GtkMenu doesn't recognize it's parents?
- From: "Jim George" <jimgeorge gmail com>
- To: gtk-app-devel-list gnome org
- Subject: GtkMenu doesn't recognize it's parents?
- Date: Wed, 30 Aug 2006 23:47:44 -0600
In glade, I created a window, with a vbox. In the vbox, I created a
menu bar (called "menubar"), then add a menu called "help" and a menu
item called "about", and set an event handler for the menu item. In
the menu event handler, I have code which does the following:
void on_about_cb(GtkMenuItem *menuitem, gpointer data)
{
GtkWidget *mainwindow;
GtkWidget *w;
w = GTK_WIDGET(menuitem);
do {
g_print("Widget ID is %s\n", gtk_widget_get_name(GTK_WIDGET(w)));
w = gtk_widget_get_parent(w);
} while (w != NULL);
}
The sequence printed out is
about
help_menu
GtkWindow
Somehow, the menu bar itself, the vbox and the main window are not in
the hierarchy.
I wrote this test because a call to gtk_widget_get_toplevel returned a
window that was *not* the top level window into which the vbox is
added.
Am I doing something wrong? Is this a glade bug? I noticed this in
programs which use glade code-generation as well as libglade. Or could
it be because the popup menu is a top-level window in it's own right?
I need a pointer to the parent window to which this menu belongs,
since the window has a structure with information, added using
g_object_set_data. Is there some other way to do this?
Thanks
-Jim
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]