Merge lp:~jamesh/libunity/metadata-form-factor into lp:libunity

Proposed by James Henstridge
Status: Merged
Approved by: Michal Hruby
Approved revision: 262
Merged at revision: 261
Proposed branch: lp:~jamesh/libunity/metadata-form-factor
Merge into: lp:libunity
Diff against target: 73 lines (+34/-0)
3 files modified
debian/libunity9.symbols (+1/-0)
src/unity-scope-interface.vala (+11/-0)
test/vala/test-scope.vala (+22/-0)
To merge this branch: bzr merge lp:~jamesh/libunity/metadata-form-factor
Reviewer Review Type Date Requested Status
Michal Hruby (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+175721@code.launchpad.net

Commit message

Expose the "form-factor" search hint through the Unity.SearchMetadata class.

Description of the change

Expose the "form-factor" search hint through the Unity.SearchMetadata class. This is required for scopes using the AbstractScope API to check this hint (since they don't get direct access to the hints dictionary like DeprecatedScope does).

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michal Hruby (mhr3) wrote :

Looks good. +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/libunity9.symbols'
2--- debian/libunity9.symbols 2013-07-04 20:21:07 +0000
3+++ debian/libunity9.symbols 2013-07-19 03:22:25 +0000
4@@ -602,6 +602,7 @@
5 unity_search_context_get_type@Base 7.0.0daily13.05.31ubuntu.unity.next
6 unity_search_metadata_construct@Base 7.0.0daily13.05.31ubuntu.unity.next
7 unity_search_metadata_create@Base 7.0.0daily13.05.31ubuntu.unity.next
8+ unity_search_metadata_get_form_factor@Base 0replaceme
9 unity_search_metadata_get_locale@Base 7.0.0daily13.05.31ubuntu.unity.next
10 unity_search_metadata_get_type@Base 7.0.0daily13.05.31ubuntu.unity.next
11 unity_search_metadata_new@Base 7.0.0daily13.05.31ubuntu.unity.next
12
13=== modified file 'src/unity-scope-interface.vala'
14--- src/unity-scope-interface.vala 2013-07-03 23:14:43 +0000
15+++ src/unity-scope-interface.vala 2013-07-19 03:22:25 +0000
16@@ -328,6 +328,17 @@
17 }
18 }
19
20+ public string? form_factor
21+ {
22+ get
23+ {
24+ if (all_metadata == null) return null;
25+ Variant form_factor_v = all_metadata["form-factor"];
26+ if (form_factor_v == null) return null;
27+ return form_factor_v.get_string ();
28+ }
29+ }
30+
31 public static SearchMetadata create (HashTable<string, Variant>? metadata)
32 {
33 var m = new SearchMetadata ();
34
35=== modified file 'test/vala/test-scope.vala'
36--- test/vala/test-scope.vala 2013-07-17 15:32:25 +0000
37+++ test/vala/test-scope.vala 2013-07-19 03:22:25 +0000
38@@ -71,6 +71,9 @@
39 Fixture.create<ScopeTester> (ScopeTester.test_scope_preview_action));
40 Test.add_data_func ("/Unit/Scope/Filters",
41 Fixture.create<ScopeTester> (ScopeTester.test_scope_filters));
42+ Test.add_data_func ("/Unit/Scope/FormFactor",
43+ Fixture.create<ScopeTester> (ScopeTester.test_scope_form_factor));
44+
45
46 Test.add_data_func ("/Unit/SimpleScope/Search",
47 Fixture.create<SimpleScopeTester> (SimpleScopeTester.test_simple_search));
48@@ -890,6 +893,25 @@
49 assert (reply_dict != null);
50 assert (got_search_signal);
51 }
52+
53+ public void test_scope_form_factor ()
54+ {
55+ // we need channel first
56+ var channel_id = open_channel (proxy, ChannelType.DEFAULT, null);
57+ assert (channel_id != null);
58+
59+ string form_factor = null;
60+
61+ // form_factor is taken from the hints dictionary
62+ var hints = new HashTable<string, Variant?> (str_hash, str_equal);
63+ hints["form-factor"] = new Variant.string ("phone");
64+ ScopeTester.perform_search (proxy, channel_id, "", hints,
65+ null, scope, (search) =>
66+ {
67+ form_factor = search.search_metadata.form_factor;
68+ });
69+ assert (form_factor == "phone");
70+ }
71 }
72
73 class SimpleScopeTester: Object, Fixture

Subscribers

People subscribed via source and target branches