]> Pileus Git - ~andy/gtk/blobdiff - tests/testicontheme.c
tests: Include config.h
[~andy/gtk] / tests / testicontheme.c
index c14f4d2d3214eb0f7ab7db128248e9eb926751b3..ad9a459e05d7059172c63fa1159ac2a4587fd941 100644 (file)
@@ -13,9 +13,7 @@
  * Library General Public License for more details.
  *
  * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <gtk/gtk.h>
@@ -68,6 +66,8 @@ main (int argc, char *argv[])
 
   if (strcmp (argv[1], "display") == 0)
     {
+      GError *error;
+      GdkPixbuf *pixbuf;
       GtkWidget *window, *image;
       GtkIconSize size;
 
@@ -82,10 +82,23 @@ main (int argc, char *argv[])
        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 ();
@@ -128,9 +141,9 @@ main (int argc, char *argv[])
       if (argc >= 5)
        size = atoi (argv[4]);
       
-      icon_info = gtk_icon_theme_lookup_icon (icon_theme, argv[3], size, 0);
+      icon_info = gtk_icon_theme_lookup_icon (icon_theme, argv[3], size, GTK_ICON_LOOKUP_USE_BUILTIN);
       g_print ("icon for %s at %dx%d is %s\n", argv[3], size, size,
-              icon_info ? gtk_icon_info_get_filename (icon_info) : "<none>");
+              icon_info ? (gtk_icon_info_get_builtin_pixbuf (icon_info) ? "<builtin>" : gtk_icon_info_get_filename (icon_info)) : "<none>");
 
       if (icon_info) 
        {