Re: Menu and toolbar issues with Gnome2::App




Osmo Salomaa said:
How do I set the state of a toggleitem in a menu to default to checked?
I'm using the create_menus method in class Gnome2::App as follows:

If you are not required to support gtk+ < 2.4, you'll be happier using the
action-based menus and toolbars with Gtk2::UIManager.  They are intended to
replace the menu management stuff in Gnome2::App.


$App->create_menus( [
...
     type => 'subtree',
     label => '_View',
     subtree => [ {
         type => 'toggleitem',
         label => '_Status Bar',
         callback => \&on_view_status_bar_event,
...
] );

One of the features of the GnomeAppHelpers stuff (also a liability that makes
it impossible to reuse static menu information, a reason for replacing it with
GtkUIManager) is that the widgets that get created are passed back to you in
the data structure you passed in.

Instead of passing an anonymous data structure, store the menu descriptions
someplace else, call create_menus, then fetch the appropriate widget from the
{widget} key and set its default state.

I won't go into more detail because, having used both myself, i really think
you should be using GtkUIManager.  It's the Way of the Future.  :-)


Toolbar:
--------
I'd like to put an entry in the view-menu to hide the toolbar. How can I
hide a toolbar created with method create_toolbar in class Gnome2::App?

Can't help you here, except to say <beat target="dead horse">this is really
easy with GtkUIManager</beat>.



-- 
muppet <scott at asofyet dot org>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]