diff options
author | Thierry Vignaud <thierry.vignaud@gmail.com> | 2013-12-05 14:11:56 +0100 |
---|---|---|
committer | Thierry Vignaud <thierry.vignaud@gmail.com> | 2013-12-05 14:16:09 +0100 |
commit | 3d6a28389da126cbeadf0c52c097dfcfaced1d5d (patch) | |
tree | 5be5bb8dc056bd5131f5e328112fa4fecc13908b /Rpmdrake | |
parent | 0239b9eef3ce4f74251956b5077a41a6b5925456 (diff) | |
download | rpmdrake-3d6a28389da126cbeadf0c52c097dfcfaced1d5d.tar rpmdrake-3d6a28389da126cbeadf0c52c097dfcfaced1d5d.tar.gz rpmdrake-3d6a28389da126cbeadf0c52c097dfcfaced1d5d.tar.bz2 rpmdrake-3d6a28389da126cbeadf0c52c097dfcfaced1d5d.tar.xz rpmdrake-3d6a28389da126cbeadf0c52c097dfcfaced1d5d.zip |
convert menu to UIManager
Diffstat (limited to 'Rpmdrake')
-rw-r--r-- | Rpmdrake/edit_urpm_sources.pm | 68 |
1 files changed, 48 insertions, 20 deletions
diff --git a/Rpmdrake/edit_urpm_sources.pm b/Rpmdrake/edit_urpm_sources.pm index 10ead8d8..662d061b 100644 --- a/Rpmdrake/edit_urpm_sources.pm +++ b/Rpmdrake/edit_urpm_sources.pm @@ -977,26 +977,54 @@ sub mainwindow() { my $reread_media; - my ($menu, $_factory) = create_factory_menu( - $mainw->{real_window}, - [ N("/_File"), undef, undef, undef, '<Branch>' ], - [ N("/_File") . N("/_Update"), N("<control>U"), sub { update_callback() and $reread_media->() }, undef, '<Item>', ], - [ N("/_File") . N("/Add a specific _media mirror"), N("<control>M"), sub { easy_add_callback_with_mirror() and $reread_media->() }, undef, '<Item>' ], - [ N("/_File") . N("/_Add a custom medium"), N("<control>A"), sub { add_callback() and $reread_media->() }, undef, '<Item>' ], - [ N("/_File") . N("/Close"), N("<control>W"), sub { Gtk3->main_quit }, undef, '<Item>', ], - [ N("/_Options"), undef, undef, undef, '<Branch>' ], - [ N("/_Options") . N("/_Global options"), N("<control>G"), \&options_callback, undef, '<Item>' ], - [ N("/_Options") . N("/Manage _keys"), N("<control>K"), \&keys_callback, undef, '<Item>' ], - [ N("/_Options") . N("/_Parallel"), N("<control>P"), \¶llel_callback, undef, '<Item>' ], - [ N("/_Options") . N("/P_roxy"), N("<control>R"), \&proxy_callback, undef, '<Item>' ], - if_($0 =~ /edit-urpm-sources/, - [ N("/_Help"), undef, undef, undef, '<Branch>' ], - [ N("/_Help") . N("/_Report Bug"), undef, sub { run_drakbug('edit-urpm-sources.pl') }, undef, '<Item>' ], - [ N("/_Help") . N("/_Help"), undef, sub { rpmdrake::open_help('sources') }, undef, '<Item>' ], - [ N("/_Help") . N("/_About..."), undef, \&show_about, undef, '<Item>' - ] - ), - ); + my $ui = gtknew( + 'UIManager', + actions => [ + [ 'FileMenu', undef, N("_File") ], + [ 'Update', undef, N("_Update"), N("<control>U"), undef, sub { update_callback() and $reread_media->() }, ], + [ 'Add_a_specific_mirror', undef, N("Add a specific _media mirror"), N("<control>M"), undef, sub { easy_add_callback_with_mirror() and $reread_media->() } ], + [ 'Add_a_custom_medium', undef, N("_Add a custom medium"), N("<control>A"), undef, sub { add_callback() and $reread_media->() } ], + [ 'Close', undef, N("Close"), N("<control>W"), undef, sub { Gtk3->main_quit }, ], + [ 'OptionsMenu', undef, N("_Options") ], + [ 'Global_options', undef, N("_Global options"), N("<control>G"), undef, \&options_callback ], + [ 'Manage_keys', undef, N("Manage _keys"), N("<control>K"), undef, \&keys_callback ], + [ 'Parallel', undef, N("_Parallel"), N("<control>P"), undef, \¶llel_callback ], + [ 'Proxy', undef, N("P_roxy"), N("<control>R"), undef, \&proxy_callback ], + if_($0 =~ /edit-urpm-sources/, + [ 'HelpMenu', undef, N("_Help") ], + [ 'Report_Bug', undef, N("_Report Bug"), undef, undef, sub { run_drakbug('edit-urpm-sources.pl') } ], + [ 'Help', undef, N("_Help"), undef, undef, sub { rpmdrake::open_help('sources') } ], + [ 'About', undef, N("_About..."), undef, undef, \&show_about ], + ), + ], + string => + join("\n", + qq(<ui> + <menubar name='MenuBar'> + <menu action='FileMenu'> + <menuitem action='Update'/> + <menuitem action='Add_a_specific_mirror'/> + <menuitem action='Add_a_custom_medium'/> + <menuitem action='Close'/> + </menu> + <menu action='OptionsMenu'> + <menuitem action='Global_options'/> + <menuitem action='Manage_keys'/> + <menuitem action='Parallel'/> + <menuitem action='Proxy'/> + </menu> +), + if_($0 =~ /edit-urpm-sources/, qq( + <menu action='HelpMenu'> + <menuitem action='Report_Bug'/> + <menuitem action='Help'/> + <menuitem action='About'/> + </menu>)), + qq( + </menubar> +</ui>))); + + my $menu = $ui->get_widget('/MenuBar'); my $list = Gtk3::ListStore->new("Glib::Boolean", "Glib::Boolean", "Glib::String", "Glib::String", "Glib::Boolean"); $list_tv = Gtk3::TreeView->new_with_model($list); |