Mercurial > geeqie
diff src/menu.c @ 1397:a0bd58a6535f
In various Edit context menus, only display editors that match the file types in the selection.
author | zas_ |
---|---|
date | Sun, 08 Mar 2009 13:23:25 +0000 |
parents | 8b89e3ff286b |
children | 9e7aed6ba6bd |
line wrap: on
line diff
--- a/src/menu.c Sun Mar 08 12:42:23 2009 +0000 +++ b/src/menu.c Sun Mar 08 13:23:25 2009 +0000 @@ -64,7 +64,7 @@ *----------------------------------------------------------------------------- */ -static void add_edit_items(GtkWidget *menu, GCallback func) +static void add_edit_items(GtkWidget *menu, GCallback func, GList *fd_list) { GList *editors_list = editor_list_get(); GList *work = editors_list; @@ -73,15 +73,24 @@ { const EditorDescription *editor = work->data; work = work->next; - - menu_item_add(menu, editor->name, func, editor->key); + gboolean active = TRUE; + + if (fd_list) + { + gint flags = editor_command_parse(editor, fd_list, NULL); + if ((flags & EDITOR_ERROR_MASK) != 0) + active = FALSE; + } + + if (active) + menu_item_add(menu, editor->name, func, editor->key); } g_list_free(editors_list); } -GtkWidget *submenu_add_edit(GtkWidget *menu, GtkWidget **menu_item, GCallback func, gpointer data) +GtkWidget *submenu_add_edit(GtkWidget *menu, GtkWidget **menu_item, GCallback func, gpointer data, GList *fd_list) { GtkWidget *item; GtkWidget *submenu; @@ -90,7 +99,7 @@ submenu = gtk_menu_new(); g_object_set_data(G_OBJECT(submenu), "submenu_data", data); - add_edit_items(submenu, func); + add_edit_items(submenu, func, fd_list); gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu);