Display icons in edit contextual menu.
authorLaurent Monin <geeqie@norz.org>
Sun, 8 Mar 2009 14:27:19 +0000 (14:27 +0000)
committerLaurent Monin <geeqie@norz.org>
Sun, 8 Mar 2009 14:27:19 +0000 (14:27 +0000)
src/menu.c
src/pixbuf_util.c

index b228126..13e9ea4 100644 (file)
@@ -21,6 +21,7 @@
 #include "editors.h"
 #include "filedata.h"
 #include "img-view.h"
+#include "pixbuf_util.h"
 #include "preferences.h"
 #include "slideshow.h"
 #include "utilops.h"
@@ -83,7 +84,13 @@ static void add_edit_items(GtkWidget *menu, GCallback func, GList *fd_list)
                        }
 
                if (active)
-                       menu_item_add(menu, editor->name, func, editor->key);
+                       {
+                       const gchar *stock_id = NULL;
+                       if (editor->icon && register_theme_icon_as_stock(editor->key, editor->icon))
+                               stock_id = editor->key;
+
+                       menu_item_add_stock(menu, editor->name, stock_id, func, editor->key);
+                       }
                }
        
        g_list_free(editors_list);
index 29640e1..19b9efe 100644 (file)
@@ -166,6 +166,9 @@ gboolean register_theme_icon_as_stock(const gchar *key, const gchar *icon)
        GError *error = NULL;
 
        icon_theme = gtk_icon_theme_get_default();
+       
+       if (gtk_icon_theme_has_icon(icon_theme, key)) return FALSE;
+
        pixbuf = gtk_icon_theme_load_icon(icon_theme,
                            icon, /* icon name */
                            64, /* size */