diff options
-rwxr-xr-x | control-center3 | 146 | ||||
-rw-r--r-- | pixmaps/splash.png | bin | 0 -> 108869 bytes |
2 files changed, 72 insertions, 74 deletions
diff --git a/control-center3 b/control-center3 index df21c06d..f577ee34 100755 --- a/control-center3 +++ b/control-center3 @@ -22,6 +22,7 @@ use Gtk; +use Gtk::Gdk::ImlibImage; use Config; use POSIX; # for i18n @@ -34,6 +35,7 @@ import Locale::GetText I_; *_ = *I_; init Gtk; +Gtk::Gdk::ImlibImage->init; use Data::Dumper; my $false = 0; @@ -43,6 +45,7 @@ my $_xbindir = "/usr/X11R6/bin"; my $_bindir = "/usr/bin"; my $_sbindir = "/usr/sbin"; my $_iconsdir = "/usr/share/icons"; +my $_docdir = "/usr/share/doc"; my %pixmaps_global; my $xpm_path="$_iconsdir"; @@ -59,7 +62,7 @@ $window_global->set_title(_("Mandrake Control Center")); $window_global->border_width(0); #$window_global->realize; -$vbox_global = new Gtk::VBox(0, 0); +my $vbox_global = new Gtk::VBox(0, 0); $window_global->add($vbox_global); ######### menus @@ -90,9 +93,7 @@ foreach (@item_factory_entries) { } $vbox_global->pack_start($item_factory->get_widget('<main>'), 0, 0, 0); -$hseparator_global = new Gtk::HSeparator; -$vbox_global->pack_start($hseparator_global, 0, 1, 0); -######### menus end +$vbox_global->pack_start(new Gtk::HSeparator, 0, 1, 0); my $hpane_global = new Gtk::HPaned; $vbox_global->pack_start($hpane_global, 1, 1, 0); @@ -101,10 +102,7 @@ my $scrolled_global = new Gtk::ScrolledWindow; $scrolled_global->set_policy('automatic','automatic'); $scrolled_global->set_usize(190, 0); $scrolled_global->set_name("icons_back"); -#$scrolled_global->window->draw_rectangle(nil,1, 0, 0, 70, 70); #$scrolled_global->window->style->bg_gc('normal') $hpane_global->pack1($scrolled_global,0,1); -#my $vseparator_global = new Gtk::VSeparator; -#$hbox_global->pack_start($vseparator_global,0,1,0); my $notebook_global = new Gtk::Notebook; $notebook_global->set_show_border(0); @@ -113,66 +111,14 @@ $hpane_global->pack2($notebook_global,0,1); #-------------------------------- splash screeen -------------------------------------------------------- -my ($pix_about_map, $pix_about_mask) = Gtk::Gdk::Pixmap->create_from_xpm(NULL, Gtk::Widget->get_default_style->bg('normal'), "$xpm_path_l/logo.xpm"); -my ($pix_splash_map, $pix_splash_mask) = Gtk::Gdk::Pixmap->create_from_xpm(NULL, Gtk::Widget->get_default_style->bg('normal'), "$xpm_path_l/splash.xpm"); -my $pix_splash = new Gtk::Pixmap ($pix_splash_map, $pix_splash_mask); -my $pix_about = new Gtk::Pixmap ($pix_about_map, $pix_about_mask); -my $fixed1= new Gtk::Fixed(); -$pix_about->set_alignment(10,0); -$fixed1->put($pix_about, 0, 0); -my $style = new Gtk::Style; -$style->font(Gtk::Gdk::Font->fontset_load(_("-adobe-times-bold-r-normal--*-180-100-100-p-*-iso8859-*,*-r-*"))); -my $label_about2 = new Gtk::Label (_("The Mandrake Control Center")); -$label_about2->set_alignment(0,0); -$label_about2->set_style($style); -$fixed1->put($pix_splash, 0, 0); -$fixed1->put($label_about2, 50, 130); -my $label_about3 = new Gtk::Label (_("The place where you can configure your Mandrake Box")); -$fixed1->put($label_about3, 60, 160); - -my @revtree; -my @infotree; -open VERS, "/etc/redhat-release" or die( sprintf _("cannot open this file for read: $!")); -while (<VERS>) { - push (@revtree,$_); -} -@info_tree = split / /, $revtree[0]; - -my ($sysname, $nodename, $release, $version, $machine ) = POSIX::uname(); -my $username= POSIX::cuserid(); - -my $style1 = new Gtk::Style; -$style1->font(Gtk::Gdk::Font->fontset_load(_("-adobe-times-bold-r-normal--14-*-100-100-p-*-iso8859-*,*-r-*"))); - -my $label_user = new Gtk::Label(_("User: ")); -$label_user->set_style($style1); -$fixed1->put($label_user, 50, 190); -my $ld = new Gtk::Label("$username"); -$fixed1->put($ld, 170, 190); -my $label_os = new Gtk::Label(_("System: ")); -$label_os->set_style($style1); -$label_os->set_justify('right'); -$fixed1->put($label_os, 50, 210); -my $ld1 = new Gtk::Label("$info_tree[0] $info_tree[1] $info_tree[3] $info_tree[4] "); -$fixed1->put($ld1, 170, 210); -my $label_host = new Gtk::Label(_("Hostname: ")); -$label_host->set_style($style1); -$fixed1->put($label_host, 50, 230); -my $ld2 = new Gtk::Label("$nodename"); -$fixed1->put($ld2, 170, 230); -my $label_kernel = new Gtk::Label(_("Kernel Version: ")); -$label_kernel->set_style($style1); -$fixed1->put($label_kernel, 50, 260); -my $ld3 = new Gtk::Label("$release $version"); -$fixed1->put($ld3, 170, 260); -my $label_box = new Gtk::Label(_("Machine: ")); -$label_box->set_style($style1); -$fixed1->put($label_box, 50, 290); -my $ld4 = new Gtk::Label("$machine"); -$fixed1->put($ld4, 170, 290); - - -$notebook_global->append_page($fixed1, ""); +my ($pix_splash_map, $pix_splash_mask) = gtkcreate_png("$xpm_path_l/splash.png"); + +my $vbox_about = new Gtk::VBox(0,0); +my $darea1= new Gtk::DrawingArea(); +$darea1->size(540,460); +$vbox_about->pack_start($darea1,1,1,0); +$notebook_global->append_page($vbox_about, undef); + my $vbox_global_left = new Gtk::VBox(0,0); $scrolled_global->add_with_viewport($vbox_global_left); @@ -186,7 +132,6 @@ map { create_tree_item($tree, $_->[0] , "$xpm_path_l/$_->[1]",1); } ([_("Boot"), 'logo.xpm'] , [_("Hardware"), 'logo.xpm'] , [_("User and Groups"),'logo.xpm'], [_("Network & Internet"),'logo.xpm'] , [_("Menu Customization"),'logo.xpm'] , [_("Font Management"),'logo.xpm']); - map { create_tree_item($treeitem_sub[int($_->[2])],$_->[0], "$xpm_path/$_->[1]",0); } ([_("Boot Loader"),'item.xpm',5] , [_("Boot Disk"), 'item.xpm',5] , [_("Boot Logo"), 'item.xpm',5], @@ -196,7 +141,7 @@ map { [_("Menudrake") , 'item.xpm',1] , [_("Drakfont"), 'item.xpm', 0]); -%tree_exec = (_("Boot Loader") => " ../bootlookdrake/bootlookdrake", _("Boot Disk") => "$_xbindir/drakfloppy", +my %tree_exec = (_("Boot Loader") => " ../bootlookdrake/bootlookdrake", _("Boot Disk") => "$_xbindir/drakfloppy", _("Boot Logo") => "$_xbindir/DrakeLogo" , _("XFDrake") => "$_sbindir/XFdrake --expert" , _("Harddrake") => "$_bindir/harddrake-auth" , _("Mousedrake") => "$_sbindir/mousedrake" , _("Printerdrake") => "$_sbindir/printerdrake" , _("Keyboarddrake") => "$_sbindir/keyboarddrake" , @@ -205,7 +150,7 @@ map { ); my @pid_launched; -%tree_launched = (_("Boot Loader") => -1, _("Boot Disk") => -1, +my %tree_launched = (_("Boot Loader") => -1, _("Boot Disk") => -1, _("Boot Logo") => -1 , _("XFDrake") => -1 , _("Harddrake") => -1 , _("Mousedrake") => -1 , _("Printerdrake") => -1 , _("Keyboarddrake") => -1 , @@ -217,15 +162,64 @@ my @pid_launched; #exec_treeitem("harddrake-auth",4); my $rc = "control-center.rc"; Gtk::Rc->parse($rc); -#$fixed1->set_back_pixmap($pix_splash_mask,1); $window_global->show_all; - -print "num: " . $notebook_global->page_num($fixed1) . "\n"; $SIG{USR1} = sub { $notebook_global->set_page(0); }; # embedded applications will send me that signal in order to "hide" them +my $pix_dbl = new Gtk::Gdk::Pixmap($darea1->window, 540,460); +draw_exposed($pix_dbl); +$darea1->signal_connect( expose_event => sub { $darea1->window->draw_pixmap + ($darea1->style->white_gc, + $pix_dbl, 0, 0, + ($darea1->allocation->[2]-540)/2, ($darea1->allocation->[3]-460)/2, + 540, 460); + }); Gtk->main; +sub draw_exposed { + my ( $pix )=@_; + $pix->draw_pixmap($darea1->style->white_gc, $pix_splash_map, + 0, 0, 0, 0, 540, 460); + my $style = new Gtk::Style; + my $style_dflt = new Gtk::Style; + $style->font(Gtk::Gdk::Font->load('-adobe-times-bold-r-normal--25-180-100-100-p-132-iso8859-1')); + $pix->draw_string($style->font, $darea1->style->black_gc, 50, 130, _("The Mandrake Control Center") ); + $pix->draw_string($style_dflt->font, $darea1->style->black_gc, 60, 160, ("The place where you can configure your Mandrake Box") ); + + my @revtree; + my @info_tree; + open VERS, "/etc/redhat-release" or die( sprintf _("cannot open this file for read: $!")); + while (<VERS>) { + push (@revtree,$_); + } + @info_tree = split / /, $revtree[0]; + + my ($sysname, $nodename, $release, $version, $machine ) = POSIX::uname(); + my $username= POSIX::cuserid(); + + my $style1 = new Gtk::Style; + $style1->font(Gtk::Gdk::Font->load('-adobe-times-bold-r-normal--14-100-100-100-p-76-iso8859-1')); + + my $i=0; + foreach( [_("User:"), $username], + [_("System:"), "$info_tree[0] $info_tree[1] $info_tree[3] $info_tree[4]"], + [_("Hostname:"), $nodename], + [_("Kernel Version :"), "$release $version"], + [_("Machine:"), $machine] ) { + $pix->draw_string($style1->font, $darea1->style->black_gc, 50, 190+$i, $_->[0]); + $pix->draw_string($style_dflt->font, $darea1->style->black_gc, 170, 190+$i, $_->[1]); + $i+=20; + } +} + +sub gtkcreate_png { + my ($f) = @_; + my $im = Gtk::Gdk::ImlibImage->load_image($f) or die "gtkcreate_png: missing png file $f"; + $im->render($im->rgb_width, $im->rgb_height); + ($im->move_image(), $im->move_mask); +} +sub gtkpng { new Gtk::Pixmap(gtkcreate_png(@_)) } + sub quit_global { print _("Cleaning...\n"); @@ -279,11 +273,14 @@ sub create_tree_item my ($treeitem, $treebox, $new_subtree); $treeitem = new Gtk::TreeItem(); + $treeitem_selected=$treeitem; $treebox = xpm_label_box($window_global,$pixmap,$label); $treeitem->add($treebox); $treebox->show(); if ($tree_depth_max == 0) { $treeitem->signal_connect('select', sub { exec_treeitem($label, $tree_exec{$label});}); + } else { + $treeitem->signal_connect('select', sub { $treeitem->expand(); $treeitem->deselect(); }); } $parent_tree->append($treeitem); $treeitem->show(); @@ -341,7 +338,8 @@ sub exec_treeitem printf (_("My PID is [%s]\n"), $$ ); my $a = $exec_string . " --embedded " . $socket->window->XWINDOW . " " . $$; print "$a\n"; - (my $pid = fork()) ? $pid_launched[$nb_pages] = $pid : exec ($a) or print STDERR _("couldn't exec $a: $!"); + my $pid; + ($pid = fork()) ? $pid_launched[$nb_pages] = $pid : exec ($a) or print STDERR _("couldn't exec $a: $!"); $nb_pages++; $tree_launched{$label}=$nb_pages; $notebook_global->set_page($nb_pages); diff --git a/pixmaps/splash.png b/pixmaps/splash.png Binary files differnew file mode 100644 index 00000000..b30a3a5c --- /dev/null +++ b/pixmaps/splash.png |