summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
Diffstat (limited to 'Master')
-rw-r--r--Master/tlpkg/dev/tlmgrgui2.pl129
1 files changed, 78 insertions, 51 deletions
diff --git a/Master/tlpkg/dev/tlmgrgui2.pl b/Master/tlpkg/dev/tlmgrgui2.pl
index f9320654fde..fcc71932255 100644
--- a/Master/tlpkg/dev/tlmgrgui2.pl
+++ b/Master/tlpkg/dev/tlmgrgui2.pl
@@ -10,9 +10,8 @@
#
# TODO: Fix return codes of execute_action sub items and execute_action
# so that we can give a decent warning window
-# TODO: Move link target display into a separate window that is
-# reachable from Menu->Options->Path adjustments ...
-# (Different for Windows and Unix)
+# TODO: implement path adjustment also for Windows
+# TODO: make the path adjustment dialog for Unix a bit nicer
$^W = 1;
use strict;
@@ -192,7 +191,7 @@ $menu_file->add('command', -label => __("Load default net repository:") . " $TeX
run_update_functions();
});
$menu_file->add('command', -label => __("Load other repository ..."),
- -command => sub { menu_edit_location(); });
+ -command => \&cb_edit_location);
$menu_file->add('separator');
$menu_file->add('command', -label => __("Quit"),
-command => sub { $mw->destroy; exit(0); });
@@ -248,22 +247,10 @@ $menu_actions->add('command', -label => __("Update font map database"),
});
if (!win32()) {
- $menu_actions->add('command', -label => __("Update symbolic links"),
+ $menu_actions->add('command',
+ -label => __("Handle symlinks in system dirs") . " ...",
-state => $::action_button_state,
- -command => sub {
- $mw->Busy(-recurse => 1);
- info("Updating symlinks ...\n");
- execute_action_gui("path", "add");
- $mw->Unbusy;
- });
- $menu_actions->add('command', -label => __("Remove symbolic links"),
- -state => $::action_button_state,
- -command => sub {
- $mw->Busy(-recurse => 1);
- info("Removing symlinks ...\n");
- execute_action_gui("path", "remove");
- $mw->Unbusy;
- });
+ -command => \&cb_handle_symlinks);
}
if (!win32()) {
$menu_actions->add('separator');
@@ -887,13 +874,6 @@ sub init_defaults_setting {
$defaults{$key} = $localtlpdb->option($key);
}
}
-}
-
-sub do_general_settings {
- my $sw = $mw->Toplevel(-title => __("General options"));
- $sw->transient($mw);
- $sw->grab();
- init_defaults_setting();
%changeddefaults = ();
for my $k (keys %defaults) {
$changeddefaults{$k}{'value'} = $defaults{$k};
@@ -907,6 +887,13 @@ sub do_general_settings {
}
}
}
+}
+
+sub do_general_settings {
+ my $sw = $mw->Toplevel(-title => __("General options"));
+ $sw->transient($mw);
+ $sw->grab();
+ init_defaults_setting();
my @config_set_l;
my @config_set_m;
@@ -979,14 +966,7 @@ sub do_general_settings {
$back_config_set->Label(-textvariable => \$changeddefaults{"sys_bin"}{'display'});
push @config_set_r,
$back_config_set->Button(-text => __("Change"),
- -command => sub {
- my $dir = $sw->chooseDirectory();
- if (defined($dir) && ($defaults{"sys_bin"} ne $dir)) {
- # see warning concerning UTF8 or other encoded dir names!!
- $changeddefaults{"sys_bin"}{'value'} = $dir;
- $changeddefaults{"sys_bin"}{'display'} = $dir;
- }
- });
+ -command => sub { edit_link_dir($sw, "sys_bin"); });
push @config_set_l,
$back_config_set->Label(-text => __("Link destination for info docs"), -anchor => "w");
@@ -994,14 +974,7 @@ sub do_general_settings {
$back_config_set->Label(-textvariable => \$changeddefaults{"sys_info"}{'display'});
push @config_set_r,
$back_config_set->Button(-text => __("Change"),
- -command => sub {
- my $dir = $sw->chooseDirectory();
- if (defined($dir) && ($defaults{"sys_info"} ne $dir)) {
- # see warning concerning UTF8 or other encoded dir names!!
- $changeddefaults{"sys_info"}{'value'} = $dir;
- $changeddefaults{"sys_info"}{'display'} = $dir;
- }
- });
+ -command => sub { edit_link_dir($sw, "sys_info"); });
push @config_set_l,
$back_config_set->Label(-text => __("Link destination for man pages"), -anchor => "w");
@@ -1009,14 +982,7 @@ sub do_general_settings {
$back_config_set->Label(-textvariable => \$changeddefaults{"sys_man"}{'display'});
push @config_set_r,
$back_config_set->Button(-text => __("Change"),
- -command => sub {
- my $dir = $sw->chooseDirectory();
- if (defined($dir) && ($defaults{"sys_man"} ne $dir)) {
- # see warning concerning UTF8 or other encoded dir names!!
- $changeddefaults{"sys_man"}{'value'} = $dir;
- $changeddefaults{"sys_man"}{'display'} = $dir;
- }
- });
+ -command => sub { edit_link_dir($sw, "sys_man"); });
}
if (win32()) {
@@ -1706,7 +1672,68 @@ sub currmem {
}
-sub menu_edit_location {
+sub cb_handle_symlinks {
+ my $sw = $mw->Toplevel(-title => __("Handle symlinks in system dirs"));
+ $sw->transient($mw);
+ $sw->grab;
+ init_defaults_setting();
+
+ my $tp = $sw->Frame;
+ $tp->pack(-ipadx => '3m', -ipady => '3m');
+ $tp->Label(-text => __("Link destination for programs"), @a_w)->grid(
+ $tp->Label(-textvariable => \$changeddefaults{"sys_bin"}{'display'}, @a_w),
+ $tp->Button(-text => __("Change"),
+ -command => sub { edit_link_dir($sw, "sys_bin"); }),
+ -sticky => 'w');
+ $tp->Label(-text => __("Link destination for info docs"), @a_w)->grid(
+ $tp->Label(-textvariable => \$changeddefaults{"sys_info"}{'display'}, @a_w),
+ $tp->Button(-text => __("Change"),
+ -command => sub { edit_link_dir($sw, "sys_info"); }),
+ -sticky => 'w');
+ $tp->Label(-text => __("Link destination for man pages"), @a_w)->grid(
+ $tp->Label(-textvariable => \$changeddefaults{"sys_man"}{'display'}, @a_w),
+ $tp->Button(-text => __("Change"),
+ -command => sub { edit_link_dir($sw, "sys_man"); }),
+ -sticky => 'w');
+
+ my $md = $sw->Frame;
+ $md->pack(-ipadx => '3m', -ipady => '3m');
+ $md->Button(-text => __("Update symbolic links"),
+ -command => sub {
+ $mw->Busy(-recurse => 1);
+ info("Updating symlinks ...\n");
+ execute_action_gui("path", "add");
+ $mw->Unbusy;
+ })->pack(@left, -padx => '3m');
+ $md->Button(-text => __("Remove symbolic links"),
+ -command => sub {
+ $mw->Busy(-recurse => 1);
+ info("Removing symlinks ...\n");
+ execute_action_gui("path", "remove");
+ $mw->Unbusy;
+ })->pack(@left, -padx => '3m');
+
+ my $bt = $sw->Frame;
+ $bt->pack(-ipadx => '3m', -ipady => '3m');
+ $bt->Button(-text => __("Ok"),
+ -command => sub { apply_settings_changes(); $sw->destroy; })
+ ->pack(@left, -padx => '3m');
+ $bt->Button(-text => __("Cancel"),
+ -command => sub { $sw->destroy; })->pack(-side => 'left', -padx => "3m");
+}
+
+sub edit_link_dir {
+ my $sw = shift;
+ my $what = shift;
+ my $dir = $sw->chooseDirectory();
+ if (defined($dir) && ($defaults{$what} ne $dir)) {
+ # see warning concerning UTF8 or other encoded dir names!!
+ $changeddefaults{$what}{'value'} = $dir;
+ $changeddefaults{$what}{'display'} = $dir;
+ }
+}
+
+sub cb_edit_location {
my $key = shift;
my $val;
my $sw = $mw->Toplevel(-title => __("Load package repository"));