diff options
author | Conor Curran <conor.curran@canonical.com> | 2010-09-13 15:42:29 +0100 |
---|---|---|
committer | Conor Curran <conor.curran@canonical.com> | 2010-09-13 15:42:29 +0100 |
commit | 410f37142bb9bc5f306b58292dcb8b975f52c9aa (patch) | |
tree | 6cdc99c8d3746c52ba968745e5c68a7bcff42286 /src | |
parent | af31c744cee14a2fadac8f72111f1b422de9f7a7 (diff) | |
parent | ee3d307dffee6f7ce5cdd09ba8d34c846f66596b (diff) | |
download | ayatana-indicator-sound-410f37142bb9bc5f306b58292dcb8b975f52c9aa.tar.gz ayatana-indicator-sound-410f37142bb9bc5f306b58292dcb8b975f52c9aa.tar.bz2 ayatana-indicator-sound-410f37142bb9bc5f306b58292dcb8b975f52c9aa.zip |
merged properties-changed fix and scrub complete removal
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 3 | ||||
-rw-r--r-- | src/indicator-sound.c | 23 | ||||
-rw-r--r-- | src/mpris2-controller.vala | 49 | ||||
-rw-r--r-- | src/transport-widget.c | 1 |
4 files changed, 4 insertions, 72 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index e85ed93..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 \ @@ -62,7 +60,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/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 <http://www.gnu.org/licenses/>. #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); @@ -297,26 +294,6 @@ new_title_widget(DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbusmenu } 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) { g_debug("indicator-sound: new_volume_slider_widget"); diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala index 5f284b2..bab20ae 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: @@ -84,10 +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(root_interface.concat(".").concat(this.owner.name.down()), - "/org/mpris/MediaPlayer2"); + 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) { @@ -98,16 +95,14 @@ public class Mpris2Controller : GLib.Object public void property_changed_cb(string interface_source, HashTable<string, Value?> 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 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"); 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); @@ -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); |