Merge lp:~therigu/unity-lens-applications/menu-entries-without-categories into lp:unity-lens-applications

Proposed by Adam Guthrie
Status: Rejected
Rejected by: Mikkel Kamstrup Erlandsen
Proposed branch: lp:~therigu/unity-lens-applications/menu-entries-without-categories
Merge into: lp:unity-lens-applications
Diff against target: 79 lines (+33/-20)
1 file modified
src/unity-package-search.cc (+33/-20)
To merge this branch: bzr merge lp:~therigu/unity-lens-applications/menu-entries-without-categories
Reviewer Review Type Date Requested Status
Mikkel Kamstrup Erlandsen (community) Disapprove
Review via email: mp+35922@code.launchpad.net

Description of the change

Allow gmenu entries without categories in their respective .desktop files to be indexed whilst still protecting against the case where unity cannot retrieve information from said .desktop file. LP: #635223

To post a comment you must log in.
Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

Considering the conclusions on the linked bug - i'll re-review this once we are out of Maverick release frenzy.

Sorry to keep you waiting. I assure you that your work is much appreciated!

Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

Finally some updates! :-)

I need to disapprove this branch as the underlying codebase for the apps place has shifted somewhat since this branch' inception. The good news is that I have applied the same approach in another branch, and together with the a patch to Unity have Wine apps working here now :-)

So thanks for pioneering this Adam!

review: Disapprove

Unmerged revisions

100. By Adam Guthrie

Allow gmenu entries without categories in their respective .desktop files to indexed whilst still protecting against the case where unity cannot retrieve information from said .desktop file.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/unity-package-search.cc'
2--- src/unity-package-search.cc 2010-09-14 11:30:09 +0000
3+++ src/unity-package-search.cc 2010-09-18 13:41:47 +0000
4@@ -92,6 +92,7 @@
5 GMenuTreeEntry *entry;
6 UnityAppInfoManager *appman;
7 GeeList *cats;
8+ GAppInfo *appinfo;
9 GeeIterator *cats_iter;
10 gchar *dum1, *dum2, *dum3;
11
12@@ -138,35 +139,47 @@
13
14 /* Index the XDG categories */
15 appman = unity_app_info_manager_get_instance ();
16- cats = unity_app_info_manager_get_categories (appman,
17+ appinfo = unity_app_info_manager_lookup (appman,
18 gmenu_tree_entry_get_desktop_file_id (entry));
19
20 /* For unknown desktop ids the app info manager returns NULL.
21 * Also happens for many NoDisplay app infos, so it's not an error
22 * case as such */
23- if (cats == NULL)
24+ if (appinfo == NULL)
25 {
26- //g_debug ("Unable to probe XDG categories for %s",
27- // gmenu_tree_entry_get_desktop_file_id (entry));
28+ g_debug ("Unable to probe info for %s",
29+ gmenu_tree_entry_get_desktop_file_id (entry));
30 g_object_unref (appman);
31 break;
32 }
33-
34- cats_iter = GEE_ITERATOR (gee_list_list_iterator (cats));
35- while (gee_iterator_next (cats_iter))
36- {
37- // FIXME: Free dum1?
38- dum1 = (gchar*) gee_iterator_get (cats_iter);
39- dum2 = g_ascii_strdown (dum1, -1);
40- dum3 = g_strconcat ("AC", dum2, NULL);
41- doc.add_term (dum3);
42- g_free (dum1);
43- g_free (dum2);
44- g_free (dum3);
45- }
46- g_object_unref (cats_iter);
47- g_object_unref (cats);
48- g_object_unref (appman);
49+
50+ cats = unity_app_info_manager_get_categories (appman,
51+ gmenu_tree_entry_get_desktop_file_id (entry));
52+
53+ if (cats == NULL)
54+ {
55+ //g_debug ("Unable to probe XDG categories for %s",
56+ // gmenu_tree_entry_get_desktop_file_id (entry));
57+ g_object_unref (appman);
58+ }
59+ else
60+ {
61+ cats_iter = GEE_ITERATOR (gee_list_list_iterator (cats));
62+ while (gee_iterator_next (cats_iter))
63+ {
64+ // FIXME: Free dum1?
65+ dum1 = (gchar*) gee_iterator_get (cats_iter);
66+ dum2 = g_ascii_strdown (dum1, -1);
67+ dum3 = g_strconcat ("AC", dum2, NULL);
68+ doc.add_term (dum3);
69+ g_free (dum1);
70+ g_free (dum2);
71+ g_free (dum3);
72+ }
73+ g_object_unref (cats_iter);
74+ g_object_unref (cats);
75+ g_object_unref (appman);
76+ }
77
78 /* Always assume Type=Application for items in a menu... */
79 doc.add_term ("ATapplication");

Subscribers

People subscribed via source and target branches