Hello,
I have a GnomeApp based application whose menu is created with
GnomeApp.create_menus and I am having two problems. Here is UIINFO
structure:
def _menu(self):
fileMenu = [UIINFO_MENU_NEW_ITEM("_New Group", "Make a new folder",
self.newGroupDialog,
STOCK_MENU_BLANK),
UIINFO_ITEM_STOCK("_Delete Group",
"Delete the current group",
self.deleteGroup, STOCK_MENU_BLANK),
UIINFO_SEPARATOR,
UIINFO_MENU_EXIT_ITEM(mainquit, None)]
helpMenu = [UIINFO_MENU_ABOUT_ITEM(help.about, None)]
return [UIINFO_SUBTREE("_File", fileMenu),
UIINFO_SUBTREE("_Help", helpMenu)]
(I haven't written much of the application yet, for example you can't
put anything in the groups yet :))
The first problem is that not every group can be deleted, and I
have an error box that pops up if an attempt is made to delete one of
these groups, but I would rather that the menu item was disabled if one
of these groups is the current group. I'm thinking I can
GtkMenuItem.set_sensitive to enable/disable the menu item if I can get a
referance to the menu item, but I do not know how to get this referance.
I was able to use
GnomeApp.get_dock_item_by_name("Menubar").get_child().children()[0] to
get the GtkMenuItem associated with the file menu, but I was not able to
get the menu items contained in the menu. I noticed a field of GtkBin
called "child" that I thought might contain a GtkMenuShell with the
individual menu items, but I was unable to figure out how to access the
field. Then I noticed a field in the
GnomeUIInfo structure called "widget" which it says is filled in by the
create function with the created widget, but I wasn't sure which items
in the list returned by _menu corresponed to which items in GnomeUIInfo,
and in any case the list turned out to be unchanged after the call to
GnomeApp.create_menus. So can anyone tell me how to get a referace to
this widget?
The second problem is getting the hints for the menu items to show
up in the appbar. It it my understanding (possibly (or probably ;))
wrong) that the second argument is meant to be a hint that shows up in
the appbar when the menus selection is over that item. The hints did not
automatically show up so I read the gnome referance docs some more and
decided that GnomeApp.install_menu_hints must be what I was looking for.
So I called the function after installing the appbar and menus with:
appBar = GnomeAppBar(TRUE , TRUE, PREFERENCES_NEVER)
self.set_statusbar(appBar)
menuui = self._menu()
print menuui
self.create_menus(menuui)
print menuui
self.install_menu_hints(menuui)
self.create_toolbar(self._toolbar())
When I ran this it crashed (segmentation fault) immediately after
printing out menuui twice. I changed it to:
appBar = GnomeAppBar(TRUE , TRUE, PREFERENCES_NEVER)
self.set_statusbar(appBar)
menuui = self._menu()
print menuui
self.create_menus(menuui)
print menuui
self.install_menu_hints(self._menu())
self.create_toolbar(self._toolbar())
and it printed the following after printing menuui twice and then seg
faulted again:
GnomeUI-CRITICAL **: file gnome-app-helper.c: line 623
(install_menuitem_hint_to_appbar): assertion `uiinfo->widget != NULL'
failed.
GnomeUI-CRITICAL **: file gnome-app-helper.c: line 623
(install_menuitem_hint_to_appbar): assertion `uiinfo->widget != NULL'
failed.
GnomeUI-CRITICAL **: file gnome-app-helper.c: line 623
(install_menuitem_hint_to_appbar): assertion `uiinfo->widget != NULL'
failed.
GnomeUI-CRITICAL **: file gnome-app-helper.c: line 623
(install_menuitem_hint_to_appbar): assertion `uiinfo->widget != NULL'
failed.
I have a feeling I am maybe completely barking up the wrong tree here,
if anybody can help me with either of these problems I would really
appreciate it.
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]