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



commit 76118198267ee8ca9abdf0af87aa395affc31d96
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   |   24 ++++++++----------------
 3 files changed, 8 insertions(+), 63 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 0260a55..ceba195 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -49,7 +49,6 @@
 
 #include "prop-editor.h"
 
-#include "circles.xbm"
 #include "test.xpm"
 
 gboolean
@@ -7425,9 +7424,8 @@ create_wmhints (GtkWidget *widget)
   GtkWidget *button;
   GtkWidget *box1;
   GtkWidget *box2;
-  GdkBitmap *circles;
-  cairo_surface_t *image;
-  cairo_t *cr;
+  GdkPixbuf *pixbuf;
+  GList *list;
 
   if (!window)
     {
@@ -7445,20 +7443,14 @@ create_wmhints (GtkWidget *widget)
 
       gtk_widget_realize (window);
       
-      circles = gdk_pixmap_new (window->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);
+      pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) openfile);
+      list = g_list_prepend (NULL, pixbuf);
 
-      gdk_window_set_icon (window->window, NULL,
-			   circles, circles);
+      gdk_window_set_icon_list (window->window, list);
       
+      g_list_free (list);
+      g_object_unref (pixbuf);
+
       gdk_window_set_icon_name (window->window, "WMHints Test Icon");
   
       gdk_window_set_decorations (window->window, GDK_DECOR_ALL | GDK_DECOR_MENU);



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