summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2002-09-09 07:19:19 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2002-09-09 07:19:19 +0000
commit038acd20992b4994ba357f3ca56ad9510941217c (patch)
treeea6bc2947214b516511d0e9356c1c32ce29d1be2
parentfaf855d915c28d459cf99d77fbcba2150b93bfd1 (diff)
downloaddrakx-backup-do-not-use-038acd20992b4994ba357f3ca56ad9510941217c.tar
drakx-backup-do-not-use-038acd20992b4994ba357f3ca56ad9510941217c.tar.gz
drakx-backup-do-not-use-038acd20992b4994ba357f3ca56ad9510941217c.tar.bz2
drakx-backup-do-not-use-038acd20992b4994ba357f3ca56ad9510941217c.tar.xz
drakx-backup-do-not-use-038acd20992b4994ba357f3ca56ad9510941217c.zip
- drakfloppy / logdrake: destroy_window and create_dialog were
gratuitously duplicated; move them in ugtk - drakfloppy / logdrake / bootlook.pm: get_main_menu was gratuitously duplicated; common code which was moved from harddrake::ui to ugtk::create_factory_menu just do the job
-rw-r--r--perl-install/bootlook.pm13
-rwxr-xr-xperl-install/standalone/drakfloppy47
-rwxr-xr-xperl-install/standalone/logdrake45
-rw-r--r--perl-install/ugtk.pm38
4 files changed, 40 insertions, 103 deletions
diff --git a/perl-install/bootlook.pm b/perl-install/bootlook.pm
index 2182c8f2a..fc507969e 100644
--- a/perl-install/bootlook.pm
+++ b/perl-install/bootlook.pm
@@ -79,7 +79,7 @@ $window->border_width(2);
my @menu_items = ( { path => _("/_File"), type => '<Branch>' },
{ path => _("/File/_Quit"), accelerator => _("<control>Q"), callback => sub { $::isEmbedded ? kill('USR1', $::CCPID) : Gtk->exit(0) } },
);
-my $menubar = get_main_menu($window);
+my $menubar = ugtk::create_factory_menu($window, @menu_items);
######### menus end
my $user_combo = new Gtk::Combo;
@@ -393,16 +393,6 @@ sub print_hello {
print("mcdtg !\n");
}
-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>');
-}
-
#-------------------------------------------------------------
# launch X functions
#-------------------------------------------------------------
@@ -501,4 +491,3 @@ sub set_autologin {
# log::l("cat $prefix/etc/sysconfig/autologin: ", cat_("$prefix/etc/sysconfig/autologin"));
}
-
diff --git a/perl-install/standalone/drakfloppy b/perl-install/standalone/drakfloppy
index 471beb475..9ed4243d3 100755
--- a/perl-install/standalone/drakfloppy
+++ b/perl-install/standalone/drakfloppy
@@ -81,7 +81,7 @@ my @menu_items = (
{ path => _("/_File"), type => '<Branch>' },
{ path => _("/File/_Quit"), accelerator => _("<control>Q"), callback => sub { $::isEmbedded ? kill('USR1', $::CCPID) : Gtk->exit(0) } },
);
-my $menubar = get_main_menu( $window );
+my $menubar = ugtk::create_factory_menu($window, @menu_items);
######### menus end
@@ -354,51 +354,6 @@ sub print_hello {
print "mcdtg !\n";
}
-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>' ) );
-}
-
-
-sub create_dialog {
- my ( $label, $c ) = @_;
- my $ret = 0;
- my $dialog = new Gtk::Dialog;
- $dialog->signal_connect ( delete_event => sub {Gtk->main_quit();});
- $dialog->set_title(_("drakfloppy"));
- $dialog->border_width(10);
- $dialog->vbox->pack_start(new Gtk::Label($label),1,1,0);
-
- my $button = new Gtk::Button _("OK");
- $button->can_default(1);
- $button->signal_connect(clicked => sub { $ret = 1; $dialog->destroy(); Gtk->main_quit(); });
- $dialog->action_area->pack_start($button, 1, 1, 0);
- $button->grab_default;
-
- if ($c) {
- my $button2 = new Gtk::Button _("Cancel");
- $button2->signal_connect(clicked => sub { $ret = 0; $dialog->destroy(); Gtk->main_quit(); });
- $button2->can_default(1);
- $dialog->action_area->pack_start($button2, 1, 1, 0);
- }
-
- $dialog->show_all;
- Gtk->main();
- $ret;
-}
-
-sub destroy_window {
- my($widget, $windowref, $w2) = @_;
- $$windowref = undef;
- $w2 = undef if defined $w2;
- 0;
-}
-
-
#-------------------------------------------------------------
# the function
#-------------------------------------------------------------
diff --git a/perl-install/standalone/logdrake b/perl-install/standalone/logdrake
index 6db0b3f1a..381a7ce29 100755
--- a/perl-install/standalone/logdrake
+++ b/perl-install/standalone/logdrake
@@ -110,7 +110,7 @@ my @menu_items = (
{ path => _("/_Help"),type => '<LastBranch>' },
{ path => _("/Help/_About...") }
);
-my $menubar = get_main_menu($window);
+my $menubar = ugtk::create_factory_menu($window, @menu_items);
######### menus end
@@ -497,46 +497,3 @@ sub save {
$yy = $in->ask_file(_("Save as.."),"/root") or return;
output($yy,$log_text->get_chars(0,$log_text->get_length()));
}
-
-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>'));
-}
-
-sub create_dialog {
- my ($label, $c) = @_;
- my $ret = 0;
- my $dialog = new Gtk::Dialog;
- $dialog->signal_connect (delete_event => sub { Gtk->main_quit() });
- $dialog->set_title(_("logdrake"));
- $dialog->border_width(10);
- $dialog->vbox->pack_start(new Gtk::Label($label),1,1,0);
-
- my $button = new Gtk::Button _("OK");
- $button->can_default(1);
- $button->signal_connect(clicked => sub { $ret = 1; $dialog->destroy(); Gtk->main_quit() });
- $dialog->action_area->pack_start($button, 1, 1, 0);
- $button->grab_default;
-
- if ($c) {
- my $button2 = new Gtk::Button _("Cancel");
- $button2->signal_connect(clicked => sub { $ret = 0; $dialog->destroy(); Gtk->main_quit() });
- $button2->can_default(1);
- $dialog->action_area->pack_start($button2, 1, 1, 0);
- }
-
- $dialog->show_all;
- Gtk->main();
- $ret;
-}
-
-sub destroy_window {
- my($widget, $windowref, $w2) = @_;
- $$windowref = undef;
- $w2 = undef if defined $w2;
- 0;
-}
diff --git a/perl-install/ugtk.pm b/perl-install/ugtk.pm
index 6ec846d14..4b062a533 100644
--- a/perl-install/ugtk.pm
+++ b/perl-install/ugtk.pm
@@ -6,7 +6,7 @@ use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK $border $use_pixbuf $use_imlib);
@ISA = qw(Exporter);
%EXPORT_TAGS = (
- helpers => [ qw(createScrolledWindow create_menu create_notebook create_packtable create_hbox create_vbox create_adjustment create_box_with_title create_treeitem) ],
+ helpers => [ qw(createScrolledWindow create_menu create_notebook create_packtable create_hbox create_vbox create_adjustment create_box_with_title create_treeitem create_dialog destroy_window) ],
wrappers => [ qw(gtksignal_connect gtkradio gtkpack gtkpack_ gtkpack__ gtkpack2 gtkpack3 gtkpack2_ gtkpack2__ gtkpowerpack gtkcombo_setpopdown_strings gtkset_editable gtksetstyle gtkset_text gtkset_tip gtkappenditems gtkappend gtkset_shadow_type gtkset_layout gtkset_relief gtkadd gtkexpand gtkput gtktext_insert gtkset_usize gtksize gtkset_justify gtkset_active gtkset_sensitive gtkset_visibility gtkset_modal gtkset_border_width gtkmove gtkresize gtkshow gtkhide gtkdestroy gtkflush gtkcolor gtkset_mousecursor gtkset_mousecursor_normal gtkset_mousecursor_wait gtkset_background gtkset_default_fontset gtkctree_children gtkxpm gtkpng create_pix_text get_text_coord fill_tiled gtkicons_labels_widget write_on_pixmap gtkcreate_xpm gtkcreate_png gtkcreate_png_pixbuf gtkbuttonset create_pixbutton gtkroot gtkentry compose_with_back compose_pixbufs) ],
various => [ qw(add2notebook add_icon_path n_line_size) ],
);
@@ -275,6 +275,42 @@ sub create_box_with_title {
}
}
+# drakfloppy / logdrake
+sub create_dialog {
+ my ($label, $c) = @_;
+ my $ret = 0;
+ my $dialog = new Gtk::Dialog;
+ $dialog->signal_connect (delete_event => sub { Gtk->main_quit() });
+ $dialog->set_title(_("logdrake"));
+ $dialog->border_width(10);
+ $dialog->vbox->pack_start(new Gtk::Label($label),1,1,0);
+
+ my $button = new Gtk::Button _("OK");
+ $button->can_default(1);
+ $button->signal_connect(clicked => sub { $ret = 1; $dialog->destroy(); Gtk->main_quit() });
+ $dialog->action_area->pack_start($button, 1, 1, 0);
+ $button->grab_default;
+
+ if ($c) {
+ my $button2 = new Gtk::Button _("Cancel");
+ $button2->signal_connect(clicked => sub { $ret = 0; $dialog->destroy(); Gtk->main_quit() });
+ $button2->can_default(1);
+ $dialog->action_area->pack_start($button2, 1, 1, 0);
+ }
+
+ $dialog->show_all;
+ Gtk->main();
+ $ret;
+}
+
+# drakfloppy / logdrake
+sub destroy_window {
+ my($widget, $windowref, $w2) = @_;
+ $$windowref = undef;
+ $w2 = undef if defined $w2;
+ 0;
+}
+
sub create_hbox { gtkset_layout(gtkset_border_width(new Gtk::HButtonBox, 3), $_[0] || 'spread') }
sub create_factory_menu_ {