metacity r3812 - in trunk: . src src/include src/ui



Author: tthurman
Date: Thu Aug 14 14:01:51 2008
New Revision: 3812
URL: http://svn.gnome.org/viewvc/metacity?rev=3812&view=rev

Log:
2008-08-14   Patrick Niklaus  <marex compiz-fusion org>

          Icons for windows are taken from the desktop theme, not from
          the Metacity theme or from the fallback icon that Metacity
          provided.  Closes #524343.

        * src/ui/ui.c: Use GtkIconTheme to load the default window icon.
          Assumes the existence of an icon called "window", otherwise
          falls back to "gtk-missing-image". Fixes #524343.
        * src/ui/preview-widget: See above.
        * src/include/common.h: Add META_DEFAULT_ICON_NAME.
        * src/Makefile.am: Remove default_icon.png from inlinepixbufs.h.
        * src/default_icon.png: Removed.



Modified:
   trunk/ChangeLog
   trunk/src/Makefile.am
   trunk/src/include/common.h
   trunk/src/ui/preview-widget.c
   trunk/src/ui/ui.c

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Thu Aug 14 14:01:51 2008
@@ -180,9 +180,8 @@
 install-data-local:
 endif
 
-IMAGES=default_icon.png stock_maximize.png stock_minimize.png stock_delete.png
-VARIABLES=default_icon_data $(srcdir)/default_icon.png \
-          stock_maximize_data $(srcdir)/stock_maximize.png \
+IMAGES=stock_maximize.png stock_minimize.png stock_delete.png
+VARIABLES=stock_maximize_data $(srcdir)/stock_maximize.png \
           stock_minimize_data $(srcdir)/stock_minimize.png \
           stock_delete_data $(srcdir)/stock_delete.png
 

Modified: trunk/src/include/common.h
==============================================================================
--- trunk/src/include/common.h	(original)
+++ trunk/src/include/common.h	Thu Aug 14 14:01:51 2008
@@ -278,6 +278,8 @@
 #define META_MINI_ICON_WIDTH 16
 #define META_MINI_ICON_HEIGHT 16
 
+#define META_DEFAULT_ICON_NAME "window"
+
 #define META_PRIORITY_PREFS_NOTIFY   (G_PRIORITY_DEFAULT_IDLE + 10)
 #define META_PRIORITY_WORK_AREA_HINT (G_PRIORITY_DEFAULT_IDLE + 15)
 

Modified: trunk/src/ui/preview-widget.c
==============================================================================
--- trunk/src/ui/preview-widget.c	(original)
+++ trunk/src/ui/preview-widget.c	Thu Aug 14 14:01:51 2008
@@ -25,6 +25,7 @@
 #define _XOPEN_SOURCE 600 /* for the maths routines over floats */
 
 #include <math.h>
+#include <gtk/gtkicontheme.h>
 #include "preview-widget.h"
 
 static void     meta_preview_class_init    (MetaPreviewClass *klass);
@@ -411,8 +412,6 @@
   gtk_widget_queue_draw (GTK_WIDGET (preview));
 }
 
