Re: howto compare two GTypes
- From: Tadej Borovšak <tadeboro gmail com>
- To: joel krähemann <joel weedlight ch>
- Cc: gtk-list gnome org
- Subject: Re: howto compare two GTypes
- Date: Mon, 11 Oct 2010 21:49:18 +0200
Hi.
Not sure why your code doesn't work, since it looks clean to me. Maybe
you have an error somewhere else in your code?
I also quickly created compilable sample that demos type comparison:
-----
#include <gtk/gtk.h>
int
main (int argc,
char **argv)
{
GList *list = NULL,
*iter;
GType type;
gtk_init (&argc, &argv);
list = g_list_prepend (list, gtk_window_new (GTK_WINDOW_TOPLEVEL));
list = g_list_prepend (list, gtk_button_new ());
list = g_list_prepend (list, gtk_label_new ("Label"));
type = GTK_TYPE_LABEL;
for (iter = list; iter; iter = g_list_next (iter))
if (G_OBJECT_TYPE (iter->data) == type)
g_print ("Match found\n");
else
g_print ("No match\n");
return 0;
}
-----
Tadej
--
Tadej Borovšak
tadeboro.blogspot.com
tadeboro gmail com
tadej borovsak gmail com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]