diff options
author | Ken VanDine <ken.vandine@canonical.com> | 2010-06-25 11:19:13 -0400 |
---|---|---|
committer | Ken VanDine <ken.vandine@canonical.com> | 2010-06-25 11:19:13 -0400 |
commit | 2118f6baaf6432811125901f5986e51fa55b4374 (patch) | |
tree | f305ccde8c4ecc67d405618eaca777ff6371211e | |
parent | 288985d7c0a4dcdde22335a31d9eae7f7d5ec215 (diff) | |
download | ayatana-indicator-sound-2118f6baaf6432811125901f5986e51fa55b4374.tar.gz ayatana-indicator-sound-2118f6baaf6432811125901f5986e51fa55b4374.tar.bz2 ayatana-indicator-sound-2118f6baaf6432811125901f5986e51fa55b4374.zip |
Import upstream version 0.3.3
-rwxr-xr-x | configure | 20 | ||||
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | src/mpris-controller.c | 16 | ||||
-rw-r--r-- | src/mpris-controller.vala | 1 | ||||
-rw-r--r-- | src/music-player-bridge.h | 1 | ||||
-rw-r--r-- | src/player-item.c | 74 | ||||
-rw-r--r-- | src/player-item.vala | 10 |
7 files changed, 87 insertions, 39 deletions
@@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.65 for indicator-sound 0.3.2. +# Generated by GNU Autoconf 2.65 for indicator-sound 0.3.3. # # 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.3.2' -PACKAGE_STRING='indicator-sound 0.3.2' +PACKAGE_VERSION='0.3.3' +PACKAGE_STRING='indicator-sound 0.3.3' PACKAGE_BUGREPORT='conor.curran@canonical.com' PACKAGE_URL='' @@ -1555,7 +1555,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.3.2 to adapt to many kinds of systems. +\`configure' configures indicator-sound 0.3.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1625,7 +1625,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of indicator-sound 0.3.2:";; + short | recursive ) echo "Configuration of indicator-sound 0.3.3:";; esac cat <<\_ACEOF @@ -1752,7 +1752,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -indicator-sound configure 0.3.2 +indicator-sound configure 0.3.3 generated by GNU Autoconf 2.65 Copyright (C) 2009 Free Software Foundation, Inc. @@ -2123,7 +2123,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.3.2, which was +It was created by indicator-sound $as_me 0.3.3, which was generated by GNU Autoconf 2.65. Invocation command line was $ $0 $@ @@ -2936,7 +2936,7 @@ fi # Define the identity of the package. PACKAGE=indicator-sound - VERSION=0.3.2 + VERSION=0.3.3 cat >>confdefs.h <<_ACEOF @@ -14073,7 +14073,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.3.2, which was +This file was extended by indicator-sound $as_me 0.3.3, which was generated by GNU Autoconf 2.65. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14139,7 +14139,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.3.2 +indicator-sound config.status 0.3.3 configured by $0, generated by GNU Autoconf 2.65, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 781e815..b302f5b 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,10 @@ -AC_INIT(indicator-sound, 0.3.2, conor.curran@canonical.com) +AC_INIT(indicator-sound, 0.3.3, conor.curran@canonical.com) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(indicator-sound, 0.3.2) +AM_INIT_AUTOMAKE(indicator-sound, 0.3.3) AM_MAINTAINER_MODE diff --git a/src/mpris-controller.c b/src/mpris-controller.c index 075a475..a9a26b2 100644 --- a/src/mpris-controller.c +++ b/src/mpris-controller.c @@ -145,6 +145,7 @@ void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attribu GeeHashSet* metadata_menuitem_attributes_format (void); MprisController* mpris_controller_new (const char* name, PlayerController* controller, const char* mpris_interface); MprisController* mpris_controller_construct (GType object_type, const char* name, PlayerController* controller, const char* mpris_interface); +void player_item_reset (PlayerItem* self, GeeHashSet* attrs); static void _dynamic_Play2 (DBusGProxy* self, GError** error); static void _dynamic_Pause3 (DBusGProxy* self, GError** error); void mpris_controller_toggle_playback (MprisController* self, gboolean state); @@ -292,13 +293,18 @@ MprisController* mpris_controller_new (const char* name, PlayerController* contr static void mpris_controller_onTrackChange (MprisController* self, DBusGProxy* mpris_client, GHashTable* ht) { GeeHashSet* _tmp1_; PlayerItem* _tmp0_; + GeeHashSet* _tmp3_; + PlayerItem* _tmp2_; g_return_if_fail (self != NULL); g_return_if_fail (mpris_client != NULL); g_return_if_fail (ht != NULL); g_debug ("mpris-controller.vala:58: onTrackChange"); - player_item_update (_tmp0_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->controller->custom_items, PLAYER_CONTROLLER_METADATA), ht, _tmp1_ = metadata_menuitem_attributes_format ()); + player_item_reset (_tmp0_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->controller->custom_items, PLAYER_CONTROLLER_METADATA), _tmp1_ = metadata_menuitem_attributes_format ()); _g_object_unref0 (_tmp1_); _g_object_unref0 (_tmp0_); + player_item_update (_tmp2_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->controller->custom_items, PLAYER_CONTROLLER_METADATA), ht, _tmp3_ = metadata_menuitem_attributes_format ()); + _g_object_unref0 (_tmp3_); + _g_object_unref0 (_tmp2_); } @@ -323,7 +329,7 @@ void mpris_controller_toggle_playback (MprisController* self, gboolean state) { g_return_if_fail (self != NULL); _inner_error_ = NULL; if (state == TRUE) { - g_debug ("mpris-controller.vala:70: about to play"); + g_debug ("mpris-controller.vala:71: about to play"); _dynamic_Play2 (self->mpris_player, &_inner_error_); 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); @@ -331,7 +337,7 @@ void mpris_controller_toggle_playback (MprisController* self, gboolean state) { return; } } else { - g_debug ("mpris-controller.vala:74: about to pause"); + g_debug ("mpris-controller.vala:75: about to pause"); _dynamic_Pause3 (self->mpris_player, &_inner_error_); 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); @@ -362,11 +368,11 @@ static void mpris_controller_onStatusChange (MprisController* self, DBusGProxy* PlayerItem* _tmp0_; g_return_if_fail (self != NULL); g_return_if_fail (mpris_client != NULL); - g_debug ("mpris-controller.vala:81: onStatusChange - signal received"); + g_debug ("mpris-controller.vala:82: onStatusChange - signal received"); status = st; ar = (GValueArray*) status; play_state = g_value_get_int (g_value_array_get_nth (ar, (guint) 0)); - g_debug ("mpris-controller.vala:85: onStatusChange - play state %i", play_state); + g_debug ("mpris-controller.vala:86: onStatusChange - play state %i", play_state); ht = g_hash_table_new (g_str_hash, g_str_equal); g_value_init (&v, G_TYPE_INT); g_value_set_int (&v, play_state); diff --git a/src/mpris-controller.vala b/src/mpris-controller.vala index a6d27be..beaf02c 100644 --- a/src/mpris-controller.vala +++ b/src/mpris-controller.vala @@ -56,6 +56,7 @@ public class MprisController : GLib.Object private void onTrackChange(dynamic DBus.Object mpris_client, HashTable<string,Value?> ht) { debug("onTrackChange"); + this.controller.custom_items[this.controller.METADATA].reset(MetadataMenuitem.attributes_format()); this.controller.custom_items[this.controller.METADATA].update(ht, MetadataMenuitem.attributes_format()); } diff --git a/src/music-player-bridge.h b/src/music-player-bridge.h index fd680c1..26fe9c3 100644 --- a/src/music-player-bridge.h +++ b/src/music-player-bridge.h @@ -224,6 +224,7 @@ MprisController* mpris_controller_construct (GType object_type, const char* name void mpris_controller_toggle_playback (MprisController* self, gboolean state); PlayerItem* player_item_new (void); PlayerItem* player_item_construct (GType object_type); +void player_item_reset (PlayerItem* self, GeeHashSet* attrs); void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attributes); void player_item_set_adaptor (PlayerItem* self, MprisController* adaptor); char* player_item_sanitize_string (const char* st); diff --git a/src/player-item.c b/src/player-item.c index 806be04..bd9d78c 100644 --- a/src/player-item.c +++ b/src/player-item.c @@ -26,9 +26,9 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <libdbusmenu-glib/menuitem-proxy.h> #include <libdbusmenu-glib/menuitem.h> #include <libdbusmenu-glib/server.h> +#include <gee.h> #include <stdlib.h> #include <string.h> -#include <gee.h> #define TYPE_PLAYER_ITEM (player_item_get_type ()) @@ -75,7 +75,9 @@ enum { }; PlayerItem* player_item_new (void); PlayerItem* player_item_construct (GType object_type); +void player_item_reset (PlayerItem* self, GeeHashSet* attrs); static gboolean player_item_ensure_valid_updates (GHashTable* data, GeeHashSet* attributes); +static GValue* _g_value_dup (GValue* self); char* player_item_sanitize_string (const char* st); void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attributes); void player_item_set_adaptor (PlayerItem* self, MprisController* adaptor); @@ -102,13 +104,44 @@ PlayerItem* player_item_new (void) { } +void player_item_reset (PlayerItem* self, GeeHashSet* attrs) { + g_return_if_fail (self != NULL); + g_return_if_fail (attrs != NULL); + { + GeeIterator* _s_it; + _s_it = gee_abstract_collection_iterator ((GeeAbstractCollection*) attrs); + while (TRUE) { + char* s; + if (!gee_iterator_next (_s_it)) { + break; + } + s = (char*) gee_iterator_get (_s_it); + g_debug ("player-item.vala:33: attempting to set prop %s to null", s); + dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, s, NULL); + _g_free0 (s); + } + _g_object_unref0 (_s_it); + } +} + + +static GValue* _g_value_dup (GValue* self) { + return g_boxed_copy (G_TYPE_VALUE, self); +} + + +static gpointer __g_value_dup0 (gpointer self) { + return self ? _g_value_dup (self) : NULL; +} + + void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attributes) { g_return_if_fail (self != NULL); g_return_if_fail (data != NULL); g_return_if_fail (attributes != NULL); - g_debug ("player-item.vala:33: PlayerItem::update()"); + g_debug ("player-item.vala:40: PlayerItem::update()"); if (player_item_ensure_valid_updates (data, attributes) == FALSE) { - g_debug ("player-item.vala:35: PlayerItem::Update -> The hashtable update does n" \ + g_debug ("player-item.vala:42: PlayerItem::Update -> The hashtable update does n" \ "ot contain what we were expecting - just leave it!"); return; } @@ -125,35 +158,34 @@ void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attribu char** _tmp3_ = NULL; gint _tmp2_; char* search_key; - GValue _tmp4_ = {0}; - GValue v; + GValue* v; if (!gee_iterator_next (_property_it)) { break; } property = (char*) gee_iterator_get (_property_it); input_keys = (_tmp1_ = _tmp0_ = g_strsplit (property, "-", 0), input_keys_length1 = _vala_array_length (_tmp0_), _input_keys_size_ = input_keys_length1, _tmp1_); search_key = g_strdup ((_tmp3_ = input_keys + (input_keys_length1 - 1), _tmp2_ = input_keys_length1 - (input_keys_length1 - 1), _tmp3_)[0]); - g_debug ("player-item.vala:41: search key = %s", search_key); - v = G_IS_VALUE ((GValue*) g_hash_table_lookup (data, search_key)) ? (g_value_init (&_tmp4_, G_VALUE_TYPE ((GValue*) g_hash_table_lookup (data, search_key))), g_value_copy ((GValue*) g_hash_table_lookup (data, search_key), &_tmp4_), _tmp4_) : (*((GValue*) g_hash_table_lookup (data, search_key))); - if (G_VALUE_HOLDS (&v, G_TYPE_STRING)) { - char* _tmp5_; - g_debug ("player-item.vala:44: with value : %s", g_value_get_string (&v)); - dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, property, _tmp5_ = player_item_sanitize_string (g_value_get_string (&v))); - _g_free0 (_tmp5_); + g_debug ("player-item.vala:48: search key = %s", search_key); + v = __g_value_dup0 ((GValue*) g_hash_table_lookup (data, search_key)); + if (G_VALUE_HOLDS (v, G_TYPE_STRING)) { + char* _tmp4_; + g_debug ("player-item.vala:52: with value : %s", g_value_get_string (v)); + dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, property, _tmp4_ = player_item_sanitize_string (g_value_get_string (v))); + _g_free0 (_tmp4_); } else { - if (G_VALUE_HOLDS (&v, G_TYPE_INT)) { - g_debug ("player-item.vala:48: with value : %i", g_value_get_int (&v)); - dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, property, g_value_get_int (&v)); + if (G_VALUE_HOLDS (v, G_TYPE_INT)) { + g_debug ("player-item.vala:56: with value : %i", g_value_get_int (v)); + dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, property, g_value_get_int (v)); } else { - if (G_VALUE_HOLDS (&v, G_TYPE_BOOLEAN)) { - dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) self, property, g_value_get_boolean (&v)); + if (G_VALUE_HOLDS (v, G_TYPE_BOOLEAN)) { + dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) self, property, g_value_get_boolean (v)); } } } _g_free0 (property); input_keys = (_vala_array_free (input_keys, input_keys_length1, (GDestroyNotify) g_free), NULL); _g_free0 (search_key); - G_IS_VALUE (&v) ? (g_value_unset (&v), NULL) : NULL; + _g_free0 (v); } _g_object_unref0 (_property_it); } @@ -182,7 +214,7 @@ static gboolean player_item_ensure_valid_updates (GHashTable* data, GeeHashSet* return result; } if (g_hash_table_size (data) < gee_collection_get_size ((GeeCollection*) attributes)) { - g_warning ("player-item.vala:70: update hash was too small for the target"); + g_warning ("player-item.vala:78: update hash was too small for the target"); result = FALSE; return result; } @@ -244,7 +276,7 @@ char* player_item_sanitize_string (const char* st) { char* _tmp0_; _result_ = (_tmp0_ = string_slice (_result_, (glong) 7, g_utf8_strlen (_result_, -1)), _g_free0 (_result_), _tmp0_); } - g_debug ("player-item.vala:82: Sanitize string - result = %s", _result_); + g_debug ("player-item.vala:90: Sanitize string - result = %s", _result_); result = _result_; return result; } @@ -274,7 +306,7 @@ PlayerItem* player_item_new_separator_item (void) { static void player_item_real_check_layout (PlayerItem* self) { g_return_if_fail (self != NULL); - g_warning ("player-item.vala:106: this should not be hit"); + g_warning ("player-item.vala:114: this should not be hit"); } diff --git a/src/player-item.vala b/src/player-item.vala index 7fcf912..a5c5512 100644 --- a/src/player-item.vala +++ b/src/player-item.vala @@ -27,6 +27,13 @@ public class PlayerItem : Dbusmenu.Menuitem public PlayerItem() { } + + public void reset(HashSet<string> attrs){ + foreach(string s in attrs){ + debug("attempting to set prop %s to null", s); + this.property_set(s, null); + } + } public void update(HashTable<string, Value?> data, HashSet<string> attributes) { @@ -39,7 +46,8 @@ public class PlayerItem : Dbusmenu.Menuitem string[] input_keys = property.split("-"); string search_key = input_keys[input_keys.length-1 : input_keys.length][0]; debug("search key = %s", search_key); - Value v = data.lookup(search_key); + Value? v = data.lookup(search_key); + if (v.holds (typeof (string))){ debug("with value : %s", v.get_string()); this.property_set(property, this.sanitize_string(v.get_string())); |