summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas James Alexander Thurman <tthurman@src.gnome.org>2006-05-04 16:30:58 +0000
committerThomas James Alexander Thurman <tthurman@src.gnome.org>2006-05-04 16:30:58 +0000
commitc88a140a7471a911342c3747d506b83c56562c93 (patch)
tree31db1e6ee69e7a13534119e5179141d0057560fa
parentcd3a1da38b21e24f9295ae475a5275a594db79d5 (diff)
downloadmetacity-c88a140a7471a911342c3747d506b83c56562c93.tar.gz
Bug 113465: allow theme images in themes (er, icon theme images)
-rw-r--r--src/theme.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/src/theme.c b/src/theme.c
index a9755759..b915e4d6 100644
--- a/src/theme.c
+++ b/src/theme.c
@@ -25,6 +25,8 @@
#include "util.h"
#include "gradient.h"
#include <gtk/gtkwidget.h>
+#include <gtk/gtkimage.h>
+#include <gtk/gtkicontheme.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
@@ -4620,19 +4622,31 @@ meta_theme_load_image (MetaTheme *theme,
if (pixbuf == NULL)
{
- char *full_path;
-
- full_path = g_build_filename (theme->dirname, filename, NULL);
-
- pixbuf = gdk_pixbuf_new_from_file (full_path, error);
- if (pixbuf == NULL)
+
+ if (g_str_has_prefix (filename, "theme:"))
{
- g_free (full_path);
- return NULL;
- }
+ pixbuf = gtk_icon_theme_load_icon (
+ gtk_icon_theme_get_default (),
+ filename+6,
+ 48,
+ 0,
+ error);
+ if (pixbuf == NULL) return NULL;
+ }
+ else
+ {
+ char *full_path;
+ full_path = g_build_filename (theme->dirname, filename, NULL);
- g_free (full_path);
+ pixbuf = gdk_pixbuf_new_from_file (full_path, error);
+ if (pixbuf == NULL)
+ {
+ g_free (full_path);
+ return NULL;
+ }
+ g_free (full_path);
+ }
g_hash_table_replace (theme->images_by_filename,
g_strdup (filename),
pixbuf);