diff options
-rwxr-xr-x | configure | 47 | ||||
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | debian/changelog | 8 | ||||
-rwxr-xr-x | debian/rules | 1 | ||||
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/Makefile.in | 22 | ||||
-rw-r--r-- | src/fetch-file.c | 30 | ||||
-rw-r--r-- | src/freedesktop-interfaces.c | 850 | ||||
-rw-r--r-- | src/freedesktop-interfaces.vala | 47 | ||||
-rw-r--r-- | src/metadata-menu-item.c | 2 | ||||
-rw-r--r-- | src/mpris2-controller.c | 523 | ||||
-rw-r--r-- | src/mpris2-controller.vala | 11 | ||||
-rw-r--r-- | src/mpris2-interfaces.c | 83 | ||||
-rw-r--r-- | src/mpris2-interfaces.vala | 4 | ||||
-rw-r--r-- | src/mpris2-watcher.c | 791 | ||||
-rw-r--r-- | src/mpris2-watcher.vala | 35 | ||||
-rw-r--r-- | src/music-player-bridge.c | 132 | ||||
-rw-r--r-- | src/music-player-bridge.h | 94 | ||||
-rw-r--r-- | src/player-controller.c | 108 | ||||
-rw-r--r-- | src/player-item.c | 2 | ||||
-rw-r--r-- | src/playlists-menu-item.c | 3 | ||||
-rw-r--r-- | src/settings-manager.c | 2 | ||||
-rw-r--r-- | src/title-menu-item.c | 3 | ||||
-rw-r--r-- | src/transport-menu-item.c | 3 |
24 files changed, 1718 insertions, 1088 deletions
@@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.67 for indicator-sound 0.5.4. +# Generated by GNU Autoconf 2.67 for indicator-sound 0.5.5. # # Report bugs to <conor.curran@canonical.com>. # @@ -761,8 +761,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='indicator-sound' PACKAGE_TARNAME='indicator-sound' -PACKAGE_VERSION='0.5.4' -PACKAGE_STRING='indicator-sound 0.5.4' +PACKAGE_VERSION='0.5.5' +PACKAGE_STRING='indicator-sound 0.5.5' PACKAGE_BUGREPORT='conor.curran@canonical.com' PACKAGE_URL='' @@ -1565,7 +1565,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures indicator-sound 0.5.4 to adapt to many kinds of systems. +\`configure' configures indicator-sound 0.5.5 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1635,7 +1635,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of indicator-sound 0.5.4:";; + short | recursive ) echo "Configuration of indicator-sound 0.5.5:";; esac cat <<\_ACEOF @@ -1768,7 +1768,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -indicator-sound configure 0.5.4 +indicator-sound configure 0.5.5 generated by GNU Autoconf 2.67 Copyright (C) 2010 Free Software Foundation, Inc. @@ -2137,7 +2137,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by indicator-sound $as_me 0.5.4, which was +It was created by indicator-sound $as_me 0.5.5, which was generated by GNU Autoconf 2.67. Invocation command line was $ $0 $@ @@ -2957,7 +2957,7 @@ fi # Define the identity of the package. PACKAGE=indicator-sound - VERSION=0.5.4 + VERSION=0.5.5 cat >>confdefs.h <<_ACEOF @@ -12488,12 +12488,14 @@ if test -n "$SOUNDSERVICE_CFLAGS"; then indicator >= \$INDICATOR_REQUIRED_VERSION indicate >= \$INDICATE_REQUIRED_VERSION gee-1.0 - gio-unix-2.0\""; } >&5 + gio-unix-2.0 + libxml-2.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "dbusmenu-glib >= $DBUSMENUGLIB_REQUIRED_VERSION indicator >= $INDICATOR_REQUIRED_VERSION indicate >= $INDICATE_REQUIRED_VERSION gee-1.0 - gio-unix-2.0") 2>&5 + gio-unix-2.0 + libxml-2.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then @@ -12501,7 +12503,8 @@ if test -n "$SOUNDSERVICE_CFLAGS"; then indicator >= $INDICATOR_REQUIRED_VERSION indicate >= $INDICATE_REQUIRED_VERSION gee-1.0 - gio-unix-2.0" 2>/dev/null` + gio-unix-2.0 + libxml-2.0" 2>/dev/null` else pkg_failed=yes fi @@ -12516,12 +12519,14 @@ if test -n "$SOUNDSERVICE_LIBS"; then indicator >= \$INDICATOR_REQUIRED_VERSION indicate >= \$INDICATE_REQUIRED_VERSION gee-1.0 - gio-unix-2.0\""; } >&5 + gio-unix-2.0 + libxml-2.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "dbusmenu-glib >= $DBUSMENUGLIB_REQUIRED_VERSION indicator >= $INDICATOR_REQUIRED_VERSION indicate >= $INDICATE_REQUIRED_VERSION gee-1.0 - gio-unix-2.0") 2>&5 + gio-unix-2.0 + libxml-2.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then @@ -12529,7 +12534,8 @@ if test -n "$SOUNDSERVICE_LIBS"; then indicator >= $INDICATOR_REQUIRED_VERSION indicate >= $INDICATE_REQUIRED_VERSION gee-1.0 - gio-unix-2.0" 2>/dev/null` + gio-unix-2.0 + libxml-2.0" 2>/dev/null` else pkg_failed=yes fi @@ -12553,13 +12559,15 @@ fi indicator >= $INDICATOR_REQUIRED_VERSION indicate >= $INDICATE_REQUIRED_VERSION gee-1.0 - gio-unix-2.0" 2>&1` + gio-unix-2.0 + libxml-2.0" 2>&1` else SOUNDSERVICE_PKG_ERRORS=`$PKG_CONFIG --print-errors "dbusmenu-glib >= $DBUSMENUGLIB_REQUIRED_VERSION indicator >= $INDICATOR_REQUIRED_VERSION indicate >= $INDICATE_REQUIRED_VERSION gee-1.0 - gio-unix-2.0" 2>&1` + gio-unix-2.0 + libxml-2.0" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$SOUNDSERVICE_PKG_ERRORS" >&5 @@ -12568,7 +12576,8 @@ fi indicator >= $INDICATOR_REQUIRED_VERSION indicate >= $INDICATE_REQUIRED_VERSION gee-1.0 - gio-unix-2.0) were not met: + gio-unix-2.0 + libxml-2.0) were not met: $SOUNDSERVICE_PKG_ERRORS @@ -14342,7 +14351,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by indicator-sound $as_me 0.5.4, which was +This file was extended by indicator-sound $as_me 0.5.5, which was generated by GNU Autoconf 2.67. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14408,7 +14417,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -indicator-sound config.status 0.5.4 +indicator-sound config.status 0.5.5 configured by $0, generated by GNU Autoconf 2.67, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 928ffff..1297120 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,10 @@ -AC_INIT(indicator-sound, 0.5.4, conor.curran@canonical.com) +AC_INIT(indicator-sound, 0.5.5, conor.curran@canonical.com) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(indicator-sound, 0.5.4) +AM_INIT_AUTOMAKE(indicator-sound, 0.5.5) AM_MAINTAINER_MODE diff --git a/debian/changelog b/debian/changelog index c694a7d..4b4666d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -indicator-sound (0.5.4-0ubuntu1) UNRELEASED; urgency=low +indicator-sound (0.5.5-0ubuntu1) natty; urgency=low * New upstream release. - unity-panel-service crashed with SIGSEGV in cairo_translate (LP: #683184) @@ -7,13 +7,11 @@ indicator-sound (0.5.4-0ubuntu1) UNRELEASED; urgency=low - The players list should be customizable (LP: #685725) - gio-unix-2.0 checks (LP: #694828) - Desktop file loading should not manually use full path (LP: #693824) + - Banshee mpris interface crashes (LP: #701692) * debian/control - Added build depends for libxml2-dev - - Added build depends for dh-autoreconf - * debian/rules - - Added autoreconf.mk - -- Ken VanDine <ken.vandine@canonical.com> Tue, 11 Jan 2011 14:38:36 -0600 + -- Ken VanDine <ken.vandine@canonical.com> Tue, 11 Jan 2011 16:44:40 -0600 indicator-sound (0.5.3-0ubuntu1) natty; urgency=low diff --git a/debian/rules b/debian/rules index d778ba1..0bae2ff 100755 --- a/debian/rules +++ b/debian/rules @@ -3,7 +3,6 @@ include /usr/share/cdbs/1/rules/debhelper.mk include /usr/share/cdbs/1/class/gnome.mk include /usr/share/cdbs/1/rules/simple-patchsys.mk -include /usr/share/cdbs/1/rules/autoreconf.mk # List any files which are not installed include /usr/share/cdbs/1/rules/utils.mk diff --git a/src/Makefile.am b/src/Makefile.am index 57f52d4..7fe7e0f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -66,6 +66,7 @@ music_bridge_VALASOURCES = \ player-item.vala \ settings-manager.vala \ playlists-menu-item.vala \ + freedesktop-interfaces.vala \ fetch-file.vala diff --git a/src/Makefile.in b/src/Makefile.in index a8d81e2..667d388 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -97,6 +97,7 @@ am__objects_1 = indicator_sound_service-music-player-bridge.$(OBJEXT) \ indicator_sound_service-player-item.$(OBJEXT) \ indicator_sound_service-settings-manager.$(OBJEXT) \ indicator_sound_service-playlists-menu-item.$(OBJEXT) \ + indicator_sound_service-freedesktop-interfaces.$(OBJEXT) \ indicator_sound_service-fetch-file.$(OBJEXT) am_indicator_sound_service_OBJECTS = \ indicator_sound_service-sound-service.$(OBJEXT) \ @@ -345,6 +346,7 @@ music_bridge_VALASOURCES = \ player-item.vala \ settings-manager.vala \ playlists-menu-item.vala \ + freedesktop-interfaces.vala \ fetch-file.vala music_bridge_VALAFLAGS = \ @@ -359,7 +361,8 @@ music_bridge_VALAFLAGS = \ --pkg common-defs \ --pkg gio-2.0 \ --pkg gio-unix-2.0 \ - --pkg gdk-pixbuf-2.0 + --pkg gdk-pixbuf-2.0 \ + --pkg libxml-2.0 music_bridge_APIFILES = \ music-player-bridge.h @@ -532,6 +535,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_sound_service-dbus-menu-manager.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_sound_service-fetch-file.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_sound_service-freedesktop-interfaces.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_sound_service-metadata-menu-item.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_sound_service-mpris2-controller.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_sound_service-mpris2-interfaces.Po@am__quote@ @@ -873,6 +877,22 @@ indicator_sound_service-playlists-menu-item.obj: playlists-menu-item.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -c -o indicator_sound_service-playlists-menu-item.obj `if test -f 'playlists-menu-item.c'; then $(CYGPATH_W) 'playlists-menu-item.c'; else $(CYGPATH_W) '$(srcdir)/playlists-menu-item.c'; fi` +indicator_sound_service-freedesktop-interfaces.o: freedesktop-interfaces.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -MT indicator_sound_service-freedesktop-interfaces.o -MD -MP -MF $(DEPDIR)/indicator_sound_service-freedesktop-interfaces.Tpo -c -o indicator_sound_service-freedesktop-interfaces.o `test -f 'freedesktop-interfaces.c' || echo '$(srcdir)/'`freedesktop-interfaces.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-freedesktop-interfaces.Tpo $(DEPDIR)/indicator_sound_service-freedesktop-interfaces.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='freedesktop-interfaces.c' object='indicator_sound_service-freedesktop-interfaces.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -c -o indicator_sound_service-freedesktop-interfaces.o `test -f 'freedesktop-interfaces.c' || echo '$(srcdir)/'`freedesktop-interfaces.c + +indicator_sound_service-freedesktop-interfaces.obj: freedesktop-interfaces.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -MT indicator_sound_service-freedesktop-interfaces.obj -MD -MP -MF $(DEPDIR)/indicator_sound_service-freedesktop-interfaces.Tpo -c -o indicator_sound_service-freedesktop-interfaces.obj `if test -f 'freedesktop-interfaces.c'; then $(CYGPATH_W) 'freedesktop-interfaces.c'; else $(CYGPATH_W) '$(srcdir)/freedesktop-interfaces.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-freedesktop-interfaces.Tpo $(DEPDIR)/indicator_sound_service-freedesktop-interfaces.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='freedesktop-interfaces.c' object='indicator_sound_service-freedesktop-interfaces.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -c -o indicator_sound_service-freedesktop-interfaces.obj `if test -f 'freedesktop-interfaces.c'; then $(CYGPATH_W) 'freedesktop-interfaces.c'; else $(CYGPATH_W) '$(srcdir)/freedesktop-interfaces.c'; fi` + indicator_sound_service-fetch-file.o: fetch-file.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -MT indicator_sound_service-fetch-file.o -MD -MP -MF $(DEPDIR)/indicator_sound_service-fetch-file.Tpo -c -o indicator_sound_service-fetch-file.o `test -f 'fetch-file.c' || echo '$(srcdir)/'`fetch-file.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-fetch-file.Tpo $(DEPDIR)/indicator_sound_service-fetch-file.Po diff --git a/src/fetch-file.c b/src/fetch-file.c index a20e7f6..61a0c02 100644 --- a/src/fetch-file.c +++ b/src/fetch-file.c @@ -1,4 +1,4 @@ -/* fetch-file.c generated by valac 0.11.2, the Vala compiler +/* fetch-file.c generated by valac 0.11.3, the Vala compiler * generated from fetch-file.vala, do not modify */ /* @@ -116,15 +116,14 @@ enum { FetchFile* fetch_file_new (const gchar* uri, const gchar* prop); FetchFile* fetch_file_construct (GType object_type, const gchar* uri, const gchar* prop); static void fetch_file_fetch_data_data_free (gpointer _data); -static void fetch_file_fetch_data_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_); void fetch_file_fetch_data (FetchFile* self, GAsyncReadyCallback _callback_, gpointer _user_data_); void fetch_file_fetch_data_finish (FetchFile* self, GAsyncResult* _res_); static gboolean fetch_file_fetch_data_co (FetchFileFetchDataData* data); static void fetch_file_read_something_async (FetchFile* self, GAsyncReadyCallback _callback_, gpointer _user_data_); static void fetch_file_read_something_finish (FetchFile* self, GAsyncResult* _res_); static void fetch_file_read_something_async_data_free (gpointer _data); -static void fetch_file_read_something_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_); static gboolean fetch_file_read_something_async_co (FetchFileReadSomethingAsyncData* data); +static void fetch_file_read_something_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_); const gchar* fetch_file_get_intended_property (FetchFile* self); const gchar* fetch_file_get_uri (FetchFile* self); static void fetch_file_set_uri (FetchFile* self, const gchar* value); @@ -179,15 +178,6 @@ void fetch_file_fetch_data_finish (FetchFile* self, GAsyncResult* _res_) { } -static void fetch_file_fetch_data_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) { - FetchFileFetchDataData* data; - data = _user_data_; - data->_source_object_ = source_object; - data->_res_ = _res_; - fetch_file_fetch_data_co (data); -} - - static gboolean fetch_file_fetch_data_co (FetchFileFetchDataData* data) { switch (data->_state_) { case 0: @@ -200,7 +190,7 @@ static gboolean fetch_file_fetch_data_co (FetchFileFetchDataData* data) { data->_tmp0_ = g_file_read (data->self->priv->file, NULL, &data->_inner_error_); data->_tmp1_ = data->_tmp0_; if (data->_inner_error_ != NULL) { - goto __catch12_g_error; + goto __catch13_g_error; } data->_tmp2_ = data->_tmp1_; data->_tmp3_ = NULL; @@ -210,15 +200,15 @@ static gboolean fetch_file_fetch_data_co (FetchFileFetchDataData* data) { data->self->priv->stream = data->_tmp4_; _g_object_unref0 (data->_tmp2_); g_data_input_stream_set_byte_order (data->self->priv->stream, G_DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN); - goto __finally12; - __catch12_g_error: + goto __finally13; + __catch13_g_error: { data->e = data->_inner_error_; data->_inner_error_ = NULL; g_signal_emit_by_name (data->self, "failed"); _g_error_free0 (data->e); } - __finally12: + __finally13: if (data->_inner_error_ != 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_); @@ -302,7 +292,7 @@ static gboolean fetch_file_read_something_async_co (FetchFileReadSomethingAsyncD data->_tmp3_ = g_input_stream_read_finish ((GInputStream*) data->self->priv->stream, data->_res_, &data->_inner_error_); data->_tmp4_ = data->_tmp3_; if (data->_inner_error_ != NULL) { - goto __catch13_g_error; + goto __catch14_g_error; } data->bufsize = data->_tmp4_; if (data->bufsize < 1) { @@ -321,15 +311,15 @@ static gboolean fetch_file_read_something_async_co (FetchFileReadSomethingAsyncD } else { g_byte_array_append (data->self->priv->data, data->buffer, data->buffer_length1); } - goto __finally13; - __catch13_g_error: + goto __finally14; + __catch14_g_error: { data->e = data->_inner_error_; data->_inner_error_ = NULL; g_signal_emit_by_name (data->self, "failed"); _g_error_free0 (data->e); } - __finally13: + __finally14: if (data->_inner_error_ != NULL) { data->buffer = (g_free (data->buffer), 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); diff --git a/src/freedesktop-interfaces.c b/src/freedesktop-interfaces.c new file mode 100644 index 0000000..08a2331 --- /dev/null +++ b/src/freedesktop-interfaces.c @@ -0,0 +1,850 @@ +/* freedesktop-interfaces.c generated by valac 0.11.3, the Vala compiler + * generated from freedesktop-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 <gio/gio.h> +#include <stdlib.h> +#include <string.h> + + +#define TYPE_FREE_DESKTOP_OBJECT (free_desktop_object_get_type ()) +#define FREE_DESKTOP_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FREE_DESKTOP_OBJECT, FreeDesktopObject)) +#define IS_FREE_DESKTOP_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FREE_DESKTOP_OBJECT)) +#define FREE_DESKTOP_OBJECT_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_FREE_DESKTOP_OBJECT, FreeDesktopObjectIface)) + +typedef struct _FreeDesktopObject FreeDesktopObject; +typedef struct _FreeDesktopObjectIface FreeDesktopObjectIface; + +#define TYPE_FREE_DESKTOP_OBJECT_PROXY (free_desktop_object_proxy_get_type ()) +typedef GDBusProxy FreeDesktopObjectProxy; +typedef GDBusProxyClass FreeDesktopObjectProxyClass; +#define _g_free0(var) (var = (g_free (var), NULL)) + +#define TYPE_FREE_DESKTOP_INTROSPECTABLE (free_desktop_introspectable_get_type ()) +#define FREE_DESKTOP_INTROSPECTABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FREE_DESKTOP_INTROSPECTABLE, FreeDesktopIntrospectable)) +#define IS_FREE_DESKTOP_INTROSPECTABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FREE_DESKTOP_INTROSPECTABLE)) +#define FREE_DESKTOP_INTROSPECTABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_FREE_DESKTOP_INTROSPECTABLE, FreeDesktopIntrospectableIface)) + +typedef struct _FreeDesktopIntrospectable FreeDesktopIntrospectable; +typedef struct _FreeDesktopIntrospectableIface FreeDesktopIntrospectableIface; + +#define TYPE_FREE_DESKTOP_INTROSPECTABLE_PROXY (free_desktop_introspectable_proxy_get_type ()) +typedef GDBusProxy FreeDesktopIntrospectableProxy; +typedef GDBusProxyClass FreeDesktopIntrospectableProxyClass; + +#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 ()) +typedef GDBusProxy FreeDesktopPropertiesProxy; +typedef GDBusProxyClass FreeDesktopPropertiesProxyClass; +#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL))) + +struct _FreeDesktopObjectIface { + GTypeInterface parent_iface; + void (*list_names) (FreeDesktopObject* self, GAsyncReadyCallback _callback_, gpointer _user_data_); + gchar** (*list_names_finish) (FreeDesktopObject* self, GAsyncResult* _res_, int* result_length1, GError** error); +}; + +struct _FreeDesktopIntrospectableIface { + GTypeInterface parent_iface; + gchar* (*Introspect) (FreeDesktopIntrospectable* self, GError** error); +}; + +struct _FreeDesktopPropertiesIface { + GTypeInterface parent_iface; +}; + +typedef enum { + XML_ERROR_FILE_NOT_FOUND, + XML_ERROR_XML_DOCUMENT_EMPTY +} XmlError; +#define XML_ERROR xml_error_quark () + + +GType free_desktop_object_proxy_get_type (void) G_GNUC_CONST; +guint free_desktop_object_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error); +GType free_desktop_object_get_type (void) G_GNUC_CONST; +void free_desktop_object_list_names (FreeDesktopObject* self, GAsyncReadyCallback _callback_, gpointer _user_data_); +gchar** free_desktop_object_list_names_finish (FreeDesktopObject* self, GAsyncResult* _res_, int* result_length1, GError** error); +static void g_cclosure_user_marshal_VOID__STRING_STRING_STRING (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data); +static void free_desktop_object_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters); +static void _dbus_handle_free_desktop_object_name_owner_changed (FreeDesktopObject* self, GVariant* parameters); +static void _vala_g_async_ready_callback (GObject *source_object, GAsyncResult *res, void *user_data); +static void free_desktop_object_proxy_list_names_async (FreeDesktopObject* self, GAsyncReadyCallback _callback_, gpointer _user_data_); +static gchar** free_desktop_object_proxy_list_names_finish (FreeDesktopObject* self, GAsyncResult* _res_, int* result_length1, GError** error); +static void free_desktop_object_proxy_free_desktop_object_interface_init (FreeDesktopObjectIface* iface); +static void _dbus_free_desktop_object_list_names (FreeDesktopObject* self, GVariant* parameters, GDBusMethodInvocation* invocation); +static void _dbus_free_desktop_object_list_names_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_); +static void free_desktop_object_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* free_desktop_object_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 gboolean free_desktop_object_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_free_desktop_object_name_owner_changed (GObject* _sender, const gchar* name, const gchar* old_owner, const gchar* new_owner, gpointer* _data); +static void _free_desktop_object_unregister_object (gpointer user_data); +GType free_desktop_introspectable_proxy_get_type (void) G_GNUC_CONST; +guint free_desktop_introspectable_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error); +GType free_desktop_introspectable_get_type (void) G_GNUC_CONST; +gchar* free_desktop_introspectable_Introspect (FreeDesktopIntrospectable* self, GError** error); +static void free_desktop_introspectable_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters); +static gchar* free_desktop_introspectable_proxy_Introspect (FreeDesktopIntrospectable* self, GError** error); +static void free_desktop_introspectable_proxy_free_desktop_introspectable_interface_init (FreeDesktopIntrospectableIface* iface); +static void _dbus_free_desktop_introspectable_Introspect (FreeDesktopIntrospectable* self, GVariant* parameters, GDBusMethodInvocation* invocation); +static void free_desktop_introspectable_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* free_desktop_introspectable_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 gboolean free_desktop_introspectable_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 _free_desktop_introspectable_unregister_object (gpointer user_data); +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); +static void g_cclosure_user_marshal_VOID__STRING_BOXED_BOXED_INT (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data); +static void free_desktop_properties_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters); +static void _dbus_handle_free_desktop_properties_properties_changed (FreeDesktopProperties* self, GVariant* parameters); +static void free_desktop_properties_proxy_free_desktop_properties_interface_init (FreeDesktopPropertiesIface* iface); +static void free_desktop_properties_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* free_desktop_properties_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 gboolean free_desktop_properties_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_free_desktop_properties_properties_changed (GObject* _sender, const gchar* source, GHashTable* changed_properties, gchar** invalid, int invalid_length1, gpointer* _data); +static void _free_desktop_properties_unregister_object (gpointer user_data); +GQuark xml_error_quark (void); +#define FREEDESKTOP_SERVICE "org.freedesktop.DBus" +#define FREEDESKTOP_OBJECT "/org/freedesktop/DBus" +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 _free_desktop_object_dbus_arg_info_list_names_result = {-1, "result", "as"}; +static const GDBusArgInfo * const _free_desktop_object_dbus_arg_info_list_names_in[] = {NULL}; +static const GDBusArgInfo * const _free_desktop_object_dbus_arg_info_list_names_out[] = {&_free_desktop_object_dbus_arg_info_list_names_result, NULL}; +static const GDBusMethodInfo _free_desktop_object_dbus_method_info_list_names = {-1, "ListNames", (GDBusArgInfo **) (&_free_desktop_object_dbus_arg_info_list_names_in), (GDBusArgInfo **) (&_free_desktop_object_dbus_arg_info_list_names_out)}; +static const GDBusMethodInfo * const _free_desktop_object_dbus_method_info[] = {&_free_desktop_object_dbus_method_info_list_names, NULL}; +static const GDBusArgInfo _free_desktop_object_dbus_arg_info_name_owner_changed_name = {-1, "name", "s"}; +static const GDBusArgInfo _free_desktop_object_dbus_arg_info_name_owner_changed_old_owner = {-1, "old_owner", "s"}; +static const GDBusArgInfo _free_desktop_object_dbus_arg_info_name_owner_changed_new_owner = {-1, "new_owner", "s"}; +static const GDBusArgInfo * const _free_desktop_object_dbus_arg_info_name_owner_changed[] = {&_free_desktop_object_dbus_arg_info_name_owner_changed_name, &_free_desktop_object_dbus_arg_info_name_owner_changed_old_owner, &_free_desktop_object_dbus_arg_info_name_owner_changed_new_owner, NULL}; +static const GDBusSignalInfo _free_desktop_object_dbus_signal_info_name_owner_changed = {-1, "NameOwnerChanged", (GDBusArgInfo **) (&_free_desktop_object_dbus_arg_info_name_owner_changed)}; +static const GDBusSignalInfo * const _free_desktop_object_dbus_signal_info[] = {&_free_desktop_object_dbus_signal_info_name_owner_changed, NULL}; +static const GDBusPropertyInfo * const _free_desktop_object_dbus_property_info[] = {NULL}; +static const GDBusInterfaceInfo _free_desktop_object_dbus_interface_info = {-1, "org.freedesktop.DBus", (GDBusMethodInfo **) (&_free_desktop_object_dbus_method_info), (GDBusSignalInfo **) (&_free_desktop_object_dbus_signal_info), (GDBusPropertyInfo **) (&_free_desktop_object_dbus_property_info)}; +static const GDBusInterfaceVTable _free_desktop_object_dbus_interface_vtable = {free_desktop_object_dbus_interface_method_call, free_desktop_object_dbus_interface_get_property, free_desktop_object_dbus_interface_set_property}; +static const GDBusArgInfo _free_desktop_introspectable_dbus_arg_info_Introspect_result = {-1, "result", "s"}; +static const GDBusArgInfo * const _free_desktop_introspectable_dbus_arg_info_Introspect_in[] = {NULL}; +static const GDBusArgInfo * const _free_desktop_introspectable_dbus_arg_info_Introspect_out[] = {&_free_desktop_introspectable_dbus_arg_info_Introspect_result, NULL}; +static const GDBusMethodInfo _free_desktop_introspectable_dbus_method_info_Introspect = {-1, "Introspect", (GDBusArgInfo **) (&_free_desktop_introspectable_dbus_arg_info_Introspect_in), (GDBusArgInfo **) (&_free_desktop_introspectable_dbus_arg_info_Introspect_out)}; +static const GDBusMethodInfo * const _free_desktop_introspectable_dbus_method_info[] = {&_free_desktop_introspectable_dbus_method_info_Introspect, NULL}; +static const GDBusSignalInfo * const _free_desktop_introspectable_dbus_signal_info[] = {NULL}; +static const GDBusPropertyInfo * const _free_desktop_introspectable_dbus_property_info[] = {NULL}; +static const GDBusInterfaceInfo _free_desktop_introspectable_dbus_interface_info = {-1, "org.freedesktop.DBus.Introspectable", (GDBusMethodInfo **) (&_free_desktop_introspectable_dbus_method_info), (GDBusSignalInfo **) (&_free_desktop_introspectable_dbus_signal_info), (GDBusPropertyInfo **) (&_free_desktop_introspectable_dbus_property_info)}; +static const GDBusInterfaceVTable _free_desktop_introspectable_dbus_interface_vtable = {free_desktop_introspectable_dbus_interface_method_call, free_desktop_introspectable_dbus_interface_get_property, free_desktop_introspectable_dbus_interface_set_property}; +static const GDBusMethodInfo * const _free_desktop_properties_dbus_method_info[] = {NULL}; +static const GDBusArgInfo _free_desktop_properties_dbus_arg_info_properties_changed_source = {-1, "source", "s"}; +static const GDBusArgInfo _free_desktop_properties_dbus_arg_info_properties_changed_changed_properties = {-1, "changed_properties", "a{sv}"}; +static const GDBusArgInfo _free_desktop_properties_dbus_arg_info_properties_changed_invalid = {-1, "invalid", "as"}; +static const GDBusArgInfo * const _free_desktop_properties_dbus_arg_info_properties_changed[] = {&_free_desktop_properties_dbus_arg_info_properties_changed_source, &_free_desktop_properties_dbus_arg_info_properties_changed_changed_properties, &_free_desktop_properties_dbus_arg_info_properties_changed_invalid, NULL}; +static const GDBusSignalInfo _free_desktop_properties_dbus_signal_info_properties_changed = {-1, "PropertiesChanged", (GDBusArgInfo **) (&_free_desktop_properties_dbus_arg_info_properties_changed)}; +static const GDBusSignalInfo * const _free_desktop_properties_dbus_signal_info[] = {&_free_desktop_properties_dbus_signal_info_properties_changed, NULL}; +static const GDBusPropertyInfo * const _free_desktop_properties_dbus_property_info[] = {NULL}; +static const GDBusInterfaceInfo _free_desktop_properties_dbus_interface_info = {-1, "org.freedesktop.DBus.Properties", (GDBusMethodInfo **) (&_free_desktop_properties_dbus_method_info), (GDBusSignalInfo **) (&_free_desktop_properties_dbus_signal_info), (GDBusPropertyInfo **) (&_free_desktop_properties_dbus_property_info)}; +static const GDBusInterfaceVTable _free_desktop_properties_dbus_interface_vtable = {free_desktop_properties_dbus_interface_method_call, free_desktop_properties_dbus_interface_get_property, free_desktop_properties_dbus_interface_set_property}; + +void free_desktop_object_list_names (FreeDesktopObject* self, GAsyncReadyCallback _callback_, gpointer _user_data_) { + FREE_DESKTOP_OBJECT_GET_INTERFACE (self)->list_names (self, _callback_, _user_data_); +} + + +gchar** free_desktop_object_list_names_finish (FreeDesktopObject* self, GAsyncResult* _res_, int* result_length1, GError** error) { + return FREE_DESKTOP_OBJECT_GET_INTERFACE (self)->list_names_finish (self, _res_, result_length1, error); +} + + +static void g_cclosure_user_marshal_VOID__STRING_STRING_STRING (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data) { + typedef void (*GMarshalFunc_VOID__STRING_STRING_STRING) (gpointer data1, const char* arg_1, const char* arg_2, const char* arg_3, gpointer data2); + register GMarshalFunc_VOID__STRING_STRING_STRING callback; + register GCClosure * cc; + register gpointer data1, data2; + cc = (GCClosure *) closure; + g_return_if_fail (n_param_values == 4); + 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__STRING_STRING_STRING) (marshal_data ? marshal_data : cc->callback); + callback (data1, g_value_get_string (param_values + 1), g_value_get_string (param_values + 2), g_value_get_string (param_values + 3), data2); +} + + +static void free_desktop_object_base_init (FreeDesktopObjectIface * iface) { + static gboolean initialized = FALSE; + if (!initialized) { + initialized = TRUE; + g_signal_new ("name_owner_changed", TYPE_FREE_DESKTOP_OBJECT, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__STRING_STRING_STRING, G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); + g_type_set_qdata (TYPE_FREE_DESKTOP_OBJECT, g_quark_from_static_string ("vala-dbus-register-object"), (void*) free_desktop_object_register_object); + } +} + + +GType free_desktop_object_get_type (void) { + static volatile gsize free_desktop_object_type_id__volatile = 0; + if (g_once_init_enter (&free_desktop_object_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (FreeDesktopObjectIface), (GBaseInitFunc) free_desktop_object_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL }; + GType free_desktop_object_type_id; + free_desktop_object_type_id = g_type_register_static (G_TYPE_INTERFACE, "FreeDesktopObject", &g_define_type_info, 0); + g_type_interface_add_prerequisite (free_desktop_object_type_id, G_TYPE_OBJECT); + g_once_init_leave (&free_desktop_object_type_id__volatile, free_desktop_object_type_id); + } + return free_desktop_object_type_id__volatile; +} + + +G_DEFINE_TYPE_EXTENDED (FreeDesktopObjectProxy, free_desktop_object_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_FREE_DESKTOP_OBJECT, free_desktop_object_proxy_free_desktop_object_interface_init) ); +static void free_desktop_object_proxy_class_init (FreeDesktopObjectProxyClass* klass) { + G_DBUS_PROXY_CLASS (klass)->g_signal = free_desktop_object_proxy_g_signal; +} + + +static void _dbus_handle_free_desktop_object_name_owner_changed (FreeDesktopObject* self, GVariant* parameters) { + GVariantIter _arguments_iter; + gchar* name = NULL; + GVariant* _tmp69_; + gchar* old_owner = NULL; + GVariant* _tmp70_; + gchar* new_owner = NULL; + GVariant* _tmp71_; + g_variant_iter_init (&_arguments_iter, parameters); + _tmp69_ = g_variant_iter_next_value (&_arguments_iter); + name = g_variant_dup_string (_tmp69_, NULL); + g_variant_unref (_tmp69_); + _tmp70_ = g_variant_iter_next_value (&_arguments_iter); + old_owner = g_variant_dup_string (_tmp70_, NULL); + g_variant_unref (_tmp70_); + _tmp71_ = g_variant_iter_next_value (&_arguments_iter); + new_owner = g_variant_dup_string (_tmp71_, NULL); + g_variant_unref (_tmp71_); + g_signal_emit_by_name (self, "name-owner-changed", name, old_owner, new_owner); + _g_free0 (name); + _g_free0 (old_owner); + _g_free0 (new_owner); +} + + +static void free_desktop_object_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters) { + if (strcmp (signal_name, "NameOwnerChanged") == 0) { + _dbus_handle_free_desktop_object_name_owner_changed (proxy, parameters); + } +} + + +static void free_desktop_object_proxy_init (FreeDesktopObjectProxy* 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 free_desktop_object_proxy_list_names_async (FreeDesktopObject* 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.freedesktop.DBus", "ListNames"); + 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 gchar** free_desktop_object_proxy_list_names_finish (FreeDesktopObject* self, GAsyncResult* _res_, int* result_length1, GError** error) { + GDBusMessage *_reply_message; + GVariant *_reply; + GVariantIter _reply_iter; + gchar** _result; + int _result_length1; + GVariant* _tmp72_; + gchar** _tmp73_; + int _tmp73__length; + int _tmp73__size; + int _tmp73__length1; + GVariantIter _tmp74_; + GVariant* _tmp75_; + _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; + _tmp72_ = g_variant_iter_next_value (&_reply_iter); + _tmp73_ = g_new (gchar*, 5); + _tmp73__length = 0; + _tmp73__size = 4; + _tmp73__length1 = 0; + g_variant_iter_init (&_tmp74_, _tmp72_); + for (; (_tmp75_ = g_variant_iter_next_value (&_tmp74_)) != NULL; _tmp73__length1++) { + if (_tmp73__size == _tmp73__length) { + _tmp73__size = 2 * _tmp73__size; + _tmp73_ = g_renew (gchar*, _tmp73_, _tmp73__size + 1); + } + _tmp73_[_tmp73__length++] = g_variant_dup_string (_tmp75_, NULL); + g_variant_unref (_tmp75_); + } + _result_length1 = _tmp73__length1; + _tmp73_[_tmp73__length] = NULL; + _result = _tmp73_; + g_variant_unref (_tmp72_); + *result_length1 = _result_length1; + g_object_unref (_reply_message); + return _result; +} + + +static void free_desktop_object_proxy_free_desktop_object_interface_init (FreeDesktopObjectIface* iface) { + iface->list_names = free_desktop_object_proxy_list_names_async; + iface->list_names_finish = free_desktop_object_proxy_list_names_finish; +} + + +static void _dbus_free_desktop_object_list_names (FreeDesktopObject* self, GVariant* parameters, GDBusMethodInvocation* invocation) { + GVariantIter _arguments_iter; + g_variant_iter_init (&_arguments_iter, parameters); + free_desktop_object_list_names (self, (GAsyncReadyCallback) _dbus_free_desktop_object_list_names_ready, g_object_ref (invocation)); +} + + +static void _dbus_free_desktop_object_list_names_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_) { + GDBusMethodInvocation * invocation; + GError* error; + GDBusMessage* _reply_message; + GVariant* _reply; + GVariantBuilder _reply_builder; + gchar** result; + int result_length1 = 0; + gchar** _tmp76_; + GVariantBuilder _tmp77_; + int _tmp78_; + invocation = _user_data_; + error = NULL; + result = free_desktop_object_list_names_finish ((FreeDesktopObject*) source_object, _res_, &result_length1, &error); + if (error) { + g_dbus_method_invocation_return_gerror (g_object_ref (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); + _tmp76_ = result; + g_variant_builder_init (&_tmp77_, G_VARIANT_TYPE ("as")); + for (_tmp78_ = 0; _tmp78_ < result_length1; _tmp78_++) { + g_variant_builder_add_value (&_tmp77_, g_variant_new_string (*_tmp76_)); + _tmp76_++; + } + g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp77_)); + result = (_vala_array_free (result, result_length1, (GDestroyNotify) g_free), 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 free_desktop_object_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, "ListNames") == 0) { + _dbus_free_desktop_object_list_names (object, parameters, invocation); + } + g_object_unref (invocation); +} + + +static GVariant* free_desktop_object_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]; + return NULL; +} + + +static gboolean free_desktop_object_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]; + return FALSE; +} + + +static void _dbus_free_desktop_object_name_owner_changed (GObject* _sender, const gchar* name, const gchar* old_owner, const gchar* new_owner, 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_string (name)); + g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (old_owner)); + g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (new_owner)); + _arguments = g_variant_builder_end (&_arguments_builder); + g_dbus_connection_emit_signal (_connection, NULL, _path, "org.freedesktop.DBus", "NameOwnerChanged", _arguments, NULL); +} + + +guint free_desktop_object_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 *) (&_free_desktop_object_dbus_interface_info), &_free_desktop_object_dbus_interface_vtable, data, _free_desktop_object_unregister_object, error); + if (!result) { + return 0; + } + g_signal_connect (object, "name-owner-changed", (GCallback) _dbus_free_desktop_object_name_owner_changed, data); + return result; +} + + +static void _free_desktop_object_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); +} + + +gchar* free_desktop_introspectable_Introspect (FreeDesktopIntrospectable* self, GError** error) { + return FREE_DESKTOP_INTROSPECTABLE_GET_INTERFACE (self)->Introspect (self, error); +} + + +static void free_desktop_introspectable_base_init (FreeDesktopIntrospectableIface * iface) { + static gboolean initialized = FALSE; + if (!initialized) { + initialized = TRUE; + g_type_set_qdata (TYPE_FREE_DESKTOP_INTROSPECTABLE, g_quark_from_static_string ("vala-dbus-register-object"), (void*) free_desktop_introspectable_register_object); + } +} + + +GType free_desktop_introspectable_get_type (void) { + static volatile gsize free_desktop_introspectable_type_id__volatile = 0; + if (g_once_init_enter (&free_desktop_introspectable_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (FreeDesktopIntrospectableIface), (GBaseInitFunc) free_desktop_introspectable_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL }; + GType free_desktop_introspectable_type_id; + free_desktop_introspectable_type_id = g_type_register_static (G_TYPE_INTERFACE, "FreeDesktopIntrospectable", &g_define_type_info, 0); + g_type_interface_add_prerequisite (free_desktop_introspectable_type_id, G_TYPE_OBJECT); + g_once_init_leave (&free_desktop_introspectable_type_id__volatile, free_desktop_introspectable_type_id); + } + return free_desktop_introspectable_type_id__volatile; +} + + +G_DEFINE_TYPE_EXTENDED (FreeDesktopIntrospectableProxy, free_desktop_introspectable_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_FREE_DESKTOP_INTROSPECTABLE, free_desktop_introspectable_proxy_free_desktop_introspectable_interface_init) ); +static void free_desktop_introspectable_proxy_class_init (FreeDesktopIntrospectableProxyClass* klass) { + G_DBUS_PROXY_CLASS (klass)->g_signal = free_desktop_introspectable_proxy_g_signal; +} + + +static void free_desktop_introspectable_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters) { +} + + +static void free_desktop_introspectable_proxy_init (FreeDesktopIntrospectableProxy* self) { +} + + +static gchar* free_desktop_introspectable_proxy_Introspect (FreeDesktopIntrospectable* self, GError** error) { + GDBusMessage *_message; + GVariant *_arguments; + GVariantBuilder _arguments_builder; + GDBusMessage *_reply_message; + GVariant *_reply; + GVariantIter _reply_iter; + gchar* _result; + GVariant* _tmp79_; + 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.freedesktop.DBus.Introspectable", "Introspect"); + g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE); + _arguments = g_variant_builder_end (&_arguments_builder); + g_dbus_message_set_body (_message, _arguments); + _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, error); + g_object_unref (_message); + 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); + _tmp79_ = g_variant_iter_next_value (&_reply_iter); + _result = g_variant_dup_string (_tmp79_, NULL); + g_variant_unref (_tmp79_); + g_object_unref (_reply_message); + return _result; +} + + +static void free_desktop_introspectable_proxy_free_desktop_introspectable_interface_init (FreeDesktopIntrospectableIface* iface) { + iface->Introspect = free_desktop_introspectable_proxy_Introspect; +} + + +static void _dbus_free_desktop_introspectable_Introspect (FreeDesktopIntrospectable* self, GVariant* parameters, GDBusMethodInvocation* invocation) { + GError* error; + GVariantIter _arguments_iter; + GDBusMessage* _reply_message; + GVariant* _reply; + GVariantBuilder _reply_builder; + gchar* result; + error = NULL; + g_variant_iter_init (&_arguments_iter, parameters); + result = free_desktop_introspectable_Introspect (self, &error); + if (error) { + g_dbus_method_invocation_return_gerror (g_object_ref (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); + g_variant_builder_add_value (&_reply_builder, g_variant_new_string (result)); + _g_free0 (result); + _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 (_reply_message); +} + + +static void free_desktop_introspectable_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, "Introspect") == 0) { + _dbus_free_desktop_introspectable_Introspect (object, parameters, invocation); + } + g_object_unref (invocation); +} + + +static GVariant* free_desktop_introspectable_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]; + return NULL; +} + + +static gboolean free_desktop_introspectable_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]; + return FALSE; +} + + +guint free_desktop_introspectable_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 *) (&_free_desktop_introspectable_dbus_interface_info), &_free_desktop_introspectable_dbus_interface_vtable, data, _free_desktop_introspectable_unregister_object, error); + if (!result) { + return 0; + } + return result; +} + + +static void _free_desktop_introspectable_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); +} + + +static void g_cclosure_user_marshal_VOID__STRING_BOXED_BOXED_INT (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data) { + typedef void (*GMarshalFunc_VOID__STRING_BOXED_BOXED_INT) (gpointer data1, const char* arg_1, gpointer arg_2, gpointer arg_3, gint arg_4, gpointer data2); + register GMarshalFunc_VOID__STRING_BOXED_BOXED_INT callback; + register GCClosure * cc; + register gpointer data1, data2; + cc = (GCClosure *) closure; + g_return_if_fail (n_param_values == 5); + 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__STRING_BOXED_BOXED_INT) (marshal_data ? marshal_data : cc->callback); + callback (data1, g_value_get_string (param_values + 1), g_value_get_boxed (param_values + 2), g_value_get_boxed (param_values + 3), g_value_get_int (param_values + 4), data2); +} + + +static void free_desktop_properties_base_init (FreeDesktopPropertiesIface * iface) { + static gboolean initialized = FALSE; + if (!initialized) { + initialized = TRUE; + g_signal_new ("properties_changed", TYPE_FREE_DESKTOP_PROPERTIES, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__STRING_BOXED_BOXED_INT, G_TYPE_NONE, 4, G_TYPE_STRING, G_TYPE_HASH_TABLE, G_TYPE_STRV, G_TYPE_INT); + g_type_set_qdata (TYPE_FREE_DESKTOP_PROPERTIES, g_quark_from_static_string ("vala-dbus-register-object"), (void*) free_desktop_properties_register_object); + } +} + + +GType free_desktop_properties_get_type (void) { + static volatile gsize free_desktop_properties_type_id__volatile = 0; + if (g_once_init_enter (&free_desktop_properties_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (FreeDesktopPropertiesIface), (GBaseInitFunc) free_desktop_properties_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL }; + GType free_desktop_properties_type_id; + free_desktop_properties_type_id = g_type_register_static (G_TYPE_INTERFACE, "FreeDesktopProperties", &g_define_type_info, 0); + g_type_interface_add_prerequisite (free_desktop_properties_type_id, G_TYPE_OBJECT); + g_once_init_leave (&free_desktop_properties_type_id__volatile, free_desktop_properties_type_id); + } + return free_desktop_properties_type_id__volatile; +} + + +G_DEFINE_TYPE_EXTENDED (FreeDesktopPropertiesProxy, free_desktop_properties_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_FREE_DESKTOP_PROPERTIES, free_desktop_properties_proxy_free_desktop_properties_interface_init) ); +static void free_desktop_properties_proxy_class_init (FreeDesktopPropertiesProxyClass* klass) { + G_DBUS_PROXY_CLASS (klass)->g_signal = free_desktop_properties_proxy_g_signal; +} + + +static void _dbus_handle_free_desktop_properties_properties_changed (FreeDesktopProperties* self, GVariant* parameters) { + GVariantIter _arguments_iter; + gchar* source = NULL; + GVariant* _tmp80_; + GHashTable* changed_properties = NULL; + GVariant* _tmp81_; + GHashTable* _tmp82_; + GVariantIter _tmp83_; + GVariant* _tmp84_; + GVariant* _tmp85_; + gchar** invalid = NULL; + int invalid_length1; + GVariant* _tmp86_; + gchar** _tmp87_; + int _tmp87__length; + int _tmp87__size; + int _tmp87__length1; + GVariantIter _tmp88_; + GVariant* _tmp89_; + g_variant_iter_init (&_arguments_iter, parameters); + _tmp80_ = g_variant_iter_next_value (&_arguments_iter); + source = g_variant_dup_string (_tmp80_, NULL); + g_variant_unref (_tmp80_); + _tmp81_ = g_variant_iter_next_value (&_arguments_iter); + _tmp82_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); + g_variant_iter_init (&_tmp83_, _tmp81_); + while (g_variant_iter_loop (&_tmp83_, "{?*}", &_tmp84_, &_tmp85_)) { + g_hash_table_insert (_tmp82_, g_variant_dup_string (_tmp84_, NULL), g_variant_get_variant (_tmp85_)); + } + changed_properties = _tmp82_; + g_variant_unref (_tmp81_); + invalid_length1 = 0; + _tmp86_ = g_variant_iter_next_value (&_arguments_iter); + _tmp87_ = g_new (gchar*, 5); + _tmp87__length = 0; + _tmp87__size = 4; + _tmp87__length1 = 0; + g_variant_iter_init (&_tmp88_, _tmp86_); + for (; (_tmp89_ = g_variant_iter_next_value (&_tmp88_)) != NULL; _tmp87__length1++) { + if (_tmp87__size == _tmp87__length) { + _tmp87__size = 2 * _tmp87__size; + _tmp87_ = g_renew (gchar*, _tmp87_, _tmp87__size + 1); + } + _tmp87_[_tmp87__length++] = g_variant_dup_string (_tmp89_, NULL); + g_variant_unref (_tmp89_); + } + invalid_length1 = _tmp87__length1; + _tmp87_[_tmp87__length] = NULL; + invalid = _tmp87_; + g_variant_unref (_tmp86_); + g_signal_emit_by_name (self, "properties-changed", source, changed_properties, invalid, invalid_length1); + _g_free0 (source); + _g_hash_table_unref0 (changed_properties); + invalid = (_vala_array_free (invalid, invalid_length1, (GDestroyNotify) g_free), NULL); +} + + +static void free_desktop_properties_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters) { + if (strcmp (signal_name, "PropertiesChanged") == 0) { + _dbus_handle_free_desktop_properties_properties_changed (proxy, parameters); + } +} + + +static void free_desktop_properties_proxy_init (FreeDesktopPropertiesProxy* self) { +} + + +static void free_desktop_properties_proxy_free_desktop_properties_interface_init (FreeDesktopPropertiesIface* iface) { +} + + +static void free_desktop_properties_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]; + g_object_unref (invocation); +} + + +static GVariant* free_desktop_properties_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]; + return NULL; +} + + +static gboolean free_desktop_properties_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]; + return FALSE; +} + + +static void _dbus_free_desktop_properties_properties_changed (GObject* _sender, const gchar* source, GHashTable* changed_properties, gchar** invalid, int invalid_length1, gpointer* _data) { + GDBusConnection * _connection; + const gchar * _path; + GVariant *_arguments; + GVariantBuilder _arguments_builder; + GVariantBuilder _tmp90_; + GHashTableIter _tmp91_; + gpointer _tmp92_; + gpointer _tmp93_; + gchar** _tmp94_; + GVariantBuilder _tmp95_; + int _tmp96_; + _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_string (source)); + g_hash_table_iter_init (&_tmp91_, changed_properties); + g_variant_builder_init (&_tmp90_, G_VARIANT_TYPE ("a{sv}")); + while (g_hash_table_iter_next (&_tmp91_, &_tmp92_, &_tmp93_)) { + gchar* _key; + GVariant* _value; + _key = (gchar*) _tmp92_; + _value = (GVariant*) _tmp93_; + g_variant_builder_add (&_tmp90_, "{?*}", g_variant_new_string (_key), g_variant_new_variant (_value)); + } + g_variant_builder_add_value (&_arguments_builder, g_variant_builder_end (&_tmp90_)); + _tmp94_ = invalid; + g_variant_builder_init (&_tmp95_, G_VARIANT_TYPE ("as")); + for (_tmp96_ = 0; _tmp96_ < invalid_length1; _tmp96_++) { + g_variant_builder_add_value (&_tmp95_, g_variant_new_string (*_tmp94_)); + _tmp94_++; + } + g_variant_builder_add_value (&_arguments_builder, g_variant_builder_end (&_tmp95_)); + _arguments = g_variant_builder_end (&_arguments_builder); + g_dbus_connection_emit_signal (_connection, NULL, _path, "org.freedesktop.DBus.Properties", "PropertiesChanged", _arguments, NULL); +} + + +guint free_desktop_properties_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 *) (&_free_desktop_properties_dbus_interface_info), &_free_desktop_properties_dbus_interface_vtable, data, _free_desktop_properties_unregister_object, error); + if (!result) { + return 0; + } + g_signal_connect (object, "properties-changed", (GCallback) _dbus_free_desktop_properties_properties_changed, data); + return result; +} + + +static void _free_desktop_properties_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); +} + + +GQuark xml_error_quark (void) { + return g_quark_from_static_string ("xml_error-quark"); +} + + +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/src/freedesktop-interfaces.vala b/src/freedesktop-interfaces.vala new file mode 100644 index 0000000..4d75044 --- /dev/null +++ b/src/freedesktop-interfaces.vala @@ -0,0 +1,47 @@ +/* +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/>. +*/ + +[DBus (name = "org.freedesktop.DBus")] +public interface FreeDesktopObject: Object { + public abstract async string[] list_names() throws IOError; + public abstract signal void name_owner_changed ( string name, + string old_owner, + string new_owner ); +} + +[DBus (name = "org.freedesktop.DBus.Introspectable")] +public interface FreeDesktopIntrospectable: Object { + public abstract string Introspect() throws IOError; +} + +[DBus (name = "org.freedesktop.DBus.Properties")] +public interface FreeDesktopProperties : Object{ + public signal void PropertiesChanged (string source, HashTable<string, Variant?> changed_properties, + string[] invalid ); +} + +public errordomain XmlError { + FILE_NOT_FOUND, + XML_DOCUMENT_EMPTY +} + +const string FREEDESKTOP_SERVICE = "org.freedesktop.DBus"; +const string FREEDESKTOP_OBJECT = "/org/freedesktop/DBus"; + + diff --git a/src/metadata-menu-item.c b/src/metadata-menu-item.c index 7e1bdbf..140cbcf 100644 --- a/src/metadata-menu-item.c +++ b/src/metadata-menu-item.c @@ -1,4 +1,4 @@ -/* metadata-menu-item.c generated by valac 0.11.2, the Vala compiler +/* metadata-menu-item.c generated by valac 0.11.3, the Vala compiler * generated from metadata-menu-item.vala, do not modify */ /* diff --git a/src/mpris2-controller.c b/src/mpris2-controller.c index acedf64..9e198d7 100644 --- a/src/mpris2-controller.c +++ b/src/mpris2-controller.c @@ -1,4 +1,4 @@ -/* mpris2-controller.c generated by valac 0.11.2, the Vala compiler +/* mpris2-controller.c generated by valac 0.11.3, the Vala compiler * generated from mpris2-controller.vala, do not modify */ /* @@ -22,9 +22,9 @@ 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 <gio/gio.h> #include <gee.h> #include <libdbusmenu-glib/client.h> #include <libdbusmenu-glib/menuitem-proxy.h> @@ -32,20 +32,6 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <libdbusmenu-glib/server.h> -#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 ()) -typedef GDBusProxy FreeDesktopPropertiesProxy; -typedef GDBusProxyClass FreeDesktopPropertiesProxyClass; -#define _g_free0(var) (var = (g_free (var), NULL)) -#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL))) - #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)) @@ -93,6 +79,16 @@ 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)) @@ -128,6 +124,8 @@ typedef struct _PlayerItemClass PlayerItemClass; typedef struct _TransportMenuitem TransportMenuitem; typedef struct _TransportMenuitemClass TransportMenuitemClass; +#define _g_free0(var) (var = (g_free (var), NULL)) +#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL))) #define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL))) #define TRANSPORT_MENUITEM_TYPE_ACTION (transport_menuitem_action_get_type ()) @@ -143,10 +141,6 @@ typedef struct _PlaylistsMenuitem PlaylistsMenuitem; typedef struct _PlaylistsMenuitemClass PlaylistsMenuitemClass; #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) -struct _FreeDesktopPropertiesIface { - GTypeInterface parent_iface; -}; - struct _Mpris2Controller { GObject parent_instance; Mpris2ControllerPrivate * priv; @@ -214,6 +208,10 @@ struct _MprisPlaylistsIface { void (*set_ActivePlaylist) (MprisPlaylists* self, ActivePlaylistContainer* value); }; +struct _FreeDesktopPropertiesIface { + GTypeInterface parent_iface; +}; + struct _Mpris2ControllerPrivate { MprisRoot* _mpris2_root; MprisPlayer* _player; @@ -233,6 +231,7 @@ struct _PlayerController { gint current_state; GeeArrayList* custom_items; Mpris2Controller* mpris_bridge; + gboolean* use_playlists; }; struct _PlayerControllerClass { @@ -256,18 +255,6 @@ typedef enum { static gpointer mpris2_controller_parent_class = NULL; -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); -static void g_cclosure_user_marshal_VOID__STRING_BOXED_BOXED_INT (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data); -static void free_desktop_properties_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters); -static void _dbus_handle_free_desktop_properties_properties_changed (FreeDesktopProperties* self, GVariant* parameters); -static void free_desktop_properties_proxy_free_desktop_properties_interface_init (FreeDesktopPropertiesIface* iface); -static void free_desktop_properties_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* free_desktop_properties_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 gboolean free_desktop_properties_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_free_desktop_properties_properties_changed (GObject* _sender, const gchar* source, GHashTable* changed_properties, gchar** invalid, int invalid_length1, gpointer* _data); -static void _free_desktop_properties_unregister_object (gpointer user_data); 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); @@ -288,6 +275,9 @@ 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 { @@ -303,7 +293,7 @@ Mpris2Controller* mpris2_controller_construct (GType object_type, PlayerControll void mpris2_controller_property_changed_cb (Mpris2Controller* self, const gchar* interface_source, GHashTable* changed_properties, gchar** invalid, int invalid_length1); PlayerController* mpris2_controller_get_owner (Mpris2Controller* self); const gchar* player_controller_get_dbus_name (PlayerController* self); -#define MPRIS2_WATCHER_MPRIS_PREFIX "org.mpris.MediaPlayer2." +#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); @@ -319,11 +309,8 @@ void player_item_reset (PlayerItem* self, GeeHashSet* attrs); GeeHashSet* metadata_menuitem_attributes_format (void); void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attributes); gboolean player_item_populated (PlayerItem* self, GeeHashSet* attrs); +static gboolean _bool_equal (const gboolean* s1, const gboolean* s2); static void mpris2_controller_fetch_active_playlist (Mpris2Controller* self); -gboolean mpris2_controller_playlists_support_exist (Mpris2Controller* self); -MprisPlaylists* mpris2_controller_get_playlists (Mpris2Controller* self); -guint32 mpris_playlists_get_PlaylistCount (MprisPlaylists* self); -static guint32* _uint32_dup (guint32* self); GHashTable* mpris_player_get_Metadata (MprisPlayer* self); static gchar** _variant_get1 (GVariant* value, int* result_length1); static gchar** _vala_array_dup1 (gchar** self, int length); @@ -340,9 +327,11 @@ void mpris_player_Previous (MprisPlayer* self, GAsyncReadyCallback _callback_, g void mpris_player_Previous_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error); void mpris_player_Next (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_); void mpris_player_Next_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error); +MprisPlaylists* mpris2_controller_get_playlists (Mpris2Controller* self); PlaylistDetails* mpris_playlists_GetPlaylists (MprisPlaylists* self, guint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, int* result_length1, GError** error); GType playlists_menuitem_get_type (void) G_GNUC_CONST; void playlists_menuitem_update (PlaylistsMenuitem* self, PlaylistDetails* playlists, int playlists_length1); +static gboolean* _bool_dup (gboolean* self); static void _vala_PlaylistDetails_array_free (PlaylistDetails* array, gint array_length); void mpris_playlists_get_ActivePlaylist (MprisPlaylists* self, ActivePlaylistContainer* result); void playlists_menuitem_update_active_playlist (PlaylistsMenuitem* self, PlaylistDetails* detail); @@ -368,227 +357,6 @@ static void _vala_mpris2_controller_set_property (GObject * object, guint proper 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 GDBusMethodInfo * const _free_desktop_properties_dbus_method_info[] = {NULL}; -static const GDBusArgInfo _free_desktop_properties_dbus_arg_info_properties_changed_source = {-1, "source", "s"}; -static const GDBusArgInfo _free_desktop_properties_dbus_arg_info_properties_changed_changed_properties = {-1, "changed_properties", "a{sv}"}; -static const GDBusArgInfo _free_desktop_properties_dbus_arg_info_properties_changed_invalid = {-1, "invalid", "as"}; -static const GDBusArgInfo * const _free_desktop_properties_dbus_arg_info_properties_changed[] = {&_free_desktop_properties_dbus_arg_info_properties_changed_source, &_free_desktop_properties_dbus_arg_info_properties_changed_changed_properties, &_free_desktop_properties_dbus_arg_info_properties_changed_invalid, NULL}; -static const GDBusSignalInfo _free_desktop_properties_dbus_signal_info_properties_changed = {-1, "PropertiesChanged", (GDBusArgInfo **) (&_free_desktop_properties_dbus_arg_info_properties_changed)}; -static const GDBusSignalInfo * const _free_desktop_properties_dbus_signal_info[] = {&_free_desktop_properties_dbus_signal_info_properties_changed, NULL}; -static const GDBusPropertyInfo * const _free_desktop_properties_dbus_property_info[] = {NULL}; -static const GDBusInterfaceInfo _free_desktop_properties_dbus_interface_info = {-1, "org.freedesktop.DBus.Properties", (GDBusMethodInfo **) (&_free_desktop_properties_dbus_method_info), (GDBusSignalInfo **) (&_free_desktop_properties_dbus_signal_info), (GDBusPropertyInfo **) (&_free_desktop_properties_dbus_property_info)}; -static const GDBusInterfaceVTable _free_desktop_properties_dbus_interface_vtable = {free_desktop_properties_dbus_interface_method_call, free_desktop_properties_dbus_interface_get_property, free_desktop_properties_dbus_interface_set_property}; - -static void g_cclosure_user_marshal_VOID__STRING_BOXED_BOXED_INT (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data) { - typedef void (*GMarshalFunc_VOID__STRING_BOXED_BOXED_INT) (gpointer data1, const char* arg_1, gpointer arg_2, gpointer arg_3, gint arg_4, gpointer data2); - register GMarshalFunc_VOID__STRING_BOXED_BOXED_INT callback; - register GCClosure * cc; - register gpointer data1, data2; - cc = (GCClosure *) closure; - g_return_if_fail (n_param_values == 5); - 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__STRING_BOXED_BOXED_INT) (marshal_data ? marshal_data : cc->callback); - callback (data1, g_value_get_string (param_values + 1), g_value_get_boxed (param_values + 2), g_value_get_boxed (param_values + 3), g_value_get_int (param_values + 4), data2); -} - - -static void free_desktop_properties_base_init (FreeDesktopPropertiesIface * iface) { - static gboolean initialized = FALSE; - if (!initialized) { - initialized = TRUE; - g_signal_new ("properties_changed", TYPE_FREE_DESKTOP_PROPERTIES, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__STRING_BOXED_BOXED_INT, G_TYPE_NONE, 4, G_TYPE_STRING, G_TYPE_HASH_TABLE, G_TYPE_STRV, G_TYPE_INT); - g_type_set_qdata (TYPE_FREE_DESKTOP_PROPERTIES, g_quark_from_static_string ("vala-dbus-register-object"), (void*) free_desktop_properties_register_object); - } -} - - -GType free_desktop_properties_get_type (void) { - static volatile gsize free_desktop_properties_type_id__volatile = 0; - if (g_once_init_enter (&free_desktop_properties_type_id__volatile)) { - static const GTypeInfo g_define_type_info = { sizeof (FreeDesktopPropertiesIface), (GBaseInitFunc) free_desktop_properties_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL }; - GType free_desktop_properties_type_id; - free_desktop_properties_type_id = g_type_register_static (G_TYPE_INTERFACE, "FreeDesktopProperties", &g_define_type_info, 0); - g_type_interface_add_prerequisite (free_desktop_properties_type_id, G_TYPE_OBJECT); - g_once_init_leave (&free_desktop_properties_type_id__volatile, free_desktop_properties_type_id); - } - return free_desktop_properties_type_id__volatile; -} - - -G_DEFINE_TYPE_EXTENDED (FreeDesktopPropertiesProxy, free_desktop_properties_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_FREE_DESKTOP_PROPERTIES, free_desktop_properties_proxy_free_desktop_properties_interface_init) ); -static void free_desktop_properties_proxy_class_init (FreeDesktopPropertiesProxyClass* klass) { - G_DBUS_PROXY_CLASS (klass)->g_signal = free_desktop_properties_proxy_g_signal; -} - - -static void _dbus_handle_free_desktop_properties_properties_changed (FreeDesktopProperties* self, GVariant* parameters) { - GVariantIter _arguments_iter; - gchar* source = NULL; - GVariant* _tmp79_; - GHashTable* changed_properties = NULL; - GVariant* _tmp80_; - GHashTable* _tmp81_; - GVariantIter _tmp82_; - GVariant* _tmp83_; - GVariant* _tmp84_; - gchar** invalid = NULL; - int invalid_length1; - GVariant* _tmp85_; - gchar** _tmp86_; - int _tmp86__length; - int _tmp86__size; - int _tmp86__length1; - GVariantIter _tmp87_; - GVariant* _tmp88_; - g_variant_iter_init (&_arguments_iter, parameters); - _tmp79_ = g_variant_iter_next_value (&_arguments_iter); - source = g_variant_dup_string (_tmp79_, NULL); - g_variant_unref (_tmp79_); - _tmp80_ = g_variant_iter_next_value (&_arguments_iter); - _tmp81_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); - g_variant_iter_init (&_tmp82_, _tmp80_); - while (g_variant_iter_loop (&_tmp82_, "{?*}", &_tmp83_, &_tmp84_)) { - g_hash_table_insert (_tmp81_, g_variant_dup_string (_tmp83_, NULL), g_variant_get_variant (_tmp84_)); - } - changed_properties = _tmp81_; - g_variant_unref (_tmp80_); - invalid_length1 = 0; - _tmp85_ = g_variant_iter_next_value (&_arguments_iter); - _tmp86_ = g_new (gchar*, 5); - _tmp86__length = 0; - _tmp86__size = 4; - _tmp86__length1 = 0; - g_variant_iter_init (&_tmp87_, _tmp85_); - for (; _tmp88_ = g_variant_iter_next_value (&_tmp87_); _tmp86__length1++) { - if (_tmp86__size == _tmp86__length) { - _tmp86__size = 2 * _tmp86__size; - _tmp86_ = g_renew (gchar*, _tmp86_, _tmp86__size + 1); - } - _tmp86_[_tmp86__length++] = g_variant_dup_string (_tmp88_, NULL); - g_variant_unref (_tmp88_); - } - invalid_length1 = _tmp86__length1; - _tmp86_[_tmp86__length] = NULL; - invalid = _tmp86_; - g_variant_unref (_tmp85_); - g_signal_emit_by_name (self, "properties-changed", source, changed_properties, invalid, invalid_length1); - _g_free0 (source); - _g_hash_table_unref0 (changed_properties); - invalid = (_vala_array_free (invalid, invalid_length1, (GDestroyNotify) g_free), NULL); -} - - -static void free_desktop_properties_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters) { - if (strcmp (signal_name, "PropertiesChanged") == 0) { - _dbus_handle_free_desktop_properties_properties_changed (proxy, parameters); - } -} - - -static void free_desktop_properties_proxy_init (FreeDesktopPropertiesProxy* self) { -} - - -static void free_desktop_properties_proxy_free_desktop_properties_interface_init (FreeDesktopPropertiesIface* iface) { -} - - -static void free_desktop_properties_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]; - g_object_unref (invocation); -} - - -static GVariant* free_desktop_properties_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]; - return NULL; -} - - -static gboolean free_desktop_properties_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]; - return FALSE; -} - - -static void _dbus_free_desktop_properties_properties_changed (GObject* _sender, const gchar* source, GHashTable* changed_properties, gchar** invalid, int invalid_length1, gpointer* _data) { - GDBusConnection * _connection; - const gchar * _path; - GVariant *_arguments; - GVariantBuilder _arguments_builder; - GVariantBuilder _tmp89_; - GHashTableIter _tmp90_; - gpointer _tmp91_; - gpointer _tmp92_; - gchar** _tmp93_; - GVariantBuilder _tmp94_; - int _tmp95_; - _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_string (source)); - g_hash_table_iter_init (&_tmp90_, changed_properties); - g_variant_builder_init (&_tmp89_, G_VARIANT_TYPE_DICTIONARY); - while (g_hash_table_iter_next (&_tmp90_, &_tmp91_, &_tmp92_)) { - gchar* _key; - GVariant* _value; - _key = (gchar*) _tmp91_; - _value = (GVariant*) _tmp92_; - g_variant_builder_add (&_tmp89_, "{?*}", g_variant_new_string (_key), g_variant_new_variant (_value)); - } - g_variant_builder_add_value (&_arguments_builder, g_variant_builder_end (&_tmp89_)); - _tmp93_ = invalid; - g_variant_builder_init (&_tmp94_, G_VARIANT_TYPE ("as")); - for (_tmp95_ = 0; _tmp95_ < invalid_length1; _tmp95_++) { - g_variant_builder_add_value (&_tmp94_, g_variant_new_string (*_tmp93_)); - _tmp93_++; - } - g_variant_builder_add_value (&_arguments_builder, g_variant_builder_end (&_tmp94_)); - _arguments = g_variant_builder_end (&_arguments_builder); - g_dbus_connection_emit_signal (_connection, NULL, _path, "org.freedesktop.DBus.Properties", "PropertiesChanged", _arguments, NULL); -} - - -guint free_desktop_properties_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, &_free_desktop_properties_dbus_interface_info, &_free_desktop_properties_dbus_interface_vtable, data, _free_desktop_properties_unregister_object, error); - if (!result) { - return 0; - } - g_signal_connect (object, "properties-changed", (GCallback) _dbus_free_desktop_properties_properties_changed, data); - return result; -} - - -static void _free_desktop_properties_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); -} - Mpris2Controller* mpris2_controller_construct (GType object_type, PlayerController* ctrl) { Mpris2Controller * self = NULL; @@ -615,6 +383,20 @@ static gboolean _mpris2_controller_ensure_correct_playback_status_gsource_func ( } +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); +} + + void mpris2_controller_property_changed_cb (Mpris2Controller* self, const gchar* interface_source, GHashTable* changed_properties, gchar** invalid, int invalid_length1) { const gchar* _tmp0_ = NULL; gboolean _tmp1_ = FALSE; @@ -627,21 +409,22 @@ void mpris2_controller_property_changed_cb (Mpris2Controller* self, const gchar* gconstpointer _tmp21_ = NULL; GVariant* _tmp22_; GVariant* playlist_v; + gboolean _tmp23_ = FALSE; g_return_if_fail (self != NULL); g_return_if_fail (interface_source != NULL); g_return_if_fail (changed_properties != NULL); _tmp0_ = player_controller_get_dbus_name (self->priv->_owner); - g_debug ("mpris2-controller.vala:71: properties-changed for interface %s and own" \ + g_debug ("mpris2-controller.vala:66: properties-changed for interface %s and own" \ "er %s", interface_source, _tmp0_); if (changed_properties == NULL) { _tmp1_ = TRUE; } else { gboolean _tmp2_; - _tmp2_ = g_str_has_prefix (interface_source, MPRIS2_WATCHER_MPRIS_PREFIX); + _tmp2_ = g_str_has_prefix (interface_source, MPRIS_PREFIX); _tmp1_ = _tmp2_ == FALSE; } if (_tmp1_) { - g_warning ("mpris2-controller.vala:74: Property-changed hash is null or this is an" \ + g_warning ("mpris2-controller.vala:69: Property-changed hash is null or this is an" \ " interface that doesn't concerns us"); return; } @@ -706,6 +489,12 @@ void mpris2_controller_property_changed_cb (Mpris2Controller* self, const gchar* _tmp22_ = _g_variant_ref0 ((GVariant*) _tmp21_); playlist_v = _tmp22_; if (playlist_v != NULL) { + gboolean _tmp24_; + _tmp23_ = _bool_equal (self->priv->_owner->use_playlists, (_tmp24_ = TRUE, &_tmp24_)) == TRUE; + } else { + _tmp23_ = FALSE; + } + if (_tmp23_) { mpris2_controller_fetch_active_playlist (self); } _g_variant_unref0 (playlist_v); @@ -714,49 +503,6 @@ void mpris2_controller_property_changed_cb (Mpris2Controller* self, const gchar* } -static guint32* _uint32_dup (guint32* self) { - guint32* dup; - dup = g_new0 (guint32, 1); - memcpy (dup, self, sizeof (guint32)); - return dup; -} - - -static gpointer __uint32_dup0 (gpointer self) { - return self ? _uint32_dup (self) : NULL; -} - - -gboolean mpris2_controller_playlists_support_exist (Mpris2Controller* self) { - gboolean result = FALSE; - guint32 _tmp0_; - guint32* _tmp1_; - guint32* count; - gboolean _tmp2_ = FALSE; - g_return_val_if_fail (self != NULL, FALSE); - if (self->priv->_playlists == NULL) { - result = FALSE; - return result; - } - _tmp0_ = mpris_playlists_get_PlaylistCount (self->priv->_playlists); - _tmp1_ = __uint32_dup0 (&_tmp0_); - count = _tmp1_; - if (count == NULL) { - _tmp2_ = TRUE; - } else { - _tmp2_ = (*count) <= 0; - } - if (_tmp2_) { - result = FALSE; - _g_free0 (count); - return result; - } - result = TRUE; - _g_free0 (count); - return result; -} - - static gboolean mpris2_controller_ensure_correct_playback_status (Mpris2Controller* self) { gboolean result = FALSE; gchar* _tmp0_ = NULL; @@ -772,7 +518,7 @@ static gboolean mpris2_controller_ensure_correct_playback_status (Mpris2Controll g_return_val_if_fail (self != NULL, FALSE); _tmp0_ = mpris_player_get_PlaybackStatus (self->priv->_player); _tmp1_ = _tmp0_; - g_debug ("mpris2-controller.vala:113: TEST playback status = %s", _tmp1_); + g_debug ("mpris2-controller.vala:99: TEST playback status = %s", _tmp1_); _g_free0 (_tmp1_); _tmp2_ = mpris_player_get_PlaybackStatus (self->priv->_player); _tmp3_ = _tmp2_; @@ -799,7 +545,7 @@ static gchar** _variant_get1 (GVariant* value, int* result_length1) { _tmp10__size = 4; _tmp10__length1 = 0; g_variant_iter_init (&_tmp11_, value); - for (; _tmp12_ = g_variant_iter_next_value (&_tmp11_); _tmp10__length1++) { + for (; (_tmp12_ = g_variant_iter_next_value (&_tmp11_)) != NULL; _tmp10__length1++) { if (_tmp10__size == _tmp10__length) { _tmp10__size = 2 * _tmp10__size; _tmp10_ = g_renew (gchar*, _tmp10_, _tmp10__size + 1); @@ -892,7 +638,7 @@ static GHashTable* mpris2_controller_clean_metadata (Mpris2Controller* self) { _tmp18_ = g_strdup ("xesam:artist"); g_hash_table_replace (changed_updates, _tmp18_, _variant_new2 (display_artists)); _tmp19_ = g_hash_table_lookup (changed_updates, "xesam:artist"); - g_debug ("mpris2-controller.vala:127: artist : %s", _variant_get3 ((GVariant*) _tmp19_)); + g_debug ("mpris2-controller.vala:113: artist : %s", _variant_get3 ((GVariant*) _tmp19_)); _g_free0 (display_artists); artists = (_vala_array_free (artists, artists_length1, (GDestroyNotify) g_free), NULL); } @@ -957,6 +703,7 @@ void mpris2_controller_initial_update (Mpris2Controller* self) { PlayerItem* _tmp9_; GeeHashSet* _tmp10_ = NULL; GeeHashSet* _tmp11_; + gboolean _tmp12_; g_return_if_fail (self != NULL); _tmp0_ = mpris_player_get_PlaybackStatus (self->priv->_player); _tmp1_ = _tmp0_; @@ -978,15 +725,17 @@ void mpris2_controller_initial_update (Mpris2Controller* self) { player_item_update (_tmp9_, cleaned_metadata, _tmp11_); _g_object_unref0 (_tmp11_); _g_object_unref0 (_tmp9_); - mpris2_controller_fetch_playlists (self); - mpris2_controller_fetch_active_playlist (self); + if (_bool_equal (self->priv->_owner->use_playlists, (_tmp12_ = TRUE, &_tmp12_)) == TRUE) { + mpris2_controller_fetch_playlists (self); + mpris2_controller_fetch_active_playlist (self); + } _g_hash_table_unref0 (cleaned_metadata); } void mpris2_controller_transport_update (Mpris2Controller* self, TransportMenuitemaction command) { g_return_if_fail (self != NULL); - g_debug ("mpris2-controller.vala:163: transport_event input = %i", (gint) command); + g_debug ("mpris2-controller.vala:152: transport_event input = %i", (gint) command); if (command == TRANSPORT_MENUITEM_ACTION_PLAY_PAUSE) { mpris_player_PlayPause (self->priv->_player, NULL, NULL); } else { @@ -1001,6 +750,19 @@ void mpris2_controller_transport_update (Mpris2Controller* self, TransportMenuit } +static gboolean* _bool_dup (gboolean* self) { + gboolean* dup; + dup = g_new0 (gboolean, 1); + memcpy (dup, self, sizeof (gboolean)); + return dup; +} + + +static gpointer __bool_dup0 (gpointer self) { + return self ? _bool_dup (self) : NULL; +} + + static void _vala_PlaylistDetails_array_free (PlaylistDetails* array, gint array_length) { if (array != NULL) { int i; @@ -1021,9 +783,6 @@ void mpris2_controller_fetch_playlists (Mpris2Controller* self) { PlaylistDetails* current_playlists; GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); - if (self->priv->_playlists == NULL) { - return; - } _tmp1_ = mpris_playlists_GetPlaylists (self->priv->_playlists, (guint32) 0, (guint32) 10, "Alphabetical", FALSE, &_tmp0_, &_inner_error_); _tmp2_ = _tmp1_; current_playlists_length1 = _tmp0_; @@ -1038,11 +797,21 @@ void mpris2_controller_fetch_playlists (Mpris2Controller* self) { gpointer _tmp3_ = NULL; PlayerItem* _tmp4_; PlaylistsMenuitem* playlists_item; - g_debug ("mpris2-controller.vala:184: Size of the playlist array = %i", current_playlists_length1); + g_debug ("mpris2-controller.vala:171: Size of the playlist array = %i", current_playlists_length1); _tmp3_ = gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS); playlists_item = (_tmp4_ = (PlayerItem*) _tmp3_, IS_PLAYLISTS_MENUITEM (_tmp4_) ? ((PlaylistsMenuitem*) _tmp4_) : NULL); playlists_menuitem_update (playlists_item, current_playlists, current_playlists_length1); _g_object_unref0 (playlists_item); + } else { + gboolean _tmp5_; + gboolean* _tmp6_; + gboolean* _tmp7_; + g_warning ("mpris2-controller.vala:176: Playlists are on but its returning no cur" \ +"rent_playlists"); + _tmp6_ = __bool_dup0 ((_tmp5_ = FALSE, &_tmp5_)); + _tmp7_ = _tmp6_; + _g_free0 (self->priv->_owner->use_playlists); + self->priv->_owner->use_playlists = _tmp7_; } current_playlists = (_vala_PlaylistDetails_array_free (current_playlists, current_playlists_length1), NULL); return; @@ -1050,26 +819,19 @@ void mpris2_controller_fetch_playlists (Mpris2Controller* self) { static void mpris2_controller_fetch_active_playlist (Mpris2Controller* self) { - gboolean _tmp0_ = FALSE; + ActivePlaylistContainer _tmp0_ = {0}; + ActivePlaylistContainer _tmp1_; + gboolean _tmp2_; gpointer _tmp3_ = NULL; PlayerItem* _tmp4_; PlaylistsMenuitem* playlists_item; ActivePlaylistContainer _tmp5_ = {0}; ActivePlaylistContainer _tmp6_; g_return_if_fail (self != NULL); - if (self->priv->_playlists == NULL) { - ActivePlaylistContainer _tmp1_ = {0}; - ActivePlaylistContainer _tmp2_; - mpris_playlists_get_ActivePlaylist (self->priv->_playlists, &_tmp1_); - _tmp2_ = _tmp1_; - _tmp0_ = _tmp2_.valid == FALSE; - active_playlist_container_destroy (&_tmp2_); - } else { - _tmp0_ = FALSE; - } - if (_tmp0_) { - g_warning ("mpris2-controller.vala:194: Playlists object is null or we don't have " \ -"an active playlist"); + mpris_playlists_get_ActivePlaylist (self->priv->_playlists, &_tmp0_); + _tmp1_ = _tmp0_; + if ((_tmp2_ = _tmp1_.valid == FALSE, active_playlist_container_destroy (&_tmp1_), _tmp2_)) { + g_debug ("mpris2-controller.vala:185: We don't have an active playlist"); } _tmp3_ = gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS); playlists_item = (_tmp4_ = (PlayerItem*) _tmp3_, IS_PLAYLISTS_MENUITEM (_tmp4_) ? ((PlaylistsMenuitem*) _tmp4_) : NULL); @@ -1109,21 +871,17 @@ void mpris2_controller_activate_playlist (Mpris2Controller* self, const char* pa GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (path != NULL); - if (self->priv->_playlists == NULL) { - g_warning ("mpris2-controller.vala:216: playlists mpris instance is null !"); - return; - } mpris_playlists_ActivatePlaylist (self->priv->_playlists, path, NULL, NULL); - goto __finally10; - __catch10_g_io_error: + goto __finally11; + __catch11_g_io_error: { GError * e; e = _inner_error_; _inner_error_ = NULL; - g_debug ("mpris2-controller.vala:223: Could not activate playlist %s because %s", (const gchar*) path, e->message); + g_debug ("mpris2-controller.vala:210: Could not activate playlist %s because %s", (const gchar*) path, e->message); _g_error_free0 (e); } - __finally10: + __finally11: 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_); @@ -1248,83 +1006,94 @@ static GObject * mpris2_controller_constructor (GType type, guint n_construct_pr Mpris2Controller * self; const gchar* _tmp0_ = NULL; const gchar* _tmp1_ = NULL; - MprisRoot* _tmp2_; + MprisRoot* _tmp2_ = NULL; MprisRoot* _tmp3_; - const gchar* _tmp4_ = NULL; + MprisRoot* _tmp4_; const gchar* _tmp5_ = NULL; - MprisPlayer* _tmp6_; - MprisPlayer* _tmp7_; - const gchar* _tmp8_ = NULL; - const gchar* _tmp9_ = NULL; - MprisPlaylists* _tmp10_; - MprisPlaylists* _tmp11_; - FreeDesktopProperties* _tmp12_; - FreeDesktopProperties* _tmp13_; + const gchar* _tmp6_ = NULL; + MprisPlayer* _tmp7_ = NULL; + MprisPlayer* _tmp8_; + MprisPlayer* _tmp9_; + gboolean _tmp10_; + FreeDesktopProperties* _tmp16_ = NULL; + FreeDesktopProperties* _tmp17_; + FreeDesktopProperties* _tmp18_; 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); _tmp0_ = player_controller_get_dbus_name (self->priv->_owner); _tmp1_ = player_controller_get_dbus_name (self->priv->_owner); - _tmp2_ = (MprisRoot*) g_initable_new (TYPE_MPRIS_ROOT_PROXY, NULL, &_inner_error_, "g-flags", 0, "g-name", _tmp1_, "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/mpris/MediaPlayer2", "g-interface-name", "org.mpris.MediaPlayer2", NULL); + _tmp2_ = g_initable_new (TYPE_MPRIS_ROOT_PROXY, NULL, &_inner_error_, "g-flags", 0, "g-name", _tmp1_, "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/mpris/MediaPlayer2", "g-interface-name", "org.mpris.MediaPlayer2", NULL); + _tmp3_ = (MprisRoot*) _tmp2_; if (_inner_error_ != NULL) { if (_inner_error_->domain == G_IO_ERROR) { - goto __catch11_g_io_error; + goto __catch12_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_); } - _tmp3_ = _tmp2_; - mpris2_controller_set_mpris2_root (self, _tmp3_); - _g_object_unref0 (_tmp3_); - _tmp4_ = player_controller_get_dbus_name (self->priv->_owner); + _tmp4_ = _tmp3_; + mpris2_controller_set_mpris2_root (self, _tmp4_); + _g_object_unref0 (_tmp4_); _tmp5_ = player_controller_get_dbus_name (self->priv->_owner); - _tmp6_ = (MprisPlayer*) g_initable_new (TYPE_MPRIS_PLAYER_PROXY, NULL, &_inner_error_, "g-flags", 0, "g-name", _tmp5_, "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/mpris/MediaPlayer2", "g-interface-name", "org.mpris.MediaPlayer2.Player", NULL); + _tmp6_ = player_controller_get_dbus_name (self->priv->_owner); + _tmp7_ = g_initable_new (TYPE_MPRIS_PLAYER_PROXY, NULL, &_inner_error_, "g-flags", 0, "g-name", _tmp6_, "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/mpris/MediaPlayer2", "g-interface-name", "org.mpris.MediaPlayer2.Player", NULL); + _tmp8_ = (MprisPlayer*) _tmp7_; if (_inner_error_ != NULL) { if (_inner_error_->domain == G_IO_ERROR) { - goto __catch11_g_io_error; + goto __catch12_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_); } - _tmp7_ = _tmp6_; - mpris2_controller_set_player (self, _tmp7_); - _g_object_unref0 (_tmp7_); - _tmp8_ = player_controller_get_dbus_name (self->priv->_owner); - _tmp9_ = player_controller_get_dbus_name (self->priv->_owner); - _tmp10_ = (MprisPlaylists*) g_initable_new (TYPE_MPRIS_PLAYLISTS_PROXY, NULL, &_inner_error_, "g-flags", 0, "g-name", _tmp9_, "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/mpris/MediaPlayer2", "g-interface-name", "org.mpris.MediaPlayer2.Playlists", NULL); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == G_IO_ERROR) { - goto __catch11_g_io_error; + _tmp9_ = _tmp8_; + mpris2_controller_set_player (self, _tmp9_); + _g_object_unref0 (_tmp9_); + if (_bool_equal (self->priv->_owner->use_playlists, (_tmp10_ = TRUE, &_tmp10_)) == TRUE) { + const gchar* _tmp11_ = NULL; + const gchar* _tmp12_ = NULL; + MprisPlaylists* _tmp13_ = NULL; + MprisPlaylists* _tmp14_; + MprisPlaylists* _tmp15_; + _tmp11_ = player_controller_get_dbus_name (self->priv->_owner); + _tmp12_ = player_controller_get_dbus_name (self->priv->_owner); + _tmp13_ = g_initable_new (TYPE_MPRIS_PLAYLISTS_PROXY, NULL, &_inner_error_, "g-flags", 0, "g-name", _tmp12_, "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/mpris/MediaPlayer2", "g-interface-name", "org.mpris.MediaPlayer2.Playlists", NULL); + _tmp14_ = (MprisPlaylists*) _tmp13_; + if (_inner_error_ != NULL) { + if (_inner_error_->domain == G_IO_ERROR) { + goto __catch12_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_); } - 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_); + _tmp15_ = _tmp14_; + mpris2_controller_set_playlists (self, _tmp15_); + _g_object_unref0 (_tmp15_); } - _tmp11_ = _tmp10_; - mpris2_controller_set_playlists (self, _tmp11_); - _g_object_unref0 (_tmp11_); - _tmp12_ = (FreeDesktopProperties*) 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); + _tmp16_ = 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); + _tmp17_ = (FreeDesktopProperties*) _tmp16_; if (_inner_error_ != NULL) { if (_inner_error_->domain == G_IO_ERROR) { - goto __catch11_g_io_error; + goto __catch12_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_); } - _tmp13_ = _tmp12_; - mpris2_controller_set_properties_interface (self, _tmp13_); - _g_object_unref0 (_tmp13_); + _tmp18_ = _tmp17_; + mpris2_controller_set_properties_interface (self, _tmp18_); + _g_object_unref0 (_tmp18_); g_signal_connect_object (self->priv->_properties_interface, "properties-changed", (GCallback) _mpris2_controller_property_changed_cb_free_desktop_properties_properties_changed, self, 0); - goto __finally11; - __catch11_g_io_error: + goto __finally12; + __catch12_g_io_error: { GError * e; e = _inner_error_; _inner_error_ = NULL; - g_error ("mpris2-controller.vala:63: Problems connecting to the session bus - %s", e->message); + g_error ("mpris2-controller.vala:58: Problems connecting to the session bus - %s", e->message); _g_error_free0 (e); } - __finally11: + __finally12: if (_inner_error_ != NULL) { g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); g_clear_error (&_inner_error_); diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala index c43f5fe..fc61c12 100644 --- a/src/mpris2-controller.vala +++ b/src/mpris2-controller.vala @@ -18,12 +18,6 @@ with this program. If not, see <http://www.gnu.org/licenses/>. */ using Dbusmenu; -[DBus (name = "org.freedesktop.DBus.Properties")] -public interface FreeDesktopProperties : Object{ - public signal void PropertiesChanged (string source, HashTable<string, Variant?> changed_properties, - string[] invalid ); -} - /* This class will entirely replace mpris-controller.vala hence why there is no point in trying to get encorporate both into the same object model. @@ -71,7 +65,7 @@ public class Mpris2Controller : GLib.Object { debug("properties-changed for interface %s and owner %s", interface_source, this.owner.dbus_name); if ( changed_properties == null || - interface_source.has_prefix ( Mpris2Watcher.MPRIS_PREFIX ) == false ){ + interface_source.has_prefix ( MPRIS_PREFIX ) == false ){ warning("Property-changed hash is null or this is an interface that doesn't concerns us"); return; } @@ -148,9 +142,8 @@ public class Mpris2Controller : GLib.Object MetadataMenuitem.attributes_format()); if ( this.owner.use_playlists == true ){ - debug ("it thinks that there is a valid playlist interface"); this.fetch_playlists(); - this.fetch_active_playlist(); + this.fetch_active_playlist(); } } diff --git a/src/mpris2-interfaces.c b/src/mpris2-interfaces.c index 2de05a9..6f18596 100644 --- a/src/mpris2-interfaces.c +++ b/src/mpris2-interfaces.c @@ -1,4 +1,4 @@ -/* mpris2-interfaces.c generated by valac 0.11.2, the Vala compiler +/* mpris2-interfaces.c generated by valac 0.11.3, the Vala compiler * generated from mpris2-interfaces.vala, do not modify */ /* @@ -21,9 +21,9 @@ 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 <gio/gio.h> #define TYPE_MPRIS_ROOT (mpris_root_get_type ()) @@ -130,6 +130,8 @@ struct _MprisPlaylistsIface { +#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; @@ -165,9 +167,9 @@ 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_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 _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); @@ -214,11 +216,11 @@ 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_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_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_Previous_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); @@ -264,7 +266,7 @@ static void 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); -static void _dbus_mpris_playlists_ActivatePlaylist_ready (GObject * source_object, GAsyncResult * _res_, gpointer * _user_data_); +static void _dbus_mpris_playlists_ActivatePlaylist_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_); static void _vala_PlaylistDetails_array_free (PlaylistDetails* array, gint array_length); static void _dbus_mpris_playlists_GetPlaylists (MprisPlaylists* self, GVariant* parameters, GDBusMethodInvocation* invocation); 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); @@ -464,14 +466,14 @@ static void mpris_root_proxy_Quit_async (MprisRoot* self, GAsyncReadyCallback _c 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 (self, _callback_, _user_data_, NULL)); + 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 (_res_), error); + _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; } @@ -492,14 +494,14 @@ static void mpris_root_proxy_Raise_async (MprisRoot* self, GAsyncReadyCallback _ 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 (self, _callback_, _user_data_, NULL)); + 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 (_res_), error); + _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; } @@ -756,10 +758,9 @@ static void _dbus_mpris_root_Quit (MprisRoot* self, GVariant* parameters, GDBusM } -static void _dbus_mpris_root_Quit_ready (GObject * source_object, GAsyncResult * _res_, gpointer * _user_data_) { +static void _dbus_mpris_root_Quit_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_) { GDBusMethodInvocation * invocation; GError* error; - GVariantIter _arguments_iter; GDBusMessage* _reply_message; GVariant* _reply; GVariantBuilder _reply_builder; @@ -787,10 +788,9 @@ static void _dbus_mpris_root_Raise (MprisRoot* self, GVariant* parameters, GDBus } -static void _dbus_mpris_root_Raise_ready (GObject * source_object, GAsyncResult * _res_, gpointer * _user_data_) { +static void _dbus_mpris_root_Raise_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_) { GDBusMethodInvocation * invocation; GError* error; - GVariantIter _arguments_iter; GDBusMessage* _reply_message; GVariant* _reply; GVariantBuilder _reply_builder; @@ -961,7 +961,7 @@ guint mpris_root_register_object (gpointer object, GDBusConnection* connection, 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, &_mpris_root_dbus_interface_info, &_mpris_root_dbus_interface_vtable, data, _mpris_root_unregister_object, error); + 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; } @@ -1122,14 +1122,14 @@ static void mpris_player_proxy_PlayPause_async (MprisPlayer* self, GAsyncReadyCa 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 (self, _callback_, _user_data_, NULL)); + 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 (_res_), error); + _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; } @@ -1150,14 +1150,14 @@ static void mpris_player_proxy_Next_async (MprisPlayer* self, GAsyncReadyCallbac 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 (self, _callback_, _user_data_, NULL)); + 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 (_res_), error); + _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; } @@ -1178,14 +1178,14 @@ static void mpris_player_proxy_Previous_async (MprisPlayer* self, GAsyncReadyCal 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 (self, _callback_, _user_data_, NULL)); + 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 (_res_), error); + _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; } @@ -1244,7 +1244,7 @@ static void mpris_player_dbus_proxy_set_Metadata (MprisPlayer* self, GHashTable* 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_DICTIONARY); + g_variant_builder_init (&_tmp5_, G_VARIANT_TYPE ("a{sv}")); while (g_hash_table_iter_next (&_tmp6_, &_tmp7_, &_tmp8_)) { gchar* _key; GVariant* _value; @@ -1374,10 +1374,9 @@ static void _dbus_mpris_player_PlayPause (MprisPlayer* self, GVariant* parameter } -static void _dbus_mpris_player_PlayPause_ready (GObject * source_object, GAsyncResult * _res_, gpointer * _user_data_) { +static void _dbus_mpris_player_PlayPause_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_) { GDBusMethodInvocation * invocation; GError* error; - GVariantIter _arguments_iter; GDBusMessage* _reply_message; GVariant* _reply; GVariantBuilder _reply_builder; @@ -1405,10 +1404,9 @@ static void _dbus_mpris_player_Next (MprisPlayer* self, GVariant* parameters, GD } -static void _dbus_mpris_player_Next_ready (GObject * source_object, GAsyncResult * _res_, gpointer * _user_data_) { +static void _dbus_mpris_player_Next_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_) { GDBusMethodInvocation * invocation; GError* error; - GVariantIter _arguments_iter; GDBusMessage* _reply_message; GVariant* _reply; GVariantBuilder _reply_builder; @@ -1436,10 +1434,9 @@ static void _dbus_mpris_player_Previous (MprisPlayer* self, GVariant* parameters } -static void _dbus_mpris_player_Previous_ready (GObject * source_object, GAsyncResult * _res_, gpointer * _user_data_) { +static void _dbus_mpris_player_Previous_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_) { GDBusMethodInvocation * invocation; GError* error; - GVariantIter _arguments_iter; GDBusMessage* _reply_message; GVariant* _reply; GVariantBuilder _reply_builder; @@ -1485,7 +1482,7 @@ static GVariant* _dbus_mpris_player_get_Metadata (MprisPlayer* self) { GVariant* _reply; result = mpris_player_get_Metadata (self); g_hash_table_iter_init (&_tmp10_, result); - g_variant_builder_init (&_tmp9_, G_VARIANT_TYPE_DICTIONARY); + g_variant_builder_init (&_tmp9_, G_VARIANT_TYPE ("a{sv}")); while (g_hash_table_iter_next (&_tmp10_, &_tmp11_, &_tmp12_)) { gchar* _key; GVariant* _value; @@ -1606,7 +1603,7 @@ guint mpris_player_register_object (gpointer object, GDBusConnection* connection 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, &_mpris_player_dbus_interface_info, &_mpris_player_dbus_interface_vtable, data, _mpris_player_unregister_object, error); + 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; } @@ -1711,13 +1708,6 @@ void mpris_playlists_ActivatePlaylist_finish (MprisPlaylists* self, GAsyncResult } -PlaylistDetails* mpris_playlists_real_GetPlaylists (MprisPlaylists* self, guint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, int* result_length1, GError** error) { - g_return_val_if_fail (self != NULL, NULL); - g_critical ("Type `%s' does not implement abstract method `mpris_playlists_GetPlaylists'", g_type_name (G_TYPE_FROM_INSTANCE (self))); - return NULL; -} - - PlaylistDetails* mpris_playlists_GetPlaylists (MprisPlaylists* self, guint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, int* result_length1, GError** error) { return MPRIS_PLAYLISTS_GET_INTERFACE (self)->GetPlaylists (self, index, max_count, order, reverse_order, result_length1, error); } @@ -1802,14 +1792,14 @@ static void mpris_playlists_proxy_ActivatePlaylist_async (MprisPlaylists* self, 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 (self, _callback_, _user_data_, NULL)); + 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 (_res_), error); + _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; } @@ -1864,7 +1854,7 @@ static PlaylistDetails* mpris_playlists_proxy_GetPlaylists (MprisPlaylists* self _tmp18__size = 4; _tmp18__length1 = 0; g_variant_iter_init (&_tmp19_, _tmp17_); - for (; _tmp20_ = g_variant_iter_next_value (&_tmp19_); _tmp18__length1++) { + for (; (_tmp20_ = g_variant_iter_next_value (&_tmp19_)) != NULL; _tmp18__length1++) { PlaylistDetails _tmp21_; GVariantIter _tmp22_; GVariant* _tmp23_; @@ -1928,7 +1918,7 @@ static gchar** mpris_playlists_dbus_proxy_get_Orderings (MprisPlaylists* self, i _tmp26__size = 4; _tmp26__length1 = 0; g_variant_iter_init (&_tmp27_, _inner_reply); - for (; _tmp28_ = g_variant_iter_next_value (&_tmp27_); _tmp26__length1++) { + for (; (_tmp28_ = g_variant_iter_next_value (&_tmp27_)) != NULL; _tmp26__length1++) { if (_tmp26__size == _tmp26__length) { _tmp26__size = 2 * _tmp26__size; _tmp26_ = g_renew (gchar*, _tmp26_, _tmp26__size + 1); @@ -2121,10 +2111,9 @@ static void _dbus_mpris_playlists_ActivatePlaylist (MprisPlaylists* self, GVaria } -static void _dbus_mpris_playlists_ActivatePlaylist_ready (GObject * source_object, GAsyncResult * _res_, gpointer * _user_data_) { +static void _dbus_mpris_playlists_ActivatePlaylist_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_) { GDBusMethodInvocation * invocation; GError* error; - GVariantIter _arguments_iter; GDBusMessage* _reply_message; GVariant* _reply; GVariantBuilder _reply_builder; @@ -2309,7 +2298,7 @@ static void _dbus_mpris_playlists_set_Orderings (MprisPlaylists* self, GVariant* _tmp57__size = 4; _tmp57__length1 = 0; g_variant_iter_init (&_tmp58_, _value); - for (; _tmp59_ = g_variant_iter_next_value (&_tmp58_); _tmp57__length1++) { + for (; (_tmp59_ = g_variant_iter_next_value (&_tmp58_)) != NULL; _tmp57__length1++) { if (_tmp57__size == _tmp57__length) { _tmp57__size = 2 * _tmp57__size; _tmp57_ = g_renew (gchar*, _tmp57_, _tmp57__size + 1); @@ -2392,7 +2381,7 @@ guint mpris_playlists_register_object (gpointer object, GDBusConnection* connect 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, &_mpris_playlists_dbus_interface_info, &_mpris_playlists_dbus_interface_vtable, data, _mpris_playlists_unregister_object, error); + 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; } diff --git a/src/mpris2-interfaces.vala b/src/mpris2-interfaces.vala index 88610e6..9d0b8c9 100644 --- a/src/mpris2-interfaces.vala +++ b/src/mpris2-interfaces.vala @@ -16,6 +16,8 @@ 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 { @@ -24,7 +26,7 @@ public interface MprisRoot : Object { 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;} + public abstract string DesktopEntry{owned get; set;} // methods public abstract async void Quit() throws IOError; public abstract async void Raise() throws IOError; diff --git a/src/mpris2-watcher.c b/src/mpris2-watcher.c index 76d8995..0cdefb4 100644 --- a/src/mpris2-watcher.c +++ b/src/mpris2-watcher.c @@ -1,4 +1,4 @@ -/* mpris2-watcher.c generated by valac 0.11.2, the Vala compiler +/* mpris2-watcher.c generated by valac 0.11.3, the Vala compiler * generated from mpris2-watcher.vala, do not modify */ /* @@ -25,21 +25,10 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <gio/gio.h> #include <stdlib.h> #include <string.h> +#include <libxml/parser.h> +#include <libxml/tree.h> -#define TYPE_FREE_DESKTOP_OBJECT (free_desktop_object_get_type ()) -#define FREE_DESKTOP_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FREE_DESKTOP_OBJECT, FreeDesktopObject)) -#define IS_FREE_DESKTOP_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FREE_DESKTOP_OBJECT)) -#define FREE_DESKTOP_OBJECT_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_FREE_DESKTOP_OBJECT, FreeDesktopObjectIface)) - -typedef struct _FreeDesktopObject FreeDesktopObject; -typedef struct _FreeDesktopObjectIface FreeDesktopObjectIface; - -#define TYPE_FREE_DESKTOP_OBJECT_PROXY (free_desktop_object_proxy_get_type ()) -typedef GDBusProxy FreeDesktopObjectProxy; -typedef GDBusProxyClass FreeDesktopObjectProxyClass; -#define _g_free0(var) (var = (g_free (var), NULL)) - #define TYPE_MPRIS2_WATCHER (mpris2_watcher_get_type ()) #define MPRIS2_WATCHER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS2_WATCHER, Mpris2Watcher)) #define MPRIS2_WATCHER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS2_WATCHER, Mpris2WatcherClass)) @@ -50,7 +39,18 @@ typedef GDBusProxyClass FreeDesktopObjectProxyClass; typedef struct _Mpris2Watcher Mpris2Watcher; typedef struct _Mpris2WatcherClass Mpris2WatcherClass; typedef struct _Mpris2WatcherPrivate Mpris2WatcherPrivate; + +#define TYPE_FREE_DESKTOP_OBJECT (free_desktop_object_get_type ()) +#define FREE_DESKTOP_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FREE_DESKTOP_OBJECT, FreeDesktopObject)) +#define IS_FREE_DESKTOP_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FREE_DESKTOP_OBJECT)) +#define FREE_DESKTOP_OBJECT_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_FREE_DESKTOP_OBJECT, FreeDesktopObjectIface)) + +typedef struct _FreeDesktopObject FreeDesktopObject; +typedef struct _FreeDesktopObjectIface FreeDesktopObjectIface; + +#define TYPE_FREE_DESKTOP_OBJECT_PROXY (free_desktop_object_proxy_get_type ()) #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) #define TYPE_MPRIS_ROOT (mpris_root_get_type ()) #define MPRIS_ROOT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_ROOT, MprisRoot)) @@ -61,14 +61,18 @@ typedef struct _MprisRoot MprisRoot; typedef struct _MprisRootIface MprisRootIface; #define TYPE_MPRIS_ROOT_PROXY (mpris_root_proxy_get_type ()) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) +#define _g_free0(var) (var = (g_free (var), NULL)) typedef struct _Mpris2WatcherCheckForActiveClientsData Mpris2WatcherCheckForActiveClientsData; -struct _FreeDesktopObjectIface { - GTypeInterface parent_iface; - void (*list_names) (FreeDesktopObject* self, GAsyncReadyCallback _callback_, gpointer _user_data_); - gchar** (*list_names_finish) (FreeDesktopObject* self, GAsyncResult* _res_, int* result_length1, GError** error); -}; +#define TYPE_FREE_DESKTOP_INTROSPECTABLE (free_desktop_introspectable_get_type ()) +#define FREE_DESKTOP_INTROSPECTABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FREE_DESKTOP_INTROSPECTABLE, FreeDesktopIntrospectable)) +#define IS_FREE_DESKTOP_INTROSPECTABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FREE_DESKTOP_INTROSPECTABLE)) +#define FREE_DESKTOP_INTROSPECTABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_FREE_DESKTOP_INTROSPECTABLE, FreeDesktopIntrospectableIface)) + +typedef struct _FreeDesktopIntrospectable FreeDesktopIntrospectable; +typedef struct _FreeDesktopIntrospectableIface FreeDesktopIntrospectableIface; + +#define TYPE_FREE_DESKTOP_INTROSPECTABLE_PROXY (free_desktop_introspectable_proxy_get_type ()) struct _Mpris2Watcher { GObject parent_instance; @@ -79,6 +83,12 @@ struct _Mpris2WatcherClass { GObjectClass parent_class; }; +struct _FreeDesktopObjectIface { + GTypeInterface parent_iface; + void (*list_names) (FreeDesktopObject* self, GAsyncReadyCallback _callback_, gpointer _user_data_); + gchar** (*list_names_finish) (FreeDesktopObject* self, GAsyncResult* _res_, int* result_length1, GError** error); +}; + struct _Mpris2WatcherPrivate { FreeDesktopObject* fdesktop_obj; }; @@ -126,361 +136,61 @@ struct _Mpris2WatcherCheckForActiveClientsData { gboolean _tmp6_; MprisRoot* _tmp7_; MprisRoot* mpris2_root; - gchar* _tmp8_; + gboolean _tmp8_; + gboolean use_playlists; gchar* _tmp9_; + gchar* _tmp10_; GError * _inner_error_; }; +struct _FreeDesktopIntrospectableIface { + GTypeInterface parent_iface; + gchar* (*Introspect) (FreeDesktopIntrospectable* self, GError** error); +}; + static gpointer mpris2_watcher_parent_class = NULL; +GType mpris2_watcher_get_type (void) G_GNUC_CONST; GType free_desktop_object_proxy_get_type (void) G_GNUC_CONST; guint free_desktop_object_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error); GType free_desktop_object_get_type (void) G_GNUC_CONST; -void free_desktop_object_list_names (FreeDesktopObject* self, GAsyncReadyCallback _callback_, gpointer _user_data_); -gchar** free_desktop_object_list_names_finish (FreeDesktopObject* self, GAsyncResult* _res_, int* result_length1, GError** error); -static void g_cclosure_user_marshal_VOID__STRING_STRING_STRING (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data); -static void free_desktop_object_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters); -static void _dbus_handle_free_desktop_object_name_owner_changed (FreeDesktopObject* self, GVariant* parameters); -static void _vala_g_async_ready_callback (GObject *source_object, GAsyncResult *res, void *user_data); -static void free_desktop_object_proxy_list_names_async (FreeDesktopObject* self, GAsyncReadyCallback _callback_, gpointer _user_data_); -static gchar** free_desktop_object_proxy_list_names_finish (FreeDesktopObject* self, GAsyncResult* _res_, int* result_length1, GError** error); -static void free_desktop_object_proxy_free_desktop_object_interface_init (FreeDesktopObjectIface* iface); -static void _dbus_free_desktop_object_list_names (FreeDesktopObject* self, GVariant* parameters, GDBusMethodInvocation* invocation); -static void _dbus_free_desktop_object_list_names_ready (GObject * source_object, GAsyncResult * _res_, gpointer * _user_data_); -static void free_desktop_object_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* free_desktop_object_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 gboolean free_desktop_object_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_free_desktop_object_name_owner_changed (GObject* _sender, const gchar* name, const gchar* old_owner, const gchar* new_owner, gpointer* _data); -static void _free_desktop_object_unregister_object (gpointer user_data); -GType mpris2_watcher_get_type (void) G_GNUC_CONST; #define MPRIS2_WATCHER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_MPRIS2_WATCHER, Mpris2WatcherPrivate)) enum { MPRIS2_WATCHER_DUMMY_PROPERTY }; -#define MPRIS2_WATCHER_FREEDESKTOP_SERVICE "org.freedesktop.DBus" -#define MPRIS2_WATCHER_FREEDESKTOP_OBJECT "/org/freedesktop/DBus" -#define MPRIS2_WATCHER_MPRIS_PREFIX "org.mpris.MediaPlayer2." -#define MPRIS2_WATCHER_MPRIS_MEDIA_PLAYER_PATH "/org/mpris/MediaPlayer2" Mpris2Watcher* mpris2_watcher_new (void); Mpris2Watcher* mpris2_watcher_construct (GType object_type); -static void mpris2_watcher_name_changes_detected (Mpris2Watcher* self, FreeDesktopObject* dbus_obj, const gchar* name, const gchar* previous_owner, const gchar* current_owner); +static void mpris2_watcher_check_for_active_clients_data_free (gpointer _data); +static void mpris2_watcher_check_for_active_clients (Mpris2Watcher* self, GAsyncReadyCallback _callback_, gpointer _user_data_); +static void mpris2_watcher_check_for_active_clients_finish (Mpris2Watcher* self, GAsyncResult* _res_); +static gboolean mpris2_watcher_check_for_active_clients_co (Mpris2WatcherCheckForActiveClientsData* data); +void free_desktop_object_list_names (FreeDesktopObject* self, GAsyncReadyCallback _callback_, gpointer _user_data_); +gchar** free_desktop_object_list_names_finish (FreeDesktopObject* self, GAsyncResult* _res_, int* result_length1, GError** error); +static void mpris2_watcher_check_for_active_clients_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_); +#define MPRIS_PREFIX "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; static MprisRoot* mpris2_watcher_create_mpris_root (Mpris2Watcher* self, const gchar* name); +static gboolean mpris2_watcher_supports_playlists (Mpris2Watcher* self, const gchar* name); gchar* mpris_root_get_DesktopEntry (MprisRoot* self); -static void mpris2_watcher_check_for_active_clients_data_free (gpointer _data); -static void mpris2_watcher_check_for_active_clients_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_); -static void mpris2_watcher_check_for_active_clients (Mpris2Watcher* self, GAsyncReadyCallback _callback_, gpointer _user_data_); -static void mpris2_watcher_check_for_active_clients_finish (Mpris2Watcher* self, GAsyncResult* _res_); -static gboolean mpris2_watcher_check_for_active_clients_co (Mpris2WatcherCheckForActiveClientsData* data); -static void g_cclosure_user_marshal_VOID__STRING_STRING (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data); +static void mpris2_watcher_name_changes_detected (Mpris2Watcher* self, FreeDesktopObject* dbus_obj, const gchar* name, const gchar* previous_owner, const gchar* current_owner); +#define MPRIS_MEDIA_PLAYER_PATH "/org/mpris/MediaPlayer2" +GType free_desktop_introspectable_proxy_get_type (void) G_GNUC_CONST; +guint free_desktop_introspectable_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error); +GType free_desktop_introspectable_get_type (void) G_GNUC_CONST; +gchar* free_desktop_introspectable_Introspect (FreeDesktopIntrospectable* self, GError** error); +static gboolean mpris2_watcher_parse_interfaces (Mpris2Watcher* self, const gchar* interface_info); +static void g_cclosure_user_marshal_VOID__STRING_STRING_BOOLEAN (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data); static GObject * mpris2_watcher_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); +#define FREEDESKTOP_SERVICE "org.freedesktop.DBus" +#define FREEDESKTOP_OBJECT "/org/freedesktop/DBus" static void _mpris2_watcher_name_changes_detected_free_desktop_object_name_owner_changed (FreeDesktopObject* _sender, const gchar* name, const gchar* old_owner, const gchar* new_owner, gpointer self); static void mpris2_watcher_finalize (GObject* obj); 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 _free_desktop_object_dbus_arg_info_list_names_result = {-1, "result", "as"}; -static const GDBusArgInfo * const _free_desktop_object_dbus_arg_info_list_names_in[] = {NULL}; -static const GDBusArgInfo * const _free_desktop_object_dbus_arg_info_list_names_out[] = {&_free_desktop_object_dbus_arg_info_list_names_result, NULL}; -static const GDBusMethodInfo _free_desktop_object_dbus_method_info_list_names = {-1, "ListNames", (GDBusArgInfo **) (&_free_desktop_object_dbus_arg_info_list_names_in), (GDBusArgInfo **) (&_free_desktop_object_dbus_arg_info_list_names_out)}; -static const GDBusMethodInfo * const _free_desktop_object_dbus_method_info[] = {&_free_desktop_object_dbus_method_info_list_names, NULL}; -static const GDBusArgInfo _free_desktop_object_dbus_arg_info_name_owner_changed_name = {-1, "name", "s"}; -static const GDBusArgInfo _free_desktop_object_dbus_arg_info_name_owner_changed_old_owner = {-1, "old_owner", "s"}; -static const GDBusArgInfo _free_desktop_object_dbus_arg_info_name_owner_changed_new_owner = {-1, "new_owner", "s"}; -static const GDBusArgInfo * const _free_desktop_object_dbus_arg_info_name_owner_changed[] = {&_free_desktop_object_dbus_arg_info_name_owner_changed_name, &_free_desktop_object_dbus_arg_info_name_owner_changed_old_owner, &_free_desktop_object_dbus_arg_info_name_owner_changed_new_owner, NULL}; -static const GDBusSignalInfo _free_desktop_object_dbus_signal_info_name_owner_changed = {-1, "NameOwnerChanged", (GDBusArgInfo **) (&_free_desktop_object_dbus_arg_info_name_owner_changed)}; -static const GDBusSignalInfo * const _free_desktop_object_dbus_signal_info[] = {&_free_desktop_object_dbus_signal_info_name_owner_changed, NULL}; -static const GDBusPropertyInfo * const _free_desktop_object_dbus_property_info[] = {NULL}; -static const GDBusInterfaceInfo _free_desktop_object_dbus_interface_info = {-1, "org.freedesktop.DBus", (GDBusMethodInfo **) (&_free_desktop_object_dbus_method_info), (GDBusSignalInfo **) (&_free_desktop_object_dbus_signal_info), (GDBusPropertyInfo **) (&_free_desktop_object_dbus_property_info)}; -static const GDBusInterfaceVTable _free_desktop_object_dbus_interface_vtable = {free_desktop_object_dbus_interface_method_call, free_desktop_object_dbus_interface_get_property, free_desktop_object_dbus_interface_set_property}; - -void free_desktop_object_list_names (FreeDesktopObject* self, GAsyncReadyCallback _callback_, gpointer _user_data_) { - FREE_DESKTOP_OBJECT_GET_INTERFACE (self)->list_names (self, _callback_, _user_data_); -} - - -gchar** free_desktop_object_list_names_finish (FreeDesktopObject* self, GAsyncResult* _res_, int* result_length1, GError** error) { - return FREE_DESKTOP_OBJECT_GET_INTERFACE (self)->list_names_finish (self, _res_, result_length1, error); -} - - -static void g_cclosure_user_marshal_VOID__STRING_STRING_STRING (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data) { - typedef void (*GMarshalFunc_VOID__STRING_STRING_STRING) (gpointer data1, const char* arg_1, const char* arg_2, const char* arg_3, gpointer data2); - register GMarshalFunc_VOID__STRING_STRING_STRING callback; - register GCClosure * cc; - register gpointer data1, data2; - cc = (GCClosure *) closure; - g_return_if_fail (n_param_values == 4); - 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__STRING_STRING_STRING) (marshal_data ? marshal_data : cc->callback); - callback (data1, g_value_get_string (param_values + 1), g_value_get_string (param_values + 2), g_value_get_string (param_values + 3), data2); -} - - -static void free_desktop_object_base_init (FreeDesktopObjectIface * iface) { - static gboolean initialized = FALSE; - if (!initialized) { - initialized = TRUE; - g_signal_new ("name_owner_changed", TYPE_FREE_DESKTOP_OBJECT, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__STRING_STRING_STRING, G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); - g_type_set_qdata (TYPE_FREE_DESKTOP_OBJECT, g_quark_from_static_string ("vala-dbus-register-object"), (void*) free_desktop_object_register_object); - } -} - - -GType free_desktop_object_get_type (void) { - static volatile gsize free_desktop_object_type_id__volatile = 0; - if (g_once_init_enter (&free_desktop_object_type_id__volatile)) { - static const GTypeInfo g_define_type_info = { sizeof (FreeDesktopObjectIface), (GBaseInitFunc) free_desktop_object_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL }; - GType free_desktop_object_type_id; - free_desktop_object_type_id = g_type_register_static (G_TYPE_INTERFACE, "FreeDesktopObject", &g_define_type_info, 0); - g_type_interface_add_prerequisite (free_desktop_object_type_id, G_TYPE_OBJECT); - g_once_init_leave (&free_desktop_object_type_id__volatile, free_desktop_object_type_id); - } - return free_desktop_object_type_id__volatile; -} - - -G_DEFINE_TYPE_EXTENDED (FreeDesktopObjectProxy, free_desktop_object_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_FREE_DESKTOP_OBJECT, free_desktop_object_proxy_free_desktop_object_interface_init) ); -static void free_desktop_object_proxy_class_init (FreeDesktopObjectProxyClass* klass) { - G_DBUS_PROXY_CLASS (klass)->g_signal = free_desktop_object_proxy_g_signal; -} - - -static void _dbus_handle_free_desktop_object_name_owner_changed (FreeDesktopObject* self, GVariant* parameters) { - GVariantIter _arguments_iter; - gchar* name = NULL; - GVariant* _tmp69_; - gchar* old_owner = NULL; - GVariant* _tmp70_; - gchar* new_owner = NULL; - GVariant* _tmp71_; - g_variant_iter_init (&_arguments_iter, parameters); - _tmp69_ = g_variant_iter_next_value (&_arguments_iter); - name = g_variant_dup_string (_tmp69_, NULL); - g_variant_unref (_tmp69_); - _tmp70_ = g_variant_iter_next_value (&_arguments_iter); - old_owner = g_variant_dup_string (_tmp70_, NULL); - g_variant_unref (_tmp70_); - _tmp71_ = g_variant_iter_next_value (&_arguments_iter); - new_owner = g_variant_dup_string (_tmp71_, NULL); - g_variant_unref (_tmp71_); - g_signal_emit_by_name (self, "name-owner-changed", name, old_owner, new_owner); - _g_free0 (name); - _g_free0 (old_owner); - _g_free0 (new_owner); -} - - -static void free_desktop_object_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters) { - if (strcmp (signal_name, "NameOwnerChanged") == 0) { - _dbus_handle_free_desktop_object_name_owner_changed (proxy, parameters); - } -} - - -static void free_desktop_object_proxy_init (FreeDesktopObjectProxy* 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 free_desktop_object_proxy_list_names_async (FreeDesktopObject* 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.freedesktop.DBus", "ListNames"); - 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 (self, _callback_, _user_data_, NULL)); - g_object_unref (_message); -} - - -static gchar** free_desktop_object_proxy_list_names_finish (FreeDesktopObject* self, GAsyncResult* _res_, int* result_length1, GError** error) { - GDBusMessage *_reply_message; - GVariant *_reply; - GVariantIter _reply_iter; - gchar** _result; - int _result_length1; - GVariant* _tmp72_; - gchar** _tmp73_; - int _tmp73__length; - int _tmp73__size; - int _tmp73__length1; - GVariantIter _tmp74_; - GVariant* _tmp75_; - _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 (_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; - _tmp72_ = g_variant_iter_next_value (&_reply_iter); - _tmp73_ = g_new (gchar*, 5); - _tmp73__length = 0; - _tmp73__size = 4; - _tmp73__length1 = 0; - g_variant_iter_init (&_tmp74_, _tmp72_); - for (; _tmp75_ = g_variant_iter_next_value (&_tmp74_); _tmp73__length1++) { - if (_tmp73__size == _tmp73__length) { - _tmp73__size = 2 * _tmp73__size; - _tmp73_ = g_renew (gchar*, _tmp73_, _tmp73__size + 1); - } - _tmp73_[_tmp73__length++] = g_variant_dup_string (_tmp75_, NULL); - g_variant_unref (_tmp75_); - } - _result_length1 = _tmp73__length1; - _tmp73_[_tmp73__length] = NULL; - _result = _tmp73_; - g_variant_unref (_tmp72_); - *result_length1 = _result_length1; - g_object_unref (_reply_message); - return _result; -} - - -static void free_desktop_object_proxy_free_desktop_object_interface_init (FreeDesktopObjectIface* iface) { - iface->list_names = free_desktop_object_proxy_list_names_async; - iface->list_names_finish = free_desktop_object_proxy_list_names_finish; -} - - -static void _dbus_free_desktop_object_list_names (FreeDesktopObject* self, GVariant* parameters, GDBusMethodInvocation* invocation) { - GVariantIter _arguments_iter; - g_variant_iter_init (&_arguments_iter, parameters); - free_desktop_object_list_names (self, (GAsyncReadyCallback) _dbus_free_desktop_object_list_names_ready, g_object_ref (invocation)); -} - - -static void _dbus_free_desktop_object_list_names_ready (GObject * source_object, GAsyncResult * _res_, gpointer * _user_data_) { - GDBusMethodInvocation * invocation; - GError* error; - GVariantIter _arguments_iter; - GDBusMessage* _reply_message; - GVariant* _reply; - GVariantBuilder _reply_builder; - gchar** result; - int result_length1 = 0; - gchar** _tmp76_; - GVariantBuilder _tmp77_; - int _tmp78_; - invocation = _user_data_; - error = NULL; - result = free_desktop_object_list_names_finish ((FreeDesktopObject*) source_object, _res_, &result_length1, &error); - if (error) { - g_dbus_method_invocation_return_gerror (g_object_ref (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); - _tmp76_ = result; - g_variant_builder_init (&_tmp77_, G_VARIANT_TYPE ("as")); - for (_tmp78_ = 0; _tmp78_ < result_length1; _tmp78_++) { - g_variant_builder_add_value (&_tmp77_, g_variant_new_string (*_tmp76_)); - _tmp76_++; - } - g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp77_)); - result = (_vala_array_free (result, result_length1, (GDestroyNotify) g_free), 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 free_desktop_object_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, "ListNames") == 0) { - _dbus_free_desktop_object_list_names (object, parameters, invocation); - } - g_object_unref (invocation); -} - - -static GVariant* free_desktop_object_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]; - return NULL; -} - - -static gboolean free_desktop_object_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]; - return FALSE; -} - - -static void _dbus_free_desktop_object_name_owner_changed (GObject* _sender, const gchar* name, const gchar* old_owner, const gchar* new_owner, 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_string (name)); - g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (old_owner)); - g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (new_owner)); - _arguments = g_variant_builder_end (&_arguments_builder); - g_dbus_connection_emit_signal (_connection, NULL, _path, "org.freedesktop.DBus", "NameOwnerChanged", _arguments, NULL); -} - - -guint free_desktop_object_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, &_free_desktop_object_dbus_interface_info, &_free_desktop_object_dbus_interface_vtable, data, _free_desktop_object_unregister_object, error); - if (!result) { - return 0; - } - g_signal_connect (object, "name-owner-changed", (GCallback) _dbus_free_desktop_object_name_owner_changed, data); - return result; -} - - -static void _free_desktop_object_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); -} - Mpris2Watcher* mpris2_watcher_construct (GType object_type) { Mpris2Watcher * self = NULL; @@ -494,98 +204,6 @@ Mpris2Watcher* mpris2_watcher_new (void) { } -static void mpris2_watcher_name_changes_detected (Mpris2Watcher* self, FreeDesktopObject* dbus_obj, const gchar* name, const gchar* previous_owner, const gchar* current_owner) { - MprisRoot* _tmp0_ = NULL; - MprisRoot* mpris2_root; - gboolean _tmp1_ = FALSE; - g_return_if_fail (self != NULL); - g_return_if_fail (dbus_obj != NULL); - g_return_if_fail (name != NULL); - g_return_if_fail (previous_owner != NULL); - g_return_if_fail (current_owner != NULL); - _tmp0_ = mpris2_watcher_create_mpris_root (self, name); - mpris2_root = _tmp0_; - if (mpris2_root == NULL) { - _g_object_unref0 (mpris2_root); - return; - } - if (g_strcmp0 (previous_owner, "") != 0) { - _tmp1_ = g_strcmp0 (current_owner, "") == 0; - } else { - _tmp1_ = FALSE; - } - if (_tmp1_) { - g_debug ("mpris2-watcher.vala:70: Client '%s' gone down", name); - g_signal_emit_by_name (self, "client-disappeared", name); - } else { - gboolean _tmp2_ = FALSE; - if (g_strcmp0 (previous_owner, "") == 0) { - _tmp2_ = g_strcmp0 (current_owner, "") != 0; - } else { - _tmp2_ = FALSE; - } - if (_tmp2_) { - gchar* _tmp3_ = NULL; - gchar* _tmp4_; - g_debug ("mpris2-watcher.vala:74: Client '%s' has appeared", name); - _tmp3_ = mpris_root_get_DesktopEntry (mpris2_root); - _tmp4_ = _tmp3_; - g_signal_emit_by_name (self, "client-appeared", _tmp4_, name); - _g_free0 (_tmp4_); - } - } - _g_object_unref0 (mpris2_root); -} - - -static MprisRoot* mpris2_watcher_create_mpris_root (Mpris2Watcher* self, const gchar* name) { - MprisRoot* result = NULL; - MprisRoot* mpris2_root; - gboolean _tmp0_; - GError * _inner_error_ = NULL; - g_return_val_if_fail (self != NULL, NULL); - g_return_val_if_fail (name != NULL, NULL); - mpris2_root = NULL; - _tmp0_ = g_str_has_prefix (name, MPRIS2_WATCHER_MPRIS_PREFIX); - if (_tmp0_) { - MprisRoot* _tmp1_; - MprisRoot* _tmp2_; - _tmp1_ = (MprisRoot*) g_initable_new (TYPE_MPRIS_ROOT_PROXY, NULL, &_inner_error_, "g-flags", 0, "g-name", name, "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", MPRIS2_WATCHER_MPRIS_MEDIA_PLAYER_PATH, "g-interface-name", "org.mpris.MediaPlayer2", NULL); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == G_IO_ERROR) { - goto __catch7_g_io_error; - } - _g_object_unref0 (mpris2_root); - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return NULL; - } - _tmp2_ = _tmp1_; - _g_object_unref0 (mpris2_root); - mpris2_root = _tmp2_; - goto __finally7; - __catch7_g_io_error: - { - GError * e; - e = _inner_error_; - _inner_error_ = NULL; - g_warning ("mpris2-watcher.vala:88: Mpris2watcher could not create a root interfac" \ -"e: %s", e->message); - _g_error_free0 (e); - } - __finally7: - if (_inner_error_ != NULL) { - _g_object_unref0 (mpris2_root); - 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 NULL; - } - } - result = mpris2_root; - return result; -} - - static void mpris2_watcher_check_for_active_clients_data_free (gpointer _data) { Mpris2WatcherCheckForActiveClientsData* data; data = _data; @@ -647,7 +265,7 @@ static gboolean mpris2_watcher_check_for_active_clients_co (Mpris2WatcherCheckFo data->_tmp2_ = data->_tmp3_; if (data->_inner_error_ != NULL) { if (data->_inner_error_->domain == G_IO_ERROR) { - goto __catch8_g_io_error; + goto __catch7_g_io_error; } data->interfaces = (_vala_array_free (data->interfaces, data->interfaces_length1, (GDestroyNotify) g_free), 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); @@ -659,13 +277,13 @@ static gboolean mpris2_watcher_check_for_active_clients_co (Mpris2WatcherCheckFo data->interfaces_length1 = data->_tmp2__length1; data->_interfaces_size_ = data->interfaces_length1; data->interfaces = data->_tmp4_; - goto __finally8; - __catch8_g_io_error: + goto __finally7; + __catch7_g_io_error: { data->e = data->_inner_error_; data->_inner_error_ = NULL; - g_warning ("mpris2-watcher.vala:104: Mpris2watcher could fetch active interfaces a" \ -"t startup: %s", data->e->message); + g_warning ("mpris2-watcher.vala:60: Mpris2watcher could fetch active interfaces at" \ +" startup: %s", data->e->message); _g_error_free0 (data->e); data->interfaces = (_vala_array_free (data->interfaces, data->interfaces_length1, (GDestroyNotify) g_free), NULL); if (data->_state_ == 0) { @@ -676,7 +294,7 @@ static gboolean mpris2_watcher_check_for_active_clients_co (Mpris2WatcherCheckFo g_object_unref (data->_async_result); return FALSE; } - __finally8: + __finally7: if (data->_inner_error_ != NULL) { data->interfaces = (_vala_array_free (data->interfaces, data->interfaces_length1, (GDestroyNotify) g_free), 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); @@ -690,7 +308,7 @@ static gboolean mpris2_watcher_check_for_active_clients_co (Mpris2WatcherCheckFo data->_tmp5_ = g_strdup (data->address_collection[data->address_it]); data->address = data->_tmp5_; { - data->_tmp6_ = g_str_has_prefix (data->address, MPRIS2_WATCHER_MPRIS_PREFIX); + data->_tmp6_ = g_str_has_prefix (data->address, MPRIS_PREFIX); if (data->_tmp6_) { data->_tmp7_ = NULL; data->_tmp7_ = mpris2_watcher_create_mpris_root (data->self, data->address); @@ -707,11 +325,13 @@ static gboolean mpris2_watcher_check_for_active_clients_co (Mpris2WatcherCheckFo g_object_unref (data->_async_result); return FALSE; } - data->_tmp8_ = NULL; - data->_tmp8_ = mpris_root_get_DesktopEntry (data->mpris2_root); - data->_tmp9_ = data->_tmp8_; - g_signal_emit_by_name (data->self, "client-appeared", data->_tmp9_, data->address); - _g_free0 (data->_tmp9_); + data->_tmp8_ = mpris2_watcher_supports_playlists (data->self, data->address); + data->use_playlists = data->_tmp8_; + data->_tmp9_ = NULL; + data->_tmp9_ = mpris_root_get_DesktopEntry (data->mpris2_root); + data->_tmp10_ = data->_tmp9_; + g_signal_emit_by_name (data->self, "client-appeared", data->_tmp10_, data->address, data->use_playlists); + _g_free0 (data->_tmp10_); _g_object_unref0 (data->mpris2_root); } _g_free0 (data->address); @@ -729,13 +349,246 @@ static gboolean mpris2_watcher_check_for_active_clients_co (Mpris2WatcherCheckFo } -static void g_cclosure_user_marshal_VOID__STRING_STRING (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data) { - typedef void (*GMarshalFunc_VOID__STRING_STRING) (gpointer data1, const char* arg_1, const char* arg_2, gpointer data2); - register GMarshalFunc_VOID__STRING_STRING callback; +static void mpris2_watcher_name_changes_detected (Mpris2Watcher* self, FreeDesktopObject* dbus_obj, const gchar* name, const gchar* previous_owner, const gchar* current_owner) { + MprisRoot* _tmp0_ = NULL; + MprisRoot* mpris2_root; + gboolean _tmp1_ = FALSE; + g_return_if_fail (self != NULL); + g_return_if_fail (dbus_obj != NULL); + g_return_if_fail (name != NULL); + g_return_if_fail (previous_owner != NULL); + g_return_if_fail (current_owner != NULL); + _tmp0_ = mpris2_watcher_create_mpris_root (self, name); + mpris2_root = _tmp0_; + if (mpris2_root == NULL) { + _g_object_unref0 (mpris2_root); + return; + } + if (g_strcmp0 (previous_owner, "") != 0) { + _tmp1_ = g_strcmp0 (current_owner, "") == 0; + } else { + _tmp1_ = FALSE; + } + if (_tmp1_) { + g_debug ("mpris2-watcher.vala:84: Client '%s' gone down", name); + g_signal_emit_by_name (self, "client-disappeared", name); + } else { + gboolean _tmp2_ = FALSE; + if (g_strcmp0 (previous_owner, "") == 0) { + _tmp2_ = g_strcmp0 (current_owner, "") != 0; + } else { + _tmp2_ = FALSE; + } + if (_tmp2_) { + gboolean _tmp3_; + gboolean use_playlists; + gchar* _tmp4_ = NULL; + gchar* _tmp5_; + g_debug ("mpris2-watcher.vala:88: Client '%s' has appeared", name); + _tmp3_ = mpris2_watcher_supports_playlists (self, name); + use_playlists = _tmp3_; + _tmp4_ = mpris_root_get_DesktopEntry (mpris2_root); + _tmp5_ = _tmp4_; + g_signal_emit_by_name (self, "client-appeared", _tmp5_, name, use_playlists); + _g_free0 (_tmp5_); + } + } + _g_object_unref0 (mpris2_root); +} + + +static MprisRoot* mpris2_watcher_create_mpris_root (Mpris2Watcher* self, const gchar* name) { + MprisRoot* result = NULL; + MprisRoot* mpris2_root; + gboolean _tmp0_; + GError * _inner_error_ = NULL; + g_return_val_if_fail (self != NULL, NULL); + g_return_val_if_fail (name != NULL, NULL); + mpris2_root = NULL; + _tmp0_ = g_str_has_prefix (name, MPRIS_PREFIX); + if (_tmp0_) { + MprisRoot* _tmp1_ = NULL; + MprisRoot* _tmp2_; + MprisRoot* _tmp3_; + _tmp1_ = g_initable_new (TYPE_MPRIS_ROOT_PROXY, NULL, &_inner_error_, "g-flags", 0, "g-name", name, "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", MPRIS_MEDIA_PLAYER_PATH, "g-interface-name", "org.mpris.MediaPlayer2", NULL); + _tmp2_ = (MprisRoot*) _tmp1_; + if (_inner_error_ != NULL) { + if (_inner_error_->domain == G_IO_ERROR) { + goto __catch8_g_io_error; + } + _g_object_unref0 (mpris2_root); + g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); + g_clear_error (&_inner_error_); + return NULL; + } + _tmp3_ = _tmp2_; + _g_object_unref0 (mpris2_root); + mpris2_root = _tmp3_; + goto __finally8; + __catch8_g_io_error: + { + GError * e; + e = _inner_error_; + _inner_error_ = NULL; + g_warning ("mpris2-watcher.vala:103: Mpris2watcher could not create a root interfa" \ +"ce: %s", e->message); + _g_error_free0 (e); + } + __finally8: + if (_inner_error_ != NULL) { + _g_object_unref0 (mpris2_root); + 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 NULL; + } + } + result = mpris2_root; + return result; +} + + +static gboolean mpris2_watcher_supports_playlists (Mpris2Watcher* self, const gchar* name) { + gboolean result = FALSE; + FreeDesktopIntrospectable* introspectable; + FreeDesktopIntrospectable* _tmp0_ = NULL; + FreeDesktopIntrospectable* _tmp1_; + FreeDesktopIntrospectable* _tmp2_; + gchar* _tmp3_ = NULL; + gchar* results; + gboolean _tmp4_; + GError * _inner_error_ = NULL; + g_return_val_if_fail (self != NULL, FALSE); + g_return_val_if_fail (name != NULL, FALSE); + introspectable = NULL; + _tmp0_ = g_initable_new (TYPE_FREE_DESKTOP_INTROSPECTABLE_PROXY, NULL, &_inner_error_, "g-flags", G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, "g-name", name, "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", MPRIS_MEDIA_PLAYER_PATH, "g-interface-name", "org.freedesktop.DBus.Introspectable", NULL); + _tmp1_ = (FreeDesktopIntrospectable*) _tmp0_; + if (_inner_error_ != NULL) { + if (_inner_error_->domain == G_IO_ERROR) { + goto __catch9_g_io_error; + } + _g_object_unref0 (introspectable); + g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); + g_clear_error (&_inner_error_); + return FALSE; + } + _tmp2_ = _tmp1_; + _g_object_unref0 (introspectable); + introspectable = _tmp2_; + _tmp3_ = free_desktop_introspectable_Introspect (introspectable, &_inner_error_); + results = _tmp3_; + if (_inner_error_ != NULL) { + if (_inner_error_->domain == G_IO_ERROR) { + goto __catch9_g_io_error; + } + _g_object_unref0 (introspectable); + g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); + g_clear_error (&_inner_error_); + return FALSE; + } + _tmp4_ = mpris2_watcher_parse_interfaces (self, results); + result = _tmp4_; + _g_free0 (results); + _g_object_unref0 (introspectable); + return result; + _g_free0 (results); + goto __finally9; + __catch9_g_io_error: + { + GError * e; + e = _inner_error_; + _inner_error_ = NULL; + g_warning ("mpris2-watcher.vala:131: Could not create an introspectable object: %s", e->message); + _g_error_free0 (e); + } + __finally9: + if (_inner_error_ != NULL) { + _g_object_unref0 (introspectable); + 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 FALSE; + } + result = FALSE; + _g_object_unref0 (introspectable); + return result; +} + + +static gboolean mpris2_watcher_parse_interfaces (Mpris2Watcher* self, const gchar* interface_info) { + gboolean result = FALSE; + gboolean _result_; + xmlDoc* _tmp0_ = NULL; + xmlDoc* xml_doc; + xmlNode* _tmp1_ = NULL; + xmlNode* root_node; + g_return_val_if_fail (self != NULL, FALSE); + g_return_val_if_fail (interface_info != NULL, FALSE); + _result_ = FALSE; + _tmp0_ = xmlParseDoc (interface_info); + xml_doc = _tmp0_; + if (xml_doc == NULL) { + g_warning ("mpris2-watcher.vala:143: Mpris2Watcher - parse-interfaces - failed to " \ +"instantiate xml doc"); + result = FALSE; + return result; + } + _tmp1_ = xmlDocGetRootElement (xml_doc); + root_node = _tmp1_; + if (root_node == NULL) { + xmlFreeDoc (xml_doc); + g_warning ("mpris2-watcher.vala:151: Mpris2Watcher - the interface info xml is emp" \ +"ty"); + result = FALSE; + return result; + } + { + xmlNode* iter; + iter = root_node->children; + { + gboolean _tmp2_; + _tmp2_ = TRUE; + while (TRUE) { + xmlAttr* attributes; + gchar* _tmp3_; + gchar* interface_name; + gchar* _tmp4_ = NULL; + gchar* _tmp5_; + gboolean _tmp6_; + if (!_tmp2_) { + iter = iter->next; + } + _tmp2_ = FALSE; + if (!(iter != NULL)) { + break; + } + if (iter->type != XML_ELEMENT_NODE) { + continue; + } + attributes = iter->properties; + _tmp3_ = g_strdup (attributes->children->content); + interface_name = _tmp3_; + g_debug ("mpris2-watcher.vala:163: this dbus object has interface %s ", interface_name); + _tmp4_ = g_strconcat (MPRIS_PREFIX, "Playlists", NULL); + _tmp5_ = _tmp4_; + if ((_tmp6_ = g_strcmp0 (interface_name, _tmp5_) == 0, _g_free0 (_tmp5_), _tmp6_)) { + _result_ = TRUE; + } + _g_free0 (interface_name); + } + } + } + xmlFreeDoc (xml_doc); + result = _result_; + return result; +} + + +static void g_cclosure_user_marshal_VOID__STRING_STRING_BOOLEAN (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data) { + typedef void (*GMarshalFunc_VOID__STRING_STRING_BOOLEAN) (gpointer data1, const char* arg_1, const char* arg_2, gboolean arg_3, gpointer data2); + register GMarshalFunc_VOID__STRING_STRING_BOOLEAN callback; register GCClosure * cc; register gpointer data1, data2; cc = (GCClosure *) closure; - g_return_if_fail (n_param_values == 3); + g_return_if_fail (n_param_values == 4); if (G_CCLOSURE_SWAP_DATA (closure)) { data1 = closure->data; data2 = param_values->data[0].v_pointer; @@ -743,8 +596,8 @@ static void g_cclosure_user_marshal_VOID__STRING_STRING (GClosure * closure, GVa data1 = param_values->data[0].v_pointer; data2 = closure->data; } - callback = (GMarshalFunc_VOID__STRING_STRING) (marshal_data ? marshal_data : cc->callback); - callback (data1, g_value_get_string (param_values + 1), g_value_get_string (param_values + 2), data2); + callback = (GMarshalFunc_VOID__STRING_STRING_BOOLEAN) (marshal_data ? marshal_data : cc->callback); + callback (data1, g_value_get_string (param_values + 1), g_value_get_string (param_values + 2), g_value_get_boolean (param_values + 3), data2); } @@ -757,36 +610,38 @@ static GObject * mpris2_watcher_constructor (GType type, guint n_construct_prope GObject * obj; GObjectClass * parent_class; Mpris2Watcher * self; - FreeDesktopObject* _tmp0_; + FreeDesktopObject* _tmp0_ = NULL; FreeDesktopObject* _tmp1_; + FreeDesktopObject* _tmp2_; GError * _inner_error_ = NULL; parent_class = G_OBJECT_CLASS (mpris2_watcher_parent_class); obj = parent_class->constructor (type, n_construct_properties, construct_properties); self = MPRIS2_WATCHER (obj); - _tmp0_ = (FreeDesktopObject*) g_initable_new (TYPE_FREE_DESKTOP_OBJECT_PROXY, NULL, &_inner_error_, "g-flags", G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, "g-name", MPRIS2_WATCHER_FREEDESKTOP_SERVICE, "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", MPRIS2_WATCHER_FREEDESKTOP_OBJECT, "g-interface-name", "org.freedesktop.DBus", NULL); + _tmp0_ = g_initable_new (TYPE_FREE_DESKTOP_OBJECT_PROXY, NULL, &_inner_error_, "g-flags", G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, "g-name", FREEDESKTOP_SERVICE, "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", FREEDESKTOP_OBJECT, "g-interface-name", "org.freedesktop.DBus", NULL); + _tmp1_ = (FreeDesktopObject*) _tmp0_; if (_inner_error_ != NULL) { if (_inner_error_->domain == G_IO_ERROR) { - goto __catch9_g_io_error; + goto __catch10_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_); } - _tmp1_ = _tmp0_; + _tmp2_ = _tmp1_; _g_object_unref0 (self->priv->fdesktop_obj); - self->priv->fdesktop_obj = _tmp1_; + self->priv->fdesktop_obj = _tmp2_; g_signal_connect_object (self->priv->fdesktop_obj, "name-owner-changed", (GCallback) _mpris2_watcher_name_changes_detected_free_desktop_object_name_owner_changed, self, 0); mpris2_watcher_check_for_active_clients (self, NULL, NULL); - goto __finally9; - __catch9_g_io_error: + goto __finally10; + __catch10_g_io_error: { GError * e; e = _inner_error_; _inner_error_ = NULL; - g_warning ("mpris2-watcher.vala:55: Mpris2watcher could not set up a watch for mpr" \ + g_warning ("mpris2-watcher.vala:46: Mpris2watcher could not set up a watch for mpr" \ "is clients appearing on the bus: %s", e->message); _g_error_free0 (e); } - __finally9: + __finally10: if (_inner_error_ != NULL) { g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); g_clear_error (&_inner_error_); @@ -800,7 +655,7 @@ static void mpris2_watcher_class_init (Mpris2WatcherClass * klass) { g_type_class_add_private (klass, sizeof (Mpris2WatcherPrivate)); G_OBJECT_CLASS (klass)->constructor = mpris2_watcher_constructor; G_OBJECT_CLASS (klass)->finalize = mpris2_watcher_finalize; - g_signal_new ("client_appeared", TYPE_MPRIS2_WATCHER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__STRING_STRING, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING); + g_signal_new ("client_appeared", TYPE_MPRIS2_WATCHER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__STRING_STRING_BOOLEAN, G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN); g_signal_new ("client_disappeared", TYPE_MPRIS2_WATCHER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING); } diff --git a/src/mpris2-watcher.vala b/src/mpris2-watcher.vala index 9ef9b2f..c20b04b 100644 --- a/src/mpris2-watcher.vala +++ b/src/mpris2-watcher.vala @@ -19,33 +19,9 @@ with this program. If not, see <http://www.gnu.org/licenses/>. using Xml; -[DBus (name = "org.freedesktop.DBus")] -public interface FreeDesktopObject: Object { - public abstract async string[] list_names() throws IOError; - public abstract signal void name_owner_changed ( string name, - string old_owner, - string new_owner ); -} - -[DBus (name = "org.freedesktop.DBus.Introspectable")] -public interface FreeDesktopIntrospectable: Object { - public abstract string Introspect() throws IOError; -} - -public errordomain XmlError { - FILE_NOT_FOUND, - XML_DOCUMENT_EMPTY -} - public class Mpris2Watcher : GLib.Object { - private const string FREEDESKTOP_SERVICE = "org.freedesktop.DBus"; - private const string FREEDESKTOP_OBJECT = "/org/freedesktop/DBus"; - public const string MPRIS_PREFIX = "org.mpris.MediaPlayer2."; - private const string MPRIS_MEDIA_PLAYER_PATH = "/org/mpris/MediaPlayer2"; - FreeDesktopObject fdesktop_obj; - FreeDesktopIntrospectable introspectable; public signal void client_appeared ( string desktop_file_name, string dbus_name, @@ -133,6 +109,8 @@ public class Mpris2Watcher : GLib.Object private bool supports_playlists ( string name ) { + FreeDesktopIntrospectable introspectable; + try { /* The dbusproxy flag parameter is needed to ensure Banshee does not blow up. I suspect the issue is that if you @@ -142,11 +120,10 @@ public class Mpris2Watcher : GLib.Object causes a crash because it doesn't check for the presence of properties before attempting to access them. */ - this.introspectable = Bus.get_proxy_sync ( BusType.SESSION, - name, - MPRIS_MEDIA_PLAYER_PATH, - GLib.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES); - + introspectable = Bus.get_proxy_sync ( BusType.SESSION, + name, + MPRIS_MEDIA_PLAYER_PATH, + GLib.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES); var results = introspectable.Introspect(); return this.parse_interfaces (results); } diff --git a/src/music-player-bridge.c b/src/music-player-bridge.c index 2b8fc17..04c2a3e 100644 --- a/src/music-player-bridge.c +++ b/src/music-player-bridge.c @@ -1,4 +1,4 @@ -/* music-player-bridge.c generated by valac 0.11.2, the Vala compiler +/* music-player-bridge.c generated by valac 0.11.3, the Vala compiler * generated from music-player-bridge.vala, do not modify */ /* @@ -77,6 +77,27 @@ typedef struct _Mpris2WatcherClass Mpris2WatcherClass; #define _g_free0(var) (var = (g_free (var), NULL)) #define PLAYER_CONTROLLER_TYPE_STATE (player_controller_state_get_type ()) +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 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; #define _g_key_file_free0(var) ((var == NULL) ? NULL : (var = (g_key_file_free (var), NULL))) #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) @@ -104,6 +125,19 @@ typedef enum { PLAYER_CONTROLLER_STATE_DISCONNECTED } PlayerControllerstate; +struct _PlayerController { + GObject parent_instance; + PlayerControllerPrivate * priv; + gint current_state; + GeeArrayList* custom_items; + Mpris2Controller* mpris_bridge; + gboolean* use_playlists; +}; + +struct _PlayerControllerClass { + GObjectClass parent_class; +}; + static gpointer music_player_bridge_parent_class = NULL; @@ -125,13 +159,16 @@ static gchar* music_player_bridge_determine_key (gchar* desktop_or_interface); static gchar* music_player_bridge_fetch_icon_name (const gchar* desktop); static gint music_player_bridge_calculate_menu_position (MusicPlayerBridge* self); GType player_controller_state_get_type (void) G_GNUC_CONST; -PlayerController* player_controller_new (DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, PlayerControllerstate initial_state); -PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, PlayerControllerstate initial_state); +PlayerController* player_controller_new (DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, gboolean* use_playlists, PlayerControllerstate initial_state); +PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, gboolean* use_playlists, PlayerControllerstate initial_state); #define PLAYER_CONTROLLER_WIDGET_QUANTITY 5 -void music_player_bridge_client_has_become_available (MusicPlayerBridge* self, const gchar* desktop, const gchar* dbus_name); +void music_player_bridge_client_has_become_available (MusicPlayerBridge* self, const gchar* desktop, const gchar* dbus_name, gboolean use_playlists); gchar** settings_manager_fetch_blacklist (SettingsManager* self, int* result_length1); static gboolean _vala_string_array_contains (gchar** stack, int stack_length, gchar* needle); void settings_manager_add_interested (SettingsManager* self, const gchar* app_desktop_name); +GType player_item_get_type (void) G_GNUC_CONST; +GType mpris2_controller_get_type (void) G_GNUC_CONST; +static gboolean* _bool_dup (gboolean* self); void player_controller_update_state (PlayerController* self, PlayerControllerstate new_state); void player_controller_activate (PlayerController* self, const gchar* dbus_name); void music_player_bridge_client_has_vanished (MusicPlayerBridge* self, const gchar* mpris_root_interface); @@ -139,7 +176,7 @@ void player_controller_hibernate (PlayerController* self); void music_player_bridge_set_root_menu_item (MusicPlayerBridge* self, DbusmenuMenuitem* menu); Mpris2Watcher* mpris2_watcher_new (void); Mpris2Watcher* mpris2_watcher_construct (GType object_type); -static void _music_player_bridge_client_has_become_available_mpris2_watcher_client_appeared (Mpris2Watcher* _sender, const gchar* desktop_file_name, const gchar* dbus_name, gpointer self); +static void _music_player_bridge_client_has_become_available_mpris2_watcher_client_appeared (Mpris2Watcher* _sender, const gchar* desktop_file_name, const gchar* dbus_name, gboolean use_playlists, gpointer self); static void _music_player_bridge_client_has_vanished_mpris2_watcher_client_disappeared (Mpris2Watcher* _sender, const gchar* dbus_name, gpointer self); static GObject * music_player_bridge_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); SettingsManager* settings_manager_new (void); @@ -223,7 +260,7 @@ static void music_player_bridge_try_to_add_inactive_familiar_clients (MusicPlaye _tmp9_ = music_player_bridge_fetch_icon_name (desktop); _tmp10_ = _tmp9_; _tmp11_ = music_player_bridge_calculate_menu_position (self); - _tmp12_ = player_controller_new (self->priv->root_menu, app_info, NULL, _tmp10_, _tmp11_, PLAYER_CONTROLLER_STATE_OFFLINE); + _tmp12_ = player_controller_new (self->priv->root_menu, app_info, NULL, _tmp10_, _tmp11_, NULL, PLAYER_CONTROLLER_STATE_OFFLINE); ctrl = (_tmp13_ = _tmp12_, _g_free0 (_tmp10_), _tmp13_); gee_abstract_map_set ((GeeAbstractMap*) self->priv->registered_clients, mpris_key, ctrl); _g_object_unref0 (ctrl); @@ -264,7 +301,20 @@ static gboolean _vala_string_array_contains (gchar** stack, int stack_length, gc } -void music_player_bridge_client_has_become_available (MusicPlayerBridge* self, const gchar* desktop, const gchar* dbus_name) { +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; +} + + +void music_player_bridge_client_has_become_available (MusicPlayerBridge* self, const gchar* desktop, const gchar* dbus_name, gboolean use_playlists) { gboolean _tmp0_ = FALSE; gint _tmp1_; gchar** _tmp2_ = NULL; @@ -289,7 +339,7 @@ void music_player_bridge_client_has_become_available (MusicPlayerBridge* self, c _tmp0_ = g_strcmp0 (desktop, "") == 0; } if (_tmp0_) { - g_warning ("music-player-bridge.vala:80: Client %s attempting to register without " \ + g_warning ("music-player-bridge.vala:83: Client %s attempting to register without " \ "desktop entry being set on the mpris root", dbus_name); return; } @@ -297,16 +347,17 @@ void music_player_bridge_client_has_become_available (MusicPlayerBridge* self, c _tmp3_ = _tmp2_; _tmp3__length1 = _tmp1_; if ((_tmp4_ = _vala_string_array_contains (_tmp3_, _tmp1_, desktop), _tmp3_ = (_vala_array_free (_tmp3_, _tmp3__length1, (GDestroyNotify) g_free), NULL), _tmp4_)) { - g_debug ("music-player-bridge.vala:85: Client %s attempting to register but it h" \ -"as been blacklisted", desktop); + g_debug ("music-player-bridge.vala:88: Client %s attempting to register but I'm " \ +"afraid it is blacklisted", desktop); + return; } - g_debug ("music-player-bridge.vala:89: client_has_become_available %s", desktop); + g_debug ("music-player-bridge.vala:93: client_has_become_available %s", desktop); _tmp5_ = g_strconcat (desktop, ".desktop", NULL); _tmp6_ = _tmp5_; _tmp7_ = music_player_bridge_create_app_info (_tmp6_); app_info = (_tmp8_ = _tmp7_, _g_free0 (_tmp6_), _tmp8_); if (app_info == NULL) { - g_warning ("music-player-bridge.vala:92: Could not create app_info for path %s \n" \ + g_warning ("music-player-bridge.vala:96: Could not create app_info for path %s \n" \ " Getting out of here ", desktop); _g_object_unref0 (app_info); return; @@ -322,33 +373,44 @@ void music_player_bridge_client_has_become_available (MusicPlayerBridge* self, c PlayerController* _tmp15_ = NULL; PlayerController* _tmp16_; PlayerController* ctrl; - g_debug ("music-player-bridge.vala:100: New client has registered that we have n" \ + g_debug ("music-player-bridge.vala:104: New client has registered that we have n" \ "ot seen before: %s", dbus_name); _tmp12_ = music_player_bridge_fetch_icon_name (desktop); _tmp13_ = _tmp12_; _tmp14_ = music_player_bridge_calculate_menu_position (self); - _tmp15_ = player_controller_new (self->priv->root_menu, app_info, dbus_name, _tmp13_, _tmp14_, PLAYER_CONTROLLER_STATE_READY); + _tmp15_ = player_controller_new (self->priv->root_menu, app_info, dbus_name, _tmp13_, _tmp14_, &use_playlists, PLAYER_CONTROLLER_STATE_READY); ctrl = (_tmp16_ = _tmp15_, _g_free0 (_tmp13_), _tmp16_); gee_abstract_map_set ((GeeAbstractMap*) self->priv->registered_clients, mpris_key, ctrl); - g_debug ("music-player-bridge.vala:108: Have not seen this %s before, new contro" \ + g_debug ("music-player-bridge.vala:113: Have not seen this %s before, new contro" \ "ller created.", desktop); settings_manager_add_interested (self->priv->settings_manager, desktop); - g_debug ("music-player-bridge.vala:110: application added to the interested list"); + g_debug ("music-player-bridge.vala:115: application added to the interested list"); _g_object_unref0 (ctrl); } else { gpointer _tmp17_ = NULL; PlayerController* _tmp18_; - gpointer _tmp19_ = NULL; - PlayerController* _tmp20_; + gboolean* _tmp19_; + gboolean* _tmp20_; + gpointer _tmp21_ = NULL; + PlayerController* _tmp22_; + gpointer _tmp23_ = NULL; + PlayerController* _tmp24_; _tmp17_ = gee_abstract_map_get ((GeeAbstractMap*) self->priv->registered_clients, mpris_key); _tmp18_ = (PlayerController*) _tmp17_; - player_controller_update_state (_tmp18_, PLAYER_CONTROLLER_STATE_READY); + _tmp19_ = __bool_dup0 (&use_playlists); + _tmp20_ = _tmp19_; + _g_free0 (_tmp18_->use_playlists); + _tmp18_->use_playlists = _tmp20_; _g_object_unref0 (_tmp18_); - _tmp19_ = gee_abstract_map_get ((GeeAbstractMap*) self->priv->registered_clients, mpris_key); - _tmp20_ = (PlayerController*) _tmp19_; - player_controller_activate (_tmp20_, dbus_name); - _g_object_unref0 (_tmp20_); - g_debug ("music-player-bridge.vala:115: Application has already registered - awa" \ + _tmp21_ = gee_abstract_map_get ((GeeAbstractMap*) self->priv->registered_clients, mpris_key); + _tmp22_ = (PlayerController*) _tmp21_; + player_controller_update_state (_tmp22_, PLAYER_CONTROLLER_STATE_READY); + _g_object_unref0 (_tmp22_); + _tmp23_ = gee_abstract_map_get ((GeeAbstractMap*) self->priv->registered_clients, mpris_key); + _tmp24_ = (PlayerController*) _tmp23_; + player_controller_activate (_tmp24_, dbus_name); + _g_object_unref0 (_tmp24_); + g_debug ("music-player-bridge.vala:121: Application has already registered - awa" \ "ken the hibernation: %s \n", dbus_name); } _g_free0 (mpris_key); @@ -359,14 +421,14 @@ void music_player_bridge_client_has_become_available (MusicPlayerBridge* self, c void music_player_bridge_client_has_vanished (MusicPlayerBridge* self, const gchar* mpris_root_interface) { g_return_if_fail (self != NULL); g_return_if_fail (mpris_root_interface != NULL); - g_debug ("music-player-bridge.vala:121: MusicPlayerBridge -> on_server_removed w" \ -"ith value %s", mpris_root_interface); + g_debug ("music-player-bridge.vala:127: MusicPlayerBridge -> client with dbus in" \ +"terface %s has vanished", mpris_root_interface); if (self->priv->root_menu != NULL) { gchar* _tmp0_; gchar* _tmp1_ = NULL; gchar* mpris_key; gboolean _tmp2_ = FALSE; - g_debug ("music-player-bridge.vala:123: attempt to remove %s", mpris_root_interface); + g_debug ("music-player-bridge.vala:130: attempt to remove %s", mpris_root_interface); _tmp0_ = g_strdup (mpris_root_interface); _tmp1_ = music_player_bridge_determine_key (_tmp0_); mpris_key = _tmp1_; @@ -384,7 +446,7 @@ void music_player_bridge_client_has_vanished (MusicPlayerBridge* self, const gch _tmp5_ = (PlayerController*) _tmp4_; player_controller_hibernate (_tmp5_); _g_object_unref0 (_tmp5_); - g_debug ("music-player-bridge.vala:127: Successively offlined client %s", mpris_key); + g_debug ("music-player-bridge.vala:134: Successively offlined client %s", mpris_key); } _g_free0 (mpris_key); } @@ -396,8 +458,8 @@ static gpointer _g_object_ref0 (gpointer self) { } -static void _music_player_bridge_client_has_become_available_mpris2_watcher_client_appeared (Mpris2Watcher* _sender, const gchar* desktop_file_name, const gchar* dbus_name, gpointer self) { - music_player_bridge_client_has_become_available (self, desktop_file_name, dbus_name); +static void _music_player_bridge_client_has_become_available_mpris2_watcher_client_appeared (Mpris2Watcher* _sender, const gchar* desktop_file_name, const gchar* dbus_name, gboolean use_playlists, gpointer self) { + music_player_bridge_client_has_become_available (self, desktop_file_name, dbus_name, use_playlists); } @@ -444,7 +506,7 @@ static GAppInfo* music_player_bridge_create_app_info (const gchar* desktop) { _tmp1_ = info == NULL; } if (_tmp1_) { - g_warning ("music-player-bridge.vala:146: Could not create a desktopappinfo instan" \ + g_warning ("music-player-bridge.vala:153: Could not create a desktopappinfo instan" \ "ce from app: %s", desktop); result = NULL; _g_object_unref0 (info); @@ -499,7 +561,7 @@ static gchar* music_player_bridge_fetch_icon_name (const gchar* desktop) { GError * _error_; _error_ = _inner_error_; _inner_error_ = NULL; - g_warning ("music-player-bridge.vala:162: Error loading keyfile - FileError"); + g_warning ("music-player-bridge.vala:169: Error loading keyfile - FileError"); result = NULL; _g_error_free0 (_error_); _g_key_file_free0 (desktop_keyfile); @@ -512,7 +574,7 @@ static gchar* music_player_bridge_fetch_icon_name (const gchar* desktop) { GError * _error_; _error_ = _inner_error_; _inner_error_ = NULL; - g_warning ("music-player-bridge.vala:166: Error loading keyfile - KeyFileError"); + g_warning ("music-player-bridge.vala:173: Error loading keyfile - KeyFileError"); result = NULL; _g_error_free0 (_error_); _g_key_file_free0 (desktop_keyfile); @@ -549,7 +611,7 @@ static gchar* music_player_bridge_fetch_icon_name (const gchar* desktop) { GError * _error_; _error_ = _inner_error_; _inner_error_ = NULL; - g_warning ("music-player-bridge.vala:175: Error trying to fetch the icon name from" \ + g_warning ("music-player-bridge.vala:182: Error trying to fetch the icon name from" \ " the keyfile"); result = NULL; _g_error_free0 (_error_); @@ -611,7 +673,7 @@ static gchar* music_player_bridge_determine_key (gchar* desktop_or_interface) { _g_free0 (_result_); _result_ = _tmp10_; } - g_debug ("music-player-bridge.vala:198: determine key result = %s", _result_); + g_debug ("music-player-bridge.vala:205: determine key result = %s", _result_); result = _result_; temp = (_vala_array_free (temp, temp_length1, (GDestroyNotify) g_free), NULL); tokens = (_vala_array_free (tokens, tokens_length1, (GDestroyNotify) g_free), NULL); diff --git a/src/music-player-bridge.h b/src/music-player-bridge.h index 24eedb8..f16836a 100644 --- a/src/music-player-bridge.h +++ b/src/music-player-bridge.h @@ -1,4 +1,4 @@ -/* music-player-bridge.h generated by valac 0.11.2, the Vala compiler, do not modify */ +/* music-player-bridge.h generated by valac 0.11.3, the Vala compiler, do not modify */ #ifndef __MUSIC_PLAYER_BRIDGE_H__ @@ -138,16 +138,6 @@ typedef struct _MprisPlaylistsIface MprisPlaylistsIface; #define TYPE_MPRIS_PLAYLISTS_PROXY (mpris_playlists_proxy_get_type ()) -#define TYPE_FREE_DESKTOP_OBJECT (free_desktop_object_get_type ()) -#define FREE_DESKTOP_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FREE_DESKTOP_OBJECT, FreeDesktopObject)) -#define IS_FREE_DESKTOP_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FREE_DESKTOP_OBJECT)) -#define FREE_DESKTOP_OBJECT_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_FREE_DESKTOP_OBJECT, FreeDesktopObjectIface)) - -typedef struct _FreeDesktopObject FreeDesktopObject; -typedef struct _FreeDesktopObjectIface FreeDesktopObjectIface; - -#define TYPE_FREE_DESKTOP_OBJECT_PROXY (free_desktop_object_proxy_get_type ()) - #define TYPE_MPRIS2_WATCHER (mpris2_watcher_get_type ()) #define MPRIS2_WATCHER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS2_WATCHER, Mpris2Watcher)) #define MPRIS2_WATCHER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS2_WATCHER, Mpris2WatcherClass)) @@ -158,6 +148,7 @@ typedef struct _FreeDesktopObjectIface FreeDesktopObjectIface; typedef struct _Mpris2Watcher Mpris2Watcher; typedef struct _Mpris2WatcherClass Mpris2WatcherClass; typedef struct _Mpris2WatcherPrivate Mpris2WatcherPrivate; +typedef struct _Mpris2ControllerPrivate Mpris2ControllerPrivate; #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)) @@ -168,7 +159,6 @@ typedef struct _FreeDesktopProperties FreeDesktopProperties; typedef struct _FreeDesktopPropertiesIface FreeDesktopPropertiesIface; #define TYPE_FREE_DESKTOP_PROPERTIES_PROXY (free_desktop_properties_proxy_get_type ()) -typedef struct _Mpris2ControllerPrivate Mpris2ControllerPrivate; #define TYPE_SETTINGS_MANAGER (settings_manager_get_type ()) #define SETTINGS_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SETTINGS_MANAGER, SettingsManager)) @@ -192,6 +182,26 @@ typedef struct _PlaylistsMenuitem PlaylistsMenuitem; typedef struct _PlaylistsMenuitemClass PlaylistsMenuitemClass; typedef struct _PlaylistsMenuitemPrivate PlaylistsMenuitemPrivate; +#define TYPE_FREE_DESKTOP_OBJECT (free_desktop_object_get_type ()) +#define FREE_DESKTOP_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FREE_DESKTOP_OBJECT, FreeDesktopObject)) +#define IS_FREE_DESKTOP_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FREE_DESKTOP_OBJECT)) +#define FREE_DESKTOP_OBJECT_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_FREE_DESKTOP_OBJECT, FreeDesktopObjectIface)) + +typedef struct _FreeDesktopObject FreeDesktopObject; +typedef struct _FreeDesktopObjectIface FreeDesktopObjectIface; + +#define TYPE_FREE_DESKTOP_OBJECT_PROXY (free_desktop_object_proxy_get_type ()) + +#define TYPE_FREE_DESKTOP_INTROSPECTABLE (free_desktop_introspectable_get_type ()) +#define FREE_DESKTOP_INTROSPECTABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FREE_DESKTOP_INTROSPECTABLE, FreeDesktopIntrospectable)) +#define IS_FREE_DESKTOP_INTROSPECTABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FREE_DESKTOP_INTROSPECTABLE)) +#define FREE_DESKTOP_INTROSPECTABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_FREE_DESKTOP_INTROSPECTABLE, FreeDesktopIntrospectableIface)) + +typedef struct _FreeDesktopIntrospectable FreeDesktopIntrospectable; +typedef struct _FreeDesktopIntrospectableIface FreeDesktopIntrospectableIface; + +#define TYPE_FREE_DESKTOP_INTROSPECTABLE_PROXY (free_desktop_introspectable_proxy_get_type ()) + #define TYPE_FETCH_FILE (fetch_file_get_type ()) #define FETCH_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FETCH_FILE, FetchFile)) #define FETCH_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FETCH_FILE, FetchFileClass)) @@ -265,6 +275,7 @@ struct _PlayerController { gint current_state; GeeArrayList* custom_items; Mpris2Controller* mpris_bridge; + gboolean* use_playlists; }; struct _PlayerControllerClass { @@ -345,12 +356,6 @@ struct _MprisPlaylistsIface { void (*set_ActivePlaylist) (MprisPlaylists* self, ActivePlaylistContainer* value); }; -struct _FreeDesktopObjectIface { - GTypeInterface parent_iface; - void (*list_names) (FreeDesktopObject* self, GAsyncReadyCallback _callback_, gpointer _user_data_); - gchar** (*list_names_finish) (FreeDesktopObject* self, GAsyncResult* _res_, int* result_length1, GError** error); -}; - struct _Mpris2Watcher { GObject parent_instance; Mpris2WatcherPrivate * priv; @@ -360,10 +365,6 @@ struct _Mpris2WatcherClass { GObjectClass parent_class; }; -struct _FreeDesktopPropertiesIface { - GTypeInterface parent_iface; -}; - struct _Mpris2Controller { GObject parent_instance; Mpris2ControllerPrivate * priv; @@ -373,6 +374,10 @@ struct _Mpris2ControllerClass { GObjectClass parent_class; }; +struct _FreeDesktopPropertiesIface { + GTypeInterface parent_iface; +}; + struct _SettingsManager { GObject parent_instance; SettingsManagerPrivate * priv; @@ -392,6 +397,22 @@ struct _PlaylistsMenuitemClass { PlayerItemClass parent_class; }; +struct _FreeDesktopObjectIface { + GTypeInterface parent_iface; + void (*list_names) (FreeDesktopObject* self, GAsyncReadyCallback _callback_, gpointer _user_data_); + gchar** (*list_names_finish) (FreeDesktopObject* self, GAsyncResult* _res_, int* result_length1, GError** error); +}; + +struct _FreeDesktopIntrospectableIface { + GTypeInterface parent_iface; + gchar* (*Introspect) (FreeDesktopIntrospectable* self, GError** error); +}; + +typedef enum { + XML_ERROR_FILE_NOT_FOUND, + XML_ERROR_XML_DOCUMENT_EMPTY +} XmlError; +#define XML_ERROR xml_error_quark () struct _FetchFile { GObject parent_instance; FetchFilePrivate * priv; @@ -405,7 +426,7 @@ struct _FetchFileClass { GType music_player_bridge_get_type (void) G_GNUC_CONST; MusicPlayerBridge* music_player_bridge_new (void); MusicPlayerBridge* music_player_bridge_construct (GType object_type); -void music_player_bridge_client_has_become_available (MusicPlayerBridge* self, const gchar* desktop, const gchar* dbus_name); +void music_player_bridge_client_has_become_available (MusicPlayerBridge* self, const gchar* desktop, const gchar* dbus_name, gboolean use_playlists); void music_player_bridge_client_has_vanished (MusicPlayerBridge* self, const gchar* mpris_root_interface); void music_player_bridge_set_root_menu_item (MusicPlayerBridge* self, DbusmenuMenuitem* menu); GType player_item_get_type (void) G_GNUC_CONST; @@ -433,8 +454,8 @@ GType mpris2_controller_get_type (void) G_GNUC_CONST; GType player_controller_widget_order_get_type (void) G_GNUC_CONST; GType player_controller_state_get_type (void) G_GNUC_CONST; #define PLAYER_CONTROLLER_WIDGET_QUANTITY 5 -PlayerController* player_controller_new (DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, PlayerControllerstate initial_state); -PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, PlayerControllerstate initial_state); +PlayerController* player_controller_new (DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, gboolean* use_playlists, PlayerControllerstate initial_state); +PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, gboolean* use_playlists, PlayerControllerstate initial_state); void player_controller_update_state (PlayerController* self, PlayerControllerstate new_state); void player_controller_activate (PlayerController* self, const gchar* dbus_name); void player_controller_instantiate (PlayerController* self); @@ -503,22 +524,12 @@ 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); -GType free_desktop_object_proxy_get_type (void) G_GNUC_CONST; -guint free_desktop_object_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error); -GType free_desktop_object_get_type (void) G_GNUC_CONST; -void free_desktop_object_list_names (FreeDesktopObject* self, GAsyncReadyCallback _callback_, gpointer _user_data_); -gchar** free_desktop_object_list_names_finish (FreeDesktopObject* self, GAsyncResult* _res_, int* result_length1, GError** error); GType mpris2_watcher_get_type (void) G_GNUC_CONST; -#define MPRIS2_WATCHER_MPRIS_PREFIX "org.mpris.MediaPlayer2." Mpris2Watcher* mpris2_watcher_new (void); Mpris2Watcher* mpris2_watcher_construct (GType object_type); -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); 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); -gboolean mpris2_controller_playlists_support_exist (Mpris2Controller* self); void mpris2_controller_initial_update (Mpris2Controller* self); void mpris2_controller_transport_update (Mpris2Controller* self, TransportMenuitemaction command); void mpris2_controller_fetch_playlists (Mpris2Controller* self); @@ -528,6 +539,9 @@ void mpris2_controller_activate_playlist (Mpris2Controller* self, const char* pa MprisRoot* mpris2_controller_get_mpris2_root (Mpris2Controller* self); MprisPlayer* mpris2_controller_get_player (Mpris2Controller* self); MprisPlaylists* mpris2_controller_get_playlists (Mpris2Controller* self); +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); FreeDesktopProperties* mpris2_controller_get_properties_interface (Mpris2Controller* self); PlayerController* mpris2_controller_get_owner (Mpris2Controller* self); PlayerItem* player_item_new (const gchar* type); @@ -550,6 +564,16 @@ PlaylistsMenuitem* playlists_menuitem_construct (GType object_type, PlayerContro void playlists_menuitem_update (PlaylistsMenuitem* self, PlaylistDetails* playlists, int playlists_length1); void playlists_menuitem_update_active_playlist (PlaylistsMenuitem* self, PlaylistDetails* detail); GeeHashSet* playlists_menuitem_attributes_format (void); +GType free_desktop_object_proxy_get_type (void) G_GNUC_CONST; +guint free_desktop_object_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error); +GType free_desktop_object_get_type (void) G_GNUC_CONST; +void free_desktop_object_list_names (FreeDesktopObject* self, GAsyncReadyCallback _callback_, gpointer _user_data_); +gchar** free_desktop_object_list_names_finish (FreeDesktopObject* self, GAsyncResult* _res_, int* result_length1, GError** error); +GType free_desktop_introspectable_proxy_get_type (void) G_GNUC_CONST; +guint free_desktop_introspectable_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error); +GType free_desktop_introspectable_get_type (void) G_GNUC_CONST; +gchar* free_desktop_introspectable_Introspect (FreeDesktopIntrospectable* self, GError** error); +GQuark xml_error_quark (void); GType fetch_file_get_type (void) G_GNUC_CONST; FetchFile* fetch_file_new (const gchar* uri, const gchar* prop); FetchFile* fetch_file_construct (GType object_type, const gchar* uri, const gchar* prop); diff --git a/src/player-controller.c b/src/player-controller.c index 6a84368..c4583d9 100644 --- a/src/player-controller.c +++ b/src/player-controller.c @@ -1,4 +1,4 @@ -/* player-controller.c generated by valac 0.11.2, the Vala compiler +/* player-controller.c generated by valac 0.11.3, the Vala compiler * generated from player-controller.vala, do not modify */ /* @@ -119,6 +119,7 @@ struct _PlayerController { gint current_state; GeeArrayList* custom_items; Mpris2Controller* mpris_bridge; + gboolean* use_playlists; }; struct _PlayerControllerClass { @@ -185,8 +186,9 @@ enum { GType player_controller_widget_order_get_type (void) G_GNUC_CONST; GType player_controller_state_get_type (void) G_GNUC_CONST; #define PLAYER_CONTROLLER_WIDGET_QUANTITY 5 -PlayerController* player_controller_new (DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, PlayerControllerstate initial_state); -PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, PlayerControllerstate initial_state); +PlayerController* player_controller_new (DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, gboolean* use_playlists, PlayerControllerstate initial_state); +PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, gboolean* use_playlists, PlayerControllerstate initial_state); +static gboolean* _bool_dup (gboolean* self); void player_controller_set_app_info (PlayerController* self, GAppInfo* value); void player_controller_set_dbus_name (PlayerController* self, const gchar* value); void player_controller_set_icon_name (PlayerController* self, const gchar* value); @@ -211,7 +213,6 @@ GType title_menuitem_get_type (void) G_GNUC_CONST; void title_menuitem_toggle_active_triangle (TitleMenuitem* self, gboolean update); GType playlists_menuitem_get_type (void) G_GNUC_CONST; gboolean player_item_populated (PlayerItem* self, GeeHashSet* attrs); -gboolean mpris2_controller_playlists_support_exist (Mpris2Controller* self); PlayerItem* player_item_new (const gchar* type); PlayerItem* player_item_construct (GType object_type, const gchar* type); TitleMenuitem* title_menuitem_new (PlayerController* parent); @@ -261,32 +262,51 @@ GType player_controller_state_get_type (void) { } +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 gpointer _g_object_ref0 (gpointer self) { return self ? g_object_ref (self) : NULL; } -PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, PlayerControllerstate initial_state) { +PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, gboolean* use_playlists, PlayerControllerstate initial_state) { PlayerController * self = NULL; - DbusmenuMenuitem* _tmp0_; - DbusmenuMenuitem* _tmp1_; - GeeArrayList* _tmp2_ = NULL; - GeeArrayList* _tmp3_; + gboolean* _tmp0_; + gboolean* _tmp1_; + DbusmenuMenuitem* _tmp2_; + DbusmenuMenuitem* _tmp3_; + GeeArrayList* _tmp4_ = NULL; + GeeArrayList* _tmp5_; g_return_val_if_fail (root != NULL, NULL); g_return_val_if_fail (app != NULL, NULL); g_return_val_if_fail (icon_name != NULL, NULL); self = (PlayerController*) g_object_new (object_type, NULL); - _tmp0_ = _g_object_ref0 (root); + _tmp0_ = __bool_dup0 (use_playlists); _tmp1_ = _tmp0_; + _g_free0 (self->use_playlists); + self->use_playlists = _tmp1_; + _tmp2_ = _g_object_ref0 (root); + _tmp3_ = _tmp2_; _g_object_unref0 (self->priv->root_menu); - self->priv->root_menu = _tmp1_; + self->priv->root_menu = _tmp3_; player_controller_set_app_info (self, app); player_controller_set_dbus_name (self, dbus_name); player_controller_set_icon_name (self, icon_name); - _tmp2_ = gee_array_list_new (TYPE_PLAYER_ITEM, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL); - _tmp3_ = _tmp2_; + _tmp4_ = gee_array_list_new (TYPE_PLAYER_ITEM, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL); + _tmp5_ = _tmp4_; _g_object_unref0 (self->custom_items); - self->custom_items = _tmp3_; + self->custom_items = _tmp5_; self->current_state = (gint) initial_state; player_controller_set_menu_offset (self, offset); player_controller_construct_widgets (self); @@ -296,8 +316,8 @@ PlayerController* player_controller_construct (GType object_type, DbusmenuMenuit } -PlayerController* player_controller_new (DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, PlayerControllerstate initial_state) { - return player_controller_construct (TYPE_PLAYER_CONTROLLER, root, app, dbus_name, icon_name, offset, initial_state); +PlayerController* player_controller_new (DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, gboolean* use_playlists, PlayerControllerstate initial_state) { + return player_controller_construct (TYPE_PLAYER_CONTROLLER, root, app, dbus_name, icon_name, offset, use_playlists, initial_state); } @@ -305,7 +325,7 @@ void player_controller_update_state (PlayerController* self, PlayerControllersta const gchar* _tmp0_ = NULL; g_return_if_fail (self != NULL); _tmp0_ = g_app_info_get_name (self->priv->_app_info); - g_debug ("player-controller.vala:75: update_state - player controller %s : new s" \ + g_debug ("player-controller.vala:78: update_state - player controller %s : new s" \ "tate %i", _tmp0_, (gint) new_state); self->current_state = (gint) new_state; player_controller_update_layout (self); @@ -325,7 +345,7 @@ void player_controller_instantiate (PlayerController* self) { GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); _tmp0_ = g_app_info_get_name (self->priv->_app_info); - g_debug ("player-controller.vala:95: instantiate in player controller for %s", _tmp0_); + g_debug ("player-controller.vala:98: instantiate in player controller for %s", _tmp0_); g_app_info_launch (self->priv->_app_info, NULL, NULL, &_inner_error_); if (_inner_error_ != NULL) { goto __catch6_g_error; @@ -339,7 +359,7 @@ void player_controller_instantiate (PlayerController* self) { _error_ = _inner_error_; _inner_error_ = NULL; _tmp1_ = g_app_info_get_name (self->priv->_app_info); - g_warning ("player-controller.vala:101: Failed to launch app %s with error message" \ + g_warning ("player-controller.vala:104: Failed to launch app %s with error message" \ ": %s", _tmp1_, _error_->message); _g_error_free0 (_error_); } @@ -352,10 +372,28 @@ void player_controller_instantiate (PlayerController* self) { } +static gchar* bool_to_string (gboolean self) { + gchar* result = NULL; + if (self) { + gchar* _tmp0_; + _tmp0_ = g_strdup ("true"); + result = _tmp0_; + return result; + } else { + gchar* _tmp1_; + _tmp1_ = g_strdup ("false"); + result = _tmp1_; + return result; + } +} + + static void player_controller_establish_mpris_connection (PlayerController* self) { gboolean _tmp0_ = FALSE; - Mpris2Controller* _tmp1_ = NULL; - Mpris2Controller* _tmp2_; + gchar* _tmp1_ = NULL; + gchar* _tmp2_; + Mpris2Controller* _tmp3_ = NULL; + Mpris2Controller* _tmp4_; g_return_if_fail (self != NULL); if (self->current_state != PLAYER_CONTROLLER_STATE_READY) { _tmp0_ = TRUE; @@ -363,14 +401,19 @@ static void player_controller_establish_mpris_connection (PlayerController* self _tmp0_ = self->priv->_dbus_name == NULL; } if (_tmp0_) { - g_debug ("player-controller.vala:109: establish_mpris_connection - Not ready to " \ + g_debug ("player-controller.vala:112: establish_mpris_connection - Not ready to " \ "connect"); return; } - _tmp1_ = mpris2_controller_new (self); + _tmp1_ = bool_to_string (*self->use_playlists); _tmp2_ = _tmp1_; + g_debug ("player-controller.vala:115: establish mpris connection - use playlist" \ +"s value = %s ", _tmp2_); + _g_free0 (_tmp2_); + _tmp3_ = mpris2_controller_new (self); + _tmp4_ = _tmp3_; _g_object_unref0 (self->mpris_bridge); - self->mpris_bridge = _tmp2_; + self->mpris_bridge = _tmp4_; player_controller_determine_state (self); } @@ -457,7 +500,6 @@ void player_controller_update_layout (PlayerController* self) { gboolean _tmp12_; gpointer _tmp13_ = NULL; PlayerItem* _tmp14_; - gboolean _tmp15_; g_return_if_fail (self != NULL); _tmp0_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS); playlists_menuitem = (_tmp1_ = (PlayerItem*) _tmp0_, IS_PLAYLISTS_MENUITEM (_tmp1_) ? ((PlaylistsMenuitem*) _tmp1_) : NULL); @@ -493,8 +535,7 @@ void player_controller_update_layout (PlayerController* self) { _tmp14_ = (PlayerItem*) _tmp13_; dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) _tmp14_, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); _g_object_unref0 (_tmp14_); - _tmp15_ = mpris2_controller_playlists_support_exist (self->mpris_bridge); - dbusmenu_menuitem_property_set_bool (playlists_menuitem->root_item, DBUSMENU_MENUITEM_PROP_VISIBLE, _tmp15_); + dbusmenu_menuitem_property_set_bool (playlists_menuitem->root_item, DBUSMENU_MENUITEM_PROP_VISIBLE, *self->use_playlists); _g_object_unref0 (playlists_menuitem); } @@ -598,7 +639,7 @@ static const gchar* string_offset (const gchar* self, glong offset) { static gchar* string_slice (const gchar* self, glong start, glong end) { gchar* result = NULL; - glong _tmp0_; + gint _tmp0_; glong string_length; gboolean _tmp1_ = FALSE; gboolean _tmp2_ = FALSE; @@ -608,7 +649,7 @@ static gchar* string_slice (const gchar* self, glong start, glong end) { gchar* _tmp5_ = NULL; g_return_val_if_fail (self != NULL, NULL); _tmp0_ = strlen (self); - string_length = _tmp0_; + string_length = (glong) _tmp0_; if (start < 0) { start = string_length + start; } @@ -650,7 +691,7 @@ static gchar* player_controller_format_player_name (gchar* app_info_name) { gint _tokens_size_; gchar** _tmp6_; gchar** tokens; - glong _tmp9_; + gint _tmp9_; g_return_val_if_fail (app_info_name != NULL, NULL); _tmp0_ = g_utf8_strdown (app_info_name, (gssize) (-1)); _tmp1_ = _tmp0_; @@ -673,7 +714,7 @@ static gchar* player_controller_format_player_name (gchar* app_info_name) { if (_tmp9_ > 1) { gchar* _tmp10_ = NULL; gchar* _tmp11_; - glong _tmp12_; + gint _tmp12_; gchar* _tmp13_ = NULL; gchar* _tmp14_; gchar* _tmp15_ = NULL; @@ -681,7 +722,7 @@ static gchar* player_controller_format_player_name (gchar* app_info_name) { _tmp10_ = g_utf8_strup (_result_, (gssize) 1); _tmp11_ = _tmp10_; _tmp12_ = strlen (_result_); - _tmp13_ = string_slice (_result_, (glong) 1, _tmp12_); + _tmp13_ = string_slice (_result_, (glong) 1, (glong) _tmp12_); _tmp14_ = _tmp13_; _tmp15_ = g_strconcat (_tmp11_, _tmp14_, NULL); _tmp16_ = _tmp15_; @@ -690,7 +731,7 @@ static gchar* player_controller_format_player_name (gchar* app_info_name) { _g_free0 (_tmp14_); _g_free0 (_tmp11_); } - g_debug ("player-controller.vala:197: PlayerController->format_player_name - : %" \ + g_debug ("player-controller.vala:202: PlayerController->format_player_name - : %" \ "s", _result_); result = _result_; tokens = (_vala_array_free (tokens, tokens_length1, (GDestroyNotify) g_free), NULL); @@ -822,6 +863,7 @@ static void player_controller_finalize (GObject* obj) { _g_object_unref0 (self->mpris_bridge); _g_object_unref0 (self->priv->_app_info); _g_free0 (self->priv->_icon_name); + _g_free0 (self->use_playlists); G_OBJECT_CLASS (player_controller_parent_class)->finalize (obj); } diff --git a/src/player-item.c b/src/player-item.c index ea68900..8dcb226 100644 --- a/src/player-item.c +++ b/src/player-item.c @@ -1,4 +1,4 @@ -/* player-item.c generated by valac 0.11.2, the Vala compiler +/* player-item.c generated by valac 0.11.3, the Vala compiler * generated from player-item.vala, do not modify */ /* diff --git a/src/playlists-menu-item.c b/src/playlists-menu-item.c index 3750074..ddbe12a 100644 --- a/src/playlists-menu-item.c +++ b/src/playlists-menu-item.c @@ -1,4 +1,4 @@ -/* playlists-menu-item.c generated by valac 0.11.2, the Vala compiler +/* playlists-menu-item.c generated by valac 0.11.3, the Vala compiler * generated from playlists-menu-item.vala, do not modify */ /* @@ -123,6 +123,7 @@ struct _PlayerController { gint current_state; GeeArrayList* custom_items; Mpris2Controller* mpris_bridge; + gboolean* use_playlists; }; struct _PlayerControllerClass { diff --git a/src/settings-manager.c b/src/settings-manager.c index 060bba8..0bb50dc 100644 --- a/src/settings-manager.c +++ b/src/settings-manager.c @@ -1,4 +1,4 @@ -/* settings-manager.c generated by valac 0.11.2, the Vala compiler +/* settings-manager.c generated by valac 0.11.3, the Vala compiler * generated from settings-manager.vala, do not modify */ /* diff --git a/src/title-menu-item.c b/src/title-menu-item.c index 19df676..d8130a0 100644 --- a/src/title-menu-item.c +++ b/src/title-menu-item.c @@ -1,4 +1,4 @@ -/* title-menu-item.c generated by valac 0.11.2, the Vala compiler +/* title-menu-item.c generated by valac 0.11.3, the Vala compiler * generated from title-menu-item.vala, do not modify */ /* @@ -103,6 +103,7 @@ struct _PlayerController { gint current_state; GeeArrayList* custom_items; Mpris2Controller* mpris_bridge; + gboolean* use_playlists; }; struct _PlayerControllerClass { diff --git a/src/transport-menu-item.c b/src/transport-menu-item.c index 5299ae1..9abef7b 100644 --- a/src/transport-menu-item.c +++ b/src/transport-menu-item.c @@ -1,4 +1,4 @@ -/* transport-menu-item.c generated by valac 0.11.2, the Vala compiler +/* transport-menu-item.c generated by valac 0.11.3, the Vala compiler * generated from transport-menu-item.vala, do not modify */ /* @@ -117,6 +117,7 @@ struct _PlayerController { gint current_state; GeeArrayList* custom_items; Mpris2Controller* mpris_bridge; + gboolean* use_playlists; }; struct _PlayerControllerClass { |