summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordamien <damien@mandriva.com>2002-02-01 12:36:39 +0000
committerdamien <damien@mandriva.com>2002-02-01 12:36:39 +0000
commite5da9b72708f1ed3059b194868dff3d7bab7004f (patch)
treeeee61996b9b08111b9f3b4a5ecfe407e68469118
parentaf54ecae31e243a7a0894ce242de40a5dcb1e746 (diff)
downloadcontrol-center-e5da9b72708f1ed3059b194868dff3d7bab7004f.tar
control-center-e5da9b72708f1ed3059b194868dff3d7bab7004f.tar.gz
control-center-e5da9b72708f1ed3059b194868dff3d7bab7004f.tar.bz2
control-center-e5da9b72708f1ed3059b194868dff3d7bab7004f.tar.xz
control-center-e5da9b72708f1ed3059b194868dff3d7bab7004f.zip
improvment
-rwxr-xr-xcontrol-center305
-rw-r--r--pixmaps/partition-mdk.pngbin2034 -> 1478 bytes
-rw-r--r--pixmaps/partition-mdk2.pngbin2035 -> 1479 bytes
-rw-r--r--pixmaps/partition-mdk_highlight.pngbin2035 -> 1479 bytes
4 files changed, 199 insertions, 106 deletions
diff --git a/control-center b/control-center
index af53fd07..eac0a06a 100755
--- a/control-center
+++ b/control-center
@@ -52,6 +52,16 @@ my $_version = "0.90";
my $in = 'interactive'->vnew('su', 'default');
+my $conffile = "/root/.mcc";
+my %h = getVarsFromSh($conffile);
+my $embedded;
+my $logs;
+defined $h{EMBEDDED} or $h{EMBEDDED} = bool2text(1);
+defined $h{LOGS} or $h{LOGS} = bool2text(1);
+($embedded, $logs) = (text2bool($h{EMBEDDED}), text2bool($h{LOGS}));
+
+my ($log_check_box, $embedded_check_box);
+
#my %pixmaps_global;
#my $xpm_path="$_iconsdir";
#my $xpm_path_l="$_iconsdir";
@@ -70,12 +80,46 @@ my $png_path="$_iconsdir";
$::isWiz = -e "/usr/sbin/wizdrake"; #- $in->do_pkgs->is_installed(q(wizard));
+my $exec_hash =
+ {
+ _("Boot Disk") => {
+ arg => "$_xbindir/drakfloppy.real",
+ function => \&compute_exec_string,
+ },
+ _("Boot Config") => {
+ arg => "$_sbindir/drakboot",
+ function => \&compute_exec_string,
+ },
+ _("Auto Install") => "$_sbindir/drakautoinst",
+ _("Display") => "$_sbindir/XFdrake",
+ _("Hardware") => "$_sbindir/harddrake",
+ _("Mouse") => "$_sbindir/mousedrake",
+ _("Printer") => "$_sbindir/print.pm",
+ _("Keyboard") => "$_sbindir/keyboarddrake",
+ _("Hard Drives") => "$_sbindir/diskdrake --hd",
+ _("Removable disks") => "$_sbindir/diskdrake --removable",
+ _("NFS mount points") => "$_sbindir/diskdrake --nfs",
+ _("Samba mount points") => "$_sbindir/diskdrake --smb",
+ _("Connection") => "$_sbindir/draknet",
+ _("Connection Sharing") => "$_sbindir/drakgw",
+ _("Security Level") => "$_sbindir/draksec",
+ _("Firewalling") => "$_sbindir/tinyfirewall",
+ _("Menus") => "$_sbindir/menus.pm",
+ _("Services") => "$_sbindir/drakxservices",
+ _("Fonts") => "$_sbindir/drakfont",
+ _("Date & Time") => "$_sbindir/clock.pm",
+ _("Software Manager") => "$_bindir/rpmdrake",
+ _("Logs") => "$_sbindir/logdrake",
+ _("Console") => "$_xbindir/rxvt",
+ _("Servers") => "$_sbindir/wizdrake",
+ };
+
my @tree =
( [_("Boot"), 'boot-mdk',
[
- [_("Boot Disk"), 'drakfloppy-mdk.png', "$_xbindir/drakfloppy.real"],
- [_("Boot Config"),'drakboot-mdk.png', "$_sbindir/drakboot"],
- [_("Auto Install"), 'drakfloppy-mdk.png', "$_sbindir/drakautoinst"],
+ [_("Boot Disk"), 'drakfloppy-mdk.png'],
+ [_("Boot Config"),'drakboot-mdk.png'],
+ [_("Auto Install"), 'drakfloppy-mdk.png'],
]
],
[_("Hardware"), 'drakhard-mdk',
@@ -133,7 +177,7 @@ 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->signal_connect ( delete_event => \&quit_global );
$window_global->set_position(1);
$window_global->set_title( _("Mandrake Control Center %s", 'beta' )); #$_version));
$window_global->set_policy(0, 1, 0);
@@ -201,7 +245,7 @@ foreach (@tree) {
}
});
$darea_left->signal_connect( button_release_event => sub {
- $darea_left->{state} == 2 and $notebook_global->set_page($index-1), return;
+ $darea_left->{state} == 2 and $notebook_global->set_page($index), return;
foreach (@darea_left_list) {
$_->[1]->window->set_cursor($cursor_hand);
if($_->[1]->{state} != 0) {
@@ -211,35 +255,79 @@ foreach (@tree) {
}
$darea_left->window->set_cursor($cursor_normal);
$darea_left->{state} = 2, $darea_left->draw(undef);
- $notebook_global->set_page($index - 1);
+ $notebook_global->set_page($index);
});
push @darea_left_list, [ ($index-1)*45, $darea_left ];
}
+my $exp_socket;
+
+my $emb_box;
+my $emb_socket;
+
+sub compute_exec_string {
+ my ($arg) = @_;
+ if ($embedded) {
+ $arg . " --embedded " . $emb_socket->window->XWINDOW . " " . $$;
+ $notebook_global->hide;
+ $emb_box->show;
+ }
+}
+
+sub res_socket {
+ $emb_box and $emb_box->destroy();
+ gtkshow(gtkpack($emb_box, $emb_socket = new Gtk::Socket));
+}
+
$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, 450, 55),
+ gtkpack_(new Gtk::VBox(0, 0),
+ 0, my $title_w = get_main_menu($window_global),
+ 0, my $fixed_title = gtkset_usize(new Gtk::Fixed, 640, 55),
# 0, my $darea_title = gtkset_usize(new Gtk::DrawingArea, 450, 55),
- 0, new Gtk::HSeparator,
- 1, gtkpack_(new Gtk::HBox(0, 0),
- 0, my $fixed_left = new Gtk::Fixed,
+ 0, new Gtk::HSeparator,
+ 1, gtkpack_(new Gtk::HBox(0, 0),
+ 0, my $fixed_left = new Gtk::Fixed,
# gtkpack2_(new Gtk::VBox(0, 0),
# @darea_left_list,
# 1, my $last_darea = new Gtk::DrawingArea,
# ),
- 1, $notebook_global = new Gtk::Widget ('Gtk::Notebook',
- show_border => 0,
- show_tabs => 0),
- )
- )
+ 1, gtkpack_(my $right_box = new Gtk::VBox(0, 0),
+ 0, $emb_box = new Gtk::HBox(0, 0),
+ 1, $notebook_global = new Gtk::Widget ('Gtk::Notebook',
+ show_border => 0,
+ show_tabs => 0),
+ )
+ )
+ )
);
+my $exp_frame;
+sub update_exp {
+ if($logs && !$exp_frame) {
+ gtkpack($right_box,
+ $exp_frame = gtkset_shadow_type(gtkset_usize(gtkset_border_width(new Gtk::Frame(_("Logs")), 5), 0, 100), 'etched_out')
+ );
+ }
+ if (!$logs && $exp_frame) {
+ $exp_frame->destroy();
+ undef $exp_frame;
+ }
+}
+
+$notebook_global->set_usize(0, ($index) * 45);
+$log_check_box->set_active($logs);
+$embedded_check_box->set_active($embedded);
+
+update_exp();
+res_socket();
+
foreach (@darea_left_list) {
$fixed_left->put($_->[1], 0, $_->[0]);
}
+$fixed_left->signal_connect( realize => sub { $fixed_left->window->set_back_pixmap($pixmap_back_left, 0) });
+
# my $dbl_arealast;
# $last_darea->signal_connect( size_allocate => sub { $dbl_arealast = undef });
# $last_darea->signal_connect( expose_event => sub {
@@ -258,10 +346,19 @@ my $dbl_area;
my ($pixmap_back, undef) = gtkcreate_png('mcc-title-back');
my ($pixmap_icon, undef) = gtkcreate_png('mcc-title-icon');
-$fixed_title->put(my $darea_title = gtkset_usize(new Gtk::DrawingArea, 450, 55), 0, 0);
-#FIXME
-$fixed_left->signal_connect( realize => sub { $fixed_left->window->set_back_pixmap($pixmap_back_left, 0) });
+$fixed_title->put(my $darea_title = gtkset_usize(new Gtk::DrawingArea, 335, 55), 0, 0); # 335 -> 450
+
$fixed_title->signal_connect( realize => sub { $fixed_title->window->set_back_pixmap($pixmap_back, 0) });
+$darea_title->signal_connect( realize => sub { $darea_title->window->set_cursor($cursor_hand) });
+$darea_title->set_events([ 'button_release_mask' ]);
+$darea_title->signal_connect( button_release_event => sub {
+ $notebook_global->set_page(0);
+ foreach (@darea_left_list) {
+ $_->[1]->window->set_cursor($cursor_normal);
+ $_->[1]->{state} = 0;
+ $_->[1]->draw(undef);
+ }
+ });
$darea_title->signal_connect( configure_event => sub { $dbl_area = undef });
$darea_title->signal_connect( expose_event => sub {
@@ -269,16 +366,16 @@ $darea_title->signal_connect( expose_event => sub {
my ($dx, $dy) = ($darea_title->allocation->[2], $darea_title->allocation->[3]);
if (!defined($dbl_area)) {
# *always* uyse a fontset to write something on screen
- my ($pix, $width, $height) = create_pix_text($darea_title, _("welcome"), "#255#255#255",
- undef, #Gtk::Gdk::Font->fontset_load( _("-*-helvetica-medium-r-normal-*-*-190-*-*-p-*-iso8859-1,*-r-*")),
- max($dx-336, 0), $dy, 0, 1, $pixmap_back, 110, 55, 0, 0);
+# my ($pix, $width, $height) = create_pix_text($darea_title, _("welcome"), "#255#255#255",
+# undef, #Gtk::Gdk::Font->fontset_load( _("-*-helvetica-medium-r-normal-*-*-190-*-*-p-*-iso8859-1,*-r-*")),
+# max($dx-336, 0), $dy, 0, 1, $pixmap_back, 110, 55, 0, 0);
$dbl_area = new Gtk::Gdk::Pixmap($darea_title->window, $dx, $dy);
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 + 15;
- $dbl_area->draw_pixmap($darea_title->style->bg_gc('normal'),
- $pix, 0, 0, 336, $y_pos, $width, $height);
+ $pixmap_icon, 0, 0, 0, 0, 325, 55);
+# my $y_pos = int( (55-$height)/2/5 )*5 + 15;
+# $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, $dim[0], $dim[1], $dim[0], $dim[1], $dim[2], $dim[3]);
@@ -286,103 +383,82 @@ $darea_title->signal_connect( expose_event => sub {
my ($pixmap_back_right, undef) = gtkcreate_png('mcc-core-back');
-# my ($pix_splash_map, undef) = gtkcreate_png('mcc-splash');
-# my $pix_dbl;
-# $notebook_global->append_page(my $scrolled_about = createScrolledWindow(my $fixed_about = new Gtk::Fixed, ['automatic', 'automatic']), undef);
-# $scrolled_about->set_usize(544, 464);
-# $fixed_about->put(gtkset_usize(my $darea1 = new Gtk::DrawingArea, 540, 460), 0, 0);
-# $fixed_about->signal_connect( realize => sub { $fixed_about->window->set_back_pixmap($pix_splash_map, 0) });
+my ($pix_splash_map, undef) = gtkcreate_png('mcc-splash');
+my $pix_dbl;
+$notebook_global->append_page(my $darea1 = new Gtk::DrawingArea);#my $fixed_about = new Gtk::Fixed);
+#$fixed_about->put(my $darea1 = new Gtk::DrawingArea, 0, 0);
+#$fixed_about->signal_connect( realize => sub { $fixed_about->window->set_back_pixmap($pixmap_back, 0); $darea1->set_usize($fixed_about->allocation->[2], $fixed_about->allocation->[3]) });
+#}); #right, 0) });
# $fixed_about->signal_connect( configure_event => sub { print "CONFIGURE\n"; });
-# $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(_("-urw-helvetica-medium-r-normal-*-*-190-*-*-p-*-iso8859-1,*-r-*")));
-# #_("-adobe-times-bold-r-normal--17-*-100-100-p-*-iso8859-*,*-r-*")));
-# $pix_dbl->draw_string($style->font, $darea1->style->black_gc, 80, 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(_("-urw-helvetica-medium-r-normal-*-*-90-*-*-p-*-iso8859-1,*-r-*")));
-# #_("-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($style_dflt->font, $darea1->style->black_gc, 80, 200+$i, $_->[0]);
-# $pix_dbl->draw_string($style_dflt->font, $darea1->style->black_gc, 81, 200+$i, $_->[0]);
-# $pix_dbl->draw_string($style_dflt->font, $darea1->style->black_gc, 200, 200+$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;
-# });
+#$darea1->set_usize(540, 460);
+$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(_("-urw-helvetica-medium-r-normal-*-*-190-*-*-p-*-iso8859-1,*-r-*")));
+ #_("-adobe-times-bold-r-normal--17-*-100-100-p-*-iso8859-*,*-r-*")));
+ $pix_dbl->draw_string($style->font, $darea1->style->black_gc, 80, 115, _("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(_("-urw-helvetica-medium-r-normal-*-*-90-*-*-p-*-iso8859-1,*-r-*")));
+ #_("-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($style_dflt->font, $darea1->style->black_gc, 80, 150+$i, $_->[0]);
+ $pix_dbl->draw_string($style_dflt->font, $darea1->style->black_gc, 81, 150+$i, $_->[0]);
+ $pix_dbl->draw_string($style_dflt->font, $darea1->style->black_gc, 200, 150+$i, $_->[1]);
+ $i+=20;
+ }
+ }
+ $darea1->window->draw_pixmap ($darea1->style->white_gc,
+ $pix_dbl, 0, 0,
+ 0, 0, $dx, $dy);
+ 0;
+ });
+#$fixed_about->signal_connect( expose_event => sub {
+# $darea1->set_usize($fixed_about->allocation->[2], $fixed_about->allocation->[3]);
+# undef $pix_dbl;
+# $darea1->draw(undef);
+# } );
+#my $timeout_about = Gtk->timeout_add(100, sub { $fixed_about->set_usize($scrolled_about->allocation->[2] - 22, 0); 0; });
my $cursor = new Gtk::Gdk::Cursor 15;
foreach (@tree) {
my $w = gtkicons_labels_widget($_->[2], $window_global, "#0#0#0", $style_dflt->font,
#"-urw-times-bold-r-normal-*-*-100-*-*-p-*-iso8859-1"),
- $pixmap_back_right, 540, 460, 55, 50, 50, 50, 50, 50);
+ $pixmap_back_right, 540, 460, 55, 50, 50, 50, 50, 50, $exec_hash);
$notebook_global->append_page($w);
}
$window_global->show_all;
+$emb_box->hide;
$window_global->realize;
+$window_global->hide;
+#$exp_socket->realize;
+#my $logdrake_string = "/usr/sbin/logdrake --embedded " . $socket->window->XWINDOW . " " . $$;
my @pid_launched;
my %tree_launched;
-# 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->hide;
Gtk->main_iteration while Gtk->events_pending;
$notebook_global->signal_connect( switch_page => sub {
my (undef, $tab_widget, $tab_number) = @_;
+ $tab_number > 0 or return;
$tab_widget->child->child->child->{redraw_function}->();
});
foreach (0..$#tree) {
@@ -427,6 +503,8 @@ $SIG{USR2} = sub { Gtk->timeout_remove($lock_time_tag);
#$darea_title->signal_emit("resize_event", undef);
#gtkmove($window_global, 50, 50);
#gtkresize($window_global, 500, 500);
+#$scrolled_about->set_usize(50, 50);
+#$fixed_title->set_usize(450, 55),
Gtk->main;
@@ -619,6 +697,10 @@ sub quit_global {
foreach(@pid_launched) {
kill 'TERM', $_ if (defined $_);
}
+ setVarsInSh($conffile, {
+ EMBEDDED => bool2text($embedded),
+ LOGS => bool2text($logs)
+ });
Gtk->exit(0);
}
@@ -744,6 +826,15 @@ sub about_mdk_cc {
$window_about->set_modal(1);
}
+sub display_logs {
+ $logs = $log_check_box->active;
+ update_exp();
+}
+
+sub embedded_mode {
+ $embedded = $embedded_check_box->active;
+}
+
sub get_main_menu {
my ($window) = @_;
my $accel_group = new Gtk::AccelGroup();
@@ -782,5 +873,7 @@ sub get_main_menu {
)
);
$window->add_accel_group($accel_group);
+ $log_check_box = $item_factory->get_widget('<main>/Options/Display Logs');
+ $embedded_check_box = $item_factory->get_widget('<main>/Options/Embedded Mode');
return ($item_factory->get_widget('<main>'));
}
diff --git a/pixmaps/partition-mdk.png b/pixmaps/partition-mdk.png
index 7c467593..d3a63b62 100644
--- a/pixmaps/partition-mdk.png
+++ b/pixmaps/partition-mdk.png
Binary files differ
diff --git a/pixmaps/partition-mdk2.png b/pixmaps/partition-mdk2.png
index 3ad585f1..05da667c 100644
--- a/pixmaps/partition-mdk2.png
+++ b/pixmaps/partition-mdk2.png
Binary files differ
diff --git a/pixmaps/partition-mdk_highlight.png b/pixmaps/partition-mdk_highlight.png
index 3ad585f1..120f6592 100644
--- a/pixmaps/partition-mdk_highlight.png
+++ b/pixmaps/partition-mdk_highlight.png
Binary files differ