[glib/wip/gdesktopappinfo: 19/20] Set appid correctly when constructing from index
- From: Ryan Lortie <desrt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/gdesktopappinfo: 19/20] Set appid correctly when constructing from index
- Date: Wed, 25 Sep 2013 20:38:25 +0000 (UTC)
commit 777544e5d9c83d23b9358f73ccb12f05b61a6067
Author: Ryan Lortie <desrt desrt ca>
Date: Thu Sep 19 14:47:58 2013 -0400
Set appid correctly when constructing from index
Set the desktop ID on GDesktopAppInfo instances created from the desktop
file index so that _get_id() doesn't return NULL.
Remove some debugging statements to stdout.
gio/gdesktopappinfo.c | 19 +++++++++----------
1 files changed, 9 insertions(+), 10 deletions(-)
---
diff --git a/gio/gdesktopappinfo.c b/gio/gdesktopappinfo.c
index 1a77a95..7d8feaf 100644
--- a/gio/gdesktopappinfo.c
+++ b/gio/gdesktopappinfo.c
@@ -92,7 +92,8 @@ static gboolean g_desktop_app_info_ensure_saved (GDesktopAppInfo *info,
static GDesktopAppInfo *
g_desktop_app_info_new_from_index (const struct dfi_index *dfi,
const struct dfi_pointer_array *array,
- guint app_num);
+ guint app_num,
+ const gchar *desktop_id);
/**
* GDesktopAppInfo:
@@ -627,11 +628,8 @@ desktop_file_dir_indexed_init (DesktopFileDir *dir)
{
gint result = dfi_string_list_binary_search (locale_names, dir->dfi, language_names[j][k]);
- g_print ("Looking for %s\n", language_names[j][k]);
-
if (result >= 0)
{
- g_print ("Found language %s is ID %d\n", language_names[j][k], result);
dir->locale_ids[i++] = result;
break;
}
@@ -688,10 +686,7 @@ desktop_file_dir_indexed_init (DesktopFileDir *dir)
cmp = strcmp (keyname, desktop_key_names[j]);
if (cmp == 0)
- {
- g_printerr ("mapped keyname %s(%d) to %d\n", keyname, i, j);
dir->key_id_map[i++] = j++;
- }
else if (cmp < 0)
i++;
else
@@ -712,7 +707,7 @@ desktop_file_dir_indexed_get_app (DesktopFileDir *dir,
app_num = GPOINTER_TO_UINT (value);
- return g_desktop_app_info_new_from_index (dir->dfi, dfi_index_get_desktop_files (dir->dfi), app_num);
+ return g_desktop_app_info_new_from_index (dir->dfi, dfi_index_get_desktop_files (dir->dfi), app_num,
desktop_id);
}
static void
@@ -735,7 +730,7 @@ desktop_file_dir_indexed_get_all (DesktopFileDir *dir,
continue;
add_to_table_if_appropriate (apps, app_name,
- g_desktop_app_info_new_from_index (dir->dfi, desktop_files, i));
+ g_desktop_app_info_new_from_index (dir->dfi, desktop_files, i, app_name));
}
}
@@ -1584,7 +1579,8 @@ g_desktop_app_info_dup (GAppInfo *appinfo)
static GDesktopAppInfo *
g_desktop_app_info_new_from_index (const struct dfi_index *dfi,
const struct dfi_pointer_array *array,
- guint app_num)
+ guint app_num,
+ const gchar *desktop_id)
{
const struct dfi_keyfile *keyfile;
GDesktopAppInfo *appinfo;
@@ -1635,6 +1631,9 @@ g_desktop_app_info_new_from_index (const struct dfi_index *dfi,
return NULL;
}
+ g_assert (!appinfo->desktop_id);
+ appinfo->desktop_id = g_strdup (desktop_id);
+
g_key_file_free (kf);
return appinfo;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]