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

2006-01-20 Thread Luca Donaggio
2006/1/19, Kalle Vahlman [EMAIL PROTECTED]:
On 1/19/06, Luca Donaggio [EMAIL PROTECTED] 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 lookssomething 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 GtkContainerso it can not be onscreen otherwise) and thus it is in it's ownhierarchy.This coupled with the fact that the glade function has no reference to
menu hierarchy (as it is created by the AppView) makes it impossibleto 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 callto hildon_app_get_appview() would do the trick, but ... it doesn'twork for me! Itseems 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 (thoughthe type and name should state HildonApp of course) which has multipleHildonAppViews (derives from GtkBin) as it's children (although it
only shows one at a time).--Kalle Vahlman, [EMAIL PROTECTED]Powered by http://movial.fiInteresting stuff at 
http://syslog.movial.fiI 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
___
maemo-developers mailing list
maemo-developers@maemo.org
https://maemo.org/mailman/listinfo/maemo-developers


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

2006-01-19 Thread Luca Donaggio
2006/1/19, Kalle Vahlman [EMAIL PROTECTED]:
On 1/18/06, Fred Lefévère-Laaoide [EMAIL PROTECTED] wrote: Have you try gtk_widget_get_toplevel ?That would give the HildonApp, as AppViews are not toplevels. You
could then of course iterate over the list of appviews and check whichhas the menu...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.
[skip]--Kalle Vahlman, [EMAIL PROTECTED]
Powered by http://movial.fiInteresting stuff at http://syslog.movial.fi___maemo-developers mailing list
maemo-developers@maemo.orghttps://maemo.org/mailman/listinfo/maemo-developers
Luca Donaggio
___
maemo-developers mailing list
maemo-developers@maemo.org
https://maemo.org/mailman/listinfo/maemo-developers


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

2006-01-19 Thread Kalle Vahlman
On 1/19/06, Luca Donaggio [EMAIL PROTECTED] 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, [EMAIL PROTECTED]
Powered by http://movial.fi
Interesting stuff at http://syslog.movial.fi
___
maemo-developers mailing list
maemo-developers@maemo.org
https://maemo.org/mailman/listinfo/maemo-developers


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

2006-01-18 Thread Luca Donaggio
How can I get a reference to the parent AppView giving a pointer to its GtkMenu?gtk_menu_get_attach_widget() doesn't work and gtk_widget_get_parent() returns a pointer to some unknown object (I checked it).
Thanks in advance,Luca Donaggio
___
maemo-developers mailing list
maemo-developers@maemo.org
https://maemo.org/mailman/listinfo/maemo-developers


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

2006-01-18 Thread Kalle Vahlman
On 1/18/06, Fred Lefévère-Laaoide [EMAIL PROTECTED] wrote:
 Have you try gtk_widget_get_toplevel ?

That would give the HildonApp, as AppViews are not toplevels. You
could then of course iterate over the list of appviews and check which
has the menu...

 Luca Donaggio wrote:
  How can I get a reference to the parent AppView giving a pointer to its
  GtkMenu?

...but best would be to determine if there was a way around it. What
exactly is the use case?

  gtk_menu_get_attach_widget() doesn't work and gtk_widget_get_parent()
  returns a pointer to some unknown object (I checked it).

The menu is not attached to any widget, nor is it strictly tied to the
AppView. I'm a bit surprised thet the get_parent() actually returns
anything, as menus should be toplevel widgets. You could print the
name of the widget with gtk_widget_name() and the type with
G_OBJECT_TYPE_NAME() to see what it is.

As you see, the menu has no good connection to the view it belongs to,
so it's probably better to rethink what you are doing in a different
way if possible.

--
Kalle Vahlman, [EMAIL PROTECTED]
Powered by http://movial.fi
Interesting stuff at http://syslog.movial.fi
___
maemo-developers mailing list
maemo-developers@maemo.org
https://maemo.org/mailman/listinfo/maemo-developers