1 /* unity-sound-menu-mpris.c generated by valac 0.14.2, the Vala compiler
2 * generated from unity-sound-menu-mpris.vala, do not modify */
3
4 /* -*- Mode: vala; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */
5 /*
6 * Copyright (C) 2011 Canonical Ltd
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 3 as
10 * published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 * Authored by Conor Curran <conor.curran@canonical.com>
21 *
22 * Note: We aim to not wrap a typical MPRIS server but just expose to the consumer
23 * the elements we need for it to populate. So that means things like Supported
24 * Mime Types which are part of MPRIS but are not relevant to the consumer should
25 * remain hidden and as a result not used.
26 */
27 /****************************************************************************************/
28 /****************************************************************************************/
29 /***************************************************************************************/
30
31 #include <glib.h>
32 #include <glib-object.h>
33 #include <stdlib.h>
34 #include <string.h>
35 #include "unity.h"
36 #include <gio/gio.h>
37 #include <unity-trace.h>
38 #include <libdbusmenu-glib/client.h>
39 #include <libdbusmenu-glib/dbusmenu-glib.h>
40 #include <libdbusmenu-glib/enum-types.h>
41 #include <libdbusmenu-glib/menuitem-proxy.h>
42 #include <libdbusmenu-glib/menuitem.h>
43 #include <libdbusmenu-glib/server.h>
44 #include <libdbusmenu-glib/types.h>
45 #include <gee.h>
46
47
48 #define UNITY_TYPE_MPRIS_GATEWAY (unity_mpris_gateway_get_type ())
49 #define UNITY_MPRIS_GATEWAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_TYPE_MPRIS_GATEWAY, UnityMPRISGateway))
50 #define UNITY_MPRIS_GATEWAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_TYPE_MPRIS_GATEWAY, UnityMPRISGatewayClass))
51 #define UNITY_IS_MPRIS_GATEWAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_TYPE_MPRIS_GATEWAY))
52 #define UNITY_IS_MPRIS_GATEWAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_TYPE_MPRIS_GATEWAY))
53 #define UNITY_MPRIS_GATEWAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_TYPE_MPRIS_GATEWAY, UnityMPRISGatewayClass))
54
55 typedef struct _UnityMPRISGateway UnityMPRISGateway;
56 typedef struct _UnityMPRISGatewayClass UnityMPRISGatewayClass;
57 typedef struct _UnityMPRISGatewayPrivate UnityMPRISGatewayPrivate;
58
59 #define UNITY_TYPE_MPRIS_ROOT (unity_mpris_root_get_type ())
60 #define UNITY_MPRIS_ROOT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_TYPE_MPRIS_ROOT, UnityMprisRoot))
61 #define UNITY_MPRIS_ROOT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_TYPE_MPRIS_ROOT, UnityMprisRootClass))
62 #define UNITY_IS_MPRIS_ROOT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_TYPE_MPRIS_ROOT))
63 #define UNITY_IS_MPRIS_ROOT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_TYPE_MPRIS_ROOT))
64 #define UNITY_MPRIS_ROOT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_TYPE_MPRIS_ROOT, UnityMprisRootClass))
65
66 typedef struct _UnityMprisRoot UnityMprisRoot;
67 typedef struct _UnityMprisRootClass UnityMprisRootClass;
68
69 #define UNITY_TYPE_MPRIS_PLAYER (unity_mpris_player_get_type ())
70 #define UNITY_MPRIS_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_TYPE_MPRIS_PLAYER, UnityMprisPlayer))
71 #define UNITY_MPRIS_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_TYPE_MPRIS_PLAYER, UnityMprisPlayerClass))
72 #define UNITY_IS_MPRIS_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_TYPE_MPRIS_PLAYER))
73 #define UNITY_IS_MPRIS_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_TYPE_MPRIS_PLAYER))
74 #define UNITY_MPRIS_PLAYER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_TYPE_MPRIS_PLAYER, UnityMprisPlayerClass))
75
76 typedef struct _UnityMprisPlayer UnityMprisPlayer;
77 typedef struct _UnityMprisPlayerClass UnityMprisPlayerClass;
78
79 #define UNITY_TYPE_MPRIS_PLAYLISTS (unity_mpris_playlists_get_type ())
80 #define UNITY_MPRIS_PLAYLISTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_TYPE_MPRIS_PLAYLISTS, UnityMprisPlaylists))
81 #define UNITY_MPRIS_PLAYLISTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_TYPE_MPRIS_PLAYLISTS, UnityMprisPlaylistsClass))
82 #define UNITY_IS_MPRIS_PLAYLISTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_TYPE_MPRIS_PLAYLISTS))
83 #define UNITY_IS_MPRIS_PLAYLISTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_TYPE_MPRIS_PLAYLISTS))
84 #define UNITY_MPRIS_PLAYLISTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_TYPE_MPRIS_PLAYLISTS, UnityMprisPlaylistsClass))
85
86 typedef struct _UnityMprisPlaylists UnityMprisPlaylists;
87 typedef struct _UnityMprisPlaylistsClass UnityMprisPlaylistsClass;
88
89 #define UNITY_TYPE_PROPERTY_UPDATE_MANAGER (unity_property_update_manager_get_type ())
90 #define UNITY_PROPERTY_UPDATE_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_TYPE_PROPERTY_UPDATE_MANAGER, UnityPropertyUpdateManager))
91 #define UNITY_PROPERTY_UPDATE_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_TYPE_PROPERTY_UPDATE_MANAGER, UnityPropertyUpdateManagerClass))
92 #define UNITY_IS_PROPERTY_UPDATE_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_TYPE_PROPERTY_UPDATE_MANAGER))
93 #define UNITY_IS_PROPERTY_UPDATE_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_TYPE_PROPERTY_UPDATE_MANAGER))
94 #define UNITY_PROPERTY_UPDATE_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_TYPE_PROPERTY_UPDATE_MANAGER, UnityPropertyUpdateManagerClass))
95
96 typedef struct _UnityPropertyUpdateManager UnityPropertyUpdateManager;
97 typedef struct _UnityPropertyUpdateManagerClass UnityPropertyUpdateManagerClass;
98
99 #define UNITY_TYPE_BLACKLIST_MANAGER (unity_blacklist_manager_get_type ())
100 #define UNITY_BLACKLIST_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_TYPE_BLACKLIST_MANAGER, UnityBlacklistManager))
101 #define UNITY_BLACKLIST_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_TYPE_BLACKLIST_MANAGER, UnityBlacklistManagerClass))
102 #define UNITY_IS_BLACKLIST_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_TYPE_BLACKLIST_MANAGER))
103 #define UNITY_IS_BLACKLIST_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_TYPE_BLACKLIST_MANAGER))
104 #define UNITY_BLACKLIST_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_TYPE_BLACKLIST_MANAGER, UnityBlacklistManagerClass))
105
106 typedef struct _UnityBlacklistManager UnityBlacklistManager;
107 typedef struct _UnityBlacklistManagerClass UnityBlacklistManagerClass;
108
109 #define UNITY_TYPE_SPECIFIC_ITEM_MANAGER (unity_specific_item_manager_get_type ())
110 #define UNITY_SPECIFIC_ITEM_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_TYPE_SPECIFIC_ITEM_MANAGER, UnitySpecificItemManager))
111 #define UNITY_SPECIFIC_ITEM_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_TYPE_SPECIFIC_ITEM_MANAGER, UnitySpecificItemManagerClass))
112 #define UNITY_IS_SPECIFIC_ITEM_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_TYPE_SPECIFIC_ITEM_MANAGER))
113 #define UNITY_IS_SPECIFIC_ITEM_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_TYPE_SPECIFIC_ITEM_MANAGER))
114 #define UNITY_SPECIFIC_ITEM_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_TYPE_SPECIFIC_ITEM_MANAGER, UnitySpecificItemManagerClass))
115
116 typedef struct _UnitySpecificItemManager UnitySpecificItemManager;
117 typedef struct _UnitySpecificItemManagerClass UnitySpecificItemManagerClass;
118 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
119 typedef struct _Block10Data Block10Data;
120 #define _g_free0(var) (var = (g_free (var), NULL))
121 #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
122 typedef struct _UnitySpecificItemManagerPrivate UnitySpecificItemManagerPrivate;
123
124 #define UNITY_TYPE_SOUND_SERVICE_INTERFACE (unity_sound_service_interface_get_type ())
125 #define UNITY_SOUND_SERVICE_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_TYPE_SOUND_SERVICE_INTERFACE, UnitySoundServiceInterface))
126 #define UNITY_IS_SOUND_SERVICE_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_TYPE_SOUND_SERVICE_INTERFACE))
127 #define UNITY_SOUND_SERVICE_INTERFACE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), UNITY_TYPE_SOUND_SERVICE_INTERFACE, UnitySoundServiceInterfaceIface))
128
129 typedef struct _UnitySoundServiceInterface UnitySoundServiceInterface;
130 typedef struct _UnitySoundServiceInterfaceIface UnitySoundServiceInterfaceIface;
131
132 #define UNITY_TYPE_SOUND_SERVICE_INTERFACE_PROXY (unity_sound_service_interface_proxy_get_type ())
133 typedef struct _UnityPropertyUpdateManagerPrivate UnityPropertyUpdateManagerPrivate;
134 #define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
135 typedef struct _Block11Data Block11Data;
136 #define _g_variant_type_free0(var) ((var == NULL) ? NULL : (var = (g_variant_type_free (var), NULL)))
137 #define _g_variant_builder_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_builder_unref (var), NULL)))
138 #define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
139 #define _g_list_free0(var) ((var == NULL) ? NULL : (var = (g_list_free (var), NULL)))
140 typedef struct _UnityBlacklistManagerPrivate UnityBlacklistManagerPrivate;
141 typedef GDBusProxy UnitySoundServiceInterfaceProxy;
142 typedef GDBusProxyClass UnitySoundServiceInterfaceProxyClass;
143 typedef struct _UnityMprisRootPrivate UnityMprisRootPrivate;
144 typedef struct _unity_mpris_root_RaiseData unity_mpris_root_RaiseData;
145 typedef struct _UnityMprisPlayerPrivate UnityMprisPlayerPrivate;
146 typedef struct _unity_mpris_player_PlayPauseData unity_mpris_player_PlayPauseData;
147 typedef struct _unity_mpris_player_NextData unity_mpris_player_NextData;
148 typedef struct _unity_mpris_player_PreviousData unity_mpris_player_PreviousData;
149 typedef struct _UnityMprisPlaylistsPrivate UnityMprisPlaylistsPrivate;
150 typedef struct _unity_mpris_playlists_ActivatePlaylistData unity_mpris_playlists_ActivatePlaylistData;
151 typedef struct _unity_mpris_playlists_GetPlaylistsData unity_mpris_playlists_GetPlaylistsData;
152
153 struct _UnityMPRISGateway {
154 GObject parent_instance;
155 UnityMPRISGatewayPrivate * priv;
156 };
157
158 struct _UnityMPRISGatewayClass {
159 GObjectClass parent_class;
160 };
161
162 struct _UnityMPRISGatewayPrivate {
163 UnityMusicPlayer* _consumer;
164 UnityMprisRoot* mpris_root_interface;
165 UnityMprisPlayer* mpris_player_interface;
166 UnityMprisPlaylists* mpris_playlist_interface;
167 UnityPropertyUpdateManager* prop_manager;
168 UnityBlacklistManager* blacklist_mgr;
169 UnitySpecificItemManager* specific_menuitem_mgr;
170 GDBusConnection* dbus_connection;
171 gboolean playlist_interface_raised;
172 UnityPlaylist* _edited_playlist;
173 gint _playlist_count;
174 guint bus_name_owner_handle;
175 guint bus_root_iface_handle;
176 guint bus_player_iface_handle;
177 };
178
179 struct _Block10Data {
180 int _ref_count_;
181 UnityMPRISGateway * self;
182 gchar* dbus_name;
183 };
184
185 struct _UnitySpecificItemManager {
186 GObject parent_instance;
187 UnitySpecificItemManagerPrivate * priv;
188 char* _player_specific_object_path;
189 char* _track_specific_object_path;
190 };
191
192 struct _UnitySpecificItemManagerClass {
193 GObjectClass parent_class;
194 };
195
196 struct _UnitySoundServiceInterfaceIface {
197 GTypeInterface parent_iface;
198 void (*EnableTrackSpecificItems) (UnitySoundServiceInterface* self, const char* object_path, const gchar* desktop_id, GAsyncReadyCallback _callback_, gpointer _user_data_);
199 void (*EnableTrackSpecificItems_finish) (UnitySoundServiceInterface* self, GAsyncResult* _res_, GError** error);
200 void (*EnablePlayerSpecificItems) (UnitySoundServiceInterface* self, const char* object_path, const gchar* desktop_id, GAsyncReadyCallback _callback_, gpointer _user_data_);
201 void (*EnablePlayerSpecificItems_finish) (UnitySoundServiceInterface* self, GAsyncResult* _res_, GError** error);
202 };
203
204 struct _UnitySpecificItemManagerPrivate {
205 DbusmenuServer* _player_item_server;
206 DbusmenuServer* _track_item_server;
207 UnityMusicPlayer* _consumer;
208 UnitySoundServiceInterface* sound_service_interface;
209 };
210
211 struct _UnityPropertyUpdateManager {
212 GObject parent_instance;
213 UnityPropertyUpdateManagerPrivate * priv;
214 };
215
216 struct _UnityPropertyUpdateManagerClass {
217 GObjectClass parent_class;
218 };
219
220 struct _UnityPropertyUpdateManagerPrivate {
221 GHashTable* queued_properties;
222 GHashTable* source_ids;
223 GDBusConnection* _connection;
224 };
225
226 struct _Block11Data {
227 int _ref_count_;
228 UnityPropertyUpdateManager * self;
229 gchar* interface_name;
230 };
231
232 struct _UnityBlacklistManager {
233 GObject parent_instance;
234 UnityBlacklistManagerPrivate * priv;
235 };
236
237 struct _UnityBlacklistManagerClass {
238 GObjectClass parent_class;
239 };
240
241 struct _UnityBlacklistManagerPrivate {
242 GSettings* settings;
243 UnityMusicPlayer* consumer;
244 };
245
246 struct _UnityMprisRoot {
247 GObject parent_instance;
248 UnityMprisRootPrivate * priv;
249 };
250
251 struct _UnityMprisRootClass {
252 GObjectClass parent_class;
253 };
254
255 struct _UnityMprisRootPrivate {
256 UnityMusicPlayer* consumer;
257 UnityPropertyUpdateManager* prop_mgr;
258 gchar* mpris_desktop_entry;
259 };
260
261 struct _unity_mpris_root_RaiseData {
262 int _state_;
263 GObject* _source_object_;
264 GAsyncResult* _res_;
265 GSimpleAsyncResult* _async_result;
266 UnityMprisRoot* self;
267 UnityMusicPlayer* _tmp0_;
268 };
269
270 struct _UnityMprisPlayer {
271 GObject parent_instance;
272 UnityMprisPlayerPrivate * priv;
273 };
274
275 struct _UnityMprisPlayerClass {
276 GObjectClass parent_class;
277 };
278
279 struct _UnityMprisPlayerPrivate {
280 UnityMusicPlayer* consumer;
281 UnityPropertyUpdateManager* prop_mgr;
282 GHashTable* current_metadata;
283 };
284
285 struct _unity_mpris_player_PlayPauseData {
286 int _state_;
287 GObject* _source_object_;
288 GAsyncResult* _res_;
289 GSimpleAsyncResult* _async_result;
290 UnityMprisPlayer* self;
291 UnityMusicPlayer* _tmp0_;
292 };
293
294 struct _unity_mpris_player_NextData {
295 int _state_;
296 GObject* _source_object_;
297 GAsyncResult* _res_;
298 GSimpleAsyncResult* _async_result;
299 UnityMprisPlayer* self;
300 UnityMusicPlayer* _tmp0_;
301 };
302
303 struct _unity_mpris_player_PreviousData {
304 int _state_;
305 GObject* _source_object_;
306 GAsyncResult* _res_;
307 GSimpleAsyncResult* _async_result;
308 UnityMprisPlayer* self;
309 UnityMusicPlayer* _tmp0_;
310 };
311
312 struct _UnityMprisPlaylists {
313 GObject parent_instance;
314 UnityMprisPlaylistsPrivate * priv;
315 };
316
317 struct _UnityMprisPlaylistsClass {
318 GObjectClass parent_class;
319 };
320
321 struct _UnityMprisPlaylistsPrivate {
322 UnityMusicPlayer* consumer;
323 UnityPropertyUpdateManager* prop_mgr;
324 UnityActivePlaylistContainer _active_pl_wrapper;
325 UnityMPRISGateway* gateway;
326 };
327
328 struct _unity_mpris_playlists_ActivatePlaylistData {
329 int _state_;
330 GObject* _source_object_;
331 GAsyncResult* _res_;
332 GSimpleAsyncResult* _async_result;
333 UnityMprisPlaylists* self;
334 char* playlist_id;
335 UnityMusicPlayer* _tmp0_;
336 const char* _tmp1_;
337 };
338
339 struct _unity_mpris_playlists_GetPlaylistsData {
340 int _state_;
341 GObject* _source_object_;
342 GAsyncResult* _res_;
343 GSimpleAsyncResult* _async_result;
344 UnityMprisPlaylists* self;
345 guint32 index;
346 guint32 max_count;
347 gchar* order;
348 gboolean reverse_order;
349 UnityPlaylistDetails* result;
350 gint result_length1;
351 UnityPlaylistDetails* _tmp0_;
352 UnityPlaylistDetails* _result_;
353 gint _result__length1;
354 gint __result__size_;
355 UnityMusicPlayer* _tmp1_;
356 gint _tmp2_;
357 UnityPlaylist** _tmp3_;
358 UnityPlaylist** up_collection;
359 gint up_collection_length1;
360 gint _up_collection_size_;
361 gint up_it;
362 UnityPlaylist* _tmp4_;
363 UnityPlaylist* up;
364 UnityPlaylistDetails details;
365 UnityPlaylist* _tmp5_;
366 UnityPlaylistDetails* _tmp6_;
367 gint _tmp6__length1;
368 UnityPlaylistDetails _tmp7_;
369 UnityPlaylistDetails _tmp8_;
370 UnityPlaylistDetails* _tmp9_;
371 gint _tmp9__length1;
372 };
373
374
375 static gpointer unity_mpris_gateway_parent_class = NULL;
376 static gpointer unity_specific_item_manager_parent_class = NULL;
377 static gpointer unity_property_update_manager_parent_class = NULL;
378 static gpointer unity_blacklist_manager_parent_class = NULL;
379 static gpointer unity_mpris_root_parent_class = NULL;
380 static gpointer unity_mpris_player_parent_class = NULL;
381 static gpointer unity_mpris_playlists_parent_class = NULL;
382
383 #define UNITY_MPRIS_INTERFACE_ROOT_PATH "/org/mpris/MediaPlayer2"
384 #define UNITY_MPRIS_INTERFACE_ROOT "org.mpris.MediaPlayer2"
385 #define UNITY_MPRIS_INTERFACE_PREFIX "org.mpris.MediaPlayer2."
386 #define UNITY_MPRIS_INTERFACE_PLAYER "org.mpris.MediaPlayer2.Player"
387 #define UNITY_MPRIS_INTERFACE_PLAYLISTS "org.mpris.MediaPlayer2.Playlists"
388 GType unity_mpris_gateway_get_type (void) G_GNUC_CONST;
389 GType unity_mpris_root_get_type (void) G_GNUC_CONST;
390 guint unity_mpris_root_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
391 GType unity_mpris_player_get_type (void) G_GNUC_CONST;
392 guint unity_mpris_player_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
393 GType unity_mpris_playlists_get_type (void) G_GNUC_CONST;
394 guint unity_mpris_playlists_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
395 GType unity_property_update_manager_get_type (void) G_GNUC_CONST;
396 GType unity_blacklist_manager_get_type (void) G_GNUC_CONST;
397 GType unity_specific_item_manager_get_type (void) G_GNUC_CONST;
398 #define UNITY_MPRIS_GATEWAY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_TYPE_MPRIS_GATEWAY, UnityMPRISGatewayPrivate))
399 enum {
400 UNITY_MPRIS_GATEWAY_DUMMY_PROPERTY,
401 UNITY_MPRIS_GATEWAY_CONSUMER,
402 UNITY_MPRIS_GATEWAY_EDITED_PLAYLIST,
403 UNITY_MPRIS_GATEWAY_PLAYLIST_COUNT
404 };
405 UnityMPRISGateway* unity_mpris_gateway_new (UnityMusicPlayer* client);
406 UnityMPRISGateway* unity_mpris_gateway_construct (GType object_type, UnityMusicPlayer* client);
407 void unity_mpris_gateway_export (UnityMPRISGateway* self);
408 static Block10Data* block10_data_ref (Block10Data* _data10_);
409 static void block10_data_unref (Block10Data* _data10_);
410 UnityPropertyUpdateManager* unity_property_update_manager_new (GDBusConnection* conn);
411 UnityPropertyUpdateManager* unity_property_update_manager_construct (GType object_type, GDBusConnection* conn);
412 UnityMusicPlayer* unity_mpris_gateway_get_consumer (UnityMPRISGateway* self);
413 UnityMprisRoot* unity_mpris_root_new (UnityMusicPlayer* client, UnityPropertyUpdateManager* prop_mgr);
414 UnityMprisRoot* unity_mpris_root_construct (GType object_type, UnityMusicPlayer* client, UnityPropertyUpdateManager* prop_mgr);
415 UnityMprisPlayer* unity_mpris_player_new (UnityMusicPlayer* client, UnityPropertyUpdateManager* prop_mgr);
416 UnityMprisPlayer* unity_mpris_player_construct (GType object_type, UnityMusicPlayer* client, UnityPropertyUpdateManager* prop_mgr);
417 UnityMprisPlaylists* unity_mpris_playlists_new (UnityMusicPlayer* consumer, UnityPropertyUpdateManager* prop_mgr, UnityMPRISGateway* gw);
418 UnityMprisPlaylists* unity_mpris_playlists_construct (GType object_type, UnityMusicPlayer* consumer, UnityPropertyUpdateManager* prop_mgr, UnityMPRISGateway* gw);
419 static void __lambda23_ (Block10Data* _data10_);
420 static void ___lambda23__gbus_name_acquired_callback (GDBusConnection* connection, const gchar* name, gpointer self);
421 static void unity_mpris_gateway_on_name_lost (UnityMPRISGateway* self, GDBusConnection* conn, const gchar* name);
422 static void _unity_mpris_gateway_on_name_lost_gbus_name_lost_callback (GDBusConnection* connection, const gchar* name, gpointer self);
423 void unity_mpris_gateway_unexport (UnityMPRISGateway* self);
424 static void unity_mpris_gateway_on_bus_aquired (UnityMPRISGateway* self, GDBusConnection* conn);
425 void unity_mpris_gateway_ensure_playlist_interface_is_raised (UnityMPRISGateway* self);
426 static void unity_mpris_gateway_set_consumer (UnityMPRISGateway* self, UnityMusicPlayer* value);
427 UnityPlaylist* unity_mpris_gateway_get_edited_playlist (UnityMPRISGateway* self);
428 void unity_mpris_gateway_set_edited_playlist (UnityMPRISGateway* self, UnityPlaylist* value);
429 gint unity_mpris_gateway_get_playlist_count (UnityMPRISGateway* self);
430 void unity_mpris_gateway_set_playlist_count (UnityMPRISGateway* self, gint value);
431 static GObject * unity_mpris_gateway_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
432 UnityBlacklistManager* unity_blacklist_manager_new (UnityMusicPlayer* client);
433 UnityBlacklistManager* unity_blacklist_manager_construct (GType object_type, UnityMusicPlayer* client);
434 UnitySpecificItemManager* unity_specific_item_manager_new (UnityMusicPlayer* client);
435 UnitySpecificItemManager* unity_specific_item_manager_construct (GType object_type, UnityMusicPlayer* client);
436 static void unity_mpris_gateway_finalize (GObject* obj);
437 static void _vala_unity_mpris_gateway_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
438 static void _vala_unity_mpris_gateway_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
439 GType unity_sound_service_interface_proxy_get_type (void) G_GNUC_CONST;
440 guint unity_sound_service_interface_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
441 GType unity_sound_service_interface_get_type (void) G_GNUC_CONST;
442 #define UNITY_SPECIFIC_ITEM_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_TYPE_SPECIFIC_ITEM_MANAGER, UnitySpecificItemManagerPrivate))
443 enum {
444 UNITY_SPECIFIC_ITEM_MANAGER_DUMMY_PROPERTY,
445 UNITY_SPECIFIC_ITEM_MANAGER_CONSUMER
446 };
447 static void unity_specific_item_manager_on_track_specific_change (UnitySpecificItemManager* self, GParamSpec* p);
448 UnityMusicPlayer* unity_specific_item_manager_get_consumer (UnitySpecificItemManager* self);
449 void unity_sound_service_interface_EnableTrackSpecificItems (UnitySoundServiceInterface* self, const char* object_path, const gchar* desktop_id, GAsyncReadyCallback _callback_, gpointer _user_data_);
450 void unity_sound_service_interface_EnableTrackSpecificItems_finish (UnitySoundServiceInterface* self, GAsyncResult* _res_, GError** error);
451 static void unity_specific_item_manager_on_player_specific_change (UnitySpecificItemManager* self, GParamSpec* p);
452 void unity_sound_service_interface_EnablePlayerSpecificItems (UnitySoundServiceInterface* self, const char* object_path, const gchar* desktop_id, GAsyncReadyCallback _callback_, gpointer _user_data_);
453 void unity_sound_service_interface_EnablePlayerSpecificItems_finish (UnitySoundServiceInterface* self, GAsyncResult* _res_, GError** error);
454 static void unity_specific_item_manager_set_consumer (UnitySpecificItemManager* self, UnityMusicPlayer* value);
455 static GObject * unity_specific_item_manager_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
456 static void _unity_specific_item_manager_on_track_specific_change_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
457 static void _unity_specific_item_manager_on_player_specific_change_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
458 static void unity_specific_item_manager_finalize (GObject* obj);
459 static void _vala_unity_specific_item_manager_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
460 static void _vala_unity_specific_item_manager_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
461 #define UNITY_PROPERTY_UPDATE_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_TYPE_PROPERTY_UPDATE_MANAGER, UnityPropertyUpdateManagerPrivate))
462 enum {
463 UNITY_PROPERTY_UPDATE_MANAGER_DUMMY_PROPERTY,
464 UNITY_PROPERTY_UPDATE_MANAGER_CONNECTION
465 };
466 void unity_property_update_manager_queue_property_update (UnityPropertyUpdateManager* self, const gchar* prop_name, GVariant* update, const gchar* interface_name);
467 static Block11Data* block11_data_ref (Block11Data* _data11_);
468 static void block11_data_unref (Block11Data* _data11_);
469 static gboolean ___lambda16_ (Block11Data* _data11_);
470 static gboolean unity_property_update_manager_dispatch_property_update (UnityPropertyUpdateManager* self, const gchar* interface_name);
471 static gboolean ____lambda16__gsource_func (gpointer self);
472 void unity_property_update_manager_emit_dbus_signal (UnityPropertyUpdateManager* self, const gchar* interface_name, const gchar* signal_name, GVariant* payload);
473 GDBusConnection* unity_property_update_manager_get_connection (UnityPropertyUpdateManager* self);
474 static void unity_property_update_manager_set_connection (UnityPropertyUpdateManager* self, GDBusConnection* value);
475 static GObject * unity_property_update_manager_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
476 static void _g_free0_ (gpointer var);
477 static void _g_hash_table_unref0_ (gpointer var);
478 static void _g_variant_unref0_ (gpointer var);
479 static void unity_property_update_manager_finalize (GObject* obj);
480 static void _vala_unity_property_update_manager_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
481 static void _vala_unity_property_update_manager_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
482 #define UNITY_BLACKLIST_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_TYPE_BLACKLIST_MANAGER, UnityBlacklistManagerPrivate))
483 enum {
484 UNITY_BLACKLIST_MANAGER_DUMMY_PROPERTY
485 };
486 static void unity_blacklist_manager_wire_it_up (UnityBlacklistManager* self);
487 gboolean unity_blacklist_manager_check_presence (UnityBlacklistManager* self);
488 static void unity_blacklist_manager_on_blacklist_event (UnityBlacklistManager* self);
489 static void _unity_blacklist_manager_on_blacklist_event_g_settings_changed (GSettings* _sender, const gchar* key, gpointer self);
490 static void unity_blacklist_manager_consumer_blacklist_change (UnityBlacklistManager* self);
491 static void _unity_blacklist_manager_consumer_blacklist_change_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
492 static void unity_blacklist_manager_add_to_blacklist (UnityBlacklistManager* self);
493 static void unity_blacklist_manager_remove_from_blacklist (UnityBlacklistManager* self);
494 static gchar* unity_blacklist_manager_get_blacklist_name (UnityBlacklistManager* self);
495 static GObject * unity_blacklist_manager_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
496 static void unity_blacklist_manager_finalize (GObject* obj);
497 static void unity_sound_service_interface_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters);
498 static void _vala_g_async_ready_callback (GObject *source_object, GAsyncResult *res, void *user_data);
499 static void unity_sound_service_interface_proxy_EnableTrackSpecificItems_async (UnitySoundServiceInterface* self, const char* object_path, const gchar* desktop_id, GAsyncReadyCallback _callback_, gpointer _user_data_);
500 static void unity_sound_service_interface_proxy_EnableTrackSpecificItems_finish (UnitySoundServiceInterface* self, GAsyncResult* _res_, GError** error);
501 static void unity_sound_service_interface_proxy_EnablePlayerSpecificItems_async (UnitySoundServiceInterface* self, const char* object_path, const gchar* desktop_id, GAsyncReadyCallback _callback_, gpointer _user_data_);
502 static void unity_sound_service_interface_proxy_EnablePlayerSpecificItems_finish (UnitySoundServiceInterface* self, GAsyncResult* _res_, GError** error);
503 static void unity_sound_service_interface_proxy_unity_sound_service_interface_interface_init (UnitySoundServiceInterfaceIface* iface);
504 static void _dbus_unity_sound_service_interface_EnableTrackSpecificItems (UnitySoundServiceInterface* self, GVariant* parameters, GDBusMethodInvocation* invocation);
505 static void _dbus_unity_sound_service_interface_EnableTrackSpecificItems_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_);
506 static void _dbus_unity_sound_service_interface_EnablePlayerSpecificItems (UnitySoundServiceInterface* self, GVariant* parameters, GDBusMethodInvocation* invocation);
507 static void _dbus_unity_sound_service_interface_EnablePlayerSpecificItems_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_);
508 static void unity_sound_service_interface_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data);
509 static GVariant* unity_sound_service_interface_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data);
510 static gboolean unity_sound_service_interface_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data);
511 static void _unity_sound_service_interface_unregister_object (gpointer user_data);
512 #define UNITY_MPRIS_ROOT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_TYPE_MPRIS_ROOT, UnityMprisRootPrivate))
513 enum {
514 UNITY_MPRIS_ROOT_DUMMY_PROPERTY,
515 UNITY_MPRIS_ROOT_HAS_TRACKLIST,
516 UNITY_MPRIS_ROOT_CAN_QUIT,
517 UNITY_MPRIS_ROOT_CAN_RAISE,
518 UNITY_MPRIS_ROOT_IDENTITY,
519 UNITY_MPRIS_ROOT_DESKTOP_ENTRY
520 };
521 static void unity_mpris_root_wire_up (UnityMprisRoot* self);
522 static void __lambda17_ (UnityMprisRoot* self, GObject* obj, GParamSpec* pspec);
523 static GVariant* _variant_new67 (const gchar* value);
524 static void ___lambda17__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
525 static void unity_mpris_root_Raise_data_free (gpointer _data);
526 void unity_mpris_root_Raise (UnityMprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
527 void unity_mpris_root_Raise_finish (UnityMprisRoot* self, GAsyncResult* _res_, GError** error);
528 static gboolean unity_mpris_root_Raise_co (unity_mpris_root_RaiseData* _data_);
529 gboolean unity_mpris_root_get_HasTracklist (UnityMprisRoot* self);
530 gboolean unity_mpris_root_get_CanQuit (UnityMprisRoot* self);
531 gboolean unity_mpris_root_get_CanRaise (UnityMprisRoot* self);
532 const gchar* unity_mpris_root_get_Identity (UnityMprisRoot* self);
533 const gchar* unity_mpris_root_get_DesktopEntry (UnityMprisRoot* self);
534 static GObject * unity_mpris_root_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
535 static void unity_mpris_root_finalize (GObject* obj);
536 static void _vala_unity_mpris_root_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
537 static void _dbus_unity_mpris_root_Raise (UnityMprisRoot* self, GVariant* parameters, GDBusMethodInvocation* invocation);
538 static void _dbus_unity_mpris_root_Raise_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_);
539 static void unity_mpris_root_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data);
540 static GVariant* unity_mpris_root_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data);
541 static GVariant* _dbus_unity_mpris_root_get_HasTracklist (UnityMprisRoot* self);
542 static GVariant* _dbus_unity_mpris_root_get_CanQuit (UnityMprisRoot* self);
543 static GVariant* _dbus_unity_mpris_root_get_CanRaise (UnityMprisRoot* self);
544 static GVariant* _dbus_unity_mpris_root_get_Identity (UnityMprisRoot* self);
545 static GVariant* _dbus_unity_mpris_root_get_DesktopEntry (UnityMprisRoot* self);
546 static gboolean unity_mpris_root_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data);
547 static void _unity_mpris_root_unregister_object (gpointer user_data);
548 #define UNITY_MPRIS_PLAYER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_TYPE_MPRIS_PLAYER, UnityMprisPlayerPrivate))
549 enum {
550 UNITY_MPRIS_PLAYER_DUMMY_PROPERTY,
551 UNITY_MPRIS_PLAYER_METADATA,
552 UNITY_MPRIS_PLAYER_PLAYBACK_STATUS,
553 UNITY_MPRIS_PLAYER_CAN_CONTROL,
554 UNITY_MPRIS_PLAYER_CAN_GO_NEXT,
555 UNITY_MPRIS_PLAYER_CAN_GO_PREVIOUS,
556 UNITY_MPRIS_PLAYER_CAN_PLAY,
557 UNITY_MPRIS_PLAYER_CAN_PAUSE
558 };
559 static void unity_mpris_player_wire_it_up (UnityMprisPlayer* self);
560 void unity_mpris_player_on_metadata_update (UnityMprisPlayer* self, GParamSpec* pspec);
561 static void _unity_mpris_player_on_metadata_update_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
562 static void __lambda18_ (UnityMprisPlayer* self, GObject* obj, GParamSpec* pspec);
563 static GVariant* _variant_new68 (const gchar* value);
564 static void ___lambda18__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
565 static void __lambda19_ (UnityMprisPlayer* self, GObject* obj, GParamSpec* pspec);
566 static GVariant* _variant_new69 (gboolean value);
567 static void ___lambda19__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
568 static void __lambda20_ (UnityMprisPlayer* self, GObject* obj, GParamSpec* pspec);
569 static GVariant* _variant_new70 (gboolean value);
570 static void ___lambda20__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
571 static void __lambda21_ (UnityMprisPlayer* self, GObject* obj, GParamSpec* pspec);
572 static GVariant* _variant_new71 (gboolean value);
573 static void ___lambda21__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
574 static void __lambda22_ (UnityMprisPlayer* self, GObject* obj, GParamSpec* pspec);
575 static GVariant* _variant_new72 (gboolean value);
576 static void ___lambda22__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
577 static GVariant* _variant_new73 (const gchar* value);
578 static GVariant* _variant_new74 (gchar* value);
579 static GVariant* _variant_new75 (const gchar* value);
580 static GVariant* _variant_new76 (const gchar* value);
581 static GVariant* _variant_new77 (const gchar* value);
582 static GVariant* _variant_new78 (GHashTable* value);
583 static void unity_mpris_player_PlayPause_data_free (gpointer _data);
584 void unity_mpris_player_PlayPause (UnityMprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
585 void unity_mpris_player_PlayPause_finish (UnityMprisPlayer* self, GAsyncResult* _res_, GError** error);
586 static gboolean unity_mpris_player_PlayPause_co (unity_mpris_player_PlayPauseData* _data_);
587 static void unity_mpris_player_Next_data_free (gpointer _data);
588 void unity_mpris_player_Next (UnityMprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
589 void unity_mpris_player_Next_finish (UnityMprisPlayer* self, GAsyncResult* _res_, GError** error);
590 static gboolean unity_mpris_player_Next_co (unity_mpris_player_NextData* _data_);
591 static void unity_mpris_player_Previous_data_free (gpointer _data);
592 void unity_mpris_player_Previous (UnityMprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
593 void unity_mpris_player_Previous_finish (UnityMprisPlayer* self, GAsyncResult* _res_, GError** error);
594 static gboolean unity_mpris_player_Previous_co (unity_mpris_player_PreviousData* _data_);
595 GHashTable* unity_mpris_player_get_Metadata (UnityMprisPlayer* self);
596 const gchar* unity_mpris_player_get_PlaybackStatus (UnityMprisPlayer* self);
597 gboolean unity_mpris_player_get_CanControl (UnityMprisPlayer* self);
598 gboolean unity_mpris_player_get_CanGoNext (UnityMprisPlayer* self);
599 gboolean unity_mpris_player_get_CanGoPrevious (UnityMprisPlayer* self);
600 gboolean unity_mpris_player_get_CanPlay (UnityMprisPlayer* self);
601 gboolean unity_mpris_player_get_CanPause (UnityMprisPlayer* self);
602 static GObject * unity_mpris_player_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
603 static void unity_mpris_player_finalize (GObject* obj);
604 static void _vala_unity_mpris_player_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
605 static void _dbus_unity_mpris_player_PlayPause (UnityMprisPlayer* self, GVariant* parameters, GDBusMethodInvocation* invocation);
606 static void _dbus_unity_mpris_player_PlayPause_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_);
607 static void _dbus_unity_mpris_player_Next (UnityMprisPlayer* self, GVariant* parameters, GDBusMethodInvocation* invocation);
608 static void _dbus_unity_mpris_player_Next_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_);
609 static void _dbus_unity_mpris_player_Previous (UnityMprisPlayer* self, GVariant* parameters, GDBusMethodInvocation* invocation);
610 static void _dbus_unity_mpris_player_Previous_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_);
611 static void unity_mpris_player_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data);
612 static GVariant* unity_mpris_player_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data);
613 static GVariant* _dbus_unity_mpris_player_get_Metadata (UnityMprisPlayer* self);
614 static GVariant* _dbus_unity_mpris_player_get_PlaybackStatus (UnityMprisPlayer* self);
615 static GVariant* _dbus_unity_mpris_player_get_CanControl (UnityMprisPlayer* self);
616 static GVariant* _dbus_unity_mpris_player_get_CanGoNext (UnityMprisPlayer* self);
617 static GVariant* _dbus_unity_mpris_player_get_CanGoPrevious (UnityMprisPlayer* self);
618 static GVariant* _dbus_unity_mpris_player_get_CanPlay (UnityMprisPlayer* self);
619 static GVariant* _dbus_unity_mpris_player_get_CanPause (UnityMprisPlayer* self);
620 static gboolean unity_mpris_player_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data);
621 static void _unity_mpris_player_unregister_object (gpointer user_data);
622 #define UNITY_MPRIS_PLAYLISTS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_TYPE_MPRIS_PLAYLISTS, UnityMprisPlaylistsPrivate))
623 enum {
624 UNITY_MPRIS_PLAYLISTS_DUMMY_PROPERTY,
625 UNITY_MPRIS_PLAYLISTS_ORDERINGS,
626 UNITY_MPRIS_PLAYLISTS_PLAYLIST_COUNT,
627 UNITY_MPRIS_PLAYLISTS_ACTIVE_PLAYLIST
628 };
629 static void unity_mpris_playlists_wire_up (UnityMprisPlaylists* self);
630 static void unity_mpris_playlists_set_active_pl_wrapper (UnityMprisPlaylists* self, UnityActivePlaylistContainer* value);
631 static void unity_mpris_playlists_construct_active_playlist (UnityMprisPlaylists* self);
632 static void unity_mpris_playlists_on_current_playlist_update (UnityMprisPlaylists* self, GParamSpec* p);
633 static void _unity_mpris_playlists_on_current_playlist_update_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
634 static void unity_mpris_playlists_on_playlist_name_change (UnityMprisPlaylists* self, GParamSpec* p);
635 static void _unity_mpris_playlists_on_playlist_name_change_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
636 static void unity_mpris_playlists_on_playlist_count_change (UnityMprisPlaylists* self, GParamSpec* p);
637 static void _unity_mpris_playlists_on_playlist_count_change_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
638 static void unity_mpris_playlists_get_active_pl_wrapper (UnityMprisPlaylists* self, UnityActivePlaylistContainer* result);
639 static GVariant* _variant_new79 (UnityActivePlaylistContainer value);
640 static void unity_mpris_playlists_prep_playlist (UnityMprisPlaylists* self, UnityPlaylist* unity_pl, UnityPlaylistDetails* outward);
641 static GVariant* _variant_new80 (gint value);
642 static void unity_mpris_playlists_ActivatePlaylist_data_free (gpointer _data);
643 void unity_mpris_playlists_ActivatePlaylist (UnityMprisPlaylists* self, const char* playlist_id, GAsyncReadyCallback _callback_, gpointer _user_data_);
644 void unity_mpris_playlists_ActivatePlaylist_finish (UnityMprisPlaylists* self, GAsyncResult* _res_, GError** error);
645 static gboolean unity_mpris_playlists_ActivatePlaylist_co (unity_mpris_playlists_ActivatePlaylistData* _data_);
646 static void _vala_UnityPlaylistDetails_array_free (UnityPlaylistDetails* array, gint array_length);
647 static void unity_mpris_playlists_GetPlaylists_data_free (gpointer _data);
648 void unity_mpris_playlists_GetPlaylists (UnityMprisPlaylists* self, guint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, GAsyncReadyCallback _callback_, gpointer _user_data_);
649 UnityPlaylistDetails* unity_mpris_playlists_GetPlaylists_finish (UnityMprisPlaylists* self, GAsyncResult* _res_, int* result_length1, GError** error);
650 static gboolean unity_mpris_playlists_GetPlaylists_co (unity_mpris_playlists_GetPlaylistsData* _data_);
651 static void _vala_array_add4 (UnityPlaylistDetails** array, int* length, int* size, const UnityPlaylistDetails* value);
652 gchar** unity_mpris_playlists_get_Orderings (UnityMprisPlaylists* self, int* result_length1);
653 guint32 unity_mpris_playlists_get_PlaylistCount (UnityMprisPlaylists* self);
654 void unity_mpris_playlists_get_ActivePlaylist (UnityMprisPlaylists* self, UnityActivePlaylistContainer* result);
655 static GObject * unity_mpris_playlists_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
656 static void unity_mpris_playlists_finalize (GObject* obj);
657 static void _vala_unity_mpris_playlists_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
658 static void _vala_unity_mpris_playlists_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
659 static void _dbus_unity_mpris_playlists_ActivatePlaylist (UnityMprisPlaylists* self, GVariant* parameters, GDBusMethodInvocation* invocation);
660 static void _dbus_unity_mpris_playlists_ActivatePlaylist_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_);
661 static void _dbus_unity_mpris_playlists_GetPlaylists (UnityMprisPlaylists* self, GVariant* parameters, GDBusMethodInvocation* invocation);
662 static void _dbus_unity_mpris_playlists_GetPlaylists_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_);
663 static void unity_mpris_playlists_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data);
664 static GVariant* unity_mpris_playlists_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data);
665 static GVariant* _dbus_unity_mpris_playlists_get_Orderings (UnityMprisPlaylists* self);
666 static GVariant* _dbus_unity_mpris_playlists_get_PlaylistCount (UnityMprisPlaylists* self);
667 static GVariant* _dbus_unity_mpris_playlists_get_ActivePlaylist (UnityMprisPlaylists* self);
668 static gboolean unity_mpris_playlists_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data);
669 static void _unity_mpris_playlists_unregister_object (gpointer user_data);
670 static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
671 static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
672 static gint _vala_array_length (gpointer array);
673
674 static const GDBusArgInfo _unity_sound_service_interface_dbus_arg_info_EnableTrackSpecificItems_object_path = {-1, "object_path", "o"};
675 static const GDBusArgInfo _unity_sound_service_interface_dbus_arg_info_EnableTrackSpecificItems_desktop_id = {-1, "desktop_id", "s"};
676 static const GDBusArgInfo * const _unity_sound_service_interface_dbus_arg_info_EnableTrackSpecificItems_in[] = {&_unity_sound_service_interface_dbus_arg_info_EnableTrackSpecificItems_object_path, &_unity_sound_service_interface_dbus_arg_info_EnableTrackSpecificItems_desktop_id, NULL};
677 static const GDBusArgInfo * const _unity_sound_service_interface_dbus_arg_info_EnableTrackSpecificItems_out[] = {NULL};
678 static const GDBusMethodInfo _unity_sound_service_interface_dbus_method_info_EnableTrackSpecificItems = {-1, "EnableTrackSpecificItems", (GDBusArgInfo **) (&_unity_sound_service_interface_dbus_arg_info_EnableTrackSpecificItems_in), (GDBusArgInfo **) (&_unity_sound_service_interface_dbus_arg_info_EnableTrackSpecificItems_out)};
679 static const GDBusArgInfo _unity_sound_service_interface_dbus_arg_info_EnablePlayerSpecificItems_object_path = {-1, "object_path", "o"};
680 static const GDBusArgInfo _unity_sound_service_interface_dbus_arg_info_EnablePlayerSpecificItems_desktop_id = {-1, "desktop_id", "s"};
681 static const GDBusArgInfo * const _unity_sound_service_interface_dbus_arg_info_EnablePlayerSpecificItems_in[] = {&_unity_sound_service_interface_dbus_arg_info_EnablePlayerSpecificItems_object_path, &_unity_sound_service_interface_dbus_arg_info_EnablePlayerSpecificItems_desktop_id, NULL};
682 static const GDBusArgInfo * const _unity_sound_service_interface_dbus_arg_info_EnablePlayerSpecificItems_out[] = {NULL};
683 static const GDBusMethodInfo _unity_sound_service_interface_dbus_method_info_EnablePlayerSpecificItems = {-1, "EnablePlayerSpecificItems", (GDBusArgInfo **) (&_unity_sound_service_interface_dbus_arg_info_EnablePlayerSpecificItems_in), (GDBusArgInfo **) (&_unity_sound_service_interface_dbus_arg_info_EnablePlayerSpecificItems_out)};
684 static const GDBusMethodInfo * const _unity_sound_service_interface_dbus_method_info[] = {&_unity_sound_service_interface_dbus_method_info_EnableTrackSpecificItems, &_unity_sound_service_interface_dbus_method_info_EnablePlayerSpecificItems, NULL};
685 static const GDBusSignalInfo * const _unity_sound_service_interface_dbus_signal_info[] = {NULL};
686 static const GDBusPropertyInfo * const _unity_sound_service_interface_dbus_property_info[] = {NULL};
687 static const GDBusInterfaceInfo _unity_sound_service_interface_dbus_interface_info = {-1, "com.canonical.indicators.sound", (GDBusMethodInfo **) (&_unity_sound_service_interface_dbus_method_info), (GDBusSignalInfo **) (&_unity_sound_service_interface_dbus_signal_info), (GDBusPropertyInfo **) (&_unity_sound_service_interface_dbus_property_info)};
688 static const GDBusInterfaceVTable _unity_sound_service_interface_dbus_interface_vtable = {unity_sound_service_interface_dbus_interface_method_call, unity_sound_service_interface_dbus_interface_get_property, unity_sound_service_interface_dbus_interface_set_property};
689 static const GDBusArgInfo * const _unity_mpris_root_dbus_arg_info_Raise_in[] = {NULL};
690 static const GDBusArgInfo * const _unity_mpris_root_dbus_arg_info_Raise_out[] = {NULL};
691 static const GDBusMethodInfo _unity_mpris_root_dbus_method_info_Raise = {-1, "Raise", (GDBusArgInfo **) (&_unity_mpris_root_dbus_arg_info_Raise_in), (GDBusArgInfo **) (&_unity_mpris_root_dbus_arg_info_Raise_out)};
692 static const GDBusMethodInfo * const _unity_mpris_root_dbus_method_info[] = {&_unity_mpris_root_dbus_method_info_Raise, NULL};
693 static const GDBusSignalInfo * const _unity_mpris_root_dbus_signal_info[] = {NULL};
694 static const GDBusPropertyInfo _unity_mpris_root_dbus_property_info_HasTracklist = {-1, "HasTracklist", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE};
695 static const GDBusPropertyInfo _unity_mpris_root_dbus_property_info_CanQuit = {-1, "CanQuit", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE};
696 static const GDBusPropertyInfo _unity_mpris_root_dbus_property_info_CanRaise = {-1, "CanRaise", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE};
697 static const GDBusPropertyInfo _unity_mpris_root_dbus_property_info_Identity = {-1, "Identity", "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE};
698 static const GDBusPropertyInfo _unity_mpris_root_dbus_property_info_DesktopEntry = {-1, "DesktopEntry", "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE};
699 static const GDBusPropertyInfo * const _unity_mpris_root_dbus_property_info[] = {&_unity_mpris_root_dbus_property_info_HasTracklist, &_unity_mpris_root_dbus_property_info_CanQuit, &_unity_mpris_root_dbus_property_info_CanRaise, &_unity_mpris_root_dbus_property_info_Identity, &_unity_mpris_root_dbus_property_info_DesktopEntry, NULL};
700 static const GDBusInterfaceInfo _unity_mpris_root_dbus_interface_info = {-1, "org.mpris.MediaPlayer2", (GDBusMethodInfo **) (&_unity_mpris_root_dbus_method_info), (GDBusSignalInfo **) (&_unity_mpris_root_dbus_signal_info), (GDBusPropertyInfo **) (&_unity_mpris_root_dbus_property_info)};
701 static const GDBusInterfaceVTable _unity_mpris_root_dbus_interface_vtable = {unity_mpris_root_dbus_interface_method_call, unity_mpris_root_dbus_interface_get_property, unity_mpris_root_dbus_interface_set_property};
702 static const GDBusArgInfo * const _unity_mpris_player_dbus_arg_info_PlayPause_in[] = {NULL};
703 static const GDBusArgInfo * const _unity_mpris_player_dbus_arg_info_PlayPause_out[] = {NULL};
704 static const GDBusMethodInfo _unity_mpris_player_dbus_method_info_PlayPause = {-1, "PlayPause", (GDBusArgInfo **) (&_unity_mpris_player_dbus_arg_info_PlayPause_in), (GDBusArgInfo **) (&_unity_mpris_player_dbus_arg_info_PlayPause_out)};
705 static const GDBusArgInfo * const _unity_mpris_player_dbus_arg_info_Next_in[] = {NULL};
706 static const GDBusArgInfo * const _unity_mpris_player_dbus_arg_info_Next_out[] = {NULL};
707 static const GDBusMethodInfo _unity_mpris_player_dbus_method_info_Next = {-1, "Next", (GDBusArgInfo **) (&_unity_mpris_player_dbus_arg_info_Next_in), (GDBusArgInfo **) (&_unity_mpris_player_dbus_arg_info_Next_out)};
708 static const GDBusArgInfo * const _unity_mpris_player_dbus_arg_info_Previous_in[] = {NULL};
709 static const GDBusArgInfo * const _unity_mpris_player_dbus_arg_info_Previous_out[] = {NULL};
710 static const GDBusMethodInfo _unity_mpris_player_dbus_method_info_Previous = {-1, "Previous", (GDBusArgInfo **) (&_unity_mpris_player_dbus_arg_info_Previous_in), (GDBusArgInfo **) (&_unity_mpris_player_dbus_arg_info_Previous_out)};
711 static const GDBusMethodInfo * const _unity_mpris_player_dbus_method_info[] = {&_unity_mpris_player_dbus_method_info_PlayPause, &_unity_mpris_player_dbus_method_info_Next, &_unity_mpris_player_dbus_method_info_Previous, NULL};
712 static const GDBusSignalInfo * const _unity_mpris_player_dbus_signal_info[] = {NULL};
713 static const GDBusPropertyInfo _unity_mpris_player_dbus_property_info_Metadata = {-1, "Metadata", "a{sv}", G_DBUS_PROPERTY_INFO_FLAGS_READABLE};
714 static const GDBusPropertyInfo _unity_mpris_player_dbus_property_info_PlaybackStatus = {-1, "PlaybackStatus", "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE};
715 static const GDBusPropertyInfo _unity_mpris_player_dbus_property_info_CanControl = {-1, "CanControl", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE};
716 static const GDBusPropertyInfo _unity_mpris_player_dbus_property_info_CanGoNext = {-1, "CanGoNext", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE};
717 static const GDBusPropertyInfo _unity_mpris_player_dbus_property_info_CanGoPrevious = {-1, "CanGoPrevious", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE};
718 static const GDBusPropertyInfo _unity_mpris_player_dbus_property_info_CanPlay = {-1, "CanPlay", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE};
719 static const GDBusPropertyInfo _unity_mpris_player_dbus_property_info_CanPause = {-1, "CanPause", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE};
720 static const GDBusPropertyInfo * const _unity_mpris_player_dbus_property_info[] = {&_unity_mpris_player_dbus_property_info_Metadata, &_unity_mpris_player_dbus_property_info_PlaybackStatus, &_unity_mpris_player_dbus_property_info_CanControl, &_unity_mpris_player_dbus_property_info_CanGoNext, &_unity_mpris_player_dbus_property_info_CanGoPrevious, &_unity_mpris_player_dbus_property_info_CanPlay, &_unity_mpris_player_dbus_property_info_CanPause, NULL};
721 static const GDBusInterfaceInfo _unity_mpris_player_dbus_interface_info = {-1, "org.mpris.MediaPlayer2.Player", (GDBusMethodInfo **) (&_unity_mpris_player_dbus_method_info), (GDBusSignalInfo **) (&_unity_mpris_player_dbus_signal_info), (GDBusPropertyInfo **) (&_unity_mpris_player_dbus_property_info)};
722 static const GDBusInterfaceVTable _unity_mpris_player_dbus_interface_vtable = {unity_mpris_player_dbus_interface_method_call, unity_mpris_player_dbus_interface_get_property, unity_mpris_player_dbus_interface_set_property};
723 static const gchar* UNITY_MPRIS_PLAYLISTS_orderings[1] = {"alphabetical"};
724 static const GDBusArgInfo _unity_mpris_playlists_dbus_arg_info_ActivatePlaylist_playlist_id = {-1, "playlist_id", "o"};
725 static const GDBusArgInfo * const _unity_mpris_playlists_dbus_arg_info_ActivatePlaylist_in[] = {&_unity_mpris_playlists_dbus_arg_info_ActivatePlaylist_playlist_id, NULL};
726 static const GDBusArgInfo * const _unity_mpris_playlists_dbus_arg_info_ActivatePlaylist_out[] = {NULL};
727 static const GDBusMethodInfo _unity_mpris_playlists_dbus_method_info_ActivatePlaylist = {-1, "ActivatePlaylist", (GDBusArgInfo **) (&_unity_mpris_playlists_dbus_arg_info_ActivatePlaylist_in), (GDBusArgInfo **) (&_unity_mpris_playlists_dbus_arg_info_ActivatePlaylist_out)};
728 static const GDBusArgInfo _unity_mpris_playlists_dbus_arg_info_GetPlaylists_index = {-1, "index", "u"};
729 static const GDBusArgInfo _unity_mpris_playlists_dbus_arg_info_GetPlaylists_max_count = {-1, "max_count", "u"};
730 static const GDBusArgInfo _unity_mpris_playlists_dbus_arg_info_GetPlaylists_order = {-1, "order", "s"};
731 static const GDBusArgInfo _unity_mpris_playlists_dbus_arg_info_GetPlaylists_reverse_order = {-1, "reverse_order", "b"};
732 static const GDBusArgInfo _unity_mpris_playlists_dbus_arg_info_GetPlaylists_result = {-1, "result", "a(oss)"};
733 static const GDBusArgInfo * const _unity_mpris_playlists_dbus_arg_info_GetPlaylists_in[] = {&_unity_mpris_playlists_dbus_arg_info_GetPlaylists_index, &_unity_mpris_playlists_dbus_arg_info_GetPlaylists_max_count, &_unity_mpris_playlists_dbus_arg_info_GetPlaylists_order, &_unity_mpris_playlists_dbus_arg_info_GetPlaylists_reverse_order, NULL};
734 static const GDBusArgInfo * const _unity_mpris_playlists_dbus_arg_info_GetPlaylists_out[] = {&_unity_mpris_playlists_dbus_arg_info_GetPlaylists_result, NULL};
735 static const GDBusMethodInfo _unity_mpris_playlists_dbus_method_info_GetPlaylists = {-1, "GetPlaylists", (GDBusArgInfo **) (&_unity_mpris_playlists_dbus_arg_info_GetPlaylists_in), (GDBusArgInfo **) (&_unity_mpris_playlists_dbus_arg_info_GetPlaylists_out)};
736 static const GDBusMethodInfo * const _unity_mpris_playlists_dbus_method_info[] = {&_unity_mpris_playlists_dbus_method_info_ActivatePlaylist, &_unity_mpris_playlists_dbus_method_info_GetPlaylists, NULL};
737 static const GDBusSignalInfo * const _unity_mpris_playlists_dbus_signal_info[] = {NULL};
738 static const GDBusPropertyInfo _unity_mpris_playlists_dbus_property_info_Orderings = {-1, "Orderings", "as", G_DBUS_PROPERTY_INFO_FLAGS_READABLE};
739 static const GDBusPropertyInfo _unity_mpris_playlists_dbus_property_info_PlaylistCount = {-1, "PlaylistCount", "u", G_DBUS_PROPERTY_INFO_FLAGS_READABLE};
740 static const GDBusPropertyInfo _unity_mpris_playlists_dbus_property_info_ActivePlaylist = {-1, "ActivePlaylist", "(b(oss))", G_DBUS_PROPERTY_INFO_FLAGS_READABLE};
741 static const GDBusPropertyInfo * const _unity_mpris_playlists_dbus_property_info[] = {&_unity_mpris_playlists_dbus_property_info_Orderings, &_unity_mpris_playlists_dbus_property_info_PlaylistCount, &_unity_mpris_playlists_dbus_property_info_ActivePlaylist, NULL};
742 static const GDBusInterfaceInfo _unity_mpris_playlists_dbus_interface_info = {-1, "org.mpris.MediaPlayer2.Playlists", (GDBusMethodInfo **) (&_unity_mpris_playlists_dbus_method_info), (GDBusSignalInfo **) (&_unity_mpris_playlists_dbus_signal_info), (GDBusPropertyInfo **) (&_unity_mpris_playlists_dbus_property_info)};
743 static const GDBusInterfaceVTable _unity_mpris_playlists_dbus_interface_vtable = {unity_mpris_playlists_dbus_interface_method_call, unity_mpris_playlists_dbus_interface_get_property, unity_mpris_playlists_dbus_interface_set_property};
744
745 UnityMPRISGateway* unity_mpris_gateway_construct (GType object_type, UnityMusicPlayer* client) {
746 UnityMPRISGateway * self = NULL;
747 UnityMusicPlayer* _tmp0_;
748 g_return_val_if_fail (client != NULL, NULL);
749 _tmp0_ = client;
750 self = (UnityMPRISGateway*) g_object_new (object_type, "consumer", _tmp0_, NULL);
751 return self;
752 }
753
754
755 UnityMPRISGateway* unity_mpris_gateway_new (UnityMusicPlayer* client) {
756 return unity_mpris_gateway_construct (UNITY_TYPE_MPRIS_GATEWAY, client);
757 }
758
759
760 static Block10Data* block10_data_ref (Block10Data* _data10_) {
761 g_atomic_int_inc (&_data10_->_ref_count_);
762 return _data10_;
763 }
764
765
766 static void block10_data_unref (Block10Data* _data10_) {
767 if (g_atomic_int_dec_and_test (&_data10_->_ref_count_)) {
768 _g_object_unref0 (_data10_->self);
769 _g_free0 (_data10_->dbus_name);
770 g_slice_free (Block10Data, _data10_);
771 }
772 }
773
774
775 static void __lambda23_ (Block10Data* _data10_) {
776 UnityMPRISGateway * self;
777 const gchar* _tmp0_;
778 self = _data10_->self;
779 _tmp0_ = _data10_->dbus_name;
780 unity_trace_log ("Owning name %s", _tmp0_);
781 }
782
783
784 static void ___lambda23__gbus_name_acquired_callback (GDBusConnection* connection, const gchar* name, gpointer self) {
785 __lambda23_ (self);
786 }
787
788
789 static void _unity_mpris_gateway_on_name_lost_gbus_name_lost_callback (GDBusConnection* connection, const gchar* name, gpointer self) {
790 unity_mpris_gateway_on_name_lost (self, connection, name);
791 }
792
793
794 void unity_mpris_gateway_export (UnityMPRISGateway* self) {
795 Block10Data* _data10_;
796 guint _tmp0_;
797 GDBusConnection* _tmp1_;
798 UnityPropertyUpdateManager* _tmp4_;
799 UnityMprisRoot* _tmp7_;
800 UnityMprisPlayer* _tmp11_;
801 UnityMprisPlaylists* _tmp15_;
802 UnityMusicPlayer* _tmp33_;
803 GAppInfo* _tmp34_;
804 GAppInfo* _tmp35_;
805 const gchar* _tmp36_ = NULL;
806 gchar* _tmp37_ = NULL;
807 gchar* mpris_extension;
808 const gchar* _tmp38_;
809 gchar* _tmp39_ = NULL;
810 const gchar* _tmp40_;
811 guint _tmp41_ = 0U;
812 GError * _inner_error_ = NULL;
813 g_return_if_fail (self != NULL);
814 _data10_ = g_slice_new0 (Block10Data);
815 _data10_->_ref_count_ = 1;
816 _data10_->self = g_object_ref (self);
817 _tmp0_ = self->priv->bus_name_owner_handle;
818 if (_tmp0_ != ((guint) 0)) {
819 g_critical ("unity-sound-menu-mpris.vala:73: Can not export MPRISGateway@%p. It is " \
820 "already exported", self);
821 block10_data_unref (_data10_);
822 _data10_ = NULL;
823 return;
824 }
825 _tmp1_ = self->priv->dbus_connection;
826 if (_tmp1_ == NULL) {
827 GDBusConnection* _tmp2_ = NULL;
828 GDBusConnection* _tmp3_;
829 _tmp2_ = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &_inner_error_);
830 _tmp3_ = _tmp2_;
831 if (_inner_error_ != NULL) {
832 block10_data_unref (_data10_);
833 _data10_ = NULL;
834 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);
835 g_clear_error (&_inner_error_);
836 return;
837 }
838 _g_object_unref0 (self->priv->dbus_connection);
839 self->priv->dbus_connection = _tmp3_;
840 }
841 _tmp4_ = self->priv->prop_manager;
842 if (_tmp4_ == NULL) {
843 GDBusConnection* _tmp5_;
844 UnityPropertyUpdateManager* _tmp6_;
845 _tmp5_ = self->priv->dbus_connection;
846 _tmp6_ = unity_property_update_manager_new (_tmp5_);
847 _g_object_unref0 (self->priv->prop_manager);
848 self->priv->prop_manager = _tmp6_;
849 }
850 _tmp7_ = self->priv->mpris_root_interface;
851 if (_tmp7_ == NULL) {
852 UnityMusicPlayer* _tmp8_;
853 UnityPropertyUpdateManager* _tmp9_;
854 UnityMprisRoot* _tmp10_;
855 _tmp8_ = self->priv->_consumer;
856 _tmp9_ = self->priv->prop_manager;
857 _tmp10_ = unity_mpris_root_new (_tmp8_, _tmp9_);
858 _g_object_unref0 (self->priv->mpris_root_interface);
859 self->priv->mpris_root_interface = _tmp10_;
860 }
861 _tmp11_ = self->priv->mpris_player_interface;
862 if (_tmp11_ == NULL) {
863 UnityMusicPlayer* _tmp12_;
864 UnityPropertyUpdateManager* _tmp13_;
865 UnityMprisPlayer* _tmp14_;
866 _tmp12_ = self->priv->_consumer;
867 _tmp13_ = self->priv->prop_manager;
868 _tmp14_ = unity_mpris_player_new (_tmp12_, _tmp13_);
869 _g_object_unref0 (self->priv->mpris_player_interface);
870 self->priv->mpris_player_interface = _tmp14_;
871 }
872 _tmp15_ = self->priv->mpris_playlist_interface;
873 if (_tmp15_ == NULL) {
874 UnityMusicPlayer* _tmp16_;
875 UnityPropertyUpdateManager* _tmp17_;
876 UnityMprisPlaylists* _tmp18_;
877 _tmp16_ = self->priv->_consumer;
878 _tmp17_ = self->priv->prop_manager;
879 _tmp18_ = unity_mpris_playlists_new (_tmp16_, _tmp17_, self);
880 _g_object_unref0 (self->priv->mpris_playlist_interface);
881 self->priv->mpris_playlist_interface = _tmp18_;
882 }
883 {
884 GDBusConnection* _tmp19_;
885 UnityMprisRoot* _tmp20_;
886 guint _tmp21_ = 0U;
887 guint _tmp22_;
888 GDBusConnection* _tmp23_;
889 UnityMprisPlayer* _tmp24_;
890 guint _tmp25_ = 0U;
891 guint _tmp26_;
892 _tmp19_ = self->priv->dbus_connection;
893 _tmp20_ = self->priv->mpris_root_interface;
894 _tmp21_ = unity_mpris_root_register_object (_tmp20_, _tmp19_, UNITY_MPRIS_INTERFACE_ROOT_PATH, &_inner_error_);
895 _tmp22_ = _tmp21_;
896 if (_inner_error_ != NULL) {
897 if (_inner_error_->domain == G_IO_ERROR) {
898 goto __catch33_g_io_error;
899 }
900 block10_data_unref (_data10_);
901 _data10_ = NULL;
902 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);
903 g_clear_error (&_inner_error_);
904 return;
905 }
906 self->priv->bus_root_iface_handle = _tmp22_;
907 _tmp23_ = self->priv->dbus_connection;
908 _tmp24_ = self->priv->mpris_player_interface;
909 _tmp25_ = unity_mpris_player_register_object (_tmp24_, _tmp23_, UNITY_MPRIS_INTERFACE_ROOT_PATH, &_inner_error_);
910 _tmp26_ = _tmp25_;
911 if (_inner_error_ != NULL) {
912 if (_inner_error_->domain == G_IO_ERROR) {
913 goto __catch33_g_io_error;
914 }
915 block10_data_unref (_data10_);
916 _data10_ = NULL;
917 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);
918 g_clear_error (&_inner_error_);
919 return;
920 }
921 self->priv->bus_root_iface_handle = _tmp26_;
922 }
923 goto __finally33;
924 __catch33_g_io_error:
925 {
926 GError* e = NULL;
927 UnityMusicPlayer* _tmp27_;
928 GAppInfo* _tmp28_;
929 GAppInfo* _tmp29_;
930 const gchar* _tmp30_ = NULL;
931 GError* _tmp31_;
932 const gchar* _tmp32_;
933 e = _inner_error_;
934 _inner_error_ = NULL;
935 _tmp27_ = self->priv->_consumer;
936 _tmp28_ = unity_music_player_get_app_info (_tmp27_);
937 _tmp29_ = _tmp28_;
938 _tmp30_ = g_app_info_get_name (_tmp29_);
939 _tmp31_ = e;
940 _tmp32_ = _tmp31_->message;
941 g_critical ("unity-sound-menu-mpris.vala:101: Could not register root or player int" \
942 "erface for '%s': %s", _tmp30_, _tmp32_);
943 _g_error_free0 (e);
944 }
945 __finally33:
946 if (_inner_error_ != NULL) {
947 block10_data_unref (_data10_);
948 _data10_ = NULL;
949 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);
950 g_clear_error (&_inner_error_);
951 return;
952 }
953 _tmp33_ = self->priv->_consumer;
954 _tmp34_ = unity_music_player_get_app_info (_tmp33_);
955 _tmp35_ = _tmp34_;
956 _tmp36_ = g_app_info_get_name (_tmp35_);
957 _tmp37_ = g_utf8_strdown (_tmp36_, (gssize) (-1));
958 mpris_extension = _tmp37_;
959 _tmp38_ = mpris_extension;
960 _tmp39_ = g_strconcat (UNITY_MPRIS_INTERFACE_PREFIX, _tmp38_, NULL);
961 _data10_->dbus_name = _tmp39_;
962 _tmp40_ = _data10_->dbus_name;
963 _tmp41_ = g_bus_own_name_with_closures (G_BUS_TYPE_SESSION, _tmp40_, G_BUS_NAME_OWNER_FLAGS_NONE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, NULL)), (GClosure*) ((___lambda23__gbus_name_acquired_callback == NULL) ? NULL : g_cclosure_new ((GCallback) ___lambda23__gbus_name_acquired_callback, block10_data_ref (_data10_), block10_data_unref)), (GClosure*) ((_unity_mpris_gateway_on_name_lost_gbus_name_lost_callback == NULL) ? NULL : g_cclosure_new ((GCallback) _unity_mpris_gateway_on_name_lost_gbus_name_lost_callback, g_object_ref (self), g_object_unref)));
964 self->priv->bus_name_owner_handle = _tmp41_;
965 _g_free0 (mpris_extension);
966 block10_data_unref (_data10_);
967 _data10_ = NULL;
968 }
969
970
971 void unity_mpris_gateway_unexport (UnityMPRISGateway* self) {
972 guint _tmp0_;
973 guint _tmp1_;
974 GDBusConnection* _tmp2_;
975 guint _tmp3_;
976 GDBusConnection* _tmp4_;
977 guint _tmp5_;
978 g_return_if_fail (self != NULL);
979 _tmp0_ = self->priv->bus_name_owner_handle;
980 if (_tmp0_ == ((guint) 0)) {
981 g_critical ("unity-sound-menu-mpris.vala:120: Can not unexport MPRISGateway@%p. It " \
982 "is not exported", self);
983 return;
984 }
985 _tmp1_ = self->priv->bus_name_owner_handle;
986 g_bus_unown_name (_tmp1_);
987 self->priv->bus_name_owner_handle = (guint) 0;
988 _tmp2_ = self->priv->dbus_connection;
989 _tmp3_ = self->priv->bus_root_iface_handle;
990 g_dbus_connection_unregister_object (_tmp2_, _tmp3_);
991 self->priv->bus_root_iface_handle = (guint) 0;
992 _tmp4_ = self->priv->dbus_connection;
993 _tmp5_ = self->priv->bus_player_iface_handle;
994 g_dbus_connection_unregister_object (_tmp4_, _tmp5_);
995 self->priv->bus_player_iface_handle = (guint) 0;
996 }
997
998
999 static void unity_mpris_gateway_on_name_lost (UnityMPRISGateway* self, GDBusConnection* conn, const gchar* name) {
1000 const gchar* _tmp0_;
1001 g_return_if_fail (self != NULL);
1002 g_return_if_fail (conn != NULL);
1003 g_return_if_fail (name != NULL);
1004 _tmp0_ = name;
1005 unity_trace_log_object ((GObject*) self, "Lost name '%s'", _tmp0_);
1006 }
1007
1008
1009 static void unity_mpris_gateway_on_bus_aquired (UnityMPRISGateway* self, GDBusConnection* conn) {
1010 g_return_if_fail (self != NULL);
1011 g_return_if_fail (conn != NULL);
1012 }
1013
1014
1015 void unity_mpris_gateway_ensure_playlist_interface_is_raised (UnityMPRISGateway* self) {
1016 gboolean _tmp0_;
1017 GError * _inner_error_ = NULL;
1018 g_return_if_fail (self != NULL);
1019 _tmp0_ = self->priv->playlist_interface_raised;
1020 if (_tmp0_ == TRUE) {
1021 return;
1022 }
1023 {
1024 GDBusConnection* _tmp1_;
1025 UnityMprisPlaylists* _tmp2_;
1026 _tmp1_ = self->priv->dbus_connection;
1027 _tmp2_ = self->priv->mpris_playlist_interface;
1028 unity_mpris_playlists_register_object (_tmp2_, _tmp1_, UNITY_MPRIS_INTERFACE_ROOT_PATH, &_inner_error_);
1029 if (_inner_error_ != NULL) {
1030 if (_inner_error_->domain == G_IO_ERROR) {
1031 goto __catch34_g_io_error;
1032 }
1033 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);
1034 g_clear_error (&_inner_error_);
1035 return;
1036 }
1037 self->priv->playlist_interface_raised = TRUE;
1038 }
1039 goto __finally34;
1040 __catch34_g_io_error:
1041 {
1042 GError* e = NULL;
1043 UnityMusicPlayer* _tmp3_;
1044 GAppInfo* _tmp4_;
1045 GAppInfo* _tmp5_;
1046 const gchar* _tmp6_ = NULL;
1047 GError* _tmp7_;
1048 const gchar* _tmp8_;
1049 e = _inner_error_;
1050 _inner_error_ = NULL;
1051 _tmp3_ = self->priv->_consumer;
1052 _tmp4_ = unity_music_player_get_app_info (_tmp3_);
1053 _tmp5_ = _tmp4_;
1054 _tmp6_ = g_app_info_get_name (_tmp5_);
1055 _tmp7_ = e;
1056 _tmp8_ = _tmp7_->message;
1057 g_critical ("unity-sound-menu-mpris.vala:153: Could not register playlist interface" \
1058 " for %s: %s", _tmp6_, _tmp8_);
1059 _g_error_free0 (e);
1060 }
1061 __finally34:
1062 if (_inner_error_ != NULL) {
1063 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);
1064 g_clear_error (&_inner_error_);
1065 return;
1066 }
1067 }
1068
1069
1070 UnityMusicPlayer* unity_mpris_gateway_get_consumer (UnityMPRISGateway* self) {
1071 UnityMusicPlayer* result;
1072 UnityMusicPlayer* _tmp0_;
1073 g_return_val_if_fail (self != NULL, NULL);
1074 _tmp0_ = self->priv->_consumer;
1075 result = _tmp0_;
1076 return result;
1077 }
1078
1079
1080 static gpointer _g_object_ref0 (gpointer self) {
1081 return self ? g_object_ref (self) : NULL;
1082 }
1083
1084
1085 static void unity_mpris_gateway_set_consumer (UnityMPRISGateway* self, UnityMusicPlayer* value) {
1086 UnityMusicPlayer* _tmp0_;
1087 UnityMusicPlayer* _tmp1_;
1088 g_return_if_fail (self != NULL);
1089 _tmp0_ = value;
1090 _tmp1_ = _g_object_ref0 (_tmp0_);
1091 _g_object_unref0 (self->priv->_consumer);
1092 self->priv->_consumer = _tmp1_;
1093 g_object_notify ((GObject *) self, "consumer");
1094 }
1095
1096
1097 UnityPlaylist* unity_mpris_gateway_get_edited_playlist (UnityMPRISGateway* self) {
1098 UnityPlaylist* result;
1099 UnityPlaylist* _tmp0_;
1100 g_return_val_if_fail (self != NULL, NULL);
1101 _tmp0_ = self->priv->_edited_playlist;
1102 result = _tmp0_;
1103 return result;
1104 }
1105
1106
1107 void unity_mpris_gateway_set_edited_playlist (UnityMPRISGateway* self, UnityPlaylist* value) {
1108 UnityPlaylist* _tmp0_;
1109 UnityPlaylist* _tmp1_;
1110 g_return_if_fail (self != NULL);
1111 _tmp0_ = value;
1112 _tmp1_ = _g_object_ref0 (_tmp0_);
1113 _g_object_unref0 (self->priv->_edited_playlist);
1114 self->priv->_edited_playlist = _tmp1_;
1115 g_object_notify ((GObject *) self, "edited-playlist");
1116 }
1117
1118
1119 gint unity_mpris_gateway_get_playlist_count (UnityMPRISGateway* self) {
1120 gint result;
1121 gint _tmp0_;
1122 g_return_val_if_fail (self != NULL, 0);
1123 _tmp0_ = self->priv->_playlist_count;
1124 result = _tmp0_;
1125 return result;
1126 }
1127
1128
1129 void unity_mpris_gateway_set_playlist_count (UnityMPRISGateway* self, gint value) {
1130 gint _tmp0_;
1131 g_return_if_fail (self != NULL);
1132 _tmp0_ = value;
1133 self->priv->_playlist_count = _tmp0_;
1134 g_object_notify ((GObject *) self, "playlist-count");
1135 }
1136
1137
1138 static GObject * unity_mpris_gateway_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
1139 GObject * obj;
1140 GObjectClass * parent_class;
1141 UnityMPRISGateway * self;
1142 UnityMusicPlayer* _tmp0_;
1143 UnityBlacklistManager* _tmp1_;
1144 UnityMusicPlayer* _tmp2_;
1145 UnitySpecificItemManager* _tmp3_;
1146 parent_class = G_OBJECT_CLASS (unity_mpris_gateway_parent_class);
1147 obj = parent_class->constructor (type, n_construct_properties, construct_properties);
1148 self = UNITY_MPRIS_GATEWAY (obj);
1149 _tmp0_ = self->priv->_consumer;
1150 _tmp1_ = unity_blacklist_manager_new (_tmp0_);
1151 _g_object_unref0 (self->priv->blacklist_mgr);
1152 self->priv->blacklist_mgr = _tmp1_;
1153 _tmp2_ = self->priv->_consumer;
1154 _tmp3_ = unity_specific_item_manager_new (_tmp2_);
1155 _g_object_unref0 (self->priv->specific_menuitem_mgr);
1156 self->priv->specific_menuitem_mgr = _tmp3_;
1157 self->priv->playlist_interface_raised = FALSE;
1158 self->priv->bus_name_owner_handle = (guint) 0;
1159 self->priv->bus_root_iface_handle = (guint) 0;
1160 self->priv->bus_player_iface_handle = (guint) 0;
1161 return obj;
1162 }
1163
1164
1165 static void unity_mpris_gateway_class_init (UnityMPRISGatewayClass * klass) {
1166 unity_mpris_gateway_parent_class = g_type_class_peek_parent (klass);
1167 g_type_class_add_private (klass, sizeof (UnityMPRISGatewayPrivate));
1168 G_OBJECT_CLASS (klass)->get_property = _vala_unity_mpris_gateway_get_property;
1169 G_OBJECT_CLASS (klass)->set_property = _vala_unity_mpris_gateway_set_property;
1170 G_OBJECT_CLASS (klass)->constructor = unity_mpris_gateway_constructor;
1171 G_OBJECT_CLASS (klass)->finalize = unity_mpris_gateway_finalize;
1172 g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_MPRIS_GATEWAY_CONSUMER, g_param_spec_object ("consumer", "consumer", "consumer", UNITY_TYPE_MUSIC_PLAYER, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
1173 g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_MPRIS_GATEWAY_EDITED_PLAYLIST, g_param_spec_object ("edited-playlist", "edited-playlist", "edited-playlist", UNITY_TYPE_PLAYLIST, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
1174 g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_MPRIS_GATEWAY_PLAYLIST_COUNT, g_param_spec_int ("playlist-count", "playlist-count", "playlist-count", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
1175 }
1176
1177
1178 static void unity_mpris_gateway_instance_init (UnityMPRISGateway * self) {
1179 self->priv = UNITY_MPRIS_GATEWAY_GET_PRIVATE (self);
1180 }
1181
1182
1183 static void unity_mpris_gateway_finalize (GObject* obj) {
1184 UnityMPRISGateway * self;
1185 self = UNITY_MPRIS_GATEWAY (obj);
1186 _g_object_unref0 (self->priv->_consumer);
1187 _g_object_unref0 (self->priv->mpris_root_interface);
1188 _g_object_unref0 (self->priv->mpris_player_interface);
1189 _g_object_unref0 (self->priv->mpris_playlist_interface);
1190 _g_object_unref0 (self->priv->prop_manager);
1191 _g_object_unref0 (self->priv->blacklist_mgr);
1192 _g_object_unref0 (self->priv->specific_menuitem_mgr);
1193 _g_object_unref0 (self->priv->dbus_connection);
1194 _g_object_unref0 (self->priv->_edited_playlist);
1195 G_OBJECT_CLASS (unity_mpris_gateway_parent_class)->finalize (obj);
1196 }
1197
1198
1199 GType unity_mpris_gateway_get_type (void) {
1200 static volatile gsize unity_mpris_gateway_type_id__volatile = 0;
1201 if (g_once_init_enter (&unity_mpris_gateway_type_id__volatile)) {
1202 static const GTypeInfo g_define_type_info = { sizeof (UnityMPRISGatewayClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) unity_mpris_gateway_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UnityMPRISGateway), 0, (GInstanceInitFunc) unity_mpris_gateway_instance_init, NULL };
1203 GType unity_mpris_gateway_type_id;
1204 unity_mpris_gateway_type_id = g_type_register_static (G_TYPE_OBJECT, "UnityMPRISGateway", &g_define_type_info, 0);
1205 g_once_init_leave (&unity_mpris_gateway_type_id__volatile, unity_mpris_gateway_type_id);
1206 }
1207 return unity_mpris_gateway_type_id__volatile;
1208 }
1209
1210
1211 static void _vala_unity_mpris_gateway_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
1212 UnityMPRISGateway * self;
1213 self = UNITY_MPRIS_GATEWAY (object);
1214 switch (property_id) {
1215 case UNITY_MPRIS_GATEWAY_CONSUMER:
1216 g_value_set_object (value, unity_mpris_gateway_get_consumer (self));
1217 break;
1218 case UNITY_MPRIS_GATEWAY_EDITED_PLAYLIST:
1219 g_value_set_object (value, unity_mpris_gateway_get_edited_playlist (self));
1220 break;
1221 case UNITY_MPRIS_GATEWAY_PLAYLIST_COUNT:
1222 g_value_set_int (value, unity_mpris_gateway_get_playlist_count (self));
1223 break;
1224 default:
1225 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
1226 break;
1227 }
1228 }
1229
1230
1231 static void _vala_unity_mpris_gateway_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
1232 UnityMPRISGateway * self;
1233 self = UNITY_MPRIS_GATEWAY (object);
1234 switch (property_id) {
1235 case UNITY_MPRIS_GATEWAY_CONSUMER:
1236 unity_mpris_gateway_set_consumer (self, g_value_get_object (value));
1237 break;
1238 case UNITY_MPRIS_GATEWAY_EDITED_PLAYLIST:
1239 unity_mpris_gateway_set_edited_playlist (self, g_value_get_object (value));
1240 break;
1241 case UNITY_MPRIS_GATEWAY_PLAYLIST_COUNT:
1242 unity_mpris_gateway_set_playlist_count (self, g_value_get_int (value));
1243 break;
1244 default:
1245 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
1246 break;
1247 }
1248 }
1249
1250
1251 UnitySpecificItemManager* unity_specific_item_manager_construct (GType object_type, UnityMusicPlayer* client) {
1252 UnitySpecificItemManager * self = NULL;
1253 UnityMusicPlayer* _tmp0_;
1254 g_return_val_if_fail (client != NULL, NULL);
1255 _tmp0_ = client;
1256 self = (UnitySpecificItemManager*) g_object_new (object_type, "consumer", _tmp0_, NULL);
1257 return self;
1258 }
1259
1260
1261 UnitySpecificItemManager* unity_specific_item_manager_new (UnityMusicPlayer* client) {
1262 return unity_specific_item_manager_construct (UNITY_TYPE_SPECIFIC_ITEM_MANAGER, client);
1263 }
1264
1265
1266 static void unity_specific_item_manager_on_track_specific_change (UnitySpecificItemManager* self, GParamSpec* p) {
1267 gboolean _tmp0_ = FALSE;
1268 UnityMusicPlayer* _tmp1_;
1269 DbusmenuMenuitem* _tmp2_;
1270 DbusmenuMenuitem* _tmp3_;
1271 gboolean _tmp5_;
1272 g_return_if_fail (self != NULL);
1273 g_return_if_fail (p != NULL);
1274 _tmp1_ = self->priv->_consumer;
1275 _tmp2_ = unity_music_player_get_track_menu (_tmp1_);
1276 _tmp3_ = _tmp2_;
1277 if (_tmp3_ != NULL) {
1278 DbusmenuServer* _tmp4_;
1279 _tmp4_ = self->priv->_track_item_server;
1280 _tmp0_ = _tmp4_ == NULL;
1281 } else {
1282 _tmp0_ = FALSE;
1283 }
1284 _tmp5_ = _tmp0_;
1285 if (_tmp5_) {
1286 const char* _tmp6_;
1287 DbusmenuServer* _tmp7_;
1288 UnitySoundServiceInterface* _tmp8_;
1289 const char* _tmp9_;
1290 UnityMusicPlayer* _tmp10_;
1291 const gchar* _tmp11_;
1292 const gchar* _tmp12_;
1293 gchar** _tmp13_;
1294 gchar** _tmp14_ = NULL;
1295 gchar** _tmp15_;
1296 gint _tmp15__length1;
1297 const gchar* _tmp16_;
1298 DbusmenuServer* _tmp17_;
1299 UnityMusicPlayer* _tmp18_;
1300 DbusmenuMenuitem* _tmp19_;
1301 DbusmenuMenuitem* _tmp20_;
1302 _tmp6_ = self->_track_specific_object_path;
1303 _tmp7_ = dbusmenu_server_new ((const gchar*) _tmp6_);
1304 _g_object_unref0 (self->priv->_track_item_server);
1305 self->priv->_track_item_server = _tmp7_;
1306 _tmp8_ = self->priv->sound_service_interface;
1307 _tmp9_ = self->_track_specific_object_path;
1308 _tmp10_ = self->priv->_consumer;
1309 _tmp11_ = unity_music_player_get_desktop_file_name (_tmp10_);
1310 _tmp12_ = _tmp11_;
1311 _tmp14_ = _tmp13_ = g_strsplit (_tmp12_, ".", 0);
1312 _tmp15_ = _tmp14_;
1313 _tmp15__length1 = _vala_array_length (_tmp13_);
1314 _tmp16_ = _tmp15_[0];
1315 unity_sound_service_interface_EnableTrackSpecificItems (_tmp8_, _tmp9_, _tmp16_, NULL, NULL);
1316 _tmp15_ = (_vala_array_free (_tmp15_, _tmp15__length1, (GDestroyNotify) g_free), NULL);
1317 _tmp17_ = self->priv->_track_item_server;
1318 _tmp18_ = self->priv->_consumer;
1319 _tmp19_ = unity_music_player_get_track_menu (_tmp18_);
1320 _tmp20_ = _tmp19_;
1321 g_object_set (_tmp17_, "root-node", _tmp20_, NULL);
1322 } else {
1323 UnityMusicPlayer* _tmp21_;
1324 DbusmenuMenuitem* _tmp22_;
1325 DbusmenuMenuitem* _tmp23_;
1326 _tmp21_ = self->priv->_consumer;
1327 _tmp22_ = unity_music_player_get_track_menu (_tmp21_);
1328 _tmp23_ = _tmp22_;
1329 if (_tmp23_ == NULL) {
1330 _g_object_unref0 (self->priv->_track_item_server);
1331 self->priv->_track_item_server = NULL;
1332 }
1333 }
1334 }
1335
1336
1337 static void unity_specific_item_manager_on_player_specific_change (UnitySpecificItemManager* self, GParamSpec* p) {
1338 gboolean _tmp0_ = FALSE;
1339 UnityMusicPlayer* _tmp1_;
1340 DbusmenuMenuitem* _tmp2_;
1341 DbusmenuMenuitem* _tmp3_;
1342 gboolean _tmp5_;
1343 g_return_if_fail (self != NULL);
1344 g_return_if_fail (p != NULL);
1345 _tmp1_ = self->priv->_consumer;
1346 _tmp2_ = unity_music_player_get_player_menu (_tmp1_);
1347 _tmp3_ = _tmp2_;
1348 if (_tmp3_ != NULL) {
1349 DbusmenuServer* _tmp4_;
1350 _tmp4_ = self->priv->_player_item_server;
1351 _tmp0_ = _tmp4_ == NULL;
1352 } else {
1353 _tmp0_ = FALSE;
1354 }
1355 _tmp5_ = _tmp0_;
1356 if (_tmp5_) {
1357 const char* _tmp6_;
1358 DbusmenuServer* _tmp7_;
1359 UnitySoundServiceInterface* _tmp8_;
1360 const char* _tmp9_;
1361 UnityMusicPlayer* _tmp10_;
1362 const gchar* _tmp11_;
1363 const gchar* _tmp12_;
1364 gchar** _tmp13_;
1365 gchar** _tmp14_ = NULL;
1366 gchar** _tmp15_;
1367 gint _tmp15__length1;
1368 const gchar* _tmp16_;
1369 DbusmenuServer* _tmp17_;
1370 UnityMusicPlayer* _tmp18_;
1371 DbusmenuMenuitem* _tmp19_;
1372 DbusmenuMenuitem* _tmp20_;
1373 _tmp6_ = self->_player_specific_object_path;
1374 _tmp7_ = dbusmenu_server_new ((const gchar*) _tmp6_);
1375 _g_object_unref0 (self->priv->_player_item_server);
1376 self->priv->_player_item_server = _tmp7_;
1377 _tmp8_ = self->priv->sound_service_interface;
1378 _tmp9_ = self->_player_specific_object_path;
1379 _tmp10_ = self->priv->_consumer;
1380 _tmp11_ = unity_music_player_get_desktop_file_name (_tmp10_);
1381 _tmp12_ = _tmp11_;
1382 _tmp14_ = _tmp13_ = g_strsplit (_tmp12_, ".", 0);
1383 _tmp15_ = _tmp14_;
1384 _tmp15__length1 = _vala_array_length (_tmp13_);
1385 _tmp16_ = _tmp15_[0];
1386 unity_sound_service_interface_EnablePlayerSpecificItems (_tmp8_, _tmp9_, _tmp16_, NULL, NULL);
1387 _tmp15_ = (_vala_array_free (_tmp15_, _tmp15__length1, (GDestroyNotify) g_free), NULL);
1388 _tmp17_ = self->priv->_player_item_server;
1389 _tmp18_ = self->priv->_consumer;
1390 _tmp19_ = unity_music_player_get_player_menu (_tmp18_);
1391 _tmp20_ = _tmp19_;
1392 g_object_set (_tmp17_, "root-node", _tmp20_, NULL);
1393 } else {
1394 UnityMusicPlayer* _tmp21_;
1395 DbusmenuMenuitem* _tmp22_;
1396 DbusmenuMenuitem* _tmp23_;
1397 _tmp21_ = self->priv->_consumer;
1398 _tmp22_ = unity_music_player_get_player_menu (_tmp21_);
1399 _tmp23_ = _tmp22_;
1400 if (_tmp23_ == NULL) {
1401 _g_object_unref0 (self->priv->_player_item_server);
1402 self->priv->_player_item_server = NULL;
1403 }
1404 }
1405 }
1406
1407
1408 UnityMusicPlayer* unity_specific_item_manager_get_consumer (UnitySpecificItemManager* self) {
1409 UnityMusicPlayer* result;
1410 UnityMusicPlayer* _tmp0_;
1411 g_return_val_if_fail (self != NULL, NULL);
1412 _tmp0_ = self->priv->_consumer;
1413 result = _tmp0_;
1414 return result;
1415 }
1416
1417
1418 static void unity_specific_item_manager_set_consumer (UnitySpecificItemManager* self, UnityMusicPlayer* value) {
1419 UnityMusicPlayer* _tmp0_;
1420 UnityMusicPlayer* _tmp1_;
1421 g_return_if_fail (self != NULL);
1422 _tmp0_ = value;
1423 _tmp1_ = _g_object_ref0 (_tmp0_);
1424 _g_object_unref0 (self->priv->_consumer);
1425 self->priv->_consumer = _tmp1_;
1426 g_object_notify ((GObject *) self, "consumer");
1427 }
1428
1429
1430 static const gchar* string_to_string (const gchar* self) {
1431 const gchar* result = NULL;
1432 g_return_val_if_fail (self != NULL, NULL);
1433 result = self;
1434 return result;
1435 }
1436
1437
1438 static void _unity_specific_item_manager_on_track_specific_change_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
1439 unity_specific_item_manager_on_track_specific_change (self, pspec);
1440 }
1441
1442
1443 static void _unity_specific_item_manager_on_player_specific_change_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
1444 unity_specific_item_manager_on_player_specific_change (self, pspec);
1445 }
1446
1447
1448 static GObject * unity_specific_item_manager_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
1449 GObject * obj;
1450 GObjectClass * parent_class;
1451 UnitySpecificItemManager * self;
1452 UnityMusicPlayer* _tmp0_;
1453 GAppInfo* _tmp1_;
1454 GAppInfo* _tmp2_;
1455 const gchar* _tmp3_ = NULL;
1456 gchar* _tmp4_ = NULL;
1457 gchar* _tmp5_;
1458 const gchar* _tmp6_ = NULL;
1459 gchar* _tmp7_ = NULL;
1460 gchar* _tmp8_;
1461 char* _tmp9_;
1462 UnityMusicPlayer* _tmp10_;
1463 GAppInfo* _tmp11_;
1464 GAppInfo* _tmp12_;
1465 const gchar* _tmp13_ = NULL;
1466 gchar* _tmp14_ = NULL;
1467 gchar* _tmp15_;
1468 const gchar* _tmp16_ = NULL;
1469 gchar* _tmp17_ = NULL;
1470 gchar* _tmp18_;
1471 char* _tmp19_;
1472 UnitySoundServiceInterface* _tmp20_ = NULL;
1473 UnitySoundServiceInterface* _tmp21_;
1474 UnityMusicPlayer* _tmp22_;
1475 UnityMusicPlayer* _tmp23_;
1476 GError * _inner_error_ = NULL;
1477 parent_class = G_OBJECT_CLASS (unity_specific_item_manager_parent_class);
1478 obj = parent_class->constructor (type, n_construct_properties, construct_properties);
1479 self = UNITY_SPECIFIC_ITEM_MANAGER (obj);
1480 _g_object_unref0 (self->priv->_track_item_server);
1481 self->priv->_track_item_server = NULL;
1482 _g_object_unref0 (self->priv->_player_item_server);
1483 self->priv->_player_item_server = NULL;
1484 _tmp0_ = self->priv->_consumer;
1485 _tmp1_ = unity_music_player_get_app_info (_tmp0_);
1486 _tmp2_ = _tmp1_;
1487 _tmp3_ = g_app_info_get_name (_tmp2_);
1488 _tmp4_ = g_utf8_strdown (_tmp3_, (gssize) (-1));
1489 _tmp5_ = _tmp4_;
1490 _tmp6_ = string_to_string (_tmp5_);
1491 _tmp7_ = g_strconcat ("/com/canonical/indicators/sound/track_specific/", _tmp6_, NULL);
1492 _tmp8_ = _tmp7_;
1493 _tmp9_ = g_strdup (_tmp8_);
1494 _g_free0 (self->_track_specific_object_path);
1495 self->_track_specific_object_path = _tmp9_;
1496 _g_free0 (_tmp8_);
1497 _g_free0 (_tmp5_);
1498 _tmp10_ = self->priv->_consumer;
1499 _tmp11_ = unity_music_player_get_app_info (_tmp10_);
1500 _tmp12_ = _tmp11_;
1501 _tmp13_ = g_app_info_get_name (_tmp12_);
1502 _tmp14_ = g_utf8_strdown (_tmp13_, (gssize) (-1));
1503 _tmp15_ = _tmp14_;
1504 _tmp16_ = string_to_string (_tmp15_);
1505 _tmp17_ = g_strconcat ("/com/canonical/indicators/sound/player_specific/", _tmp16_, NULL);
1506 _tmp18_ = _tmp17_;
1507 _tmp19_ = g_strdup (_tmp18_);
1508 _g_free0 (self->_player_specific_object_path);
1509 self->_player_specific_object_path = _tmp19_;
1510 _g_free0 (_tmp18_);
1511 _g_free0 (_tmp15_);
1512 _tmp20_ = g_initable_new (UNITY_TYPE_SOUND_SERVICE_INTERFACE_PROXY, NULL, &_inner_error_, "g-flags", G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START, "g-name", "com.canonical.indicators.sound", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/com/canonical/indicators/sound/service", "g-interface-name", "com.canonical.indicators.sound", NULL);
1513 _tmp21_ = (UnitySoundServiceInterface*) _tmp20_;
1514 if (_inner_error_ != NULL) {
1515 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);
1516 g_clear_error (&_inner_error_);
1517 }
1518 _g_object_unref0 (self->priv->sound_service_interface);
1519 self->priv->sound_service_interface = _tmp21_;
1520 _tmp22_ = self->priv->_consumer;
1521 g_signal_connect_object ((GObject*) _tmp22_, "notify::track-menu", (GCallback) _unity_specific_item_manager_on_track_specific_change_g_object_notify, self, 0);
1522 _tmp23_ = self->priv->_consumer;
1523 g_signal_connect_object ((GObject*) _tmp23_, "notify::player-menu", (GCallback) _unity_specific_item_manager_on_player_specific_change_g_object_notify, self, 0);
1524 return obj;
1525 }
1526
1527
1528 static void unity_specific_item_manager_class_init (UnitySpecificItemManagerClass * klass) {
1529 unity_specific_item_manager_parent_class = g_type_class_peek_parent (klass);
1530 g_type_class_add_private (klass, sizeof (UnitySpecificItemManagerPrivate));
1531 G_OBJECT_CLASS (klass)->get_property = _vala_unity_specific_item_manager_get_property;
1532 G_OBJECT_CLASS (klass)->set_property = _vala_unity_specific_item_manager_set_property;
1533 G_OBJECT_CLASS (klass)->constructor = unity_specific_item_manager_constructor;
1534 G_OBJECT_CLASS (klass)->finalize = unity_specific_item_manager_finalize;
1535 g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_SPECIFIC_ITEM_MANAGER_CONSUMER, g_param_spec_object ("consumer", "consumer", "consumer", UNITY_TYPE_MUSIC_PLAYER, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
1536 }
1537
1538
1539 static void unity_specific_item_manager_instance_init (UnitySpecificItemManager * self) {
1540 self->priv = UNITY_SPECIFIC_ITEM_MANAGER_GET_PRIVATE (self);
1541 }
1542
1543
1544 static void unity_specific_item_manager_finalize (GObject* obj) {
1545 UnitySpecificItemManager * self;
1546 self = UNITY_SPECIFIC_ITEM_MANAGER (obj);
1547 _g_object_unref0 (self->priv->_player_item_server);
1548 _g_free0 (self->_player_specific_object_path);
1549 _g_object_unref0 (self->priv->_track_item_server);
1550 _g_free0 (self->_track_specific_object_path);
1551 _g_object_unref0 (self->priv->_consumer);
1552 _g_object_unref0 (self->priv->sound_service_interface);
1553 G_OBJECT_CLASS (unity_specific_item_manager_parent_class)->finalize (obj);
1554 }
1555
1556
1557 GType unity_specific_item_manager_get_type (void) {
1558 static volatile gsize unity_specific_item_manager_type_id__volatile = 0;
1559 if (g_once_init_enter (&unity_specific_item_manager_type_id__volatile)) {
1560 static const GTypeInfo g_define_type_info = { sizeof (UnitySpecificItemManagerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) unity_specific_item_manager_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UnitySpecificItemManager), 0, (GInstanceInitFunc) unity_specific_item_manager_instance_init, NULL };
1561 GType unity_specific_item_manager_type_id;
1562 unity_specific_item_manager_type_id = g_type_register_static (G_TYPE_OBJECT, "UnitySpecificItemManager", &g_define_type_info, 0);
1563 g_once_init_leave (&unity_specific_item_manager_type_id__volatile, unity_specific_item_manager_type_id);
1564 }
1565 return unity_specific_item_manager_type_id__volatile;
1566 }
1567
1568
1569 static void _vala_unity_specific_item_manager_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
1570 UnitySpecificItemManager * self;
1571 self = UNITY_SPECIFIC_ITEM_MANAGER (object);
1572 switch (property_id) {
1573 case UNITY_SPECIFIC_ITEM_MANAGER_CONSUMER:
1574 g_value_set_object (value, unity_specific_item_manager_get_consumer (self));
1575 break;
1576 default:
1577 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
1578 break;
1579 }
1580 }
1581
1582
1583 static void _vala_unity_specific_item_manager_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
1584 UnitySpecificItemManager * self;
1585 self = UNITY_SPECIFIC_ITEM_MANAGER (object);
1586 switch (property_id) {
1587 case UNITY_SPECIFIC_ITEM_MANAGER_CONSUMER:
1588 unity_specific_item_manager_set_consumer (self, g_value_get_object (value));
1589 break;
1590 default:
1591 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
1592 break;
1593 }
1594 }
1595
1596
1597 UnityPropertyUpdateManager* unity_property_update_manager_construct (GType object_type, GDBusConnection* conn) {
1598 UnityPropertyUpdateManager * self = NULL;
1599 GDBusConnection* _tmp0_;
1600 g_return_val_if_fail (conn != NULL, NULL);
1601 _tmp0_ = conn;
1602 self = (UnityPropertyUpdateManager*) g_object_new (object_type, "connection", _tmp0_, NULL);
1603 return self;
1604 }
1605
1606
1607 UnityPropertyUpdateManager* unity_property_update_manager_new (GDBusConnection* conn) {
1608 return unity_property_update_manager_construct (UNITY_TYPE_PROPERTY_UPDATE_MANAGER, conn);
1609 }
1610
1611
1612 static Block11Data* block11_data_ref (Block11Data* _data11_) {
1613 g_atomic_int_inc (&_data11_->_ref_count_);
1614 return _data11_;
1615 }
1616
1617
1618 static void block11_data_unref (Block11Data* _data11_) {
1619 if (g_atomic_int_dec_and_test (&_data11_->_ref_count_)) {
1620 _g_object_unref0 (_data11_->self);
1621 _g_free0 (_data11_->interface_name);
1622 g_slice_free (Block11Data, _data11_);
1623 }
1624 }
1625
1626
1627 static gpointer _g_hash_table_ref0 (gpointer self) {
1628 return self ? g_hash_table_ref (self) : NULL;
1629 }
1630
1631
1632 static gpointer _g_variant_ref0 (gpointer self) {
1633 return self ? g_variant_ref (self) : NULL;
1634 }
1635
1636
1637 static gboolean ___lambda16_ (Block11Data* _data11_) {
1638 UnityPropertyUpdateManager * self;
1639 gboolean result = FALSE;
1640 const gchar* _tmp0_;
1641 gboolean _tmp1_ = FALSE;
1642 self = _data11_->self;
1643 _tmp0_ = _data11_->interface_name;
1644 _tmp1_ = unity_property_update_manager_dispatch_property_update (self, _tmp0_);
1645 result = _tmp1_;
1646 return result;
1647 }
1648
1649
1650 static gboolean ____lambda16__gsource_func (gpointer self) {
1651 gboolean result;
1652 result = ___lambda16_ (self);
1653 return result;
1654 }
1655
1656
1657 void unity_property_update_manager_queue_property_update (UnityPropertyUpdateManager* self, const gchar* prop_name, GVariant* update, const gchar* interface_name) {
1658 Block11Data* _data11_;
1659 const gchar* _tmp0_;
1660 gchar* _tmp1_;
1661 GHashTable* _tmp2_;
1662 const gchar* _tmp3_;
1663 gconstpointer _tmp4_ = NULL;
1664 GHashTable* _tmp5_;
1665 GHashTable* appropriate_hash;
1666 GHashTable* _tmp6_;
1667 const gchar* _tmp7_;
1668 gchar* _tmp8_;
1669 GVariant* _tmp9_;
1670 GVariant* _tmp10_;
1671 GHashTable* _tmp11_;
1672 const gchar* _tmp12_;
1673 gconstpointer _tmp13_ = NULL;
1674 guint appropriate_source_id;
1675 guint _tmp14_;
1676 g_return_if_fail (self != NULL);
1677 g_return_if_fail (prop_name != NULL);
1678 g_return_if_fail (update != NULL);
1679 g_return_if_fail (interface_name != NULL);
1680 _data11_ = g_slice_new0 (Block11Data);
1681 _data11_->_ref_count_ = 1;
1682 _data11_->self = g_object_ref (self);
1683 _tmp0_ = interface_name;
1684 _tmp1_ = g_strdup (_tmp0_);
1685 _data11_->interface_name = _tmp1_;
1686 _tmp2_ = self->priv->queued_properties;
1687 _tmp3_ = _data11_->interface_name;
1688 _tmp4_ = g_hash_table_lookup (_tmp2_, _tmp3_);
1689 _tmp5_ = _g_hash_table_ref0 ((GHashTable*) _tmp4_);
1690 appropriate_hash = _tmp5_;
1691 _tmp6_ = appropriate_hash;
1692 _tmp7_ = prop_name;
1693 _tmp8_ = g_strdup (_tmp7_);
1694 _tmp9_ = update;
1695 _tmp10_ = _g_variant_ref0 (_tmp9_);
1696 g_hash_table_insert (_tmp6_, _tmp8_, _tmp10_);
1697 _tmp11_ = self->priv->source_ids;
1698 _tmp12_ = _data11_->interface_name;
1699 _tmp13_ = g_hash_table_lookup (_tmp11_, _tmp12_);
1700 appropriate_source_id = GPOINTER_TO_UINT (_tmp13_);
1701 _tmp14_ = appropriate_source_id;
1702 if (_tmp14_ == ((guint) 0)) {
1703 guint _tmp15_ = 0U;
1704 GHashTable* _tmp16_;
1705 const gchar* _tmp17_;
1706 gchar* _tmp18_;
1707 guint _tmp19_;
1708 _tmp15_ = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ____lambda16__gsource_func, block11_data_ref (_data11_), block11_data_unref);
1709 appropriate_source_id = _tmp15_;
1710 _tmp16_ = self->priv->source_ids;
1711 _tmp17_ = _data11_->interface_name;
1712 _tmp18_ = g_strdup (_tmp17_);
1713 _tmp19_ = appropriate_source_id;
1714 g_hash_table_insert (_tmp16_, _tmp18_, GUINT_TO_POINTER (_tmp19_));
1715 }
1716 _g_hash_table_unref0 (appropriate_hash);
1717 block11_data_unref (_data11_);
1718 _data11_ = NULL;
1719 }
1720
1721
1722 static gboolean unity_property_update_manager_dispatch_property_update (UnityPropertyUpdateManager* self, const gchar* interface_name) {
1723 gboolean result = FALSE;
1724 GVariantType* _tmp0_;
1725 GVariantType* _tmp1_;
1726 GVariantBuilder* _tmp2_;
1727 GVariantBuilder* _tmp3_;
1728 GVariantBuilder* builder;
1729 GVariantType* _tmp4_;
1730 GVariantType* _tmp5_;
1731 GVariantBuilder* _tmp6_;
1732 GVariantBuilder* _tmp7_;
1733 GVariantBuilder* invalidated_builder;
1734 GHashTable* _tmp8_;
1735 const gchar* _tmp9_;
1736 gconstpointer _tmp10_ = NULL;
1737 GHashTable* _tmp11_;
1738 GHashTable* appropriate_hash;
1739 GHashTable* _tmp12_;
1740 GHashTable* _tmp14_;
1741 guint _tmp15_ = 0U;
1742 GHashTable* _tmp19_;
1743 GList* _tmp20_ = NULL;
1744 const gchar* _tmp31_;
1745 GVariantBuilder* _tmp32_;
1746 GVariantBuilder* _tmp33_;
1747 GVariant* _tmp34_;
1748 GVariant* _tmp35_;
1749 GHashTable* _tmp36_;
1750 const gchar* _tmp37_;
1751 gchar* _tmp38_;
1752 GHashTable* _tmp39_;
1753 g_return_val_if_fail (self != NULL, FALSE);
1754 g_return_val_if_fail (interface_name != NULL, FALSE);
1755 _tmp0_ = g_variant_type_new ("a{sv}");
1756 _tmp1_ = _tmp0_;
1757 _tmp2_ = g_variant_builder_new (_tmp1_);
1758 _tmp3_ = _tmp2_;
1759 _g_variant_type_free0 (_tmp1_);
1760 builder = _tmp3_;
1761 _tmp4_ = g_variant_type_new ("as");
1762 _tmp5_ = _tmp4_;
1763 _tmp6_ = g_variant_builder_new (_tmp5_);
1764 _tmp7_ = _tmp6_;
1765 _g_variant_type_free0 (_tmp5_);
1766 invalidated_builder = _tmp7_;
1767 _tmp8_ = self->priv->queued_properties;
1768 _tmp9_ = interface_name;
1769 _tmp10_ = g_hash_table_lookup (_tmp8_, _tmp9_);
1770 _tmp11_ = _g_hash_table_ref0 ((GHashTable*) _tmp10_);
1771 appropriate_hash = _tmp11_;
1772 _tmp12_ = appropriate_hash;
1773 if (_tmp12_ == NULL) {
1774 const gchar* _tmp13_;
1775 _tmp13_ = interface_name;
1776 g_warning ("unity-sound-menu-mpris.vala:256: can't find the appropriate hash withi" \
1777 "n queued properties for name %s", _tmp13_);
1778 result = FALSE;
1779 _g_hash_table_unref0 (appropriate_hash);
1780 _g_variant_builder_unref0 (invalidated_builder);
1781 _g_variant_builder_unref0 (builder);
1782 return result;
1783 }
1784 _tmp14_ = appropriate_hash;
1785 _tmp15_ = g_hash_table_size (_tmp14_);
1786 if (_tmp15_ == ((guint) 0)) {
1787 GHashTable* _tmp16_;
1788 const gchar* _tmp17_;
1789 gchar* _tmp18_;
1790 g_warning ("unity-sound-menu-mpris.vala:260: dispatch called on an empty array !!!");
1791 _tmp16_ = self->priv->source_ids;
1792 _tmp17_ = interface_name;
1793 _tmp18_ = g_strdup (_tmp17_);
1794 g_hash_table_insert (_tmp16_, _tmp18_, GUINT_TO_POINTER ((guint) 0));
1795 result = FALSE;
1796 _g_hash_table_unref0 (appropriate_hash);
1797 _g_variant_builder_unref0 (invalidated_builder);
1798 _g_variant_builder_unref0 (builder);
1799 return result;
1800 }
1801 _tmp19_ = appropriate_hash;
1802 _tmp20_ = g_hash_table_get_keys (_tmp19_);
1803 {
1804 GList* name_collection = NULL;
1805 GList* name_it = NULL;
1806 name_collection = _tmp20_;
1807 for (name_it = name_collection; name_it != NULL; name_it = name_it->next) {
1808 gchar* _tmp21_;
1809 gchar* name = NULL;
1810 _tmp21_ = g_strdup ((const gchar*) name_it->data);
1811 name = _tmp21_;
1812 {
1813 GHashTable* _tmp22_;
1814 const gchar* _tmp23_;
1815 gconstpointer _tmp24_ = NULL;
1816 GVariant* _tmp25_;
1817 GVariant* variant;
1818 GVariantBuilder* _tmp26_;
1819 const gchar* _tmp27_;
1820 gchar* _tmp28_ = NULL;
1821 gchar* _tmp29_;
1822 GVariant* _tmp30_;
1823 _tmp22_ = appropriate_hash;
1824 _tmp23_ = name;
1825 _tmp24_ = g_hash_table_lookup (_tmp22_, _tmp23_);
1826 _tmp25_ = _g_variant_ref0 ((GVariant*) _tmp24_);
1827 variant = _tmp25_;
1828 _tmp26_ = builder;
1829 _tmp27_ = name;
1830 _tmp28_ = g_strdup (_tmp27_);
1831 _tmp29_ = _tmp28_;
1832 _tmp30_ = variant;
1833 g_variant_builder_add (_tmp26_, "{sv}", _tmp29_, _tmp30_, NULL);
1834 _g_free0 (_tmp29_);
1835 _g_variant_unref0 (variant);
1836 _g_free0 (name);
1837 }
1838 }
1839 _g_list_free0 (name_collection);
1840 }
1841 _tmp31_ = interface_name;
1842 _tmp32_ = builder;
1843 _tmp33_ = invalidated_builder;
1844 _tmp34_ = g_variant_new ("(sa{sv}as)", _tmp31_, _tmp32_, _tmp33_, NULL);
1845 _tmp35_ = g_variant_ref_sink (_tmp34_);
1846 unity_property_update_manager_emit_dbus_signal (self, "org.freedesktop.DBus.Properties", "PropertiesChanged", _tmp35_);
1847 _g_variant_unref0 (_tmp35_);
1848 _tmp36_ = self->priv->source_ids;
1849 _tmp37_ = interface_name;
1850 _tmp38_ = g_strdup (_tmp37_);
1851 g_hash_table_insert (_tmp36_, _tmp38_, GUINT_TO_POINTER ((guint) 0));
1852 _tmp39_ = appropriate_hash;
1853 g_hash_table_remove_all (_tmp39_);
1854 result = FALSE;
1855 _g_hash_table_unref0 (appropriate_hash);
1856 _g_variant_builder_unref0 (invalidated_builder);
1857 _g_variant_builder_unref0 (builder);
1858 return result;
1859 }
1860
1861
1862 void unity_property_update_manager_emit_dbus_signal (UnityPropertyUpdateManager* self, const gchar* interface_name, const gchar* signal_name, GVariant* payload) {
1863 GError * _inner_error_ = NULL;
1864 g_return_if_fail (self != NULL);
1865 g_return_if_fail (interface_name != NULL);
1866 g_return_if_fail (signal_name != NULL);
1867 g_return_if_fail (payload != NULL);
1868 {
1869 GDBusConnection* _tmp0_;
1870 const gchar* _tmp1_;
1871 const gchar* _tmp2_;
1872 GVariant* _tmp3_;
1873 _tmp0_ = self->priv->_connection;
1874 _tmp1_ = interface_name;
1875 _tmp2_ = signal_name;
1876 _tmp3_ = payload;
1877 g_dbus_connection_emit_signal (_tmp0_, NULL, UNITY_MPRIS_INTERFACE_ROOT_PATH, _tmp1_, _tmp2_, _tmp3_, &_inner_error_);
1878 if (_inner_error_ != NULL) {
1879 goto __catch35_g_error;
1880 }
1881 }
1882 goto __finally35;
1883 __catch35_g_error:
1884 {
1885 GError* e = NULL;
1886 const gchar* _tmp4_;
1887 const gchar* _tmp5_;
1888 GError* _tmp6_;
1889 const gchar* _tmp7_;
1890 e = _inner_error_;
1891 _inner_error_ = NULL;
1892 _tmp4_ = interface_name;
1893 _tmp5_ = signal_name;
1894 _tmp6_ = e;
1895 _tmp7_ = _tmp6_->message;
1896 g_warning ("unity-sound-menu-mpris.vala:295: Error emitting DBus signal '%s.%s': %" \
1897 "s\n", _tmp4_, _tmp5_, _tmp7_);
1898 _g_error_free0 (e);
1899 }
1900 __finally35:
1901 if (_inner_error_ != NULL) {
1902 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);
1903 g_clear_error (&_inner_error_);
1904 return;
1905 }
1906 }
1907
1908
1909 GDBusConnection* unity_property_update_manager_get_connection (UnityPropertyUpdateManager* self) {
1910 GDBusConnection* result;
1911 GDBusConnection* _tmp0_;
1912 g_return_val_if_fail (self != NULL, NULL);
1913 _tmp0_ = self->priv->_connection;
1914 result = _tmp0_;
1915 return result;
1916 }
1917
1918
1919 static void unity_property_update_manager_set_connection (UnityPropertyUpdateManager* self, GDBusConnection* value) {
1920 GDBusConnection* _tmp0_;
1921 GDBusConnection* _tmp1_;
1922 g_return_if_fail (self != NULL);
1923 _tmp0_ = value;
1924 _tmp1_ = _g_object_ref0 (_tmp0_);
1925 _g_object_unref0 (self->priv->_connection);
1926 self->priv->_connection = _tmp1_;
1927 g_object_notify ((GObject *) self, "connection");
1928 }
1929
1930
1931 static void _g_free0_ (gpointer var) {
1932 var = (g_free (var), NULL);
1933 }
1934
1935
1936 static void _g_hash_table_unref0_ (gpointer var) {
1937 (var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL));
1938 }
1939
1940
1941 static void _g_variant_unref0_ (gpointer var) {
1942 (var == NULL) ? NULL : (var = (g_variant_unref (var), NULL));
1943 }
1944
1945
1946 static GObject * unity_property_update_manager_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
1947 GObject * obj;
1948 GObjectClass * parent_class;
1949 UnityPropertyUpdateManager * self;
1950 GHashFunc _tmp0_;
1951 GEqualFunc _tmp1_;
1952 GHashTable* _tmp2_;
1953 GHashTable* _tmp3_;
1954 gchar* _tmp4_;
1955 GHashFunc _tmp5_;
1956 GEqualFunc _tmp6_;
1957 GHashTable* _tmp7_;
1958 GHashTable* _tmp8_;
1959 gchar* _tmp9_;
1960 GHashFunc _tmp10_;
1961 GEqualFunc _tmp11_;
1962 GHashTable* _tmp12_;
1963 GHashTable* _tmp13_;
1964 gchar* _tmp14_;
1965 GHashFunc _tmp15_;
1966 GEqualFunc _tmp16_;
1967 GHashTable* _tmp17_;
1968 GHashFunc _tmp18_;
1969 GEqualFunc _tmp19_;
1970 GHashTable* _tmp20_;
1971 GHashTable* _tmp21_;
1972 gchar* _tmp22_;
1973 GHashTable* _tmp23_;
1974 gchar* _tmp24_;
1975 GHashTable* _tmp25_;
1976 gchar* _tmp26_;
1977 parent_class = G_OBJECT_CLASS (unity_property_update_manager_parent_class);
1978 obj = parent_class->constructor (type, n_construct_properties, construct_properties);
1979 self = UNITY_PROPERTY_UPDATE_MANAGER (obj);
1980 _tmp0_ = g_str_hash;
1981 _tmp1_ = g_str_equal;
1982 _tmp2_ = g_hash_table_new_full (_tmp0_, _tmp1_, _g_free0_, _g_hash_table_unref0_);
1983 _g_hash_table_unref0 (self->priv->queued_properties);
1984 self->priv->queued_properties = _tmp2_;
1985 _tmp3_ = self->priv->queued_properties;
1986 _tmp4_ = g_strdup (UNITY_MPRIS_INTERFACE_ROOT);
1987 _tmp5_ = g_str_hash;
1988 _tmp6_ = g_str_equal;
1989 _tmp7_ = g_hash_table_new_full (_tmp5_, _tmp6_, _g_free0_, _g_variant_unref0_);
1990 g_hash_table_insert (_tmp3_, _tmp4_, _tmp7_);
1991 _tmp8_ = self->priv->queued_properties;
1992 _tmp9_ = g_strdup (UNITY_MPRIS_INTERFACE_PLAYER);
1993 _tmp10_ = g_str_hash;
1994 _tmp11_ = g_str_equal;
1995 _tmp12_ = g_hash_table_new_full (_tmp10_, _tmp11_, _g_free0_, _g_variant_unref0_);
1996 g_hash_table_insert (_tmp8_, _tmp9_, _tmp12_);
1997 _tmp13_ = self->priv->queued_properties;
1998 _tmp14_ = g_strdup (UNITY_MPRIS_INTERFACE_PLAYLISTS);
1999 _tmp15_ = g_str_hash;
2000 _tmp16_ = g_str_equal;
2001 _tmp17_ = g_hash_table_new_full (_tmp15_, _tmp16_, _g_free0_, _g_variant_unref0_);
2002 g_hash_table_insert (_tmp13_, _tmp14_, _tmp17_);
2003 _tmp18_ = g_str_hash;
2004 _tmp19_ = g_str_equal;
2005 _tmp20_ = g_hash_table_new_full (_tmp18_, _tmp19_, _g_free0_, NULL);
2006 _g_hash_table_unref0 (self->priv->source_ids);
2007 self->priv->source_ids = _tmp20_;
2008 _tmp21_ = self->priv->source_ids;
2009 _tmp22_ = g_strdup (UNITY_MPRIS_INTERFACE_ROOT);
2010 g_hash_table_insert (_tmp21_, _tmp22_, GUINT_TO_POINTER ((guint) 0));
2011 _tmp23_ = self->priv->source_ids;
2012 _tmp24_ = g_strdup (UNITY_MPRIS_INTERFACE_PLAYER);
2013 g_hash_table_insert (_tmp23_, _tmp24_, GUINT_TO_POINTER ((guint) 0));
2014 _tmp25_ = self->priv->source_ids;
2015 _tmp26_ = g_strdup (UNITY_MPRIS_INTERFACE_PLAYLISTS);
2016 g_hash_table_insert (_tmp25_, _tmp26_, GUINT_TO_POINTER ((guint) 0));
2017 return obj;
2018 }
2019
2020
2021 static void unity_property_update_manager_class_init (UnityPropertyUpdateManagerClass * klass) {
2022 unity_property_update_manager_parent_class = g_type_class_peek_parent (klass);
2023 g_type_class_add_private (klass, sizeof (UnityPropertyUpdateManagerPrivate));
2024 G_OBJECT_CLASS (klass)->get_property = _vala_unity_property_update_manager_get_property;
2025 G_OBJECT_CLASS (klass)->set_property = _vala_unity_property_update_manager_set_property;
2026 G_OBJECT_CLASS (klass)->constructor = unity_property_update_manager_constructor;
2027 G_OBJECT_CLASS (klass)->finalize = unity_property_update_manager_finalize;
2028 g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_PROPERTY_UPDATE_MANAGER_CONNECTION, g_param_spec_object ("connection", "connection", "connection", G_TYPE_DBUS_CONNECTION, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
2029 }
2030
2031
2032 static void unity_property_update_manager_instance_init (UnityPropertyUpdateManager * self) {
2033 self->priv = UNITY_PROPERTY_UPDATE_MANAGER_GET_PRIVATE (self);
2034 }
2035
2036
2037 static void unity_property_update_manager_finalize (GObject* obj) {
2038 UnityPropertyUpdateManager * self;
2039 self = UNITY_PROPERTY_UPDATE_MANAGER (obj);
2040 _g_hash_table_unref0 (self->priv->queued_properties);
2041 _g_hash_table_unref0 (self->priv->source_ids);
2042 _g_object_unref0 (self->priv->_connection);
2043 G_OBJECT_CLASS (unity_property_update_manager_parent_class)->finalize (obj);
2044 }
2045
2046
2047 /**
2048 PropertyUpdate Manager
2049 Handles all property updates for each of the 3 MPRIS interfaces
2050 **/
2051 GType unity_property_update_manager_get_type (void) {
2052 static volatile gsize unity_property_update_manager_type_id__volatile = 0;
2053 if (g_once_init_enter (&unity_property_update_manager_type_id__volatile)) {
2054 static const GTypeInfo g_define_type_info = { sizeof (UnityPropertyUpdateManagerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) unity_property_update_manager_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UnityPropertyUpdateManager), 0, (GInstanceInitFunc) unity_property_update_manager_instance_init, NULL };
2055 GType unity_property_update_manager_type_id;
2056 unity_property_update_manager_type_id = g_type_register_static (G_TYPE_OBJECT, "UnityPropertyUpdateManager", &g_define_type_info, 0);
2057 g_once_init_leave (&unity_property_update_manager_type_id__volatile, unity_property_update_manager_type_id);
2058 }
2059 return unity_property_update_manager_type_id__volatile;
2060 }
2061
2062
2063 static void _vala_unity_property_update_manager_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
2064 UnityPropertyUpdateManager * self;
2065 self = UNITY_PROPERTY_UPDATE_MANAGER (object);
2066 switch (property_id) {
2067 case UNITY_PROPERTY_UPDATE_MANAGER_CONNECTION:
2068 g_value_set_object (value, unity_property_update_manager_get_connection (self));
2069 break;
2070 default:
2071 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
2072 break;
2073 }
2074 }
2075
2076
2077 static void _vala_unity_property_update_manager_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
2078 UnityPropertyUpdateManager * self;
2079 self = UNITY_PROPERTY_UPDATE_MANAGER (object);
2080 switch (property_id) {
2081 case UNITY_PROPERTY_UPDATE_MANAGER_CONNECTION:
2082 unity_property_update_manager_set_connection (self, g_value_get_object (value));
2083 break;
2084 default:
2085 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
2086 break;
2087 }
2088 }
2089
2090
2091 UnityBlacklistManager* unity_blacklist_manager_construct (GType object_type, UnityMusicPlayer* client) {
2092 UnityBlacklistManager * self = NULL;
2093 UnityMusicPlayer* _tmp0_;
2094 UnityMusicPlayer* _tmp1_;
2095 g_return_val_if_fail (client != NULL, NULL);
2096 self = (UnityBlacklistManager*) g_object_new (object_type, NULL);
2097 _tmp0_ = client;
2098 _tmp1_ = _g_object_ref0 (_tmp0_);
2099 _g_object_unref0 (self->priv->consumer);
2100 self->priv->consumer = _tmp1_;
2101 unity_blacklist_manager_wire_it_up (self);
2102 return self;
2103 }
2104
2105
2106 UnityBlacklistManager* unity_blacklist_manager_new (UnityMusicPlayer* client) {
2107 return unity_blacklist_manager_construct (UNITY_TYPE_BLACKLIST_MANAGER, client);
2108 }
2109
2110
2111 static void _unity_blacklist_manager_on_blacklist_event_g_settings_changed (GSettings* _sender, const gchar* key, gpointer self) {
2112 unity_blacklist_manager_on_blacklist_event (self);
2113 }
2114
2115
2116 static void _unity_blacklist_manager_consumer_blacklist_change_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
2117 unity_blacklist_manager_consumer_blacklist_change (self);
2118 }
2119
2120
2121 static void unity_blacklist_manager_wire_it_up (UnityBlacklistManager* self) {
2122 GSettings* _tmp0_;
2123 UnityMusicPlayer* _tmp1_;
2124 gboolean _tmp2_ = FALSE;
2125 GSettings* _tmp3_;
2126 UnityMusicPlayer* _tmp4_;
2127 g_return_if_fail (self != NULL);
2128 _tmp0_ = g_settings_new ("com.canonical.indicators.sound");
2129 _g_object_unref0 (self->priv->settings);
2130 self->priv->settings = _tmp0_;
2131 _tmp1_ = self->priv->consumer;
2132 _tmp2_ = unity_blacklist_manager_check_presence (self);
2133 unity_music_player_set_is_blacklisted (_tmp1_, _tmp2_);
2134 _tmp3_ = self->priv->settings;
2135 g_signal_connect_object (_tmp3_, "changed::blacklisted-media-players", (GCallback) _unity_blacklist_manager_on_blacklist_event_g_settings_changed, self, 0);
2136 _tmp4_ = self->priv->consumer;
2137 g_signal_connect_object ((GObject*) _tmp4_, "notify::is-blacklisted", (GCallback) _unity_blacklist_manager_consumer_blacklist_change_g_object_notify, self, 0);
2138 }
2139
2140
2141 static void unity_blacklist_manager_consumer_blacklist_change (UnityBlacklistManager* self) {
2142 UnityMusicPlayer* _tmp0_;
2143 gboolean _tmp1_;
2144 gboolean _tmp2_;
2145 g_return_if_fail (self != NULL);
2146 _tmp0_ = self->priv->consumer;
2147 _tmp1_ = unity_music_player_get_is_blacklisted (_tmp0_);
2148 _tmp2_ = _tmp1_;
2149 if (_tmp2_ == TRUE) {
2150 unity_blacklist_manager_add_to_blacklist (self);
2151 } else {
2152 unity_blacklist_manager_remove_from_blacklist (self);
2153 }
2154 }
2155
2156
2157 static void unity_blacklist_manager_on_blacklist_event (UnityBlacklistManager* self) {
2158 gboolean _tmp0_ = FALSE;
2159 gboolean is_present;
2160 UnityMusicPlayer* _tmp1_;
2161 gboolean _tmp2_;
2162 gboolean _tmp3_;
2163 gboolean _tmp4_;
2164 g_return_if_fail (self != NULL);
2165 _tmp0_ = unity_blacklist_manager_check_presence (self);
2166 is_present = _tmp0_;
2167 _tmp1_ = self->priv->consumer;
2168 _tmp2_ = unity_music_player_get_is_blacklisted (_tmp1_);
2169 _tmp3_ = _tmp2_;
2170 _tmp4_ = is_present;
2171 if (_tmp3_ != _tmp4_) {
2172 UnityMusicPlayer* _tmp5_;
2173 gboolean _tmp6_;
2174 unity_trace_log_object ((GObject*) self, "Blacklist Event - consumer blacklist is not the same as the situation");
2175 _tmp5_ = self->priv->consumer;
2176 _tmp6_ = is_present;
2177 unity_music_player_set_is_blacklisted (_tmp5_, _tmp6_);
2178 }
2179 }
2180
2181
2182 static gchar* unity_blacklist_manager_get_blacklist_name (UnityBlacklistManager* self) {
2183 gchar* result = NULL;
2184 UnityMusicPlayer* _tmp0_;
2185 GAppInfo* _tmp1_;
2186 GAppInfo* _tmp2_;
2187 const gchar* _tmp3_ = NULL;
2188 gchar* _tmp4_;
2189 gchar* app_id;
2190 const gchar* _tmp5_;
2191 const gchar* _tmp6_;
2192 gchar** _tmp7_;
2193 gchar** _tmp8_ = NULL;
2194 gchar** components;
2195 gint components_length1;
2196 gint _components_size_;
2197 gchar** _tmp9_;
2198 gint _tmp9__length1;
2199 const gchar* _tmp10_;
2200 gchar* _tmp11_;
2201 g_return_val_if_fail (self != NULL, NULL);
2202 _tmp0_ = self->priv->consumer;
2203 _tmp1_ = unity_music_player_get_app_info (_tmp0_);
2204 _tmp2_ = _tmp1_;
2205 _tmp3_ = g_app_info_get_id (_tmp2_);
2206 _tmp4_ = g_strdup (_tmp3_);
2207 app_id = _tmp4_;
2208 _tmp5_ = app_id;
2209 if (_tmp5_ == NULL) {
2210 result = NULL;
2211 _g_free0 (app_id);
2212 return result;
2213 }
2214 _tmp6_ = app_id;
2215 _tmp8_ = _tmp7_ = g_strsplit (_tmp6_, ".", 0);
2216 components = _tmp8_;
2217 components_length1 = _vala_array_length (_tmp7_);
2218 _components_size_ = components_length1;
2219 _tmp9_ = components;
2220 _tmp9__length1 = components_length1;
2221 _tmp10_ = _tmp9_[0];
2222 _tmp11_ = g_strdup (_tmp10_);
2223 result = _tmp11_;
2224 components = (_vala_array_free (components, components_length1, (GDestroyNotify) g_free), NULL);
2225 _g_free0 (app_id);
2226 return result;
2227 }
2228
2229
2230 gboolean unity_blacklist_manager_check_presence (UnityBlacklistManager* self) {
2231 gboolean result = FALSE;
2232 GSettings* _tmp0_;
2233 gchar** _tmp1_;
2234 gchar** _tmp2_ = NULL;
2235 gchar** blacklist;
2236 gint blacklist_length1;
2237 gint _blacklist_size_;
2238 gchar** _tmp3_;
2239 gint _tmp3__length1;
2240 g_return_val_if_fail (self != NULL, FALSE);
2241 _tmp0_ = self->priv->settings;
2242 _tmp2_ = _tmp1_ = g_settings_get_strv (_tmp0_, "blacklisted-media-players");
2243 blacklist = _tmp2_;
2244 blacklist_length1 = _vala_array_length (_tmp1_);
2245 _blacklist_size_ = blacklist_length1;
2246 _tmp3_ = blacklist;
2247 _tmp3__length1 = blacklist_length1;
2248 {
2249 gchar** s_collection = NULL;
2250 gint s_collection_length1 = 0;
2251 gint _s_collection_size_ = 0;
2252 gint s_it = 0;
2253 s_collection = _tmp3_;
2254 s_collection_length1 = _tmp3__length1;
2255 for (s_it = 0; s_it < _tmp3__length1; s_it = s_it + 1) {
2256 gchar* _tmp4_;
2257 gchar* s = NULL;
2258 _tmp4_ = g_strdup (s_collection[s_it]);
2259 s = _tmp4_;
2260 {
2261 const gchar* _tmp5_;
2262 gchar* _tmp6_ = NULL;
2263 gchar* _tmp7_;
2264 gboolean _tmp8_;
2265 _tmp5_ = s;
2266 _tmp6_ = unity_blacklist_manager_get_blacklist_name (self);
2267 _tmp7_ = _tmp6_;
2268 _tmp8_ = g_strcmp0 (_tmp5_, _tmp7_) == 0;
2269 _g_free0 (_tmp7_);
2270 if (_tmp8_) {
2271 result = TRUE;
2272 _g_free0 (s);
2273 blacklist = (_vala_array_free (blacklist, blacklist_length1, (GDestroyNotify) g_free), NULL);
2274 return result;
2275 }
2276 _g_free0 (s);
2277 }
2278 }
2279 }
2280 result = FALSE;
2281 blacklist = (_vala_array_free (blacklist, blacklist_length1, (GDestroyNotify) g_free), NULL);
2282 return result;
2283 }
2284
2285
2286 static void unity_blacklist_manager_add_to_blacklist (UnityBlacklistManager* self) {
2287 GSettings* _tmp0_;
2288 gchar** _tmp1_;
2289 gchar** _tmp2_ = NULL;
2290 gchar** already_bl;
2291 gint already_bl_length1;
2292 gint _already_bl_size_;
2293 GeeArrayList* _tmp3_;
2294 GeeArrayList* new_bl;
2295 gchar** _tmp4_;
2296 gint _tmp4__length1;
2297 GeeArrayList* _tmp13_;
2298 gchar* _tmp14_ = NULL;
2299 gchar* _tmp15_;
2300 GSettings* _tmp16_;
2301 GeeArrayList* _tmp17_;
2302 gint _tmp18_ = 0;
2303 gpointer* _tmp19_ = NULL;
2304 gchar** _tmp20_;
2305 gint _tmp20__length1;
2306 g_return_if_fail (self != NULL);
2307 _tmp0_ = self->priv->settings;
2308 _tmp2_ = _tmp1_ = g_settings_get_strv (_tmp0_, "blacklisted-media-players");
2309 already_bl = _tmp2_;
2310 already_bl_length1 = _vala_array_length (_tmp1_);
2311 _already_bl_size_ = already_bl_length1;
2312 _tmp3_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL);
2313 new_bl = _tmp3_;
2314 _tmp4_ = already_bl;
2315 _tmp4__length1 = already_bl_length1;
2316 {
2317 gchar** s_collection = NULL;
2318 gint s_collection_length1 = 0;
2319 gint _s_collection_size_ = 0;
2320 gint s_it = 0;
2321 s_collection = _tmp4_;
2322 s_collection_length1 = _tmp4__length1;
2323 for (s_it = 0; s_it < _tmp4__length1; s_it = s_it + 1) {
2324 gchar* _tmp5_;
2325 gchar* s = NULL;
2326 _tmp5_ = g_strdup (s_collection[s_it]);
2327 s = _tmp5_;
2328 {
2329 const gchar* _tmp6_;
2330 gchar* _tmp7_ = NULL;
2331 gchar* _tmp8_;
2332 gboolean _tmp9_;
2333 const gchar* _tmp10_;
2334 GeeArrayList* _tmp11_;
2335 const gchar* _tmp12_;
2336 _tmp6_ = s;
2337 _tmp7_ = unity_blacklist_manager_get_blacklist_name (self);
2338 _tmp8_ = _tmp7_;
2339 _tmp9_ = g_strcmp0 (_tmp6_, _tmp8_) == 0;
2340 _g_free0 (_tmp8_);
2341 if (_tmp9_) {
2342 _g_free0 (s);
2343 _g_object_unref0 (new_bl);
2344 already_bl = (_vala_array_free (already_bl, already_bl_length1, (GDestroyNotify) g_free), NULL);
2345 return;
2346 }
2347 _tmp10_ = s;
2348 unity_trace_log_object ((GObject*) self, "add_to_blacklist: %s", _tmp10_);
2349 _tmp11_ = new_bl;
2350 _tmp12_ = s;
2351 gee_abstract_collection_add ((GeeAbstractCollection*) _tmp11_, _tmp12_);
2352 _g_free0 (s);
2353 }
2354 }
2355 }
2356 _tmp13_ = new_bl;
2357 _tmp14_ = unity_blacklist_manager_get_blacklist_name (self);
2358 _tmp15_ = _tmp14_;
2359 gee_abstract_collection_add ((GeeAbstractCollection*) _tmp13_, _tmp15_);
2360 _g_free0 (_tmp15_);
2361 _tmp16_ = self->priv->settings;
2362 _tmp17_ = new_bl;
2363 _tmp19_ = gee_abstract_collection_to_array ((GeeAbstractCollection*) _tmp17_, &_tmp18_);
2364 _tmp20_ = _tmp19_;
2365 _tmp20__length1 = _tmp18_;
2366 g_settings_set_strv (_tmp16_, "blacklisted-media-players", _tmp20_);
2367 _tmp20_ = (_vala_array_free (_tmp20_, _tmp20__length1, (GDestroyNotify) g_free), NULL);
2368 _g_object_unref0 (new_bl);
2369 already_bl = (_vala_array_free (already_bl, already_bl_length1, (GDestroyNotify) g_free), NULL);
2370 }
2371
2372
2373 static void unity_blacklist_manager_remove_from_blacklist (UnityBlacklistManager* self) {
2374 GSettings* _tmp0_;
2375 gchar** _tmp1_;
2376 gchar** _tmp2_ = NULL;
2377 gchar** already_bl;
2378 gint already_bl_length1;
2379 gint _already_bl_size_;
2380 GeeArrayList* _tmp3_;
2381 GeeArrayList* new_bl;
2382 gchar** _tmp4_;
2383 gint _tmp4__length1;
2384 GSettings* _tmp12_;
2385 GeeArrayList* _tmp13_;
2386 gint _tmp14_ = 0;
2387 gpointer* _tmp15_ = NULL;
2388 gchar** _tmp16_;
2389 gint _tmp16__length1;
2390 g_return_if_fail (self != NULL);
2391 _tmp0_ = self->priv->settings;
2392 _tmp2_ = _tmp1_ = g_settings_get_strv (_tmp0_, "blacklisted-media-players");
2393 already_bl = _tmp2_;
2394 already_bl_length1 = _vala_array_length (_tmp1_);
2395 _already_bl_size_ = already_bl_length1;
2396 _tmp3_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL);
2397 new_bl = _tmp3_;
2398 _tmp4_ = already_bl;
2399 _tmp4__length1 = already_bl_length1;
2400 {
2401 gchar** s_collection = NULL;
2402 gint s_collection_length1 = 0;
2403 gint _s_collection_size_ = 0;
2404 gint s_it = 0;
2405 s_collection = _tmp4_;
2406 s_collection_length1 = _tmp4__length1;
2407 for (s_it = 0; s_it < _tmp4__length1; s_it = s_it + 1) {
2408 gchar* _tmp5_;
2409 gchar* s = NULL;
2410 _tmp5_ = g_strdup (s_collection[s_it]);
2411 s = _tmp5_;
2412 {
2413 const gchar* _tmp6_;
2414 gchar* _tmp7_ = NULL;
2415 gchar* _tmp8_;
2416 gboolean _tmp9_;
2417 GeeArrayList* _tmp10_;
2418 const gchar* _tmp11_;
2419 _tmp6_ = s;
2420 _tmp7_ = unity_blacklist_manager_get_blacklist_name (self);
2421 _tmp8_ = _tmp7_;
2422 _tmp9_ = g_strcmp0 (_tmp6_, _tmp8_) == 0;
2423 _g_free0 (_tmp8_);
2424 if (_tmp9_) {
2425 _g_free0 (s);
2426 continue;
2427 }
2428 _tmp10_ = new_bl;
2429 _tmp11_ = s;
2430 gee_abstract_collection_add ((GeeAbstractCollection*) _tmp10_, _tmp11_);
2431 _g_free0 (s);
2432 }
2433 }
2434 }
2435 _tmp12_ = self->priv->settings;
2436 _tmp13_ = new_bl;
2437 _tmp15_ = gee_abstract_collection_to_array ((GeeAbstractCollection*) _tmp13_, &_tmp14_);
2438 _tmp16_ = _tmp15_;
2439 _tmp16__length1 = _tmp14_;
2440 g_settings_set_strv (_tmp12_, "blacklisted-media-players", _tmp16_);
2441 _tmp16_ = (_vala_array_free (_tmp16_, _tmp16__length1, (GDestroyNotify) g_free), NULL);
2442 _g_object_unref0 (new_bl);
2443 already_bl = (_vala_array_free (already_bl, already_bl_length1, (GDestroyNotify) g_free), NULL);
2444 }
2445
2446
2447 static GObject * unity_blacklist_manager_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
2448 GObject * obj;
2449 GObjectClass * parent_class;
2450 UnityBlacklistManager * self;
2451 parent_class = G_OBJECT_CLASS (unity_blacklist_manager_parent_class);
2452 obj = parent_class->constructor (type, n_construct_properties, construct_properties);
2453 self = UNITY_BLACKLIST_MANAGER (obj);
2454 return obj;
2455 }
2456
2457
2458 static void unity_blacklist_manager_class_init (UnityBlacklistManagerClass * klass) {
2459 unity_blacklist_manager_parent_class = g_type_class_peek_parent (klass);
2460 g_type_class_add_private (klass, sizeof (UnityBlacklistManagerPrivate));
2461 G_OBJECT_CLASS (klass)->constructor = unity_blacklist_manager_constructor;
2462 G_OBJECT_CLASS (klass)->finalize = unity_blacklist_manager_finalize;
2463 }
2464
2465
2466 static void unity_blacklist_manager_instance_init (UnityBlacklistManager * self) {
2467 self->priv = UNITY_BLACKLIST_MANAGER_GET_PRIVATE (self);
2468 }
2469
2470
2471 static void unity_blacklist_manager_finalize (GObject* obj) {
2472 UnityBlacklistManager * self;
2473 self = UNITY_BLACKLIST_MANAGER (obj);
2474 _g_object_unref0 (self->priv->settings);
2475 _g_object_unref0 (self->priv->consumer);
2476 G_OBJECT_CLASS (unity_blacklist_manager_parent_class)->finalize (obj);
2477 }
2478
2479
2480 GType unity_blacklist_manager_get_type (void) {
2481 static volatile gsize unity_blacklist_manager_type_id__volatile = 0;
2482 if (g_once_init_enter (&unity_blacklist_manager_type_id__volatile)) {
2483 static const GTypeInfo g_define_type_info = { sizeof (UnityBlacklistManagerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) unity_blacklist_manager_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UnityBlacklistManager), 0, (GInstanceInitFunc) unity_blacklist_manager_instance_init, NULL };
2484 GType unity_blacklist_manager_type_id;
2485 unity_blacklist_manager_type_id = g_type_register_static (G_TYPE_OBJECT, "UnityBlacklistManager", &g_define_type_info, 0);
2486 g_once_init_leave (&unity_blacklist_manager_type_id__volatile, unity_blacklist_manager_type_id);
2487 }
2488 return unity_blacklist_manager_type_id__volatile;
2489 }
2490
2491
2492 void unity_sound_service_interface_EnableTrackSpecificItems (UnitySoundServiceInterface* self, const char* object_path, const gchar* desktop_id, GAsyncReadyCallback _callback_, gpointer _user_data_) {
2493 UNITY_SOUND_SERVICE_INTERFACE_GET_INTERFACE (self)->EnableTrackSpecificItems (self, object_path, desktop_id, _callback_, _user_data_);
2494 }
2495
2496
2497 void unity_sound_service_interface_EnableTrackSpecificItems_finish (UnitySoundServiceInterface* self, GAsyncResult* _res_, GError** error) {
2498 UNITY_SOUND_SERVICE_INTERFACE_GET_INTERFACE (self)->EnableTrackSpecificItems_finish (self, _res_, error);
2499 }
2500
2501
2502 void unity_sound_service_interface_EnablePlayerSpecificItems (UnitySoundServiceInterface* self, const char* object_path, const gchar* desktop_id, GAsyncReadyCallback _callback_, gpointer _user_data_) {
2503 UNITY_SOUND_SERVICE_INTERFACE_GET_INTERFACE (self)->EnablePlayerSpecificItems (self, object_path, desktop_id, _callback_, _user_data_);
2504 }
2505
2506
2507 void unity_sound_service_interface_EnablePlayerSpecificItems_finish (UnitySoundServiceInterface* self, GAsyncResult* _res_, GError** error) {
2508 UNITY_SOUND_SERVICE_INTERFACE_GET_INTERFACE (self)->EnablePlayerSpecificItems_finish (self, _res_, error);
2509 }
2510
2511
2512 static void unity_sound_service_interface_base_init (UnitySoundServiceInterfaceIface * iface) {
2513 static gboolean initialized = FALSE;
2514 if (!initialized) {
2515 initialized = TRUE;
2516 }
2517 }
2518
2519
2520 /***************************************************************************************/
2521 GType unity_sound_service_interface_get_type (void) {
2522 static volatile gsize unity_sound_service_interface_type_id__volatile = 0;
2523 if (g_once_init_enter (&unity_sound_service_interface_type_id__volatile)) {
2524 static const GTypeInfo g_define_type_info = { sizeof (UnitySoundServiceInterfaceIface), (GBaseInitFunc) unity_sound_service_interface_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
2525 GType unity_sound_service_interface_type_id;
2526 unity_sound_service_interface_type_id = g_type_register_static (G_TYPE_INTERFACE, "UnitySoundServiceInterface", &g_define_type_info, 0);
2527 g_type_interface_add_prerequisite (unity_sound_service_interface_type_id, G_TYPE_OBJECT);
2528 g_type_set_qdata (unity_sound_service_interface_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) unity_sound_service_interface_proxy_get_type);
2529 g_type_set_qdata (unity_sound_service_interface_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), "com.canonical.indicators.sound");
2530 g_type_set_qdata (unity_sound_service_interface_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) unity_sound_service_interface_register_object);
2531 g_once_init_leave (&unity_sound_service_interface_type_id__volatile, unity_sound_service_interface_type_id);
2532 }
2533 return unity_sound_service_interface_type_id__volatile;
2534 }
2535
2536
2537 G_DEFINE_TYPE_EXTENDED (UnitySoundServiceInterfaceProxy, unity_sound_service_interface_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (UNITY_TYPE_SOUND_SERVICE_INTERFACE, unity_sound_service_interface_proxy_unity_sound_service_interface_interface_init) )
2538 static void unity_sound_service_interface_proxy_class_init (UnitySoundServiceInterfaceProxyClass* klass) {
2539 G_DBUS_PROXY_CLASS (klass)->g_signal = unity_sound_service_interface_proxy_g_signal;
2540 }
2541
2542
2543 static void unity_sound_service_interface_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters) {
2544 }
2545
2546
2547 static void unity_sound_service_interface_proxy_init (UnitySoundServiceInterfaceProxy* self) {
2548 }
2549
2550
2551 static void _vala_g_async_ready_callback (GObject *source_object, GAsyncResult *res, void *user_data) {
2552 g_simple_async_result_set_op_res_gpointer (user_data, g_object_ref (res), g_object_unref);
2553 g_simple_async_result_complete (user_data);
2554 g_object_unref (user_data);
2555 }
2556
2557
2558 static void unity_sound_service_interface_proxy_EnableTrackSpecificItems_async (UnitySoundServiceInterface* self, const char* object_path, const gchar* desktop_id, GAsyncReadyCallback _callback_, gpointer _user_data_) {
2559 GDBusMessage *_message;
2560 GVariant *_arguments;
2561 GVariantBuilder _arguments_builder;
2562 G_IO_ERROR;
2563 _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "com.canonical.indicators.sound", "EnableTrackSpecificItems");
2564 g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
2565 g_variant_builder_add_value (&_arguments_builder, g_variant_new_object_path (object_path));
2566 g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (desktop_id));
2567 _arguments = g_variant_builder_end (&_arguments_builder);
2568 g_dbus_message_set_body (_message, _arguments);
2569 g_dbus_connection_send_message_with_reply (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, _vala_g_async_ready_callback, g_simple_async_result_new ((GObject *) self, _callback_, _user_data_, NULL));
2570 g_object_unref (_message);
2571 }
2572
2573
2574 static void unity_sound_service_interface_proxy_EnableTrackSpecificItems_finish (UnitySoundServiceInterface* self, GAsyncResult* _res_, GError** error) {
2575 GDBusMessage *_reply_message;
2576 _reply_message = g_dbus_connection_send_message_with_reply_finish (g_dbus_proxy_get_connection ((GDBusProxy *) self), g_simple_async_result_get_op_res_gpointer ((GSimpleAsyncResult *) _res_), error);
2577 if (!_reply_message) {
2578 return;
2579 }
2580 if (g_dbus_message_to_gerror (_reply_message, error)) {
2581 g_object_unref (_reply_message);
2582 return;
2583 }
2584 g_object_unref (_reply_message);
2585 }
2586
2587
2588 static void unity_sound_service_interface_proxy_EnablePlayerSpecificItems_async (UnitySoundServiceInterface* self, const char* object_path, const gchar* desktop_id, GAsyncReadyCallback _callback_, gpointer _user_data_) {
2589 GDBusMessage *_message;
2590 GVariant *_arguments;
2591 GVariantBuilder _arguments_builder;
2592 G_IO_ERROR;
2593 _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "com.canonical.indicators.sound", "EnablePlayerSpecificItems");
2594 g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
2595 g_variant_builder_add_value (&_arguments_builder, g_variant_new_object_path (object_path));
2596 g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (desktop_id));
2597 _arguments = g_variant_builder_end (&_arguments_builder);
2598 g_dbus_message_set_body (_message, _arguments);
2599 g_dbus_connection_send_message_with_reply (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, _vala_g_async_ready_callback, g_simple_async_result_new ((GObject *) self, _callback_, _user_data_, NULL));
2600 g_object_unref (_message);
2601 }
2602
2603
2604 static void unity_sound_service_interface_proxy_EnablePlayerSpecificItems_finish (UnitySoundServiceInterface* self, GAsyncResult* _res_, GError** error) {
2605 GDBusMessage *_reply_message;
2606 _reply_message = g_dbus_connection_send_message_with_reply_finish (g_dbus_proxy_get_connection ((GDBusProxy *) self), g_simple_async_result_get_op_res_gpointer ((GSimpleAsyncResult *) _res_), error);
2607 if (!_reply_message) {
2608 return;
2609 }
2610 if (g_dbus_message_to_gerror (_reply_message, error)) {
2611 g_object_unref (_reply_message);
2612 return;
2613 }
2614 g_object_unref (_reply_message);
2615 }
2616
2617
2618 static void unity_sound_service_interface_proxy_unity_sound_service_interface_interface_init (UnitySoundServiceInterfaceIface* iface) {
2619 iface->EnableTrackSpecificItems = unity_sound_service_interface_proxy_EnableTrackSpecificItems_async;
2620 iface->EnableTrackSpecificItems_finish = unity_sound_service_interface_proxy_EnableTrackSpecificItems_finish;
2621 iface->EnablePlayerSpecificItems = unity_sound_service_interface_proxy_EnablePlayerSpecificItems_async;
2622 iface->EnablePlayerSpecificItems_finish = unity_sound_service_interface_proxy_EnablePlayerSpecificItems_finish;
2623 }
2624
2625
2626 static void _dbus_unity_sound_service_interface_EnableTrackSpecificItems (UnitySoundServiceInterface* self, GVariant* parameters, GDBusMethodInvocation* invocation) {
2627 GVariantIter _arguments_iter;
2628 char* object_path = NULL;
2629 GVariant* _tmp211_;
2630 gchar* desktop_id = NULL;
2631 GVariant* _tmp212_;
2632 g_variant_iter_init (&_arguments_iter, parameters);
2633 _tmp211_ = g_variant_iter_next_value (&_arguments_iter);
2634 object_path = g_variant_dup_string (_tmp211_, NULL);
2635 g_variant_unref (_tmp211_);
2636 _tmp212_ = g_variant_iter_next_value (&_arguments_iter);
2637 desktop_id = g_variant_dup_string (_tmp212_, NULL);
2638 g_variant_unref (_tmp212_);
2639 unity_sound_service_interface_EnableTrackSpecificItems (self, object_path, desktop_id, (GAsyncReadyCallback) _dbus_unity_sound_service_interface_EnableTrackSpecificItems_ready, invocation);
2640 _g_free0 (object_path);
2641 _g_free0 (desktop_id);
2642 }
2643
2644
2645 static void _dbus_unity_sound_service_interface_EnableTrackSpecificItems_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_) {
2646 GDBusMethodInvocation * invocation;
2647 GError* error = NULL;
2648 GDBusMessage* _reply_message;
2649 GVariant* _reply;
2650 GVariantBuilder _reply_builder;
2651 invocation = _user_data_;
2652 unity_sound_service_interface_EnableTrackSpecificItems_finish ((UnitySoundServiceInterface*) source_object, _res_, &error);
2653 if (error) {
2654 g_dbus_method_invocation_return_gerror (invocation, error);
2655 return;
2656 }
2657 _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
2658 g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
2659 _reply = g_variant_builder_end (&_reply_builder);
2660 g_dbus_message_set_body (_reply_message, _reply);
2661 g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
2662 g_object_unref (invocation);
2663 g_object_unref (_reply_message);
2664 }
2665
2666
2667 static void _dbus_unity_sound_service_interface_EnablePlayerSpecificItems (UnitySoundServiceInterface* self, GVariant* parameters, GDBusMethodInvocation* invocation) {
2668 GVariantIter _arguments_iter;
2669 char* object_path = NULL;
2670 GVariant* _tmp213_;
2671 gchar* desktop_id = NULL;
2672 GVariant* _tmp214_;
2673 g_variant_iter_init (&_arguments_iter, parameters);
2674 _tmp213_ = g_variant_iter_next_value (&_arguments_iter);
2675 object_path = g_variant_dup_string (_tmp213_, NULL);
2676 g_variant_unref (_tmp213_);
2677 _tmp214_ = g_variant_iter_next_value (&_arguments_iter);
2678 desktop_id = g_variant_dup_string (_tmp214_, NULL);
2679 g_variant_unref (_tmp214_);
2680 unity_sound_service_interface_EnablePlayerSpecificItems (self, object_path, desktop_id, (GAsyncReadyCallback) _dbus_unity_sound_service_interface_EnablePlayerSpecificItems_ready, invocation);
2681 _g_free0 (object_path);
2682 _g_free0 (desktop_id);
2683 }
2684
2685
2686 static void _dbus_unity_sound_service_interface_EnablePlayerSpecificItems_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_) {
2687 GDBusMethodInvocation * invocation;
2688 GError* error = NULL;
2689 GDBusMessage* _reply_message;
2690 GVariant* _reply;
2691 GVariantBuilder _reply_builder;
2692 invocation = _user_data_;
2693 unity_sound_service_interface_EnablePlayerSpecificItems_finish ((UnitySoundServiceInterface*) source_object, _res_, &error);
2694 if (error) {
2695 g_dbus_method_invocation_return_gerror (invocation, error);
2696 return;
2697 }
2698 _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
2699 g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
2700 _reply = g_variant_builder_end (&_reply_builder);
2701 g_dbus_message_set_body (_reply_message, _reply);
2702 g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
2703 g_object_unref (invocation);
2704 g_object_unref (_reply_message);
2705 }
2706
2707
2708 static void unity_sound_service_interface_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data) {
2709 gpointer* data;
2710 gpointer object;
2711 data = user_data;
2712 object = data[0];
2713 if (strcmp (method_name, "EnableTrackSpecificItems") == 0) {
2714 _dbus_unity_sound_service_interface_EnableTrackSpecificItems (object, parameters, invocation);
2715 } else if (strcmp (method_name, "EnablePlayerSpecificItems") == 0) {
2716 _dbus_unity_sound_service_interface_EnablePlayerSpecificItems (object, parameters, invocation);
2717 } else {
2718 g_object_unref (invocation);
2719 }
2720 }
2721
2722
2723 static GVariant* unity_sound_service_interface_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data) {
2724 gpointer* data;
2725 gpointer object;
2726 data = user_data;
2727 object = data[0];
2728 return NULL;
2729 }
2730
2731
2732 static gboolean unity_sound_service_interface_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data) {
2733 gpointer* data;
2734 gpointer object;
2735 data = user_data;
2736 object = data[0];
2737 return FALSE;
2738 }
2739
2740
2741 guint unity_sound_service_interface_register_object (gpointer object, GDBusConnection* connection, const gchar* path, GError** error) {
2742 guint result;
2743 gpointer *data;
2744 data = g_new (gpointer, 3);
2745 data[0] = g_object_ref (object);
2746 data[1] = g_object_ref (connection);
2747 data[2] = g_strdup (path);
2748 result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) (&_unity_sound_service_interface_dbus_interface_info), &_unity_sound_service_interface_dbus_interface_vtable, data, _unity_sound_service_interface_unregister_object, error);
2749 if (!result) {
2750 return 0;
2751 }
2752 return result;
2753 }
2754
2755
2756 static void _unity_sound_service_interface_unregister_object (gpointer user_data) {
2757 gpointer* data;
2758 data = user_data;
2759 g_object_unref (data[0]);
2760 g_object_unref (data[1]);
2761 g_free (data[2]);
2762 g_free (data);
2763 }
2764
2765
2766 UnityMprisRoot* unity_mpris_root_construct (GType object_type, UnityMusicPlayer* client, UnityPropertyUpdateManager* prop_mgr) {
2767 UnityMprisRoot * self = NULL;
2768 UnityMusicPlayer* _tmp0_;
2769 UnityMusicPlayer* _tmp1_;
2770 UnityPropertyUpdateManager* _tmp2_;
2771 UnityPropertyUpdateManager* _tmp3_;
2772 g_return_val_if_fail (client != NULL, NULL);
2773 g_return_val_if_fail (prop_mgr != NULL, NULL);
2774 self = (UnityMprisRoot*) g_object_new (object_type, NULL);
2775 _tmp0_ = client;
2776 _tmp1_ = _g_object_ref0 (_tmp0_);
2777 _g_object_unref0 (self->priv->consumer);
2778 self->priv->consumer = _tmp1_;
2779 _tmp2_ = prop_mgr;
2780 _tmp3_ = _g_object_ref0 (_tmp2_);
2781 _g_object_unref0 (self->priv->prop_mgr);
2782 self->priv->prop_mgr = _tmp3_;
2783 unity_mpris_root_wire_up (self);
2784 return self;
2785 }
2786
2787
2788 UnityMprisRoot* unity_mpris_root_new (UnityMusicPlayer* client, UnityPropertyUpdateManager* prop_mgr) {
2789 return unity_mpris_root_construct (UNITY_TYPE_MPRIS_ROOT, client, prop_mgr);
2790 }
2791
2792
2793 static GVariant* _variant_new67 (const gchar* value) {
2794 return g_variant_ref_sink (g_variant_new_string (value));
2795 }
2796
2797
2798 static void __lambda17_ (UnityMprisRoot* self, GObject* obj, GParamSpec* pspec) {
2799 UnityPropertyUpdateManager* _tmp0_;
2800 UnityMusicPlayer* _tmp1_;
2801 const gchar* _tmp2_;
2802 const gchar* _tmp3_;
2803 GVariant* _tmp4_;
2804 g_return_if_fail (obj != NULL);
2805 g_return_if_fail (pspec != NULL);
2806 _tmp0_ = self->priv->prop_mgr;
2807 _tmp1_ = self->priv->consumer;
2808 _tmp2_ = unity_music_player_get_title (_tmp1_);
2809 _tmp3_ = _tmp2_;
2810 _tmp4_ = _variant_new67 (_tmp3_);
2811 unity_property_update_manager_queue_property_update (_tmp0_, "Identity", _tmp4_, UNITY_MPRIS_INTERFACE_ROOT);
2812 }
2813
2814
2815 static void ___lambda17__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
2816 __lambda17_ (self, _sender, pspec);
2817 }
2818
2819
2820 static void unity_mpris_root_wire_up (UnityMprisRoot* self) {
2821 UnityMusicPlayer* _tmp0_;
2822 UnityMusicPlayer* _tmp1_;
2823 const gchar* _tmp2_;
2824 const gchar* _tmp3_;
2825 gchar** _tmp4_;
2826 gchar** _tmp5_ = NULL;
2827 gchar** _tmp6_;
2828 gint _tmp6__length1;
2829 const gchar* _tmp7_;
2830 gchar* _tmp8_;
2831 g_return_if_fail (self != NULL);
2832 _tmp0_ = self->priv->consumer;
2833 g_signal_connect_object ((GObject*) _tmp0_, "notify::title", (GCallback) ___lambda17__g_object_notify, self, 0);
2834 _tmp1_ = self->priv->consumer;
2835 _tmp2_ = unity_music_player_get_desktop_file_name (_tmp1_);
2836 _tmp3_ = _tmp2_;
2837 _tmp5_ = _tmp4_ = g_strsplit (_tmp3_, ".", 0);
2838 _tmp6_ = _tmp5_;
2839 _tmp6__length1 = _vala_array_length (_tmp4_);
2840 _tmp7_ = _tmp6_[0];
2841 _tmp8_ = g_strdup (_tmp7_);
2842 _g_free0 (self->priv->mpris_desktop_entry);
2843 self->priv->mpris_desktop_entry = _tmp8_;
2844 _tmp6_ = (_vala_array_free (_tmp6_, _tmp6__length1, (GDestroyNotify) g_free), NULL);
2845 }
2846
2847
2848 static void unity_mpris_root_Raise_data_free (gpointer _data) {
2849 unity_mpris_root_RaiseData* _data_;
2850 _data_ = _data;
2851 _g_object_unref0 (_data_->self);
2852 g_slice_free (unity_mpris_root_RaiseData, _data_);
2853 }
2854
2855
2856 void unity_mpris_root_Raise (UnityMprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
2857 unity_mpris_root_RaiseData* _data_;
2858 UnityMprisRoot* _tmp0_;
2859 _data_ = g_slice_new0 (unity_mpris_root_RaiseData);
2860 _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, unity_mpris_root_Raise);
2861 g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, unity_mpris_root_Raise_data_free);
2862 _tmp0_ = _g_object_ref0 (self);
2863 _data_->self = _tmp0_;
2864 unity_mpris_root_Raise_co (_data_);
2865 }
2866
2867
2868 void unity_mpris_root_Raise_finish (UnityMprisRoot* self, GAsyncResult* _res_, GError** error) {
2869 unity_mpris_root_RaiseData* _data_;
2870 if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
2871 return;
2872 }
2873 _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
2874 }
2875
2876
2877 static gboolean unity_mpris_root_Raise_co (unity_mpris_root_RaiseData* _data_) {
2878 switch (_data_->_state_) {
2879 case 0:
2880 goto _state_0;
2881 default:
2882 g_assert_not_reached ();
2883 }
2884 _state_0:
2885 _data_->_tmp0_ = _data_->self->priv->consumer;
2886 g_signal_emit_by_name (_data_->_tmp0_, "raise");
2887 if (_data_->_state_ == 0) {
2888 g_simple_async_result_complete_in_idle (_data_->_async_result);
2889 } else {
2890 g_simple_async_result_complete (_data_->_async_result);
2891 }
2892 g_object_unref (_data_->_async_result);
2893 return FALSE;
2894 }
2895
2896
2897 gboolean unity_mpris_root_get_HasTracklist (UnityMprisRoot* self) {
2898 gboolean result;
2899 g_return_val_if_fail (self != NULL, FALSE);
2900 result = FALSE;
2901 return result;
2902 }
2903
2904
2905 gboolean unity_mpris_root_get_CanQuit (UnityMprisRoot* self) {
2906 gboolean result;
2907 g_return_val_if_fail (self != NULL, FALSE);
2908 result = FALSE;
2909 return result;
2910 }
2911
2912
2913 gboolean unity_mpris_root_get_CanRaise (UnityMprisRoot* self) {
2914 gboolean result;
2915 g_return_val_if_fail (self != NULL, FALSE);
2916 result = TRUE;
2917 return result;
2918 }
2919
2920
2921 const gchar* unity_mpris_root_get_Identity (UnityMprisRoot* self) {
2922 const gchar* result;
2923 UnityMusicPlayer* _tmp0_;
2924 const gchar* _tmp1_;
2925 const gchar* _tmp2_;
2926 g_return_val_if_fail (self != NULL, NULL);
2927 _tmp0_ = self->priv->consumer;
2928 _tmp1_ = unity_music_player_get_title (_tmp0_);
2929 _tmp2_ = _tmp1_;
2930 result = _tmp2_;
2931 return result;
2932 }
2933
2934
2935 const gchar* unity_mpris_root_get_DesktopEntry (UnityMprisRoot* self) {
2936 const gchar* result;
2937 const gchar* _tmp0_;
2938 g_return_val_if_fail (self != NULL, NULL);
2939 _tmp0_ = self->priv->mpris_desktop_entry;
2940 result = _tmp0_;
2941 return result;
2942 }
2943
2944
2945 static GObject * unity_mpris_root_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
2946 GObject * obj;
2947 GObjectClass * parent_class;
2948 UnityMprisRoot * self;
2949 parent_class = G_OBJECT_CLASS (unity_mpris_root_parent_class);
2950 obj = parent_class->constructor (type, n_construct_properties, construct_properties);
2951 self = UNITY_MPRIS_ROOT (obj);
2952 return obj;
2953 }
2954
2955
2956 static void unity_mpris_root_class_init (UnityMprisRootClass * klass) {
2957 unity_mpris_root_parent_class = g_type_class_peek_parent (klass);
2958 g_type_class_add_private (klass, sizeof (UnityMprisRootPrivate));
2959 G_OBJECT_CLASS (klass)->get_property = _vala_unity_mpris_root_get_property;
2960 G_OBJECT_CLASS (klass)->constructor = unity_mpris_root_constructor;
2961 G_OBJECT_CLASS (klass)->finalize = unity_mpris_root_finalize;
2962 g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_MPRIS_ROOT_HAS_TRACKLIST, g_param_spec_boolean ("HasTracklist", "HasTracklist", "HasTracklist", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
2963 g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_MPRIS_ROOT_CAN_QUIT, g_param_spec_boolean ("CanQuit", "CanQuit", "CanQuit", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
2964 g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_MPRIS_ROOT_CAN_RAISE, g_param_spec_boolean ("CanRaise", "CanRaise", "CanRaise", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
2965 g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_MPRIS_ROOT_IDENTITY, g_param_spec_string ("Identity", "Identity", "Identity", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
2966 g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_MPRIS_ROOT_DESKTOP_ENTRY, g_param_spec_string ("DesktopEntry", "DesktopEntry", "DesktopEntry", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
2967 }
2968
2969
2970 static void unity_mpris_root_instance_init (UnityMprisRoot * self) {
2971 self->priv = UNITY_MPRIS_ROOT_GET_PRIVATE (self);
2972 }
2973
2974
2975 static void unity_mpris_root_finalize (GObject* obj) {
2976 UnityMprisRoot * self;
2977 self = UNITY_MPRIS_ROOT (obj);
2978 _g_object_unref0 (self->priv->consumer);
2979 _g_object_unref0 (self->priv->prop_mgr);
2980 _g_free0 (self->priv->mpris_desktop_entry);
2981 G_OBJECT_CLASS (unity_mpris_root_parent_class)->finalize (obj);
2982 }
2983
2984
2985 /**
2986 MPRIS Root
2987 **/
2988 GType unity_mpris_root_get_type (void) {
2989 static volatile gsize unity_mpris_root_type_id__volatile = 0;
2990 if (g_once_init_enter (&unity_mpris_root_type_id__volatile)) {
2991 static const GTypeInfo g_define_type_info = { sizeof (UnityMprisRootClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) unity_mpris_root_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UnityMprisRoot), 0, (GInstanceInitFunc) unity_mpris_root_instance_init, NULL };
2992 GType unity_mpris_root_type_id;
2993 unity_mpris_root_type_id = g_type_register_static (G_TYPE_OBJECT, "UnityMprisRoot", &g_define_type_info, 0);
2994 g_type_set_qdata (unity_mpris_root_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) unity_mpris_root_register_object);
2995 g_once_init_leave (&unity_mpris_root_type_id__volatile, unity_mpris_root_type_id);
2996 }
2997 return unity_mpris_root_type_id__volatile;
2998 }
2999
3000
3001 static void _vala_unity_mpris_root_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
3002 UnityMprisRoot * self;
3003 self = UNITY_MPRIS_ROOT (object);
3004 switch (property_id) {
3005 case UNITY_MPRIS_ROOT_HAS_TRACKLIST:
3006 g_value_set_boolean (value, unity_mpris_root_get_HasTracklist (self));
3007 break;
3008 case UNITY_MPRIS_ROOT_CAN_QUIT:
3009 g_value_set_boolean (value, unity_mpris_root_get_CanQuit (self));
3010 break;
3011 case UNITY_MPRIS_ROOT_CAN_RAISE:
3012 g_value_set_boolean (value, unity_mpris_root_get_CanRaise (self));
3013 break;
3014 case UNITY_MPRIS_ROOT_IDENTITY:
3015 g_value_set_string (value, unity_mpris_root_get_Identity (self));
3016 break;
3017 case UNITY_MPRIS_ROOT_DESKTOP_ENTRY:
3018 g_value_set_string (value, unity_mpris_root_get_DesktopEntry (self));
3019 break;
3020 default:
3021 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
3022 break;
3023 }
3024 }
3025
3026
3027 static void _dbus_unity_mpris_root_Raise (UnityMprisRoot* self, GVariant* parameters, GDBusMethodInvocation* invocation) {
3028 GVariantIter _arguments_iter;
3029 g_variant_iter_init (&_arguments_iter, parameters);
3030 unity_mpris_root_Raise (self, (GAsyncReadyCallback) _dbus_unity_mpris_root_Raise_ready, invocation);
3031 }
3032
3033
3034 static void _dbus_unity_mpris_root_Raise_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_) {
3035 GDBusMethodInvocation * invocation;
3036 GError* error = NULL;
3037 GDBusMessage* _reply_message;
3038 GVariant* _reply;
3039 GVariantBuilder _reply_builder;
3040 invocation = _user_data_;
3041 unity_mpris_root_Raise_finish ((UnityMprisRoot*) source_object, _res_, &error);
3042 if (error) {
3043 g_dbus_method_invocation_return_gerror (invocation, error);
3044 return;
3045 }
3046 _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
3047 g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
3048 _reply = g_variant_builder_end (&_reply_builder);
3049 g_dbus_message_set_body (_reply_message, _reply);
3050 g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
3051 g_object_unref (invocation);
3052 g_object_unref (_reply_message);
3053 }
3054
3055
3056 static void unity_mpris_root_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data) {
3057 gpointer* data;
3058 gpointer object;
3059 data = user_data;
3060 object = data[0];
3061 if (strcmp (method_name, "Raise") == 0) {
3062 _dbus_unity_mpris_root_Raise (object, parameters, invocation);
3063 } else {
3064 g_object_unref (invocation);
3065 }
3066 }
3067
3068
3069 static GVariant* _dbus_unity_mpris_root_get_HasTracklist (UnityMprisRoot* self) {
3070 gboolean result;
3071 GVariant* _reply;
3072 result = unity_mpris_root_get_HasTracklist (self);
3073 _reply = g_variant_new_boolean (result);
3074 return _reply;
3075 }
3076
3077
3078 static GVariant* _dbus_unity_mpris_root_get_CanQuit (UnityMprisRoot* self) {
3079 gboolean result;
3080 GVariant* _reply;
3081 result = unity_mpris_root_get_CanQuit (self);
3082 _reply = g_variant_new_boolean (result);
3083 return _reply;
3084 }
3085
3086
3087 static GVariant* _dbus_unity_mpris_root_get_CanRaise (UnityMprisRoot* self) {
3088 gboolean result;
3089 GVariant* _reply;
3090 result = unity_mpris_root_get_CanRaise (self);
3091 _reply = g_variant_new_boolean (result);
3092 return _reply;
3093 }
3094
3095
3096 static GVariant* _dbus_unity_mpris_root_get_Identity (UnityMprisRoot* self) {
3097 const gchar* result;
3098 GVariant* _reply;
3099 result = unity_mpris_root_get_Identity (self);
3100 _reply = g_variant_new_string (result);
3101 return _reply;
3102 }
3103
3104
3105 static GVariant* _dbus_unity_mpris_root_get_DesktopEntry (UnityMprisRoot* self) {
3106 const gchar* result;
3107 GVariant* _reply;
3108 result = unity_mpris_root_get_DesktopEntry (self);
3109 _reply = g_variant_new_string (result);
3110 return _reply;
3111 }
3112
3113
3114 static GVariant* unity_mpris_root_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data) {
3115 gpointer* data;
3116 gpointer object;
3117 data = user_data;
3118 object = data[0];
3119 if (strcmp (property_name, "HasTracklist") == 0) {
3120 return _dbus_unity_mpris_root_get_HasTracklist (object);
3121 } else if (strcmp (property_name, "CanQuit") == 0) {
3122 return _dbus_unity_mpris_root_get_CanQuit (object);
3123 } else if (strcmp (property_name, "CanRaise") == 0) {
3124 return _dbus_unity_mpris_root_get_CanRaise (object);
3125 } else if (strcmp (property_name, "Identity") == 0) {
3126 return _dbus_unity_mpris_root_get_Identity (object);
3127 } else if (strcmp (property_name, "DesktopEntry") == 0) {
3128 return _dbus_unity_mpris_root_get_DesktopEntry (object);
3129 }
3130 return NULL;
3131 }
3132
3133
3134 static gboolean unity_mpris_root_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data) {
3135 gpointer* data;
3136 gpointer object;
3137 data = user_data;
3138 object = data[0];
3139 return FALSE;
3140 }
3141
3142
3143 guint unity_mpris_root_register_object (gpointer object, GDBusConnection* connection, const gchar* path, GError** error) {
3144 guint result;
3145 gpointer *data;
3146 data = g_new (gpointer, 3);
3147 data[0] = g_object_ref (object);
3148 data[1] = g_object_ref (connection);
3149 data[2] = g_strdup (path);
3150 result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) (&_unity_mpris_root_dbus_interface_info), &_unity_mpris_root_dbus_interface_vtable, data, _unity_mpris_root_unregister_object, error);
3151 if (!result) {
3152 return 0;
3153 }
3154 return result;
3155 }
3156
3157
3158 static void _unity_mpris_root_unregister_object (gpointer user_data) {
3159 gpointer* data;
3160 data = user_data;
3161 g_object_unref (data[0]);
3162 g_object_unref (data[1]);
3163 g_free (data[2]);
3164 g_free (data);
3165 }
3166
3167
3168 UnityMprisPlayer* unity_mpris_player_construct (GType object_type, UnityMusicPlayer* client, UnityPropertyUpdateManager* prop_mgr) {
3169 UnityMprisPlayer * self = NULL;
3170 UnityMusicPlayer* _tmp0_;
3171 UnityMusicPlayer* _tmp1_;
3172 UnityPropertyUpdateManager* _tmp2_;
3173 UnityPropertyUpdateManager* _tmp3_;
3174 g_return_val_if_fail (client != NULL, NULL);
3175 g_return_val_if_fail (prop_mgr != NULL, NULL);
3176 self = (UnityMprisPlayer*) g_object_new (object_type, NULL);
3177 _tmp0_ = client;
3178 _tmp1_ = _g_object_ref0 (_tmp0_);
3179 _g_object_unref0 (self->priv->consumer);
3180 self->priv->consumer = _tmp1_;
3181 _tmp2_ = prop_mgr;
3182 _tmp3_ = _g_object_ref0 (_tmp2_);
3183 _g_object_unref0 (self->priv->prop_mgr);
3184 self->priv->prop_mgr = _tmp3_;
3185 unity_mpris_player_wire_it_up (self);
3186 return self;
3187 }
3188
3189
3190 UnityMprisPlayer* unity_mpris_player_new (UnityMusicPlayer* client, UnityPropertyUpdateManager* prop_mgr) {
3191 return unity_mpris_player_construct (UNITY_TYPE_MPRIS_PLAYER, client, prop_mgr);
3192 }
3193
3194
3195 static void _unity_mpris_player_on_metadata_update_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
3196 unity_mpris_player_on_metadata_update (self, pspec);
3197 }
3198
3199
3200 static GVariant* _variant_new68 (const gchar* value) {
3201 return g_variant_ref_sink (g_variant_new_string (value));
3202 }
3203
3204
3205 static void __lambda18_ (UnityMprisPlayer* self, GObject* obj, GParamSpec* pspec) {
3206 const gchar* _tmp0_ = NULL;
3207 UnityMusicPlayer* _tmp1_;
3208 UnityPlaybackState _tmp2_;
3209 UnityPlaybackState _tmp3_;
3210 const gchar* _tmp4_;
3211 gchar* _tmp5_;
3212 gchar* update;
3213 UnityPropertyUpdateManager* _tmp6_;
3214 GVariant* _tmp7_;
3215 g_return_if_fail (obj != NULL);
3216 g_return_if_fail (pspec != NULL);
3217 _tmp1_ = self->priv->consumer;
3218 _tmp2_ = unity_music_player_get_playback_state (_tmp1_);
3219 _tmp3_ = _tmp2_;
3220 if (_tmp3_ == UNITY_PLAYBACK_STATE_PAUSED) {
3221 _tmp0_ = "Paused";
3222 } else {
3223 _tmp0_ = "Playing";
3224 }
3225 _tmp4_ = _tmp0_;
3226 _tmp5_ = g_strdup (_tmp4_);
3227 update = _tmp5_;
3228 _tmp6_ = self->priv->prop_mgr;
3229 _tmp7_ = _variant_new68 (update);
3230 unity_property_update_manager_queue_property_update (_tmp6_, "PlaybackStatus", _tmp7_, UNITY_MPRIS_INTERFACE_PLAYER);
3231 _g_free0 (update);
3232 }
3233
3234
3235 static void ___lambda18__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
3236 __lambda18_ (self, _sender, pspec);
3237 }
3238
3239
3240 static GVariant* _variant_new69 (gboolean value) {
3241 return g_variant_ref_sink (g_variant_new_boolean (value));
3242 }
3243
3244
3245 static void __lambda19_ (UnityMprisPlayer* self, GObject* obj, GParamSpec* pspec) {
3246 UnityPropertyUpdateManager* _tmp0_;
3247 UnityMusicPlayer* _tmp1_;
3248 gboolean _tmp2_;
3249 gboolean _tmp3_;
3250 GVariant* _tmp4_;
3251 g_return_if_fail (obj != NULL);
3252 g_return_if_fail (pspec != NULL);
3253 _tmp0_ = self->priv->prop_mgr;
3254 _tmp1_ = self->priv->consumer;
3255 _tmp2_ = unity_music_player_get_can_go_next (_tmp1_);
3256 _tmp3_ = _tmp2_;
3257 _tmp4_ = _variant_new69 (_tmp3_);
3258 unity_property_update_manager_queue_property_update (_tmp0_, "CanGoNext", _tmp4_, UNITY_MPRIS_INTERFACE_PLAYER);
3259 }
3260
3261
3262 static void ___lambda19__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
3263 __lambda19_ (self, _sender, pspec);
3264 }
3265
3266
3267 static GVariant* _variant_new70 (gboolean value) {
3268 return g_variant_ref_sink (g_variant_new_boolean (value));
3269 }
3270
3271
3272 static void __lambda20_ (UnityMprisPlayer* self, GObject* obj, GParamSpec* pspec) {
3273 UnityPropertyUpdateManager* _tmp0_;
3274 UnityMusicPlayer* _tmp1_;
3275 gboolean _tmp2_;
3276 gboolean _tmp3_;
3277 GVariant* _tmp4_;
3278 g_return_if_fail (obj != NULL);
3279 g_return_if_fail (pspec != NULL);
3280 _tmp0_ = self->priv->prop_mgr;
3281 _tmp1_ = self->priv->consumer;
3282 _tmp2_ = unity_music_player_get_can_go_previous (_tmp1_);
3283 _tmp3_ = _tmp2_;
3284 _tmp4_ = _variant_new70 (_tmp3_);
3285 unity_property_update_manager_queue_property_update (_tmp0_, "CanGoPrevious", _tmp4_, UNITY_MPRIS_INTERFACE_PLAYER);
3286 }
3287
3288
3289 static void ___lambda20__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
3290 __lambda20_ (self, _sender, pspec);
3291 }
3292
3293
3294 static GVariant* _variant_new71 (gboolean value) {
3295 return g_variant_ref_sink (g_variant_new_boolean (value));
3296 }
3297
3298
3299 static void __lambda21_ (UnityMprisPlayer* self, GObject* obj, GParamSpec* pspec) {
3300 UnityPropertyUpdateManager* _tmp0_;
3301 UnityMusicPlayer* _tmp1_;
3302 gboolean _tmp2_;
3303 gboolean _tmp3_;
3304 GVariant* _tmp4_;
3305 g_return_if_fail (obj != NULL);
3306 g_return_if_fail (pspec != NULL);
3307 _tmp0_ = self->priv->prop_mgr;
3308 _tmp1_ = self->priv->consumer;
3309 _tmp2_ = unity_music_player_get_can_play (_tmp1_);
3310 _tmp3_ = _tmp2_;
3311 _tmp4_ = _variant_new71 (_tmp3_);
3312 unity_property_update_manager_queue_property_update (_tmp0_, "CanPlay", _tmp4_, UNITY_MPRIS_INTERFACE_PLAYER);
3313 }
3314
3315
3316 static void ___lambda21__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
3317 __lambda21_ (self, _sender, pspec);
3318 }
3319
3320
3321 static GVariant* _variant_new72 (gboolean value) {
3322 return g_variant_ref_sink (g_variant_new_boolean (value));
3323 }
3324
3325
3326 static void __lambda22_ (UnityMprisPlayer* self, GObject* obj, GParamSpec* pspec) {
3327 UnityPropertyUpdateManager* _tmp0_;
3328 UnityMusicPlayer* _tmp1_;
3329 gboolean _tmp2_;
3330 gboolean _tmp3_;
3331 GVariant* _tmp4_;
3332 g_return_if_fail (obj != NULL);
3333 g_return_if_fail (pspec != NULL);
3334 _tmp0_ = self->priv->prop_mgr;
3335 _tmp1_ = self->priv->consumer;
3336 _tmp2_ = unity_music_player_get_can_pause (_tmp1_);
3337 _tmp3_ = _tmp2_;
3338 _tmp4_ = _variant_new72 (_tmp3_);
3339 unity_property_update_manager_queue_property_update (_tmp0_, "CanPause", _tmp4_, UNITY_MPRIS_INTERFACE_PLAYER);
3340 }
3341
3342
3343 static void ___lambda22__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
3344 __lambda22_ (self, _sender, pspec);
3345 }
3346
3347
3348 static GVariant* _variant_new73 (const gchar* value) {
3349 return g_variant_ref_sink (g_variant_new_string (value));
3350 }
3351
3352
3353 static void unity_mpris_player_wire_it_up (UnityMprisPlayer* self) {
3354 GHashFunc _tmp0_;
3355 GEqualFunc _tmp1_;
3356 GHashTable* _tmp2_;
3357 UnityMusicPlayer* _tmp3_;
3358 UnityMusicPlayer* _tmp4_;
3359 UnityMusicPlayer* _tmp5_;
3360 UnityMusicPlayer* _tmp6_;
3361 UnityMusicPlayer* _tmp7_;
3362 UnityMusicPlayer* _tmp8_;
3363 const gchar* _tmp9_ = NULL;
3364 UnityMusicPlayer* _tmp10_;
3365 UnityPlaybackState _tmp11_;
3366 UnityPlaybackState _tmp12_;
3367 const gchar* _tmp13_;
3368 gchar* _tmp14_;
3369 gchar* update;
3370 UnityPropertyUpdateManager* _tmp15_;
3371 GVariant* _tmp16_;
3372 g_return_if_fail (self != NULL);
3373 _tmp0_ = g_str_hash;
3374 _tmp1_ = g_str_equal;
3375 _tmp2_ = g_hash_table_new_full (_tmp0_, _tmp1_, _g_free0_, _g_variant_unref0_);
3376 _g_hash_table_unref0 (self->priv->current_metadata);
3377 self->priv->current_metadata = _tmp2_;
3378 _tmp3_ = self->priv->consumer;
3379 g_signal_connect_object ((GObject*) _tmp3_, "notify::current-track", (GCallback) _unity_mpris_player_on_metadata_update_g_object_notify, self, 0);
3380 _tmp4_ = self->priv->consumer;
3381 g_signal_connect_object ((GObject*) _tmp4_, "notify::playback-state", (GCallback) ___lambda18__g_object_notify, self, 0);
3382 _tmp5_ = self->priv->consumer;
3383 g_signal_connect_object ((GObject*) _tmp5_, "notify::can-go-next", (GCallback) ___lambda19__g_object_notify, self, 0);
3384 _tmp6_ = self->priv->consumer;
3385 g_signal_connect_object ((GObject*) _tmp6_, "notify::can-go-previous", (GCallback) ___lambda20__g_object_notify, self, 0);
3386 _tmp7_ = self->priv->consumer;
3387 g_signal_connect_object ((GObject*) _tmp7_, "notify::can-play", (GCallback) ___lambda21__g_object_notify, self, 0);
3388 _tmp8_ = self->priv->consumer;
3389 g_signal_connect_object ((GObject*) _tmp8_, "notify::can-pause", (GCallback) ___lambda22__g_object_notify, self, 0);
3390 _tmp10_ = self->priv->consumer;
3391 _tmp11_ = unity_music_player_get_playback_state (_tmp10_);
3392 _tmp12_ = _tmp11_;
3393 if (_tmp12_ == UNITY_PLAYBACK_STATE_PAUSED) {
3394 _tmp9_ = "Paused";
3395 } else {
3396 _tmp9_ = "Playing";
3397 }
3398 _tmp13_ = _tmp9_;
3399 _tmp14_ = g_strdup (_tmp13_);
3400 update = _tmp14_;
3401 _tmp15_ = self->priv->prop_mgr;
3402 _tmp16_ = _variant_new73 (update);
3403 unity_property_update_manager_queue_property_update (_tmp15_, "PlaybackStatus", _tmp16_, UNITY_MPRIS_INTERFACE_PLAYER);
3404 _g_free0 (update);
3405 }
3406
3407
3408 static GVariant* _variant_new74 (gchar* value) {
3409 return g_variant_ref_sink (g_variant_new_string (value));
3410 }
3411
3412
3413 static GVariant* _variant_new75 (const gchar* value) {
3414 return g_variant_ref_sink (g_variant_new_string (value));
3415 }
3416
3417
3418 static GVariant* _variant_new76 (const gchar* value) {
3419 return g_variant_ref_sink (g_variant_new_string (value));
3420 }
3421
3422
3423 static GVariant* _variant_new77 (const gchar* value) {
3424 return g_variant_ref_sink (g_variant_new_string (value));
3425 }
3426
3427
3428 static GVariant* _variant_new78 (GHashTable* value) {
3429 GVariantBuilder _tmp56_;
3430 GHashTableIter _tmp57_;
3431 gpointer _tmp58_;
3432 gpointer _tmp59_;
3433 g_hash_table_iter_init (&_tmp57_, value);
3434 g_variant_builder_init (&_tmp56_, G_VARIANT_TYPE ("a{sv}"));
3435 while (g_hash_table_iter_next (&_tmp57_, &_tmp58_, &_tmp59_)) {
3436 gchar* _key;
3437 GVariant* _value;
3438 _key = (gchar*) _tmp58_;
3439 _value = (GVariant*) _tmp59_;
3440 g_variant_builder_add (&_tmp56_, "{?*}", g_variant_new_string (_key), g_variant_new_variant (_value));
3441 }
3442 return g_variant_ref_sink (g_variant_builder_end (&_tmp56_));
3443 }
3444
3445
3446 void unity_mpris_player_on_metadata_update (UnityMprisPlayer* self, GParamSpec* pspec) {
3447 GHashTable* _tmp0_;
3448 UnityMusicPlayer* _tmp1_;
3449 UnityTrackMetadata* _tmp2_;
3450 UnityTrackMetadata* _tmp3_;
3451 GFile* _tmp4_;
3452 GFile* _tmp5_;
3453 UnityMusicPlayer* _tmp15_;
3454 UnityTrackMetadata* _tmp16_;
3455 UnityTrackMetadata* _tmp17_;
3456 const gchar* _tmp18_;
3457 const gchar* _tmp19_;
3458 UnityMusicPlayer* _tmp28_;
3459 UnityTrackMetadata* _tmp29_;
3460 UnityTrackMetadata* _tmp30_;
3461 const gchar* _tmp31_;
3462 const gchar* _tmp32_;
3463 UnityMusicPlayer* _tmp41_;
3464 UnityTrackMetadata* _tmp42_;
3465 UnityTrackMetadata* _tmp43_;
3466 const gchar* _tmp44_;
3467 const gchar* _tmp45_;
3468 UnityPropertyUpdateManager* _tmp54_;
3469 GHashTable* _tmp55_;
3470 GVariant* _tmp60_;
3471 g_return_if_fail (self != NULL);
3472 g_return_if_fail (pspec != NULL);
3473 _tmp0_ = self->priv->current_metadata;
3474 g_hash_table_remove_all (_tmp0_);
3475 _tmp1_ = self->priv->consumer;
3476 _tmp2_ = unity_music_player_get_current_track (_tmp1_);
3477 _tmp3_ = _tmp2_;
3478 _tmp4_ = unity_track_metadata_get_art_location (_tmp3_);
3479 _tmp5_ = _tmp4_;
3480 if (_tmp5_ != NULL) {
3481 GHashTable* _tmp6_;
3482 gchar* _tmp7_;
3483 UnityMusicPlayer* _tmp8_;
3484 UnityTrackMetadata* _tmp9_;
3485 UnityTrackMetadata* _tmp10_;
3486 GFile* _tmp11_;
3487 GFile* _tmp12_;
3488 gchar* _tmp13_ = NULL;
3489 GVariant* _tmp14_;
3490 _tmp6_ = self->priv->current_metadata;
3491 _tmp7_ = g_strdup ("mpris:artUrl");
3492 _tmp8_ = self->priv->consumer;
3493 _tmp9_ = unity_music_player_get_current_track (_tmp8_);
3494 _tmp10_ = _tmp9_;
3495 _tmp11_ = unity_track_metadata_get_art_location (_tmp10_);
3496 _tmp12_ = _tmp11_;
3497 _tmp13_ = g_file_get_uri (_tmp12_);
3498 _tmp14_ = _variant_new74 (_tmp13_);
3499 g_hash_table_insert (_tmp6_, _tmp7_, _tmp14_);
3500 }
3501 _tmp15_ = self->priv->consumer;
3502 _tmp16_ = unity_music_player_get_current_track (_tmp15_);
3503 _tmp17_ = _tmp16_;
3504 _tmp18_ = unity_track_metadata_get_artist (_tmp17_);
3505 _tmp19_ = _tmp18_;
3506 if (_tmp19_ != NULL) {
3507 GHashTable* _tmp20_;
3508 gchar* _tmp21_;
3509 UnityMusicPlayer* _tmp22_;
3510 UnityTrackMetadata* _tmp23_;
3511 UnityTrackMetadata* _tmp24_;
3512 const gchar* _tmp25_;
3513 const gchar* _tmp26_;
3514 GVariant* _tmp27_;
3515 _tmp20_ = self->priv->current_metadata;
3516 _tmp21_ = g_strdup ("xesam:artist");
3517 _tmp22_ = self->priv->consumer;
3518 _tmp23_ = unity_music_player_get_current_track (_tmp22_);
3519 _tmp24_ = _tmp23_;
3520 _tmp25_ = unity_track_metadata_get_artist (_tmp24_);
3521 _tmp26_ = _tmp25_;
3522 _tmp27_ = _variant_new75 (_tmp26_);
3523 g_hash_table_insert (_tmp20_, _tmp21_, _tmp27_);
3524 }
3525 _tmp28_ = self->priv->consumer;
3526 _tmp29_ = unity_music_player_get_current_track (_tmp28_);
3527 _tmp30_ = _tmp29_;
3528 _tmp31_ = unity_track_metadata_get_album (_tmp30_);
3529 _tmp32_ = _tmp31_;
3530 if (_tmp32_ != NULL) {
3531 GHashTable* _tmp33_;
3532 gchar* _tmp34_;
3533 UnityMusicPlayer* _tmp35_;
3534 UnityTrackMetadata* _tmp36_;
3535 UnityTrackMetadata* _tmp37_;
3536 const gchar* _tmp38_;
3537 const gchar* _tmp39_;
3538 GVariant* _tmp40_;
3539 _tmp33_ = self->priv->current_metadata;
3540 _tmp34_ = g_strdup ("xesam:album");
3541 _tmp35_ = self->priv->consumer;
3542 _tmp36_ = unity_music_player_get_current_track (_tmp35_);
3543 _tmp37_ = _tmp36_;
3544 _tmp38_ = unity_track_metadata_get_album (_tmp37_);
3545 _tmp39_ = _tmp38_;
3546 _tmp40_ = _variant_new76 (_tmp39_);
3547 g_hash_table_insert (_tmp33_, _tmp34_, _tmp40_);
3548 }
3549 _tmp41_ = self->priv->consumer;
3550 _tmp42_ = unity_music_player_get_current_track (_tmp41_);
3551 _tmp43_ = _tmp42_;
3552 _tmp44_ = unity_track_metadata_get_title (_tmp43_);
3553 _tmp45_ = _tmp44_;
3554 if (_tmp45_ != NULL) {
3555 GHashTable* _tmp46_;
3556 gchar* _tmp47_;
3557 UnityMusicPlayer* _tmp48_;
3558 UnityTrackMetadata* _tmp49_;
3559 UnityTrackMetadata* _tmp50_;
3560 const gchar* _tmp51_;
3561 const gchar* _tmp52_;
3562 GVariant* _tmp53_;
3563 _tmp46_ = self->priv->current_metadata;
3564 _tmp47_ = g_strdup ("xesam:title");
3565 _tmp48_ = self->priv->consumer;
3566 _tmp49_ = unity_music_player_get_current_track (_tmp48_);
3567 _tmp50_ = _tmp49_;
3568 _tmp51_ = unity_track_metadata_get_title (_tmp50_);
3569 _tmp52_ = _tmp51_;
3570 _tmp53_ = _variant_new77 (_tmp52_);
3571 g_hash_table_insert (_tmp46_, _tmp47_, _tmp53_);
3572 }
3573 _tmp54_ = self->priv->prop_mgr;
3574 _tmp55_ = self->priv->current_metadata;
3575 _tmp60_ = _variant_new78 (_tmp55_);
3576 unity_property_update_manager_queue_property_update (_tmp54_, "Metadata", _tmp60_, UNITY_MPRIS_INTERFACE_PLAYER);
3577 }
3578
3579
3580 static void unity_mpris_player_PlayPause_data_free (gpointer _data) {
3581 unity_mpris_player_PlayPauseData* _data_;
3582 _data_ = _data;
3583 _g_object_unref0 (_data_->self);
3584 g_slice_free (unity_mpris_player_PlayPauseData, _data_);
3585 }
3586
3587
3588 void unity_mpris_player_PlayPause (UnityMprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
3589 unity_mpris_player_PlayPauseData* _data_;
3590 UnityMprisPlayer* _tmp0_;
3591 _data_ = g_slice_new0 (unity_mpris_player_PlayPauseData);
3592 _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, unity_mpris_player_PlayPause);
3593 g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, unity_mpris_player_PlayPause_data_free);
3594 _tmp0_ = _g_object_ref0 (self);
3595 _data_->self = _tmp0_;
3596 unity_mpris_player_PlayPause_co (_data_);
3597 }
3598
3599
3600 void unity_mpris_player_PlayPause_finish (UnityMprisPlayer* self, GAsyncResult* _res_, GError** error) {
3601 unity_mpris_player_PlayPauseData* _data_;
3602 if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
3603 return;
3604 }
3605 _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
3606 }
3607
3608
3609 static gboolean unity_mpris_player_PlayPause_co (unity_mpris_player_PlayPauseData* _data_) {
3610 switch (_data_->_state_) {
3611 case 0:
3612 goto _state_0;
3613 default:
3614 g_assert_not_reached ();
3615 }
3616 _state_0:
3617 _data_->_tmp0_ = _data_->self->priv->consumer;
3618 g_signal_emit_by_name (_data_->_tmp0_, "play-pause");
3619 if (_data_->_state_ == 0) {
3620 g_simple_async_result_complete_in_idle (_data_->_async_result);
3621 } else {
3622 g_simple_async_result_complete (_data_->_async_result);
3623 }
3624 g_object_unref (_data_->_async_result);
3625 return FALSE;
3626 }
3627
3628
3629 static void unity_mpris_player_Next_data_free (gpointer _data) {
3630 unity_mpris_player_NextData* _data_;
3631 _data_ = _data;
3632 _g_object_unref0 (_data_->self);
3633 g_slice_free (unity_mpris_player_NextData, _data_);
3634 }
3635
3636
3637 void unity_mpris_player_Next (UnityMprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
3638 unity_mpris_player_NextData* _data_;
3639 UnityMprisPlayer* _tmp0_;
3640 _data_ = g_slice_new0 (unity_mpris_player_NextData);
3641 _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, unity_mpris_player_Next);
3642 g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, unity_mpris_player_Next_data_free);
3643 _tmp0_ = _g_object_ref0 (self);
3644 _data_->self = _tmp0_;
3645 unity_mpris_player_Next_co (_data_);
3646 }
3647
3648
3649 void unity_mpris_player_Next_finish (UnityMprisPlayer* self, GAsyncResult* _res_, GError** error) {
3650 unity_mpris_player_NextData* _data_;
3651 if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
3652 return;
3653 }
3654 _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
3655 }
3656
3657
3658 static gboolean unity_mpris_player_Next_co (unity_mpris_player_NextData* _data_) {
3659 switch (_data_->_state_) {
3660 case 0:
3661 goto _state_0;
3662 default:
3663 g_assert_not_reached ();
3664 }
3665 _state_0:
3666 _data_->_tmp0_ = _data_->self->priv->consumer;
3667 g_signal_emit_by_name (_data_->_tmp0_, "next");
3668 if (_data_->_state_ == 0) {
3669 g_simple_async_result_complete_in_idle (_data_->_async_result);
3670 } else {
3671 g_simple_async_result_complete (_data_->_async_result);
3672 }
3673 g_object_unref (_data_->_async_result);
3674 return FALSE;
3675 }
3676
3677
3678 static void unity_mpris_player_Previous_data_free (gpointer _data) {
3679 unity_mpris_player_PreviousData* _data_;
3680 _data_ = _data;
3681 _g_object_unref0 (_data_->self);
3682 g_slice_free (unity_mpris_player_PreviousData, _data_);
3683 }
3684
3685
3686 void unity_mpris_player_Previous (UnityMprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
3687 unity_mpris_player_PreviousData* _data_;
3688 UnityMprisPlayer* _tmp0_;
3689 _data_ = g_slice_new0 (unity_mpris_player_PreviousData);
3690 _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, unity_mpris_player_Previous);
3691 g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, unity_mpris_player_Previous_data_free);
3692 _tmp0_ = _g_object_ref0 (self);
3693 _data_->self = _tmp0_;
3694 unity_mpris_player_Previous_co (_data_);
3695 }
3696
3697
3698 void unity_mpris_player_Previous_finish (UnityMprisPlayer* self, GAsyncResult* _res_, GError** error) {
3699 unity_mpris_player_PreviousData* _data_;
3700 if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
3701 return;
3702 }
3703 _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
3704 }
3705
3706
3707 static gboolean unity_mpris_player_Previous_co (unity_mpris_player_PreviousData* _data_) {
3708 switch (_data_->_state_) {
3709 case 0:
3710 goto _state_0;
3711 default:
3712 g_assert_not_reached ();
3713 }
3714 _state_0:
3715 _data_->_tmp0_ = _data_->self->priv->consumer;
3716 g_signal_emit_by_name (_data_->_tmp0_, "previous");
3717 if (_data_->_state_ == 0) {
3718 g_simple_async_result_complete_in_idle (_data_->_async_result);
3719 } else {
3720 g_simple_async_result_complete (_data_->_async_result);
3721 }
3722 g_object_unref (_data_->_async_result);
3723 return FALSE;
3724 }
3725
3726
3727 GHashTable* unity_mpris_player_get_Metadata (UnityMprisPlayer* self) {
3728 GHashTable* result;
3729 GHashTable* _tmp0_;
3730 g_return_val_if_fail (self != NULL, NULL);
3731 _tmp0_ = self->priv->current_metadata;
3732 result = _tmp0_;
3733 return result;
3734 }
3735
3736
3737 const gchar* unity_mpris_player_get_PlaybackStatus (UnityMprisPlayer* self) {
3738 const gchar* result;
3739 const gchar* _tmp0_ = NULL;
3740 UnityMusicPlayer* _tmp1_;
3741 UnityPlaybackState _tmp2_;
3742 UnityPlaybackState _tmp3_;
3743 const gchar* _tmp4_;
3744 g_return_val_if_fail (self != NULL, NULL);
3745 _tmp1_ = self->priv->consumer;
3746 _tmp2_ = unity_music_player_get_playback_state (_tmp1_);
3747 _tmp3_ = _tmp2_;
3748 if (_tmp3_ == UNITY_PLAYBACK_STATE_PAUSED) {
3749 _tmp0_ = "Paused";
3750 } else {
3751 _tmp0_ = "Playing";
3752 }
3753 _tmp4_ = _tmp0_;
3754 result = _tmp4_;
3755 return result;
3756 }
3757
3758
3759 gboolean unity_mpris_player_get_CanControl (UnityMprisPlayer* self) {
3760 gboolean result;
3761 g_return_val_if_fail (self != NULL, FALSE);
3762 result = TRUE;
3763 return result;
3764 }
3765
3766
3767 gboolean unity_mpris_player_get_CanGoNext (UnityMprisPlayer* self) {
3768 gboolean result;
3769 UnityMusicPlayer* _tmp0_;
3770 gboolean _tmp1_;
3771 gboolean _tmp2_;
3772 g_return_val_if_fail (self != NULL, FALSE);
3773 _tmp0_ = self->priv->consumer;
3774 _tmp1_ = unity_music_player_get_can_go_next (_tmp0_);
3775 _tmp2_ = _tmp1_;
3776 result = _tmp2_;
3777 return result;
3778 }
3779
3780
3781 gboolean unity_mpris_player_get_CanGoPrevious (UnityMprisPlayer* self) {
3782 gboolean result;
3783 UnityMusicPlayer* _tmp0_;
3784 gboolean _tmp1_;
3785 gboolean _tmp2_;
3786 g_return_val_if_fail (self != NULL, FALSE);
3787 _tmp0_ = self->priv->consumer;
3788 _tmp1_ = unity_music_player_get_can_go_previous (_tmp0_);
3789 _tmp2_ = _tmp1_;
3790 result = _tmp2_;
3791 return result;
3792 }
3793
3794
3795 gboolean unity_mpris_player_get_CanPlay (UnityMprisPlayer* self) {
3796 gboolean result;
3797 UnityMusicPlayer* _tmp0_;
3798 gboolean _tmp1_;
3799 gboolean _tmp2_;
3800 g_return_val_if_fail (self != NULL, FALSE);
3801 _tmp0_ = self->priv->consumer;
3802 _tmp1_ = unity_music_player_get_can_play (_tmp0_);
3803 _tmp2_ = _tmp1_;
3804 result = _tmp2_;
3805 return result;
3806 }
3807
3808
3809 gboolean unity_mpris_player_get_CanPause (UnityMprisPlayer* self) {
3810 gboolean result;
3811 UnityMusicPlayer* _tmp0_;
3812 gboolean _tmp1_;
3813 gboolean _tmp2_;
3814 g_return_val_if_fail (self != NULL, FALSE);
3815 _tmp0_ = self->priv->consumer;
3816 _tmp1_ = unity_music_player_get_can_pause (_tmp0_);
3817 _tmp2_ = _tmp1_;
3818 result = _tmp2_;
3819 return result;
3820 }
3821
3822
3823 static GObject * unity_mpris_player_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
3824 GObject * obj;
3825 GObjectClass * parent_class;
3826 UnityMprisPlayer * self;
3827 parent_class = G_OBJECT_CLASS (unity_mpris_player_parent_class);
3828 obj = parent_class->constructor (type, n_construct_properties, construct_properties);
3829 self = UNITY_MPRIS_PLAYER (obj);
3830 return obj;
3831 }
3832
3833
3834 static void unity_mpris_player_class_init (UnityMprisPlayerClass * klass) {
3835 unity_mpris_player_parent_class = g_type_class_peek_parent (klass);
3836 g_type_class_add_private (klass, sizeof (UnityMprisPlayerPrivate));
3837 G_OBJECT_CLASS (klass)->get_property = _vala_unity_mpris_player_get_property;
3838 G_OBJECT_CLASS (klass)->constructor = unity_mpris_player_constructor;
3839 G_OBJECT_CLASS (klass)->finalize = unity_mpris_player_finalize;
3840 g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_MPRIS_PLAYER_METADATA, g_param_spec_boxed ("Metadata", "Metadata", "Metadata", G_TYPE_HASH_TABLE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
3841 g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_MPRIS_PLAYER_PLAYBACK_STATUS, g_param_spec_string ("PlaybackStatus", "PlaybackStatus", "PlaybackStatus", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
3842 g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_MPRIS_PLAYER_CAN_CONTROL, g_param_spec_boolean ("CanControl", "CanControl", "CanControl", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
3843 g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_MPRIS_PLAYER_CAN_GO_NEXT, g_param_spec_boolean ("CanGoNext", "CanGoNext", "CanGoNext", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
3844 g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_MPRIS_PLAYER_CAN_GO_PREVIOUS, g_param_spec_boolean ("CanGoPrevious", "CanGoPrevious", "CanGoPrevious", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
3845 g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_MPRIS_PLAYER_CAN_PLAY, g_param_spec_boolean ("CanPlay", "CanPlay", "CanPlay", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
3846 g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_MPRIS_PLAYER_CAN_PAUSE, g_param_spec_boolean ("CanPause", "CanPause", "CanPause", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
3847 }
3848
3849
3850 static void unity_mpris_player_instance_init (UnityMprisPlayer * self) {
3851 self->priv = UNITY_MPRIS_PLAYER_GET_PRIVATE (self);
3852 }
3853
3854
3855 static void unity_mpris_player_finalize (GObject* obj) {
3856 UnityMprisPlayer * self;
3857 self = UNITY_MPRIS_PLAYER (obj);
3858 _g_object_unref0 (self->priv->consumer);
3859 _g_object_unref0 (self->priv->prop_mgr);
3860 _g_hash_table_unref0 (self->priv->current_metadata);
3861 G_OBJECT_CLASS (unity_mpris_player_parent_class)->finalize (obj);
3862 }
3863
3864
3865 /**
3866 MPRIS Player
3867 **/
3868 GType unity_mpris_player_get_type (void) {
3869 static volatile gsize unity_mpris_player_type_id__volatile = 0;
3870 if (g_once_init_enter (&unity_mpris_player_type_id__volatile)) {
3871 static const GTypeInfo g_define_type_info = { sizeof (UnityMprisPlayerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) unity_mpris_player_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UnityMprisPlayer), 0, (GInstanceInitFunc) unity_mpris_player_instance_init, NULL };
3872 GType unity_mpris_player_type_id;
3873 unity_mpris_player_type_id = g_type_register_static (G_TYPE_OBJECT, "UnityMprisPlayer", &g_define_type_info, 0);
3874 g_type_set_qdata (unity_mpris_player_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) unity_mpris_player_register_object);
3875 g_once_init_leave (&unity_mpris_player_type_id__volatile, unity_mpris_player_type_id);
3876 }
3877 return unity_mpris_player_type_id__volatile;
3878 }
3879
3880
3881 static void _vala_unity_mpris_player_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
3882 UnityMprisPlayer * self;
3883 self = UNITY_MPRIS_PLAYER (object);
3884 switch (property_id) {
3885 case UNITY_MPRIS_PLAYER_METADATA:
3886 g_value_set_boxed (value, unity_mpris_player_get_Metadata (self));
3887 break;
3888 case UNITY_MPRIS_PLAYER_PLAYBACK_STATUS:
3889 g_value_set_string (value, unity_mpris_player_get_PlaybackStatus (self));
3890 break;
3891 case UNITY_MPRIS_PLAYER_CAN_CONTROL:
3892 g_value_set_boolean (value, unity_mpris_player_get_CanControl (self));
3893 break;
3894 case UNITY_MPRIS_PLAYER_CAN_GO_NEXT:
3895 g_value_set_boolean (value, unity_mpris_player_get_CanGoNext (self));
3896 break;
3897 case UNITY_MPRIS_PLAYER_CAN_GO_PREVIOUS:
3898 g_value_set_boolean (value, unity_mpris_player_get_CanGoPrevious (self));
3899 break;
3900 case UNITY_MPRIS_PLAYER_CAN_PLAY:
3901 g_value_set_boolean (value, unity_mpris_player_get_CanPlay (self));
3902 break;
3903 case UNITY_MPRIS_PLAYER_CAN_PAUSE:
3904 g_value_set_boolean (value, unity_mpris_player_get_CanPause (self));
3905 break;
3906 default:
3907 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
3908 break;
3909 }
3910 }
3911
3912
3913 static void _dbus_unity_mpris_player_PlayPause (UnityMprisPlayer* self, GVariant* parameters, GDBusMethodInvocation* invocation) {
3914 GVariantIter _arguments_iter;
3915 g_variant_iter_init (&_arguments_iter, parameters);
3916 unity_mpris_player_PlayPause (self, (GAsyncReadyCallback) _dbus_unity_mpris_player_PlayPause_ready, invocation);
3917 }
3918
3919
3920 static void _dbus_unity_mpris_player_PlayPause_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_) {
3921 GDBusMethodInvocation * invocation;
3922 GError* error = NULL;
3923 GDBusMessage* _reply_message;
3924 GVariant* _reply;
3925 GVariantBuilder _reply_builder;
3926 invocation = _user_data_;
3927 unity_mpris_player_PlayPause_finish ((UnityMprisPlayer*) source_object, _res_, &error);
3928 if (error) {
3929 g_dbus_method_invocation_return_gerror (invocation, error);
3930 return;
3931 }
3932 _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
3933 g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
3934 _reply = g_variant_builder_end (&_reply_builder);
3935 g_dbus_message_set_body (_reply_message, _reply);
3936 g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
3937 g_object_unref (invocation);
3938 g_object_unref (_reply_message);
3939 }
3940
3941
3942 static void _dbus_unity_mpris_player_Next (UnityMprisPlayer* self, GVariant* parameters, GDBusMethodInvocation* invocation) {
3943 GVariantIter _arguments_iter;
3944 g_variant_iter_init (&_arguments_iter, parameters);
3945 unity_mpris_player_Next (self, (GAsyncReadyCallback) _dbus_unity_mpris_player_Next_ready, invocation);
3946 }
3947
3948
3949 static void _dbus_unity_mpris_player_Next_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_) {
3950 GDBusMethodInvocation * invocation;
3951 GError* error = NULL;
3952 GDBusMessage* _reply_message;
3953 GVariant* _reply;
3954 GVariantBuilder _reply_builder;
3955 invocation = _user_data_;
3956 unity_mpris_player_Next_finish ((UnityMprisPlayer*) source_object, _res_, &error);
3957 if (error) {
3958 g_dbus_method_invocation_return_gerror (invocation, error);
3959 return;
3960 }
3961 _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
3962 g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
3963 _reply = g_variant_builder_end (&_reply_builder);
3964 g_dbus_message_set_body (_reply_message, _reply);
3965 g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
3966 g_object_unref (invocation);
3967 g_object_unref (_reply_message);
3968 }
3969
3970
3971 static void _dbus_unity_mpris_player_Previous (UnityMprisPlayer* self, GVariant* parameters, GDBusMethodInvocation* invocation) {
3972 GVariantIter _arguments_iter;
3973 g_variant_iter_init (&_arguments_iter, parameters);
3974 unity_mpris_player_Previous (self, (GAsyncReadyCallback) _dbus_unity_mpris_player_Previous_ready, invocation);
3975 }
3976
3977
3978 static void _dbus_unity_mpris_player_Previous_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_) {
3979 GDBusMethodInvocation * invocation;
3980 GError* error = NULL;
3981 GDBusMessage* _reply_message;
3982 GVariant* _reply;
3983 GVariantBuilder _reply_builder;
3984 invocation = _user_data_;
3985 unity_mpris_player_Previous_finish ((UnityMprisPlayer*) source_object, _res_, &error);
3986 if (error) {
3987 g_dbus_method_invocation_return_gerror (invocation, error);
3988 return;
3989 }
3990 _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
3991 g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
3992 _reply = g_variant_builder_end (&_reply_builder);
3993 g_dbus_message_set_body (_reply_message, _reply);
3994 g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
3995 g_object_unref (invocation);
3996 g_object_unref (_reply_message);
3997 }
3998
3999
4000 static void unity_mpris_player_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data) {
4001 gpointer* data;
4002 gpointer object;
4003 data = user_data;
4004 object = data[0];
4005 if (strcmp (method_name, "PlayPause") == 0) {
4006 _dbus_unity_mpris_player_PlayPause (object, parameters, invocation);
4007 } else if (strcmp (method_name, "Next") == 0) {
4008 _dbus_unity_mpris_player_Next (object, parameters, invocation);
4009 } else if (strcmp (method_name, "Previous") == 0) {
4010 _dbus_unity_mpris_player_Previous (object, parameters, invocation);
4011 } else {
4012 g_object_unref (invocation);
4013 }
4014 }
4015
4016
4017 static GVariant* _dbus_unity_mpris_player_get_Metadata (UnityMprisPlayer* self) {
4018 GHashTable* result;
4019 GVariantBuilder _tmp215_;
4020 GHashTableIter _tmp216_;
4021 gpointer _tmp217_;
4022 gpointer _tmp218_;
4023 GVariant* _reply;
4024 result = unity_mpris_player_get_Metadata (self);
4025 g_hash_table_iter_init (&_tmp216_, result);
4026 g_variant_builder_init (&_tmp215_, G_VARIANT_TYPE ("a{sv}"));
4027 while (g_hash_table_iter_next (&_tmp216_, &_tmp217_, &_tmp218_)) {
4028 gchar* _key;
4029 GVariant* _value;
4030 _key = (gchar*) _tmp217_;
4031 _value = (GVariant*) _tmp218_;
4032 g_variant_builder_add (&_tmp215_, "{?*}", g_variant_new_string (_key), g_variant_new_variant (_value));
4033 }
4034 _reply = g_variant_builder_end (&_tmp215_);
4035 return _reply;
4036 }
4037
4038
4039 static GVariant* _dbus_unity_mpris_player_get_PlaybackStatus (UnityMprisPlayer* self) {
4040 const gchar* result;
4041 GVariant* _reply;
4042 result = unity_mpris_player_get_PlaybackStatus (self);
4043 _reply = g_variant_new_string (result);
4044 return _reply;
4045 }
4046
4047
4048 static GVariant* _dbus_unity_mpris_player_get_CanControl (UnityMprisPlayer* self) {
4049 gboolean result;
4050 GVariant* _reply;
4051 result = unity_mpris_player_get_CanControl (self);
4052 _reply = g_variant_new_boolean (result);
4053 return _reply;
4054 }
4055
4056
4057 static GVariant* _dbus_unity_mpris_player_get_CanGoNext (UnityMprisPlayer* self) {
4058 gboolean result;
4059 GVariant* _reply;
4060 result = unity_mpris_player_get_CanGoNext (self);
4061 _reply = g_variant_new_boolean (result);
4062 return _reply;
4063 }
4064
4065
4066 static GVariant* _dbus_unity_mpris_player_get_CanGoPrevious (UnityMprisPlayer* self) {
4067 gboolean result;
4068 GVariant* _reply;
4069 result = unity_mpris_player_get_CanGoPrevious (self);
4070 _reply = g_variant_new_boolean (result);
4071 return _reply;
4072 }
4073
4074
4075 static GVariant* _dbus_unity_mpris_player_get_CanPlay (UnityMprisPlayer* self) {
4076 gboolean result;
4077 GVariant* _reply;
4078 result = unity_mpris_player_get_CanPlay (self);
4079 _reply = g_variant_new_boolean (result);
4080 return _reply;
4081 }
4082
4083
4084 static GVariant* _dbus_unity_mpris_player_get_CanPause (UnityMprisPlayer* self) {
4085 gboolean result;
4086 GVariant* _reply;
4087 result = unity_mpris_player_get_CanPause (self);
4088 _reply = g_variant_new_boolean (result);
4089 return _reply;
4090 }
4091
4092
4093 static GVariant* unity_mpris_player_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data) {
4094 gpointer* data;
4095 gpointer object;
4096 data = user_data;
4097 object = data[0];
4098 if (strcmp (property_name, "Metadata") == 0) {
4099 return _dbus_unity_mpris_player_get_Metadata (object);
4100 } else if (strcmp (property_name, "PlaybackStatus") == 0) {
4101 return _dbus_unity_mpris_player_get_PlaybackStatus (object);
4102 } else if (strcmp (property_name, "CanControl") == 0) {
4103 return _dbus_unity_mpris_player_get_CanControl (object);
4104 } else if (strcmp (property_name, "CanGoNext") == 0) {
4105 return _dbus_unity_mpris_player_get_CanGoNext (object);
4106 } else if (strcmp (property_name, "CanGoPrevious") == 0) {
4107 return _dbus_unity_mpris_player_get_CanGoPrevious (object);
4108 } else if (strcmp (property_name, "CanPlay") == 0) {
4109 return _dbus_unity_mpris_player_get_CanPlay (object);
4110 } else if (strcmp (property_name, "CanPause") == 0) {
4111 return _dbus_unity_mpris_player_get_CanPause (object);
4112 }
4113 return NULL;
4114 }
4115
4116
4117 static gboolean unity_mpris_player_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data) {
4118 gpointer* data;
4119 gpointer object;
4120 data = user_data;
4121 object = data[0];
4122 return FALSE;
4123 }
4124
4125
4126 guint unity_mpris_player_register_object (gpointer object, GDBusConnection* connection, const gchar* path, GError** error) {
4127 guint result;
4128 gpointer *data;
4129 data = g_new (gpointer, 3);
4130 data[0] = g_object_ref (object);
4131 data[1] = g_object_ref (connection);
4132 data[2] = g_strdup (path);
4133 result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) (&_unity_mpris_player_dbus_interface_info), &_unity_mpris_player_dbus_interface_vtable, data, _unity_mpris_player_unregister_object, error);
4134 if (!result) {
4135 return 0;
4136 }
4137 return result;
4138 }
4139
4140
4141 static void _unity_mpris_player_unregister_object (gpointer user_data) {
4142 gpointer* data;
4143 data = user_data;
4144 g_object_unref (data[0]);
4145 g_object_unref (data[1]);
4146 g_free (data[2]);
4147 g_free (data);
4148 }
4149
4150
4151 void unity_playlist_details_copy (const UnityPlaylistDetails* self, UnityPlaylistDetails* dest) {
4152 const char* _tmp0_;
4153 char* _tmp1_;
4154 const gchar* _tmp2_;
4155 gchar* _tmp3_;
4156 const gchar* _tmp4_;
4157 gchar* _tmp5_;
4158 _tmp0_ = (*self).id;
4159 _tmp1_ = g_strdup (_tmp0_);
4160 _g_free0 ((*dest).id);
4161 (*dest).id = _tmp1_;
4162 _tmp2_ = (*self).name;
4163 _tmp3_ = g_strdup (_tmp2_);
4164 _g_free0 ((*dest).name);
4165 (*dest).name = _tmp3_;
4166 _tmp4_ = (*self).icon_name;
4167 _tmp5_ = g_strdup (_tmp4_);
4168 _g_free0 ((*dest).icon_name);
4169 (*dest).icon_name = _tmp5_;
4170 }
4171
4172
4173 void unity_playlist_details_destroy (UnityPlaylistDetails* self) {
4174 _g_free0 ((*self).id);
4175 _g_free0 ((*self).name);
4176 _g_free0 ((*self).icon_name);
4177 }
4178
4179
4180 UnityPlaylistDetails* unity_playlist_details_dup (const UnityPlaylistDetails* self) {
4181 UnityPlaylistDetails* dup;
4182 dup = g_new0 (UnityPlaylistDetails, 1);
4183 unity_playlist_details_copy (self, dup);
4184 return dup;
4185 }
4186
4187
4188 void unity_playlist_details_free (UnityPlaylistDetails* self) {
4189 unity_playlist_details_destroy (self);
4190 g_free (self);
4191 }
4192
4193
4194 GType unity_playlist_details_get_type (void) {
4195 static volatile gsize unity_playlist_details_type_id__volatile = 0;
4196 if (g_once_init_enter (&unity_playlist_details_type_id__volatile)) {
4197 GType unity_playlist_details_type_id;
4198 unity_playlist_details_type_id = g_boxed_type_register_static ("UnityPlaylistDetails", (GBoxedCopyFunc) unity_playlist_details_dup, (GBoxedFreeFunc) unity_playlist_details_free);
4199 g_once_init_leave (&unity_playlist_details_type_id__volatile, unity_playlist_details_type_id);
4200 }
4201 return unity_playlist_details_type_id__volatile;
4202 }
4203
4204
4205 void unity_active_playlist_container_copy (const UnityActivePlaylistContainer* self, UnityActivePlaylistContainer* dest) {
4206 gboolean _tmp0_;
4207 UnityPlaylistDetails _tmp1_;
4208 UnityPlaylistDetails _tmp2_ = {0};
4209 _tmp0_ = (*self).valid;
4210 (*dest).valid = _tmp0_;
4211 _tmp1_ = (*self).details;
4212 unity_playlist_details_copy (&_tmp1_, &_tmp2_);
4213 unity_playlist_details_destroy (&(*dest).details);
4214 (*dest).details = _tmp2_;
4215 }
4216
4217
4218 void unity_active_playlist_container_destroy (UnityActivePlaylistContainer* self) {
4219 unity_playlist_details_destroy (&(*self).details);
4220 }
4221
4222
4223 UnityActivePlaylistContainer* unity_active_playlist_container_dup (const UnityActivePlaylistContainer* self) {
4224 UnityActivePlaylistContainer* dup;
4225 dup = g_new0 (UnityActivePlaylistContainer, 1);
4226 unity_active_playlist_container_copy (self, dup);
4227 return dup;
4228 }
4229
4230
4231 void unity_active_playlist_container_free (UnityActivePlaylistContainer* self) {
4232 unity_active_playlist_container_destroy (self);
4233 g_free (self);
4234 }
4235
4236
4237 GType unity_active_playlist_container_get_type (void) {
4238 static volatile gsize unity_active_playlist_container_type_id__volatile = 0;
4239 if (g_once_init_enter (&unity_active_playlist_container_type_id__volatile)) {
4240 GType unity_active_playlist_container_type_id;
4241 unity_active_playlist_container_type_id = g_boxed_type_register_static ("UnityActivePlaylistContainer", (GBoxedCopyFunc) unity_active_playlist_container_dup, (GBoxedFreeFunc) unity_active_playlist_container_free);
4242 g_once_init_leave (&unity_active_playlist_container_type_id__volatile, unity_active_playlist_container_type_id);
4243 }
4244 return unity_active_playlist_container_type_id__volatile;
4245 }
4246
4247
4248 UnityMprisPlaylists* unity_mpris_playlists_construct (GType object_type, UnityMusicPlayer* consumer, UnityPropertyUpdateManager* prop_mgr, UnityMPRISGateway* gw) {
4249 UnityMprisPlaylists * self = NULL;
4250 UnityMPRISGateway* _tmp0_;
4251 UnityMPRISGateway* _tmp1_;
4252 UnityMusicPlayer* _tmp2_;
4253 UnityMusicPlayer* _tmp3_;
4254 UnityPropertyUpdateManager* _tmp4_;
4255 UnityPropertyUpdateManager* _tmp5_;
4256 g_return_val_if_fail (consumer != NULL, NULL);
4257 g_return_val_if_fail (prop_mgr != NULL, NULL);
4258 g_return_val_if_fail (gw != NULL, NULL);
4259 self = (UnityMprisPlaylists*) g_object_new (object_type, NULL);
4260 _tmp0_ = gw;
4261 _tmp1_ = _g_object_ref0 (_tmp0_);
4262 _g_object_unref0 (self->priv->gateway);
4263 self->priv->gateway = _tmp1_;
4264 _tmp2_ = consumer;
4265 _tmp3_ = _g_object_ref0 (_tmp2_);
4266 _g_object_unref0 (self->priv->consumer);
4267 self->priv->consumer = _tmp3_;
4268 _tmp4_ = prop_mgr;
4269 _tmp5_ = _g_object_ref0 (_tmp4_);
4270 _g_object_unref0 (self->priv->prop_mgr);
4271 self->priv->prop_mgr = _tmp5_;
4272 unity_mpris_playlists_wire_up (self);
4273 return self;
4274 }
4275
4276
4277 UnityMprisPlaylists* unity_mpris_playlists_new (UnityMusicPlayer* consumer, UnityPropertyUpdateManager* prop_mgr, UnityMPRISGateway* gw) {
4278 return unity_mpris_playlists_construct (UNITY_TYPE_MPRIS_PLAYLISTS, consumer, prop_mgr, gw);
4279 }
4280
4281
4282 static void _unity_mpris_playlists_on_current_playlist_update_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
4283 unity_mpris_playlists_on_current_playlist_update (self, pspec);
4284 }
4285
4286
4287 static void _unity_mpris_playlists_on_playlist_name_change_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
4288 unity_mpris_playlists_on_playlist_name_change (self, pspec);
4289 }
4290
4291
4292 static void _unity_mpris_playlists_on_playlist_count_change_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
4293 unity_mpris_playlists_on_playlist_count_change (self, pspec);
4294 }
4295
4296
4297 static void unity_mpris_playlists_wire_up (UnityMprisPlaylists* self) {
4298 UnityActivePlaylistContainer _tmp0_ = {0};
4299 UnityActivePlaylistContainer _tmp1_;
4300 UnityMusicPlayer* _tmp2_;
4301 UnityMPRISGateway* _tmp3_;
4302 UnityMPRISGateway* _tmp4_;
4303 g_return_if_fail (self != NULL);
4304 memset (&_tmp0_, 0, sizeof (UnityActivePlaylistContainer));
4305 _tmp1_ = _tmp0_;
4306 unity_mpris_playlists_set_active_pl_wrapper (self, &_tmp1_);
4307 unity_active_playlist_container_destroy (&_tmp1_);
4308 unity_mpris_playlists_construct_active_playlist (self);
4309 _tmp2_ = self->priv->consumer;
4310 g_signal_connect_object ((GObject*) _tmp2_, "notify::current-playlist", (GCallback) _unity_mpris_playlists_on_current_playlist_update_g_object_notify, self, 0);
4311 _tmp3_ = self->priv->gateway;
4312 g_signal_connect_object ((GObject*) _tmp3_, "notify::edited-playlist", (GCallback) _unity_mpris_playlists_on_playlist_name_change_g_object_notify, self, 0);
4313 _tmp4_ = self->priv->gateway;
4314 g_signal_connect_object ((GObject*) _tmp4_, "notify::playlist-count", (GCallback) _unity_mpris_playlists_on_playlist_count_change_g_object_notify, self, 0);
4315 }
4316
4317
4318 static GVariant* _variant_new79 (UnityActivePlaylistContainer value) {
4319 GVariantBuilder _tmp2_;
4320 GVariantBuilder _tmp3_;
4321 g_variant_builder_init (&_tmp2_, G_VARIANT_TYPE_TUPLE);
4322 g_variant_builder_add_value (&_tmp2_, g_variant_new_boolean (value.valid));
4323 g_variant_builder_init (&_tmp3_, G_VARIANT_TYPE_TUPLE);
4324 g_variant_builder_add_value (&_tmp3_, g_variant_new_object_path (value.details.id));
4325 g_variant_builder_add_value (&_tmp3_, g_variant_new_string (value.details.name));
4326 g_variant_builder_add_value (&_tmp3_, g_variant_new_string (value.details.icon_name));
4327 g_variant_builder_add_value (&_tmp2_, g_variant_builder_end (&_tmp3_));
4328 return g_variant_ref_sink (g_variant_builder_end (&_tmp2_));
4329 }
4330
4331
4332 static void unity_mpris_playlists_on_current_playlist_update (UnityMprisPlaylists* self, GParamSpec* p) {
4333 UnityPropertyUpdateManager* _tmp0_;
4334 UnityActivePlaylistContainer _tmp1_;
4335 GVariant* _tmp4_;
4336 g_return_if_fail (self != NULL);
4337 g_return_if_fail (p != NULL);
4338 unity_mpris_playlists_construct_active_playlist (self);
4339 _tmp0_ = self->priv->prop_mgr;
4340 _tmp1_ = self->priv->_active_pl_wrapper;
4341 _tmp4_ = _variant_new79 (_tmp1_);
4342 unity_property_update_manager_queue_property_update (_tmp0_, "ActivePlaylist", _tmp4_, UNITY_MPRIS_INTERFACE_PLAYLISTS);
4343 }
4344
4345
4346 static void unity_mpris_playlists_on_playlist_name_change (UnityMprisPlaylists* self, GParamSpec* p) {
4347 UnityPlaylistDetails details = {0};
4348 UnityMPRISGateway* _tmp0_;
4349 UnityPlaylist* _tmp1_;
4350 UnityPlaylist* _tmp2_;
4351 UnityPlaylistDetails _tmp3_;
4352 const char* _tmp4_;
4353 UnityPlaylistDetails _tmp5_;
4354 const gchar* _tmp6_;
4355 UnityPlaylistDetails _tmp7_;
4356 const gchar* _tmp8_;
4357 GVariant* _tmp9_;
4358 GVariant* _tmp10_;
4359 GVariant* output;
4360 UnityPropertyUpdateManager* _tmp11_;
4361 g_return_if_fail (self != NULL);
4362 g_return_if_fail (p != NULL);
4363 memset (&details, 0, sizeof (UnityPlaylistDetails));
4364 _tmp0_ = self->priv->gateway;
4365 _tmp1_ = unity_mpris_gateway_get_edited_playlist (_tmp0_);
4366 _tmp2_ = _tmp1_;
4367 unity_mpris_playlists_prep_playlist (self, _tmp2_, &details);
4368 _tmp3_ = details;
4369 _tmp4_ = _tmp3_.id;
4370 _tmp5_ = details;
4371 _tmp6_ = _tmp5_.name;
4372 _tmp7_ = details;
4373 _tmp8_ = _tmp7_.icon_name;
4374 _tmp9_ = g_variant_new ("(oss)", _tmp4_, _tmp6_, _tmp8_, NULL);
4375 _tmp10_ = g_variant_ref_sink (_tmp9_);
4376 output = _tmp10_;
4377 _tmp11_ = self->priv->prop_mgr;
4378 unity_property_update_manager_emit_dbus_signal (_tmp11_, UNITY_MPRIS_INTERFACE_PLAYLISTS, "PlaylistChanged", output);
4379 _g_variant_unref0 (output);
4380 unity_playlist_details_destroy (&details);
4381 }
4382
4383
4384 static GVariant* _variant_new80 (gint value) {
4385 return g_variant_ref_sink (g_variant_new_int32 (value));
4386 }
4387
4388
4389 static void unity_mpris_playlists_on_playlist_count_change (UnityMprisPlaylists* self, GParamSpec* p) {
4390 UnityPropertyUpdateManager* _tmp0_;
4391 UnityMPRISGateway* _tmp1_;
4392 gint _tmp2_;
4393 gint _tmp3_;
4394 GVariant* _tmp4_;
4395 g_return_if_fail (self != NULL);
4396 g_return_if_fail (p != NULL);
4397 _tmp0_ = self->priv->prop_mgr;
4398 _tmp1_ = self->priv->gateway;
4399 _tmp2_ = unity_mpris_gateway_get_playlist_count (_tmp1_);
4400 _tmp3_ = _tmp2_;
4401 _tmp4_ = _variant_new80 (_tmp3_);
4402 unity_property_update_manager_queue_property_update (_tmp0_, "PlaylistCount", _tmp4_, UNITY_MPRIS_INTERFACE_PLAYLISTS);
4403 }
4404
4405
4406 static void unity_mpris_playlists_construct_active_playlist (UnityMprisPlaylists* self) {
4407 UnityActivePlaylistContainer _tmp0_;
4408 UnityMusicPlayer* _tmp1_;
4409 UnityPlaylist* _tmp2_;
4410 UnityPlaylist* _tmp3_;
4411 UnityPlaylistDetails details = {0};
4412 char* _tmp4_;
4413 gchar* _tmp5_;
4414 gchar* _tmp6_;
4415 UnityActivePlaylistContainer _tmp7_;
4416 gboolean _tmp8_;
4417 UnityActivePlaylistContainer _tmp12_;
4418 UnityPlaylistDetails _tmp13_;
4419 UnityPlaylistDetails _tmp14_ = {0};
4420 g_return_if_fail (self != NULL);
4421 _tmp0_ = self->priv->_active_pl_wrapper;
4422 _tmp1_ = self->priv->consumer;
4423 _tmp2_ = unity_music_player_get_current_playlist (_tmp1_);
4424 _tmp3_ = _tmp2_;
4425 _tmp0_.valid = _tmp3_ != NULL;
4426 memset (&details, 0, sizeof (UnityPlaylistDetails));
4427 _tmp4_ = g_strdup ("/test/playlist/id");
4428 _g_free0 (details.id);
4429 details.id = _tmp4_;
4430 _tmp5_ = g_strdup ("test playlist");
4431 _g_free0 (details.name);
4432 details.name = _tmp5_;
4433 _tmp6_ = g_strdup ("test pl icon name");
4434 _g_free0 (details.icon_name);
4435 details.icon_name = _tmp6_;
4436 _tmp7_ = self->priv->_active_pl_wrapper;
4437 _tmp8_ = _tmp7_.valid;
4438 if (_tmp8_) {
4439 UnityMusicPlayer* _tmp9_;
4440 UnityPlaylist* _tmp10_;
4441 UnityPlaylist* _tmp11_;
4442 _tmp9_ = self->priv->consumer;
4443 _tmp10_ = unity_music_player_get_current_playlist (_tmp9_);
4444 _tmp11_ = _tmp10_;
4445 unity_mpris_playlists_prep_playlist (self, _tmp11_, &details);
4446 }
4447 _tmp12_ = self->priv->_active_pl_wrapper;
4448 _tmp13_ = details;
4449 unity_playlist_details_copy (&_tmp13_, &_tmp14_);
4450 unity_playlist_details_destroy (&_tmp12_.details);
4451 _tmp12_.details = _tmp14_;
4452 unity_playlist_details_destroy (&details);
4453 }
4454
4455
4456 static void unity_mpris_playlists_prep_playlist (UnityMprisPlaylists* self, UnityPlaylist* unity_pl, UnityPlaylistDetails* outward) {
4457 UnityPlaylistDetails* _tmp0_;
4458 UnityPlaylist* _tmp1_;
4459 const gchar* _tmp2_;
4460 const gchar* _tmp3_;
4461 char* _tmp4_;
4462 UnityPlaylistDetails* _tmp5_;
4463 UnityPlaylist* _tmp6_;
4464 const gchar* _tmp7_;
4465 const gchar* _tmp8_;
4466 gchar* _tmp9_;
4467 UnityPlaylistDetails* _tmp10_;
4468 UnityPlaylist* _tmp11_;
4469 GIcon* _tmp12_;
4470 GIcon* _tmp13_;
4471 gchar* _tmp14_ = NULL;
4472 g_return_if_fail (self != NULL);
4473 g_return_if_fail (unity_pl != NULL);
4474 _tmp0_ = outward;
4475 _tmp1_ = unity_pl;
4476 _tmp2_ = unity_playlist_get_id (_tmp1_);
4477 _tmp3_ = _tmp2_;
4478 _tmp4_ = g_strdup (_tmp3_);
4479 _g_free0 ((*_tmp0_).id);
4480 (*_tmp0_).id = _tmp4_;
4481 _tmp5_ = outward;
4482 _tmp6_ = unity_pl;
4483 _tmp7_ = unity_playlist_get_name (_tmp6_);
4484 _tmp8_ = _tmp7_;
4485 _tmp9_ = g_strdup (_tmp8_);
4486 _g_free0 ((*_tmp5_).name);
4487 (*_tmp5_).name = _tmp9_;
4488 _tmp10_ = outward;
4489 _tmp11_ = unity_pl;
4490 _tmp12_ = unity_playlist_get_icon (_tmp11_);
4491 _tmp13_ = _tmp12_;
4492 _tmp14_ = g_icon_to_string (_tmp13_);
4493 _g_free0 ((*_tmp10_).icon_name);
4494 (*_tmp10_).icon_name = _tmp14_;
4495 }
4496
4497
4498 static void unity_mpris_playlists_ActivatePlaylist_data_free (gpointer _data) {
4499 unity_mpris_playlists_ActivatePlaylistData* _data_;
4500 _data_ = _data;
4501 _g_free0 (_data_->playlist_id);
4502 _g_object_unref0 (_data_->self);
4503 g_slice_free (unity_mpris_playlists_ActivatePlaylistData, _data_);
4504 }
4505
4506
4507 void unity_mpris_playlists_ActivatePlaylist (UnityMprisPlaylists* self, const char* playlist_id, GAsyncReadyCallback _callback_, gpointer _user_data_) {
4508 unity_mpris_playlists_ActivatePlaylistData* _data_;
4509 UnityMprisPlaylists* _tmp0_;
4510 const char* _tmp1_;
4511 char* _tmp2_;
4512 _data_ = g_slice_new0 (unity_mpris_playlists_ActivatePlaylistData);
4513 _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, unity_mpris_playlists_ActivatePlaylist);
4514 g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, unity_mpris_playlists_ActivatePlaylist_data_free);
4515 _tmp0_ = _g_object_ref0 (self);
4516 _data_->self = _tmp0_;
4517 _tmp1_ = playlist_id;
4518 _tmp2_ = g_strdup (_tmp1_);
4519 _data_->playlist_id = _tmp2_;
4520 unity_mpris_playlists_ActivatePlaylist_co (_data_);
4521 }
4522
4523
4524 void unity_mpris_playlists_ActivatePlaylist_finish (UnityMprisPlaylists* self, GAsyncResult* _res_, GError** error) {
4525 unity_mpris_playlists_ActivatePlaylistData* _data_;
4526 if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
4527 return;
4528 }
4529 _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
4530 }
4531
4532
4533 static gboolean unity_mpris_playlists_ActivatePlaylist_co (unity_mpris_playlists_ActivatePlaylistData* _data_) {
4534 switch (_data_->_state_) {
4535 case 0:
4536 goto _state_0;
4537 default:
4538 g_assert_not_reached ();
4539 }
4540 _state_0:
4541 _data_->_tmp0_ = _data_->self->priv->consumer;
4542 _data_->_tmp1_ = _data_->playlist_id;
4543 g_signal_emit_by_name (_data_->_tmp0_, "activate-playlist", _data_->_tmp1_);
4544 if (_data_->_state_ == 0) {
4545 g_simple_async_result_complete_in_idle (_data_->_async_result);
4546 } else {
4547 g_simple_async_result_complete (_data_->_async_result);
4548 }
4549 g_object_unref (_data_->_async_result);
4550 return FALSE;
4551 }
4552
4553
4554 static void _vala_UnityPlaylistDetails_array_free (UnityPlaylistDetails* array, gint array_length) {
4555 if (array != NULL) {
4556 int i;
4557 for (i = 0; i < array_length; i = i + 1) {
4558 unity_playlist_details_destroy (&array[i]);
4559 }
4560 }
4561 g_free (array);
4562 }
4563
4564
4565 static void unity_mpris_playlists_GetPlaylists_data_free (gpointer _data) {
4566 unity_mpris_playlists_GetPlaylistsData* _data_;
4567 _data_ = _data;
4568 _g_free0 (_data_->order);
4569 _data_->result = (_vala_UnityPlaylistDetails_array_free (_data_->result, _data_->result_length1), NULL);
4570 _g_object_unref0 (_data_->self);
4571 g_slice_free (unity_mpris_playlists_GetPlaylistsData, _data_);
4572 }
4573
4574
4575 void unity_mpris_playlists_GetPlaylists (UnityMprisPlaylists* self, guint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, GAsyncReadyCallback _callback_, gpointer _user_data_) {
4576 unity_mpris_playlists_GetPlaylistsData* _data_;
4577 UnityMprisPlaylists* _tmp0_;
4578 guint32 _tmp1_;
4579 guint32 _tmp2_;
4580 const gchar* _tmp3_;
4581 gchar* _tmp4_;
4582 gboolean _tmp5_;
4583 _data_ = g_slice_new0 (unity_mpris_playlists_GetPlaylistsData);
4584 _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, unity_mpris_playlists_GetPlaylists);
4585 g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, unity_mpris_playlists_GetPlaylists_data_free);
4586 _tmp0_ = _g_object_ref0 (self);
4587 _data_->self = _tmp0_;
4588 _tmp1_ = index;
4589 _data_->index = _tmp1_;
4590 _tmp2_ = max_count;
4591 _data_->max_count = _tmp2_;
4592 _tmp3_ = order;
4593 _tmp4_ = g_strdup (_tmp3_);
4594 _data_->order = _tmp4_;
4595 _tmp5_ = reverse_order;
4596 _data_->reverse_order = _tmp5_;
4597 unity_mpris_playlists_GetPlaylists_co (_data_);
4598 }
4599
4600
4601 UnityPlaylistDetails* unity_mpris_playlists_GetPlaylists_finish (UnityMprisPlaylists* self, GAsyncResult* _res_, int* result_length1, GError** error) {
4602 UnityPlaylistDetails* result;
4603 unity_mpris_playlists_GetPlaylistsData* _data_;
4604 if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
4605 return NULL;
4606 }
4607 _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
4608 result = _data_->result;
4609 *result_length1 = _data_->result_length1;
4610 _data_->result = NULL;
4611 return result;
4612 }
4613
4614
4615 static void _vala_array_add4 (UnityPlaylistDetails** array, int* length, int* size, const UnityPlaylistDetails* value) {
4616 if ((*length) == (*size)) {
4617 *size = (*size) ? (2 * (*size)) : 4;
4618 *array = g_renew (UnityPlaylistDetails, *array, *size);
4619 }
4620 (*array)[(*length)++] = *value;
4621 }
4622
4623
4624 static gboolean unity_mpris_playlists_GetPlaylists_co (unity_mpris_playlists_GetPlaylistsData* _data_) {
4625 switch (_data_->_state_) {
4626 case 0:
4627 goto _state_0;
4628 default:
4629 g_assert_not_reached ();
4630 }
4631 _state_0:
4632 _data_->_tmp0_ = NULL;
4633 _data_->_tmp0_ = g_new0 (UnityPlaylistDetails, 0);
4634 _data_->_result_ = _data_->_tmp0_;
4635 _data_->_result__length1 = 0;
4636 _data_->__result__size_ = _data_->_result__length1;
4637 _data_->_tmp1_ = _data_->self->priv->consumer;
4638 _data_->_tmp2_ = 0;
4639 _data_->_tmp3_ = NULL;
4640 _data_->_tmp3_ = unity_music_player_get_playlists (_data_->_tmp1_, &_data_->_tmp2_);
4641 {
4642 _data_->up_collection_length1 = 0;
4643 _data_->_up_collection_size_ = 0;
4644 _data_->up_collection = _data_->_tmp3_;
4645 _data_->up_collection_length1 = _data_->_tmp2_;
4646 _data_->up_it = 0;
4647 for (_data_->up_it = 0; _data_->up_it < _data_->_tmp2_; _data_->up_it = _data_->up_it + 1) {
4648 _data_->_tmp4_ = _g_object_ref0 (_data_->up_collection[_data_->up_it]);
4649 _data_->up = _data_->_tmp4_;
4650 {
4651 memset (&_data_->details, 0, sizeof (UnityPlaylistDetails));
4652 _data_->_tmp5_ = _data_->up;
4653 unity_mpris_playlists_prep_playlist (_data_->self, _data_->_tmp5_, &_data_->details);
4654 _data_->_tmp6_ = _data_->_result_;
4655 _data_->_tmp6__length1 = _data_->_result__length1;
4656 _data_->_tmp7_ = _data_->details;
4657 memset (&_data_->_tmp8_, 0, sizeof (UnityPlaylistDetails));
4658 unity_playlist_details_copy (&_data_->_tmp7_, &_data_->_tmp8_);
4659 _vala_array_add4 (&_data_->_result_, &_data_->_result__length1, &_data_->__result__size_, &_data_->_tmp8_);
4660 unity_playlist_details_destroy (&_data_->details);
4661 _g_object_unref0 (_data_->up);
4662 }
4663 }
4664 _data_->up_collection = (_vala_array_free (_data_->up_collection, _data_->up_collection_length1, (GDestroyNotify) g_object_unref), NULL);
4665 }
4666 _data_->_tmp9_ = _data_->_result_;
4667 _data_->_tmp9__length1 = _data_->_result__length1;
4668 _data_->result_length1 = _data_->_tmp9__length1;
4669 _data_->result = _data_->_tmp9_;
4670 if (_data_->_state_ == 0) {
4671 g_simple_async_result_complete_in_idle (_data_->_async_result);
4672 } else {
4673 g_simple_async_result_complete (_data_->_async_result);
4674 }
4675 g_object_unref (_data_->_async_result);
4676 return FALSE;
CID 10587 - UNREACHABLE
This code cannot be reached: "_data_->_result_ = ((_vala_...".
4677 _data_->_result_ = (_vala_UnityPlaylistDetails_array_free (_data_->_result_, _data_->_result__length1), NULL);
4678 if (_data_->_state_ == 0) {
4679 g_simple_async_result_complete_in_idle (_data_->_async_result);
4680 } else {
4681 g_simple_async_result_complete (_data_->_async_result);
4682 }
4683 g_object_unref (_data_->_async_result);
4684 return FALSE;
4685 }
4686
4687
4688 static void unity_mpris_playlists_get_active_pl_wrapper (UnityMprisPlaylists* self, UnityActivePlaylistContainer* result) {
4689 UnityActivePlaylistContainer _tmp0_;
4690 g_return_if_fail (self != NULL);
4691 _tmp0_ = self->priv->_active_pl_wrapper;
4692 *result = _tmp0_;
4693 return;
4694 }
4695
4696
4697 static void unity_mpris_playlists_set_active_pl_wrapper (UnityMprisPlaylists* self, UnityActivePlaylistContainer* value) {
4698 UnityActivePlaylistContainer _tmp0_;
4699 UnityActivePlaylistContainer _tmp1_ = {0};
4700 g_return_if_fail (self != NULL);
4701 _tmp0_ = *value;
4702 unity_active_playlist_container_copy (&_tmp0_, &_tmp1_);
4703 unity_active_playlist_container_destroy (&self->priv->_active_pl_wrapper);
4704 self->priv->_active_pl_wrapper = _tmp1_;
4705 }
4706
4707
4708 gchar** unity_mpris_playlists_get_Orderings (UnityMprisPlaylists* self, int* result_length1) {
4709 gchar** result;
4710 gchar** _tmp0_;
4711 gint _tmp0__length1;
4712 g_return_val_if_fail (self != NULL, NULL);
4713 _tmp0_ = UNITY_MPRIS_PLAYLISTS_orderings;
4714 _tmp0__length1 = G_N_ELEMENTS (UNITY_MPRIS_PLAYLISTS_orderings);
4715 if (result_length1) {
4716 *result_length1 = _tmp0__length1;
4717 }
4718 result = _tmp0_;
4719 return result;
4720 }
4721
4722
4723 guint32 unity_mpris_playlists_get_PlaylistCount (UnityMprisPlaylists* self) {
4724 guint32 result;
4725 UnityMusicPlayer* _tmp0_;
4726 gint _tmp1_ = 0;
4727 UnityPlaylist** _tmp2_ = NULL;
4728 UnityPlaylist** _tmp3_;
4729 gint _tmp3__length1;
4730 guint32 _tmp4_;
4731 g_return_val_if_fail (self != NULL, 0U);
4732 _tmp0_ = self->priv->consumer;
4733 _tmp2_ = unity_music_player_get_playlists (_tmp0_, &_tmp1_);
4734 _tmp3_ = _tmp2_;
4735 _tmp3__length1 = _tmp1_;
4736 _tmp4_ = (guint32) _tmp1_;
4737 _tmp3_ = (_vala_array_free (_tmp3_, _tmp3__length1, (GDestroyNotify) g_object_unref), NULL);
4738 result = _tmp4_;
4739 return result;
4740 }
4741
4742
4743 void unity_mpris_playlists_get_ActivePlaylist (UnityMprisPlaylists* self, UnityActivePlaylistContainer* result) {
4744 UnityActivePlaylistContainer _tmp0_;
4745 g_return_if_fail (self != NULL);
4746 _tmp0_ = self->priv->_active_pl_wrapper;
4747 *result = _tmp0_;
4748 return;
4749 }
4750
4751
4752 static GObject * unity_mpris_playlists_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
4753 GObject * obj;
4754 GObjectClass * parent_class;
4755 UnityMprisPlaylists * self;
4756 parent_class = G_OBJECT_CLASS (unity_mpris_playlists_parent_class);
4757 obj = parent_class->constructor (type, n_construct_properties, construct_properties);
4758 self = UNITY_MPRIS_PLAYLISTS (obj);
4759 return obj;
4760 }
4761
4762
4763 static void unity_mpris_playlists_class_init (UnityMprisPlaylistsClass * klass) {
4764 unity_mpris_playlists_parent_class = g_type_class_peek_parent (klass);
4765 g_type_class_add_private (klass, sizeof (UnityMprisPlaylistsPrivate));
4766 G_OBJECT_CLASS (klass)->get_property = _vala_unity_mpris_playlists_get_property;
4767 G_OBJECT_CLASS (klass)->set_property = _vala_unity_mpris_playlists_set_property;
4768 G_OBJECT_CLASS (klass)->constructor = unity_mpris_playlists_constructor;
4769 G_OBJECT_CLASS (klass)->finalize = unity_mpris_playlists_finalize;
4770 g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_MPRIS_PLAYLISTS_ORDERINGS, g_param_spec_boxed ("Orderings", "Orderings", "Orderings", G_TYPE_STRV, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
4771 g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_MPRIS_PLAYLISTS_PLAYLIST_COUNT, g_param_spec_uint ("PlaylistCount", "PlaylistCount", "PlaylistCount", 0, G_MAXUINT, 0U, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
4772 g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_MPRIS_PLAYLISTS_ACTIVE_PLAYLIST, g_param_spec_boxed ("ActivePlaylist", "ActivePlaylist", "ActivePlaylist", UNITY_TYPE_ACTIVE_PLAYLIST_CONTAINER, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
4773 }
4774
4775
4776 static void unity_mpris_playlists_instance_init (UnityMprisPlaylists * self) {
4777 self->priv = UNITY_MPRIS_PLAYLISTS_GET_PRIVATE (self);
4778 }
4779
4780
4781 static void unity_mpris_playlists_finalize (GObject* obj) {
4782 UnityMprisPlaylists * self;
4783 self = UNITY_MPRIS_PLAYLISTS (obj);
4784 _g_object_unref0 (self->priv->consumer);
4785 _g_object_unref0 (self->priv->prop_mgr);
4786 unity_active_playlist_container_destroy (&self->priv->_active_pl_wrapper);
4787 _g_object_unref0 (self->priv->gateway);
4788 G_OBJECT_CLASS (unity_mpris_playlists_parent_class)->finalize (obj);
4789 }
4790
4791
4792 GType unity_mpris_playlists_get_type (void) {
4793 static volatile gsize unity_mpris_playlists_type_id__volatile = 0;
4794 if (g_once_init_enter (&unity_mpris_playlists_type_id__volatile)) {
4795 static const GTypeInfo g_define_type_info = { sizeof (UnityMprisPlaylistsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) unity_mpris_playlists_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UnityMprisPlaylists), 0, (GInstanceInitFunc) unity_mpris_playlists_instance_init, NULL };
4796 GType unity_mpris_playlists_type_id;
4797 unity_mpris_playlists_type_id = g_type_register_static (G_TYPE_OBJECT, "UnityMprisPlaylists", &g_define_type_info, 0);
4798 g_type_set_qdata (unity_mpris_playlists_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) unity_mpris_playlists_register_object);
4799 g_once_init_leave (&unity_mpris_playlists_type_id__volatile, unity_mpris_playlists_type_id);
4800 }
4801 return unity_mpris_playlists_type_id__volatile;
4802 }
4803
4804
4805 static void _vala_unity_mpris_playlists_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
4806 UnityMprisPlaylists * self;
4807 self = UNITY_MPRIS_PLAYLISTS (object);
4808 switch (property_id) {
4809 case UNITY_MPRIS_PLAYLISTS_ORDERINGS:
4810 {
4811 int length;
4812 g_value_set_boxed (value, unity_mpris_playlists_get_Orderings (self, &length));
4813 }
4814 break;
4815 case UNITY_MPRIS_PLAYLISTS_PLAYLIST_COUNT:
4816 g_value_set_uint (value, unity_mpris_playlists_get_PlaylistCount (self));
4817 break;
4818 case UNITY_MPRIS_PLAYLISTS_ACTIVE_PLAYLIST:
4819 {
4820 UnityActivePlaylistContainer boxed;
4821 unity_mpris_playlists_get_ActivePlaylist (self, &boxed);
4822 g_value_set_boxed (value, &boxed);
4823 }
4824 break;
4825 default:
4826 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
4827 break;
4828 }
4829 }
4830
4831
4832 static void _vala_unity_mpris_playlists_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
4833 UnityMprisPlaylists * self;
4834 self = UNITY_MPRIS_PLAYLISTS (object);
4835 switch (property_id) {
4836 default:
4837 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
4838 break;
4839 }
4840 }
4841
4842
4843 static void _dbus_unity_mpris_playlists_ActivatePlaylist (UnityMprisPlaylists* self, GVariant* parameters, GDBusMethodInvocation* invocation) {
4844 GVariantIter _arguments_iter;
4845 char* playlist_id = NULL;
4846 GVariant* _tmp219_;
4847 g_variant_iter_init (&_arguments_iter, parameters);
4848 _tmp219_ = g_variant_iter_next_value (&_arguments_iter);
4849 playlist_id = g_variant_dup_string (_tmp219_, NULL);
4850 g_variant_unref (_tmp219_);
4851 unity_mpris_playlists_ActivatePlaylist (self, playlist_id, (GAsyncReadyCallback) _dbus_unity_mpris_playlists_ActivatePlaylist_ready, invocation);
4852 _g_free0 (playlist_id);
4853 }
4854
4855
4856 static void _dbus_unity_mpris_playlists_ActivatePlaylist_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_) {
4857 GDBusMethodInvocation * invocation;
4858 GError* error = NULL;
4859 GDBusMessage* _reply_message;
4860 GVariant* _reply;
4861 GVariantBuilder _reply_builder;
4862 invocation = _user_data_;
4863 unity_mpris_playlists_ActivatePlaylist_finish ((UnityMprisPlaylists*) source_object, _res_, &error);
4864 if (error) {
4865 g_dbus_method_invocation_return_gerror (invocation, error);
4866 return;
4867 }
4868 _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
4869 g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
4870 _reply = g_variant_builder_end (&_reply_builder);
4871 g_dbus_message_set_body (_reply_message, _reply);
4872 g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
4873 g_object_unref (invocation);
4874 g_object_unref (_reply_message);
4875 }
4876
4877
4878 static void _dbus_unity_mpris_playlists_GetPlaylists (UnityMprisPlaylists* self, GVariant* parameters, GDBusMethodInvocation* invocation) {
4879 GVariantIter _arguments_iter;
4880 guint32 index = 0U;
4881 GVariant* _tmp220_;
4882 guint32 max_count = 0U;
4883 GVariant* _tmp221_;
4884 gchar* order = NULL;
4885 GVariant* _tmp222_;
4886 gboolean reverse_order = FALSE;
4887 GVariant* _tmp223_;
4888 g_variant_iter_init (&_arguments_iter, parameters);
4889 _tmp220_ = g_variant_iter_next_value (&_arguments_iter);
4890 index = g_variant_get_uint32 (_tmp220_);
4891 g_variant_unref (_tmp220_);
4892 _tmp221_ = g_variant_iter_next_value (&_arguments_iter);
4893 max_count = g_variant_get_uint32 (_tmp221_);
4894 g_variant_unref (_tmp221_);
4895 _tmp222_ = g_variant_iter_next_value (&_arguments_iter);
4896 order = g_variant_dup_string (_tmp222_, NULL);
4897 g_variant_unref (_tmp222_);
4898 _tmp223_ = g_variant_iter_next_value (&_arguments_iter);
4899 reverse_order = g_variant_get_boolean (_tmp223_);
4900 g_variant_unref (_tmp223_);
4901 unity_mpris_playlists_GetPlaylists (self, index, max_count, order, reverse_order, (GAsyncReadyCallback) _dbus_unity_mpris_playlists_GetPlaylists_ready, invocation);
4902 _g_free0 (order);
4903 }
4904
4905
4906 static void _dbus_unity_mpris_playlists_GetPlaylists_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_) {
4907 GDBusMethodInvocation * invocation;
4908 GError* error = NULL;
4909 GDBusMessage* _reply_message;
4910 GVariant* _reply;
4911 GVariantBuilder _reply_builder;
4912 UnityPlaylistDetails* result;
4913 int result_length1 = 0;
4914 UnityPlaylistDetails* _tmp224_;
4915 GVariantBuilder _tmp225_;
4916 int _tmp226_;
4917 invocation = _user_data_;
4918 result = unity_mpris_playlists_GetPlaylists_finish ((UnityMprisPlaylists*) source_object, _res_, &result_length1, &error);
4919 if (error) {
4920 g_dbus_method_invocation_return_gerror (invocation, error);
4921 return;
4922 }
4923 _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
4924 g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
4925 _tmp224_ = result;
4926 g_variant_builder_init (&_tmp225_, G_VARIANT_TYPE ("a(oss)"));
4927 for (_tmp226_ = 0; _tmp226_ < result_length1; _tmp226_++) {
4928 GVariantBuilder _tmp227_;
4929 g_variant_builder_init (&_tmp227_, G_VARIANT_TYPE_TUPLE);
4930 g_variant_builder_add_value (&_tmp227_, g_variant_new_object_path ((*_tmp224_).id));
4931 g_variant_builder_add_value (&_tmp227_, g_variant_new_string ((*_tmp224_).name));
4932 g_variant_builder_add_value (&_tmp227_, g_variant_new_string ((*_tmp224_).icon_name));
4933 g_variant_builder_add_value (&_tmp225_, g_variant_builder_end (&_tmp227_));
4934 _tmp224_++;
4935 }
4936 g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp225_));
4937 result = (_vala_UnityPlaylistDetails_array_free (result, result_length1), NULL);
4938 _reply = g_variant_builder_end (&_reply_builder);
4939 g_dbus_message_set_body (_reply_message, _reply);
4940 g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
4941 g_object_unref (invocation);
4942 g_object_unref (_reply_message);
4943 }
4944
4945
4946 static void unity_mpris_playlists_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data) {
4947 gpointer* data;
4948 gpointer object;
4949 data = user_data;
4950 object = data[0];
4951 if (strcmp (method_name, "ActivatePlaylist") == 0) {
4952 _dbus_unity_mpris_playlists_ActivatePlaylist (object, parameters, invocation);
4953 } else if (strcmp (method_name, "GetPlaylists") == 0) {
4954 _dbus_unity_mpris_playlists_GetPlaylists (object, parameters, invocation);
4955 } else {
4956 g_object_unref (invocation);
4957 }
4958 }
4959
4960
4961 static GVariant* _dbus_unity_mpris_playlists_get_Orderings (UnityMprisPlaylists* self) {
4962 gchar** result;
4963 int result_length1;
4964 gchar** _tmp228_;
4965 GVariantBuilder _tmp229_;
4966 int _tmp230_;
4967 GVariant* _reply;
4968 result = unity_mpris_playlists_get_Orderings (self, &result_length1);
4969 _tmp228_ = result;
4970 g_variant_builder_init (&_tmp229_, G_VARIANT_TYPE ("as"));
4971 for (_tmp230_ = 0; _tmp230_ < result_length1; _tmp230_++) {
4972 g_variant_builder_add_value (&_tmp229_, g_variant_new_string (*_tmp228_));
4973 _tmp228_++;
4974 }
4975 _reply = g_variant_builder_end (&_tmp229_);
4976 return _reply;
4977 }
4978
4979
4980 static GVariant* _dbus_unity_mpris_playlists_get_PlaylistCount (UnityMprisPlaylists* self) {
4981 guint32 result;
4982 GVariant* _reply;
4983 result = unity_mpris_playlists_get_PlaylistCount (self);
4984 _reply = g_variant_new_uint32 (result);
4985 return _reply;
4986 }
4987
4988
4989 static GVariant* _dbus_unity_mpris_playlists_get_ActivePlaylist (UnityMprisPlaylists* self) {
4990 UnityActivePlaylistContainer result = {0};
4991 GVariantBuilder _tmp231_;
4992 GVariantBuilder _tmp232_;
4993 GVariant* _reply;
4994 unity_mpris_playlists_get_ActivePlaylist (self, &result);
4995 g_variant_builder_init (&_tmp231_, G_VARIANT_TYPE_TUPLE);
4996 g_variant_builder_add_value (&_tmp231_, g_variant_new_boolean (result.valid));
4997 g_variant_builder_init (&_tmp232_, G_VARIANT_TYPE_TUPLE);
4998 g_variant_builder_add_value (&_tmp232_, g_variant_new_object_path (result.details.id));
4999 g_variant_builder_add_value (&_tmp232_, g_variant_new_string (result.details.name));
5000 g_variant_builder_add_value (&_tmp232_, g_variant_new_string (result.details.icon_name));
5001 g_variant_builder_add_value (&_tmp231_, g_variant_builder_end (&_tmp232_));
5002 _reply = g_variant_builder_end (&_tmp231_);
5003 return _reply;
5004 }
5005
5006
5007 static GVariant* unity_mpris_playlists_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data) {
5008 gpointer* data;
5009 gpointer object;
5010 data = user_data;
5011 object = data[0];
5012 if (strcmp (property_name, "Orderings") == 0) {
5013 return _dbus_unity_mpris_playlists_get_Orderings (object);
5014 } else if (strcmp (property_name, "PlaylistCount") == 0) {
5015 return _dbus_unity_mpris_playlists_get_PlaylistCount (object);
5016 } else if (strcmp (property_name, "ActivePlaylist") == 0) {
5017 return _dbus_unity_mpris_playlists_get_ActivePlaylist (object);
5018 }
5019 return NULL;
5020 }
5021
5022
5023 static gboolean unity_mpris_playlists_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data) {
5024 gpointer* data;
5025 gpointer object;
5026 data = user_data;
5027 object = data[0];
5028 return FALSE;
5029 }
5030
5031
5032 guint unity_mpris_playlists_register_object (gpointer object, GDBusConnection* connection, const gchar* path, GError** error) {
5033 guint result;
5034 gpointer *data;
5035 data = g_new (gpointer, 3);
5036 data[0] = g_object_ref (object);
5037 data[1] = g_object_ref (connection);
5038 data[2] = g_strdup (path);
5039 result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) (&_unity_mpris_playlists_dbus_interface_info), &_unity_mpris_playlists_dbus_interface_vtable, data, _unity_mpris_playlists_unregister_object, error);
5040 if (!result) {
5041 return 0;
5042 }
5043 return result;
5044 }
5045
5046
5047 static void _unity_mpris_playlists_unregister_object (gpointer user_data) {
5048 gpointer* data;
5049 data = user_data;
5050 g_object_unref (data[0]);
5051 g_object_unref (data[1]);
5052 g_free (data[2]);
5053 g_free (data);
5054 }
5055
5056
5057 static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
5058 if ((array != NULL) && (destroy_func != NULL)) {
5059 int i;
5060 for (i = 0; i < array_length; i = i + 1) {
5061 if (((gpointer*) array)[i] != NULL) {
5062 destroy_func (((gpointer*) array)[i]);
5063 }
5064 }
5065 }
5066 }
5067
5068
5069 static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
5070 _vala_array_destroy (array, array_length, destroy_func);
5071 g_free (array);
5072 }
5073
5074
5075 static gint _vala_array_length (gpointer array) {
5076 int length;
5077 length = 0;
5078 if (array) {
5079 while (((gpointer*) array)[length]) {
5080 length++;
5081 }
5082 }
5083 return length;
5084 }