summaryrefslogtreecommitdiffstats
path: root/control-center3
diff options
context:
space:
mode:
authorDaouda Lo <daouda@mandriva.com>2001-02-05 15:36:29 +0000
committerDaouda Lo <daouda@mandriva.com>2001-02-05 15:36:29 +0000
commit02da0e03759792eb5424a7ed27758255d0d04d7c (patch)
treead78de0ec3b5dc5124fdbed014796bf719520409 /control-center3
parentdd5562609f80da6e2ec96fe46bbddbe40778a2e7 (diff)
downloadcontrol-center-02da0e03759792eb5424a7ed27758255d0d04d7c.tar
control-center-02da0e03759792eb5424a7ed27758255d0d04d7c.tar.gz
control-center-02da0e03759792eb5424a7ed27758255d0d04d7c.tar.bz2
control-center-02da0e03759792eb5424a7ed27758255d0d04d7c.tar.xz
control-center-02da0e03759792eb5424a7ed27758255d0d04d7c.zip
now applications are loading well
Diffstat (limited to 'control-center3')
-rwxr-xr-xcontrol-center3306
1 files changed, 108 insertions, 198 deletions
diff --git a/control-center3 b/control-center3
index bfc4eeeb..891d0a13 100755
--- a/control-center3
+++ b/control-center3
@@ -30,6 +30,8 @@ use Data::Dumper;
my %pixmaps_global;
my $xpm_path="pixmaps";
+my $tree_depth_max = 1;
+my @treeitem_sub;
my $window_global = new Gtk::Window -toplevel;
$window_global->set_usize(800, 600);
@@ -47,11 +49,11 @@ my @item_factory_entries = (
["/File/tearoff1", undef, 0, "<Tearoff>"],
#["/File/_Quit", "<control>Q", 5],
{
- 'path' => "/File/_Quit",
- 'accelerator' => "<control>Q",
- 'action' => 1,
- 'type' => '<Item>'
- },
+ 'path' => "/File/_Quit",
+ 'accelerator' => "<control>Q",
+ 'action' => 1,
+ 'type' => '<Item>'
+ },
["/_Help", undef, 0, "<Branch>"],
["/Help/_Mandrake Control Center", undef, 2],
["/Help/_Report Bug", undef, 3 ],
@@ -160,37 +162,42 @@ $vbox_about->set_spacing(30);
$vbox_about->pack_start($table_info1, 0, 0, 0);
$vbox_about->reorder_child($table_info1,150);
-
$notebook_global->append_page($vbox_about, "$arg");
my $vbox_global_left = new Gtk::VBox(0,0);
$scrolled_global->add_with_viewport($vbox_global_left);
$window_global->realize;
-#map {
-# $pixmaps_global{$_ . '_pixmap'} =
-# Gtk::Gdk::Pixmap->create_from_xpm($window_global->window, Gtk::Widget->get_default_style->bg('normal'), "$xpm_path/$_.xpm");
-#} ('item1', 'item2', 'item3', 'item4', 'item5','draknet1','draknet2','draknet3','draknet4', 'draknet5', 'drakgw');
-
my $tree= new Gtk::Tree;
$vbox_global_left->pack_start($tree,1,1,0);
map {
- create_treeitem($tree,"$xpm_path/logo.xpm",$_);
- } ('Boot Configuration', 'Hardware Configuration', 'User and Groups Management', 'Network and Internet Connection', 'Menu Customization',
- 'Font Management');
-
+ create_tree_item($tree,$_->[0], "$xpm_path/$_->[1]",1);
+} (['Boot Configuration', 'logo.xpm'] , ['Hardware Configuration', 'logo.xpm'] , ['User and Groups Management','logo.xpm'],
+ ['Network and Internet Connection','logo.xpm'] , ['Menu Customization','logo.xpm'] , ['Font Management','logo.xpm']);
+
+map {
+ create_tree_item($treeitem_sub[int($_->[2])],$_->[0], "$xpm_path/$_->[1]",0);
+} (['Drakboot','item.xpm',5] , ['Drakfloppy', 'item.xpm',5] , ['Drakelogo', 'item.xpm',5],
+ ['XFDrake','item.xpm',4] , ['Hardrake','item.xpm',4] , ['Mousedrake', 'item.xpm',4] , ['Printerdrake','item.xpm',4] , ['Keyboarddrake', 'item.xpm',4],
+ ['Userdrake','item.xpm',3] ,
+ ['Draknet' , 'item.xpm',2] , ['Drakgw','item.xpm',2],
+ ['Menudrake' , 'item.xpm',1] ,
+ ['Drakfont', 'item.xpm', 0]);
+
+@tree_exec = ("drakboot", "drakfloppy", "DrakeLogo" , "XFDrake" , "harddrake-auth" , "mousedrake" , "printerdrake" , "keyboarddrake" , "userdrake", "draknet" ,
+ "drakgw", "menudrake" , "drakfont");
+
+$treeitem_sub[1]->select_item(2);
+exec_treeitem(@tree_exec[4],1),;
+
+
my $rc = "control-center.rc";
-Gtk::Rc->parse($rc);
+ Gtk::Rc->parse($rc);
$window_global->show_all;
-#for (my $i=0; $i<$tree{nb_groups}; $i++) {
-# for (my $j=0; $j<$tree[$i]{nb_applis}; $j++) {
-# $tree[$i]{applis}[$j]{darea}->hide;
-# $tree[$i]{applis}[$j]{label}->hide;
-# }
-#}
+
print "num : " . $notebook_global->page_num($vbox_about) . "\n";
-$notebook_global->set_page(0);
+#$notebook_global->set_page(0);
$SIG{USR1} = sub { $notebook_global->set_page(0); }; # embedded applications will send me that signal in order to "hide" them
Gtk->main;
@@ -204,49 +211,45 @@ sub about_mdk_cc()
$window_about->action_area->pack_start($button,$true,$true,0);
$button->show();
- my $label = new Gtk::Label( "Mandrake Control Center 1.0 \n Copyright (C) 2001 Mandrakesoft SA" );
+ my $label = new Gtk::Label( "Mandrake Control Center 1.0 \n Copyright (C) 2001 Mandrakesoft SA\n" );
my $style1 = new Gtk::Style;
$style1->font(Gtk::Gdk::Font->load('-adobe-times-bold-r-normal--14-100-100-100-p-76-iso8859-1'));
$label->set_style($style1);
$window_about->vbox->pack_start( $label, $true, $true, 0 );
$label->show();
-
- my $label1 = new Gtk::Label( "Authors :\n Daouda Lo <daouda\@mandrakesoft.com> \n Damien Krotkine <damien\@mandrakesoft.com>" );
+
+ my $label1 = new Gtk::Label( "Authors :\n\n Daouda Lo <daouda\@mandrakesoft.com> \n \n Damien Krotkine <dams\@mandrakesoft.com>\n" );
$window_about->vbox->pack_start( $label1, $true, $true, 0 );
$label1->show();
-
+
$window_about->show();
}
-sub create_treeitem()
+sub create_tree_item()
{
- my ($parent_tree, ($pixmap, $label)) =@_;
+ my ($parent_tree, $label, $pixmap, $tree_depth_max) =@_;
my (
- $tree_item,
- $treebox
+ $treeitem,
+ $treebox,
+ $new_subtree,
);
-
- $treeitem = new Gtk::TreeItem;
+
+ $treeitem = new Gtk::TreeItem();
$treebox = xpm_label_box($window_global,$pixmap,$label);
$treeitem->add($treebox);
$treebox->show();
$parent_tree->append($treeitem);
-}
-
-sub create_subtree
-{
- my($item, $label) = @_;
-
- my(
- $item_subtree,
- $item_new,
- $nb_item,
- $no_root_item
- );
-
-
+ $treeitem->show();
+
+ if ($tree_depth_max) {
+ $tree_depth_max-- ;
+ $new_subtree= new Gtk::Tree();
+ $treeitem->set_subtree($new_subtree);
+ $new_subtree->ref();
+ unshift(@treeitem_sub, $new_subtree);
+ }
}
sub xpm_label_box
@@ -282,14 +285,11 @@ sub xpm_label_box
$label->show();
return ( $box );
- }
-
-
+}
-sub draw_icon {
- my ($width, $height, $icon_name, $decalage, $exec_string, $name, $number ) = @_;
- my %hash;
+sub exec_treeitem {
+ my ($exec_string,$num) = @_;
if ($exec_string) {
my $socket = new Gtk::Socket;
$socket->show;
@@ -299,159 +299,69 @@ sub draw_icon {
my $a = $exec_string . " --embedded " . $socket->window->XWINDOW . " " . $$ . "&";
print "$a\n";
system ($a);
+ $notebook_global->set_page($num);
}
- $hash{PIX_W} = $width;
- $hash{PIX_H} = $height;
- $hash{actual_pixmap}=1;
- $hash{save_pixmap}=0;
- $hash{anim_idle}=undef;
- $hash{timeout}=undef;
- $hash{darea} = new Gtk::DrawingArea;
- $hash{label} = new Gtk::DrawingArea;
- $hash{label}->set_usize(50, 12);
- $hash{label}->signal_connect(expose_event => sub {
- my $font = $hash{label}->style->font;
- my $w = $font->string_width($name);
- $hash{label}->window->draw_string($font, $hash{label}->style->fg_gc('normal'), ($hash{label}->allocation->[2] - $w) / 2 * 0 + $decalage*20, 9, $name );
-#($hash{label}->allocation->[3]-40)/2
-#$hash{label}->window->draw_string($font, $hash{label}->style->bg_gc('normal'), 0, 10, "QQWWylt"); #($hash{label}->allocation->[3]-40)/2
-});
-
- if ($exec_string) {
- $tree[$group]{applis}[$item]{darea} = $hash{darea};
- $tree[$group]{applis}[$item]{label} = $hash{label};
- }
- $hash{darea}->set_usize($width,$height);
- $hash{darea}->set_events(['exposure_mask', 'enter_notify_mask', 'leave_notify_mask', 'button_press_mask', 'button_release_mask' ]);
- $hash{darea}->signal_connect
- (expose_event => sub {
- $hash{darea}->window->draw_pixmap
- ($hash{darea}->style->bg_gc('normal'),
- $pixmaps_global{ $icon_name . $hash{actual_pixmap} . '_pixmap'}, 0, 0,
- ($hash{darea}->allocation->[2]-$hash{PIX_W})/2*0+($decalage * 20),
- ($hash{darea}->allocation->[3]-$hash{PIX_H})/2,
- $hash{PIX_W} , $hash{PIX_H} );
- });
-
-
- $hash{darea}->signal_connect
- (enter_notify_event => sub {
- $hash{anim_idle} ||= Gtk->idle_add
- ( sub {
- $hash{actual_pixmap}==$hash{save_pixmap} and return 1;
- $hash{darea}->window->draw_pixmap
- ($hash{darea}->style->bg_gc('normal'),
- $pixmaps_global{ $icon_name . 1 . '_pixmap'}, # $hash{actual_pixmap} . '_pixmap'},
- 0, 0,
- ($hash{darea}->allocation->[2]-$hash{PIX_W})/2*0+($decalage * 20),
- ($hash{darea}->allocation->[3]-$hash{PIX_H})/2,
- $hash{PIX_W} , $hash{PIX_H} );
- $hash{save_pixmap}=$hash{actual_pixmap};
- return 1;
- });
-
- $hash{timeout} ||= Gtk->timeout_add
- ( 50, sub {
- $hash{actual_pixmap}++;
- $hash{actual_pixmap}>5 and $hash{actual_pixmap}=1;
- return 1;
- });
- });
-
-
- $hash{darea}->signal_connect
- (leave_notify_event => sub {
- Gtk->main_iteration() while ($hash{save_pixmap}!=1);
- Gtk->idle_remove($hash{anim_idle});
- Gtk->timeout_remove($hash{timeout});
- undef $hash{anim_idle};
- undef $hash{timeout};
- });
- # $hash{darea}->signal_connect(button_press_event => sub { });
- if ($exec_string) {
- $hash{darea}->signal_connect(button_release_event => sub { $notebook_global->set_page($number+1); });
- } else {
- $hash{darea}->signal_connect(button_release_event => sub {
- print "group : $number\n";
- for (my $i=0; $i<$tree{nb_groups}; $i++) {
- for (my $j=0; $j<$tree[$i]{nb_applis}; $j++) {
- if ($i==$number) {
- #print "yep i : $i ; j : $j\n";
- #print Data::Dumper->Dump([$tree[$i]{applis}[$j]{darea}], ['darea-->']) . "\n";
- $tree[$i]{applis}[$j]{darea}->show;
- $tree[$i]{applis}[$j]{label}->show;
- } else {
- #print "nope i : $i ; j : $j\n";
- $tree[$i]{applis}[$j]{darea}->hide;
- $tree[$i]{applis}[$j]{label}->hide;
- }
- }
- }
- });
- }
- $vbox_global_left->pack_start($hash{darea},0,1,0);
- $vbox_global_left->pack_start($hash{label},0,1,0);
}
sub item_factory_cb {
- my ($widget, $action, @data) = @_;
+ my ($widget, $action, @data) = @_;
- print "ItemFactory: activated ", $widget->item_factory_path(), " -> ", $action, "\n";
- $action == 1 and Gtk->exit(0);
- $action == 4 and about_mdk_cc();
+ print "ItemFactory: activated ", $widget->item_factory_path(), " -> ", $action, "\n";
+ $action == 1 and Gtk->exit(0);
+ $action == 4 and about_mdk_cc();
}
sub create_item_factory {
- if (!defined $item_factory_window) {
- my ($accel_group, $item_factory, $box1, $label, $box2);
- my ($separator, $button, $dummy);
-
-
- $item_factory_window = new Gtk::Window('toplevel');
- signal_connect $item_factory_window destroy => \&destroy_window, \$item_factory_window;
- signal_connect $item_factory_window "delete-event" => \&destroy_window, \$item_factory_window;
-
- $accel_group = new Gtk::AccelGroup;
- $item_factory = new Gtk::ItemFactory('Gtk::MenuBar', "<main>", $accel_group);
-
- #$item_factory_window->set_data('<main>', $item_factory);
- $accel_group->attach($item_factory_window);
- # $item_factory->create_items();
- foreach (@item_factory_entries) {
- $item_factory->create_item($_, \&item_factory_cb);
- }
-
- $item_factory_window->set_title("Item Factory");
- $item_factory_window->set_border_width(0);
-
- $box1 = new Gtk::VBox(0, 0);
- $item_factory_window->add($box1);
- $box1->pack_start($item_factory->get_widget('<main>'), 0, 0, 0);
-
- $label = new Gtk::Label "Type\n<alt>\nto start";
-
- $label->set_usize(200, 200);
- $label->set_alignment(0.5, 0.5);
- $box1->pack_start($label, 1, 1, 0);
-
- $separator = new Gtk::HSeparator;
- $box1->pack_start($separator, 0, 1, 0);
-
- $box2 = new Gtk::VBox(0, 10);
- $box2->set_border_width(10);
- $box1->pack_start($box2, 0, 1, 0);
-
- $button = new Gtk::Button("close");
- $button->signal_connect('clicked', sub {$item_factory_window->destroy;});
- $box2->pack_start($button, 1, 1, 0);
- $button->can_default(1);
- $button->grab_default;
-
- }
- if (!visible $item_factory_window) {
- show_all $item_factory_window;
- } else {
- destroy $item_factory_window;
+ if (!defined $item_factory_window) {
+ my ($accel_group, $item_factory, $box1, $label, $box2);
+ my ($separator, $button, $dummy);
+
+
+ $item_factory_window = new Gtk::Window('toplevel');
+ signal_connect $item_factory_window destroy => \&destroy_window, \$item_factory_window;
+ signal_connect $item_factory_window "delete-event" => \&destroy_window, \$item_factory_window;
+
+ $accel_group = new Gtk::AccelGroup;
+ $item_factory = new Gtk::ItemFactory('Gtk::MenuBar', "<main>", $accel_group);
+
+ #$item_factory_window->set_data('<main>', $item_factory);
+ $accel_group->attach($item_factory_window);
+ # $item_factory->create_items();
+ foreach (@item_factory_entries) {
+ $item_factory->create_item($_, \&item_factory_cb);
}
+
+ $item_factory_window->set_title("Item Factory");
+ $item_factory_window->set_border_width(0);
+
+ $box1 = new Gtk::VBox(0, 0);
+ $item_factory_window->add($box1);
+ $box1->pack_start($item_factory->get_widget('<main>'), 0, 0, 0);
+
+ $label = new Gtk::Label "Type\n<alt>\nto start";
+
+ $label->set_usize(200, 200);
+ $label->set_alignment(0.5, 0.5);
+ $box1->pack_start($label, 1, 1, 0);
+
+ $separator = new Gtk::HSeparator;
+ $box1->pack_start($separator, 0, 1, 0);
+
+ $box2 = new Gtk::VBox(0, 10);
+ $box2->set_border_width(10);
+ $box1->pack_start($box2, 0, 1, 0);
+
+ $button = new Gtk::Button("close");
+ $button->signal_connect('clicked', sub {$item_factory_window->destroy;});
+ $box2->pack_start($button, 1, 1, 0);
+ $button->can_default(1);
+ $button->grab_default;
+
+ }
+ if (!visible $item_factory_window) {
+ show_all $item_factory_window;
+ } else {
+ destroy $item_factory_window;
+ }
}