diff options
-rwxr-xr-x | configure | 20 | ||||
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | debian/changelog | 9 | ||||
-rw-r--r-- | src/familiar-players-db.c | 44 | ||||
-rw-r--r-- | src/fetch-file.c | 16 | ||||
-rw-r--r-- | src/indicator-sound.c | 11 | ||||
-rw-r--r-- | src/mpris2-controller.c | 133 | ||||
-rw-r--r-- | src/mpris2-controller.vala | 64 |
8 files changed, 96 insertions, 205 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.5. +# Generated by GNU Autoconf 2.67 for indicator-sound 0.4.6. # # 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.5' -PACKAGE_STRING='indicator-sound 0.4.5' +PACKAGE_VERSION='0.4.6' +PACKAGE_STRING='indicator-sound 0.4.6' 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.5 to adapt to many kinds of systems. +\`configure' configures indicator-sound 0.4.6 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.5:";; + short | recursive ) echo "Configuration of indicator-sound 0.4.6:";; 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.5 +indicator-sound configure 0.4.6 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.5, which was +It was created by indicator-sound $as_me 0.4.6, 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.5 + VERSION=0.4.6 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.5, which was +This file was extended by indicator-sound $as_me 0.4.6, 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.5 +indicator-sound config.status 0.4.6 configured by $0, generated by GNU Autoconf 2.67, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 23c6767..b4a9e91 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,10 @@ -AC_INIT(indicator-sound, 0.4.5, conor.curran@canonical.com) +AC_INIT(indicator-sound, 0.4.6, conor.curran@canonical.com) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(indicator-sound, 0.4.5) +AM_INIT_AUTOMAKE(indicator-sound, 0.4.6) AM_MAINTAINER_MODE diff --git a/debian/changelog b/debian/changelog index 438f009..92b74c1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +indicator-sound (0.4.6-0ubuntu1) maverick; urgency=low + + * New upstream release. + - indicator crashes in the event of the service crashing (LP: #638891) + - metadata widget should remain hidden if there is no track + data (LP: #637031) + + -- Ken VanDine <ken.vandine@canonical.com> Wed, 15 Sep 2010 08:47:49 -0400 + indicator-sound (0.4.5-0ubuntu1) maverick; urgency=low * New upstream release. diff --git a/src/familiar-players-db.c b/src/familiar-players-db.c index 96c8e32..2556b6c 100644 --- a/src/familiar-players-db.c +++ b/src/familiar-players-db.c @@ -140,10 +140,10 @@ static gboolean familiar_players_db_create_key_file (FamiliarPlayersDB* self) { _tmp1_ = g_key_file_load_from_file (self->priv->key_file, self->priv->file_name, G_KEY_FILE_NONE, &_inner_error_); if (_inner_error_ != NULL) { if (_inner_error_->domain == G_KEY_FILE_ERROR) { - goto __catch10_g_key_file_error; + goto __catch6_g_key_file_error; } if (_inner_error_->domain == G_FILE_ERROR) { - goto __catch10_g_file_error; + goto __catch6_g_file_error; } 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_); @@ -151,8 +151,8 @@ static gboolean familiar_players_db_create_key_file (FamiliarPlayersDB* self) { } _result_ = _tmp1_; } - goto __finally10; - __catch10_g_key_file_error: + goto __finally6; + __catch6_g_key_file_error: { GError * e; e = _inner_error_; @@ -163,8 +163,8 @@ static gboolean familiar_players_db_create_key_file (FamiliarPlayersDB* self) { _g_error_free0 (e); } } - goto __finally10; - __catch10_g_file_error: + goto __finally6; + __catch6_g_file_error: { GError * e; e = _inner_error_; @@ -175,7 +175,7 @@ static gboolean familiar_players_db_create_key_file (FamiliarPlayersDB* self) { _g_error_free0 (e); } } - __finally10: + __finally6: if (_inner_error_ != NULL) { g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); g_clear_error (&_inner_error_); @@ -196,7 +196,7 @@ static gboolean familiar_players_db_check_for_keys (FamiliarPlayersDB* self) { _tmp0_ = g_key_file_has_key (self->priv->key_file, FAMILIAR_PLAYERS_DB_GROUP_NAME, FAMILIAR_PLAYERS_DB_KEY_NAME, &_inner_error_); if (_inner_error_ != NULL) { if (_inner_error_->domain == G_KEY_FILE_ERROR) { - goto __catch11_g_key_file_error; + goto __catch7_g_key_file_error; } 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_); @@ -207,8 +207,8 @@ static gboolean familiar_players_db_check_for_keys (FamiliarPlayersDB* self) { return result; } } - goto __finally11; - __catch11_g_key_file_error: + goto __finally7; + __catch7_g_key_file_error: { GError * e; e = _inner_error_; @@ -219,7 +219,7 @@ static gboolean familiar_players_db_check_for_keys (FamiliarPlayersDB* self) { return result; } } - __finally11: + __finally7: if (_inner_error_ != NULL) { g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); g_clear_error (&_inner_error_); @@ -245,7 +245,7 @@ static gboolean familiar_players_db_load_data_from_key_file (FamiliarPlayersDB* desktops = (_tmp1_ = g_key_file_get_string_list (self->priv->key_file, FAMILIAR_PLAYERS_DB_GROUP_NAME, FAMILIAR_PLAYERS_DB_KEY_NAME, &_tmp0_, &_inner_error_), desktops_length1 = _tmp0_, _desktops_size_ = desktops_length1, _tmp1_); if (_inner_error_ != NULL) { if (_inner_error_->domain == G_KEY_FILE_ERROR) { - goto __catch12_g_key_file_error; + goto __catch8_g_key_file_error; } 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_); @@ -270,8 +270,8 @@ static gboolean familiar_players_db_load_data_from_key_file (FamiliarPlayersDB* desktops = (_vala_array_free (desktops, desktops_length1, (GDestroyNotify) g_free), NULL); return result; } - goto __finally12; - __catch12_g_key_file_error: + goto __finally8; + __catch8_g_key_file_error: { GError * _error_; _error_ = _inner_error_; @@ -283,7 +283,7 @@ static gboolean familiar_players_db_load_data_from_key_file (FamiliarPlayersDB* return result; } } - __finally12: + __finally8: { g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); g_clear_error (&_inner_error_); @@ -338,8 +338,8 @@ static gboolean familiar_players_db_write_db (FamiliarPlayersDB* self) { char* _tmp4_; data = (_tmp4_ = g_key_file_to_data (keyfile, &data_length, NULL), _g_free0 (data), _tmp4_); } - goto __finally13; - __catch13_g_key_file_error: + goto __finally9; + __catch9_g_key_file_error: { GError * e; e = _inner_error_; @@ -354,7 +354,7 @@ static gboolean familiar_players_db_write_db (FamiliarPlayersDB* self) { return result; } } - __finally13: + __finally9: if (_inner_error_ != NULL) { _g_free0 (data); desktops = (_vala_array_free (desktops, desktops_length1, (GDestroyNotify) g_free), NULL); @@ -376,7 +376,7 @@ static gboolean familiar_players_db_write_db (FamiliarPlayersDB* self) { _tmp5_ = g_file_set_contents (self->priv->file_name, data, (gssize) data_length, &_inner_error_); if (_inner_error_ != NULL) { if (_inner_error_->domain == G_FILE_ERROR) { - goto __catch14_g_file_error; + goto __catch10_g_file_error; } _g_free0 (data); desktops = (_vala_array_free (desktops, desktops_length1, (GDestroyNotify) g_free), NULL); @@ -389,8 +389,8 @@ static gboolean familiar_players_db_write_db (FamiliarPlayersDB* self) { g_warning ("familiar-players-db.vala:125: Unable to write out file '%s'", self->priv->file_name); } } - goto __finally14; - __catch14_g_file_error: + goto __finally10; + __catch10_g_file_error: { GError * err; err = _inner_error_; @@ -400,7 +400,7 @@ static gboolean familiar_players_db_write_db (FamiliarPlayersDB* self) { _g_error_free0 (err); } } - __finally14: + __finally10: if (_inner_error_ != NULL) { _g_free0 (data); desktops = (_vala_array_free (desktops, desktops_length1, (GDestroyNotify) g_free), NULL); diff --git a/src/fetch-file.c b/src/fetch-file.c index 4b8941b..4a8d595 100644 --- a/src/fetch-file.c +++ b/src/fetch-file.c @@ -187,14 +187,14 @@ static gboolean fetch_file_fetch_data_co (FetchFileFetchDataData* data) { { data->_tmp0_ = g_file_read (data->self->priv->file, NULL, &data->_inner_error_); if (data->_inner_error_ != NULL) { - goto __catch15_g_error; + goto __catch11_g_error; } data->self->priv->stream = (data->_tmp2_ = g_data_input_stream_new ((GInputStream*) (data->_tmp1_ = data->_tmp0_)), _g_object_unref0 (data->self->priv->stream), data->_tmp2_); _g_object_unref0 (data->_tmp1_); g_data_input_stream_set_byte_order (data->self->priv->stream, G_DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN); } - goto __finally15; - __catch15_g_error: + goto __finally11; + __catch11_g_error: { data->e = data->_inner_error_; data->_inner_error_ = NULL; @@ -203,7 +203,7 @@ static gboolean fetch_file_fetch_data_co (FetchFileFetchDataData* data) { _g_error_free0 (data->e); } } - __finally15: + __finally11: if (data->_inner_error_ != NULL) { g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, data->_inner_error_->message, g_quark_to_string (data->_inner_error_->domain), data->_inner_error_->code); g_clear_error (&data->_inner_error_); @@ -283,7 +283,7 @@ static gboolean fetch_file_read_something_async_co (FetchFileReadSomethingAsyncD _state_1: data->_tmp2_ = g_input_stream_read_finish ((GInputStream*) data->self->priv->stream, data->_res_, &data->_inner_error_); if (data->_inner_error_ != NULL) { - goto __catch16_g_error; + goto __catch12_g_error; } data->bufsize = data->_tmp2_; if (data->bufsize < 1) { @@ -298,8 +298,8 @@ static gboolean fetch_file_read_something_async_co (FetchFileReadSomethingAsyncD g_byte_array_append (data->self->priv->data, data->buffer, data->buffer_length1); } } - goto __finally16; - __catch16_g_error: + goto __finally12; + __catch12_g_error: { data->e = data->_inner_error_; data->_inner_error_ = NULL; @@ -308,7 +308,7 @@ static gboolean fetch_file_read_something_async_co (FetchFileReadSomethingAsyncD _g_error_free0 (data->e); } } - __finally16: + __finally12: if (data->_inner_error_ != NULL) { data->buffer = (g_free (data->buffer), NULL); g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, data->_inner_error_->message, g_quark_to_string (data->_inner_error_->domain), data->_inner_error_->code); diff --git a/src/indicator-sound.c b/src/indicator-sound.c index 0aa93b3..35045d7 100644 --- a/src/indicator-sound.c +++ b/src/indicator-sound.c @@ -365,7 +365,9 @@ connection_changed (IndicatorServiceManager * sm, gboolean connected, gpointer u IndicatorSound* indicator = INDICATOR_SOUND(user_data); fetch_sink_availability_from_dbus(indicator); IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(indicator); - determine_state_from_volume (volume_widget_get_current_volume(priv->volume_widget)); + if(priv->volume_widget != NULL){ + determine_state_from_volume (volume_widget_get_current_volume(priv->volume_widget)); + } } } else{ @@ -557,8 +559,11 @@ fetch_sink_availability_from_dbus(IndicatorSound* self) } IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(self); - GtkWidget* slider_widget = volume_widget_get_ido_slider(VOLUME_WIDGET(priv->volume_widget)); - gtk_widget_set_sensitive(slider_widget, device_available); + + if(priv->volume_widget != NULL){ + GtkWidget* slider_widget = volume_widget_get_ido_slider(VOLUME_WIDGET(priv->volume_widget)); + gtk_widget_set_sensitive(slider_widget, device_available); + } g_free(available_input); g_debug("IndicatorSound::fetch_sink_availability_from_dbus ->%i", device_available); diff --git a/src/mpris2-controller.c b/src/mpris2-controller.c index 945fc7b..ac90fc4 100644 --- a/src/mpris2-controller.c +++ b/src/mpris2-controller.c @@ -122,8 +122,8 @@ typedef struct _TransportMenuitemClass TransportMenuitemClass; #define __vala_GValue_free0(var) ((var == NULL) ? NULL : (var = (_vala_GValue_free (var), NULL))) #define TRANSPORT_MENUITEM_TYPE_ACTION (transport_menuitem_action_get_type ()) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) #define _dbus_g_connection_unref0(var) ((var == NULL) ? NULL : (var = (dbus_g_connection_unref (var), NULL))) +#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) struct _MprisRootIface { GTypeInterface parent_iface; @@ -419,6 +419,7 @@ static GHashTable* mpris2_controller_clean_metadata (Mpris2Controller* self); void player_item_reset (PlayerItem* self, GeeHashSet* attrs); GeeHashSet* metadata_menuitem_attributes_format (void); void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attributes); +gboolean player_item_populated (PlayerItem* self, GeeHashSet* attrs); static void _vala_GValue_free (GValue* self); static char** _vala_array_dup1 (char** self, int length); void mpris2_controller_initial_update (Mpris2Controller* self); @@ -4457,7 +4458,6 @@ void mpris2_controller_property_changed_cb (Mpris2Controller* self, const char* char* _tmp0_; gboolean _tmp1_ = FALSE; GValue* play_v; - GValue* pos_v; GValue* meta_v; g_return_if_fail (self != NULL); g_return_if_fail (interface_source != NULL); @@ -4482,36 +4482,30 @@ void mpris2_controller_property_changed_cb (Mpris2Controller* self, const char* PlayerItem* _tmp2_; TransportMenuitem* _tmp3_; state = mpris_player_get_PlaybackStatus (self->priv->_player); - g_debug ("mpris2-controller.vala:104: new playback state = %s", state); 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_); _g_free0 (state); } - pos_v = __g_value_dup0 ((GValue*) g_hash_table_lookup (changed_properties, "Position")); - if (pos_v != NULL) { - gint64 pos; - pos = g_value_get_int64 (pos_v); - g_debug ("mpris2-controller.vala:112: new position = %i", (gint) pos); - } meta_v = __g_value_dup0 ((GValue*) g_hash_table_lookup (changed_properties, "Metadata")); if (meta_v != NULL) { GHashTable* changed_updates; - PlayerItem* _tmp4_; + PlayerItem* metadata; + GeeHashSet* _tmp4_; GeeHashSet* _tmp5_; - PlayerItem* _tmp6_; - GeeHashSet* _tmp7_; + GeeHashSet* _tmp6_; changed_updates = mpris2_controller_clean_metadata (self); - player_item_reset (_tmp4_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), _tmp5_ = metadata_menuitem_attributes_format ()); - _g_object_unref0 (_tmp5_); + 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 ()); _g_object_unref0 (_tmp4_); - player_item_update (_tmp6_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), changed_updates, _tmp7_ = metadata_menuitem_attributes_format ()); - _g_object_unref0 (_tmp7_); + player_item_update (metadata, changed_updates, _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); } __vala_GValue_free0 (meta_v); - __vala_GValue_free0 (pos_v); __vala_GValue_free0 (play_v); } @@ -4552,7 +4546,7 @@ static GHashTable* mpris2_controller_clean_metadata (Mpris2Controller* self) { artists = (_tmp5_ = (_tmp4_ = (_tmp3_ = g_value_get_boxed ((GValue*) g_hash_table_lookup (_tmp2_ = mpris_player_get_Metadata (self->priv->_player), "xesam:artist")), (_tmp3_ == NULL) ? ((gpointer) _tmp3_) : _vala_array_dup1 (_tmp3_, g_strv_length (g_value_get_boxed ((GValue*) g_hash_table_lookup (_tmp2_ = mpris_player_get_Metadata (self->priv->_player), "xesam:artist"))))), _g_hash_table_unref0 (_tmp2_), _tmp4_), artists_length1 = g_strv_length (g_value_get_boxed ((GValue*) g_hash_table_lookup (_tmp2_ = mpris_player_get_Metadata (self->priv->_player), "xesam:artist"))), _artists_size_ = artists_length1, _tmp5_); display_artists = g_strjoinv (", ", artists); g_hash_table_replace (changed_updates, g_strdup ("xesam:artist"), (_tmp6_ = g_new0 (GValue, 1), g_value_init (_tmp6_, G_TYPE_STRING), g_value_set_string (_tmp6_, display_artists), _tmp6_)); - g_debug ("mpris2-controller.vala:132: artist : %s", display_artists); + g_debug ("mpris2-controller.vala:128: artist : %s", display_artists); _g_free0 (display_artists); artists = (_vala_array_free (artists, artists_length1, (GDestroyNotify) g_free), NULL); } @@ -4587,7 +4581,6 @@ static TransportMenuitemstate mpris2_controller_determine_play_state (Mpris2Cont _tmp0_ = FALSE; } if (_tmp0_) { - g_debug ("mpris2-controller.vala:148: determine play state - state = %s", status); result = TRANSPORT_MENUITEM_STATE_PLAYING; return result; } @@ -4613,7 +4606,6 @@ void mpris2_controller_initial_update (Mpris2Controller* self) { update = mpris2_controller_determine_play_state (self, _tmp2_ = mpris_player_get_PlaybackStatus (self->priv->_player)); _g_free0 (_tmp2_); } - g_debug ("mpris2-controller.vala:163: initial update - play state %i", (gint) update); transport_menuitem_change_play_state (_tmp4_ = (_tmp3_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT), IS_TRANSPORT_MENUITEM (_tmp3_) ? ((TransportMenuitem*) _tmp3_) : NULL), update); _g_object_unref0 (_tmp4_); cleaned_metadata = mpris2_controller_clean_metadata (self); @@ -4625,78 +4617,16 @@ void mpris2_controller_initial_update (Mpris2Controller* self) { void mpris2_controller_transport_update (Mpris2Controller* self, TransportMenuitemaction command) { - GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); - g_debug ("mpris2-controller.vala:173: transport_event input = %i", (gint) command); + g_debug ("mpris2-controller.vala:165: transport_event input = %i", (gint) command); if (command == TRANSPORT_MENUITEM_ACTION_PLAY_PAUSE) { - g_debug ("mpris2-controller.vala:175: transport_event PLAY_PAUSE"); - { - mpris_player_PlayPause (self->priv->_player, NULL, NULL); - } - goto __finally5; - __catch5_dbus_gerror: - { - GError * _error_; - _error_ = _inner_error_; - _inner_error_ = NULL; - { - g_warning ("mpris2-controller.vala:180: DBus Error calling the player objects Play" \ -"Pause method %s", _error_->message); - _g_error_free0 (_error_); - } - } - __finally5: - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } + mpris_player_PlayPause (self->priv->_player, NULL, NULL); } else { if (command == TRANSPORT_MENUITEM_ACTION_PREVIOUS) { - { - mpris_player_Previous (self->priv->_player, NULL, NULL); - } - goto __finally6; - __catch6_dbus_gerror: - { - GError * _error_; - _error_ = _inner_error_; - _inner_error_ = NULL; - { - g_warning ("mpris2-controller.vala:189: DBus Error calling the player objects Prev" \ -"ious method %s", _error_->message); - _g_error_free0 (_error_); - } - } - __finally6: - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } + mpris_player_Previous (self->priv->_player, NULL, NULL); } else { if (command == TRANSPORT_MENUITEM_ACTION_NEXT) { - { - mpris_player_Next (self->priv->_player, NULL, NULL); - } - goto __finally7; - __catch7_dbus_gerror: - { - GError * _error_; - _error_ = _inner_error_; - _inner_error_ = NULL; - { - g_warning ("mpris2-controller.vala:198: DBus Error calling the player objects Next" \ -" method %s", _error_->message); - _g_error_free0 (_error_); - } - } - __finally7: - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } + mpris_player_Next (self->priv->_player, NULL, NULL); } } } @@ -4736,30 +4666,9 @@ gboolean mpris2_controller_was_successfull (Mpris2Controller* self) { void mpris2_controller_expose (Mpris2Controller* self) { - GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); if (mpris2_controller_connected (self) == TRUE) { - { - mpris_root_Raise (self->priv->_mpris2_root, NULL, NULL); - } - goto __finally8; - __catch8_dbus_gerror: - { - GError * e; - e = _inner_error_; - _inner_error_ = NULL; - { - g_error ("mpris2-controller.vala:224: Exception thrown while calling function Ra" \ -"ise - %s", e->message); - _g_error_free0 (e); - } - } - __finally8: - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } + mpris_root_Raise (self->priv->_mpris2_root, NULL, NULL); } } @@ -4869,7 +4778,7 @@ static GObject * mpris2_controller_constructor (GType type, guint n_construct_pr connection = dbus_g_bus_get (DBUS_BUS_SESSION, &_inner_error_); if (_inner_error_ != NULL) { if (_inner_error_->domain == DBUS_GERROR) { - goto __catch9_dbus_gerror; + goto __catch5_dbus_gerror; } 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_); @@ -4896,8 +4805,8 @@ static GObject * mpris2_controller_constructor (GType type, guint n_construct_pr 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); } - goto __finally9; - __catch9_dbus_gerror: + goto __finally5; + __catch5_dbus_gerror: { GError * e; e = _inner_error_; @@ -4907,7 +4816,7 @@ static GObject * mpris2_controller_constructor (GType type, guint n_construct_pr _g_error_free0 (e); } } - __finally9: + __finally5: if (_inner_error_ != NULL) { g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); g_clear_error (&_inner_error_); diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala index 2f5bcde..54e1868 100644 --- a/src/mpris2-controller.vala +++ b/src/mpris2-controller.vala @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ using DBus; - +using Dbusmenu; [DBus (name = "org.mpris.MediaPlayer2")] public interface MprisRoot : DBus.Object { @@ -81,7 +81,7 @@ 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.properties_interface = (FreeDesktopProperties) connection.get_object("org.freedesktop.Properties.PropertiesChanged",//root_interface.concat(".").concat(this.owner.name.down()), + this.properties_interface = (FreeDesktopProperties) connection.get_object("org.freedesktop.Properties.PropertiesChanged", "/org/mpris/MediaPlayer2"); this.properties_interface.PropertiesChanged += property_changed_cb; @@ -101,24 +101,20 @@ public class Mpris2Controller : GLib.Object Value? play_v = changed_properties.lookup("PlaybackStatus"); if(play_v != null){ 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); } - Value? pos_v = changed_properties.lookup("Position"); - if(pos_v != null){ - int64 pos = pos_v.get_int64(); - debug("new position = %i", (int)pos); - } - Value? meta_v = changed_properties.lookup("Metadata"); if(meta_v != null){ - GLib.HashTable<string, Value?> changed_updates = clean_metadata(); - this.owner.custom_items[PlayerController.widget_order.METADATA].reset(MetadataMenuitem.attributes_format()); - this.owner.custom_items[PlayerController.widget_order.METADATA].update(changed_updates, - MetadataMenuitem.attributes_format()); - } + GLib.HashTable<string, Value?> changed_updates = clean_metadata(); + PlayerItem metadata = this.owner.custom_items[PlayerController.widget_order.METADATA]; + metadata.reset(MetadataMenuitem.attributes_format()); + metadata.update(changed_updates, + MetadataMenuitem.attributes_format()); + metadata.property_set_bool(MENUITEM_PROP_VISIBLE, + metadata.populated(MetadataMenuitem.attributes_format())); + } } private GLib.HashTable<string, Value?> clean_metadata() @@ -139,13 +135,11 @@ public class Mpris2Controller : GLib.Object return changed_updates; } - private TransportMenuitem.state determine_play_state(string status){ if(status == null) return TransportMenuitem.state.PAUSED; if(status != null && status == "Playing"){ - debug("determine play state - state = %s", status); return TransportMenuitem.state.PLAYING; } return TransportMenuitem.state.PAUSED; @@ -159,9 +153,7 @@ public class Mpris2Controller : GLib.Object } else{ update = determine_play_state(this.player.PlaybackStatus); - } - debug("initial update - play state %i", (int)update); - + } (this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(update); GLib.HashTable<string, Value?> cleaned_metadata = this.clean_metadata(); this.owner.custom_items[PlayerController.widget_order.METADATA].update(cleaned_metadata, @@ -172,32 +164,13 @@ public class Mpris2Controller : GLib.Object { debug("transport_event input = %i", (int)command); if(command == TransportMenuitem.action.PLAY_PAUSE){ - debug("transport_event PLAY_PAUSE"); - try{ - this.player.PlayPause.begin(); - } - catch(DBus.Error error){ - warning("DBus Error calling the player objects PlayPause method %s", - error.message); - } + this.player.PlayPause.begin(); } else if(command == TransportMenuitem.action.PREVIOUS){ - try{ - this.player.Previous.begin(); - } - catch(DBus.Error error){ - warning("DBus Error calling the player objects Previous method %s", - error.message); - } + this.player.Previous.begin(); } else if(command == TransportMenuitem.action.NEXT){ - try{ - this.player.Next.begin(); - } - catch(DBus.Error error){ - warning("DBus Error calling the player objects Next method %s", - error.message); - } + this.player.Next.begin(); } } @@ -208,7 +181,7 @@ public class Mpris2Controller : GLib.Object public bool was_successfull(){ - if(this.mpris2_root == null ||this.player == null){ + if(this.mpris2_root == null || this.player == null){ return false; } return true; @@ -217,12 +190,7 @@ public class Mpris2Controller : GLib.Object public void expose() { if(this.connected() == true){ - try{ - this.mpris2_root.Raise.begin(); - } - catch(DBus.Error e){ - error("Exception thrown while calling function Raise - %s", e.message); - } + this.mpris2_root.Raise.begin(); } } } |