summaryrefslogtreecommitdiffstats
path: root/bin/draknfs
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2013-11-22 18:40:33 +0100
committerThierry Vignaud <thierry.vignaud@gmail.com>2013-11-24 11:00:46 +0100
commit4b3e7506909380c640d83959b862fa0211038eaa (patch)
treea8516e4bad98c17cac86f19f3e8c1aa925c3d78c /bin/draknfs
parentf2ba08b9d21918ecf78d9a769bda7cfbed1f3190 (diff)
downloaddrakx-net-4b3e7506909380c640d83959b862fa0211038eaa.tar
drakx-net-4b3e7506909380c640d83959b862fa0211038eaa.tar.gz
drakx-net-4b3e7506909380c640d83959b862fa0211038eaa.tar.bz2
drakx-net-4b3e7506909380c640d83959b862fa0211038eaa.tar.xz
drakx-net-4b3e7506909380c640d83959b862fa0211038eaa.zip
convert to UIManager
Diffstat (limited to 'bin/draknfs')
-rwxr-xr-xbin/draknfs44
1 files changed, 26 insertions, 18 deletions
diff --git a/bin/draknfs b/bin/draknfs
index f23b74e..21ee663 100755
--- a/bin/draknfs
+++ b/bin/draknfs
@@ -64,20 +64,6 @@ my $userid_data = {
my @yesno = qw(yes no);
-sub get_items() {
- my @items = (
- [ N("/_File"), undef, undef, undef, '<Branch>', ],
- [ N("/_File") . N("/_Write conf"), undef, \&write_conf, 1, '<Item>', ],
- [ N("/_File") . N("/_Quit"), N("<control>Q"), \&quit_all, 1, '<Item>', ],
-
-
- [ N("/_NFS Server"), undef, undef, undef, '<Branch>', ],
- [ N("/_NFS Server") . N("/_Restart"), undef, \&restart_dialog, 1, '<Item>', ],
- [ N("/_NFS Server") . N("/R_eload"), undef, \&reload_dialog, 1, '<Item>', ],
- );
- return @items;
-}
-
sub quit_all() {
ugtk3->exit;
}
@@ -572,10 +558,32 @@ $treeview->signal_connect(button_press_event => sub {
});
# create menu
-my @items = get_items();
-my $factory = Gtk3::ItemFactory->new('Gtk3::MenuBar', '<main>', undef);
-$factory->create_items('menu', @items);
-my $menu = $factory->get_widget('<main>');
+my $ui = gtknew('UIManager', actions => [
+ # [name, stock_id, value, label, accelerator, tooltip, callback]
+ [ 'FileMenu', undef, N("_File") ],
+ [ 'Write_conf', undef, N("_Write conf"), undef, undef, \&write_conf ],
+ [ 'Quit', undef, N("_Quit"), N("<control>Q"), undef, sub { ugtk3->exit(0) } ],
+ [ 'NFSMenu', undef, N("_NFS Server") ],
+ [ 'Restart', undef, N("_Restart"), undef, undef, \&restart_dialog ],
+ [ 'Reload', undef, N("R_eload"), undef, undef, \&reload_dialog ],
+
+
+ ],
+ string => qq(<ui>
+ <menubar name='MenuBar'>
+ <menu action='FileMenu'>
+ <menuitem action='Write_conf'/>
+ <menuitem action='Quit'/>
+ </menu>
+ <menu action='NFSMenu'>
+ <menuitem action='Restart'/>
+ <menuitem action='Reload'/>
+ </menu>
+ </menubar>
+</ui>));
+$window->{rwindow}->add_accel_group($ui->get_accel_group);
+
+my $menu = $ui->get_widget('/MenuBar');
my $okcancel = create_okcancel({
cancel_clicked => sub { ugtk3->exit },