From 94e22e394b1dff9b67fc51024c30ad93cc20b785 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 26 Sep 2008 16:13:50 +0000 Subject: enable to disable backups git-svn-id: http://svn.mandriva.com/svn/soft/draksnapshot/trunk@246754 99302b65-d5f7-0310-b3dd-f8cd6f4e3d94 --- draksnapshot-config | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'draksnapshot-config') 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, -- cgit v1.2.1