summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2005-02-03 10:40:20 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2005-02-03 10:40:20 +0000
commit8a8e9ec7d71b87d9dd82d9bbc625a84c88f9c1e9 (patch)
tree3674f501bf92fae78436349d8ff1e258631930ae
parentb8f66ecc767e59456dca0ab01742a7eac0f818dd (diff)
downloadcontrol-center-8a8e9ec7d71b87d9dd82d9bbc625a84c88f9c1e9.tar
control-center-8a8e9ec7d71b87d9dd82d9bbc625a84c88f9c1e9.tar.gz
control-center-8a8e9ec7d71b87d9dd82d9bbc625a84c88f9c1e9.tar.bz2
control-center-8a8e9ec7d71b87d9dd82d9bbc625a84c88f9c1e9.tar.xz
control-center-8a8e9ec7d71b87d9dd82d9bbc625a84c88f9c1e9.zip
add export mode: only show advanced tools in expert mode
-rwxr-xr-xcontrol-center52
1 files changed, 47 insertions, 5 deletions
diff --git a/control-center b/control-center
index 3293858d..f5415483 100755
--- a/control-center
+++ b/control-center
@@ -58,6 +58,7 @@ my %class = getVarsFromSh($class_install);
$h{THEME} ||= 'default';
$h{LOGS} ||= bool2text($class{CLASS} eq 'expert' ? 1 : 0);
$h{EXPERT_WIZARD} ||= 0;
+$h{EXPERT_MODE} ||= bool2text(0);
$h{HEIGTH} ||= $default_heigth;
$h{WIDTH} ||= $default_width;
$h{USE_LONG_DESCRIPTIONS} ||= 'yes';
@@ -65,6 +66,7 @@ $h{USE_LONG_DESCRIPTIONS} ||= 'yes';
my %option_values;
$option_values{use_long_dscr} = text2bool($h{USE_LONG_DESCRIPTIONS});
$option_values{show_log} = text2bool($h{LOGS});
+$option_values{expert_mode} = text2bool($h{EXPERT_MODE});
my $theme = $h{THEME};
$theme = $1 if "@ARGV" =~ /--theme (\w+)/;
my $program;
@@ -139,6 +141,7 @@ my %programs =
N("Authentication"),
long_description => N("Select the authentication method (local, NIS, LDAP, Windows Domain, ...)"),
icon => 'drakauth-mdk',
+ expert_mode => 1,
},
@@ -149,6 +152,7 @@ my %programs =
description => N("Auto Install floppy"),
long_description => N("Generate an Auto Install floppy"),
icon => 'drakautoinst-mdk',
+ expert_mode => 1,
},
@@ -362,6 +366,7 @@ my %programs =
embedded => 1,
description => N("Kolab"),
long_description => N("Set up a groupware server"),
+ expert_mode => 1,
},
@@ -405,6 +410,7 @@ my %programs =
description => N("Manage computer group"),
long_description => N("Manage installed software packages on a group of computers"),
icon => 'drakpark-mdk',
+ expert_mode => 1,
},
@@ -586,6 +592,7 @@ my %programs =
description => N("Level and checks"),
long_description => N("Set the system security level and the periodic security audit"),
icon => 'draksec-mdk',
+ expert_mode => 1,
},
@@ -596,6 +603,7 @@ my %programs =
description => N("Permissions"),
long_description => N("Fine-tune the security permissions of the system"),
icon => 'drakperm-mdk',
+ expert_mode => 1,
},
@@ -666,7 +674,7 @@ my %programs =
sub wizard_format {
map {
- my ($id, $wizard, $icon, $description, $long_description) = @$_;
+ my ($id, $wizard, $icon, $description, $long_description, $expert_mode) = @$_;
$programs{$id} =
{
binary => "$sbindir/drakwizard $wizard",
@@ -674,6 +682,7 @@ sub wizard_format {
description => $description,
long_description => $long_description,
icon => $icon,
+ expert_mode => $expert_mode,
};
$id;
@@ -712,7 +721,7 @@ my @tree =
N("Set up a web server"),
],
[ "Installation server wizard", "installsrv", 'wizard-mdk', N("Configure installation server"),
- N("Set up server for network installations of Mandrakelinux"),
+ N("Set up server for network installations of Mandrakelinux"), 1,
],
),
),
@@ -941,6 +950,7 @@ my %options = (
'show_log' => [ N("/_Options"), N("/Display _Logs") ],
'embedded_mode' => [ N("/_Options"), N("/_Embedded Mode") ],
'wiz_expert' => [ N("/_Options"), N("/Expert mode in _wizards") ],
+ 'expert_mode' => [ N("/_Options"), translate("/_Expert mode") ],
);
my %shared_translations = (
@@ -967,6 +977,14 @@ my @menu_items = (
},
undef, '<CheckItem>'
],
+ [ join('', @{$options{expert_mode}}), undef,
+ sub {
+ $option_values{expert_mode} = $check_boxes{expert_mode}->get_active;
+ refresh_tree(1);
+ # refill tree & reselect current category
+ },
+ undef, '<CheckItem>'
+ ],
if_(0 && $isWiz,
[ join('', @{$options{wiz_expert}}), undef,
sub { $option_values{expert_wizard} = $check_boxes{wiz_expert}->get_active },
@@ -1124,7 +1142,7 @@ update_profiles();
%check_boxes = map {
$_ => $factory->get_widget("<main>" . get_path(@{$options{$_}}));
-} ("show_log", if_(0 && $isWiz, "wiz_expert"));
+} ('show_log', 'expert_mode', if_(0 && $isWiz, "wiz_expert"));
gtkadd($window_global,
@@ -1200,7 +1218,17 @@ my ($index, $left_locked) = (0, 0);
my $spacing = 25;
my %tool_callbacks;
-
+
+my $page_count;
+
+sub refresh_tree {
+ my ($mode) = @_;
+ my $pos = $notebook_global->get_current_page;
+ if ($mode && $page_count) {
+ $notebook_global->window && $notebook_global->window->freeze_updates;
+ $notebook_global->remove_page(-1) foreach 0..$page_count-1;
+ $page_count = 0;
+ }
foreach (@tree) {
my ($text, $icon, $subtree) = @$_;
@@ -1208,6 +1236,7 @@ foreach (@tree) {
foreach my $stuff (@$subtree) {
my $exec = first(split /\s+/, $programs{$stuff}{binary});
next if $programs{$stuff}{hidden};
+ next if !$option_values{expert_mode} && $programs{$stuff}{expert_mode};
# do not complain about missing entries in move:
if (-x $exec) {
push @subtree, $stuff;
@@ -1266,6 +1295,7 @@ foreach (@tree) {
# b/c we use Pango text markup language, we've to protect '&' caracter:
$text =~ s/&/&amp;/g;
+ $page_count++;
gtkappend_page($notebook_global,
my $_w_ret = create_scrolled_window(gtkset_border_width($tbl, 5),
[ 'never', 'automatic' ], 'none',
@@ -1277,8 +1307,19 @@ foreach (@tree) {
);
# $w_ret->vscrollbar->set_size_request(19, undef);
- add2notebook($banner_notebook, "", Gtk2::Banner->new($icon, $text));
+ add2notebook($banner_notebook, "", Gtk2::Banner->new($icon, $text)) if !$mode;
}
+ if ($mode) {
+ $notebook_global->show_all;
+ # workaround buggy gtk+:
+ $notebook_global->set_current_page($page_count-$_-1) foreach 0..$page_count-1;
+ # restore previous position:
+ $notebook_global->set_current_page($pos);
+ $notebook_global->window && $notebook_global->window->thaw_updates;
+ }
+}
+
+refresh_tree();
my %icons = (
"Localization" => 'localedrake'
@@ -1582,6 +1623,7 @@ sub quit_global() {
setVarsInSh($conffile, {
LOGS => bool2text($option_values{show_log}),
EXPERT_WIZARD => bool2text($option_values{expert_wizard}),
+ EXPERT_MODE => bool2text($option_values{expert_mode}),
HEIGTH => $y,
WIDTH => $x,
THEME => $theme,