summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordamien <damien@mandriva.com>2001-12-19 17:45:04 +0000
committerdamien <damien@mandriva.com>2001-12-19 17:45:04 +0000
commitaecb7e4363d2b54d0f35f53cad69f961e9eb06ff (patch)
treebbbcc0bf6fe1205fcc3e46b7380eda3753bff963
parent2478eecee23682f14fd8c9c0c553b31d88a8a6a5 (diff)
downloadcontrol-center-aecb7e4363d2b54d0f35f53cad69f961e9eb06ff.tar
control-center-aecb7e4363d2b54d0f35f53cad69f961e9eb06ff.tar.gz
control-center-aecb7e4363d2b54d0f35f53cad69f961e9eb06ff.tar.bz2
control-center-aecb7e4363d2b54d0f35f53cad69f961e9eb06ff.tar.xz
control-center-aecb7e4363d2b54d0f35f53cad69f961e9eb06ff.zip
updated
-rwxr-xr-xcontrol-center600
-rw-r--r--pixmaps/mcc-splash.pngbin32486 -> 31942 bytes
-rw-r--r--pixmaps/time-mdk.pngbin1573 -> 2567 bytes
3 files changed, 359 insertions, 241 deletions
diff --git a/control-center b/control-center
index 37189946..bd89de54 100755
--- a/control-center
+++ b/control-center
@@ -20,40 +20,43 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-use Config;
-use POSIX;
-
-
my $_xbindir = "/usr/X11R6/bin";
my $_bindir = "/usr/bin";
my $_sbindir = "/usr/sbin";
my $_iconsdir = "/usr/share/icons";
-my $_docdir = "/usr/share/doc";
-my $_wizdir = "/usr/share/wizards";
-
-my $_version = "0.70";
+#my $_docdir = "/usr/share/doc";
+#my $_wizdir = "/usr/share/wizards";
!$ENV{DISPLAY} and exec ("$_sbindir/drakxconf; reset");
+require Gtk;
+use lib qw(/usr/lib/libDrakX);
use lib qw(/usr/lib/libDrakX);
use common;
use interactive;
use standalone;
+use my_gtk qw(:helpers :wrappers);
+use strict;
+
+# require Gtk;
+# require Gtk::Gdk::ImlibImage;
+# init Gtk;
+# Gtk->set_locale;
+# Gtk::Gdk::ImlibImage->init;
+use Config;
+use POSIX;
+
+my $_version = "0.80";
my $in = 'interactive'->vnew('su', 'default');
-require Gtk;
-require Gtk::Gdk::ImlibImage;
-init Gtk;
-Gtk->set_locale;
-Gtk::Gdk::ImlibImage->init;
-
-my %pixmaps_global;
-my $xpm_path="$_iconsdir";
-my $xpm_path_l="$_iconsdir";
-my $tree_depth_max = 1;
-my $treeitem_old;
-my @treeitem_sub;
+#my %pixmaps_global;
+#my $xpm_path="$_iconsdir";
+#my $xpm_path_l="$_iconsdir";
+my $png_path="$_iconsdir";
+#my $tree_depth_max = 1;
+#my $treeitem_old;
+#my @treeitem_sub;
#-------------------------------------------------------------
# tree def
@@ -64,185 +67,285 @@ my @treeitem_sub;
$::isWiz = $in->do_pkgs->is_installed(q(wizard));
-my @tree_parent =
- ([_("Boot"), 'boot-mdk.png'],
- [_("Hardware"), 'drakhard-mdk.png'],
- [_("Network & Internet"),'net-mdk.png'],
- [_("Security"),'security-mdk.png'],
- [_("System"),'system-mdk.png'],
- if_($::isWiz, [_("Servers"),'net-mdk.png'])
-);
-
-my @tree_app =
- ([_("Boot Disk"), 'drakfloppy-mdk.png',1] , [_("Boot Config"),'drakboot-mdk.png',1], [_("Auto Install"), 'drakfloppy-mdk.png', 1],
-
- [_("Display"),'XFdrake-mdk.png',2] , [_("Hardware"),'harddrake-mdk.png',2] , [_("Mouse"), 'mousedrake-mdk.png',2],
- [_("Printer"),'printer-mdk.png',2] , [_("Keyboard"), 'keyboard-mdk.png',2], [_("Mount Points"),'partition-mdk.png',2],
-
- [_("Connection") , 'draknet-mdk.png',3] , [_("Connection Sharing"),'drakgw-mdk.png',3], #[_("Proxy"), 'drakgw-mdk.png', 3],
-
- [_("Security Level"), 'draksec-mdk.png',4], [_("Firewalling"), 'firewall-mdk.png',4],
-
- [_("Menus") , 'menudrake-mdk.png',5], [_("Services") , 'service-mdk.png' , 5],
- [_("Fonts"), 'drakfont-mdk.png',5], [_("Date & Time") , 'time-mdk.png',5],
- [_("Software Manager"), 'harddrake-mdk.png',5], [_("Logs"), 'logdrake-mdk.png',5],
- [_("Console"), 'drakboot-mdk.png', 5],
-
- if_($::isWiz,[_("Configuration Wizards"), 'service-mdk.png', 6]),
-
-# if_($::isWiz,[_("client"), 'drakboot-mdk.png', 6]),
-# if_($::isWiz,[_("Database"), 'drakboot-mdk.png', 6]),
-# if_($::isWiz,[_("Dhcp Server"), 'drakboot-mdk.png', 6]),
-# if_($::isWiz,[_("DNS"), 'drakboot-mdk.png', 6]),
-# if_($::isWiz,[_("Firewall"), 'drakboot-mdk.png', 6]),
-# if_($::isWiz,[_("Ftp Server"), 'drakboot-mdk.png', 6]),
-# if_($::isWiz,[_("global"), 'drakboot-mdk.png', 6]),
-# if_($::isWiz,[_("News Server"), 'drakboot-mdk.png', 6]),
-# if_($::isWiz,[_("Mail Server"), 'drakboot-mdk.png', 6]),
-# if_($::isWiz,[_("Samba Server"), 'drakboot-mdk.png', 6]),
-# if_($::isWiz,[_("server"), 'drakboot-mdk.png', 6]),
-# if_($::isWiz,[_("Time"), 'drakboot-mdk.png', 6]),
-# if_($::isWiz,[_("Web Server"), 'drakboot-mdk.png', 6]),
- );
-
-my %tree_exec = (_("Boot Disk") => "$_xbindir/drakfloppy.real", _("Boot Config") => "$_sbindir/drakboot", _("Auto Install") => "$_sbindir/drakautoinst",
- _("Display") => "$_sbindir/XFdrake" ,
- _("Hardware") => "$_sbindir/harddrake" , _("Mouse") => "$_sbindir/mousedrake" ,
- _("Printer") => "$_sbindir/print.pm" , _("Keyboard") => "$_sbindir/keyboarddrake" ,
- _("Mount Points") => "$_sbindir/diskdrake",
- _("Connection") => "$_sbindir/draknet",
- _("Connection Sharing") => "$_sbindir/drakgw",
- _("Proxy") => "$_sbindir/drakproxy",
- _("Firewalling") => "$_sbindir/tinyfirewall",
- _("Security Level") => "$_sbindir/draksec",
- _("Date & Time") => "$_sbindir/clock.pm",
- _("Menus") => "$_sbindir/menus.pm",
- _("Services") => "$_sbindir/drakxservices",
- _("Fonts") => "$_xbindir/drakfont",
- _("Software Manager") => "$_bindir/rpmdrake",
- _("Logs") => "$_sbindir/logdrake",
- _("Console") => "$_xbindir/rxvt",
- # wizard java
- _("Configuration Wizards") => "$_sbindir/wizdrake",
-# _("client") => "$_wizdir/client_wizard/client.wiz",
-# _("Database") => "$_wizdir/db_wizard/db.wiz",
-# _("Dhcp Server") => "$_wizdir/dhcp_wizard/dhcp.wiz",
-# _("DNS") => "$_wizdir/dns_wizard/dns.wiz",
-# _("Firewall") => "$_wizdir/firewall_wizard/firewall.wiz",
-# _("Ftp Server") => "$_wizdir/ftp_wizard/ftp.wiz",
-# _("global") => "$_wizdir/global_wizard/global.wiz",
-# _("News Server") => "$_wizdir/news_wizard/news.wiz",
-# _("Mail Server") => "$_wizdir/postfix_wizard/postfix.wiz",
-# _("Samba Server") => "$_wizdir/samba_wizard/samba.wiz",
-# _("server") => "$_wizdir/server_wizard/server.wiz",
-# _("Time") => "$_wizdir/time_wizard/time.wiz",
-# _("Web Server") => "$_wizdir/web_wizard/web.wiz",
- );
-
-my %xapp = (_("Console") => ["rxvt", "rxvt", 1],
-# _("client") => ["wiz $_wizdir/client_wizard/client.wiz", "wizdrake", 1],
-# _("Database") => ["wiz $_wizdir/db_wizard/db.wiz", "wizdrake", 1],
-# _("Dhcp Server") => ["wiz $_wizdir/dhcp_wizard/dhcp.wiz", "wizdrake", 1],
-# _("DNS") => ["wiz $_wizdir/dns_wizard/dns.wiz", "wizdrake", 1],
-# _("Firewall") => ["wiz $_wizdir/firewall_wizard/firewall.wiz", "wizdrake", 1],
-# _("Ftp Server") => ["wiz $_wizdir/ftp_wizard/ftp.wiz", "wizdrake", 1],
-# _("global") => ["wiz $_wizdir/global_wizard/global.wiz", "wizdrake", 1],
-# _("News Server") => ["wiz $_wizdir/news_wizard/news.wiz", "wizdrake", 1],
-# _("Mail Server") => ["wiz $_wizdir/postfix_wizard/postfix.wiz", "wizdrake", 1],
-# _("Samba Server") => ["wiz $_wizdir/samba_wizard/samba.wiz", "wizdrake", 1],
-# _("server") => ["wiz $_wizdir/server_wizard/server.wiz", "wizdrake", 1],
-# _("Time") => ["wiz $_wizdir/time_wizard/time.wiz", "wizdrake", 1],
-# _("Web Server") => ["wiz $_wizdir/web_wizard/web.wiz", "wizdrake", 1],
- );
+my @tree =
+ ( [_("Boot"), 'boot-mdk.png',
+ [
+ [_("Boot Disk"), 'drakfloppy-mdk.png', "$_xbindir/drakfloppy.real"],
+ [_("Boot Config"),'drakboot-mdk.png', "$_sbindir/drakboot"],
+ [_("Auto Install"), 'drakfloppy-mdk.png', "$_sbindir/drakautoinst"],
+ ]
+ ],
+ [_("Hardware"), 'drakhard-mdk.png',
+ [
+ [_("Display"),'XFdrake-mdk.png', "$_sbindir/XFdrake"],
+ [_("Hardware"),'harddrake-mdk.png', "$_sbindir/harddrake"],
+ [_("Mouse"), 'mousedrake-mdk.png', "$_sbindir/mousedrake"],
+ [_("Printer"),'printer-mdk.png', "$_sbindir/print.pm"],
+ [_("Keyboard"), 'keyboard-mdk.png', "$_sbindir/keyboarddrake"],
+ [_("Mount Points"),'partition-mdk.png', "$_sbindir/diskdrake"],
+ ]
+ ],
+ [_("Network & Internet"),'net-mdk.png',
+ [
+ [_("Connection"), 'draknet-mdk.png', "$_sbindir/draknet"],
+ [_("Connection Sharing"),'drakgw-mdk.png', "$_sbindir/drakgw"],
+ #[_("Proxy"), 'drakgw-mdk.png', "$_sbindir/drakproxy"],
+ ],
+ ],
+ [_("Security"),'security-mdk.png',
+ [
+ [_("Security Level"), 'draksec-mdk.png', "$_sbindir/draksec"],
+ [_("Firewalling"), 'firewall-mdk.png', "$_sbindir/tinyfirewall"],
+ ]
+ ],
+ [_("System"),'system-mdk.png',
+ [
+ [_("Menus") , 'menudrake-mdk.png', "$_sbindir/menus.pm"],
+ [_("Services") , 'service-mdk.png', "$_sbindir/drakxservices"],
+ [_("Fonts"), 'drakfont-mdk.png', "$_xbindir/drakfont"],
+ [_("Date & Time") , 'time-mdk.png', "$_sbindir/clock.pm"],
+ [_("Software Manager"), 'harddrake-mdk.png', "$_bindir/rpmdrake"],
+ [_("Logs"), 'logdrake-mdk.png', "$_sbindir/logdrake"],
+ [_("Console"), 'drakboot-mdk.png', "$_xbindir/rxvt"],
+ ]
+ ],
+ if_($::isWiz,
+ [_("Configuration Wizards"), 'service-mdk.png',
+ [
+ [_("Servers"),'net-mdk.png', "$_sbindir/wizdrake"],
+ ]
+ ]),
+ );
#-------------------------------------------------------------
-
+my @menu_items =
my $nb_pages=0;
my $window_global = new Gtk::Window -toplevel;
$window_global->signal_connect ( delete_event => sub { quit_global(); });
$window_global->set_position(1);
$window_global->set_title( _("Mandrake Control Center %s", $_version));
-$window_global->border_width(0);
-
-my $vbox_global = new Gtk::VBox(0, 0);
-$window_global->add($vbox_global);
-
-######### menus
-my @menu_items = (
- { path => _("/_File"), type => '<Branch>' },
- { path => _("/File")._("/_Quit"), accelerator => _("<control>Q"), callback => \&quit_global },
- { path => _("/_Help"),type => '<Branch>' },
-# { path => _("/Help")._("/_Help on line"), callback => sub { Gtk->exit(0) } },
- { path => _("/Help")._("/_Report Bug") , callback => sub {connect_to_site("https://qa.mandrakesoft.com/");}},
- { path => _("/Help/-"), type => '<Separator>' },
- { path => _("/Help")._("/Mandrake_Campus"), callback => sub {connect_to_site("http://www.mandrakecampus.com/");} },
- { path => _("/Help")._("/Mandrake_Expert"), callback => sub {connect_to_site("http://www.mandrakeexpert.com/");} },
- { path => _("/Help/-"), type => '<Separator>' },
- { path => _("/Help")._("/_About..."), callback => \&about_mdk_cc }
- );
-my $menubar = get_main_menu( $window_global );
-$vbox_global->pack_start($menubar, 0, 0, 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);
-$hpane_global->border_width(5);
-my $scrolled_global = new Gtk::ScrolledWindow;
-$scrolled_global->set_policy('automatic','automatic');
-$scrolled_global->set_usize(210, 0);
-$scrolled_global->set_name("icons_back");
-$hpane_global->pack1($scrolled_global,0,1);
-
-my $notebook_global = new Gtk::Notebook;
-$notebook_global->set_show_border(0);
-$notebook_global->set_show_tabs(0);
-$hpane_global->pack2($notebook_global,0,1);
-
-my $vbox_about = new Gtk::VBox(0,0);
-my $darea1 = new Gtk::DrawingArea();
-$darea1->size(540,460);
-$darea1->set_usize(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);
-$window_global->realize;
+#$window_global->border_width(0);
+
+my ($pixmap_back_left, undef) = gtkcreate_png('mcc-left-back');
+
+my @darea_left_list = map {
+ my $text = $_->[0];
+ my $darea_left = gtkset_usize(new Gtk::DrawingArea, 160, 45);
+ my $dbl_area_left;
+ my ($pixmap_back_left, undef) = gtkcreate_png('mcc-left-back');
+ $darea_left->signal_connect( size_allocate => sub { $dbl_area_left = undef });
+ $darea_left->signal_connect( expose_event => sub {
+ my ($dx, $dy) = ($darea_left->allocation->[2], $darea_left->allocation->[3]);
+ if (!defined($dbl_area_left)) {
+ my ($dbl_area_left, $width, $height, $asc, $desc) = create_pix_text($darea_left, $text, "#0#0#0",
+ _("-urw-helvetica-medium-r-normal-*-*-100-*-*-p-*-iso8859-1"),
+ max($dx-40, 0), $dy, 0, 0, 5, $pixmap_back_left, 160, 45); #"#0#0#0",
+ $dbl_area_left = new Gtk::Gdk::Pixmap($darea_left->window, $dx, $dy);
+ $dbl_area_left->draw_pixmap($darea_left->style->bg_gc('normal'),
+ $pixmap_icon, 0, 0, 4, ($dy-35) 0, 35, 35);
+ my $y_pos = int( (55-$height)/2/5 )*5 + 10;
+ $dbl_area_left->draw_pixmap($darea_left->style->bg_gc('normal'),
+ $pix, 0, 0, 336, $y_pos, $width, $height);
+ }
+ $darea_left->window->draw_pixmap($darea_left->style->bg_gc('normal'),
+ $dbl_area_left, 0, 0, 0, 0, ($dx, $dy));
+ });
+ $darea_left;
+} @tree;
+
+$window_global->add(
+ gtkpack_(new Gtk::VBox(0, 0),
+ 0, get_main_menu($window_global),
+ 0, my $darea_title = gtkset_usize(new Gtk::DrawingArea, 450, 55),
+ 0, new Gtk::HSeparator,
+ 1, gtkpack_(new Gtk::HBox(0, 0),
+ gtkpack_(new Gtk::HBox(0, 0),
+ 0,
+
+ ),
+ 1, my $notebook_global = new Gtk::Widget ('Gtk::Notebook',
+ show_border => 0,
+ show_tabs => 0),
+ )
+ )
+ );
+
+my $dbl_area;
+my ($pixmap_back, undef) = gtkcreate_png('mcc-title-back');
+my ($pixmap_icon, undef) = gtkcreate_png('mcc-title-icon');
+
+#FIXME
+#$darea_title->window->set_back_pixmap($pixmap_back, 0);
+$darea_title->signal_connect( size_allocate => sub { $dbl_area = undef });
+
+$darea_title->signal_connect( expose_event => sub {
+ my ($dx, $dy) = ($darea_title->allocation->[2], $darea_title->allocation->[3]);
+ if (!defined($dbl_area)) {
+ my ($pix, $width, $height, $asc, $desc) = create_pix_text($darea_title, "welcome", "#255#255#255",
+ _("-urw-helvetica-medium-r-normal-*-*-190-*-*-p-*-iso8859-1"),
+#_("-urw-times-bold-r-normal-*-*-200-*-*-p-*-iso8859-1"),
+ max($dx-336, 0), $dy, 0, 1, 5, $pixmap_back, 5, 5); #"#0#0#0",
+ $dbl_area = new Gtk::Gdk::Pixmap($darea_title->window, $dx, $dy);
+ print "CALL tiled : $dx, $dy\n";
+ fill_tiled($darea_title, $dbl_area, $pixmap_back, 110, 55, $dx, $dy);
+ $dbl_area->draw_pixmap($darea_title->style->bg_gc('normal'),
+ $pixmap_icon, 0, 0, 0, 0, 336, 55);
+ my $y_pos = int( (55-$height)/2/5 )*5 + 10;
+ $dbl_area->draw_pixmap($darea_title->style->bg_gc('normal'),
+ $pix, 0, 0, 336, $y_pos, $width, $height);
+ }
+ $darea_title->window->draw_pixmap($darea_title->style->bg_gc('normal'),
+ $dbl_area, 0, 0, 0, 0, ($dx, $dy));
+ });
+
+my ($pixmap_back_right, undef) = gtkcreate_png('mcc-core-back');
+
+# $hpane_global->pack1(gtkpack(new Gtk::VBox(0,0),
+# gtkappenditems(my $list = new Gtk::List,
+# map_index {
+# my $k = $::i+1;
+# gtkadd(
+# gtksignal_connect(new Gtk::ListItem,
+# select => sub { $notebook_global->set_page($k) }),
+# icon_label_box($_->[0], "$png_path/$_->[1]")) } @tree )
+# ),
+#my $scrolled_global = new Gtk::Widget ('Gtk::ScrolledWindow', name => 'icons_back'),
+# 0, 1);
+#$scrolled_global->set_policy('automatic','automatic');
+#$scrolled_global->set_usize(180, 0);
+
+# $hpane_global->pack1(gtkpack(new Gtk::VBox(0,0),
+# gtkappenditems(my $list = new Gtk::List,
+# map_index {
+# my $k = $::i+1;
+# gtkadd(
+# gtksignal_connect(new Gtk::ListItem,
+# select => sub { $notebook_global->set_page($k) }),
+# icon_label_box($_->[0], "$png_path/$_->[1]")) } @tree )
+# ),
+#my $scrolled_global = new Gtk::Widget ('Gtk::ScrolledWindow', name => 'icons_back'),
+# 0, 1);
+
+my ($pix_splash_map, undef) = gtkcreate_png('mcc-splash');
+my $pix_dbl;
+$notebook_global->append_page(gtkset_usize(my $darea1 = new Gtk::DrawingArea, 540, 460), undef);
+$darea1->signal_connect( size_allocate => sub { $pix_dbl = undef });
+$darea1->signal_connect( expose_event => sub {
+ my ($dx, $dy) = ($darea1->allocation->[2], $darea1->allocation->[3]);
+ if (!defined($pix_dbl)) {
+ $pix_dbl = new Gtk::Gdk::Pixmap($darea1->window, $dx, $dy);
+
+# fill_tiled($darea1, $pix_dbl, $pixmap_back_right, 540, 460, $dx, $dy);
+ $pix_dbl->draw_pixmap($darea1->style->white_gc, $pix_splash_map,
+ 0, 0, ($dx-540)/2, ($dy-460)/2, 540, 460);
+ my $style = new Gtk::Style;
+ my $style_dflt = new Gtk::Style;
+ $style->font(Gtk::Gdk::Font->fontset_load(_("-adobe-times-bold-r-normal--17-*-100-100-p-*-iso8859-*,*-r-*")));
+ $pix_dbl->draw_string($style->font, $darea1->style->black_gc, 103, 165, _("Welcome to the Mandrake Control Center") );
+ my @revtree;
+ open VERS, "/etc/mandrake-release" or die _("cannot open this file for read: %s", $!);
+ while (<VERS>) { push (@revtree,$_) }
+ my @info_tree = split / /, $revtree[0];
+ my ($sysname, $nodename, $release, $version, $machine) = POSIX::uname();
+ my $style1 = new Gtk::Style;
+ $style1->font(Gtk::Gdk::Font->fontset_load(_("-adobe-times-bold-r-normal--14-*-100-100-p-*-iso8859-*,*-r-*")));
+ my $i=0;
+ foreach(
+ [_("System:"), "$info_tree[0] $info_tree[1] $info_tree[3] $info_tree[4]"],
+ [_("Hostname:"), $nodename],
+ [_("Kernel Version:"), "$release $version"],
+ [_("Machine:"), $machine] ) {
+ $pix_dbl->draw_string($style1->font, $darea1->style->black_gc, 80, 220+$i, $_->[0]);
+ $pix_dbl->draw_string($style_dflt->font, $darea1->style->black_gc, 200, 220+$i, $_->[1]);
+ $i+=20;
+ }
+ }
+ $darea1->window->draw_pixmap ($darea1->style->white_gc,
+ $pix_dbl, 0, 0,
+ ($darea1->allocation->[2]-540)/2, ($darea1->allocation->[3]-460)/2,
+ 540, 460);
+ 0;
+ });
my @pid_launched;
my %tree_launched;
-my $tree= new Gtk::Tree;
-$tree->set_selection_mode('browse');
-$tree->set_view_lines(0);
-$tree->set_view_mode('item');
-map { create_tree_item($tree, $_->[0] , "$xpm_path_l/$_->[1]",1); }
- @tree_parent;
-map { create_tree_item($treeitem_sub[st(int($_->[2]))],$_->[0], "$xpm_path_l/$_->[1]",0);}
- @tree_app;
-
-$vbox_global_left->pack_start($tree,1,1,0);
-$window_global->show_all;
-my ($pix_splash_map, $pix_splash_mask) = gtkcreate_png("$xpm_path_l/splash.png");
+# my $tree= new Gtk::Tree;
+# $tree->set_selection_mode('browse');
+# $tree->set_view_lines(0);
+# $tree->set_view_mode('item');
+# map { create_tree_item($tree, $_->[0] , "$xpm_path_l/$_->[1]",1); }
+# @tree_parent;
+# map { create_tree_item($treeitem_sub[st(int($_->[2]))],$_->[0], "$xpm_path_l/$_->[1]",0);}
+# @tree_app;
+
+# $scrolled_global->add_with_viewport(gtkpack(new Gtk::VBox(0,0),
+# gtkappenditems(my $list = new Gtk::List,
+# map_index {
+# my $k = $::i+1;
+# gtkadd(
+# gtksignal_connect(new Gtk::ListItem,
+# select => sub { $notebook_global->set_page($k) }),
+# icon_label_box($_->[0], "$png_path/$_->[1]")) } @tree )
+# )
+# );
+#$list->set_selection_mode('browse');
+
+my $cursor = new Gtk::Gdk::Cursor 15;
+foreach (@tree) {
+ $notebook_global->append_page(
+# gtkicons_labels_widget($_->[2], $window_global, "#0#0#0", _("-urw-times-bold-r-normal-*-*-100-*-*-p-*-iso8859-1"),
+# 2, $pixmap_back_right, 540, 460, 44, 40, 5, 5, 32, 32)
+ gtkicons_labels_widget($_->[2], $window_global, "#0#0#0", _("-b&h-lucida sans unicode-medium-r-normal-*-*-100-*-*-p-*-iso8859-1"),
+ #"-urw-times-bold-r-normal-*-*-100-*-*-p-*-iso8859-1"),
+ 2, $pixmap_back_right, 540, 460, 44, 40, 50, 50, 32, 32)
+ );
+
+}
+
+# my $cursor = new Gtk::Gdk::Cursor 10;
+# foreach (@tree) {
+# $notebook_global->append_page(
+# createScrolledWindow(
+# create_packtable(
+# { col_spacings => 5, row_spacings => 5 , homogeneous => 0},
+# common::group_n_lm(9, map {
+# my $b = gtkpack__(new Gtk::VBox(0, 0),
+# gtkpack_(new Gtk::HBox(0, 0),
+# 1, new Gtk::HBox(0, 0),
+# 0, my $darea = new Gtk::DrawingArea,
+# 1, new Gtk::HBox(0, 0),
+# ),
+# $_->[0]
+# );
+# my @pix = gtkcreate_png("$png_path/" . $_->[1]);
+# $darea->size(32, 32);
+# $darea->signal_connect(expose_event => sub {
+# $darea->window->draw_rectangle($darea->style->white_gc, 1, 0, 0,
+# $darea->allocation->[2], $darea->allocation->[3]);
+# $darea->window->set_cursor($cursor);
+# $darea->window->draw_pixmap($darea->style->white_gc, $pix[0], 0, 0, 0, 0, 32, 32);
+# 0;
+# });
+# $b;
+# } @{$_->[2]})
+# )
+# ), undef
+# )
+# }
+
+#$window_global->realize;
+$window_global->show_all;
+$notebook_global->set_page(0);
my @anim;
-($anim[$_]->[0], $anim[$_]->[1]) = gtkcreate_png("$xpm_path_l/anim_" . ($_ + 1) . ".png") foreach (0..9);
-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);
- return 0;
- });
-
+($anim[$_]->[0], $anim[$_]->[1]) = gtkcreate_png("$png_path/anim_" . ($_ + 1) . ".png") foreach (0..9);
+
$SIG{USR1} = sub {
- ${$tree_launched{$_}->[1]}->deselect() foreach (keys %tree_launched);
+# ${$tree_launched{$_}->[1]}->deselect() foreach (keys %tree_launched);
$notebook_global->set_page(0);
- $scrolled_global->set_usize(210, 0);
+# $scrolled_global->set_usize(180, 0);
}; # embedded applications will send me that signal in order to "hide" them
$SIG{TERM} = \&quit_global; # embedded applications will send me that signal in order to quit the cc.
my $global_vbox;
@@ -258,9 +361,41 @@ $SIG{USR2} = sub { Gtk->timeout_remove($lock_time_tag);
};
-Gtk->main_iteration while Gtk->events_pending;
+#$darea_title->window->set_back_pixmap($pixmap_back, 0);
+#Gtk->main_iteration while Gtk->events_pending;
+#$darea_title->signal_emit("configure_event", undef);
+#$darea_title->signal_emit("expose_event", undef);
+#$window_global->signal_emit("configure_event", undef);
+#$window_global->signal_emit("expose_event", undef);
+#$window_global->signal_emit("unmap_event", undef);
+#$darea_title->signal_emit("visibility_notify_event", undef);
+#$window_global->signal_emit("visibility_notify_event", undef);
+#Gtk::Gdk->flush;
+
+#$darea_title->signal_emit("resize_event", undef);
+#gtkmove($window_global, 50, 50);
+#gtkresize($window_global, 500, 500);
Gtk->main;
+
+
+#-------------------------- new control-center ---------------
+sub icon_label_box {
+ my ($label_text, $png_filename) = @_;
+ my $box = new Gtk::HBox(0, 0);
+ $box->pack_start(new Gtk::Pixmap(gtkcreate_png($png_filename)), 0, 0, 3);
+ $box->pack_start(new Gtk::Label($label_text), 0, 0, 3);
+ $box->border_width(2);
+ $box;
+}
+
+
+
+
+
+
+
+
#-------------------------------------------------------------
# i18n routines
# IMPORTANT: next two routines have to be redefined here to
@@ -282,13 +417,13 @@ sub translate {
# plug & tree sub
#-------------------------------------------------------------
-sub st {
- return (@tree_parent - $_[0]);
-}
+# sub st {
+# return (@tree_parent - $_[0]);
+# }
sub exec_treeitem {
my ($label, $exec_string, $available) = @_;
-# $scrolled_global->set_usize($label eq _("Software Manager") ? 1 : 210, 0);
+# $scrolled_global->set_usize($label eq _("Software Manager") ? 1 : 180, 0);
if (!$available) {
my $vbox = new Gtk::VBox(0, 0);
$vbox->pack_start( new Gtk::Label( _("The application cannot be loaded,\nthe file '%s' has not been found.\nTry to install it.", $exec_string)), 1, 0, 0);
@@ -300,7 +435,7 @@ sub exec_treeitem {
return;
}
if (!$tree_launched{$label}->[0]) {
- (member($label, keys(%xapp))) ? xplug($label) : gtkplug($label,$exec_string);
+# (member($label, keys(%xapp))) ? xplug($label) : gtkplug($label,$exec_string);
} else {
$notebook_global->set_page($tree_launched{$label}->[0]);
}
@@ -327,12 +462,12 @@ sub gtkplug {
my $darea1= new Gtk::DrawingArea();
$darea1->size(350,12);
$darea1->set_usize(340,12);
- $frame0 = new Gtk::Frame;
- $frame0->add($darea1);
- $frame0->show;
+# $frame0 = new Gtk::Frame;
+# $frame0->add($darea1);
+# $frame0->show;
$darea1->show;
- $frame0->set_shadow_type('etched_out');
- $hbox->pack_start($frame0,1,0,0);
+# $frame0->set_shadow_type('etched_out');
+# $hbox->pack_start($frame0,1,0,0);
my $socket = new Gtk::Socket;
$global_socket = \$socket;
$vbox->pack_start($socket, 1, 1, 0);
@@ -379,7 +514,7 @@ sub xplug {
$tree_launched{$_[0]}->[0]=$nb_pages;
$notebook_global->set_page($nb_pages);
$socket->realize;
- $socket->steal(launch_xapp($xapp{$_[0]}));
+# $socket->steal(launch_xapp($xapp{$_[0]}));
$socket->show_all();
$notebook_global->set_page($nb_pages);
}
@@ -388,6 +523,7 @@ sub launch_xapp {
# my ($exec, $grep, $num) = @_;
my $b = "xwininfo -root -tree -int | grep '" . $_[0]->[1] . "'";
my @before = split ('\n', `$b`);
+ my $pid;
unless ($pid = fork) {
print $pid ."\n";
splash_warning(_("cannot fork: %s", $~)) unless defined $pid;
@@ -416,47 +552,16 @@ sub launch_xapp {
# sub
#-------------------------------------------------------------
-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->fontset_load(_("-adobe-times-bold-r-normal--17-*-100-100-p-*-iso8859-*,*-r-*")));
- $pix->draw_string($style->font, $darea1->style->black_gc, 73, 170, _("The place where you can configure your Mandrake Box") );
-
- my @revtree;
- open VERS, "/etc/mandrake-release" or die _("cannot open this file for read: %s", $!);
- while (<VERS>) { push (@revtree,$_) }
- my @info_tree = split / /, $revtree[0];
-
- my ($sysname, $nodename, $release, $version, $machine) = POSIX::uname();
-
- my $style1 = new Gtk::Style;
- $style1->font(Gtk::Gdk::Font->fontset_load(_("-adobe-times-bold-r-normal--14-*-100-100-p-*-iso8859-*,*-r-*")));
-
- my $i=0;
- foreach(
- [_("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, 80, 250+$i, $_->[0]);
- $pix->draw_string($style_dflt->font, $darea1->style->black_gc, 200, 250+$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 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 quit_global {
foreach(@pid_launched) {
- kill TERM, $_ if (defined $_);
+ kill 'TERM', $_ if (defined $_);
}
Gtk->exit(0);
}
@@ -494,11 +599,11 @@ sub create_tree_item {
$treeitem->add($treebox);
if ($tree_depth_max == 0) {
$tree_launched{$label}->[1]=\$treeitem;
- $treeitem->signal_connect(select => sub { exec_treeitem($label, $tree_exec{$label}, -e $tree_exec{$label} ) });
+# $treeitem->signal_connect(select => sub { exec_treeitem($label, $tree_exec{$label}, -e $tree_exec{$label} ) });
} else {
$treeitem->signal_connect(button_press_event => sub { $expanded ? $treeitem->collapse : $treeitem->expand; $expanded = !$expanded });
- $treeitem->signal_connect(select => sub { $treeitem_old and $$treeitem_old->collapse(); $treeitem->expand(); $treeitem_old=\$treeitem;
- $expanded=1; });
+# $treeitem->signal_connect(select => sub { $treeitem_old and $$treeitem_old->collapse(); $treeitem->expand(); $treeitem_old=\$treeitem;
+# $expanded=1; });
}
$parent_tree->append($treeitem);
$treeitem->show_all();
@@ -508,7 +613,7 @@ sub create_tree_item {
$new_subtree= new Gtk::Tree();
$treeitem->set_subtree($new_subtree);
$new_subtree->ref();
- unshift(@treeitem_sub, $new_subtree);
+# unshift(@treeitem_sub, $new_subtree);
}
}
@@ -586,8 +691,21 @@ sub about_mdk_cc {
sub get_main_menu {
my ($window) = @_;
my $accel_group = new Gtk::AccelGroup();
- my $item_factory = new Gtk::ItemFactory( 'Gtk::MenuBar', '<main>', $accel_group );
- $item_factory->create_items( @menu_items );
- $window->add_accel_group( $accel_group );
- return ( $item_factory->get_widget( '<main>' ) );
+ my $item_factory = new Gtk::ItemFactory('Gtk::MenuBar', '<main>', $accel_group);
+ $item_factory->create_items(
+ (
+ { path => _("/_File"), type => '<Branch>' },
+ { path => _("/File")._("/_Quit"), accelerator => _("<control>Q"), callback => \&quit_global },
+ { path => _("/_Help"),type => '<Branch>' },
+# { path => _("/Help")._("/_Help on line"), callback => sub { Gtk->exit(0) } },
+ { path => _("/Help")._("/_Report Bug") , callback => sub {connect_to_site("https://qa.mandrakesoft.com/");}},
+ { path => _("/Help/-"), type => '<Separator>' },
+ { path => _("/Help")._("/Mandrake_Campus"), callback => sub {connect_to_site("http://www.mandrakecampus.com/");} },
+ { path => _("/Help")._("/Mandrake_Expert"), callback => sub {connect_to_site("http://www.mandrakeexpert.com/");} },
+ { path => _("/Help/-"), type => '<Separator>' },
+ { path => _("/Help")._("/_About..."), callback => \&about_mdk_cc }
+ )
+ );
+ $window->add_accel_group($accel_group);
+ return ($item_factory->get_widget('<main>'));
}
diff --git a/pixmaps/mcc-splash.png b/pixmaps/mcc-splash.png
index 43efc81c..f837e241 100644
--- a/pixmaps/mcc-splash.png
+++ b/pixmaps/mcc-splash.png
Binary files differ
diff --git a/pixmaps/time-mdk.png b/pixmaps/time-mdk.png
index 3a8b180e..6df09724 100644
--- a/pixmaps/time-mdk.png
+++ b/pixmaps/time-mdk.png
Binary files differ