Re: Getting all data from a GObject



Not that I know of. Data can be anything, so if you get a NULL pointer or a number that points outside the application memory, you get a segfault when checking for the type. I guess you could catch the segfault signal and ignore it...

myaconis nycap rr com wrote:

That works great. Unfortunately, when I check to see if the data associated with the Quark is a widget (i.e. GTK_IS_WIDGET( data )) occasionally I'll get a seg fault.
Is there any way to make that check more safely?  I only really care about the widgets.

----- Original Message -----
From: Paolo Costabel <paolo zebradevelopment com>
Date: Monday, January 10, 2005 1:48 pm
Subject: Re: Getting all data from a GObject

Try

g_datalist_foreach( &object->qdata, my_function , user_data);

void my_function (GQuark <http://developer.gnome.org/doc/API/2.0/glib/glib-Quarks.html#GQuark> key_id, gpointer <http://developer.gnome.org/doc/API/2.0/glib/glib-Basic-
Types.html#gpointer> data,
gpointer <http://developer.gnome.org/doc/API/2.0/glib/glib-Basic-
Types.html#gpointer> user_data)
{
        printf("Key: %s\n",g_quark_to_string (key_id));

}



myaconis nycap rr com wrote:

Is there a way to get all the data assigned to a GObject by
g_object_set_data? Basically what I would like to do is grab a list of keys for a particular GObject that I have no prior knowledge of so that I can iterate through them.
Thanks
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list









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