diff options
author | tv <tv@99302b65-d5f7-0310-b3dd-f8cd6f4e3d94> | 2008-09-26 16:13:50 +0000 |
---|---|---|
committer | tv <tv@99302b65-d5f7-0310-b3dd-f8cd6f4e3d94> | 2008-09-26 16:13:50 +0000 |
commit | 94e22e394b1dff9b67fc51024c30ad93cc20b785 (patch) | |
tree | c6752acffd222fab56bd072eac72339a0d5fdd4f /draksnapshot-config | |
parent | 67dab3d92e440864d2dfd93c885bdb5518363ea3 (diff) | |
download | draksnapshot-94e22e394b1dff9b67fc51024c30ad93cc20b785.tar draksnapshot-94e22e394b1dff9b67fc51024c30ad93cc20b785.tar.gz draksnapshot-94e22e394b1dff9b67fc51024c30ad93cc20b785.tar.bz2 draksnapshot-94e22e394b1dff9b67fc51024c30ad93cc20b785.tar.xz draksnapshot-94e22e394b1dff9b67fc51024c30ad93cc20b785.zip |
enable to disable backups
git-svn-id: http://svn.mandriva.com/svn/soft/draksnapshot/trunk@246754 99302b65-d5f7-0310-b3dd-f8cd6f4e3d94
Diffstat (limited to 'draksnapshot-config')
-rwxr-xr-x | draksnapshot-config | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/draksnapshot-config b/draksnapshot-config index 94f573b..95c6546 100755 --- a/draksnapshot-config +++ b/draksnapshot-config @@ -118,12 +118,23 @@ gtkadd($dialog->{rwindow}, ]), ])); -my $button; +my $is_enabled = to_bool(glob("/etc/cron.*/rsnapshot")); + +my ($box, $button); gtkadd($my_win->{window}, gtknew('VBox', children => [ if_(!$::isEmbedded, 0, Gtk2::Banner->new('draksnapshot-big', N("Backup snapshots configuration"))), 0, gtknew('Title1', label => N("Settings")), + 0, gtknew('CheckButton', text => N("Enable Backups"), active_ref => \$is_enabled, + toggled => sub { + my ($w) = @_; + warn "===>>> !$w || !$box\n"; + return if !$w || !$box; + warn "set to " . to_bool($w->get_active) . "\n"; + $box->set_sensitive($w->get_active); + }), + 0, $box = gtknew('VBox', sensitive => $is_enabled, children => [ 0, gtknew('CheckButton', text => N("Backup the whole system"), toggled => sub { my ($w) = @_; @@ -169,6 +180,7 @@ gtkadd($my_win->{window}, ])), 0, $button = gtknew('Install_Button', text => N("Advanced"), clicked => sub { $d_window->show }), + ]), 0, gtknew('HButtonBox', layout => 'end', border_width => 5, spacing => 5, children_loose => [ gtknew('Button', text => N("Apply"), clicked => \&save), gtknew('Button', text => $::isEmbedded ? N("Cancel") : N("Close"), clicked => sub { save(); quit() }) @@ -314,6 +326,11 @@ sub generate_cron_entry() { my $cron_file = "$::prefix/etc/cron.\%s/rsnapshot"; + if (!$is_enabled) { # Mandriva defaults + unlink(sprintf($cron_file, $_)) foreach qw(hourly daily weekly monthly); + return; + } + foreach my $type (qw(hourly daily weekly monthly)) { my $file = sprintf($cron_file, $type); output_with_perm($file, 0755, |