]> www.fi.muni.cz Git - evince.git/commitdiff
Don't use libgnome to lookup icons for MIME types, instead copy code from
authorRoss Burton <ross@openedhand.com>
Fri, 4 May 2007 15:12:15 +0000 (15:12 +0000)
committerRoss Burton <rburton@src.gnome.org>
Fri, 4 May 2007 15:12:15 +0000 (15:12 +0000)
2007-05-04  Ross Burton  <ross@openedhand.com>

* shell/ev-sidebar-attachments.c:
Don't use libgnome to lookup icons for MIME types, instead copy
code from GTK+ to do it manually.

svn path=/trunk/; revision=2434

ChangeLog
shell/ev-sidebar-attachments.c

index 042a7b2300d73c5c366b0ab87be8e4818567809f..8aace3186c830d4955d528bdec2337fe740fd9a3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-05-04  Ross Burton  <ross@openedhand.com>
+
+       * shell/ev-sidebar-attachments.c:
+       Don't use libgnome to lookup icons for MIME types, instead copy
+       code from GTK+ to do it manually.
+
 2007-05-04  Ross Burton  <ross@openedhand.com>
 
        * configure.ac:
index e735b131ce0a29e69836d226ffff34f0ed957dd4..5d2beff317e1ab722450284b9654eeca99f03846 100644 (file)
@@ -29,7 +29,6 @@
 #include <glib/gstdio.h>
 #include <gtk/gtk.h>
 #include <string.h>
-#include <libgnomeui/gnome-icon-lookup.h>
 
 #include "ev-file-helpers.h"
 #include "ev-sidebar-attachments.h"
@@ -99,20 +98,28 @@ static GdkPixbuf *
 icon_theme_get_pixbuf_from_mime_type (GtkIconTheme *icon_theme,
                                      const gchar  *mime_type)
 {
-       GdkPixbuf *pixbuf = NULL;
-       gchar     *icon;
-
-       icon = gnome_icon_lookup (icon_theme,
-                                 NULL, NULL,
-                                 NULL, NULL,
-                                 mime_type,
-                                 GNOME_ICON_LOOKUP_FLAGS_NONE,
-                                 NULL);
-
-       pixbuf = gtk_icon_theme_load_icon (icon_theme,
-                                          icon, 48, 0, NULL);
-       g_free (icon);
-
+       const char *separator;
+       GString *icon_name;
+       GdkPixbuf *pixbuf;
+
+       separator = strchr (mime_type, '/');
+       if (!separator)
+               return NULL; /* maybe we should return a GError with "invalid MIME-type" */
+
+       icon_name = g_string_new ("gnome-mime-");
+       g_string_append_len (icon_name, mime_type, separator - mime_type);
+       g_string_append_c (icon_name, '-');
+       g_string_append (icon_name, separator + 1);
+       pixbuf = gtk_icon_theme_load_icon (icon_theme, icon_name->str, 48, 0, NULL);
+       g_string_free (icon_name, TRUE);
+       if (pixbuf)
+               return pixbuf;
+       
+       icon_name = g_string_new ("gnome-mime-");
+       g_string_append_len (icon_name, mime_type, separator - mime_type);
+       pixbuf = gtk_icon_theme_load_icon (icon_theme, icon_name->str, 48, 0, NULL);
+       g_string_free (icon_name, TRUE);
+       
        return pixbuf;
 }