From 8396e05ce716296377f2e4550e0c929dca30518e Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 14 Dec 2010 16:41:10 +0000 Subject: gsettings all the way --- data/Makefile.am | 41 ++++++++----------------- data/com.canonical.indicators.sound.gschema.xml | 20 ++++++++++++ data/indicator-sound.schemas.in | 16 ---------- 3 files changed, 32 insertions(+), 45 deletions(-) create mode 100644 data/com.canonical.indicators.sound.gschema.xml delete mode 100644 data/indicator-sound.schemas.in (limited to 'data') diff --git a/data/Makefile.am b/data/Makefile.am index aaa6ca4..730f166 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -5,39 +5,22 @@ service_in_files = indicator-sound.service.in dbus_services_DATA = $(service_in_files:.service.in=.service) %.service: %.service.in - sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@ + sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@ ############################## -# GConf Schema +# GSettings Schema ############################## -schemadir = \ - $(GCONF_SCHEMA_FILE_DIR) +gsettings_SCHEMAS = \ + com.canonical.indicators.sound.gschema.xml +@GSETTINGS_RULES@ -schema_in_files = \ - indicator-sound.schemas.in - -schema_DATA = \ - $(schema_in_files:.schemas.in=.schemas) - -@INTLTOOL_SCHEMAS_RULE@ - - -#$(dbus_services_DATA): $(service_in_files) Makefile -# sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@ - -EXTRA_DIST = \ - $(service_in_files) \ - $(schema_in_files) +############################## -CLEANFILES = \ - $(dbus_services_DATA) \ - $(schema_DATA) +EXTRA_DIST = \ + $(service_in_files) \ + $(gsettings_SCHEMAS) -if GCONF_SCHEMAS_INSTALL -install-data-local: - GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) \ - gconftool-2 --makefile-install-rule $(schema_DATA) -else -install-data-local: -endif +CLEANFILES = \ + $(dbus_services_DATA) + \ No newline at end of file diff --git a/data/com.canonical.indicators.sound.gschema.xml b/data/com.canonical.indicators.sound.gschema.xml new file mode 100644 index 0000000..4284527 --- /dev/null +++ b/data/com.canonical.indicators.sound.gschema.xml @@ -0,0 +1,20 @@ + + + + + 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. + + + + FALSE + Initial setting for global mute (mute all) on the menu + + On start up volume should not be muted. + + + + diff --git a/data/indicator-sound.schemas.in b/data/indicator-sound.schemas.in deleted file mode 100644 index 9ad0f39..0000000 --- a/data/indicator-sound.schemas.in +++ /dev/null @@ -1,16 +0,0 @@ - - - - - /schemas/apps/indicator-sound/volume_mute - /apps/indicator-sound/volume_mute - indicator-sound - bool - FALSE - - Volume is not muted by default - On start up volume should not be muted. - - - - -- cgit v1.2.3 From 7ef502c18c6ccf850c83fabebfb1884c458320b4 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 14 Dec 2010 17:04:46 +0000 Subject: autofoo in order for gsettings --- data/Makefile.am | 24 +++++++++--------------- data/indicator-sound.service.in | 2 ++ 2 files changed, 11 insertions(+), 15 deletions(-) (limited to 'data') diff --git a/data/Makefile.am b/data/Makefile.am index 730f166..3f54f64 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -1,26 +1,20 @@ SUBDIRS = icons +gsettings_SCHEMAS = \ + com.canonical.indicators.sound.gschema.xml +@GSETTINGS_RULES@ + dbus_servicesdir = $(DBUSSERVICEDIR) -service_in_files = indicator-sound.service.in -dbus_services_DATA = $(service_in_files:.service.in=.service) +dbus_services_DATA = indicator-sound.service %.service: %.service.in sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@ -############################## -# GSettings Schema -############################## - -gsettings_SCHEMAS = \ - com.canonical.indicators.sound.gschema.xml -@GSETTINGS_RULES@ - -############################## -EXTRA_DIST = \ - $(service_in_files) \ - $(gsettings_SCHEMAS) +EXTRA_DIST = \ + $(gsettings_SCHEMAS) \ + indicator-sound.service.in -CLEANFILES = \ +CLEANFILES = \ $(dbus_services_DATA) \ No newline at end of file diff --git a/data/indicator-sound.service.in b/data/indicator-sound.service.in index 883d31d..7a957cb 100644 --- a/data/indicator-sound.service.in +++ b/data/indicator-sound.service.in @@ -1,3 +1,5 @@ [D-BUS Service] Name=org.ayatana.indicator.sound Exec=@libexecdir@/indicator-sound-service + + -- cgit v1.2.3 From 37eb76fbc08dad63341a4deff3bcaf433e1082ab Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 14 Dec 2010 17:29:49 +0000 Subject: added glib macro necessaries to configure.ac --- configure.ac | 6 ++++++ data/Makefile.am | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'data') diff --git a/configure.ac b/configure.ac index c8ae871..ea4ab45 100644 --- a/configure.ac +++ b/configure.ac @@ -89,6 +89,12 @@ fi AC_SUBST(INDICATORDIR) AC_SUBST(INDICATORICONSDIR) +########################### +# Grab the GSettings Macros +########################### + +GLIB_GSETTINGS + ########################### # DBus Service Info ########################### diff --git a/data/Makefile.am b/data/Makefile.am index 3f54f64..6f2ac61 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -10,7 +10,6 @@ dbus_services_DATA = indicator-sound.service %.service: %.service.in sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@ - EXTRA_DIST = \ $(gsettings_SCHEMAS) \ indicator-sound.service.in -- cgit v1.2.3 From 7e7fa1765dc095f441d7290f50c5a773ba531b02 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 14 Dec 2010 17:53:47 +0000 Subject: changed the name of the dbus address to be used between the indicator and service --- data/indicator-sound.service.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'data') diff --git a/data/indicator-sound.service.in b/data/indicator-sound.service.in index 7a957cb..8059216 100644 --- a/data/indicator-sound.service.in +++ b/data/indicator-sound.service.in @@ -1,5 +1,5 @@ [D-BUS Service] -Name=org.ayatana.indicator.sound +Name=com.canonical.indicators.sound Exec=@libexecdir@/indicator-sound-service -- cgit v1.2.3 From 02b6109a523fdf2236788628447186682a9adf1b Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 14 Dec 2010 18:00:36 +0000 Subject: fixed annoying autofoo issues --- data/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'data') diff --git a/data/Makefile.am b/data/Makefile.am index 6f2ac61..f33b470 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -8,7 +8,7 @@ dbus_servicesdir = $(DBUSSERVICEDIR) dbus_services_DATA = indicator-sound.service %.service: %.service.in - sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@ + sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@ EXTRA_DIST = \ $(gsettings_SCHEMAS) \ -- cgit v1.2.3 From aaf57407f00aa59df3699794496fd42a731ad7db Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 15 Dec 2010 14:32:27 +0000 Subject: settings schema defined and handling code wrote --- data/com.canonical.indicators.sound.gschema.xml | 25 +++++++---- src/Makefile.am | 2 +- src/music-player-bridge.vala | 10 ++++- src/settings-manager.vala | 55 +++++++++++++++++++++++++ src/sound-service-dbus.c | 1 - 5 files changed, 81 insertions(+), 12 deletions(-) create mode 100644 src/settings-manager.vala (limited to 'data') diff --git a/data/com.canonical.indicators.sound.gschema.xml b/data/com.canonical.indicators.sound.gschema.xml index 4284527..e8e4c86 100644 --- a/data/com.canonical.indicators.sound.gschema.xml +++ b/data/com.canonical.indicators.sound.gschema.xml @@ -1,19 +1,28 @@ - - + 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. + 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. - - FALSE + + A list of applications which at some point have registered with 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 + 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. + On start up volume should not be muted. diff --git a/src/Makefile.am b/src/Makefile.am index 1c381f5..5ef9ef0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -64,7 +64,7 @@ music_bridge_VALASOURCES = \ mpris2-watcher.vala \ mpris2-controller.vala \ player-item.vala \ - familiar-players-db.vala \ + settings-manager.vala \ fetch-file.vala diff --git a/src/music-player-bridge.vala b/src/music-player-bridge.vala index 51ecc4c..6a45d0c 100644 --- a/src/music-player-bridge.vala +++ b/src/music-player-bridge.vala @@ -23,6 +23,7 @@ using GLib; public class MusicPlayerBridge : GLib.Object { + private SettingsManager settings_manager; private Dbusmenu.Menuitem root_menu; private HashMap registered_clients; private Mpris2Watcher watcher; @@ -35,9 +36,14 @@ public class MusicPlayerBridge : GLib.Object construct{ this.registered_clients = new HashMap (); - this.settings = new Settings("com.canonical.indicators.sound"); + this.settings_manager = new SettingsManager(); + this.settings_manager.connect.blacklist_updates (on_blacklist_update); } + private void on_black_list_updated ( string[] blacklist ) + { + debug("some blacklist update"); + } /*private void try_to_add_inactive_familiar_clients(){ foreach(string app in this.playersDB.records()){ @@ -143,7 +149,7 @@ public class MusicPlayerBridge : GLib.Object GLib.AppInfo app_info = info as GLib.AppInfo; return app_info; } - + private static string? fetch_icon_name(string desktop_path) { KeyFile desktop_keyfile = new KeyFile (); diff --git a/src/settings-manager.vala b/src/settings-manager.vala new file mode 100644 index 0000000..9068c05 --- /dev/null +++ b/src/settings-manager.vala @@ -0,0 +1,55 @@ +/* +Copyright 2010 Canonical Ltd. + +Authors: + Conor Curran + +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published +by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program. If not, see . +*/ +using Gee; + +public class SettingsManager : GLib.Object +{ + private Settings settings; + public signal void blacklist_updates ( string[] new_blacklist ); + + public SettingsManager ( ){ + } + construct{ + this.settings = new Settings ("com.canonical.indicators.sound"); + settings.changed["blacklisted-media-players"].connect (on_blacklist_event); + this.fetch_entries.begin(); + } + + public string[] fetch_blacklist() + { + return this.blacklist_updates(this.settings.get_strv ("blacklisted-media-players")); + } + + public string[] fetch_interested() + { + return this.interested_updates(this.settings.get_strv ("interested-media-players")); + } + + public bool add_interested(string app_desktop_name) + { + string[] already_interested = fetch_interested(); + already_interested.append ( app_desktop_name ); + return this.settings.set_strv( already_interested ); + } + + private on_blacklist_event() + { + this.blacklist_updates(this.settings.get_strv ("blacklisted-media-players")); + } +} \ No newline at end of file diff --git a/src/sound-service-dbus.c b/src/sound-service-dbus.c index d553285..0760247 100644 --- a/src/sound-service-dbus.c +++ b/src/sound-service-dbus.c @@ -42,7 +42,6 @@ struct _SoundServiceDbusPrivate { gboolean sink_availability; }; - /* Signals */ enum { SINK_INPUT_WHILE_MUTED, -- cgit v1.2.3 From bb13f9134c42480ada8128cfbd3b19ec2d68865b Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 15 Dec 2010 16:23:15 +0000 Subject: clients properly remembered using gsettings --- data/com.canonical.indicators.sound.gschema.xml | 2 +- src/music-player-bridge.vala | 62 ++++++++++++------------- src/settings-manager.vala | 12 ++--- 3 files changed, 37 insertions(+), 39 deletions(-) (limited to 'data') diff --git a/data/com.canonical.indicators.sound.gschema.xml b/data/com.canonical.indicators.sound.gschema.xml index e8e4c86..43cc645 100644 --- a/data/com.canonical.indicators.sound.gschema.xml +++ b/data/com.canonical.indicators.sound.gschema.xml @@ -1,5 +1,5 @@ - + A list of applications blacklisted from the sound menu [] diff --git a/src/music-player-bridge.vala b/src/music-player-bridge.vala index 6a45d0c..b13b7f3 100644 --- a/src/music-player-bridge.vala +++ b/src/music-player-bridge.vala @@ -37,42 +37,35 @@ public class MusicPlayerBridge : GLib.Object construct{ this.registered_clients = new HashMap (); this.settings_manager = new SettingsManager(); - this.settings_manager.connect.blacklist_updates (on_blacklist_update); + this.settings_manager.blacklist_updates.connect ( this.on_blacklist_update ); } - private void on_black_list_updated ( string[] blacklist ) + private void on_blacklist_update ( string[] blacklist ) { debug("some blacklist update"); } - - /*private void try_to_add_inactive_familiar_clients(){ - foreach(string app in this.playersDB.records()){ - if(app == null){ - warning("App string in keyfile is null therefore moving on to next player"); - continue; - } - debug("attempting to make an app info from %s", app); - - DesktopAppInfo info = new DesktopAppInfo.from_filename(app); - - if(info == null){ - warning("Could not create a desktopappinfo instance from app,: %s , moving on to the next client", app); + private void try_to_add_inactive_familiar_clients() + { + foreach ( string desktop in this.settings_manager.fetch_interested()){ + debug ( "interested client found : %s", desktop ); + string path = DESKTOP_PREFIX.concat ( desktop.concat( ".desktop" ) ); + AppInfo? app_info = create_app_info ( path ); + if ( app_info == null ){ + warning ( "Could not create app_info for path %s \n Getting out of here ", path); continue; } - - GLib.AppInfo app_info = info as GLib.AppInfo; - var mpris_key = determine_key ( app ); - PlayerController ctrl = new PlayerController(this.root_menu, - app_info, - mpris_key, - playersDB.fetch_icon_name(app), - calculate_menu_position(), - PlayerController.state.OFFLINE); - this.registered_clients.set(mpris_key, ctrl); - } - }*/ - + var mpris_key = determine_key ( path ); + PlayerController ctrl = new PlayerController ( this.root_menu, + app_info, + mpris_key, + this.fetch_icon_name(path), + calculate_menu_position(), + PlayerController.state.OFFLINE ); + this.registered_clients.set(mpris_key, ctrl); + } + } + private int calculate_menu_position() { if(this.registered_clients.size == 0){ @@ -109,12 +102,14 @@ public class MusicPlayerBridge : GLib.Object this.calculate_menu_position(), PlayerController.state.READY ); this.registered_clients.set ( mpris_key, ctrl ); - debug ( "successfully created appinfo and instance from path and set it on the respective instance" ); + debug ( "Have not seen this %s before, new controller created.", desktop ); + this.settings_manager.add_interested ( desktop ); + debug ( "application added to the interested list" ); } else{ this.registered_clients[mpris_key].update_state ( PlayerController.state.READY ); this.registered_clients[mpris_key].activate ( ); - debug("Ignoring desktop file path callback because the db cache file has it already: %s \n", path); + debug("Application has already registered - awaken the hibernation: %s \n", path); } } @@ -137,6 +132,7 @@ public class MusicPlayerBridge : GLib.Object this.watcher = new Mpris2Watcher (); this.watcher.client_appeared += this.client_has_become_available; this.watcher.client_disappeared += this.client_has_vanished; + this.try_to_add_inactive_familiar_clients(); } private static AppInfo? create_app_info ( string path ) @@ -176,8 +172,10 @@ public class MusicPlayerBridge : GLib.Object } /* - Messy but necessary method to consolidate desktop filesnames and mpris dbus names - into the one single word string (used as the key in the players hash). + Messy but necessary method to consolidate desktop filesnames and mpris dbus names + into the one single word string (used as the key in the players hash). + So this means that we can determine the key for the players_hash from the + dbus interface name or the desktop file name. */ private static string? determine_key(owned string path) { diff --git a/src/settings-manager.vala b/src/settings-manager.vala index 9068c05..05db430 100644 --- a/src/settings-manager.vala +++ b/src/settings-manager.vala @@ -28,27 +28,27 @@ public class SettingsManager : GLib.Object construct{ this.settings = new Settings ("com.canonical.indicators.sound"); settings.changed["blacklisted-media-players"].connect (on_blacklist_event); - this.fetch_entries.begin(); } public string[] fetch_blacklist() { - return this.blacklist_updates(this.settings.get_strv ("blacklisted-media-players")); + return this.settings.get_strv ("blacklisted-media-players"); } public string[] fetch_interested() { - return this.interested_updates(this.settings.get_strv ("interested-media-players")); + return this.settings.get_strv ("interested-media-players"); } public bool add_interested(string app_desktop_name) { string[] already_interested = fetch_interested(); - already_interested.append ( app_desktop_name ); - return this.settings.set_strv( already_interested ); + already_interested += (app_desktop_name); + return this.settings.set_strv( "interested-media-players", + already_interested ); } - private on_blacklist_event() + private void on_blacklist_event() { this.blacklist_updates(this.settings.get_strv ("blacklisted-media-players")); } -- cgit v1.2.3 From de3ed4111ef50b847e1ba4d6ea06e13f913ba7a0 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Thu, 16 Dec 2010 12:36:43 +0000 Subject: race condtion on playbackstatus accommodated for and dbus names changed over the new canonical naming --- data/com.canonical.indicators.sound.gschema.xml | 2 +- data/indicator-sound.service.in | 2 -- src/dbus-shared-names.h | 2 +- src/indicator-sound.c | 4 ++-- src/mpris2-controller.vala | 15 +++++++++++++-- src/music-player-bridge.vala | 10 +++++----- src/player-controller.vala | 7 ++++--- src/pulse-manager.c | 4 ++-- src/sound-service.xml | 4 ++-- 9 files changed, 30 insertions(+), 20 deletions(-) (limited to 'data') diff --git a/data/com.canonical.indicators.sound.gschema.xml b/data/com.canonical.indicators.sound.gschema.xml index 43cc645..3850f65 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-1' ] 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/data/indicator-sound.service.in b/data/indicator-sound.service.in index 8059216..a80cd03 100644 --- a/data/indicator-sound.service.in +++ b/data/indicator-sound.service.in @@ -1,5 +1,3 @@ [D-BUS Service] Name=com.canonical.indicators.sound Exec=@libexecdir@/indicator-sound-service - - diff --git a/src/dbus-shared-names.h b/src/dbus-shared-names.h index a62238b..9d1e875 100644 --- a/src/dbus-shared-names.h +++ b/src/dbus-shared-names.h @@ -23,7 +23,7 @@ with this program. If not, see . #ifndef __DBUS_SHARED_NAMES_H__ -#define __DBUS_SHARED_NAMES_H__ +#define __DBUS_SHARED_NAMES_H__ 1 #define INDICATOR_SOUND_DBUS_NAME "com.canonical.indicators.sound" #define INDICATOR_SOUND_DBUS_OBJECT "/com/canonical/indicators/sound/menu" diff --git a/src/indicator-sound.c b/src/indicator-sound.c index d5cc54c..34f5ed9 100644 --- a/src/indicator-sound.c +++ b/src/indicator-sound.c @@ -561,7 +561,7 @@ fetch_sink_availability_from_dbus(IndicatorSound* self) GError * error = NULL; gboolean * available_input; available_input = g_new0(gboolean, 1); - org_ayatana_indicator_sound_get_sink_availability(sound_dbus_proxy, available_input, &error); + com_canonical_indicators_sound_get_sink_availability(sound_dbus_proxy, available_input, &error); if (error != NULL) { g_warning("Unable to fetch AVAILABILITY at indicator start up: %s", error->message); g_error_free(error); @@ -593,7 +593,7 @@ fetch_mute_value_from_dbus() GError * error = NULL; gboolean *mute_input; mute_input = g_new0(gboolean, 1); - org_ayatana_indicator_sound_get_sink_mute(sound_dbus_proxy, mute_input, &error); + com_canonical_indicators_sound_get_sink_mute(sound_dbus_proxy, mute_input, &error); if (error != NULL) { g_warning("Unable to fetch MUTE at indicator start up: %s", error->message); g_error_free(error); diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala index 42d08c9..7f14efe 100644 --- a/src/mpris2-controller.vala +++ b/src/mpris2-controller.vala @@ -46,7 +46,7 @@ public class Mpris2Controller : GLib.Object try { this.mpris2_root = Bus.get_proxy_sync ( BusType.SESSION, this.owner.dbus_name, - "/org/mpris/MediaPlayer2"); + "/org/mpris/MediaPlayer2" ); this.player = Bus.get_proxy_sync ( BusType.SESSION, this.owner.dbus_name, "/org/mpris/MediaPlayer2" ); @@ -73,7 +73,11 @@ public class Mpris2Controller : GLib.Object } Variant? play_v = changed_properties.lookup("PlaybackStatus"); if(play_v != null){ + // Race condition sometimes appears with the playback status + // 200ms timeout ensures we have the correct playback status at all times. string state = this.player.PlaybackStatus; + //debug("in the property update and the playback status = %s and update = %s", state, (string)play_v); + Timeout.add ( 200, ensure_correct_playback_status ); TransportMenuitem.state p = (TransportMenuitem.state)this.determine_play_state(state); (this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(p); } @@ -81,7 +85,7 @@ public class Mpris2Controller : GLib.Object if(meta_v != null){ GLib.HashTable changed_updates = clean_metadata(); PlayerItem metadata = this.owner.custom_items[PlayerController.widget_order.METADATA]; - metadata.reset( MetadataMenuitem.attributes_format()); + metadata.reset ( MetadataMenuitem.attributes_format()); metadata.update ( changed_updates, MetadataMenuitem.attributes_format()); metadata.property_set_bool ( MENUITEM_PROP_VISIBLE, @@ -89,6 +93,13 @@ public class Mpris2Controller : GLib.Object } } + private bool ensure_correct_playback_status(){ + debug("TEST playback status = %s", this.player.PlaybackStatus); + TransportMenuitem.state p = (TransportMenuitem.state)this.determine_play_state(this.player.PlaybackStatus); + (this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(p); + return false; + } + private GLib.HashTable? clean_metadata() { GLib.HashTable changed_updates = this.player.Metadata; diff --git a/src/music-player-bridge.vala b/src/music-player-bridge.vala index b13b7f3..327a775 100644 --- a/src/music-player-bridge.vala +++ b/src/music-player-bridge.vala @@ -58,11 +58,11 @@ public class MusicPlayerBridge : GLib.Object var mpris_key = determine_key ( path ); PlayerController ctrl = new PlayerController ( this.root_menu, app_info, - mpris_key, + null, this.fetch_icon_name(path), calculate_menu_position(), PlayerController.state.OFFLINE ); - this.registered_clients.set(mpris_key, ctrl); + this.registered_clients.set(mpris_key, ctrl); } } @@ -94,7 +94,7 @@ public class MusicPlayerBridge : GLib.Object var mpris_key = determine_key ( path ); // Are we sure clients will appear like this with the new registration method in place. if ( this.registered_clients.has_key (mpris_key) == false ){ - debug("New client has registered that we have not seen before: %s", desktop ); + debug("New client has registered that we have not seen before: %s", dbus_name ); PlayerController ctrl = new PlayerController ( this.root_menu, app_info, dbus_name, @@ -108,8 +108,8 @@ public class MusicPlayerBridge : GLib.Object } else{ this.registered_clients[mpris_key].update_state ( PlayerController.state.READY ); - this.registered_clients[mpris_key].activate ( ); - debug("Application has already registered - awaken the hibernation: %s \n", path); + this.registered_clients[mpris_key].activate ( dbus_name ); + debug("Application has already registered - awaken the hibernation: %s \n", dbus_name ); } } diff --git a/src/player-controller.vala b/src/player-controller.vala index 9e00258..b5c2d76 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -53,7 +53,7 @@ public class PlayerController : GLib.Object public PlayerController(Dbusmenu.Menuitem root, GLib.AppInfo app, - string dbus_name, + string? dbus_name, string icon_name, int offset, state initial_state) @@ -78,8 +78,9 @@ public class PlayerController : GLib.Object this.update_layout(); } - public void activate() + public void activate( string dbus_name ) { + this.dbus_name = dbus_name; this.establish_mpris_connection(); } @@ -103,7 +104,7 @@ public class PlayerController : GLib.Object private void establish_mpris_connection() { - if(this.current_state != state.READY){ + if(this.current_state != state.READY && this.dbus_name != null ){ debug("establish_mpris_connection - Not ready to connect"); return; } diff --git a/src/pulse-manager.c b/src/pulse-manager.c index b002094..4443044 100644 --- a/src/pulse-manager.c +++ b/src/pulse-manager.c @@ -65,7 +65,7 @@ void establish_pulse_activities(SoundServiceDbus *service) pa_main_loop = pa_glib_mainloop_new(g_main_context_default()); g_assert(pa_main_loop); pulse_context = pa_context_new(pa_glib_mainloop_get_api(pa_main_loop), - "ayatana.indicator.sound"); + "com.canonical.indicators.sound"); g_assert(pulse_context); sink_hash = g_hash_table_new_full(g_direct_hash, @@ -103,7 +103,7 @@ reconnect_to_pulse() sink_hash = NULL; } pulse_context = pa_context_new( pa_glib_mainloop_get_api( pa_main_loop ), - "ayatana.indicator.sound" ); + "com.canonical.indicators.sound" ); g_assert(pulse_context); sink_hash = g_hash_table_new_full( g_direct_hash, g_direct_equal, NULL, diff --git a/src/sound-service.xml b/src/sound-service.xml index ee19ceb..a552d52 100644 --- a/src/sound-service.xml +++ b/src/sound-service.xml @@ -1,6 +1,6 @@ - - + + -- cgit v1.2.3