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

Proposed by Mikkel Kamstrup Erlandsen
Status: Rejected
Rejected by: Mikkel Kamstrup Erlandsen
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 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

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

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
=== modified file 'applications.place.in.in'
--- applications.place.in.in 2011-04-01 14:54:26 +0000
+++ applications.place.in.in 2011-04-08 13:53:23 +0000
@@ -18,7 +18,7 @@
18ShowEntry=false18ShowEntry=false
1919
20[Activation]20[Activation]
21URIPattern=unity-(install|runner)://.+21URIPattern=unity-(install|runner|available-apps)://.+
22MimetypePattern=application/x-unity-available-application22MimetypePattern=application/x-unity-available-application
23Priority=023Priority=0
2424
2525
=== modified file 'src/daemon.vala'
--- src/daemon.vala 2011-04-07 09:37:36 +0000
+++ src/daemon.vala 2011-04-08 13:53:23 +0000
@@ -282,6 +282,9 @@
282 groups.append ("UnityDefaultRenderer",282 groups.append ("UnityDefaultRenderer",
283 _("Apps Available for Download"),283 _("Apps Available for Download"),
284 ICON_PATH + "group-available.svg");284 ICON_PATH + "group-available.svg");
285 groups.append ("UnityDefaultRenderer",
286 _("Sample Apps Available for Download"),
287 ICON_PATH + "group-available.svg");
285 groups.append ("UnityEmptySearchRenderer",288 groups.append ("UnityEmptySearchRenderer",
286 "No search results", // No i18n, should never be rendered289 "No search results", // No i18n, should never be rendered
287 "");290 "");
@@ -483,11 +486,12 @@
483 else if (pkgsearcher != null)486 else if (pkgsearcher != null)
484 {487 {
485 timer.start ();488 timer.start ();
489 add_show_all_apps_result (model, prepare_pkg_search_string (null, section));
486 string? category = (section == Section.ALL_APPLICATIONS ?490 string? category = (section == Section.ALL_APPLICATIONS ?
487 null : section_queries.get(section));491 null : section_queries.get(section));
488 var random_pkgresults = pkgsearcher.get_random_apps (category, 12);492 var random_pkgresults = pkgsearcher.get_random_apps (category, 12);
489 add_pkg_search_result (random_pkgresults, installed_uris, available_uris,493 add_pkg_search_result (random_pkgresults, installed_uris, available_uris,
490 model, Group.AVAILABLE, 6);494 model, Group.AVAILABLE_SAMPLE, 5);
491 timer.stop ();495 timer.stop ();
492 debug ("Entry search listed %i random Available apps in %fms",496 debug ("Entry search listed %i random Available apps in %fms",
493 random_pkgresults.num_hits, timer.elapsed ()*1000);497 random_pkgresults.num_hits, timer.elapsed ()*1000);
@@ -578,6 +582,17 @@
578 search.finished ();582 search.finished ();
579 }583 }
580 584
585 private void add_show_all_apps_result (Dee.Model results_model,
586 string query)
587 {
588 results_model.append (@"unity-available-apps://$query",
589 Config.DATADIR + "/unity/themes/applications.png",
590 Group.AVAILABLE_SAMPLE,
591 "", // mime
592 _("Show all"),
593 _("Show All Apps Available for Download"));
594 }
595
581 private string prepare_pkg_search_string (PlaceSearch? search, Section section)596 private string prepare_pkg_search_string (PlaceSearch? search, Section section)
582 { 597 {
583 if (Utils.search_is_invalid (search))598 if (Utils.search_is_invalid (search))
@@ -707,6 +722,7 @@
707 comment = app.get_description ();722 comment = app.get_description ();
708 break;723 break;
709 case Group.AVAILABLE:724 case Group.AVAILABLE:
725 case Group.AVAILABLE_SAMPLE:
710 available_uris.add (uri);726 available_uris.add (uri);
711 display_name = pkginfo.application_name;727 display_name = pkginfo.application_name;
712 comment = "";728 comment = "";
@@ -789,6 +805,36 @@
789 }805 }
790 this.runner.add_history (orig);806 this.runner.add_history (orig);
791 }807 }
808 else if (uri.has_prefix ("unity-available-apps://"))
809 {
810 /* Clear the group */
811 Dee.Model results_model = applications.entry_renderer_info.results_model;
812 unowned Dee.ModelIter dum, iter = results_model.get_first_iter ();
813 unowned Dee.ModelIter end = results_model.get_last_iter ();
814 while (iter != end)
815 {
816 if (results_model.get_uint32 (iter, ResultsColumn.GROUP_ID) == Group.AVAILABLE_SAMPLE)
817 {
818 dum = iter;
819 iter = results_model.next (iter);
820 results_model.remove (dum);
821 }
822 else
823 {
824 iter = results_model.next (iter);
825 }
826 }
827
828 /* Reload query results for the group */
829 var query = uri.offset (23);
830 var results = pkgsearcher.search (query, -1,
831 Unity.Package.SearchType.EXACT,
832 Unity.Package.Sort.BY_NAME);
833 add_pkg_search_result (results,
834 new HashSet<string>(), new HashSet<string>(),
835 results_model, Group.AVAILABLE);
836 return ActivationStatus.ACTIVATED_SHOW_DASH;
837 }
792 else838 else
793 {839 {
794 debug ("Declined activation of URI '%s': Expected URI scheme unity-install:// or unity-runner://", uri);840 debug ("Declined activation of URI '%s': Expected URI scheme unity-install:// or unity-runner://", uri);
795841
=== modified file 'src/schemas.vala'
--- src/schemas.vala 2011-03-10 10:56:46 +0000
+++ src/schemas.vala 2011-04-08 13:53:23 +0000
@@ -65,6 +65,7 @@
65 MOST_USED,65 MOST_USED,
66 INSTALLED,66 INSTALLED,
67 AVAILABLE,67 AVAILABLE,
68 AVAILABLE_SAMPLE,
68 EMPTY_SEARCH,69 EMPTY_SEARCH,
69 EMPTY_SECTION70 EMPTY_SECTION
70 }71 }

Subscribers

People subscribed via source and target branches