[Glade-users] Function needed in new glade-3.x
- From: Neil Zanella <nzanella gmail com> (Neil Zanella)
- Subject: [Glade-users] Function needed in new glade-3.x
- Date: Mon, 18 Oct 2004 13:36:06 -0600
Hi,
I am new to libglade, but out of curiosity, what kind of work
do you do with the glade_xml_widget_tree_foreach() call?
That is, what do you use it for?
Regards,
Thanks,
Neil
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.
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.
I have this working now, but I had to do a VERY BAD HACK (copied
glade-private.h from the libglade source into my own code so that I could
expose the hashtable of widgets inside the GladeXML structure. I DID not want
to do it this way as if a future version of libglade gets installed and the
internal structure changes my code would most likely break badly.
So the best solution is to add a new function called something like:
glade_xml_tree_foreach(GladeXML *xml, (GHFunc *) foreach_func, gpointer
user_data)
{
g_hash_table_foreach(xml->priv->name_hash, foreach_func,user_data);
}
The foreach func has the same structure as a GHFunc from the glib manual:
void (*GHFunc) (gpointer key,
gpointer value,
gpointer user_data);
key being the widget name, value being the widget pointer.
This way 1 function can be called that kicks off a call to a foreach function
passing in the widgets name/pointer and user supplied data.
PLEASE consider adding this to libglade-2.4 or 3.0, as it works very well.
=====
Dave J. Andruczyk
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com
_______________________________________________
Glade-users maillist - Glade-users lists ximian com
http://lists.ximian.com/mailman/listinfo/glade-users
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]