Merge lp:~stolowski/libunity/progress-source-flat-array into lp:libunity

Proposed by Paweł Stołowski
Status: Merged
Approved by: Michal Hruby
Approved revision: 280
Merged at revision: 279
Proposed branch: lp:~stolowski/libunity/progress-source-flat-array
Merge into: lp:libunity
Diff against target: 100 lines (+17/-20)
5 files modified
configure.ac (+1/-1)
debian/changelog (+6/-0)
src/unity-aggregator-scope-private.vala (+4/-8)
src/unity-category.vala (+2/-3)
test/vala/test-scope.vala (+4/-8)
To merge this branch: bzr merge lp:~stolowski/libunity/progress-source-flat-array
Reviewer Review Type Date Requested Status
Michal Hruby (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+180869@code.launchpad.net

Commit message

Serialize progress-source property as an array of strings (each string is a dbus name and path separated with colon), instead of array of tuples.

Description of the change

Serialize progress-source property as an array of strings (each string is a dbus name and path separated with colon), instead of array of tuples.

This is the desired format (just a list of "foo:bar") in the QML bindings (agreed with Saviq), so while we could contcatenate them in the Unity plugin, it's actually easier to just serialize this way; plus, it's easier to extend it with other progress sources in the future (by introducing a schema prefix).

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 :

Tests still passing, looks fine.

review: Approve

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-08-14 15:06:11 +0000
3+++ configure.ac 2013-08-19 13:46:59 +0000
4@@ -1,5 +1,5 @@
5 # When releasing also remember to update the soname as instructed below
6-AC_INIT(libunity, 7.0.11)
7+AC_INIT(libunity, 7.0.12)
8
9 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
10 AM_CONFIG_HEADER(config.h)
11
12=== modified file 'debian/changelog'
13--- debian/changelog 2013-08-16 10:35:25 +0000
14+++ debian/changelog 2013-08-19 13:46:59 +0000
15@@ -1,3 +1,9 @@
16+libunity (7.0.12+13.10.20130816.2-0ubuntu2) UNRELEASED; urgency=low
17+
18+ * Serialize progress-source property as an array of strings instead of tuples.
19+
20+ -- Pawel Stolowski <pawel.stolowski@ubuntu.com> Mon, 19 Aug 2013 14:02:42 +0200
21+
22 libunity (7.0.11+13.10.20130816.2-0ubuntu1) saucy; urgency=low
23
24 [ Michal Hruby ]
25
26=== modified file 'src/unity-aggregator-scope-private.vala'
27--- src/unity-aggregator-scope-private.vala 2013-08-06 08:09:15 +0000
28+++ src/unity-aggregator-scope-private.vala 2013-08-19 13:46:59 +0000
29@@ -38,20 +38,16 @@
30 public abstract bool merge_metadata (string scope_id, Dee.Model categories, Dee.Model master_categories);
31
32 /*
33- Check if values array contains pstuple. This is needed because
34- vala's 'in' check doesn't work for array of variant tuples.
35+ Check if values array contains given progress-source string.
36 Note that this is not efficient for many progress source values, but in reality
37 we will be dealing with a single source at a time.
38 */
39- internal static bool contains_progress_source (Variant[] values, Variant pstuple)
40- requires (pstuple.n_children () == 2)
41+ internal static bool contains_progress_source (Variant[] values, Variant psvar)
42 {
43- unowned string ps1 = pstuple.get_child_value (0).get_string ();
44- unowned string ps2 = pstuple.get_child_value (1).get_string ();
45+ unowned string ps = psvar.get_string ();
46 foreach (var v in values)
47 {
48- if (v.get_child_value (0).get_string () == ps1 &&
49- v.get_child_value (1).get_string () == ps2)
50+ if (v.get_string () == ps)
51 return true;
52 }
53 return false;
54
55=== modified file 'src/unity-category.vala'
56--- src/unity-category.vala 2013-08-05 08:23:49 +0000
57+++ src/unity-category.vala 2013-08-19 13:46:59 +0000
58@@ -151,9 +151,8 @@
59
60 internal override void update_hints (HashTable<string, Variant> hints)
61 {
62- Variant[] ps = { new Variant.string (dbus_name), new Variant.string (dbus_path) };
63- Variant[] tp = { new Variant.tuple (ps) };
64- hints["progress-source"] = new Variant.array (null, tp);
65+ Variant[] ps = { new Variant.string (dbus_name + ":" + dbus_path) };
66+ hints["progress-source"] = new Variant.array (null, ps);
67 }
68 }
69
70
71=== modified file 'test/vala/test-scope.vala'
72--- test/vala/test-scope.vala 2013-08-15 15:54:43 +0000
73+++ test/vala/test-scope.vala 2013-08-19 13:46:59 +0000
74@@ -2194,11 +2194,9 @@
75
76 assert (cat_id == "1991");
77 assert (psarr != null);
78- assert (psarr.n_children () == 1); // progress-source array contains only one tuple
79+ assert (psarr.n_children () == 1); // progress-source array contains only one value
80 var ps = psarr.get_child_value (0);
81- assert (ps.n_children () == 2); // tuple has 2 values
82- assert (ps.get_child_value (0).get_string () == "b1");
83- assert (ps.get_child_value (1).get_string () == "b2");
84+ assert (ps.get_string () == "b1:b2");
85
86 iter = proxy.categories_model.next (iter);
87 cat_id = proxy.categories_model.get_string (iter, Unity.Internal.CategoryColumn.ID);
88@@ -2207,11 +2205,9 @@
89
90 assert (cat_id == "1211");
91 assert (psarr != null);
92- assert (psarr.n_children () == 1); // progress-source array contains only one tuple
93+ assert (psarr.n_children () == 1); // progress-source array contains only one value
94 ps = psarr.get_child_value (0);
95- assert (ps.n_children () == 2); // tuple has 2 values
96- assert (ps.get_child_value (0).get_string () == "a1");
97- assert (ps.get_child_value (1).get_string () == "a2");
98+ assert (ps.get_string () == "a1:a2");
99 }
100 }
101

Subscribers

People subscribed via source and target branches