summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2004-02-26 15:32:44 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2004-02-26 15:32:44 +0000
commite9b11232bd2692078637917bb6db352208cfc1d9 (patch)
treefaaae9d8a4733ed57fec6a8be31aa7c3254fccaf
parentf0c188ca45451b616546deb0345519675075d240 (diff)
downloadcontrol-center-e9b11232bd2692078637917bb6db352208cfc1d9.tar
control-center-e9b11232bd2692078637917bb6db352208cfc1d9.tar.gz
control-center-e9b11232bd2692078637917bb6db352208cfc1d9.tar.bz2
control-center-e9b11232bd2692078637917bb6db352208cfc1d9.tar.xz
control-center-e9b11232bd2692078637917bb6db352208cfc1d9.zip
- clean wait_area structure: use a single drawing_area instead of lot
of boxes (needed in order to alter background) - do fading from current theme entry color to current theme background color in run area while starting the tool
-rwxr-xr-xcontrol-center67
1 files changed, 37 insertions, 30 deletions
diff --git a/control-center b/control-center
index bbc738ac..7bc42bf2 100755
--- a/control-center
+++ b/control-center
@@ -507,23 +507,9 @@ gtkadd($window_global,
0, my $banner_notebook = Gtk2::Notebook->new,
0, Gtk2::HSeparator->new,
1, my $notebook_global = gtkset_name(Gtk2::Notebook->new, 'mcc'),
- 1, gtkset_name(
- # FIXME: move emb_frame as a notebook page instead
- gtkadd(my $emb_frame = Gtk2::EventBox->new,
- gtkpack_(my $emb_box = Gtk2::VBox->new(0, 0),
- 1, gtkpack_(my $emb_wait = Gtk2::VBox->new(0, 0),
- 1, Gtk2::HBox->new(0, 0),
- 0, gtkpack_(Gtk2::HBox->new(0, 0),
- 1, Gtk2::VBox->new(0, 0),
- 0, my $run_darea = gtkset_size_request(Gtk2::DrawingArea->new, 128, 128),
- 1, Gtk2::VBox->new(0, 0),
- ),
- 0, Gtk2::Label->new(N("Please wait...")),
- 1, Gtk2::HBox->new(0, 0),
- ),
- ),
- ),
- 'mcc'),
+ 1, gtkpack(my $emb_box = Gtk2::VBox->new(0, 0),
+ my $run_darea = Gtk2::DrawingArea->new,
+ ),
0, Gtk2::HSeparator->new,
),
0, my $buttons = gtkadd(gtkset_layout(Gtk2::HButtonBox->new, 'start'),
@@ -560,7 +546,7 @@ foreach my $notebook ($notebook_global, $banner_notebook) {
# banner :
-add2notebook($banner_notebook, "", Gtk2::Banner->new("/usr/share/icons/large/drakconf.png",
+add2notebook($banner_notebook, "", my $ban = Gtk2::Banner->new("/usr/share/icons/large/drakconf.png",
N("Welcome to the Mandrake Control Center")));
@@ -652,8 +638,6 @@ gtkadd($main_page,
);
-#$emb_frame->set_size_request(-1, $index * 50);
-
foreach (keys %check_boxes) {
my $widget = $check_boxes{$_};
if (defined $widget) {
@@ -668,10 +652,20 @@ foreach (keys %check_boxes) {
my ($run_pixbuf, $run_counter, $run_counter_add);
$run_darea->signal_connect(expose_event => sub {
+ return if !$run_darea->realized;
return unless $run_pixbuf; # some people got an expose event before we start an embedded tool
+ $run_darea->{layout} ||= $run_darea->create_pango_layout(N("Loading... Please wait"));
my $pixbuf = render_alpha($run_pixbuf, $run_counter);
+ my $size = $run_darea->allocation;
+ my ($d_width, $d_height) = ($size->width, $size->height);
my ($window, $gc, $width, $height) = ($run_darea->window, $run_darea->style->fg_gc('normal'), $pixbuf->get_width, $pixbuf->get_height);
- $pixbuf->render_to_drawable($window, $gc, 0, 0, 0, 0, $width, $height, 'normal', 0, 0);
+ my ($txt_width, $txt_height) = $run_darea->{layout}->get_pixel_size;
+ my ($y_icon, $x_icon) = (($d_width - $width)/2, ($d_height - $height - $txt_height)/2);
+ my ($y_text, $x_text) = ($y_icon, $x_icon + $width + 5);
+
+ $pixbuf->render_to_drawable($window, $gc, 0, 0, $y_icon, $x_icon, $width, $height, 'normal', 0, 0);
+ my $style = $run_darea->{style} ||= $run_darea->get_style;
+ $run_darea->window->draw_layout($style->text_gc('normal'), $y_text + $width/2 - $txt_width/2, $x_text, $run_darea->{layout});
$run_counter += $run_counter_add;
$run_counter_add = -$run_counter_add if $run_counter < 100 || 245 < $run_counter;
});
@@ -686,7 +680,7 @@ $notebook_global->signal_connect(switch_page => sub {
$window_global->show_all;
show_hide_previous(0);
-$emb_frame->hide;
+$emb_box->hide;
$SIG{USR1} = 'IGNORE';
$SIG{USR2} = 'IGNORE';
@@ -730,8 +724,7 @@ sub child_just_exited() {
$emb_socket->destroy;
undef $emb_socket;
}
- $emb_frame->hide;
- $emb_wait->hide;
+ $emb_box->hide;
show_hide_previous(1);
$cancel->hide;
gtkset_mousecursor_normal();
@@ -743,7 +736,7 @@ sub child_just_exited() {
}
sub hide_socket_and_clean() {
- $emb_frame->hide;
+ $emb_box->hide;
$pending_app = 0;
}
@@ -752,7 +745,7 @@ sub create_hidden_socket() {
# signal emitted when embedded apps begin to draw:
$emb_socket->signal_connect('plug-added' => sub {
$left_locked = 0;
- $emb_wait->hide;
+ $run_darea->hide;
show_hide_previous(0);
$buttons->hide;
return if !$emb_socket;
@@ -763,7 +756,7 @@ sub create_hidden_socket() {
});
$emb_box->set_focus_child($emb_socket);
$emb_socket->hide;
- $emb_wait->hide;
+ $run_darea->hide;
}
@@ -805,18 +798,32 @@ sub compute_exec_string {
$notebook->hide;
}
create_hidden_socket();
- $emb_frame->show;
+ $emb_box->show;
$emb_socket->realize;
$pending_app = 1;
if ($gtkplug > 0) {
$exec .= " --embedded " . $emb_socket->get_id;
- $emb_wait->show;
+ $run_darea->show;
$cancel->show;
$previous->hide;
$run_pixbuf = gtkcreate_pixbuf($icon . "_128");
$run_counter = 255;
$run_counter_add = -10;
- $timeout = Glib::Timeout->add(70, sub { $run_darea->queue_draw; 1 });
+ $timeout = Glib::Timeout->add(35, sub {
+ my $style = $run_darea->{style} ||= $run_darea->get_style;
+ my $bg = $run_darea->{bg} ||= $style->bg('normal');
+ my $base = $run_darea->{base} ||= $style->base('normal');
+ my $color = $run_darea->{color} ||= $base;
+ # $base -> $bg
+ $run_darea->window->set_background($color);
+ $run_darea->{color} = gtkcolor(map { $_->[0] - min(500, $_->[0] - $_->[1]) }
+ ([ $color->red, $bg->red ],
+ [ $color->green, $bg->green ],
+ [ $color->blue, $bg->blue ])
+ );
+ $run_darea->queue_draw;
+ 1;
+ });
$left_locked = 1;
$tool_pids{$label} = fork_($exec);
} else { # gtkplug == 0