Merge lp:~mhr3/libunity/api-tweaks into lp:libunity

Proposed by Michal Hruby
Status: Merged
Approved by: Paweł Stołowski
Approved revision: 242
Merged at revision: 240
Proposed branch: lp:~mhr3/libunity/api-tweaks
Merge into: lp:libunity
Diff against target: 169 lines (+60/-14)
10 files modified
configure.ac (+1/-1)
debian/changelog (+7/-0)
debian/libunity9.symbols (+1/-0)
protocol/protocol-scope-discovery.vala (+18/-2)
src/unity-utils.vala (+23/-1)
test/data/unity/scopes/masterscope_b.scope (+2/-2)
test/data/unity/scopes/masterscope_b/brokenscope.scope (+2/-2)
test/data/unity/scopes/masterscope_b/subscope1.scope (+2/-2)
test/data/unity/scopes/masterscope_b/subscope2.scope (+2/-2)
test/data/unity/scopes/test_masterscope.scope (+2/-2)
To merge this branch: bzr merge lp:~mhr3/libunity/api-tweaks
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Paweł Stołowski (community) Approve
Review via email: mp+171057@code.launchpad.net

Commit message

Add unity_object_unref wrapper, deprecate the DBusName and DBusPath keys in .scope files, use UniqueName & GroupName instead (same as what the API uses).

Description of the change

Add unity_object_unref wrapper, deprecate the DBusName and DBusPath keys in .scope files, use UniqueName & GroupName instead (same as what the API uses).

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
Paweł Stołowski (stolowski) wrote :

Looks good overall, just two comments:

86 + if (o.get_type ().name ().has_prefix ("Unity"))

This check looks a bit shaky, but I recon we can't do much more... So, how about renaming object_unref to unity_object_unref to emphasize this requirement?

82 + public static void object_unref (void* object)
What's the use case / who is going to use it? Can you add a docstring?

review: Needs Fixing
lp:~mhr3/libunity/api-tweaks updated
242. By Michal Hruby

Add proper doc string

Revision history for this message
Michal Hruby (mhr3) wrote :

> Looks good overall, just two comments:
>
> 86 + if (o.get_type ().name ().has_prefix ("Unity"))
>
> This check looks a bit shaky, but I recon we can't do much more... So, how
> about renaming object_unref to unity_object_unref to emphasize this
> requirement?

That's already the name, note the Unity namespace.

>
> 82 + public static void object_unref (void* object)
> What's the use case / who is going to use it? Can you add a docstring?

It's *the* destructor for everything.

Revision history for this message
Paweł Stołowski (stolowski) wrote :

Ok, thanks for clarification, let's get it it.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'configure.ac'
--- configure.ac 2013-06-18 17:29:18 +0000
+++ configure.ac 2013-06-24 16:07:47 +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.4)2AC_INIT(libunity, 7.0.5)
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-06-21 04:02:47 +0000
+++ debian/changelog 2013-06-24 16:07:47 +0000
@@ -1,3 +1,10 @@
1libunity (7.0.5-0ubuntu1) UNRELEASED; urgency=low
2
3 * Add unity_object_unref wrapper.
4 * Use GroupName and UniqueName in the .scope files.
5
6 -- Michal Hruby <michal.hruby@canonical.com> Mon, 24 Jun 2013 11:28:15 +0100
7
1libunity (7.0.4daily13.06.21-0ubuntu1) saucy; urgency=low8libunity (7.0.4daily13.06.21-0ubuntu1) saucy; urgency=low
29
3 [ Michal Hruby ]10 [ Michal Hruby ]
411
=== modified file 'debian/libunity9.symbols'
--- debian/libunity9.symbols 2013-06-21 15:35:04 +0000
+++ debian/libunity9.symbols 2013-06-24 16:07:47 +0000
@@ -572,6 +572,7 @@
572 unity_music_preview_get_type@Base 5.90.0572 unity_music_preview_get_type@Base 5.90.0
573 unity_music_preview_new@Base 5.90.0573 unity_music_preview_new@Base 5.90.0
574 unity_music_preview_track_state_get_type@Base 5.92.0574 unity_music_preview_track_state_get_type@Base 5.92.0
575 unity_object_unref@Base 0replaceme
575 unity_options_filter_add_option@Base 4.0.0576 unity_options_filter_add_option@Base 4.0.0
576 unity_options_filter_construct@Base 4.0.0577 unity_options_filter_construct@Base 4.0.0
577 unity_options_filter_find_and_update_option@Base 4.0.0578 unity_options_filter_find_and_update_option@Base 4.0.0
578579
=== modified file 'protocol/protocol-scope-discovery.vala'
--- protocol/protocol-scope-discovery.vala 2013-06-11 10:24:17 +0000
+++ protocol/protocol-scope-discovery.vala 2013-06-24 16:07:47 +0000
@@ -234,8 +234,24 @@
234234
235 // required fields235 // required fields
236 this.name = dgettext(this.domain, file.get_string (SCOPE_GROUP, "Name"));236 this.name = dgettext(this.domain, file.get_string (SCOPE_GROUP, "Name"));
237 this.dbus_name = file.get_string (SCOPE_GROUP, "DBusName");237 // support deprecated DBusName / DBusPath, but require the new
238 this.dbus_path = file.get_string (SCOPE_GROUP, "DBusPath");238 // GroupName & UniqueName
239 if (file.has_key (SCOPE_GROUP, "DBusName"))
240 {
241 this.dbus_name = file.get_string (SCOPE_GROUP, "DBusName");
242 }
243 else
244 {
245 this.dbus_name = file.get_string (SCOPE_GROUP, "GroupName");
246 }
247 if (file.has_key (SCOPE_GROUP, "DBusPath"))
248 {
249 this.dbus_path = file.get_string (SCOPE_GROUP, "DBusPath");
250 }
251 else
252 {
253 this.dbus_path = file.get_string (SCOPE_GROUP, "UniqueName");
254 }
239 this.icon = file.get_string (SCOPE_GROUP, "Icon");255 this.icon = file.get_string (SCOPE_GROUP, "Icon");
240 this.type = file.get_string (SCOPE_GROUP, "Type");256 this.type = file.get_string (SCOPE_GROUP, "Type");
241257
242258
=== modified file 'src/unity-utils.vala'
--- src/unity-utils.vala 2013-06-21 15:27:07 +0000
+++ src/unity-utils.vala 2013-06-24 16:07:47 +0000
@@ -21,7 +21,28 @@
21using GLib;21using GLib;
22using Gee;22using Gee;
2323
24namespace Unity.Internal {24namespace Unity {
25
26 /**
27 * Destroy an object.
28 *
29 * Unreferences object returned by one of unity_*_new constructors.
30 */
31 public static void object_unref (void* object)
32 {
33 Object* o_ptr = (Object*) object;
34 // we don't want people using unity_object_unref for non Unity classes
35 if (o_ptr is Object && o_ptr->get_type ().name ().has_prefix ("Unity"))
36 {
37 delete o_ptr;
38 }
39 else
40 {
41 critical ("Unable to unref object, invalid object type");
42 }
43 }
44
45namespace Internal {
2546
26/* Cateories: [id, display_name, icon, renderer_name, hints] */47/* Cateories: [id, display_name, icon, renderer_name, hints] */
27internal const string[] CATEGORIES_SCHEMA = {"s", "s", "s", "s", "a{sv}"};48internal const string[] CATEGORIES_SCHEMA = {"s", "s", "s", "s", "a{sv}"};
@@ -287,3 +308,4 @@
287}308}
288309
289} /* namespace Unity.Internal */310} /* namespace Unity.Internal */
311} /* namespace Unity */
290312
=== modified file 'test/data/unity/scopes/masterscope_b.scope'
--- test/data/unity/scopes/masterscope_b.scope 2013-06-10 12:02:11 +0000
+++ test/data/unity/scopes/masterscope_b.scope 2013-06-24 16:07:47 +0000
@@ -1,6 +1,6 @@
1[Scope]1[Scope]
2DBusName=com.canonical.Unity.Scope.MasterB2GroupName=com.canonical.Unity.Scope.MasterB
3DBusPath=/com/canonical/unity/scope/masterb3UniqueName=/com/canonical/unity/scope/masterb
4Icon=/usr/share/unity/6/icon2.svg4Icon=/usr/share/unity/6/icon2.svg
5IsMaster=true5IsMaster=true
6RequiredMetadata=bid[s];a[s];b[y];6RequiredMetadata=bid[s];a[s];b[y];
77
=== modified file 'test/data/unity/scopes/masterscope_b/brokenscope.scope'
--- test/data/unity/scopes/masterscope_b/brokenscope.scope 2012-12-04 17:19:39 +0000
+++ test/data/unity/scopes/masterscope_b/brokenscope.scope 2013-06-24 16:07:47 +0000
@@ -1,3 +1,3 @@
1[Scope]1[Scope]
2DBusName=com.canonical.Unity.Scope.Subscope12GroupName=com.canonical.Unity.Scope.Subscope1
3DBusPath=/com/canonical/unity/scope/subscope13UniqueName=/com/canonical/unity/scope/subscope1
44
=== modified file 'test/data/unity/scopes/masterscope_b/subscope1.scope'
--- test/data/unity/scopes/masterscope_b/subscope1.scope 2013-04-23 18:21:33 +0000
+++ test/data/unity/scopes/masterscope_b/subscope1.scope 2013-06-24 16:07:47 +0000
@@ -1,6 +1,6 @@
1[Scope]1[Scope]
2DBusName=com.canonical.Unity.Scope.Subscope12GroupName=com.canonical.Unity.Scope.Subscope1
3DBusPath=/com/canonical/unity/scope/subscope13UniqueName=/com/canonical/unity/scope/subscope1
4Icon=/usr/share/unity/6/icon-sub1.svg4Icon=/usr/share/unity/6/icon-sub1.svg
5RequiredMetadata=bid[s];5RequiredMetadata=bid[s];
6OptionalMetadata=6OptionalMetadata=
77
=== modified file 'test/data/unity/scopes/masterscope_b/subscope2.scope'
--- test/data/unity/scopes/masterscope_b/subscope2.scope 2013-04-03 15:22:36 +0000
+++ test/data/unity/scopes/masterscope_b/subscope2.scope 2013-06-24 16:07:47 +0000
@@ -1,6 +1,6 @@
1[Scope]1[Scope]
2DBusName=com.canonical.Unity.Scope.Subscope22GroupName=com.canonical.Unity.Scope.Subscope2
3DBusPath=/com/canonical/unity/scope/subscope23UniqueName=/com/canonical/unity/scope/subscope2
4Icon=/usr/share/unity/6/icon-sub2.svg4Icon=/usr/share/unity/6/icon-sub2.svg
5Keywords=pooh;5Keywords=pooh;
6Type=various6Type=various
77
=== modified file 'test/data/unity/scopes/test_masterscope.scope'
--- test/data/unity/scopes/test_masterscope.scope 2013-04-03 15:22:36 +0000
+++ test/data/unity/scopes/test_masterscope.scope 2013-06-24 16:07:47 +0000
@@ -1,6 +1,6 @@
1[Scope]1[Scope]
2DBusName=com.canonical.Unity.Scope.Test2GroupName=com.canonical.Unity.Scope.Test
3DBusPath=/com/canonical/Unity/MasterScope/Test3UniqueName=/com/canonical/Unity/MasterScope/Test
4Icon=/usr/share/unity/6/icon1.svg4Icon=/usr/share/unity/6/icon1.svg
5IsMaster=true5IsMaster=true
6RequiredMetadata=required_string[s];required_int[i];6RequiredMetadata=required_string[s];required_int[i];

Subscribers

People subscribed via source and target branches