From 4b3e7506909380c640d83959b862fa0211038eaa Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Fri, 22 Nov 2013 18:40:33 +0100 Subject: convert to UIManager --- bin/draknfs | 44 ++++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 18 deletions(-) (limited to 'bin/draknfs') 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, '', ], - [ N("/_File") . N("/_Write conf"), undef, \&write_conf, 1, '', ], - [ N("/_File") . N("/_Quit"), N("Q"), \&quit_all, 1, '', ], - - - [ N("/_NFS Server"), undef, undef, undef, '', ], - [ N("/_NFS Server") . N("/_Restart"), undef, \&restart_dialog, 1, '', ], - [ N("/_NFS Server") . N("/R_eload"), undef, \&reload_dialog, 1, '', ], - ); - 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', '
', undef); -$factory->create_items('menu', @items); -my $menu = $factory->get_widget('
'); +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("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( + + + + + + + + + + +)); +$window->{rwindow}->add_accel_group($ui->get_accel_group); + +my $menu = $ui->get_widget('/MenuBar'); my $okcancel = create_okcancel({ cancel_clicked => sub { ugtk3->exit }, -- cgit v1.2.1