aboutsummaryrefslogtreecommitdiff
path: root/src/mpris2-controller.c
diff options
context:
space:
mode:
authorKen VanDine <ken.vandine@canonical.com>2011-01-27 15:57:39 -0500
committerKen VanDine <ken.vandine@canonical.com>2011-01-27 15:57:39 -0500
commit759793a2dda77abd227921e119bb329271c36a55 (patch)
tree248c4ba64e9464f58a64c22c69f24a294ff16a84 /src/mpris2-controller.c
parent500000a82b6785e2bf7732ee87f36c6a44d2767c (diff)
parent6b2132fb4e700fe84a26adeac5126e8afbc507b3 (diff)
downloadayatana-indicator-sound-759793a2dda77abd227921e119bb329271c36a55.tar.gz
ayatana-indicator-sound-759793a2dda77abd227921e119bb329271c36a55.tar.bz2
ayatana-indicator-sound-759793a2dda77abd227921e119bb329271c36a55.zip
Import upstream version 0.5.7
Diffstat (limited to 'src/mpris2-controller.c')
-rw-r--r--src/mpris2-controller.c491
1 files changed, 291 insertions, 200 deletions
diff --git a/src/mpris2-controller.c b/src/mpris2-controller.c
index 9e198d7..c953648 100644
--- a/src/mpris2-controller.c
+++ b/src/mpris2-controller.c
@@ -1,4 +1,4 @@
-/* mpris2-controller.c generated by valac 0.11.3, the Vala compiler
+/* mpris2-controller.c generated by valac 0.11.5, the Vala compiler
* generated from mpris2-controller.vala, do not modify */
/*
@@ -129,6 +129,7 @@ typedef struct _TransportMenuitemClass TransportMenuitemClass;
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (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 TYPE_PLAYLISTS_MENUITEM (playlists_menuitem_get_type ())
#define PLAYLISTS_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYLISTS_MENUITEM, PlaylistsMenuitem))
@@ -139,7 +140,7 @@ typedef struct _TransportMenuitemClass TransportMenuitemClass;
typedef struct _PlaylistsMenuitem PlaylistsMenuitem;
typedef struct _PlaylistsMenuitemClass PlaylistsMenuitemClass;
-#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
+typedef struct _Mpris2ControllerFetchPlaylistsData Mpris2ControllerFetchPlaylistsData;
struct _Mpris2Controller {
GObject parent_instance;
@@ -199,7 +200,8 @@ struct _MprisPlaylistsIface {
GTypeInterface parent_iface;
void (*ActivatePlaylist) (MprisPlaylists* self, const char* playlist_id, GAsyncReadyCallback _callback_, gpointer _user_data_);
void (*ActivatePlaylist_finish) (MprisPlaylists* self, GAsyncResult* _res_, GError** error);
- PlaylistDetails* (*GetPlaylists) (MprisPlaylists* self, guint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, int* result_length1, GError** error);
+ void (*GetPlaylists) (MprisPlaylists* self, guint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, GAsyncReadyCallback _callback_, gpointer _user_data_);
+ PlaylistDetails* (*GetPlaylists_finish) (MprisPlaylists* self, GAsyncResult* _res_, int* result_length1, GError** error);
gchar** (*get_Orderings) (MprisPlaylists* self, int* result_length1);
void (*set_Orderings) (MprisPlaylists* self, gchar** value, int value_length1);
guint32 (*get_PlaylistCount) (MprisPlaylists* self);
@@ -252,6 +254,31 @@ typedef enum {
TRANSPORT_MENUITEM_ACTION_NEXT
} TransportMenuitemaction;
+struct _Mpris2ControllerFetchPlaylistsData {
+ int _state_;
+ GObject* _source_object_;
+ GAsyncResult* _res_;
+ GSimpleAsyncResult* _async_result;
+ Mpris2Controller* self;
+ PlaylistDetails* current_playlists;
+ gint current_playlists_length1;
+ gint _current_playlists_size_;
+ gint _tmp0_;
+ PlaylistDetails* _tmp1_;
+ PlaylistDetails* _tmp2_;
+ gint _tmp2__length1;
+ gint __tmp2__size_;
+ PlaylistDetails* _tmp3_;
+ GError * e;
+ gpointer _tmp4_;
+ PlayerItem* _tmp5_;
+ PlaylistsMenuitem* playlists_item;
+ gboolean _tmp6_;
+ gboolean* _tmp7_;
+ gboolean* _tmp8_;
+ GError * _inner_error_;
+};
+
static gpointer mpris2_controller_parent_class = NULL;
@@ -311,14 +338,12 @@ void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attribu
gboolean player_item_populated (PlayerItem* self, GeeHashSet* attrs);
static gboolean _bool_equal (const gboolean* s1, const gboolean* s2);
static void mpris2_controller_fetch_active_playlist (Mpris2Controller* self);
+void mpris2_controller_fetch_playlists (Mpris2Controller* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+void mpris2_controller_fetch_playlists_finish (Mpris2Controller* self, GAsyncResult* _res_);
GHashTable* mpris_player_get_Metadata (MprisPlayer* self);
-static gchar** _variant_get1 (GVariant* value, int* result_length1);
-static gchar** _vala_array_dup1 (gchar** self, int length);
-static GVariant* _variant_new2 (const gchar* value);
-static const gchar* _variant_get3 (GVariant* value);
-static GVariant* _variant_new4 (gint64 value);
+static GVariant* _variant_new1 (const gchar* value);
+static const gchar* _variant_get2 (GVariant* value);
void mpris2_controller_initial_update (Mpris2Controller* self);
-void mpris2_controller_fetch_playlists (Mpris2Controller* self);
GType transport_menuitem_action_get_type (void) G_GNUC_CONST;
void mpris2_controller_transport_update (Mpris2Controller* self, TransportMenuitemaction command);
void mpris_player_PlayPause (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
@@ -327,19 +352,23 @@ void mpris_player_Previous (MprisPlayer* self, GAsyncReadyCallback _callback_, g
void mpris_player_Previous_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
void mpris_player_Next (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
void mpris_player_Next_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+gboolean mpris2_controller_connected (Mpris2Controller* self);
+MprisRoot* mpris2_controller_get_mpris2_root (Mpris2Controller* self);
+void mpris2_controller_expose (Mpris2Controller* self);
+void mpris_root_Raise (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+void mpris_root_Raise_finish (MprisRoot* self, GAsyncResult* _res_, GError** error);
+static void mpris2_controller_fetch_playlists_data_free (gpointer _data);
+static gboolean mpris2_controller_fetch_playlists_co (Mpris2ControllerFetchPlaylistsData* data);
MprisPlaylists* mpris2_controller_get_playlists (Mpris2Controller* self);
-PlaylistDetails* mpris_playlists_GetPlaylists (MprisPlaylists* self, guint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, int* result_length1, GError** error);
+void mpris_playlists_GetPlaylists (MprisPlaylists* self, guint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, GAsyncReadyCallback _callback_, gpointer _user_data_);
+PlaylistDetails* mpris_playlists_GetPlaylists_finish (MprisPlaylists* self, GAsyncResult* _res_, int* result_length1, GError** error);
+static void mpris2_controller_fetch_playlists_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
+static void _vala_PlaylistDetails_array_free (PlaylistDetails* array, gint array_length);
GType playlists_menuitem_get_type (void) G_GNUC_CONST;
void playlists_menuitem_update (PlaylistsMenuitem* self, PlaylistDetails* playlists, int playlists_length1);
static gboolean* _bool_dup (gboolean* self);
-static void _vala_PlaylistDetails_array_free (PlaylistDetails* array, gint array_length);
void mpris_playlists_get_ActivePlaylist (MprisPlaylists* self, ActivePlaylistContainer* result);
void playlists_menuitem_update_active_playlist (PlaylistsMenuitem* self, PlaylistDetails* detail);
-gboolean mpris2_controller_connected (Mpris2Controller* self);
-MprisRoot* mpris2_controller_get_mpris2_root (Mpris2Controller* self);
-void mpris2_controller_expose (Mpris2Controller* self);
-void mpris_root_Raise (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
-void mpris_root_Raise_finish (MprisRoot* self, GAsyncResult* _res_, GError** error);
void mpris2_controller_activate_playlist (Mpris2Controller* self, const char* path);
void mpris_playlists_ActivatePlaylist (MprisPlaylists* self, const char* playlist_id, GAsyncReadyCallback _callback_, gpointer _user_data_);
void mpris_playlists_ActivatePlaylist_finish (MprisPlaylists* self, GAsyncResult* _res_, GError** error);
@@ -410,6 +439,14 @@ void mpris2_controller_property_changed_cb (Mpris2Controller* self, const gchar*
GVariant* _tmp22_;
GVariant* playlist_v;
gboolean _tmp23_ = FALSE;
+ gconstpointer _tmp25_ = NULL;
+ GVariant* _tmp26_;
+ GVariant* playlist_count_v;
+ gboolean _tmp27_ = FALSE;
+ gconstpointer _tmp29_ = NULL;
+ GVariant* _tmp30_;
+ GVariant* playlist_orderings_v;
+ gboolean _tmp31_ = FALSE;
g_return_if_fail (self != NULL);
g_return_if_fail (interface_source != NULL);
g_return_if_fail (changed_properties != NULL);
@@ -497,6 +534,34 @@ void mpris2_controller_property_changed_cb (Mpris2Controller* self, const gchar*
if (_tmp23_) {
mpris2_controller_fetch_active_playlist (self);
}
+ _tmp25_ = g_hash_table_lookup (changed_properties, "PlaylistCount");
+ _tmp26_ = _g_variant_ref0 ((GVariant*) _tmp25_);
+ playlist_count_v = _tmp26_;
+ if (playlist_count_v != NULL) {
+ gboolean _tmp28_;
+ _tmp27_ = _bool_equal (self->priv->_owner->use_playlists, (_tmp28_ = TRUE, &_tmp28_)) == TRUE;
+ } else {
+ _tmp27_ = FALSE;
+ }
+ if (_tmp27_) {
+ mpris2_controller_fetch_playlists (self, NULL, NULL);
+ mpris2_controller_fetch_active_playlist (self);
+ }
+ _tmp29_ = g_hash_table_lookup (changed_properties, "Orderings");
+ _tmp30_ = _g_variant_ref0 ((GVariant*) _tmp29_);
+ playlist_orderings_v = _tmp30_;
+ if (playlist_orderings_v != NULL) {
+ gboolean _tmp32_;
+ _tmp31_ = _bool_equal (self->priv->_owner->use_playlists, (_tmp32_ = TRUE, &_tmp32_)) == TRUE;
+ } else {
+ _tmp31_ = FALSE;
+ }
+ if (_tmp31_) {
+ mpris2_controller_fetch_playlists (self, NULL, NULL);
+ mpris2_controller_fetch_active_playlist (self);
+ }
+ _g_variant_unref0 (playlist_orderings_v);
+ _g_variant_unref0 (playlist_count_v);
_g_variant_unref0 (playlist_v);
_g_variant_unref0 (meta_v);
_g_variant_unref0 (play_v);
@@ -518,7 +583,7 @@ static gboolean mpris2_controller_ensure_correct_playback_status (Mpris2Controll
g_return_val_if_fail (self != NULL, FALSE);
_tmp0_ = mpris_player_get_PlaybackStatus (self->priv->_player);
_tmp1_ = _tmp0_;
- g_debug ("mpris2-controller.vala:99: TEST playback status = %s", _tmp1_);
+ g_debug ("mpris2-controller.vala:109: TEST playback status = %s", _tmp1_);
_g_free0 (_tmp1_);
_tmp2_ = mpris_player_get_PlaybackStatus (self->priv->_player);
_tmp3_ = _tmp2_;
@@ -533,58 +598,16 @@ static gboolean mpris2_controller_ensure_correct_playback_status (Mpris2Controll
}
-static gchar** _variant_get1 (GVariant* value, int* result_length1) {
- gchar** _tmp10_;
- int _tmp10__length;
- int _tmp10__size;
- int _tmp10__length1;
- GVariantIter _tmp11_;
- GVariant* _tmp12_;
- _tmp10_ = g_new (gchar*, 5);
- _tmp10__length = 0;
- _tmp10__size = 4;
- _tmp10__length1 = 0;
- g_variant_iter_init (&_tmp11_, value);
- for (; (_tmp12_ = g_variant_iter_next_value (&_tmp11_)) != NULL; _tmp10__length1++) {
- if (_tmp10__size == _tmp10__length) {
- _tmp10__size = 2 * _tmp10__size;
- _tmp10_ = g_renew (gchar*, _tmp10_, _tmp10__size + 1);
- }
- _tmp10_[_tmp10__length++] = g_variant_dup_string (_tmp12_, NULL);
- g_variant_unref (_tmp12_);
- }
- *result_length1 = _tmp10__length1;
- _tmp10_[_tmp10__length] = NULL;
- return _tmp10_;
-}
-
-
-static gchar** _vala_array_dup1 (gchar** self, int length) {
- gchar** result;
- int i;
- result = g_new0 (gchar*, length + 1);
- for (i = 0; i < length; i++) {
- result[i] = g_strdup (self[i]);
- }
- return result;
-}
-
-
-static GVariant* _variant_new2 (const gchar* value) {
+static GVariant* _variant_new1 (const gchar* value) {
return g_variant_ref_sink (g_variant_new_string (value));
}
-static const gchar* _variant_get3 (GVariant* value) {
+static const gchar* _variant_get2 (GVariant* value) {
return g_variant_dup_string (value, NULL);
}
-static GVariant* _variant_new4 (gint64 value) {
- return g_variant_ref_sink (g_variant_new_int64 (value));
-}
-
-
static GHashTable* mpris2_controller_clean_metadata (Mpris2Controller* self) {
GHashTable* result = NULL;
GHashTable* _tmp0_ = NULL;
@@ -595,12 +618,6 @@ static GHashTable* mpris2_controller_clean_metadata (Mpris2Controller* self) {
GVariant* _tmp4_;
GVariant* _tmp5_;
GVariant* artist_v;
- GHashTable* _tmp20_ = NULL;
- GHashTable* _tmp21_;
- gconstpointer _tmp22_ = NULL;
- GVariant* _tmp23_;
- GVariant* _tmp24_;
- GVariant* length_v;
g_return_val_if_fail (self != NULL, NULL);
_tmp0_ = mpris_player_get_Metadata (self->priv->_player);
changed_updates = _tmp0_;
@@ -613,58 +630,58 @@ static GHashTable* mpris2_controller_clean_metadata (Mpris2Controller* self) {
GHashTable* _tmp6_ = NULL;
GHashTable* _tmp7_;
gconstpointer _tmp8_ = NULL;
- gint _tmp9_;
- gchar** _tmp13_;
- gchar** _tmp14_;
- gchar** _tmp15_;
- gint artists_length1;
- gint _artists_size_;
- gchar** _tmp16_;
- gchar** artists;
- gchar* _tmp17_ = NULL;
- gchar* display_artists;
- gchar* _tmp18_;
- gconstpointer _tmp19_ = NULL;
+ GVariant* _tmp9_;
+ GVariant* _tmp10_;
+ GVariant* v_artists;
+ const gchar* _tmp11_ = NULL;
+ gchar* display_artists = NULL;
+ const gchar* _tmp12_ = NULL;
+ gchar* _tmp20_;
+ gconstpointer _tmp21_ = NULL;
_tmp6_ = mpris_player_get_Metadata (self->priv->_player);
_tmp7_ = _tmp6_;
_tmp8_ = g_hash_table_lookup (_tmp7_, "xesam:artist");
- _tmp13_ = (_tmp14_ = _variant_get1 ((GVariant*) _tmp8_, &_tmp9_), (_tmp14_ == NULL) ? ((gpointer) _tmp14_) : _vala_array_dup1 (_tmp14_, _tmp9_));
- _tmp16_ = (_tmp15_ = _tmp13_, _g_hash_table_unref0 (_tmp7_), _tmp15_);
- artists_length1 = _tmp9_;
- _artists_size_ = artists_length1;
- artists = _tmp16_;
- _tmp17_ = g_strjoinv (", ", artists);
- display_artists = _tmp17_;
- _tmp18_ = g_strdup ("xesam:artist");
- g_hash_table_replace (changed_updates, _tmp18_, _variant_new2 (display_artists));
- _tmp19_ = g_hash_table_lookup (changed_updates, "xesam:artist");
- g_debug ("mpris2-controller.vala:113: artist : %s", _variant_get3 ((GVariant*) _tmp19_));
+ _tmp9_ = _g_variant_ref0 ((GVariant*) _tmp8_);
+ v_artists = (_tmp10_ = _tmp9_, _g_hash_table_unref0 (_tmp7_), _tmp10_);
+ _tmp11_ = g_variant_get_type_string (v_artists);
+ g_debug ("mpris2-controller.vala:121: artists is of type %s", _tmp11_);
+ _tmp12_ = g_variant_get_type_string (v_artists);
+ if (g_strcmp0 (_tmp12_, "s") == 0) {
+ const gchar* _tmp13_ = NULL;
+ gchar* _tmp14_;
+ gchar* _tmp15_;
+ g_debug ("mpris2-controller.vala:124: SPOTIFY is that you ?");
+ _tmp13_ = g_variant_get_string (v_artists, NULL);
+ _tmp14_ = g_strdup (_tmp13_);
+ _tmp15_ = _tmp14_;
+ _g_free0 (display_artists);
+ display_artists = _tmp15_;
+ } else {
+ size_t _tmp16_;
+ gchar** _tmp17_ = NULL;
+ gchar** artists;
+ gint artists_length1;
+ gint _artists_size_;
+ gchar* _tmp18_ = NULL;
+ gchar* _tmp19_;
+ _tmp17_ = g_variant_dup_strv (v_artists, &_tmp16_);
+ artists = _tmp17_;
+ artists_length1 = _tmp16_;
+ _artists_size_ = _tmp16_;
+ _tmp18_ = g_strjoinv (", ", artists);
+ _tmp19_ = _tmp18_;
+ _g_free0 (display_artists);
+ display_artists = _tmp19_;
+ artists = (_vala_array_free (artists, artists_length1, (GDestroyNotify) g_free), NULL);
+ }
+ _tmp20_ = g_strdup ("xesam:artist");
+ g_hash_table_replace (changed_updates, _tmp20_, _variant_new1 (display_artists));
+ _tmp21_ = g_hash_table_lookup (changed_updates, "xesam:artist");
+ g_debug ("mpris2-controller.vala:132: artist : %s", _variant_get2 ((GVariant*) _tmp21_));
_g_free0 (display_artists);
- artists = (_vala_array_free (artists, artists_length1, (GDestroyNotify) g_free), NULL);
- }
- _tmp20_ = mpris_player_get_Metadata (self->priv->_player);
- _tmp21_ = _tmp20_;
- _tmp22_ = g_hash_table_lookup (_tmp21_, "mpris:length");
- _tmp23_ = _g_variant_ref0 ((GVariant*) _tmp22_);
- length_v = (_tmp24_ = _tmp23_, _g_hash_table_unref0 (_tmp21_), _tmp24_);
- if (length_v != NULL) {
- GHashTable* _tmp25_ = NULL;
- GHashTable* _tmp26_;
- gconstpointer _tmp27_ = NULL;
- gint64 _tmp28_;
- gint64 _tmp29_;
- gint64 duration;
- gchar* _tmp30_;
- _tmp25_ = mpris_player_get_Metadata (self->priv->_player);
- _tmp26_ = _tmp25_;
- _tmp27_ = g_hash_table_lookup (_tmp26_, "mpris:length");
- _tmp28_ = g_variant_get_int64 ((GVariant*) _tmp27_);
- duration = (_tmp29_ = _tmp28_, _g_hash_table_unref0 (_tmp26_), _tmp29_);
- _tmp30_ = g_strdup ("mpris:length");
- g_hash_table_replace (changed_updates, _tmp30_, _variant_new4 (duration / 1000000));
+ _g_variant_unref0 (v_artists);
}
result = changed_updates;
- _g_variant_unref0 (length_v);
_g_variant_unref0 (artist_v);
return result;
}
@@ -726,7 +743,7 @@ void mpris2_controller_initial_update (Mpris2Controller* self) {
_g_object_unref0 (_tmp11_);
_g_object_unref0 (_tmp9_);
if (_bool_equal (self->priv->_owner->use_playlists, (_tmp12_ = TRUE, &_tmp12_)) == TRUE) {
- mpris2_controller_fetch_playlists (self);
+ mpris2_controller_fetch_playlists (self, NULL, NULL);
mpris2_controller_fetch_active_playlist (self);
}
_g_hash_table_unref0 (cleaned_metadata);
@@ -735,7 +752,7 @@ void mpris2_controller_initial_update (Mpris2Controller* self) {
void mpris2_controller_transport_update (Mpris2Controller* self, TransportMenuitemaction command) {
g_return_if_fail (self != NULL);
- g_debug ("mpris2-controller.vala:152: transport_event input = %i", (gint) command);
+ g_debug ("mpris2-controller.vala:166: transport_event input = %i", (gint) command);
if (command == TRANSPORT_MENUITEM_ACTION_PLAY_PAUSE) {
mpris_player_PlayPause (self->priv->_player, NULL, NULL);
} else {
@@ -750,16 +767,65 @@ void mpris2_controller_transport_update (Mpris2Controller* self, TransportMenuit
}
-static gboolean* _bool_dup (gboolean* self) {
- gboolean* dup;
- dup = g_new0 (gboolean, 1);
- memcpy (dup, self, sizeof (gboolean));
- return dup;
+gboolean mpris2_controller_connected (Mpris2Controller* self) {
+ gboolean result = FALSE;
+ gboolean _tmp0_ = FALSE;
+ g_return_val_if_fail (self != NULL, FALSE);
+ if (self->priv->_player != NULL) {
+ _tmp0_ = self->priv->_mpris2_root != NULL;
+ } else {
+ _tmp0_ = FALSE;
+ }
+ result = _tmp0_;
+ return result;
}
-static gpointer __bool_dup0 (gpointer self) {
- return self ? _bool_dup (self) : NULL;
+void mpris2_controller_expose (Mpris2Controller* self) {
+ gboolean _tmp0_;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = mpris2_controller_connected (self);
+ if (_tmp0_ == TRUE) {
+ mpris_root_Raise (self->priv->_mpris2_root, NULL, NULL);
+ }
+}
+
+
+static void mpris2_controller_fetch_playlists_data_free (gpointer _data) {
+ Mpris2ControllerFetchPlaylistsData* data;
+ data = _data;
+ _g_object_unref0 (data->self);
+ g_slice_free (Mpris2ControllerFetchPlaylistsData, data);
+}
+
+
+static gpointer _g_object_ref0 (gpointer self) {
+ return self ? g_object_ref (self) : NULL;
+}
+
+
+void mpris2_controller_fetch_playlists (Mpris2Controller* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
+ Mpris2ControllerFetchPlaylistsData* _data_;
+ _data_ = g_slice_new0 (Mpris2ControllerFetchPlaylistsData);
+ _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, mpris2_controller_fetch_playlists);
+ g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, mpris2_controller_fetch_playlists_data_free);
+ _data_->self = _g_object_ref0 (self);
+ mpris2_controller_fetch_playlists_co (_data_);
+}
+
+
+void mpris2_controller_fetch_playlists_finish (Mpris2Controller* self, GAsyncResult* _res_) {
+ Mpris2ControllerFetchPlaylistsData* _data_;
+ _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
+}
+
+
+static void mpris2_controller_fetch_playlists_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
+ Mpris2ControllerFetchPlaylistsData* data;
+ data = _user_data_;
+ data->_source_object_ = source_object;
+ data->_res_ = _res_;
+ mpris2_controller_fetch_playlists_co (data);
}
@@ -774,47 +840,101 @@ static void _vala_PlaylistDetails_array_free (PlaylistDetails* array, gint array
}
-void mpris2_controller_fetch_playlists (Mpris2Controller* self) {
- gint _tmp0_;
- PlaylistDetails* _tmp1_ = NULL;
- gint current_playlists_length1;
- gint _current_playlists_size_;
- PlaylistDetails* _tmp2_;
- PlaylistDetails* current_playlists;
- GError * _inner_error_ = NULL;
- g_return_if_fail (self != NULL);
- _tmp1_ = mpris_playlists_GetPlaylists (self->priv->_playlists, (guint32) 0, (guint32) 10, "Alphabetical", FALSE, &_tmp0_, &_inner_error_);
- _tmp2_ = _tmp1_;
- current_playlists_length1 = _tmp0_;
- _current_playlists_size_ = current_playlists_length1;
- current_playlists = _tmp2_;
- 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;
+static gboolean* _bool_dup (gboolean* self) {
+ gboolean* dup;
+ dup = g_new0 (gboolean, 1);
+ memcpy (dup, self, sizeof (gboolean));
+ return dup;
+}
+
+
+static gpointer __bool_dup0 (gpointer self) {
+ return self ? _bool_dup (self) : NULL;
+}
+
+
+static gboolean mpris2_controller_fetch_playlists_co (Mpris2ControllerFetchPlaylistsData* data) {
+ switch (data->_state_) {
+ case 0:
+ goto _state_0;
+ case 1:
+ goto _state_1;
+ default:
+ g_assert_not_reached ();
}
- if (current_playlists != NULL) {
- gpointer _tmp3_ = NULL;
- PlayerItem* _tmp4_;
- PlaylistsMenuitem* playlists_item;
- g_debug ("mpris2-controller.vala:171: Size of the playlist array = %i", current_playlists_length1);
- _tmp3_ = gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS);
- playlists_item = (_tmp4_ = (PlayerItem*) _tmp3_, IS_PLAYLISTS_MENUITEM (_tmp4_) ? ((PlaylistsMenuitem*) _tmp4_) : NULL);
- playlists_menuitem_update (playlists_item, current_playlists, current_playlists_length1);
- _g_object_unref0 (playlists_item);
+ _state_0:
+ data->current_playlists = NULL;
+ data->current_playlists_length1 = 0;
+ data->_current_playlists_size_ = 0;
+ data->_state_ = 1;
+ mpris_playlists_GetPlaylists (data->self->priv->_playlists, (guint32) 0, (guint32) 10, "Alphabetical", FALSE, mpris2_controller_fetch_playlists_ready, data);
+ return FALSE;
+ _state_1:
+ data->_tmp1_ = NULL;
+ data->_tmp1_ = mpris_playlists_GetPlaylists_finish (data->self->priv->_playlists, data->_res_, &data->_tmp0_, &data->_inner_error_);
+ data->_tmp2_ = data->_tmp1_;
+ data->_tmp2__length1 = data->_tmp0_;
+ data->__tmp2__size_ = data->_tmp0_;
+ if (data->_inner_error_ != NULL) {
+ if (data->_inner_error_->domain == G_IO_ERROR) {
+ goto __catch11_g_io_error;
+ }
+ data->current_playlists = (_vala_PlaylistDetails_array_free (data->current_playlists, data->current_playlists_length1), NULL);
+ g_critical ("file %s: line %d: unexpected 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_);
+ return FALSE;
+ }
+ data->_tmp3_ = data->_tmp2_;
+ data->current_playlists = (_vala_PlaylistDetails_array_free (data->current_playlists, data->current_playlists_length1), NULL);
+ data->current_playlists_length1 = data->_tmp2__length1;
+ data->_current_playlists_size_ = data->current_playlists_length1;
+ data->current_playlists = data->_tmp3_;
+ goto __finally11;
+ __catch11_g_io_error:
+ {
+ data->e = data->_inner_error_;
+ data->_inner_error_ = NULL;
+ g_debug ("mpris2-controller.vala:202: Could not fetch playlists because %s", data->e->message);
+ _g_error_free0 (data->e);
+ data->current_playlists = (_vala_PlaylistDetails_array_free (data->current_playlists, data->current_playlists_length1), NULL);
+ if (data->_state_ == 0) {
+ g_simple_async_result_complete_in_idle (data->_async_result);
+ } else {
+ g_simple_async_result_complete (data->_async_result);
+ }
+ g_object_unref (data->_async_result);
+ return FALSE;
+ }
+ __finally11:
+ if (data->_inner_error_ != NULL) {
+ data->current_playlists = (_vala_PlaylistDetails_array_free (data->current_playlists, data->current_playlists_length1), 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_);
+ return FALSE;
+ }
+ if (data->current_playlists != NULL) {
+ g_debug ("mpris2-controller.vala:207: Size of the playlist array = %i", data->current_playlists_length1);
+ data->_tmp4_ = NULL;
+ data->_tmp4_ = gee_abstract_list_get ((GeeAbstractList*) data->self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS);
+ data->playlists_item = (data->_tmp5_ = (PlayerItem*) data->_tmp4_, IS_PLAYLISTS_MENUITEM (data->_tmp5_) ? ((PlaylistsMenuitem*) data->_tmp5_) : NULL);
+ playlists_menuitem_update (data->playlists_item, data->current_playlists, data->current_playlists_length1);
+ _g_object_unref0 (data->playlists_item);
} else {
- gboolean _tmp5_;
- gboolean* _tmp6_;
- gboolean* _tmp7_;
- g_warning ("mpris2-controller.vala:176: Playlists are on but its returning no cur" \
+ g_warning ("mpris2-controller.vala:212: Playlists are on but its returning no cur" \
"rent_playlists");
- _tmp6_ = __bool_dup0 ((_tmp5_ = FALSE, &_tmp5_));
- _tmp7_ = _tmp6_;
- _g_free0 (self->priv->_owner->use_playlists);
- self->priv->_owner->use_playlists = _tmp7_;
+ data->_tmp7_ = __bool_dup0 ((data->_tmp6_ = FALSE, &data->_tmp6_));
+ data->_tmp8_ = data->_tmp7_;
+ _g_free0 (data->self->priv->_owner->use_playlists);
+ data->self->priv->_owner->use_playlists = data->_tmp8_;
+ }
+ data->current_playlists = (_vala_PlaylistDetails_array_free (data->current_playlists, data->current_playlists_length1), NULL);
+ if (data->_state_ == 0) {
+ g_simple_async_result_complete_in_idle (data->_async_result);
+ } else {
+ g_simple_async_result_complete (data->_async_result);
}
- current_playlists = (_vala_PlaylistDetails_array_free (current_playlists, current_playlists_length1), NULL);
- return;
+ g_object_unref (data->_async_result);
+ return FALSE;
}
@@ -831,7 +951,7 @@ static void mpris2_controller_fetch_active_playlist (Mpris2Controller* self) {
mpris_playlists_get_ActivePlaylist (self->priv->_playlists, &_tmp0_);
_tmp1_ = _tmp0_;
if ((_tmp2_ = _tmp1_.valid == FALSE, active_playlist_container_destroy (&_tmp1_), _tmp2_)) {
- g_debug ("mpris2-controller.vala:185: We don't have an active playlist");
+ g_debug ("mpris2-controller.vala:220: We don't have an active playlist");
}
_tmp3_ = gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS);
playlists_item = (_tmp4_ = (PlayerItem*) _tmp3_, IS_PLAYLISTS_MENUITEM (_tmp4_) ? ((PlaylistsMenuitem*) _tmp4_) : NULL);
@@ -843,45 +963,21 @@ static void mpris2_controller_fetch_active_playlist (Mpris2Controller* self) {
}
-gboolean mpris2_controller_connected (Mpris2Controller* self) {
- gboolean result = FALSE;
- gboolean _tmp0_ = FALSE;
- g_return_val_if_fail (self != NULL, FALSE);
- if (self->priv->_player != NULL) {
- _tmp0_ = self->priv->_mpris2_root != NULL;
- } else {
- _tmp0_ = FALSE;
- }
- result = _tmp0_;
- return result;
-}
-
-
-void mpris2_controller_expose (Mpris2Controller* self) {
- gboolean _tmp0_;
- g_return_if_fail (self != NULL);
- _tmp0_ = mpris2_controller_connected (self);
- if (_tmp0_ == TRUE) {
- mpris_root_Raise (self->priv->_mpris2_root, NULL, NULL);
- }
-}
-
-
void mpris2_controller_activate_playlist (Mpris2Controller* self, const char* path) {
GError * _inner_error_ = NULL;
g_return_if_fail (self != NULL);
g_return_if_fail (path != NULL);
mpris_playlists_ActivatePlaylist (self->priv->_playlists, path, NULL, NULL);
- goto __finally11;
- __catch11_g_io_error:
+ goto __finally12;
+ __catch12_g_io_error:
{
GError * e;
e = _inner_error_;
_inner_error_ = NULL;
- g_debug ("mpris2-controller.vala:210: Could not activate playlist %s because %s", (const gchar*) path, e->message);
+ g_debug ("mpris2-controller.vala:232: Could not activate playlist %s because %s", (const gchar*) path, e->message);
_g_error_free0 (e);
}
- __finally11:
+ __finally12:
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_);
@@ -898,11 +994,6 @@ MprisRoot* mpris2_controller_get_mpris2_root (Mpris2Controller* self) {
}
-static gpointer _g_object_ref0 (gpointer self) {
- return self ? g_object_ref (self) : NULL;
-}
-
-
static void mpris2_controller_set_mpris2_root (Mpris2Controller* self, MprisRoot* value) {
MprisRoot* _tmp0_;
MprisRoot* _tmp1_;
@@ -1028,7 +1119,7 @@ static GObject * mpris2_controller_constructor (GType type, guint n_construct_pr
_tmp3_ = (MprisRoot*) _tmp2_;
if (_inner_error_ != NULL) {
if (_inner_error_->domain == G_IO_ERROR) {
- goto __catch12_g_io_error;
+ goto __catch13_g_io_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_);
@@ -1042,7 +1133,7 @@ static GObject * mpris2_controller_constructor (GType type, guint n_construct_pr
_tmp8_ = (MprisPlayer*) _tmp7_;
if (_inner_error_ != NULL) {
if (_inner_error_->domain == G_IO_ERROR) {
- goto __catch12_g_io_error;
+ goto __catch13_g_io_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_);
@@ -1062,7 +1153,7 @@ static GObject * mpris2_controller_constructor (GType type, guint n_construct_pr
_tmp14_ = (MprisPlaylists*) _tmp13_;
if (_inner_error_ != NULL) {
if (_inner_error_->domain == G_IO_ERROR) {
- goto __catch12_g_io_error;
+ goto __catch13_g_io_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_);
@@ -1075,7 +1166,7 @@ static GObject * mpris2_controller_constructor (GType type, guint n_construct_pr
_tmp17_ = (FreeDesktopProperties*) _tmp16_;
if (_inner_error_ != NULL) {
if (_inner_error_->domain == G_IO_ERROR) {
- goto __catch12_g_io_error;
+ goto __catch13_g_io_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_);
@@ -1084,8 +1175,8 @@ static GObject * mpris2_controller_constructor (GType type, guint n_construct_pr
mpris2_controller_set_properties_interface (self, _tmp18_);
_g_object_unref0 (_tmp18_);
g_signal_connect_object (self->priv->_properties_interface, "properties-changed", (GCallback) _mpris2_controller_property_changed_cb_free_desktop_properties_properties_changed, self, 0);
- goto __finally12;
- __catch12_g_io_error:
+ goto __finally13;
+ __catch13_g_io_error:
{
GError * e;
e = _inner_error_;
@@ -1093,7 +1184,7 @@ static GObject * mpris2_controller_constructor (GType type, guint n_construct_pr
g_error ("mpris2-controller.vala:58: Problems connecting to the session bus - %s", e->message);
_g_error_free0 (e);
}
- __finally12:
+ __finally13:
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_);