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
=== modified file 'configure.ac'
--- configure.ac 2013-08-14 15:06:11 +0000
+++ configure.ac 2013-08-19 13:46:59 +0000
@@ -1,5 +1,5 @@
1# When releasing also remember to update the soname as instructed below1# When releasing also remember to update the soname as instructed below
2AC_INIT(libunity, 7.0.11)2AC_INIT(libunity, 7.0.12)
33
4AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)4AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
5AM_CONFIG_HEADER(config.h)5AM_CONFIG_HEADER(config.h)
66
=== modified file 'debian/changelog'
--- debian/changelog 2013-08-16 10:35:25 +0000
+++ debian/changelog 2013-08-19 13:46:59 +0000
@@ -1,3 +1,9 @@
1libunity (7.0.12+13.10.20130816.2-0ubuntu2) UNRELEASED; urgency=low
2
3 * Serialize progress-source property as an array of strings instead of tuples.
4
5 -- Pawel Stolowski <pawel.stolowski@ubuntu.com> Mon, 19 Aug 2013 14:02:42 +0200
6
1libunity (7.0.11+13.10.20130816.2-0ubuntu1) saucy; urgency=low7libunity (7.0.11+13.10.20130816.2-0ubuntu1) saucy; urgency=low
28
3 [ Michal Hruby ]9 [ Michal Hruby ]
410
=== modified file 'src/unity-aggregator-scope-private.vala'
--- src/unity-aggregator-scope-private.vala 2013-08-06 08:09:15 +0000
+++ src/unity-aggregator-scope-private.vala 2013-08-19 13:46:59 +0000
@@ -38,20 +38,16 @@
38 public abstract bool merge_metadata (string scope_id, Dee.Model categories, Dee.Model master_categories);38 public abstract bool merge_metadata (string scope_id, Dee.Model categories, Dee.Model master_categories);
39 39
40 /*40 /*
41 Check if values array contains pstuple. This is needed because41 Check if values array contains given progress-source string.
42 vala's 'in' check doesn't work for array of variant tuples.
43 Note that this is not efficient for many progress source values, but in reality42 Note that this is not efficient for many progress source values, but in reality
44 we will be dealing with a single source at a time.43 we will be dealing with a single source at a time.
45 */44 */
46 internal static bool contains_progress_source (Variant[] values, Variant pstuple)45 internal static bool contains_progress_source (Variant[] values, Variant psvar)
47 requires (pstuple.n_children () == 2)
48 {46 {
49 unowned string ps1 = pstuple.get_child_value (0).get_string ();47 unowned string ps = psvar.get_string ();
50 unowned string ps2 = pstuple.get_child_value (1).get_string ();
51 foreach (var v in values)48 foreach (var v in values)
52 {49 {
53 if (v.get_child_value (0).get_string () == ps1 &&50 if (v.get_string () == ps)
54 v.get_child_value (1).get_string () == ps2)
55 return true;51 return true;
56 }52 }
57 return false;53 return false;
5854
=== modified file 'src/unity-category.vala'
--- src/unity-category.vala 2013-08-05 08:23:49 +0000
+++ src/unity-category.vala 2013-08-19 13:46:59 +0000
@@ -151,9 +151,8 @@
151151
152 internal override void update_hints (HashTable<string, Variant> hints)152 internal override void update_hints (HashTable<string, Variant> hints)
153 {153 {
154 Variant[] ps = { new Variant.string (dbus_name), new Variant.string (dbus_path) };154 Variant[] ps = { new Variant.string (dbus_name + ":" + dbus_path) };
155 Variant[] tp = { new Variant.tuple (ps) };155 hints["progress-source"] = new Variant.array (null, ps);
156 hints["progress-source"] = new Variant.array (null, tp);
157 }156 }
158}157}
159158
160159
=== modified file 'test/vala/test-scope.vala'
--- test/vala/test-scope.vala 2013-08-15 15:54:43 +0000
+++ test/vala/test-scope.vala 2013-08-19 13:46:59 +0000
@@ -2194,11 +2194,9 @@
21942194
2195 assert (cat_id == "1991");2195 assert (cat_id == "1991");
2196 assert (psarr != null);2196 assert (psarr != null);
2197 assert (psarr.n_children () == 1); // progress-source array contains only one tuple2197 assert (psarr.n_children () == 1); // progress-source array contains only one value
2198 var ps = psarr.get_child_value (0);2198 var ps = psarr.get_child_value (0);
2199 assert (ps.n_children () == 2); // tuple has 2 values2199 assert (ps.get_string () == "b1:b2");
2200 assert (ps.get_child_value (0).get_string () == "b1");
2201 assert (ps.get_child_value (1).get_string () == "b2");
22022200
2203 iter = proxy.categories_model.next (iter);2201 iter = proxy.categories_model.next (iter);
2204 cat_id = proxy.categories_model.get_string (iter, Unity.Internal.CategoryColumn.ID);2202 cat_id = proxy.categories_model.get_string (iter, Unity.Internal.CategoryColumn.ID);
@@ -2207,11 +2205,9 @@
2207 2205
2208 assert (cat_id == "1211");2206 assert (cat_id == "1211");
2209 assert (psarr != null);2207 assert (psarr != null);
2210 assert (psarr.n_children () == 1); // progress-source array contains only one tuple2208 assert (psarr.n_children () == 1); // progress-source array contains only one value
2211 ps = psarr.get_child_value (0);2209 ps = psarr.get_child_value (0);
2212 assert (ps.n_children () == 2); // tuple has 2 values2210 assert (ps.get_string () == "a1:a2");
2213 assert (ps.get_child_value (0).get_string () == "a1");
2214 assert (ps.get_child_value (1).get_string () == "a2");
2215 }2211 }
2216 }2212 }
22172213

Subscribers

People subscribed via source and target branches