[maemo-developers] [maemo-developers] Way to get a reference to parent HildonAppView from its menu

From: Kalle Vahlman kalle.vahlman at gmail.com
Date: Thu Jan 19 19:19:17 EET 2006
On 1/19/06, Luca Donaggio <donaggio at gmail.com> wrote:
[Finding the AppView from a menu reference]
> I'm tryng to port grsync to maemo, it's almost done really, but for this
> menu related issue. Grsync has been made with Glade and Glade uses a
> lookup_widget() function to retrieve widgets programmatically by their
> names.

And that's exactly where it fails since it traverses the widget
hierarchy which the menu is not a part of. It's own hierarchy looks
something like:

GtkWindow
   \- GtkMenu
    \- (multiple GtkMenuItems)

Looking at the code, the GtkWindow is the menu's toplevel window (the
menu itself derives from GtkMenuShell which is in turn a GtkContainer
so it can not be onscreen otherwise) and thus it is in it's own
hierarchy.

This coupled with the fact that the glade function has no reference to
menu hierarchy (as it is created by the AppView) makes it impossible
to find with the standard lookup method.

>From the other mail:
>That would not be a big issue, as this app has only one AppView and a
simple call
>to hildon_app_get_appview() would do the trick, but ... it doesn't
work for me! It
>seems to return the same value I got before: ie a reference to a GtkWindow
> (probably the window in which the app itself is displayed ?) and not a pointer to
> the HildonApp object.

This sounds a bit strange, since the HildonApp is a GtkWindow (though
the type and name should state HildonApp of course) which has multiple
HildonAppViews (derives from GtkBin) as it's children (although it
only shows one at a time).

--
Kalle Vahlman, zuh at iki.fi
Powered by http://movial.fi
Interesting stuff at http://syslog.movial.fi

More information about the maemo-developers mailing list