[gtk+/rendering-cleanup: 27/92] testgtk: Convert WM hints example to use gdk_window_set_icon_list()



commit f79866c5696b3c0f5de043ad56b42b7a1f9b0389
Author: Benjamin Otte <otte redhat com>
Date:   Thu Aug 12 04:39:28 2010 +0200

    testgtk: Convert WM hints example to use gdk_window_set_icon_list()
    
    gdk_window_set_icon() is about to go away.
    
    Also removes the circles.xbm file and uses the oncluded openfile logo
    instead.

 tests/Makefile.am |    1 -
 tests/circles.xbm |   46 ----------------------------------------------
 tests/testgtk.c   |   29 +++++++++++------------------
 3 files changed, 11 insertions(+), 65 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a729c24..ac2c9c2 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -355,7 +355,6 @@ EXTRA_DIST += 			\
 	testgtk.1 		\
 	testgtkrc 		\
 	testgtkrc2 		\
-	circles.xbm		\
 	3DRings.xpm		\
 	FilesQueue.xpm		\
 	Modeller.xpm		\
diff --git a/tests/testgtk.c b/tests/testgtk.c
index ba6a9ba..c5a47dd 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -49,7 +49,6 @@
 
 #include "prop-editor.h"
 
-#include "circles.xbm"
 #include "test.xpm"
 
 gboolean
@@ -7460,10 +7459,9 @@ create_wmhints (GtkWidget *widget)
   GtkWidget *button;
   GtkWidget *box1;
   GtkWidget *box2;
-  GdkBitmap *circles;
   GdkWindow *gdk_window;
-  cairo_surface_t *image;
-  cairo_t *cr;
+  GdkPixbuf *pixbuf;
+  GList *list;
 
   if (!window)
     {
@@ -7482,25 +7480,20 @@ create_wmhints (GtkWidget *widget)
       gtk_widget_realize (window);
 
       gdk_window = gtk_widget_get_window (window);
-      circles = gdk_pixmap_new (gdk_window, circles_width, circles_height, 1);
-      cr = gdk_cairo_create (circles);
-      image = cairo_image_surface_create_for_data (circles_bits, CAIRO_FORMAT_A1,
-                                                   circles_width, circles_height,
-                                                   circles_width / 8);
-      cairo_set_source_surface (cr, image, 0, 0);
-      cairo_surface_destroy (image);
-      cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
-      cairo_paint (cr);
-      cairo_destroy (cr);
 
-      gdk_window_set_icon (gdk_window, NULL,
-			   circles, circles);
+      pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) openfile);
+      list = g_list_prepend (NULL, pixbuf);
 
-      gdk_window_set_icon_name (gdk_window, "WMHints Test Icon");
+      gdk_window_set_icon_list (gdk_window, list);
+      
+      g_list_free (list);
+      g_object_unref (pixbuf);
 
+      gdk_window_set_icon_name (gdk_window, "WMHints Test Icon");
+  
       gdk_window_set_decorations (gdk_window, GDK_DECOR_ALL | GDK_DECOR_MENU);
       gdk_window_set_functions (gdk_window, GDK_FUNC_ALL | GDK_FUNC_RESIZE);
-
+      
       box1 = gtk_vbox_new (FALSE, 0);
       gtk_container_add (GTK_CONTAINER (window), box1);
       gtk_widget_show (box1);



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