summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2013-11-03 15:04:02 +0100
committerThierry Vignaud <thierry.vignaud@gmail.com>2013-11-24 23:53:09 +0100
commitca6a026a23f723a74dab9a7d3afc11c2a43c01f2 (patch)
treef0f6b7ee52cb585b95ffdadaa435cb7b4e6fd692 /perl-install
parent32dfc90e18b52dc5bc3928a46c5e946158d7aee1 (diff)
downloaddrakx-ca6a026a23f723a74dab9a7d3afc11c2a43c01f2.tar
drakx-ca6a026a23f723a74dab9a7d3afc11c2a43c01f2.tar.gz
drakx-ca6a026a23f723a74dab9a7d3afc11c2a43c01f2.tar.bz2
drakx-ca6a026a23f723a74dab9a7d3afc11c2a43c01f2.tar.xz
drakx-ca6a026a23f723a74dab9a7d3afc11c2a43c01f2.zip
convert to UIManager
Diffstat (limited to 'perl-install')
-rwxr-xr-xperl-install/standalone/drakboot18
-rwxr-xr-xperl-install/standalone/drakfloppy18
-rwxr-xr-xperl-install/standalone/harddrake271
-rwxr-xr-xperl-install/standalone/logdrake31
4 files changed, 85 insertions, 53 deletions
diff --git a/perl-install/standalone/drakboot b/perl-install/standalone/drakboot
index e9f6cf348..375b0b4d1 100755
--- a/perl-install/standalone/drakboot
+++ b/perl-install/standalone/drakboot
@@ -85,10 +85,20 @@ sub run_boot_window {
$window->set_border_width(2);
### menus definition
# the menus are not shown but they provides shiny shortcut like C-q
- my @menu_items = ([ N("/_File"), undef, undef, undef, '<Branch>' ],
- [ N("/File/_Quit"), N("<control>Q"), sub { ugtk3->exit(0) }, undef, '<Item>' ],
- );
- create_factory_menu($w->{rwindow}, @menu_items);
+ my $ui = gtknew('UIManager', actions => [
+ # [name, stock_id, value, label, accelerator, tooltip, callback]
+ [ 'FileMenu', undef, N("_File") ],
+ [ 'Quit', undef, N("_Quit"), N("<control>Q"), undef, sub { ugtk3->exit(0) } ],
+ ],
+ string => qq(<ui>
+ <menubar name='MenuBar'>
+ <menu action='FileMenu'>
+ <menuitem action='Quit'/>
+ </menu>
+ </menubar>
+</ui>));
+ $w->{rwindow}->add_accel_group($ui->get_accel_group);
+
######### menus end
}
gtkadd($window, gtknew('VBox', children => [
diff --git a/perl-install/standalone/drakfloppy b/perl-install/standalone/drakfloppy
index 9154d40a3..efb2104df 100755
--- a/perl-install/standalone/drakfloppy
+++ b/perl-install/standalone/drakfloppy
@@ -43,11 +43,19 @@ unless ($::isEmbedded) {
### menus definition
# the menus are not shown but they provides shiny shortcut like C-q
- create_factory_menu($window->{rwindow}, (
- { path => N("/_File"), item_type => '<Branch>' },
- { path => N("/File/_Quit"), accelerator => N("<control>Q"), callback => sub { ugtk3->exit(0) } },
- )
- );
+ my $ui = gtknew('UIManager', actions => [
+ # [name, stock_id, value, label, accelerator, tooltip, callback]
+ [ 'FileMenu', undef, N("_File") ],
+ [ 'Quit', undef, N("_Quit"), N("<control>Q"), undef, sub { ugtk3->exit(0) } ],
+ ],
+ string => qq(<ui>
+ <menubar name='MenuBar'>
+ <menu action='FileMenu'>
+ <menuitem action='Quit'/>
+ </menu>
+ </menubar>
+</ui>));
+ $window->{rwindow}->add_accel_group($ui->get_accel_group);
}
diff --git a/perl-install/standalone/harddrake2 b/perl-install/standalone/harddrake2
index 3862a0614..08a81b913 100755
--- a/perl-install/standalone/harddrake2
+++ b/perl-install/standalone/harddrake2
@@ -175,16 +175,9 @@ my ($current_device, $current_class, $current_configurator);
my %sysh = distrib();
my $distro_name = $sysh{system};
-my %menus = (
- 'options' =>
- #-PO: please keep all "/" characters !!!
- N("/_Options"),
- 'help' => N("/_Help")
- );
-
my %menu_options = (
- 'MODEMS_DETECTION' => [ $menus{options}, N("/Autodetect _modems") ],
- 'PARALLEL_ZIP_DETECTION' => [ $menus{options}, N("/Autodetect parallel _zip drives") ],
+ 'MODEMS_DETECTION' => N("Autodetect _modems"),
+ 'PARALLEL_ZIP_DETECTION' => N("Autodetect parallel _zip drives"),
);
$ugtk3::wm_icon = "harddrake";
@@ -192,24 +185,42 @@ $w = ugtk3->new(N("Hardware Configuration"));
# fake diagnostics pragma:
local $::main_window = $w->{real_window};
-my @menu_items =
- (
- [ N("/_File"), undef, undef, undef, '<Branch>' ],
- [ N("/_File") . N("/_Quit"), N("<control>Q"), \&quit_global, undef, '<Item>' ],
- [ join('', @{$menu_options{MODEMS_DETECTION}}), undef, \&handle_modem_option, undef, '<CheckItem>' ],
- [ join('', @{$menu_options{PARALLEL_ZIP_DETECTION}}), undef, \&handle_zip_option, undef, '<CheckItem>' ],
- [ $menus{help}, undef, undef, undef, '<Branch>' ],
- if_(-x "/usr/sbin/drakhelp_inst",
- [ $menus{help} . N("/_Help"), undef, \&run_help, undef, '<Item>' ],
- ),
- [ $menus{help} . N("/_Fields description"), undef, \&fields_help, undef, '<Item>'
- ],
- if_(!-e "/etc/sysconfig/oem",
- [ $menus{help} . N("/_Report Bug"), undef, \&run_drakbug, undef, '<Item>' ],
- ),
- [ $menus{help} . N("/_About..."), undef, \&about, undef, '<Item>'
- ]
- );
+my $has_help = -x "/usr/sbin/drakhelp_inst";
+my $ui = gtknew('UIManager', actions => [
+ # [name, stock_id, value, label, accelerator, tooltip, callback]
+ [ 'FileMenu', undef, N("_File") ],
+ [ 'Quit', undef, N("_Quit"), N("<control>Q"), undef, \&quit_global ],
+ [ 'OptionsMenu', undef, '_Options' ],
+ [ 'HelpMenu', undef, '_Help' ],
+ if_($has_help, [ 'Help', undef, N("_Help"), N("<control>Q"), undef, \&run_help ]),
+ [ 'Fields description', undef, N("_Fields description"), undef, undef, \&fields_help ],
+ [ 'Report Bug', undef, N("_Report Bug"), undef, undef, \&run_drakbug ],
+ [ 'About', undef, N("_About..."), '', undef, \&about ],
+ ],
+ toggle_actions => [
+ [ 'MODEMS_DETECTION', undef, $menu_options{MODEMS_DETECTION}, undef, undef, \&handle_modem_option ],
+ [ 'PARALLEL_ZIP_DETECTION', undef, $menu_options{PARALLEL_ZIP_DETECTION}, undef, undef, \&handle_zip_option ],
+ ],
+ string =>
+ join("\n",
+ qq(<ui>
+ <menubar name='MenuBar'>
+ <menu action='FileMenu'>
+ <menuitem action='Quit'/>
+ </menu>
+ <menu action='OptionsMenu'>
+ <menuitem action='MODEMS_DETECTION'/>
+ <menuitem action='PARALLEL_ZIP_DETECTION'/>
+ </menu>
+ <menu action='HelpMenu'>),
+ if_($has_help, "<menuitem action='Help'/>"),
+ qq(
+ <menuitem action='Fields description'/>
+ <menuitem action='Report Bug'/>
+ <menuitem action='About'/>
+ </menu>
+ </menubar>
+</ui>)));
$in = 'interactive'->vnew('su'); #require_root_capability();
@@ -221,7 +232,7 @@ add_icon_path('/usr/share/pixmaps/harddrake2/');
$::noborderWhenEmbedded = 1;
-my ($menubar, $factory) = create_factory_menu($w->{real_window}, @menu_items);
+my $menubar = $ui->get_widget('/MenuBar');
$w->{window}->set_size_request(805, 550) if !$::isEmbedded;
my $tree_model = Gtk3::TreeStore->new("Gtk3::Gdk::Pixbuf", "Glib::String", "Glib::Int");
@@ -338,6 +349,7 @@ $tree->get_selection->signal_connect('changed' => sub {
$module_cfg_button->hide;
});
+$w->{rwindow}->add_accel_group($ui->get_accel_group);
# show the main window earlier (so that sub dialogs can use main
# window's icon and so that no Gtk+ critical message got displayed):
$w->{rwindow}->show_all;
@@ -473,9 +485,8 @@ $w->{rwindow}->signal_connect(delete_event => \&quit_global);
$w->{rwindow}->set_position('center') unless $::isEmbedded;
foreach (keys %menu_options) {
- my $title = strip_first_underscore(@{$menu_options{$_}});
$options{$_} = 0 unless defined($options{$_}); # force detection by default
- $check_boxes{$_} = $factory->get_widget("<main>" . $title);
+ $check_boxes{$_} = $ui->get_widget('/MenuBar/OptionsMenu/' . $_);
$check_boxes{$_}->set_active($options{$_}); # restore saved values
}
diff --git a/perl-install/standalone/logdrake b/perl-install/standalone/logdrake
index 94315750a..8ad314f0f 100755
--- a/perl-install/standalone/logdrake
+++ b/perl-install/standalone/logdrake
@@ -72,20 +72,23 @@ my $cal_butt = gtksignal_connect(Gtk3::CheckButton->new(N("Show only for the sel
### menus definition
# the menus are not shown
# but they provides shiny shortcut like C-q (Broken: FIXME)
-my @menu_items = (
- { path => N("/_File"), item_type => '<Branch>' },
- { path => N("/File/_New"), accelerator => N("<control>N") },
- { path => N("/File/_Open"), accelerator => N("<control>O") },
- { path => N("/File/_Save"), accelerator => N("<control>S"), callback => \&save },
- { path => N("/File/Save _As") },
- { path => N("/File/-"), item_type => '<Separator>' },
- { path => N("/File/_Quit"), accelerator => N("<control>Q"), callback => \&quit },
- { path => N("/_Options"), item_type => '<Branch>' },
- { path => N("/Options/Test") },
- { path => N("/_Help"), item_type => '<LastBranch>' },
- { path => N("/Help/_About...") }
- );
-my $_menubar = $::isEmbedded ? create_factory_menu($my_win->{rwindow}, @menu_items) : undef;
+if ($::isEmbedded) {
+ my $ui = gtknew('UIManager', actions => [
+ # [name, stock_id, value, label, accelerator, tooltip, callback]
+ [ 'FileMenu', undef, N("_File") ],
+ [ 'Save', undef, N("_Quit"), N("<control>Q"), undef, \&save ],
+ [ 'Quit', undef, N("_Quit"), N("<control>Q"), undef, \&quit ],
+ ],
+ string => qq(<ui>
+ <menubar name='MenuBar'>
+ <menu action='FileMenu'>
+ <menuitem action='Save'/>
+ <menuitem action='Quit'/>
+ </menu>
+ </menubar>
+</ui>));
+ $my_win->{rwindow}->add_accel_group($ui->get_accel_group);
+}
######### menus end