aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.pc/.version1
-rw-r--r--.pc/applied-patches3
-rw-r--r--.pc/lp_945827.patch/src/metadata-widget.c896
-rw-r--r--.pc/lp_945827.patch/src/mpris2-controller.c1671
-rw-r--r--.pc/lp_945827.patch/src/mpris2-controller.vala267
-rw-r--r--.pc/lp_945827.patch/src/mpris2-interfaces.c2653
-rw-r--r--.pc/lp_945827.patch/src/mpris2-interfaces.vala79
-rw-r--r--.pc/lp_960846.patch/src/mpris2-controller.c1754
-rw-r--r--.pc/lp_960846.patch/src/mpris2-controller.vala283
-rw-r--r--.pc/sound_nua.patch/src/sound-service-dbus.c489
-rw-r--r--src/metadata-widget.c2
-rw-r--r--src/mpris2-controller.c188
-rw-r--r--src/mpris2-controller.vala25
-rw-r--r--src/mpris2-interfaces.c42
-rw-r--r--src/mpris2-interfaces.vala2
-rw-r--r--src/sound-service-dbus.c8
16 files changed, 8292 insertions, 71 deletions
diff --git a/.pc/.version b/.pc/.version
new file mode 100644
index 0000000..0cfbf08
--- /dev/null
+++ b/.pc/.version
@@ -0,0 +1 @@
+2
diff --git a/.pc/applied-patches b/.pc/applied-patches
new file mode 100644
index 0000000..1fa9dfb
--- /dev/null
+++ b/.pc/applied-patches
@@ -0,0 +1,3 @@
+sound_nua.patch
+lp_945827.patch
+lp_960846.patch
diff --git a/.pc/lp_945827.patch/src/metadata-widget.c b/.pc/lp_945827.patch/src/metadata-widget.c
new file mode 100644
index 0000000..ceae79a
--- /dev/null
+++ b/.pc/lp_945827.patch/src/metadata-widget.c
@@ -0,0 +1,896 @@
+/*
+Copyright 2010 Canonical Ltd.
+
+Authors:
+ Conor Curran <conor.curran@canonical.com>
+ Mirco Müller <mirco.mueller@canonical.com>
+
+This program is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 3, as published
+by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranties of
+MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <glib/gi18n-lib.h>
+#include "metadata-widget.h"
+#include "common-defs.h"
+#include <gtk/gtk.h>
+#include <glib.h>
+#include "transport-widget.h"
+#include <libindicator/indicator-image-helper.h>
+
+typedef struct _MetadataWidgetPrivate MetadataWidgetPrivate;
+
+struct _MetadataWidgetPrivate
+{
+ gboolean theme_change_occured;
+ GtkWidget* meta_data_h_box;
+ GtkWidget* meta_data_v_box;
+ GtkWidget* album_art;
+ GString* image_path;
+ GString* old_image_path;
+ GtkWidget* artist_label;
+ GtkWidget* piece_label;
+ GtkWidget* container_label;
+ GtkWidget* player_label;
+ GdkPixbuf* icon_buf;
+ DbusmenuMenuitem* twin_item;
+ gint current_height;
+};
+
+#define METADATA_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), METADATA_WIDGET_TYPE, MetadataWidgetPrivate))
+
+/* Prototypes */
+static void metadata_widget_class_init (MetadataWidgetClass *klass);
+static void metadata_widget_init (MetadataWidget *self);
+static void metadata_widget_dispose (GObject *object);
+static void metadata_widget_finalize (GObject *object);
+static void metadata_widget_set_style (GtkWidget* button, GtkStyle* style);
+static void metadata_widget_set_twin_item (MetadataWidget* self,
+ DbusmenuMenuitem* twin_item);
+// keyevent consumers
+static gboolean metadata_widget_button_release_event (GtkWidget *menuitem,
+ GdkEventButton *event);
+// Dbusmenuitem properties update callback
+static void metadata_widget_property_update (DbusmenuMenuitem* item,
+ gchar* property,
+ GVariant* value,
+ gpointer userdata);
+static void metadata_widget_style_labels ( MetadataWidget* self,
+ GtkLabel* label);
+static void draw_album_art_placeholder (GtkWidget *metadata);
+
+static void draw_album_border (GtkWidget *metadata, gboolean selected);
+static void metadata_widget_selection_received_event_callback( GtkWidget *widget,
+ GtkSelectionData *data,
+ guint time,
+ gpointer user_data);
+
+
+
+#if GTK_CHECK_VERSION(3, 0, 0)
+static void metadata_widget_get_preferred_width (GtkWidget* self,
+ gint* minimum_width,
+ gint* natural_width);
+static gboolean metadata_widget_icon_triangle_draw_cb_gtk_3 (GtkWidget *image,
+ cairo_t* cr,
+ gpointer user_data);
+static gboolean metadata_image_expose_gtk_3 (GtkWidget *image,
+ cairo_t* cr,
+ gpointer user_data);
+#else
+static gboolean metadata_widget_icon_triangle_draw_cb (GtkWidget *image,
+ GdkEventExpose *event,
+ gpointer user_data);
+static gboolean metadata_image_expose (GtkWidget *image,
+ GdkEventExpose *event,
+ gpointer user_data);
+#endif
+
+static void metadata_widget_set_icon (MetadataWidget *self);
+static void metadata_widget_handle_resizing (MetadataWidget* self);
+
+
+G_DEFINE_TYPE (MetadataWidget, metadata_widget, GTK_TYPE_MENU_ITEM);
+
+static void
+metadata_widget_class_init (MetadataWidgetClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ widget_class->button_release_event = metadata_widget_button_release_event;
+ #if GTK_CHECK_VERSION(3, 0, 0)
+ widget_class->get_preferred_width = metadata_widget_get_preferred_width;
+ #endif
+ g_type_class_add_private (klass, sizeof (MetadataWidgetPrivate));
+
+ gobject_class->dispose = metadata_widget_dispose;
+ gobject_class->finalize = metadata_widget_finalize;
+}
+
+static void
+metadata_widget_init (MetadataWidget *self)
+{
+ MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(self);
+ GtkWidget *hbox;
+ GtkWidget *outer_v_box;
+ priv->icon_buf = NULL;
+
+ #if GTK_CHECK_VERSION(3, 0, 0)
+ outer_v_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+ #else
+ outer_v_box = gtk_vbox_new (FALSE, 0);
+ #endif
+
+ #if GTK_CHECK_VERSION(3, 0, 0)
+ hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
+ #else
+ hbox = gtk_hbox_new(FALSE, 0);
+ #endif
+
+ priv->meta_data_h_box = hbox;
+ priv->current_height = 1;
+
+ // image
+ priv->album_art = gtk_image_new();
+ priv->image_path = g_string_new("");
+ priv->old_image_path = g_string_new("");
+
+ #if GTK_CHECK_VERSION(3, 0, 0)
+ g_signal_connect(priv->album_art, "draw",
+ G_CALLBACK(metadata_image_expose_gtk_3),
+ GTK_WIDGET(self));
+
+ g_signal_connect_after (GTK_WIDGET(self), "draw",
+ G_CALLBACK(metadata_widget_icon_triangle_draw_cb_gtk_3),
+ GTK_WIDGET(self));
+ #else
+ g_signal_connect(priv->album_art, "expose-event",
+ G_CALLBACK(metadata_image_expose),
+ GTK_WIDGET(self));
+
+ g_signal_connect_after (GTK_WIDGET(self), "expose-event",
+ G_CALLBACK(metadata_widget_icon_triangle_draw_cb),
+ GTK_WIDGET(self));
+ #endif
+ gtk_box_pack_start (GTK_BOX (priv->meta_data_h_box),
+ priv->album_art,
+ FALSE,
+ FALSE,
+ 1);
+ priv->theme_change_occured = FALSE;
+
+ #if GTK_CHECK_VERSION(3, 0, 0)
+ GtkWidget* vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
+ #else
+ GtkWidget* vbox = gtk_vbox_new(FALSE, 0);
+ #endif
+
+
+ // artist
+ GtkWidget* artist;
+ artist = gtk_label_new("");
+ gtk_misc_set_alignment(GTK_MISC(artist), (gfloat)0, (gfloat)0);
+ gtk_misc_set_padding (GTK_MISC(artist), (gfloat)10, (gfloat)0);
+ gtk_widget_set_size_request (artist, 140, 15);
+
+ gtk_label_set_ellipsize(GTK_LABEL(artist), PANGO_ELLIPSIZE_MIDDLE);
+ metadata_widget_style_labels(self, GTK_LABEL(artist));
+ priv->artist_label = artist;
+
+ // title
+ GtkWidget* piece;
+ piece = gtk_label_new("");
+ gtk_misc_set_alignment(GTK_MISC(piece), (gfloat)0, (gfloat)0);
+ gtk_misc_set_padding (GTK_MISC(piece), (gfloat)10, (gfloat)-5);
+
+ gtk_widget_set_size_request (piece, 140, 15);
+ gtk_label_set_ellipsize(GTK_LABEL(piece), PANGO_ELLIPSIZE_MIDDLE);
+ metadata_widget_style_labels(self, GTK_LABEL(piece));
+ priv->piece_label = piece;
+
+ // container
+ GtkWidget* container;
+ container = gtk_label_new("");
+ gtk_misc_set_alignment(GTK_MISC(container), (gfloat)0, (gfloat)0);
+ gtk_misc_set_padding (GTK_MISC(container), (gfloat)10, (gfloat)0);
+ gtk_widget_set_size_request (container, 140, 15);
+
+ gtk_label_set_ellipsize(GTK_LABEL(container), PANGO_ELLIPSIZE_MIDDLE);
+ metadata_widget_style_labels(self, GTK_LABEL(container));
+ priv->container_label = container;
+
+ gtk_box_pack_start (GTK_BOX (vbox), priv->piece_label, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), priv->artist_label, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), priv->container_label, FALSE, FALSE, 0);
+
+ gtk_box_pack_start (GTK_BOX (priv->meta_data_h_box), vbox, FALSE, FALSE, 0);
+
+ g_signal_connect(self, "style-set",
+ G_CALLBACK(metadata_widget_set_style), GTK_WIDGET(self));
+ g_signal_connect (self, "selection-received",
+ G_CALLBACK(metadata_widget_selection_received_event_callback),
+ GTK_WIDGET(self));
+
+ // player label
+ GtkWidget* player_label;
+ player_label = gtk_label_new ("");
+ gtk_misc_set_alignment(GTK_MISC(player_label), (gfloat)0, (gfloat)0);
+ gtk_misc_set_padding (GTK_MISC(player_label), (gfloat)1, (gfloat)4);
+ gtk_widget_set_size_request (player_label, 150, 24);
+ priv->player_label = player_label;
+
+ gtk_box_pack_start (GTK_BOX(outer_v_box), priv->player_label, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX(outer_v_box), priv->meta_data_h_box, FALSE, FALSE, 0);
+
+ gtk_container_add (GTK_CONTAINER (self), outer_v_box);
+
+ gtk_widget_show_all (priv->meta_data_h_box);
+ gtk_widget_set_no_show_all (priv->meta_data_h_box, TRUE);
+
+ gtk_widget_hide (priv->meta_data_h_box);
+}
+
+static void
+metadata_widget_dispose (GObject *object)
+{
+ MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(METADATA_WIDGET(object));
+
+ if (priv->icon_buf != NULL){
+ #if GTK_CHECK_VERSION(3, 0, 0)
+ g_object_unref(priv->icon_buf);
+ #else
+ gdk_pixbuf_unref(priv->icon_buf);
+ #endif
+ priv->icon_buf = NULL;
+ }
+ G_OBJECT_CLASS (metadata_widget_parent_class)->dispose (object);
+}
+
+static void
+metadata_widget_finalize (GObject *object)
+{
+ MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(METADATA_WIDGET(object));
+ g_string_free (priv->image_path, TRUE);
+ g_string_free (priv->old_image_path, TRUE);
+
+ G_OBJECT_CLASS (metadata_widget_parent_class)->finalize (object);
+}
+
+/**
+* Make sure to only clear the album art only when it is not empty
+* Otherwise it will continuously call queue_draw after each empty call.
+*/
+static void
+clear_album_art (GtkImage* album_art)
+{
+ if (gtk_image_get_storage_type(album_art) != GTK_IMAGE_EMPTY){
+ gtk_image_clear (album_art);
+ }
+}
+
+
+#if GTK_CHECK_VERSION(3, 0, 0)
+static void
+metadata_widget_get_preferred_width (GtkWidget* self,
+ gint* minimum_width,
+ gint* natural_width)
+{
+ *minimum_width = *natural_width = 200;
+}
+
+/**
+ * We override the expose method to enable primitive drawing of the
+ * empty album art image.
+ */
+static gboolean
+metadata_image_expose_gtk_3 (GtkWidget *metadata,
+ cairo_t* cr,
+ gpointer user_data)
+{
+ g_return_val_if_fail(IS_METADATA_WIDGET(user_data), FALSE);
+ MetadataWidget* widget = METADATA_WIDGET(user_data);
+ MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(widget);
+
+ if ( TRUE == dbusmenu_menuitem_property_get_bool (DBUSMENU_MENUITEM(priv->twin_item),
+ DBUSMENU_METADATA_MENUITEM_HIDE_TRACK_DETAILS))
+ {
+ return FALSE;
+ }
+
+ if((guint)priv->image_path->len != 0){
+
+ if(g_string_equal (priv->image_path, priv->old_image_path) == FALSE ||
+ priv->theme_change_occured == TRUE){
+ priv->theme_change_occured = FALSE;
+ GdkPixbuf* pixbuf;
+ pixbuf = gdk_pixbuf_new_from_file_at_size(priv->image_path->str, 60, 60, NULL);
+
+ if(GDK_IS_PIXBUF(pixbuf) == FALSE){
+ clear_album_art (GTK_IMAGE(priv->album_art));
+ gtk_widget_set_size_request(GTK_WIDGET(priv->album_art), 60, 60);
+ draw_album_border (metadata, FALSE);
+ draw_album_art_placeholder(metadata);
+ return FALSE;
+ }
+
+ gtk_image_set_from_pixbuf(GTK_IMAGE(priv->album_art), pixbuf);
+ gtk_widget_set_size_request(GTK_WIDGET(priv->album_art),
+ gdk_pixbuf_get_width(pixbuf),
+ gdk_pixbuf_get_height(pixbuf));
+
+ draw_album_border (metadata, FALSE);
+ g_string_erase (priv->old_image_path, 0, -1);
+ g_string_overwrite (priv->old_image_path, 0, priv->image_path->str);
+ g_object_unref(pixbuf);
+ }
+ return FALSE;
+ }
+ clear_album_art (GTK_IMAGE(priv->album_art));
+ g_string_erase (priv->old_image_path, 0, -1);
+ gtk_widget_set_size_request(GTK_WIDGET(priv->album_art), 60, 60);
+ draw_album_border (metadata, FALSE);
+ draw_album_art_placeholder(metadata);
+ return FALSE;
+}
+
+// Draw the triangle if the player is running ...
+static gboolean
+metadata_widget_icon_triangle_draw_cb_gtk_3 (GtkWidget *widget,
+ cairo_t* cr,
+ gpointer user_data)
+{
+ g_return_val_if_fail(IS_METADATA_WIDGET(user_data), FALSE);
+ MetadataWidget* meta = METADATA_WIDGET(user_data);
+ MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(meta);
+
+ GtkStyle *style;
+ int x, y, arrow_width, arrow_height;
+
+ arrow_width = 5;
+ arrow_height = 9;
+
+ style = gtk_widget_get_style (widget);
+
+ GtkAllocation allocation;
+ gtk_widget_get_allocation (widget, &allocation);
+ x = allocation.x;
+ y = 0;
+
+ gint offset = gdk_pixbuf_get_height (priv->icon_buf) / 3;
+
+ // Draw player icon
+ if (priv->icon_buf != NULL){
+ gdk_cairo_set_source_pixbuf (cr,
+ priv->icon_buf,
+ x + arrow_width + 1,
+ y + offset);
+ cairo_paint (cr);
+ }
+
+ // Draw triangle but only if the player is running.
+ if (dbusmenu_menuitem_property_get_bool (priv->twin_item,
+ DBUSMENU_METADATA_MENUITEM_PLAYER_RUNNING)){
+ y += gdk_pixbuf_get_height (priv->icon_buf) / 3 + 3;
+ cairo_set_line_width (cr, 1.0);
+
+ cairo_move_to (cr, x, y);
+ cairo_line_to (cr, x, y + arrow_height);
+ cairo_line_to (cr, x + arrow_width, y + (double)arrow_height/2.0);
+ cairo_close_path (cr);
+ cairo_set_source_rgb (cr, style->fg[gtk_widget_get_state(widget)].red/65535.0,
+ style->fg[gtk_widget_get_state(widget)].green/65535.0,
+ style->fg[gtk_widget_get_state(widget)].blue/65535.0);
+ cairo_fill (cr);
+ }
+
+ return FALSE;
+}
+
+// GTK 2 Expose handler
+#else
+
+static gboolean
+metadata_image_expose (GtkWidget *metadata,
+ GdkEventExpose *event,
+ gpointer user_data)
+{
+ g_return_val_if_fail(IS_METADATA_WIDGET(user_data), FALSE);
+ MetadataWidget* widget = METADATA_WIDGET(user_data);
+ MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(widget);
+
+ if ( TRUE == dbusmenu_menuitem_property_get_bool (DBUSMENU_MENUITEM(priv->twin_item),
+ DBUSMENU_METADATA_MENUITEM_HIDE_TRACK_DETAILS))
+ {
+ return FALSE;
+ }
+
+ draw_album_border(metadata, FALSE);
+
+ if(priv->image_path->len > 0){
+ if(g_string_equal(priv->image_path, priv->old_image_path) == FALSE ||
+ priv->theme_change_occured == TRUE){
+ priv->theme_change_occured = FALSE;
+ GdkPixbuf* pixbuf;
+ pixbuf = gdk_pixbuf_new_from_file_at_size(priv->image_path->str, 60, 60, NULL);
+
+ if(GDK_IS_PIXBUF(pixbuf) == FALSE){
+ clear_album_art (GTK_IMAGE(priv->album_art));
+ gtk_widget_set_size_request(GTK_WIDGET(priv->album_art), 60, 60);
+ draw_album_art_placeholder(metadata);
+ return FALSE;
+ }
+
+ gtk_image_set_from_pixbuf(GTK_IMAGE(priv->album_art), pixbuf);
+ gtk_widget_set_size_request(GTK_WIDGET(priv->album_art),
+ gdk_pixbuf_get_width(pixbuf),
+ gdk_pixbuf_get_height(pixbuf));
+
+ g_string_erase (priv->old_image_path, 0, -1);
+ g_string_overwrite (priv->old_image_path, 0, priv->image_path->str);
+ g_object_unref(pixbuf);
+ }
+ return FALSE;
+ }
+ clear_album_art (GTK_IMAGE(priv->album_art));
+ g_string_erase (priv->old_image_path, 0, -1);
+ gtk_widget_set_size_request(GTK_WIDGET(priv->album_art), 60, 60);
+ draw_album_art_placeholder(metadata);
+ return FALSE;
+}
+
+
+// Draw the triangle if the player is running ...
+static gboolean
+metadata_widget_icon_triangle_draw_cb (GtkWidget *widget,
+ GdkEventExpose *event,
+ gpointer user_data)
+{
+ g_return_val_if_fail(IS_METADATA_WIDGET(user_data), FALSE);
+ MetadataWidget* meta = METADATA_WIDGET(user_data);
+ MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(meta);
+
+ GtkStyle *style;
+ cairo_t *cr;
+ int x, y, arrow_width, arrow_height;
+
+ arrow_width = 5;
+ arrow_height = 9;
+
+ style = gtk_widget_get_style (widget);
+
+ cr = (cairo_t*) gdk_cairo_create (gtk_widget_get_window (widget));
+
+ GtkAllocation allocation;
+ gtk_widget_get_allocation (widget, &allocation);
+ x = allocation.x;
+ y = allocation.y;
+
+ gint offset = (allocation.height - gdk_pixbuf_get_height (priv->icon_buf)) / 2;
+
+ // Draw player icon
+ if (priv->icon_buf != NULL){
+ gdk_cairo_set_source_pixbuf (cr,
+ priv->icon_buf,
+ x + arrow_width + 1,
+ y + offset);
+ cairo_paint (cr);
+ }
+
+ // Draw triangle but only if the player is running.
+ if (dbusmenu_menuitem_property_get_bool (priv->twin_item,
+ DBUSMENU_METADATA_MENUITEM_PLAYER_RUNNING)){
+ y += allocation.height/2.0 - (double)arrow_height/2.0;
+ cairo_set_line_width (cr, 1.0);
+
+ cairo_move_to (cr, x, y);
+ cairo_line_to (cr, x, y + arrow_height);
+ cairo_line_to (cr, x + arrow_width, y + (double)arrow_height/2.0);
+ cairo_close_path (cr);
+ cairo_set_source_rgb (cr, style->fg[gtk_widget_get_state(widget)].red/65535.0,
+ style->fg[gtk_widget_get_state(widget)].green/65535.0,
+ style->fg[gtk_widget_get_state(widget)].blue/65535.0);
+ cairo_fill (cr);
+ }
+
+ cairo_destroy (cr);
+ return FALSE;
+}
+#endif
+
+static void
+draw_album_border(GtkWidget *metadata,
+ gboolean selected)
+{
+ cairo_t *cr;
+ cr = gdk_cairo_create (gtk_widget_get_window (metadata));
+ #if GTK_CHECK_VERSION(3, 0, 0)
+ gtk_style_context_add_class (gtk_widget_get_style_context (metadata),
+ "menu");
+ #endif
+
+ GtkStyle *style;
+ style = gtk_widget_get_style (metadata);
+
+ GtkAllocation alloc;
+ gtk_widget_get_allocation (metadata, &alloc);
+ gint offset = 1;
+
+ alloc.width = alloc.width + (offset * 2);
+ alloc.height = alloc.height + (offset * 2) - 7;
+ alloc.x = alloc.x - offset;
+ alloc.y = alloc.y - offset + 3;
+
+ CairoColorRGB bg_normal, fg_normal;
+
+ bg_normal.r = style->bg[0].red/65535.0;
+ bg_normal.g = style->bg[0].green/65535.0;
+ bg_normal.b = style->bg[0].blue/65535.0;
+
+ const gint state = selected ? GTK_STATE_SELECTED : GTK_STATE_NORMAL;
+
+ fg_normal.r = style->fg[state].red/65535.0;
+ fg_normal.g = style->fg[state].green/65535.0;
+ fg_normal.b = style->fg[state].blue/65535.0;
+
+ CairoColorRGB dark_top_color;
+ CairoColorRGB light_bottom_color;
+ CairoColorRGB background_color;
+
+ _color_shade ( &bg_normal, 0.93, &background_color );
+ _color_shade ( &bg_normal, 0.23, &dark_top_color );
+ _color_shade ( &fg_normal, 0.55, &light_bottom_color );
+
+ cairo_rectangle (cr,
+ alloc.x, alloc.y,
+ alloc.width, alloc.height);
+
+ cairo_set_line_width (cr, 1.0);
+
+ cairo_clip ( cr );
+
+ cairo_move_to (cr, alloc.x, alloc.y );
+ cairo_line_to (cr, alloc.x + alloc.width,
+ alloc.y );
+ cairo_line_to ( cr, alloc.x + alloc.width,
+ alloc.y + alloc.height );
+ cairo_line_to ( cr, alloc.x, alloc.y + alloc.height );
+ cairo_line_to ( cr, alloc.x, alloc.y);
+ cairo_close_path (cr);
+
+ cairo_set_source_rgba ( cr,
+ background_color.r,
+ background_color.g,
+ background_color.b,
+ 1.0 );
+
+ cairo_fill ( cr );
+
+ cairo_move_to (cr, alloc.x, alloc.y );
+ cairo_line_to (cr, alloc.x + alloc.width,
+ alloc.y );
+
+ cairo_close_path (cr);
+ cairo_set_source_rgba ( cr,
+ dark_top_color.r,
+ dark_top_color.g,
+ dark_top_color.b,
+ 1.0 );
+
+ cairo_stroke ( cr );
+
+ cairo_move_to ( cr, alloc.x + alloc.width,
+ alloc.y + alloc.height );
+ cairo_line_to ( cr, alloc.x, alloc.y + alloc.height );
+
+ cairo_close_path (cr);
+ cairo_set_source_rgba ( cr,
+ light_bottom_color.r,
+ light_bottom_color.g,
+ light_bottom_color.b,
+ 1.0);
+
+ cairo_stroke ( cr );
+ cairo_destroy (cr);
+}
+
+static void
+draw_album_art_placeholder(GtkWidget *metadata)
+{
+ cairo_t *cr;
+ cr = gdk_cairo_create (gtk_widget_get_window (metadata));
+ GtkStyle *style;
+ style = gtk_widget_get_style (metadata);
+
+ GtkAllocation alloc;
+ gtk_widget_get_allocation (metadata, &alloc);
+
+ PangoLayout *layout;
+ PangoFontDescription *desc;
+ layout = pango_cairo_create_layout(cr);
+ PangoContext* pcontext = pango_cairo_create_context(cr);
+ pango_cairo_context_set_resolution (pcontext, 96);
+
+ GString* string = g_string_new("");
+ gssize size = -1;
+ gunichar code = g_utf8_get_char_validated("\342\231\253", size);
+ g_string_append_unichar (string, code);
+
+ pango_layout_set_text(layout, string->str, -1);
+ desc = pango_font_description_from_string("Sans Bold 30");
+ pango_layout_set_font_description(layout, desc);
+ pango_font_description_free(desc);
+
+ CairoColorRGB fg_normal, light_bottom_color;
+
+ fg_normal.r = style->fg[0].red/65535.0;
+ fg_normal.g = style->fg[0].green/65535.0;
+ fg_normal.b = style->fg[0].blue/65535.0;
+
+ _color_shade ( &fg_normal, 0.78, &light_bottom_color );
+
+ cairo_set_source_rgba (cr,
+ light_bottom_color.r,
+ light_bottom_color.g,
+ light_bottom_color.b,
+ 1.0);
+
+ pango_cairo_update_layout(cr, layout);
+ cairo_move_to (cr, alloc.x + alloc.width/6, alloc.y + 3);
+ pango_cairo_show_layout(cr, layout);
+
+ g_object_unref(layout);
+ g_object_unref(pcontext);
+ g_string_free (string, TRUE);
+ cairo_destroy (cr);
+}
+
+static void
+metadata_widget_selection_received_event_callback ( GtkWidget *widget,
+ GtkSelectionData *data,
+ guint time,
+ gpointer user_data )
+
+{
+ draw_album_border(widget, TRUE);
+}
+
+/* Suppress/consume keyevents */
+static gboolean
+metadata_widget_button_release_event (GtkWidget *menuitem,
+ GdkEventButton *event)
+{
+ g_return_val_if_fail (IS_METADATA_WIDGET (menuitem), FALSE);
+ MetadataWidgetPrivate* priv = METADATA_WIDGET_GET_PRIVATE(METADATA_WIDGET(menuitem));
+ // For the left raise/launch the player
+ if (event->button == 1){
+ GVariant* new_title_event = g_variant_new_boolean(TRUE);
+ dbusmenu_menuitem_handle_event (priv->twin_item,
+ "Title menu event",
+ new_title_event,
+ 0);
+ }
+ // For the right copy track details to clipboard only if the player is running
+ // and there is something there
+ else if (event->button == 3){
+ gboolean running = dbusmenu_menuitem_property_get_bool (priv->twin_item,
+ DBUSMENU_METADATA_MENUITEM_PLAYER_RUNNING);
+ gboolean hidden = dbusmenu_menuitem_property_get_bool (priv->twin_item,
+ DBUSMENU_METADATA_MENUITEM_HIDE_TRACK_DETAILS);
+ g_return_val_if_fail ( running, FALSE );
+
+ g_return_val_if_fail ( !hidden, FALSE );
+
+ GtkClipboard* board = gtk_clipboard_get (GDK_NONE);
+ gchar* contents = g_strdup_printf("artist: %s \ntitle: %s \nalbum: %s",
+ dbusmenu_menuitem_property_get(priv->twin_item,
+ DBUSMENU_METADATA_MENUITEM_ARTIST),
+ dbusmenu_menuitem_property_get(priv->twin_item,
+ DBUSMENU_METADATA_MENUITEM_TITLE),
+ dbusmenu_menuitem_property_get(priv->twin_item,
+ DBUSMENU_METADATA_MENUITEM_ALBUM));
+ gtk_clipboard_set_text (board, contents, -1);
+ gtk_clipboard_store (board);
+ g_free(contents);
+ }
+ return FALSE;
+}
+
+static void
+metadata_widget_property_update(DbusmenuMenuitem* item, gchar* property,
+ GVariant* value, gpointer userdata)
+{
+ g_return_if_fail (IS_METADATA_WIDGET (userdata));
+
+ if(g_variant_is_of_type(value, G_VARIANT_TYPE_INT32) == TRUE &&
+ g_variant_get_int32(value) == DBUSMENU_PROPERTY_EMPTY){
+ GVariant* new_value = g_variant_new_string ("");
+ value = new_value;
+ }
+
+ MetadataWidget* mitem = METADATA_WIDGET(userdata);
+ MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(mitem);
+
+ if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_ARTIST, property) == 0){
+ gtk_label_set_text(GTK_LABEL(priv->artist_label), g_variant_get_string(value, NULL));
+ metadata_widget_style_labels(mitem, GTK_LABEL(priv->artist_label));
+ }
+ else if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_TITLE, property) == 0){
+ gtk_label_set_text(GTK_LABEL(priv->piece_label), g_variant_get_string(value, NULL));
+ metadata_widget_style_labels(mitem, GTK_LABEL(priv->piece_label));
+ }
+ else if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_ALBUM, property) == 0){
+ gtk_label_set_text(GTK_LABEL(priv->container_label), g_variant_get_string(value, NULL));
+ metadata_widget_style_labels(mitem, GTK_LABEL(priv->container_label));
+ }
+ else if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_ARTURL, property) == 0){
+ g_string_erase(priv->image_path, 0, -1);
+ g_string_overwrite (priv->image_path, 0, g_variant_get_string (value, NULL));
+ gtk_widget_queue_draw(GTK_WIDGET(mitem));
+ }
+ else if (g_ascii_strcasecmp (DBUSMENU_METADATA_MENUITEM_PLAYER_NAME, property) == 0){
+ gtk_label_set_label (GTK_LABEL (priv->player_label),
+ g_variant_get_string(value, NULL));
+ }
+ else if (g_ascii_strcasecmp (DBUSMENU_METADATA_MENUITEM_PLAYER_ICON, property) == 0){
+ metadata_widget_set_icon (mitem);
+ }
+ else if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_HIDE_TRACK_DETAILS, property) == 0){
+ metadata_widget_handle_resizing (mitem);
+ }
+}
+
+static void
+metadata_widget_handle_resizing (MetadataWidget* self)
+{
+ MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(self);
+
+ if (dbusmenu_menuitem_property_get_bool (priv->twin_item,
+ DBUSMENU_METADATA_MENUITEM_HIDE_TRACK_DETAILS) == TRUE){
+ gtk_widget_hide (priv->meta_data_h_box);
+ }
+ else{
+ gtk_widget_show (priv->meta_data_h_box);
+ }
+ gtk_widget_queue_draw(GTK_WIDGET(self));
+}
+
+static void
+metadata_widget_style_labels(MetadataWidget* self, GtkLabel* label)
+{
+ char* markup;
+ markup = g_markup_printf_escaped ("<span size=\"smaller\">%s</span>",
+ gtk_label_get_text(GTK_LABEL(label)));
+ gtk_label_set_markup (GTK_LABEL (label), markup);
+ g_free(markup);
+}
+
+static void
+metadata_widget_set_style(GtkWidget* metadata, GtkStyle* style)
+{
+ g_return_if_fail(IS_METADATA_WIDGET(metadata));
+ MetadataWidget* widg = METADATA_WIDGET(metadata);
+ MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(widg);
+ priv->theme_change_occured = TRUE;
+ gtk_widget_queue_draw (GTK_WIDGET(metadata));
+}
+
+static void
+metadata_widget_set_icon (MetadataWidget *self)
+{
+ MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(self);
+
+ if (priv->icon_buf != NULL){
+ #if GTK_CHECK_VERSION(3, 0, 0)
+ g_object_unref(priv->icon_buf);
+ #else
+ gdk_pixbuf_unref(priv->icon_buf);
+ #endif
+ priv->icon_buf = NULL;
+ }
+
+ gint padding = 0;
+ gtk_widget_style_get(GTK_WIDGET(self), "horizontal-padding", &padding, NULL);
+ gint width, height;
+ gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &width, &height);
+
+ GString* banshee_string = g_string_new ( "banshee" );
+ gchar * tmp = g_utf8_strdown (dbusmenu_menuitem_property_get(priv->twin_item, DBUSMENU_METADATA_MENUITEM_PLAYER_NAME), -1);
+ GString* app_panel = g_string_new (tmp);
+ g_free (tmp);
+ GdkPixbuf* icon_buf;
+
+ // Banshee Special case!
+ // Not ideal but apparently we want the banshee icon to be the greyscale one
+ // and any others to be the icon from the desktop file => colour.
+ if ( g_string_equal ( banshee_string, app_panel ) == TRUE &&
+ gtk_icon_theme_has_icon ( gtk_icon_theme_get_default(), app_panel->str ) ){
+ g_string_append ( app_panel, "-panel" );
+ }
+ else{
+ // Otherwise use what is stored in the props
+ g_string_erase (app_panel, 0, -1);
+ g_string_overwrite (app_panel,
+ 0,
+ dbusmenu_menuitem_property_get ( priv->twin_item,
+ DBUSMENU_METADATA_MENUITEM_PLAYER_ICON ));
+ }
+ icon_buf = gtk_icon_theme_load_icon ( gtk_icon_theme_get_default(),
+ app_panel->str,
+ (width > height) ? width : height,
+ GTK_ICON_LOOKUP_GENERIC_FALLBACK,
+ NULL );
+ priv->icon_buf = icon_buf;
+ g_string_free ( app_panel, TRUE);
+ g_string_free ( banshee_string, TRUE);
+}
+
+static void
+metadata_widget_set_twin_item (MetadataWidget* self,
+ DbusmenuMenuitem* twin_item)
+{
+ MetadataWidgetPrivate* priv = METADATA_WIDGET_GET_PRIVATE(self);
+ priv->twin_item = twin_item;
+ g_signal_connect( G_OBJECT(priv->twin_item), "property-changed",
+ G_CALLBACK(metadata_widget_property_update), self);
+ gtk_label_set_text( GTK_LABEL(priv->container_label),
+ dbusmenu_menuitem_property_get( priv->twin_item,
+ DBUSMENU_METADATA_MENUITEM_ALBUM));
+ metadata_widget_style_labels( self, GTK_LABEL(priv->container_label));
+
+ gtk_label_set_text( GTK_LABEL(priv->piece_label),
+ dbusmenu_menuitem_property_get( priv->twin_item,
+ DBUSMENU_METADATA_MENUITEM_TITLE));
+ metadata_widget_style_labels( self, GTK_LABEL(priv->piece_label));
+ gtk_label_set_text( GTK_LABEL(priv->artist_label),
+ dbusmenu_menuitem_property_get( priv->twin_item,
+ DBUSMENU_METADATA_MENUITEM_ARTIST));
+ metadata_widget_style_labels( self, GTK_LABEL(priv->artist_label));
+
+ g_string_erase(priv->image_path, 0, -1);
+ const gchar *arturl = dbusmenu_menuitem_property_get( priv->twin_item,
+ DBUSMENU_METADATA_MENUITEM_ARTURL );
+
+ gtk_label_set_label (GTK_LABEL(priv->player_label),
+ dbusmenu_menuitem_property_get(priv->twin_item,
+ DBUSMENU_METADATA_MENUITEM_PLAYER_NAME));
+
+ metadata_widget_set_icon(self);
+
+ if (arturl != NULL){
+ g_string_overwrite( priv->image_path,
+ 0,
+ arturl);
+ // if its a remote image queue a redraw incase the download took too long
+ if (g_str_has_prefix (arturl, g_get_user_cache_dir())){
+ gtk_widget_queue_draw(GTK_WIDGET(self));
+ }
+ }
+ metadata_widget_handle_resizing (self);
+}
+
+ /**
+ * transport_new:
+ * @returns: a new #MetadataWidget.
+ **/
+GtkWidget*
+metadata_widget_new(DbusmenuMenuitem *item)
+{
+ GtkWidget* widget = g_object_new(METADATA_WIDGET_TYPE, NULL);
+ metadata_widget_set_twin_item ( METADATA_WIDGET(widget),
+ item );
+ return widget;
+}
+
diff --git a/.pc/lp_945827.patch/src/mpris2-controller.c b/.pc/lp_945827.patch/src/mpris2-controller.c
new file mode 100644
index 0000000..57250b6
--- /dev/null
+++ b/.pc/lp_945827.patch/src/mpris2-controller.c
@@ -0,0 +1,1671 @@
+/* mpris2-controller.c generated by valac 0.14.2, the Vala compiler
+ * generated from mpris2-controller.vala, do not modify */
+
+/*
+Copyright 2010 Canonical Ltd.
+
+Authors:
+ Conor Curran <conor.curran@canonical.com>
+
+This program is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 3, as published
+by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranties of
+MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <common-defs.h>
+#include <libdbusmenu-glib/client.h>
+#include <libdbusmenu-glib/dbusmenu-glib.h>
+#include <libdbusmenu-glib/enum-types.h>
+#include <libdbusmenu-glib/menuitem-proxy.h>
+#include <libdbusmenu-glib/menuitem.h>
+#include <libdbusmenu-glib/server.h>
+#include <libdbusmenu-glib/types.h>
+#include <gee.h>
+
+
+#define TYPE_MPRIS2_CONTROLLER (mpris2_controller_get_type ())
+#define MPRIS2_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS2_CONTROLLER, Mpris2Controller))
+#define MPRIS2_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS2_CONTROLLER, Mpris2ControllerClass))
+#define IS_MPRIS2_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS2_CONTROLLER))
+#define IS_MPRIS2_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS2_CONTROLLER))
+#define MPRIS2_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS2_CONTROLLER, Mpris2ControllerClass))
+
+typedef struct _Mpris2Controller Mpris2Controller;
+typedef struct _Mpris2ControllerClass Mpris2ControllerClass;
+typedef struct _Mpris2ControllerPrivate Mpris2ControllerPrivate;
+
+#define TYPE_MPRIS_ROOT (mpris_root_get_type ())
+#define MPRIS_ROOT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_ROOT, MprisRoot))
+#define IS_MPRIS_ROOT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_ROOT))
+#define MPRIS_ROOT_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_MPRIS_ROOT, MprisRootIface))
+
+typedef struct _MprisRoot MprisRoot;
+typedef struct _MprisRootIface MprisRootIface;
+
+#define TYPE_MPRIS_ROOT_PROXY (mpris_root_proxy_get_type ())
+
+#define TYPE_MPRIS_PLAYER (mpris_player_get_type ())
+#define MPRIS_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_PLAYER, MprisPlayer))
+#define IS_MPRIS_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_PLAYER))
+#define MPRIS_PLAYER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_MPRIS_PLAYER, MprisPlayerIface))
+
+typedef struct _MprisPlayer MprisPlayer;
+typedef struct _MprisPlayerIface MprisPlayerIface;
+
+#define TYPE_MPRIS_PLAYER_PROXY (mpris_player_proxy_get_type ())
+
+#define TYPE_MPRIS_PLAYLISTS (mpris_playlists_get_type ())
+#define MPRIS_PLAYLISTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_PLAYLISTS, MprisPlaylists))
+#define IS_MPRIS_PLAYLISTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_PLAYLISTS))
+#define MPRIS_PLAYLISTS_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_MPRIS_PLAYLISTS, MprisPlaylistsIface))
+
+typedef struct _MprisPlaylists MprisPlaylists;
+typedef struct _MprisPlaylistsIface MprisPlaylistsIface;
+
+#define TYPE_MPRIS_PLAYLISTS_PROXY (mpris_playlists_proxy_get_type ())
+
+#define TYPE_PLAYLIST_DETAILS (playlist_details_get_type ())
+typedef struct _PlaylistDetails PlaylistDetails;
+
+#define TYPE_ACTIVE_PLAYLIST_CONTAINER (active_playlist_container_get_type ())
+typedef struct _ActivePlaylistContainer ActivePlaylistContainer;
+
+#define TYPE_FREE_DESKTOP_PROPERTIES (free_desktop_properties_get_type ())
+#define FREE_DESKTOP_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FREE_DESKTOP_PROPERTIES, FreeDesktopProperties))
+#define IS_FREE_DESKTOP_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FREE_DESKTOP_PROPERTIES))
+#define FREE_DESKTOP_PROPERTIES_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_FREE_DESKTOP_PROPERTIES, FreeDesktopPropertiesIface))
+
+typedef struct _FreeDesktopProperties FreeDesktopProperties;
+typedef struct _FreeDesktopPropertiesIface FreeDesktopPropertiesIface;
+
+#define TYPE_FREE_DESKTOP_PROPERTIES_PROXY (free_desktop_properties_proxy_get_type ())
+
+#define TYPE_PLAYER_CONTROLLER (player_controller_get_type ())
+#define PLAYER_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYER_CONTROLLER, PlayerController))
+#define PLAYER_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYER_CONTROLLER, PlayerControllerClass))
+#define IS_PLAYER_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYER_CONTROLLER))
+#define IS_PLAYER_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYER_CONTROLLER))
+#define PLAYER_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYER_CONTROLLER, PlayerControllerClass))
+
+typedef struct _PlayerController PlayerController;
+typedef struct _PlayerControllerClass PlayerControllerClass;
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+typedef struct _PlayerControllerPrivate PlayerControllerPrivate;
+
+#define TYPE_PLAYER_ITEM (player_item_get_type ())
+#define PLAYER_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYER_ITEM, PlayerItem))
+#define PLAYER_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYER_ITEM, PlayerItemClass))
+#define IS_PLAYER_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYER_ITEM))
+#define IS_PLAYER_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYER_ITEM))
+#define PLAYER_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYER_ITEM, PlayerItemClass))
+
+typedef struct _PlayerItem PlayerItem;
+typedef struct _PlayerItemClass PlayerItemClass;
+
+#define PLAYER_CONTROLLER_TYPE_WIDGET_ORDER (player_controller_widget_order_get_type ())
+
+#define TYPE_TRANSPORT_MENUITEM (transport_menuitem_get_type ())
+#define TRANSPORT_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TRANSPORT_MENUITEM, TransportMenuitem))
+#define TRANSPORT_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TRANSPORT_MENUITEM, TransportMenuitemClass))
+#define IS_TRANSPORT_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TRANSPORT_MENUITEM))
+#define IS_TRANSPORT_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TRANSPORT_MENUITEM))
+#define TRANSPORT_MENUITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TRANSPORT_MENUITEM, TransportMenuitemClass))
+
+typedef struct _TransportMenuitem TransportMenuitem;
+typedef struct _TransportMenuitemClass TransportMenuitemClass;
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+#define TYPE_METADATA_MENUITEM (metadata_menuitem_get_type ())
+#define METADATA_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_METADATA_MENUITEM, MetadataMenuitem))
+#define METADATA_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_METADATA_MENUITEM, MetadataMenuitemClass))
+#define IS_METADATA_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_METADATA_MENUITEM))
+#define IS_METADATA_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_METADATA_MENUITEM))
+#define METADATA_MENUITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_METADATA_MENUITEM, MetadataMenuitemClass))
+
+typedef struct _MetadataMenuitem MetadataMenuitem;
+typedef struct _MetadataMenuitemClass MetadataMenuitemClass;
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
+
+#define TYPE_PLAYLISTS_MENUITEM (playlists_menuitem_get_type ())
+#define PLAYLISTS_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYLISTS_MENUITEM, PlaylistsMenuitem))
+#define PLAYLISTS_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYLISTS_MENUITEM, PlaylistsMenuitemClass))
+#define IS_PLAYLISTS_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYLISTS_MENUITEM))
+#define IS_PLAYLISTS_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYLISTS_MENUITEM))
+#define PLAYLISTS_MENUITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYLISTS_MENUITEM, PlaylistsMenuitemClass))
+
+typedef struct _PlaylistsMenuitem PlaylistsMenuitem;
+typedef struct _PlaylistsMenuitemClass PlaylistsMenuitemClass;
+#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
+typedef struct _Mpris2ControllerFetchPlaylistsData Mpris2ControllerFetchPlaylistsData;
+
+struct _Mpris2Controller {
+ GObject parent_instance;
+ Mpris2ControllerPrivate * priv;
+};
+
+struct _Mpris2ControllerClass {
+ GObjectClass parent_class;
+};
+
+struct _MprisRootIface {
+ GTypeInterface parent_iface;
+ void (*Quit) (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+ void (*Quit_finish) (MprisRoot* self, GAsyncResult* _res_, GError** error);
+ void (*Raise) (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+ void (*Raise_finish) (MprisRoot* self, GAsyncResult* _res_, GError** error);
+ gboolean (*get_HasTracklist) (MprisRoot* self);
+ void (*set_HasTracklist) (MprisRoot* self, gboolean value);
+ gboolean (*get_CanQuit) (MprisRoot* self);
+ void (*set_CanQuit) (MprisRoot* self, gboolean value);
+ gboolean (*get_CanRaise) (MprisRoot* self);
+ void (*set_CanRaise) (MprisRoot* self, gboolean value);
+ gchar* (*get_Identity) (MprisRoot* self);
+ void (*set_Identity) (MprisRoot* self, const gchar* value);
+ gchar* (*get_DesktopEntry) (MprisRoot* self);
+ void (*set_DesktopEntry) (MprisRoot* self, const gchar* value);
+};
+
+struct _MprisPlayerIface {
+ GTypeInterface parent_iface;
+ void (*PlayPause) (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+ void (*PlayPause_finish) (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+ void (*Next) (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+ void (*Next_finish) (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+ void (*Previous) (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+ void (*Previous_finish) (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+ void (*Seek) (MprisPlayer* self, gint64 offset, GAsyncReadyCallback _callback_, gpointer _user_data_);
+ void (*Seek_finish) (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+ GHashTable* (*get_Metadata) (MprisPlayer* self);
+ void (*set_Metadata) (MprisPlayer* self, GHashTable* value);
+ gint32 (*get_Position) (MprisPlayer* self);
+ void (*set_Position) (MprisPlayer* self, gint32 value);
+ gchar* (*get_PlaybackStatus) (MprisPlayer* self);
+ void (*set_PlaybackStatus) (MprisPlayer* self, const gchar* value);
+};
+
+struct _PlaylistDetails {
+ char* path;
+ gchar* name;
+ gchar* icon_path;
+};
+
+struct _ActivePlaylistContainer {
+ gboolean valid;
+ PlaylistDetails* details;
+};
+
+struct _MprisPlaylistsIface {
+ GTypeInterface parent_iface;
+ void (*ActivatePlaylist) (MprisPlaylists* self, const char* playlist_id, GAsyncReadyCallback _callback_, gpointer _user_data_);
+ void (*ActivatePlaylist_finish) (MprisPlaylists* self, GAsyncResult* _res_, GError** error);
+ void (*GetPlaylists) (MprisPlaylists* self, guint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, GAsyncReadyCallback _callback_, gpointer _user_data_);
+ PlaylistDetails* (*GetPlaylists_finish) (MprisPlaylists* self, GAsyncResult* _res_, int* result_length1, GError** error);
+ gchar** (*get_Orderings) (MprisPlaylists* self, int* result_length1);
+ void (*set_Orderings) (MprisPlaylists* self, gchar** value, int value_length1);
+ guint32 (*get_PlaylistCount) (MprisPlaylists* self);
+ void (*set_PlaylistCount) (MprisPlaylists* self, guint32 value);
+ void (*get_ActivePlaylist) (MprisPlaylists* self, ActivePlaylistContainer* value);
+ void (*set_ActivePlaylist) (MprisPlaylists* self, ActivePlaylistContainer* value);
+};
+
+struct _FreeDesktopPropertiesIface {
+ GTypeInterface parent_iface;
+};
+
+struct _Mpris2ControllerPrivate {
+ MprisRoot* _mpris2_root;
+ MprisPlayer* _player;
+ MprisPlaylists* _playlists;
+ FreeDesktopProperties* _properties_interface;
+ PlayerController* _owner;
+};
+
+struct _PlayerController {
+ GObject parent_instance;
+ PlayerControllerPrivate * priv;
+ gint current_state;
+ DbusmenuMenuitem* root_menu;
+ GeeArrayList* custom_items;
+ Mpris2Controller* mpris_bridge;
+ gboolean* use_playlists;
+};
+
+struct _PlayerControllerClass {
+ GObjectClass parent_class;
+};
+
+typedef enum {
+ PLAYER_CONTROLLER_WIDGET_ORDER_SEPARATOR,
+ PLAYER_CONTROLLER_WIDGET_ORDER_METADATA,
+ PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT,
+ PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS
+} PlayerControllerwidget_order;
+
+struct _Mpris2ControllerFetchPlaylistsData {
+ int _state_;
+ GObject* _source_object_;
+ GAsyncResult* _res_;
+ GSimpleAsyncResult* _async_result;
+ Mpris2Controller* self;
+ PlaylistDetails* current_playlists;
+ gint current_playlists_length1;
+ gint _current_playlists_size_;
+ MprisPlaylists* _tmp0_;
+ gint _tmp1_;
+ PlaylistDetails* _tmp2_;
+ PlaylistDetails* _tmp3_;
+ gint _tmp3__length1;
+ gint __tmp3__size_;
+ GError* e;
+ PlaylistDetails* _tmp4_;
+ gint _tmp4__length1;
+ PlayerController* _tmp5_;
+ GeeArrayList* _tmp6_;
+ gpointer _tmp7_;
+ PlaylistsMenuitem* playlists_item;
+ PlaylistsMenuitem* _tmp8_;
+ PlaylistDetails* _tmp9_;
+ gint _tmp9__length1;
+ PlayerController* _tmp10_;
+ gboolean _tmp11_;
+ gboolean* _tmp12_;
+ GError * _inner_error_;
+};
+
+
+static gpointer mpris2_controller_parent_class = NULL;
+
+GType mpris2_controller_get_type (void) G_GNUC_CONST;
+GType mpris_root_proxy_get_type (void) G_GNUC_CONST;
+guint mpris_root_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
+GType mpris_root_get_type (void) G_GNUC_CONST;
+GType mpris_player_proxy_get_type (void) G_GNUC_CONST;
+guint mpris_player_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
+GType mpris_player_get_type (void) G_GNUC_CONST;
+GType mpris_playlists_proxy_get_type (void) G_GNUC_CONST;
+guint mpris_playlists_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
+GType playlist_details_get_type (void) G_GNUC_CONST;
+PlaylistDetails* playlist_details_dup (const PlaylistDetails* self);
+void playlist_details_free (PlaylistDetails* self);
+void playlist_details_copy (const PlaylistDetails* self, PlaylistDetails* dest);
+void playlist_details_destroy (PlaylistDetails* self);
+GType active_playlist_container_get_type (void) G_GNUC_CONST;
+ActivePlaylistContainer* active_playlist_container_dup (const ActivePlaylistContainer* self);
+void active_playlist_container_free (ActivePlaylistContainer* self);
+void active_playlist_container_copy (const ActivePlaylistContainer* self, ActivePlaylistContainer* dest);
+void active_playlist_container_destroy (ActivePlaylistContainer* self);
+GType mpris_playlists_get_type (void) G_GNUC_CONST;
+GType free_desktop_properties_get_type (void) G_GNUC_CONST;
+GType free_desktop_properties_proxy_get_type (void) G_GNUC_CONST;
+guint free_desktop_properties_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
+GType player_controller_get_type (void) G_GNUC_CONST;
+#define MPRIS2_CONTROLLER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_MPRIS2_CONTROLLER, Mpris2ControllerPrivate))
+enum {
+ MPRIS2_CONTROLLER_DUMMY_PROPERTY,
+ MPRIS2_CONTROLLER_MPRIS2_ROOT,
+ MPRIS2_CONTROLLER_PLAYER,
+ MPRIS2_CONTROLLER_PLAYLISTS,
+ MPRIS2_CONTROLLER_PROPERTIES_INTERFACE,
+ MPRIS2_CONTROLLER_OWNER
+};
+#define MPRIS2_CONTROLLER_MAX_PLAYLIST_COUNT 100
+Mpris2Controller* mpris2_controller_new (PlayerController* ctrl);
+Mpris2Controller* mpris2_controller_construct (GType object_type, PlayerController* ctrl);
+void mpris2_controller_property_changed_cb (Mpris2Controller* self, const gchar* interface_source, GHashTable* changed_properties, gchar** invalid, int invalid_length1);
+#define MPRIS_PREFIX "org.mpris.MediaPlayer2."
+MprisPlayer* mpris2_controller_get_player (Mpris2Controller* self);
+gchar* mpris_player_get_PlaybackStatus (MprisPlayer* self);
+static gboolean mpris2_controller_ensure_correct_playback_status (Mpris2Controller* self);
+static gboolean _mpris2_controller_ensure_correct_playback_status_gsource_func (gpointer self);
+static TransportState mpris2_controller_determine_play_state (Mpris2Controller* self, const gchar* status);
+PlayerController* mpris2_controller_get_owner (Mpris2Controller* self);
+GType player_item_get_type (void) G_GNUC_CONST;
+GType player_controller_widget_order_get_type (void) G_GNUC_CONST;
+GType transport_menuitem_get_type (void) G_GNUC_CONST;
+void transport_menuitem_change_play_state (TransportMenuitem* self, TransportState update);
+static gboolean mpris2_controller_ensure_correct_metadata (Mpris2Controller* self);
+static gboolean _mpris2_controller_ensure_correct_metadata_gsource_func (gpointer self);
+static gboolean _bool_equal (const gboolean* s1, const gboolean* s2);
+static gboolean mpris2_controller_fetch_active_playlist (Mpris2Controller* self);
+static gboolean _mpris2_controller_fetch_active_playlist_gsource_func (gpointer self);
+void mpris2_controller_fetch_playlists (Mpris2Controller* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+void mpris2_controller_fetch_playlists_finish (Mpris2Controller* self, GAsyncResult* _res_);
+GType metadata_menuitem_get_type (void) G_GNUC_CONST;
+void metadata_menuitem_alter_label (MetadataMenuitem* self, const gchar* new_title);
+MprisRoot* mpris2_controller_get_mpris2_root (Mpris2Controller* self);
+gchar* mpris_root_get_Identity (MprisRoot* self);
+static GHashTable* mpris2_controller_clean_metadata (Mpris2Controller* self);
+void player_item_reset (PlayerItem* self, GeeHashSet* attrs);
+GeeHashSet* metadata_menuitem_relevant_attributes_for_ui (void);
+void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attributes);
+gboolean player_item_populated (PlayerItem* self, GeeHashSet* attrs);
+void metadata_menuitem_should_collapse (MetadataMenuitem* self, gboolean collapse);
+GHashTable* mpris_player_get_Metadata (MprisPlayer* self);
+static GVariant* _variant_new1 (const gchar* value);
+void mpris2_controller_initial_update (Mpris2Controller* self);
+GeeHashSet* metadata_menuitem_attributes_format (void);
+void mpris2_controller_transport_update (Mpris2Controller* self, TransportAction command);
+void mpris_player_PlayPause (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+void mpris_player_PlayPause_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+void mpris_player_Previous (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+void mpris_player_Previous_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+void mpris_player_Next (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+void mpris_player_Next_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+void mpris_player_Seek (MprisPlayer* self, gint64 offset, GAsyncReadyCallback _callback_, gpointer _user_data_);
+void mpris_player_Seek_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+gboolean mpris2_controller_connected (Mpris2Controller* self);
+void mpris2_controller_expose (Mpris2Controller* self);
+void mpris_root_Raise (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+void mpris_root_Raise_finish (MprisRoot* self, GAsyncResult* _res_, GError** error);
+static void mpris2_controller_on_playlistdetails_changed (Mpris2Controller* self, PlaylistDetails* details);
+GType playlists_menuitem_get_type (void) G_GNUC_CONST;
+void playlists_menuitem_update_individual_playlist (PlaylistsMenuitem* self, PlaylistDetails* new_detail);
+static void mpris2_controller_fetch_playlists_data_free (gpointer _data);
+static gboolean mpris2_controller_fetch_playlists_co (Mpris2ControllerFetchPlaylistsData* _data_);
+MprisPlaylists* mpris2_controller_get_playlists (Mpris2Controller* self);
+void mpris_playlists_GetPlaylists (MprisPlaylists* self, guint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, GAsyncReadyCallback _callback_, gpointer _user_data_);
+PlaylistDetails* mpris_playlists_GetPlaylists_finish (MprisPlaylists* self, GAsyncResult* _res_, int* result_length1, GError** error);
+static void mpris2_controller_fetch_playlists_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
+static void _vala_PlaylistDetails_array_free (PlaylistDetails* array, gint array_length);
+void playlists_menuitem_update (PlaylistsMenuitem* self, PlaylistDetails* playlists, int playlists_length1);
+static gboolean* _bool_dup (gboolean* self);
+void mpris_playlists_get_ActivePlaylist (MprisPlaylists* self, ActivePlaylistContainer* result);
+void playlists_menuitem_active_playlist_update (PlaylistsMenuitem* self, PlaylistDetails* detail);
+void mpris2_controller_activate_playlist (Mpris2Controller* self, const char* path);
+void mpris_playlists_ActivatePlaylist (MprisPlaylists* self, const char* playlist_id, GAsyncReadyCallback _callback_, gpointer _user_data_);
+void mpris_playlists_ActivatePlaylist_finish (MprisPlaylists* self, GAsyncResult* _res_, GError** error);
+static void mpris2_controller_set_mpris2_root (Mpris2Controller* self, MprisRoot* value);
+static void mpris2_controller_set_player (Mpris2Controller* self, MprisPlayer* value);
+static void mpris2_controller_set_playlists (Mpris2Controller* self, MprisPlaylists* value);
+FreeDesktopProperties* mpris2_controller_get_properties_interface (Mpris2Controller* self);
+static void mpris2_controller_set_properties_interface (Mpris2Controller* self, FreeDesktopProperties* value);
+static void mpris2_controller_set_owner (Mpris2Controller* self, PlayerController* value);
+static GObject * mpris2_controller_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
+const gchar* player_controller_get_dbus_name (PlayerController* self);
+static void _mpris2_controller_property_changed_cb_free_desktop_properties_properties_changed (FreeDesktopProperties* _sender, const gchar* source, GHashTable* changed_properties, gchar** invalid, int invalid_length1, gpointer self);
+static void _mpris2_controller_on_playlistdetails_changed_mpris_playlists_playlist_changed (MprisPlaylists* _sender, PlaylistDetails* details, gpointer self);
+static void mpris2_controller_finalize (GObject* obj);
+static void _vala_mpris2_controller_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
+static void _vala_mpris2_controller_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
+static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
+
+
+Mpris2Controller* mpris2_controller_construct (GType object_type, PlayerController* ctrl) {
+ Mpris2Controller * self = NULL;
+ PlayerController* _tmp0_;
+ g_return_val_if_fail (ctrl != NULL, NULL);
+ _tmp0_ = ctrl;
+ self = (Mpris2Controller*) g_object_new (object_type, "owner", _tmp0_, NULL);
+ return self;
+}
+
+
+Mpris2Controller* mpris2_controller_new (PlayerController* ctrl) {
+ return mpris2_controller_construct (TYPE_MPRIS2_CONTROLLER, ctrl);
+}
+
+
+static gpointer _g_variant_ref0 (gpointer self) {
+ return self ? g_variant_ref (self) : NULL;
+}
+
+
+static gboolean _mpris2_controller_ensure_correct_playback_status_gsource_func (gpointer self) {
+ gboolean result;
+ result = mpris2_controller_ensure_correct_playback_status (self);
+ return result;
+}
+
+
+static gboolean _mpris2_controller_ensure_correct_metadata_gsource_func (gpointer self) {
+ gboolean result;
+ result = mpris2_controller_ensure_correct_metadata (self);
+ return result;
+}
+
+
+static gboolean _bool_equal (const gboolean* s1, const gboolean* s2) {
+ if (s1 == s2) {
+ return TRUE;
+ }
+ if (s1 == NULL) {
+ return FALSE;
+ }
+ if (s2 == NULL) {
+ return FALSE;
+ }
+ return (*s1) == (*s2);
+}
+
+
+static gboolean _mpris2_controller_fetch_active_playlist_gsource_func (gpointer self) {
+ gboolean result;
+ result = mpris2_controller_fetch_active_playlist (self);
+ return result;
+}
+
+
+void mpris2_controller_property_changed_cb (Mpris2Controller* self, const gchar* interface_source, GHashTable* changed_properties, gchar** invalid, int invalid_length1) {
+ gboolean _tmp0_ = FALSE;
+ GHashTable* _tmp1_;
+ gboolean _tmp4_;
+ GHashTable* _tmp5_;
+ gconstpointer _tmp6_ = NULL;
+ GVariant* _tmp7_;
+ GVariant* play_v;
+ GVariant* _tmp8_;
+ GHashTable* _tmp19_;
+ gconstpointer _tmp20_ = NULL;
+ GVariant* _tmp21_;
+ GVariant* meta_v;
+ GVariant* _tmp22_;
+ GHashTable* _tmp23_;
+ gconstpointer _tmp24_ = NULL;
+ GVariant* _tmp25_;
+ GVariant* playlist_v;
+ gboolean _tmp26_ = FALSE;
+ GVariant* _tmp27_;
+ gboolean _tmp31_;
+ GHashTable* _tmp32_;
+ gconstpointer _tmp33_ = NULL;
+ GVariant* _tmp34_;
+ GVariant* playlist_count_v;
+ gboolean _tmp35_ = FALSE;
+ GVariant* _tmp36_;
+ gboolean _tmp40_;
+ GHashTable* _tmp41_;
+ gconstpointer _tmp42_ = NULL;
+ GVariant* _tmp43_;
+ GVariant* playlist_orderings_v;
+ gboolean _tmp44_ = FALSE;
+ GVariant* _tmp45_;
+ gboolean _tmp49_;
+ GHashTable* _tmp50_;
+ gconstpointer _tmp51_ = NULL;
+ GVariant* _tmp52_;
+ GVariant* identity_v;
+ GVariant* _tmp53_;
+ g_return_if_fail (self != NULL);
+ g_return_if_fail (interface_source != NULL);
+ g_return_if_fail (changed_properties != NULL);
+ _tmp1_ = changed_properties;
+ if (_tmp1_ == NULL) {
+ _tmp0_ = TRUE;
+ } else {
+ const gchar* _tmp2_;
+ gboolean _tmp3_ = FALSE;
+ _tmp2_ = interface_source;
+ _tmp3_ = g_str_has_prefix (_tmp2_, MPRIS_PREFIX);
+ _tmp0_ = _tmp3_ == FALSE;
+ }
+ _tmp4_ = _tmp0_;
+ if (_tmp4_) {
+ g_warning ("mpris2-controller.vala:78: Property-changed hash is null or this is an" \
+" interface that doesn't concern us");
+ return;
+ }
+ _tmp5_ = changed_properties;
+ _tmp6_ = g_hash_table_lookup (_tmp5_, "PlaybackStatus");
+ _tmp7_ = _g_variant_ref0 ((GVariant*) _tmp6_);
+ play_v = _tmp7_;
+ _tmp8_ = play_v;
+ if (_tmp8_ != NULL) {
+ MprisPlayer* _tmp9_;
+ gchar* _tmp10_;
+ gchar* _tmp11_;
+ gchar* state;
+ const gchar* _tmp12_;
+ TransportState _tmp13_ = 0;
+ TransportState p;
+ PlayerController* _tmp14_;
+ GeeArrayList* _tmp15_;
+ gpointer _tmp16_ = NULL;
+ TransportMenuitem* _tmp17_;
+ TransportState _tmp18_;
+ _tmp9_ = self->priv->_player;
+ _tmp10_ = mpris_player_get_PlaybackStatus (_tmp9_);
+ _tmp11_ = _tmp10_;
+ state = _tmp11_;
+ g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 200, _mpris2_controller_ensure_correct_playback_status_gsource_func, g_object_ref (self), g_object_unref);
+ _tmp12_ = state;
+ _tmp13_ = mpris2_controller_determine_play_state (self, _tmp12_);
+ p = (TransportState) _tmp13_;
+ _tmp14_ = self->priv->_owner;
+ _tmp15_ = _tmp14_->custom_items;
+ _tmp16_ = gee_abstract_list_get ((GeeAbstractList*) _tmp15_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT);
+ _tmp17_ = IS_TRANSPORT_MENUITEM ((PlayerItem*) _tmp16_) ? ((TransportMenuitem*) ((PlayerItem*) _tmp16_)) : NULL;
+ _tmp18_ = p;
+ transport_menuitem_change_play_state (_tmp17_, _tmp18_);
+ _g_object_unref0 (_tmp17_);
+ _g_free0 (state);
+ }
+ _tmp19_ = changed_properties;
+ _tmp20_ = g_hash_table_lookup (_tmp19_, "Metadata");
+ _tmp21_ = _g_variant_ref0 ((GVariant*) _tmp20_);
+ meta_v = _tmp21_;
+ _tmp22_ = meta_v;
+ if (_tmp22_ != NULL) {
+ g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 200, _mpris2_controller_ensure_correct_metadata_gsource_func, g_object_ref (self), g_object_unref);
+ }
+ _tmp23_ = changed_properties;
+ _tmp24_ = g_hash_table_lookup (_tmp23_, "ActivePlaylist");
+ _tmp25_ = _g_variant_ref0 ((GVariant*) _tmp24_);
+ playlist_v = _tmp25_;
+ _tmp27_ = playlist_v;
+ if (_tmp27_ != NULL) {
+ PlayerController* _tmp28_;
+ gboolean* _tmp29_;
+ gboolean _tmp30_;
+ _tmp28_ = self->priv->_owner;
+ _tmp29_ = _tmp28_->use_playlists;
+ _tmp30_ = TRUE;
+ _tmp26_ = _bool_equal (_tmp29_, &_tmp30_) == TRUE;
+ } else {
+ _tmp26_ = FALSE;
+ }
+ _tmp31_ = _tmp26_;
+ if (_tmp31_) {
+ g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 300, _mpris2_controller_fetch_active_playlist_gsource_func, g_object_ref (self), g_object_unref);
+ }
+ _tmp32_ = changed_properties;
+ _tmp33_ = g_hash_table_lookup (_tmp32_, "PlaylistCount");
+ _tmp34_ = _g_variant_ref0 ((GVariant*) _tmp33_);
+ playlist_count_v = _tmp34_;
+ _tmp36_ = playlist_count_v;
+ if (_tmp36_ != NULL) {
+ PlayerController* _tmp37_;
+ gboolean* _tmp38_;
+ gboolean _tmp39_;
+ _tmp37_ = self->priv->_owner;
+ _tmp38_ = _tmp37_->use_playlists;
+ _tmp39_ = TRUE;
+ _tmp35_ = _bool_equal (_tmp38_, &_tmp39_) == TRUE;
+ } else {
+ _tmp35_ = FALSE;
+ }
+ _tmp40_ = _tmp35_;
+ if (_tmp40_) {
+ mpris2_controller_fetch_playlists (self, NULL, NULL);
+ mpris2_controller_fetch_active_playlist (self);
+ }
+ _tmp41_ = changed_properties;
+ _tmp42_ = g_hash_table_lookup (_tmp41_, "Orderings");
+ _tmp43_ = _g_variant_ref0 ((GVariant*) _tmp42_);
+ playlist_orderings_v = _tmp43_;
+ _tmp45_ = playlist_orderings_v;
+ if (_tmp45_ != NULL) {
+ PlayerController* _tmp46_;
+ gboolean* _tmp47_;
+ gboolean _tmp48_;
+ _tmp46_ = self->priv->_owner;
+ _tmp47_ = _tmp46_->use_playlists;
+ _tmp48_ = TRUE;
+ _tmp44_ = _bool_equal (_tmp47_, &_tmp48_) == TRUE;
+ } else {
+ _tmp44_ = FALSE;
+ }
+ _tmp49_ = _tmp44_;
+ if (_tmp49_) {
+ mpris2_controller_fetch_playlists (self, NULL, NULL);
+ mpris2_controller_fetch_active_playlist (self);
+ }
+ _tmp50_ = changed_properties;
+ _tmp51_ = g_hash_table_lookup (_tmp50_, "Identity");
+ _tmp52_ = _g_variant_ref0 ((GVariant*) _tmp51_);
+ identity_v = _tmp52_;
+ _tmp53_ = identity_v;
+ if (_tmp53_ != NULL) {
+ PlayerController* _tmp54_;
+ GeeArrayList* _tmp55_;
+ gpointer _tmp56_ = NULL;
+ MetadataMenuitem* md;
+ MetadataMenuitem* _tmp57_;
+ MprisRoot* _tmp58_;
+ gchar* _tmp59_;
+ gchar* _tmp60_;
+ gchar* _tmp61_;
+ _tmp54_ = self->priv->_owner;
+ _tmp55_ = _tmp54_->custom_items;
+ _tmp56_ = gee_abstract_list_get ((GeeAbstractList*) _tmp55_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA);
+ md = IS_METADATA_MENUITEM ((PlayerItem*) _tmp56_) ? ((MetadataMenuitem*) ((PlayerItem*) _tmp56_)) : NULL;
+ _tmp57_ = md;
+ _tmp58_ = self->priv->_mpris2_root;
+ _tmp59_ = mpris_root_get_Identity (_tmp58_);
+ _tmp60_ = _tmp59_;
+ _tmp61_ = _tmp60_;
+ metadata_menuitem_alter_label (_tmp57_, _tmp61_);
+ _g_free0 (_tmp61_);
+ _g_object_unref0 (md);
+ }
+ _g_variant_unref0 (identity_v);
+ _g_variant_unref0 (playlist_orderings_v);
+ _g_variant_unref0 (playlist_count_v);
+ _g_variant_unref0 (playlist_v);
+ _g_variant_unref0 (meta_v);
+ _g_variant_unref0 (play_v);
+}
+
+
+static gboolean mpris2_controller_ensure_correct_metadata (Mpris2Controller* self) {
+ gboolean result = FALSE;
+ GHashTable* _tmp0_ = NULL;
+ GHashTable* changed_updates;
+ PlayerController* _tmp1_;
+ GeeArrayList* _tmp2_;
+ gpointer _tmp3_ = NULL;
+ PlayerItem* metadata;
+ GeeHashSet* _tmp4_ = NULL;
+ GeeHashSet* _tmp5_;
+ GeeHashSet* _tmp6_ = NULL;
+ GeeHashSet* _tmp7_;
+ PlayerController* _tmp8_;
+ GeeArrayList* _tmp9_;
+ gpointer _tmp10_ = NULL;
+ MetadataMenuitem* md;
+ GeeHashSet* _tmp11_ = NULL;
+ GeeHashSet* _tmp12_;
+ gboolean _tmp13_ = FALSE;
+ gboolean _tmp14_;
+ gboolean collapsing;
+ g_return_val_if_fail (self != NULL, FALSE);
+ _tmp0_ = mpris2_controller_clean_metadata (self);
+ changed_updates = _tmp0_;
+ _tmp1_ = self->priv->_owner;
+ _tmp2_ = _tmp1_->custom_items;
+ _tmp3_ = gee_abstract_list_get ((GeeAbstractList*) _tmp2_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA);
+ metadata = (PlayerItem*) _tmp3_;
+ _tmp4_ = metadata_menuitem_relevant_attributes_for_ui ();
+ _tmp5_ = _tmp4_;
+ player_item_reset (metadata, _tmp5_);
+ _g_object_unref0 (_tmp5_);
+ _tmp6_ = metadata_menuitem_relevant_attributes_for_ui ();
+ _tmp7_ = _tmp6_;
+ player_item_update (metadata, changed_updates, _tmp7_);
+ _g_object_unref0 (_tmp7_);
+ _tmp8_ = self->priv->_owner;
+ _tmp9_ = _tmp8_->custom_items;
+ _tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA);
+ md = IS_METADATA_MENUITEM ((PlayerItem*) _tmp10_) ? ((MetadataMenuitem*) ((PlayerItem*) _tmp10_)) : NULL;
+ _tmp11_ = metadata_menuitem_relevant_attributes_for_ui ();
+ _tmp12_ = _tmp11_;
+ _tmp13_ = player_item_populated (metadata, _tmp12_);
+ _tmp14_ = !_tmp13_;
+ _g_object_unref0 (_tmp12_);
+ collapsing = _tmp14_;
+ metadata_menuitem_should_collapse (md, collapsing);
+ result = FALSE;
+ _g_object_unref0 (md);
+ _g_object_unref0 (metadata);
+ _g_hash_table_unref0 (changed_updates);
+ return result;
+}
+
+
+static gboolean mpris2_controller_ensure_correct_playback_status (Mpris2Controller* self) {
+ gboolean result = FALSE;
+ MprisPlayer* _tmp0_;
+ gchar* _tmp1_;
+ gchar* _tmp2_;
+ gchar* _tmp3_;
+ TransportState _tmp4_ = 0;
+ TransportState _tmp5_;
+ TransportState p;
+ PlayerController* _tmp6_;
+ GeeArrayList* _tmp7_;
+ gpointer _tmp8_ = NULL;
+ TransportMenuitem* _tmp9_;
+ g_return_val_if_fail (self != NULL, FALSE);
+ _tmp0_ = self->priv->_player;
+ _tmp1_ = mpris_player_get_PlaybackStatus (_tmp0_);
+ _tmp2_ = _tmp1_;
+ _tmp3_ = _tmp2_;
+ _tmp4_ = mpris2_controller_determine_play_state (self, _tmp3_);
+ _tmp5_ = (TransportState) _tmp4_;
+ _g_free0 (_tmp3_);
+ p = _tmp5_;
+ _tmp6_ = self->priv->_owner;
+ _tmp7_ = _tmp6_->custom_items;
+ _tmp8_ = gee_abstract_list_get ((GeeAbstractList*) _tmp7_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT);
+ _tmp9_ = IS_TRANSPORT_MENUITEM ((PlayerItem*) _tmp8_) ? ((TransportMenuitem*) ((PlayerItem*) _tmp8_)) : NULL;
+ transport_menuitem_change_play_state (_tmp9_, p);
+ _g_object_unref0 (_tmp9_);
+ result = FALSE;
+ return result;
+}
+
+
+static GVariant* _variant_new1 (const gchar* value) {
+ return g_variant_ref_sink (g_variant_new_string (value));
+}
+
+
+static GHashTable* mpris2_controller_clean_metadata (Mpris2Controller* self) {
+ GHashTable* result = NULL;
+ MprisPlayer* _tmp0_;
+ GHashTable* _tmp1_;
+ GHashTable* _tmp2_;
+ GHashTable* changed_updates;
+ MprisPlayer* _tmp3_;
+ GHashTable* _tmp4_;
+ GHashTable* _tmp5_;
+ GHashTable* _tmp6_;
+ gconstpointer _tmp7_ = NULL;
+ GVariant* _tmp8_;
+ GVariant* _tmp9_;
+ GVariant* artist_v;
+ GVariant* _tmp10_;
+ g_return_val_if_fail (self != NULL, NULL);
+ _tmp0_ = self->priv->_player;
+ _tmp1_ = mpris_player_get_Metadata (_tmp0_);
+ _tmp2_ = _tmp1_;
+ changed_updates = _tmp2_;
+ _tmp3_ = self->priv->_player;
+ _tmp4_ = mpris_player_get_Metadata (_tmp3_);
+ _tmp5_ = _tmp4_;
+ _tmp6_ = _tmp5_;
+ _tmp7_ = g_hash_table_lookup (_tmp6_, "xesam:artist");
+ _tmp8_ = _g_variant_ref0 ((GVariant*) _tmp7_);
+ _tmp9_ = _tmp8_;
+ _g_hash_table_unref0 (_tmp6_);
+ artist_v = _tmp9_;
+ _tmp10_ = artist_v;
+ if (_tmp10_ != NULL) {
+ gchar* display_artists = NULL;
+ GVariant* _tmp11_;
+ const gchar* _tmp12_ = NULL;
+ GHashTable* _tmp21_;
+ gchar* _tmp22_;
+ const gchar* _tmp23_;
+ GVariant* _tmp24_;
+ _tmp11_ = artist_v;
+ _tmp12_ = g_variant_get_type_string (_tmp11_);
+ if (g_strcmp0 (_tmp12_, "s") == 0) {
+ GVariant* _tmp13_;
+ const gchar* _tmp14_ = NULL;
+ gchar* _tmp15_;
+ _tmp13_ = artist_v;
+ _tmp14_ = g_variant_get_string (_tmp13_, NULL);
+ _tmp15_ = g_strdup (_tmp14_);
+ _g_free0 (display_artists);
+ display_artists = _tmp15_;
+ } else {
+ GVariant* _tmp16_;
+ size_t _tmp17_;
+ gchar** _tmp18_ = NULL;
+ gchar** artists;
+ gint artists_length1;
+ gint _artists_size_;
+ gchar** _tmp19_;
+ gint _tmp19__length1;
+ gchar* _tmp20_ = NULL;
+ _tmp16_ = artist_v;
+ _tmp18_ = g_variant_dup_strv (_tmp16_, &_tmp17_);
+ artists = _tmp18_;
+ artists_length1 = _tmp17_;
+ _artists_size_ = artists_length1;
+ _tmp19_ = artists;
+ _tmp19__length1 = artists_length1;
+ _tmp20_ = g_strjoinv (", ", _tmp19_);
+ _g_free0 (display_artists);
+ display_artists = _tmp20_;
+ artists = (_vala_array_free (artists, artists_length1, (GDestroyNotify) g_free), NULL);
+ }
+ _tmp21_ = changed_updates;
+ _tmp22_ = g_strdup ("xesam:artist");
+ _tmp23_ = display_artists;
+ _tmp24_ = _variant_new1 (_tmp23_);
+ g_hash_table_replace (_tmp21_, _tmp22_, _tmp24_);
+ _g_free0 (display_artists);
+ }
+ result = changed_updates;
+ _g_variant_unref0 (artist_v);
+ return result;
+}
+
+
+static TransportState mpris2_controller_determine_play_state (Mpris2Controller* self, const gchar* status) {
+ TransportState result = 0;
+ gboolean _tmp0_ = FALSE;
+ const gchar* _tmp1_;
+ gboolean _tmp3_;
+ g_return_val_if_fail (self != NULL, 0);
+ _tmp1_ = status;
+ if (_tmp1_ != NULL) {
+ const gchar* _tmp2_;
+ _tmp2_ = status;
+ _tmp0_ = g_strcmp0 (_tmp2_, "Playing") == 0;
+ } else {
+ _tmp0_ = FALSE;
+ }
+ _tmp3_ = _tmp0_;
+ if (_tmp3_) {
+ result = TRANSPORT_STATE_PLAYING;
+ return result;
+ }
+ result = TRANSPORT_STATE_PAUSED;
+ return result;
+}
+
+
+void mpris2_controller_initial_update (Mpris2Controller* self) {
+ TransportState update = 0;
+ MprisPlayer* _tmp0_;
+ gchar* _tmp1_;
+ gchar* _tmp2_;
+ gchar* _tmp3_;
+ gboolean _tmp4_;
+ MprisRoot* _tmp10_;
+ gchar* _tmp11_;
+ gchar* _tmp12_;
+ gchar* _tmp13_;
+ gboolean _tmp14_;
+ PlayerController* _tmp23_;
+ GeeArrayList* _tmp24_;
+ gpointer _tmp25_ = NULL;
+ TransportMenuitem* _tmp26_;
+ TransportState _tmp27_;
+ GHashTable* _tmp28_ = NULL;
+ GHashTable* cleaned_metadata;
+ PlayerController* _tmp29_;
+ GeeArrayList* _tmp30_;
+ gpointer _tmp31_ = NULL;
+ PlayerItem* _tmp32_;
+ GHashTable* _tmp33_;
+ GeeHashSet* _tmp34_ = NULL;
+ GeeHashSet* _tmp35_;
+ PlayerController* _tmp36_;
+ gboolean* _tmp37_;
+ gboolean _tmp38_;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = self->priv->_player;
+ _tmp1_ = mpris_player_get_PlaybackStatus (_tmp0_);
+ _tmp2_ = _tmp1_;
+ _tmp3_ = _tmp2_;
+ _tmp4_ = _tmp3_ == NULL;
+ _g_free0 (_tmp3_);
+ if (_tmp4_) {
+ update = TRANSPORT_STATE_PAUSED;
+ } else {
+ MprisPlayer* _tmp5_;
+ gchar* _tmp6_;
+ gchar* _tmp7_;
+ gchar* _tmp8_;
+ TransportState _tmp9_ = 0;
+ _tmp5_ = self->priv->_player;
+ _tmp6_ = mpris_player_get_PlaybackStatus (_tmp5_);
+ _tmp7_ = _tmp6_;
+ _tmp8_ = _tmp7_;
+ _tmp9_ = mpris2_controller_determine_play_state (self, _tmp8_);
+ update = _tmp9_;
+ _g_free0 (_tmp8_);
+ }
+ _tmp10_ = self->priv->_mpris2_root;
+ _tmp11_ = mpris_root_get_Identity (_tmp10_);
+ _tmp12_ = _tmp11_;
+ _tmp13_ = _tmp12_;
+ _tmp14_ = _tmp13_ != NULL;
+ _g_free0 (_tmp13_);
+ if (_tmp14_) {
+ PlayerController* _tmp15_;
+ GeeArrayList* _tmp16_;
+ gpointer _tmp17_ = NULL;
+ MetadataMenuitem* md;
+ MetadataMenuitem* _tmp18_;
+ MprisRoot* _tmp19_;
+ gchar* _tmp20_;
+ gchar* _tmp21_;
+ gchar* _tmp22_;
+ _tmp15_ = self->priv->_owner;
+ _tmp16_ = _tmp15_->custom_items;
+ _tmp17_ = gee_abstract_list_get ((GeeAbstractList*) _tmp16_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA);
+ md = IS_METADATA_MENUITEM ((PlayerItem*) _tmp17_) ? ((MetadataMenuitem*) ((PlayerItem*) _tmp17_)) : NULL;
+ _tmp18_ = md;
+ _tmp19_ = self->priv->_mpris2_root;
+ _tmp20_ = mpris_root_get_Identity (_tmp19_);
+ _tmp21_ = _tmp20_;
+ _tmp22_ = _tmp21_;
+ metadata_menuitem_alter_label (_tmp18_, _tmp22_);
+ _g_free0 (_tmp22_);
+ _g_object_unref0 (md);
+ }
+ _tmp23_ = self->priv->_owner;
+ _tmp24_ = _tmp23_->custom_items;
+ _tmp25_ = gee_abstract_list_get ((GeeAbstractList*) _tmp24_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT);
+ _tmp26_ = IS_TRANSPORT_MENUITEM ((PlayerItem*) _tmp25_) ? ((TransportMenuitem*) ((PlayerItem*) _tmp25_)) : NULL;
+ _tmp27_ = update;
+ transport_menuitem_change_play_state (_tmp26_, _tmp27_);
+ _g_object_unref0 (_tmp26_);
+ _tmp28_ = mpris2_controller_clean_metadata (self);
+ cleaned_metadata = _tmp28_;
+ _tmp29_ = self->priv->_owner;
+ _tmp30_ = _tmp29_->custom_items;
+ _tmp31_ = gee_abstract_list_get ((GeeAbstractList*) _tmp30_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA);
+ _tmp32_ = (PlayerItem*) _tmp31_;
+ _tmp33_ = cleaned_metadata;
+ _tmp34_ = metadata_menuitem_attributes_format ();
+ _tmp35_ = _tmp34_;
+ player_item_update (_tmp32_, _tmp33_, _tmp35_);
+ _g_object_unref0 (_tmp35_);
+ _g_object_unref0 (_tmp32_);
+ _tmp36_ = self->priv->_owner;
+ _tmp37_ = _tmp36_->use_playlists;
+ _tmp38_ = TRUE;
+ if (_bool_equal (_tmp37_, &_tmp38_) == TRUE) {
+ mpris2_controller_fetch_playlists (self, NULL, NULL);
+ mpris2_controller_fetch_active_playlist (self);
+ }
+ _g_hash_table_unref0 (cleaned_metadata);
+}
+
+
+void mpris2_controller_transport_update (Mpris2Controller* self, TransportAction command) {
+ TransportAction _tmp0_;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = command;
+ if (_tmp0_ == TRANSPORT_ACTION_PLAY_PAUSE) {
+ MprisPlayer* _tmp1_;
+ _tmp1_ = self->priv->_player;
+ mpris_player_PlayPause (_tmp1_, NULL, NULL);
+ } else {
+ TransportAction _tmp2_;
+ _tmp2_ = command;
+ if (_tmp2_ == TRANSPORT_ACTION_PREVIOUS) {
+ MprisPlayer* _tmp3_;
+ _tmp3_ = self->priv->_player;
+ mpris_player_Previous (_tmp3_, NULL, NULL);
+ } else {
+ TransportAction _tmp4_;
+ _tmp4_ = command;
+ if (_tmp4_ == TRANSPORT_ACTION_NEXT) {
+ MprisPlayer* _tmp5_;
+ _tmp5_ = self->priv->_player;
+ mpris_player_Next (_tmp5_, NULL, NULL);
+ } else {
+ TransportAction _tmp6_;
+ _tmp6_ = command;
+ if (_tmp6_ == TRANSPORT_ACTION_REWIND) {
+ MprisPlayer* _tmp7_;
+ _tmp7_ = self->priv->_player;
+ mpris_player_Seek (_tmp7_, (gint64) (-500000), NULL, NULL);
+ } else {
+ TransportAction _tmp8_;
+ _tmp8_ = command;
+ if (_tmp8_ == TRANSPORT_ACTION_FORWIND) {
+ MprisPlayer* _tmp9_;
+ _tmp9_ = self->priv->_player;
+ mpris_player_Seek (_tmp9_, (gint64) 400000, NULL, NULL);
+ }
+ }
+ }
+ }
+ }
+}
+
+
+gboolean mpris2_controller_connected (Mpris2Controller* self) {
+ gboolean result = FALSE;
+ gboolean _tmp0_ = FALSE;
+ MprisPlayer* _tmp1_;
+ gboolean _tmp3_;
+ g_return_val_if_fail (self != NULL, FALSE);
+ _tmp1_ = self->priv->_player;
+ if (_tmp1_ != NULL) {
+ MprisRoot* _tmp2_;
+ _tmp2_ = self->priv->_mpris2_root;
+ _tmp0_ = _tmp2_ != NULL;
+ } else {
+ _tmp0_ = FALSE;
+ }
+ _tmp3_ = _tmp0_;
+ result = _tmp3_;
+ return result;
+}
+
+
+void mpris2_controller_expose (Mpris2Controller* self) {
+ gboolean _tmp0_ = FALSE;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = mpris2_controller_connected (self);
+ if (_tmp0_ == TRUE) {
+ MprisRoot* _tmp1_;
+ _tmp1_ = self->priv->_mpris2_root;
+ mpris_root_Raise (_tmp1_, NULL, NULL);
+ }
+}
+
+
+static void mpris2_controller_on_playlistdetails_changed (Mpris2Controller* self, PlaylistDetails* details) {
+ PlayerController* _tmp0_;
+ GeeArrayList* _tmp1_;
+ gpointer _tmp2_ = NULL;
+ PlaylistsMenuitem* playlists_item;
+ PlaylistDetails _tmp3_;
+ g_return_if_fail (self != NULL);
+ g_return_if_fail (details != NULL);
+ _tmp0_ = self->priv->_owner;
+ _tmp1_ = _tmp0_->custom_items;
+ _tmp2_ = gee_abstract_list_get ((GeeAbstractList*) _tmp1_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS);
+ playlists_item = IS_PLAYLISTS_MENUITEM ((PlayerItem*) _tmp2_) ? ((PlaylistsMenuitem*) ((PlayerItem*) _tmp2_)) : NULL;
+ _tmp3_ = *details;
+ playlists_menuitem_update_individual_playlist (playlists_item, &_tmp3_);
+ _g_object_unref0 (playlists_item);
+}
+
+
+static void mpris2_controller_fetch_playlists_data_free (gpointer _data) {
+ Mpris2ControllerFetchPlaylistsData* _data_;
+ _data_ = _data;
+ _g_object_unref0 (_data_->self);
+ g_slice_free (Mpris2ControllerFetchPlaylistsData, _data_);
+}
+
+
+static gpointer _g_object_ref0 (gpointer self) {
+ return self ? g_object_ref (self) : NULL;
+}
+
+
+void mpris2_controller_fetch_playlists (Mpris2Controller* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
+ Mpris2ControllerFetchPlaylistsData* _data_;
+ Mpris2Controller* _tmp0_;
+ _data_ = g_slice_new0 (Mpris2ControllerFetchPlaylistsData);
+ _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, mpris2_controller_fetch_playlists);
+ g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, mpris2_controller_fetch_playlists_data_free);
+ _tmp0_ = _g_object_ref0 (self);
+ _data_->self = _tmp0_;
+ mpris2_controller_fetch_playlists_co (_data_);
+}
+
+
+void mpris2_controller_fetch_playlists_finish (Mpris2Controller* self, GAsyncResult* _res_) {
+ Mpris2ControllerFetchPlaylistsData* _data_;
+ _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
+}
+
+
+static void mpris2_controller_fetch_playlists_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
+ Mpris2ControllerFetchPlaylistsData* _data_;
+ _data_ = _user_data_;
+ _data_->_source_object_ = source_object;
+ _data_->_res_ = _res_;
+ mpris2_controller_fetch_playlists_co (_data_);
+}
+
+
+static void _vala_PlaylistDetails_array_free (PlaylistDetails* array, gint array_length) {
+ if (array != NULL) {
+ int i;
+ for (i = 0; i < array_length; i = i + 1) {
+ playlist_details_destroy (&array[i]);
+ }
+ }
+ g_free (array);
+}
+
+
+static gboolean* _bool_dup (gboolean* self) {
+ gboolean* dup;
+ dup = g_new0 (gboolean, 1);
+ memcpy (dup, self, sizeof (gboolean));
+ return dup;
+}
+
+
+static gpointer __bool_dup0 (gpointer self) {
+ return self ? _bool_dup (self) : NULL;
+}
+
+
+static gboolean mpris2_controller_fetch_playlists_co (Mpris2ControllerFetchPlaylistsData* _data_) {
+ switch (_data_->_state_) {
+ case 0:
+ goto _state_0;
+ case 1:
+ goto _state_1;
+ default:
+ g_assert_not_reached ();
+ }
+ _state_0:
+ _data_->current_playlists = NULL;
+ _data_->current_playlists_length1 = 0;
+ _data_->_current_playlists_size_ = _data_->current_playlists_length1;
+ {
+ _data_->_tmp0_ = _data_->self->priv->_playlists;
+ _data_->_tmp1_ = 0;
+ _data_->_state_ = 1;
+ mpris_playlists_GetPlaylists (_data_->_tmp0_, (guint32) 0, (guint32) MPRIS2_CONTROLLER_MAX_PLAYLIST_COUNT, "Alphabetical", FALSE, mpris2_controller_fetch_playlists_ready, _data_);
+ return FALSE;
+ _state_1:
+ _data_->_tmp2_ = NULL;
+ _data_->_tmp2_ = mpris_playlists_GetPlaylists_finish (_data_->_tmp0_, _data_->_res_, &_data_->_tmp1_, &_data_->_inner_error_);
+ _data_->_tmp3_ = _data_->_tmp2_;
+ _data_->_tmp3__length1 = _data_->_tmp1_;
+ _data_->__tmp3__size_ = _data_->_tmp3__length1;
+ if (_data_->_inner_error_ != NULL) {
+ if (_data_->_inner_error_->domain == G_IO_ERROR) {
+ goto __catch12_g_io_error;
+ }
+ _data_->current_playlists = (_vala_PlaylistDetails_array_free (_data_->current_playlists, _data_->current_playlists_length1), NULL);
+ g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
+ g_clear_error (&_data_->_inner_error_);
+ return FALSE;
+ }
+ _data_->current_playlists = (_vala_PlaylistDetails_array_free (_data_->current_playlists, _data_->current_playlists_length1), NULL);
+ _data_->current_playlists = _data_->_tmp3_;
+ _data_->current_playlists_length1 = _data_->_tmp3__length1;
+ _data_->_current_playlists_size_ = _data_->current_playlists_length1;
+ }
+ goto __finally12;
+ __catch12_g_io_error:
+ {
+ _data_->e = _data_->_inner_error_;
+ _data_->_inner_error_ = NULL;
+ _g_error_free0 (_data_->e);
+ _data_->current_playlists = (_vala_PlaylistDetails_array_free (_data_->current_playlists, _data_->current_playlists_length1), NULL);
+ if (_data_->_state_ == 0) {
+ g_simple_async_result_complete_in_idle (_data_->_async_result);
+ } else {
+ g_simple_async_result_complete (_data_->_async_result);
+ }
+ g_object_unref (_data_->_async_result);
+ return FALSE;
+ }
+ __finally12:
+ if (_data_->_inner_error_ != NULL) {
+ _data_->current_playlists = (_vala_PlaylistDetails_array_free (_data_->current_playlists, _data_->current_playlists_length1), NULL);
+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
+ g_clear_error (&_data_->_inner_error_);
+ return FALSE;
+ }
+ _data_->_tmp4_ = _data_->current_playlists;
+ _data_->_tmp4__length1 = _data_->current_playlists_length1;
+ if (_data_->_tmp4_ != NULL) {
+ _data_->_tmp5_ = _data_->self->priv->_owner;
+ _data_->_tmp6_ = _data_->_tmp5_->custom_items;
+ _data_->_tmp7_ = NULL;
+ _data_->_tmp7_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp6_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS);
+ _data_->playlists_item = IS_PLAYLISTS_MENUITEM ((PlayerItem*) _data_->_tmp7_) ? ((PlaylistsMenuitem*) ((PlayerItem*) _data_->_tmp7_)) : NULL;
+ _data_->_tmp8_ = _data_->playlists_item;
+ _data_->_tmp9_ = _data_->current_playlists;
+ _data_->_tmp9__length1 = _data_->current_playlists_length1;
+ playlists_menuitem_update (_data_->_tmp8_, _data_->_tmp9_, _data_->_tmp9__length1);
+ _g_object_unref0 (_data_->playlists_item);
+ } else {
+ g_warning ("mpris2-controller.vala:243: Playlists are on but its returning no cur" \
+"rent_playlists");
+ _data_->_tmp10_ = _data_->self->priv->_owner;
+ _data_->_tmp11_ = FALSE;
+ _data_->_tmp12_ = __bool_dup0 (&_data_->_tmp11_);
+ _g_free0 (_data_->_tmp10_->use_playlists);
+ _data_->_tmp10_->use_playlists = _data_->_tmp12_;
+ }
+ _data_->current_playlists = (_vala_PlaylistDetails_array_free (_data_->current_playlists, _data_->current_playlists_length1), NULL);
+ if (_data_->_state_ == 0) {
+ g_simple_async_result_complete_in_idle (_data_->_async_result);
+ } else {
+ g_simple_async_result_complete (_data_->_async_result);
+ }
+ g_object_unref (_data_->_async_result);
+ return FALSE;
+}
+
+
+static gboolean mpris2_controller_fetch_active_playlist (Mpris2Controller* self) {
+ gboolean result = FALSE;
+ MprisPlaylists* _tmp0_;
+ ActivePlaylistContainer _tmp1_;
+ ActivePlaylistContainer _tmp2_;
+ ActivePlaylistContainer _tmp3_;
+ gboolean _tmp4_;
+ gboolean _tmp5_;
+ PlayerController* _tmp6_;
+ GeeArrayList* _tmp7_;
+ gpointer _tmp8_ = NULL;
+ PlaylistsMenuitem* playlists_item;
+ PlaylistsMenuitem* _tmp9_;
+ MprisPlaylists* _tmp10_;
+ ActivePlaylistContainer _tmp11_;
+ ActivePlaylistContainer _tmp12_;
+ ActivePlaylistContainer _tmp13_;
+ PlaylistDetails* _tmp14_;
+ PlaylistDetails _tmp15_;
+ g_return_val_if_fail (self != NULL, FALSE);
+ _tmp0_ = self->priv->_playlists;
+ mpris_playlists_get_ActivePlaylist (_tmp0_, &_tmp1_);
+ _tmp2_ = _tmp1_;
+ _tmp3_ = _tmp2_;
+ _tmp4_ = _tmp3_.valid;
+ _tmp5_ = _tmp4_ == FALSE;
+ active_playlist_container_destroy (&_tmp3_);
+ if (_tmp5_) {
+ result = FALSE;
+ return result;
+ }
+ _tmp6_ = self->priv->_owner;
+ _tmp7_ = _tmp6_->custom_items;
+ _tmp8_ = gee_abstract_list_get ((GeeAbstractList*) _tmp7_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS);
+ playlists_item = IS_PLAYLISTS_MENUITEM ((PlayerItem*) _tmp8_) ? ((PlaylistsMenuitem*) ((PlayerItem*) _tmp8_)) : NULL;
+ _tmp9_ = playlists_item;
+ _tmp10_ = self->priv->_playlists;
+ mpris_playlists_get_ActivePlaylist (_tmp10_, &_tmp11_);
+ _tmp12_ = _tmp11_;
+ _tmp13_ = _tmp12_;
+ _tmp14_ = _tmp13_.details;
+ _tmp15_ = *_tmp14_;
+ playlists_menuitem_active_playlist_update (_tmp9_, &_tmp15_);
+ active_playlist_container_destroy (&_tmp13_);
+ result = FALSE;
+ _g_object_unref0 (playlists_item);
+ return result;
+}
+
+
+void mpris2_controller_activate_playlist (Mpris2Controller* self, const char* path) {
+ GError * _inner_error_ = NULL;
+ g_return_if_fail (self != NULL);
+ g_return_if_fail (path != NULL);
+ {
+ MprisPlaylists* _tmp0_;
+ const char* _tmp1_;
+ _tmp0_ = self->priv->_playlists;
+ _tmp1_ = path;
+ mpris_playlists_ActivatePlaylist (_tmp0_, _tmp1_, NULL, NULL);
+ }
+ goto __finally13;
+ __catch13_g_io_error:
+ {
+ GError* e = NULL;
+ const char* _tmp2_;
+ GError* _tmp3_;
+ const gchar* _tmp4_;
+ e = _inner_error_;
+ _inner_error_ = NULL;
+ _tmp2_ = path;
+ _tmp3_ = e;
+ _tmp4_ = _tmp3_->message;
+ g_warning ("mpris2-controller.vala:264: Could not activate playlist %s because %s", (const gchar*) _tmp2_, _tmp4_);
+ _g_error_free0 (e);
+ }
+ __finally13:
+ if (_inner_error_ != NULL) {
+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
+ g_clear_error (&_inner_error_);
+ return;
+ }
+}
+
+
+MprisRoot* mpris2_controller_get_mpris2_root (Mpris2Controller* self) {
+ MprisRoot* result;
+ MprisRoot* _tmp0_;
+ g_return_val_if_fail (self != NULL, NULL);
+ _tmp0_ = self->priv->_mpris2_root;
+ result = _tmp0_;
+ return result;
+}
+
+
+static void mpris2_controller_set_mpris2_root (Mpris2Controller* self, MprisRoot* value) {
+ MprisRoot* _tmp0_;
+ MprisRoot* _tmp1_;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = value;
+ _tmp1_ = _g_object_ref0 (_tmp0_);
+ _g_object_unref0 (self->priv->_mpris2_root);
+ self->priv->_mpris2_root = _tmp1_;
+ g_object_notify ((GObject *) self, "mpris2-root");
+}
+
+
+MprisPlayer* mpris2_controller_get_player (Mpris2Controller* self) {
+ MprisPlayer* result;
+ MprisPlayer* _tmp0_;
+ g_return_val_if_fail (self != NULL, NULL);
+ _tmp0_ = self->priv->_player;
+ result = _tmp0_;
+ return result;
+}
+
+
+static void mpris2_controller_set_player (Mpris2Controller* self, MprisPlayer* value) {
+ MprisPlayer* _tmp0_;
+ MprisPlayer* _tmp1_;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = value;
+ _tmp1_ = _g_object_ref0 (_tmp0_);
+ _g_object_unref0 (self->priv->_player);
+ self->priv->_player = _tmp1_;
+ g_object_notify ((GObject *) self, "player");
+}
+
+
+MprisPlaylists* mpris2_controller_get_playlists (Mpris2Controller* self) {
+ MprisPlaylists* result;
+ MprisPlaylists* _tmp0_;
+ g_return_val_if_fail (self != NULL, NULL);
+ _tmp0_ = self->priv->_playlists;
+ result = _tmp0_;
+ return result;
+}
+
+
+static void mpris2_controller_set_playlists (Mpris2Controller* self, MprisPlaylists* value) {
+ MprisPlaylists* _tmp0_;
+ MprisPlaylists* _tmp1_;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = value;
+ _tmp1_ = _g_object_ref0 (_tmp0_);
+ _g_object_unref0 (self->priv->_playlists);
+ self->priv->_playlists = _tmp1_;
+ g_object_notify ((GObject *) self, "playlists");
+}
+
+
+FreeDesktopProperties* mpris2_controller_get_properties_interface (Mpris2Controller* self) {
+ FreeDesktopProperties* result;
+ FreeDesktopProperties* _tmp0_;
+ g_return_val_if_fail (self != NULL, NULL);
+ _tmp0_ = self->priv->_properties_interface;
+ result = _tmp0_;
+ return result;
+}
+
+
+static void mpris2_controller_set_properties_interface (Mpris2Controller* self, FreeDesktopProperties* value) {
+ FreeDesktopProperties* _tmp0_;
+ FreeDesktopProperties* _tmp1_;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = value;
+ _tmp1_ = _g_object_ref0 (_tmp0_);
+ _g_object_unref0 (self->priv->_properties_interface);
+ self->priv->_properties_interface = _tmp1_;
+ g_object_notify ((GObject *) self, "properties-interface");
+}
+
+
+PlayerController* mpris2_controller_get_owner (Mpris2Controller* self) {
+ PlayerController* result;
+ PlayerController* _tmp0_;
+ g_return_val_if_fail (self != NULL, NULL);
+ _tmp0_ = self->priv->_owner;
+ result = _tmp0_;
+ return result;
+}
+
+
+static void mpris2_controller_set_owner (Mpris2Controller* self, PlayerController* value) {
+ PlayerController* _tmp0_;
+ PlayerController* _tmp1_;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = value;
+ _tmp1_ = _g_object_ref0 (_tmp0_);
+ _g_object_unref0 (self->priv->_owner);
+ self->priv->_owner = _tmp1_;
+ g_object_notify ((GObject *) self, "owner");
+}
+
+
+static void _mpris2_controller_property_changed_cb_free_desktop_properties_properties_changed (FreeDesktopProperties* _sender, const gchar* source, GHashTable* changed_properties, gchar** invalid, int invalid_length1, gpointer self) {
+ mpris2_controller_property_changed_cb (self, source, changed_properties, invalid, invalid_length1);
+}
+
+
+static void _mpris2_controller_on_playlistdetails_changed_mpris_playlists_playlist_changed (MprisPlaylists* _sender, PlaylistDetails* details, gpointer self) {
+ mpris2_controller_on_playlistdetails_changed (self, details);
+}
+
+
+static GObject * mpris2_controller_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
+ GObject * obj;
+ GObjectClass * parent_class;
+ Mpris2Controller * self;
+ GError * _inner_error_ = NULL;
+ parent_class = G_OBJECT_CLASS (mpris2_controller_parent_class);
+ obj = parent_class->constructor (type, n_construct_properties, construct_properties);
+ self = MPRIS2_CONTROLLER (obj);
+ {
+ PlayerController* _tmp0_;
+ const gchar* _tmp1_;
+ const gchar* _tmp2_;
+ MprisRoot* _tmp3_ = NULL;
+ MprisRoot* _tmp4_;
+ MprisRoot* _tmp5_;
+ PlayerController* _tmp6_;
+ const gchar* _tmp7_;
+ const gchar* _tmp8_;
+ MprisPlayer* _tmp9_ = NULL;
+ MprisPlayer* _tmp10_;
+ MprisPlayer* _tmp11_;
+ FreeDesktopProperties* _tmp12_ = NULL;
+ FreeDesktopProperties* _tmp13_;
+ FreeDesktopProperties* _tmp14_;
+ FreeDesktopProperties* _tmp15_;
+ PlayerController* _tmp16_;
+ gboolean* _tmp17_;
+ gboolean _tmp18_;
+ _tmp0_ = self->priv->_owner;
+ _tmp1_ = player_controller_get_dbus_name (_tmp0_);
+ _tmp2_ = _tmp1_;
+ _tmp3_ = g_initable_new (TYPE_MPRIS_ROOT_PROXY, NULL, &_inner_error_, "g-flags", 0, "g-name", _tmp2_, "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/mpris/MediaPlayer2", "g-interface-name", "org.mpris.MediaPlayer2", NULL);
+ _tmp4_ = (MprisRoot*) _tmp3_;
+ if (_inner_error_ != NULL) {
+ if (_inner_error_->domain == G_IO_ERROR) {
+ goto __catch14_g_io_error;
+ }
+ g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
+ g_clear_error (&_inner_error_);
+ }
+ _tmp5_ = _tmp4_;
+ mpris2_controller_set_mpris2_root (self, _tmp5_);
+ _g_object_unref0 (_tmp5_);
+ _tmp6_ = self->priv->_owner;
+ _tmp7_ = player_controller_get_dbus_name (_tmp6_);
+ _tmp8_ = _tmp7_;
+ _tmp9_ = g_initable_new (TYPE_MPRIS_PLAYER_PROXY, NULL, &_inner_error_, "g-flags", 0, "g-name", _tmp8_, "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/mpris/MediaPlayer2", "g-interface-name", "org.mpris.MediaPlayer2.Player", NULL);
+ _tmp10_ = (MprisPlayer*) _tmp9_;
+ if (_inner_error_ != NULL) {
+ if (_inner_error_->domain == G_IO_ERROR) {
+ goto __catch14_g_io_error;
+ }
+ g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
+ g_clear_error (&_inner_error_);
+ }
+ _tmp11_ = _tmp10_;
+ mpris2_controller_set_player (self, _tmp11_);
+ _g_object_unref0 (_tmp11_);
+ _tmp12_ = g_initable_new (TYPE_FREE_DESKTOP_PROPERTIES_PROXY, NULL, &_inner_error_, "g-flags", 0, "g-name", "org.freedesktop.Properties.PropertiesChanged", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/mpris/MediaPlayer2", "g-interface-name", "org.freedesktop.DBus.Properties", NULL);
+ _tmp13_ = (FreeDesktopProperties*) _tmp12_;
+ if (_inner_error_ != NULL) {
+ if (_inner_error_->domain == G_IO_ERROR) {
+ goto __catch14_g_io_error;
+ }
+ g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
+ g_clear_error (&_inner_error_);
+ }
+ _tmp14_ = _tmp13_;
+ mpris2_controller_set_properties_interface (self, _tmp14_);
+ _g_object_unref0 (_tmp14_);
+ _tmp15_ = self->priv->_properties_interface;
+ g_signal_connect_object (_tmp15_, "properties-changed", (GCallback) _mpris2_controller_property_changed_cb_free_desktop_properties_properties_changed, self, 0);
+ _tmp16_ = self->priv->_owner;
+ _tmp17_ = _tmp16_->use_playlists;
+ _tmp18_ = TRUE;
+ if (_bool_equal (_tmp17_, &_tmp18_) == TRUE) {
+ PlayerController* _tmp19_;
+ const gchar* _tmp20_;
+ const gchar* _tmp21_;
+ MprisPlaylists* _tmp22_ = NULL;
+ MprisPlaylists* _tmp23_;
+ MprisPlaylists* _tmp24_;
+ MprisPlaylists* _tmp25_;
+ _tmp19_ = self->priv->_owner;
+ _tmp20_ = player_controller_get_dbus_name (_tmp19_);
+ _tmp21_ = _tmp20_;
+ _tmp22_ = g_initable_new (TYPE_MPRIS_PLAYLISTS_PROXY, NULL, &_inner_error_, "g-flags", 0, "g-name", _tmp21_, "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/mpris/MediaPlayer2", "g-interface-name", "org.mpris.MediaPlayer2.Playlists", NULL);
+ _tmp23_ = (MprisPlaylists*) _tmp22_;
+ if (_inner_error_ != NULL) {
+ if (_inner_error_->domain == G_IO_ERROR) {
+ goto __catch14_g_io_error;
+ }
+ g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
+ g_clear_error (&_inner_error_);
+ }
+ _tmp24_ = _tmp23_;
+ mpris2_controller_set_playlists (self, _tmp24_);
+ _g_object_unref0 (_tmp24_);
+ _tmp25_ = self->priv->_playlists;
+ g_signal_connect_object (_tmp25_, "playlist-changed", (GCallback) _mpris2_controller_on_playlistdetails_changed_mpris_playlists_playlist_changed, self, 0);
+ }
+ }
+ goto __finally14;
+ __catch14_g_io_error:
+ {
+ GError* e = NULL;
+ GError* _tmp26_;
+ const gchar* _tmp27_;
+ e = _inner_error_;
+ _inner_error_ = NULL;
+ _tmp26_ = e;
+ _tmp27_ = _tmp26_->message;
+ g_critical ("mpris2-controller.vala:57: Problems connecting to the session bus - %s", _tmp27_);
+ _g_error_free0 (e);
+ }
+ __finally14:
+ if (_inner_error_ != NULL) {
+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
+ g_clear_error (&_inner_error_);
+ }
+ return obj;
+}
+
+
+static void mpris2_controller_class_init (Mpris2ControllerClass * klass) {
+ mpris2_controller_parent_class = g_type_class_peek_parent (klass);
+ g_type_class_add_private (klass, sizeof (Mpris2ControllerPrivate));
+ G_OBJECT_CLASS (klass)->get_property = _vala_mpris2_controller_get_property;
+ G_OBJECT_CLASS (klass)->set_property = _vala_mpris2_controller_set_property;
+ G_OBJECT_CLASS (klass)->constructor = mpris2_controller_constructor;
+ G_OBJECT_CLASS (klass)->finalize = mpris2_controller_finalize;
+ g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS2_CONTROLLER_MPRIS2_ROOT, g_param_spec_object ("mpris2-root", "mpris2-root", "mpris2-root", TYPE_MPRIS_ROOT, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS2_CONTROLLER_PLAYER, g_param_spec_object ("player", "player", "player", TYPE_MPRIS_PLAYER, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS2_CONTROLLER_PLAYLISTS, g_param_spec_object ("playlists", "playlists", "playlists", TYPE_MPRIS_PLAYLISTS, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS2_CONTROLLER_PROPERTIES_INTERFACE, g_param_spec_object ("properties-interface", "properties-interface", "properties-interface", TYPE_FREE_DESKTOP_PROPERTIES, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS2_CONTROLLER_OWNER, g_param_spec_object ("owner", "owner", "owner", TYPE_PLAYER_CONTROLLER, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
+}
+
+
+static void mpris2_controller_instance_init (Mpris2Controller * self) {
+ self->priv = MPRIS2_CONTROLLER_GET_PRIVATE (self);
+}
+
+
+static void mpris2_controller_finalize (GObject* obj) {
+ Mpris2Controller * self;
+ self = MPRIS2_CONTROLLER (obj);
+ _g_object_unref0 (self->priv->_mpris2_root);
+ _g_object_unref0 (self->priv->_player);
+ _g_object_unref0 (self->priv->_playlists);
+ _g_object_unref0 (self->priv->_properties_interface);
+ _g_object_unref0 (self->priv->_owner);
+ G_OBJECT_CLASS (mpris2_controller_parent_class)->finalize (obj);
+}
+
+
+GType mpris2_controller_get_type (void) {
+ static volatile gsize mpris2_controller_type_id__volatile = 0;
+ if (g_once_init_enter (&mpris2_controller_type_id__volatile)) {
+ static const GTypeInfo g_define_type_info = { sizeof (Mpris2ControllerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) mpris2_controller_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Mpris2Controller), 0, (GInstanceInitFunc) mpris2_controller_instance_init, NULL };
+ GType mpris2_controller_type_id;
+ mpris2_controller_type_id = g_type_register_static (G_TYPE_OBJECT, "Mpris2Controller", &g_define_type_info, 0);
+ g_once_init_leave (&mpris2_controller_type_id__volatile, mpris2_controller_type_id);
+ }
+ return mpris2_controller_type_id__volatile;
+}
+
+
+static void _vala_mpris2_controller_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
+ Mpris2Controller * self;
+ self = MPRIS2_CONTROLLER (object);
+ switch (property_id) {
+ case MPRIS2_CONTROLLER_MPRIS2_ROOT:
+ g_value_set_object (value, mpris2_controller_get_mpris2_root (self));
+ break;
+ case MPRIS2_CONTROLLER_PLAYER:
+ g_value_set_object (value, mpris2_controller_get_player (self));
+ break;
+ case MPRIS2_CONTROLLER_PLAYLISTS:
+ g_value_set_object (value, mpris2_controller_get_playlists (self));
+ break;
+ case MPRIS2_CONTROLLER_PROPERTIES_INTERFACE:
+ g_value_set_object (value, mpris2_controller_get_properties_interface (self));
+ break;
+ case MPRIS2_CONTROLLER_OWNER:
+ g_value_set_object (value, mpris2_controller_get_owner (self));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+
+static void _vala_mpris2_controller_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
+ Mpris2Controller * self;
+ self = MPRIS2_CONTROLLER (object);
+ switch (property_id) {
+ case MPRIS2_CONTROLLER_MPRIS2_ROOT:
+ mpris2_controller_set_mpris2_root (self, g_value_get_object (value));
+ break;
+ case MPRIS2_CONTROLLER_PLAYER:
+ mpris2_controller_set_player (self, g_value_get_object (value));
+ break;
+ case MPRIS2_CONTROLLER_PLAYLISTS:
+ mpris2_controller_set_playlists (self, g_value_get_object (value));
+ break;
+ case MPRIS2_CONTROLLER_PROPERTIES_INTERFACE:
+ mpris2_controller_set_properties_interface (self, g_value_get_object (value));
+ break;
+ case MPRIS2_CONTROLLER_OWNER:
+ mpris2_controller_set_owner (self, g_value_get_object (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+
+static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
+ if ((array != NULL) && (destroy_func != NULL)) {
+ int i;
+ for (i = 0; i < array_length; i = i + 1) {
+ if (((gpointer*) array)[i] != NULL) {
+ destroy_func (((gpointer*) array)[i]);
+ }
+ }
+ }
+}
+
+
+static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
+ _vala_array_destroy (array, array_length, destroy_func);
+ g_free (array);
+}
+
+
+
diff --git a/.pc/lp_945827.patch/src/mpris2-controller.vala b/.pc/lp_945827.patch/src/mpris2-controller.vala
new file mode 100644
index 0000000..0fa7b6c
--- /dev/null
+++ b/.pc/lp_945827.patch/src/mpris2-controller.vala
@@ -0,0 +1,267 @@
+/*
+Copyright 2010 Canonical Ltd.
+
+Authors:
+ Conor Curran <conor.curran@canonical.com>
+
+This program is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 3, as published
+by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranties of
+MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+using Dbusmenu;
+using Transport;
+
+public class Mpris2Controller : GLib.Object
+{
+ public const int MAX_PLAYLIST_COUNT = 100;
+
+ public MprisRoot mpris2_root {get; construct;}
+ public MprisPlayer player {get; construct;}
+ public MprisPlaylists playlists {get; construct;}
+ public FreeDesktopProperties properties_interface {get; construct;}
+ public PlayerController owner {get; construct;}
+
+ public Mpris2Controller(PlayerController ctrl)
+ {
+ GLib.Object(owner: ctrl);
+ }
+
+ construct{
+ try {
+ this.mpris2_root = Bus.get_proxy_sync ( BusType.SESSION,
+ this.owner.dbus_name,
+ "/org/mpris/MediaPlayer2" );
+ this.player = Bus.get_proxy_sync ( BusType.SESSION,
+ this.owner.dbus_name,
+ "/org/mpris/MediaPlayer2" );
+ this.properties_interface = Bus.get_proxy_sync ( BusType.SESSION,
+ "org.freedesktop.Properties.PropertiesChanged",
+ "/org/mpris/MediaPlayer2" );
+ this.properties_interface.PropertiesChanged.connect ( property_changed_cb );
+ if ( this.owner.use_playlists == true ){
+ this.playlists = Bus.get_proxy_sync ( BusType.SESSION,
+ this.owner.dbus_name,
+ "/org/mpris/MediaPlayer2" );
+ this.playlists.PlaylistChanged.connect (on_playlistdetails_changed);
+ }
+ }
+ catch (IOError e) {
+ critical("Problems connecting to the session bus - %s", e.message);
+ }
+ }
+ /*
+ * property_changed_cb
+ * Called when a property changed signal is emitted from any of mpris
+ * objects on the bus.
+ * Note that the signal will be received by each instance for each player
+ * and at that moment there is no way to know what player that signal
+ * came from therefore it is necessary to query each relevant property
+ * to update the respective dbusmenuitem property inorder to keep the UI in sync
+ * Please also note due to some race condition in the depths of gdbus
+ * a timeout is needed between receiving the prop update and query the respective property.
+ * This can be seen at various points below.
+ */
+ public void property_changed_cb ( string interface_source,
+ HashTable<string, Variant?> changed_properties,
+ string[] invalid )
+ {
+ if ( changed_properties == null ||
+ interface_source.has_prefix ( MPRIS_PREFIX ) == false ){
+ warning("Property-changed hash is null or this is an interface that doesn't concern us");
+ return;
+ }
+ Variant? play_v = changed_properties.lookup("PlaybackStatus");
+ if(play_v != null){
+ string state = this.player.PlaybackStatus;
+ Timeout.add ( 200, ensure_correct_playback_status );
+ Transport.State p = (Transport.State)this.determine_play_state(state);
+ (this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(p);
+ }
+ Variant? meta_v = changed_properties.lookup("Metadata");
+ if(meta_v != null)
+ {
+ Timeout.add ( 200, ensure_correct_metadata );
+ }
+ Variant? playlist_v = changed_properties.lookup("ActivePlaylist");
+ if ( playlist_v != null && this.owner.use_playlists == true ){
+ Timeout.add (300, this.fetch_active_playlist);
+ }
+ Variant? playlist_count_v = changed_properties.lookup("PlaylistCount");
+ if ( playlist_count_v != null && this.owner.use_playlists == true ){
+ this.fetch_playlists.begin();
+ this.fetch_active_playlist();
+ }
+ Variant? playlist_orderings_v = changed_properties.lookup("Orderings");
+ if ( playlist_orderings_v != null && this.owner.use_playlists == true ){
+ this.fetch_playlists.begin();
+ this.fetch_active_playlist();
+ }
+ Variant? identity_v = changed_properties.lookup("Identity");
+ if (identity_v != null){
+ MetadataMenuitem md = this.owner.custom_items[PlayerController.widget_order.METADATA] as MetadataMenuitem;
+ md.alter_label (this.mpris2_root.Identity);
+ }
+ }
+
+ private bool ensure_correct_metadata ()
+ {
+ GLib.HashTable<string, Variant?> changed_updates = clean_metadata();
+ PlayerItem metadata = this.owner.custom_items[PlayerController.widget_order.METADATA];
+ metadata.reset (MetadataMenuitem.relevant_attributes_for_ui());
+ metadata.update ( changed_updates,
+ MetadataMenuitem.relevant_attributes_for_ui());
+ MetadataMenuitem md = this.owner.custom_items[PlayerController.widget_order.METADATA] as MetadataMenuitem;
+ bool collapsing = !metadata.populated(MetadataMenuitem.relevant_attributes_for_ui());
+ md.should_collapse(collapsing);
+
+ return false;
+ }
+
+ private bool ensure_correct_playback_status()
+ {
+ Transport.State p = (Transport.State)this.determine_play_state(this.player.PlaybackStatus);
+ (this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(p);
+ return false;
+ }
+
+ private GLib.HashTable<string, Variant?>? clean_metadata()
+ {
+ GLib.HashTable<string, Variant?> changed_updates = this.player.Metadata;
+
+ Variant? artist_v = this.player.Metadata.lookup("xesam:artist");
+ if(artist_v != null){
+ string display_artists;
+ // Accomodate Spotify (should return 'as' and not 's')
+ if(artist_v.get_type_string() == "s"){
+ display_artists = artist_v.get_string();
+ }
+ else{
+ string[] artists = artist_v.dup_strv();
+ display_artists = string.joinv(", ", artists);
+ }
+ changed_updates.replace("xesam:artist", display_artists);
+ }
+ return changed_updates;
+ }
+
+ private Transport.State determine_play_state(string? status){
+ if(status != null && status == "Playing"){
+ return Transport.State.PLAYING;
+ }
+ return Transport.State.PAUSED;
+ }
+
+ public void initial_update()
+ {
+ Transport.State update;
+
+ if(this.player.PlaybackStatus == null){
+ update = Transport.State.PAUSED;
+ }
+ else{
+ update = determine_play_state (this.player.PlaybackStatus);
+ }
+ if (this.mpris2_root.Identity != null){
+ MetadataMenuitem md = this.owner.custom_items[PlayerController.widget_order.METADATA] as MetadataMenuitem;
+ md.alter_label (this.mpris2_root.Identity);
+ }
+ (this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state (update);
+ GLib.HashTable<string, Value?>? cleaned_metadata = this.clean_metadata();
+ this.owner.custom_items[PlayerController.widget_order.METADATA].update (cleaned_metadata,
+ MetadataMenuitem.attributes_format());
+
+ if ( this.owner.use_playlists == true ){
+ this.fetch_playlists.begin();
+ this.fetch_active_playlist();
+ }
+ }
+
+ public void transport_update(Transport.Action command)
+ {
+ if(command == Transport.Action.PLAY_PAUSE){
+ this.player.PlayPause.begin();
+ }
+ else if(command == Transport.Action.PREVIOUS){
+ this.player.Previous.begin();
+ }
+ else if(command == Transport.Action.NEXT){
+ this.player.Next.begin();
+ }
+ else if(command == Transport.Action.REWIND){
+ this.player.Seek.begin(-500000);
+ }
+ else if(command == Transport.Action.FORWIND){
+ this.player.Seek.begin(400000);
+ }
+ }
+
+ public bool connected()
+ {
+ return (this.player != null && this.mpris2_root != null);
+ }
+
+ public void expose()
+ {
+ if(this.connected() == true){
+ this.mpris2_root.Raise.begin();
+ }
+ }
+
+ private void on_playlistdetails_changed (PlaylistDetails details)
+ {
+ PlaylistsMenuitem playlists_item = this.owner.custom_items[PlayerController.widget_order.PLAYLISTS] as PlaylistsMenuitem;
+ playlists_item.update_individual_playlist (details);
+ }
+
+ public async void fetch_playlists()
+ {
+ PlaylistDetails[] current_playlists = null;
+
+ try{
+ current_playlists = yield this.playlists.GetPlaylists (0,
+ MAX_PLAYLIST_COUNT,
+ "Alphabetical",
+ false);
+ }
+ catch (IOError e){
+ return;
+ }
+
+ if( current_playlists != null ){
+ PlaylistsMenuitem playlists_item = this.owner.custom_items[PlayerController.widget_order.PLAYLISTS] as PlaylistsMenuitem;
+ playlists_item.update(current_playlists);
+ }
+ else{
+ warning(" Playlists are on but its returning no current_playlists" );
+ this.owner.use_playlists = false;
+ }
+ }
+
+ private bool fetch_active_playlist()
+ {
+ if (this.playlists.ActivePlaylist.valid == false){
+ return false;
+ }
+ PlaylistsMenuitem playlists_item = this.owner.custom_items[PlayerController.widget_order.PLAYLISTS] as PlaylistsMenuitem;
+ playlists_item.active_playlist_update ( this.playlists.ActivePlaylist.details );
+ return false;
+ }
+
+ public void activate_playlist (ObjectPath path)
+ {
+ try{
+ this.playlists.ActivatePlaylist.begin(path);
+ }
+ catch(IOError e){
+ warning ("Could not activate playlist %s because %s", (string)path, e.message);
+ }
+ }
+}
diff --git a/.pc/lp_945827.patch/src/mpris2-interfaces.c b/.pc/lp_945827.patch/src/mpris2-interfaces.c
new file mode 100644
index 0000000..9058f95
--- /dev/null
+++ b/.pc/lp_945827.patch/src/mpris2-interfaces.c
@@ -0,0 +1,2653 @@
+/* mpris2-interfaces.c generated by valac 0.14.2, the Vala compiler
+ * generated from mpris2-interfaces.vala, do not modify */
+
+/*
+Copyright 2010 Canonical Ltd.
+Authors:
+ Conor Curran <conor.curran@canonical.com>
+
+This program is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 3, as published
+by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranties of
+MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <glib.h>
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <gio/gio.h>
+
+
+#define TYPE_MPRIS_ROOT (mpris_root_get_type ())
+#define MPRIS_ROOT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_ROOT, MprisRoot))
+#define IS_MPRIS_ROOT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_ROOT))
+#define MPRIS_ROOT_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_MPRIS_ROOT, MprisRootIface))
+
+typedef struct _MprisRoot MprisRoot;
+typedef struct _MprisRootIface MprisRootIface;
+
+#define TYPE_MPRIS_ROOT_PROXY (mpris_root_proxy_get_type ())
+typedef GDBusProxy MprisRootProxy;
+typedef GDBusProxyClass MprisRootProxyClass;
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+#define TYPE_MPRIS_PLAYER (mpris_player_get_type ())
+#define MPRIS_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_PLAYER, MprisPlayer))
+#define IS_MPRIS_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_PLAYER))
+#define MPRIS_PLAYER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_MPRIS_PLAYER, MprisPlayerIface))
+
+typedef struct _MprisPlayer MprisPlayer;
+typedef struct _MprisPlayerIface MprisPlayerIface;
+
+#define TYPE_MPRIS_PLAYER_PROXY (mpris_player_proxy_get_type ())
+typedef GDBusProxy MprisPlayerProxy;
+typedef GDBusProxyClass MprisPlayerProxyClass;
+#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
+
+#define TYPE_PLAYLIST_DETAILS (playlist_details_get_type ())
+typedef struct _PlaylistDetails PlaylistDetails;
+
+#define TYPE_ACTIVE_PLAYLIST_CONTAINER (active_playlist_container_get_type ())
+typedef struct _ActivePlaylistContainer ActivePlaylistContainer;
+#define _playlist_details_free0(var) ((var == NULL) ? NULL : (var = (playlist_details_free (var), NULL)))
+
+#define TYPE_MPRIS_PLAYLISTS (mpris_playlists_get_type ())
+#define MPRIS_PLAYLISTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_PLAYLISTS, MprisPlaylists))
+#define IS_MPRIS_PLAYLISTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_PLAYLISTS))
+#define MPRIS_PLAYLISTS_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_MPRIS_PLAYLISTS, MprisPlaylistsIface))
+
+typedef struct _MprisPlaylists MprisPlaylists;
+typedef struct _MprisPlaylistsIface MprisPlaylistsIface;
+
+#define TYPE_MPRIS_PLAYLISTS_PROXY (mpris_playlists_proxy_get_type ())
+typedef GDBusProxy MprisPlaylistsProxy;
+typedef GDBusProxyClass MprisPlaylistsProxyClass;
+
+struct _MprisRootIface {
+ GTypeInterface parent_iface;
+ void (*Quit) (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+ void (*Quit_finish) (MprisRoot* self, GAsyncResult* _res_, GError** error);
+ void (*Raise) (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+ void (*Raise_finish) (MprisRoot* self, GAsyncResult* _res_, GError** error);
+ gboolean (*get_HasTracklist) (MprisRoot* self);
+ void (*set_HasTracklist) (MprisRoot* self, gboolean value);
+ gboolean (*get_CanQuit) (MprisRoot* self);
+ void (*set_CanQuit) (MprisRoot* self, gboolean value);
+ gboolean (*get_CanRaise) (MprisRoot* self);
+ void (*set_CanRaise) (MprisRoot* self, gboolean value);
+ gchar* (*get_Identity) (MprisRoot* self);
+ void (*set_Identity) (MprisRoot* self, const gchar* value);
+ gchar* (*get_DesktopEntry) (MprisRoot* self);
+ void (*set_DesktopEntry) (MprisRoot* self, const gchar* value);
+};
+
+struct _MprisPlayerIface {
+ GTypeInterface parent_iface;
+ void (*PlayPause) (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+ void (*PlayPause_finish) (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+ void (*Next) (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+ void (*Next_finish) (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+ void (*Previous) (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+ void (*Previous_finish) (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+ void (*Seek) (MprisPlayer* self, gint64 offset, GAsyncReadyCallback _callback_, gpointer _user_data_);
+ void (*Seek_finish) (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+ GHashTable* (*get_Metadata) (MprisPlayer* self);
+ void (*set_Metadata) (MprisPlayer* self, GHashTable* value);
+ gint32 (*get_Position) (MprisPlayer* self);
+ void (*set_Position) (MprisPlayer* self, gint32 value);
+ gchar* (*get_PlaybackStatus) (MprisPlayer* self);
+ void (*set_PlaybackStatus) (MprisPlayer* self, const gchar* value);
+};
+
+struct _PlaylistDetails {
+ char* path;
+ gchar* name;
+ gchar* icon_path;
+};
+
+struct _ActivePlaylistContainer {
+ gboolean valid;
+ PlaylistDetails* details;
+};
+
+struct _MprisPlaylistsIface {
+ GTypeInterface parent_iface;
+ void (*ActivatePlaylist) (MprisPlaylists* self, const char* playlist_id, GAsyncReadyCallback _callback_, gpointer _user_data_);
+ void (*ActivatePlaylist_finish) (MprisPlaylists* self, GAsyncResult* _res_, GError** error);
+ void (*GetPlaylists) (MprisPlaylists* self, guint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, GAsyncReadyCallback _callback_, gpointer _user_data_);
+ PlaylistDetails* (*GetPlaylists_finish) (MprisPlaylists* self, GAsyncResult* _res_, int* result_length1, GError** error);
+ gchar** (*get_Orderings) (MprisPlaylists* self, int* result_length1);
+ void (*set_Orderings) (MprisPlaylists* self, gchar** value, int value_length1);
+ guint32 (*get_PlaylistCount) (MprisPlaylists* self);
+ void (*set_PlaylistCount) (MprisPlaylists* self, guint32 value);
+ void (*get_ActivePlaylist) (MprisPlaylists* self, ActivePlaylistContainer* value);
+ void (*set_ActivePlaylist) (MprisPlaylists* self, ActivePlaylistContainer* value);
+};
+
+
+
+#define MPRIS_PREFIX "org.mpris.MediaPlayer2."
+#define MPRIS_MEDIA_PLAYER_PATH "/org/mpris/MediaPlayer2"
+GType mpris_root_proxy_get_type (void) G_GNUC_CONST;
+guint mpris_root_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
+GType mpris_root_get_type (void) G_GNUC_CONST;
+void mpris_root_Quit (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+void mpris_root_Quit_finish (MprisRoot* self, GAsyncResult* _res_, GError** error);
+void mpris_root_Raise (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+void mpris_root_Raise_finish (MprisRoot* self, GAsyncResult* _res_, GError** error);
+gboolean mpris_root_get_HasTracklist (MprisRoot* self);
+void mpris_root_set_HasTracklist (MprisRoot* self, gboolean value);
+gboolean mpris_root_get_CanQuit (MprisRoot* self);
+void mpris_root_set_CanQuit (MprisRoot* self, gboolean value);
+gboolean mpris_root_get_CanRaise (MprisRoot* self);
+void mpris_root_set_CanRaise (MprisRoot* self, gboolean value);
+gchar* mpris_root_get_Identity (MprisRoot* self);
+void mpris_root_set_Identity (MprisRoot* self, const gchar* value);
+gchar* mpris_root_get_DesktopEntry (MprisRoot* self);
+void mpris_root_set_DesktopEntry (MprisRoot* self, const gchar* value);
+static void mpris_root_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters);
+static void _vala_g_async_ready_callback (GObject *source_object, GAsyncResult *res, void *user_data);
+static void mpris_root_proxy_Quit_async (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+static void mpris_root_proxy_Quit_finish (MprisRoot* self, GAsyncResult* _res_, GError** error);
+static void mpris_root_proxy_Raise_async (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+static void mpris_root_proxy_Raise_finish (MprisRoot* self, GAsyncResult* _res_, GError** error);
+static gboolean mpris_root_dbus_proxy_get_HasTracklist (MprisRoot* self);
+static void mpris_root_dbus_proxy_set_HasTracklist (MprisRoot* self, gboolean value);
+static gboolean mpris_root_dbus_proxy_get_CanQuit (MprisRoot* self);
+static void mpris_root_dbus_proxy_set_CanQuit (MprisRoot* self, gboolean value);
+static gboolean mpris_root_dbus_proxy_get_CanRaise (MprisRoot* self);
+static void mpris_root_dbus_proxy_set_CanRaise (MprisRoot* self, gboolean value);
+static gchar* mpris_root_dbus_proxy_get_Identity (MprisRoot* self);
+static void mpris_root_dbus_proxy_set_Identity (MprisRoot* self, const gchar* value);
+static gchar* mpris_root_dbus_proxy_get_DesktopEntry (MprisRoot* self);
+static void mpris_root_dbus_proxy_set_DesktopEntry (MprisRoot* self, const gchar* value);
+static void mpris_root_proxy_mpris_root_interface_init (MprisRootIface* iface);
+static void _dbus_mpris_root_Quit (MprisRoot* self, GVariant* parameters, GDBusMethodInvocation* invocation);
+static void _dbus_mpris_root_Quit_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_);
+static void _dbus_mpris_root_Raise (MprisRoot* self, GVariant* parameters, GDBusMethodInvocation* invocation);
+static void _dbus_mpris_root_Raise_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_);
+static void 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);
+static GVariant* 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);
+static GVariant* _dbus_mpris_root_get_HasTracklist (MprisRoot* self);
+static GVariant* _dbus_mpris_root_get_CanQuit (MprisRoot* self);
+static GVariant* _dbus_mpris_root_get_CanRaise (MprisRoot* self);
+static GVariant* _dbus_mpris_root_get_Identity (MprisRoot* self);
+static GVariant* _dbus_mpris_root_get_DesktopEntry (MprisRoot* self);
+static gboolean 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);
+static void _dbus_mpris_root_set_HasTracklist (MprisRoot* self, GVariant* _value);
+static void _dbus_mpris_root_set_CanQuit (MprisRoot* self, GVariant* _value);
+static void _dbus_mpris_root_set_CanRaise (MprisRoot* self, GVariant* _value);
+static void _dbus_mpris_root_set_Identity (MprisRoot* self, GVariant* _value);
+static void _dbus_mpris_root_set_DesktopEntry (MprisRoot* self, GVariant* _value);
+static void _mpris_root_unregister_object (gpointer user_data);
+GType mpris_player_proxy_get_type (void) G_GNUC_CONST;
+guint mpris_player_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
+GType mpris_player_get_type (void) G_GNUC_CONST;
+void mpris_player_PlayPause (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+void mpris_player_PlayPause_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+void mpris_player_Next (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+void mpris_player_Next_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+void mpris_player_Previous (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+void mpris_player_Previous_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+void mpris_player_Seek (MprisPlayer* self, gint64 offset, GAsyncReadyCallback _callback_, gpointer _user_data_);
+void mpris_player_Seek_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+GHashTable* mpris_player_get_Metadata (MprisPlayer* self);
+void mpris_player_set_Metadata (MprisPlayer* self, GHashTable* value);
+gint32 mpris_player_get_Position (MprisPlayer* self);
+void mpris_player_set_Position (MprisPlayer* self, gint32 value);
+gchar* mpris_player_get_PlaybackStatus (MprisPlayer* self);
+void mpris_player_set_PlaybackStatus (MprisPlayer* self, const gchar* value);
+static void g_cclosure_user_marshal_VOID__INT64 (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data);
+static void mpris_player_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters);
+static void _dbus_handle_mpris_player_seeked (MprisPlayer* self, GVariant* parameters);
+static void mpris_player_proxy_PlayPause_async (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+static void mpris_player_proxy_PlayPause_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+static void mpris_player_proxy_Next_async (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+static void mpris_player_proxy_Next_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+static void mpris_player_proxy_Previous_async (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+static void mpris_player_proxy_Previous_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+static void mpris_player_proxy_Seek_async (MprisPlayer* self, gint64 offset, GAsyncReadyCallback _callback_, gpointer _user_data_);
+static void mpris_player_proxy_Seek_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+static GHashTable* mpris_player_dbus_proxy_get_Metadata (MprisPlayer* self);
+static void mpris_player_dbus_proxy_set_Metadata (MprisPlayer* self, GHashTable* value);
+static gint32 mpris_player_dbus_proxy_get_Position (MprisPlayer* self);
+static void mpris_player_dbus_proxy_set_Position (MprisPlayer* self, gint32 value);
+static gchar* mpris_player_dbus_proxy_get_PlaybackStatus (MprisPlayer* self);
+static void mpris_player_dbus_proxy_set_PlaybackStatus (MprisPlayer* self, const gchar* value);
+static void mpris_player_proxy_mpris_player_interface_init (MprisPlayerIface* iface);
+static void _dbus_mpris_player_PlayPause (MprisPlayer* self, GVariant* parameters, GDBusMethodInvocation* invocation);
+static void _dbus_mpris_player_PlayPause_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_);
+static void _dbus_mpris_player_Next (MprisPlayer* self, GVariant* parameters, GDBusMethodInvocation* invocation);
+static void _dbus_mpris_player_Next_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_);
+static void _dbus_mpris_player_Previous (MprisPlayer* self, GVariant* parameters, GDBusMethodInvocation* invocation);
+static void _dbus_mpris_player_Previous_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_);
+static void _dbus_mpris_player_Seek (MprisPlayer* self, GVariant* parameters, GDBusMethodInvocation* invocation);
+static void _dbus_mpris_player_Seek_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_);
+static void 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);
+static GVariant* 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);
+static GVariant* _dbus_mpris_player_get_Metadata (MprisPlayer* self);
+static GVariant* _dbus_mpris_player_get_Position (MprisPlayer* self);
+static GVariant* _dbus_mpris_player_get_PlaybackStatus (MprisPlayer* self);
+static gboolean 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);
+static void _dbus_mpris_player_set_Metadata (MprisPlayer* self, GVariant* _value);
+static void _dbus_mpris_player_set_Position (MprisPlayer* self, GVariant* _value);
+static void _dbus_mpris_player_set_PlaybackStatus (MprisPlayer* self, GVariant* _value);
+static void _dbus_mpris_player_seeked (GObject* _sender, gint64 new_position, gpointer* _data);
+static void _mpris_player_unregister_object (gpointer user_data);
+GType playlist_details_get_type (void) G_GNUC_CONST;
+PlaylistDetails* playlist_details_dup (const PlaylistDetails* self);
+void playlist_details_free (PlaylistDetails* self);
+void playlist_details_copy (const PlaylistDetails* self, PlaylistDetails* dest);
+void playlist_details_destroy (PlaylistDetails* self);
+GType active_playlist_container_get_type (void) G_GNUC_CONST;
+ActivePlaylistContainer* active_playlist_container_dup (const ActivePlaylistContainer* self);
+void active_playlist_container_free (ActivePlaylistContainer* self);
+void active_playlist_container_copy (const ActivePlaylistContainer* self, ActivePlaylistContainer* dest);
+void active_playlist_container_destroy (ActivePlaylistContainer* self);
+GType mpris_playlists_proxy_get_type (void) G_GNUC_CONST;
+guint mpris_playlists_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
+GType mpris_playlists_get_type (void) G_GNUC_CONST;
+void mpris_playlists_ActivatePlaylist (MprisPlaylists* self, const char* playlist_id, GAsyncReadyCallback _callback_, gpointer _user_data_);
+void mpris_playlists_ActivatePlaylist_finish (MprisPlaylists* self, GAsyncResult* _res_, GError** error);
+void mpris_playlists_GetPlaylists (MprisPlaylists* self, guint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, GAsyncReadyCallback _callback_, gpointer _user_data_);
+PlaylistDetails* mpris_playlists_GetPlaylists_finish (MprisPlaylists* self, GAsyncResult* _res_, int* result_length1, GError** error);
+gchar** mpris_playlists_get_Orderings (MprisPlaylists* self, int* result_length1);
+void mpris_playlists_set_Orderings (MprisPlaylists* self, gchar** value, int value_length1);
+guint32 mpris_playlists_get_PlaylistCount (MprisPlaylists* self);
+void mpris_playlists_set_PlaylistCount (MprisPlaylists* self, guint32 value);
+void mpris_playlists_get_ActivePlaylist (MprisPlaylists* self, ActivePlaylistContainer* result);
+void mpris_playlists_set_ActivePlaylist (MprisPlaylists* self, ActivePlaylistContainer* value);
+static void g_cclosure_user_marshal_VOID__BOXED (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data);
+static void mpris_playlists_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters);
+static void _dbus_handle_mpris_playlists_playlist_changed (MprisPlaylists* self, GVariant* parameters);
+static void mpris_playlists_proxy_ActivatePlaylist_async (MprisPlaylists* self, const char* playlist_id, GAsyncReadyCallback _callback_, gpointer _user_data_);
+static void mpris_playlists_proxy_ActivatePlaylist_finish (MprisPlaylists* self, GAsyncResult* _res_, GError** error);
+static void mpris_playlists_proxy_GetPlaylists_async (MprisPlaylists* self, guint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, GAsyncReadyCallback _callback_, gpointer _user_data_);
+static PlaylistDetails* mpris_playlists_proxy_GetPlaylists_finish (MprisPlaylists* self, GAsyncResult* _res_, int* result_length1, GError** error);
+static gchar** mpris_playlists_dbus_proxy_get_Orderings (MprisPlaylists* self, int* result_length1);
+static void mpris_playlists_dbus_proxy_set_Orderings (MprisPlaylists* self, gchar** value, int value_length1);
+static guint32 mpris_playlists_dbus_proxy_get_PlaylistCount (MprisPlaylists* self);
+static void mpris_playlists_dbus_proxy_set_PlaylistCount (MprisPlaylists* self, guint32 value);
+static void mpris_playlists_dbus_proxy_get_ActivePlaylist (MprisPlaylists* self, ActivePlaylistContainer* result);
+static void mpris_playlists_dbus_proxy_set_ActivePlaylist (MprisPlaylists* self, ActivePlaylistContainer* value);
+static void mpris_playlists_proxy_mpris_playlists_interface_init (MprisPlaylistsIface* iface);
+static void _dbus_mpris_playlists_ActivatePlaylist (MprisPlaylists* self, GVariant* parameters, GDBusMethodInvocation* invocation);
+static void _dbus_mpris_playlists_ActivatePlaylist_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_);
+static void _dbus_mpris_playlists_GetPlaylists (MprisPlaylists* self, GVariant* parameters, GDBusMethodInvocation* invocation);
+static void _vala_PlaylistDetails_array_free (PlaylistDetails* array, gint array_length);
+static void _dbus_mpris_playlists_GetPlaylists_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_);
+static void 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);
+static GVariant* 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);
+static GVariant* _dbus_mpris_playlists_get_Orderings (MprisPlaylists* self);
+static GVariant* _dbus_mpris_playlists_get_PlaylistCount (MprisPlaylists* self);
+static GVariant* _dbus_mpris_playlists_get_ActivePlaylist (MprisPlaylists* self);
+static gboolean 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);
+static void _dbus_mpris_playlists_set_Orderings (MprisPlaylists* self, GVariant* _value);
+static void _dbus_mpris_playlists_set_PlaylistCount (MprisPlaylists* self, GVariant* _value);
+static void _dbus_mpris_playlists_set_ActivePlaylist (MprisPlaylists* self, GVariant* _value);
+static void _dbus_mpris_playlists_playlist_changed (GObject* _sender, PlaylistDetails* details, gpointer* _data);
+static void _mpris_playlists_unregister_object (gpointer user_data);
+static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
+
+static const GDBusArgInfo * const _mpris_root_dbus_arg_info_Quit_in[] = {NULL};
+static const GDBusArgInfo * const _mpris_root_dbus_arg_info_Quit_out[] = {NULL};
+static const GDBusMethodInfo _mpris_root_dbus_method_info_Quit = {-1, "Quit", (GDBusArgInfo **) (&_mpris_root_dbus_arg_info_Quit_in), (GDBusArgInfo **) (&_mpris_root_dbus_arg_info_Quit_out)};
+static const GDBusArgInfo * const _mpris_root_dbus_arg_info_Raise_in[] = {NULL};
+static const GDBusArgInfo * const _mpris_root_dbus_arg_info_Raise_out[] = {NULL};
+static const GDBusMethodInfo _mpris_root_dbus_method_info_Raise = {-1, "Raise", (GDBusArgInfo **) (&_mpris_root_dbus_arg_info_Raise_in), (GDBusArgInfo **) (&_mpris_root_dbus_arg_info_Raise_out)};
+static const GDBusMethodInfo * const _mpris_root_dbus_method_info[] = {&_mpris_root_dbus_method_info_Quit, &_mpris_root_dbus_method_info_Raise, NULL};
+static const GDBusSignalInfo * const _mpris_root_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo _mpris_root_dbus_property_info_HasTracklist = {-1, "HasTracklist", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE};
+static const GDBusPropertyInfo _mpris_root_dbus_property_info_CanQuit = {-1, "CanQuit", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE};
+static const GDBusPropertyInfo _mpris_root_dbus_property_info_CanRaise = {-1, "CanRaise", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE};
+static const GDBusPropertyInfo _mpris_root_dbus_property_info_Identity = {-1, "Identity", "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE};
+static const GDBusPropertyInfo _mpris_root_dbus_property_info_DesktopEntry = {-1, "DesktopEntry", "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE};
+static const GDBusPropertyInfo * const _mpris_root_dbus_property_info[] = {&_mpris_root_dbus_property_info_HasTracklist, &_mpris_root_dbus_property_info_CanQuit, &_mpris_root_dbus_property_info_CanRaise, &_mpris_root_dbus_property_info_Identity, &_mpris_root_dbus_property_info_DesktopEntry, NULL};
+static const GDBusInterfaceInfo _mpris_root_dbus_interface_info = {-1, "org.mpris.MediaPlayer2", (GDBusMethodInfo **) (&_mpris_root_dbus_method_info), (GDBusSignalInfo **) (&_mpris_root_dbus_signal_info), (GDBusPropertyInfo **) (&_mpris_root_dbus_property_info)};
+static const GDBusInterfaceVTable _mpris_root_dbus_interface_vtable = {mpris_root_dbus_interface_method_call, mpris_root_dbus_interface_get_property, mpris_root_dbus_interface_set_property};
+static const GDBusArgInfo * const _mpris_player_dbus_arg_info_PlayPause_in[] = {NULL};
+static const GDBusArgInfo * const _mpris_player_dbus_arg_info_PlayPause_out[] = {NULL};
+static const GDBusMethodInfo _mpris_player_dbus_method_info_PlayPause = {-1, "PlayPause", (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_PlayPause_in), (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_PlayPause_out)};
+static const GDBusArgInfo * const _mpris_player_dbus_arg_info_Next_in[] = {NULL};
+static const GDBusArgInfo * const _mpris_player_dbus_arg_info_Next_out[] = {NULL};
+static const GDBusMethodInfo _mpris_player_dbus_method_info_Next = {-1, "Next", (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_Next_in), (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_Next_out)};
+static const GDBusArgInfo * const _mpris_player_dbus_arg_info_Previous_in[] = {NULL};
+static const GDBusArgInfo * const _mpris_player_dbus_arg_info_Previous_out[] = {NULL};
+static const GDBusMethodInfo _mpris_player_dbus_method_info_Previous = {-1, "Previous", (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_Previous_in), (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_Previous_out)};
+static const GDBusArgInfo _mpris_player_dbus_arg_info_Seek_offset = {-1, "offset", "x"};
+static const GDBusArgInfo * const _mpris_player_dbus_arg_info_Seek_in[] = {&_mpris_player_dbus_arg_info_Seek_offset, NULL};
+static const GDBusArgInfo * const _mpris_player_dbus_arg_info_Seek_out[] = {NULL};
+static const GDBusMethodInfo _mpris_player_dbus_method_info_Seek = {-1, "Seek", (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_Seek_in), (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_Seek_out)};
+static const GDBusMethodInfo * const _mpris_player_dbus_method_info[] = {&_mpris_player_dbus_method_info_PlayPause, &_mpris_player_dbus_method_info_Next, &_mpris_player_dbus_method_info_Previous, &_mpris_player_dbus_method_info_Seek, NULL};
+static const GDBusArgInfo _mpris_player_dbus_arg_info_seeked_new_position = {-1, "new_position", "x"};
+static const GDBusArgInfo * const _mpris_player_dbus_arg_info_seeked[] = {&_mpris_player_dbus_arg_info_seeked_new_position, NULL};
+static const GDBusSignalInfo _mpris_player_dbus_signal_info_seeked = {-1, "Seeked", (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_seeked)};
+static const GDBusSignalInfo * const _mpris_player_dbus_signal_info[] = {&_mpris_player_dbus_signal_info_seeked, NULL};
+static const GDBusPropertyInfo _mpris_player_dbus_property_info_Metadata = {-1, "Metadata", "a{sv}", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE};
+static const GDBusPropertyInfo _mpris_player_dbus_property_info_Position = {-1, "Position", "i", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE};
+static const GDBusPropertyInfo _mpris_player_dbus_property_info_PlaybackStatus = {-1, "PlaybackStatus", "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE};
+static const GDBusPropertyInfo * const _mpris_player_dbus_property_info[] = {&_mpris_player_dbus_property_info_Metadata, &_mpris_player_dbus_property_info_Position, &_mpris_player_dbus_property_info_PlaybackStatus, NULL};
+static const GDBusInterfaceInfo _mpris_player_dbus_interface_info = {-1, "org.mpris.MediaPlayer2.Player", (GDBusMethodInfo **) (&_mpris_player_dbus_method_info), (GDBusSignalInfo **) (&_mpris_player_dbus_signal_info), (GDBusPropertyInfo **) (&_mpris_player_dbus_property_info)};
+static const GDBusInterfaceVTable _mpris_player_dbus_interface_vtable = {mpris_player_dbus_interface_method_call, mpris_player_dbus_interface_get_property, mpris_player_dbus_interface_set_property};
+static const GDBusArgInfo _mpris_playlists_dbus_arg_info_ActivatePlaylist_playlist_id = {-1, "playlist_id", "o"};
+static const GDBusArgInfo * const _mpris_playlists_dbus_arg_info_ActivatePlaylist_in[] = {&_mpris_playlists_dbus_arg_info_ActivatePlaylist_playlist_id, NULL};
+static const GDBusArgInfo * const _mpris_playlists_dbus_arg_info_ActivatePlaylist_out[] = {NULL};
+static const GDBusMethodInfo _mpris_playlists_dbus_method_info_ActivatePlaylist = {-1, "ActivatePlaylist", (GDBusArgInfo **) (&_mpris_playlists_dbus_arg_info_ActivatePlaylist_in), (GDBusArgInfo **) (&_mpris_playlists_dbus_arg_info_ActivatePlaylist_out)};
+static const GDBusArgInfo _mpris_playlists_dbus_arg_info_GetPlaylists_index = {-1, "index", "u"};
+static const GDBusArgInfo _mpris_playlists_dbus_arg_info_GetPlaylists_max_count = {-1, "max_count", "u"};
+static const GDBusArgInfo _mpris_playlists_dbus_arg_info_GetPlaylists_order = {-1, "order", "s"};
+static const GDBusArgInfo _mpris_playlists_dbus_arg_info_GetPlaylists_reverse_order = {-1, "reverse_order", "b"};
+static const GDBusArgInfo _mpris_playlists_dbus_arg_info_GetPlaylists_result = {-1, "result", "a(oss)"};
+static const GDBusArgInfo * const _mpris_playlists_dbus_arg_info_GetPlaylists_in[] = {&_mpris_playlists_dbus_arg_info_GetPlaylists_index, &_mpris_playlists_dbus_arg_info_GetPlaylists_max_count, &_mpris_playlists_dbus_arg_info_GetPlaylists_order, &_mpris_playlists_dbus_arg_info_GetPlaylists_reverse_order, NULL};
+static const GDBusArgInfo * const _mpris_playlists_dbus_arg_info_GetPlaylists_out[] = {&_mpris_playlists_dbus_arg_info_GetPlaylists_result, NULL};
+static const GDBusMethodInfo _mpris_playlists_dbus_method_info_GetPlaylists = {-1, "GetPlaylists", (GDBusArgInfo **) (&_mpris_playlists_dbus_arg_info_GetPlaylists_in), (GDBusArgInfo **) (&_mpris_playlists_dbus_arg_info_GetPlaylists_out)};
+static const GDBusMethodInfo * const _mpris_playlists_dbus_method_info[] = {&_mpris_playlists_dbus_method_info_ActivatePlaylist, &_mpris_playlists_dbus_method_info_GetPlaylists, NULL};
+static const GDBusArgInfo _mpris_playlists_dbus_arg_info_playlist_changed_details = {-1, "details", "(oss)"};
+static const GDBusArgInfo * const _mpris_playlists_dbus_arg_info_playlist_changed[] = {&_mpris_playlists_dbus_arg_info_playlist_changed_details, NULL};
+static const GDBusSignalInfo _mpris_playlists_dbus_signal_info_playlist_changed = {-1, "PlaylistChanged", (GDBusArgInfo **) (&_mpris_playlists_dbus_arg_info_playlist_changed)};
+static const GDBusSignalInfo * const _mpris_playlists_dbus_signal_info[] = {&_mpris_playlists_dbus_signal_info_playlist_changed, NULL};
+static const GDBusPropertyInfo _mpris_playlists_dbus_property_info_Orderings = {-1, "Orderings", "as", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE};
+static const GDBusPropertyInfo _mpris_playlists_dbus_property_info_PlaylistCount = {-1, "PlaylistCount", "u", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE};
+static const GDBusPropertyInfo _mpris_playlists_dbus_property_info_ActivePlaylist = {-1, "ActivePlaylist", "(b(oss))", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE};
+static const GDBusPropertyInfo * const _mpris_playlists_dbus_property_info[] = {&_mpris_playlists_dbus_property_info_Orderings, &_mpris_playlists_dbus_property_info_PlaylistCount, &_mpris_playlists_dbus_property_info_ActivePlaylist, NULL};
+static const GDBusInterfaceInfo _mpris_playlists_dbus_interface_info = {-1, "org.mpris.MediaPlayer2.Playlists", (GDBusMethodInfo **) (&_mpris_playlists_dbus_method_info), (GDBusSignalInfo **) (&_mpris_playlists_dbus_signal_info), (GDBusPropertyInfo **) (&_mpris_playlists_dbus_property_info)};
+static const GDBusInterfaceVTable _mpris_playlists_dbus_interface_vtable = {mpris_playlists_dbus_interface_method_call, mpris_playlists_dbus_interface_get_property, mpris_playlists_dbus_interface_set_property};
+
+void mpris_root_Quit (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
+ MPRIS_ROOT_GET_INTERFACE (self)->Quit (self, _callback_, _user_data_);
+}
+
+
+void mpris_root_Quit_finish (MprisRoot* self, GAsyncResult* _res_, GError** error) {
+ MPRIS_ROOT_GET_INTERFACE (self)->Quit_finish (self, _res_, error);
+}
+
+
+void mpris_root_Raise (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
+ MPRIS_ROOT_GET_INTERFACE (self)->Raise (self, _callback_, _user_data_);
+}
+
+
+void mpris_root_Raise_finish (MprisRoot* self, GAsyncResult* _res_, GError** error) {
+ MPRIS_ROOT_GET_INTERFACE (self)->Raise_finish (self, _res_, error);
+}
+
+
+gboolean mpris_root_get_HasTracklist (MprisRoot* self) {
+ g_return_val_if_fail (self != NULL, FALSE);
+ return MPRIS_ROOT_GET_INTERFACE (self)->get_HasTracklist (self);
+}
+
+
+void mpris_root_set_HasTracklist (MprisRoot* self, gboolean value) {
+ g_return_if_fail (self != NULL);
+ MPRIS_ROOT_GET_INTERFACE (self)->set_HasTracklist (self, value);
+}
+
+
+gboolean mpris_root_get_CanQuit (MprisRoot* self) {
+ g_return_val_if_fail (self != NULL, FALSE);
+ return MPRIS_ROOT_GET_INTERFACE (self)->get_CanQuit (self);
+}
+
+
+void mpris_root_set_CanQuit (MprisRoot* self, gboolean value) {
+ g_return_if_fail (self != NULL);
+ MPRIS_ROOT_GET_INTERFACE (self)->set_CanQuit (self, value);
+}
+
+
+gboolean mpris_root_get_CanRaise (MprisRoot* self) {
+ g_return_val_if_fail (self != NULL, FALSE);
+ return MPRIS_ROOT_GET_INTERFACE (self)->get_CanRaise (self);
+}
+
+
+void mpris_root_set_CanRaise (MprisRoot* self, gboolean value) {
+ g_return_if_fail (self != NULL);
+ MPRIS_ROOT_GET_INTERFACE (self)->set_CanRaise (self, value);
+}
+
+
+gchar* mpris_root_get_Identity (MprisRoot* self) {
+ g_return_val_if_fail (self != NULL, NULL);
+ return MPRIS_ROOT_GET_INTERFACE (self)->get_Identity (self);
+}
+
+
+void mpris_root_set_Identity (MprisRoot* self, const gchar* value) {
+ g_return_if_fail (self != NULL);
+ MPRIS_ROOT_GET_INTERFACE (self)->set_Identity (self, value);
+}
+
+
+gchar* mpris_root_get_DesktopEntry (MprisRoot* self) {
+ g_return_val_if_fail (self != NULL, NULL);
+ return MPRIS_ROOT_GET_INTERFACE (self)->get_DesktopEntry (self);
+}
+
+
+void mpris_root_set_DesktopEntry (MprisRoot* self, const gchar* value) {
+ g_return_if_fail (self != NULL);
+ MPRIS_ROOT_GET_INTERFACE (self)->set_DesktopEntry (self, value);
+}
+
+
+static void mpris_root_base_init (MprisRootIface * iface) {
+ static gboolean initialized = FALSE;
+ if (!initialized) {
+ initialized = TRUE;
+ }
+}
+
+
+GType mpris_root_get_type (void) {
+ static volatile gsize mpris_root_type_id__volatile = 0;
+ if (g_once_init_enter (&mpris_root_type_id__volatile)) {
+ static const GTypeInfo g_define_type_info = { sizeof (MprisRootIface), (GBaseInitFunc) mpris_root_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
+ GType mpris_root_type_id;
+ mpris_root_type_id = g_type_register_static (G_TYPE_INTERFACE, "MprisRoot", &g_define_type_info, 0);
+ g_type_interface_add_prerequisite (mpris_root_type_id, G_TYPE_OBJECT);
+ g_type_set_qdata (mpris_root_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) mpris_root_proxy_get_type);
+ g_type_set_qdata (mpris_root_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), "org.mpris.MediaPlayer2");
+ g_type_set_qdata (mpris_root_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) mpris_root_register_object);
+ g_once_init_leave (&mpris_root_type_id__volatile, mpris_root_type_id);
+ }
+ return mpris_root_type_id__volatile;
+}
+
+
+G_DEFINE_TYPE_EXTENDED (MprisRootProxy, mpris_root_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_MPRIS_ROOT, mpris_root_proxy_mpris_root_interface_init) )
+static void mpris_root_proxy_class_init (MprisRootProxyClass* klass) {
+ G_DBUS_PROXY_CLASS (klass)->g_signal = mpris_root_proxy_g_signal;
+}
+
+
+static void mpris_root_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters) {
+}
+
+
+static void mpris_root_proxy_init (MprisRootProxy* self) {
+}
+
+
+static void _vala_g_async_ready_callback (GObject *source_object, GAsyncResult *res, void *user_data) {
+ g_simple_async_result_set_op_res_gpointer (user_data, g_object_ref (res), g_object_unref);
+ g_simple_async_result_complete (user_data);
+ g_object_unref (user_data);
+}
+
+
+static void mpris_root_proxy_Quit_async (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
+ GDBusMessage *_message;
+ GVariant *_arguments;
+ GVariantBuilder _arguments_builder;
+ G_IO_ERROR;
+ _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.mpris.MediaPlayer2", "Quit");
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ g_dbus_message_set_body (_message, _arguments);
+ 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));
+ g_object_unref (_message);
+}
+
+
+static void mpris_root_proxy_Quit_finish (MprisRoot* self, GAsyncResult* _res_, GError** error) {
+ GDBusMessage *_reply_message;
+ _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);
+ if (!_reply_message) {
+ return;
+ }
+ if (g_dbus_message_to_gerror (_reply_message, error)) {
+ g_object_unref (_reply_message);
+ return;
+ }
+ g_object_unref (_reply_message);
+}
+
+
+static void mpris_root_proxy_Raise_async (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
+ GDBusMessage *_message;
+ GVariant *_arguments;
+ GVariantBuilder _arguments_builder;
+ G_IO_ERROR;
+ _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.mpris.MediaPlayer2", "Raise");
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ g_dbus_message_set_body (_message, _arguments);
+ 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));
+ g_object_unref (_message);
+}
+
+
+static void mpris_root_proxy_Raise_finish (MprisRoot* self, GAsyncResult* _res_, GError** error) {
+ GDBusMessage *_reply_message;
+ _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);
+ if (!_reply_message) {
+ return;
+ }
+ if (g_dbus_message_to_gerror (_reply_message, error)) {
+ g_object_unref (_reply_message);
+ return;
+ }
+ g_object_unref (_reply_message);
+}
+
+
+static gboolean mpris_root_dbus_proxy_get_HasTracklist (MprisRoot* self) {
+ GVariant *_inner_reply;
+ gboolean _result;
+ _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "HasTracklist");
+ if (!_inner_reply) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("HasTracklist"));
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return FALSE;
+ }
+ g_variant_get (_reply, "(v)", &_inner_reply);
+ g_variant_unref (_reply);
+ }
+ _result = g_variant_get_boolean (_inner_reply);
+ g_variant_unref (_inner_reply);
+ return _result;
+}
+
+
+static void mpris_root_dbus_proxy_set_HasTracklist (MprisRoot* self, gboolean value) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("HasTracklist"));
+ g_variant_builder_open (&_arguments_builder, G_VARIANT_TYPE_VARIANT);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_boolean (value));
+ g_variant_builder_close (&_arguments_builder);
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Set", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return;
+ }
+ g_variant_unref (_reply);
+}
+
+
+static gboolean mpris_root_dbus_proxy_get_CanQuit (MprisRoot* self) {
+ GVariant *_inner_reply;
+ gboolean _result;
+ _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "CanQuit");
+ if (!_inner_reply) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("CanQuit"));
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return FALSE;
+ }
+ g_variant_get (_reply, "(v)", &_inner_reply);
+ g_variant_unref (_reply);
+ }
+ _result = g_variant_get_boolean (_inner_reply);
+ g_variant_unref (_inner_reply);
+ return _result;
+}
+
+
+static void mpris_root_dbus_proxy_set_CanQuit (MprisRoot* self, gboolean value) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("CanQuit"));
+ g_variant_builder_open (&_arguments_builder, G_VARIANT_TYPE_VARIANT);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_boolean (value));
+ g_variant_builder_close (&_arguments_builder);
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Set", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return;
+ }
+ g_variant_unref (_reply);
+}
+
+
+static gboolean mpris_root_dbus_proxy_get_CanRaise (MprisRoot* self) {
+ GVariant *_inner_reply;
+ gboolean _result;
+ _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "CanRaise");
+ if (!_inner_reply) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("CanRaise"));
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return FALSE;
+ }
+ g_variant_get (_reply, "(v)", &_inner_reply);
+ g_variant_unref (_reply);
+ }
+ _result = g_variant_get_boolean (_inner_reply);
+ g_variant_unref (_inner_reply);
+ return _result;
+}
+
+
+static void mpris_root_dbus_proxy_set_CanRaise (MprisRoot* self, gboolean value) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("CanRaise"));
+ g_variant_builder_open (&_arguments_builder, G_VARIANT_TYPE_VARIANT);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_boolean (value));
+ g_variant_builder_close (&_arguments_builder);
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Set", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return;
+ }
+ g_variant_unref (_reply);
+}
+
+
+static gchar* mpris_root_dbus_proxy_get_Identity (MprisRoot* self) {
+ GVariant *_inner_reply;
+ gchar* _result;
+ _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "Identity");
+ if (!_inner_reply) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("Identity"));
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return NULL;
+ }
+ g_variant_get (_reply, "(v)", &_inner_reply);
+ g_variant_unref (_reply);
+ }
+ _result = g_variant_dup_string (_inner_reply, NULL);
+ g_variant_unref (_inner_reply);
+ return _result;
+}
+
+
+static void mpris_root_dbus_proxy_set_Identity (MprisRoot* self, const gchar* value) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("Identity"));
+ g_variant_builder_open (&_arguments_builder, G_VARIANT_TYPE_VARIANT);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (value));
+ g_variant_builder_close (&_arguments_builder);
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Set", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return;
+ }
+ g_variant_unref (_reply);
+}
+
+
+static gchar* mpris_root_dbus_proxy_get_DesktopEntry (MprisRoot* self) {
+ GVariant *_inner_reply;
+ gchar* _result;
+ _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "DesktopEntry");
+ if (!_inner_reply) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("DesktopEntry"));
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return NULL;
+ }
+ g_variant_get (_reply, "(v)", &_inner_reply);
+ g_variant_unref (_reply);
+ }
+ _result = g_variant_dup_string (_inner_reply, NULL);
+ g_variant_unref (_inner_reply);
+ return _result;
+}
+
+
+static void mpris_root_dbus_proxy_set_DesktopEntry (MprisRoot* self, const gchar* value) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("DesktopEntry"));
+ g_variant_builder_open (&_arguments_builder, G_VARIANT_TYPE_VARIANT);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (value));
+ g_variant_builder_close (&_arguments_builder);
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Set", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return;
+ }
+ g_variant_unref (_reply);
+}
+
+
+static void mpris_root_proxy_mpris_root_interface_init (MprisRootIface* iface) {
+ iface->Quit = mpris_root_proxy_Quit_async;
+ iface->Quit_finish = mpris_root_proxy_Quit_finish;
+ iface->Raise = mpris_root_proxy_Raise_async;
+ iface->Raise_finish = mpris_root_proxy_Raise_finish;
+ iface->get_HasTracklist = mpris_root_dbus_proxy_get_HasTracklist;
+ iface->set_HasTracklist = mpris_root_dbus_proxy_set_HasTracklist;
+ iface->get_CanQuit = mpris_root_dbus_proxy_get_CanQuit;
+ iface->set_CanQuit = mpris_root_dbus_proxy_set_CanQuit;
+ iface->get_CanRaise = mpris_root_dbus_proxy_get_CanRaise;
+ iface->set_CanRaise = mpris_root_dbus_proxy_set_CanRaise;
+ iface->get_Identity = mpris_root_dbus_proxy_get_Identity;
+ iface->set_Identity = mpris_root_dbus_proxy_set_Identity;
+ iface->get_DesktopEntry = mpris_root_dbus_proxy_get_DesktopEntry;
+ iface->set_DesktopEntry = mpris_root_dbus_proxy_set_DesktopEntry;
+}
+
+
+static void _dbus_mpris_root_Quit (MprisRoot* self, GVariant* parameters, GDBusMethodInvocation* invocation) {
+ GVariantIter _arguments_iter;
+ g_variant_iter_init (&_arguments_iter, parameters);
+ mpris_root_Quit (self, (GAsyncReadyCallback) _dbus_mpris_root_Quit_ready, invocation);
+}
+
+
+static void _dbus_mpris_root_Quit_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_) {
+ GDBusMethodInvocation * invocation;
+ GError* error = NULL;
+ GDBusMessage* _reply_message;
+ GVariant* _reply;
+ GVariantBuilder _reply_builder;
+ invocation = _user_data_;
+ mpris_root_Quit_finish ((MprisRoot*) source_object, _res_, &error);
+ if (error) {
+ g_dbus_method_invocation_return_gerror (invocation, error);
+ return;
+ }
+ _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+ g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+ _reply = g_variant_builder_end (&_reply_builder);
+ g_dbus_message_set_body (_reply_message, _reply);
+ g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+ g_object_unref (invocation);
+ g_object_unref (_reply_message);
+}
+
+
+static void _dbus_mpris_root_Raise (MprisRoot* self, GVariant* parameters, GDBusMethodInvocation* invocation) {
+ GVariantIter _arguments_iter;
+ g_variant_iter_init (&_arguments_iter, parameters);
+ mpris_root_Raise (self, (GAsyncReadyCallback) _dbus_mpris_root_Raise_ready, invocation);
+}
+
+
+static void _dbus_mpris_root_Raise_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_) {
+ GDBusMethodInvocation * invocation;
+ GError* error = NULL;
+ GDBusMessage* _reply_message;
+ GVariant* _reply;
+ GVariantBuilder _reply_builder;
+ invocation = _user_data_;
+ mpris_root_Raise_finish ((MprisRoot*) source_object, _res_, &error);
+ if (error) {
+ g_dbus_method_invocation_return_gerror (invocation, error);
+ return;
+ }
+ _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+ g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+ _reply = g_variant_builder_end (&_reply_builder);
+ g_dbus_message_set_body (_reply_message, _reply);
+ g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+ g_object_unref (invocation);
+ g_object_unref (_reply_message);
+}
+
+
+static void 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) {
+ gpointer* data;
+ gpointer object;
+ data = user_data;
+ object = data[0];
+ if (strcmp (method_name, "Quit") == 0) {
+ _dbus_mpris_root_Quit (object, parameters, invocation);
+ } else if (strcmp (method_name, "Raise") == 0) {
+ _dbus_mpris_root_Raise (object, parameters, invocation);
+ } else {
+ g_object_unref (invocation);
+ }
+}
+
+
+static GVariant* _dbus_mpris_root_get_HasTracklist (MprisRoot* self) {
+ gboolean result;
+ GVariant* _reply;
+ result = mpris_root_get_HasTracklist (self);
+ _reply = g_variant_new_boolean (result);
+ return _reply;
+}
+
+
+static GVariant* _dbus_mpris_root_get_CanQuit (MprisRoot* self) {
+ gboolean result;
+ GVariant* _reply;
+ result = mpris_root_get_CanQuit (self);
+ _reply = g_variant_new_boolean (result);
+ return _reply;
+}
+
+
+static GVariant* _dbus_mpris_root_get_CanRaise (MprisRoot* self) {
+ gboolean result;
+ GVariant* _reply;
+ result = mpris_root_get_CanRaise (self);
+ _reply = g_variant_new_boolean (result);
+ return _reply;
+}
+
+
+static GVariant* _dbus_mpris_root_get_Identity (MprisRoot* self) {
+ gchar* result;
+ GVariant* _reply;
+ result = mpris_root_get_Identity (self);
+ _reply = g_variant_new_string (result);
+ _g_free0 (result);
+ return _reply;
+}
+
+
+static GVariant* _dbus_mpris_root_get_DesktopEntry (MprisRoot* self) {
+ gchar* result;
+ GVariant* _reply;
+ result = mpris_root_get_DesktopEntry (self);
+ _reply = g_variant_new_string (result);
+ _g_free0 (result);
+ return _reply;
+}
+
+
+static GVariant* 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) {
+ gpointer* data;
+ gpointer object;
+ data = user_data;
+ object = data[0];
+ if (strcmp (property_name, "HasTracklist") == 0) {
+ return _dbus_mpris_root_get_HasTracklist (object);
+ } else if (strcmp (property_name, "CanQuit") == 0) {
+ return _dbus_mpris_root_get_CanQuit (object);
+ } else if (strcmp (property_name, "CanRaise") == 0) {
+ return _dbus_mpris_root_get_CanRaise (object);
+ } else if (strcmp (property_name, "Identity") == 0) {
+ return _dbus_mpris_root_get_Identity (object);
+ } else if (strcmp (property_name, "DesktopEntry") == 0) {
+ return _dbus_mpris_root_get_DesktopEntry (object);
+ }
+ return NULL;
+}
+
+
+static void _dbus_mpris_root_set_HasTracklist (MprisRoot* self, GVariant* _value) {
+ gboolean value = FALSE;
+ value = g_variant_get_boolean (_value);
+ mpris_root_set_HasTracklist (self, value);
+}
+
+
+static void _dbus_mpris_root_set_CanQuit (MprisRoot* self, GVariant* _value) {
+ gboolean value = FALSE;
+ value = g_variant_get_boolean (_value);
+ mpris_root_set_CanQuit (self, value);
+}
+
+
+static void _dbus_mpris_root_set_CanRaise (MprisRoot* self, GVariant* _value) {
+ gboolean value = FALSE;
+ value = g_variant_get_boolean (_value);
+ mpris_root_set_CanRaise (self, value);
+}
+
+
+static void _dbus_mpris_root_set_Identity (MprisRoot* self, GVariant* _value) {
+ gchar* value = NULL;
+ value = g_variant_dup_string (_value, NULL);
+ mpris_root_set_Identity (self, value);
+ _g_free0 (value);
+}
+
+
+static void _dbus_mpris_root_set_DesktopEntry (MprisRoot* self, GVariant* _value) {
+ gchar* value = NULL;
+ value = g_variant_dup_string (_value, NULL);
+ mpris_root_set_DesktopEntry (self, value);
+ _g_free0 (value);
+}
+
+
+static gboolean 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) {
+ gpointer* data;
+ gpointer object;
+ data = user_data;
+ object = data[0];
+ if (strcmp (property_name, "HasTracklist") == 0) {
+ _dbus_mpris_root_set_HasTracklist (object, value);
+ return TRUE;
+ } else if (strcmp (property_name, "CanQuit") == 0) {
+ _dbus_mpris_root_set_CanQuit (object, value);
+ return TRUE;
+ } else if (strcmp (property_name, "CanRaise") == 0) {
+ _dbus_mpris_root_set_CanRaise (object, value);
+ return TRUE;
+ } else if (strcmp (property_name, "Identity") == 0) {
+ _dbus_mpris_root_set_Identity (object, value);
+ return TRUE;
+ } else if (strcmp (property_name, "DesktopEntry") == 0) {
+ _dbus_mpris_root_set_DesktopEntry (object, value);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+guint mpris_root_register_object (gpointer object, GDBusConnection* connection, const gchar* path, GError** error) {
+ guint result;
+ gpointer *data;
+ data = g_new (gpointer, 3);
+ data[0] = g_object_ref (object);
+ data[1] = g_object_ref (connection);
+ data[2] = g_strdup (path);
+ result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) (&_mpris_root_dbus_interface_info), &_mpris_root_dbus_interface_vtable, data, _mpris_root_unregister_object, error);
+ if (!result) {
+ return 0;
+ }
+ return result;
+}
+
+
+static void _mpris_root_unregister_object (gpointer user_data) {
+ gpointer* data;
+ data = user_data;
+ g_object_unref (data[0]);
+ g_object_unref (data[1]);
+ g_free (data[2]);
+ g_free (data);
+}
+
+
+void mpris_player_PlayPause (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
+ MPRIS_PLAYER_GET_INTERFACE (self)->PlayPause (self, _callback_, _user_data_);
+}
+
+
+void mpris_player_PlayPause_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error) {
+ MPRIS_PLAYER_GET_INTERFACE (self)->PlayPause_finish (self, _res_, error);
+}
+
+
+void mpris_player_Next (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
+ MPRIS_PLAYER_GET_INTERFACE (self)->Next (self, _callback_, _user_data_);
+}
+
+
+void mpris_player_Next_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error) {
+ MPRIS_PLAYER_GET_INTERFACE (self)->Next_finish (self, _res_, error);
+}
+
+
+void mpris_player_Previous (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
+ MPRIS_PLAYER_GET_INTERFACE (self)->Previous (self, _callback_, _user_data_);
+}
+
+
+void mpris_player_Previous_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error) {
+ MPRIS_PLAYER_GET_INTERFACE (self)->Previous_finish (self, _res_, error);
+}
+
+
+void mpris_player_Seek (MprisPlayer* self, gint64 offset, GAsyncReadyCallback _callback_, gpointer _user_data_) {
+ MPRIS_PLAYER_GET_INTERFACE (self)->Seek (self, offset, _callback_, _user_data_);
+}
+
+
+void mpris_player_Seek_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error) {
+ MPRIS_PLAYER_GET_INTERFACE (self)->Seek_finish (self, _res_, error);
+}
+
+
+GHashTable* mpris_player_get_Metadata (MprisPlayer* self) {
+ g_return_val_if_fail (self != NULL, NULL);
+ return MPRIS_PLAYER_GET_INTERFACE (self)->get_Metadata (self);
+}
+
+
+void mpris_player_set_Metadata (MprisPlayer* self, GHashTable* value) {
+ g_return_if_fail (self != NULL);
+ MPRIS_PLAYER_GET_INTERFACE (self)->set_Metadata (self, value);
+}
+
+
+gint32 mpris_player_get_Position (MprisPlayer* self) {
+ g_return_val_if_fail (self != NULL, 0);
+ return MPRIS_PLAYER_GET_INTERFACE (self)->get_Position (self);
+}
+
+
+void mpris_player_set_Position (MprisPlayer* self, gint32 value) {
+ g_return_if_fail (self != NULL);
+ MPRIS_PLAYER_GET_INTERFACE (self)->set_Position (self, value);
+}
+
+
+gchar* mpris_player_get_PlaybackStatus (MprisPlayer* self) {
+ g_return_val_if_fail (self != NULL, NULL);
+ return MPRIS_PLAYER_GET_INTERFACE (self)->get_PlaybackStatus (self);
+}
+
+
+void mpris_player_set_PlaybackStatus (MprisPlayer* self, const gchar* value) {
+ g_return_if_fail (self != NULL);
+ MPRIS_PLAYER_GET_INTERFACE (self)->set_PlaybackStatus (self, value);
+}
+
+
+static void g_cclosure_user_marshal_VOID__INT64 (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data) {
+ typedef void (*GMarshalFunc_VOID__INT64) (gpointer data1, gint64 arg_1, gpointer data2);
+ register GMarshalFunc_VOID__INT64 callback;
+ register GCClosure * cc;
+ register gpointer data1;
+ register gpointer data2;
+ cc = (GCClosure *) closure;
+ g_return_if_fail (n_param_values == 2);
+ if (G_CCLOSURE_SWAP_DATA (closure)) {
+ data1 = closure->data;
+ data2 = param_values->data[0].v_pointer;
+ } else {
+ data1 = param_values->data[0].v_pointer;
+ data2 = closure->data;
+ }
+ callback = (GMarshalFunc_VOID__INT64) (marshal_data ? marshal_data : cc->callback);
+ callback (data1, g_value_get_int64 (param_values + 1), data2);
+}
+
+
+static void mpris_player_base_init (MprisPlayerIface * iface) {
+ static gboolean initialized = FALSE;
+ if (!initialized) {
+ initialized = TRUE;
+ g_signal_new ("seeked", TYPE_MPRIS_PLAYER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__INT64, G_TYPE_NONE, 1, G_TYPE_INT64);
+ }
+}
+
+
+GType mpris_player_get_type (void) {
+ static volatile gsize mpris_player_type_id__volatile = 0;
+ if (g_once_init_enter (&mpris_player_type_id__volatile)) {
+ static const GTypeInfo g_define_type_info = { sizeof (MprisPlayerIface), (GBaseInitFunc) mpris_player_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
+ GType mpris_player_type_id;
+ mpris_player_type_id = g_type_register_static (G_TYPE_INTERFACE, "MprisPlayer", &g_define_type_info, 0);
+ g_type_interface_add_prerequisite (mpris_player_type_id, G_TYPE_OBJECT);
+ g_type_set_qdata (mpris_player_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) mpris_player_proxy_get_type);
+ g_type_set_qdata (mpris_player_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), "org.mpris.MediaPlayer2.Player");
+ g_type_set_qdata (mpris_player_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) mpris_player_register_object);
+ g_once_init_leave (&mpris_player_type_id__volatile, mpris_player_type_id);
+ }
+ return mpris_player_type_id__volatile;
+}
+
+
+G_DEFINE_TYPE_EXTENDED (MprisPlayerProxy, mpris_player_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_MPRIS_PLAYER, mpris_player_proxy_mpris_player_interface_init) )
+static void mpris_player_proxy_class_init (MprisPlayerProxyClass* klass) {
+ G_DBUS_PROXY_CLASS (klass)->g_signal = mpris_player_proxy_g_signal;
+}
+
+
+static void _dbus_handle_mpris_player_seeked (MprisPlayer* self, GVariant* parameters) {
+ GVariantIter _arguments_iter;
+ gint64 new_position = 0LL;
+ GVariant* _tmp0_;
+ g_variant_iter_init (&_arguments_iter, parameters);
+ _tmp0_ = g_variant_iter_next_value (&_arguments_iter);
+ new_position = g_variant_get_int64 (_tmp0_);
+ g_variant_unref (_tmp0_);
+ g_signal_emit_by_name (self, "seeked", new_position);
+}
+
+
+static void mpris_player_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters) {
+ if (strcmp (signal_name, "Seeked") == 0) {
+ _dbus_handle_mpris_player_seeked ((MprisPlayer*) proxy, parameters);
+ }
+}
+
+
+static void mpris_player_proxy_init (MprisPlayerProxy* self) {
+}
+
+
+static void mpris_player_proxy_PlayPause_async (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
+ GDBusMessage *_message;
+ GVariant *_arguments;
+ GVariantBuilder _arguments_builder;
+ G_IO_ERROR;
+ _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.mpris.MediaPlayer2.Player", "PlayPause");
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ g_dbus_message_set_body (_message, _arguments);
+ 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));
+ g_object_unref (_message);
+}
+
+
+static void mpris_player_proxy_PlayPause_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error) {
+ GDBusMessage *_reply_message;
+ _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);
+ if (!_reply_message) {
+ return;
+ }
+ if (g_dbus_message_to_gerror (_reply_message, error)) {
+ g_object_unref (_reply_message);
+ return;
+ }
+ g_object_unref (_reply_message);
+}
+
+
+static void mpris_player_proxy_Next_async (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
+ GDBusMessage *_message;
+ GVariant *_arguments;
+ GVariantBuilder _arguments_builder;
+ G_IO_ERROR;
+ _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.mpris.MediaPlayer2.Player", "Next");
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ g_dbus_message_set_body (_message, _arguments);
+ 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));
+ g_object_unref (_message);
+}
+
+
+static void mpris_player_proxy_Next_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error) {
+ GDBusMessage *_reply_message;
+ _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);
+ if (!_reply_message) {
+ return;
+ }
+ if (g_dbus_message_to_gerror (_reply_message, error)) {
+ g_object_unref (_reply_message);
+ return;
+ }
+ g_object_unref (_reply_message);
+}
+
+
+static void mpris_player_proxy_Previous_async (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
+ GDBusMessage *_message;
+ GVariant *_arguments;
+ GVariantBuilder _arguments_builder;
+ G_IO_ERROR;
+ _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.mpris.MediaPlayer2.Player", "Previous");
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ g_dbus_message_set_body (_message, _arguments);
+ 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));
+ g_object_unref (_message);
+}
+
+
+static void mpris_player_proxy_Previous_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error) {
+ GDBusMessage *_reply_message;
+ _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);
+ if (!_reply_message) {
+ return;
+ }
+ if (g_dbus_message_to_gerror (_reply_message, error)) {
+ g_object_unref (_reply_message);
+ return;
+ }
+ g_object_unref (_reply_message);
+}
+
+
+static void mpris_player_proxy_Seek_async (MprisPlayer* self, gint64 offset, GAsyncReadyCallback _callback_, gpointer _user_data_) {
+ GDBusMessage *_message;
+ GVariant *_arguments;
+ GVariantBuilder _arguments_builder;
+ G_IO_ERROR;
+ _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.mpris.MediaPlayer2.Player", "Seek");
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_int64 (offset));
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ g_dbus_message_set_body (_message, _arguments);
+ 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));
+ g_object_unref (_message);
+}
+
+
+static void mpris_player_proxy_Seek_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error) {
+ GDBusMessage *_reply_message;
+ _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);
+ if (!_reply_message) {
+ return;
+ }
+ if (g_dbus_message_to_gerror (_reply_message, error)) {
+ g_object_unref (_reply_message);
+ return;
+ }
+ g_object_unref (_reply_message);
+}
+
+
+static GHashTable* mpris_player_dbus_proxy_get_Metadata (MprisPlayer* self) {
+ GVariant *_inner_reply;
+ GHashTable* _result;
+ GHashTable* _tmp1_;
+ GVariantIter _tmp2_;
+ GVariant* _tmp3_;
+ GVariant* _tmp4_;
+ _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "Metadata");
+ if (!_inner_reply) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2.Player"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("Metadata"));
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return NULL;
+ }
+ g_variant_get (_reply, "(v)", &_inner_reply);
+ g_variant_unref (_reply);
+ }
+ _tmp1_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+ g_variant_iter_init (&_tmp2_, _inner_reply);
+ while (g_variant_iter_loop (&_tmp2_, "{?*}", &_tmp3_, &_tmp4_)) {
+ g_hash_table_insert (_tmp1_, g_variant_dup_string (_tmp3_, NULL), g_variant_get_variant (_tmp4_));
+ }
+ _result = _tmp1_;
+ g_variant_unref (_inner_reply);
+ return _result;
+}
+
+
+static void mpris_player_dbus_proxy_set_Metadata (MprisPlayer* self, GHashTable* value) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ GVariantBuilder _tmp5_;
+ GHashTableIter _tmp6_;
+ gpointer _tmp7_;
+ gpointer _tmp8_;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2.Player"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("Metadata"));
+ g_variant_builder_open (&_arguments_builder, G_VARIANT_TYPE_VARIANT);
+ g_hash_table_iter_init (&_tmp6_, value);
+ g_variant_builder_init (&_tmp5_, G_VARIANT_TYPE ("a{sv}"));
+ while (g_hash_table_iter_next (&_tmp6_, &_tmp7_, &_tmp8_)) {
+ gchar* _key;
+ GVariant* _value;
+ _key = (gchar*) _tmp7_;
+ _value = (GVariant*) _tmp8_;
+ g_variant_builder_add (&_tmp5_, "{?*}", g_variant_new_string (_key), g_variant_new_variant (_value));
+ }
+ g_variant_builder_add_value (&_arguments_builder, g_variant_builder_end (&_tmp5_));
+ g_variant_builder_close (&_arguments_builder);
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Set", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return;
+ }
+ g_variant_unref (_reply);
+}
+
+
+static gint32 mpris_player_dbus_proxy_get_Position (MprisPlayer* self) {
+ GVariant *_inner_reply;
+ gint32 _result;
+ _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "Position");
+ if (!_inner_reply) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2.Player"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("Position"));
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return 0;
+ }
+ g_variant_get (_reply, "(v)", &_inner_reply);
+ g_variant_unref (_reply);
+ }
+ _result = g_variant_get_int32 (_inner_reply);
+ g_variant_unref (_inner_reply);
+ return _result;
+}
+
+
+static void mpris_player_dbus_proxy_set_Position (MprisPlayer* self, gint32 value) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2.Player"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("Position"));
+ g_variant_builder_open (&_arguments_builder, G_VARIANT_TYPE_VARIANT);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (value));
+ g_variant_builder_close (&_arguments_builder);
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Set", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return;
+ }
+ g_variant_unref (_reply);
+}
+
+
+static gchar* mpris_player_dbus_proxy_get_PlaybackStatus (MprisPlayer* self) {
+ GVariant *_inner_reply;
+ gchar* _result;
+ _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "PlaybackStatus");
+ if (!_inner_reply) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2.Player"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("PlaybackStatus"));
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return NULL;
+ }
+ g_variant_get (_reply, "(v)", &_inner_reply);
+ g_variant_unref (_reply);
+ }
+ _result = g_variant_dup_string (_inner_reply, NULL);
+ g_variant_unref (_inner_reply);
+ return _result;
+}
+
+
+static void mpris_player_dbus_proxy_set_PlaybackStatus (MprisPlayer* self, const gchar* value) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2.Player"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("PlaybackStatus"));
+ g_variant_builder_open (&_arguments_builder, G_VARIANT_TYPE_VARIANT);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (value));
+ g_variant_builder_close (&_arguments_builder);
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Set", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return;
+ }
+ g_variant_unref (_reply);
+}
+
+
+static void mpris_player_proxy_mpris_player_interface_init (MprisPlayerIface* iface) {
+ iface->PlayPause = mpris_player_proxy_PlayPause_async;
+ iface->PlayPause_finish = mpris_player_proxy_PlayPause_finish;
+ iface->Next = mpris_player_proxy_Next_async;
+ iface->Next_finish = mpris_player_proxy_Next_finish;
+ iface->Previous = mpris_player_proxy_Previous_async;
+ iface->Previous_finish = mpris_player_proxy_Previous_finish;
+ iface->Seek = mpris_player_proxy_Seek_async;
+ iface->Seek_finish = mpris_player_proxy_Seek_finish;
+ iface->get_Metadata = mpris_player_dbus_proxy_get_Metadata;
+ iface->set_Metadata = mpris_player_dbus_proxy_set_Metadata;
+ iface->get_Position = mpris_player_dbus_proxy_get_Position;
+ iface->set_Position = mpris_player_dbus_proxy_set_Position;
+ iface->get_PlaybackStatus = mpris_player_dbus_proxy_get_PlaybackStatus;
+ iface->set_PlaybackStatus = mpris_player_dbus_proxy_set_PlaybackStatus;
+}
+
+
+static void _dbus_mpris_player_PlayPause (MprisPlayer* self, GVariant* parameters, GDBusMethodInvocation* invocation) {
+ GVariantIter _arguments_iter;
+ g_variant_iter_init (&_arguments_iter, parameters);
+ mpris_player_PlayPause (self, (GAsyncReadyCallback) _dbus_mpris_player_PlayPause_ready, invocation);
+}
+
+
+static void _dbus_mpris_player_PlayPause_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_) {
+ GDBusMethodInvocation * invocation;
+ GError* error = NULL;
+ GDBusMessage* _reply_message;
+ GVariant* _reply;
+ GVariantBuilder _reply_builder;
+ invocation = _user_data_;
+ mpris_player_PlayPause_finish ((MprisPlayer*) source_object, _res_, &error);
+ if (error) {
+ g_dbus_method_invocation_return_gerror (invocation, error);
+ return;
+ }
+ _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+ g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+ _reply = g_variant_builder_end (&_reply_builder);
+ g_dbus_message_set_body (_reply_message, _reply);
+ g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+ g_object_unref (invocation);
+ g_object_unref (_reply_message);
+}
+
+
+static void _dbus_mpris_player_Next (MprisPlayer* self, GVariant* parameters, GDBusMethodInvocation* invocation) {
+ GVariantIter _arguments_iter;
+ g_variant_iter_init (&_arguments_iter, parameters);
+ mpris_player_Next (self, (GAsyncReadyCallback) _dbus_mpris_player_Next_ready, invocation);
+}
+
+
+static void _dbus_mpris_player_Next_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_) {
+ GDBusMethodInvocation * invocation;
+ GError* error = NULL;
+ GDBusMessage* _reply_message;
+ GVariant* _reply;
+ GVariantBuilder _reply_builder;
+ invocation = _user_data_;
+ mpris_player_Next_finish ((MprisPlayer*) source_object, _res_, &error);
+ if (error) {
+ g_dbus_method_invocation_return_gerror (invocation, error);
+ return;
+ }
+ _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+ g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+ _reply = g_variant_builder_end (&_reply_builder);
+ g_dbus_message_set_body (_reply_message, _reply);
+ g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+ g_object_unref (invocation);
+ g_object_unref (_reply_message);
+}
+
+
+static void _dbus_mpris_player_Previous (MprisPlayer* self, GVariant* parameters, GDBusMethodInvocation* invocation) {
+ GVariantIter _arguments_iter;
+ g_variant_iter_init (&_arguments_iter, parameters);
+ mpris_player_Previous (self, (GAsyncReadyCallback) _dbus_mpris_player_Previous_ready, invocation);
+}
+
+
+static void _dbus_mpris_player_Previous_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_) {
+ GDBusMethodInvocation * invocation;
+ GError* error = NULL;
+ GDBusMessage* _reply_message;
+ GVariant* _reply;
+ GVariantBuilder _reply_builder;
+ invocation = _user_data_;
+ mpris_player_Previous_finish ((MprisPlayer*) source_object, _res_, &error);
+ if (error) {
+ g_dbus_method_invocation_return_gerror (invocation, error);
+ return;
+ }
+ _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+ g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+ _reply = g_variant_builder_end (&_reply_builder);
+ g_dbus_message_set_body (_reply_message, _reply);
+ g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+ g_object_unref (invocation);
+ g_object_unref (_reply_message);
+}
+
+
+static void _dbus_mpris_player_Seek (MprisPlayer* self, GVariant* parameters, GDBusMethodInvocation* invocation) {
+ GVariantIter _arguments_iter;
+ gint64 offset = 0LL;
+ GVariant* _tmp9_;
+ g_variant_iter_init (&_arguments_iter, parameters);
+ _tmp9_ = g_variant_iter_next_value (&_arguments_iter);
+ offset = g_variant_get_int64 (_tmp9_);
+ g_variant_unref (_tmp9_);
+ mpris_player_Seek (self, offset, (GAsyncReadyCallback) _dbus_mpris_player_Seek_ready, invocation);
+}
+
+
+static void _dbus_mpris_player_Seek_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_) {
+ GDBusMethodInvocation * invocation;
+ GError* error = NULL;
+ GDBusMessage* _reply_message;
+ GVariant* _reply;
+ GVariantBuilder _reply_builder;
+ invocation = _user_data_;
+ mpris_player_Seek_finish ((MprisPlayer*) source_object, _res_, &error);
+ if (error) {
+ g_dbus_method_invocation_return_gerror (invocation, error);
+ return;
+ }
+ _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+ g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+ _reply = g_variant_builder_end (&_reply_builder);
+ g_dbus_message_set_body (_reply_message, _reply);
+ g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+ g_object_unref (invocation);
+ g_object_unref (_reply_message);
+}
+
+
+static void 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) {
+ gpointer* data;
+ gpointer object;
+ data = user_data;
+ object = data[0];
+ if (strcmp (method_name, "PlayPause") == 0) {
+ _dbus_mpris_player_PlayPause (object, parameters, invocation);
+ } else if (strcmp (method_name, "Next") == 0) {
+ _dbus_mpris_player_Next (object, parameters, invocation);
+ } else if (strcmp (method_name, "Previous") == 0) {
+ _dbus_mpris_player_Previous (object, parameters, invocation);
+ } else if (strcmp (method_name, "Seek") == 0) {
+ _dbus_mpris_player_Seek (object, parameters, invocation);
+ } else {
+ g_object_unref (invocation);
+ }
+}
+
+
+static GVariant* _dbus_mpris_player_get_Metadata (MprisPlayer* self) {
+ GHashTable* result;
+ GVariantBuilder _tmp10_;
+ GHashTableIter _tmp11_;
+ gpointer _tmp12_;
+ gpointer _tmp13_;
+ GVariant* _reply;
+ result = mpris_player_get_Metadata (self);
+ g_hash_table_iter_init (&_tmp11_, result);
+ g_variant_builder_init (&_tmp10_, G_VARIANT_TYPE ("a{sv}"));
+ while (g_hash_table_iter_next (&_tmp11_, &_tmp12_, &_tmp13_)) {
+ gchar* _key;
+ GVariant* _value;
+ _key = (gchar*) _tmp12_;
+ _value = (GVariant*) _tmp13_;
+ g_variant_builder_add (&_tmp10_, "{?*}", g_variant_new_string (_key), g_variant_new_variant (_value));
+ }
+ _reply = g_variant_builder_end (&_tmp10_);
+ _g_hash_table_unref0 (result);
+ return _reply;
+}
+
+
+static GVariant* _dbus_mpris_player_get_Position (MprisPlayer* self) {
+ gint32 result;
+ GVariant* _reply;
+ result = mpris_player_get_Position (self);
+ _reply = g_variant_new_int32 (result);
+ return _reply;
+}
+
+
+static GVariant* _dbus_mpris_player_get_PlaybackStatus (MprisPlayer* self) {
+ gchar* result;
+ GVariant* _reply;
+ result = mpris_player_get_PlaybackStatus (self);
+ _reply = g_variant_new_string (result);
+ _g_free0 (result);
+ return _reply;
+}
+
+
+static GVariant* 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) {
+ gpointer* data;
+ gpointer object;
+ data = user_data;
+ object = data[0];
+ if (strcmp (property_name, "Metadata") == 0) {
+ return _dbus_mpris_player_get_Metadata (object);
+ } else if (strcmp (property_name, "Position") == 0) {
+ return _dbus_mpris_player_get_Position (object);
+ } else if (strcmp (property_name, "PlaybackStatus") == 0) {
+ return _dbus_mpris_player_get_PlaybackStatus (object);
+ }
+ return NULL;
+}
+
+
+static void _dbus_mpris_player_set_Metadata (MprisPlayer* self, GVariant* _value) {
+ GHashTable* value = NULL;
+ GHashTable* _tmp14_;
+ GVariantIter _tmp15_;
+ GVariant* _tmp16_;
+ GVariant* _tmp17_;
+ _tmp14_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+ g_variant_iter_init (&_tmp15_, _value);
+ while (g_variant_iter_loop (&_tmp15_, "{?*}", &_tmp16_, &_tmp17_)) {
+ g_hash_table_insert (_tmp14_, g_variant_dup_string (_tmp16_, NULL), g_variant_get_variant (_tmp17_));
+ }
+ value = _tmp14_;
+ mpris_player_set_Metadata (self, value);
+ _g_hash_table_unref0 (value);
+}
+
+
+static void _dbus_mpris_player_set_Position (MprisPlayer* self, GVariant* _value) {
+ gint32 value = 0;
+ value = g_variant_get_int32 (_value);
+ mpris_player_set_Position (self, value);
+}
+
+
+static void _dbus_mpris_player_set_PlaybackStatus (MprisPlayer* self, GVariant* _value) {
+ gchar* value = NULL;
+ value = g_variant_dup_string (_value, NULL);
+ mpris_player_set_PlaybackStatus (self, value);
+ _g_free0 (value);
+}
+
+
+static gboolean 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) {
+ gpointer* data;
+ gpointer object;
+ data = user_data;
+ object = data[0];
+ if (strcmp (property_name, "Metadata") == 0) {
+ _dbus_mpris_player_set_Metadata (object, value);
+ return TRUE;
+ } else if (strcmp (property_name, "Position") == 0) {
+ _dbus_mpris_player_set_Position (object, value);
+ return TRUE;
+ } else if (strcmp (property_name, "PlaybackStatus") == 0) {
+ _dbus_mpris_player_set_PlaybackStatus (object, value);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+static void _dbus_mpris_player_seeked (GObject* _sender, gint64 new_position, gpointer* _data) {
+ GDBusConnection * _connection;
+ const gchar * _path;
+ GVariant *_arguments;
+ GVariantBuilder _arguments_builder;
+ _connection = _data[1];
+ _path = _data[2];
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_int64 (new_position));
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ g_dbus_connection_emit_signal (_connection, NULL, _path, "org.mpris.MediaPlayer2.Player", "Seeked", _arguments, NULL);
+}
+
+
+guint mpris_player_register_object (gpointer object, GDBusConnection* connection, const gchar* path, GError** error) {
+ guint result;
+ gpointer *data;
+ data = g_new (gpointer, 3);
+ data[0] = g_object_ref (object);
+ data[1] = g_object_ref (connection);
+ data[2] = g_strdup (path);
+ result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) (&_mpris_player_dbus_interface_info), &_mpris_player_dbus_interface_vtable, data, _mpris_player_unregister_object, error);
+ if (!result) {
+ return 0;
+ }
+ g_signal_connect (object, "seeked", (GCallback) _dbus_mpris_player_seeked, data);
+ return result;
+}
+
+
+static void _mpris_player_unregister_object (gpointer user_data) {
+ gpointer* data;
+ data = user_data;
+ g_signal_handlers_disconnect_by_func (data[0], _dbus_mpris_player_seeked, data);
+ g_object_unref (data[0]);
+ g_object_unref (data[1]);
+ g_free (data[2]);
+ g_free (data);
+}
+
+
+void playlist_details_copy (const PlaylistDetails* self, PlaylistDetails* dest) {
+ const char* _tmp0_;
+ char* _tmp1_;
+ const gchar* _tmp2_;
+ gchar* _tmp3_;
+ const gchar* _tmp4_;
+ gchar* _tmp5_;
+ _tmp0_ = (*self).path;
+ _tmp1_ = g_strdup (_tmp0_);
+ _g_free0 ((*dest).path);
+ (*dest).path = _tmp1_;
+ _tmp2_ = (*self).name;
+ _tmp3_ = g_strdup (_tmp2_);
+ _g_free0 ((*dest).name);
+ (*dest).name = _tmp3_;
+ _tmp4_ = (*self).icon_path;
+ _tmp5_ = g_strdup (_tmp4_);
+ _g_free0 ((*dest).icon_path);
+ (*dest).icon_path = _tmp5_;
+}
+
+
+void playlist_details_destroy (PlaylistDetails* self) {
+ _g_free0 ((*self).path);
+ _g_free0 ((*self).name);
+ _g_free0 ((*self).icon_path);
+}
+
+
+PlaylistDetails* playlist_details_dup (const PlaylistDetails* self) {
+ PlaylistDetails* dup;
+ dup = g_new0 (PlaylistDetails, 1);
+ playlist_details_copy (self, dup);
+ return dup;
+}
+
+
+void playlist_details_free (PlaylistDetails* self) {
+ playlist_details_destroy (self);
+ g_free (self);
+}
+
+
+GType playlist_details_get_type (void) {
+ static volatile gsize playlist_details_type_id__volatile = 0;
+ if (g_once_init_enter (&playlist_details_type_id__volatile)) {
+ GType playlist_details_type_id;
+ playlist_details_type_id = g_boxed_type_register_static ("PlaylistDetails", (GBoxedCopyFunc) playlist_details_dup, (GBoxedFreeFunc) playlist_details_free);
+ g_once_init_leave (&playlist_details_type_id__volatile, playlist_details_type_id);
+ }
+ return playlist_details_type_id__volatile;
+}
+
+
+static gpointer _playlist_details_dup0 (gpointer self) {
+ return self ? playlist_details_dup (self) : NULL;
+}
+
+
+void active_playlist_container_copy (const ActivePlaylistContainer* self, ActivePlaylistContainer* dest) {
+ gboolean _tmp0_;
+ PlaylistDetails* _tmp1_;
+ PlaylistDetails* _tmp2_;
+ _tmp0_ = (*self).valid;
+ (*dest).valid = _tmp0_;
+ _tmp1_ = (*self).details;
+ _tmp2_ = _playlist_details_dup0 (_tmp1_);
+ _playlist_details_free0 ((*dest).details);
+ (*dest).details = _tmp2_;
+}
+
+
+void active_playlist_container_destroy (ActivePlaylistContainer* self) {
+ _playlist_details_free0 ((*self).details);
+}
+
+
+ActivePlaylistContainer* active_playlist_container_dup (const ActivePlaylistContainer* self) {
+ ActivePlaylistContainer* dup;
+ dup = g_new0 (ActivePlaylistContainer, 1);
+ active_playlist_container_copy (self, dup);
+ return dup;
+}
+
+
+void active_playlist_container_free (ActivePlaylistContainer* self) {
+ active_playlist_container_destroy (self);
+ g_free (self);
+}
+
+
+GType active_playlist_container_get_type (void) {
+ static volatile gsize active_playlist_container_type_id__volatile = 0;
+ if (g_once_init_enter (&active_playlist_container_type_id__volatile)) {
+ GType active_playlist_container_type_id;
+ active_playlist_container_type_id = g_boxed_type_register_static ("ActivePlaylistContainer", (GBoxedCopyFunc) active_playlist_container_dup, (GBoxedFreeFunc) active_playlist_container_free);
+ g_once_init_leave (&active_playlist_container_type_id__volatile, active_playlist_container_type_id);
+ }
+ return active_playlist_container_type_id__volatile;
+}
+
+
+void mpris_playlists_ActivatePlaylist (MprisPlaylists* self, const char* playlist_id, GAsyncReadyCallback _callback_, gpointer _user_data_) {
+ MPRIS_PLAYLISTS_GET_INTERFACE (self)->ActivatePlaylist (self, playlist_id, _callback_, _user_data_);
+}
+
+
+void mpris_playlists_ActivatePlaylist_finish (MprisPlaylists* self, GAsyncResult* _res_, GError** error) {
+ MPRIS_PLAYLISTS_GET_INTERFACE (self)->ActivatePlaylist_finish (self, _res_, error);
+}
+
+
+void mpris_playlists_GetPlaylists (MprisPlaylists* self, guint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, GAsyncReadyCallback _callback_, gpointer _user_data_) {
+ MPRIS_PLAYLISTS_GET_INTERFACE (self)->GetPlaylists (self, index, max_count, order, reverse_order, _callback_, _user_data_);
+}
+
+
+PlaylistDetails* mpris_playlists_GetPlaylists_finish (MprisPlaylists* self, GAsyncResult* _res_, int* result_length1, GError** error) {
+ return MPRIS_PLAYLISTS_GET_INTERFACE (self)->GetPlaylists_finish (self, _res_, result_length1, error);
+}
+
+
+gchar** mpris_playlists_get_Orderings (MprisPlaylists* self, int* result_length1) {
+ g_return_val_if_fail (self != NULL, NULL);
+ return MPRIS_PLAYLISTS_GET_INTERFACE (self)->get_Orderings (self, result_length1);
+}
+
+
+void mpris_playlists_set_Orderings (MprisPlaylists* self, gchar** value, int value_length1) {
+ g_return_if_fail (self != NULL);
+ MPRIS_PLAYLISTS_GET_INTERFACE (self)->set_Orderings (self, value, value_length1);
+}
+
+
+guint32 mpris_playlists_get_PlaylistCount (MprisPlaylists* self) {
+ g_return_val_if_fail (self != NULL, 0U);
+ return MPRIS_PLAYLISTS_GET_INTERFACE (self)->get_PlaylistCount (self);
+}
+
+
+void mpris_playlists_set_PlaylistCount (MprisPlaylists* self, guint32 value) {
+ g_return_if_fail (self != NULL);
+ MPRIS_PLAYLISTS_GET_INTERFACE (self)->set_PlaylistCount (self, value);
+}
+
+
+void mpris_playlists_get_ActivePlaylist (MprisPlaylists* self, ActivePlaylistContainer* result) {
+ g_return_if_fail (self != NULL);
+ MPRIS_PLAYLISTS_GET_INTERFACE (self)->get_ActivePlaylist (self, result);
+}
+
+
+void mpris_playlists_set_ActivePlaylist (MprisPlaylists* self, ActivePlaylistContainer* value) {
+ g_return_if_fail (self != NULL);
+ MPRIS_PLAYLISTS_GET_INTERFACE (self)->set_ActivePlaylist (self, value);
+}
+
+
+static void g_cclosure_user_marshal_VOID__BOXED (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data) {
+ typedef void (*GMarshalFunc_VOID__BOXED) (gpointer data1, gpointer arg_1, gpointer data2);
+ register GMarshalFunc_VOID__BOXED callback;
+ register GCClosure * cc;
+ register gpointer data1;
+ register gpointer data2;
+ cc = (GCClosure *) closure;
+ g_return_if_fail (n_param_values == 2);
+ if (G_CCLOSURE_SWAP_DATA (closure)) {
+ data1 = closure->data;
+ data2 = param_values->data[0].v_pointer;
+ } else {
+ data1 = param_values->data[0].v_pointer;
+ data2 = closure->data;
+ }
+ callback = (GMarshalFunc_VOID__BOXED) (marshal_data ? marshal_data : cc->callback);
+ callback (data1, g_value_get_boxed (param_values + 1), data2);
+}
+
+
+static void mpris_playlists_base_init (MprisPlaylistsIface * iface) {
+ static gboolean initialized = FALSE;
+ if (!initialized) {
+ initialized = TRUE;
+ g_signal_new ("playlist_changed", TYPE_MPRIS_PLAYLISTS, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__BOXED, G_TYPE_NONE, 1, TYPE_PLAYLIST_DETAILS);
+ }
+}
+
+
+GType mpris_playlists_get_type (void) {
+ static volatile gsize mpris_playlists_type_id__volatile = 0;
+ if (g_once_init_enter (&mpris_playlists_type_id__volatile)) {
+ static const GTypeInfo g_define_type_info = { sizeof (MprisPlaylistsIface), (GBaseInitFunc) mpris_playlists_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
+ GType mpris_playlists_type_id;
+ mpris_playlists_type_id = g_type_register_static (G_TYPE_INTERFACE, "MprisPlaylists", &g_define_type_info, 0);
+ g_type_interface_add_prerequisite (mpris_playlists_type_id, G_TYPE_OBJECT);
+ g_type_set_qdata (mpris_playlists_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) mpris_playlists_proxy_get_type);
+ g_type_set_qdata (mpris_playlists_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), "org.mpris.MediaPlayer2.Playlists");
+ g_type_set_qdata (mpris_playlists_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) mpris_playlists_register_object);
+ g_once_init_leave (&mpris_playlists_type_id__volatile, mpris_playlists_type_id);
+ }
+ return mpris_playlists_type_id__volatile;
+}
+
+
+G_DEFINE_TYPE_EXTENDED (MprisPlaylistsProxy, mpris_playlists_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_MPRIS_PLAYLISTS, mpris_playlists_proxy_mpris_playlists_interface_init) )
+static void mpris_playlists_proxy_class_init (MprisPlaylistsProxyClass* klass) {
+ G_DBUS_PROXY_CLASS (klass)->g_signal = mpris_playlists_proxy_g_signal;
+}
+
+
+static void _dbus_handle_mpris_playlists_playlist_changed (MprisPlaylists* self, GVariant* parameters) {
+ GVariantIter _arguments_iter;
+ PlaylistDetails details = {0};
+ GVariant* _tmp18_;
+ PlaylistDetails _tmp19_;
+ GVariantIter _tmp20_;
+ GVariant* _tmp21_;
+ GVariant* _tmp22_;
+ GVariant* _tmp23_;
+ g_variant_iter_init (&_arguments_iter, parameters);
+ _tmp18_ = g_variant_iter_next_value (&_arguments_iter);
+ g_variant_iter_init (&_tmp20_, _tmp18_);
+ _tmp21_ = g_variant_iter_next_value (&_tmp20_);
+ _tmp19_.path = g_variant_dup_string (_tmp21_, NULL);
+ g_variant_unref (_tmp21_);
+ _tmp22_ = g_variant_iter_next_value (&_tmp20_);
+ _tmp19_.name = g_variant_dup_string (_tmp22_, NULL);
+ g_variant_unref (_tmp22_);
+ _tmp23_ = g_variant_iter_next_value (&_tmp20_);
+ _tmp19_.icon_path = g_variant_dup_string (_tmp23_, NULL);
+ g_variant_unref (_tmp23_);
+ details = _tmp19_;
+ g_variant_unref (_tmp18_);
+ g_signal_emit_by_name (self, "playlist-changed", &details);
+ playlist_details_destroy (&details);
+}
+
+
+static void mpris_playlists_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters) {
+ if (strcmp (signal_name, "PlaylistChanged") == 0) {
+ _dbus_handle_mpris_playlists_playlist_changed ((MprisPlaylists*) proxy, parameters);
+ }
+}
+
+
+static void mpris_playlists_proxy_init (MprisPlaylistsProxy* self) {
+}
+
+
+static void mpris_playlists_proxy_ActivatePlaylist_async (MprisPlaylists* self, const char* playlist_id, GAsyncReadyCallback _callback_, gpointer _user_data_) {
+ GDBusMessage *_message;
+ GVariant *_arguments;
+ GVariantBuilder _arguments_builder;
+ G_IO_ERROR;
+ _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.mpris.MediaPlayer2.Playlists", "ActivatePlaylist");
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_object_path (playlist_id));
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ g_dbus_message_set_body (_message, _arguments);
+ 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));
+ g_object_unref (_message);
+}
+
+
+static void mpris_playlists_proxy_ActivatePlaylist_finish (MprisPlaylists* self, GAsyncResult* _res_, GError** error) {
+ GDBusMessage *_reply_message;
+ _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);
+ if (!_reply_message) {
+ return;
+ }
+ if (g_dbus_message_to_gerror (_reply_message, error)) {
+ g_object_unref (_reply_message);
+ return;
+ }
+ g_object_unref (_reply_message);
+}
+
+
+static void mpris_playlists_proxy_GetPlaylists_async (MprisPlaylists* self, guint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, GAsyncReadyCallback _callback_, gpointer _user_data_) {
+ GDBusMessage *_message;
+ GVariant *_arguments;
+ GVariantBuilder _arguments_builder;
+ G_IO_ERROR;
+ _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.mpris.MediaPlayer2.Playlists", "GetPlaylists");
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_uint32 (index));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_uint32 (max_count));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (order));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_boolean (reverse_order));
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ g_dbus_message_set_body (_message, _arguments);
+ 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));
+ g_object_unref (_message);
+}
+
+
+static PlaylistDetails* mpris_playlists_proxy_GetPlaylists_finish (MprisPlaylists* self, GAsyncResult* _res_, int* result_length1, GError** error) {
+ GDBusMessage *_reply_message;
+ GVariant *_reply;
+ GVariantIter _reply_iter;
+ PlaylistDetails* _result;
+ int _result_length1;
+ GVariant* _tmp24_;
+ PlaylistDetails* _tmp25_;
+ int _tmp25__length;
+ int _tmp25__size;
+ int _tmp25__length1;
+ GVariantIter _tmp26_;
+ GVariant* _tmp27_;
+ _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);
+ if (!_reply_message) {
+ return NULL;
+ }
+ if (g_dbus_message_to_gerror (_reply_message, error)) {
+ g_object_unref (_reply_message);
+ return NULL;
+ }
+ _reply = g_dbus_message_get_body (_reply_message);
+ g_variant_iter_init (&_reply_iter, _reply);
+ _result_length1 = 0;
+ _tmp24_ = g_variant_iter_next_value (&_reply_iter);
+ _tmp25_ = g_new (PlaylistDetails, 5);
+ _tmp25__length = 0;
+ _tmp25__size = 4;
+ _tmp25__length1 = 0;
+ g_variant_iter_init (&_tmp26_, _tmp24_);
+ for (; (_tmp27_ = g_variant_iter_next_value (&_tmp26_)) != NULL; _tmp25__length1++) {
+ PlaylistDetails _tmp28_;
+ GVariantIter _tmp29_;
+ GVariant* _tmp30_;
+ GVariant* _tmp31_;
+ GVariant* _tmp32_;
+ if (_tmp25__size == _tmp25__length) {
+ _tmp25__size = 2 * _tmp25__size;
+ _tmp25_ = g_renew (PlaylistDetails, _tmp25_, _tmp25__size + 1);
+ }
+ g_variant_iter_init (&_tmp29_, _tmp27_);
+ _tmp30_ = g_variant_iter_next_value (&_tmp29_);
+ _tmp28_.path = g_variant_dup_string (_tmp30_, NULL);
+ g_variant_unref (_tmp30_);
+ _tmp31_ = g_variant_iter_next_value (&_tmp29_);
+ _tmp28_.name = g_variant_dup_string (_tmp31_, NULL);
+ g_variant_unref (_tmp31_);
+ _tmp32_ = g_variant_iter_next_value (&_tmp29_);
+ _tmp28_.icon_path = g_variant_dup_string (_tmp32_, NULL);
+ g_variant_unref (_tmp32_);
+ _tmp25_[_tmp25__length++] = _tmp28_;
+ g_variant_unref (_tmp27_);
+ }
+ _result_length1 = _tmp25__length1;
+ _result = _tmp25_;
+ g_variant_unref (_tmp24_);
+ *result_length1 = _result_length1;
+ g_object_unref (_reply_message);
+ return _result;
+}
+
+
+static gchar** mpris_playlists_dbus_proxy_get_Orderings (MprisPlaylists* self, int* result_length1) {
+ GVariant *_inner_reply;
+ gchar** _result;
+ int _result_length1;
+ gchar** _tmp33_;
+ int _tmp33__length;
+ int _tmp33__size;
+ int _tmp33__length1;
+ GVariantIter _tmp34_;
+ GVariant* _tmp35_;
+ _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "Orderings");
+ if (!_inner_reply) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2.Playlists"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("Orderings"));
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return NULL;
+ }
+ g_variant_get (_reply, "(v)", &_inner_reply);
+ g_variant_unref (_reply);
+ }
+ _result_length1 = 0;
+ _tmp33_ = g_new (gchar*, 5);
+ _tmp33__length = 0;
+ _tmp33__size = 4;
+ _tmp33__length1 = 0;
+ g_variant_iter_init (&_tmp34_, _inner_reply);
+ for (; (_tmp35_ = g_variant_iter_next_value (&_tmp34_)) != NULL; _tmp33__length1++) {
+ if (_tmp33__size == _tmp33__length) {
+ _tmp33__size = 2 * _tmp33__size;
+ _tmp33_ = g_renew (gchar*, _tmp33_, _tmp33__size + 1);
+ }
+ _tmp33_[_tmp33__length++] = g_variant_dup_string (_tmp35_, NULL);
+ g_variant_unref (_tmp35_);
+ }
+ _result_length1 = _tmp33__length1;
+ _tmp33_[_tmp33__length] = NULL;
+ _result = _tmp33_;
+ *result_length1 = _result_length1;
+ g_variant_unref (_inner_reply);
+ return _result;
+}
+
+
+static void mpris_playlists_dbus_proxy_set_Orderings (MprisPlaylists* self, gchar** value, int value_length1) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ gchar** _tmp36_;
+ GVariantBuilder _tmp37_;
+ int _tmp38_;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2.Playlists"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("Orderings"));
+ g_variant_builder_open (&_arguments_builder, G_VARIANT_TYPE_VARIANT);
+ _tmp36_ = value;
+ g_variant_builder_init (&_tmp37_, G_VARIANT_TYPE ("as"));
+ for (_tmp38_ = 0; _tmp38_ < value_length1; _tmp38_++) {
+ g_variant_builder_add_value (&_tmp37_, g_variant_new_string (*_tmp36_));
+ _tmp36_++;
+ }
+ g_variant_builder_add_value (&_arguments_builder, g_variant_builder_end (&_tmp37_));
+ g_variant_builder_close (&_arguments_builder);
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Set", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return;
+ }
+ g_variant_unref (_reply);
+}
+
+
+static guint32 mpris_playlists_dbus_proxy_get_PlaylistCount (MprisPlaylists* self) {
+ GVariant *_inner_reply;
+ guint32 _result;
+ _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "PlaylistCount");
+ if (!_inner_reply) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2.Playlists"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("PlaylistCount"));
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return 0U;
+ }
+ g_variant_get (_reply, "(v)", &_inner_reply);
+ g_variant_unref (_reply);
+ }
+ _result = g_variant_get_uint32 (_inner_reply);
+ g_variant_unref (_inner_reply);
+ return _result;
+}
+
+
+static void mpris_playlists_dbus_proxy_set_PlaylistCount (MprisPlaylists* self, guint32 value) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2.Playlists"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("PlaylistCount"));
+ g_variant_builder_open (&_arguments_builder, G_VARIANT_TYPE_VARIANT);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_uint32 (value));
+ g_variant_builder_close (&_arguments_builder);
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Set", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return;
+ }
+ g_variant_unref (_reply);
+}
+
+
+static void mpris_playlists_dbus_proxy_get_ActivePlaylist (MprisPlaylists* self, ActivePlaylistContainer* result) {
+ GVariant *_inner_reply;
+ ActivePlaylistContainer _tmp39_;
+ GVariantIter _tmp40_;
+ GVariant* _tmp41_;
+ GVariant* _tmp42_;
+ PlaylistDetails _tmp43_;
+ GVariantIter _tmp44_;
+ GVariant* _tmp45_;
+ GVariant* _tmp46_;
+ GVariant* _tmp47_;
+ _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "ActivePlaylist");
+ if (!_inner_reply) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2.Playlists"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("ActivePlaylist"));
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return;
+ }
+ g_variant_get (_reply, "(v)", &_inner_reply);
+ g_variant_unref (_reply);
+ }
+ g_variant_iter_init (&_tmp40_, _inner_reply);
+ _tmp41_ = g_variant_iter_next_value (&_tmp40_);
+ _tmp39_.valid = g_variant_get_boolean (_tmp41_);
+ g_variant_unref (_tmp41_);
+ _tmp42_ = g_variant_iter_next_value (&_tmp40_);
+ g_variant_iter_init (&_tmp44_, _tmp42_);
+ _tmp45_ = g_variant_iter_next_value (&_tmp44_);
+ _tmp43_.path = g_variant_dup_string (_tmp45_, NULL);
+ g_variant_unref (_tmp45_);
+ _tmp46_ = g_variant_iter_next_value (&_tmp44_);
+ _tmp43_.name = g_variant_dup_string (_tmp46_, NULL);
+ g_variant_unref (_tmp46_);
+ _tmp47_ = g_variant_iter_next_value (&_tmp44_);
+ _tmp43_.icon_path = g_variant_dup_string (_tmp47_, NULL);
+ g_variant_unref (_tmp47_);
+ _tmp39_.details = g_memdup (&_tmp43_, sizeof (PlaylistDetails));
+ g_variant_unref (_tmp42_);
+ *result = _tmp39_;
+ g_variant_unref (_inner_reply);
+ return;
+}
+
+
+static void mpris_playlists_dbus_proxy_set_ActivePlaylist (MprisPlaylists* self, ActivePlaylistContainer* value) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ GVariantBuilder _tmp48_;
+ GVariantBuilder _tmp49_;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2.Playlists"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("ActivePlaylist"));
+ g_variant_builder_open (&_arguments_builder, G_VARIANT_TYPE_VARIANT);
+ g_variant_builder_init (&_tmp48_, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_tmp48_, g_variant_new_boolean ((*value).valid));
+ g_variant_builder_init (&_tmp49_, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_tmp49_, g_variant_new_object_path ((*(*value).details).path));
+ g_variant_builder_add_value (&_tmp49_, g_variant_new_string ((*(*value).details).name));
+ g_variant_builder_add_value (&_tmp49_, g_variant_new_string ((*(*value).details).icon_path));
+ g_variant_builder_add_value (&_tmp48_, g_variant_builder_end (&_tmp49_));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_builder_end (&_tmp48_));
+ g_variant_builder_close (&_arguments_builder);
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Set", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return;
+ }
+ g_variant_unref (_reply);
+}
+
+
+static void mpris_playlists_proxy_mpris_playlists_interface_init (MprisPlaylistsIface* iface) {
+ iface->ActivatePlaylist = mpris_playlists_proxy_ActivatePlaylist_async;
+ iface->ActivatePlaylist_finish = mpris_playlists_proxy_ActivatePlaylist_finish;
+ iface->GetPlaylists = mpris_playlists_proxy_GetPlaylists_async;
+ iface->GetPlaylists_finish = mpris_playlists_proxy_GetPlaylists_finish;
+ iface->get_Orderings = mpris_playlists_dbus_proxy_get_Orderings;
+ iface->set_Orderings = mpris_playlists_dbus_proxy_set_Orderings;
+ iface->get_PlaylistCount = mpris_playlists_dbus_proxy_get_PlaylistCount;
+ iface->set_PlaylistCount = mpris_playlists_dbus_proxy_set_PlaylistCount;
+ iface->get_ActivePlaylist = mpris_playlists_dbus_proxy_get_ActivePlaylist;
+ iface->set_ActivePlaylist = mpris_playlists_dbus_proxy_set_ActivePlaylist;
+}
+
+
+static void _dbus_mpris_playlists_ActivatePlaylist (MprisPlaylists* self, GVariant* parameters, GDBusMethodInvocation* invocation) {
+ GVariantIter _arguments_iter;
+ char* playlist_id = NULL;
+ GVariant* _tmp50_;
+ g_variant_iter_init (&_arguments_iter, parameters);
+ _tmp50_ = g_variant_iter_next_value (&_arguments_iter);
+ playlist_id = g_variant_dup_string (_tmp50_, NULL);
+ g_variant_unref (_tmp50_);
+ mpris_playlists_ActivatePlaylist (self, playlist_id, (GAsyncReadyCallback) _dbus_mpris_playlists_ActivatePlaylist_ready, invocation);
+ _g_free0 (playlist_id);
+}
+
+
+static void _dbus_mpris_playlists_ActivatePlaylist_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_) {
+ GDBusMethodInvocation * invocation;
+ GError* error = NULL;
+ GDBusMessage* _reply_message;
+ GVariant* _reply;
+ GVariantBuilder _reply_builder;
+ invocation = _user_data_;
+ mpris_playlists_ActivatePlaylist_finish ((MprisPlaylists*) source_object, _res_, &error);
+ if (error) {
+ g_dbus_method_invocation_return_gerror (invocation, error);
+ return;
+ }
+ _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+ g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+ _reply = g_variant_builder_end (&_reply_builder);
+ g_dbus_message_set_body (_reply_message, _reply);
+ g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+ g_object_unref (invocation);
+ g_object_unref (_reply_message);
+}
+
+
+static void _dbus_mpris_playlists_GetPlaylists (MprisPlaylists* self, GVariant* parameters, GDBusMethodInvocation* invocation) {
+ GVariantIter _arguments_iter;
+ guint32 index = 0U;
+ GVariant* _tmp51_;
+ guint32 max_count = 0U;
+ GVariant* _tmp52_;
+ gchar* order = NULL;
+ GVariant* _tmp53_;
+ gboolean reverse_order = FALSE;
+ GVariant* _tmp54_;
+ g_variant_iter_init (&_arguments_iter, parameters);
+ _tmp51_ = g_variant_iter_next_value (&_arguments_iter);
+ index = g_variant_get_uint32 (_tmp51_);
+ g_variant_unref (_tmp51_);
+ _tmp52_ = g_variant_iter_next_value (&_arguments_iter);
+ max_count = g_variant_get_uint32 (_tmp52_);
+ g_variant_unref (_tmp52_);
+ _tmp53_ = g_variant_iter_next_value (&_arguments_iter);
+ order = g_variant_dup_string (_tmp53_, NULL);
+ g_variant_unref (_tmp53_);
+ _tmp54_ = g_variant_iter_next_value (&_arguments_iter);
+ reverse_order = g_variant_get_boolean (_tmp54_);
+ g_variant_unref (_tmp54_);
+ mpris_playlists_GetPlaylists (self, index, max_count, order, reverse_order, (GAsyncReadyCallback) _dbus_mpris_playlists_GetPlaylists_ready, invocation);
+ _g_free0 (order);
+}
+
+
+static void _vala_PlaylistDetails_array_free (PlaylistDetails* array, gint array_length) {
+ if (array != NULL) {
+ int i;
+ for (i = 0; i < array_length; i = i + 1) {
+ playlist_details_destroy (&array[i]);
+ }
+ }
+ g_free (array);
+}
+
+
+static void _dbus_mpris_playlists_GetPlaylists_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_) {
+ GDBusMethodInvocation * invocation;
+ GError* error = NULL;
+ GDBusMessage* _reply_message;
+ GVariant* _reply;
+ GVariantBuilder _reply_builder;
+ PlaylistDetails* result;
+ int result_length1 = 0;
+ PlaylistDetails* _tmp55_;
+ GVariantBuilder _tmp56_;
+ int _tmp57_;
+ invocation = _user_data_;
+ result = mpris_playlists_GetPlaylists_finish ((MprisPlaylists*) source_object, _res_, &result_length1, &error);
+ if (error) {
+ g_dbus_method_invocation_return_gerror (invocation, error);
+ return;
+ }
+ _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+ g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+ _tmp55_ = result;
+ g_variant_builder_init (&_tmp56_, G_VARIANT_TYPE ("a(oss)"));
+ for (_tmp57_ = 0; _tmp57_ < result_length1; _tmp57_++) {
+ GVariantBuilder _tmp58_;
+ g_variant_builder_init (&_tmp58_, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_tmp58_, g_variant_new_object_path ((*_tmp55_).path));
+ g_variant_builder_add_value (&_tmp58_, g_variant_new_string ((*_tmp55_).name));
+ g_variant_builder_add_value (&_tmp58_, g_variant_new_string ((*_tmp55_).icon_path));
+ g_variant_builder_add_value (&_tmp56_, g_variant_builder_end (&_tmp58_));
+ _tmp55_++;
+ }
+ g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp56_));
+ result = (_vala_PlaylistDetails_array_free (result, result_length1), NULL);
+ _reply = g_variant_builder_end (&_reply_builder);
+ g_dbus_message_set_body (_reply_message, _reply);
+ g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+ g_object_unref (invocation);
+ g_object_unref (_reply_message);
+}
+
+
+static void 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) {
+ gpointer* data;
+ gpointer object;
+ data = user_data;
+ object = data[0];
+ if (strcmp (method_name, "ActivatePlaylist") == 0) {
+ _dbus_mpris_playlists_ActivatePlaylist (object, parameters, invocation);
+ } else if (strcmp (method_name, "GetPlaylists") == 0) {
+ _dbus_mpris_playlists_GetPlaylists (object, parameters, invocation);
+ } else {
+ g_object_unref (invocation);
+ }
+}
+
+
+static GVariant* _dbus_mpris_playlists_get_Orderings (MprisPlaylists* self) {
+ gchar** result;
+ int result_length1;
+ gchar** _tmp59_;
+ GVariantBuilder _tmp60_;
+ int _tmp61_;
+ GVariant* _reply;
+ result = mpris_playlists_get_Orderings (self, &result_length1);
+ _tmp59_ = result;
+ g_variant_builder_init (&_tmp60_, G_VARIANT_TYPE ("as"));
+ for (_tmp61_ = 0; _tmp61_ < result_length1; _tmp61_++) {
+ g_variant_builder_add_value (&_tmp60_, g_variant_new_string (*_tmp59_));
+ _tmp59_++;
+ }
+ _reply = g_variant_builder_end (&_tmp60_);
+ result = (_vala_array_free (result, result_length1, (GDestroyNotify) g_free), NULL);
+ return _reply;
+}
+
+
+static GVariant* _dbus_mpris_playlists_get_PlaylistCount (MprisPlaylists* self) {
+ guint32 result;
+ GVariant* _reply;
+ result = mpris_playlists_get_PlaylistCount (self);
+ _reply = g_variant_new_uint32 (result);
+ return _reply;
+}
+
+
+static GVariant* _dbus_mpris_playlists_get_ActivePlaylist (MprisPlaylists* self) {
+ ActivePlaylistContainer result = {0};
+ GVariantBuilder _tmp62_;
+ GVariantBuilder _tmp63_;
+ GVariant* _reply;
+ mpris_playlists_get_ActivePlaylist (self, &result);
+ g_variant_builder_init (&_tmp62_, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_tmp62_, g_variant_new_boolean (result.valid));
+ g_variant_builder_init (&_tmp63_, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_tmp63_, g_variant_new_object_path ((*result.details).path));
+ g_variant_builder_add_value (&_tmp63_, g_variant_new_string ((*result.details).name));
+ g_variant_builder_add_value (&_tmp63_, g_variant_new_string ((*result.details).icon_path));
+ g_variant_builder_add_value (&_tmp62_, g_variant_builder_end (&_tmp63_));
+ _reply = g_variant_builder_end (&_tmp62_);
+ active_playlist_container_destroy (&result);
+ return _reply;
+}
+
+
+static GVariant* 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) {
+ gpointer* data;
+ gpointer object;
+ data = user_data;
+ object = data[0];
+ if (strcmp (property_name, "Orderings") == 0) {
+ return _dbus_mpris_playlists_get_Orderings (object);
+ } else if (strcmp (property_name, "PlaylistCount") == 0) {
+ return _dbus_mpris_playlists_get_PlaylistCount (object);
+ } else if (strcmp (property_name, "ActivePlaylist") == 0) {
+ return _dbus_mpris_playlists_get_ActivePlaylist (object);
+ }
+ return NULL;
+}
+
+
+static void _dbus_mpris_playlists_set_Orderings (MprisPlaylists* self, GVariant* _value) {
+ gchar** value = NULL;
+ int value_length1;
+ gchar** _tmp64_;
+ int _tmp64__length;
+ int _tmp64__size;
+ int _tmp64__length1;
+ GVariantIter _tmp65_;
+ GVariant* _tmp66_;
+ _tmp64_ = g_new (gchar*, 5);
+ _tmp64__length = 0;
+ _tmp64__size = 4;
+ _tmp64__length1 = 0;
+ g_variant_iter_init (&_tmp65_, _value);
+ for (; (_tmp66_ = g_variant_iter_next_value (&_tmp65_)) != NULL; _tmp64__length1++) {
+ if (_tmp64__size == _tmp64__length) {
+ _tmp64__size = 2 * _tmp64__size;
+ _tmp64_ = g_renew (gchar*, _tmp64_, _tmp64__size + 1);
+ }
+ _tmp64_[_tmp64__length++] = g_variant_dup_string (_tmp66_, NULL);
+ g_variant_unref (_tmp66_);
+ }
+ value_length1 = _tmp64__length1;
+ _tmp64_[_tmp64__length] = NULL;
+ value = _tmp64_;
+ mpris_playlists_set_Orderings (self, value, value_length1);
+ value = (_vala_array_free (value, value_length1, (GDestroyNotify) g_free), NULL);
+}
+
+
+static void _dbus_mpris_playlists_set_PlaylistCount (MprisPlaylists* self, GVariant* _value) {
+ guint32 value = 0U;
+ value = g_variant_get_uint32 (_value);
+ mpris_playlists_set_PlaylistCount (self, value);
+}
+
+
+static void _dbus_mpris_playlists_set_ActivePlaylist (MprisPlaylists* self, GVariant* _value) {
+ ActivePlaylistContainer value = {0};
+ ActivePlaylistContainer _tmp67_;
+ GVariantIter _tmp68_;
+ GVariant* _tmp69_;
+ GVariant* _tmp70_;
+ PlaylistDetails _tmp71_;
+ GVariantIter _tmp72_;
+ GVariant* _tmp73_;
+ GVariant* _tmp74_;
+ GVariant* _tmp75_;
+ g_variant_iter_init (&_tmp68_, _value);
+ _tmp69_ = g_variant_iter_next_value (&_tmp68_);
+ _tmp67_.valid = g_variant_get_boolean (_tmp69_);
+ g_variant_unref (_tmp69_);
+ _tmp70_ = g_variant_iter_next_value (&_tmp68_);
+ g_variant_iter_init (&_tmp72_, _tmp70_);
+ _tmp73_ = g_variant_iter_next_value (&_tmp72_);
+ _tmp71_.path = g_variant_dup_string (_tmp73_, NULL);
+ g_variant_unref (_tmp73_);
+ _tmp74_ = g_variant_iter_next_value (&_tmp72_);
+ _tmp71_.name = g_variant_dup_string (_tmp74_, NULL);
+ g_variant_unref (_tmp74_);
+ _tmp75_ = g_variant_iter_next_value (&_tmp72_);
+ _tmp71_.icon_path = g_variant_dup_string (_tmp75_, NULL);
+ g_variant_unref (_tmp75_);
+ _tmp67_.details = g_memdup (&_tmp71_, sizeof (PlaylistDetails));
+ g_variant_unref (_tmp70_);
+ value = _tmp67_;
+ mpris_playlists_set_ActivePlaylist (self, &value);
+ active_playlist_container_destroy (&value);
+}
+
+
+static gboolean 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) {
+ gpointer* data;
+ gpointer object;
+ data = user_data;
+ object = data[0];
+ if (strcmp (property_name, "Orderings") == 0) {
+ _dbus_mpris_playlists_set_Orderings (object, value);
+ return TRUE;
+ } else if (strcmp (property_name, "PlaylistCount") == 0) {
+ _dbus_mpris_playlists_set_PlaylistCount (object, value);
+ return TRUE;
+ } else if (strcmp (property_name, "ActivePlaylist") == 0) {
+ _dbus_mpris_playlists_set_ActivePlaylist (object, value);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+static void _dbus_mpris_playlists_playlist_changed (GObject* _sender, PlaylistDetails* details, gpointer* _data) {
+ GDBusConnection * _connection;
+ const gchar * _path;
+ GVariant *_arguments;
+ GVariantBuilder _arguments_builder;
+ GVariantBuilder _tmp76_;
+ _connection = _data[1];
+ _path = _data[2];
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_init (&_tmp76_, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_tmp76_, g_variant_new_object_path ((*details).path));
+ g_variant_builder_add_value (&_tmp76_, g_variant_new_string ((*details).name));
+ g_variant_builder_add_value (&_tmp76_, g_variant_new_string ((*details).icon_path));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_builder_end (&_tmp76_));
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ g_dbus_connection_emit_signal (_connection, NULL, _path, "org.mpris.MediaPlayer2.Playlists", "PlaylistChanged", _arguments, NULL);
+}
+
+
+guint mpris_playlists_register_object (gpointer object, GDBusConnection* connection, const gchar* path, GError** error) {
+ guint result;
+ gpointer *data;
+ data = g_new (gpointer, 3);
+ data[0] = g_object_ref (object);
+ data[1] = g_object_ref (connection);
+ data[2] = g_strdup (path);
+ result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) (&_mpris_playlists_dbus_interface_info), &_mpris_playlists_dbus_interface_vtable, data, _mpris_playlists_unregister_object, error);
+ if (!result) {
+ return 0;
+ }
+ g_signal_connect (object, "playlist-changed", (GCallback) _dbus_mpris_playlists_playlist_changed, data);
+ return result;
+}
+
+
+static void _mpris_playlists_unregister_object (gpointer user_data) {
+ gpointer* data;
+ data = user_data;
+ g_signal_handlers_disconnect_by_func (data[0], _dbus_mpris_playlists_playlist_changed, data);
+ g_object_unref (data[0]);
+ g_object_unref (data[1]);
+ g_free (data[2]);
+ g_free (data);
+}
+
+
+static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
+ if ((array != NULL) && (destroy_func != NULL)) {
+ int i;
+ for (i = 0; i < array_length; i = i + 1) {
+ if (((gpointer*) array)[i] != NULL) {
+ destroy_func (((gpointer*) array)[i]);
+ }
+ }
+ }
+}
+
+
+static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
+ _vala_array_destroy (array, array_length, destroy_func);
+ g_free (array);
+}
+
+
+
diff --git a/.pc/lp_945827.patch/src/mpris2-interfaces.vala b/.pc/lp_945827.patch/src/mpris2-interfaces.vala
new file mode 100644
index 0000000..db6888d
--- /dev/null
+++ b/.pc/lp_945827.patch/src/mpris2-interfaces.vala
@@ -0,0 +1,79 @@
+/*
+Copyright 2010 Canonical Ltd.
+Authors:
+ Conor Curran <conor.curran@canonical.com>
+
+This program is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 3, as published
+by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranties of
+MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+const string MPRIS_PREFIX = "org.mpris.MediaPlayer2.";
+const string MPRIS_MEDIA_PLAYER_PATH = "/org/mpris/MediaPlayer2";
+
+[DBus (name = "org.mpris.MediaPlayer2")]
+public interface MprisRoot : Object {
+ // properties
+ public abstract bool HasTracklist{owned get; set;}
+ public abstract bool CanQuit{owned get; set;}
+ public abstract bool CanRaise{owned get; set;}
+ public abstract string Identity{owned get; set;}
+ public abstract string DesktopEntry{owned get; set;}
+ // methods
+ public abstract async void Quit() throws IOError;
+ public abstract async void Raise() throws IOError;
+}
+
+[DBus (name = "org.mpris.MediaPlayer2.Player")]
+public interface MprisPlayer : Object {
+ // properties
+ public abstract HashTable<string, Variant?> Metadata{owned get; set;}
+ public abstract int32 Position{owned get; set;}
+ public abstract string PlaybackStatus{owned get; set;}
+ // methods
+ public abstract async void PlayPause() throws IOError;
+ public abstract async void Next() throws IOError;
+ public abstract async void Previous() throws IOError;
+ public abstract async void Seek(int64 offset) throws IOError;
+ // signals
+ public signal void Seeked(int64 new_position);
+}
+
+// Playlist container
+public struct PlaylistDetails{
+ public ObjectPath? path;
+ public string? name;
+ public string? icon_path;
+}
+
+// Active playlist property container
+public struct ActivePlaylistContainer{
+ public bool valid;
+ public PlaylistDetails? details;
+}
+
+[DBus (name = "org.mpris.MediaPlayer2.Playlists")]
+public interface MprisPlaylists : Object {
+ //properties
+ public abstract string[] Orderings{owned get; set;}
+ public abstract uint32 PlaylistCount{owned get; set;}
+ public abstract ActivePlaylistContainer ActivePlaylist {owned get; set;}
+
+ //methods
+ public abstract async void ActivatePlaylist(ObjectPath playlist_id) throws IOError;
+ public abstract async PlaylistDetails[]? GetPlaylists ( uint32 index,
+ uint32 max_count,
+ string order,
+ bool reverse_order ) throws IOError;
+ //signals
+ public signal void PlaylistChanged (PlaylistDetails details);
+
+}
diff --git a/.pc/lp_960846.patch/src/mpris2-controller.c b/.pc/lp_960846.patch/src/mpris2-controller.c
new file mode 100644
index 0000000..302ef66
--- /dev/null
+++ b/.pc/lp_960846.patch/src/mpris2-controller.c
@@ -0,0 +1,1754 @@
+/* mpris2-controller.c generated by valac 0.14.2, the Vala compiler
+ * generated from mpris2-controller.vala, do not modify */
+
+/*
+Copyright 2010 Canonical Ltd.
+
+Authors:
+ Conor Curran <conor.curran@canonical.com>
+
+This program is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 3, as published
+by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranties of
+MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <common-defs.h>
+#include <libdbusmenu-glib/client.h>
+#include <libdbusmenu-glib/dbusmenu-glib.h>
+#include <libdbusmenu-glib/enum-types.h>
+#include <libdbusmenu-glib/menuitem-proxy.h>
+#include <libdbusmenu-glib/menuitem.h>
+#include <libdbusmenu-glib/server.h>
+#include <libdbusmenu-glib/types.h>
+#include <gee.h>
+
+
+#define TYPE_MPRIS2_CONTROLLER (mpris2_controller_get_type ())
+#define MPRIS2_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS2_CONTROLLER, Mpris2Controller))
+#define MPRIS2_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS2_CONTROLLER, Mpris2ControllerClass))
+#define IS_MPRIS2_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS2_CONTROLLER))
+#define IS_MPRIS2_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS2_CONTROLLER))
+#define MPRIS2_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS2_CONTROLLER, Mpris2ControllerClass))
+
+typedef struct _Mpris2Controller Mpris2Controller;
+typedef struct _Mpris2ControllerClass Mpris2ControllerClass;
+typedef struct _Mpris2ControllerPrivate Mpris2ControllerPrivate;
+
+#define TYPE_MPRIS_ROOT (mpris_root_get_type ())
+#define MPRIS_ROOT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_ROOT, MprisRoot))
+#define IS_MPRIS_ROOT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_ROOT))
+#define MPRIS_ROOT_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_MPRIS_ROOT, MprisRootIface))
+
+typedef struct _MprisRoot MprisRoot;
+typedef struct _MprisRootIface MprisRootIface;
+
+#define TYPE_MPRIS_ROOT_PROXY (mpris_root_proxy_get_type ())
+
+#define TYPE_MPRIS_PLAYER (mpris_player_get_type ())
+#define MPRIS_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_PLAYER, MprisPlayer))
+#define IS_MPRIS_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_PLAYER))
+#define MPRIS_PLAYER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_MPRIS_PLAYER, MprisPlayerIface))
+
+typedef struct _MprisPlayer MprisPlayer;
+typedef struct _MprisPlayerIface MprisPlayerIface;
+
+#define TYPE_MPRIS_PLAYER_PROXY (mpris_player_proxy_get_type ())
+
+#define TYPE_MPRIS_PLAYLISTS (mpris_playlists_get_type ())
+#define MPRIS_PLAYLISTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_PLAYLISTS, MprisPlaylists))
+#define IS_MPRIS_PLAYLISTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_PLAYLISTS))
+#define MPRIS_PLAYLISTS_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_MPRIS_PLAYLISTS, MprisPlaylistsIface))
+
+typedef struct _MprisPlaylists MprisPlaylists;
+typedef struct _MprisPlaylistsIface MprisPlaylistsIface;
+
+#define TYPE_MPRIS_PLAYLISTS_PROXY (mpris_playlists_proxy_get_type ())
+
+#define TYPE_PLAYLIST_DETAILS (playlist_details_get_type ())
+typedef struct _PlaylistDetails PlaylistDetails;
+
+#define TYPE_ACTIVE_PLAYLIST_CONTAINER (active_playlist_container_get_type ())
+typedef struct _ActivePlaylistContainer ActivePlaylistContainer;
+
+#define TYPE_FREE_DESKTOP_PROPERTIES (free_desktop_properties_get_type ())
+#define FREE_DESKTOP_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FREE_DESKTOP_PROPERTIES, FreeDesktopProperties))
+#define IS_FREE_DESKTOP_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FREE_DESKTOP_PROPERTIES))
+#define FREE_DESKTOP_PROPERTIES_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_FREE_DESKTOP_PROPERTIES, FreeDesktopPropertiesIface))
+
+typedef struct _FreeDesktopProperties FreeDesktopProperties;
+typedef struct _FreeDesktopPropertiesIface FreeDesktopPropertiesIface;
+
+#define TYPE_FREE_DESKTOP_PROPERTIES_PROXY (free_desktop_properties_proxy_get_type ())
+
+#define TYPE_PLAYER_CONTROLLER (player_controller_get_type ())
+#define PLAYER_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYER_CONTROLLER, PlayerController))
+#define PLAYER_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYER_CONTROLLER, PlayerControllerClass))
+#define IS_PLAYER_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYER_CONTROLLER))
+#define IS_PLAYER_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYER_CONTROLLER))
+#define PLAYER_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYER_CONTROLLER, PlayerControllerClass))
+
+typedef struct _PlayerController PlayerController;
+typedef struct _PlayerControllerClass PlayerControllerClass;
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+typedef struct _PlayerControllerPrivate PlayerControllerPrivate;
+
+#define TYPE_PLAYER_ITEM (player_item_get_type ())
+#define PLAYER_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYER_ITEM, PlayerItem))
+#define PLAYER_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYER_ITEM, PlayerItemClass))
+#define IS_PLAYER_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYER_ITEM))
+#define IS_PLAYER_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYER_ITEM))
+#define PLAYER_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYER_ITEM, PlayerItemClass))
+
+typedef struct _PlayerItem PlayerItem;
+typedef struct _PlayerItemClass PlayerItemClass;
+
+#define PLAYER_CONTROLLER_TYPE_WIDGET_ORDER (player_controller_widget_order_get_type ())
+
+#define TYPE_TRANSPORT_MENUITEM (transport_menuitem_get_type ())
+#define TRANSPORT_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TRANSPORT_MENUITEM, TransportMenuitem))
+#define TRANSPORT_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TRANSPORT_MENUITEM, TransportMenuitemClass))
+#define IS_TRANSPORT_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TRANSPORT_MENUITEM))
+#define IS_TRANSPORT_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TRANSPORT_MENUITEM))
+#define TRANSPORT_MENUITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TRANSPORT_MENUITEM, TransportMenuitemClass))
+
+typedef struct _TransportMenuitem TransportMenuitem;
+typedef struct _TransportMenuitemClass TransportMenuitemClass;
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+#define TYPE_METADATA_MENUITEM (metadata_menuitem_get_type ())
+#define METADATA_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_METADATA_MENUITEM, MetadataMenuitem))
+#define METADATA_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_METADATA_MENUITEM, MetadataMenuitemClass))
+#define IS_METADATA_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_METADATA_MENUITEM))
+#define IS_METADATA_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_METADATA_MENUITEM))
+#define METADATA_MENUITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_METADATA_MENUITEM, MetadataMenuitemClass))
+
+typedef struct _MetadataMenuitem MetadataMenuitem;
+typedef struct _MetadataMenuitemClass MetadataMenuitemClass;
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
+
+#define TYPE_PLAYLISTS_MENUITEM (playlists_menuitem_get_type ())
+#define PLAYLISTS_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYLISTS_MENUITEM, PlaylistsMenuitem))
+#define PLAYLISTS_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYLISTS_MENUITEM, PlaylistsMenuitemClass))
+#define IS_PLAYLISTS_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYLISTS_MENUITEM))
+#define IS_PLAYLISTS_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYLISTS_MENUITEM))
+#define PLAYLISTS_MENUITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYLISTS_MENUITEM, PlaylistsMenuitemClass))
+
+typedef struct _PlaylistsMenuitem PlaylistsMenuitem;
+typedef struct _PlaylistsMenuitemClass PlaylistsMenuitemClass;
+#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
+typedef struct _Mpris2ControllerFetchPlaylistsData Mpris2ControllerFetchPlaylistsData;
+#define _active_playlist_container_free0(var) ((var == NULL) ? NULL : (var = (active_playlist_container_free (var), NULL)))
+
+struct _Mpris2Controller {
+ GObject parent_instance;
+ Mpris2ControllerPrivate * priv;
+};
+
+struct _Mpris2ControllerClass {
+ GObjectClass parent_class;
+};
+
+struct _MprisRootIface {
+ GTypeInterface parent_iface;
+ void (*Quit) (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+ void (*Quit_finish) (MprisRoot* self, GAsyncResult* _res_, GError** error);
+ void (*Raise) (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+ void (*Raise_finish) (MprisRoot* self, GAsyncResult* _res_, GError** error);
+ gboolean (*get_HasTracklist) (MprisRoot* self);
+ void (*set_HasTracklist) (MprisRoot* self, gboolean value);
+ gboolean (*get_CanQuit) (MprisRoot* self);
+ void (*set_CanQuit) (MprisRoot* self, gboolean value);
+ gboolean (*get_CanRaise) (MprisRoot* self);
+ void (*set_CanRaise) (MprisRoot* self, gboolean value);
+ gchar* (*get_Identity) (MprisRoot* self);
+ void (*set_Identity) (MprisRoot* self, const gchar* value);
+ gchar* (*get_DesktopEntry) (MprisRoot* self);
+ void (*set_DesktopEntry) (MprisRoot* self, const gchar* value);
+};
+
+struct _MprisPlayerIface {
+ GTypeInterface parent_iface;
+ void (*PlayPause) (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+ void (*PlayPause_finish) (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+ void (*Next) (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+ void (*Next_finish) (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+ void (*Previous) (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+ void (*Previous_finish) (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+ void (*Seek) (MprisPlayer* self, gint64 offset, GAsyncReadyCallback _callback_, gpointer _user_data_);
+ void (*Seek_finish) (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+ GHashTable* (*get_Metadata) (MprisPlayer* self);
+ void (*set_Metadata) (MprisPlayer* self, GHashTable* value);
+ gint32 (*get_Position) (MprisPlayer* self);
+ void (*set_Position) (MprisPlayer* self, gint32 value);
+ gchar* (*get_PlaybackStatus) (MprisPlayer* self);
+ void (*set_PlaybackStatus) (MprisPlayer* self, const gchar* value);
+};
+
+struct _PlaylistDetails {
+ char* path;
+ gchar* name;
+ gchar* icon_path;
+};
+
+struct _ActivePlaylistContainer {
+ gboolean valid;
+ PlaylistDetails* details;
+};
+
+struct _MprisPlaylistsIface {
+ GTypeInterface parent_iface;
+ void (*ActivatePlaylist) (MprisPlaylists* self, const char* playlist_id, GAsyncReadyCallback _callback_, gpointer _user_data_);
+ void (*ActivatePlaylist_finish) (MprisPlaylists* self, GAsyncResult* _res_, GError** error);
+ void (*GetPlaylists) (MprisPlaylists* self, guint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, GAsyncReadyCallback _callback_, gpointer _user_data_);
+ PlaylistDetails* (*GetPlaylists_finish) (MprisPlaylists* self, GAsyncResult* _res_, int* result_length1, GError** error);
+ gchar** (*get_Orderings) (MprisPlaylists* self, int* result_length1);
+ void (*set_Orderings) (MprisPlaylists* self, gchar** value, int value_length1);
+ guint32 (*get_PlaylistCount) (MprisPlaylists* self);
+ void (*set_PlaylistCount) (MprisPlaylists* self, guint32 value);
+ ActivePlaylistContainer* (*get_ActivePlaylist) (MprisPlaylists* self);
+ void (*set_ActivePlaylist) (MprisPlaylists* self, ActivePlaylistContainer* value);
+};
+
+struct _FreeDesktopPropertiesIface {
+ GTypeInterface parent_iface;
+};
+
+struct _Mpris2ControllerPrivate {
+ MprisRoot* _mpris2_root;
+ MprisPlayer* _player;
+ MprisPlaylists* _playlists;
+ FreeDesktopProperties* _properties_interface;
+ PlayerController* _owner;
+};
+
+struct _PlayerController {
+ GObject parent_instance;
+ PlayerControllerPrivate * priv;
+ gint current_state;
+ DbusmenuMenuitem* root_menu;
+ GeeArrayList* custom_items;
+ Mpris2Controller* mpris_bridge;
+ gboolean* use_playlists;
+};
+
+struct _PlayerControllerClass {
+ GObjectClass parent_class;
+};
+
+typedef enum {
+ PLAYER_CONTROLLER_WIDGET_ORDER_SEPARATOR,
+ PLAYER_CONTROLLER_WIDGET_ORDER_METADATA,
+ PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT,
+ PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS
+} PlayerControllerwidget_order;
+
+struct _Mpris2ControllerFetchPlaylistsData {
+ int _state_;
+ GObject* _source_object_;
+ GAsyncResult* _res_;
+ GSimpleAsyncResult* _async_result;
+ Mpris2Controller* self;
+ PlaylistDetails* current_playlists;
+ gint current_playlists_length1;
+ gint _current_playlists_size_;
+ MprisPlaylists* _tmp0_;
+ gint _tmp1_;
+ PlaylistDetails* _tmp2_;
+ PlaylistDetails* _tmp3_;
+ gint _tmp3__length1;
+ gint __tmp3__size_;
+ GError* e;
+ PlaylistDetails* _tmp4_;
+ gint _tmp4__length1;
+ PlayerController* _tmp5_;
+ GeeArrayList* _tmp6_;
+ gpointer _tmp7_;
+ PlaylistsMenuitem* playlists_item;
+ PlaylistsMenuitem* _tmp8_;
+ PlaylistDetails* _tmp9_;
+ gint _tmp9__length1;
+ PlayerController* _tmp10_;
+ GAppInfo* _tmp11_;
+ GAppInfo* _tmp12_;
+ const gchar* _tmp13_;
+ PlayerController* _tmp14_;
+ gboolean _tmp15_;
+ gboolean* _tmp16_;
+ GError * _inner_error_;
+};
+
+
+static gpointer mpris2_controller_parent_class = NULL;
+
+GType mpris2_controller_get_type (void) G_GNUC_CONST;
+GType mpris_root_proxy_get_type (void) G_GNUC_CONST;
+guint mpris_root_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
+GType mpris_root_get_type (void) G_GNUC_CONST;
+GType mpris_player_proxy_get_type (void) G_GNUC_CONST;
+guint mpris_player_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
+GType mpris_player_get_type (void) G_GNUC_CONST;
+GType mpris_playlists_proxy_get_type (void) G_GNUC_CONST;
+guint mpris_playlists_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
+GType playlist_details_get_type (void) G_GNUC_CONST;
+PlaylistDetails* playlist_details_dup (const PlaylistDetails* self);
+void playlist_details_free (PlaylistDetails* self);
+void playlist_details_copy (const PlaylistDetails* self, PlaylistDetails* dest);
+void playlist_details_destroy (PlaylistDetails* self);
+GType active_playlist_container_get_type (void) G_GNUC_CONST;
+ActivePlaylistContainer* active_playlist_container_dup (const ActivePlaylistContainer* self);
+void active_playlist_container_free (ActivePlaylistContainer* self);
+void active_playlist_container_copy (const ActivePlaylistContainer* self, ActivePlaylistContainer* dest);
+void active_playlist_container_destroy (ActivePlaylistContainer* self);
+GType mpris_playlists_get_type (void) G_GNUC_CONST;
+GType free_desktop_properties_get_type (void) G_GNUC_CONST;
+GType free_desktop_properties_proxy_get_type (void) G_GNUC_CONST;
+guint free_desktop_properties_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
+GType player_controller_get_type (void) G_GNUC_CONST;
+#define MPRIS2_CONTROLLER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_MPRIS2_CONTROLLER, Mpris2ControllerPrivate))
+enum {
+ MPRIS2_CONTROLLER_DUMMY_PROPERTY,
+ MPRIS2_CONTROLLER_MPRIS2_ROOT,
+ MPRIS2_CONTROLLER_PLAYER,
+ MPRIS2_CONTROLLER_PLAYLISTS,
+ MPRIS2_CONTROLLER_PROPERTIES_INTERFACE,
+ MPRIS2_CONTROLLER_OWNER
+};
+#define MPRIS2_CONTROLLER_MAX_PLAYLIST_COUNT 100
+Mpris2Controller* mpris2_controller_new (PlayerController* ctrl);
+Mpris2Controller* mpris2_controller_construct (GType object_type, PlayerController* ctrl);
+void mpris2_controller_property_changed_cb (Mpris2Controller* self, const gchar* interface_source, GHashTable* changed_properties, gchar** invalid, int invalid_length1);
+#define MPRIS_PREFIX "org.mpris.MediaPlayer2."
+MprisPlayer* mpris2_controller_get_player (Mpris2Controller* self);
+gchar* mpris_player_get_PlaybackStatus (MprisPlayer* self);
+static gboolean mpris2_controller_ensure_correct_playback_status (Mpris2Controller* self);
+static gboolean _mpris2_controller_ensure_correct_playback_status_gsource_func (gpointer self);
+static TransportState mpris2_controller_determine_play_state (Mpris2Controller* self, const gchar* status);
+PlayerController* mpris2_controller_get_owner (Mpris2Controller* self);
+GType player_item_get_type (void) G_GNUC_CONST;
+GType player_controller_widget_order_get_type (void) G_GNUC_CONST;
+GType transport_menuitem_get_type (void) G_GNUC_CONST;
+void transport_menuitem_change_play_state (TransportMenuitem* self, TransportState update);
+static gboolean mpris2_controller_ensure_correct_metadata (Mpris2Controller* self);
+static gboolean _mpris2_controller_ensure_correct_metadata_gsource_func (gpointer self);
+static gboolean _bool_equal (const gboolean* s1, const gboolean* s2);
+static gboolean mpris2_controller_fetch_active_playlist (Mpris2Controller* self);
+static gboolean _mpris2_controller_fetch_active_playlist_gsource_func (gpointer self);
+void mpris2_controller_fetch_playlists (Mpris2Controller* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+void mpris2_controller_fetch_playlists_finish (Mpris2Controller* self, GAsyncResult* _res_);
+GType metadata_menuitem_get_type (void) G_GNUC_CONST;
+void metadata_menuitem_alter_label (MetadataMenuitem* self, const gchar* new_title);
+MprisRoot* mpris2_controller_get_mpris2_root (Mpris2Controller* self);
+gchar* mpris_root_get_Identity (MprisRoot* self);
+static GHashTable* mpris2_controller_clean_metadata (Mpris2Controller* self);
+void player_item_reset (PlayerItem* self, GeeHashSet* attrs);
+GeeHashSet* metadata_menuitem_relevant_attributes_for_ui (void);
+void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attributes);
+gboolean player_item_populated (PlayerItem* self, GeeHashSet* attrs);
+void metadata_menuitem_should_collapse (MetadataMenuitem* self, gboolean collapse);
+GHashTable* mpris_player_get_Metadata (MprisPlayer* self);
+static GVariant* _variant_new1 (const gchar* value);
+void mpris2_controller_initial_update (Mpris2Controller* self);
+GeeHashSet* metadata_menuitem_attributes_format (void);
+void mpris2_controller_transport_update (Mpris2Controller* self, TransportAction command);
+void mpris_player_PlayPause (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+void mpris_player_PlayPause_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+void mpris_player_Previous (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+void mpris_player_Previous_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+void mpris_player_Next (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+void mpris_player_Next_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+void mpris_player_Seek (MprisPlayer* self, gint64 offset, GAsyncReadyCallback _callback_, gpointer _user_data_);
+void mpris_player_Seek_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+gboolean mpris2_controller_connected (Mpris2Controller* self);
+void mpris2_controller_expose (Mpris2Controller* self);
+void mpris_root_Raise (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+void mpris_root_Raise_finish (MprisRoot* self, GAsyncResult* _res_, GError** error);
+static void mpris2_controller_on_playlistdetails_changed (Mpris2Controller* self, PlaylistDetails* details);
+GType playlists_menuitem_get_type (void) G_GNUC_CONST;
+void playlists_menuitem_update_individual_playlist (PlaylistsMenuitem* self, PlaylistDetails* new_detail);
+static void mpris2_controller_fetch_playlists_data_free (gpointer _data);
+static gboolean mpris2_controller_fetch_playlists_co (Mpris2ControllerFetchPlaylistsData* _data_);
+MprisPlaylists* mpris2_controller_get_playlists (Mpris2Controller* self);
+void mpris_playlists_GetPlaylists (MprisPlaylists* self, guint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, GAsyncReadyCallback _callback_, gpointer _user_data_);
+PlaylistDetails* mpris_playlists_GetPlaylists_finish (MprisPlaylists* self, GAsyncResult* _res_, int* result_length1, GError** error);
+static void mpris2_controller_fetch_playlists_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
+static void _vala_PlaylistDetails_array_free (PlaylistDetails* array, gint array_length);
+void playlists_menuitem_update (PlaylistsMenuitem* self, PlaylistDetails* playlists, int playlists_length1);
+GAppInfo* player_controller_get_app_info (PlayerController* self);
+static gboolean* _bool_dup (gboolean* self);
+static gboolean mpris2_controller_validate_playlists_details (Mpris2Controller* self);
+ActivePlaylistContainer* mpris_playlists_get_ActivePlaylist (MprisPlaylists* self);
+void playlists_menuitem_active_playlist_update (PlaylistsMenuitem* self, PlaylistDetails* detail);
+void mpris2_controller_activate_playlist (Mpris2Controller* self, const char* path);
+void mpris_playlists_ActivatePlaylist (MprisPlaylists* self, const char* playlist_id, GAsyncReadyCallback _callback_, gpointer _user_data_);
+void mpris_playlists_ActivatePlaylist_finish (MprisPlaylists* self, GAsyncResult* _res_, GError** error);
+static void mpris2_controller_set_mpris2_root (Mpris2Controller* self, MprisRoot* value);
+static void mpris2_controller_set_player (Mpris2Controller* self, MprisPlayer* value);
+static void mpris2_controller_set_playlists (Mpris2Controller* self, MprisPlaylists* value);
+FreeDesktopProperties* mpris2_controller_get_properties_interface (Mpris2Controller* self);
+static void mpris2_controller_set_properties_interface (Mpris2Controller* self, FreeDesktopProperties* value);
+static void mpris2_controller_set_owner (Mpris2Controller* self, PlayerController* value);
+static GObject * mpris2_controller_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
+const gchar* player_controller_get_dbus_name (PlayerController* self);
+static void _mpris2_controller_property_changed_cb_free_desktop_properties_properties_changed (FreeDesktopProperties* _sender, const gchar* source, GHashTable* changed_properties, gchar** invalid, int invalid_length1, gpointer self);
+static void _mpris2_controller_on_playlistdetails_changed_mpris_playlists_playlist_changed (MprisPlaylists* _sender, PlaylistDetails* details, gpointer self);
+static void mpris2_controller_finalize (GObject* obj);
+static void _vala_mpris2_controller_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
+static void _vala_mpris2_controller_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
+static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
+
+
+Mpris2Controller* mpris2_controller_construct (GType object_type, PlayerController* ctrl) {
+ Mpris2Controller * self = NULL;
+ PlayerController* _tmp0_;
+ g_return_val_if_fail (ctrl != NULL, NULL);
+ _tmp0_ = ctrl;
+ self = (Mpris2Controller*) g_object_new (object_type, "owner", _tmp0_, NULL);
+ return self;
+}
+
+
+Mpris2Controller* mpris2_controller_new (PlayerController* ctrl) {
+ return mpris2_controller_construct (TYPE_MPRIS2_CONTROLLER, ctrl);
+}
+
+
+static gpointer _g_variant_ref0 (gpointer self) {
+ return self ? g_variant_ref (self) : NULL;
+}
+
+
+static gboolean _mpris2_controller_ensure_correct_playback_status_gsource_func (gpointer self) {
+ gboolean result;
+ result = mpris2_controller_ensure_correct_playback_status (self);
+ return result;
+}
+
+
+static gboolean _mpris2_controller_ensure_correct_metadata_gsource_func (gpointer self) {
+ gboolean result;
+ result = mpris2_controller_ensure_correct_metadata (self);
+ return result;
+}
+
+
+static gboolean _bool_equal (const gboolean* s1, const gboolean* s2) {
+ if (s1 == s2) {
+ return TRUE;
+ }
+ if (s1 == NULL) {
+ return FALSE;
+ }
+ if (s2 == NULL) {
+ return FALSE;
+ }
+ return (*s1) == (*s2);
+}
+
+
+static gboolean _mpris2_controller_fetch_active_playlist_gsource_func (gpointer self) {
+ gboolean result;
+ result = mpris2_controller_fetch_active_playlist (self);
+ return result;
+}
+
+
+void mpris2_controller_property_changed_cb (Mpris2Controller* self, const gchar* interface_source, GHashTable* changed_properties, gchar** invalid, int invalid_length1) {
+ gboolean _tmp0_ = FALSE;
+ GHashTable* _tmp1_;
+ gboolean _tmp4_;
+ GHashTable* _tmp5_;
+ gconstpointer _tmp6_ = NULL;
+ GVariant* _tmp7_;
+ GVariant* play_v;
+ GVariant* _tmp8_;
+ GHashTable* _tmp19_;
+ gconstpointer _tmp20_ = NULL;
+ GVariant* _tmp21_;
+ GVariant* meta_v;
+ GVariant* _tmp22_;
+ GHashTable* _tmp23_;
+ gconstpointer _tmp24_ = NULL;
+ GVariant* _tmp25_;
+ GVariant* playlist_v;
+ gboolean _tmp26_ = FALSE;
+ GVariant* _tmp27_;
+ gboolean _tmp31_;
+ GHashTable* _tmp32_;
+ gconstpointer _tmp33_ = NULL;
+ GVariant* _tmp34_;
+ GVariant* playlist_count_v;
+ gboolean _tmp35_ = FALSE;
+ GVariant* _tmp36_;
+ gboolean _tmp40_;
+ GHashTable* _tmp41_;
+ gconstpointer _tmp42_ = NULL;
+ GVariant* _tmp43_;
+ GVariant* playlist_orderings_v;
+ gboolean _tmp44_ = FALSE;
+ GVariant* _tmp45_;
+ gboolean _tmp49_;
+ GHashTable* _tmp50_;
+ gconstpointer _tmp51_ = NULL;
+ GVariant* _tmp52_;
+ GVariant* identity_v;
+ GVariant* _tmp53_;
+ g_return_if_fail (self != NULL);
+ g_return_if_fail (interface_source != NULL);
+ g_return_if_fail (changed_properties != NULL);
+ _tmp1_ = changed_properties;
+ if (_tmp1_ == NULL) {
+ _tmp0_ = TRUE;
+ } else {
+ const gchar* _tmp2_;
+ gboolean _tmp3_ = FALSE;
+ _tmp2_ = interface_source;
+ _tmp3_ = g_str_has_prefix (_tmp2_, MPRIS_PREFIX);
+ _tmp0_ = _tmp3_ == FALSE;
+ }
+ _tmp4_ = _tmp0_;
+ if (_tmp4_) {
+ g_warning ("mpris2-controller.vala:78: Property-changed hash is null or this is an" \
+" interface that doesn't concern us");
+ return;
+ }
+ _tmp5_ = changed_properties;
+ _tmp6_ = g_hash_table_lookup (_tmp5_, "PlaybackStatus");
+ _tmp7_ = _g_variant_ref0 ((GVariant*) _tmp6_);
+ play_v = _tmp7_;
+ _tmp8_ = play_v;
+ if (_tmp8_ != NULL) {
+ MprisPlayer* _tmp9_;
+ gchar* _tmp10_;
+ gchar* _tmp11_;
+ gchar* state;
+ const gchar* _tmp12_;
+ TransportState _tmp13_ = 0;
+ TransportState p;
+ PlayerController* _tmp14_;
+ GeeArrayList* _tmp15_;
+ gpointer _tmp16_ = NULL;
+ TransportMenuitem* _tmp17_;
+ TransportState _tmp18_;
+ _tmp9_ = self->priv->_player;
+ _tmp10_ = mpris_player_get_PlaybackStatus (_tmp9_);
+ _tmp11_ = _tmp10_;
+ state = _tmp11_;
+ g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 200, _mpris2_controller_ensure_correct_playback_status_gsource_func, g_object_ref (self), g_object_unref);
+ _tmp12_ = state;
+ _tmp13_ = mpris2_controller_determine_play_state (self, _tmp12_);
+ p = (TransportState) _tmp13_;
+ _tmp14_ = self->priv->_owner;
+ _tmp15_ = _tmp14_->custom_items;
+ _tmp16_ = gee_abstract_list_get ((GeeAbstractList*) _tmp15_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT);
+ _tmp17_ = IS_TRANSPORT_MENUITEM ((PlayerItem*) _tmp16_) ? ((TransportMenuitem*) ((PlayerItem*) _tmp16_)) : NULL;
+ _tmp18_ = p;
+ transport_menuitem_change_play_state (_tmp17_, _tmp18_);
+ _g_object_unref0 (_tmp17_);
+ _g_free0 (state);
+ }
+ _tmp19_ = changed_properties;
+ _tmp20_ = g_hash_table_lookup (_tmp19_, "Metadata");
+ _tmp21_ = _g_variant_ref0 ((GVariant*) _tmp20_);
+ meta_v = _tmp21_;
+ _tmp22_ = meta_v;
+ if (_tmp22_ != NULL) {
+ g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 200, _mpris2_controller_ensure_correct_metadata_gsource_func, g_object_ref (self), g_object_unref);
+ }
+ _tmp23_ = changed_properties;
+ _tmp24_ = g_hash_table_lookup (_tmp23_, "ActivePlaylist");
+ _tmp25_ = _g_variant_ref0 ((GVariant*) _tmp24_);
+ playlist_v = _tmp25_;
+ _tmp27_ = playlist_v;
+ if (_tmp27_ != NULL) {
+ PlayerController* _tmp28_;
+ gboolean* _tmp29_;
+ gboolean _tmp30_;
+ _tmp28_ = self->priv->_owner;
+ _tmp29_ = _tmp28_->use_playlists;
+ _tmp30_ = TRUE;
+ _tmp26_ = _bool_equal (_tmp29_, &_tmp30_) == TRUE;
+ } else {
+ _tmp26_ = FALSE;
+ }
+ _tmp31_ = _tmp26_;
+ if (_tmp31_) {
+ g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 500, _mpris2_controller_fetch_active_playlist_gsource_func, g_object_ref (self), g_object_unref);
+ }
+ _tmp32_ = changed_properties;
+ _tmp33_ = g_hash_table_lookup (_tmp32_, "PlaylistCount");
+ _tmp34_ = _g_variant_ref0 ((GVariant*) _tmp33_);
+ playlist_count_v = _tmp34_;
+ _tmp36_ = playlist_count_v;
+ if (_tmp36_ != NULL) {
+ PlayerController* _tmp37_;
+ gboolean* _tmp38_;
+ gboolean _tmp39_;
+ _tmp37_ = self->priv->_owner;
+ _tmp38_ = _tmp37_->use_playlists;
+ _tmp39_ = TRUE;
+ _tmp35_ = _bool_equal (_tmp38_, &_tmp39_) == TRUE;
+ } else {
+ _tmp35_ = FALSE;
+ }
+ _tmp40_ = _tmp35_;
+ if (_tmp40_) {
+ mpris2_controller_fetch_playlists (self, NULL, NULL);
+ mpris2_controller_fetch_active_playlist (self);
+ }
+ _tmp41_ = changed_properties;
+ _tmp42_ = g_hash_table_lookup (_tmp41_, "Orderings");
+ _tmp43_ = _g_variant_ref0 ((GVariant*) _tmp42_);
+ playlist_orderings_v = _tmp43_;
+ _tmp45_ = playlist_orderings_v;
+ if (_tmp45_ != NULL) {
+ PlayerController* _tmp46_;
+ gboolean* _tmp47_;
+ gboolean _tmp48_;
+ _tmp46_ = self->priv->_owner;
+ _tmp47_ = _tmp46_->use_playlists;
+ _tmp48_ = TRUE;
+ _tmp44_ = _bool_equal (_tmp47_, &_tmp48_) == TRUE;
+ } else {
+ _tmp44_ = FALSE;
+ }
+ _tmp49_ = _tmp44_;
+ if (_tmp49_) {
+ mpris2_controller_fetch_playlists (self, NULL, NULL);
+ mpris2_controller_fetch_active_playlist (self);
+ }
+ _tmp50_ = changed_properties;
+ _tmp51_ = g_hash_table_lookup (_tmp50_, "Identity");
+ _tmp52_ = _g_variant_ref0 ((GVariant*) _tmp51_);
+ identity_v = _tmp52_;
+ _tmp53_ = identity_v;
+ if (_tmp53_ != NULL) {
+ PlayerController* _tmp54_;
+ GeeArrayList* _tmp55_;
+ gpointer _tmp56_ = NULL;
+ MetadataMenuitem* md;
+ MetadataMenuitem* _tmp57_;
+ MprisRoot* _tmp58_;
+ gchar* _tmp59_;
+ gchar* _tmp60_;
+ gchar* _tmp61_;
+ _tmp54_ = self->priv->_owner;
+ _tmp55_ = _tmp54_->custom_items;
+ _tmp56_ = gee_abstract_list_get ((GeeAbstractList*) _tmp55_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA);
+ md = IS_METADATA_MENUITEM ((PlayerItem*) _tmp56_) ? ((MetadataMenuitem*) ((PlayerItem*) _tmp56_)) : NULL;
+ _tmp57_ = md;
+ _tmp58_ = self->priv->_mpris2_root;
+ _tmp59_ = mpris_root_get_Identity (_tmp58_);
+ _tmp60_ = _tmp59_;
+ _tmp61_ = _tmp60_;
+ metadata_menuitem_alter_label (_tmp57_, _tmp61_);
+ _g_free0 (_tmp61_);
+ _g_object_unref0 (md);
+ }
+ _g_variant_unref0 (identity_v);
+ _g_variant_unref0 (playlist_orderings_v);
+ _g_variant_unref0 (playlist_count_v);
+ _g_variant_unref0 (playlist_v);
+ _g_variant_unref0 (meta_v);
+ _g_variant_unref0 (play_v);
+}
+
+
+static gboolean mpris2_controller_ensure_correct_metadata (Mpris2Controller* self) {
+ gboolean result = FALSE;
+ GHashTable* _tmp0_ = NULL;
+ GHashTable* changed_updates;
+ PlayerController* _tmp1_;
+ GeeArrayList* _tmp2_;
+ gpointer _tmp3_ = NULL;
+ PlayerItem* metadata;
+ GeeHashSet* _tmp4_ = NULL;
+ GeeHashSet* _tmp5_;
+ GeeHashSet* _tmp6_ = NULL;
+ GeeHashSet* _tmp7_;
+ PlayerController* _tmp8_;
+ GeeArrayList* _tmp9_;
+ gpointer _tmp10_ = NULL;
+ MetadataMenuitem* md;
+ GeeHashSet* _tmp11_ = NULL;
+ GeeHashSet* _tmp12_;
+ gboolean _tmp13_ = FALSE;
+ gboolean _tmp14_;
+ gboolean collapsing;
+ g_return_val_if_fail (self != NULL, FALSE);
+ _tmp0_ = mpris2_controller_clean_metadata (self);
+ changed_updates = _tmp0_;
+ _tmp1_ = self->priv->_owner;
+ _tmp2_ = _tmp1_->custom_items;
+ _tmp3_ = gee_abstract_list_get ((GeeAbstractList*) _tmp2_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA);
+ metadata = (PlayerItem*) _tmp3_;
+ _tmp4_ = metadata_menuitem_relevant_attributes_for_ui ();
+ _tmp5_ = _tmp4_;
+ player_item_reset (metadata, _tmp5_);
+ _g_object_unref0 (_tmp5_);
+ _tmp6_ = metadata_menuitem_relevant_attributes_for_ui ();
+ _tmp7_ = _tmp6_;
+ player_item_update (metadata, changed_updates, _tmp7_);
+ _g_object_unref0 (_tmp7_);
+ _tmp8_ = self->priv->_owner;
+ _tmp9_ = _tmp8_->custom_items;
+ _tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA);
+ md = IS_METADATA_MENUITEM ((PlayerItem*) _tmp10_) ? ((MetadataMenuitem*) ((PlayerItem*) _tmp10_)) : NULL;
+ _tmp11_ = metadata_menuitem_relevant_attributes_for_ui ();
+ _tmp12_ = _tmp11_;
+ _tmp13_ = player_item_populated (metadata, _tmp12_);
+ _tmp14_ = !_tmp13_;
+ _g_object_unref0 (_tmp12_);
+ collapsing = _tmp14_;
+ metadata_menuitem_should_collapse (md, collapsing);
+ result = FALSE;
+ _g_object_unref0 (md);
+ _g_object_unref0 (metadata);
+ _g_hash_table_unref0 (changed_updates);
+ return result;
+}
+
+
+static gboolean mpris2_controller_ensure_correct_playback_status (Mpris2Controller* self) {
+ gboolean result = FALSE;
+ MprisPlayer* _tmp0_;
+ gchar* _tmp1_;
+ gchar* _tmp2_;
+ gchar* _tmp3_;
+ TransportState _tmp4_ = 0;
+ TransportState _tmp5_;
+ TransportState p;
+ PlayerController* _tmp6_;
+ GeeArrayList* _tmp7_;
+ gpointer _tmp8_ = NULL;
+ TransportMenuitem* _tmp9_;
+ g_return_val_if_fail (self != NULL, FALSE);
+ _tmp0_ = self->priv->_player;
+ _tmp1_ = mpris_player_get_PlaybackStatus (_tmp0_);
+ _tmp2_ = _tmp1_;
+ _tmp3_ = _tmp2_;
+ _tmp4_ = mpris2_controller_determine_play_state (self, _tmp3_);
+ _tmp5_ = (TransportState) _tmp4_;
+ _g_free0 (_tmp3_);
+ p = _tmp5_;
+ _tmp6_ = self->priv->_owner;
+ _tmp7_ = _tmp6_->custom_items;
+ _tmp8_ = gee_abstract_list_get ((GeeAbstractList*) _tmp7_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT);
+ _tmp9_ = IS_TRANSPORT_MENUITEM ((PlayerItem*) _tmp8_) ? ((TransportMenuitem*) ((PlayerItem*) _tmp8_)) : NULL;
+ transport_menuitem_change_play_state (_tmp9_, p);
+ _g_object_unref0 (_tmp9_);
+ result = FALSE;
+ return result;
+}
+
+
+static GVariant* _variant_new1 (const gchar* value) {
+ return g_variant_ref_sink (g_variant_new_string (value));
+}
+
+
+static GHashTable* mpris2_controller_clean_metadata (Mpris2Controller* self) {
+ GHashTable* result = NULL;
+ MprisPlayer* _tmp0_;
+ GHashTable* _tmp1_;
+ GHashTable* _tmp2_;
+ GHashTable* changed_updates;
+ MprisPlayer* _tmp3_;
+ GHashTable* _tmp4_;
+ GHashTable* _tmp5_;
+ GHashTable* _tmp6_;
+ gconstpointer _tmp7_ = NULL;
+ GVariant* _tmp8_;
+ GVariant* _tmp9_;
+ GVariant* artist_v;
+ GVariant* _tmp10_;
+ g_return_val_if_fail (self != NULL, NULL);
+ _tmp0_ = self->priv->_player;
+ _tmp1_ = mpris_player_get_Metadata (_tmp0_);
+ _tmp2_ = _tmp1_;
+ changed_updates = _tmp2_;
+ _tmp3_ = self->priv->_player;
+ _tmp4_ = mpris_player_get_Metadata (_tmp3_);
+ _tmp5_ = _tmp4_;
+ _tmp6_ = _tmp5_;
+ _tmp7_ = g_hash_table_lookup (_tmp6_, "xesam:artist");
+ _tmp8_ = _g_variant_ref0 ((GVariant*) _tmp7_);
+ _tmp9_ = _tmp8_;
+ _g_hash_table_unref0 (_tmp6_);
+ artist_v = _tmp9_;
+ _tmp10_ = artist_v;
+ if (_tmp10_ != NULL) {
+ gchar* display_artists = NULL;
+ GVariant* _tmp11_;
+ const gchar* _tmp12_ = NULL;
+ GHashTable* _tmp21_;
+ gchar* _tmp22_;
+ const gchar* _tmp23_;
+ GVariant* _tmp24_;
+ _tmp11_ = artist_v;
+ _tmp12_ = g_variant_get_type_string (_tmp11_);
+ if (g_strcmp0 (_tmp12_, "s") == 0) {
+ GVariant* _tmp13_;
+ const gchar* _tmp14_ = NULL;
+ gchar* _tmp15_;
+ _tmp13_ = artist_v;
+ _tmp14_ = g_variant_get_string (_tmp13_, NULL);
+ _tmp15_ = g_strdup (_tmp14_);
+ _g_free0 (display_artists);
+ display_artists = _tmp15_;
+ } else {
+ GVariant* _tmp16_;
+ size_t _tmp17_;
+ gchar** _tmp18_ = NULL;
+ gchar** artists;
+ gint artists_length1;
+ gint _artists_size_;
+ gchar** _tmp19_;
+ gint _tmp19__length1;
+ gchar* _tmp20_ = NULL;
+ _tmp16_ = artist_v;
+ _tmp18_ = g_variant_dup_strv (_tmp16_, &_tmp17_);
+ artists = _tmp18_;
+ artists_length1 = _tmp17_;
+ _artists_size_ = artists_length1;
+ _tmp19_ = artists;
+ _tmp19__length1 = artists_length1;
+ _tmp20_ = g_strjoinv (", ", _tmp19_);
+ _g_free0 (display_artists);
+ display_artists = _tmp20_;
+ artists = (_vala_array_free (artists, artists_length1, (GDestroyNotify) g_free), NULL);
+ }
+ _tmp21_ = changed_updates;
+ _tmp22_ = g_strdup ("xesam:artist");
+ _tmp23_ = display_artists;
+ _tmp24_ = _variant_new1 (_tmp23_);
+ g_hash_table_replace (_tmp21_, _tmp22_, _tmp24_);
+ _g_free0 (display_artists);
+ }
+ result = changed_updates;
+ _g_variant_unref0 (artist_v);
+ return result;
+}
+
+
+static TransportState mpris2_controller_determine_play_state (Mpris2Controller* self, const gchar* status) {
+ TransportState result = 0;
+ gboolean _tmp0_ = FALSE;
+ const gchar* _tmp1_;
+ gboolean _tmp3_;
+ g_return_val_if_fail (self != NULL, 0);
+ _tmp1_ = status;
+ if (_tmp1_ != NULL) {
+ const gchar* _tmp2_;
+ _tmp2_ = status;
+ _tmp0_ = g_strcmp0 (_tmp2_, "Playing") == 0;
+ } else {
+ _tmp0_ = FALSE;
+ }
+ _tmp3_ = _tmp0_;
+ if (_tmp3_) {
+ result = TRANSPORT_STATE_PLAYING;
+ return result;
+ }
+ result = TRANSPORT_STATE_PAUSED;
+ return result;
+}
+
+
+void mpris2_controller_initial_update (Mpris2Controller* self) {
+ TransportState update = 0;
+ MprisPlayer* _tmp0_;
+ gchar* _tmp1_;
+ gchar* _tmp2_;
+ gchar* _tmp3_;
+ gboolean _tmp4_;
+ MprisRoot* _tmp10_;
+ gchar* _tmp11_;
+ gchar* _tmp12_;
+ gchar* _tmp13_;
+ gboolean _tmp14_;
+ PlayerController* _tmp23_;
+ GeeArrayList* _tmp24_;
+ gpointer _tmp25_ = NULL;
+ TransportMenuitem* _tmp26_;
+ TransportState _tmp27_;
+ GHashTable* _tmp28_ = NULL;
+ GHashTable* cleaned_metadata;
+ PlayerController* _tmp29_;
+ GeeArrayList* _tmp30_;
+ gpointer _tmp31_ = NULL;
+ PlayerItem* _tmp32_;
+ GHashTable* _tmp33_;
+ GeeHashSet* _tmp34_ = NULL;
+ GeeHashSet* _tmp35_;
+ PlayerController* _tmp36_;
+ gboolean* _tmp37_;
+ gboolean _tmp38_;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = self->priv->_player;
+ _tmp1_ = mpris_player_get_PlaybackStatus (_tmp0_);
+ _tmp2_ = _tmp1_;
+ _tmp3_ = _tmp2_;
+ _tmp4_ = _tmp3_ == NULL;
+ _g_free0 (_tmp3_);
+ if (_tmp4_) {
+ update = TRANSPORT_STATE_PAUSED;
+ } else {
+ MprisPlayer* _tmp5_;
+ gchar* _tmp6_;
+ gchar* _tmp7_;
+ gchar* _tmp8_;
+ TransportState _tmp9_ = 0;
+ _tmp5_ = self->priv->_player;
+ _tmp6_ = mpris_player_get_PlaybackStatus (_tmp5_);
+ _tmp7_ = _tmp6_;
+ _tmp8_ = _tmp7_;
+ _tmp9_ = mpris2_controller_determine_play_state (self, _tmp8_);
+ update = _tmp9_;
+ _g_free0 (_tmp8_);
+ }
+ _tmp10_ = self->priv->_mpris2_root;
+ _tmp11_ = mpris_root_get_Identity (_tmp10_);
+ _tmp12_ = _tmp11_;
+ _tmp13_ = _tmp12_;
+ _tmp14_ = _tmp13_ != NULL;
+ _g_free0 (_tmp13_);
+ if (_tmp14_) {
+ PlayerController* _tmp15_;
+ GeeArrayList* _tmp16_;
+ gpointer _tmp17_ = NULL;
+ MetadataMenuitem* md;
+ MetadataMenuitem* _tmp18_;
+ MprisRoot* _tmp19_;
+ gchar* _tmp20_;
+ gchar* _tmp21_;
+ gchar* _tmp22_;
+ _tmp15_ = self->priv->_owner;
+ _tmp16_ = _tmp15_->custom_items;
+ _tmp17_ = gee_abstract_list_get ((GeeAbstractList*) _tmp16_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA);
+ md = IS_METADATA_MENUITEM ((PlayerItem*) _tmp17_) ? ((MetadataMenuitem*) ((PlayerItem*) _tmp17_)) : NULL;
+ _tmp18_ = md;
+ _tmp19_ = self->priv->_mpris2_root;
+ _tmp20_ = mpris_root_get_Identity (_tmp19_);
+ _tmp21_ = _tmp20_;
+ _tmp22_ = _tmp21_;
+ metadata_menuitem_alter_label (_tmp18_, _tmp22_);
+ _g_free0 (_tmp22_);
+ _g_object_unref0 (md);
+ }
+ _tmp23_ = self->priv->_owner;
+ _tmp24_ = _tmp23_->custom_items;
+ _tmp25_ = gee_abstract_list_get ((GeeAbstractList*) _tmp24_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT);
+ _tmp26_ = IS_TRANSPORT_MENUITEM ((PlayerItem*) _tmp25_) ? ((TransportMenuitem*) ((PlayerItem*) _tmp25_)) : NULL;
+ _tmp27_ = update;
+ transport_menuitem_change_play_state (_tmp26_, _tmp27_);
+ _g_object_unref0 (_tmp26_);
+ _tmp28_ = mpris2_controller_clean_metadata (self);
+ cleaned_metadata = _tmp28_;
+ _tmp29_ = self->priv->_owner;
+ _tmp30_ = _tmp29_->custom_items;
+ _tmp31_ = gee_abstract_list_get ((GeeAbstractList*) _tmp30_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA);
+ _tmp32_ = (PlayerItem*) _tmp31_;
+ _tmp33_ = cleaned_metadata;
+ _tmp34_ = metadata_menuitem_attributes_format ();
+ _tmp35_ = _tmp34_;
+ player_item_update (_tmp32_, _tmp33_, _tmp35_);
+ _g_object_unref0 (_tmp35_);
+ _g_object_unref0 (_tmp32_);
+ _tmp36_ = self->priv->_owner;
+ _tmp37_ = _tmp36_->use_playlists;
+ _tmp38_ = TRUE;
+ if (_bool_equal (_tmp37_, &_tmp38_) == TRUE) {
+ mpris2_controller_fetch_playlists (self, NULL, NULL);
+ mpris2_controller_fetch_active_playlist (self);
+ }
+ _g_hash_table_unref0 (cleaned_metadata);
+}
+
+
+void mpris2_controller_transport_update (Mpris2Controller* self, TransportAction command) {
+ TransportAction _tmp0_;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = command;
+ if (_tmp0_ == TRANSPORT_ACTION_PLAY_PAUSE) {
+ MprisPlayer* _tmp1_;
+ _tmp1_ = self->priv->_player;
+ mpris_player_PlayPause (_tmp1_, NULL, NULL);
+ } else {
+ TransportAction _tmp2_;
+ _tmp2_ = command;
+ if (_tmp2_ == TRANSPORT_ACTION_PREVIOUS) {
+ MprisPlayer* _tmp3_;
+ _tmp3_ = self->priv->_player;
+ mpris_player_Previous (_tmp3_, NULL, NULL);
+ } else {
+ TransportAction _tmp4_;
+ _tmp4_ = command;
+ if (_tmp4_ == TRANSPORT_ACTION_NEXT) {
+ MprisPlayer* _tmp5_;
+ _tmp5_ = self->priv->_player;
+ mpris_player_Next (_tmp5_, NULL, NULL);
+ } else {
+ TransportAction _tmp6_;
+ _tmp6_ = command;
+ if (_tmp6_ == TRANSPORT_ACTION_REWIND) {
+ MprisPlayer* _tmp7_;
+ _tmp7_ = self->priv->_player;
+ mpris_player_Seek (_tmp7_, (gint64) (-500000), NULL, NULL);
+ } else {
+ TransportAction _tmp8_;
+ _tmp8_ = command;
+ if (_tmp8_ == TRANSPORT_ACTION_FORWIND) {
+ MprisPlayer* _tmp9_;
+ _tmp9_ = self->priv->_player;
+ mpris_player_Seek (_tmp9_, (gint64) 400000, NULL, NULL);
+ }
+ }
+ }
+ }
+ }
+}
+
+
+gboolean mpris2_controller_connected (Mpris2Controller* self) {
+ gboolean result = FALSE;
+ gboolean _tmp0_ = FALSE;
+ MprisPlayer* _tmp1_;
+ gboolean _tmp3_;
+ g_return_val_if_fail (self != NULL, FALSE);
+ _tmp1_ = self->priv->_player;
+ if (_tmp1_ != NULL) {
+ MprisRoot* _tmp2_;
+ _tmp2_ = self->priv->_mpris2_root;
+ _tmp0_ = _tmp2_ != NULL;
+ } else {
+ _tmp0_ = FALSE;
+ }
+ _tmp3_ = _tmp0_;
+ result = _tmp3_;
+ return result;
+}
+
+
+void mpris2_controller_expose (Mpris2Controller* self) {
+ gboolean _tmp0_ = FALSE;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = mpris2_controller_connected (self);
+ if (_tmp0_ == TRUE) {
+ MprisRoot* _tmp1_;
+ _tmp1_ = self->priv->_mpris2_root;
+ mpris_root_Raise (_tmp1_, NULL, NULL);
+ }
+}
+
+
+static void mpris2_controller_on_playlistdetails_changed (Mpris2Controller* self, PlaylistDetails* details) {
+ PlayerController* _tmp0_;
+ GeeArrayList* _tmp1_;
+ gpointer _tmp2_ = NULL;
+ PlaylistsMenuitem* playlists_item;
+ PlaylistDetails _tmp3_;
+ g_return_if_fail (self != NULL);
+ g_return_if_fail (details != NULL);
+ _tmp0_ = self->priv->_owner;
+ _tmp1_ = _tmp0_->custom_items;
+ _tmp2_ = gee_abstract_list_get ((GeeAbstractList*) _tmp1_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS);
+ playlists_item = IS_PLAYLISTS_MENUITEM ((PlayerItem*) _tmp2_) ? ((PlaylistsMenuitem*) ((PlayerItem*) _tmp2_)) : NULL;
+ _tmp3_ = *details;
+ playlists_menuitem_update_individual_playlist (playlists_item, &_tmp3_);
+ _g_object_unref0 (playlists_item);
+}
+
+
+static void mpris2_controller_fetch_playlists_data_free (gpointer _data) {
+ Mpris2ControllerFetchPlaylistsData* _data_;
+ _data_ = _data;
+ _g_object_unref0 (_data_->self);
+ g_slice_free (Mpris2ControllerFetchPlaylistsData, _data_);
+}
+
+
+static gpointer _g_object_ref0 (gpointer self) {
+ return self ? g_object_ref (self) : NULL;
+}
+
+
+void mpris2_controller_fetch_playlists (Mpris2Controller* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
+ Mpris2ControllerFetchPlaylistsData* _data_;
+ Mpris2Controller* _tmp0_;
+ _data_ = g_slice_new0 (Mpris2ControllerFetchPlaylistsData);
+ _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, mpris2_controller_fetch_playlists);
+ g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, mpris2_controller_fetch_playlists_data_free);
+ _tmp0_ = _g_object_ref0 (self);
+ _data_->self = _tmp0_;
+ mpris2_controller_fetch_playlists_co (_data_);
+}
+
+
+void mpris2_controller_fetch_playlists_finish (Mpris2Controller* self, GAsyncResult* _res_) {
+ Mpris2ControllerFetchPlaylistsData* _data_;
+ _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
+}
+
+
+static void mpris2_controller_fetch_playlists_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
+ Mpris2ControllerFetchPlaylistsData* _data_;
+ _data_ = _user_data_;
+ _data_->_source_object_ = source_object;
+ _data_->_res_ = _res_;
+ mpris2_controller_fetch_playlists_co (_data_);
+}
+
+
+static void _vala_PlaylistDetails_array_free (PlaylistDetails* array, gint array_length) {
+ if (array != NULL) {
+ int i;
+ for (i = 0; i < array_length; i = i + 1) {
+ playlist_details_destroy (&array[i]);
+ }
+ }
+ g_free (array);
+}
+
+
+static gboolean* _bool_dup (gboolean* self) {
+ gboolean* dup;
+ dup = g_new0 (gboolean, 1);
+ memcpy (dup, self, sizeof (gboolean));
+ return dup;
+}
+
+
+static gpointer __bool_dup0 (gpointer self) {
+ return self ? _bool_dup (self) : NULL;
+}
+
+
+static gboolean mpris2_controller_fetch_playlists_co (Mpris2ControllerFetchPlaylistsData* _data_) {
+ switch (_data_->_state_) {
+ case 0:
+ goto _state_0;
+ case 1:
+ goto _state_1;
+ default:
+ g_assert_not_reached ();
+ }
+ _state_0:
+ _data_->current_playlists = NULL;
+ _data_->current_playlists_length1 = 0;
+ _data_->_current_playlists_size_ = _data_->current_playlists_length1;
+ {
+ _data_->_tmp0_ = _data_->self->priv->_playlists;
+ _data_->_tmp1_ = 0;
+ _data_->_state_ = 1;
+ mpris_playlists_GetPlaylists (_data_->_tmp0_, (guint32) 0, (guint32) MPRIS2_CONTROLLER_MAX_PLAYLIST_COUNT, "Alphabetical", FALSE, mpris2_controller_fetch_playlists_ready, _data_);
+ return FALSE;
+ _state_1:
+ _data_->_tmp2_ = NULL;
+ _data_->_tmp2_ = mpris_playlists_GetPlaylists_finish (_data_->_tmp0_, _data_->_res_, &_data_->_tmp1_, &_data_->_inner_error_);
+ _data_->_tmp3_ = _data_->_tmp2_;
+ _data_->_tmp3__length1 = _data_->_tmp1_;
+ _data_->__tmp3__size_ = _data_->_tmp3__length1;
+ if (_data_->_inner_error_ != NULL) {
+ if (_data_->_inner_error_->domain == G_IO_ERROR) {
+ goto __catch12_g_io_error;
+ }
+ _data_->current_playlists = (_vala_PlaylistDetails_array_free (_data_->current_playlists, _data_->current_playlists_length1), NULL);
+ g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
+ g_clear_error (&_data_->_inner_error_);
+ return FALSE;
+ }
+ _data_->current_playlists = (_vala_PlaylistDetails_array_free (_data_->current_playlists, _data_->current_playlists_length1), NULL);
+ _data_->current_playlists = _data_->_tmp3_;
+ _data_->current_playlists_length1 = _data_->_tmp3__length1;
+ _data_->_current_playlists_size_ = _data_->current_playlists_length1;
+ }
+ goto __finally12;
+ __catch12_g_io_error:
+ {
+ _data_->e = _data_->_inner_error_;
+ _data_->_inner_error_ = NULL;
+ _g_error_free0 (_data_->e);
+ _data_->current_playlists = (_vala_PlaylistDetails_array_free (_data_->current_playlists, _data_->current_playlists_length1), NULL);
+ if (_data_->_state_ == 0) {
+ g_simple_async_result_complete_in_idle (_data_->_async_result);
+ } else {
+ g_simple_async_result_complete (_data_->_async_result);
+ }
+ g_object_unref (_data_->_async_result);
+ return FALSE;
+ }
+ __finally12:
+ if (_data_->_inner_error_ != NULL) {
+ _data_->current_playlists = (_vala_PlaylistDetails_array_free (_data_->current_playlists, _data_->current_playlists_length1), NULL);
+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
+ g_clear_error (&_data_->_inner_error_);
+ return FALSE;
+ }
+ _data_->_tmp4_ = _data_->current_playlists;
+ _data_->_tmp4__length1 = _data_->current_playlists_length1;
+ if (_data_->_tmp4_ != NULL) {
+ _data_->_tmp5_ = _data_->self->priv->_owner;
+ _data_->_tmp6_ = _data_->_tmp5_->custom_items;
+ _data_->_tmp7_ = NULL;
+ _data_->_tmp7_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp6_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS);
+ _data_->playlists_item = IS_PLAYLISTS_MENUITEM ((PlayerItem*) _data_->_tmp7_) ? ((PlaylistsMenuitem*) ((PlayerItem*) _data_->_tmp7_)) : NULL;
+ _data_->_tmp8_ = _data_->playlists_item;
+ _data_->_tmp9_ = _data_->current_playlists;
+ _data_->_tmp9__length1 = _data_->current_playlists_length1;
+ playlists_menuitem_update (_data_->_tmp8_, _data_->_tmp9_, _data_->_tmp9__length1);
+ _g_object_unref0 (_data_->playlists_item);
+ } else {
+ _data_->_tmp10_ = _data_->self->priv->_owner;
+ _data_->_tmp11_ = player_controller_get_app_info (_data_->_tmp10_);
+ _data_->_tmp12_ = _data_->_tmp11_;
+ _data_->_tmp13_ = NULL;
+ _data_->_tmp13_ = g_app_info_get_name (_data_->_tmp12_);
+ g_warning ("mpris2-controller.vala:243: Playlists are on but %s is returning no c" \
+"urrent_playlists ?", _data_->_tmp13_);
+ _data_->_tmp14_ = _data_->self->priv->_owner;
+ _data_->_tmp15_ = FALSE;
+ _data_->_tmp16_ = __bool_dup0 (&_data_->_tmp15_);
+ _g_free0 (_data_->_tmp14_->use_playlists);
+ _data_->_tmp14_->use_playlists = _data_->_tmp16_;
+ }
+ _data_->current_playlists = (_vala_PlaylistDetails_array_free (_data_->current_playlists, _data_->current_playlists_length1), NULL);
+ if (_data_->_state_ == 0) {
+ g_simple_async_result_complete_in_idle (_data_->_async_result);
+ } else {
+ g_simple_async_result_complete (_data_->_async_result);
+ }
+ g_object_unref (_data_->_async_result);
+ return FALSE;
+}
+
+
+static gboolean mpris2_controller_validate_playlists_details (Mpris2Controller* self) {
+ gboolean result = FALSE;
+ MprisPlaylists* _tmp0_;
+ ActivePlaylistContainer* _tmp1_;
+ ActivePlaylistContainer* _tmp2_;
+ ActivePlaylistContainer* _tmp3_;
+ gboolean _tmp4_;
+ gboolean _tmp5_;
+ MprisPlaylists* _tmp6_;
+ ActivePlaylistContainer* _tmp7_;
+ ActivePlaylistContainer* _tmp8_;
+ ActivePlaylistContainer* _tmp9_;
+ PlaylistDetails* _tmp10_;
+ gboolean _tmp11_;
+ gboolean _tmp12_ = FALSE;
+ MprisPlaylists* _tmp13_;
+ ActivePlaylistContainer* _tmp14_;
+ ActivePlaylistContainer* _tmp15_;
+ ActivePlaylistContainer* _tmp16_;
+ PlaylistDetails* _tmp17_;
+ const char* _tmp18_;
+ gboolean _tmp19_;
+ gboolean _tmp26_;
+ g_return_val_if_fail (self != NULL, FALSE);
+ _tmp0_ = self->priv->_playlists;
+ _tmp1_ = mpris_playlists_get_ActivePlaylist (_tmp0_);
+ _tmp2_ = _tmp1_;
+ _tmp3_ = _tmp2_;
+ _tmp4_ = (*_tmp3_).valid;
+ _tmp5_ = _tmp4_ == FALSE;
+ _active_playlist_container_free0 (_tmp3_);
+ if (_tmp5_) {
+ result = FALSE;
+ return result;
+ }
+ _tmp6_ = self->priv->_playlists;
+ _tmp7_ = mpris_playlists_get_ActivePlaylist (_tmp6_);
+ _tmp8_ = _tmp7_;
+ _tmp9_ = _tmp8_;
+ _tmp10_ = (*_tmp9_).details;
+ _tmp11_ = _tmp10_ == NULL;
+ _active_playlist_container_free0 (_tmp9_);
+ if (_tmp11_) {
+ result = FALSE;
+ return result;
+ }
+ _tmp13_ = self->priv->_playlists;
+ _tmp14_ = mpris_playlists_get_ActivePlaylist (_tmp13_);
+ _tmp15_ = _tmp14_;
+ _tmp16_ = _tmp15_;
+ _tmp17_ = (*_tmp16_).details;
+ _tmp18_ = (*_tmp17_).path;
+ _tmp19_ = _tmp18_ == NULL;
+ _active_playlist_container_free0 (_tmp16_);
+ if (_tmp19_) {
+ _tmp12_ = TRUE;
+ } else {
+ MprisPlaylists* _tmp20_;
+ ActivePlaylistContainer* _tmp21_;
+ ActivePlaylistContainer* _tmp22_;
+ ActivePlaylistContainer* _tmp23_;
+ PlaylistDetails* _tmp24_;
+ const gchar* _tmp25_;
+ _tmp20_ = self->priv->_playlists;
+ _tmp21_ = mpris_playlists_get_ActivePlaylist (_tmp20_);
+ _tmp22_ = _tmp21_;
+ _tmp23_ = _tmp22_;
+ _tmp24_ = (*_tmp23_).details;
+ _tmp25_ = (*_tmp24_).name;
+ _tmp12_ = _tmp25_ == NULL;
+ _active_playlist_container_free0 (_tmp23_);
+ }
+ _tmp26_ = _tmp12_;
+ if (_tmp26_) {
+ result = FALSE;
+ return result;
+ }
+ result = TRUE;
+ return result;
+}
+
+
+static gboolean mpris2_controller_fetch_active_playlist (Mpris2Controller* self) {
+ gboolean result = FALSE;
+ gboolean _tmp0_ = FALSE;
+ PlayerController* _tmp1_;
+ GeeArrayList* _tmp2_;
+ gpointer _tmp3_ = NULL;
+ PlaylistsMenuitem* playlists_item;
+ PlaylistsMenuitem* _tmp4_;
+ MprisPlaylists* _tmp5_;
+ ActivePlaylistContainer* _tmp6_;
+ ActivePlaylistContainer* _tmp7_;
+ ActivePlaylistContainer* _tmp8_;
+ PlaylistDetails* _tmp9_;
+ PlaylistDetails _tmp10_;
+ g_return_val_if_fail (self != NULL, FALSE);
+ _tmp0_ = mpris2_controller_validate_playlists_details (self);
+ if (_tmp0_ == FALSE) {
+ result = FALSE;
+ return result;
+ }
+ _tmp1_ = self->priv->_owner;
+ _tmp2_ = _tmp1_->custom_items;
+ _tmp3_ = gee_abstract_list_get ((GeeAbstractList*) _tmp2_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS);
+ playlists_item = IS_PLAYLISTS_MENUITEM ((PlayerItem*) _tmp3_) ? ((PlaylistsMenuitem*) ((PlayerItem*) _tmp3_)) : NULL;
+ _tmp4_ = playlists_item;
+ _tmp5_ = self->priv->_playlists;
+ _tmp6_ = mpris_playlists_get_ActivePlaylist (_tmp5_);
+ _tmp7_ = _tmp6_;
+ _tmp8_ = _tmp7_;
+ _tmp9_ = (*_tmp8_).details;
+ _tmp10_ = *_tmp9_;
+ playlists_menuitem_active_playlist_update (_tmp4_, &_tmp10_);
+ _active_playlist_container_free0 (_tmp8_);
+ result = FALSE;
+ _g_object_unref0 (playlists_item);
+ return result;
+}
+
+
+void mpris2_controller_activate_playlist (Mpris2Controller* self, const char* path) {
+ GError * _inner_error_ = NULL;
+ g_return_if_fail (self != NULL);
+ g_return_if_fail (path != NULL);
+ {
+ MprisPlaylists* _tmp0_;
+ const char* _tmp1_;
+ _tmp0_ = self->priv->_playlists;
+ _tmp1_ = path;
+ mpris_playlists_ActivatePlaylist (_tmp0_, _tmp1_, NULL, NULL);
+ }
+ goto __finally13;
+ __catch13_g_io_error:
+ {
+ GError* e = NULL;
+ const char* _tmp2_;
+ GError* _tmp3_;
+ const gchar* _tmp4_;
+ e = _inner_error_;
+ _inner_error_ = NULL;
+ _tmp2_ = path;
+ _tmp3_ = e;
+ _tmp4_ = _tmp3_->message;
+ g_warning ("mpris2-controller.vala:280: Could not activate playlist %s because %s", (const gchar*) _tmp2_, _tmp4_);
+ _g_error_free0 (e);
+ }
+ __finally13:
+ if (_inner_error_ != NULL) {
+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
+ g_clear_error (&_inner_error_);
+ return;
+ }
+}
+
+
+MprisRoot* mpris2_controller_get_mpris2_root (Mpris2Controller* self) {
+ MprisRoot* result;
+ MprisRoot* _tmp0_;
+ g_return_val_if_fail (self != NULL, NULL);
+ _tmp0_ = self->priv->_mpris2_root;
+ result = _tmp0_;
+ return result;
+}
+
+
+static void mpris2_controller_set_mpris2_root (Mpris2Controller* self, MprisRoot* value) {
+ MprisRoot* _tmp0_;
+ MprisRoot* _tmp1_;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = value;
+ _tmp1_ = _g_object_ref0 (_tmp0_);
+ _g_object_unref0 (self->priv->_mpris2_root);
+ self->priv->_mpris2_root = _tmp1_;
+ g_object_notify ((GObject *) self, "mpris2-root");
+}
+
+
+MprisPlayer* mpris2_controller_get_player (Mpris2Controller* self) {
+ MprisPlayer* result;
+ MprisPlayer* _tmp0_;
+ g_return_val_if_fail (self != NULL, NULL);
+ _tmp0_ = self->priv->_player;
+ result = _tmp0_;
+ return result;
+}
+
+
+static void mpris2_controller_set_player (Mpris2Controller* self, MprisPlayer* value) {
+ MprisPlayer* _tmp0_;
+ MprisPlayer* _tmp1_;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = value;
+ _tmp1_ = _g_object_ref0 (_tmp0_);
+ _g_object_unref0 (self->priv->_player);
+ self->priv->_player = _tmp1_;
+ g_object_notify ((GObject *) self, "player");
+}
+
+
+MprisPlaylists* mpris2_controller_get_playlists (Mpris2Controller* self) {
+ MprisPlaylists* result;
+ MprisPlaylists* _tmp0_;
+ g_return_val_if_fail (self != NULL, NULL);
+ _tmp0_ = self->priv->_playlists;
+ result = _tmp0_;
+ return result;
+}
+
+
+static void mpris2_controller_set_playlists (Mpris2Controller* self, MprisPlaylists* value) {
+ MprisPlaylists* _tmp0_;
+ MprisPlaylists* _tmp1_;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = value;
+ _tmp1_ = _g_object_ref0 (_tmp0_);
+ _g_object_unref0 (self->priv->_playlists);
+ self->priv->_playlists = _tmp1_;
+ g_object_notify ((GObject *) self, "playlists");
+}
+
+
+FreeDesktopProperties* mpris2_controller_get_properties_interface (Mpris2Controller* self) {
+ FreeDesktopProperties* result;
+ FreeDesktopProperties* _tmp0_;
+ g_return_val_if_fail (self != NULL, NULL);
+ _tmp0_ = self->priv->_properties_interface;
+ result = _tmp0_;
+ return result;
+}
+
+
+static void mpris2_controller_set_properties_interface (Mpris2Controller* self, FreeDesktopProperties* value) {
+ FreeDesktopProperties* _tmp0_;
+ FreeDesktopProperties* _tmp1_;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = value;
+ _tmp1_ = _g_object_ref0 (_tmp0_);
+ _g_object_unref0 (self->priv->_properties_interface);
+ self->priv->_properties_interface = _tmp1_;
+ g_object_notify ((GObject *) self, "properties-interface");
+}
+
+
+PlayerController* mpris2_controller_get_owner (Mpris2Controller* self) {
+ PlayerController* result;
+ PlayerController* _tmp0_;
+ g_return_val_if_fail (self != NULL, NULL);
+ _tmp0_ = self->priv->_owner;
+ result = _tmp0_;
+ return result;
+}
+
+
+static void mpris2_controller_set_owner (Mpris2Controller* self, PlayerController* value) {
+ PlayerController* _tmp0_;
+ PlayerController* _tmp1_;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = value;
+ _tmp1_ = _g_object_ref0 (_tmp0_);
+ _g_object_unref0 (self->priv->_owner);
+ self->priv->_owner = _tmp1_;
+ g_object_notify ((GObject *) self, "owner");
+}
+
+
+static void _mpris2_controller_property_changed_cb_free_desktop_properties_properties_changed (FreeDesktopProperties* _sender, const gchar* source, GHashTable* changed_properties, gchar** invalid, int invalid_length1, gpointer self) {
+ mpris2_controller_property_changed_cb (self, source, changed_properties, invalid, invalid_length1);
+}
+
+
+static void _mpris2_controller_on_playlistdetails_changed_mpris_playlists_playlist_changed (MprisPlaylists* _sender, PlaylistDetails* details, gpointer self) {
+ mpris2_controller_on_playlistdetails_changed (self, details);
+}
+
+
+static GObject * mpris2_controller_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
+ GObject * obj;
+ GObjectClass * parent_class;
+ Mpris2Controller * self;
+ GError * _inner_error_ = NULL;
+ parent_class = G_OBJECT_CLASS (mpris2_controller_parent_class);
+ obj = parent_class->constructor (type, n_construct_properties, construct_properties);
+ self = MPRIS2_CONTROLLER (obj);
+ {
+ PlayerController* _tmp0_;
+ const gchar* _tmp1_;
+ const gchar* _tmp2_;
+ MprisRoot* _tmp3_ = NULL;
+ MprisRoot* _tmp4_;
+ MprisRoot* _tmp5_;
+ PlayerController* _tmp6_;
+ const gchar* _tmp7_;
+ const gchar* _tmp8_;
+ MprisPlayer* _tmp9_ = NULL;
+ MprisPlayer* _tmp10_;
+ MprisPlayer* _tmp11_;
+ FreeDesktopProperties* _tmp12_ = NULL;
+ FreeDesktopProperties* _tmp13_;
+ FreeDesktopProperties* _tmp14_;
+ FreeDesktopProperties* _tmp15_;
+ PlayerController* _tmp16_;
+ gboolean* _tmp17_;
+ gboolean _tmp18_;
+ _tmp0_ = self->priv->_owner;
+ _tmp1_ = player_controller_get_dbus_name (_tmp0_);
+ _tmp2_ = _tmp1_;
+ _tmp3_ = g_initable_new (TYPE_MPRIS_ROOT_PROXY, NULL, &_inner_error_, "g-flags", 0, "g-name", _tmp2_, "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/mpris/MediaPlayer2", "g-interface-name", "org.mpris.MediaPlayer2", NULL);
+ _tmp4_ = (MprisRoot*) _tmp3_;
+ if (_inner_error_ != NULL) {
+ if (_inner_error_->domain == G_IO_ERROR) {
+ goto __catch14_g_io_error;
+ }
+ g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
+ g_clear_error (&_inner_error_);
+ }
+ _tmp5_ = _tmp4_;
+ mpris2_controller_set_mpris2_root (self, _tmp5_);
+ _g_object_unref0 (_tmp5_);
+ _tmp6_ = self->priv->_owner;
+ _tmp7_ = player_controller_get_dbus_name (_tmp6_);
+ _tmp8_ = _tmp7_;
+ _tmp9_ = g_initable_new (TYPE_MPRIS_PLAYER_PROXY, NULL, &_inner_error_, "g-flags", 0, "g-name", _tmp8_, "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/mpris/MediaPlayer2", "g-interface-name", "org.mpris.MediaPlayer2.Player", NULL);
+ _tmp10_ = (MprisPlayer*) _tmp9_;
+ if (_inner_error_ != NULL) {
+ if (_inner_error_->domain == G_IO_ERROR) {
+ goto __catch14_g_io_error;
+ }
+ g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
+ g_clear_error (&_inner_error_);
+ }
+ _tmp11_ = _tmp10_;
+ mpris2_controller_set_player (self, _tmp11_);
+ _g_object_unref0 (_tmp11_);
+ _tmp12_ = g_initable_new (TYPE_FREE_DESKTOP_PROPERTIES_PROXY, NULL, &_inner_error_, "g-flags", 0, "g-name", "org.freedesktop.Properties.PropertiesChanged", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/mpris/MediaPlayer2", "g-interface-name", "org.freedesktop.DBus.Properties", NULL);
+ _tmp13_ = (FreeDesktopProperties*) _tmp12_;
+ if (_inner_error_ != NULL) {
+ if (_inner_error_->domain == G_IO_ERROR) {
+ goto __catch14_g_io_error;
+ }
+ g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
+ g_clear_error (&_inner_error_);
+ }
+ _tmp14_ = _tmp13_;
+ mpris2_controller_set_properties_interface (self, _tmp14_);
+ _g_object_unref0 (_tmp14_);
+ _tmp15_ = self->priv->_properties_interface;
+ g_signal_connect_object (_tmp15_, "properties-changed", (GCallback) _mpris2_controller_property_changed_cb_free_desktop_properties_properties_changed, self, 0);
+ _tmp16_ = self->priv->_owner;
+ _tmp17_ = _tmp16_->use_playlists;
+ _tmp18_ = TRUE;
+ if (_bool_equal (_tmp17_, &_tmp18_) == TRUE) {
+ PlayerController* _tmp19_;
+ const gchar* _tmp20_;
+ const gchar* _tmp21_;
+ MprisPlaylists* _tmp22_ = NULL;
+ MprisPlaylists* _tmp23_;
+ MprisPlaylists* _tmp24_;
+ MprisPlaylists* _tmp25_;
+ _tmp19_ = self->priv->_owner;
+ _tmp20_ = player_controller_get_dbus_name (_tmp19_);
+ _tmp21_ = _tmp20_;
+ _tmp22_ = g_initable_new (TYPE_MPRIS_PLAYLISTS_PROXY, NULL, &_inner_error_, "g-flags", 0, "g-name", _tmp21_, "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/mpris/MediaPlayer2", "g-interface-name", "org.mpris.MediaPlayer2.Playlists", NULL);
+ _tmp23_ = (MprisPlaylists*) _tmp22_;
+ if (_inner_error_ != NULL) {
+ if (_inner_error_->domain == G_IO_ERROR) {
+ goto __catch14_g_io_error;
+ }
+ g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
+ g_clear_error (&_inner_error_);
+ }
+ _tmp24_ = _tmp23_;
+ mpris2_controller_set_playlists (self, _tmp24_);
+ _g_object_unref0 (_tmp24_);
+ _tmp25_ = self->priv->_playlists;
+ g_signal_connect_object (_tmp25_, "playlist-changed", (GCallback) _mpris2_controller_on_playlistdetails_changed_mpris_playlists_playlist_changed, self, 0);
+ }
+ }
+ goto __finally14;
+ __catch14_g_io_error:
+ {
+ GError* e = NULL;
+ GError* _tmp26_;
+ const gchar* _tmp27_;
+ e = _inner_error_;
+ _inner_error_ = NULL;
+ _tmp26_ = e;
+ _tmp27_ = _tmp26_->message;
+ g_critical ("mpris2-controller.vala:57: Problems connecting to the session bus - %s", _tmp27_);
+ _g_error_free0 (e);
+ }
+ __finally14:
+ if (_inner_error_ != NULL) {
+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
+ g_clear_error (&_inner_error_);
+ }
+ return obj;
+}
+
+
+static void mpris2_controller_class_init (Mpris2ControllerClass * klass) {
+ mpris2_controller_parent_class = g_type_class_peek_parent (klass);
+ g_type_class_add_private (klass, sizeof (Mpris2ControllerPrivate));
+ G_OBJECT_CLASS (klass)->get_property = _vala_mpris2_controller_get_property;
+ G_OBJECT_CLASS (klass)->set_property = _vala_mpris2_controller_set_property;
+ G_OBJECT_CLASS (klass)->constructor = mpris2_controller_constructor;
+ G_OBJECT_CLASS (klass)->finalize = mpris2_controller_finalize;
+ g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS2_CONTROLLER_MPRIS2_ROOT, g_param_spec_object ("mpris2-root", "mpris2-root", "mpris2-root", TYPE_MPRIS_ROOT, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS2_CONTROLLER_PLAYER, g_param_spec_object ("player", "player", "player", TYPE_MPRIS_PLAYER, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS2_CONTROLLER_PLAYLISTS, g_param_spec_object ("playlists", "playlists", "playlists", TYPE_MPRIS_PLAYLISTS, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS2_CONTROLLER_PROPERTIES_INTERFACE, g_param_spec_object ("properties-interface", "properties-interface", "properties-interface", TYPE_FREE_DESKTOP_PROPERTIES, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS2_CONTROLLER_OWNER, g_param_spec_object ("owner", "owner", "owner", TYPE_PLAYER_CONTROLLER, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
+}
+
+
+static void mpris2_controller_instance_init (Mpris2Controller * self) {
+ self->priv = MPRIS2_CONTROLLER_GET_PRIVATE (self);
+}
+
+
+static void mpris2_controller_finalize (GObject* obj) {
+ Mpris2Controller * self;
+ self = MPRIS2_CONTROLLER (obj);
+ _g_object_unref0 (self->priv->_mpris2_root);
+ _g_object_unref0 (self->priv->_player);
+ _g_object_unref0 (self->priv->_playlists);
+ _g_object_unref0 (self->priv->_properties_interface);
+ _g_object_unref0 (self->priv->_owner);
+ G_OBJECT_CLASS (mpris2_controller_parent_class)->finalize (obj);
+}
+
+
+GType mpris2_controller_get_type (void) {
+ static volatile gsize mpris2_controller_type_id__volatile = 0;
+ if (g_once_init_enter (&mpris2_controller_type_id__volatile)) {
+ static const GTypeInfo g_define_type_info = { sizeof (Mpris2ControllerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) mpris2_controller_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Mpris2Controller), 0, (GInstanceInitFunc) mpris2_controller_instance_init, NULL };
+ GType mpris2_controller_type_id;
+ mpris2_controller_type_id = g_type_register_static (G_TYPE_OBJECT, "Mpris2Controller", &g_define_type_info, 0);
+ g_once_init_leave (&mpris2_controller_type_id__volatile, mpris2_controller_type_id);
+ }
+ return mpris2_controller_type_id__volatile;
+}
+
+
+static void _vala_mpris2_controller_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
+ Mpris2Controller * self;
+ self = MPRIS2_CONTROLLER (object);
+ switch (property_id) {
+ case MPRIS2_CONTROLLER_MPRIS2_ROOT:
+ g_value_set_object (value, mpris2_controller_get_mpris2_root (self));
+ break;
+ case MPRIS2_CONTROLLER_PLAYER:
+ g_value_set_object (value, mpris2_controller_get_player (self));
+ break;
+ case MPRIS2_CONTROLLER_PLAYLISTS:
+ g_value_set_object (value, mpris2_controller_get_playlists (self));
+ break;
+ case MPRIS2_CONTROLLER_PROPERTIES_INTERFACE:
+ g_value_set_object (value, mpris2_controller_get_properties_interface (self));
+ break;
+ case MPRIS2_CONTROLLER_OWNER:
+ g_value_set_object (value, mpris2_controller_get_owner (self));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+
+static void _vala_mpris2_controller_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
+ Mpris2Controller * self;
+ self = MPRIS2_CONTROLLER (object);
+ switch (property_id) {
+ case MPRIS2_CONTROLLER_MPRIS2_ROOT:
+ mpris2_controller_set_mpris2_root (self, g_value_get_object (value));
+ break;
+ case MPRIS2_CONTROLLER_PLAYER:
+ mpris2_controller_set_player (self, g_value_get_object (value));
+ break;
+ case MPRIS2_CONTROLLER_PLAYLISTS:
+ mpris2_controller_set_playlists (self, g_value_get_object (value));
+ break;
+ case MPRIS2_CONTROLLER_PROPERTIES_INTERFACE:
+ mpris2_controller_set_properties_interface (self, g_value_get_object (value));
+ break;
+ case MPRIS2_CONTROLLER_OWNER:
+ mpris2_controller_set_owner (self, g_value_get_object (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+
+static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
+ if ((array != NULL) && (destroy_func != NULL)) {
+ int i;
+ for (i = 0; i < array_length; i = i + 1) {
+ if (((gpointer*) array)[i] != NULL) {
+ destroy_func (((gpointer*) array)[i]);
+ }
+ }
+ }
+}
+
+
+static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
+ _vala_array_destroy (array, array_length, destroy_func);
+ g_free (array);
+}
+
+
+
diff --git a/.pc/lp_960846.patch/src/mpris2-controller.vala b/.pc/lp_960846.patch/src/mpris2-controller.vala
new file mode 100644
index 0000000..9cd02c4
--- /dev/null
+++ b/.pc/lp_960846.patch/src/mpris2-controller.vala
@@ -0,0 +1,283 @@
+/*
+Copyright 2010 Canonical Ltd.
+
+Authors:
+ Conor Curran <conor.curran@canonical.com>
+
+This program is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 3, as published
+by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranties of
+MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+using Dbusmenu;
+using Transport;
+
+public class Mpris2Controller : GLib.Object
+{
+ public const int MAX_PLAYLIST_COUNT = 100;
+
+ public MprisRoot mpris2_root {get; construct;}
+ public MprisPlayer player {get; construct;}
+ public MprisPlaylists playlists {get; construct;}
+ public FreeDesktopProperties properties_interface {get; construct;}
+ public PlayerController owner {get; construct;}
+
+ public Mpris2Controller(PlayerController ctrl)
+ {
+ GLib.Object(owner: ctrl);
+ }
+
+ construct{
+ try {
+ this.mpris2_root = Bus.get_proxy_sync ( BusType.SESSION,
+ this.owner.dbus_name,
+ "/org/mpris/MediaPlayer2" );
+ this.player = Bus.get_proxy_sync ( BusType.SESSION,
+ this.owner.dbus_name,
+ "/org/mpris/MediaPlayer2" );
+ this.properties_interface = Bus.get_proxy_sync ( BusType.SESSION,
+ "org.freedesktop.Properties.PropertiesChanged",
+ "/org/mpris/MediaPlayer2" );
+ this.properties_interface.PropertiesChanged.connect ( property_changed_cb );
+ if ( this.owner.use_playlists == true ){
+ this.playlists = Bus.get_proxy_sync ( BusType.SESSION,
+ this.owner.dbus_name,
+ "/org/mpris/MediaPlayer2" );
+ this.playlists.PlaylistChanged.connect (on_playlistdetails_changed);
+ }
+ }
+ catch (IOError e) {
+ critical("Problems connecting to the session bus - %s", e.message);
+ }
+ }
+ /*
+ * property_changed_cb
+ * Called when a property changed signal is emitted from any of mpris
+ * objects on the bus.
+ * Note that the signal will be received by each instance for each player
+ * and at that moment there is no way to know what player that signal
+ * came from therefore it is necessary to query each relevant property
+ * to update the respective dbusmenuitem property inorder to keep the UI in sync
+ * Please also note due to some race condition in the depths of gdbus
+ * a timeout is needed between receiving the prop update and query the respective property.
+ * This can be seen at various points below.
+ */
+ public void property_changed_cb ( string interface_source,
+ HashTable<string, Variant?> changed_properties,
+ string[] invalid )
+ {
+ if ( changed_properties == null ||
+ interface_source.has_prefix ( MPRIS_PREFIX ) == false ){
+ warning("Property-changed hash is null or this is an interface that doesn't concern us");
+ return;
+ }
+ Variant? play_v = changed_properties.lookup("PlaybackStatus");
+ if(play_v != null){
+ string state = this.player.PlaybackStatus;
+ Timeout.add ( 200, ensure_correct_playback_status );
+ Transport.State p = (Transport.State)this.determine_play_state(state);
+ (this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(p);
+ }
+ Variant? meta_v = changed_properties.lookup("Metadata");
+ if(meta_v != null)
+ {
+ Timeout.add ( 200, ensure_correct_metadata );
+ }
+ Variant? playlist_v = changed_properties.lookup("ActivePlaylist");
+ if ( playlist_v != null && this.owner.use_playlists == true ){
+ Timeout.add (500, this.fetch_active_playlist);
+ }
+ Variant? playlist_count_v = changed_properties.lookup("PlaylistCount");
+ if ( playlist_count_v != null && this.owner.use_playlists == true ){
+ this.fetch_playlists.begin();
+ this.fetch_active_playlist();
+ }
+ Variant? playlist_orderings_v = changed_properties.lookup("Orderings");
+ if ( playlist_orderings_v != null && this.owner.use_playlists == true ){
+ this.fetch_playlists.begin();
+ this.fetch_active_playlist();
+ }
+ Variant? identity_v = changed_properties.lookup("Identity");
+ if (identity_v != null){
+ MetadataMenuitem md = this.owner.custom_items[PlayerController.widget_order.METADATA] as MetadataMenuitem;
+ md.alter_label (this.mpris2_root.Identity);
+ }
+ }
+
+ private bool ensure_correct_metadata ()
+ {
+ GLib.HashTable<string, Variant?> changed_updates = clean_metadata();
+ PlayerItem metadata = this.owner.custom_items[PlayerController.widget_order.METADATA];
+ metadata.reset (MetadataMenuitem.relevant_attributes_for_ui());
+ metadata.update ( changed_updates,
+ MetadataMenuitem.relevant_attributes_for_ui());
+ MetadataMenuitem md = this.owner.custom_items[PlayerController.widget_order.METADATA] as MetadataMenuitem;
+ bool collapsing = !metadata.populated(MetadataMenuitem.relevant_attributes_for_ui());
+ md.should_collapse(collapsing);
+
+ return false;
+ }
+
+ private bool ensure_correct_playback_status()
+ {
+ Transport.State p = (Transport.State)this.determine_play_state(this.player.PlaybackStatus);
+ (this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(p);
+ return false;
+ }
+
+ private GLib.HashTable<string, Variant?>? clean_metadata()
+ {
+ GLib.HashTable<string, Variant?> changed_updates = this.player.Metadata;
+
+ Variant? artist_v = this.player.Metadata.lookup("xesam:artist");
+ if(artist_v != null){
+ string display_artists;
+ // Accomodate Spotify (should return 'as' and not 's')
+ if(artist_v.get_type_string() == "s"){
+ display_artists = artist_v.get_string();
+ }
+ else{
+ string[] artists = artist_v.dup_strv();
+ display_artists = string.joinv(", ", artists);
+ }
+ changed_updates.replace("xesam:artist", display_artists);
+ }
+ return changed_updates;
+ }
+
+ private Transport.State determine_play_state(string? status){
+ if(status != null && status == "Playing"){
+ return Transport.State.PLAYING;
+ }
+ return Transport.State.PAUSED;
+ }
+
+ public void initial_update()
+ {
+ Transport.State update;
+
+ if(this.player.PlaybackStatus == null){
+ update = Transport.State.PAUSED;
+ }
+ else{
+ update = determine_play_state (this.player.PlaybackStatus);
+ }
+ if (this.mpris2_root.Identity != null){
+ MetadataMenuitem md = this.owner.custom_items[PlayerController.widget_order.METADATA] as MetadataMenuitem;
+ md.alter_label (this.mpris2_root.Identity);
+ }
+ (this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state (update);
+ GLib.HashTable<string, Value?>? cleaned_metadata = this.clean_metadata();
+ this.owner.custom_items[PlayerController.widget_order.METADATA].update (cleaned_metadata,
+ MetadataMenuitem.attributes_format());
+
+ if ( this.owner.use_playlists == true ){
+ this.fetch_playlists.begin();
+ this.fetch_active_playlist();
+ }
+ }
+
+ public void transport_update(Transport.Action command)
+ {
+ if(command == Transport.Action.PLAY_PAUSE){
+ this.player.PlayPause.begin();
+ }
+ else if(command == Transport.Action.PREVIOUS){
+ this.player.Previous.begin();
+ }
+ else if(command == Transport.Action.NEXT){
+ this.player.Next.begin();
+ }
+ else if(command == Transport.Action.REWIND){
+ this.player.Seek.begin(-500000);
+ }
+ else if(command == Transport.Action.FORWIND){
+ this.player.Seek.begin(400000);
+ }
+ }
+
+ public bool connected()
+ {
+ return (this.player != null && this.mpris2_root != null);
+ }
+
+ public void expose()
+ {
+ if(this.connected() == true){
+ this.mpris2_root.Raise.begin();
+ }
+ }
+
+ private void on_playlistdetails_changed (PlaylistDetails details)
+ {
+ PlaylistsMenuitem playlists_item = this.owner.custom_items[PlayerController.widget_order.PLAYLISTS] as PlaylistsMenuitem;
+ playlists_item.update_individual_playlist (details);
+ }
+
+ public async void fetch_playlists()
+ {
+ PlaylistDetails[] current_playlists = null;
+
+ try{
+ current_playlists = yield this.playlists.GetPlaylists (0,
+ MAX_PLAYLIST_COUNT,
+ "Alphabetical",
+ false);
+ }
+ catch (IOError e){
+ return;
+ }
+
+ if( current_playlists != null ){
+ PlaylistsMenuitem playlists_item = this.owner.custom_items[PlayerController.widget_order.PLAYLISTS] as PlaylistsMenuitem;
+ playlists_item.update(current_playlists);
+ }
+ else{
+ warning(" Playlists are on but %s is returning no current_playlists ?",
+ this.owner.app_info.get_name());
+ this.owner.use_playlists = false;
+ }
+ }
+
+ private bool validate_playlists_details()
+ {
+ if (this.playlists.ActivePlaylist.valid == false){
+ return false;
+ }
+ if (this.playlists.ActivePlaylist.details == null){
+ return false;
+ }
+ if (this.playlists.ActivePlaylist.details.path == null ||
+ this.playlists.ActivePlaylist.details.name == null){
+ return false;
+ }
+ return true;
+ }
+
+ private bool fetch_active_playlist()
+ {
+ if (this.validate_playlists_details() == false){
+ return false;
+ }
+ PlaylistsMenuitem playlists_item = this.owner.custom_items[PlayerController.widget_order.PLAYLISTS] as PlaylistsMenuitem;
+ playlists_item.active_playlist_update ( this.playlists.ActivePlaylist.details );
+ return false;
+ }
+
+ public void activate_playlist (ObjectPath path)
+ {
+ try{
+ this.playlists.ActivatePlaylist.begin(path);
+ }
+ catch(IOError e){
+ warning ("Could not activate playlist %s because %s", (string)path, e.message);
+ }
+ }
+}
diff --git a/.pc/sound_nua.patch/src/sound-service-dbus.c b/.pc/sound_nua.patch/src/sound-service-dbus.c
new file mode 100644
index 0000000..7cad2bc
--- /dev/null
+++ b/.pc/sound_nua.patch/src/sound-service-dbus.c
@@ -0,0 +1,489 @@
+/*
+ * Copyright 2010 Canonical Ltd.
+ *
+ * Authors:
+ * Conor Curran <conor.curran@canonical.com>
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 3, as published
+ * by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranties of
+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gio/gio.h>
+#include <unistd.h>
+#include <glib/gi18n.h>
+#include <libindicator/indicator-service.h>
+#include <libdbusmenu-glib/server.h>
+#include <libdbusmenu-glib/client.h>
+
+#include "sound-service-dbus.h"
+#include "device.h"
+#include "gen-sound-service.xml.h"
+#include "dbus-shared-names.h"
+#include "sound-service-marshal.h"
+
+// DBUS methods
+static void bus_method_call (GDBusConnection * connection,
+ const gchar * sender,
+ const gchar * path,
+ const gchar * interface,
+ const gchar * method,
+ GVariant * params,
+ GDBusMethodInvocation * invocation,
+ gpointer user_data);
+
+static GDBusInterfaceVTable interface_table = {
+ method_call: bus_method_call,
+ get_property: NULL, /* No properties */
+ set_property: NULL /* No properties */
+};
+
+
+typedef struct _SoundServiceDbusPrivate SoundServiceDbusPrivate;
+
+struct _SoundServiceDbusPrivate {
+ GDBusConnection* connection;
+ DbusmenuMenuitem* root_menuitem;
+ Device* device;
+ gboolean greeter_mode;
+ guint registration_id;
+};
+
+enum {
+ TRACK_SPECIFIC_ITEM,
+ PLAYER_SPECIFIC_ITEM,
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+static GDBusNodeInfo * node_info = NULL;
+static GDBusInterfaceInfo * interface_info = NULL;
+
+#define SOUND_SERVICE_DBUS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SOUND_SERVICE_DBUS_TYPE, SoundServiceDbusPrivate))
+
+static void sound_service_dbus_class_init (SoundServiceDbusClass *klass);
+static void sound_service_dbus_init (SoundServiceDbus *self);
+static void sound_service_dbus_dispose (GObject *object);
+static void sound_service_dbus_finalize (GObject *object);
+
+static void show_sound_settings_dialog (DbusmenuMenuitem *mi,
+ gpointer user_data);
+static gboolean sound_service_dbus_blacklist_player (SoundServiceDbus* self,
+ gchar* player_name,
+ gboolean blacklist);
+
+static gboolean sound_service_dbus_is_blacklisted (SoundServiceDbus* self,
+ gchar* player_name);
+
+G_DEFINE_TYPE (SoundServiceDbus, sound_service_dbus, G_TYPE_OBJECT);
+
+static void
+sound_service_dbus_class_init (SoundServiceDbusClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (object_class, sizeof(SoundServiceDbusPrivate));
+
+ object_class->dispose = sound_service_dbus_dispose;
+ object_class->finalize = sound_service_dbus_finalize;
+
+ g_assert(klass != NULL);
+
+ if (node_info == NULL) {
+ GError * error = NULL;
+
+ node_info = g_dbus_node_info_new_for_xml(_sound_service, &error);
+ if (error != NULL) {
+ g_critical ("Unable to parse Indicator Service Interface description: %s",
+ error->message);
+ g_error_free(error);
+ }
+ }
+
+ if (interface_info == NULL) {
+ interface_info = g_dbus_node_info_lookup_interface (node_info,
+ INDICATOR_SOUND_DBUS_INTERFACE);
+
+ if (interface_info == NULL) {
+ g_critical("Unable to find interface '" INDICATOR_SOUND_DBUS_INTERFACE "'");
+ }
+ }
+ signals[TRACK_SPECIFIC_ITEM] = g_signal_new("track-specific-item-requested",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ _sound_service_marshal_VOID__STRING_STRING,
+ G_TYPE_NONE, 2, G_TYPE_STRING,
+ G_TYPE_STRING);
+ signals[PLAYER_SPECIFIC_ITEM] = g_signal_new("player-specific-item-requested",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ _sound_service_marshal_VOID__STRING_STRING,
+ G_TYPE_NONE, 2, G_TYPE_STRING,
+ G_TYPE_STRING);
+}
+
+static void
+sound_service_dbus_init (SoundServiceDbus *self)
+{
+ GError *error = NULL;
+ SoundServiceDbusPrivate * priv = SOUND_SERVICE_DBUS_GET_PRIVATE(self);
+
+ priv->connection = NULL;
+
+ /* Fetch the session bus */
+ priv->connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
+
+ if (error != NULL) {
+ g_critical ("sound-service-dbus:Unable to connect to the session bus when creating indicator sound service : %s", error->message);
+ g_error_free (error);
+ return;
+ }
+ /* register the service on it */
+ priv->registration_id = g_dbus_connection_register_object (priv->connection,
+ INDICATOR_SOUND_SERVICE_DBUS_OBJECT_PATH,
+ interface_info,
+ &interface_table,
+ self,
+ NULL,
+ &error);
+ if (error != NULL) {
+ g_critical ("Unable to register the sound service on DBus: %s", error->message);
+ g_error_free (error);
+ }
+}
+
+DbusmenuMenuitem*
+sound_service_dbus_create_root_item (SoundServiceDbus* self, gboolean greeter_mode)
+{
+ SoundServiceDbusPrivate * priv = SOUND_SERVICE_DBUS_GET_PRIVATE(self);
+ priv->greeter_mode = greeter_mode;
+ priv->root_menuitem = dbusmenu_menuitem_new();
+ DbusmenuServer *server = dbusmenu_server_new (INDICATOR_SOUND_MENU_DBUS_OBJECT_PATH);
+ dbusmenu_server_set_root (server, priv->root_menuitem);
+ g_object_unref (priv->root_menuitem);
+ priv->device = device_new (self);
+ return priv->root_menuitem;
+}
+
+void
+sound_service_dbus_build_sound_menu ( SoundServiceDbus* self,
+ DbusmenuMenuitem* mute_item,
+ DbusmenuMenuitem* slider_item,
+ DbusmenuMenuitem* voip_input_menu_item)
+{
+ SoundServiceDbusPrivate * priv = SOUND_SERVICE_DBUS_GET_PRIVATE(self);
+
+ // Mute, Volume and Voip widgets
+ dbusmenu_menuitem_child_add_position (priv->root_menuitem, mute_item, 0);
+ dbusmenu_menuitem_child_add_position (priv->root_menuitem, slider_item, 1);
+ dbusmenu_menuitem_child_add_position (priv->root_menuitem, voip_input_menu_item, 2);
+
+ if (!priv->greeter_mode) {
+ // Separator
+ DbusmenuMenuitem* separator = dbusmenu_menuitem_new();
+
+ dbusmenu_menuitem_property_set (separator,
+ DBUSMENU_MENUITEM_PROP_TYPE,
+ DBUSMENU_CLIENT_TYPES_SEPARATOR);
+ dbusmenu_menuitem_child_add_position (priv->root_menuitem, separator, 3);
+ g_object_unref (separator);
+
+ // Sound preferences dialog
+ DbusmenuMenuitem* settings_mi = dbusmenu_menuitem_new();
+
+ dbusmenu_menuitem_property_set( settings_mi,
+ DBUSMENU_MENUITEM_PROP_LABEL,
+ _("Sound Settings..."));
+ dbusmenu_menuitem_child_append(priv->root_menuitem, settings_mi);
+ g_object_unref (settings_mi);
+ g_signal_connect(G_OBJECT(settings_mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED,
+ G_CALLBACK(show_sound_settings_dialog), NULL);
+ }
+}
+
+/**
+show_sound_settings_dialog:
+Bring up the gnome volume preferences dialog
+**/
+static void
+show_sound_settings_dialog (DbusmenuMenuitem *mi,
+ gpointer user_data)
+{
+ GError * error = NULL;
+ if (!g_spawn_command_line_async("gnome-volume-control --page=applications", &error) &&
+ !g_spawn_command_line_async("gnome-control-center sound", &error) &&
+ !g_spawn_command_line_async("xfce4-mixer", &error))
+ {
+ g_warning("Unable to show dialog: %s", error->message);
+ g_error_free(error);
+ }
+}
+
+static void
+sound_service_dbus_dispose (GObject *object)
+{
+ SoundServiceDbusPrivate *priv = SOUND_SERVICE_DBUS_GET_PRIVATE (object);
+
+ if (priv->connection && priv->registration_id) {
+ g_dbus_connection_unregister_object (priv->connection, priv->registration_id);
+ priv->registration_id = 0;
+ }
+
+ g_clear_object(&priv->connection);
+
+ G_OBJECT_CLASS (sound_service_dbus_parent_class)->dispose (object);
+ //TODO dispose of the active sink instance !
+ return;
+}
+
+static void
+sound_service_dbus_finalize (GObject *object)
+{
+ G_OBJECT_CLASS (sound_service_dbus_parent_class)->finalize (object);
+ return;
+}
+
+
+// EMIT STATE SIGNAL
+void
+sound_service_dbus_update_sound_state (SoundServiceDbus* self,
+ SoundState new_state)
+{
+ SoundServiceDbusPrivate *priv = SOUND_SERVICE_DBUS_GET_PRIVATE (self);
+
+ GVariant* v_output = g_variant_new("(i)", (int)new_state);
+
+ GError * error = NULL;
+
+ if (priv->connection == NULL ||
+ g_dbus_connection_is_closed (priv->connection) == TRUE){
+ g_critical ("sound_service_dbus_update_sound_state - dbus connection is %s !!",
+ priv->connection == NULL? "NULL" : "closed");
+ return;
+ }
+
+ //g_debug ("emitting state signal with value %i", (int)new_state);
+ g_dbus_connection_emit_signal( priv->connection,
+ NULL,
+ INDICATOR_SOUND_SERVICE_DBUS_OBJECT_PATH,
+ INDICATOR_SOUND_DBUS_INTERFACE,
+ INDICATOR_SOUND_SIGNAL_STATE_UPDATE,
+ v_output,
+ &error );
+ if (error != NULL) {
+ g_critical ("Unable to emit signal because : %s", error->message);
+ g_error_free(error);
+ }
+}
+
+//HANDLE DBUS METHOD CALLS
+static void
+bus_method_call (GDBusConnection * connection,
+ const gchar * sender,
+ const gchar * path,
+ const gchar * interface,
+ const gchar * method,
+ GVariant * params,
+ GDBusMethodInvocation * invocation,
+ gpointer user_data)
+{
+ SoundServiceDbus* service = SOUND_SERVICE_DBUS(user_data);
+ g_return_if_fail ( IS_SOUND_SERVICE_DBUS(service) );
+ GVariant * retval = NULL;
+ SoundServiceDbusPrivate *priv = SOUND_SERVICE_DBUS_GET_PRIVATE (service);
+
+ if (g_strcmp0(method, "GetSoundState") == 0) {
+ g_debug("Get state - %i", device_get_state (priv->device));
+ retval = g_variant_new ( "(i)", device_get_state (priv->device));
+ }
+ else if (g_strcmp0(method, "BlacklistMediaPlayer") == 0) {
+ gboolean blacklist;
+ gchar* player_name;
+ g_variant_get (params, "(sb)", &player_name, &blacklist);
+
+ g_debug ("BlacklistMediaPlayer - bool %i", blacklist);
+ g_debug ("BlacklistMediaPlayer - name %s", player_name);
+ gboolean result = sound_service_dbus_blacklist_player (service,
+ player_name,
+ blacklist);
+ retval = g_variant_new ("(b)", result);
+ }
+ else if (g_strcmp0(method, "IsBlacklisted") == 0) {
+ gchar* player_name;
+ g_variant_get (params, "(s)", &player_name);
+
+ g_debug ("IsBlacklisted - name %s", player_name);
+ gboolean result = sound_service_dbus_is_blacklisted (service,
+ player_name);
+ retval = g_variant_new ("(b)", result);
+ }
+ else if (g_strcmp0(method, "EnableTrackSpecificItems") == 0) {
+ g_debug ("EnableTrackSpecificItems");
+ gchar* player_object_path;
+ gchar* player_id;
+ g_variant_get (params, "(os)", &player_object_path, &player_id);
+ //g_debug ("object path = %s and id = %s", player_object_path, player_id);
+ g_signal_emit (service,
+ signals[TRACK_SPECIFIC_ITEM],
+ 0,
+ player_object_path,
+ player_id);
+ g_free (player_object_path);
+ g_free (player_id);
+
+ }
+ else if (g_strcmp0(method, "EnablePlayerSpecificItems") == 0) {
+ gchar* player_object_path;
+ gchar* player_id;
+ g_variant_get (params, "(os)", &player_object_path, &player_id);
+ g_debug ("PLayer specific item - object path = %s and id = %s",
+ player_object_path,
+ player_id);
+ g_signal_emit (service,
+ signals[PLAYER_SPECIFIC_ITEM],
+ 0,
+ player_object_path,
+ player_id);
+ g_free (player_object_path);
+ g_free (player_id);
+ }
+ else {
+ g_warning("Calling method '%s' on the sound service but it's unknown", method);
+ }
+ g_dbus_method_invocation_return_value (invocation, retval);
+}
+
+/**
+ TODO - Works nicely but refactor into at least two different methods
+**/
+static gboolean sound_service_dbus_blacklist_player (SoundServiceDbus* self,
+ gchar* player_name,
+ gboolean blacklist)
+{
+ g_return_val_if_fail (player_name != NULL, FALSE);
+ g_return_val_if_fail (IS_SOUND_SERVICE_DBUS (self), FALSE);
+
+ GVariant* the_black_list;
+ gboolean result = FALSE;
+ GSettings* our_settings;
+ GVariantIter iter;
+ gchar *str;
+ GVariantBuilder builder;
+
+ our_settings = g_settings_new ("com.canonical.indicator.sound");
+ the_black_list = g_settings_get_value (our_settings,
+ "blacklisted-media-players");
+ g_variant_iter_init (&iter, the_black_list);
+ g_variant_builder_init(&builder, G_VARIANT_TYPE_STRING_ARRAY);
+
+ while (g_variant_iter_loop (&iter, "s", &str)){
+ g_variant_builder_add (&builder, "s", str);
+ }
+ g_variant_iter_init (&iter, the_black_list);
+
+ if (blacklist == TRUE){
+ while (g_variant_iter_loop (&iter, "s", &str)){
+ g_print ("first pass to check if %s is present\n", str);
+ if (g_strcmp0 (player_name, str) == 0){
+ // Return if its already there
+ g_debug ("we have this already blacklisted, no need to do anything");
+ g_variant_builder_clear (&builder);
+ g_object_unref (our_settings);
+ g_variant_unref (the_black_list);
+ return result;
+ }
+ }
+ // Otherwise blacklist it !
+ g_debug ("about to blacklist %s", player_name);
+ g_variant_builder_add (&builder, "s", player_name);
+ }
+ else{
+ gboolean present = FALSE;
+ g_variant_iter_init (&iter, the_black_list);
+ g_debug ("attempting to UN-blacklist %s", player_name);
+
+ while (g_variant_iter_loop (&iter, "s", &str)){
+ if (g_strcmp0 (player_name, str) == 0){
+ present = TRUE;
+ }
+ }
+ // It was not there anyway, return false
+ if (present == FALSE){
+ g_debug ("it was not blacklisted ?, no need to do anything");
+ g_variant_builder_clear (&builder);
+ g_object_unref (our_settings);
+ g_variant_unref (the_black_list);
+ return result;
+ }
+
+ // Otherwise free the builder and reconstruct ensuring no duplicates.
+ g_variant_builder_clear (&builder);
+ g_variant_builder_init (&builder, G_VARIANT_TYPE_STRING_ARRAY);
+
+ g_variant_iter_init (&iter, the_black_list);
+
+ while (g_variant_iter_loop (&iter, "s", &str)){
+ if (g_strcmp0 (player_name, str) != 0){
+ g_variant_builder_add (&builder, "s", str);
+ }
+ }
+ }
+ GVariant* value = g_variant_builder_end (&builder);
+ result = g_settings_set_value (our_settings,
+ "blacklisted-media-players",
+ value);
+
+ g_object_unref (our_settings);
+ g_variant_unref (the_black_list);
+
+ return result;
+}
+
+static gboolean sound_service_dbus_is_blacklisted (SoundServiceDbus *self,
+ gchar *player_name)
+{
+ GSettings *our_settings;
+ GVariant *the_black_list;
+ GVariantIter iter;
+ gchar *str;
+ gboolean result = FALSE;
+
+ g_return_val_if_fail (player_name != NULL, FALSE);
+ g_return_val_if_fail (IS_SOUND_SERVICE_DBUS (self), FALSE);
+
+ our_settings = g_settings_new ("com.canonical.indicator.sound");
+ the_black_list = g_settings_get_value (our_settings,
+ "blacklisted-media-players");
+ g_variant_iter_init (&iter, the_black_list);
+ while (g_variant_iter_next (&iter, "s", &str)){
+ if (g_strcmp0 (player_name, str) == 0) {
+ result = TRUE;
+ g_free (str);
+ break;
+ }
+ g_free (str);
+ }
+
+ g_object_unref (our_settings);
+ g_variant_unref (the_black_list);
+
+ return result;
+}
+
diff --git a/src/metadata-widget.c b/src/metadata-widget.c
index ceae79a..7c7e750 100644
--- a/src/metadata-widget.c
+++ b/src/metadata-widget.c
@@ -228,7 +228,7 @@ metadata_widget_init (MetadataWidget *self)
GtkWidget* player_label;
player_label = gtk_label_new ("");
gtk_misc_set_alignment(GTK_MISC(player_label), (gfloat)0, (gfloat)0);
- gtk_misc_set_padding (GTK_MISC(player_label), (gfloat)1, (gfloat)4);
+ gtk_misc_set_padding (GTK_MISC(player_label), (gfloat)1, (gfloat)3);
gtk_widget_set_size_request (player_label, 150, 24);
priv->player_label = player_label;
diff --git a/src/mpris2-controller.c b/src/mpris2-controller.c
index 57250b6..a471d07 100644
--- a/src/mpris2-controller.c
+++ b/src/mpris2-controller.c
@@ -151,6 +151,7 @@ typedef struct _PlaylistsMenuitem PlaylistsMenuitem;
typedef struct _PlaylistsMenuitemClass PlaylistsMenuitemClass;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _Mpris2ControllerFetchPlaylistsData Mpris2ControllerFetchPlaylistsData;
+#define _active_playlist_container_free0(var) ((var == NULL) ? NULL : (var = (active_playlist_container_free (var), NULL)))
struct _Mpris2Controller {
GObject parent_instance;
@@ -218,7 +219,7 @@ struct _MprisPlaylistsIface {
void (*set_Orderings) (MprisPlaylists* self, gchar** value, int value_length1);
guint32 (*get_PlaylistCount) (MprisPlaylists* self);
void (*set_PlaylistCount) (MprisPlaylists* self, guint32 value);
- void (*get_ActivePlaylist) (MprisPlaylists* self, ActivePlaylistContainer* value);
+ ActivePlaylistContainer* (*get_ActivePlaylist) (MprisPlaylists* self);
void (*set_ActivePlaylist) (MprisPlaylists* self, ActivePlaylistContainer* value);
};
@@ -281,8 +282,12 @@ struct _Mpris2ControllerFetchPlaylistsData {
PlaylistDetails* _tmp9_;
gint _tmp9__length1;
PlayerController* _tmp10_;
- gboolean _tmp11_;
- gboolean* _tmp12_;
+ GAppInfo* _tmp11_;
+ GAppInfo* _tmp12_;
+ const gchar* _tmp13_;
+ PlayerController* _tmp14_;
+ gboolean _tmp15_;
+ gboolean* _tmp16_;
GError * _inner_error_;
};
@@ -382,8 +387,10 @@ PlaylistDetails* mpris_playlists_GetPlaylists_finish (MprisPlaylists* self, GAsy
static void mpris2_controller_fetch_playlists_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _vala_PlaylistDetails_array_free (PlaylistDetails* array, gint array_length);
void playlists_menuitem_update (PlaylistsMenuitem* self, PlaylistDetails* playlists, int playlists_length1);
+GAppInfo* player_controller_get_app_info (PlayerController* self);
static gboolean* _bool_dup (gboolean* self);
-void mpris_playlists_get_ActivePlaylist (MprisPlaylists* self, ActivePlaylistContainer* result);
+static gboolean mpris2_controller_validate_playlists_details (Mpris2Controller* self);
+ActivePlaylistContainer* mpris_playlists_get_ActivePlaylist (MprisPlaylists* self);
void playlists_menuitem_active_playlist_update (PlaylistsMenuitem* self, PlaylistDetails* detail);
void mpris2_controller_activate_playlist (Mpris2Controller* self, const char* path);
void mpris_playlists_ActivatePlaylist (MprisPlaylists* self, const char* playlist_id, GAsyncReadyCallback _callback_, gpointer _user_data_);
@@ -580,7 +587,7 @@ void mpris2_controller_property_changed_cb (Mpris2Controller* self, const gchar*
}
_tmp31_ = _tmp26_;
if (_tmp31_) {
- g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 300, _mpris2_controller_fetch_active_playlist_gsource_func, g_object_ref (self), g_object_unref);
+ g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 500, _mpris2_controller_fetch_active_playlist_gsource_func, g_object_ref (self), g_object_unref);
}
_tmp32_ = changed_properties;
_tmp33_ = g_hash_table_lookup (_tmp32_, "PlaylistCount");
@@ -1206,13 +1213,18 @@ static gboolean mpris2_controller_fetch_playlists_co (Mpris2ControllerFetchPlayl
playlists_menuitem_update (_data_->_tmp8_, _data_->_tmp9_, _data_->_tmp9__length1);
_g_object_unref0 (_data_->playlists_item);
} else {
- g_warning ("mpris2-controller.vala:243: Playlists are on but its returning no cur" \
-"rent_playlists");
_data_->_tmp10_ = _data_->self->priv->_owner;
- _data_->_tmp11_ = FALSE;
- _data_->_tmp12_ = __bool_dup0 (&_data_->_tmp11_);
- _g_free0 (_data_->_tmp10_->use_playlists);
- _data_->_tmp10_->use_playlists = _data_->_tmp12_;
+ _data_->_tmp11_ = player_controller_get_app_info (_data_->_tmp10_);
+ _data_->_tmp12_ = _data_->_tmp11_;
+ _data_->_tmp13_ = NULL;
+ _data_->_tmp13_ = g_app_info_get_name (_data_->_tmp12_);
+ g_warning ("mpris2-controller.vala:243: Playlists are on but %s is returning no c" \
+"urrent_playlists ?", _data_->_tmp13_);
+ _data_->_tmp14_ = _data_->self->priv->_owner;
+ _data_->_tmp15_ = FALSE;
+ _data_->_tmp16_ = __bool_dup0 (&_data_->_tmp15_);
+ _g_free0 (_data_->_tmp14_->use_playlists);
+ _data_->_tmp14_->use_playlists = _data_->_tmp16_;
}
_data_->current_playlists = (_vala_PlaylistDetails_array_free (_data_->current_playlists, _data_->current_playlists_length1), NULL);
if (_data_->_state_ == 0) {
@@ -1225,50 +1237,136 @@ static gboolean mpris2_controller_fetch_playlists_co (Mpris2ControllerFetchPlayl
}
-static gboolean mpris2_controller_fetch_active_playlist (Mpris2Controller* self) {
+static gboolean mpris2_controller_validate_playlists_details (Mpris2Controller* self) {
gboolean result = FALSE;
MprisPlaylists* _tmp0_;
- ActivePlaylistContainer _tmp1_;
- ActivePlaylistContainer _tmp2_;
- ActivePlaylistContainer _tmp3_;
+ ActivePlaylistContainer* _tmp1_;
+ ActivePlaylistContainer* _tmp2_;
+ ActivePlaylistContainer* _tmp3_;
gboolean _tmp4_;
- gboolean _tmp5_;
- PlayerController* _tmp6_;
- GeeArrayList* _tmp7_;
- gpointer _tmp8_ = NULL;
- PlaylistsMenuitem* playlists_item;
- PlaylistsMenuitem* _tmp9_;
- MprisPlaylists* _tmp10_;
- ActivePlaylistContainer _tmp11_;
- ActivePlaylistContainer _tmp12_;
- ActivePlaylistContainer _tmp13_;
- PlaylistDetails* _tmp14_;
- PlaylistDetails _tmp15_;
+ MprisPlaylists* _tmp5_;
+ ActivePlaylistContainer* _tmp6_;
+ ActivePlaylistContainer* _tmp7_;
+ ActivePlaylistContainer* _tmp8_;
+ gboolean _tmp9_;
+ gboolean _tmp10_;
+ MprisPlaylists* _tmp11_;
+ ActivePlaylistContainer* _tmp12_;
+ ActivePlaylistContainer* _tmp13_;
+ ActivePlaylistContainer* _tmp14_;
+ PlaylistDetails* _tmp15_;
+ gboolean _tmp16_;
+ gboolean _tmp17_ = FALSE;
+ MprisPlaylists* _tmp18_;
+ ActivePlaylistContainer* _tmp19_;
+ ActivePlaylistContainer* _tmp20_;
+ ActivePlaylistContainer* _tmp21_;
+ PlaylistDetails* _tmp22_;
+ const char* _tmp23_;
+ gboolean _tmp24_;
+ gboolean _tmp31_;
g_return_val_if_fail (self != NULL, FALSE);
_tmp0_ = self->priv->_playlists;
- mpris_playlists_get_ActivePlaylist (_tmp0_, &_tmp1_);
+ _tmp1_ = mpris_playlists_get_ActivePlaylist (_tmp0_);
_tmp2_ = _tmp1_;
_tmp3_ = _tmp2_;
- _tmp4_ = _tmp3_.valid;
- _tmp5_ = _tmp4_ == FALSE;
- active_playlist_container_destroy (&_tmp3_);
- if (_tmp5_) {
+ _tmp4_ = _tmp3_ == NULL;
+ _active_playlist_container_free0 (_tmp3_);
+ if (_tmp4_) {
result = FALSE;
return result;
}
- _tmp6_ = self->priv->_owner;
- _tmp7_ = _tmp6_->custom_items;
- _tmp8_ = gee_abstract_list_get ((GeeAbstractList*) _tmp7_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS);
- playlists_item = IS_PLAYLISTS_MENUITEM ((PlayerItem*) _tmp8_) ? ((PlaylistsMenuitem*) ((PlayerItem*) _tmp8_)) : NULL;
- _tmp9_ = playlists_item;
- _tmp10_ = self->priv->_playlists;
- mpris_playlists_get_ActivePlaylist (_tmp10_, &_tmp11_);
- _tmp12_ = _tmp11_;
+ _tmp5_ = self->priv->_playlists;
+ _tmp6_ = mpris_playlists_get_ActivePlaylist (_tmp5_);
+ _tmp7_ = _tmp6_;
+ _tmp8_ = _tmp7_;
+ _tmp9_ = (*_tmp8_).valid;
+ _tmp10_ = _tmp9_ == FALSE;
+ _active_playlist_container_free0 (_tmp8_);
+ if (_tmp10_) {
+ result = FALSE;
+ return result;
+ }
+ _tmp11_ = self->priv->_playlists;
+ _tmp12_ = mpris_playlists_get_ActivePlaylist (_tmp11_);
_tmp13_ = _tmp12_;
- _tmp14_ = _tmp13_.details;
- _tmp15_ = *_tmp14_;
- playlists_menuitem_active_playlist_update (_tmp9_, &_tmp15_);
- active_playlist_container_destroy (&_tmp13_);
+ _tmp14_ = _tmp13_;
+ _tmp15_ = (*_tmp14_).details;
+ _tmp16_ = _tmp15_ == NULL;
+ _active_playlist_container_free0 (_tmp14_);
+ if (_tmp16_) {
+ result = FALSE;
+ return result;
+ }
+ _tmp18_ = self->priv->_playlists;
+ _tmp19_ = mpris_playlists_get_ActivePlaylist (_tmp18_);
+ _tmp20_ = _tmp19_;
+ _tmp21_ = _tmp20_;
+ _tmp22_ = (*_tmp21_).details;
+ _tmp23_ = (*_tmp22_).path;
+ _tmp24_ = _tmp23_ == NULL;
+ _active_playlist_container_free0 (_tmp21_);
+ if (_tmp24_) {
+ _tmp17_ = TRUE;
+ } else {
+ MprisPlaylists* _tmp25_;
+ ActivePlaylistContainer* _tmp26_;
+ ActivePlaylistContainer* _tmp27_;
+ ActivePlaylistContainer* _tmp28_;
+ PlaylistDetails* _tmp29_;
+ const gchar* _tmp30_;
+ _tmp25_ = self->priv->_playlists;
+ _tmp26_ = mpris_playlists_get_ActivePlaylist (_tmp25_);
+ _tmp27_ = _tmp26_;
+ _tmp28_ = _tmp27_;
+ _tmp29_ = (*_tmp28_).details;
+ _tmp30_ = (*_tmp29_).name;
+ _tmp17_ = _tmp30_ == NULL;
+ _active_playlist_container_free0 (_tmp28_);
+ }
+ _tmp31_ = _tmp17_;
+ if (_tmp31_) {
+ result = FALSE;
+ return result;
+ }
+ result = TRUE;
+ return result;
+}
+
+
+static gboolean mpris2_controller_fetch_active_playlist (Mpris2Controller* self) {
+ gboolean result = FALSE;
+ gboolean _tmp0_ = FALSE;
+ PlayerController* _tmp1_;
+ GeeArrayList* _tmp2_;
+ gpointer _tmp3_ = NULL;
+ PlaylistsMenuitem* playlists_item;
+ PlaylistsMenuitem* _tmp4_;
+ MprisPlaylists* _tmp5_;
+ ActivePlaylistContainer* _tmp6_;
+ ActivePlaylistContainer* _tmp7_;
+ ActivePlaylistContainer* _tmp8_;
+ PlaylistDetails* _tmp9_;
+ PlaylistDetails _tmp10_;
+ g_return_val_if_fail (self != NULL, FALSE);
+ _tmp0_ = mpris2_controller_validate_playlists_details (self);
+ if (_tmp0_ == FALSE) {
+ result = FALSE;
+ return result;
+ }
+ _tmp1_ = self->priv->_owner;
+ _tmp2_ = _tmp1_->custom_items;
+ _tmp3_ = gee_abstract_list_get ((GeeAbstractList*) _tmp2_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS);
+ playlists_item = IS_PLAYLISTS_MENUITEM ((PlayerItem*) _tmp3_) ? ((PlaylistsMenuitem*) ((PlayerItem*) _tmp3_)) : NULL;
+ _tmp4_ = playlists_item;
+ _tmp5_ = self->priv->_playlists;
+ _tmp6_ = mpris_playlists_get_ActivePlaylist (_tmp5_);
+ _tmp7_ = _tmp6_;
+ _tmp8_ = _tmp7_;
+ _tmp9_ = (*_tmp8_).details;
+ _tmp10_ = *_tmp9_;
+ playlists_menuitem_active_playlist_update (_tmp4_, &_tmp10_);
+ _active_playlist_container_free0 (_tmp8_);
result = FALSE;
_g_object_unref0 (playlists_item);
return result;
@@ -1298,7 +1396,7 @@ void mpris2_controller_activate_playlist (Mpris2Controller* self, const char* pa
_tmp2_ = path;
_tmp3_ = e;
_tmp4_ = _tmp3_->message;
- g_warning ("mpris2-controller.vala:264: Could not activate playlist %s because %s", (const gchar*) _tmp2_, _tmp4_);
+ g_warning ("mpris2-controller.vala:283: Could not activate playlist %s because %s", (const gchar*) _tmp2_, _tmp4_);
_g_error_free0 (e);
}
__finally13:
diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala
index 0fa7b6c..2cc8d12 100644
--- a/src/mpris2-controller.vala
+++ b/src/mpris2-controller.vala
@@ -92,7 +92,7 @@ public class Mpris2Controller : GLib.Object
}
Variant? playlist_v = changed_properties.lookup("ActivePlaylist");
if ( playlist_v != null && this.owner.use_playlists == true ){
- Timeout.add (300, this.fetch_active_playlist);
+ Timeout.add (500, this.fetch_active_playlist);
}
Variant? playlist_count_v = changed_properties.lookup("PlaylistCount");
if ( playlist_count_v != null && this.owner.use_playlists == true ){
@@ -240,14 +240,33 @@ public class Mpris2Controller : GLib.Object
playlists_item.update(current_playlists);
}
else{
- warning(" Playlists are on but its returning no current_playlists" );
+ warning(" Playlists are on but %s is returning no current_playlists ?",
+ this.owner.app_info.get_name());
this.owner.use_playlists = false;
}
}
+ private bool validate_playlists_details()
+ {
+ if (this.playlists.ActivePlaylist == null){
+ return false;
+ }
+ if (this.playlists.ActivePlaylist.valid == false){
+ return false;
+ }
+ if (this.playlists.ActivePlaylist.details == null){
+ return false;
+ }
+ if (this.playlists.ActivePlaylist.details.path == null ||
+ this.playlists.ActivePlaylist.details.name == null){
+ return false;
+ }
+ return true;
+ }
+
private bool fetch_active_playlist()
{
- if (this.playlists.ActivePlaylist.valid == false){
+ if (this.validate_playlists_details() == false){
return false;
}
PlaylistsMenuitem playlists_item = this.owner.custom_items[PlayerController.widget_order.PLAYLISTS] as PlaylistsMenuitem;
diff --git a/src/mpris2-interfaces.c b/src/mpris2-interfaces.c
index 9058f95..d625955 100644
--- a/src/mpris2-interfaces.c
+++ b/src/mpris2-interfaces.c
@@ -70,6 +70,7 @@ typedef struct _MprisPlaylistsIface MprisPlaylistsIface;
#define TYPE_MPRIS_PLAYLISTS_PROXY (mpris_playlists_proxy_get_type ())
typedef GDBusProxy MprisPlaylistsProxy;
typedef GDBusProxyClass MprisPlaylistsProxyClass;
+#define _active_playlist_container_free0(var) ((var == NULL) ? NULL : (var = (active_playlist_container_free (var), NULL)))
struct _MprisRootIface {
GTypeInterface parent_iface;
@@ -128,7 +129,7 @@ struct _MprisPlaylistsIface {
void (*set_Orderings) (MprisPlaylists* self, gchar** value, int value_length1);
guint32 (*get_PlaylistCount) (MprisPlaylists* self);
void (*set_PlaylistCount) (MprisPlaylists* self, guint32 value);
- void (*get_ActivePlaylist) (MprisPlaylists* self, ActivePlaylistContainer* value);
+ ActivePlaylistContainer* (*get_ActivePlaylist) (MprisPlaylists* self);
void (*set_ActivePlaylist) (MprisPlaylists* self, ActivePlaylistContainer* value);
};
@@ -263,7 +264,7 @@ gchar** mpris_playlists_get_Orderings (MprisPlaylists* self, int* result_length1
void mpris_playlists_set_Orderings (MprisPlaylists* self, gchar** value, int value_length1);
guint32 mpris_playlists_get_PlaylistCount (MprisPlaylists* self);
void mpris_playlists_set_PlaylistCount (MprisPlaylists* self, guint32 value);
-void mpris_playlists_get_ActivePlaylist (MprisPlaylists* self, ActivePlaylistContainer* result);
+ActivePlaylistContainer* mpris_playlists_get_ActivePlaylist (MprisPlaylists* self);
void mpris_playlists_set_ActivePlaylist (MprisPlaylists* self, ActivePlaylistContainer* value);
static void g_cclosure_user_marshal_VOID__BOXED (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data);
static void mpris_playlists_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters);
@@ -276,7 +277,7 @@ static gchar** mpris_playlists_dbus_proxy_get_Orderings (MprisPlaylists* self, i
static void mpris_playlists_dbus_proxy_set_Orderings (MprisPlaylists* self, gchar** value, int value_length1);
static guint32 mpris_playlists_dbus_proxy_get_PlaylistCount (MprisPlaylists* self);
static void mpris_playlists_dbus_proxy_set_PlaylistCount (MprisPlaylists* self, guint32 value);
-static void mpris_playlists_dbus_proxy_get_ActivePlaylist (MprisPlaylists* self, ActivePlaylistContainer* result);
+static ActivePlaylistContainer* mpris_playlists_dbus_proxy_get_ActivePlaylist (MprisPlaylists* self);
static void mpris_playlists_dbus_proxy_set_ActivePlaylist (MprisPlaylists* self, ActivePlaylistContainer* value);
static void mpris_playlists_proxy_mpris_playlists_interface_init (MprisPlaylistsIface* iface);
static void _dbus_mpris_playlists_ActivatePlaylist (MprisPlaylists* self, GVariant* parameters, GDBusMethodInvocation* invocation);
@@ -1879,9 +1880,9 @@ void mpris_playlists_set_PlaylistCount (MprisPlaylists* self, guint32 value) {
}
-void mpris_playlists_get_ActivePlaylist (MprisPlaylists* self, ActivePlaylistContainer* result) {
- g_return_if_fail (self != NULL);
- MPRIS_PLAYLISTS_GET_INTERFACE (self)->get_ActivePlaylist (self, result);
+ActivePlaylistContainer* mpris_playlists_get_ActivePlaylist (MprisPlaylists* self) {
+ g_return_val_if_fail (self != NULL, NULL);
+ return MPRIS_PLAYLISTS_GET_INTERFACE (self)->get_ActivePlaylist (self);
}
@@ -2211,8 +2212,9 @@ static void mpris_playlists_dbus_proxy_set_PlaylistCount (MprisPlaylists* self,
}
-static void mpris_playlists_dbus_proxy_get_ActivePlaylist (MprisPlaylists* self, ActivePlaylistContainer* result) {
+static ActivePlaylistContainer* mpris_playlists_dbus_proxy_get_ActivePlaylist (MprisPlaylists* self) {
GVariant *_inner_reply;
+ ActivePlaylistContainer* _result;
ActivePlaylistContainer _tmp39_;
GVariantIter _tmp40_;
GVariant* _tmp41_;
@@ -2233,7 +2235,7 @@ static void mpris_playlists_dbus_proxy_get_ActivePlaylist (MprisPlaylists* self,
_arguments = g_variant_builder_end (&_arguments_builder);
_reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
if (!_reply) {
- return;
+ return NULL;
}
g_variant_get (_reply, "(v)", &_inner_reply);
g_variant_unref (_reply);
@@ -2255,9 +2257,9 @@ static void mpris_playlists_dbus_proxy_get_ActivePlaylist (MprisPlaylists* self,
g_variant_unref (_tmp47_);
_tmp39_.details = g_memdup (&_tmp43_, sizeof (PlaylistDetails));
g_variant_unref (_tmp42_);
- *result = _tmp39_;
+ _result = g_memdup (&_tmp39_, sizeof (ActivePlaylistContainer));
g_variant_unref (_inner_reply);
- return;
+ return _result;
}
@@ -2462,20 +2464,20 @@ static GVariant* _dbus_mpris_playlists_get_PlaylistCount (MprisPlaylists* self)
static GVariant* _dbus_mpris_playlists_get_ActivePlaylist (MprisPlaylists* self) {
- ActivePlaylistContainer result = {0};
+ ActivePlaylistContainer* result;
GVariantBuilder _tmp62_;
GVariantBuilder _tmp63_;
GVariant* _reply;
- mpris_playlists_get_ActivePlaylist (self, &result);
+ result = mpris_playlists_get_ActivePlaylist (self);
g_variant_builder_init (&_tmp62_, G_VARIANT_TYPE_TUPLE);
- g_variant_builder_add_value (&_tmp62_, g_variant_new_boolean (result.valid));
+ g_variant_builder_add_value (&_tmp62_, g_variant_new_boolean ((*result).valid));
g_variant_builder_init (&_tmp63_, G_VARIANT_TYPE_TUPLE);
- g_variant_builder_add_value (&_tmp63_, g_variant_new_object_path ((*result.details).path));
- g_variant_builder_add_value (&_tmp63_, g_variant_new_string ((*result.details).name));
- g_variant_builder_add_value (&_tmp63_, g_variant_new_string ((*result.details).icon_path));
+ g_variant_builder_add_value (&_tmp63_, g_variant_new_object_path ((*(*result).details).path));
+ g_variant_builder_add_value (&_tmp63_, g_variant_new_string ((*(*result).details).name));
+ g_variant_builder_add_value (&_tmp63_, g_variant_new_string ((*(*result).details).icon_path));
g_variant_builder_add_value (&_tmp62_, g_variant_builder_end (&_tmp63_));
_reply = g_variant_builder_end (&_tmp62_);
- active_playlist_container_destroy (&result);
+ _active_playlist_container_free0 (result);
return _reply;
}
@@ -2534,7 +2536,7 @@ static void _dbus_mpris_playlists_set_PlaylistCount (MprisPlaylists* self, GVari
static void _dbus_mpris_playlists_set_ActivePlaylist (MprisPlaylists* self, GVariant* _value) {
- ActivePlaylistContainer value = {0};
+ ActivePlaylistContainer* value = NULL;
ActivePlaylistContainer _tmp67_;
GVariantIter _tmp68_;
GVariant* _tmp69_;
@@ -2561,9 +2563,9 @@ static void _dbus_mpris_playlists_set_ActivePlaylist (MprisPlaylists* self, GVar
g_variant_unref (_tmp75_);
_tmp67_.details = g_memdup (&_tmp71_, sizeof (PlaylistDetails));
g_variant_unref (_tmp70_);
- value = _tmp67_;
+ value = g_memdup (&_tmp67_, sizeof (ActivePlaylistContainer));
mpris_playlists_set_ActivePlaylist (self, &value);
- active_playlist_container_destroy (&value);
+ _active_playlist_container_free0 (value);
}
diff --git a/src/mpris2-interfaces.vala b/src/mpris2-interfaces.vala
index db6888d..cb68e84 100644
--- a/src/mpris2-interfaces.vala
+++ b/src/mpris2-interfaces.vala
@@ -65,7 +65,7 @@ public interface MprisPlaylists : Object {
//properties
public abstract string[] Orderings{owned get; set;}
public abstract uint32 PlaylistCount{owned get; set;}
- public abstract ActivePlaylistContainer ActivePlaylist {owned get; set;}
+ public abstract ActivePlaylistContainer? ActivePlaylist {owned get; set;}
//methods
public abstract async void ActivatePlaylist(ObjectPath playlist_id) throws IOError;
diff --git a/src/sound-service-dbus.c b/src/sound-service-dbus.c
index 7cad2bc..9d10bed 100644
--- a/src/sound-service-dbus.c
+++ b/src/sound-service-dbus.c
@@ -227,8 +227,14 @@ show_sound_settings_dialog (DbusmenuMenuitem *mi,
gpointer user_data)
{
GError * error = NULL;
+ gchar* cmd;
+ if (!g_strcmp0 (g_getenv ("XDG_CURRENT_DESKTOP"), "Unity"))
+ cmd = "gnome-control-center sound-nua";
+ else
+ cmd = "gnome-control-center sound";
+
if (!g_spawn_command_line_async("gnome-volume-control --page=applications", &error) &&
- !g_spawn_command_line_async("gnome-control-center sound", &error) &&
+ !g_spawn_command_line_async(cmd, &error) &&
!g_spawn_command_line_async("xfce4-mixer", &error))
{
g_warning("Unable to show dialog: %s", error->message);