[gnome-menus] [libmenu] Add API to access GenericName
- From: Vincent Untz <vuntz src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-menus] [libmenu] Add API to access GenericName
- Date: Sat, 20 Jun 2009 19:29:46 -0400 (EDT)
commit dca731f53b3686436cc94cf2704035419c03b7e8
Author: Robert Staudinger <robsta gnome org>
Date: Thu May 7 17:28:08 2009 +0200
[libmenu] Add API to access GenericName
http://bugzilla.gnome.org/show_bug.cgi?id=581887
libmenu/desktop-entries.c | 48 ++++++++++++++++++++++++++++++---------------
libmenu/desktop-entries.h | 1 +
libmenu/gmenu-tree.c | 8 +++++++
libmenu/gmenu-tree.h | 1 +
4 files changed, 42 insertions(+), 16 deletions(-)
---
diff --git a/libmenu/desktop-entries.c b/libmenu/desktop-entries.c
index 59b926a..79bd555 100644
--- a/libmenu/desktop-entries.c
+++ b/libmenu/desktop-entries.c
@@ -44,6 +44,7 @@ struct DesktopEntry
GQuark *categories;
char *name;
+ char *generic_name;
char *comment;
char *icon;
char *exec;
@@ -283,11 +284,12 @@ desktop_entry_load (DesktopEntry *entry)
#define GET_LOCALE_STRING(n) g_key_file_get_locale_string (key_file, desktop_entry_group, (n), NULL, NULL)
- retval->name = GET_LOCALE_STRING ("Name");
- retval->comment = GET_LOCALE_STRING ("Comment");
- retval->icon = GET_LOCALE_STRING ("Icon");
- retval->flags = get_flags_from_key_file (retval, key_file, desktop_entry_group);
- retval->categories = get_categories_from_key_file (retval, key_file, desktop_entry_group);
+ retval->name = GET_LOCALE_STRING ("Name");
+ retval->generic_name = GET_LOCALE_STRING ("GenericName");
+ retval->comment = GET_LOCALE_STRING ("Comment");
+ retval->icon = GET_LOCALE_STRING ("Icon");
+ retval->flags = get_flags_from_key_file (retval, key_file, desktop_entry_group);
+ retval->categories = get_categories_from_key_file (retval, key_file, desktop_entry_group);
if (entry->type == DESKTOP_ENTRY_DESKTOP)
{
@@ -297,9 +299,10 @@ desktop_entry_load (DesktopEntry *entry)
#undef GET_LOCALE_STRING
- menu_verbose ("Desktop entry \"%s\" (%s, %s, %s) flags: NoDisplay=%s, Hidden=%s, ShowInGNOME=%s, TryExecFailed=%s\n",
+ menu_verbose ("Desktop entry \"%s\" (%s, %s, %s, %s) flags: NoDisplay=%s, Hidden=%s, ShowInGNOME=%s, TryExecFailed=%s\n",
retval->basename,
retval->name,
+ retval->generic_name ? retval->generic_name : "(null)",
retval->comment ? retval->comment : "(null)",
retval->icon ? retval->icon : "(null)",
retval->flags & DESKTOP_ENTRY_NO_DISPLAY ? "(true)" : "(false)",
@@ -362,6 +365,9 @@ desktop_entry_reload (DesktopEntry *entry)
g_free (entry->name);
entry->name = NULL;
+ g_free (entry->generic_name);
+ entry->generic_name = NULL;
+
g_free (entry->comment);
entry->comment = NULL;
@@ -399,16 +405,17 @@ desktop_entry_copy (DesktopEntry *entry)
retval = g_new0 (DesktopEntry, 1);
- retval->refcount = 1;
- retval->type = entry->type;
- retval->basename = g_strdup (entry->basename);
- retval->path = g_strdup (entry->path);
- retval->name = g_strdup (entry->name);
- retval->comment = g_strdup (entry->comment);
- retval->icon = g_strdup (entry->icon);
- retval->exec = g_strdup (entry->exec);
- retval->terminal = entry->terminal;
- retval->flags = entry->flags;
+ retval->refcount = 1;
+ retval->type = entry->type;
+ retval->basename = g_strdup (entry->basename);
+ retval->path = g_strdup (entry->path);
+ retval->name = g_strdup (entry->name);
+ retval->generic_name = g_strdup (entry->generic_name);
+ retval->comment = g_strdup (entry->comment);
+ retval->icon = g_strdup (entry->icon);
+ retval->exec = g_strdup (entry->exec);
+ retval->terminal = entry->terminal;
+ retval->flags = entry->flags;
i = 0;
if (entry->categories != NULL)
@@ -443,6 +450,9 @@ desktop_entry_unref (DesktopEntry *entry)
g_free (entry->name);
entry->name = NULL;
+ g_free (entry->generic_name);
+ entry->generic_name = NULL;
+
g_free (entry->comment);
entry->comment = NULL;
@@ -487,6 +497,12 @@ desktop_entry_get_name (DesktopEntry *entry)
}
const char *
+desktop_entry_get_generic_name (DesktopEntry *entry)
+{
+ return entry->generic_name;
+}
+
+const char *
desktop_entry_get_comment (DesktopEntry *entry)
{
return entry->comment;
diff --git a/libmenu/desktop-entries.h b/libmenu/desktop-entries.h
index e9507e6..700f283 100644
--- a/libmenu/desktop-entries.h
+++ b/libmenu/desktop-entries.h
@@ -45,6 +45,7 @@ const char *desktop_entry_get_path (DesktopEntry *entry);
const char *desktop_entry_get_basename (DesktopEntry *entry);
const char *desktop_entry_get_name (DesktopEntry *entry);
+const char *desktop_entry_get_generic_name (DesktopEntry *entry);
const char *desktop_entry_get_comment (DesktopEntry *entry);
const char *desktop_entry_get_icon (DesktopEntry *entry);
const char *desktop_entry_get_exec (DesktopEntry *entry);
diff --git a/libmenu/gmenu-tree.c b/libmenu/gmenu-tree.c
index fd8318e..ec4f611 100644
--- a/libmenu/gmenu-tree.c
+++ b/libmenu/gmenu-tree.c
@@ -1125,6 +1125,14 @@ gmenu_tree_entry_get_name (GMenuTreeEntry *entry)
}
const char *
+gmenu_tree_entry_get_generic_name (GMenuTreeEntry *entry)
+{
+ g_return_val_if_fail (entry != NULL, NULL);
+
+ return desktop_entry_get_generic_name (entry->desktop_entry);
+}
+
+const char *
gmenu_tree_entry_get_comment (GMenuTreeEntry *entry)
{
g_return_val_if_fail (entry != NULL, NULL);
diff --git a/libmenu/gmenu-tree.h b/libmenu/gmenu-tree.h
index f4a75ea..ae98ef1 100644
--- a/libmenu/gmenu-tree.h
+++ b/libmenu/gmenu-tree.h
@@ -111,6 +111,7 @@ char *gmenu_tree_directory_make_path (GMenuTreeDirectory *directory,
const char *gmenu_tree_entry_get_name (GMenuTreeEntry *entry);
+const char *gmenu_tree_entry_get_generic_name (GMenuTreeEntry *entry);
const char *gmenu_tree_entry_get_comment (GMenuTreeEntry *entry);
const char *gmenu_tree_entry_get_icon (GMenuTreeEntry *entry);
const char *gmenu_tree_entry_get_exec (GMenuTreeEntry *entry);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]