Skip to content

Commit

Permalink
Display icons in edit contextual menu.
Browse files Browse the repository at this point in the history
  • Loading branch information
Laurent Monin committed Mar 8, 2009
1 parent 0205b0a commit 3014c4f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions src/pixbuf_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 3014c4f

Please sign in to comment.