summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2009-01-26 19:32:44 +0000
committerNorbert Preining <preining@logic.at>2009-01-26 19:32:44 +0000
commit5670fbaf6c0f35e7acba17dd3663df1aa2ae9720 (patch)
tree6ce5569baa38d3a290003fe5114d3995b3d63258
parenta356cc0c3a89f2873eab3cb36816f69b925afd12 (diff)
tlmgr: implement GUI access to autobackup and backupdir
git-svn-id: svn://tug.org/texlive/trunk@11983 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf/scripts/texlive/tlmgrgui/gui-config.pl54
1 files changed, 43 insertions, 11 deletions
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('<Escape>', [ $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('<Return>', [ $okbutton, 'Invoke' ]);
+ $foo->bind('<Escape>', [ $cancelbutton, 'Invoke' ]);
+}
+
1;