gtk+ r21739 - in trunk: . tests



Author: cdywan
Date: Fri Oct 31 08:56:42 2008
New Revision: 21739
URL: http://svn.gnome.org/viewvc/gtk+?rev=21739&view=rev

Log:
Bug 347230 â testicontheme shortcomings

* tests/testicontheme.c (main):
Use theme for "display" and quit on window closing

Modified:
   trunk/ChangeLog
   trunk/tests/testicontheme.c

Modified: trunk/tests/testicontheme.c
==============================================================================
--- trunk/tests/testicontheme.c	(original)
+++ trunk/tests/testicontheme.c	Fri Oct 31 08:56:42 2008
@@ -68,6 +68,8 @@
 
   if (strcmp (argv[1], "display") == 0)
     {
+      GError *error;
+      GdkPixbuf *pixbuf;
       GtkWidget *window, *image;
       GtkIconSize size;
 
@@ -82,10 +84,23 @@
 	size = atoi (argv[4]);
       else 
 	size = GTK_ICON_SIZE_BUTTON;
-      
+
+      error = NULL;
+      pixbuf = gtk_icon_theme_load_icon (icon_theme, argv[3], size,
+                                         GTK_ICON_LOOKUP_USE_BUILTIN, &error);
+      if (!pixbuf)
+        {
+          g_print ("%s\n", error->message);
+          return 1;
+        }
+
       window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-      image = gtk_image_new_from_icon_name (argv[3], size); 
+      image = gtk_image_new ();
+      gtk_image_set_from_pixbuf (GTK_IMAGE (image), pixbuf);
+      g_object_unref (pixbuf);
       gtk_container_add (GTK_CONTAINER (window), image);
+      g_signal_connect (window, "delete-event",
+                        G_CALLBACK (gtk_main_quit), window);
       gtk_widget_show_all (window);
       
       gtk_main ();



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