[Glade-users] Function needed in new glade-3.x



On Mon, 18 Oct 2004 09:18:11 -0700 (PDT), Dave Andruczyk
<djandruczyk yahoo com> wrote:
I brought this up before but I think it got lost in never-never land when the
list went haywire.

Hmmm,
    It would really be a plus IMO if people would post these things
to bugzilla, at least the discussion could be archived in a more sensable
manner.

I think one function needs to be added to libglade to be able to call a
function for each widget in the loaded XML tree.  Now people will say: "WHY,
you can just lookup the widgets by name and get the pointer to the widget that
way"  The reason is that what if I have 1000 widgets, I don't want those to be
statically named throughout my code.  My current code projects NEED and WILL
NOT WORK without being able to bind data to the widgets without calls to
g_object_set/get_data.  By having ONE function called
glade_xml_widget_tree_foreach()(or similar), Users can get have a function
called for each widget in the tree and do whatever they need to it with just 1
function call (instead foa call per widget needed by the lookup_name fucntion.

The GTK+ tradition AFAIK goes something like this:

/* Call this on each toplevel
 */
gtk_container_forech(GTK_CONTAINER(toplevel), 
                                       recursive_foreach, callback);

recursive_foreach(GtkWidget *widget, gpointer cb)
{
         if (GTK_IS_CONTAINER(widget)) {
                gtk_container_foreach(widget, recursive_foreach, cb);
         }
         cb(widget);
}


Cheers,
                                                  -Tristan




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