From 3a1bf21052b1f9939ef574a4dfa6d4c1fe74df5d Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 10 Jan 2012 18:04:50 +0100 Subject: make indicator-sound's schema and path naming consistent with other indicators. indicator-sound uses a different schema prefix ("/com/canonical/indicators" vs "/com/canonical/indicator") and different path prefix ("/apps/indicators" vs "/com/canonical/indicator") than other indicators use. When I asked ronoc about the latter, he confirmed it's an error and suggested that the former be fixed at the same time to make indicator naming more consistent. --- data/Makefile.am | 2 +- data/com.canonical.indicator.sound.gschema.xml | 38 +++++++++++++++++++++++++ data/com.canonical.indicators.sound.gschema.xml | 38 ------------------------- data/indicator-sound.service.in | 2 +- 4 files changed, 40 insertions(+), 40 deletions(-) create mode 100644 data/com.canonical.indicator.sound.gschema.xml delete mode 100644 data/com.canonical.indicators.sound.gschema.xml (limited to 'data') diff --git a/data/Makefile.am b/data/Makefile.am index f33b470..2891606 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -1,7 +1,7 @@ SUBDIRS = icons gsettings_SCHEMAS = \ - com.canonical.indicators.sound.gschema.xml + com.canonical.indicator.sound.gschema.xml @GSETTINGS_RULES@ dbus_servicesdir = $(DBUSSERVICEDIR) diff --git a/data/com.canonical.indicator.sound.gschema.xml b/data/com.canonical.indicator.sound.gschema.xml new file mode 100644 index 0000000..5d3fea8 --- /dev/null +++ b/data/com.canonical.indicator.sound.gschema.xml @@ -0,0 +1,38 @@ + + + + A list of applications blacklisted from the sound menu + [] + + Each media player which abides by the MPRIS2 spec will automatically appear in the menu. + This array should contain the desktop file names (minus .desktop suffix) of applications which + do not want to be included in the sound menu. + + + + A list of applications which at some point have registered with the sound menu + [ 'banshee' ] + + Each media player which abides by the MPRIS2 spec will automatically appear in the menu. + This array should contain the desktop file names (minus .desktop suffix) of applications which + have at some point appeared in the menU. This allows the menu remember and display offlined applications. + + + + false + Initial setting for global mute (mute all) on the menu + + On start up volume should not be muted. + + + + true + Initial setting for showing notify-osd notification on scroll volume-change + + When using the mouse scroll-wheel over the indicator-sound icon, the volume changes. + Enabling this setting, every scroll volume-change a notify-osd bubble with the + updated volume value will be shown (if supported by your notification daemon). + + + + diff --git a/data/com.canonical.indicators.sound.gschema.xml b/data/com.canonical.indicators.sound.gschema.xml deleted file mode 100644 index dc63bcb..0000000 --- a/data/com.canonical.indicators.sound.gschema.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - A list of applications blacklisted from the sound menu - [] - - Each media player which abides by the MPRIS2 spec will automatically appear in the menu. - This array should contain the desktop file names (minus .desktop suffix) of applications which - do not want to be included in the sound menu. - - - - A list of applications which at some point have registered with the sound menu - [ 'banshee' ] - - Each media player which abides by the MPRIS2 spec will automatically appear in the menu. - This array should contain the desktop file names (minus .desktop suffix) of applications which - have at some point appeared in the menU. This allows the menu remember and display offlined applications. - - - - false - Initial setting for global mute (mute all) on the menu - - On start up volume should not be muted. - - - - true - Initial setting for showing notify-osd notification on scroll volume-change - - When using the mouse scroll-wheel over the indicator-sound icon, the volume changes. - Enabling this setting, every scroll volume-change a notify-osd bubble with the - updated volume value will be shown (if supported by your notification daemon). - - - - diff --git a/data/indicator-sound.service.in b/data/indicator-sound.service.in index a80cd03..4cee062 100644 --- a/data/indicator-sound.service.in +++ b/data/indicator-sound.service.in @@ -1,3 +1,3 @@ [D-BUS Service] -Name=com.canonical.indicators.sound +Name=com.canonical.indicator.sound Exec=@libexecdir@/indicator-sound-service -- cgit v1.2.3 From 1c6998b43f5bc0ea04b7285b2687b1b73393efd4 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Fri, 13 Jan 2012 13:04:08 +0000 Subject: revert to rhythmbox for the default player --- data/com.canonical.indicators.sound.gschema.xml | 2 +- src/player-controller.vala | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'data') diff --git a/data/com.canonical.indicators.sound.gschema.xml b/data/com.canonical.indicators.sound.gschema.xml index dc63bcb..f853367 100644 --- a/data/com.canonical.indicators.sound.gschema.xml +++ b/data/com.canonical.indicators.sound.gschema.xml @@ -11,7 +11,7 @@ A list of applications which at some point have registered with the sound menu - [ 'banshee' ] + [ 'rhythmbox' ] Each media player which abides by the MPRIS2 spec will automatically appear in the menu. This array should contain the desktop file names (minus .desktop suffix) of applications which diff --git a/src/player-controller.vala b/src/player-controller.vala index 04d0bf9..05996c6 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -178,11 +178,11 @@ public class PlayerController : GLib.Object playlists_menuitem.root_item.property_set_bool (MENUITEM_PROP_VISIBLE, false ); this.custom_items[widget_order.TRANSPORT].property_set_bool (MENUITEM_PROP_VISIBLE, - this.app_info.get_id() == "banshee.desktop"); + this.app_info.get_id() == "rhythmbox.desktop"); return; } metadata_menuitem.should_collapse (!this.custom_items[widget_order.METADATA].populated (MetadataMenuitem.relevant_attributes_for_ui()) ); - if (this.app_info.get_id() == "banshee.desktop"){ + if (this.app_info.get_id() == "rhythmbox.desktop"){ TransportMenuitem transport = this.custom_items[widget_order.TRANSPORT] as TransportMenuitem; transport.handle_cached_action(); } -- cgit v1.2.3 From 6101f59b28f94ebe2ac819c4af61928a0ff17844 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 24 Jan 2012 20:57:50 -0600 Subject: add visibility toggle support for (lp:#829648) --- data/com.canonical.indicator.sound.gschema.xml | 7 +++ src/indicator-sound.c | 66 +++++++++++++++++++++++++- 2 files changed, 72 insertions(+), 1 deletion(-) (limited to 'data') diff --git a/data/com.canonical.indicator.sound.gschema.xml b/data/com.canonical.indicator.sound.gschema.xml index ae0cc8d..a3ec770 100644 --- a/data/com.canonical.indicator.sound.gschema.xml +++ b/data/com.canonical.indicator.sound.gschema.xml @@ -34,5 +34,12 @@ updated volume value will be shown (if supported by your notification daemon). + + true + Whether or not to show the sound indicator in the menu bar. + + Whether or not to show the sound indicator in the menu bar. + + diff --git a/src/indicator-sound.c b/src/indicator-sound.c index b953449..c87f850 100644 --- a/src/indicator-sound.c +++ b/src/indicator-sound.c @@ -55,10 +55,13 @@ struct _IndicatorSoundPrivate GDBusProxy *dbus_proxy; SoundStateManager* state_manager; gchar *accessible_desc; + GSettings *settings; }; #define INDICATOR_SOUND_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), INDICATOR_SOUND_TYPE, IndicatorSoundPrivate)) +#define SOUND_INDICATOR_GSETTINGS_SCHEMA_ID "com.canonical.indicator.sound" + // GObject Boiler plate INDICATOR_SET_VERSION INDICATOR_SET_TYPE(INDICATOR_SOUND_TYPE) @@ -119,6 +122,10 @@ static void connection_changed (IndicatorServiceManager * sm, gboolean connected, gpointer userdata); +// Visiblity +static void settings_init (IndicatorSound * self); + + static void indicator_sound_class_init (IndicatorSoundClass *klass) { @@ -156,6 +163,9 @@ indicator_sound_init (IndicatorSound *self) priv->transport_widgets_list = t_list; priv->state_manager = g_object_new (SOUND_TYPE_STATE_MANAGER, NULL); priv->accessible_desc = NULL; + priv->settings = NULL; + + settings_init (self); g_signal_connect ( G_OBJECT(self->service), INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE, @@ -168,6 +178,11 @@ indicator_sound_dispose (GObject *object) IndicatorSound * self = INDICATOR_SOUND(object); IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(self); + if (priv->settings != NULL) { + g_object_unref (G_OBJECT(priv->settings)); + priv->settings = NULL; + } + if (self->service != NULL) { g_object_unref(G_OBJECT(self->service)); self->service = NULL; @@ -747,10 +762,12 @@ indicator_sound_middle_click (IndicatorObject * io, IndicatorObjectEntry * entry void update_accessible_desc (IndicatorObject * io) { - IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(io); GList *entries = indicator_object_get_entries(io); + if (!entries) + return; IndicatorObjectEntry * entry = (IndicatorObjectEntry *)entries->data; + IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(io); gchar *old_desc = priv->accessible_desc; if (priv->volume_widget) { @@ -770,3 +787,50 @@ update_accessible_desc (IndicatorObject * io) TRUE); g_list_free(entries); } + +/*** +**** +***/ + +#define VISIBLE_KEY "visible" + +static void +on_visible_changed (GSettings * settings, gchar * key, gpointer user_data) +{ + g_return_if_fail (!g_strcmp0 (key, VISIBLE_KEY)); + + IndicatorObject * io = INDICATOR_OBJECT(user_data); + const gboolean visible = g_settings_get_boolean (settings, key); + indicator_object_set_visible (io, visible); + if (visible) + update_accessible_desc (io); // requires an entry +} + +static void +settings_init (IndicatorSound *self) +{ + const char * schema = SOUND_INDICATOR_GSETTINGS_SCHEMA_ID; + + gint i; + gboolean schema_exists = FALSE; + const char * const * schemas = g_settings_list_schemas (); + for (i=0; !schema_exists && schemas && schemas[i]; i++) + if (!g_strcmp0 (schema, schemas[i])) + schema_exists = TRUE; + + IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(self); + if (schema_exists) { + priv->settings = g_settings_new (schema); + } else { + priv->settings = NULL; + } + + if (priv->settings != NULL) { + g_signal_connect (G_OBJECT(priv->settings), "changed::" VISIBLE_KEY, + G_CALLBACK(on_visible_changed), self); + const gboolean b = g_settings_get_boolean (priv->settings, VISIBLE_KEY); + g_object_set (G_OBJECT(self), + "indicator-object-default-visibility", b, + NULL); + } +} -- cgit v1.2.3