Revision: 1502
          http://geeqie.svn.sourceforge.net/geeqie/?rev=1502&view=rev
Author:   zas_
Date:     2009-03-09 12:44:06 +0000 (Mon, 09 Mar 2009)

Log Message:
-----------
Only store editors if they match criterias to not be hidden from start, it 
makes more sense. Fix editor_command_path_parse().

Modified Paths:
--------------
    trunk/src/editors.c

Modified: trunk/src/editors.c
===================================================================
--- trunk/src/editors.c 2009-03-08 23:12:49 UTC (rev 1501)
+++ trunk/src/editors.c 2009-03-09 12:44:06 UTC (rev 1502)
@@ -152,6 +152,7 @@
        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 */
        
@@ -169,17 +170,10 @@
                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))
                {
-               editor->hidden = TRUE;
+               hidden = TRUE;
                }
 
        categories = g_key_file_get_string_list(key_file, DESKTOP_GROUP, 
"Categories", NULL, NULL);
@@ -195,12 +189,12 @@
                                found = TRUE;
                                break;
                                }
-               if (!found) editor->hidden = TRUE;
+               if (!found) hidden = TRUE;
                g_strfreev(categories);
                }
        else
                {
-               editor->hidden = TRUE;
+               hidden = TRUE;
                }
 
        only_show_in = g_key_file_get_string_list(key_file, DESKTOP_GROUP, 
"OnlyShowIn", NULL, NULL);
@@ -214,7 +208,7 @@
                                found = TRUE;
                                break;
                                }
-               if (!found) editor->hidden = TRUE;
+               if (!found) hidden = TRUE;
                g_strfreev(only_show_in);
                }
 
@@ -229,27 +223,34 @@
                                found = TRUE;
                                break;
                                }
-               if (found) editor->hidden = TRUE;
+               if (found) 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) editor->hidden = TRUE;
+               if (!try_exec_res) hidden = TRUE;
                g_free(try_exec_res);
                g_free(try_exec);
                }
                
-       if (editor->hidden) 
+       if (hidden) 
                {
                /* hidden editors will be deleted, no need to parse the rest */
                g_key_file_free(key_file);
-               return TRUE;
+               return FALSE;
                }
+
+       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);
 
@@ -570,7 +571,7 @@
 {
        GString *string;
        gchar *pathl;
-       const gchar *p;
+       const gchar *p = NULL;
 
        string = g_string_new("");
 
@@ -620,7 +621,6 @@
                        p = "";
                }
 
-       g_assert(p);
        while (*p != '\0')
                {
                /* must escape \, ", `, and $ to avoid problems,


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Geeqie-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geeqie-svn

Reply via email to