[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gtk-app-devel
Subject:    Re: GtkMenu doesn't recognize it's parents?
From:       Soeren Sandmann <sandmann () daimi ! au ! dk>
Date:       2006-08-31 16:53:56
Message-ID: ye8veo8u9qz.fsf () camel04 ! daimi ! au ! dk
[Download RAW message or body]

"Jim George" <jimgeorge@gmail.com> writes:

> 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?

Yes, the menu is a toplevel window in its own right, so it doesn't
have a parent. 

You can get at the parent menubar this way:

        GTK_MENU_SHELL (menu)->parent_menu_shell

but see below for a better way.

> 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?

The usual way to pass data to a callback is to pass it at signal
connection time:

   g_signal_connect (menu_item, "activated", 
                     G_CALLBACK (on_about_cb),
                     main_window);

The main window will then be passed as "data" in the on_about_cb
function. I am not sure you can do this when adding event handlers
through glade, so you'll have to not do that.

Instead use libglade and manually connec whatever signal connections
you need.


Soren
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic