Merge lp:~charlesk/indicator-sound/lp-1432446-use-bus-watcher-for-notifications into lp:indicator-sound/15.10

Proposed by Charles Kerr
Status: Merged
Approved by: dobey
Approved revision: 493
Merged at revision: 495
Proposed branch: lp:~charlesk/indicator-sound/lp-1432446-use-bus-watcher-for-notifications
Merge into: lp:indicator-sound/15.10
Diff against target: 34 lines (+4/-13)
1 file modified
src/service.vala (+4/-13)
To merge this branch: bzr merge lp:~charlesk/indicator-sound/lp-1432446-use-bus-watcher-for-notifications
Reviewer Review Type Date Requested Status
dobey (community) Approve
Review via email: mp+258300@code.launchpad.net

Commit message

Use the BusWatcher to look for org.freedesktop.Notifications ownership changes on the bus.

Description of the change

Use BusWatcher, rather than a GDBusProxy, to watch for org.freedesktop.Notifications' owner to change. BusWatcher already handles bus errors gracefully, and as a bonus the resulting service code is slightly simpler.

This crash is happening when there are bigger problems on the system, evidenced by the ticket's description of a blank white screen before this crash shows up. i-sound isn't much use without a working session bus, but at least we can stop it from generating redundant bug reports.

Sibling 15.04 MP: https://code.launchpad.net/~charlesk/indicator-sound/lp-1432446-use-bus-watcher-for-notifications/+merge/256861

To post a comment you must log in.
Revision history for this message
dobey (dobey) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/service.vala'
2--- src/service.vala 2015-02-27 22:36:17 +0000
3+++ src/service.vala 2015-05-05 19:09:37 +0000
4@@ -19,7 +19,6 @@
5
6 public class IndicatorSound.Service: Object {
7 DBusConnection bus;
8- DBusProxy notification_proxy;
9
10 public Service (MediaPlayerList playerlist, VolumeControl volume, AccountsServiceUser? accounts) {
11 try {
12@@ -29,18 +28,10 @@
13 }
14
15 sync_notification = new Notify.Notification(_("Volume"), "", "audio-volume-muted");
16- try {
17- this.notification_proxy = new DBusProxy.for_bus_sync(GLib.BusType.SESSION,
18- DBusProxyFlags.DO_NOT_LOAD_PROPERTIES | DBusProxyFlags.DO_NOT_CONNECT_SIGNALS | DBusProxyFlags.DO_NOT_AUTO_START,
19- null, /* interface info */
20- "org.freedesktop.Notifications",
21- "/org/freedesktop/Notifications",
22- "org.freedesktop.Notifications",
23- null);
24- this.notification_proxy.notify["g-name-owner"].connect ( () => { debug("Notifications name owner changed"); check_sync_notification = false; } );
25- } catch (GLib.Error e) {
26- error("Unable to build notification proxy: %s", e.message);
27- }
28+ BusWatcher.watch_namespace (GLib.BusType.SESSION,
29+ "org.freedesktop.Notifications",
30+ () => { debug("Notifications name appeared"); check_sync_notification = false; },
31+ () => { debug("Notifications name vanshed"); check_sync_notification = false; });
32
33 this.settings = new Settings ("com.canonical.indicator.sound");
34 this.sharedsettings = new Settings ("com.ubuntu.sound");

Subscribers

People subscribed via source and target branches