Re: howto compare two GTypes

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

 



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@xxxxxxxxx
tadej.borovsak@xxxxxxxxx
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list



[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux