diff options
-rwxr-xr-x | configure | 20 | ||||
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | debian/changelog | 7 | ||||
-rw-r--r-- | src/mpris2-controller.c | 64 | ||||
-rw-r--r-- | src/mpris2-controller.vala | 6 | ||||
-rw-r--r-- | src/music-player-bridge.c | 63 | ||||
-rw-r--r-- | src/music-player-bridge.h | 6 | ||||
-rw-r--r-- | src/music-player-bridge.vala | 2 | ||||
-rw-r--r-- | src/player-controller.c | 50 | ||||
-rw-r--r-- | src/player-controller.vala | 3 |
10 files changed, 131 insertions, 94 deletions
@@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.67 for indicator-sound 0.4.8. +# Generated by GNU Autoconf 2.67 for indicator-sound 0.4.9. # # Report bugs to <conor.curran@canonical.com>. # @@ -761,8 +761,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='indicator-sound' PACKAGE_TARNAME='indicator-sound' -PACKAGE_VERSION='0.4.8' -PACKAGE_STRING='indicator-sound 0.4.8' +PACKAGE_VERSION='0.4.9' +PACKAGE_STRING='indicator-sound 0.4.9' PACKAGE_BUGREPORT='conor.curran@canonical.com' PACKAGE_URL='' @@ -1560,7 +1560,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures indicator-sound 0.4.8 to adapt to many kinds of systems. +\`configure' configures indicator-sound 0.4.9 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1630,7 +1630,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of indicator-sound 0.4.8:";; + short | recursive ) echo "Configuration of indicator-sound 0.4.9:";; esac cat <<\_ACEOF @@ -1761,7 +1761,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -indicator-sound configure 0.4.8 +indicator-sound configure 0.4.9 generated by GNU Autoconf 2.67 Copyright (C) 2010 Free Software Foundation, Inc. @@ -2130,7 +2130,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by indicator-sound $as_me 0.4.8, which was +It was created by indicator-sound $as_me 0.4.9, which was generated by GNU Autoconf 2.67. Invocation command line was $ $0 $@ @@ -2950,7 +2950,7 @@ fi # Define the identity of the package. PACKAGE=indicator-sound - VERSION=0.4.8 + VERSION=0.4.9 cat >>confdefs.h <<_ACEOF @@ -14081,7 +14081,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by indicator-sound $as_me 0.4.8, which was +This file was extended by indicator-sound $as_me 0.4.9, which was generated by GNU Autoconf 2.67. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14147,7 +14147,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -indicator-sound config.status 0.4.8 +indicator-sound config.status 0.4.9 configured by $0, generated by GNU Autoconf 2.67, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 7f25bb3..7a86e4d 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,10 @@ -AC_INIT(indicator-sound, 0.4.8, conor.curran@canonical.com) +AC_INIT(indicator-sound, 0.4.9, conor.curran@canonical.com) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(indicator-sound, 0.4.8) +AM_INIT_AUTOMAKE(indicator-sound, 0.4.9) AM_MAINTAINER_MODE diff --git a/debian/changelog b/debian/changelog index 69bf895..2d31f4a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +indicator-sound (0.4.9-0ubuntu1) maverick-proposed; urgency=low + + * New upstream release. + - fixes tranlation mpris name regression (LP: #654140) + + -- Ken VanDine <ken.vandine@canonical.com> Thu, 14 Oct 2010 10:40:13 -0400 + indicator-sound (0.4.8-0ubuntu1) maverick-proposed; urgency=low * New upstream release. diff --git a/src/mpris2-controller.c b/src/mpris2-controller.c index ced6bdb..1ee4ebf 100644 --- a/src/mpris2-controller.c +++ b/src/mpris2-controller.c @@ -406,7 +406,7 @@ Mpris2Controller* mpris2_controller_new (PlayerController* ctrl); Mpris2Controller* mpris2_controller_construct (GType object_type, PlayerController* ctrl); void mpris2_controller_property_changed_cb (Mpris2Controller* self, const char* interface_source, GHashTable* changed_properties, char** invalid, int invalid_length1); PlayerController* mpris2_controller_get_owner (Mpris2Controller* self); -const char* player_controller_get_name (PlayerController* self); +const char* player_controller_get_mpris_name (PlayerController* self); static GValue* _g_value_dup (GValue* self); MprisPlayer* mpris2_controller_get_player (Mpris2Controller* self); GType transport_menuitem_state_get_type (void) G_GNUC_CONST; @@ -4455,22 +4455,20 @@ static void _vala_GValue_free (GValue* self) { void mpris2_controller_property_changed_cb (Mpris2Controller* self, const char* interface_source, GHashTable* changed_properties, char** invalid, int invalid_length1) { - char* _tmp0_; - gboolean _tmp1_ = FALSE; + gboolean _tmp0_ = FALSE; GValue* play_v; GValue* meta_v; g_return_if_fail (self != NULL); g_return_if_fail (interface_source != NULL); g_return_if_fail (changed_properties != NULL); g_debug ("mpris2-controller.vala:95: properties-changed for interface %s and own" \ -"er %s", interface_source, _tmp0_ = g_utf8_strdown (player_controller_get_name (self->priv->_owner), -1)); - _g_free0 (_tmp0_); +"er %s", interface_source, player_controller_get_mpris_name (self->priv->_owner)); if (changed_properties == NULL) { - _tmp1_ = TRUE; + _tmp0_ = TRUE; } else { - _tmp1_ = g_str_has_prefix (interface_source, MPRIS2_CONTROLLER_root_interface) == FALSE; + _tmp0_ = g_str_has_prefix (interface_source, MPRIS2_CONTROLLER_root_interface) == FALSE; } - if (_tmp1_) { + if (_tmp0_) { g_warning ("mpris2-controller.vala:98: Property-changed hash is null or this is an" \ " interface that doesn't concerns us"); return; @@ -4479,29 +4477,29 @@ void mpris2_controller_property_changed_cb (Mpris2Controller* self, const char* if (play_v != NULL) { char* state; TransportMenuitemstate p; - PlayerItem* _tmp2_; - TransportMenuitem* _tmp3_; + PlayerItem* _tmp1_; + TransportMenuitem* _tmp2_; state = mpris_player_get_PlaybackStatus (self->priv->_player); p = (TransportMenuitemstate) mpris2_controller_determine_play_state (self, state); - transport_menuitem_change_play_state (_tmp3_ = (_tmp2_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT), IS_TRANSPORT_MENUITEM (_tmp2_) ? ((TransportMenuitem*) _tmp2_) : NULL), p); - _g_object_unref0 (_tmp3_); + transport_menuitem_change_play_state (_tmp2_ = (_tmp1_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT), IS_TRANSPORT_MENUITEM (_tmp1_) ? ((TransportMenuitem*) _tmp1_) : NULL), p); + _g_object_unref0 (_tmp2_); _g_free0 (state); } meta_v = __g_value_dup0 ((GValue*) g_hash_table_lookup (changed_properties, "Metadata")); if (meta_v != NULL) { GHashTable* changed_updates; PlayerItem* metadata; + GeeHashSet* _tmp3_; GeeHashSet* _tmp4_; GeeHashSet* _tmp5_; - GeeHashSet* _tmp6_; changed_updates = mpris2_controller_clean_metadata (self); metadata = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA); - player_item_reset (metadata, _tmp4_ = metadata_menuitem_attributes_format ()); + player_item_reset (metadata, _tmp3_ = metadata_menuitem_attributes_format ()); + _g_object_unref0 (_tmp3_); + player_item_update (metadata, changed_updates, _tmp4_ = metadata_menuitem_attributes_format ()); _g_object_unref0 (_tmp4_); - player_item_update (metadata, changed_updates, _tmp5_ = metadata_menuitem_attributes_format ()); + dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) metadata, DBUSMENU_MENUITEM_PROP_VISIBLE, player_item_populated (metadata, _tmp5_ = metadata_menuitem_attributes_format ())); _g_object_unref0 (_tmp5_); - dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) metadata, DBUSMENU_MENUITEM_PROP_VISIBLE, player_item_populated (metadata, _tmp6_ = metadata_menuitem_attributes_format ())); - _g_object_unref0 (_tmp6_); _g_object_unref0 (metadata); _g_hash_table_unref0 (changed_updates); } @@ -4759,18 +4757,14 @@ static GObject * mpris2_controller_constructor (GType type, guint n_construct_pr char* _tmp1_; char* _tmp2_; char* _tmp3_; - char* _tmp4_; + MprisRoot* _tmp4_; char* _tmp5_; - MprisRoot* _tmp6_; + char* _tmp6_; char* _tmp7_; char* _tmp8_; char* _tmp9_; - char* _tmp10_; - char* _tmp11_; - char* _tmp12_; - char* _tmp13_; - MprisPlayer* _tmp14_; - FreeDesktopProperties* _tmp15_; + MprisPlayer* _tmp10_; + FreeDesktopProperties* _tmp11_; connection = dbus_g_bus_get (DBUS_BUS_SESSION, &_inner_error_); if (_inner_error_ != NULL) { if (_inner_error_->domain == DBUS_GERROR) { @@ -4779,25 +4773,21 @@ static GObject * mpris2_controller_constructor (GType type, guint n_construct_pr g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); g_clear_error (&_inner_error_); } - mpris2_controller_set_mpris2_root (self, _tmp6_ = mpris_root_dbus_proxy_new (connection, _tmp5_ = g_strconcat (_tmp3_ = g_strconcat (MPRIS2_CONTROLLER_root_interface, ".", NULL), _tmp4_ = g_utf8_strdown (player_controller_get_name (self->priv->_owner), -1), NULL), "/org/mpris/MediaPlayer2")); - _g_object_unref0 (_tmp6_); - _g_free0 (_tmp5_); - _g_free0 (_tmp4_); + mpris2_controller_set_mpris2_root (self, _tmp4_ = mpris_root_dbus_proxy_new (connection, _tmp3_ = g_strconcat (_tmp2_ = g_strconcat (MPRIS2_CONTROLLER_root_interface, ".", NULL), player_controller_get_mpris_name (self->priv->_owner), NULL), "/org/mpris/MediaPlayer2")); + _g_object_unref0 (_tmp4_); _g_free0 (_tmp3_); _g_free0 (_tmp2_); _g_free0 (_tmp1_); _g_free0 (_tmp0_); - mpris2_controller_set_player (self, _tmp14_ = mpris_player_dbus_proxy_new (connection, _tmp13_ = g_strconcat (_tmp11_ = g_strconcat (MPRIS2_CONTROLLER_root_interface, ".", NULL), _tmp12_ = g_utf8_strdown (player_controller_get_name (self->priv->_owner), -1), NULL), "/org/mpris/MediaPlayer2")); - _g_object_unref0 (_tmp14_); - _g_free0 (_tmp13_); - _g_free0 (_tmp12_); - _g_free0 (_tmp11_); - _g_free0 (_tmp10_); + mpris2_controller_set_player (self, _tmp10_ = mpris_player_dbus_proxy_new (connection, _tmp9_ = g_strconcat (_tmp8_ = g_strconcat (MPRIS2_CONTROLLER_root_interface, ".", NULL), player_controller_get_mpris_name (self->priv->_owner), NULL), "/org/mpris/MediaPlayer2")); + _g_object_unref0 (_tmp10_); _g_free0 (_tmp9_); _g_free0 (_tmp8_); _g_free0 (_tmp7_); - mpris2_controller_set_properties_interface (self, _tmp15_ = free_desktop_properties_dbus_proxy_new (connection, "org.freedesktop.Properties.PropertiesChanged", "/org/mpris/MediaPlayer2")); - _g_object_unref0 (_tmp15_); + _g_free0 (_tmp6_); + _g_free0 (_tmp5_); + mpris2_controller_set_properties_interface (self, _tmp11_ = free_desktop_properties_dbus_proxy_new (connection, "org.freedesktop.Properties.PropertiesChanged", "/org/mpris/MediaPlayer2")); + _g_object_unref0 (_tmp11_); g_signal_connect_object (self->priv->_properties_interface, "properties-changed", (GCallback) _mpris2_controller_property_changed_cb_free_desktop_properties_properties_changed, self, 0); _dbus_g_connection_unref0 (connection); } diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala index 29dd4cf..f355d28 100644 --- a/src/mpris2-controller.vala +++ b/src/mpris2-controller.vala @@ -75,10 +75,10 @@ public class Mpris2Controller : GLib.Object construct{ try { var connection = DBus.Bus.get (DBus.BusType.SESSION); - this.mpris2_root = (MprisRoot) connection.get_object (root_interface.concat(".").concat(this.owner.name.down()), + this.mpris2_root = (MprisRoot) connection.get_object (root_interface.concat(".").concat(this.owner.mpris_name), "/org/mpris/MediaPlayer2", root_interface); - this.player = (MprisPlayer) connection.get_object (root_interface.concat(".").concat(this.owner.name.down()), + this.player = (MprisPlayer) connection.get_object (root_interface.concat(".").concat(this.owner.mpris_name), "/org/mpris/MediaPlayer2", root_interface.concat(".Player")); this.properties_interface = (FreeDesktopProperties) connection.get_object("org.freedesktop.Properties.PropertiesChanged", @@ -92,7 +92,7 @@ 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("properties-changed for interface %s and owner %s", interface_source, this.owner.mpris_name); 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"); diff --git a/src/music-player-bridge.c b/src/music-player-bridge.c index 3746bf6..dddaa1a 100644 --- a/src/music-player-bridge.c +++ b/src/music-player-bridge.c @@ -118,13 +118,13 @@ static void _music_player_bridge_on_server_removed_indicate_listener_server_remo static void music_player_bridge_try_to_add_inactive_familiar_clients (MusicPlayerBridge* self); GeeSet* familiar_players_db_records (FamiliarPlayersDB* self); static char* music_player_bridge_truncate_player_name (char* app_info_name); +static char* music_player_bridge_determine_key (char* path); static gint music_player_bridge_calculate_menu_position (MusicPlayerBridge* self); GType player_controller_state_get_type (void) G_GNUC_CONST; -PlayerController* player_controller_new (DbusmenuMenuitem* root, const char* client_name, gint offset, PlayerControllerstate initial_state); -PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, const char* client_name, gint offset, PlayerControllerstate initial_state); +PlayerController* player_controller_new (DbusmenuMenuitem* root, const char* client_name, const char* mpris_name, gint offset, PlayerControllerstate initial_state); +PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, const char* client_name, const char* mpris_name, gint offset, PlayerControllerstate initial_state); void player_controller_set_app_info (PlayerController* self, GAppInfo* value); GAppInfo* player_controller_get_app_info (PlayerController* self); -static char* music_player_bridge_determine_key (char* path); #define PLAYER_CONTROLLER_WIDGET_QUANTITY 4 static gboolean music_player_bridge_server_is_not_of_interest (MusicPlayerBridge* self, const char* type); static void music_player_bridge_desktop_info_callback (MusicPlayerBridge* self, IndicateListenerServer* server, char* path, void* data); @@ -190,9 +190,10 @@ static void music_player_bridge_try_to_add_inactive_familiar_clients (MusicPlaye GDesktopAppInfo* _tmp2_; GAppInfo* app_info; char* _tmp3_; - PlayerController* _tmp4_; + char* _tmp4_; + PlayerController* _tmp5_; PlayerController* ctrl; - char* _tmp5_; + char* _tmp6_; if (!gee_iterator_next (_app_it)) { break; } @@ -213,13 +214,13 @@ static void music_player_bridge_try_to_add_inactive_familiar_clients (MusicPlaye continue; } app_info = _g_object_ref0 ((_tmp2_ = info, G_IS_APP_INFO (_tmp2_) ? ((GAppInfo*) _tmp2_) : NULL)); - ctrl = (_tmp4_ = player_controller_new (self->priv->root_menu, _tmp3_ = music_player_bridge_truncate_player_name (g_strdup (g_app_info_get_name (app_info))), music_player_bridge_calculate_menu_position (self), PLAYER_CONTROLLER_STATE_OFFLINE), _g_free0 (_tmp3_), _tmp4_); + ctrl = (_tmp5_ = player_controller_new (self->priv->root_menu, _tmp3_ = music_player_bridge_truncate_player_name (g_strdup (g_app_info_get_name (app_info))), _tmp4_ = music_player_bridge_determine_key (g_strdup (app)), music_player_bridge_calculate_menu_position (self), PLAYER_CONTROLLER_STATE_OFFLINE), _g_free0 (_tmp4_), _g_free0 (_tmp3_), _tmp5_); player_controller_set_app_info (ctrl, app_info); if (player_controller_get_app_info (ctrl) == NULL) { - g_warning ("music-player-bridge.vala:65: for some reason the app info is null"); + g_warning ("music-player-bridge.vala:66: for some reason the app info is null"); } - gee_abstract_map_set ((GeeAbstractMap*) self->priv->registered_clients, _tmp5_ = music_player_bridge_determine_key (g_strdup (app)), ctrl); - _g_free0 (_tmp5_); + gee_abstract_map_set ((GeeAbstractMap*) self->priv->registered_clients, _tmp6_ = music_player_bridge_determine_key (g_strdup (app)), ctrl); + _g_free0 (_tmp6_); _g_object_unref0 (ctrl); _g_object_unref0 (app_info); _g_object_unref0 (info); @@ -246,7 +247,7 @@ static gint music_player_bridge_calculate_menu_position (MusicPlayerBridge* self void music_player_bridge_on_server_added (MusicPlayerBridge* self, IndicateListenerServer* object, const char* type) { g_return_if_fail (self != NULL); g_return_if_fail (type != NULL); - g_debug ("music-player-bridge.vala:82: MusicPlayerBridge -> on_server_added with" \ + g_debug ("music-player-bridge.vala:83: MusicPlayerBridge -> on_server_added with" \ " value %s", type); if (music_player_bridge_server_is_not_of_interest (self, type)) { return; @@ -285,27 +286,29 @@ static void music_player_bridge_desktop_info_callback (MusicPlayerBridge* self, _tmp1_ = FALSE; } if (_tmp1_) { - PlayerController* ctrl; char* _tmp2_; - g_debug ("music-player-bridge.vala:98: About to store desktop file path: %s", path); + PlayerController* _tmp3_; + PlayerController* ctrl; + char* _tmp4_; + g_debug ("music-player-bridge.vala:99: About to store desktop file path: %s", path); familiar_players_db_insert (bridge->priv->playersDB, path); - ctrl = player_controller_new (bridge->priv->root_menu, name, music_player_bridge_calculate_menu_position (bridge), PLAYER_CONTROLLER_STATE_READY); + ctrl = (_tmp3_ = player_controller_new (bridge->priv->root_menu, name, _tmp2_ = music_player_bridge_determine_key (g_strdup (path)), music_player_bridge_calculate_menu_position (bridge), PLAYER_CONTROLLER_STATE_READY), _g_free0 (_tmp2_), _tmp3_); g_object_set ((GObject*) ctrl, "app_info", app_info, NULL); - gee_abstract_map_set ((GeeAbstractMap*) bridge->priv->registered_clients, _tmp2_ = music_player_bridge_determine_key (g_strdup (path)), ctrl); - _g_free0 (_tmp2_); - g_debug ("music-player-bridge.vala:106: successfully created appinfo and instanc" \ + gee_abstract_map_set ((GeeAbstractMap*) bridge->priv->registered_clients, _tmp4_ = music_player_bridge_determine_key (g_strdup (path)), ctrl); + _g_free0 (_tmp4_); + g_debug ("music-player-bridge.vala:108: successfully created appinfo and instanc" \ "e from path and set it on the respective instance"); _g_object_unref0 (ctrl); } else { char* key; - PlayerController* _tmp3_; - PlayerController* _tmp4_; + PlayerController* _tmp5_; + PlayerController* _tmp6_; key = music_player_bridge_determine_key (g_strdup (path)); - player_controller_update_state (_tmp3_ = (PlayerController*) gee_abstract_map_get ((GeeAbstractMap*) bridge->priv->registered_clients, key), PLAYER_CONTROLLER_STATE_READY); - _g_object_unref0 (_tmp3_); - player_controller_activate (_tmp4_ = (PlayerController*) gee_abstract_map_get ((GeeAbstractMap*) bridge->priv->registered_clients, key)); - _g_object_unref0 (_tmp4_); - g_debug ("music-player-bridge.vala:112: Ignoring desktop file path callback beca" \ + player_controller_update_state (_tmp5_ = (PlayerController*) gee_abstract_map_get ((GeeAbstractMap*) bridge->priv->registered_clients, key), PLAYER_CONTROLLER_STATE_READY); + _g_object_unref0 (_tmp5_); + player_controller_activate (_tmp6_ = (PlayerController*) gee_abstract_map_get ((GeeAbstractMap*) bridge->priv->registered_clients, key)); + _g_object_unref0 (_tmp6_); + g_debug ("music-player-bridge.vala:114: Ignoring desktop file path callback beca" \ "use the db cache file has it already: %s", path); _g_free0 (key); } @@ -319,7 +322,7 @@ static void music_player_bridge_desktop_info_callback (MusicPlayerBridge* self, void music_player_bridge_on_server_removed (MusicPlayerBridge* self, IndicateListenerServer* object, const char* type) { g_return_if_fail (self != NULL); g_return_if_fail (type != NULL); - g_debug ("music-player-bridge.vala:118: MusicPlayerBridge -> on_server_removed w" \ + g_debug ("music-player-bridge.vala:120: MusicPlayerBridge -> on_server_removed w" \ "ith value %s", type); if (music_player_bridge_server_is_not_of_interest (self, type)) { return; @@ -331,12 +334,12 @@ void music_player_bridge_on_server_removed (MusicPlayerBridge* self, IndicateLis char** _tmp0_; char** tmp; tmp = (_tmp1_ = _tmp0_ = g_strsplit (type, ".", 0), tmp_length1 = _vala_array_length (_tmp0_), _tmp_size_ = tmp_length1, _tmp1_); - g_debug ("music-player-bridge.vala:122: attempt to remove %s", tmp[tmp_length1 - 1]); + g_debug ("music-player-bridge.vala:124: attempt to remove %s", tmp[tmp_length1 - 1]); if (tmp_length1 > 0) { PlayerController* _tmp2_; player_controller_hibernate (_tmp2_ = (PlayerController*) gee_abstract_map_get ((GeeAbstractMap*) self->priv->registered_clients, tmp[tmp_length1 - 1])); _g_object_unref0 (_tmp2_); - g_debug ("music-player-bridge.vala:125: Successively offlined client %s", tmp[tmp_length1 - 1]); + g_debug ("music-player-bridge.vala:127: Successively offlined client %s", tmp[tmp_length1 - 1]); } tmp = (_vala_array_free (tmp, tmp_length1, (GDestroyNotify) g_free), NULL); } @@ -352,7 +355,7 @@ static gboolean music_player_bridge_server_is_not_of_interest (MusicPlayerBridge return result; } if (string_contains (type, "music") == FALSE) { - g_debug ("music-player-bridge.vala:133: server is of no interest, it is not an " \ + g_debug ("music-player-bridge.vala:135: server is of no interest, it is not an " \ "music server"); result = TRUE; return result; @@ -379,7 +382,7 @@ GAppInfo* music_player_bridge_create_app_info (const char* path) { g_return_val_if_fail (path != NULL, NULL); info = g_desktop_app_info_new_from_filename (path); if (path == NULL) { - g_warning ("music-player-bridge.vala:149: Could not create a desktopappinfo instan" \ + g_warning ("music-player-bridge.vala:151: Could not create a desktopappinfo instan" \ "ce from app: %s", path); result = NULL; _g_object_unref0 (info); @@ -420,7 +423,7 @@ static char* music_player_bridge_truncate_player_name (char* app_info_name) { char* _tmp4_; _result_ = (_tmp4_ = g_strdup (tokens[0]), _g_free0 (_result_), _tmp4_); } - g_debug ("music-player-bridge.vala:165: truncate player name %s", _result_); + g_debug ("music-player-bridge.vala:167: truncate player name %s", _result_); result = _result_; tokens = (_vala_array_free (tokens, tokens_length1, (GDestroyNotify) g_free), NULL); _g_free0 (app_info_name); @@ -461,7 +464,7 @@ static char* music_player_bridge_determine_key (char* path) { char* _tmp7_; _result_ = (_tmp7_ = g_strdup (temp[0]), _g_free0 (_result_), _tmp7_); } - g_debug ("music-player-bridge.vala:179: determine key result = %s", _result_); + g_debug ("music-player-bridge.vala:181: determine key result = %s", _result_); result = _result_; temp = (_vala_array_free (temp, temp_length1, (GDestroyNotify) g_free), NULL); _g_free0 (filename); diff --git a/src/music-player-bridge.h b/src/music-player-bridge.h index 111a76d..41ea682 100644 --- a/src/music-player-bridge.h +++ b/src/music-player-bridge.h @@ -337,8 +337,8 @@ GType mpris2_controller_get_type (void) G_GNUC_CONST; GType player_controller_widget_order_get_type (void) G_GNUC_CONST; GType player_controller_state_get_type (void) G_GNUC_CONST; #define PLAYER_CONTROLLER_WIDGET_QUANTITY 4 -PlayerController* player_controller_new (DbusmenuMenuitem* root, const char* client_name, gint offset, PlayerControllerstate initial_state); -PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, const char* client_name, gint offset, PlayerControllerstate initial_state); +PlayerController* player_controller_new (DbusmenuMenuitem* root, const char* client_name, const char* mpris_name, gint offset, PlayerControllerstate initial_state); +PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, const char* client_name, const char* mpris_name, gint offset, PlayerControllerstate initial_state); void player_controller_update_state (PlayerController* self, PlayerControllerstate new_state); void player_controller_activate (PlayerController* self); void player_controller_instantiate (PlayerController* self); @@ -348,6 +348,8 @@ void player_controller_update_layout (PlayerController* self); void player_controller_determine_state (PlayerController* self); const char* player_controller_get_name (PlayerController* self); void player_controller_set_name (PlayerController* self, const char* value); +const char* player_controller_get_mpris_name (PlayerController* self); +void player_controller_set_mpris_name (PlayerController* self, const char* value); GAppInfo* player_controller_get_app_info (PlayerController* self); void player_controller_set_app_info (PlayerController* self, GAppInfo* value); gint player_controller_get_menu_offset (PlayerController* self); diff --git a/src/music-player-bridge.vala b/src/music-player-bridge.vala index 9ba4ef6..57f5636 100644 --- a/src/music-player-bridge.vala +++ b/src/music-player-bridge.vala @@ -58,6 +58,7 @@ public class MusicPlayerBridge : GLib.Object GLib.AppInfo app_info = info as GLib.AppInfo; PlayerController ctrl = new PlayerController(this.root_menu, truncate_player_name(app_info.get_name()), + determine_key(app), calculate_menu_position(), PlayerController.state.OFFLINE); ctrl.app_info = app_info; @@ -99,6 +100,7 @@ public class MusicPlayerBridge : GLib.Object bridge.playersDB.insert(path); PlayerController ctrl = new PlayerController(bridge.root_menu, name, + determine_key(path), bridge.calculate_menu_position(), PlayerController.state.READY); ctrl.set("app_info", app_info); diff --git a/src/player-controller.c b/src/player-controller.c index ab05cb3..3eee29a 100644 --- a/src/player-controller.c +++ b/src/player-controller.c @@ -118,6 +118,7 @@ struct _PlayerControllerClass { struct _PlayerControllerPrivate { DbusmenuMenuitem* root_menu; char* _name; + char* _mpris_name; GAppInfo* _app_info; gint _menu_offset; }; @@ -152,16 +153,18 @@ GType mpris2_controller_get_type (void) G_GNUC_CONST; enum { PLAYER_CONTROLLER_DUMMY_PROPERTY, PLAYER_CONTROLLER_NAME, + PLAYER_CONTROLLER_MPRIS_NAME, PLAYER_CONTROLLER_APP_INFO, PLAYER_CONTROLLER_MENU_OFFSET }; GType player_controller_widget_order_get_type (void) G_GNUC_CONST; GType player_controller_state_get_type (void) G_GNUC_CONST; #define PLAYER_CONTROLLER_WIDGET_QUANTITY 4 -PlayerController* player_controller_new (DbusmenuMenuitem* root, const char* client_name, gint offset, PlayerControllerstate initial_state); -PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, const char* client_name, gint offset, PlayerControllerstate initial_state); +PlayerController* player_controller_new (DbusmenuMenuitem* root, const char* client_name, const char* mpris_name, gint offset, PlayerControllerstate initial_state); +PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, const char* client_name, const char* mpris_name, gint offset, PlayerControllerstate initial_state); static char* player_controller_format_client_name (const char* client_name); void player_controller_set_name (PlayerController* self, const char* value); +void player_controller_set_mpris_name (PlayerController* self, const char* value); void player_controller_set_menu_offset (PlayerController* self, gint value); static void player_controller_construct_widgets (PlayerController* self); static void player_controller_establish_mpris_connection (PlayerController* self); @@ -196,6 +199,7 @@ gint player_controller_get_menu_offset (PlayerController* self); gboolean mpris2_controller_connected (Mpris2Controller* self); GType transport_menuitem_state_get_type (void) G_GNUC_CONST; void transport_menuitem_change_play_state (TransportMenuitem* self, TransportMenuitemstate update); +const char* player_controller_get_mpris_name (PlayerController* self); void player_controller_set_app_info (PlayerController* self, GAppInfo* value); static void player_controller_finalize (GObject* obj); static void player_controller_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); @@ -243,7 +247,7 @@ static char* string_strip (const char* self) { } -PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, const char* client_name, gint offset, PlayerControllerstate initial_state) { +PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, const char* client_name, const char* mpris_name, gint offset, PlayerControllerstate initial_state) { PlayerController * self; DbusmenuMenuitem* _tmp0_; char* _tmp1_; @@ -251,11 +255,13 @@ PlayerController* player_controller_construct (GType object_type, DbusmenuMenuit GeeArrayList* _tmp3_; g_return_val_if_fail (root != NULL, NULL); g_return_val_if_fail (client_name != NULL, NULL); + g_return_val_if_fail (mpris_name != NULL, NULL); self = (PlayerController*) g_object_new (object_type, NULL); self->priv->root_menu = (_tmp0_ = _g_object_ref0 (root), _g_object_unref0 (self->priv->root_menu), _tmp0_); player_controller_set_name (self, _tmp2_ = player_controller_format_client_name (_tmp1_ = string_strip (client_name))); _g_free0 (_tmp2_); _g_free0 (_tmp1_); + player_controller_set_mpris_name (self, mpris_name); self->custom_items = (_tmp3_ = gee_array_list_new (TYPE_PLAYER_ITEM, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL), _g_object_unref0 (self->custom_items), _tmp3_); self->current_state = (gint) initial_state; player_controller_set_menu_offset (self, offset); @@ -266,14 +272,14 @@ PlayerController* player_controller_construct (GType object_type, DbusmenuMenuit } -PlayerController* player_controller_new (DbusmenuMenuitem* root, const char* client_name, gint offset, PlayerControllerstate initial_state) { - return player_controller_construct (TYPE_PLAYER_CONTROLLER, root, client_name, offset, initial_state); +PlayerController* player_controller_new (DbusmenuMenuitem* root, const char* client_name, const char* mpris_name, gint offset, PlayerControllerstate initial_state) { + return player_controller_construct (TYPE_PLAYER_CONTROLLER, root, client_name, mpris_name, offset, initial_state); } void player_controller_update_state (PlayerController* self, PlayerControllerstate new_state) { g_return_if_fail (self != NULL); - g_debug ("player-controller.vala:69: update_state - player controller %s : new s" \ + g_debug ("player-controller.vala:72: update_state - player controller %s : new s" \ "tate %i", self->priv->_name, (gint) new_state); self->current_state = (gint) new_state; player_controller_update_layout (self); @@ -289,7 +295,7 @@ void player_controller_activate (PlayerController* self) { void player_controller_instantiate (PlayerController* self) { GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); - g_debug ("player-controller.vala:87: instantiate in player controller for %s", self->priv->_name); + g_debug ("player-controller.vala:90: instantiate in player controller for %s", self->priv->_name); { g_app_info_launch (self->priv->_app_info, NULL, NULL, &_inner_error_); if (_inner_error_ != NULL) { @@ -304,7 +310,7 @@ void player_controller_instantiate (PlayerController* self) { _error_ = _inner_error_; _inner_error_ = NULL; { - g_warning ("player-controller.vala:93: Failed to launch app %s with error message:" \ + g_warning ("player-controller.vala:96: Failed to launch app %s with error message:" \ " %s", self->priv->_name, _error_->message); _g_error_free0 (_error_); } @@ -322,7 +328,7 @@ static void player_controller_establish_mpris_connection (PlayerController* self Mpris2Controller* _tmp0_; g_return_if_fail (self != NULL); if (self->current_state != PLAYER_CONTROLLER_STATE_READY) { - g_debug ("player-controller.vala:100: establish_mpris_connection - Not ready to " \ + g_debug ("player-controller.vala:103: establish_mpris_connection - Not ready to " \ "connect"); return; } @@ -482,7 +488,7 @@ static char* player_controller_format_client_name (const char* client_name) { formatted = (_tmp2_ = g_strconcat (_tmp0_ = g_utf8_strup (client_name, (gssize) 1), _tmp1_ = string_slice (client_name, (glong) 1, string_get_length (client_name)), NULL), _g_free0 (formatted), _tmp2_); _g_free0 (_tmp1_); _g_free0 (_tmp0_); - g_debug ("player-controller.vala:165: PlayerController->format_client_name - : %" \ + g_debug ("player-controller.vala:168: PlayerController->format_client_name - : %" \ "s", formatted); } result = formatted; @@ -526,6 +532,22 @@ void player_controller_set_name (PlayerController* self, const char* value) { } +const char* player_controller_get_mpris_name (PlayerController* self) { + const char* result; + g_return_val_if_fail (self != NULL, NULL); + result = self->priv->_mpris_name; + return result; +} + + +void player_controller_set_mpris_name (PlayerController* self, const char* value) { + char* _tmp0_; + g_return_if_fail (self != NULL); + self->priv->_mpris_name = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_mpris_name), _tmp0_); + g_object_notify ((GObject *) self, "mpris-name"); +} + + GAppInfo* player_controller_get_app_info (PlayerController* self) { GAppInfo* result; g_return_val_if_fail (self != NULL, NULL); @@ -564,6 +586,7 @@ static void player_controller_class_init (PlayerControllerClass * klass) { G_OBJECT_CLASS (klass)->set_property = player_controller_set_property; G_OBJECT_CLASS (klass)->finalize = player_controller_finalize; g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYER_CONTROLLER_NAME, g_param_spec_string ("name", "name", "name", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); + g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYER_CONTROLLER_MPRIS_NAME, g_param_spec_string ("mpris-name", "mpris-name", "mpris-name", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYER_CONTROLLER_APP_INFO, g_param_spec_object ("app-info", "app-info", "app-info", G_TYPE_APP_INFO, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYER_CONTROLLER_MENU_OFFSET, g_param_spec_int ("menu-offset", "menu-offset", "menu-offset", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); } @@ -580,6 +603,7 @@ static void player_controller_finalize (GObject* obj) { self = PLAYER_CONTROLLER (obj); _g_object_unref0 (self->priv->root_menu); _g_free0 (self->priv->_name); + _g_free0 (self->priv->_mpris_name); _g_object_unref0 (self->custom_items); _g_object_unref0 (self->mpris_bridge); _g_object_unref0 (self->priv->_app_info); @@ -606,6 +630,9 @@ static void player_controller_get_property (GObject * object, guint property_id, case PLAYER_CONTROLLER_NAME: g_value_set_string (value, player_controller_get_name (self)); break; + case PLAYER_CONTROLLER_MPRIS_NAME: + g_value_set_string (value, player_controller_get_mpris_name (self)); + break; case PLAYER_CONTROLLER_APP_INFO: g_value_set_object (value, player_controller_get_app_info (self)); break; @@ -626,6 +653,9 @@ static void player_controller_set_property (GObject * object, guint property_id, case PLAYER_CONTROLLER_NAME: player_controller_set_name (self, g_value_get_string (value)); break; + case PLAYER_CONTROLLER_MPRIS_NAME: + player_controller_set_mpris_name (self, g_value_get_string (value)); + break; case PLAYER_CONTROLLER_APP_INFO: player_controller_set_app_info (self, g_value_get_object (value)); break; diff --git a/src/player-controller.vala b/src/player-controller.vala index d5b79e7..ad8e989 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -44,6 +44,7 @@ public class PlayerController : GLib.Object private Dbusmenu.Menuitem root_menu; public string name { get; set;} + public string mpris_name { get; set;} public ArrayList<PlayerItem> custom_items; public Mpris2Controller mpris_bridge; public AppInfo? app_info { get; set;} @@ -51,11 +52,13 @@ public class PlayerController : GLib.Object public PlayerController(Dbusmenu.Menuitem root, string client_name, + string mpris_name, int offset, state initial_state) { this.root_menu = root; this.name = format_client_name(client_name.strip()); + this.mpris_name = mpris_name; this.custom_items = new ArrayList<PlayerItem>(); this.current_state = initial_state; this.menu_offset = offset; |