summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
authorPatrick Niklaus <marex@compiz-fusion.org>2008-08-14 14:01:51 +0000
committerThomas James Alexander Thurman <tthurman@src.gnome.org>2008-08-14 14:01:51 +0000
commit5631cbe22d9ef06db1406881f8407d705b26aff5 (patch)
treeafc7e4777582b5aa0238c973b852294e6e7fcc6e /src/ui
parent92fe1574ec11a89b40750be7a9961c31c6163db8 (diff)
downloadmetacity-5631cbe22d9ef06db1406881f8407d705b26aff5.tar.gz
metacity-5631cbe22d9ef06db1406881f8407d705b26aff5.tar.bz2
Icons for windows are taken from the desktop theme, not from the Metacity
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. svn path=/trunk/; revision=3812
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/preview-widget.c57
-rw-r--r--src/ui/ui.c54
2 files changed, 69 insertions, 42 deletions
diff --git a/src/ui/preview-widget.c b/src/ui/preview-widget.c
index 4d2f9a2..23504f9 100644
--- a/src/ui/preview-widget.c
+++ b/src/ui/preview-widget.c
@@ -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 @@ meta_preview_set_button_layout (MetaPreview *preview,
gtk_widget_queue_draw (GTK_WIDGET (preview));
}
-#include "inlinepixbufs.h"
-
GdkPixbuf*
meta_preview_get_icon (void)
{
@@ -420,20 +419,27 @@ meta_preview_get_icon (void)
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 @@ meta_preview_get_mini_icon (void)
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;
diff --git a/src/ui/ui.c b/src/ui/ui.c
index 3790118..ca0affc 100644
--- a/src/ui/ui.c
+++ b/src/ui/ui.c
@@ -574,20 +574,27 @@ meta_ui_get_default_window_icon (MetaUI *ui)
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 @@ meta_ui_get_default_mini_icon (MetaUI *ui)
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));