summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2002-12-20 16:37:07 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2002-12-20 16:37:07 +0000
commit8ea5e90c9318fda21a5d6cea0cfef628ce75b6c4 (patch)
tree557434f070bbbbcd7bd6f3e204b8b621a46f0f07
parent5698207463d5140fd7d0c40d54f16f69ad10e280 (diff)
downloadcontrol-center-8ea5e90c9318fda21a5d6cea0cfef628ce75b6c4.tar
control-center-8ea5e90c9318fda21a5d6cea0cfef628ce75b6c4.tar.gz
control-center-8ea5e90c9318fda21a5d6cea0cfef628ce75b6c4.tar.bz2
control-center-8ea5e90c9318fda21a5d6cea0cfef628ce75b6c4.tar.xz
control-center-8ea5e90c9318fda21a5d6cea0cfef628ce75b6c4.zip
- add a default value for old users that did not have the expert
option for drakwizard saved - don't print warnings while the main window is not yet up - just catch exceptions if translations're broken or options're missing - center left icons - make left icons bigger on selection - use MDK::Common rather than POSIX for math - better reaping of dead zombies sub processes: o non blocking reaping o reap all dead children - better error message on error faillure
-rwxr-xr-xcontrol-center67
1 files changed, 44 insertions, 23 deletions
diff --git a/control-center b/control-center
index 8a4c570e..b63d65bf 100755
--- a/control-center
+++ b/control-center
@@ -52,6 +52,7 @@ my %class = getVarsFromSh($class_install);
$h{THEME} ||= 'default';
$h{EMBEDDED} ||= bool2text(1);
$h{LOGS} ||= bool2text($class{CLASS} eq 'expert' ? 1 : 0);
+$h{EXPERT_WIZARD} ||= 0;
my ($embedded, $show_logs, $expert_wizard) = (text2bool($h{EMBEDDED}), text2bool($h{LOGS}), text2bool($h{EXPERT_WIZARD}));
my $theme = $h{THEME};
if ("@ARGV" =~ /--theme (\w+)/) { $theme = $1 }
@@ -285,6 +286,7 @@ my ($menu, $factory) = create_factory_menu($window_global,
$embedded = $embedded_check_box->active;
if ($embedded) {
$embedded = 0;
+ return if $window_splash;
splash_warning(N("Embedding support is currently broken as of Gtk+-2.1.5."));
}
}
@@ -373,6 +375,7 @@ $summary->set_has_window(1);
$notebook_global->append_page(gtksignal_connect($summary, realize => sub { set_back_pixbuf($summary, gtkcreate_pixbuf("mcc-splash")) }));
use POSIX qw(:sys_utsname_h :math_h);
+
my (undef, $nodename, $release, undef, $machine) = POSIX::uname();
$summary->put(gtkmodify_font(Gtk2::Label->new(N("Welcome to the Mandrake Control Center")), Gtk2::Pango::FontDescription->from_string('15')),
80, 115); # FIXME: better center it at realize time @(summary->width - (vbox->width/2), summary->height - (vbox->height/2) )
@@ -396,9 +399,11 @@ my $index_sav = -1;
my (@curr_state, @old_state);
my ($d_width, $d_height) = (160, 44);
-my @colors = (gtkcolor(0, 0, 0), gtkcolor(0xAA, 0xAA, 0xFF), gtkcolor(0, 0, 0));
+my @colors = (gtkcolor(0, 0, 0), gtkcolor(0xAA, 0xAA, 0xFF), gtkcolor(0, 0, 0));
my $spacing = 25;
-my ($lspacing, $txt_offset);
+my $scale = 4;
+my (@lspacing, $txt_offset);
+my $top_lspacing = 4;
# Create left icons
foreach (@tree) {
@@ -411,14 +416,15 @@ foreach (@tree) {
my $icon_pixbuf = gtkcreate_pixbuf($icon);
my ($icon_width, $icon_height) = ($icon_pixbuf->get_width, $icon_pixbuf->get_height);
- if (!defined $lspacing) {
-# $lspacing = ceil(($d_height-$icon_height)/2);
- $lspacing = ($d_height-$icon_height)/2;
+ unless (@lspacing) {
+# $lspacing = round_up(($d_height-$icon_height)/2, 1);
+ my $lspacing = ($d_height-$icon_height)/2;
$txt_offset = $lspacing * 2 + $icon_width;
- $lspacing = ceil($lspacing);
+ $lspacing = round_up($lspacing, 1);
+ @lspacing = ($lspacing, $lspacing+$scale/2, $lspacing);
}
- my @icon_pixbufs = ($icon_pixbuf, render_shiner($icon_pixbuf, 1.89), $icon_pixbuf);
+ my @icon_pixbufs = ($icon_pixbuf, scale(render_shiner($icon_pixbuf, 1.89), $scale), $icon_pixbuf);
my @fonts = map { Gtk2::Pango::FontDescription->from_string($_) } '', 'Bold', 'Bold';
my ($lines, $widths, $heights, @dbl_area_left);
@@ -433,11 +439,13 @@ foreach (@tree) {
my ($x, $y, $width, $height) = $full_redraw ? (0, 0, $d_width, $d_height) : $event->area->values;
# Redraw double buffer on first expose in that particular state (selected <=> not selected): render background, then icon, then text
unless ($dbl_area_left[$curr_state]) {
+ my $extra = $curr_state == 1 ? $scale : 0;
my $window = $darea_left->window;
+ my $lspacing = $lspacing[$curr_state];
$dbl_area_left[$curr_state] = Gtk2::Gdk::Pixmap->new($window, $d_width, $d_height, $window->get_depth);
my $gc = $darea_left->style->fg_gc('normal');
$left_back_pixbuf[$curr_state]->render_to_drawable($dbl_area_left[$curr_state], $gc, 0, 0, 0, 0, $back_width, $back_height, 'normal', 0, 0);
- $icon_pixbufs[$curr_state]->render_to_drawable($dbl_area_left[$curr_state], $gc, 0, 0, $lspacing, $lspacing+2, $icon_width, $icon_height, 'normal', 0, 0);
+ $icon_pixbufs[$curr_state]->render_to_drawable($dbl_area_left[$curr_state], $gc, 0, 0, $lspacing-$extra, $top_lspacing-$extra/2, $icon_width+$extra, $icon_height+$extra, 'normal', 0, 0);
$darea_left->style->black_gc->set_rgb_fg_color($colors[$curr_state]);
# $darea_left->style->black_gc->set_fg_gc('normal', $colors[$curr_state]);
# $darea_left->style->set_rgb_fg_color($colors[$curr_state]);
@@ -508,8 +516,8 @@ foreach (@tree) {
gtkpack(Gtk2::HBox->new(0, 0),
$event_box,
- gtkset_size_request(gtktext_insert(Gtk2::TextView->new, [ [ $text, {'background_set' => 0, 'background_stipple_set' => 0 } ] ]), ($global_width-$d_width-$icon_width-$spacing*4-5)/2, -1)
-# gtkset_size_request(Gtk2::Label->new($text), ($global_width-$d_width-$icon_width-95)/2, -1)
+ gtkset_size_request(gtktext_insert(Gtk2::TextView->new, [ [ $text, {'background_set' => 0, 'background_stipple_set' => 0 } ] ]), ($global_width-$d_width-$icon->get_pixbuf->get_width-$spacing*4-5)/2, -1)
+# gtkset_size_request(Gtk2::Label->new($text), ($global_width-$d_width-$icon->get_width-95)/2, -1)
);
} @$subtree)),
0, $spacing),
@@ -538,11 +546,14 @@ sub update_exp {
$emb_box->set_size_request(-1, $index * 50);
-if (defined $show_log_check_box) {
- $show_log_check_box->set_active($show_logs);
- $embedded_check_box->set_active($embedded);
- $expert_wizard_check_box->set_active($expert_wizard);
-} else { print STDERR "BUG with LANGUAGE $ENV{LANGUAGE}\n" }
+eval {
+ if (defined $show_log_check_box) {
+ $show_log_check_box->set_active($show_logs);
+ $embedded_check_box->set_active($embedded);
+ $expert_wizard_check_box->set_active($expert_wizard);
+ };
+};
+print STDERR "BUG with LANGUAGE $ENV{LANGUAGE}\n" if $@;
create_hidden_socket_if_needed();
@@ -568,7 +579,7 @@ gtkflush();
$notebook_global->set_current_page(0);
$notebook_global->signal_connect(switch_page => sub {
- my (undef, $tab_widget, $tab_number) = @_;
+ my (undef, undef, $tab_number) = @_;
return unless $tab_number > 0;
});
@@ -583,12 +594,15 @@ $SIG{CHLD} = \&sig_child;
$SIG{CONT} = sub { Gtk2->main };
$window_splash->destroy;
+undef $window_splash;
eval { Gtk2->main } while 1;
# got when child unexpectedly died and gone in zombie state
sub sig_child {
- wait(); # reap zombies
+ # reap zombies
+ my $kid;
+ do { $kid = waitpid(-1, 'WNOHANG') } until $kid > 0;
return unless $left_locked;
kill('USR1', $$);
splash_warning(N("This program was abnomarly exited"));
@@ -622,7 +636,7 @@ sub fork_ {
my ($prog, $do_not_kill) = @_;
my $pid;
unless ($pid = fork()) {
- splash_warning(N("cannot fork: %s", $~)) unless defined $pid;
+ splash_warning(N("cannot fork: %s", "$!")) unless defined $pid;
exec($prog);
}
return if $do_not_kill;
@@ -683,7 +697,7 @@ sub compute_exec_string {
if ($exec =~ /(drakfont|drakconnect|drakboot)/) { $exp_frame->hide } # $window_global->height < 600
# fork_($exec_log, 1);
unless ($pid = fork()) {
- splash_warning(N("cannot fork: %s", $~)) unless defined $pid;
+ splash_warning(N("cannot fork: %s", "$!")) unless defined $pid;
exec($exec_log);
}
push @pid_exp, $pid;
@@ -845,7 +859,7 @@ sub connect_to_site {
if ($help) {
fork_("$browser $link &");
} else {
- if ($initial_user ne "root" && $initial_user ne undef) {
+ if ($initial_user && $initial_user ne "root") {
fork_("su -m -l $initial_user -c \"$browser $link &\"");
} else {
splash_warning(" ".N("Security Warning: I'm not allowed to connect to the internet as root user")." ");
@@ -862,8 +876,9 @@ sub set_page {
sub new_pixbuf {
- my ($pixbuf) = @_;
- my ($width, $height) = ($pixbuf->get_height, $pixbuf->get_width);
+ my ($pixbuf, $width, $height) = @_;
+ $width ||= $pixbuf->get_height;
+ $height ||= $pixbuf->get_width;
my $new_pixbuf = Gtk2::Gdk::Pixbuf->new('rgb', 1, 8, $height, $width);
$new_pixbuf->fill(0x00000000); # transparent white
$width, $height, $new_pixbuf;
@@ -876,10 +891,16 @@ sub render_alpha {
$new_pixbuf;
}
-
sub render_shiner {
my ($pixbuf, $shine_value) = @_;
my (undef, undef, $new_pixbuf) = new_pixbuf($pixbuf);
$pixbuf->saturate_and_pixelate($new_pixbuf, $shine_value, 0);
$new_pixbuf;
}
+
+
+sub scale {
+ my ($pixbuf, $gain) = @_;
+ my ($width, $height) = ($pixbuf->get_height, $pixbuf->get_width);
+ $pixbuf->scale_simple($height+$gain, $width+$gain, 'hyper');
+}