aboutsummaryrefslogtreecommitdiff
path: root/src/player-item.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/player-item.c')
-rw-r--r--src/player-item.c241
1 files changed, 160 insertions, 81 deletions
diff --git a/src/player-item.c b/src/player-item.c
index fe0d8db..073fd80 100644
--- a/src/player-item.c
+++ b/src/player-item.c
@@ -1,4 +1,4 @@
-/* player-item.c generated by valac 0.10.0, the Vala compiler
+/* player-item.c generated by valac 0.11.2, the Vala compiler
* generated from player-item.vala, do not modify */
/*
@@ -76,7 +76,7 @@ struct _PlayerItemClass {
struct _PlayerItemPrivate {
PlayerController* _owner;
- char* _item_type;
+ gchar* _item_type;
};
@@ -91,38 +91,37 @@ enum {
PLAYER_ITEM_ITEM_TYPE
};
#define PLAYER_ITEM_EMPTY (-1)
-PlayerItem* player_item_new (const char* type);
-PlayerItem* player_item_construct (GType object_type, const char* type);
+PlayerItem* player_item_new (const gchar* type);
+PlayerItem* player_item_construct (GType object_type, const gchar* type);
void player_item_reset (PlayerItem* self, GeeHashSet* attrs);
void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attributes);
static GValue* _g_value_dup (GValue* self);
GType metadata_menuitem_get_type (void) G_GNUC_CONST;
-void metadata_menuitem_fetch_art (MetadataMenuitem* self, const char* uri, const char* prop);
+void metadata_menuitem_fetch_art (MetadataMenuitem* self, const gchar* uri, const gchar* prop);
static void _vala_GValue_free (GValue* self);
gboolean player_item_populated (PlayerItem* self, GeeHashSet* attrs);
PlayerController* player_item_get_owner (PlayerItem* self);
static void player_item_set_owner (PlayerItem* self, PlayerController* value);
-const char* player_item_get_item_type (PlayerItem* self);
-static void player_item_set_item_type (PlayerItem* self, const char* value);
+const gchar* player_item_get_item_type (PlayerItem* self);
+static void player_item_set_item_type (PlayerItem* self, const gchar* value);
static GObject * player_item_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
static void player_item_finalize (GObject* obj);
-static void player_item_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
-static void player_item_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
+static void _vala_player_item_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
+static void _vala_player_item_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
static gint _vala_array_length (gpointer array);
-
-PlayerItem* player_item_construct (GType object_type, const char* type) {
- PlayerItem * self;
+PlayerItem* player_item_construct (GType object_type, const gchar* type) {
+ PlayerItem * self = NULL;
g_return_val_if_fail (type != NULL, NULL);
self = (PlayerItem*) g_object_new (object_type, "item-type", type, NULL);
return self;
}
-PlayerItem* player_item_new (const char* type) {
+PlayerItem* player_item_new (const gchar* type) {
return player_item_construct (TYPE_PLAYER_ITEM, type);
}
@@ -131,14 +130,20 @@ void player_item_reset (PlayerItem* self, GeeHashSet* attrs) {
g_return_if_fail (self != NULL);
g_return_if_fail (attrs != NULL);
{
+ GeeIterator* _tmp0_ = NULL;
GeeIterator* _s_it;
- _s_it = gee_abstract_collection_iterator ((GeeAbstractCollection*) attrs);
+ _tmp0_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) attrs);
+ _s_it = _tmp0_;
while (TRUE) {
- char* s;
- if (!gee_iterator_next (_s_it)) {
+ gboolean _tmp1_;
+ gpointer _tmp2_ = NULL;
+ gchar* s;
+ _tmp1_ = gee_iterator_next (_s_it);
+ if (!_tmp1_) {
break;
}
- s = (char*) gee_iterator_get (_s_it);
+ _tmp2_ = gee_iterator_get (_s_it);
+ s = (gchar*) _tmp2_;
g_debug ("player-item.vala:40: attempting to set prop %s to EMPTY", s);
dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, s, PLAYER_ITEM_EMPTY);
_g_free0 (s);
@@ -164,22 +169,26 @@ static gpointer __g_value_dup0 (gpointer self) {
}
-static char* string_strip (const char* self) {
- char* result = NULL;
- char* _result_;
+static gchar* string_strip (const gchar* self) {
+ gchar* result = NULL;
+ gchar* _tmp0_ = NULL;
+ gchar* _result_;
g_return_val_if_fail (self != NULL, NULL);
- _result_ = g_strdup (self);
+ _tmp0_ = g_strdup (self);
+ _result_ = _tmp0_;
g_strstrip (_result_);
result = _result_;
return result;
}
-static gboolean string_contains (const char* self, const char* needle) {
+static gboolean string_contains (const gchar* self, const gchar* needle) {
gboolean result = FALSE;
+ const gchar* _tmp0_ = NULL;
g_return_val_if_fail (self != NULL, FALSE);
g_return_val_if_fail (needle != NULL, FALSE);
- result = strstr (self, needle) != NULL;
+ _tmp0_ = strstr (self, needle);
+ result = _tmp0_ != NULL;
return result;
}
@@ -195,19 +204,24 @@ static void _vala_GValue_free (GValue* self) {
}
-static char* bool_to_string (gboolean self) {
- char* result = NULL;
+static gchar* bool_to_string (gboolean self) {
+ gchar* result = NULL;
if (self) {
- result = g_strdup ("true");
+ gchar* _tmp0_;
+ _tmp0_ = g_strdup ("true");
+ result = _tmp0_;
return result;
} else {
- result = g_strdup ("false");
+ gchar* _tmp1_;
+ _tmp1_ = g_strdup ("false");
+ result = _tmp1_;
return result;
}
}
void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attributes) {
+ gboolean _tmp28_;
g_return_if_fail (self != NULL);
g_return_if_fail (data != NULL);
g_return_if_fail (attributes != NULL);
@@ -218,38 +232,66 @@ void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attribu
return;
}
{
+ GeeIterator* _tmp0_ = NULL;
GeeIterator* _property_it;
- _property_it = gee_abstract_collection_iterator ((GeeAbstractCollection*) attributes);
+ _tmp0_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) attributes);
+ _property_it = _tmp0_;
while (TRUE) {
- char* property;
+ gboolean _tmp1_;
+ gpointer _tmp2_ = NULL;
+ gchar* property;
+ gchar** _tmp3_;
+ gchar** _tmp4_ = NULL;
gint input_keys_length1;
gint _input_keys_size_;
- char** _tmp1_;
- char** _tmp0_;
- char** input_keys;
- gint _tmp2_;
- char** _tmp3_ = NULL;
- char* search_key;
+ gchar** _tmp5_;
+ gchar** input_keys;
+ gchar* _tmp6_;
+ gchar* search_key;
+ gconstpointer _tmp7_ = NULL;
+ GValue* _tmp8_;
GValue* v;
- if (!gee_iterator_next (_property_it)) {
+ gboolean _tmp9_;
+ _tmp1_ = gee_iterator_next (_property_it);
+ if (!_tmp1_) {
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]);
+ _tmp2_ = gee_iterator_get (_property_it);
+ property = (gchar*) _tmp2_;
+ _tmp4_ = _tmp3_ = g_strsplit (property, "-", 0);
+ _tmp5_ = _tmp4_;
+ input_keys_length1 = _vala_array_length (_tmp3_);
+ _input_keys_size_ = input_keys_length1;
+ input_keys = _tmp5_;
+ _tmp6_ = g_strdup ((input_keys + (input_keys_length1 - 1))[0]);
+ search_key = _tmp6_;
g_debug ("player-item.vala:62: 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* update;
- update = string_strip (g_value_get_string (v));
+ _tmp7_ = g_hash_table_lookup (data, search_key);
+ _tmp8_ = __g_value_dup0 ((GValue*) _tmp7_);
+ v = _tmp8_;
+ _tmp9_ = G_VALUE_HOLDS (v, G_TYPE_STRING);
+ if (_tmp9_) {
+ const gchar* _tmp10_ = NULL;
+ gchar* _tmp11_ = NULL;
+ gchar* update;
+ gboolean _tmp12_;
+ _tmp10_ = g_value_get_string (v);
+ _tmp11_ = string_strip (_tmp10_);
+ update = _tmp11_;
g_debug ("player-item.vala:67: with value : %s", update);
- if (string_contains (property, "mpris:artUrl")) {
- PlayerItem* _tmp4_;
+ _tmp12_ = string_contains (property, "mpris:artUrl");
+ if (_tmp12_) {
+ PlayerItem* _tmp13_;
+ MetadataMenuitem* _tmp14_;
MetadataMenuitem* metadata;
- char* _tmp5_;
- metadata = _g_object_ref0 ((_tmp4_ = self, IS_METADATA_MENUITEM (_tmp4_) ? ((MetadataMenuitem*) _tmp4_) : NULL));
- metadata_menuitem_fetch_art (metadata, _tmp5_ = string_strip (update), property);
- _g_free0 (_tmp5_);
+ gchar* _tmp15_ = NULL;
+ gchar* _tmp16_;
+ _tmp14_ = _g_object_ref0 ((_tmp13_ = self, IS_METADATA_MENUITEM (_tmp13_) ? ((MetadataMenuitem*) _tmp13_) : NULL));
+ metadata = _tmp14_;
+ _tmp15_ = string_strip (update);
+ _tmp16_ = _tmp15_;
+ metadata_menuitem_fetch_art (metadata, _tmp16_, property);
+ _g_free0 (_tmp16_);
_g_object_unref0 (metadata);
_g_free0 (update);
__vala_GValue_free0 (v);
@@ -261,19 +303,40 @@ void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attribu
dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, property, update);
_g_free0 (update);
} else {
- if (G_VALUE_HOLDS (v, G_TYPE_INT)) {
- g_debug ("player-item.vala:78: with value : %i", g_value_get_int (v));
- dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, property, g_value_get_int (v));
+ gboolean _tmp17_;
+ _tmp17_ = G_VALUE_HOLDS (v, G_TYPE_INT);
+ if (_tmp17_) {
+ gint _tmp18_;
+ gint _tmp19_;
+ _tmp18_ = g_value_get_int (v);
+ g_debug ("player-item.vala:78: with value : %i", _tmp18_);
+ _tmp19_ = g_value_get_int (v);
+ dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, property, _tmp19_);
} else {
- if (G_VALUE_HOLDS (v, G_TYPE_INT64)) {
- g_debug ("player-item.vala:82: with value : %i", (gint) g_value_get_int64 (v));
- dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, property, (gint) g_value_get_int64 (v));
+ gboolean _tmp20_;
+ _tmp20_ = G_VALUE_HOLDS (v, G_TYPE_INT64);
+ if (_tmp20_) {
+ gint64 _tmp21_;
+ gint64 _tmp22_;
+ _tmp21_ = g_value_get_int64 (v);
+ g_debug ("player-item.vala:82: with value : %i", (gint) _tmp21_);
+ _tmp22_ = g_value_get_int64 (v);
+ dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, property, (gint) _tmp22_);
} else {
- if (G_VALUE_HOLDS (v, G_TYPE_BOOLEAN)) {
- char* _tmp6_;
- g_debug ("player-item.vala:86: with value : %s", _tmp6_ = bool_to_string (g_value_get_boolean (v)));
- _g_free0 (_tmp6_);
- dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) self, property, g_value_get_boolean (v));
+ gboolean _tmp23_;
+ _tmp23_ = G_VALUE_HOLDS (v, G_TYPE_BOOLEAN);
+ if (_tmp23_) {
+ gboolean _tmp24_;
+ gchar* _tmp25_ = NULL;
+ gchar* _tmp26_;
+ gboolean _tmp27_;
+ _tmp24_ = g_value_get_boolean (v);
+ _tmp25_ = bool_to_string (_tmp24_);
+ _tmp26_ = _tmp25_;
+ g_debug ("player-item.vala:86: with value : %s", _tmp26_);
+ _g_free0 (_tmp26_);
+ _tmp27_ = g_value_get_boolean (v);
+ dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) self, property, _tmp27_);
}
}
}
@@ -285,7 +348,8 @@ void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attribu
}
_g_object_unref0 (_property_it);
}
- dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) self, DBUSMENU_MENUITEM_PROP_VISIBLE, player_item_populated (self, attributes));
+ _tmp28_ = player_item_populated (self, attributes);
+ dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) self, DBUSMENU_MENUITEM_PROP_VISIBLE, _tmp28_);
}
@@ -294,18 +358,28 @@ gboolean player_item_populated (PlayerItem* self, GeeHashSet* attrs) {
g_return_val_if_fail (self != NULL, FALSE);
g_return_val_if_fail (attrs != NULL, FALSE);
{
+ GeeIterator* _tmp0_ = NULL;
GeeIterator* _prop_it;
- _prop_it = gee_abstract_collection_iterator ((GeeAbstractCollection*) attrs);
+ _tmp0_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) attrs);
+ _prop_it = _tmp0_;
while (TRUE) {
- char* prop;
+ gboolean _tmp1_;
+ gpointer _tmp2_ = NULL;
+ gchar* prop;
+ gint _tmp3_;
gint value_int;
- if (!gee_iterator_next (_prop_it)) {
+ gint _tmp4_;
+ _tmp1_ = gee_iterator_next (_prop_it);
+ if (!_tmp1_) {
break;
}
- prop = (char*) gee_iterator_get (_prop_it);
+ _tmp2_ = gee_iterator_get (_prop_it);
+ prop = (gchar*) _tmp2_;
g_debug ("player-item.vala:96: populated ? - prop: %s", prop);
- value_int = dbusmenu_menuitem_property_get_int ((DbusmenuMenuitem*) self, prop);
- if (dbusmenu_menuitem_property_get_int ((DbusmenuMenuitem*) self, prop) != PLAYER_ITEM_EMPTY) {
+ _tmp3_ = dbusmenu_menuitem_property_get_int ((DbusmenuMenuitem*) self, prop);
+ value_int = _tmp3_;
+ _tmp4_ = dbusmenu_menuitem_property_get_int ((DbusmenuMenuitem*) self, prop);
+ if (_tmp4_ != PLAYER_ITEM_EMPTY) {
g_debug ("player-item.vala:99: populated - prop %s and value %i", prop, value_int);
result = TRUE;
_g_free0 (prop);
@@ -331,24 +405,32 @@ PlayerController* player_item_get_owner (PlayerItem* self) {
static void player_item_set_owner (PlayerItem* self, PlayerController* value) {
PlayerController* _tmp0_;
+ PlayerController* _tmp1_;
g_return_if_fail (self != NULL);
- self->priv->_owner = (_tmp0_ = _g_object_ref0 (value), _g_object_unref0 (self->priv->_owner), _tmp0_);
+ _tmp0_ = _g_object_ref0 (value);
+ _tmp1_ = _tmp0_;
+ _g_object_unref0 (self->priv->_owner);
+ self->priv->_owner = _tmp1_;
g_object_notify ((GObject *) self, "owner");
}
-const char* player_item_get_item_type (PlayerItem* self) {
- const char* result;
+const gchar* player_item_get_item_type (PlayerItem* self) {
+ const gchar* result;
g_return_val_if_fail (self != NULL, NULL);
result = self->priv->_item_type;
return result;
}
-static void player_item_set_item_type (PlayerItem* self, const char* value) {
- char* _tmp0_;
+static void player_item_set_item_type (PlayerItem* self, const gchar* value) {
+ gchar* _tmp0_;
+ gchar* _tmp1_;
g_return_if_fail (self != NULL);
- self->priv->_item_type = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_item_type), _tmp0_);
+ _tmp0_ = g_strdup (value);
+ _tmp1_ = _tmp0_;
+ _g_free0 (self->priv->_item_type);
+ self->priv->_item_type = _tmp1_;
g_object_notify ((GObject *) self, "item-type");
}
@@ -360,9 +442,7 @@ static GObject * player_item_constructor (GType type, guint n_construct_properti
parent_class = G_OBJECT_CLASS (player_item_parent_class);
obj = parent_class->constructor (type, n_construct_properties, construct_properties);
self = PLAYER_ITEM (obj);
- {
- dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, DBUSMENU_MENUITEM_PROP_TYPE, self->priv->_item_type);
- }
+ dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, DBUSMENU_MENUITEM_PROP_TYPE, self->priv->_item_type);
return obj;
}
@@ -370,8 +450,8 @@ static GObject * player_item_constructor (GType type, guint n_construct_properti
static void player_item_class_init (PlayerItemClass * klass) {
player_item_parent_class = g_type_class_peek_parent (klass);
g_type_class_add_private (klass, sizeof (PlayerItemPrivate));
- G_OBJECT_CLASS (klass)->get_property = player_item_get_property;
- G_OBJECT_CLASS (klass)->set_property = player_item_set_property;
+ G_OBJECT_CLASS (klass)->get_property = _vala_player_item_get_property;
+ G_OBJECT_CLASS (klass)->set_property = _vala_player_item_set_property;
G_OBJECT_CLASS (klass)->constructor = player_item_constructor;
G_OBJECT_CLASS (klass)->finalize = player_item_finalize;
g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYER_ITEM_OWNER, g_param_spec_object ("owner", "owner", "owner", TYPE_PLAYER_CONTROLLER, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
@@ -405,7 +485,7 @@ GType player_item_get_type (void) {
}
-static void player_item_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
+static void _vala_player_item_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
PlayerItem * self;
self = PLAYER_ITEM (object);
switch (property_id) {
@@ -422,7 +502,7 @@ static void player_item_get_property (GObject * object, guint property_id, GValu
}
-static void player_item_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
+static void _vala_player_item_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
PlayerItem * self;
self = PLAYER_ITEM (object);
switch (property_id) {
@@ -470,4 +550,3 @@ static gint _vala_array_length (gpointer array) {
-