From 5670fbaf6c0f35e7acba17dd3663df1aa2ae9720 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 26 Jan 2009 19:32:44 +0000 Subject: tlmgr: implement GUI access to autobackup and backupdir git-svn-id: svn://tug.org/texlive/trunk@11983 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf/scripts/texlive/tlmgrgui/gui-config.pl | 54 +++++++++++++++++----- 1 file changed, 43 insertions(+), 11 deletions(-) (limited to 'Master') diff --git a/Master/texmf/scripts/texlive/tlmgrgui/gui-config.pl b/Master/texmf/scripts/texlive/tlmgrgui/gui-config.pl index 75e9e98f039..a90e33535e2 100644 --- a/Master/texmf/scripts/texlive/tlmgrgui/gui-config.pl +++ b/Master/texmf/scripts/texlive/tlmgrgui/gui-config.pl @@ -45,21 +45,20 @@ my $back_config_set_r4 = $back_config_set->Button(-text => ___"toggle", my $back_config_set_l5 = $back_config_set->Label(-text => ___"backupdir", -anchor => "w"); my $back_config_set_m5 = $back_config_set->Label(-textvariable => \$default_backupdir); my $back_config_set_r5 = $back_config_set->Button(-text => ___"change", - -command => sub { - $mw->Dialog(-title => "not implemented", - -text => "changing backupdir setting not implemented", - -buttons => [ "ok" ])->Show; - info("Not implemented!\n"); return; change_backupdir(); }); + -command => sub { + my $dir = $back_config->chooseDirectory(); + if (defined($dir) && ($default_backupdir ne $dir)) { + # see warning concerning UTF8 or other encoded dir names!! + $localtlpdb->option("backupdir", $dir); + $default_backupdir = $dir; + $localtlpdb->save; + } + }); my $back_config_set_l6 = $back_config_set->Label(-text => ___"autobackup", -anchor => "w"); my $back_config_set_m6 = $back_config_set->Label(-textvariable => \$default_autobackup); my $back_config_set_r6 = $back_config_set->Button(-text => ___"change", - -command => sub { - $mw->Dialog(-title => "not implemented", - -text => "changing autobackup setting not implemented", - -buttons => [ "ok" ])->Show; - info("Not implemented!\n"); return; change_autobackup(); }); - + -command => sub { select_autobackup($p); }, -anchor => "w"); $back_config_set_l1->grid( $back_config_set_m1, $back_config_set_r1, -padx => "2m", -pady => "2m", -sticky => "nwe"); @@ -259,6 +258,39 @@ sub select_paper { $foo->bind('', [ $cancelbutton, 'Invoke' ]); } +sub select_autobackup { + my $foo = $back_config->Toplevel(-title => ___"autobackup"); + $foo->transient($mw); + $foo->grab(); + my $var = $default_autobackup; + my $opt = $foo->BrowseEntry(-label => ___"autobackup", + -variable => \$var); + my @al; + push @al, "-1 (keep arbitrarly many)"; + push @al, "0 (disable)"; + for my $i (1..100) { + push @al, $i; + } + foreach my $p (@al) { + $opt->insert("end",$p); + } + $opt->pack(-padx => "2m", -pady => "2m"); + my $f = $foo->Frame; + my $okbutton = $f->Button(-text => ___"ok", + -command => sub { + $var =~ s/ .*$//; + $localtlpdb->option("autobackup", $var); + $default_autobackup = $var; + $localtlpdb->save; + $foo->destroy; + } + )->pack(-side => "left", -padx => "2m", -pady => "2m"); + my $cancelbutton = $f->Button(-text => ___"cancel", -command => sub { $foo->destroy; })->pack(-side => "left", -padx => "2m", -pady => "2m"); + $f->pack; + $foo->bind('', [ $okbutton, 'Invoke' ]); + $foo->bind('', [ $cancelbutton, 'Invoke' ]); +} + 1; -- cgit v1.2.3