Re: Iterating through children



Dimitar Haralanov wrote:

Well, looking at your function I realized that it might be more
helpful then I thought. Here is what I am trying to accomplish:
I am not sure whether you are familiar with the lookup_widget ()
function that glade/glade-2 generates as part of its gtk code but what
it does is allow the programmer to get a pointer to any widget just by
passing an arbitrary widget and the name of the variable that is used
to point to the sought widget.

That's basically the same thing my function does. There are just two
main differences:
1. my function operates independently from Glade, has no particular
   external references and doesn't need any extra precautions like
   Glade's GLADE_HOOKUP_OBJECT lists.
2. Since it uses gtk_container_get_children () and numerous string
   comparisons it's probably a bit slower than lookup_widget ().

I haven't understood that g_object_[sg]et_data-thing (used by
lookup_widget) yet, since it doesn't seem to be documented thus I will
need to analyze it. I'm not sure whether it provides a way to accelerate
my function.

I am trying to duplicate this functionality! The reason why I am
not using lookup_widget is that it requires that the top level
widget is a window. Unfortunately, I don't have that pointer
since the container that I am working with gets passed to me.

See
http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html#gtk-widget-get-parent

If you can assume the window to be created by Glade then you should be
able to use lookup_widget () for it as well. If you're not sure / don't
know / can't assume then the approach of widget_find_by_name () would
still work.

If would appreciate it very much if anyone can help with this.
Otherwise, I will have to resort to making all the needed widgets
global:(

I personally dislike such ideas.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]