test TryExec,
authorVladimir Nadvornik <nadvornik@suse.cz>
Sun, 1 Feb 2009 22:35:40 +0000 (22:35 +0000)
committerVladimir Nadvornik <nadvornik@suse.cz>
Sun, 1 Feb 2009 22:35:40 +0000 (22:35 +0000)
xdg_data_home added to the list of directories

src/editors.c

index c749192..f02d5d5 100644 (file)
@@ -151,6 +151,7 @@ static gboolean editor_read_desktop_file(const gchar *path)
        gchar *extensions;
        const gchar *key = filename_from_path(path);
        gchar **categories, **only_show_in, **not_show_in;
+       gchar *try_exec;
 
        if (g_hash_table_lookup(editors, key)) return FALSE; /* the file found earlier wins */
        
@@ -221,6 +222,16 @@ static gboolean editor_read_desktop_file(const gchar *path)
                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;
+               g_free(try_exec_res);
+               g_free(try_exec);
+               }
+               
        if (editor->hidden) 
                {
                /* hidden editors will be deleted, no need to parse the rest */
@@ -326,7 +337,7 @@ void editor_load_descriptions(void)
        else
                xdg_data_dirs = g_strdup("/usr/share");
        
-       all_dirs = g_strconcat(get_rc_dir(), ":", GQ_APP_DIR, ":", xdg_data_dirs, NULL);
+       all_dirs = g_strconcat(get_rc_dir(), ":", GQ_APP_DIR, ":", xdg_data_home_get(), ":", xdg_data_dirs, NULL);
        
        g_free(xdg_data_dirs);