-#include "inlinepixbufs.h"
-
 GdkPixbuf*
 meta_preview_get_icon (void)
 {
@@ -420,20 +419,27 @@
 
   if (default_icon == NULL)
     {
-      GdkPixbuf *base;
+      GtkIconTheme *theme;
+      gboolean icon_exists;
 
-      base = gdk_pixbuf_new_from_inline (-1, default_icon_data,
-                                         FALSE,
-                                         NULL);
+      theme = gtk_icon_theme_get_default ();
 
-      g_assert (base);
+      icon_exists = gtk_icon_theme_has_icon (theme, META_DEFAULT_ICON_NAME);
 
-      default_icon = gdk_pixbuf_scale_simple (base,
-                                              META_ICON_WIDTH,
-                                              META_ICON_HEIGHT,
-                                              GDK_INTERP_BILINEAR);
+      if (icon_exists)
+          default_icon = gtk_icon_theme_load_icon (theme,
+                                                   META_DEFAULT_ICON_NAME,
+                                                   META_ICON_WIDTH,
+                                                   0,
+                                                   NULL);
+      else
+          default_icon = gtk_icon_theme_load_icon (theme,
+                                                   "gtk-missing-image",
+                                                   META_ICON_WIDTH,
+                                                   0,
+                                                   NULL);
 
-      g_object_unref (G_OBJECT (base));
+      g_assert (default_icon);
     }
   
   return default_icon;
@@ -446,20 +452,27 @@
 
   if (default_icon == NULL)
     {
-      GdkPixbuf *base;
+      GtkIconTheme *theme;
+      gboolean icon_exists;
 
-      base = gdk_pixbuf_new_from_inline (-1, default_icon_data,
-                                         FALSE,
-                                         NULL);
+      theme = gtk_icon_theme_get_default ();
 
-      g_assert (base);
+      icon_exists = gtk_icon_theme_has_icon (theme, META_DEFAULT_ICON_NAME);
 
-      default_icon = gdk_pixbuf_scale_simple (base,
-                                              META_MINI_ICON_WIDTH,
-                                              META_MINI_ICON_HEIGHT,
-                                              GDK_INTERP_BILINEAR);
+      if (icon_exists)
+          default_icon = gtk_icon_theme_load_icon (theme,
+                                                   META_DEFAULT_ICON_NAME,
+                                                   META_MINI_ICON_WIDTH,
+                                                   0,
+                                                   NULL);
+      else
+          default_icon = gtk_icon_theme_load_icon (theme,
+                                                   "gtk-missing-image",
+                                                   META_MINI_ICON_WIDTH,
+                                                   0,
+                                                   NULL);
 
-      g_object_unref (G_OBJECT (base));
+      g_assert (default_icon);
     }
   
   return default_icon;

Modified: trunk/src/ui/ui.c
==============================================================================
--- trunk/src/ui/ui.c	(original)
+++ trunk/src/ui/ui.c	Thu Aug 14 14:01:51 2008
@@ -574,20 +574,27 @@
 
   if (default_icon == NULL)
     {
-      GdkPixbuf *base;
+      GtkIconTheme *theme;
+      gboolean icon_exists;
 
-      base = gdk_pixbuf_new_from_inline (-1, default_icon_data,
-                                         FALSE,
-                                         NULL);
+      theme = gtk_icon_theme_get_default ();
 
-      g_assert (base);
+      icon_exists = gtk_icon_theme_has_icon (theme, META_DEFAULT_ICON_NAME);
 
-      default_icon = gdk_pixbuf_scale_simple (base,
-                                              META_ICON_WIDTH,
-                                              META_ICON_HEIGHT,
-                                              GDK_INTERP_BILINEAR);
+      if (icon_exists)
+          default_icon = gtk_icon_theme_load_icon (theme,
+                                                   META_DEFAULT_ICON_NAME,
+                                                   META_ICON_WIDTH,
+                                                   0,
+                                                   NULL);
+      else
+          default_icon = gtk_icon_theme_load_icon (theme,
+                                                   "gtk-missing-image",
+                                                   META_ICON_WIDTH,
+                                                   0,
+                                                   NULL);
 
-      g_object_unref (G_OBJECT (base));
+      g_assert (default_icon);
     }
 
   g_object_ref (G_OBJECT (default_icon));
@@ -602,20 +609,27 @@
 
   if (default_icon == NULL)
     {
-      GdkPixbuf *base;
+      GtkIconTheme *theme;
+      gboolean icon_exists;
 
-      base = gdk_pixbuf_new_from_inline (-1, default_icon_data,
-                                         FALSE,
-                                         NULL);
+      theme = gtk_icon_theme_get_default ();
 
-      g_assert (base);
+      icon_exists = gtk_icon_theme_has_icon (theme, META_DEFAULT_ICON_NAME);
 
-      default_icon = gdk_pixbuf_scale_simple (base,
-                                              META_MINI_ICON_WIDTH,
-                                              META_MINI_ICON_HEIGHT,
-                                              GDK_INTERP_BILINEAR);
+      if (icon_exists)
+          default_icon = gtk_icon_theme_load_icon (theme,
+                                                   META_DEFAULT_ICON_NAME,
+                                                   META_MINI_ICON_WIDTH,
+                                                   0,
+                                                   NULL);
+      else
+          default_icon = gtk_icon_theme_load_icon (theme,
+                                                   "gtk-missing-image",
+                                                   META_MINI_ICON_WIDTH,
+                                                   0,
+                                                   NULL);
 
-      g_object_unref (G_OBJECT (base));
+      g_assert (default_icon);
     }
 
   g_object_ref (G_OBJECT (default_icon));



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