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

From: Luca Donaggio donaggio at gmail.com
Date: Fri Jan 20 14:43:53 EET 2006
2006/1/19, Kalle Vahlman <kalle.vahlman at gmail.com>:
>
> 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
>


I  understand. So the GtkWindow, which is the top level widget of an
HildonAppView's own menu, is not in any way referrable to the HildonApp to
which that HildonAppView is attached?
If this is the case, I don't see any other way to solve the problem apart
from maintaining a global reference for the HildonApp and modifying the
glade lookup function to get the right pointer to the HildonAppView through
that reference directly, without traversing one object's hierarchy anymore.

Luca Donaggio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maemo.org/pipermail/maemo-developers/attachments/20060120/43f5cba1/attachment.htm 
More information about the maemo-developers mailing list