fixed list of possible editors in popup menu
authorVladimir Nadvornik <nadvornik@suse.cz>
Mon, 7 Sep 2009 20:04:22 +0000 (20:04 +0000)
committerVladimir Nadvornik <nadvornik@suse.cz>
Mon, 7 Sep 2009 20:04:22 +0000 (20:04 +0000)
src/editors.c
src/editors.h
src/menu.c

index f4dc2ac..8862d9a 100644 (file)
@@ -319,7 +319,7 @@ gboolean editor_read_desktop_file(const gchar *path)
        if (g_key_file_get_boolean(key_file, DESKTOP_GROUP, "X-Geeqie-Filter", NULL)) editor->flags |= EDITOR_DEST;
        if (g_key_file_get_boolean(key_file, DESKTOP_GROUP, "Terminal", NULL)) editor->flags |= EDITOR_TERMINAL;
        
-       editor->flags |= editor_command_parse(editor, NULL, NULL);
+       editor->flags |= editor_command_parse(editor, NULL, FALSE, NULL);
 
        if ((editor->flags & EDITOR_NO_PARAM) && !category_geeqie) editor->hidden = TRUE;
 
@@ -639,7 +639,7 @@ typedef enum {
 } PathType;
 
 
-static gchar *editor_command_path_parse(const FileData *fd, PathType type, const EditorDescription *editor)
+static gchar *editor_command_path_parse(const FileData *fd, gboolean consider_sidecars, PathType type, const EditorDescription *editor)
 {
        GString *string;
        gchar *pathl;
@@ -668,7 +668,7 @@ static gchar *editor_command_path_parse(const FileData *fd, PathType type, const
                                        break;
                                        }
 
-                               work2 = fd->sidecar_files;
+                               work2 = consider_sidecars ? fd->sidecar_files : NULL;
                                while (work2)
                                        {
                                        FileData *sfd = work2->data;
@@ -741,7 +741,7 @@ static GString *append_quoted(GString *str, const char *s, gboolean single_quote
 }
 
 
-EditorFlags editor_command_parse(const EditorDescription *editor, GList *list, gchar **output)
+EditorFlags editor_command_parse(const EditorDescription *editor, GList *list, gboolean consider_sidecars, gchar **output)
 {
        EditorFlags flags = 0;
        const gchar *p;
@@ -818,6 +818,7 @@ EditorFlags editor_command_parse(const EditorDescription *editor, GList *list, g
                                                        goto err;
                                                        }
                                                pathl = editor_command_path_parse((FileData *)list->data,
+                                                                                 consider_sidecars,
                                                                                  (*p == 'f') ? PATH_FILE : PATH_FILE_URL,
                                                                                  editor);
                                                if (!pathl)
@@ -851,7 +852,7 @@ EditorFlags editor_command_parse(const EditorDescription *editor, GList *list, g
                                                while (work)
                                                        {
                                                        FileData *fd = work->data;
-                                                       pathl = editor_command_path_parse(fd, (*p == 'F') ? PATH_FILE : PATH_FILE_URL, editor);
+                                                       pathl = editor_command_path_parse(fd, consider_sidecars, (*p == 'F') ? PATH_FILE : PATH_FILE_URL, editor);
                                                        if (pathl)
                                                                {
                                                                ok = TRUE;
@@ -961,7 +962,7 @@ static EditorFlags editor_command_one(const EditorDescription *editor, GList *li
 
        ed->pid = -1;
        ed->flags = editor->flags;
-       ed->flags |= editor_command_parse(editor, list, &command);
+       ed->flags |= editor_command_parse(editor, list, TRUE, &command);
 
        ok = !EDITOR_ERRORS(ed->flags);
 
index f185194..acbb935 100644 (file)
@@ -118,7 +118,7 @@ const gchar *editor_get_name(const gchar *key);
 gboolean is_valid_editor_command(const gchar *key);
 gboolean editor_blocks_file(const gchar *key);
 
-EditorFlags editor_command_parse(const EditorDescription *editor, GList *list, gchar **output);
+EditorFlags editor_command_parse(const EditorDescription *editor, GList *list, gboolean consider_sidecars, gchar **output);
 
 #endif
 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */
index d2b0168..0049df9 100644 (file)
@@ -80,7 +80,7 @@ static void add_edit_items(GtkWidget *menu, GCallback func, GList *fd_list)
                work = work->next;
                gboolean active = TRUE;
 
-               if (fd_list && EDITOR_ERRORS(editor_command_parse(editor, fd_list, NULL)))
+               if (fd_list && EDITOR_ERRORS(editor_command_parse(editor, fd_list, FALSE, NULL)))
                        active = FALSE;
 
                if (active)