}
/**
+ * g_app_info_get_display_name:
+ * @appinfo: a #GAppInfo.
+ *
+ * Gets the display name of the application. The display name is often more
+ * descriptive to the user than the name itself.
+ *
+ * Returns: the display name of the application for @appinfo, or the name if
+ * no display name is available.
+ *
+ * Since: 2.24
+ **/
+const char *
+g_app_info_get_display_name (GAppInfo *appinfo)
+{
+ GAppInfoIface *iface;
+
+ g_return_val_if_fail (G_IS_APP_INFO (appinfo), NULL);
+
+ iface = G_APP_INFO_GET_IFACE (appinfo);
+
+ if (iface->get_display_name == NULL)
+ return (* iface->get_name) (appinfo);
+
+ return (* iface->get_display_name) (appinfo);
+}
+
+/**
* g_app_info_get_description:
* @appinfo: a #GAppInfo.
*
gboolean (* can_delete) (GAppInfo *appinfo);
gboolean (* do_delete) (GAppInfo *appinfo);
const char * (* get_commandline) (GAppInfo *appinfo);
+ const char * (* get_display_name) (GAppInfo *appinfo);
};
GType g_app_info_get_type (void) G_GNUC_CONST;
GAppInfo *appinfo2);
const char *g_app_info_get_id (GAppInfo *appinfo);
const char *g_app_info_get_name (GAppInfo *appinfo);
+const char *g_app_info_get_display_name (GAppInfo *appinfo);
const char *g_app_info_get_description (GAppInfo *appinfo);
const char *g_app_info_get_executable (GAppInfo *appinfo);
const char *g_app_info_get_commandline (GAppInfo *appinfo);
#define ADDED_ASSOCIATIONS_GROUP "Added Associations"
#define REMOVED_ASSOCIATIONS_GROUP "Removed Associations"
#define MIME_CACHE_GROUP "MIME Cache"
+#define FULL_NAME_KEY "X-GNOME-FullName"
static void g_desktop_app_info_iface_init (GAppInfoIface *iface);
static GList * get_all_desktop_entries_for_mime_type (const char *base_mime_type,
char *name;
/* FIXME: what about GenericName ? */
+ char *fullname;
char *comment;
char *icon_name;
GIcon *icon;
g_free (info->desktop_id);
g_free (info->filename);
g_free (info->name);
+ g_free (info->fullname);
g_free (info->comment);
g_free (info->icon_name);
if (info->icon)
info->filename = NULL;
info->name = g_key_file_get_locale_string (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_NAME, NULL, NULL);
+ info->fullname = g_key_file_get_locale_string (key_file, G_KEY_FILE_DESKTOP_GROUP, FULL_NAME_KEY, NULL, NULL);
info->comment = g_key_file_get_locale_string (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_COMMENT, NULL, NULL);
info->nodisplay = g_key_file_get_boolean (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY, NULL) != FALSE;
info->icon_name = g_key_file_get_locale_string (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_ICON, NULL, NULL);
new_info->desktop_id = g_strdup (info->desktop_id);
new_info->name = g_strdup (info->name);
+ new_info->fullname = g_strdup (info->fullname);
new_info->comment = g_strdup (info->comment);
new_info->nodisplay = info->nodisplay;
new_info->icon_name = g_strdup (info->icon_name);
return info->name;
}
+static const char *
+g_desktop_app_info_get_display_name (GAppInfo *appinfo)
+{
+ GDesktopAppInfo *info = G_DESKTOP_APP_INFO (appinfo);
+
+ if (info->fullname == NULL)
+ return g_desktop_app_info_get_name (appinfo);
+ return info->fullname;
+}
+
/**
* g_desktop_app_info_get_is_hidden:
* @info: a #GDesktopAppInfo.
g_key_file_set_string (key_file, G_KEY_FILE_DESKTOP_GROUP,
G_KEY_FILE_DESKTOP_KEY_NAME, info->name);
+ if (info->fullname != NULL)
+ g_key_file_set_string (key_file, G_KEY_FILE_DESKTOP_GROUP,
+ FULL_NAME_KEY, info->fullname);
+
g_key_file_set_string (key_file, G_KEY_FILE_DESKTOP_GROUP,
G_KEY_FILE_DESKTOP_KEY_COMMENT, info->comment);
iface->can_delete = g_desktop_app_info_can_delete;
iface->do_delete = g_desktop_app_info_delete;
iface->get_commandline = g_desktop_app_info_get_commandline;
+ iface->get_display_name = g_desktop_app_info_get_display_name;
}
static gboolean