aboutsummaryrefslogtreecommitdiff
path: root/src/mpris2-controller.c
diff options
context:
space:
mode:
authorSebastien Bacher <seb128@ubuntu.com>2010-09-08 12:24:23 +0200
committerSebastien Bacher <seb128@ubuntu.com>2010-09-08 12:24:23 +0200
commitb347212eb1cb41fb9739a9873b0ff8eb8abb4b77 (patch)
tree3c9cb3c86b5668c2c03155c60a041f6cc85d28ba /src/mpris2-controller.c
parent80e5ad4f83a8b1218133761de11d433a7854041e (diff)
downloadayatana-indicator-sound-b347212eb1cb41fb9739a9873b0ff8eb8abb4b77.tar.gz
ayatana-indicator-sound-b347212eb1cb41fb9739a9873b0ff8eb8abb4b77.tar.bz2
ayatana-indicator-sound-b347212eb1cb41fb9739a9873b0ff8eb8abb4b77.zip
Import upstream version 0.4.2
Diffstat (limited to 'src/mpris2-controller.c')
-rw-r--r--src/mpris2-controller.c150
1 files changed, 75 insertions, 75 deletions
diff --git a/src/mpris2-controller.c b/src/mpris2-controller.c
index 87ec14a..6aa2be2 100644
--- a/src/mpris2-controller.c
+++ b/src/mpris2-controller.c
@@ -1,4 +1,4 @@
-/* mpris2-controller.c generated by valac 0.9.7, the Vala compiler
+/* mpris2-controller.c generated by valac 0.9.8, the Vala compiler
* generated from mpris2-controller.vala, do not modify */
/*
@@ -103,16 +103,6 @@ typedef struct _PlayerControllerPrivate PlayerControllerPrivate;
typedef struct _PlayerItem PlayerItem;
typedef struct _PlayerItemClass PlayerItemClass;
-#define TYPE_MPRIS_BRIDGE (mpris_bridge_get_type ())
-#define MPRIS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_BRIDGE, MprisBridge))
-#define MPRIS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS_BRIDGE, MprisBridgeClass))
-#define IS_MPRIS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_BRIDGE))
-#define IS_MPRIS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS_BRIDGE))
-#define MPRIS_BRIDGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS_BRIDGE, MprisBridgeClass))
-
-typedef struct _MprisBridge MprisBridge;
-typedef struct _MprisBridgeClass MprisBridgeClass;
-
#define PLAYER_CONTROLLER_TYPE_WIDGET_ORDER (player_controller_widget_order_get_type ())
#define TYPE_TRANSPORT_MENUITEM (transport_menuitem_get_type ())
@@ -124,6 +114,7 @@ typedef struct _MprisBridgeClass MprisBridgeClass;
typedef struct _TransportMenuitem TransportMenuitem;
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)))
@@ -204,7 +195,7 @@ struct _PlayerController {
PlayerControllerPrivate * priv;
gint current_state;
GeeArrayList* custom_items;
- MprisBridge* mpris_bridge;
+ Mpris2Controller* mpris_bridge;
};
struct _PlayerControllerClass {
@@ -357,11 +348,11 @@ enum {
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);
static GValue* _g_value_dup (GValue* self);
static gint mpris2_controller_determine_play_state (Mpris2Controller* self, const char* status);
-PlayerController* mpris2_controller_get_owner (Mpris2Controller* self);
GType player_item_get_type (void) G_GNUC_CONST;
-GType mpris_bridge_get_type (void) G_GNUC_CONST;
GType player_controller_widget_order_get_type (void) G_GNUC_CONST;
GType transport_menuitem_get_type (void) G_GNUC_CONST;
void transport_menuitem_change_play_state (TransportMenuitem* self, gint state);
@@ -369,12 +360,13 @@ 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);
+static void _vala_GValue_free (GValue* self);
MprisPlayer* mpris2_controller_get_player (Mpris2Controller* self);
static char** _vala_array_dup1 (char** self, int length);
void mpris2_controller_initial_update (Mpris2Controller* self);
GType transport_menuitem_action_get_type (void) G_GNUC_CONST;
-void mpris2_controller_transport_event (Mpris2Controller* self, TransportMenuitemaction command);
-void mpris2_controller_set_position (Mpris2Controller* self, double position);
+void mpris2_controller_transport_update (Mpris2Controller* self, TransportMenuitemaction command);
+void mpris2_controller_set_track_position (Mpris2Controller* self, double position);
void mpris2_controller_onSeeked (Mpris2Controller* self, gint64 position);
gboolean mpris2_controller_connected (Mpris2Controller* self);
MprisRoot* mpris2_controller_get_mpris2_root (Mpris2Controller* self);
@@ -385,7 +377,6 @@ static void mpris2_controller_set_player (Mpris2Controller* self, MprisPlayer* v
static void mpris2_controller_set_owner (Mpris2Controller* self, PlayerController* value);
FreeDesktopProperties* mpris2_controller_get_properties_interface (Mpris2Controller* self);
static void mpris2_controller_set_properties_interface (Mpris2Controller* self, FreeDesktopProperties* value);
-const char* player_controller_get_name (PlayerController* self);
static void _mpris2_controller_onSeeked_mpris_player_seeked (MprisPlayer* _sender, gint64 new_position, gpointer self);
static void _mpris2_controller_property_changed_cb_free_desktop_properties_properties_changed (FreeDesktopProperties* _sender, const char* source, GHashTable* changed_properties, char** invalid, int invalid_length1, gpointer self);
static GObject * mpris2_controller_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
@@ -4669,21 +4660,30 @@ static gpointer __g_value_dup0 (gpointer self) {
}
+static void _vala_GValue_free (GValue* self) {
+ g_value_unset (self);
+ g_free (self);
+}
+
+
void mpris2_controller_property_changed_cb (Mpris2Controller* self, const char* interface_source, GHashTable* changed_properties, char** invalid, int invalid_length1) {
- gboolean _tmp0_ = FALSE;
+ 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);
g_return_if_fail (changed_properties != NULL);
- g_debug ("mpris2-controller.vala:99: properties-changed for interface %s", interface_source);
+ g_debug ("mpris2-controller.vala:99: 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_);
if (changed_properties == NULL) {
- _tmp0_ = TRUE;
+ _tmp1_ = TRUE;
} else {
- _tmp0_ = g_str_has_prefix (interface_source, MPRIS2_CONTROLLER_root_interface) == FALSE;
+ _tmp1_ = g_str_has_prefix (interface_source, MPRIS2_CONTROLLER_root_interface) == FALSE;
}
- if (_tmp0_) {
+ if (_tmp1_) {
g_warning ("mpris2-controller.vala:101: Property-changed hash is null or this is a" \
"n interface that concerns us");
return;
@@ -4692,13 +4692,13 @@ void mpris2_controller_property_changed_cb (Mpris2Controller* self, const char*
if (play_v != NULL) {
char* state;
gint p;
- PlayerItem* _tmp1_;
- TransportMenuitem* _tmp2_;
+ PlayerItem* _tmp2_;
+ TransportMenuitem* _tmp3_;
state = g_strdup (g_value_get_string (play_v));
g_debug ("mpris2-controller.vala:107: new playback state = %s", state);
p = mpris2_controller_determine_play_state (self, state);
- 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_);
+ 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"));
@@ -4710,22 +4710,22 @@ void mpris2_controller_property_changed_cb (Mpris2Controller* self, const char*
meta_v = __g_value_dup0 ((GValue*) g_hash_table_lookup (changed_properties, "Metadata"));
if (meta_v != NULL) {
GHashTable* changed_updates;
- PlayerItem* _tmp3_;
- GeeHashSet* _tmp4_;
- PlayerItem* _tmp5_;
- GeeHashSet* _tmp6_;
+ PlayerItem* _tmp4_;
+ GeeHashSet* _tmp5_;
+ PlayerItem* _tmp6_;
+ GeeHashSet* _tmp7_;
changed_updates = mpris2_controller_clean_metadata (self);
- player_item_reset (_tmp3_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), _tmp4_ = metadata_menuitem_attributes_format ());
+ 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_);
_g_object_unref0 (_tmp4_);
- _g_object_unref0 (_tmp3_);
- player_item_update (_tmp5_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), changed_updates, _tmp6_ = metadata_menuitem_attributes_format ());
+ 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_);
_g_object_unref0 (_tmp6_);
- _g_object_unref0 (_tmp5_);
_g_hash_table_unref0 (changed_updates);
}
- _g_free0 (meta_v);
- _g_free0 (pos_v);
- _g_free0 (play_v);
+ __vala_GValue_free0 (meta_v);
+ __vala_GValue_free0 (pos_v);
+ __vala_GValue_free0 (play_v);
}
@@ -4779,8 +4779,8 @@ static GHashTable* mpris2_controller_clean_metadata (Mpris2Controller* self) {
g_hash_table_replace (changed_updates, g_strdup ("mpris:length"), (_tmp11_ = g_new0 (GValue, 1), g_value_init (_tmp11_, G_TYPE_INT64), g_value_set_int64 (_tmp11_, duration / 1000000), _tmp11_));
}
result = changed_updates;
- _g_free0 (length_v);
- _g_free0 (artist_v);
+ __vala_GValue_free0 (length_v);
+ __vala_GValue_free0 (artist_v);
return result;
}
@@ -4837,7 +4837,7 @@ void mpris2_controller_initial_update (Mpris2Controller* self) {
}
-void mpris2_controller_transport_event (Mpris2Controller* self, TransportMenuitemaction command) {
+void mpris2_controller_transport_update (Mpris2Controller* self, TransportMenuitemaction command) {
GError * _inner_error_ = NULL;
g_return_if_fail (self != NULL);
g_debug ("mpris2-controller.vala:176: transport_event input = %i", (gint) command);
@@ -4847,15 +4847,15 @@ void mpris2_controller_transport_event (Mpris2Controller* self, TransportMenuite
mpris_player_PlayPause (self->priv->_player, &_inner_error_);
if (_inner_error_ != NULL) {
if (_inner_error_->domain == DBUS_GERROR) {
- goto __catch2_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_);
return;
}
}
- goto __finally2;
- __catch2_dbus_gerror:
+ goto __finally5;
+ __catch5_dbus_gerror:
{
GError * _error_;
_error_ = _inner_error_;
@@ -4866,7 +4866,7 @@ void mpris2_controller_transport_event (Mpris2Controller* self, TransportMenuite
_g_error_free0 (_error_);
}
}
- __finally2:
+ __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_);
@@ -4878,15 +4878,15 @@ void mpris2_controller_transport_event (Mpris2Controller* self, TransportMenuite
mpris_player_Previous (self->priv->_player, &_inner_error_);
if (_inner_error_ != NULL) {
if (_inner_error_->domain == DBUS_GERROR) {
- goto __catch3_dbus_gerror;
+ goto __catch6_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_);
return;
}
}
- goto __finally3;
- __catch3_dbus_gerror:
+ goto __finally6;
+ __catch6_dbus_gerror:
{
GError * _error_;
_error_ = _inner_error_;
@@ -4897,7 +4897,7 @@ void mpris2_controller_transport_event (Mpris2Controller* self, TransportMenuite
_g_error_free0 (_error_);
}
}
- __finally3:
+ __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_);
@@ -4909,15 +4909,15 @@ void mpris2_controller_transport_event (Mpris2Controller* self, TransportMenuite
mpris_player_Next (self->priv->_player, &_inner_error_);
if (_inner_error_ != NULL) {
if (_inner_error_->domain == DBUS_GERROR) {
- goto __catch4_dbus_gerror;
+ goto __catch7_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_);
return;
}
}
- goto __finally4;
- __catch4_dbus_gerror:
+ goto __finally7;
+ __catch7_dbus_gerror:
{
GError * _error_;
_error_ = _inner_error_;
@@ -4928,7 +4928,7 @@ void mpris2_controller_transport_event (Mpris2Controller* self, TransportMenuite
_g_error_free0 (_error_);
}
}
- __finally4:
+ __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_);
@@ -4944,7 +4944,7 @@ void mpris2_controller_transport_event (Mpris2Controller* self, TransportMenuite
TODO: SetPosition on the player object is not working with rhythmbox,
runtime error - "dbus function not supported"
*/
-void mpris2_controller_set_position (Mpris2Controller* self, double position) {
+void mpris2_controller_set_track_position (Mpris2Controller* self, double position) {
GHashTable* _tmp0_;
GValue* _tmp1_;
GValue* time_value;
@@ -4960,7 +4960,7 @@ void mpris2_controller_set_position (Mpris2Controller* self, double position) {
if (time_value == NULL) {
g_warning ("mpris2-controller.vala:215: Can't fetch the duration of the track ther" \
"efore cant set the position");
- _g_free0 (time_value);
+ __vala_GValue_free0 (time_value);
return;
}
total_time = g_value_get_int64 (time_value);
@@ -4976,33 +4976,33 @@ void mpris2_controller_set_position (Mpris2Controller* self, double position) {
mpris_player_SetPosition (self->priv->_player, path, (gint64) new_time_position, &_inner_error_);
if (_inner_error_ != NULL) {
if (_inner_error_->domain == DBUS_GERROR) {
- goto __catch5_dbus_gerror;
+ goto __catch8_dbus_gerror;
}
_g_free0 (path);
- _g_free0 (v);
- _g_free0 (time_value);
+ __vala_GValue_free0 (v);
+ __vala_GValue_free0 (time_value);
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_);
return;
}
}
- goto __finally5;
- __catch5_dbus_gerror:
+ goto __finally8;
+ __catch8_dbus_gerror:
{
GError * e;
e = _inner_error_;
_inner_error_ = NULL;
{
- g_error ("mpris2-controller.vala:234: DBus Error calling the player objects SetP" \
+ g_error ("mpris2-controller.vala:232: DBus Error calling the player objects SetP" \
"osition method %s", e->message);
_g_error_free0 (e);
}
}
- __finally5:
+ __finally8:
if (_inner_error_ != NULL) {
_g_free0 (path);
- _g_free0 (v);
- _g_free0 (time_value);
+ __vala_GValue_free0 (v);
+ __vala_GValue_free0 (time_value);
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;
@@ -5010,14 +5010,14 @@ void mpris2_controller_set_position (Mpris2Controller* self, double position) {
_g_free0 (path);
}
}
- _g_free0 (v);
- _g_free0 (time_value);
+ __vala_GValue_free0 (v);
+ __vala_GValue_free0 (time_value);
}
void mpris2_controller_onSeeked (Mpris2Controller* self, gint64 position) {
g_return_if_fail (self != NULL);
- g_debug ("mpris2-controller.vala:242: Seeked signal callback with pos = %i", ((gint) position) / 1000);
+ g_debug ("mpris2-controller.vala:240: Seeked signal callback with pos = %i", ((gint) position) / 1000);
}
@@ -5061,26 +5061,26 @@ void mpris2_controller_expose (Mpris2Controller* self) {
mpris_root_Raise (self->priv->_mpris2_root, &_inner_error_);
if (_inner_error_ != NULL) {
if (_inner_error_->domain == DBUS_GERROR) {
- goto __catch6_dbus_gerror;
+ goto __catch9_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_);
return;
}
}
- goto __finally6;
- __catch6_dbus_gerror:
+ goto __finally9;
+ __catch9_dbus_gerror:
{
GError * e;
e = _inner_error_;
_inner_error_ = NULL;
{
- g_error ("mpris2-controller.vala:267: Exception thrown while calling root functi" \
+ g_error ("mpris2-controller.vala:263: Exception thrown while calling root functi" \
"on Raise - %s", e->message);
_g_error_free0 (e);
}
}
- __finally6:
+ __finally9:
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_);
@@ -5206,7 +5206,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 __catch7_dbus_gerror;
+ goto __catch10_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_);
@@ -5240,8 +5240,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 __finally7;
- __catch7_dbus_gerror:
+ goto __finally10;
+ __catch10_dbus_gerror:
{
GError * e;
e = _inner_error_;
@@ -5251,7 +5251,7 @@ static GObject * mpris2_controller_constructor (GType type, guint n_construct_pr
_g_error_free0 (e);
}
}
- __finally7:
+ __finally10:
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_);