diff options
author | Thierry Vignaud <tvignaud@mandriva.org> | 2002-09-06 07:43:15 +0000 |
---|---|---|
committer | Thierry Vignaud <tvignaud@mandriva.org> | 2002-09-06 07:43:15 +0000 |
commit | 343c237363aafe7d9a8ee505ea1629d562ff3f29 (patch) | |
tree | fd837cf2fc236fd2457afe56957246bc9889e247 | |
parent | 02de44c4ff7a912afecc7a2278ee99203d1e2d78 (diff) | |
download | control-center-343c237363aafe7d9a8ee505ea1629d562ff3f29.tar control-center-343c237363aafe7d9a8ee505ea1629d562ff3f29.tar.gz control-center-343c237363aafe7d9a8ee505ea1629d562ff3f29.tar.bz2 control-center-343c237363aafe7d9a8ee505ea1629d562ff3f29.tar.xz control-center-343c237363aafe7d9a8ee505ea1629d562ff3f29.zip |
- ugtk::gtkicons_labels_widget() :
o pass icon name in $tag to $exec_func so that the later can display
big icon
o $label_exec is a duplicate of $label
o simplify notebook redrawing:
* remove dam'sugly hacks
* $redraw_function->() : resize Gtk::Fixed on first run if more
than 4 icons
* redraw in only one place
* don't redraw on realize event
(now we both don't flick and have proper icon alignment without
old hacks)
- mcc:
o print big icon while launching a tool (anim in next commit)
o move todo list in TODO
o stricter check:
* default to use strict
* disable strict mode when building rpm
* fixes for 'use strict'
o kill :
* a debugging print
* a superflous 'no warnings'
* a title->show since we never hide it
* $rootheight since gtk packer do the job for us
* unused $nb_pages
o begin to un-hardcode some values (window and notebook size, ...)
o cosmetics:
* comment some code
* add myself to authors list (deush, you should add yourself too
since you're the localedrake/mcc interaction guru)
* s/darea1/summary_darea/
o don't display logs when back in main summary
o destroy pixbuf after
-rw-r--r-- | TODO | 13 | ||||
-rwxr-xr-x | control-center | 100 | ||||
-rw-r--r-- | drakconf.spec | 1 |
3 files changed, 72 insertions, 42 deletions
@@ -1,2 +1,11 @@ -+ integrate wizard tool -- xinerama compliant: look in gdm
\ No newline at end of file +TODO: +- banner: don't put background under title, just render it with alpha blending +- limit running apps to one if not embedded ? +- trap kill => kill pending apps +- fixed resizing hack: don't do it if less that 5 icons +- consolidate gdk-pixbuf code +- once perl-gtk for gtk+2 is there, use a Gtk::Table (or better gimp widget for + its tool icons table) filled with Gtk::Image, thus killing lot of code (dbl* + buffers, rerending, alpha blending, ...) +- add mmc theme so that drakx tools get mcc background +- xinerama compliant: look in gdm diff --git a/control-center b/control-center index a5223a48..22f10d0a 100755 --- a/control-center +++ b/control-center @@ -18,7 +18,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# TODO: once perl-gtk for gtk+2 is there, use a Gtk::Table filled with Gtk::Image, thus killing lot of code my $_xbindir = "/usr/X11R6/bin"; my $_bindir = "/usr/bin"; @@ -37,7 +36,7 @@ use interactive; use detect_devices; use my_gtk qw(:helpers :wrappers :various); use ugtk qw(:helpers :wrappers :various); -#use strict; +use strict; # set the locale, needed for proper fontset and charset selection Gtk->set_locale; @@ -81,7 +80,7 @@ Gtk->timeout_add(100, sub{ 1 }); my $rc = "$mcc_dir/$theme/gtkrc"; -r $rc and Gtk::Rc->parse($rc); -my ($log_check_box, $embedded_check_box); +my ($log_check_box, $embedded_check_box, $timeout); $::isWiz = -e "/usr/sbin/drakwizard"; $::isRpmDrake = -e "/usr/sbin/rpmdrake"; @@ -261,8 +260,8 @@ my @tree = #------------------------------------------------------------- -my $nb_pages = 0; my $window_global = new Gtk::Window -toplevel; +my ($pixmap_back_right, undef) = gtkcreate_png('mcc-core-back'); $window_global->signal_connect (delete_event => \&quit_global); $window_global->set_title(_("Mandrake Control Center %s", $_version)); $window_global->set_policy(0, 1, 1); @@ -280,6 +279,7 @@ my $back; ($back->[0], undef) = gtkcreate_png('mcc-left-back'); $back->[1] = $back->[0]; ($back->[2], undef) = gtkcreate_png('mcc-left-back2'); +# Create left icons foreach (@tree) { $index++; my $index = $index; @@ -334,7 +334,7 @@ foreach (@tree) { $pending_app && !splash_warning(_("The modifications done in the current module won't be saved."), 1) and return; clean_socket(); $notebook_global->show; - $darea_left->{state} == 2 and $notebook_global->set_page($index), return; + $darea_left->{state} == 2 and set_page($index), return; foreach (@darea_left_list) { $_->[1]->window->set_cursor($cursor_hand); if($_->[1]->{state} != 0) { @@ -349,18 +349,16 @@ foreach (@tree) { $still_in_splash_screen = 0; update_exp(); } - $notebook_global->set_page($index); + set_page($index); $darea_left_sav = $darea_left; }); push @darea_left_list, [ ($index-1)*45, $darea_left ]; } -my $exp_frame; -my $emb_box; -my $emb_wait; -my $emb_socket; +my ($exp_frame, $emb_box, $emb_wait, $emb_socket); +my ($global_width, $global_height) = (715, 515); # embedded processes pid will be stocked there my @pid_launched; @@ -368,12 +366,10 @@ my @pid_launched; # logdrake pid are stocked here my @pid_exp; -my ($rootheight, undef) = my_gtk::gtkroot()->get_size; - $window_global->add( gtkpack_(new Gtk::VBox(0, 0), 0, my $title_w = get_main_menu($window_global), - 0, my $fixed_title = gtkset_usize(new Gtk::Fixed, 400, 55), + 0, my $fixed_title = gtkset_usize(new Gtk::Fixed, $global_width, 55), 0, new Gtk::HSeparator, 1, gtkpack_(new Gtk::HBox(0, 0), 0, my $fixed_left = new Gtk::Fixed, @@ -384,7 +380,7 @@ $window_global->add( 0, gtkpack_(new Gtk::HBox(0, 0), 1, new Gtk::VBox(0, 0), 0, gtkadd(gtkset_shadow_type(new Gtk::Frame, 'etched_out'), - gtkpng('hourglass'), + my $run_darea = gtkset_usize(new Gtk::DrawingArea, 128, 128) ), 1, new Gtk::VBox(0, 0), ), @@ -410,17 +406,19 @@ sub update_exp { gtkadd($exp_frame = gtkset_shadow_type(gtkset_usize(gtkset_border_width(new Gtk::Frame(_("Logs")), 5), 0, 120), 'etched_out'), ) ); - $rootheight <= 600 and $fixed_title->hide; $show_log = 1; + } + if($logs) { + $show_log = 1; $exp_frame->show_all; } if (!$logs && $exp_frame) { $exp_frame->destroy(); undef $exp_frame; - $fixed_title->show; } } #540, 420 +my ($notebook_width, $notebook_height) = (540, 420); $notebook_global->set_usize(40, $index * 50); $emb_box->set_usize(40, $index * 50); $log_check_box->set_active($logs); @@ -445,7 +443,7 @@ $darea_title->set_events([ 'button_release_mask' ]); $darea_title->signal_connect(button_release_event => sub { clean_socket(); $notebook_global->show; - $notebook_global->set_page(0); + set_page(0); foreach (@darea_left_list) { $_->[1]->window->set_cursor($cursor_normal); $_->[1]->{state} = 0; @@ -469,17 +467,17 @@ $darea_title->signal_connect(expose_event => sub { my $right_back_pixbuf = gtkcreate_png_pixbuf('mcc-core-back'); my $pix_dbl; -$notebook_global->append_page(my $darea1 = new Gtk::DrawingArea);#my $fixed_about = new Gtk::Fixed); -$darea1->signal_connect(size_allocate => sub { $pix_dbl = undef }); -$darea1->signal_connect(expose_event => sub { - my ($dx, $dy) = ($darea1->allocation->[2], $darea1->allocation->[3]); +$notebook_global->append_page(my $summary_darea = new Gtk::DrawingArea); +$summary_darea->signal_connect(size_allocate => sub { $pix_dbl = undef }); # needed when hiding emb_box +$summary_darea->signal_connect(expose_event => sub { + my ($dx, $dy) = ($summary_darea->allocation->[2], $summary_darea->allocation->[3]); if (!defined($pix_dbl)) { - $pix_dbl = new Gtk::Gdk::Pixmap($darea1->window, $dx, $dy); + $pix_dbl = new Gtk::Gdk::Pixmap($summary_darea->window, $dx, $dy); my ($splash_pix, undef) = gtkcreate_png("mcc-splash"); - fill_tiled($darea1, $pix_dbl, $splash_pix, 540, 460, $dx, $dy); - my $style = $darea1->style->copy(); + fill_tiled($summary_darea, $pix_dbl, $splash_pix, $notebook_width, $notebook_height, $dx, $dy); + my $style = $summary_darea->style->copy(); $style->font(Gtk::Gdk::Font->fontset_load(_("-*-helvetica-medium-r-normal-*-20-*-100-100-p-*-iso8859-1,*-r-*"))); - $pix_dbl->draw_string($style->font, $darea1->style->black_gc, 80, 115, _("Welcome to the Mandrake Control Center")); + $pix_dbl->draw_string($style->font, $summary_darea->style->black_gc, 80, 115, _("Welcome to the Mandrake Control Center")); open VERS, "/etc/mandrake-release" or die _("cannot open this file for read: %s", $!); my ($sysname, $nodename, $release, undef, $machine) = uname(); my $i = 0; @@ -488,24 +486,32 @@ $darea1->signal_connect(expose_event => sub { [_("Hostname:"), $nodename], [_("Kernel Version:"), "$release"], [_("Machine:"), $machine]) { - $pix_dbl->draw_string($darea1->style->font, $darea1->style->black_gc, 80, 150+$i, $_->[0]); - $pix_dbl->draw_string($darea1->style->font, $darea1->style->black_gc, 81, 150+$i, $_->[0]); - $pix_dbl->draw_string($darea1->style->font, $darea1->style->black_gc, 200, 150+$i, $_->[1]); + $pix_dbl->draw_string($summary_darea->style->font, $summary_darea->style->black_gc, 80, 150+$i, $_->[0]); + $pix_dbl->draw_string($summary_darea->style->font, $summary_darea->style->black_gc, 81, 150+$i, $_->[0]); + $pix_dbl->draw_string($summary_darea->style->font, $summary_darea->style->black_gc, 200, 150+$i, $_->[1]); $i+=20; } } - $darea1->window->draw_pixmap ($darea1->style->white_gc, + $summary_darea->window->draw_pixmap ($summary_darea->style->white_gc, $pix_dbl, 0, 0, 0, 0, $dx, $dy); 0; }); +my ($run_pixbuf, $run_counter); -my ($pixmap_back_right, undef) = gtkcreate_png('mcc-core-back'); +$run_darea->signal_connect(expose_event => sub { + $run_pixbuf->render_to_drawable($run_darea->window, $run_darea->style->fg_gc('normal'), 0, 0, 0, 0, + $run_pixbuf->get_width, $run_pixbuf->get_height, 'normal', 0, 0); +}); + + +$window_global->set_usize($global_width, $global_height); my $left_back_pixbuf_unaltered_50 = gtkcreate_png_pixbuf('mcc-left-back2'); +# Create right notebook pages foreach (@tree) { - $notebook_global->append_page(gtkicons_labels_widget($_->[2], $window_global, $darea1, - $pixmap_back_right, $left_back_pixbuf_unaltered_50, 540, 460, 55, 50, 50, 50, 50, 50, \&compute_exec_string, $exec_hash)); + $notebook_global->append_page(gtkicons_labels_widget($_->[2], $window_global, $summary_darea, + $pixmap_back_right, $left_back_pixbuf_unaltered_50, $notebook_width, $notebook_height, 55, 50, 50, 50, 50, 50, \&compute_exec_string, $exec_hash)); } Gtk->main_iteration while Gtk->events_pending; $notebook_global->signal_connect(switch_page => sub { @@ -513,7 +519,8 @@ $notebook_global->signal_connect(switch_page => sub { $tab_number > 0 or return; $tab_widget->child->child->child->{redraw_function}->(); }); -$window_global->set_usize(715, 515); +$window_global->set_usize($global_width, $global_height); +#$window_global->set_default_size($global_width, $global_height); $window_global->set_position('center'); Gtk->main_iteration while Gtk->events_pending; $window_global->show_all; @@ -558,7 +565,6 @@ sub sig_usr2 { sprintf $t, @_; } - no warnings; sub translate { my ($s) = @_; $s ? c::dgettext('drakconf', $s) : ''; @@ -566,18 +572,22 @@ sub sig_usr2 { } sub compute_exec_string { - my ($log_exp, $exec, $gtkplug, $alternate) = @{$_[0]}; - print "embed($embedded) $alternate $exec\n"; + use Data::Dumper;print Dumper(\@_),"\n"; + my ($icon, $log_exp, $exec, $gtkplug, $alternate) = ($_[0], @{$_[1]}); + print "($icon, $log_exp, $exec, $gtkplug, $alternate)\n"; if ($embedded) { if ($gtkplug != -1) { $notebook_global->hide; res_socket(); $emb_box->show; $emb_socket->realize; - $exec = $exec . " --embedded " . $emb_socket->window->XWINDOW . " " . $$; + $exec .= " --embedded " . $emb_socket->window->XWINDOW . " " . $$; } if ($gtkplug > 0) { $emb_wait->show; + $run_pixbuf = gtkcreate_png_pixbuf($icon . "_128"); + $timeout = Gtk->timeout_add(100, sub { $run_darea->draw(undef); 1 }); +# Gtk->timeout_remove($timeout); $left_locked = 1; $pending_app = 1; my $pid; @@ -588,11 +598,11 @@ sub compute_exec_string { push @pid_launched, $pid; } elsif ($gtkplug == -1) { system($exec . " &"); - } else { + } else { # gtkplug == 0 $emb_socket->show; $emb_socket->steal(launch_xapp($alternate)); } - } else { + } else { # not embedded system(($gtkplug == 0 ? $alternate->[0] : $alternate || $exec) . " &"); } if ($embedded && $gtkplug != -1) { @@ -608,7 +618,7 @@ sub compute_exec_string { my $pid; gtkadd($exp_frame, my $exp_socket = new Gtk::Socket); $exp_socket->realize; - $exec_log = "logdrake --explain=$log_exp --embedded " . $exp_socket->window->XWINDOW . " " . $$; + my $exec_log = "logdrake --explain=$log_exp --embedded " . $exp_socket->window->XWINDOW . " " . $$; $show_log = 0; unless ($pid = fork) { splash_warning(_("cannot fork: %s", $~)) unless defined $pid; @@ -735,6 +745,7 @@ sub about_mdk_cc { my $clist = new Gtk::CList(3); my $i = -1; $i++, $clist->append(@$_) foreach ([ _("Author: "), 'Damien "dams" Krotkine', 'damien@mandrakesoft.com'], + [ '', 'Thierry Vignaud', 'tvignaud@mandrakesoft.com'], [ '', 'Yves Duret', 'yduret@mandrakesoft.com'], [ '', ''], [ _("Artwork: "), @@ -830,3 +841,12 @@ sub get_main_menu { $embedded_check_box = $item_factory->get_widget("<main>"._("/Options")._("/Embedded Mode")); return ($item_factory->get_widget('<main>')); } + +sub set_page { + my ($index) = @_; + if ($index == 0) { + $still_in_splash_screen=1; + $exp_frame->hide; + } else { update_exp } + $notebook_global->set_page($index); +} diff --git a/drakconf.spec b/drakconf.spec index eb3fd78b..f54fa50a 100644 --- a/drakconf.spec +++ b/drakconf.spec @@ -43,6 +43,7 @@ Center : kde and gnome themes. %setup -q %build +perl -pi -e 's/^use strict/#use strict/g' control-center %install %makeinstall_std |