aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2011-06-22 14:18:38 +0200
committerConor Curran <conor.curran@canonical.com>2011-06-22 14:18:38 +0200
commit01fc374f65b6c552891d3f0d2dad5c7eb8031596 (patch)
treeb4015c076733c7c8aa5d57f6dffeaed7a172aa75 /src
parent83240c1cfd0c46bf46d616088d5d9ad12f3e2730 (diff)
downloadayatana-indicator-sound-01fc374f65b6c552891d3f0d2dad5c7eb8031596.tar.gz
ayatana-indicator-sound-01fc374f65b6c552891d3f0d2dad5c7eb8031596.tar.bz2
ayatana-indicator-sound-01fc374f65b6c552891d3f0d2dad5c7eb8031596.zip
properly plug the track / player specific together
Diffstat (limited to 'src')
-rw-r--r--src/music-player-bridge.vala11
-rw-r--r--src/player-controller.vala19
-rw-r--r--src/sound-service-dbus.c2
-rw-r--r--src/sound-service.c8
4 files changed, 26 insertions, 14 deletions
diff --git a/src/music-player-bridge.vala b/src/music-player-bridge.vala
index 3cda638..727c36b 100644
--- a/src/music-player-bridge.vala
+++ b/src/music-player-bridge.vala
@@ -158,25 +158,26 @@ public class MusicPlayerBridge : GLib.Object
this.watcher.client_disappeared.connect (this.client_has_vanished);
}
- public void enable_player_specific_items_for_client (string desktop_id)
+ public void enable_player_specific_items_for_client (string object_path,
+ string desktop_id)
{
// TODO
}
- public void enable_track_specific_items_for_client (string desktop_id)
+ public void enable_track_specific_items_for_client (string object_path,
+ string desktop_id)
{
var mpris_key = determine_key ( desktop_id );
if (this.registered_clients.has_key (mpris_key) == false){
warning ("we don't have a client with desktop id %s registered", desktop_id);
return;
}
- this.registered_clients[mpris_key].enable_track_specific_items();
+ this.registered_clients[mpris_key].enable_track_specific_items(object_path);
}
private static AppInfo? create_app_info ( string desktop )
{
- DesktopAppInfo info = new DesktopAppInfo ( desktop ) ;
-
+ DesktopAppInfo info = new DesktopAppInfo ( desktop );
if ( desktop == null || info == null ){
warning ( "Could not create a desktopappinfo instance from app: %s", desktop );
return null;
diff --git a/src/player-controller.vala b/src/player-controller.vala
index 52adb23..e988682 100644
--- a/src/player-controller.vala
+++ b/src/player-controller.vala
@@ -51,6 +51,7 @@ public class PlayerController : GLib.Object
public int menu_offset { get; set;}
public string icon_name { get; set; }
public bool? use_playlists;
+ public Client track_specific_client;
public PlayerController(Dbusmenu.Menuitem root,
GLib.AppInfo app,
@@ -107,12 +108,19 @@ public class PlayerController : GLib.Object
}
}
- public void enable_track_specific_items()
+ public void enable_track_specific_items (string object_path)
{
debug ("enable_track_specific_items");
- TrackSpecificMenuitem menuitem = this.custom_items[widget_order.TRACK_SPECIFIC] as TrackSpecificMenuitem;
+ track_specific_client = new Client (this.dbus_name, object_path);
+ track_specific_client.new_menuitem.connect (on_new_track_specific_menuitem);
+ /*TrackSpecificMenuitem menuitem = this.custom_items[widget_order.TRACK_SPECIFIC] as TrackSpecificMenuitem;
menuitem.root_item.property_set_bool (MENUITEM_PROP_VISIBLE, true);
- menuitem.root_item.property_set_bool (MENUITEM_PROP_ENABLED, true);
+ menuitem.root_item.property_set_bool (MENUITEM_PROP_ENABLED, true);*/
+ }
+
+ private void on_new_track_specific_menuitem (GLib.Object item)
+ {
+ debug ("New track specific item for %s", this.app_info.get_name());
}
private void establish_mpris_connection()
@@ -123,9 +131,8 @@ public class PlayerController : GLib.Object
}
debug ( " establish mpris connection - use playlists value = %s ",
this.use_playlists.to_string() );
-
- this.mpris_bridge = new Mpris2Controller(this);
- this.determine_state();
+ this.mpris_bridge = new Mpris2Controller (this);
+ this.determine_state ();
}
public void remove_from_menu()
diff --git a/src/sound-service-dbus.c b/src/sound-service-dbus.c
index d546ceb..980fa05 100644
--- a/src/sound-service-dbus.c
+++ b/src/sound-service-dbus.c
@@ -325,7 +325,7 @@ bus_method_call (GDBusConnection * connection,
gchar* player_object_path;
gchar* player_id;
g_variant_get (params, "(os)", &player_object_path, &player_id);
- //g_debug ("object path = %s and id = %s", player_object_path, player_id);
+ g_debug ("object path = %s and id = %s", player_object_path, player_id);
g_signal_emit (service,
signals[TRACK_SPECIFIC_ITEM],
0,
diff --git a/src/sound-service.c b/src/sound-service.c
index 9e22485..da9b94e 100644
--- a/src/sound-service.c
+++ b/src/sound-service.c
@@ -52,7 +52,9 @@ on_player_specific_item_requested (SoundServiceDbus* sound_service,
const gchar* player_object_path,
gpointer userdata)
{
- music_player_bridge_enable_player_specific_items_for_client (player_bridge, desktop_id);
+ music_player_bridge_enable_player_specific_items_for_client (player_bridge,
+ desktop_id,
+ player_object_path);
g_debug ("ON PLAYER SPECIFIC ITEM REQUESTED %s", desktop_id);
}
@@ -62,7 +64,9 @@ on_track_specific_item_requested (SoundServiceDbus* sound_service,
const gchar* player_object_path,
gpointer userdata)
{
- music_player_bridge_enable_track_specific_items_for_client (player_bridge, desktop_id);
+ music_player_bridge_enable_track_specific_items_for_client (player_bridge,
+ desktop_id,
+ player_object_path);
g_debug ("ON TRACK SPECIFIC ITEM REQUESTED %s", desktop_id);
}