From 4eb240c40ac3b9a83d2af9d39264da0cb4e39aab Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 10 Nov 2014 12:41:52 -0600 Subject: Set the internal variable and not the property --- src/accounts-service-user.vala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/accounts-service-user.vala b/src/accounts-service-user.vala index ec52730..21e8431 100644 --- a/src/accounts-service-user.vala +++ b/src/accounts-service-user.vala @@ -211,7 +211,8 @@ public class AccountsServiceUser : Object { } }); - this.silentMode = this.syssoundproxy.silent_mode; + this._silentMode = this.syssoundproxy.silent_mode; + this.notify_property("silentMode"); } catch (Error e) { this.syssoundproxy = null; warning("Unable to get proxy to system sound settings: %s", e.message); -- cgit v1.2.3 From 0c675658b0a897e08f475b33895d9a2202ce3dd3 Mon Sep 17 00:00:00 2001 From: Nick Dedekind Date: Wed, 19 Nov 2014 17:21:11 +0000 Subject: silent mode updates icon --- src/service.vala | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/service.vala b/src/service.vala index fd0c08d..3bb8b39 100644 --- a/src/service.vala +++ b/src/service.vala @@ -242,6 +242,8 @@ public class IndicatorSound.Service: Object { string icon; if (this.volume_control.mute) icon = this.mute_blocks_sound ? "audio-volume-muted-blocking-panel" : "audio-volume-muted-panel"; + else if (this.accounts_service != null && this.accounts_service.silentMode) + icon = "audio-volume-muted-panel"; else if (volume <= 0.0) icon = "audio-volume-low-zero-panel"; else if (volume <= 0.3) @@ -254,6 +256,9 @@ public class IndicatorSound.Service: Object { string accessible_name; if (this.volume_control.mute) { accessible_name = _("Volume (muted)"); + } else if (this.accounts_service != null && this.accounts_service.silentMode) { + int volume_int = (int)(volume * 100); + accessible_name = "%s (%s %d%%)".printf (_("Volume"), _("silent"), volume_int); } else { int volume_int = (int)(volume * 100); accessible_name = "%s (%d%%)".printf (_("Volume"), volume_int); @@ -443,13 +448,13 @@ public class IndicatorSound.Service: Object { action.set_state (this.action_state_for_player (player)); action.set_enabled (player.can_raise); } - + SimpleAction? greeter_action = this.actions.lookup_action (player.id + ".greeter") as SimpleAction; if (greeter_action != null) { greeter_action.set_state (this.action_state_for_player (player, greeter_show_track())); greeter_action.set_enabled (player.can_raise); } - + /* If we're playing then put that data in accounts service */ if (player.is_running && export_to_accounts_service && accounts_service != null) { accounts_service.player = player; -- cgit v1.2.3 From bc82d53ffb97ed3bed87e65f4dc3dabea99cd9b3 Mon Sep 17 00:00:00 2001 From: Dmitry Shachnev Date: Sun, 23 Nov 2014 15:03:22 +0300 Subject: Fix crash when active_port is null. --- src/volume-control.vala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/volume-control.vala b/src/volume-control.vala index 6f22dc5..6201935 100644 --- a/src/volume-control.vala +++ b/src/volume-control.vala @@ -185,9 +185,10 @@ public class VolumeControl : Object * checking for the port name. On touch (with the pulseaudio droid element) * the headset/headphone port is called 'output-headset' and 'output-headphone'. * On the desktop this is usually called 'analog-output-headphones' */ - if (i.active_port.name == "output-wired_headset" || + if (i.active_port != null && ( + i.active_port.name == "output-wired_headset" || i.active_port.name == "output-wired_headphone" || - i.active_port.name == "analog-output-headphones") { + i.active_port.name == "analog-output-headphones")) { _active_port_headphone = true; } else { _active_port_headphone = false; -- cgit v1.2.3 From 4ab5d1931bc0e8925f2fa32b42ea7c161a7bfc10 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Sat, 6 Dec 2014 10:13:57 -0600 Subject: Disconnect the right function from the 'closed' signal' --- src/bus-watch-namespace.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/bus-watch-namespace.c b/src/bus-watch-namespace.c index ad4e7ad..66ad2b2 100644 --- a/src/bus-watch-namespace.c +++ b/src/bus-watch-namespace.c @@ -41,9 +41,16 @@ typedef struct gchar *name; } GetNameOwnerData; +/* Global Variables */ static guint namespace_watcher_next_id; static GHashTable *namespace_watcher_watchers; +/* Prototypes */ +static void connection_closed (GDBusConnection *connection, + gboolean remote_peer_vanished, + GError *error, + gpointer user_data); + static void namespace_watcher_stop (gpointer data) { @@ -70,7 +77,7 @@ namespace_watcher_stop (gpointer data) if (watcher->connection) { - g_signal_handlers_disconnect_by_func (watcher->connection, namespace_watcher_stop, watcher); + g_signal_handlers_disconnect_by_func (watcher->connection, connection_closed, watcher); g_object_unref (watcher->connection); } -- cgit v1.2.3 From 90c987b1683219a68f54c70fe4d58e4482df7df3 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Sat, 6 Dec 2014 11:10:51 -0600 Subject: Ensure that the active port is not null before looking at its value --- src/volume-control.vala | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/volume-control.vala b/src/volume-control.vala index 6f22dc5..3b175e5 100644 --- a/src/volume-control.vala +++ b/src/volume-control.vala @@ -185,9 +185,10 @@ public class VolumeControl : Object * checking for the port name. On touch (with the pulseaudio droid element) * the headset/headphone port is called 'output-headset' and 'output-headphone'. * On the desktop this is usually called 'analog-output-headphones' */ - if (i.active_port.name == "output-wired_headset" || - i.active_port.name == "output-wired_headphone" || - i.active_port.name == "analog-output-headphones") { + if (i.active_port != null && + (i.active_port.name == "output-wired_headset" || + i.active_port.name == "output-wired_headphone" || + i.active_port.name == "analog-output-headphones")) { _active_port_headphone = true; } else { _active_port_headphone = false; -- cgit v1.2.3 From 2862112c262c8d4d211f378388f3286b5f0642a6 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 9 Dec 2014 09:55:37 -0600 Subject: Make sure to set the internal variable too --- src/accounts-service-user.vala | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/accounts-service-user.vala b/src/accounts-service-user.vala index 21e8431..e8db7c4 100644 --- a/src/accounts-service-user.vala +++ b/src/accounts-service-user.vala @@ -35,6 +35,7 @@ public class AccountsServiceUser : Object { return _silentMode; } set { + _silentMode = value; if (syssoundproxy != null) syssoundproxy.silent_mode = value; } -- cgit v1.2.3 From 30e9118a70ef2ed337ae613b6af55245da5df4f5 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 29 Jan 2015 11:28:58 -0600 Subject: Add a watcher for the notification server going up and down. Redetect sync notifications depending on it. --- src/service.vala | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/service.vala b/src/service.vala index c7e29e7..f4f13ab 100644 --- a/src/service.vala +++ b/src/service.vala @@ -20,6 +20,11 @@ public class IndicatorSound.Service: Object { public Service (MediaPlayerList playerlist) { sync_notification = new Notify.Notification(_("Volume"), "", "audio-volume-muted"); + this.notification_server_watch = GLib.Bus.watch_name(GLib.BusType.SESSION, + "org.freedesktop.Notifications", + GLib.BusNameWatcherFlags.NONE, + () => { check_sync_notification = false; }, + () => { check_sync_notification = false; }); this.settings = new Settings ("com.canonical.indicator.sound"); this.sharedsettings = new Settings ("com.ubuntu.sound"); @@ -92,6 +97,11 @@ public class IndicatorSound.Service: Object { Source.remove (this.sound_was_blocked_timeout_id); this.sound_was_blocked_timeout_id = 0; } + + if (this.notification_server_watch != 0) { + GLib.Bus.unwatch_name(this.notification_server_watch); + this.notification_server_watch = 0; + } } bool greeter_show_track () { @@ -175,6 +185,7 @@ public class IndicatorSound.Service: Object { AccountsServiceUser? accounts_service = null; bool export_to_accounts_service = false; private Notify.Notification sync_notification; + private uint notification_server_watch; /* Maximum volume as a scaling factor between the volume action's state and the value in * this.volume_control. See create_volume_action(). @@ -252,7 +263,6 @@ public class IndicatorSound.Service: Object { root_action.set_state (builder.end()); } - /* TODO: Update these if the notification server leaves the bus and restarts */ private bool check_sync_notification = false; private bool support_sync_notification = false; -- cgit v1.2.3