Merge lp:~stolowski/unity-lens-video/preview-on-lmb into lp:~unity-team/unity-lens-video/libunity7-compatible

Proposed by Paweł Stołowski on 2013-04-23
Status: Merged
Approved by: Martin Mrazik on 2013-04-24
Approved revision: 129
Merged at revision: 126
Proposed branch: lp:~stolowski/unity-lens-video/preview-on-lmb
Merge into: lp:~unity-team/unity-lens-video/libunity7-compatible
Diff against target: 99 lines (+23/-9)
3 files modified
configure.ac (+2/-2)
debian/control (+1/-1)
src/remote-scope.vala (+20/-6)
To merge this branch: bzr merge lp:~stolowski/unity-lens-video/preview-on-lmb
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve on 2013-04-24
Michal Hruby (community) 2013-04-23 Needs Fixing on 2013-04-24
Review via email: mp+160348@code.launchpad.net

Commit message

Open preview on left-click for More Suggestions.

Description of the change

Open preview on left-click for More Suggestions.

To post a comment you must log in.
Michal Hruby (mhr3) wrote :

14 + if (rawuri.has_prefix ("https://videosearch.ubuntu.com"))
15 + return new Unity.ActivationResponse (Unity.HandledType.SHOW_PREVIEW);

This won't work, both "Online" and "More suggestions" results use this prefix.

review: Needs Fixing
125. By Paweł Stołowski on 2013-04-23

Use activate_result handler added to libunity API to handle preview-on-activation based on category index.

126. By Paweł Stołowski on 2013-04-24

Put real category into metadata.

127. By Paweł Stołowski on 2013-04-24

Merged libunity-7 branch.

128. By Paweł Stołowski on 2013-04-24

Just store a bool in metadata to indiciate preview on LMB for more suggestions. Set schema.

Michal Hruby (mhr3) wrote :

Looks good, but please bump the debian/control file as well.

review: Needs Fixing
129. By Paweł Stołowski on 2013-04-24

Bumped required libunity version in debian control.

Martin Mrazik (mrazik) wrote :

Jenkins error. Reapproving.

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'configure.ac'
2--- configure.ac 2013-04-23 08:07:54 +0000
3+++ configure.ac 2013-04-24 11:33:26 +0000
4@@ -76,8 +76,8 @@
5 libsoup-gnome-2.4
6 json-glib-1.0
7 zeitgeist-1.0 >= 0.3.8
8- unity >= 6.90.2
9- unity-extras >= 6.90.2
10+ unity >= 6.91.11
11+ unity-extras >= 6.91.11
12 )
13
14 AC_SUBST(SCOPE_DAEMON_CFLAGS)
15
16=== modified file 'debian/control'
17--- debian/control 2013-03-15 13:16:17 +0000
18+++ debian/control 2013-04-24 11:33:26 +0000
19@@ -11,7 +11,7 @@
20 libglib2.0-dev (>= 2.27),
21 libjson-glib-dev,
22 libsoup-gnome2.4-dev,
23- libunity-dev (>= 6.91),
24+ libunity-dev (>= 6.91.11),
25 libzeitgeist-dev (>= 0.3.8),
26 valac-0.18,
27 xvfb,
28
29=== modified file 'src/remote-scope.vala'
30--- src/remote-scope.vala 2013-04-11 15:31:07 +0000
31+++ src/remote-scope.vala 2013-04-24 11:33:26 +0000
32@@ -27,6 +27,7 @@
33 private static int REFRESH_INTERVAL = 3600; // fetch sources & recommendations once an hour
34 private static int RETRY_INTERVAL = 60; // retry sources/recommendations after a minute
35
36+ private static string PREVIEW_ON_LMB = "lmb-preview";
37 private Soup.Session session;
38 private PreferencesManager preferences = PreferencesManager.get_default ();
39 Gee.ArrayList<RemoteVideoFile?> recommendations;
40@@ -34,8 +35,6 @@
41 Zeitgeist.DataSourceRegistry zg_sources;
42 bool use_zeitgeist;
43
44- private Variant empty_asv;
45-
46 public RemoteVideoScope ()
47 {
48 Object (dbus_path: "/net/launchpad/scope/remotevideos", id: "video-remote.scope");
49@@ -45,7 +44,7 @@
50 {
51 base.constructed ();
52
53- empty_asv = new Variant.array (VariantType.VARDICT.element (), {});
54+ schema.add_field (PREVIEW_ON_LMB, "b", Unity.Schema.FieldType.OPTIONAL);
55
56 recommendations = new Gee.ArrayList<RemoteVideoFile?> ();
57
58@@ -82,8 +81,6 @@
59 queue_search_changed (SearchType.DEFAULT);
60 });
61
62- activate_uri.connect (on_activate_uri);
63-
64 populate_categories ();
65 query_list_of_sources ();
66
67@@ -181,6 +178,19 @@
68 });
69 }
70
71+ public override async Unity.ActivationResponse? activate_result (ScopeResult result)
72+ {
73+ var realcat = result.metadata.lookup (PREVIEW_ON_LMB);
74+ // activation of More Suggestions should display a preview.
75+ if (realcat != null && realcat.get_boolean ())
76+ {
77+ var preview = yield preview_result (result);
78+ return new Unity.ActivationResponse.with_preview (preview);
79+ }
80+
81+ return on_activate_uri (result.uri);
82+ }
83+
84 private Unity.ActivationResponse on_activate_uri (string rawuri)
85 {
86 var fakeuri = RemoteUri.from_rawuri (rawuri);
87@@ -475,7 +485,11 @@
88 result_icon = anno_icon.to_string ();
89 }
90
91- model.append (fake_uri.to_rawuri (), result_icon, video.category, ResultType.DEFAULT, "text/html", video.title, video.comment, video.uri, empty_asv);
92+ // aggregator scope remaps categories, so we won't get real category back;
93+ // put real category into metadata
94+ var realcat = new Variant.dict_entry (PREVIEW_ON_LMB, new Variant.variant (video.category == CAT_INDEX_MORE));
95+ var metadata = new Variant.array (VariantType.VARDICT.element (), {realcat});
96+ model.append (fake_uri.to_rawuri (), result_icon, video.category, ResultType.DEFAULT, "text/html", video.title, video.comment, video.uri, metadata);
97 }
98 }
99 }

Subscribers

People subscribed via source and target branches