changeset 1278:c5852c543775

Add support for NoDisplay (entry is then hidden) and Type (only Application type is valid here) keys.
author zas_
date Tue, 03 Feb 2009 13:52:20 +0000
parents 93df70312ccd
children 6248faa9e829
files src/editors.c
diffstat 1 files changed, 14 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/editors.c	Tue Feb 03 13:50:10 2009 +0000
+++ b/src/editors.c	Tue Feb 03 13:52:20 2009 +0000
@@ -81,11 +81,11 @@
 	
 	g_free(editor->key);
 	g_free(editor->name);
+	g_free(editor->icon);
 	g_free(editor->exec);
 	g_free(editor->menu_path);
 	g_free(editor->hotkey);
 	string_list_free(editor->ext_list);
-	g_free(editor->icon);
 	g_free(editor->file);
 	g_free(editor);
 }
@@ -149,6 +149,7 @@
 	GKeyFile *key_file;
 	EditorDescription *editor;
 	gchar *extensions;
+	gchar *type;
 	const gchar *key = filename_from_path(path);
 	gchar **categories, **only_show_in, **not_show_in;
 	gchar *try_exec;
@@ -161,6 +162,13 @@
 		g_key_file_free(key_file);
 		return FALSE;
 		}
+
+	type = g_key_file_get_string(key_file, DESKTOP_GROUP, "Type", NULL);
+	if (!type || strcmp(type, "Application") != 0)
+		{
+		/* We only consider desktop entries of Application type */
+		return FALSE;
+		}
 	
 	editor = g_new0(EditorDescription, 1);
 	
@@ -169,7 +177,11 @@
 
 	g_hash_table_insert(editors, editor->key, editor);
 
-	if (g_key_file_get_boolean(key_file, DESKTOP_GROUP, "Hidden", NULL)) editor->hidden = TRUE;
+	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;
+		}
 
 	categories = g_key_file_get_string_list(key_file, DESKTOP_GROUP, "Categories", NULL, NULL);
 	if (categories)