summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xcontrol-center163
-rw-r--r--drakconf.spec7
-rwxr-xr-xmenus_launcher.pl31
3 files changed, 101 insertions, 100 deletions
diff --git a/control-center b/control-center
index 289f1b3c..b33eda42 100755
--- a/control-center
+++ b/control-center
@@ -27,6 +27,7 @@ use lib qw(/usr/lib/libDrakX);
use standalone;
use common;
use detect_devices;
+use lang;
# i18n: IMPORTANT: to get correct namespace (drakconf instead of libDrakX)
BEGIN { unshift @::textdomains, 'drakconf' }
@@ -69,8 +70,6 @@ Gtk2::Rc->parse($rc) if -r $rc;
my $window_splash = Gtk2::Window->new('popup');
$window_splash->signal_connect(delete_event => \&quit_global);
$window_splash->set_title(N("Mandrake Control Center") . $version);
-$window_splash->allow_shrink(0);
-$window_splash->allow_grow(0);
$window_splash->set_position('center_always');
$window_splash->add(gtkadd(gtkset_shadow_type(Gtk2::Frame->new, 'etched_out'),
gtkpack(Gtk2::VBox->new(0, 0),
@@ -284,51 +283,57 @@ my %options = (
'wiz_expert' => [ N("/_Options"), N("/Expert mode in _wizards") ],
);
-my ($menu, $factory) = create_factory_menu($window_global,
- ({ path => N("/_File"), type => '<Branch>' },
- { path => N("/_File") . N("/_Quit"), accelerator => N("<control>Q"), callback => \&quit_global },
- { path => N("/_Options"), type => '<Branch>' },
- { path => join('', @{$options{show_log}}), type => '<CheckItem>',
- callback => sub {
- $option_values{show_log} = $check_boxes{show_log}->active;
- update_exp();
- }
- },
- { path => join('', @{$options{embedded_mode}}), type => '<ToggleItem>',
- callback => sub { $option_values{embedded} = $check_boxes{embedded_mode}->active }
- },
- if_($::isWiz,
- { path => join('', @{$options{wiz_expert}}), type => '<ToggleItem>',
- callback => sub { $option_values{expert_wizard} = $check_boxes{wiz_expert}->active }
- },
- ),
- if_(all($themes_dir) > 1,
- { path => N("/_Themes"), type => '<Branch>' },
- (map {
- my $name = $_;
- { path => N("/_Themes") . "/" . ($name eq $theme ? " O " : " ") . "_$_",
- callback => sub {
- return if $theme eq $name;
- !$pending_app || splash_warning(N("This action will restart the control center.\nAny change not applied will be lost."), 1) and do {
- # embedded app must be killed
- kill_children();
- kill_logdrake();
- child_just_exited();
- exec "$0 --theme $name";
- };
- }
- }
- } grep { -d "$themes_dir/$_" } all($themes_dir)),
- { path => N("/_Themes").N("/_More themes"), callback => \&more_themes }
- ),
- { path => N("/_Help"), type => '<Branch>' },
- { path => N("/_Help").N("/_Help"), callback => sub { fork_("drakhelp Drakxtools-Guide.html/drakconf-intro.html") } },
- { path => N("/_Help").N("/_Report Bug"), callback => sub { fork_("drakbug --report drakconf &") } },
- { path => N("/_Help").N("/_About..."), callback => \&about_mdk_cc }
- ));
+my @menu_items = (
+ [ N("/_File"), undef, undef, undef, '<Branch>' ],
+ [ N("/_File") . N("/_Quit"), N("<control>Q"), \&quit_global, undef, '<StockItem>', 'gtk-quit' ],
+ [ N("/_Options"), undef, undef, undef, '<Branch>' ],
+ [ join('', @{$options{show_log}}), undef,
+ sub {
+ $option_values{show_log} = $check_boxes{show_log}->get_active;
+ update_exp();
+ },
+ undef, '<CheckItem>'
+ ],
+ [ join('', @{$options{embedded_mode}}), undef,
+ sub { $option_values{embedded} = $check_boxes{embedded_mode}->get_active },
+ undef, '<CheckItem>',
+ ],
+ if_($::isWiz,
+ [ join('', @{$options{wiz_expert}}), undef,
+ sub { $option_values{expert_wizard} = $check_boxes{wiz_expert}->get_active },
+ undef, '<CheckItem>',
+ ],
+ ),
+ if_(all($themes_dir) > 1,
+ [ N("/_Themes"), undef, undef, undef, '<Branch>' ],
+ (map {
+ my $name = $_;
+ [ N("/_Themes") . "/" . ($name eq $theme ? " O " : " ") . "_$_", undef,
+ sub {
+ return if $theme eq $name;
+ !$pending_app || splash_warning(N("This action will restart the control center.\nAny change not applied will be lost."), 1) and do {
+ # embedded app must be killed
+ kill_children();
+ kill_logdrake();
+ child_just_exited();
+ exec "$0 --theme $name";
+ };
+ }, '<CheckItem>'
+ ]
+ } grep { -d "$themes_dir/$_" } all($themes_dir)),
+ [ N("/_Themes").N("/_More themes"), undef, \&more_themes, undef, '<Item>' ]
+ ),
+ [ N("/_Help"), undef, undef, undef, '<Branch>' ],
+ [ N("/_Help").N("/_Help"), undef, sub { fork_("drakhelp Drakxtools-Guide.html/drakconf-intro.html") }, undef, '<StockItem>', 'gtk-help' ],
+ [ N("/_Help").N("/_Report Bug"), undef, sub { fork_("drakbug --report drakconf &") }, undef, '<Item>' ],
+ [ N("/_Help").N("/_About..."), undef, \&about_mdk_cc, undef, '<Item>' ]
+ );
+
+my ($menu, $factory) = create_factory_menu($window_global, @menu_items);
+
%check_boxes = map {
- $_ => $factory->get_widget("<main>" . join '', map { s/_//; $_ } @{$options{$_}})
+ $_ => $factory->get_widget("<main>" . join('', map { s/_//; $_ } @{$options{$_}}))
} ("embedded_mode", "show_log", if_($::isWiz, "wiz_expert"));
@@ -363,7 +368,7 @@ gtkadd($window_global,
0, Gtk2::Label->new(N("Please wait...")),
1, Gtk2::HBox->new(0, 0),
0, gtkadd(gtkset_layout(gtkset_border_width(Gtk2::HButtonBox->new, 10), 'end'),
- gtksignal_connect(Gtk2::Button->new_from_stock('gtk-cancel'), clicked => sub { Gtk2->timeout_remove($timeout) if $timeout; &child_just_exited() }),
+ gtksignal_connect(Gtk2::Button->new_from_stock('gtk-cancel'), clicked => sub { Glib::Source->remove($timeout) if $timeout; &child_just_exited() }),
),
),
),
@@ -395,33 +400,25 @@ my $pixbuf_icon = gtkcreate_pixbuf('mcc-title-icon');
# main page (summary) :
-my $summary = create_scrolled_window(
- gtkpack_(Gtk2::VBox->new(0, 0),
- 1, gtkset_size_request(
- gtkset_border_width(
- gtktext_insert(Gtk2::TextView->new, [
- [ N("Welcome to the Mandrake Control Center")."\n\n",
- {'size-points' => 15, justification => 'center', 'weight-set' => 1, weight => 1000 } ],
- [ formatAlaTeX(N("Mandrake Control Center is Mandrake Linux's main configuration
+my $summary = gtktext_insert(Gtk2::TextView->new, [
+ [ N("Welcome to the Mandrake Control Center")."\n\n",
+ {'size-points' => 15, justification => 'center', 'weight-set' => 1, weight => 1000 } ],
+ [ formatAlaTeX(N("Mandrake Control Center is Mandrake Linux's main configuration
tool. It enables the system administrator to configure the hardware
and services used for all users.
The tools accessed through the Mandrake Control Center greatly
simplify the use of the system, notably by avoiding the use of the
-evil command line.")) ]
- ]),
- 40),
- 50, 50),
- 0, gtkpack2__(Gtk2::HBox->new(0, 0),
- { 'pack_end' => 1, expand => 0, fill => 0 }, gtkcreate_img('mcc-welcome-logo'),
- )
- ),
- undef, 'none');
-
+evil command line.")) ],
+ [ "\n ", { justification => 'GTK_JUSTIFY_RIGHT' } ],
+ [ gtkcreate_pixbuf('mcc-welcome-logo'), { justification => 'GTK_JUSTIFY_RIGHT' } ]
+ ]);
-
-$notebook_global->append_page($summary, "");
+add2notebook($notebook_global, "", create_scrolled_window(gtkset_size_request(gtkset_border_width($summary, 40),
+ 50, 50),
+ ),
+ "");
use POSIX qw(:sys_utsname_h :math_h :sys_wait_h :unistd_h);
@@ -447,7 +444,7 @@ my ($d_width, $d_height) = (173, 46);
my $right_text_offset = $d_width - 155;
my @colors = (gtkcolor(0, 0, 0), gtkcolor(0xAA, 0xAA, 0xFF), gtkcolor(0, 0, 0));
my $spacing = 25;
-my ($lspacing, $left_txt_offset);
+my ($lspacing, $left_txt_offset, $icon_offset);
# Create left icons
foreach (@tree) {
@@ -488,7 +485,7 @@ foreach (@tree) {
$dbl_area_left[$curr_state] = Gtk2::Gdk::Pixmap->new($window, $d_width, $d_height, $window->get_depth);
my $gc = $darea_left->style->fg_gc('normal');
$left_back_pixbuf->render_to_drawable($dbl_area_left[$curr_state], $gc, 0, 0, 0, 0, $back_width, $back_height, 'normal', 0, 0);
- $icon_pixbufs[$curr_state]->render_to_drawable($dbl_area_left[$curr_state], $gc, 0, 0, $lspacing, $lspacing, $icon_width, $icon_height, 'normal', 0, 0);
+ $icon_pixbufs[$curr_state]->render_to_drawable($dbl_area_left[$curr_state], $gc, 0, 0, $lspacing+$icon_offset, $lspacing, $icon_width, $icon_height, 'normal', 0, 0);
$darea_left->style->black_gc->set_rgb_fg_color($colors[$curr_state]);
$darea_left->modify_font($fonts[$curr_state]);
@@ -561,12 +558,12 @@ foreach (@tree) {
);
} @$subtree));
- $notebook_global->append_page(
- my $_w_ret = create_scrolled_window(gtkset_border_width($tbl, 5),
- [ 'never', 'automatic' ], 'none'
- ),
- ""
- );
+ add2notebook($notebook_global, "",
+ my $_w_ret = create_scrolled_window(gtkset_border_width($tbl, 5),
+ [ 'never', 'automatic' ], 'none'
+ ),
+ ""
+ );
# $w_ret->vscrollbar->set_size_request(19, undef);
}
@@ -596,7 +593,6 @@ $run_darea->signal_connect(expose_event => sub {
my $pixbuf = render_alpha($run_pixbuf, $run_counter);
my ($window, $gc, $width, $height) = ($run_darea->window, $run_darea->style->fg_gc('normal'), $pixbuf->get_width, $pixbuf->get_height);
$pixbuf->render_to_drawable($window, $gc, 0, 0, 0, 0, $width, $height, 'normal', 0, 0);
- $pixbuf->unref;
$run_counter += $run_counter_add;
$run_counter_add = -$run_counter_add if $run_counter < 100 || 245 < $run_counter;
});
@@ -636,7 +632,7 @@ sub child_just_exited() {
clean_socket();
gtkset_mousecursor_normal();
$notebook_global->show;
- Gtk2->timeout_remove($timeout) if $timeout;
+ Glib::Source->remove($timeout) if $timeout;
}
sub hide_socket_and_clean() {
@@ -731,13 +727,12 @@ sub compute_exec_string {
$emb_socket->realize;
$pending_app = 1;
if ($gtkplug > 0) {
- $exec .= " --embedded " . $emb_socket->window->XWINDOW;
+ $exec .= " --embedded " . $emb_socket->get_id;
$emb_wait->show;
- $run_pixbuf->unref if $run_pixbuf;
$run_pixbuf = gtkcreate_pixbuf($icon . "_128");
$run_counter = 255;
$run_counter_add = -10;
- $timeout = Gtk2->timeout_add(70, sub { $run_darea->queue_draw; 1 });
+ $timeout = Glib::Timeout->add(70, sub { $run_darea->queue_draw; 1 });
$left_locked = 1;
fork_($exec);
} else { # gtkplug == 0
@@ -746,7 +741,7 @@ sub compute_exec_string {
$emb_socket->show;
$exec_->[0] = $exec;
$SIG{CHLD} = undef;
- $emb_socket->steal(launch_xapp(@$exec_));
+ $emb_socket->add_id(launch_xapp(@$exec_));
$emb_socket->grab_focus;
$SIG{CHLD} = \&sig_child;
}
@@ -821,7 +816,7 @@ sub quit_global() {
THEME => $theme,
});
gtkset_mousecursor_normal();
- Gtk2->exit(0);
+ Gtk2::exit(0);
}
@@ -881,7 +876,7 @@ sub more_themes() {
sub about_mdk_cc() {
my $window_about = new_dialog(N("About - Mandrake Control Center"));
- my $tree_model = Gtk2::TreeStore->new(Gtk2::GType->STRING, Gtk2::GType->STRING, Gtk2::GType->STRING);
+ my $tree_model = Gtk2::TreeStore->new("Glib::String", "Glib::String", "Glib::String");
my $list = Gtk2::TreeView->new_with_model($tree_model);
$list->can_focus(0);
each_index { $list->append_column(Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererText->new, 'text' => $::i)) } 0..2;
@@ -900,7 +895,7 @@ sub about_mdk_cc() {
#-PO If your language allows it, use eacute for first "e" and egrave for 2nd one.
[ '', N("Helene Durosini"), '<ln@mandrakesoft.com>' ],
) {
- $tree_model->append_set(undef, [ map_index { $::i => $_ } @$row ])->free;
+ $tree_model->append_set(undef, [ map_index { $::i => $_ } @$row ]);
}
# Give our translators the ability to show their family and
@@ -911,7 +906,7 @@ sub about_mdk_cc() {
#-PO Add your E-Mail address here if you want to show it in the about doialog.
my $translator_email = N("~ @ ~");
if ($translator_name ne "~ * ~ " && 0) {
- $list->append_set(undef, [ 0 => $_->[0], 1 => $_->[1] ])->free foreach [ '', '' ], [ N("Translator: "), $translator_name, $translator_email ];
+ $list->append_set(undef, [ 0 => $_->[0], 1 => $_->[1] ]) foreach [ '', '' ], [ N("Translator: "), $translator_name, $translator_email ];
}
$list->get_selection()->set_mode('none');
diff --git a/drakconf.spec b/drakconf.spec
index 7d478dd3..46edaa19 100644
--- a/drakconf.spec
+++ b/drakconf.spec
@@ -4,7 +4,7 @@
Summary: The Mandrake Control Center
Name: drakconf
Version: 9.2
-Release: 0.4mdk
+Release: 0.5mdk
# get the source from our cvs repository (see
# http://www.linuxmandrake.com/en/cvs.php3)
Source0: %name-%version.tar.bz2
@@ -19,7 +19,7 @@ Provides: DrakConf
BuildRequires: gettext
Requires: mandrake-release, drakxtools >= 9.2-0.9mdk
Requires: harddrake-ui >= 9.1-31mdk, popt >= 1.6.4-24mdk, usermode
-Requires: perl-GTK2 >= 0.0.cvs.2003.03.04.1-2mdk
+Requires: perl-Gtk2 >= 0.26.cvs.2003.07.09.1-2mdk
Requires: gtk+2.0 >= 2.2.0-3mdk, perl-MDK-Common => 1.0.4-16mdk
Requires: drakcronat >= 0.1.3-1mdk, menudrake >= 0.7.2-1mdk, rxvt, userdrake
BuildRoot: %_tmppath/%name-%version-buildroot
@@ -93,6 +93,9 @@ rm -rf $RPM_BUILD_ROOT
%changelog
+* Wed Jul 9 2003 Thierry Vignaud <tvignaud@mandrakesoft.com> 9.2-0.5mdk
+- switch to gtk2-perl-xs
+
* Sat Jul 5 2003 Thierry Vignaud <tvignaud@mandrakesoft.com> 9.2-0.4mdk
- use stock icons
diff --git a/menus_launcher.pl b/menus_launcher.pl
index 9c6782bb..b46047f3 100755
--- a/menus_launcher.pl
+++ b/menus_launcher.pl
@@ -9,6 +9,11 @@ use ugtk2 qw(:helpers :wrappers);
use interactive;
use standalone;
+sub gtkcan_default {
+ $_[0]->can_default($_->[1]);
+ $_[0];
+}
+
my $bindir = "/usr/bin/";
my $my_win = ugtk2->new('print_launcher');
$my_win->{rwindow}->set_title(N("Menu Configuration Center")) unless $::isEmbedded;
@@ -16,17 +21,10 @@ $my_win->{window}->signal_connect(delete_event => sub {
gtkset_mousecursor_normal();
ugtk2->exit(0);
});
-my $vbox = Gtk2::VBox->new(0, 0);
-$my_win->{window}->add($vbox);
-$vbox->pack_start(Gtk2::Label->new(N("Menu Configuration Center") . N("\n\nChoose which menu you want to configure")), 0, 0, 5);
-$vbox->pack_start(Gtk2::HSeparator->new, 0, 0, 5);
my $table = Gtk2::Table->new(3, 2, 0);
$table->set_border_width(5);
$table->set_row_spacings(5);
$table->set_col_spacings(5);
-my $hbox = Gtk2::HBox->new(0, 0);
-$vbox->pack_start($hbox, 1, 1, 1);
-$hbox->pack_start($table, 0, 0, 5);
$table->attach(Gtk2::Label->new(N("System menu")), 0, 1, 0, 1, 'fill', 'fill', 0, 0);
my $b1 = gtksignal_connect(Gtk2::Button->new(N("Configure...")), clicked => sub { system("$bindir/menudrake --systemmenu &") });
$table->attach($b1, 1, 2, 0, 1, 'fill', 'fill', 0, 0);
@@ -38,13 +36,18 @@ $table->attach($combo, 2, 3, 1, 2, 'fill', 'fill', 0, 0);
my $b2 = gtksignal_connect(Gtk2::Button->new(N("Configure...")),
clicked => sub { my $a = $combo->entry->get_text(); system($a eq "root" ? "$bindir/menudrake --usermenu &" : " su $a -c \"$bindir/menudrake\" &") });
$table->attach($b2, 1, 2, 1, 2, 'fill', 'fill', 0, 0);
-$vbox->pack_start(Gtk2::HSeparator->new, 0, 0, 5);
-my $bbox = Gtk2::HButtonBox->new;
-$vbox->pack_start($bbox, 0, 0, 5);
-$bbox->set_layout('end');
-my $button_ok = gtksignal_connect(Gtk2::Button->new(N("Done")), clicked => sub { ugtk2->exit(0) });
-$button_ok->can_default(1);
-$bbox->add($button_ok);
+
+$my_win->{window}->add(gtkpack(Gtk2::VBox->new(0, 0),
+ Gtk2::Label->new(N("Menu Configuration Center") . N("\n\nChoose which menu you want to configure")),
+ Gtk2::HSeparator->new,
+ $table,
+ Gtk2::HSeparator->new,
+ gtkpack(gtkset_layout(Gtk2::HButtonBox->new, 'end'),
+ gtkcan_default(gtksignal_connect(Gtk2::Button->new(N("Done")), clicked => sub { ugtk2->exit(0) }), 1)
+ ),
+ ),
+ );
+
$my_win->{window}->show_all;
$my_win->main;