Merge lp:~kamstrup/unity-lens-applications/expand-avail-apps into lp:unity-lens-applications

Proposed by Mikkel Kamstrup Erlandsen on 2011-04-08
Status: Rejected
Rejected by: Mikkel Kamstrup Erlandsen on 2011-04-14
Proposed branch: lp:~kamstrup/unity-lens-applications/expand-avail-apps
Merge into: lp:unity-lens-applications
Diff against target: 115 lines (+49/-2)
3 files modified
applications.place.in.in (+1/-1)
src/daemon.vala (+47/-1)
src/schemas.vala (+1/-0)
To merge this branch: bzr merge lp:~kamstrup/unity-lens-applications/expand-avail-apps
Reviewer Review Type Date Requested Status
Unity Team 2011-04-08 Pending
Review via email: mp+56939@code.launchpad.net

Description of the change

See discussion in linked bug

To post a comment you must log in.

Unmerged revisions

206. By Mikkel Kamstrup Erlandsen on 2011-04-08

When displaying random apps available for download add a first hit "Show all" that clears the *Sample* Apps Available for Download group and Populates the Apps Available for Download group (now without the "Sample" prefix) with all apps from that category sorted alphabetically (according to locale rules)

205. By Mikkel Kamstrup Erlandsen on 2011-04-08

When showing random apps change the group header to "Sample Apps Available for Download"

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'applications.place.in.in'
2--- applications.place.in.in 2011-04-01 14:54:26 +0000
3+++ applications.place.in.in 2011-04-08 13:53:23 +0000
4@@ -18,7 +18,7 @@
5 ShowEntry=false
6
7 [Activation]
8-URIPattern=unity-(install|runner)://.+
9+URIPattern=unity-(install|runner|available-apps)://.+
10 MimetypePattern=application/x-unity-available-application
11 Priority=0
12
13
14=== modified file 'src/daemon.vala'
15--- src/daemon.vala 2011-04-07 09:37:36 +0000
16+++ src/daemon.vala 2011-04-08 13:53:23 +0000
17@@ -282,6 +282,9 @@
18 groups.append ("UnityDefaultRenderer",
19 _("Apps Available for Download"),
20 ICON_PATH + "group-available.svg");
21+ groups.append ("UnityDefaultRenderer",
22+ _("Sample Apps Available for Download"),
23+ ICON_PATH + "group-available.svg");
24 groups.append ("UnityEmptySearchRenderer",
25 "No search results", // No i18n, should never be rendered
26 "");
27@@ -483,11 +486,12 @@
28 else if (pkgsearcher != null)
29 {
30 timer.start ();
31+ add_show_all_apps_result (model, prepare_pkg_search_string (null, section));
32 string? category = (section == Section.ALL_APPLICATIONS ?
33 null : section_queries.get(section));
34 var random_pkgresults = pkgsearcher.get_random_apps (category, 12);
35 add_pkg_search_result (random_pkgresults, installed_uris, available_uris,
36- model, Group.AVAILABLE, 6);
37+ model, Group.AVAILABLE_SAMPLE, 5);
38 timer.stop ();
39 debug ("Entry search listed %i random Available apps in %fms",
40 random_pkgresults.num_hits, timer.elapsed ()*1000);
41@@ -578,6 +582,17 @@
42 search.finished ();
43 }
44
45+ private void add_show_all_apps_result (Dee.Model results_model,
46+ string query)
47+ {
48+ results_model.append (@"unity-available-apps://$query",
49+ Config.DATADIR + "/unity/themes/applications.png",
50+ Group.AVAILABLE_SAMPLE,
51+ "", // mime
52+ _("Show all"),
53+ _("Show All Apps Available for Download"));
54+ }
55+
56 private string prepare_pkg_search_string (PlaceSearch? search, Section section)
57 {
58 if (Utils.search_is_invalid (search))
59@@ -707,6 +722,7 @@
60 comment = app.get_description ();
61 break;
62 case Group.AVAILABLE:
63+ case Group.AVAILABLE_SAMPLE:
64 available_uris.add (uri);
65 display_name = pkginfo.application_name;
66 comment = "";
67@@ -789,6 +805,36 @@
68 }
69 this.runner.add_history (orig);
70 }
71+ else if (uri.has_prefix ("unity-available-apps://"))
72+ {
73+ /* Clear the group */
74+ Dee.Model results_model = applications.entry_renderer_info.results_model;
75+ unowned Dee.ModelIter dum, iter = results_model.get_first_iter ();
76+ unowned Dee.ModelIter end = results_model.get_last_iter ();
77+ while (iter != end)
78+ {
79+ if (results_model.get_uint32 (iter, ResultsColumn.GROUP_ID) == Group.AVAILABLE_SAMPLE)
80+ {
81+ dum = iter;
82+ iter = results_model.next (iter);
83+ results_model.remove (dum);
84+ }
85+ else
86+ {
87+ iter = results_model.next (iter);
88+ }
89+ }
90+
91+ /* Reload query results for the group */
92+ var query = uri.offset (23);
93+ var results = pkgsearcher.search (query, -1,
94+ Unity.Package.SearchType.EXACT,
95+ Unity.Package.Sort.BY_NAME);
96+ add_pkg_search_result (results,
97+ new HashSet<string>(), new HashSet<string>(),
98+ results_model, Group.AVAILABLE);
99+ return ActivationStatus.ACTIVATED_SHOW_DASH;
100+ }
101 else
102 {
103 debug ("Declined activation of URI '%s': Expected URI scheme unity-install:// or unity-runner://", uri);
104
105=== modified file 'src/schemas.vala'
106--- src/schemas.vala 2011-03-10 10:56:46 +0000
107+++ src/schemas.vala 2011-04-08 13:53:23 +0000
108@@ -65,6 +65,7 @@
109 MOST_USED,
110 INSTALLED,
111 AVAILABLE,
112+ AVAILABLE_SAMPLE,
113 EMPTY_SEARCH,
114 EMPTY_SECTION
115 }

Subscribers

People subscribed via source and target branches