diff options
author | Thierry Vignaud <tvignaud@mandriva.org> | 2004-09-01 03:17:37 +0000 |
---|---|---|
committer | Thierry Vignaud <tvignaud@mandriva.org> | 2004-09-01 03:17:37 +0000 |
commit | 500a37f6c9bceb221356b5d1c4daa600722290d3 (patch) | |
tree | 9570b36398955a745a531092ebc1db24b360035d | |
parent | 924febecc82abeddeda8a8b5ee338fdb329d434e (diff) | |
download | control-center-500a37f6c9bceb221356b5d1c4daa600722290d3.tar control-center-500a37f6c9bceb221356b5d1c4daa600722290d3.tar.gz control-center-500a37f6c9bceb221356b5d1c4daa600722290d3.tar.bz2 control-center-500a37f6c9bceb221356b5d1c4daa600722290d3.tar.xz control-center-500a37f6c9bceb221356b5d1c4daa600722290d3.zip |
add support for the '--start-with=foobar' command line option that enable to
start mcc directly with specified applet
-rwxr-xr-x | control-center | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/control-center b/control-center index 811edb8c..8dcf37d8 100755 --- a/control-center +++ b/control-center @@ -64,6 +64,10 @@ my %option_values; $option_values{show_log} = text2bool($h{LOGS}); my $theme = $h{THEME}; $theme = $1 if "@ARGV" =~ /--theme (\w+)/; +my $program; +foreach (@ARGV) { + $program = $1 if /--start-with=(\w+)/; +} my ($i, $geometry); foreach (@ARGV) { @@ -620,7 +624,7 @@ my ($index, $left_locked) = (0, 0); my $spacing = 25; -my @main_icons; +my (@main_icons, %tool_callbacks); foreach (@tree) { my ($text, $icon, $subtree) = @$_; @@ -662,9 +666,14 @@ foreach (@tree) { my $text = $exec_hash->{$label}[3]; die "$label 's icon is missing" if !$exec_hash->{$label} && $::testing; my $event_box; + $tool_callbacks{$label} = sub { + # needed for --start-with parameter: + $event_box->realize; + compute_exec_string($label, $event_box, $tag, $text, @{$exec_hash->{$label}}); + }; $event_box = Gtk2::WebIcon->new($text, $tag, { - button_release_event => sub { compute_exec_string($label, $event_box, $tag, $text, @{$exec_hash->{$label}}) }, + button_release_event => $tool_callbacks{$label}, } ); $event_box->set_events([ 'enter_notify_mask', 'leave_notify_mask', 'button_press_mask', 'button_release_mask' ]); @@ -758,6 +767,15 @@ $window_splash->destroy; undef $window_splash; Glib::Timeout->add(200, sub { sig_child(1); 1 }); +if ($program) { + if (my $sub = $tool_callbacks{$program}) { + Glib::Timeout->add(500, sub { $sub->(); 0 }); + } else { + err_dialog(N("Error"), N("Impossible to run unknown '%s' program", $program)); + + } +} + Gtk2->main; |