Revert changeset 1502. It brokes the spec: hidden desktop files from user directory...
authorLaurent Monin <geeqie@norz.org>
Mon, 9 Mar 2009 19:34:26 +0000 (19:34 +0000)
committerLaurent Monin <geeqie@norz.org>
Mon, 9 Mar 2009 19:34:26 +0000 (19:34 +0000)
src/editors.c

index 57c39d6..89d7e45 100644 (file)
@@ -152,7 +152,6 @@ static gboolean editor_read_desktop_file(const gchar *path)
        const gchar *key = filename_from_path(path);
        gchar **categories, **only_show_in, **not_show_in;
        gchar *try_exec;
-       gboolean hidden = FALSE;
 
        if (g_hash_table_lookup(editors, key)) return FALSE; /* the file found earlier wins */
        
@@ -170,10 +169,17 @@ static gboolean editor_read_desktop_file(const gchar *path)
                return FALSE;
                }
        
+       editor = g_new0(EditorDescription, 1);
+       
+       editor->key = g_strdup(key);
+       editor->file = g_strdup(path);
+
+       g_hash_table_insert(editors, editor->key, editor);
+
        if (g_key_file_get_boolean(key_file, DESKTOP_GROUP, "Hidden", NULL)
            || g_key_file_get_boolean(key_file, DESKTOP_GROUP, "NoDisplay", NULL))
                {
-               hidden = TRUE;
+               editor->hidden = TRUE;
                }
 
        categories = g_key_file_get_string_list(key_file, DESKTOP_GROUP, "Categories", NULL, NULL);
@@ -189,12 +195,12 @@ static gboolean editor_read_desktop_file(const gchar *path)
                                found = TRUE;
                                break;
                                }
-               if (!found) hidden = TRUE;
+               if (!found) editor->hidden = TRUE;
                g_strfreev(categories);
                }
        else
                {
-               hidden = TRUE;
+               editor->hidden = TRUE;
                }
 
        only_show_in = g_key_file_get_string_list(key_file, DESKTOP_GROUP, "OnlyShowIn", NULL, NULL);
@@ -208,7 +214,7 @@ static gboolean editor_read_desktop_file(const gchar *path)
                                found = TRUE;
                                break;
                                }
-               if (!found) hidden = TRUE;
+               if (!found) editor->hidden = TRUE;
                g_strfreev(only_show_in);
                }
 
@@ -223,34 +229,27 @@ static gboolean editor_read_desktop_file(const gchar *path)
                                found = TRUE;
                                break;
                                }
-               if (found) hidden = TRUE;
+               if (found) editor->hidden = TRUE;
                g_strfreev(not_show_in);
                }
                
+               
        try_exec = g_key_file_get_string(key_file, DESKTOP_GROUP, "TryExec", NULL);
        if (try_exec && !editor->hidden)
                {
                gchar *try_exec_res = g_find_program_in_path(try_exec);
-               if (!try_exec_res) hidden = TRUE;
+               if (!try_exec_res) editor->hidden = TRUE;
                g_free(try_exec_res);
                g_free(try_exec);
                }
                
-       if (hidden) 
+       if (editor->hidden) 
                {
                /* hidden editors will be deleted, no need to parse the rest */
                g_key_file_free(key_file);
-               return FALSE;
+               return TRUE;
                }
-
-       editor = g_new0(EditorDescription, 1);
        
-       editor->key = g_strdup(key);
-       editor->file = g_strdup(path);
-       editor->hidden = hidden;
-
-       g_hash_table_insert(editors, editor->key, editor);
-
        editor->name = g_key_file_get_locale_string(key_file, DESKTOP_GROUP, "Name", NULL, NULL);
        editor->icon = g_key_file_get_string(key_file, DESKTOP_GROUP, "Icon", NULL);
 
@@ -571,7 +570,7 @@ static gchar *editor_command_path_parse(const FileData *fd, PathType type, const
 {
        GString *string;
        gchar *pathl;
-       const gchar *p = NULL;
+       const gchar *p;
 
        string = g_string_new("");
 
@@ -621,6 +620,7 @@ static gchar *editor_command_path_parse(const FileData *fd, PathType type, const
                        p = "";
                }
 
+       g_assert(p);
        while (*p != '\0')
                {
                /* must escape \, ", `, and $ to avoid problems,