From fc3c998e6bbec4528a9b1682665064679ac590ac Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Mon, 13 Sep 2010 11:57:41 +0100 Subject: playback status investigations --- src/mpris2-controller.vala | 6 +++--- src/sound-service.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala index 5f284b2..b6d2333 100644 --- a/src/mpris2-controller.vala +++ b/src/mpris2-controller.vala @@ -1,5 +1,4 @@ /* -This service primarily controls PulseAudio and is driven by the sound indicator menu on the panel. Copyright 2010 Canonical Ltd. Authors: @@ -86,8 +85,9 @@ public class Mpris2Controller : GLib.Object root_interface.concat(".Player")); this.player.Seeked += onSeeked; - this.properties_interface = (FreeDesktopProperties) connection.get_object(root_interface.concat(".").concat(this.owner.name.down()), + this.properties_interface = (FreeDesktopProperties) connection.get_object("org.freedesktop.Properties.PropertiesChanged",//root_interface.concat(".").concat(this.owner.name.down()), "/org/mpris/MediaPlayer2"); + this.properties_interface.PropertiesChanged += property_changed_cb; } catch (DBus.Error e) { @@ -102,7 +102,7 @@ public class Mpris2Controller : GLib.Object debug("invalid length : %i", invalid.length); if(changed_properties == null || interface_source.has_prefix(this.root_interface) == false ){ - warning("Property-changed hash is null or this is an interface that concerns us"); + warning("Property-changed hash is null or this is an interface that doesn't concerns us"); return; } Value? play_v = changed_properties.lookup("PlaybackStatus"); diff --git a/src/sound-service.c b/src/sound-service.c index f19379d..51f5f37 100644 --- a/src/sound-service.c +++ b/src/sound-service.c @@ -41,8 +41,8 @@ service_shutdown (IndicatorService *service, gpointer user_data) if (mainloop != NULL) { g_debug("Service shutdown !"); //TODO: uncomment for release !! - close_pulse_activites(); - g_main_loop_quit(mainloop); + //close_pulse_activites(); + //g_main_loop_quit(mainloop); } return; } -- cgit v1.2.3 From 40cde0089157e7ac2475b32ff2afad9ea031260b Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Mon, 13 Sep 2010 12:15:15 +0100 Subject: playback status fix --- src/mpris2-controller.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala index b6d2333..4717f41 100644 --- a/src/mpris2-controller.vala +++ b/src/mpris2-controller.vala @@ -107,7 +107,7 @@ public class Mpris2Controller : GLib.Object } Value? play_v = changed_properties.lookup("PlaybackStatus"); if(play_v != null){ - string state = play_v.get_string(); + string state = this.player.PlaybackStatus; debug("new playback state = %s", state); TransportMenuitem.state p = (TransportMenuitem.state)this.determine_play_state(state); (this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(p); -- cgit v1.2.3 From 61f5618272f6e9ef010965b546344d67f39650f7 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Mon, 13 Sep 2010 12:49:01 +0100 Subject: removed redundant scrub code --- src/Makefile.am | 1 - src/mpris2-controller.vala | 43 +------------------------------------------ src/transport-widget.c | 1 - 3 files changed, 1 insertion(+), 44 deletions(-) (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index e85ed93..4bc6ff8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -62,7 +62,6 @@ music_bridge_VALASOURCES = \ music-player-bridge.vala \ transport-menu-item.vala \ metadata-menu-item.vala \ - scrub-menu-item.vala \ title-menu-item.vala \ player-controller.vala \ mpris2-controller.vala \ diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala index 4717f41..bab20ae 100644 --- a/src/mpris2-controller.vala +++ b/src/mpris2-controller.vala @@ -83,11 +83,8 @@ public class Mpris2Controller : GLib.Object this.player = (MprisPlayer) connection.get_object (root_interface.concat(".").concat(this.owner.name.down()), "/org/mpris/MediaPlayer2", root_interface.concat(".Player")); - this.player.Seeked += onSeeked; - this.properties_interface = (FreeDesktopProperties) connection.get_object("org.freedesktop.Properties.PropertiesChanged",//root_interface.concat(".").concat(this.owner.name.down()), - "/org/mpris/MediaPlayer2"); - + "/org/mpris/MediaPlayer2"); this.properties_interface.PropertiesChanged += property_changed_cb; } catch (DBus.Error e) { @@ -98,8 +95,6 @@ public class Mpris2Controller : GLib.Object public void property_changed_cb(string interface_source, HashTable changed_properties, string[] invalid ) { debug("properties-changed for interface %s and owner %s", interface_source, this.owner.name.down()); - debug("is the invalid array null : %s", (invalid == null).to_string()); - debug("invalid length : %i", invalid.length); if(changed_properties == null || interface_source.has_prefix(this.root_interface) == false ){ warning("Property-changed hash is null or this is an interface that doesn't concerns us"); @@ -207,42 +202,6 @@ public class Mpris2Controller : GLib.Object } } } - /** - TODO: SetPosition on the player object is not working with rhythmbox, - runtime error - "dbus function not supported" - */ - public void set_track_position(double position) - { - debug("Set position with pos (0-100) %f", position); - Value? time_value = this.player.Metadata.lookup("mpris:length"); - if(time_value == null){ - warning("Can't fetch the duration of the track therefore cant set the position"); - return; - } - // work in microseconds (scale up by 10 TTP-of 6) - int64 total_time = time_value.get_int64(); - debug("total time of track = %i", (int)total_time); - double new_time_position = total_time * (position/100.0); - debug("new position = %f", (new_time_position)); - - Value? v = this.player.Metadata.lookup("mpris:trackid"); - if(v != null){ - if(v.holds (typeof (string))){ - DBus.ObjectPath path = new ObjectPath(v.get_string()); - try{ - this.player.SetPosition(path, (int64)(new_time_position)); - } - catch(DBus.Error e){ - error("DBus Error calling the player objects SetPosition method %s", - e.message); - } - } - } - } - - public void onSeeked(int64 position){ - debug("Seeked signal callback with pos = %i", (int)position/1000); - } public bool connected() { diff --git a/src/transport-widget.c b/src/transport-widget.c index 979f6fd..2dfcbef 100644 --- a/src/transport-widget.c +++ b/src/transport-widget.c @@ -46,7 +46,6 @@ static void transport_widget_finalize (GObject *object); static void transport_widget_set_twin_item(TransportWidget* self, DbusmenuMenuitem* twin_item); - static gboolean transport_widget_expose_event(GtkWidget* widget, GdkEventExpose* event); -- cgit v1.2.3 From ae5428d1367a17f34263b1e2178cab0de5b72e60 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Mon, 13 Sep 2010 13:32:34 +0100 Subject: tidy up --- src/sound-service.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/sound-service.c b/src/sound-service.c index 51f5f37..f19379d 100644 --- a/src/sound-service.c +++ b/src/sound-service.c @@ -41,8 +41,8 @@ service_shutdown (IndicatorService *service, gpointer user_data) if (mainloop != NULL) { g_debug("Service shutdown !"); //TODO: uncomment for release !! - //close_pulse_activites(); - //g_main_loop_quit(mainloop); + close_pulse_activites(); + g_main_loop_quit(mainloop); } return; } -- cgit v1.2.3 From ee3d307dffee6f7ce5cdd09ba8d34c846f66596b Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Mon, 13 Sep 2010 13:35:28 +0100 Subject: removed scrub stuff indicator side --- src/Makefile.am | 2 -- src/indicator-sound.c | 23 ----------------------- 2 files changed, 25 deletions(-) (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index 4bc6ff8..aa5fdc7 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -18,8 +18,6 @@ libsoundmenu_la_SOURCES = \ indicator-sound.c \ title-widget.c \ title-widget.h \ - scrub-widget.c \ - scrub-widget.h \ volume-widget.c \ volume-widget.h \ dbus-shared-names.h \ diff --git a/src/indicator-sound.c b/src/indicator-sound.c index 4cab754..7f3b94b 100644 --- a/src/indicator-sound.c +++ b/src/indicator-sound.c @@ -36,7 +36,6 @@ with this program. If not, see . #include "transport-widget.h" #include "metadata-widget.h" #include "title-widget.h" -#include "scrub-widget.h" #include "volume-widget.h" #include "dbus-shared-names.h" @@ -79,7 +78,6 @@ static void style_changed_cb(GtkWidget *widget, gpointer user_data); static gboolean new_transport_widget(DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client); static gboolean new_metadata_widget(DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client); static gboolean new_title_widget(DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client); -static gboolean new_scrub_bar_widget(DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client); // DBUS communication static DBusGProxy *sound_dbus_proxy = NULL; @@ -219,7 +217,6 @@ get_menu (IndicatorObject * io) dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_TRANSPORT_MENUITEM_TYPE, new_transport_widget); dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_METADATA_MENUITEM_TYPE, new_metadata_widget); dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_TITLE_MENUITEM_TYPE, new_title_widget); - dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_SCRUB_MENUITEM_TYPE, new_scrub_bar_widget); // register Key-press listening on the menu widget as the slider does not allow this. g_signal_connect(menu, "key-press-event", G_CALLBACK(key_press_cb), io); @@ -296,26 +293,6 @@ new_title_widget(DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbusmenu return TRUE; } -static gboolean -new_scrub_bar_widget(DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client) -{ - g_debug("indicator-sound: new_scrub_bar_widget"); - - GtkWidget* scrub_bar = NULL; - - g_return_val_if_fail(DBUSMENU_IS_MENUITEM(newitem), FALSE); - g_return_val_if_fail(DBUSMENU_IS_GTKCLIENT(client), FALSE); - - scrub_bar = scrub_widget_new (newitem); - GtkMenuItem *menu_scrub_widget = GTK_MENU_ITEM(scrub_widget_get_ido_bar(SCRUB_WIDGET(scrub_bar))); - - gtk_widget_show_all(scrub_widget_get_ido_bar(SCRUB_WIDGET(scrub_bar))); - - dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, menu_scrub_widget, parent); - - return TRUE; -} - static gboolean new_volume_slider_widget(DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client) { -- cgit v1.2.3