changeset 1274:8fcdfacce91d

test TryExec, xdg_data_home added to the list of directories
author nadvornik
date Sun, 01 Feb 2009 22:35:40 +0000
parents 1ac2baeb8dc9
children fa0e7b8e785e
files src/editors.c
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/editors.c	Sun Feb 01 18:27:42 2009 +0000
+++ b/src/editors.c	Sun Feb 01 22:35:40 2009 +0000
@@ -151,6 +151,7 @@
 	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 @@
 		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 @@
 	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);