aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen VanDine <ken.vandine@canonical.com>2011-01-11 10:44:40 -0600
committerBazaar Package Importer <james.westby@ubuntu.com>2011-01-11 10:44:40 -0600
commitcb6ca63e62511e9107eea459a5a705b713416e7e (patch)
treea477ffb0c58de4d2358fa75352c87773f7c2f245
parent9caa6a3807dd44f8345266f1f341b4a5d02a8d96 (diff)
parentf4f168553cc7fc9ed09f76c805694abfcad70870 (diff)
downloadayatana-indicator-sound-cb6ca63e62511e9107eea459a5a705b713416e7e.tar.gz
ayatana-indicator-sound-cb6ca63e62511e9107eea459a5a705b713416e7e.tar.bz2
ayatana-indicator-sound-cb6ca63e62511e9107eea459a5a705b713416e7e.zip
* New upstream release.
- unity-panel-service crashed with SIGSEGV in cairo_translate (LP: #683184) - Add MPRIS Playlist support (LP: #692644) - only first word of application name is shown (LP: #695385) - 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
-rw-r--r--Makefile.am2
-rw-r--r--Makefile.in2
-rw-r--r--aclocal.m416
-rwxr-xr-xconfigure95
-rw-r--r--configure.ac11
-rw-r--r--debian/changelog15
-rw-r--r--debian/control4
-rw-r--r--src/Makefile.am5
-rw-r--r--src/Makefile.in41
-rw-r--r--src/common-defs.h3
-rw-r--r--src/dbus-menu-manager.c1
-rw-r--r--src/fetch-file.c30
-rw-r--r--src/freedesktop-interfaces.c850
-rw-r--r--src/freedesktop-interfaces.vala47
-rw-r--r--src/metadata-menu-item.c2
-rw-r--r--src/mpris2-controller.c634
-rw-r--r--src/mpris2-controller.vala73
-rw-r--r--src/mpris2-interfaces.c966
-rw-r--r--src/mpris2-interfaces.vala33
-rw-r--r--src/mpris2-watcher.c791
-rw-r--r--src/mpris2-watcher.vala125
-rw-r--r--src/music-player-bridge.c509
-rw-r--r--src/music-player-bridge.h185
-rw-r--r--src/music-player-bridge.vala84
-rw-r--r--src/player-controller.c307
-rw-r--r--src/player-controller.vala60
-rw-r--r--src/player-item.c2
-rw-r--r--src/player-item.vala2
-rw-r--r--src/playlists-menu-item.c408
-rw-r--r--src/playlists-menu-item.vala87
-rw-r--r--src/settings-manager.c126
-rw-r--r--src/settings-manager.vala30
-rw-r--r--src/title-menu-item.c15
-rw-r--r--src/title-menu-item.vala3
-rw-r--r--src/title-widget.c10
-rw-r--r--src/transport-menu-item.c20
-rw-r--r--src/transport-menu-item.vala2
-rw-r--r--src/transport-widget.c2
-rw-r--r--vapi/common-defs.vapi37
39 files changed, 4235 insertions, 1400 deletions
diff --git a/Makefile.am b/Makefile.am
index 70e69c1..466806a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -5,7 +5,7 @@ SUBDIRS = \
tests \
po
-EXTRA_DIST = autogen.sh vapi/common-defs.vapi vapi/Indicate-0.2.vapi
+EXTRA_DIST = autogen.sh vapi/common-defs.vapi
DISTCHECK_CONFIGURE_FLAGS = --enable-localinstall
diff --git a/Makefile.in b/Makefile.in
index 9dfd4fc..ca05132 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -273,7 +273,7 @@ SUBDIRS = \
tests \
po
-EXTRA_DIST = autogen.sh vapi/common-defs.vapi vapi/Indicate-0.2.vapi
+EXTRA_DIST = autogen.sh vapi/common-defs.vapi
DISTCHECK_CONFIGURE_FLAGS = --enable-localinstall
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
diff --git a/aclocal.m4 b/aclocal.m4
index 5b73575..7228fa9 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -536,7 +536,7 @@ mostlyclean-am: clean-gsettings-schemas
gsettings__enum_file = $(addsuffix .enums.xml,$(gsettings_ENUM_NAMESPACE))
%.gschema.valid: %.gschema.xml $(gsettings__enum_file)
- $(AM_V_GEN) if test -f "$<"; then d=; else d="$(srcdir)/"; fi; $(GLIB_COMPILE_SCHEMAS) --dry-run $(addprefix --schema-file=,$(gsettings__enum_file)) --schema-file=$${d}$< && touch [$]@
+ $(AM_V_GEN) if test -f "$<"; then d=; else d="$(srcdir)/"; fi; $(GLIB_COMPILE_SCHEMAS) --strict --dry-run $(addprefix --schema-file=,$(gsettings__enum_file)) --schema-file=$${d}$< && touch [$]@
all-am: $(gsettings_SCHEMAS:.xml=.valid)
uninstall-am: uninstall-gsettings-schemas
@@ -546,9 +546,11 @@ install-data-am: install-gsettings-schemas
install-gsettings-schemas: $(gsettings_SCHEMAS) $(gsettings__enum_file)
@$(NORMAL_INSTALL)
- test -z "$(gsettingsschemadir)" || $(MKDIR_P) "$(DESTDIR)$(gsettingsschemadir)"
- $(INSTALL_DATA) $^ "$(DESTDIR)$(gsettingsschemadir)"
- test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir)
+ if test -n "$^"; then \
+ test -z "$(gsettingsschemadir)" || $(MKDIR_P) "$(DESTDIR)$(gsettingsschemadir)"; \
+ $(INSTALL_DATA) $^ "$(DESTDIR)$(gsettingsschemadir)"; \
+ test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir); \
+ fi
uninstall-gsettings-schemas:
@$(NORMAL_UNINSTALL)
@@ -564,7 +566,7 @@ clean-gsettings-schemas:
ifdef gsettings_ENUM_NAMESPACE
$(gsettings__enum_file): $(gsettings_ENUM_FILES)
- $(AM_V_GEN) glib-mkenums --comments '\''<!-- @comment@ -->'\'' --fhead "<schemalist>" --vhead " <@type@ id='\''$(gsettings_ENUM_NAMESPACE).@EnumName@'\''>" --vprod " <value nick='\''@valuenick@'\'' value='\''@valuenum@'\''/>" --vtail " </@type@>" --ftail "</schemalist>" $(gsettings_ENUM_FILES) > [$]@.tmp && mv [$]@.tmp [$]@
+ $(AM_V_GEN) glib-mkenums --comments '\''<!-- @comment@ -->'\'' --fhead "<schemalist>" --vhead " <@type@ id='\''$(gsettings_ENUM_NAMESPACE).@EnumName@'\''>" --vprod " <value nick='\''@valuenick@'\'' value='\''@valuenum@'\''/>" --vtail " </@type@>" --ftail "</schemalist>" [$]^ > [$]@.tmp && mv [$]@.tmp [$]@
endif
'
_GSETTINGS_SUBST(GSETTINGS_RULES)
@@ -8909,7 +8911,7 @@ $$1_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
-_PKG_TEXT])dnl
+_PKG_TEXT])[]dnl
])
elif test $pkg_failed = untried; then
AC_MSG_RESULT([no])
@@ -8920,7 +8922,7 @@ path to pkg-config.
_PKG_TEXT
-To get pkg-config, see <http://pkg-config.freedesktop.org/>.])dnl
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
])
else
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
diff --git a/configure b/configure
index 1bc85bf..89b3548 100755
--- a/configure
+++ b/configure
@@ -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.3.
+# 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.3'
-PACKAGE_STRING='indicator-sound 0.5.3'
+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.3 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.3:";;
+ 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.3
+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.3, 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.3
+ VERSION=0.5.5
cat >>confdefs.h <<_ACEOF
@@ -12383,12 +12383,15 @@ if test -n "$PULSEAUDIO_CFLAGS"; then
pkg_cv_PULSEAUDIO_CFLAGS="$PULSEAUDIO_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpulse-mainloop-glib >= \$PULSE_AUDIO_REQUIRED_VERSION\""; } >&5
- ($PKG_CONFIG --exists --print-errors "libpulse-mainloop-glib >= $PULSE_AUDIO_REQUIRED_VERSION") 2>&5
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpulse-mainloop-glib >= \$PULSE_AUDIO_REQUIRED_VERSION
+ gio-unix-2.0\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "libpulse-mainloop-glib >= $PULSE_AUDIO_REQUIRED_VERSION
+ gio-unix-2.0") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
- pkg_cv_PULSEAUDIO_CFLAGS=`$PKG_CONFIG --cflags "libpulse-mainloop-glib >= $PULSE_AUDIO_REQUIRED_VERSION" 2>/dev/null`
+ pkg_cv_PULSEAUDIO_CFLAGS=`$PKG_CONFIG --cflags "libpulse-mainloop-glib >= $PULSE_AUDIO_REQUIRED_VERSION
+ gio-unix-2.0" 2>/dev/null`
else
pkg_failed=yes
fi
@@ -12399,12 +12402,15 @@ if test -n "$PULSEAUDIO_LIBS"; then
pkg_cv_PULSEAUDIO_LIBS="$PULSEAUDIO_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpulse-mainloop-glib >= \$PULSE_AUDIO_REQUIRED_VERSION\""; } >&5
- ($PKG_CONFIG --exists --print-errors "libpulse-mainloop-glib >= $PULSE_AUDIO_REQUIRED_VERSION") 2>&5
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpulse-mainloop-glib >= \$PULSE_AUDIO_REQUIRED_VERSION
+ gio-unix-2.0\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "libpulse-mainloop-glib >= $PULSE_AUDIO_REQUIRED_VERSION
+ gio-unix-2.0") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
- pkg_cv_PULSEAUDIO_LIBS=`$PKG_CONFIG --libs "libpulse-mainloop-glib >= $PULSE_AUDIO_REQUIRED_VERSION" 2>/dev/null`
+ pkg_cv_PULSEAUDIO_LIBS=`$PKG_CONFIG --libs "libpulse-mainloop-glib >= $PULSE_AUDIO_REQUIRED_VERSION
+ gio-unix-2.0" 2>/dev/null`
else
pkg_failed=yes
fi
@@ -12424,14 +12430,17 @@ else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
- PULSEAUDIO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libpulse-mainloop-glib >= $PULSE_AUDIO_REQUIRED_VERSION" 2>&1`
+ PULSEAUDIO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libpulse-mainloop-glib >= $PULSE_AUDIO_REQUIRED_VERSION
+ gio-unix-2.0" 2>&1`
else
- PULSEAUDIO_PKG_ERRORS=`$PKG_CONFIG --print-errors "libpulse-mainloop-glib >= $PULSE_AUDIO_REQUIRED_VERSION" 2>&1`
+ PULSEAUDIO_PKG_ERRORS=`$PKG_CONFIG --print-errors "libpulse-mainloop-glib >= $PULSE_AUDIO_REQUIRED_VERSION
+ gio-unix-2.0" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$PULSEAUDIO_PKG_ERRORS" >&5
- as_fn_error $? "Package requirements (libpulse-mainloop-glib >= $PULSE_AUDIO_REQUIRED_VERSION) were not met:
+ as_fn_error $? "Package requirements (libpulse-mainloop-glib >= $PULSE_AUDIO_REQUIRED_VERSION
+ gio-unix-2.0) were not met:
$PULSEAUDIO_PKG_ERRORS
@@ -12478,18 +12487,24 @@ if test -n "$SOUNDSERVICE_CFLAGS"; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dbusmenu-glib >= \$DBUSMENUGLIB_REQUIRED_VERSION
indicator >= \$INDICATOR_REQUIRED_VERSION
indicate >= \$INDICATE_REQUIRED_VERSION
- gee-1.0\""; } >&5
+ gee-1.0
+ 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") 2>&5
+ gee-1.0
+ 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
pkg_cv_SOUNDSERVICE_CFLAGS=`$PKG_CONFIG --cflags "dbusmenu-glib >= $DBUSMENUGLIB_REQUIRED_VERSION
indicator >= $INDICATOR_REQUIRED_VERSION
indicate >= $INDICATE_REQUIRED_VERSION
- gee-1.0" 2>/dev/null`
+ gee-1.0
+ gio-unix-2.0
+ libxml-2.0" 2>/dev/null`
else
pkg_failed=yes
fi
@@ -12503,18 +12518,24 @@ if test -n "$SOUNDSERVICE_LIBS"; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dbusmenu-glib >= \$DBUSMENUGLIB_REQUIRED_VERSION
indicator >= \$INDICATOR_REQUIRED_VERSION
indicate >= \$INDICATE_REQUIRED_VERSION
- gee-1.0\""; } >&5
+ gee-1.0
+ 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") 2>&5
+ gee-1.0
+ 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
pkg_cv_SOUNDSERVICE_LIBS=`$PKG_CONFIG --libs "dbusmenu-glib >= $DBUSMENUGLIB_REQUIRED_VERSION
indicator >= $INDICATOR_REQUIRED_VERSION
indicate >= $INDICATE_REQUIRED_VERSION
- gee-1.0" 2>/dev/null`
+ gee-1.0
+ gio-unix-2.0
+ libxml-2.0" 2>/dev/null`
else
pkg_failed=yes
fi
@@ -12537,12 +12558,16 @@ fi
SOUNDSERVICE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "dbusmenu-glib >= $DBUSMENUGLIB_REQUIRED_VERSION
indicator >= $INDICATOR_REQUIRED_VERSION
indicate >= $INDICATE_REQUIRED_VERSION
- gee-1.0" 2>&1`
+ gee-1.0
+ 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" 2>&1`
+ gee-1.0
+ 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
@@ -12550,7 +12575,9 @@ fi
as_fn_error $? "Package requirements (dbusmenu-glib >= $DBUSMENUGLIB_REQUIRED_VERSION
indicator >= $INDICATOR_REQUIRED_VERSION
indicate >= $INDICATE_REQUIRED_VERSION
- gee-1.0) were not met:
+ gee-1.0
+ gio-unix-2.0
+ libxml-2.0) were not met:
$SOUNDSERVICE_PKG_ERRORS
@@ -12993,7 +13020,7 @@ mostlyclean-am: clean-gsettings-schemas
gsettings__enum_file = $(addsuffix .enums.xml,$(gsettings_ENUM_NAMESPACE))
%.gschema.valid: %.gschema.xml $(gsettings__enum_file)
- $(AM_V_GEN) if test -f "$<"; then d=; else d="$(srcdir)/"; fi; $(GLIB_COMPILE_SCHEMAS) --dry-run $(addprefix --schema-file=,$(gsettings__enum_file)) --schema-file=$${d}$< && touch $@
+ $(AM_V_GEN) if test -f "$<"; then d=; else d="$(srcdir)/"; fi; $(GLIB_COMPILE_SCHEMAS) --strict --dry-run $(addprefix --schema-file=,$(gsettings__enum_file)) --schema-file=$${d}$< && touch $@
all-am: $(gsettings_SCHEMAS:.xml=.valid)
uninstall-am: uninstall-gsettings-schemas
@@ -13003,9 +13030,11 @@ install-data-am: install-gsettings-schemas
install-gsettings-schemas: $(gsettings_SCHEMAS) $(gsettings__enum_file)
@$(NORMAL_INSTALL)
- test -z "$(gsettingsschemadir)" || $(MKDIR_P) "$(DESTDIR)$(gsettingsschemadir)"
- $(INSTALL_DATA) $^ "$(DESTDIR)$(gsettingsschemadir)"
- test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir)
+ if test -n "$^"; then \
+ test -z "$(gsettingsschemadir)" || $(MKDIR_P) "$(DESTDIR)$(gsettingsschemadir)"; \
+ $(INSTALL_DATA) $^ "$(DESTDIR)$(gsettingsschemadir)"; \
+ test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir); \
+ fi
uninstall-gsettings-schemas:
@$(NORMAL_UNINSTALL)
@@ -13021,7 +13050,7 @@ clean-gsettings-schemas:
ifdef gsettings_ENUM_NAMESPACE
$(gsettings__enum_file): $(gsettings_ENUM_FILES)
- $(AM_V_GEN) glib-mkenums --comments '\''<!-- @comment@ -->'\'' --fhead "<schemalist>" --vhead " <@type@ id='\''$(gsettings_ENUM_NAMESPACE).@EnumName@'\''>" --vprod " <value nick='\''@valuenick@'\'' value='\''@valuenum@'\''/>" --vtail " </@type@>" --ftail "</schemalist>" $(gsettings_ENUM_FILES) > $@.tmp && mv $@.tmp $@
+ $(AM_V_GEN) glib-mkenums --comments '\''<!-- @comment@ -->'\'' --fhead "<schemalist>" --vhead " <@type@ id='\''$(gsettings_ENUM_NAMESPACE).@EnumName@'\''>" --vprod " <value nick='\''@valuenick@'\'' value='\''@valuenum@'\''/>" --vtail " </@type@>" --ftail "</schemalist>" $^ > $@.tmp && mv $@.tmp $@
endif
'
@@ -14322,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.3, 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
@@ -14388,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.3
+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 88ffe6d..1297120 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,10 +1,10 @@
-AC_INIT(indicator-sound, 0.5.3, 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.3)
+AM_INIT_AUTOMAKE(indicator-sound, 0.5.5)
AM_MAINTAINER_MODE
@@ -46,14 +46,17 @@ AC_SUBST(APPLET_CFLAGS)
AC_SUBST(APPLET_LIBS)
-PKG_CHECK_MODULES(PULSEAUDIO, libpulse-mainloop-glib >= $PULSE_AUDIO_REQUIRED_VERSION)
+PKG_CHECK_MODULES(PULSEAUDIO, libpulse-mainloop-glib >= $PULSE_AUDIO_REQUIRED_VERSION
+ gio-unix-2.0)
AC_SUBST(PULSEAUDIO_CFLAGS)
AC_SUBST(PULSEAUDIO_LIBS)
PKG_CHECK_MODULES(SOUNDSERVICE, dbusmenu-glib >= $DBUSMENUGLIB_REQUIRED_VERSION
indicator >= $INDICATOR_REQUIRED_VERSION
indicate >= $INDICATE_REQUIRED_VERSION
- gee-1.0)
+ gee-1.0
+ gio-unix-2.0
+ libxml-2.0)
AC_SUBST(SOUNDSERVICE_CFLAGS)
AC_SUBST(SOUNDERVICE_LIBS)
diff --git a/debian/changelog b/debian/changelog
index 2b6eedb..4b4666d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,18 @@
+indicator-sound (0.5.5-0ubuntu1) natty; urgency=low
+
+ * New upstream release.
+ - unity-panel-service crashed with SIGSEGV in cairo_translate (LP: #683184)
+ - Add MPRIS Playlist support (LP: #692644)
+ - only first word of application name is shown (LP: #695385)
+ - 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
+
+ -- Ken VanDine <ken.vandine@canonical.com> Tue, 11 Jan 2011 16:44:40 -0600
+
indicator-sound (0.5.3-0ubuntu1) natty; urgency=low
* New upstream release.
diff --git a/debian/control b/debian/control
index dab145b..b6a62ad 100644
--- a/debian/control
+++ b/debian/control
@@ -18,7 +18,9 @@ Build-Depends: debhelper (>= 7),
libgconf2-dev,
libgee-dev,
libindicate-dev (>= 0.4.1),
- valac
+ libxml2-dev,
+ dh-autoreconf,
+ valac-0.12
Standards-Version: 3.9.1
Homepage: https://launchpad.net/indicator-sound
diff --git a/src/Makefile.am b/src/Makefile.am
index 5ef9ef0..7fe7e0f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -65,6 +65,8 @@ music_bridge_VALASOURCES = \
mpris2-controller.vala \
player-item.vala \
settings-manager.vala \
+ playlists-menu-item.vala \
+ freedesktop-interfaces.vala \
fetch-file.vala
@@ -80,7 +82,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
$(MAINTAINER_VALAFLAGS)
diff --git a/src/Makefile.in b/src/Makefile.in
index 3f0467f..667d388 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -96,6 +96,8 @@ am__objects_1 = indicator_sound_service-music-player-bridge.$(OBJEXT) \
indicator_sound_service-mpris2-controller.$(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) \
@@ -343,6 +345,8 @@ music_bridge_VALASOURCES = \
mpris2-controller.vala \
player-item.vala \
settings-manager.vala \
+ playlists-menu-item.vala \
+ freedesktop-interfaces.vala \
fetch-file.vala
music_bridge_VALAFLAGS = \
@@ -357,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
@@ -530,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@
@@ -537,6 +543,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_sound_service-music-player-bridge.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_sound_service-player-controller.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_sound_service-player-item.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_sound_service-playlists-menu-item.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_sound_service-pulse-manager.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_sound_service-settings-manager.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_sound_service-slider-menu-item.Po@am__quote@
@@ -854,6 +861,38 @@ indicator_sound_service-settings-manager.obj: settings-manager.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-settings-manager.obj `if test -f 'settings-manager.c'; then $(CYGPATH_W) 'settings-manager.c'; else $(CYGPATH_W) '$(srcdir)/settings-manager.c'; fi`
+indicator_sound_service-playlists-menu-item.o: playlists-menu-item.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -MT indicator_sound_service-playlists-menu-item.o -MD -MP -MF $(DEPDIR)/indicator_sound_service-playlists-menu-item.Tpo -c -o indicator_sound_service-playlists-menu-item.o `test -f 'playlists-menu-item.c' || echo '$(srcdir)/'`playlists-menu-item.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-playlists-menu-item.Tpo $(DEPDIR)/indicator_sound_service-playlists-menu-item.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='playlists-menu-item.c' object='indicator_sound_service-playlists-menu-item.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-playlists-menu-item.o `test -f 'playlists-menu-item.c' || echo '$(srcdir)/'`playlists-menu-item.c
+
+indicator_sound_service-playlists-menu-item.obj: playlists-menu-item.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -MT indicator_sound_service-playlists-menu-item.obj -MD -MP -MF $(DEPDIR)/indicator_sound_service-playlists-menu-item.Tpo -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`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-playlists-menu-item.Tpo $(DEPDIR)/indicator_sound_service-playlists-menu-item.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='playlists-menu-item.c' object='indicator_sound_service-playlists-menu-item.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-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/common-defs.h b/src/common-defs.h
index 214f60a..8ec69e8 100644
--- a/src/common-defs.h
+++ b/src/common-defs.h
@@ -49,3 +49,6 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#define DBUSMENU_SCRUB_MENUITEM_POSITION "x-canonical-sound-menu-player-scrub-position"
#define DBUSMENU_SCRUB_MENUITEM_PLAY_STATE "x-canonical-sound-menu-player-scrub-play-state"
+#define DBUSMENU_PLAYLISTS_MENUITEM_TYPE "x-canonical-sound-menu-player-playlists-type"
+#define DBUSMENU_PLAYLISTS_MENUITEM_TITLE "x-canonical-sound-menu-player-playlists-title"
+#define DBUSMENU_PLAYLISTS_MENUITEM_PLAYLISTS "x-canonical-sound-menu-player-playlists-playlists" \ No newline at end of file
diff --git a/src/dbus-menu-manager.c b/src/dbus-menu-manager.c
index 37e1c18..f92c324 100644
--- a/src/dbus-menu-manager.c
+++ b/src/dbus-menu-manager.c
@@ -214,6 +214,7 @@ static void rebuild_sound_menu(DbusmenuMenuitem *root, SoundServiceDbus *service
// Sound preferences dialog
DbusmenuMenuitem *settings_mi = dbusmenu_menuitem_new();
dbusmenu_menuitem_property_set(settings_mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Sound Preferences..."));
+
//_("Sound Preferences..."));
dbusmenu_menuitem_child_append(root, settings_mi);
g_signal_connect(G_OBJECT(settings_mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED,
diff --git a/src/fetch-file.c b/src/fetch-file.c
index 1e6c1af..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 __catch11_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 __finally11;
- __catch11_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);
}
- __finally11:
+ __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 __catch12_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 __finally12;
- __catch12_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);
}
- __finally12:
+ __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 edb443a..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))
@@ -77,6 +63,32 @@ typedef struct _MprisPlayerIface MprisPlayerIface;
#define TYPE_MPRIS_PLAYER_PROXY (mpris_player_proxy_get_type ())
+#define TYPE_MPRIS_PLAYLISTS (mpris_playlists_get_type ())
+#define MPRIS_PLAYLISTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_PLAYLISTS, MprisPlaylists))
+#define IS_MPRIS_PLAYLISTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_PLAYLISTS))
+#define MPRIS_PLAYLISTS_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_MPRIS_PLAYLISTS, MprisPlaylistsIface))
+
+typedef struct _MprisPlaylists MprisPlaylists;
+typedef struct _MprisPlaylistsIface MprisPlaylistsIface;
+
+#define TYPE_MPRIS_PLAYLISTS_PROXY (mpris_playlists_proxy_get_type ())
+
+#define TYPE_PLAYLIST_DETAILS (playlist_details_get_type ())
+typedef struct _PlaylistDetails PlaylistDetails;
+
+#define TYPE_ACTIVE_PLAYLIST_CONTAINER (active_playlist_container_get_type ())
+typedef struct _ActivePlaylistContainer ActivePlaylistContainer;
+
+#define TYPE_FREE_DESKTOP_PROPERTIES (free_desktop_properties_get_type ())
+#define FREE_DESKTOP_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FREE_DESKTOP_PROPERTIES, FreeDesktopProperties))
+#define IS_FREE_DESKTOP_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FREE_DESKTOP_PROPERTIES))
+#define FREE_DESKTOP_PROPERTIES_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_FREE_DESKTOP_PROPERTIES, FreeDesktopPropertiesIface))
+
+typedef struct _FreeDesktopProperties FreeDesktopProperties;
+typedef struct _FreeDesktopPropertiesIface FreeDesktopPropertiesIface;
+
+#define TYPE_FREE_DESKTOP_PROPERTIES_PROXY (free_desktop_properties_proxy_get_type ())
+
#define TYPE_PLAYER_CONTROLLER (player_controller_get_type ())
#define PLAYER_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYER_CONTROLLER, PlayerController))
#define PLAYER_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYER_CONTROLLER, PlayerControllerClass))
@@ -112,14 +124,22 @@ 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 ())
-#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
-struct _FreeDesktopPropertiesIface {
- GTypeInterface parent_iface;
-};
+#define TYPE_PLAYLISTS_MENUITEM (playlists_menuitem_get_type ())
+#define PLAYLISTS_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYLISTS_MENUITEM, PlaylistsMenuitem))
+#define PLAYLISTS_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYLISTS_MENUITEM, PlaylistsMenuitemClass))
+#define IS_PLAYLISTS_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYLISTS_MENUITEM))
+#define IS_PLAYLISTS_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYLISTS_MENUITEM))
+#define PLAYLISTS_MENUITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYLISTS_MENUITEM, PlaylistsMenuitemClass))
+
+typedef struct _PlaylistsMenuitem PlaylistsMenuitem;
+typedef struct _PlaylistsMenuitemClass PlaylistsMenuitemClass;
+#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
struct _Mpris2Controller {
GObject parent_instance;
@@ -164,9 +184,38 @@ struct _MprisPlayerIface {
void (*set_PlaybackStatus) (MprisPlayer* self, const gchar* value);
};
+struct _PlaylistDetails {
+ char* path;
+ gchar* name;
+ gchar* icon_path;
+};
+
+struct _ActivePlaylistContainer {
+ gboolean valid;
+ PlaylistDetails details;
+};
+
+struct _MprisPlaylistsIface {
+ GTypeInterface parent_iface;
+ void (*ActivatePlaylist) (MprisPlaylists* self, const char* playlist_id, GAsyncReadyCallback _callback_, gpointer _user_data_);
+ void (*ActivatePlaylist_finish) (MprisPlaylists* self, GAsyncResult* _res_, GError** error);
+ PlaylistDetails* (*GetPlaylists) (MprisPlaylists* self, guint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, int* result_length1, GError** error);
+ gchar** (*get_Orderings) (MprisPlaylists* self, int* result_length1);
+ void (*set_Orderings) (MprisPlaylists* self, gchar** value, int value_length1);
+ guint32 (*get_PlaylistCount) (MprisPlaylists* self);
+ void (*set_PlaylistCount) (MprisPlaylists* self, guint32 value);
+ void (*get_ActivePlaylist) (MprisPlaylists* self, ActivePlaylistContainer* value);
+ void (*set_ActivePlaylist) (MprisPlaylists* self, ActivePlaylistContainer* value);
+};
+
+struct _FreeDesktopPropertiesIface {
+ GTypeInterface parent_iface;
+};
+
struct _Mpris2ControllerPrivate {
MprisRoot* _mpris2_root;
MprisPlayer* _player;
+ MprisPlaylists* _playlists;
FreeDesktopProperties* _properties_interface;
PlayerController* _owner;
};
@@ -182,6 +231,7 @@ struct _PlayerController {
gint current_state;
GeeArrayList* custom_items;
Mpris2Controller* mpris_bridge;
+ gboolean* use_playlists;
};
struct _PlayerControllerClass {
@@ -192,7 +242,8 @@ typedef enum {
PLAYER_CONTROLLER_WIDGET_ORDER_SEPARATOR,
PLAYER_CONTROLLER_WIDGET_ORDER_TITLE,
PLAYER_CONTROLLER_WIDGET_ORDER_METADATA,
- PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT
+ PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT,
+ PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS
} PlayerControllerwidget_order;
typedef enum {
@@ -204,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);
@@ -223,12 +262,29 @@ GType mpris_root_get_type (void) G_GNUC_CONST;
GType mpris_player_proxy_get_type (void) G_GNUC_CONST;
guint mpris_player_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
GType mpris_player_get_type (void) G_GNUC_CONST;
+GType mpris_playlists_proxy_get_type (void) G_GNUC_CONST;
+guint mpris_playlists_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
+GType playlist_details_get_type (void) G_GNUC_CONST;
+PlaylistDetails* playlist_details_dup (const PlaylistDetails* self);
+void playlist_details_free (PlaylistDetails* self);
+void playlist_details_copy (const PlaylistDetails* self, PlaylistDetails* dest);
+void playlist_details_destroy (PlaylistDetails* self);
+GType active_playlist_container_get_type (void) G_GNUC_CONST;
+ActivePlaylistContainer* active_playlist_container_dup (const ActivePlaylistContainer* self);
+void active_playlist_container_free (ActivePlaylistContainer* self);
+void active_playlist_container_copy (const ActivePlaylistContainer* self, ActivePlaylistContainer* dest);
+void active_playlist_container_destroy (ActivePlaylistContainer* self);
+GType mpris_playlists_get_type (void) G_GNUC_CONST;
+GType free_desktop_properties_get_type (void) G_GNUC_CONST;
+GType free_desktop_properties_proxy_get_type (void) G_GNUC_CONST;
+guint free_desktop_properties_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
GType player_controller_get_type (void) G_GNUC_CONST;
#define MPRIS2_CONTROLLER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_MPRIS2_CONTROLLER, Mpris2ControllerPrivate))
enum {
MPRIS2_CONTROLLER_DUMMY_PROPERTY,
MPRIS2_CONTROLLER_MPRIS2_ROOT,
MPRIS2_CONTROLLER_PLAYER,
+ MPRIS2_CONTROLLER_PLAYLISTS,
MPRIS2_CONTROLLER_PROPERTIES_INTERFACE,
MPRIS2_CONTROLLER_OWNER
};
@@ -237,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);
@@ -253,6 +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);
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);
@@ -260,6 +318,7 @@ static GVariant* _variant_new2 (const gchar* value);
static const gchar* _variant_get3 (GVariant* value);
static GVariant* _variant_new4 (gint64 value);
void mpris2_controller_initial_update (Mpris2Controller* self);
+void mpris2_controller_fetch_playlists (Mpris2Controller* self);
GType transport_menuitem_action_get_type (void) G_GNUC_CONST;
void mpris2_controller_transport_update (Mpris2Controller* self, TransportMenuitemaction command);
void mpris_player_PlayPause (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
@@ -268,13 +327,25 @@ 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);
gboolean mpris2_controller_connected (Mpris2Controller* self);
MprisRoot* mpris2_controller_get_mpris2_root (Mpris2Controller* self);
void mpris2_controller_expose (Mpris2Controller* self);
void mpris_root_Raise (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
void mpris_root_Raise_finish (MprisRoot* self, GAsyncResult* _res_, GError** error);
+void mpris2_controller_activate_playlist (Mpris2Controller* self, const char* path);
+void mpris_playlists_ActivatePlaylist (MprisPlaylists* self, const char* playlist_id, GAsyncReadyCallback _callback_, gpointer _user_data_);
+void mpris_playlists_ActivatePlaylist_finish (MprisPlaylists* self, GAsyncResult* _res_, GError** error);
static void mpris2_controller_set_mpris2_root (Mpris2Controller* self, MprisRoot* value);
static void mpris2_controller_set_player (Mpris2Controller* self, MprisPlayer* value);
+static void mpris2_controller_set_playlists (Mpris2Controller* self, MprisPlaylists* value);
FreeDesktopProperties* mpris2_controller_get_properties_interface (Mpris2Controller* self);
static void mpris2_controller_set_properties_interface (Mpris2Controller* self, FreeDesktopProperties* value);
static void mpris2_controller_set_owner (Mpris2Controller* self, PlayerController* value);
@@ -286,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* _tmp27_;
- GHashTable* changed_properties = NULL;
- GVariant* _tmp28_;
- GHashTable* _tmp29_;
- GVariantIter _tmp30_;
- GVariant* _tmp31_;
- GVariant* _tmp32_;
- gchar** invalid = NULL;
- int invalid_length1;
- GVariant* _tmp33_;
- gchar** _tmp34_;
- int _tmp34__length;
- int _tmp34__size;
- int _tmp34__length1;
- GVariantIter _tmp35_;
- GVariant* _tmp36_;
- g_variant_iter_init (&_arguments_iter, parameters);
- _tmp27_ = g_variant_iter_next_value (&_arguments_iter);
- source = g_variant_dup_string (_tmp27_, NULL);
- g_variant_unref (_tmp27_);
- _tmp28_ = g_variant_iter_next_value (&_arguments_iter);
- _tmp29_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
- g_variant_iter_init (&_tmp30_, _tmp28_);
- while (g_variant_iter_loop (&_tmp30_, "{?*}", &_tmp31_, &_tmp32_)) {
- g_hash_table_insert (_tmp29_, g_variant_dup_string (_tmp31_, NULL), g_variant_get_variant (_tmp32_));
- }
- changed_properties = _tmp29_;
- g_variant_unref (_tmp28_);
- invalid_length1 = 0;
- _tmp33_ = g_variant_iter_next_value (&_arguments_iter);
- _tmp34_ = g_new (gchar*, 5);
- _tmp34__length = 0;
- _tmp34__size = 4;
- _tmp34__length1 = 0;
- g_variant_iter_init (&_tmp35_, _tmp33_);
- for (; _tmp36_ = g_variant_iter_next_value (&_tmp35_); _tmp34__length1++) {
- if (_tmp34__size == _tmp34__length) {
- _tmp34__size = 2 * _tmp34__size;
- _tmp34_ = g_renew (gchar*, _tmp34_, _tmp34__size + 1);
- }
- _tmp34_[_tmp34__length++] = g_variant_dup_string (_tmp36_, NULL);
- g_variant_unref (_tmp36_);
- }
- invalid_length1 = _tmp34__length1;
- _tmp34_[_tmp34__length] = NULL;
- invalid = _tmp34_;
- g_variant_unref (_tmp33_);
- 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 _tmp37_;
- GHashTableIter _tmp38_;
- gpointer _tmp39_;
- gpointer _tmp40_;
- gchar** _tmp41_;
- GVariantBuilder _tmp42_;
- int _tmp43_;
- _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 (&_tmp38_, changed_properties);
- g_variant_builder_init (&_tmp37_, G_VARIANT_TYPE_DICTIONARY);
- while (g_hash_table_iter_next (&_tmp38_, &_tmp39_, &_tmp40_)) {
- gchar* _key;
- GVariant* _value;
- _key = (gchar*) _tmp39_;
- _value = (GVariant*) _tmp40_;
- g_variant_builder_add (&_tmp37_, "{?*}", g_variant_new_string (_key), g_variant_new_variant (_value));
- }
- g_variant_builder_add_value (&_arguments_builder, g_variant_builder_end (&_tmp37_));
- _tmp41_ = invalid;
- g_variant_builder_init (&_tmp42_, G_VARIANT_TYPE ("as"));
- for (_tmp43_ = 0; _tmp43_ < invalid_length1; _tmp43_++) {
- g_variant_builder_add_value (&_tmp42_, g_variant_new_string (*_tmp41_));
- _tmp41_++;
- }
- g_variant_builder_add_value (&_arguments_builder, g_variant_builder_end (&_tmp42_));
- _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;
@@ -533,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;
@@ -542,21 +406,25 @@ void mpris2_controller_property_changed_cb (Mpris2Controller* self, const gchar*
gconstpointer _tmp10_ = NULL;
GVariant* _tmp11_;
GVariant* meta_v;
+ 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:68: 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:71: 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;
}
@@ -617,6 +485,19 @@ void mpris2_controller_property_changed_cb (Mpris2Controller* self, const gchar*
_g_object_unref0 (metadata);
_g_hash_table_unref0 (changed_updates);
}
+ _tmp21_ = g_hash_table_lookup (changed_properties, "ActivePlaylist");
+ _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);
_g_variant_unref0 (meta_v);
_g_variant_unref0 (play_v);
}
@@ -637,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:97: 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_;
@@ -664,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);
@@ -757,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:111: 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);
}
@@ -822,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_;
@@ -843,13 +725,17 @@ void mpris2_controller_initial_update (Mpris2Controller* self) {
player_item_update (_tmp9_, cleaned_metadata, _tmp11_);
_g_object_unref0 (_tmp11_);
_g_object_unref0 (_tmp9_);
+ if (_bool_equal (self->priv->_owner->use_playlists, (_tmp12_ = TRUE, &_tmp12_)) == TRUE) {
+ mpris2_controller_fetch_playlists (self);
+ mpris2_controller_fetch_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:145: 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 {
@@ -864,6 +750,99 @@ 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;
+ for (i = 0; i < array_length; i = i + 1) {
+ playlist_details_destroy (&array[i]);
+ }
+ }
+ g_free (array);
+}
+
+
+void mpris2_controller_fetch_playlists (Mpris2Controller* self) {
+ gint _tmp0_;
+ PlaylistDetails* _tmp1_ = NULL;
+ gint current_playlists_length1;
+ gint _current_playlists_size_;
+ PlaylistDetails* _tmp2_;
+ PlaylistDetails* current_playlists;
+ GError * _inner_error_ = NULL;
+ g_return_if_fail (self != NULL);
+ _tmp1_ = mpris_playlists_GetPlaylists (self->priv->_playlists, (guint32) 0, (guint32) 10, "Alphabetical", FALSE, &_tmp0_, &_inner_error_);
+ _tmp2_ = _tmp1_;
+ current_playlists_length1 = _tmp0_;
+ _current_playlists_size_ = current_playlists_length1;
+ current_playlists = _tmp2_;
+ if (_inner_error_ != NULL) {
+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
+ g_clear_error (&_inner_error_);
+ return;
+ }
+ if (current_playlists != NULL) {
+ gpointer _tmp3_ = NULL;
+ PlayerItem* _tmp4_;
+ PlaylistsMenuitem* playlists_item;
+ g_debug ("mpris2-controller.vala:171: Size of the playlist array = %i", current_playlists_length1);
+ _tmp3_ = gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS);
+ playlists_item = (_tmp4_ = (PlayerItem*) _tmp3_, IS_PLAYLISTS_MENUITEM (_tmp4_) ? ((PlaylistsMenuitem*) _tmp4_) : NULL);
+ playlists_menuitem_update (playlists_item, current_playlists, current_playlists_length1);
+ _g_object_unref0 (playlists_item);
+ } 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;
+}
+
+
+static void mpris2_controller_fetch_active_playlist (Mpris2Controller* self) {
+ 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);
+ 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);
+ mpris_playlists_get_ActivePlaylist (self->priv->_playlists, &_tmp5_);
+ _tmp6_ = _tmp5_;
+ playlists_menuitem_update_active_playlist (playlists_item, &_tmp6_.details);
+ active_playlist_container_destroy (&_tmp6_);
+ _g_object_unref0 (playlists_item);
+}
+
+
gboolean mpris2_controller_connected (Mpris2Controller* self) {
gboolean result = FALSE;
gboolean _tmp0_ = FALSE;
@@ -888,6 +867,29 @@ void mpris2_controller_expose (Mpris2Controller* self) {
}
+void mpris2_controller_activate_playlist (Mpris2Controller* self, const char* path) {
+ GError * _inner_error_ = NULL;
+ g_return_if_fail (self != NULL);
+ g_return_if_fail (path != NULL);
+ mpris_playlists_ActivatePlaylist (self->priv->_playlists, path, NULL, NULL);
+ goto __finally11;
+ __catch11_g_io_error:
+ {
+ GError * e;
+ e = _inner_error_;
+ _inner_error_ = NULL;
+ g_debug ("mpris2-controller.vala:210: Could not activate playlist %s because %s", (const gchar*) path, e->message);
+ _g_error_free0 (e);
+ }
+ __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_);
+ return;
+ }
+}
+
+
MprisRoot* mpris2_controller_get_mpris2_root (Mpris2Controller* self) {
MprisRoot* result;
g_return_val_if_fail (self != NULL, NULL);
@@ -933,6 +935,26 @@ static void mpris2_controller_set_player (Mpris2Controller* self, MprisPlayer* v
}
+MprisPlaylists* mpris2_controller_get_playlists (Mpris2Controller* self) {
+ MprisPlaylists* result;
+ g_return_val_if_fail (self != NULL, NULL);
+ result = self->priv->_playlists;
+ return result;
+}
+
+
+static void mpris2_controller_set_playlists (Mpris2Controller* self, MprisPlaylists* value) {
+ MprisPlaylists* _tmp0_;
+ MprisPlaylists* _tmp1_;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = _g_object_ref0 (value);
+ _tmp1_ = _tmp0_;
+ _g_object_unref0 (self->priv->_playlists);
+ self->priv->_playlists = _tmp1_;
+ g_object_notify ((GObject *) self, "playlists");
+}
+
+
FreeDesktopProperties* mpris2_controller_get_properties_interface (Mpris2Controller* self) {
FreeDesktopProperties* result;
g_return_val_if_fail (self != NULL, NULL);
@@ -984,66 +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_;
- FreeDesktopProperties* _tmp8_;
- FreeDesktopProperties* _tmp9_;
+ 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 __catch10_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 __catch10_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_ = (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);
+ _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_);
+ }
+ _tmp15_ = _tmp14_;
+ mpris2_controller_set_playlists (self, _tmp15_);
+ _g_object_unref0 (_tmp15_);
+ }
+ _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 __catch10_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_);
}
- _tmp9_ = _tmp8_;
- mpris2_controller_set_properties_interface (self, _tmp9_);
- _g_object_unref0 (_tmp9_);
+ _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 __finally10;
- __catch10_g_io_error:
+ goto __finally12;
+ __catch12_g_io_error:
{
GError * e;
e = _inner_error_;
_inner_error_ = NULL;
- g_error ("mpris2-controller.vala:60: 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);
}
- __finally10:
+ __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_);
@@ -1061,6 +1111,7 @@ static void mpris2_controller_class_init (Mpris2ControllerClass * klass) {
G_OBJECT_CLASS (klass)->finalize = mpris2_controller_finalize;
g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS2_CONTROLLER_MPRIS2_ROOT, g_param_spec_object ("mpris2-root", "mpris2-root", "mpris2-root", TYPE_MPRIS_ROOT, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS2_CONTROLLER_PLAYER, g_param_spec_object ("player", "player", "player", TYPE_MPRIS_PLAYER, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS2_CONTROLLER_PLAYLISTS, g_param_spec_object ("playlists", "playlists", "playlists", TYPE_MPRIS_PLAYLISTS, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS2_CONTROLLER_PROPERTIES_INTERFACE, g_param_spec_object ("properties-interface", "properties-interface", "properties-interface", TYPE_FREE_DESKTOP_PROPERTIES, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS2_CONTROLLER_OWNER, g_param_spec_object ("owner", "owner", "owner", TYPE_PLAYER_CONTROLLER, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}
@@ -1076,6 +1127,7 @@ static void mpris2_controller_finalize (GObject* obj) {
self = MPRIS2_CONTROLLER (obj);
_g_object_unref0 (self->priv->_mpris2_root);
_g_object_unref0 (self->priv->_player);
+ _g_object_unref0 (self->priv->_playlists);
_g_object_unref0 (self->priv->_properties_interface);
_g_object_unref0 (self->priv->_owner);
G_OBJECT_CLASS (mpris2_controller_parent_class)->finalize (obj);
@@ -1104,6 +1156,9 @@ static void _vala_mpris2_controller_get_property (GObject * object, guint proper
case MPRIS2_CONTROLLER_PLAYER:
g_value_set_object (value, mpris2_controller_get_player (self));
break;
+ case MPRIS2_CONTROLLER_PLAYLISTS:
+ g_value_set_object (value, mpris2_controller_get_playlists (self));
+ break;
case MPRIS2_CONTROLLER_PROPERTIES_INTERFACE:
g_value_set_object (value, mpris2_controller_get_properties_interface (self));
break;
@@ -1127,6 +1182,9 @@ static void _vala_mpris2_controller_set_property (GObject * object, guint proper
case MPRIS2_CONTROLLER_PLAYER:
mpris2_controller_set_player (self, g_value_get_object (value));
break;
+ case MPRIS2_CONTROLLER_PLAYLISTS:
+ mpris2_controller_set_playlists (self, g_value_get_object (value));
+ break;
case MPRIS2_CONTROLLER_PROPERTIES_INTERFACE:
mpris2_controller_set_properties_interface (self, g_value_get_object (value));
break;
diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala
index 7f14efe..fc61c12 100644
--- a/src/mpris2-controller.vala
+++ b/src/mpris2-controller.vala
@@ -18,13 +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.
@@ -33,13 +26,14 @@ public class Mpris2Controller : GLib.Object
{
public MprisRoot mpris2_root {get; construct;}
public MprisPlayer player {get; construct;}
+ public MprisPlaylists playlists {get; construct;}
public FreeDesktopProperties properties_interface {get; construct;}
public PlayerController owner {get; construct;}
-
+
public Mpris2Controller(PlayerController ctrl)
{
- GLib.Object(owner: ctrl);
+ GLib.Object(owner: ctrl);
}
construct{
@@ -50,10 +44,14 @@ public class Mpris2Controller : GLib.Object
this.player = Bus.get_proxy_sync ( BusType.SESSION,
this.owner.dbus_name,
"/org/mpris/MediaPlayer2" );
-
+ if ( this.owner.use_playlists == true ){
+ this.playlists = Bus.get_proxy_sync ( BusType.SESSION,
+ this.owner.dbus_name,
+ "/org/mpris/MediaPlayer2" );
+ }
this.properties_interface = Bus.get_proxy_sync ( BusType.SESSION,
"org.freedesktop.Properties.PropertiesChanged",
- "/org/mpris/MediaPlayer2" );
+ "/org/mpris/MediaPlayer2" );
this.properties_interface.PropertiesChanged.connect ( property_changed_cb );
}
catch (IOError e) {
@@ -67,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;
}
@@ -91,8 +89,12 @@ public class Mpris2Controller : GLib.Object
metadata.property_set_bool ( MENUITEM_PROP_VISIBLE,
metadata.populated(MetadataMenuitem.attributes_format()));
}
+ Variant? playlist_v = changed_properties.lookup("ActivePlaylist");
+ if ( playlist_v != null && this.owner.use_playlists == true ){
+ this.fetch_active_playlist();
+ }
}
-
+
private bool ensure_correct_playback_status(){
debug("TEST playback status = %s", this.player.PlaybackStatus);
TransportMenuitem.state p = (TransportMenuitem.state)this.determine_play_state(this.player.PlaybackStatus);
@@ -138,6 +140,11 @@ public class Mpris2Controller : GLib.Object
GLib.HashTable<string, Value?>? cleaned_metadata = this.clean_metadata();
this.owner.custom_items[PlayerController.widget_order.METADATA].update(cleaned_metadata,
MetadataMenuitem.attributes_format());
+
+ if ( this.owner.use_playlists == true ){
+ this.fetch_playlists();
+ this.fetch_active_playlist();
+ }
}
public void transport_update(TransportMenuitem.action command)
@@ -154,15 +161,53 @@ public class Mpris2Controller : GLib.Object
}
}
+ public void fetch_playlists()
+ {
+ PlaylistDetails[] current_playlists = this.playlists.GetPlaylists(0,
+ 10,
+ "Alphabetical",
+ false);
+ if( current_playlists != null ){
+ debug( "Size of the playlist array = %i", current_playlists.length );
+ PlaylistsMenuitem playlists_item = this.owner.custom_items[PlayerController.widget_order.PLAYLISTS] as PlaylistsMenuitem;
+ playlists_item.update(current_playlists);
+ }
+ else{
+ warning(" Playlists are on but its returning no current_playlists" );
+ this.owner.use_playlists = false;
+ }
+ return;
+ }
+
+ private void fetch_active_playlist()
+ {
+ if (this.playlists.ActivePlaylist.valid == false){
+ debug("We don't have an active playlist");
+ }
+ PlaylistsMenuitem playlists_item = this.owner.custom_items[PlayerController.widget_order.PLAYLISTS] as PlaylistsMenuitem;
+ playlists_item.update_active_playlist ( this.playlists.ActivePlaylist.details );
+ }
+
+
public bool connected()
{
return (this.player != null && this.mpris2_root != null);
}
-
+
public void expose()
{
if(this.connected() == true){
this.mpris2_root.Raise.begin();
}
}
+
+ public void activate_playlist (ObjectPath path)
+ {
+ try{
+ this.playlists.ActivatePlaylist.begin(path);
+ }
+ catch(IOError e){
+ debug("Could not activate playlist %s because %s", (string)path, e.message);
+ }
+ }
} \ No newline at end of file
diff --git a/src/mpris2-interfaces.c b/src/mpris2-interfaces.c
index 2755782..6f18596 100644
--- a/src/mpris2-interfaces.c
+++ b/src/mpris2-interfaces.c
@@ -1,9 +1,8 @@
-/* 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 */
/*
Copyright 2010 Canonical Ltd.
-
Authors:
Conor Curran <conor.curran@canonical.com>
@@ -22,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 ())
@@ -53,6 +52,24 @@ typedef GDBusProxy MprisPlayerProxy;
typedef GDBusProxyClass MprisPlayerProxyClass;
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
+#define TYPE_PLAYLIST_DETAILS (playlist_details_get_type ())
+typedef struct _PlaylistDetails PlaylistDetails;
+
+#define TYPE_ACTIVE_PLAYLIST_CONTAINER (active_playlist_container_get_type ())
+typedef struct _ActivePlaylistContainer ActivePlaylistContainer;
+
+#define TYPE_MPRIS_PLAYLISTS (mpris_playlists_get_type ())
+#define MPRIS_PLAYLISTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_PLAYLISTS, MprisPlaylists))
+#define IS_MPRIS_PLAYLISTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_PLAYLISTS))
+#define MPRIS_PLAYLISTS_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_MPRIS_PLAYLISTS, MprisPlaylistsIface))
+
+typedef struct _MprisPlaylists MprisPlaylists;
+typedef struct _MprisPlaylistsIface MprisPlaylistsIface;
+
+#define TYPE_MPRIS_PLAYLISTS_PROXY (mpris_playlists_proxy_get_type ())
+typedef GDBusProxy MprisPlaylistsProxy;
+typedef GDBusProxyClass MprisPlaylistsProxyClass;
+
struct _MprisRootIface {
GTypeInterface parent_iface;
void (*Quit) (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
@@ -87,8 +104,34 @@ struct _MprisPlayerIface {
void (*set_PlaybackStatus) (MprisPlayer* self, const gchar* value);
};
+struct _PlaylistDetails {
+ char* path;
+ gchar* name;
+ gchar* icon_path;
+};
+
+struct _ActivePlaylistContainer {
+ gboolean valid;
+ PlaylistDetails details;
+};
+
+struct _MprisPlaylistsIface {
+ GTypeInterface parent_iface;
+ void (*ActivatePlaylist) (MprisPlaylists* self, const char* playlist_id, GAsyncReadyCallback _callback_, gpointer _user_data_);
+ void (*ActivatePlaylist_finish) (MprisPlaylists* self, GAsyncResult* _res_, GError** error);
+ PlaylistDetails* (*GetPlaylists) (MprisPlaylists* self, guint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, int* result_length1, GError** error);
+ gchar** (*get_Orderings) (MprisPlaylists* self, int* result_length1);
+ void (*set_Orderings) (MprisPlaylists* self, gchar** value, int value_length1);
+ guint32 (*get_PlaylistCount) (MprisPlaylists* self);
+ void (*set_PlaylistCount) (MprisPlaylists* self, guint32 value);
+ void (*get_ActivePlaylist) (MprisPlaylists* self, ActivePlaylistContainer* value);
+ void (*set_ActivePlaylist) (MprisPlaylists* self, ActivePlaylistContainer* value);
+};
+
+#define MPRIS_PREFIX "org.mpris.MediaPlayer2."
+#define MPRIS_MEDIA_PLAYER_PATH "/org/mpris/MediaPlayer2"
GType mpris_root_proxy_get_type (void) G_GNUC_CONST;
guint mpris_root_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
GType mpris_root_get_type (void) G_GNUC_CONST;
@@ -124,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);
@@ -173,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);
@@ -189,6 +232,55 @@ static void _dbus_mpris_player_set_Position (MprisPlayer* self, GVariant* _value
static void _dbus_mpris_player_set_PlaybackStatus (MprisPlayer* self, GVariant* _value);
static void _dbus_mpris_player_seeked (GObject* _sender, gint64 new_position, gpointer* _data);
static void _mpris_player_unregister_object (gpointer user_data);
+GType playlist_details_get_type (void) G_GNUC_CONST;
+PlaylistDetails* playlist_details_dup (const PlaylistDetails* self);
+void playlist_details_free (PlaylistDetails* self);
+void playlist_details_copy (const PlaylistDetails* self, PlaylistDetails* dest);
+void playlist_details_destroy (PlaylistDetails* self);
+GType active_playlist_container_get_type (void) G_GNUC_CONST;
+ActivePlaylistContainer* active_playlist_container_dup (const ActivePlaylistContainer* self);
+void active_playlist_container_free (ActivePlaylistContainer* self);
+void active_playlist_container_copy (const ActivePlaylistContainer* self, ActivePlaylistContainer* dest);
+void active_playlist_container_destroy (ActivePlaylistContainer* self);
+GType mpris_playlists_proxy_get_type (void) G_GNUC_CONST;
+guint mpris_playlists_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
+GType mpris_playlists_get_type (void) G_GNUC_CONST;
+void mpris_playlists_ActivatePlaylist (MprisPlaylists* self, const char* playlist_id, GAsyncReadyCallback _callback_, gpointer _user_data_);
+void mpris_playlists_ActivatePlaylist_finish (MprisPlaylists* self, GAsyncResult* _res_, GError** error);
+PlaylistDetails* mpris_playlists_GetPlaylists (MprisPlaylists* self, guint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, int* result_length1, GError** error);
+gchar** mpris_playlists_get_Orderings (MprisPlaylists* self, int* result_length1);
+void mpris_playlists_set_Orderings (MprisPlaylists* self, gchar** value, int value_length1);
+guint32 mpris_playlists_get_PlaylistCount (MprisPlaylists* self);
+void mpris_playlists_set_PlaylistCount (MprisPlaylists* self, guint32 value);
+void mpris_playlists_get_ActivePlaylist (MprisPlaylists* self, ActivePlaylistContainer* result);
+void mpris_playlists_set_ActivePlaylist (MprisPlaylists* self, ActivePlaylistContainer* value);
+static void mpris_playlists_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters);
+static void mpris_playlists_proxy_ActivatePlaylist_async (MprisPlaylists* self, const char* playlist_id, GAsyncReadyCallback _callback_, gpointer _user_data_);
+static void mpris_playlists_proxy_ActivatePlaylist_finish (MprisPlaylists* self, GAsyncResult* _res_, GError** error);
+static PlaylistDetails* mpris_playlists_proxy_GetPlaylists (MprisPlaylists* self, guint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, int* result_length1, GError** error);
+static gchar** mpris_playlists_dbus_proxy_get_Orderings (MprisPlaylists* self, int* result_length1);
+static void mpris_playlists_dbus_proxy_set_Orderings (MprisPlaylists* self, gchar** value, int value_length1);
+static guint32 mpris_playlists_dbus_proxy_get_PlaylistCount (MprisPlaylists* self);
+static void mpris_playlists_dbus_proxy_set_PlaylistCount (MprisPlaylists* self, guint32 value);
+static void mpris_playlists_dbus_proxy_get_ActivePlaylist (MprisPlaylists* self, ActivePlaylistContainer* result);
+static void mpris_playlists_dbus_proxy_set_ActivePlaylist (MprisPlaylists* self, ActivePlaylistContainer* value);
+static void mpris_playlists_proxy_mpris_playlists_interface_init (MprisPlaylistsIface* iface);
+static void _dbus_mpris_playlists_ActivatePlaylist (MprisPlaylists* self, GVariant* parameters, GDBusMethodInvocation* invocation);
+static void _dbus_mpris_playlists_ActivatePlaylist_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_);
+static void _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);
+static GVariant* mpris_playlists_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data);
+static GVariant* _dbus_mpris_playlists_get_Orderings (MprisPlaylists* self);
+static GVariant* _dbus_mpris_playlists_get_PlaylistCount (MprisPlaylists* self);
+static GVariant* _dbus_mpris_playlists_get_ActivePlaylist (MprisPlaylists* self);
+static gboolean mpris_playlists_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data);
+static void _dbus_mpris_playlists_set_Orderings (MprisPlaylists* self, GVariant* _value);
+static void _dbus_mpris_playlists_set_PlaylistCount (MprisPlaylists* self, GVariant* _value);
+static void _dbus_mpris_playlists_set_ActivePlaylist (MprisPlaylists* self, GVariant* _value);
+static void _mpris_playlists_unregister_object (gpointer user_data);
+static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
static const GDBusArgInfo * const _mpris_root_dbus_arg_info_Quit_in[] = {NULL};
static const GDBusArgInfo * const _mpris_root_dbus_arg_info_Quit_out[] = {NULL};
@@ -226,6 +318,26 @@ static const GDBusPropertyInfo _mpris_player_dbus_property_info_PlaybackStatus =
static const GDBusPropertyInfo * const _mpris_player_dbus_property_info[] = {&_mpris_player_dbus_property_info_Metadata, &_mpris_player_dbus_property_info_Position, &_mpris_player_dbus_property_info_PlaybackStatus, NULL};
static const GDBusInterfaceInfo _mpris_player_dbus_interface_info = {-1, "org.mpris.MediaPlayer2.Player", (GDBusMethodInfo **) (&_mpris_player_dbus_method_info), (GDBusSignalInfo **) (&_mpris_player_dbus_signal_info), (GDBusPropertyInfo **) (&_mpris_player_dbus_property_info)};
static const GDBusInterfaceVTable _mpris_player_dbus_interface_vtable = {mpris_player_dbus_interface_method_call, mpris_player_dbus_interface_get_property, mpris_player_dbus_interface_set_property};
+static const GDBusArgInfo _mpris_playlists_dbus_arg_info_ActivatePlaylist_playlist_id = {-1, "playlist_id", "o"};
+static const GDBusArgInfo * const _mpris_playlists_dbus_arg_info_ActivatePlaylist_in[] = {&_mpris_playlists_dbus_arg_info_ActivatePlaylist_playlist_id, NULL};
+static const GDBusArgInfo * const _mpris_playlists_dbus_arg_info_ActivatePlaylist_out[] = {NULL};
+static const GDBusMethodInfo _mpris_playlists_dbus_method_info_ActivatePlaylist = {-1, "ActivatePlaylist", (GDBusArgInfo **) (&_mpris_playlists_dbus_arg_info_ActivatePlaylist_in), (GDBusArgInfo **) (&_mpris_playlists_dbus_arg_info_ActivatePlaylist_out)};
+static const GDBusArgInfo _mpris_playlists_dbus_arg_info_GetPlaylists_index = {-1, "index", "u"};
+static const GDBusArgInfo _mpris_playlists_dbus_arg_info_GetPlaylists_max_count = {-1, "max_count", "u"};
+static const GDBusArgInfo _mpris_playlists_dbus_arg_info_GetPlaylists_order = {-1, "order", "s"};
+static const GDBusArgInfo _mpris_playlists_dbus_arg_info_GetPlaylists_reverse_order = {-1, "reverse_order", "b"};
+static const GDBusArgInfo _mpris_playlists_dbus_arg_info_GetPlaylists_result = {-1, "result", "a(oss)"};
+static const GDBusArgInfo * const _mpris_playlists_dbus_arg_info_GetPlaylists_in[] = {&_mpris_playlists_dbus_arg_info_GetPlaylists_index, &_mpris_playlists_dbus_arg_info_GetPlaylists_max_count, &_mpris_playlists_dbus_arg_info_GetPlaylists_order, &_mpris_playlists_dbus_arg_info_GetPlaylists_reverse_order, NULL};
+static const GDBusArgInfo * const _mpris_playlists_dbus_arg_info_GetPlaylists_out[] = {&_mpris_playlists_dbus_arg_info_GetPlaylists_result, NULL};
+static const GDBusMethodInfo _mpris_playlists_dbus_method_info_GetPlaylists = {-1, "GetPlaylists", (GDBusArgInfo **) (&_mpris_playlists_dbus_arg_info_GetPlaylists_in), (GDBusArgInfo **) (&_mpris_playlists_dbus_arg_info_GetPlaylists_out)};
+static const GDBusMethodInfo * const _mpris_playlists_dbus_method_info[] = {&_mpris_playlists_dbus_method_info_ActivatePlaylist, &_mpris_playlists_dbus_method_info_GetPlaylists, NULL};
+static const GDBusSignalInfo * const _mpris_playlists_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo _mpris_playlists_dbus_property_info_Orderings = {-1, "Orderings", "as", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE};
+static const GDBusPropertyInfo _mpris_playlists_dbus_property_info_PlaylistCount = {-1, "PlaylistCount", "u", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE};
+static const GDBusPropertyInfo _mpris_playlists_dbus_property_info_ActivePlaylist = {-1, "ActivePlaylist", "(b(oss))", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE};
+static const GDBusPropertyInfo * const _mpris_playlists_dbus_property_info[] = {&_mpris_playlists_dbus_property_info_Orderings, &_mpris_playlists_dbus_property_info_PlaylistCount, &_mpris_playlists_dbus_property_info_ActivePlaylist, NULL};
+static const GDBusInterfaceInfo _mpris_playlists_dbus_interface_info = {-1, "org.mpris.MediaPlayer2.Playlists", (GDBusMethodInfo **) (&_mpris_playlists_dbus_method_info), (GDBusSignalInfo **) (&_mpris_playlists_dbus_signal_info), (GDBusPropertyInfo **) (&_mpris_playlists_dbus_property_info)};
+static const GDBusInterfaceVTable _mpris_playlists_dbus_interface_vtable = {mpris_playlists_dbus_interface_method_call, mpris_playlists_dbus_interface_get_property, mpris_playlists_dbus_interface_set_property};
void mpris_root_Quit (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
MPRIS_ROOT_GET_INTERFACE (self)->Quit (self, _callback_, _user_data_);
@@ -354,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;
}
@@ -382,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;
}
@@ -646,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;
@@ -677,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;
@@ -851,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;
}
@@ -1012,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;
}
@@ -1040,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;
}
@@ -1068,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;
}
@@ -1134,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;
@@ -1264,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;
@@ -1295,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;
@@ -1326,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;
@@ -1375,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;
@@ -1496,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;
}
@@ -1515,4 +1622,799 @@ static void _mpris_player_unregister_object (gpointer user_data) {
}
+void playlist_details_copy (const PlaylistDetails* self, PlaylistDetails* dest) {
+ dest->path = g_strdup (self->path);
+ dest->name = g_strdup (self->name);
+ dest->icon_path = g_strdup (self->icon_path);
+}
+
+
+void playlist_details_destroy (PlaylistDetails* self) {
+ _g_free0 (self->path);
+ _g_free0 (self->name);
+ _g_free0 (self->icon_path);
+}
+
+
+PlaylistDetails* playlist_details_dup (const PlaylistDetails* self) {
+ PlaylistDetails* dup;
+ dup = g_new0 (PlaylistDetails, 1);
+ playlist_details_copy (self, dup);
+ return dup;
+}
+
+
+void playlist_details_free (PlaylistDetails* self) {
+ playlist_details_destroy (self);
+ g_free (self);
+}
+
+
+GType playlist_details_get_type (void) {
+ static volatile gsize playlist_details_type_id__volatile = 0;
+ if (g_once_init_enter (&playlist_details_type_id__volatile)) {
+ GType playlist_details_type_id;
+ playlist_details_type_id = g_boxed_type_register_static ("PlaylistDetails", (GBoxedCopyFunc) playlist_details_dup, (GBoxedFreeFunc) playlist_details_free);
+ g_once_init_leave (&playlist_details_type_id__volatile, playlist_details_type_id);
+ }
+ return playlist_details_type_id__volatile;
+}
+
+
+void active_playlist_container_copy (const ActivePlaylistContainer* self, ActivePlaylistContainer* dest) {
+ PlaylistDetails _tmp0_ = {0};
+ dest->valid = self->valid;
+ dest->details = (playlist_details_copy (&self->details, &_tmp0_), _tmp0_);
+}
+
+
+void active_playlist_container_destroy (ActivePlaylistContainer* self) {
+ playlist_details_destroy (&self->details);
+}
+
+
+ActivePlaylistContainer* active_playlist_container_dup (const ActivePlaylistContainer* self) {
+ ActivePlaylistContainer* dup;
+ dup = g_new0 (ActivePlaylistContainer, 1);
+ active_playlist_container_copy (self, dup);
+ return dup;
+}
+
+
+void active_playlist_container_free (ActivePlaylistContainer* self) {
+ active_playlist_container_destroy (self);
+ g_free (self);
+}
+
+
+GType active_playlist_container_get_type (void) {
+ static volatile gsize active_playlist_container_type_id__volatile = 0;
+ if (g_once_init_enter (&active_playlist_container_type_id__volatile)) {
+ GType active_playlist_container_type_id;
+ active_playlist_container_type_id = g_boxed_type_register_static ("ActivePlaylistContainer", (GBoxedCopyFunc) active_playlist_container_dup, (GBoxedFreeFunc) active_playlist_container_free);
+ g_once_init_leave (&active_playlist_container_type_id__volatile, active_playlist_container_type_id);
+ }
+ return active_playlist_container_type_id__volatile;
+}
+
+
+void mpris_playlists_ActivatePlaylist (MprisPlaylists* self, const char* playlist_id, GAsyncReadyCallback _callback_, gpointer _user_data_) {
+ MPRIS_PLAYLISTS_GET_INTERFACE (self)->ActivatePlaylist (self, playlist_id, _callback_, _user_data_);
+}
+
+
+void mpris_playlists_ActivatePlaylist_finish (MprisPlaylists* self, GAsyncResult* _res_, GError** error) {
+ MPRIS_PLAYLISTS_GET_INTERFACE (self)->ActivatePlaylist_finish (self, _res_, error);
+}
+
+
+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);
+}
+
+
+gchar** mpris_playlists_get_Orderings (MprisPlaylists* self, int* result_length1) {
+ return MPRIS_PLAYLISTS_GET_INTERFACE (self)->get_Orderings (self, result_length1);
+}
+
+
+void mpris_playlists_set_Orderings (MprisPlaylists* self, gchar** value, int value_length1) {
+ MPRIS_PLAYLISTS_GET_INTERFACE (self)->set_Orderings (self, value, value_length1);
+}
+
+
+guint32 mpris_playlists_get_PlaylistCount (MprisPlaylists* self) {
+ return MPRIS_PLAYLISTS_GET_INTERFACE (self)->get_PlaylistCount (self);
+}
+
+
+void mpris_playlists_set_PlaylistCount (MprisPlaylists* self, guint32 value) {
+ MPRIS_PLAYLISTS_GET_INTERFACE (self)->set_PlaylistCount (self, value);
+}
+
+
+void mpris_playlists_get_ActivePlaylist (MprisPlaylists* self, ActivePlaylistContainer* result) {
+ MPRIS_PLAYLISTS_GET_INTERFACE (self)->get_ActivePlaylist (self, result);
+}
+
+
+void mpris_playlists_set_ActivePlaylist (MprisPlaylists* self, ActivePlaylistContainer* value) {
+ MPRIS_PLAYLISTS_GET_INTERFACE (self)->set_ActivePlaylist (self, value);
+}
+
+
+static void mpris_playlists_base_init (MprisPlaylistsIface * iface) {
+ static gboolean initialized = FALSE;
+ if (!initialized) {
+ initialized = TRUE;
+ g_object_interface_install_property (iface, g_param_spec_boxed ("Orderings", "Orderings", "Orderings", G_TYPE_STRV, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
+ g_object_interface_install_property (iface, g_param_spec_uint ("PlaylistCount", "PlaylistCount", "PlaylistCount", 0, G_MAXUINT, 0U, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
+ g_object_interface_install_property (iface, g_param_spec_boxed ("ActivePlaylist", "ActivePlaylist", "ActivePlaylist", TYPE_ACTIVE_PLAYLIST_CONTAINER, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
+ g_type_set_qdata (TYPE_MPRIS_PLAYLISTS, g_quark_from_static_string ("vala-dbus-register-object"), (void*) mpris_playlists_register_object);
+ }
+}
+
+
+GType mpris_playlists_get_type (void) {
+ static volatile gsize mpris_playlists_type_id__volatile = 0;
+ if (g_once_init_enter (&mpris_playlists_type_id__volatile)) {
+ static const GTypeInfo g_define_type_info = { sizeof (MprisPlaylistsIface), (GBaseInitFunc) mpris_playlists_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
+ GType mpris_playlists_type_id;
+ mpris_playlists_type_id = g_type_register_static (G_TYPE_INTERFACE, "MprisPlaylists", &g_define_type_info, 0);
+ g_type_interface_add_prerequisite (mpris_playlists_type_id, G_TYPE_OBJECT);
+ g_once_init_leave (&mpris_playlists_type_id__volatile, mpris_playlists_type_id);
+ }
+ return mpris_playlists_type_id__volatile;
+}
+
+
+G_DEFINE_TYPE_EXTENDED (MprisPlaylistsProxy, mpris_playlists_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_MPRIS_PLAYLISTS, mpris_playlists_proxy_mpris_playlists_interface_init) );
+static void mpris_playlists_proxy_class_init (MprisPlaylistsProxyClass* klass) {
+ G_DBUS_PROXY_CLASS (klass)->g_signal = mpris_playlists_proxy_g_signal;
+}
+
+
+static void mpris_playlists_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters) {
+}
+
+
+static void mpris_playlists_proxy_init (MprisPlaylistsProxy* self) {
+}
+
+
+static void mpris_playlists_proxy_ActivatePlaylist_async (MprisPlaylists* self, const char* playlist_id, GAsyncReadyCallback _callback_, gpointer _user_data_) {
+ GDBusMessage *_message;
+ GVariant *_arguments;
+ GVariantBuilder _arguments_builder;
+ G_IO_ERROR;
+ _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.mpris.MediaPlayer2.Playlists", "ActivatePlaylist");
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_object_path (playlist_id));
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ g_dbus_message_set_body (_message, _arguments);
+ g_dbus_connection_send_message_with_reply (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, _vala_g_async_ready_callback, g_simple_async_result_new ((GObject *) self, _callback_, _user_data_, NULL));
+ g_object_unref (_message);
+}
+
+
+static void mpris_playlists_proxy_ActivatePlaylist_finish (MprisPlaylists* self, GAsyncResult* _res_, GError** error) {
+ GDBusMessage *_reply_message;
+ _reply_message = g_dbus_connection_send_message_with_reply_finish (g_dbus_proxy_get_connection ((GDBusProxy *) self), g_simple_async_result_get_op_res_gpointer ((GSimpleAsyncResult *) _res_), error);
+ if (!_reply_message) {
+ return;
+ }
+ if (g_dbus_message_to_gerror (_reply_message, error)) {
+ g_object_unref (_reply_message);
+ return;
+ }
+ g_object_unref (_reply_message);
+}
+
+
+static PlaylistDetails* mpris_playlists_proxy_GetPlaylists (MprisPlaylists* self, guint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, int* result_length1, GError** error) {
+ GDBusMessage *_message;
+ GVariant *_arguments;
+ GVariantBuilder _arguments_builder;
+ GDBusMessage *_reply_message;
+ GVariant *_reply;
+ GVariantIter _reply_iter;
+ PlaylistDetails* _result;
+ int _result_length1;
+ GVariant* _tmp17_;
+ PlaylistDetails* _tmp18_;
+ int _tmp18__length;
+ int _tmp18__size;
+ int _tmp18__length1;
+ GVariantIter _tmp19_;
+ GVariant* _tmp20_;
+ G_IO_ERROR;
+ _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.mpris.MediaPlayer2.Playlists", "GetPlaylists");
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_uint32 (index));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_uint32 (max_count));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (order));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_boolean (reverse_order));
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ g_dbus_message_set_body (_message, _arguments);
+ _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);
+ _result_length1 = 0;
+ _tmp17_ = g_variant_iter_next_value (&_reply_iter);
+ _tmp18_ = g_new (PlaylistDetails, 5);
+ _tmp18__length = 0;
+ _tmp18__size = 4;
+ _tmp18__length1 = 0;
+ g_variant_iter_init (&_tmp19_, _tmp17_);
+ for (; (_tmp20_ = g_variant_iter_next_value (&_tmp19_)) != NULL; _tmp18__length1++) {
+ PlaylistDetails _tmp21_;
+ GVariantIter _tmp22_;
+ GVariant* _tmp23_;
+ GVariant* _tmp24_;
+ GVariant* _tmp25_;
+ if (_tmp18__size == _tmp18__length) {
+ _tmp18__size = 2 * _tmp18__size;
+ _tmp18_ = g_renew (PlaylistDetails, _tmp18_, _tmp18__size + 1);
+ }
+ g_variant_iter_init (&_tmp22_, _tmp20_);
+ _tmp23_ = g_variant_iter_next_value (&_tmp22_);
+ _tmp21_.path = g_variant_dup_string (_tmp23_, NULL);
+ g_variant_unref (_tmp23_);
+ _tmp24_ = g_variant_iter_next_value (&_tmp22_);
+ _tmp21_.name = g_variant_dup_string (_tmp24_, NULL);
+ g_variant_unref (_tmp24_);
+ _tmp25_ = g_variant_iter_next_value (&_tmp22_);
+ _tmp21_.icon_path = g_variant_dup_string (_tmp25_, NULL);
+ g_variant_unref (_tmp25_);
+ _tmp18_[_tmp18__length++] = _tmp21_;
+ g_variant_unref (_tmp20_);
+ }
+ _result_length1 = _tmp18__length1;
+ _result = _tmp18_;
+ g_variant_unref (_tmp17_);
+ *result_length1 = _result_length1;
+ g_object_unref (_reply_message);
+ return _result;
+}
+
+
+static gchar** mpris_playlists_dbus_proxy_get_Orderings (MprisPlaylists* self, int* result_length1) {
+ GVariant *_inner_reply;
+ gchar** _result;
+ int _result_length1;
+ gchar** _tmp26_;
+ int _tmp26__length;
+ int _tmp26__size;
+ int _tmp26__length1;
+ GVariantIter _tmp27_;
+ GVariant* _tmp28_;
+ _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "Orderings");
+ if (!_inner_reply) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2.Playlists"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("Orderings"));
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return NULL;
+ }
+ g_variant_get (_reply, "(v)", &_inner_reply);
+ g_variant_unref (_reply);
+ }
+ _result_length1 = 0;
+ _tmp26_ = g_new (gchar*, 5);
+ _tmp26__length = 0;
+ _tmp26__size = 4;
+ _tmp26__length1 = 0;
+ g_variant_iter_init (&_tmp27_, _inner_reply);
+ 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);
+ }
+ _tmp26_[_tmp26__length++] = g_variant_dup_string (_tmp28_, NULL);
+ g_variant_unref (_tmp28_);
+ }
+ _result_length1 = _tmp26__length1;
+ _tmp26_[_tmp26__length] = NULL;
+ _result = _tmp26_;
+ *result_length1 = _result_length1;
+ g_variant_unref (_inner_reply);
+ return _result;
+}
+
+
+static void mpris_playlists_dbus_proxy_set_Orderings (MprisPlaylists* self, gchar** value, int value_length1) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ gchar** _tmp29_;
+ GVariantBuilder _tmp30_;
+ int _tmp31_;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2.Playlists"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("Orderings"));
+ g_variant_builder_open (&_arguments_builder, G_VARIANT_TYPE_VARIANT);
+ _tmp29_ = value;
+ g_variant_builder_init (&_tmp30_, G_VARIANT_TYPE ("as"));
+ for (_tmp31_ = 0; _tmp31_ < value_length1; _tmp31_++) {
+ g_variant_builder_add_value (&_tmp30_, g_variant_new_string (*_tmp29_));
+ _tmp29_++;
+ }
+ g_variant_builder_add_value (&_arguments_builder, g_variant_builder_end (&_tmp30_));
+ g_variant_builder_close (&_arguments_builder);
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Set", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return;
+ }
+ g_variant_unref (_reply);
+}
+
+
+static guint32 mpris_playlists_dbus_proxy_get_PlaylistCount (MprisPlaylists* self) {
+ GVariant *_inner_reply;
+ guint32 _result;
+ _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "PlaylistCount");
+ if (!_inner_reply) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2.Playlists"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("PlaylistCount"));
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return 0U;
+ }
+ g_variant_get (_reply, "(v)", &_inner_reply);
+ g_variant_unref (_reply);
+ }
+ _result = g_variant_get_uint32 (_inner_reply);
+ g_variant_unref (_inner_reply);
+ return _result;
+}
+
+
+static void mpris_playlists_dbus_proxy_set_PlaylistCount (MprisPlaylists* self, guint32 value) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2.Playlists"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("PlaylistCount"));
+ g_variant_builder_open (&_arguments_builder, G_VARIANT_TYPE_VARIANT);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_uint32 (value));
+ g_variant_builder_close (&_arguments_builder);
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Set", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return;
+ }
+ g_variant_unref (_reply);
+}
+
+
+static void mpris_playlists_dbus_proxy_get_ActivePlaylist (MprisPlaylists* self, ActivePlaylistContainer* result) {
+ GVariant *_inner_reply;
+ ActivePlaylistContainer _tmp32_;
+ GVariantIter _tmp33_;
+ GVariant* _tmp34_;
+ GVariant* _tmp35_;
+ PlaylistDetails _tmp36_;
+ GVariantIter _tmp37_;
+ GVariant* _tmp38_;
+ GVariant* _tmp39_;
+ GVariant* _tmp40_;
+ _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "ActivePlaylist");
+ if (!_inner_reply) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2.Playlists"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("ActivePlaylist"));
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return;
+ }
+ g_variant_get (_reply, "(v)", &_inner_reply);
+ g_variant_unref (_reply);
+ }
+ g_variant_iter_init (&_tmp33_, _inner_reply);
+ _tmp34_ = g_variant_iter_next_value (&_tmp33_);
+ _tmp32_.valid = g_variant_get_boolean (_tmp34_);
+ g_variant_unref (_tmp34_);
+ _tmp35_ = g_variant_iter_next_value (&_tmp33_);
+ g_variant_iter_init (&_tmp37_, _tmp35_);
+ _tmp38_ = g_variant_iter_next_value (&_tmp37_);
+ _tmp36_.path = g_variant_dup_string (_tmp38_, NULL);
+ g_variant_unref (_tmp38_);
+ _tmp39_ = g_variant_iter_next_value (&_tmp37_);
+ _tmp36_.name = g_variant_dup_string (_tmp39_, NULL);
+ g_variant_unref (_tmp39_);
+ _tmp40_ = g_variant_iter_next_value (&_tmp37_);
+ _tmp36_.icon_path = g_variant_dup_string (_tmp40_, NULL);
+ g_variant_unref (_tmp40_);
+ _tmp32_.details = _tmp36_;
+ g_variant_unref (_tmp35_);
+ *result = _tmp32_;
+ g_variant_unref (_inner_reply);
+ return;
+}
+
+
+static void mpris_playlists_dbus_proxy_set_ActivePlaylist (MprisPlaylists* self, ActivePlaylistContainer* value) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ GVariantBuilder _tmp41_;
+ GVariantBuilder _tmp42_;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2.Playlists"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("ActivePlaylist"));
+ g_variant_builder_open (&_arguments_builder, G_VARIANT_TYPE_VARIANT);
+ g_variant_builder_init (&_tmp41_, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_tmp41_, g_variant_new_boolean ((*value).valid));
+ g_variant_builder_init (&_tmp42_, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_tmp42_, g_variant_new_object_path ((*value).details.path));
+ g_variant_builder_add_value (&_tmp42_, g_variant_new_string ((*value).details.name));
+ g_variant_builder_add_value (&_tmp42_, g_variant_new_string ((*value).details.icon_path));
+ g_variant_builder_add_value (&_tmp41_, g_variant_builder_end (&_tmp42_));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_builder_end (&_tmp41_));
+ g_variant_builder_close (&_arguments_builder);
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Set", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return;
+ }
+ g_variant_unref (_reply);
+}
+
+
+static void mpris_playlists_proxy_mpris_playlists_interface_init (MprisPlaylistsIface* iface) {
+ iface->ActivatePlaylist = mpris_playlists_proxy_ActivatePlaylist_async;
+ iface->ActivatePlaylist_finish = mpris_playlists_proxy_ActivatePlaylist_finish;
+ iface->GetPlaylists = mpris_playlists_proxy_GetPlaylists;
+ iface->get_Orderings = mpris_playlists_dbus_proxy_get_Orderings;
+ iface->set_Orderings = mpris_playlists_dbus_proxy_set_Orderings;
+ iface->get_PlaylistCount = mpris_playlists_dbus_proxy_get_PlaylistCount;
+ iface->set_PlaylistCount = mpris_playlists_dbus_proxy_set_PlaylistCount;
+ iface->get_ActivePlaylist = mpris_playlists_dbus_proxy_get_ActivePlaylist;
+ iface->set_ActivePlaylist = mpris_playlists_dbus_proxy_set_ActivePlaylist;
+}
+
+
+static void _dbus_mpris_playlists_ActivatePlaylist (MprisPlaylists* self, GVariant* parameters, GDBusMethodInvocation* invocation) {
+ GVariantIter _arguments_iter;
+ char* playlist_id = NULL;
+ GVariant* _tmp43_;
+ g_variant_iter_init (&_arguments_iter, parameters);
+ _tmp43_ = g_variant_iter_next_value (&_arguments_iter);
+ playlist_id = g_variant_dup_string (_tmp43_, NULL);
+ g_variant_unref (_tmp43_);
+ mpris_playlists_ActivatePlaylist (self, playlist_id, (GAsyncReadyCallback) _dbus_mpris_playlists_ActivatePlaylist_ready, g_object_ref (invocation));
+ _g_free0 (playlist_id);
+}
+
+
+static void _dbus_mpris_playlists_ActivatePlaylist_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_) {
+ GDBusMethodInvocation * invocation;
+ GError* error;
+ GDBusMessage* _reply_message;
+ GVariant* _reply;
+ GVariantBuilder _reply_builder;
+ invocation = _user_data_;
+ error = NULL;
+ mpris_playlists_ActivatePlaylist_finish ((MprisPlaylists*) source_object, _res_, &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);
+ _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 _vala_PlaylistDetails_array_free (PlaylistDetails* array, gint array_length) {
+ if (array != NULL) {
+ int i;
+ for (i = 0; i < array_length; i = i + 1) {
+ playlist_details_destroy (&array[i]);
+ }
+ }
+ g_free (array);
+}
+
+
+static void _dbus_mpris_playlists_GetPlaylists (MprisPlaylists* self, GVariant* parameters, GDBusMethodInvocation* invocation) {
+ GError* error;
+ GVariantIter _arguments_iter;
+ guint32 index = 0U;
+ GVariant* _tmp44_;
+ guint32 max_count = 0U;
+ GVariant* _tmp45_;
+ gchar* order = NULL;
+ GVariant* _tmp46_;
+ gboolean reverse_order = FALSE;
+ GVariant* _tmp47_;
+ GDBusMessage* _reply_message;
+ GVariant* _reply;
+ GVariantBuilder _reply_builder;
+ PlaylistDetails* result;
+ int result_length1 = 0;
+ PlaylistDetails* _tmp48_;
+ GVariantBuilder _tmp49_;
+ int _tmp50_;
+ error = NULL;
+ g_variant_iter_init (&_arguments_iter, parameters);
+ _tmp44_ = g_variant_iter_next_value (&_arguments_iter);
+ index = g_variant_get_uint32 (_tmp44_);
+ g_variant_unref (_tmp44_);
+ _tmp45_ = g_variant_iter_next_value (&_arguments_iter);
+ max_count = g_variant_get_uint32 (_tmp45_);
+ g_variant_unref (_tmp45_);
+ _tmp46_ = g_variant_iter_next_value (&_arguments_iter);
+ order = g_variant_dup_string (_tmp46_, NULL);
+ g_variant_unref (_tmp46_);
+ _tmp47_ = g_variant_iter_next_value (&_arguments_iter);
+ reverse_order = g_variant_get_boolean (_tmp47_);
+ g_variant_unref (_tmp47_);
+ result = mpris_playlists_GetPlaylists (self, index, max_count, order, reverse_order, &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);
+ _tmp48_ = result;
+ g_variant_builder_init (&_tmp49_, G_VARIANT_TYPE ("a(oss)"));
+ for (_tmp50_ = 0; _tmp50_ < result_length1; _tmp50_++) {
+ GVariantBuilder _tmp51_;
+ g_variant_builder_init (&_tmp51_, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_tmp51_, g_variant_new_object_path ((*_tmp48_).path));
+ g_variant_builder_add_value (&_tmp51_, g_variant_new_string ((*_tmp48_).name));
+ g_variant_builder_add_value (&_tmp51_, g_variant_new_string ((*_tmp48_).icon_path));
+ g_variant_builder_add_value (&_tmp49_, g_variant_builder_end (&_tmp51_));
+ _tmp48_++;
+ }
+ g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp49_));
+ result = (_vala_PlaylistDetails_array_free (result, result_length1), NULL);
+ _reply = g_variant_builder_end (&_reply_builder);
+ g_dbus_message_set_body (_reply_message, _reply);
+ _g_free0 (order);
+ 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 mpris_playlists_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data) {
+ gpointer* data;
+ gpointer object;
+ data = user_data;
+ object = data[0];
+ if (strcmp (method_name, "ActivatePlaylist") == 0) {
+ _dbus_mpris_playlists_ActivatePlaylist (object, parameters, invocation);
+ } else if (strcmp (method_name, "GetPlaylists") == 0) {
+ _dbus_mpris_playlists_GetPlaylists (object, parameters, invocation);
+ }
+ g_object_unref (invocation);
+}
+
+
+static GVariant* _dbus_mpris_playlists_get_Orderings (MprisPlaylists* self) {
+ gchar** result;
+ int result_length1;
+ gchar** _tmp52_;
+ GVariantBuilder _tmp53_;
+ int _tmp54_;
+ GVariant* _reply;
+ result = mpris_playlists_get_Orderings (self, &result_length1);
+ _tmp52_ = result;
+ g_variant_builder_init (&_tmp53_, G_VARIANT_TYPE ("as"));
+ for (_tmp54_ = 0; _tmp54_ < result_length1; _tmp54_++) {
+ g_variant_builder_add_value (&_tmp53_, g_variant_new_string (*_tmp52_));
+ _tmp52_++;
+ }
+ _reply = g_variant_builder_end (&_tmp53_);
+ result = (_vala_array_free (result, result_length1, (GDestroyNotify) g_free), NULL);
+ return _reply;
+}
+
+
+static GVariant* _dbus_mpris_playlists_get_PlaylistCount (MprisPlaylists* self) {
+ guint32 result;
+ GVariant* _reply;
+ result = mpris_playlists_get_PlaylistCount (self);
+ _reply = g_variant_new_uint32 (result);
+ return _reply;
+}
+
+
+static GVariant* _dbus_mpris_playlists_get_ActivePlaylist (MprisPlaylists* self) {
+ ActivePlaylistContainer result = {0};
+ GVariantBuilder _tmp55_;
+ GVariantBuilder _tmp56_;
+ GVariant* _reply;
+ mpris_playlists_get_ActivePlaylist (self, &result);
+ g_variant_builder_init (&_tmp55_, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_tmp55_, g_variant_new_boolean (result.valid));
+ g_variant_builder_init (&_tmp56_, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_tmp56_, g_variant_new_object_path (result.details.path));
+ g_variant_builder_add_value (&_tmp56_, g_variant_new_string (result.details.name));
+ g_variant_builder_add_value (&_tmp56_, g_variant_new_string (result.details.icon_path));
+ g_variant_builder_add_value (&_tmp55_, g_variant_builder_end (&_tmp56_));
+ _reply = g_variant_builder_end (&_tmp55_);
+ active_playlist_container_destroy (&result);
+ return _reply;
+}
+
+
+static GVariant* mpris_playlists_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data) {
+ gpointer* data;
+ gpointer object;
+ data = user_data;
+ object = data[0];
+ if (strcmp (property_name, "Orderings") == 0) {
+ return _dbus_mpris_playlists_get_Orderings (object);
+ } else if (strcmp (property_name, "PlaylistCount") == 0) {
+ return _dbus_mpris_playlists_get_PlaylistCount (object);
+ } else if (strcmp (property_name, "ActivePlaylist") == 0) {
+ return _dbus_mpris_playlists_get_ActivePlaylist (object);
+ }
+ return NULL;
+}
+
+
+static void _dbus_mpris_playlists_set_Orderings (MprisPlaylists* self, GVariant* _value) {
+ gchar** value = NULL;
+ int value_length1;
+ gchar** _tmp57_;
+ int _tmp57__length;
+ int _tmp57__size;
+ int _tmp57__length1;
+ GVariantIter _tmp58_;
+ GVariant* _tmp59_;
+ _tmp57_ = g_new (gchar*, 5);
+ _tmp57__length = 0;
+ _tmp57__size = 4;
+ _tmp57__length1 = 0;
+ g_variant_iter_init (&_tmp58_, _value);
+ 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);
+ }
+ _tmp57_[_tmp57__length++] = g_variant_dup_string (_tmp59_, NULL);
+ g_variant_unref (_tmp59_);
+ }
+ value_length1 = _tmp57__length1;
+ _tmp57_[_tmp57__length] = NULL;
+ value = _tmp57_;
+ mpris_playlists_set_Orderings (self, value, value_length1);
+ value = (_vala_array_free (value, value_length1, (GDestroyNotify) g_free), NULL);
+}
+
+
+static void _dbus_mpris_playlists_set_PlaylistCount (MprisPlaylists* self, GVariant* _value) {
+ guint32 value = 0U;
+ value = g_variant_get_uint32 (_value);
+ mpris_playlists_set_PlaylistCount (self, value);
+}
+
+
+static void _dbus_mpris_playlists_set_ActivePlaylist (MprisPlaylists* self, GVariant* _value) {
+ ActivePlaylistContainer value = {0};
+ ActivePlaylistContainer _tmp60_;
+ GVariantIter _tmp61_;
+ GVariant* _tmp62_;
+ GVariant* _tmp63_;
+ PlaylistDetails _tmp64_;
+ GVariantIter _tmp65_;
+ GVariant* _tmp66_;
+ GVariant* _tmp67_;
+ GVariant* _tmp68_;
+ g_variant_iter_init (&_tmp61_, _value);
+ _tmp62_ = g_variant_iter_next_value (&_tmp61_);
+ _tmp60_.valid = g_variant_get_boolean (_tmp62_);
+ g_variant_unref (_tmp62_);
+ _tmp63_ = g_variant_iter_next_value (&_tmp61_);
+ g_variant_iter_init (&_tmp65_, _tmp63_);
+ _tmp66_ = g_variant_iter_next_value (&_tmp65_);
+ _tmp64_.path = g_variant_dup_string (_tmp66_, NULL);
+ g_variant_unref (_tmp66_);
+ _tmp67_ = g_variant_iter_next_value (&_tmp65_);
+ _tmp64_.name = g_variant_dup_string (_tmp67_, NULL);
+ g_variant_unref (_tmp67_);
+ _tmp68_ = g_variant_iter_next_value (&_tmp65_);
+ _tmp64_.icon_path = g_variant_dup_string (_tmp68_, NULL);
+ g_variant_unref (_tmp68_);
+ _tmp60_.details = _tmp64_;
+ g_variant_unref (_tmp63_);
+ value = _tmp60_;
+ mpris_playlists_set_ActivePlaylist (self, &value);
+ active_playlist_container_destroy (&value);
+}
+
+
+static gboolean mpris_playlists_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data) {
+ gpointer* data;
+ gpointer object;
+ data = user_data;
+ object = data[0];
+ if (strcmp (property_name, "Orderings") == 0) {
+ _dbus_mpris_playlists_set_Orderings (object, value);
+ return TRUE;
+ } else if (strcmp (property_name, "PlaylistCount") == 0) {
+ _dbus_mpris_playlists_set_PlaylistCount (object, value);
+ return TRUE;
+ } else if (strcmp (property_name, "ActivePlaylist") == 0) {
+ _dbus_mpris_playlists_set_ActivePlaylist (object, value);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+guint mpris_playlists_register_object (gpointer object, GDBusConnection* connection, const gchar* path, GError** error) {
+ guint result;
+ gpointer *data;
+ data = g_new (gpointer, 3);
+ data[0] = g_object_ref (object);
+ data[1] = g_object_ref (connection);
+ data[2] = g_strdup (path);
+ result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) (&_mpris_playlists_dbus_interface_info), &_mpris_playlists_dbus_interface_vtable, data, _mpris_playlists_unregister_object, error);
+ if (!result) {
+ return 0;
+ }
+ return result;
+}
+
+
+static void _mpris_playlists_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 _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/mpris2-interfaces.vala b/src/mpris2-interfaces.vala
index ebea135..9d0b8c9 100644
--- a/src/mpris2-interfaces.vala
+++ b/src/mpris2-interfaces.vala
@@ -1,6 +1,5 @@
/*
Copyright 2010 Canonical Ltd.
-
Authors:
Conor Curran <conor.curran@canonical.com>
@@ -17,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 {
@@ -25,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;
@@ -44,3 +45,31 @@ public interface MprisPlayer : Object {
// signals
public signal void Seeked(int64 new_position);
}
+
+// Playlist container
+public struct PlaylistDetails{
+ public ObjectPath path;
+ public string name;
+ public string icon_path;
+}
+
+// Active playlist property container
+public struct ActivePlaylistContainer{
+ public bool valid;
+ public PlaylistDetails details;
+}
+
+[DBus (name = "org.mpris.MediaPlayer2.Playlists")]
+public interface MprisPlaylists : Object {
+ //properties
+ public abstract string[] Orderings{owned get; set;}
+ public abstract uint32 PlaylistCount{owned get; set;}
+ public abstract ActivePlaylistContainer ActivePlaylist {owned get; set;}
+
+ //methods
+ public abstract async void ActivatePlaylist(ObjectPath playlist_id) throws IOError;
+ public abstract PlaylistDetails[] GetPlaylists ( uint32 index,
+ uint32 max_count,
+ string order,
+ bool reverse_order ) throws IOError;
+} \ No newline at end of file
diff --git a/src/mpris2-watcher.c b/src/mpris2-watcher.c
index f6b5805..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* _tmp17_;
- gchar* old_owner = NULL;
- GVariant* _tmp18_;
- gchar* new_owner = NULL;
- GVariant* _tmp19_;
- g_variant_iter_init (&_arguments_iter, parameters);
- _tmp17_ = g_variant_iter_next_value (&_arguments_iter);
- name = g_variant_dup_string (_tmp17_, NULL);
- g_variant_unref (_tmp17_);
- _tmp18_ = g_variant_iter_next_value (&_arguments_iter);
- old_owner = g_variant_dup_string (_tmp18_, NULL);
- g_variant_unref (_tmp18_);
- _tmp19_ = g_variant_iter_next_value (&_arguments_iter);
- new_owner = g_variant_dup_string (_tmp19_, NULL);
- g_variant_unref (_tmp19_);
- 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* _tmp20_;
- gchar** _tmp21_;
- int _tmp21__length;
- int _tmp21__size;
- int _tmp21__length1;
- GVariantIter _tmp22_;
- GVariant* _tmp23_;
- _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;
- _tmp20_ = g_variant_iter_next_value (&_reply_iter);
- _tmp21_ = g_new (gchar*, 5);
- _tmp21__length = 0;
- _tmp21__size = 4;
- _tmp21__length1 = 0;
- g_variant_iter_init (&_tmp22_, _tmp20_);
- for (; _tmp23_ = g_variant_iter_next_value (&_tmp22_); _tmp21__length1++) {
- if (_tmp21__size == _tmp21__length) {
- _tmp21__size = 2 * _tmp21__size;
- _tmp21_ = g_renew (gchar*, _tmp21_, _tmp21__size + 1);
- }
- _tmp21_[_tmp21__length++] = g_variant_dup_string (_tmp23_, NULL);
- g_variant_unref (_tmp23_);
- }
- _result_length1 = _tmp21__length1;
- _tmp21_[_tmp21__length] = NULL;
- _result = _tmp21_;
- g_variant_unref (_tmp20_);
- *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** _tmp24_;
- GVariantBuilder _tmp25_;
- int _tmp26_;
- 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);
- _tmp24_ = result;
- g_variant_builder_init (&_tmp25_, G_VARIANT_TYPE ("as"));
- for (_tmp26_ = 0; _tmp26_ < result_length1; _tmp26_++) {
- g_variant_builder_add_value (&_tmp25_, g_variant_new_string (*_tmp24_));
- _tmp24_++;
- }
- g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp25_));
- 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 7814975..c20b04b 100644
--- a/src/mpris2-watcher.vala
+++ b/src/mpris2-watcher.vala
@@ -17,30 +17,21 @@ 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 );
-}
+using Xml;
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;
- public signal void client_appeared ( string desktop_file_name, string dbus_name );
+ public signal void client_appeared ( string desktop_file_name,
+ string dbus_name,
+ bool use_playlists );
public signal void client_disappeared ( string dbus_name );
public Mpris2Watcher ()
{
}
-
+
construct
{
try {
@@ -57,6 +48,29 @@ public class Mpris2Watcher : GLib.Object
}
}
+ // At startup check to see if there are clients up that we are interested in
+ // More relevant for development and daemon's like mpd.
+ private async void check_for_active_clients()
+ {
+ string[] interfaces;
+ try{
+ interfaces = yield this.fdesktop_obj.list_names();
+ }
+ catch ( IOError e) {
+ warning( "Mpris2watcher could fetch active interfaces at startup: %s",
+ e.message );
+ return;
+ }
+ foreach (var address in interfaces) {
+ if (address.has_prefix (MPRIS_PREFIX)){
+ MprisRoot? mpris2_root = this.create_mpris_root(address);
+ if (mpris2_root == null) return;
+ bool use_playlists = this.supports_playlists ( address );
+ client_appeared (mpris2_root.DesktopEntry, address, use_playlists);
+ }
+ }
+ }
+
private void name_changes_detected ( FreeDesktopObject dbus_obj,
string name,
string previous_owner,
@@ -65,24 +79,25 @@ public class Mpris2Watcher : GLib.Object
MprisRoot? mpris2_root = this.create_mpris_root(name);
if (mpris2_root == null) return;
-
+
if (previous_owner != "" && current_owner == "") {
debug ("Client '%s' gone down", name);
client_disappeared (name);
}
else if (previous_owner == "" && current_owner != "") {
debug ("Client '%s' has appeared", name);
- client_appeared (mpris2_root.DesktopEntry, name);
+ bool use_playlists = this.supports_playlists ( name );
+ client_appeared (mpris2_root.DesktopEntry, name, use_playlists);
}
}
- private MprisRoot? create_mpris_root(string name){
+ private MprisRoot? create_mpris_root ( string name ){
MprisRoot mpris2_root = null;
if ( name.has_prefix (MPRIS_PREFIX) ){
try {
mpris2_root = Bus.get_proxy_sync ( BusType.SESSION,
- name,
- MPRIS_MEDIA_PLAYER_PATH );
+ name,
+ MPRIS_MEDIA_PLAYER_PATH );
}
catch (IOError e){
warning( "Mpris2watcher could not create a root interface: %s",
@@ -91,26 +106,66 @@ public class Mpris2Watcher : GLib.Object
}
return mpris2_root;
}
-
- // At startup check to see if there are clients up that we are interested in
- // More relevant for development and daemon's like mpd.
- private async void check_for_active_clients()
+
+ private bool supports_playlists ( string name )
{
- string[] interfaces;
- try{
- interfaces = yield this.fdesktop_obj.list_names();
+ FreeDesktopIntrospectable introspectable;
+
+ try {
+ /* The dbusproxy flag parameter is needed to ensure Banshee does not
+ blow up. I suspect the issue is that if you
+ try to instantiate a dbus object which does not have any properties
+ associated with it, gdbus will attempt to fetch the properties (this is
+ in the documentation) but the banshee mpris dbus object more than likely
+ causes a crash because it doesn't check for the presence of properties
+ before attempting to access them.
+ */
+ 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);
}
- catch ( IOError e) {
- warning( "Mpris2watcher could fetch active interfaces at startup: %s",
+ catch (IOError e){
+ warning( "Could not create an introspectable object: %s",
e.message );
- return;
}
- foreach (var address in interfaces) {
- if (address.has_prefix (MPRIS_PREFIX)){
- MprisRoot? mpris2_root = this.create_mpris_root(address);
- if (mpris2_root == null) return;
- client_appeared (mpris2_root.DesktopEntry, address);
+ return false;
+ }
+
+ private bool parse_interfaces( string interface_info )
+ {
+ //parse the document from path
+ bool result = false;
+ Xml.Doc* xml_doc = Parser.parse_doc (interface_info);
+ if (xml_doc == null) {
+ warning ("Mpris2Watcher - parse-interfaces - failed to instantiate xml doc");
+ return false;
+ }
+ //get the root node. notice the dereferencing operator -> instead of .
+ Xml.Node* root_node = xml_doc->get_root_element ();
+ if (root_node == null) {
+ //free the document manually before throwing because the garbage collector can't work on pointers
+ delete xml_doc;
+ warning ("Mpris2Watcher - the interface info xml is empty");
+ return false;
+ }
+
+ //let's parse those nodes
+ for (Xml.Node* iter = root_node->children; iter != null; iter = iter->next) {
+ //spaces btw. tags are also nodes, discard them
+ if (iter->type != ElementType.ELEMENT_NODE){
+ continue;
+ }
+ Xml.Attr* attributes = iter->properties; //get the node's name
+ string interface_name = attributes->children->content;
+ debug ( "this dbus object has interface %s ", interface_name );
+ if ( interface_name == MPRIS_PREFIX.concat("Playlists")){
+ result = true;
}
}
- }
+ delete xml_doc;
+ return result;
+ }
} \ No newline at end of file
diff --git a/src/music-player-bridge.c b/src/music-player-bridge.c
index e397913..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)))
@@ -94,7 +115,6 @@ struct _MusicPlayerBridgePrivate {
DbusmenuMenuitem* root_menu;
GeeHashMap* registered_clients;
Mpris2Watcher* watcher;
- GSettings* settings;
};
typedef enum {
@@ -105,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;
@@ -116,22 +149,26 @@ GType mpris2_watcher_get_type (void) G_GNUC_CONST;
enum {
MUSIC_PLAYER_BRIDGE_DUMMY_PROPERTY
};
-#define MUSIC_PLAYER_BRIDGE_DESKTOP_PREFIX "/usr/share/applications/"
MusicPlayerBridge* music_player_bridge_new (void);
MusicPlayerBridge* music_player_bridge_construct (GType object_type);
static void music_player_bridge_on_blacklist_update (MusicPlayerBridge* self, gchar** blacklist, int blacklist_length1);
static void music_player_bridge_try_to_add_inactive_familiar_clients (MusicPlayerBridge* self);
-gchar** settings_manager_fetch_interested (SettingsManager* self, int* result_length1);
-static GAppInfo* music_player_bridge_create_app_info (const gchar* path);
-static gchar* music_player_bridge_determine_key (gchar* path);
-static gchar* music_player_bridge_fetch_icon_name (const gchar* desktop_path);
+GeeArrayList* settings_manager_fetch_interested (SettingsManager* self);
+static GAppInfo* music_player_bridge_create_app_info (const gchar* desktop);
+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);
-#define PLAYER_CONTROLLER_WIDGET_QUANTITY 4
-void music_player_bridge_client_has_become_available (MusicPlayerBridge* self, const gchar* desktop, const gchar* dbus_name);
-gboolean settings_manager_add_interested (SettingsManager* self, const gchar* app_desktop_name);
+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, 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);
@@ -165,75 +202,73 @@ MusicPlayerBridge* music_player_bridge_new (void) {
static void music_player_bridge_on_blacklist_update (MusicPlayerBridge* self, gchar** blacklist, int blacklist_length1) {
g_return_if_fail (self != NULL);
- g_debug ("music-player-bridge.vala:45: some blacklist update");
+ g_debug ("music-player-bridge.vala:43: some blacklist update");
}
static void music_player_bridge_try_to_add_inactive_familiar_clients (MusicPlayerBridge* self) {
- gint _tmp0_;
- gchar** _tmp1_ = NULL;
g_return_if_fail (self != NULL);
- _tmp1_ = settings_manager_fetch_interested (self->priv->settings_manager, &_tmp0_);
{
- gchar** desktop_collection;
- int desktop_collection_length1;
- int desktop_it;
- desktop_collection = _tmp1_;
- desktop_collection_length1 = _tmp0_;
- for (desktop_it = 0; desktop_it < _tmp0_; desktop_it = desktop_it + 1) {
- gchar* _tmp2_;
+ GeeArrayList* _tmp0_ = NULL;
+ GeeArrayList* _desktop_list;
+ gint _tmp1_;
+ gint _desktop_size;
+ gint _desktop_index;
+ _tmp0_ = settings_manager_fetch_interested (self->priv->settings_manager);
+ _desktop_list = _tmp0_;
+ _tmp1_ = gee_collection_get_size ((GeeCollection*) _desktop_list);
+ _desktop_size = _tmp1_;
+ _desktop_index = -1;
+ while (TRUE) {
+ gpointer _tmp2_ = NULL;
gchar* desktop;
- _tmp2_ = g_strdup (desktop_collection[desktop_it]);
- desktop = _tmp2_;
- {
- gchar* _tmp3_ = NULL;
- gchar* _tmp4_;
- gchar* _tmp5_ = NULL;
- gchar* _tmp6_;
- gchar* path;
- GAppInfo* _tmp7_ = NULL;
- GAppInfo* app_info;
- gchar* _tmp8_;
- gchar* _tmp9_ = NULL;
- gchar* mpris_key;
- gchar* _tmp10_ = NULL;
- gchar* _tmp11_;
- gint _tmp12_;
- PlayerController* _tmp13_ = NULL;
- PlayerController* _tmp14_;
- PlayerController* ctrl;
- g_debug ("music-player-bridge.vala:51: interested client found : %s", desktop);
- _tmp3_ = g_strconcat (desktop, ".desktop", NULL);
- _tmp4_ = _tmp3_;
- _tmp5_ = g_strconcat (MUSIC_PLAYER_BRIDGE_DESKTOP_PREFIX, _tmp4_, NULL);
- path = (_tmp6_ = _tmp5_, _g_free0 (_tmp4_), _tmp6_);
- _tmp7_ = music_player_bridge_create_app_info (path);
- app_info = _tmp7_;
- if (app_info == NULL) {
- g_warning ("music-player-bridge.vala:55: Could not create app_info for path %s \n" \
-" Getting out of here ", path);
- _g_object_unref0 (app_info);
- _g_free0 (path);
- _g_free0 (desktop);
- continue;
- }
- _tmp8_ = g_strdup (path);
- _tmp9_ = music_player_bridge_determine_key (_tmp8_);
- mpris_key = _tmp9_;
- _tmp10_ = music_player_bridge_fetch_icon_name (path);
- _tmp11_ = _tmp10_;
- _tmp12_ = music_player_bridge_calculate_menu_position (self);
- _tmp13_ = player_controller_new (self->priv->root_menu, app_info, NULL, _tmp11_, _tmp12_, PLAYER_CONTROLLER_STATE_OFFLINE);
- ctrl = (_tmp14_ = _tmp13_, _g_free0 (_tmp11_), _tmp14_);
- gee_abstract_map_set ((GeeAbstractMap*) self->priv->registered_clients, mpris_key, ctrl);
- _g_object_unref0 (ctrl);
- _g_free0 (mpris_key);
+ gchar* _tmp3_ = NULL;
+ gchar* _tmp4_;
+ GAppInfo* _tmp5_ = NULL;
+ GAppInfo* _tmp6_;
+ GAppInfo* app_info;
+ gchar* _tmp7_;
+ gchar* _tmp8_ = NULL;
+ gchar* mpris_key;
+ gchar* _tmp9_ = NULL;
+ gchar* _tmp10_;
+ gint _tmp11_;
+ PlayerController* _tmp12_ = NULL;
+ PlayerController* _tmp13_;
+ PlayerController* ctrl;
+ _desktop_index = _desktop_index + 1;
+ if (!(_desktop_index < _desktop_size)) {
+ break;
+ }
+ _tmp2_ = gee_abstract_list_get ((GeeAbstractList*) _desktop_list, _desktop_index);
+ desktop = (gchar*) _tmp2_;
+ g_debug ("music-player-bridge.vala:49: interested client found : %s", desktop);
+ _tmp3_ = g_strconcat (desktop, ".desktop", NULL);
+ _tmp4_ = _tmp3_;
+ _tmp5_ = music_player_bridge_create_app_info (_tmp4_);
+ app_info = (_tmp6_ = _tmp5_, _g_free0 (_tmp4_), _tmp6_);
+ if (app_info == NULL) {
+ g_warning ("music-player-bridge.vala:52: Could not create app_info for path %s \n" \
+" Getting out of here ", desktop);
_g_object_unref0 (app_info);
- _g_free0 (path);
_g_free0 (desktop);
+ continue;
}
+ _tmp7_ = g_strdup (desktop);
+ _tmp8_ = music_player_bridge_determine_key (_tmp7_);
+ mpris_key = _tmp8_;
+ _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_, 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);
+ _g_free0 (mpris_key);
+ _g_object_unref0 (app_info);
+ _g_free0 (desktop);
}
- desktop_collection = (_vala_array_free (desktop_collection, desktop_collection_length1, (GDestroyNotify) g_free), NULL);
+ _g_object_unref0 (_desktop_list);
}
}
@@ -255,19 +290,46 @@ static gint music_player_bridge_calculate_menu_position (MusicPlayerBridge* self
}
-void music_player_bridge_client_has_become_available (MusicPlayerBridge* self, const gchar* desktop, const gchar* dbus_name) {
+static gboolean _vala_string_array_contains (gchar** stack, int stack_length, gchar* needle) {
+ int i;
+ for (i = 0; i < stack_length; i++) {
+ if (g_strcmp0 (stack[i], needle) == 0) {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+
+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;
- gchar* _tmp1_ = NULL;
- gchar* _tmp2_;
- gchar* _tmp3_ = NULL;
- gchar* _tmp4_;
- gchar* path;
- GAppInfo* _tmp5_ = NULL;
- GAppInfo* app_info;
+ gint _tmp1_;
+ gchar** _tmp2_ = NULL;
+ gchar** _tmp3_;
+ gint _tmp3__length1;
+ gboolean _tmp4_;
+ gchar* _tmp5_ = NULL;
gchar* _tmp6_;
- gchar* _tmp7_ = NULL;
+ GAppInfo* _tmp7_ = NULL;
+ GAppInfo* _tmp8_;
+ GAppInfo* app_info;
+ gchar* _tmp9_;
+ gchar* _tmp10_ = NULL;
gchar* mpris_key;
- gboolean _tmp8_;
+ gboolean _tmp11_;
g_return_if_fail (self != NULL);
g_return_if_fail (desktop != NULL);
g_return_if_fail (dbus_name != NULL);
@@ -277,91 +339,114 @@ void music_player_bridge_client_has_become_available (MusicPlayerBridge* self, c
_tmp0_ = g_strcmp0 (desktop, "") == 0;
}
if (_tmp0_) {
- g_warning ("music-player-bridge.vala:82: 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;
}
- g_debug ("music-player-bridge.vala:86: client_has_become_available %s", desktop);
- _tmp1_ = g_strconcat (desktop, ".desktop", NULL);
- _tmp2_ = _tmp1_;
- _tmp3_ = g_strconcat (MUSIC_PLAYER_BRIDGE_DESKTOP_PREFIX, _tmp2_, NULL);
- path = (_tmp4_ = _tmp3_, _g_free0 (_tmp2_), _tmp4_);
- _tmp5_ = music_player_bridge_create_app_info (path);
- app_info = _tmp5_;
+ _tmp2_ = settings_manager_fetch_blacklist (self->priv->settings_manager, &_tmp1_);
+ _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:88: Client %s attempting to register but I'm " \
+"afraid it is blacklisted", desktop);
+ return;
+ }
+ 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:90: Could not create app_info for path %s \n" \
-" Getting out of here ", path);
+ 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);
- _g_free0 (path);
return;
}
- _tmp6_ = g_strdup (path);
- _tmp7_ = music_player_bridge_determine_key (_tmp6_);
- mpris_key = _tmp7_;
- _tmp8_ = gee_abstract_map_has_key ((GeeAbstractMap*) self->priv->registered_clients, mpris_key);
- if (_tmp8_ == FALSE) {
- gchar* _tmp9_ = NULL;
- gchar* _tmp10_;
- gint _tmp11_;
- PlayerController* _tmp12_ = NULL;
- PlayerController* _tmp13_;
+ _tmp9_ = g_strdup (desktop);
+ _tmp10_ = music_player_bridge_determine_key (_tmp9_);
+ mpris_key = _tmp10_;
+ _tmp11_ = gee_abstract_map_has_key ((GeeAbstractMap*) self->priv->registered_clients, mpris_key);
+ if (_tmp11_ == FALSE) {
+ gchar* _tmp12_ = NULL;
+ gchar* _tmp13_;
+ gint _tmp14_;
+ PlayerController* _tmp15_ = NULL;
+ PlayerController* _tmp16_;
PlayerController* ctrl;
- g_debug ("music-player-bridge.vala:97: New client has registered that we have no" \
-"t seen before: %s", dbus_name);
- _tmp9_ = music_player_bridge_fetch_icon_name (path);
- _tmp10_ = _tmp9_;
- _tmp11_ = music_player_bridge_calculate_menu_position (self);
- _tmp12_ = player_controller_new (self->priv->root_menu, app_info, dbus_name, _tmp10_, _tmp11_, PLAYER_CONTROLLER_STATE_READY);
- ctrl = (_tmp13_ = _tmp12_, _g_free0 (_tmp10_), _tmp13_);
+ 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_, &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:105: 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:107: 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 _tmp14_ = NULL;
- PlayerController* _tmp15_;
- gpointer _tmp16_ = NULL;
- PlayerController* _tmp17_;
- _tmp14_ = gee_abstract_map_get ((GeeAbstractMap*) self->priv->registered_clients, mpris_key);
- _tmp15_ = (PlayerController*) _tmp14_;
- player_controller_update_state (_tmp15_, PLAYER_CONTROLLER_STATE_READY);
- _g_object_unref0 (_tmp15_);
- _tmp16_ = gee_abstract_map_get ((GeeAbstractMap*) self->priv->registered_clients, mpris_key);
- _tmp17_ = (PlayerController*) _tmp16_;
- player_controller_activate (_tmp17_, dbus_name);
- _g_object_unref0 (_tmp17_);
- g_debug ("music-player-bridge.vala:112: Application has already registered - awa" \
+ gpointer _tmp17_ = NULL;
+ PlayerController* _tmp18_;
+ 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_;
+ _tmp19_ = __bool_dup0 (&use_playlists);
+ _tmp20_ = _tmp19_;
+ _g_free0 (_tmp18_->use_playlists);
+ _tmp18_->use_playlists = _tmp20_;
+ _g_object_unref0 (_tmp18_);
+ _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);
_g_object_unref0 (app_info);
- _g_free0 (path);
}
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:118: 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;
- g_debug ("music-player-bridge.vala:120: attempt to remove %s", mpris_root_interface);
+ gboolean _tmp2_ = FALSE;
+ 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_;
if (mpris_key != NULL) {
- gpointer _tmp2_ = NULL;
- PlayerController* _tmp3_;
- _tmp2_ = gee_abstract_map_get ((GeeAbstractMap*) self->priv->registered_clients, mpris_key);
- _tmp3_ = (PlayerController*) _tmp2_;
- player_controller_hibernate (_tmp3_);
- _g_object_unref0 (_tmp3_);
- g_debug ("music-player-bridge.vala:124: Successively offlined client %s", mpris_key);
+ gboolean _tmp3_;
+ _tmp3_ = gee_abstract_map_has_key ((GeeAbstractMap*) self->priv->registered_clients, mpris_key);
+ _tmp2_ = _tmp3_;
+ } else {
+ _tmp2_ = FALSE;
+ }
+ if (_tmp2_) {
+ gpointer _tmp4_ = NULL;
+ PlayerController* _tmp5_;
+ _tmp4_ = gee_abstract_map_get ((GeeAbstractMap*) self->priv->registered_clients, mpris_key);
+ _tmp5_ = (PlayerController*) _tmp4_;
+ player_controller_hibernate (_tmp5_);
+ _g_object_unref0 (_tmp5_);
+ g_debug ("music-player-bridge.vala:134: Successively offlined client %s", mpris_key);
}
_g_free0 (mpris_key);
}
@@ -373,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);
}
@@ -394,17 +479,17 @@ void music_player_bridge_set_root_menu_item (MusicPlayerBridge* self, DbusmenuMe
_tmp1_ = _tmp0_;
_g_object_unref0 (self->priv->root_menu);
self->priv->root_menu = _tmp1_;
+ music_player_bridge_try_to_add_inactive_familiar_clients (self);
_tmp2_ = mpris2_watcher_new ();
_tmp3_ = _tmp2_;
_g_object_unref0 (self->priv->watcher);
self->priv->watcher = _tmp3_;
g_signal_connect_object (self->priv->watcher, "client-appeared", (GCallback) _music_player_bridge_client_has_become_available_mpris2_watcher_client_appeared, self, 0);
g_signal_connect_object (self->priv->watcher, "client-disappeared", (GCallback) _music_player_bridge_client_has_vanished_mpris2_watcher_client_disappeared, self, 0);
- music_player_bridge_try_to_add_inactive_familiar_clients (self);
}
-static GAppInfo* music_player_bridge_create_app_info (const gchar* path) {
+static GAppInfo* music_player_bridge_create_app_info (const gchar* desktop) {
GAppInfo* result = NULL;
GDesktopAppInfo* _tmp0_ = NULL;
GDesktopAppInfo* info;
@@ -412,17 +497,17 @@ static GAppInfo* music_player_bridge_create_app_info (const gchar* path) {
GDesktopAppInfo* _tmp2_;
GAppInfo* _tmp3_;
GAppInfo* app_info;
- g_return_val_if_fail (path != NULL, NULL);
- _tmp0_ = g_desktop_app_info_new_from_filename (path);
+ g_return_val_if_fail (desktop != NULL, NULL);
+ _tmp0_ = g_desktop_app_info_new (desktop);
info = _tmp0_;
- if (path == NULL) {
+ if (desktop == NULL) {
_tmp1_ = TRUE;
} else {
_tmp1_ = info == NULL;
}
if (_tmp1_) {
- g_warning ("music-player-bridge.vala:142: Could not create a desktopappinfo instan" \
-"ce from app: %s", path);
+ g_warning ("music-player-bridge.vala:153: Could not create a desktopappinfo instan" \
+"ce from app: %s", desktop);
result = NULL;
_g_object_unref0 (info);
return result;
@@ -435,17 +520,28 @@ static GAppInfo* music_player_bridge_create_app_info (const gchar* path) {
}
-static gchar* music_player_bridge_fetch_icon_name (const gchar* desktop_path) {
+static gchar* music_player_bridge_fetch_icon_name (const gchar* desktop) {
gchar* result = NULL;
- GKeyFile* _tmp0_ = NULL;
+ gchar* _tmp0_ = NULL;
+ gchar* _tmp1_;
+ GDesktopAppInfo* _tmp2_ = NULL;
+ GDesktopAppInfo* _tmp3_;
+ GDesktopAppInfo* info;
+ GKeyFile* _tmp4_ = NULL;
GKeyFile* desktop_keyfile;
- gchar* _tmp1_ = NULL;
- gchar* _tmp2_;
+ const gchar* _tmp5_ = NULL;
+ gchar* _tmp6_ = NULL;
+ gchar* _tmp7_;
GError * _inner_error_ = NULL;
- g_return_val_if_fail (desktop_path != NULL, NULL);
- _tmp0_ = g_key_file_new ();
- desktop_keyfile = _tmp0_;
- g_key_file_load_from_file (desktop_keyfile, desktop_path, G_KEY_FILE_NONE, &_inner_error_);
+ g_return_val_if_fail (desktop != NULL, NULL);
+ _tmp0_ = g_strconcat (desktop, ".desktop", NULL);
+ _tmp1_ = _tmp0_;
+ _tmp2_ = g_desktop_app_info_new (_tmp1_);
+ info = (_tmp3_ = _tmp2_, _g_free0 (_tmp1_), _tmp3_);
+ _tmp4_ = g_key_file_new ();
+ desktop_keyfile = _tmp4_;
+ _tmp5_ = g_desktop_app_info_get_filename (info);
+ g_key_file_load_from_file (desktop_keyfile, _tmp5_, G_KEY_FILE_NONE, &_inner_error_);
if (_inner_error_ != NULL) {
if (_inner_error_->domain == G_FILE_ERROR) {
goto __catch0_g_file_error;
@@ -454,6 +550,7 @@ static gchar* music_player_bridge_fetch_icon_name (const gchar* desktop_path) {
goto __catch0_g_key_file_error;
}
_g_key_file_free0 (desktop_keyfile);
+ _g_object_unref0 (info);
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;
@@ -464,10 +561,11 @@ static gchar* music_player_bridge_fetch_icon_name (const gchar* desktop_path) {
GError * _error_;
_error_ = _inner_error_;
_inner_error_ = NULL;
- g_warning ("music-player-bridge.vala:156: 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);
+ _g_object_unref0 (info);
return result;
}
goto __finally0;
@@ -476,32 +574,36 @@ static gchar* music_player_bridge_fetch_icon_name (const gchar* desktop_path) {
GError * _error_;
_error_ = _inner_error_;
_inner_error_ = NULL;
- g_warning ("music-player-bridge.vala:160: 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);
+ _g_object_unref0 (info);
return result;
}
__finally0:
if (_inner_error_ != NULL) {
_g_key_file_free0 (desktop_keyfile);
+ _g_object_unref0 (info);
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;
}
- _tmp1_ = g_key_file_get_string (desktop_keyfile, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_ICON, &_inner_error_);
- _tmp2_ = _tmp1_;
+ _tmp6_ = g_key_file_get_string (desktop_keyfile, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_ICON, &_inner_error_);
+ _tmp7_ = _tmp6_;
if (_inner_error_ != NULL) {
if (_inner_error_->domain == G_KEY_FILE_ERROR) {
goto __catch1_g_key_file_error;
}
_g_key_file_free0 (desktop_keyfile);
+ _g_object_unref0 (info);
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;
}
- result = _tmp2_;
+ result = _tmp7_;
_g_key_file_free0 (desktop_keyfile);
+ _g_object_unref0 (info);
return result;
goto __finally1;
__catch1_g_key_file_error:
@@ -509,93 +611,73 @@ static gchar* music_player_bridge_fetch_icon_name (const gchar* desktop_path) {
GError * _error_;
_error_ = _inner_error_;
_inner_error_ = NULL;
- g_warning ("music-player-bridge.vala:169: 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_);
_g_key_file_free0 (desktop_keyfile);
+ _g_object_unref0 (info);
return result;
}
__finally1:
_g_key_file_free0 (desktop_keyfile);
+ _g_object_unref0 (info);
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;
}
-static gchar* music_player_bridge_determine_key (gchar* path) {
+static gchar* music_player_bridge_determine_key (gchar* desktop_or_interface) {
gchar* result = NULL;
- gchar** _tmp0_;
- gchar** _tmp1_ = NULL;
+ gchar* _tmp0_;
+ gchar* _result_;
+ gchar** _tmp1_;
+ gchar** _tmp2_ = NULL;
gint tokens_length1;
gint _tokens_size_;
- gchar** _tmp2_;
+ gchar** _tmp3_;
gchar** tokens;
- gchar* _tmp6_;
- gchar* filename;
- gchar** _tmp7_;
- gchar** _tmp8_ = NULL;
- gchar** _tmp9_;
- gint _tmp9__length1;
- gchar* _tmp10_;
- gchar* _tmp11_;
- gchar* _result_;
- gchar** _tmp12_;
- gchar** _tmp13_ = NULL;
+ gchar** _tmp6_;
+ gchar** _tmp7_ = NULL;
gint temp_length1;
gint _temp_size_;
- gchar** _tmp14_;
+ gchar** _tmp8_;
gchar** temp;
- g_return_val_if_fail (path != NULL, NULL);
- _tmp1_ = _tmp0_ = g_strsplit (path, "/", 0);
- _tmp2_ = _tmp1_;
- tokens_length1 = _vala_array_length (_tmp0_);
+ g_return_val_if_fail (desktop_or_interface != NULL, NULL);
+ _tmp0_ = g_strdup (desktop_or_interface);
+ _result_ = _tmp0_;
+ _tmp2_ = _tmp1_ = g_strsplit (desktop_or_interface, ".", 0);
+ _tmp3_ = _tmp2_;
+ tokens_length1 = _vala_array_length (_tmp1_);
_tokens_size_ = tokens_length1;
- tokens = _tmp2_;
- if (tokens_length1 < 2) {
- gchar** _tmp3_;
- gchar** _tmp4_ = NULL;
- gchar** _tmp5_;
- _tmp4_ = _tmp3_ = g_strsplit (path, ".", 0);
+ tokens = _tmp3_;
+ if (tokens_length1 > 1) {
+ gchar* _tmp4_;
+ gchar* _tmp5_;
+ _tmp4_ = g_strdup (tokens[tokens_length1 - 1]);
_tmp5_ = _tmp4_;
- tokens = (_vala_array_free (tokens, tokens_length1, (GDestroyNotify) g_free), NULL);
- tokens_length1 = _vala_array_length (_tmp3_);
- _tokens_size_ = tokens_length1;
- tokens = _tmp5_;
- if (tokens_length1 < 2) {
- result = NULL;
- tokens = (_vala_array_free (tokens, tokens_length1, (GDestroyNotify) g_free), NULL);
- _g_free0 (path);
- return result;
- }
+ _g_free0 (_result_);
+ _result_ = _tmp5_;
}
- _tmp6_ = g_strdup (tokens[tokens_length1 - 1]);
- filename = _tmp6_;
- _tmp8_ = _tmp7_ = g_strsplit (filename, ".", 0);
- _tmp9_ = _tmp8_;
- _tmp9__length1 = _vala_array_length (_tmp7_);
- _tmp10_ = g_strdup (_tmp9_[0]);
- _result_ = (_tmp11_ = _tmp10_, _tmp9_ = (_vala_array_free (_tmp9_, _tmp9__length1, (GDestroyNotify) g_free), NULL), _tmp11_);
- _tmp13_ = _tmp12_ = g_strsplit (_result_, "-", 0);
- _tmp14_ = _tmp13_;
- temp_length1 = _vala_array_length (_tmp12_);
+ _tmp7_ = _tmp6_ = g_strsplit (_result_, "-", 0);
+ _tmp8_ = _tmp7_;
+ temp_length1 = _vala_array_length (_tmp6_);
_temp_size_ = temp_length1;
- temp = _tmp14_;
+ temp = _tmp8_;
if (temp_length1 > 1) {
- gchar* _tmp15_;
- gchar* _tmp16_;
- _tmp15_ = g_strdup (temp[0]);
- _tmp16_ = _tmp15_;
+ gchar* _tmp9_;
+ gchar* _tmp10_;
+ _tmp9_ = g_strdup (temp[0]);
+ _tmp10_ = _tmp9_;
_g_free0 (_result_);
- _result_ = _tmp16_;
+ _result_ = _tmp10_;
}
- g_debug ("music-player-bridge.vala:197: 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);
- _g_free0 (filename);
tokens = (_vala_array_free (tokens, tokens_length1, (GDestroyNotify) g_free), NULL);
- _g_free0 (path);
+ _g_free0 (desktop_or_interface);
return result;
}
@@ -649,7 +731,6 @@ static void music_player_bridge_finalize (GObject* obj) {
_g_object_unref0 (self->priv->root_menu);
_g_object_unref0 (self->priv->registered_clients);
_g_object_unref0 (self->priv->watcher);
- _g_object_unref0 (self->priv->settings);
G_OBJECT_CLASS (music_player_bridge_parent_class)->finalize (obj);
}
diff --git a/src/music-player-bridge.h b/src/music-player-bridge.h
index 13eebe1..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__
@@ -122,15 +122,21 @@ typedef struct _MprisPlayerIface MprisPlayerIface;
#define TYPE_MPRIS_PLAYER_PROXY (mpris_player_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))
+#define TYPE_PLAYLIST_DETAILS (playlist_details_get_type ())
+typedef struct _PlaylistDetails PlaylistDetails;
-typedef struct _FreeDesktopObject FreeDesktopObject;
-typedef struct _FreeDesktopObjectIface FreeDesktopObjectIface;
+#define TYPE_ACTIVE_PLAYLIST_CONTAINER (active_playlist_container_get_type ())
+typedef struct _ActivePlaylistContainer ActivePlaylistContainer;
-#define TYPE_FREE_DESKTOP_OBJECT_PROXY (free_desktop_object_proxy_get_type ())
+#define TYPE_MPRIS_PLAYLISTS (mpris_playlists_get_type ())
+#define MPRIS_PLAYLISTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_PLAYLISTS, MprisPlaylists))
+#define IS_MPRIS_PLAYLISTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_PLAYLISTS))
+#define MPRIS_PLAYLISTS_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_MPRIS_PLAYLISTS, MprisPlaylistsIface))
+
+typedef struct _MprisPlaylists MprisPlaylists;
+typedef struct _MprisPlaylistsIface MprisPlaylistsIface;
+
+#define TYPE_MPRIS_PLAYLISTS_PROXY (mpris_playlists_proxy_get_type ())
#define TYPE_MPRIS2_WATCHER (mpris2_watcher_get_type ())
#define MPRIS2_WATCHER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS2_WATCHER, Mpris2Watcher))
@@ -142,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))
@@ -152,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))
@@ -165,6 +171,37 @@ typedef struct _SettingsManager SettingsManager;
typedef struct _SettingsManagerClass SettingsManagerClass;
typedef struct _SettingsManagerPrivate SettingsManagerPrivate;
+#define TYPE_PLAYLISTS_MENUITEM (playlists_menuitem_get_type ())
+#define PLAYLISTS_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYLISTS_MENUITEM, PlaylistsMenuitem))
+#define PLAYLISTS_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYLISTS_MENUITEM, PlaylistsMenuitemClass))
+#define IS_PLAYLISTS_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYLISTS_MENUITEM))
+#define IS_PLAYLISTS_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYLISTS_MENUITEM))
+#define PLAYLISTS_MENUITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYLISTS_MENUITEM, PlaylistsMenuitemClass))
+
+typedef struct _PlaylistsMenuitem PlaylistsMenuitem;
+typedef struct _PlaylistsMenuitemClass PlaylistsMenuitemClass;
+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))
@@ -238,6 +275,7 @@ struct _PlayerController {
gint current_state;
GeeArrayList* custom_items;
Mpris2Controller* mpris_bridge;
+ gboolean* use_playlists;
};
struct _PlayerControllerClass {
@@ -248,7 +286,8 @@ typedef enum {
PLAYER_CONTROLLER_WIDGET_ORDER_SEPARATOR,
PLAYER_CONTROLLER_WIDGET_ORDER_TITLE,
PLAYER_CONTROLLER_WIDGET_ORDER_METADATA,
- PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT
+ PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT,
+ PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS
} PlayerControllerwidget_order;
typedef enum {
@@ -293,10 +332,28 @@ struct _MprisPlayerIface {
void (*set_PlaybackStatus) (MprisPlayer* self, const gchar* value);
};
-struct _FreeDesktopObjectIface {
+struct _PlaylistDetails {
+ char* path;
+ gchar* name;
+ gchar* icon_path;
+};
+
+struct _ActivePlaylistContainer {
+ gboolean valid;
+ PlaylistDetails details;
+};
+
+struct _MprisPlaylistsIface {
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);
+ void (*ActivatePlaylist) (MprisPlaylists* self, const char* playlist_id, GAsyncReadyCallback _callback_, gpointer _user_data_);
+ void (*ActivatePlaylist_finish) (MprisPlaylists* self, GAsyncResult* _res_, GError** error);
+ PlaylistDetails* (*GetPlaylists) (MprisPlaylists* self, guint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, int* result_length1, GError** error);
+ gchar** (*get_Orderings) (MprisPlaylists* self, int* result_length1);
+ void (*set_Orderings) (MprisPlaylists* self, gchar** value, int value_length1);
+ guint32 (*get_PlaylistCount) (MprisPlaylists* self);
+ void (*set_PlaylistCount) (MprisPlaylists* self, guint32 value);
+ void (*get_ActivePlaylist) (MprisPlaylists* self, ActivePlaylistContainer* value);
+ void (*set_ActivePlaylist) (MprisPlaylists* self, ActivePlaylistContainer* value);
};
struct _Mpris2Watcher {
@@ -308,10 +365,6 @@ struct _Mpris2WatcherClass {
GObjectClass parent_class;
};
-struct _FreeDesktopPropertiesIface {
- GTypeInterface parent_iface;
-};
-
struct _Mpris2Controller {
GObject parent_instance;
Mpris2ControllerPrivate * priv;
@@ -321,6 +374,10 @@ struct _Mpris2ControllerClass {
GObjectClass parent_class;
};
+struct _FreeDesktopPropertiesIface {
+ GTypeInterface parent_iface;
+};
+
struct _SettingsManager {
GObject parent_instance;
SettingsManagerPrivate * priv;
@@ -330,6 +387,32 @@ struct _SettingsManagerClass {
GObjectClass parent_class;
};
+struct _PlaylistsMenuitem {
+ PlayerItem parent_instance;
+ PlaylistsMenuitemPrivate * priv;
+ DbusmenuMenuitem* root_item;
+};
+
+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;
@@ -343,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;
@@ -370,17 +453,15 @@ GeeHashSet* title_menuitem_attributes_format (void);
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 4
-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);
+#define PLAYER_CONTROLLER_WIDGET_QUANTITY 5
+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);
void player_controller_vanish (PlayerController* self);
void player_controller_hibernate (PlayerController* self);
void player_controller_update_layout (PlayerController* self);
-const gchar* player_controller_get_name (PlayerController* self);
-void player_controller_set_name (PlayerController* self, const gchar* value);
const gchar* player_controller_get_dbus_name (PlayerController* self);
void player_controller_set_dbus_name (PlayerController* self, const gchar* value);
GAppInfo* player_controller_get_app_info (PlayerController* self);
@@ -421,27 +502,46 @@ gint32 mpris_player_get_Position (MprisPlayer* self);
void mpris_player_set_Position (MprisPlayer* self, gint32 value);
gchar* mpris_player_get_PlaybackStatus (MprisPlayer* self);
void mpris_player_set_PlaybackStatus (MprisPlayer* self, const gchar* value);
-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 playlist_details_get_type (void) G_GNUC_CONST;
+PlaylistDetails* playlist_details_dup (const PlaylistDetails* self);
+void playlist_details_free (PlaylistDetails* self);
+void playlist_details_copy (const PlaylistDetails* self, PlaylistDetails* dest);
+void playlist_details_destroy (PlaylistDetails* self);
+GType active_playlist_container_get_type (void) G_GNUC_CONST;
+ActivePlaylistContainer* active_playlist_container_dup (const ActivePlaylistContainer* self);
+void active_playlist_container_free (ActivePlaylistContainer* self);
+void active_playlist_container_copy (const ActivePlaylistContainer* self, ActivePlaylistContainer* dest);
+void active_playlist_container_destroy (ActivePlaylistContainer* self);
+GType mpris_playlists_proxy_get_type (void) G_GNUC_CONST;
+guint mpris_playlists_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
+GType mpris_playlists_get_type (void) G_GNUC_CONST;
+void mpris_playlists_ActivatePlaylist (MprisPlaylists* self, const char* playlist_id, GAsyncReadyCallback _callback_, gpointer _user_data_);
+void mpris_playlists_ActivatePlaylist_finish (MprisPlaylists* self, GAsyncResult* _res_, GError** error);
+PlaylistDetails* mpris_playlists_GetPlaylists (MprisPlaylists* self, guint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, int* result_length1, GError** error);
+gchar** mpris_playlists_get_Orderings (MprisPlaylists* self, int* result_length1);
+void mpris_playlists_set_Orderings (MprisPlaylists* self, gchar** value, int value_length1);
+guint32 mpris_playlists_get_PlaylistCount (MprisPlaylists* self);
+void mpris_playlists_set_PlaylistCount (MprisPlaylists* self, guint32 value);
+void mpris_playlists_get_ActivePlaylist (MprisPlaylists* self, ActivePlaylistContainer* result);
+void mpris_playlists_set_ActivePlaylist (MprisPlaylists* self, ActivePlaylistContainer* value);
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);
void mpris2_controller_initial_update (Mpris2Controller* self);
void mpris2_controller_transport_update (Mpris2Controller* self, TransportMenuitemaction command);
+void mpris2_controller_fetch_playlists (Mpris2Controller* self);
gboolean mpris2_controller_connected (Mpris2Controller* self);
void mpris2_controller_expose (Mpris2Controller* self);
+void mpris2_controller_activate_playlist (Mpris2Controller* self, const char* path);
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);
@@ -455,8 +555,25 @@ GType settings_manager_get_type (void) G_GNUC_CONST;
SettingsManager* settings_manager_new (void);
SettingsManager* settings_manager_construct (GType object_type);
gchar** settings_manager_fetch_blacklist (SettingsManager* self, int* result_length1);
-gchar** settings_manager_fetch_interested (SettingsManager* self, int* result_length1);
-gboolean settings_manager_add_interested (SettingsManager* self, const gchar* app_desktop_name);
+GeeArrayList* settings_manager_fetch_interested (SettingsManager* self);
+void settings_manager_clear_list (SettingsManager* self);
+void settings_manager_add_interested (SettingsManager* self, const gchar* app_desktop_name);
+GType playlists_menuitem_get_type (void) G_GNUC_CONST;
+PlaylistsMenuitem* playlists_menuitem_new (PlayerController* parent);
+PlaylistsMenuitem* playlists_menuitem_construct (GType object_type, PlayerController* parent);
+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/music-player-bridge.vala b/src/music-player-bridge.vala
index 327a775..7587684 100644
--- a/src/music-player-bridge.vala
+++ b/src/music-player-bridge.vala
@@ -27,8 +27,6 @@ public class MusicPlayerBridge : GLib.Object
private Dbusmenu.Menuitem root_menu;
private HashMap<string, PlayerController> registered_clients;
private Mpris2Watcher watcher;
- private const string DESKTOP_PREFIX = "/usr/share/applications/";
- private Settings settings;
public MusicPlayerBridge()
{
@@ -49,20 +47,21 @@ public class MusicPlayerBridge : GLib.Object
{
foreach ( string desktop in this.settings_manager.fetch_interested()){
debug ( "interested client found : %s", desktop );
- string path = DESKTOP_PREFIX.concat ( desktop.concat( ".desktop" ) );
- AppInfo? app_info = create_app_info ( path );
+ AppInfo? app_info = create_app_info ( desktop.concat( ".desktop" ) );
if ( app_info == null ){
- warning ( "Could not create app_info for path %s \n Getting out of here ", path);
+ warning ( "Could not create app_info for path %s \n Getting out of here ",
+ desktop );
continue;
}
- var mpris_key = determine_key ( path );
+ var mpris_key = determine_key ( desktop );
PlayerController ctrl = new PlayerController ( this.root_menu,
app_info,
null,
- this.fetch_icon_name(path),
+ this.fetch_icon_name(desktop),
calculate_menu_position(),
+ null,
PlayerController.state.OFFLINE );
- this.registered_clients.set(mpris_key, ctrl);
+ this.registered_clients.set(mpris_key, ctrl);
}
}
@@ -76,30 +75,39 @@ public class MusicPlayerBridge : GLib.Object
}
}
- public void client_has_become_available ( string desktop, string dbus_name )
+ public void client_has_become_available ( string desktop,
+ string dbus_name,
+ bool use_playlists )
{
if (desktop == null || desktop == ""){
warning("Client %s attempting to register without desktop entry being set on the mpris root",
dbus_name);
return;
}
+ if (desktop in this.settings_manager.fetch_blacklist()) {
+ debug ("Client %s attempting to register but I'm afraid it is blacklisted",
+ desktop);
+ return;
+ }
+
debug ( "client_has_become_available %s", desktop );
- string path = DESKTOP_PREFIX.concat ( desktop.concat( ".desktop" ) );
- AppInfo? app_info = create_app_info ( path );
+ AppInfo? app_info = create_app_info ( desktop.concat( ".desktop" ) );
if ( app_info == null ){
- warning ( "Could not create app_info for path %s \n Getting out of here ", path);
+ warning ( "Could not create app_info for path %s \n Getting out of here ",
+ desktop );
return;
}
- var mpris_key = determine_key ( path );
+ var mpris_key = determine_key ( desktop );
// Are we sure clients will appear like this with the new registration method in place.
if ( this.registered_clients.has_key (mpris_key) == false ){
debug("New client has registered that we have not seen before: %s", dbus_name );
PlayerController ctrl = new PlayerController ( this.root_menu,
app_info,
dbus_name,
- this.fetch_icon_name(path),
+ this.fetch_icon_name(desktop),
this.calculate_menu_position(),
+ use_playlists,
PlayerController.state.READY );
this.registered_clients.set ( mpris_key, ctrl );
debug ( "Have not seen this %s before, new controller created.", desktop );
@@ -107,6 +115,7 @@ public class MusicPlayerBridge : GLib.Object
debug ( "application added to the interested list" );
}
else{
+ this.registered_clients[mpris_key].use_playlists = use_playlists;
this.registered_clients[mpris_key].update_state ( PlayerController.state.READY );
this.registered_clients[mpris_key].activate ( dbus_name );
debug("Application has already registered - awaken the hibernation: %s \n", dbus_name );
@@ -115,42 +124,46 @@ public class MusicPlayerBridge : GLib.Object
public void client_has_vanished ( string mpris_root_interface )
{
- debug("MusicPlayerBridge -> on_server_removed with value %s", mpris_root_interface);
+ debug("MusicPlayerBridge -> client with dbus interface %s has vanished",
+ mpris_root_interface );
if (root_menu != null){
debug("attempt to remove %s", mpris_root_interface);
var mpris_key = determine_key ( mpris_root_interface );
- if ( mpris_key != null ){
+ if ( mpris_key != null && this.registered_clients.has_key(mpris_key)){
registered_clients[mpris_key].hibernate();
debug("Successively offlined client %s", mpris_key);
}
}
}
-
+
public void set_root_menu_item ( Dbusmenu.Menuitem menu )
{
this.root_menu = menu;
+ this.try_to_add_inactive_familiar_clients();
this.watcher = new Mpris2Watcher ();
this.watcher.client_appeared += this.client_has_become_available;
this.watcher.client_disappeared += this.client_has_vanished;
- this.try_to_add_inactive_familiar_clients();
}
- private static AppInfo? create_app_info ( string path )
+ private static AppInfo? create_app_info ( string desktop )
{
- DesktopAppInfo info = new DesktopAppInfo.from_filename ( path ) ;
- if ( path == null || info == null ){
- warning ( "Could not create a desktopappinfo instance from app: %s", path );
+ DesktopAppInfo info = new DesktopAppInfo ( desktop ) ;
+
+ if ( desktop == null || info == null ){
+ warning ( "Could not create a desktopappinfo instance from app: %s", desktop );
return null;
}
GLib.AppInfo app_info = info as GLib.AppInfo;
return app_info;
}
- private static string? fetch_icon_name(string desktop_path)
+ private static string? fetch_icon_name(string desktop)
{
+ // We know the appinfo is good because it was loaded in the previous reg step.
+ DesktopAppInfo info = new DesktopAppInfo ( desktop.concat( ".desktop" ) ) ;
KeyFile desktop_keyfile = new KeyFile ();
try{
- desktop_keyfile.load_from_file (desktop_path, KeyFileFlags.NONE);
+ desktop_keyfile.load_from_file (info.get_filename(), KeyFileFlags.NONE);
}
catch(GLib.FileError error){
warning("Error loading keyfile - FileError");
@@ -172,24 +185,19 @@ public class MusicPlayerBridge : GLib.Object
}
/*
- Messy but necessary method to consolidate desktop filesnames and mpris dbus names
- into the one single word string (used as the key in the players hash).
+ Messy but necessary method to consolidate desktop filesnames and mpris dbus
+ names into the one single word string (used as the key in the players hash).
So this means that we can determine the key for the players_hash from the
- dbus interface name or the desktop file name.
+ dbus interface name or the desktop file name, at startup offline/online and
+ shutdown.
*/
- private static string? determine_key(owned string path)
+ private static string? determine_key(owned string desktop_or_interface)
{
- var tokens = path.split( "/" );
- if ( tokens.length < 2 ){
- // try to split on "."
- tokens = path.split(".");
- if ( tokens.length < 2 ){
- // don't know what this is
- return null;
- }
+ var result = desktop_or_interface;
+ var tokens = desktop_or_interface.split( "." );
+ if ( tokens.length > 1 ){
+ result = tokens[tokens.length - 1];
}
- var filename = tokens[tokens.length - 1];
- var result = filename.split(".")[0];
var temp = result.split("-");
if (temp.length > 1){
result = temp[0];
diff --git a/src/player-controller.c b/src/player-controller.c
index 2872736..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 */
/*
@@ -81,6 +81,18 @@ typedef struct _Mpris2ControllerClass Mpris2ControllerClass;
typedef struct _TitleMenuitem TitleMenuitem;
typedef struct _TitleMenuitemClass TitleMenuitemClass;
+#define TYPE_PLAYLISTS_MENUITEM (playlists_menuitem_get_type ())
+#define PLAYLISTS_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYLISTS_MENUITEM, PlaylistsMenuitem))
+#define PLAYLISTS_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYLISTS_MENUITEM, PlaylistsMenuitemClass))
+#define IS_PLAYLISTS_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYLISTS_MENUITEM))
+#define IS_PLAYLISTS_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYLISTS_MENUITEM))
+#define PLAYLISTS_MENUITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYLISTS_MENUITEM, PlaylistsMenuitemClass))
+
+typedef struct _PlaylistsMenuitem PlaylistsMenuitem;
+typedef struct _PlaylistsMenuitemClass PlaylistsMenuitemClass;
+typedef struct _PlayerItemPrivate PlayerItemPrivate;
+typedef struct _PlaylistsMenuitemPrivate PlaylistsMenuitemPrivate;
+
#define TYPE_METADATA_MENUITEM (metadata_menuitem_get_type ())
#define METADATA_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_METADATA_MENUITEM, MetadataMenuitem))
#define METADATA_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_METADATA_MENUITEM, MetadataMenuitemClass))
@@ -107,6 +119,7 @@ struct _PlayerController {
gint current_state;
GeeArrayList* custom_items;
Mpris2Controller* mpris_bridge;
+ gboolean* use_playlists;
};
struct _PlayerControllerClass {
@@ -115,7 +128,6 @@ struct _PlayerControllerClass {
struct _PlayerControllerPrivate {
DbusmenuMenuitem* root_menu;
- gchar* _name;
gchar* _dbus_name;
GAppInfo* _app_info;
gint _menu_offset;
@@ -126,7 +138,8 @@ typedef enum {
PLAYER_CONTROLLER_WIDGET_ORDER_SEPARATOR,
PLAYER_CONTROLLER_WIDGET_ORDER_TITLE,
PLAYER_CONTROLLER_WIDGET_ORDER_METADATA,
- PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT
+ PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT,
+ PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS
} PlayerControllerwidget_order;
typedef enum {
@@ -137,6 +150,25 @@ typedef enum {
PLAYER_CONTROLLER_STATE_DISCONNECTED
} PlayerControllerstate;
+struct _PlayerItem {
+ DbusmenuMenuitem parent_instance;
+ PlayerItemPrivate * priv;
+};
+
+struct _PlayerItemClass {
+ DbusmenuMenuitemClass parent_class;
+};
+
+struct _PlaylistsMenuitem {
+ PlayerItem parent_instance;
+ PlaylistsMenuitemPrivate * priv;
+ DbusmenuMenuitem* root_item;
+};
+
+struct _PlaylistsMenuitemClass {
+ PlayerItemClass parent_class;
+};
+
static gpointer player_controller_parent_class = NULL;
@@ -146,7 +178,6 @@ GType mpris2_controller_get_type (void) G_GNUC_CONST;
#define PLAYER_CONTROLLER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_PLAYER_CONTROLLER, PlayerControllerPrivate))
enum {
PLAYER_CONTROLLER_DUMMY_PROPERTY,
- PLAYER_CONTROLLER_NAME,
PLAYER_CONTROLLER_DBUS_NAME,
PLAYER_CONTROLLER_APP_INFO,
PLAYER_CONTROLLER_MENU_OFFSET,
@@ -154,21 +185,19 @@ 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 4
-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);
+#define PLAYER_CONTROLLER_WIDGET_QUANTITY 5
+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);
-static gchar* player_controller_format_player_name (gchar* app_info_name);
-GAppInfo* player_controller_get_app_info (PlayerController* self);
-void player_controller_set_name (PlayerController* self, const gchar* value);
void player_controller_set_icon_name (PlayerController* self, const gchar* value);
void player_controller_set_menu_offset (PlayerController* self, gint value);
static void player_controller_construct_widgets (PlayerController* self);
static void player_controller_establish_mpris_connection (PlayerController* self);
void player_controller_update_layout (PlayerController* self);
void player_controller_update_state (PlayerController* self, PlayerControllerstate new_state);
-const gchar* player_controller_get_name (PlayerController* self);
+GAppInfo* player_controller_get_app_info (PlayerController* self);
void player_controller_activate (PlayerController* self, const gchar* dbus_name);
void player_controller_instantiate (PlayerController* self);
const gchar* player_controller_get_dbus_name (PlayerController* self);
@@ -182,6 +211,7 @@ GeeHashSet* transport_menuitem_attributes_format (void);
GeeHashSet* metadata_menuitem_attributes_format (void);
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);
PlayerItem* player_item_new (const gchar* type);
PlayerItem* player_item_construct (GType object_type, const gchar* type);
@@ -193,7 +223,10 @@ GType metadata_menuitem_get_type (void) G_GNUC_CONST;
TransportMenuitem* transport_menuitem_new (PlayerController* parent);
TransportMenuitem* transport_menuitem_construct (GType object_type, PlayerController* parent);
GType transport_menuitem_get_type (void) G_GNUC_CONST;
+PlaylistsMenuitem* playlists_menuitem_new (PlayerController* parent);
+PlaylistsMenuitem* playlists_menuitem_construct (GType object_type, PlayerController* parent);
gint player_controller_get_menu_offset (PlayerController* self);
+static gchar* player_controller_format_player_name (gchar* app_info_name);
gboolean mpris2_controller_connected (Mpris2Controller* self);
void mpris2_controller_initial_update (Mpris2Controller* self);
const gchar* player_controller_get_icon_name (PlayerController* self);
@@ -208,7 +241,7 @@ static gint _vala_array_length (gpointer array);
GType player_controller_widget_order_get_type (void) {
static volatile gsize player_controller_widget_order_type_id__volatile = 0;
if (g_once_init_enter (&player_controller_widget_order_type_id__volatile)) {
- static const GEnumValue values[] = {{PLAYER_CONTROLLER_WIDGET_ORDER_SEPARATOR, "PLAYER_CONTROLLER_WIDGET_ORDER_SEPARATOR", "separator"}, {PLAYER_CONTROLLER_WIDGET_ORDER_TITLE, "PLAYER_CONTROLLER_WIDGET_ORDER_TITLE", "title"}, {PLAYER_CONTROLLER_WIDGET_ORDER_METADATA, "PLAYER_CONTROLLER_WIDGET_ORDER_METADATA", "metadata"}, {PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT, "PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT", "transport"}, {0, NULL, NULL}};
+ static const GEnumValue values[] = {{PLAYER_CONTROLLER_WIDGET_ORDER_SEPARATOR, "PLAYER_CONTROLLER_WIDGET_ORDER_SEPARATOR", "separator"}, {PLAYER_CONTROLLER_WIDGET_ORDER_TITLE, "PLAYER_CONTROLLER_WIDGET_ORDER_TITLE", "title"}, {PLAYER_CONTROLLER_WIDGET_ORDER_METADATA, "PLAYER_CONTROLLER_WIDGET_ORDER_METADATA", "metadata"}, {PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT, "PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT", "transport"}, {PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS, "PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS", "playlists"}, {0, NULL, NULL}};
GType player_controller_widget_order_type_id;
player_controller_widget_order_type_id = g_enum_register_static ("PlayerControllerwidget_order", values);
g_once_init_leave (&player_controller_widget_order_type_id__volatile, player_controller_widget_order_type_id);
@@ -229,42 +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_;
- const gchar* _tmp2_ = NULL;
- gchar* _tmp3_;
- gchar* _tmp4_ = NULL;
- gchar* _tmp5_;
- GeeArrayList* _tmp6_ = NULL;
- GeeArrayList* _tmp7_;
+ 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);
- _tmp2_ = g_app_info_get_name (self->priv->_app_info);
- _tmp3_ = g_strdup (_tmp2_);
- _tmp4_ = player_controller_format_player_name (_tmp3_);
- _tmp5_ = _tmp4_;
- player_controller_set_name (self, _tmp5_);
- _g_free0 (_tmp5_);
player_controller_set_icon_name (self, icon_name);
- _tmp6_ = gee_array_list_new (TYPE_PLAYER_ITEM, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL);
- _tmp7_ = _tmp6_;
+ _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 = _tmp7_;
+ self->custom_items = _tmp5_;
self->current_state = (gint) initial_state;
player_controller_set_menu_offset (self, offset);
player_controller_construct_widgets (self);
@@ -274,15 +316,17 @@ 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);
}
void player_controller_update_state (PlayerController* self, PlayerControllerstate new_state) {
+ const gchar* _tmp0_ = NULL;
g_return_if_fail (self != NULL);
- g_debug ("player-controller.vala:76: update_state - player controller %s : new s" \
-"tate %i", self->priv->_name, (gint) new_state);
+ _tmp0_ = g_app_info_get_name (self->priv->_app_info);
+ 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);
}
@@ -297,9 +341,11 @@ void player_controller_activate (PlayerController* self, const gchar* dbus_name)
void player_controller_instantiate (PlayerController* self) {
+ const gchar* _tmp0_ = NULL;
GError * _inner_error_ = NULL;
g_return_if_fail (self != NULL);
- g_debug ("player-controller.vala:95: instantiate in player controller for %s", self->priv->_name);
+ _tmp0_ = g_app_info_get_name (self->priv->_app_info);
+ 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;
@@ -309,10 +355,12 @@ void player_controller_instantiate (PlayerController* self) {
__catch6_g_error:
{
GError * _error_;
+ const gchar* _tmp1_ = NULL;
_error_ = _inner_error_;
_inner_error_ = NULL;
- g_warning ("player-controller.vala:101: Failed to launch app %s with error message" \
-": %s", self->priv->_name, _error_->message);
+ _tmp1_ = g_app_info_get_name (self->priv->_app_info);
+ g_warning ("player-controller.vala:104: Failed to launch app %s with error message" \
+": %s", _tmp1_, _error_->message);
_g_error_free0 (_error_);
}
__finally6:
@@ -324,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;
@@ -335,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:108: 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);
}
@@ -389,6 +460,7 @@ void player_controller_hibernate (PlayerController* self) {
gpointer _tmp8_ = NULL;
PlayerItem* _tmp9_;
TitleMenuitem* title;
+ Mpris2Controller* _tmp10_;
g_return_if_fail (self != NULL);
player_controller_update_state (self, PLAYER_CONTROLLER_STATE_OFFLINE);
_tmp0_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT);
@@ -408,51 +480,63 @@ void player_controller_hibernate (PlayerController* self) {
_tmp8_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TITLE);
title = (_tmp9_ = (PlayerItem*) _tmp8_, IS_TITLE_MENUITEM (_tmp9_) ? ((TitleMenuitem*) _tmp9_) : NULL);
title_menuitem_toggle_active_triangle (title, FALSE);
+ _tmp10_ = NULL;
+ _g_object_unref0 (self->mpris_bridge);
+ self->mpris_bridge = _tmp10_;
_g_object_unref0 (title);
}
void player_controller_update_layout (PlayerController* self) {
- gpointer _tmp4_ = NULL;
- PlayerItem* _tmp5_;
+ gpointer _tmp0_ = NULL;
+ PlayerItem* _tmp1_;
+ PlaylistsMenuitem* playlists_menuitem;
gpointer _tmp6_ = NULL;
PlayerItem* _tmp7_;
- GeeHashSet* _tmp8_ = NULL;
- GeeHashSet* _tmp9_;
- gboolean _tmp10_;
- gpointer _tmp11_ = NULL;
- PlayerItem* _tmp12_;
+ gpointer _tmp8_ = NULL;
+ PlayerItem* _tmp9_;
+ GeeHashSet* _tmp10_ = NULL;
+ GeeHashSet* _tmp11_;
+ gboolean _tmp12_;
+ gpointer _tmp13_ = NULL;
+ PlayerItem* _tmp14_;
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);
if (self->current_state != PLAYER_CONTROLLER_STATE_CONNECTED) {
- gpointer _tmp0_ = NULL;
- PlayerItem* _tmp1_;
gpointer _tmp2_ = NULL;
PlayerItem* _tmp3_;
- _tmp0_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT);
- _tmp1_ = (PlayerItem*) _tmp0_;
- dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) _tmp1_, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE);
- _g_object_unref0 (_tmp1_);
- _tmp2_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA);
+ gpointer _tmp4_ = NULL;
+ PlayerItem* _tmp5_;
+ _tmp2_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT);
_tmp3_ = (PlayerItem*) _tmp2_;
dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) _tmp3_, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE);
_g_object_unref0 (_tmp3_);
+ _tmp4_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA);
+ _tmp5_ = (PlayerItem*) _tmp4_;
+ dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) _tmp5_, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE);
+ _g_object_unref0 (_tmp5_);
+ dbusmenu_menuitem_property_set_bool (playlists_menuitem->root_item, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE);
+ _g_object_unref0 (playlists_menuitem);
return;
}
- _tmp4_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA);
- _tmp5_ = (PlayerItem*) _tmp4_;
_tmp6_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA);
_tmp7_ = (PlayerItem*) _tmp6_;
- _tmp8_ = metadata_menuitem_attributes_format ();
- _tmp9_ = _tmp8_;
- _tmp10_ = player_item_populated (_tmp7_, _tmp9_);
- dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) _tmp5_, DBUSMENU_MENUITEM_PROP_VISIBLE, _tmp10_);
+ _tmp8_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA);
+ _tmp9_ = (PlayerItem*) _tmp8_;
+ _tmp10_ = metadata_menuitem_attributes_format ();
+ _tmp11_ = _tmp10_;
+ _tmp12_ = player_item_populated (_tmp9_, _tmp11_);
+ dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) _tmp7_, DBUSMENU_MENUITEM_PROP_VISIBLE, _tmp12_);
+ _g_object_unref0 (_tmp11_);
_g_object_unref0 (_tmp9_);
_g_object_unref0 (_tmp7_);
- _g_object_unref0 (_tmp5_);
- _tmp11_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT);
- _tmp12_ = (PlayerItem*) _tmp11_;
- dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) _tmp12_, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE);
- _g_object_unref0 (_tmp12_);
+ _tmp13_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT);
+ _tmp14_ = (PlayerItem*) _tmp13_;
+ dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) _tmp14_, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE);
+ _g_object_unref0 (_tmp14_);
+ dbusmenu_menuitem_property_set_bool (playlists_menuitem->root_item, DBUSMENU_MENUITEM_PROP_VISIBLE, *self->use_playlists);
+ _g_object_unref0 (playlists_menuitem);
}
@@ -465,6 +549,8 @@ static void player_controller_construct_widgets (PlayerController* self) {
MetadataMenuitem* metadata_item;
TransportMenuitem* _tmp4_ = NULL;
TransportMenuitem* transport_item;
+ PlaylistsMenuitem* _tmp5_ = NULL;
+ PlaylistsMenuitem* playlist_menuitem;
g_return_if_fail (self != NULL);
_tmp0_ = player_item_new (DBUSMENU_CLIENT_TYPES_SEPARATOR);
_tmp1_ = _tmp0_;
@@ -479,33 +565,51 @@ static void player_controller_construct_widgets (PlayerController* self) {
_tmp4_ = transport_menuitem_new (self);
transport_item = _tmp4_;
gee_abstract_collection_add ((GeeAbstractCollection*) self->custom_items, (PlayerItem*) transport_item);
+ _tmp5_ = playlists_menuitem_new (self);
+ playlist_menuitem = _tmp5_;
+ gee_abstract_collection_add ((GeeAbstractCollection*) self->custom_items, (PlayerItem*) playlist_menuitem);
{
- GeeArrayList* _tmp5_;
+ GeeArrayList* _tmp6_;
GeeArrayList* _item_list;
- gint _tmp6_;
+ gint _tmp7_;
gint _item_size;
gint _item_index;
- _tmp5_ = _g_object_ref0 (self->custom_items);
- _item_list = _tmp5_;
- _tmp6_ = gee_collection_get_size ((GeeCollection*) _item_list);
- _item_size = _tmp6_;
+ _tmp6_ = _g_object_ref0 (self->custom_items);
+ _item_list = _tmp6_;
+ _tmp7_ = gee_collection_get_size ((GeeCollection*) _item_list);
+ _item_size = _tmp7_;
_item_index = -1;
while (TRUE) {
- gpointer _tmp7_ = NULL;
+ gpointer _tmp8_ = NULL;
PlayerItem* item;
- gint _tmp8_;
+ gint _tmp9_;
_item_index = _item_index + 1;
if (!(_item_index < _item_size)) {
break;
}
- _tmp7_ = gee_abstract_list_get ((GeeAbstractList*) _item_list, _item_index);
- item = (PlayerItem*) _tmp7_;
- _tmp8_ = gee_abstract_list_index_of ((GeeAbstractList*) self->custom_items, item);
- dbusmenu_menuitem_child_add_position (self->priv->root_menu, (DbusmenuMenuitem*) item, (guint) (self->priv->_menu_offset + _tmp8_));
+ _tmp8_ = gee_abstract_list_get ((GeeAbstractList*) _item_list, _item_index);
+ item = (PlayerItem*) _tmp8_;
+ _tmp9_ = gee_abstract_list_index_of ((GeeAbstractList*) self->custom_items, item);
+ if (_tmp9_ != 4) {
+ gint _tmp10_;
+ _tmp10_ = gee_abstract_list_index_of ((GeeAbstractList*) self->custom_items, item);
+ dbusmenu_menuitem_child_add_position (self->priv->root_menu, (DbusmenuMenuitem*) item, (guint) (self->priv->_menu_offset + _tmp10_));
+ } else {
+ PlayerItem* _tmp11_;
+ PlaylistsMenuitem* _tmp12_;
+ PlaylistsMenuitem* playlists_menuitem;
+ gint _tmp13_;
+ _tmp12_ = _g_object_ref0 ((_tmp11_ = item, IS_PLAYLISTS_MENUITEM (_tmp11_) ? ((PlaylistsMenuitem*) _tmp11_) : NULL));
+ playlists_menuitem = _tmp12_;
+ _tmp13_ = gee_abstract_list_index_of ((GeeAbstractList*) self->custom_items, item);
+ dbusmenu_menuitem_child_add_position (self->priv->root_menu, playlists_menuitem->root_item, (guint) (self->priv->_menu_offset + _tmp13_));
+ _g_object_unref0 (playlists_menuitem);
+ }
_g_object_unref0 (item);
}
_g_object_unref0 (_item_list);
}
+ _g_object_unref0 (playlist_menuitem);
_g_object_unref0 (transport_item);
_g_object_unref0 (metadata_item);
_g_object_unref0 (title_menu_item);
@@ -535,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;
@@ -545,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;
}
@@ -587,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_;
@@ -610,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;
@@ -618,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_;
@@ -627,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:178: 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);
@@ -656,26 +760,6 @@ static void player_controller_determine_state (PlayerController* self) {
}
-const gchar* player_controller_get_name (PlayerController* self) {
- const gchar* result;
- g_return_val_if_fail (self != NULL, NULL);
- result = self->priv->_name;
- return result;
-}
-
-
-void player_controller_set_name (PlayerController* self, const gchar* value) {
- gchar* _tmp0_;
- gchar* _tmp1_;
- g_return_if_fail (self != NULL);
- _tmp0_ = g_strdup (value);
- _tmp1_ = _tmp0_;
- _g_free0 (self->priv->_name);
- self->priv->_name = _tmp1_;
- g_object_notify ((GObject *) self, "name");
-}
-
-
const gchar* player_controller_get_dbus_name (PlayerController* self) {
const gchar* result;
g_return_val_if_fail (self != NULL, NULL);
@@ -757,7 +841,6 @@ static void player_controller_class_init (PlayerControllerClass * klass) {
G_OBJECT_CLASS (klass)->get_property = _vala_player_controller_get_property;
G_OBJECT_CLASS (klass)->set_property = _vala_player_controller_set_property;
G_OBJECT_CLASS (klass)->finalize = player_controller_finalize;
- g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYER_CONTROLLER_NAME, g_param_spec_string ("name", "name", "name", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYER_CONTROLLER_DBUS_NAME, g_param_spec_string ("dbus-name", "dbus-name", "dbus-name", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYER_CONTROLLER_APP_INFO, g_param_spec_object ("app-info", "app-info", "app-info", G_TYPE_APP_INFO, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYER_CONTROLLER_MENU_OFFSET, g_param_spec_int ("menu-offset", "menu-offset", "menu-offset", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
@@ -775,12 +858,12 @@ static void player_controller_finalize (GObject* obj) {
PlayerController * self;
self = PLAYER_CONTROLLER (obj);
_g_object_unref0 (self->priv->root_menu);
- _g_free0 (self->priv->_name);
_g_free0 (self->priv->_dbus_name);
_g_object_unref0 (self->custom_items);
_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);
}
@@ -801,9 +884,6 @@ static void _vala_player_controller_get_property (GObject * object, guint proper
PlayerController * self;
self = PLAYER_CONTROLLER (object);
switch (property_id) {
- case PLAYER_CONTROLLER_NAME:
- g_value_set_string (value, player_controller_get_name (self));
- break;
case PLAYER_CONTROLLER_DBUS_NAME:
g_value_set_string (value, player_controller_get_dbus_name (self));
break;
@@ -827,9 +907,6 @@ static void _vala_player_controller_set_property (GObject * object, guint proper
PlayerController * self;
self = PLAYER_CONTROLLER (object);
switch (property_id) {
- case PLAYER_CONTROLLER_NAME:
- player_controller_set_name (self, g_value_get_string (value));
- break;
case PLAYER_CONTROLLER_DBUS_NAME:
player_controller_set_dbus_name (self, g_value_get_string (value));
break;
diff --git a/src/player-controller.vala b/src/player-controller.vala
index 97f5303..adefb65 100644
--- a/src/player-controller.vala
+++ b/src/player-controller.vala
@@ -23,13 +23,14 @@ using Gee;
public class PlayerController : GLib.Object
{
- public const int WIDGET_QUANTITY = 4;
+ public const int WIDGET_QUANTITY = 5;
public static enum widget_order{
SEPARATOR,
TITLE,
METADATA,
- TRANSPORT
+ TRANSPORT,
+ PLAYLISTS
}
public enum state{
@@ -43,37 +44,39 @@ public class PlayerController : GLib.Object
public int current_state = state.OFFLINE;
private Dbusmenu.Menuitem root_menu;
- public string name { get; set;}
public string dbus_name { get; set;}
- public ArrayList<PlayerItem> custom_items;
+ public ArrayList<PlayerItem> custom_items;
public Mpris2Controller mpris_bridge;
public AppInfo? app_info { get; set;}
public int menu_offset { get; set;}
public string icon_name { get; set; }
-
+ public bool? use_playlists;
+
public PlayerController(Dbusmenu.Menuitem root,
GLib.AppInfo app,
string? dbus_name,
string icon_name,
int offset,
+ bool? use_playlists,
state initial_state)
{
+ this.use_playlists = use_playlists;
this.root_menu = root;
this.app_info = app;
this.dbus_name = dbus_name;
- this.name = format_player_name(this.app_info.get_name());
this.icon_name = icon_name;
this.custom_items = new ArrayList<PlayerItem>();
this.current_state = initial_state;
this.menu_offset = offset;
this.construct_widgets();
this.establish_mpris_connection();
- this.update_layout();
+ this.update_layout();
}
public void update_state(state new_state)
{
- debug("update_state - player controller %s : new state %i", this.name, new_state);
+ debug("update_state - player controller %s : new state %i", this.app_info.get_name(),
+ new_state);
this.current_state = new_state;
this.update_layout();
}
@@ -81,7 +84,7 @@ public class PlayerController : GLib.Object
public void activate( string dbus_name )
{
this.dbus_name = dbus_name;
- this.establish_mpris_connection();
+ this.establish_mpris_connection();
}
/*
@@ -92,13 +95,14 @@ public class PlayerController : GLib.Object
*/
public void instantiate()
{
- debug("instantiate in player controller for %s", this.name);
+ debug("instantiate in player controller for %s", this.app_info.get_name() );
try{
this.app_info.launch(null, null);
this.update_state(state.INSTANTIATING);
}
catch(GLib.Error error){
- warning("Failed to launch app %s with error message: %s", this.name, error.message);
+ warning("Failed to launch app %s with error message: %s", this.app_info.get_name(),
+ error.message );
}
}
@@ -108,6 +112,9 @@ public class PlayerController : GLib.Object
debug("establish_mpris_connection - Not ready to connect");
return;
}
+ debug ( " establish mpris connection - use playlists value = %s ",
+ this.use_playlists.to_string() );
+
this.mpris_bridge = new Mpris2Controller(this);
this.determine_state();
}
@@ -125,22 +132,29 @@ public class PlayerController : GLib.Object
this.custom_items[widget_order.TRANSPORT].reset(TransportMenuitem.attributes_format());
this.custom_items[widget_order.METADATA].reset(MetadataMenuitem.attributes_format());
TitleMenuitem title = this.custom_items[widget_order.TITLE] as TitleMenuitem;
- title.toggle_active_triangle(false);
+ title.toggle_active_triangle(false);
+ this.mpris_bridge = null;
}
public void update_layout()
{
+ PlaylistsMenuitem playlists_menuitem = this.custom_items[widget_order.PLAYLISTS] as PlaylistsMenuitem;
+
if(this.current_state != state.CONNECTED){
this.custom_items[widget_order.TRANSPORT].property_set_bool(MENUITEM_PROP_VISIBLE,
false);
this.custom_items[widget_order.METADATA].property_set_bool(MENUITEM_PROP_VISIBLE,
false);
+ playlists_menuitem.root_item.property_set_bool ( MENUITEM_PROP_VISIBLE,
+ false );
return;
}
this.custom_items[widget_order.METADATA].property_set_bool(MENUITEM_PROP_VISIBLE,
this.custom_items[widget_order.METADATA].populated(MetadataMenuitem.attributes_format()));
this.custom_items[widget_order.TRANSPORT].property_set_bool(MENUITEM_PROP_VISIBLE,
true);
+ playlists_menuitem.root_item.property_set_bool ( MENUITEM_PROP_VISIBLE,
+ this.use_playlists );
}
private void construct_widgets()
@@ -159,12 +173,22 @@ public class PlayerController : GLib.Object
// Transport item
TransportMenuitem transport_item = new TransportMenuitem(this);
this.custom_items.add(transport_item);
-
+
+ // Playlist item
+ PlaylistsMenuitem playlist_menuitem = new PlaylistsMenuitem(this);
+ this.custom_items.add(playlist_menuitem);
+
foreach(PlayerItem item in this.custom_items){
- root_menu.child_add_position(item, this.menu_offset + this.custom_items.index_of(item));
+ if (this.custom_items.index_of(item) != 4) {
+ root_menu.child_add_position(item, this.menu_offset + this.custom_items.index_of(item));
+ }
+ else{
+ PlaylistsMenuitem playlists_menuitem = item as PlaylistsMenuitem;
+ root_menu.child_add_position(playlists_menuitem.root_item, this.menu_offset + this.custom_items.index_of(item));
+ }
}
- }
-
+ }
+
private static string format_player_name(owned string app_info_name)
{
string result = app_info_name.down().strip();
@@ -184,11 +208,11 @@ public class PlayerController : GLib.Object
if(this.mpris_bridge.connected() == true){
this.update_state(state.CONNECTED);
TitleMenuitem title = this.custom_items[widget_order.TITLE] as TitleMenuitem;
- title.toggle_active_triangle(true);
+ title.toggle_active_triangle(true);
this.mpris_bridge.initial_update();
}
else{
this.update_state(state.DISCONNECTED);
}
- }
+ }
}
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/player-item.vala b/src/player-item.vala
index c80a17d..f883a1e 100644
--- a/src/player-item.vala
+++ b/src/player-item.vala
@@ -54,7 +54,7 @@ public class PlayerItem : Dbusmenu.Menuitem
if(data == null){
debug("PlayerItem::Update -> The hashtable was null - just leave it!");
return;
- }
+ }
foreach(string property in attributes){
string[] input_keys = property.split("-");
diff --git a/src/playlists-menu-item.c b/src/playlists-menu-item.c
new file mode 100644
index 0000000..ddbe12a
--- /dev/null
+++ b/src/playlists-menu-item.c
@@ -0,0 +1,408 @@
+/* playlists-menu-item.c generated by valac 0.11.3, the Vala compiler
+ * generated from playlists-menu-item.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 <libdbusmenu-glib/client.h>
+#include <libdbusmenu-glib/menuitem-proxy.h>
+#include <libdbusmenu-glib/menuitem.h>
+#include <libdbusmenu-glib/server.h>
+#include <gee.h>
+#include <stdlib.h>
+#include <string.h>
+#include <common-defs.h>
+
+
+#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;
+typedef struct _PlayerItemPrivate PlayerItemPrivate;
+
+#define TYPE_PLAYLISTS_MENUITEM (playlists_menuitem_get_type ())
+#define PLAYLISTS_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYLISTS_MENUITEM, PlaylistsMenuitem))
+#define PLAYLISTS_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYLISTS_MENUITEM, PlaylistsMenuitemClass))
+#define IS_PLAYLISTS_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYLISTS_MENUITEM))
+#define IS_PLAYLISTS_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYLISTS_MENUITEM))
+#define PLAYLISTS_MENUITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYLISTS_MENUITEM, PlaylistsMenuitemClass))
+
+typedef struct _PlaylistsMenuitem PlaylistsMenuitem;
+typedef struct _PlaylistsMenuitemClass PlaylistsMenuitemClass;
+typedef struct _PlaylistsMenuitemPrivate PlaylistsMenuitemPrivate;
+
+#define TYPE_PLAYLIST_DETAILS (playlist_details_get_type ())
+typedef struct _PlaylistDetails PlaylistDetails;
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+
+#define TYPE_PLAYER_CONTROLLER (player_controller_get_type ())
+#define PLAYER_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYER_CONTROLLER, PlayerController))
+#define PLAYER_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYER_CONTROLLER, PlayerControllerClass))
+#define IS_PLAYER_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYER_CONTROLLER))
+#define IS_PLAYER_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYER_CONTROLLER))
+#define PLAYER_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYER_CONTROLLER, PlayerControllerClass))
+
+typedef struct _PlayerController PlayerController;
+typedef struct _PlayerControllerClass PlayerControllerClass;
+typedef struct _Block1Data Block1Data;
+#define _playlist_details_free0(var) ((var == NULL) ? NULL : (var = (playlist_details_free (var), NULL)))
+#define _g_free0(var) (var = (g_free (var), NULL))
+typedef struct _PlayerControllerPrivate PlayerControllerPrivate;
+
+#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;
+
+struct _PlayerItem {
+ DbusmenuMenuitem parent_instance;
+ PlayerItemPrivate * priv;
+};
+
+struct _PlayerItemClass {
+ DbusmenuMenuitemClass parent_class;
+};
+
+struct _PlaylistsMenuitem {
+ PlayerItem parent_instance;
+ PlaylistsMenuitemPrivate * priv;
+ DbusmenuMenuitem* root_item;
+};
+
+struct _PlaylistsMenuitemClass {
+ PlayerItemClass parent_class;
+};
+
+struct _PlaylistDetails {
+ char* path;
+ gchar* name;
+ gchar* icon_path;
+};
+
+struct _PlaylistsMenuitemPrivate {
+ GeeHashMap* current_playlists;
+};
+
+struct _Block1Data {
+ int _ref_count_;
+ PlaylistsMenuitem * self;
+ DbusmenuMenuitem* menuitem;
+};
+
+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 playlists_menuitem_parent_class = NULL;
+
+GType player_item_get_type (void) G_GNUC_CONST;
+GType playlists_menuitem_get_type (void) G_GNUC_CONST;
+GType playlist_details_get_type (void) G_GNUC_CONST;
+PlaylistDetails* playlist_details_dup (const PlaylistDetails* self);
+void playlist_details_free (PlaylistDetails* self);
+void playlist_details_copy (const PlaylistDetails* self, PlaylistDetails* dest);
+void playlist_details_destroy (PlaylistDetails* self);
+#define PLAYLISTS_MENUITEM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_PLAYLISTS_MENUITEM, PlaylistsMenuitemPrivate))
+enum {
+ PLAYLISTS_MENUITEM_DUMMY_PROPERTY
+};
+GType player_controller_get_type (void) G_GNUC_CONST;
+PlaylistsMenuitem* playlists_menuitem_new (PlayerController* parent);
+PlaylistsMenuitem* playlists_menuitem_construct (GType object_type, PlayerController* parent);
+void playlists_menuitem_update (PlaylistsMenuitem* self, PlaylistDetails* playlists, int playlists_length1);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (Block1Data* _data1_);
+static gboolean playlists_menuitem_already_observed (PlaylistsMenuitem* self, PlaylistDetails* new_detail);
+static void _lambda1_ (Block1Data* _data1_);
+static void playlists_menuitem_submenu_item_activated (PlaylistsMenuitem* self, gint menu_item_id);
+static void __lambda1__dbusmenu_menuitem_item_activated (DbusmenuMenuitem* _sender, guint timestamp, gpointer self);
+void playlists_menuitem_update_active_playlist (PlaylistsMenuitem* self, PlaylistDetails* detail);
+PlayerController* player_item_get_owner (PlayerItem* self);
+GType mpris2_controller_get_type (void) G_GNUC_CONST;
+void mpris2_controller_activate_playlist (Mpris2Controller* self, const char* path);
+GeeHashSet* playlists_menuitem_attributes_format (void);
+static GObject * playlists_menuitem_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
+static void playlists_menuitem_finalize (GObject* obj);
+
+
+PlaylistsMenuitem* playlists_menuitem_construct (GType object_type, PlayerController* parent) {
+ PlaylistsMenuitem * self = NULL;
+ g_return_val_if_fail (parent != NULL, NULL);
+ self = (PlaylistsMenuitem*) g_object_new (object_type, "item-type", DBUSMENU_PLAYLISTS_MENUITEM_TYPE, "owner", parent, NULL);
+ return self;
+}
+
+
+PlaylistsMenuitem* playlists_menuitem_new (PlayerController* parent) {
+ return playlists_menuitem_construct (TYPE_PLAYLISTS_MENUITEM, parent);
+}
+
+
+static Block1Data* block1_data_ref (Block1Data* _data1_) {
+ g_atomic_int_inc (&_data1_->_ref_count_);
+ return _data1_;
+}
+
+
+static void block1_data_unref (Block1Data* _data1_) {
+ if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+ _g_object_unref0 (_data1_->self);
+ _g_object_unref0 (_data1_->menuitem);
+ g_slice_free (Block1Data, _data1_);
+ }
+}
+
+
+static void _lambda1_ (Block1Data* _data1_) {
+ PlaylistsMenuitem * self;
+ gint _tmp0_;
+ self = _data1_->self;
+ _tmp0_ = dbusmenu_menuitem_get_id (_data1_->menuitem);
+ playlists_menuitem_submenu_item_activated (self, _tmp0_);
+}
+
+
+static void __lambda1__dbusmenu_menuitem_item_activated (DbusmenuMenuitem* _sender, guint timestamp, gpointer self) {
+ _lambda1_ (self);
+}
+
+
+void playlists_menuitem_update (PlaylistsMenuitem* self, PlaylistDetails* playlists, int playlists_length1) {
+ g_return_if_fail (self != NULL);
+ {
+ PlaylistDetails* detail_collection;
+ int detail_collection_length1;
+ int detail_it;
+ detail_collection = playlists;
+ detail_collection_length1 = playlists_length1;
+ for (detail_it = 0; detail_it < playlists_length1; detail_it = detail_it + 1) {
+ PlaylistDetails _tmp0_;
+ PlaylistDetails _tmp1_ = {0};
+ PlaylistDetails detail;
+ _tmp0_ = (playlist_details_copy (&detail_collection[detail_it], &_tmp1_), _tmp1_);
+ detail = _tmp0_;
+ {
+ Block1Data* _data1_;
+ gboolean _tmp2_;
+ DbusmenuMenuitem* _tmp3_ = NULL;
+ gint _tmp4_;
+ _data1_ = g_slice_new0 (Block1Data);
+ _data1_->_ref_count_ = 1;
+ _data1_->self = g_object_ref (self);
+ _tmp2_ = playlists_menuitem_already_observed (self, &detail);
+ if (_tmp2_) {
+ playlist_details_destroy (&detail);
+ block1_data_unref (_data1_);
+ continue;
+ }
+ _tmp3_ = dbusmenu_menuitem_new ();
+ _data1_->menuitem = _tmp3_;
+ dbusmenu_menuitem_property_set (_data1_->menuitem, DBUSMENU_MENUITEM_PROP_LABEL, detail.name);
+ dbusmenu_menuitem_property_set (_data1_->menuitem, DBUSMENU_MENUITEM_PROP_ICON_NAME, "source-smart-playlist");
+ dbusmenu_menuitem_property_set_bool (_data1_->menuitem, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE);
+ dbusmenu_menuitem_property_set_bool (_data1_->menuitem, DBUSMENU_MENUITEM_PROP_ENABLED, TRUE);
+ _tmp4_ = dbusmenu_menuitem_get_id (_data1_->menuitem);
+ gee_abstract_map_set ((GeeAbstractMap*) self->priv->current_playlists, GINT_TO_POINTER (_tmp4_), &detail);
+ g_signal_connect_data (_data1_->menuitem, "item-activated", (GCallback) __lambda1__dbusmenu_menuitem_item_activated, block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0);
+ dbusmenu_menuitem_child_append (self->root_item, _data1_->menuitem);
+ playlist_details_destroy (&detail);
+ block1_data_unref (_data1_);
+ }
+ }
+ }
+}
+
+
+static gboolean playlists_menuitem_already_observed (PlaylistsMenuitem* self, PlaylistDetails* new_detail) {
+ gboolean result = FALSE;
+ g_return_val_if_fail (self != NULL, FALSE);
+ {
+ GeeCollection* _tmp0_ = NULL;
+ GeeCollection* _tmp1_;
+ GeeIterator* _tmp2_ = NULL;
+ GeeIterator* _tmp3_;
+ GeeIterator* _detail_it;
+ _tmp0_ = gee_map_get_values ((GeeMap*) self->priv->current_playlists);
+ _tmp1_ = _tmp0_;
+ _tmp2_ = gee_iterable_iterator ((GeeIterable*) _tmp1_);
+ _detail_it = (_tmp3_ = _tmp2_, _g_object_unref0 (_tmp1_), _tmp3_);
+ while (TRUE) {
+ gboolean _tmp4_;
+ gpointer _tmp5_ = NULL;
+ PlaylistDetails* _tmp6_;
+ PlaylistDetails _tmp7_;
+ PlaylistDetails _tmp8_ = {0};
+ PlaylistDetails _tmp9_;
+ PlaylistDetails detail;
+ _tmp4_ = gee_iterator_next (_detail_it);
+ if (!_tmp4_) {
+ break;
+ }
+ _tmp5_ = gee_iterator_get (_detail_it);
+ _tmp6_ = (PlaylistDetails*) _tmp5_;
+ _tmp7_ = (playlist_details_copy (_tmp6_, &_tmp8_), _tmp8_);
+ detail = (_tmp9_ = _tmp7_, _playlist_details_free0 (_tmp6_), _tmp9_);
+ if (g_strcmp0 ((*new_detail).path, detail.path) == 0) {
+ result = TRUE;
+ playlist_details_destroy (&detail);
+ _g_object_unref0 (_detail_it);
+ return result;
+ }
+ playlist_details_destroy (&detail);
+ }
+ _g_object_unref0 (_detail_it);
+ }
+ result = FALSE;
+ return result;
+}
+
+
+void playlists_menuitem_update_active_playlist (PlaylistsMenuitem* self, PlaylistDetails* detail) {
+ gchar* _tmp0_;
+ gchar* update;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = g_strdup ((*detail).name);
+ update = _tmp0_;
+ if (g_strcmp0 (update, "") == 0) {
+ gchar* _tmp1_;
+ gchar* _tmp2_;
+ _tmp1_ = g_strdup ("Choose Playlist");
+ _tmp2_ = _tmp1_;
+ _g_free0 (update);
+ update = _tmp2_;
+ }
+ dbusmenu_menuitem_property_set (self->root_item, DBUSMENU_MENUITEM_PROP_LABEL, update);
+ _g_free0 (update);
+}
+
+
+static void playlists_menuitem_submenu_item_activated (PlaylistsMenuitem* self, gint menu_item_id) {
+ gboolean _tmp0_;
+ PlayerController* _tmp1_ = NULL;
+ gpointer _tmp2_ = NULL;
+ PlaylistDetails* _tmp3_;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = gee_abstract_map_has_key ((GeeAbstractMap*) self->priv->current_playlists, GINT_TO_POINTER (menu_item_id));
+ if (!_tmp0_) {
+ g_warning ("playlists-menu-item.vala:72: item %i was activated but we don't have a" \
+" corresponding playlist", menu_item_id);
+ return;
+ }
+ _tmp1_ = player_item_get_owner ((PlayerItem*) self);
+ _tmp2_ = gee_abstract_map_get ((GeeAbstractMap*) self->priv->current_playlists, GINT_TO_POINTER (menu_item_id));
+ _tmp3_ = (PlaylistDetails*) _tmp2_;
+ mpris2_controller_activate_playlist (_tmp1_->mpris_bridge, (*_tmp3_).path);
+ _playlist_details_free0 (_tmp3_);
+}
+
+
+GeeHashSet* playlists_menuitem_attributes_format (void) {
+ GeeHashSet* result = NULL;
+ GeeHashSet* _tmp0_ = NULL;
+ GeeHashSet* attrs;
+ _tmp0_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL);
+ attrs = _tmp0_;
+ gee_abstract_collection_add ((GeeAbstractCollection*) attrs, DBUSMENU_PLAYLISTS_MENUITEM_TITLE);
+ gee_abstract_collection_add ((GeeAbstractCollection*) attrs, DBUSMENU_PLAYLISTS_MENUITEM_PLAYLISTS);
+ result = attrs;
+ return result;
+}
+
+
+static GObject * playlists_menuitem_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
+ GObject * obj;
+ GObjectClass * parent_class;
+ PlaylistsMenuitem * self;
+ GeeHashMap* _tmp0_ = NULL;
+ GeeHashMap* _tmp1_;
+ DbusmenuMenuitem* _tmp2_ = NULL;
+ DbusmenuMenuitem* _tmp3_;
+ parent_class = G_OBJECT_CLASS (playlists_menuitem_parent_class);
+ obj = parent_class->constructor (type, n_construct_properties, construct_properties);
+ self = PLAYLISTS_MENUITEM (obj);
+ _tmp0_ = gee_hash_map_new (G_TYPE_INT, NULL, NULL, TYPE_PLAYLIST_DETAILS, (GBoxedCopyFunc) playlist_details_dup, playlist_details_free, NULL, NULL, NULL);
+ _tmp1_ = _tmp0_;
+ _g_object_unref0 (self->priv->current_playlists);
+ self->priv->current_playlists = _tmp1_;
+ _tmp2_ = dbusmenu_menuitem_new ();
+ _tmp3_ = _tmp2_;
+ _g_object_unref0 (self->root_item);
+ self->root_item = _tmp3_;
+ dbusmenu_menuitem_property_set (self->root_item, DBUSMENU_MENUITEM_PROP_LABEL, "Choose Playlist");
+ return obj;
+}
+
+
+static void playlists_menuitem_class_init (PlaylistsMenuitemClass * klass) {
+ playlists_menuitem_parent_class = g_type_class_peek_parent (klass);
+ g_type_class_add_private (klass, sizeof (PlaylistsMenuitemPrivate));
+ G_OBJECT_CLASS (klass)->constructor = playlists_menuitem_constructor;
+ G_OBJECT_CLASS (klass)->finalize = playlists_menuitem_finalize;
+}
+
+
+static void playlists_menuitem_instance_init (PlaylistsMenuitem * self) {
+ self->priv = PLAYLISTS_MENUITEM_GET_PRIVATE (self);
+}
+
+
+static void playlists_menuitem_finalize (GObject* obj) {
+ PlaylistsMenuitem * self;
+ self = PLAYLISTS_MENUITEM (obj);
+ _g_object_unref0 (self->priv->current_playlists);
+ _g_object_unref0 (self->root_item);
+ G_OBJECT_CLASS (playlists_menuitem_parent_class)->finalize (obj);
+}
+
+
+GType playlists_menuitem_get_type (void) {
+ static volatile gsize playlists_menuitem_type_id__volatile = 0;
+ if (g_once_init_enter (&playlists_menuitem_type_id__volatile)) {
+ static const GTypeInfo g_define_type_info = { sizeof (PlaylistsMenuitemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) playlists_menuitem_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PlaylistsMenuitem), 0, (GInstanceInitFunc) playlists_menuitem_instance_init, NULL };
+ GType playlists_menuitem_type_id;
+ playlists_menuitem_type_id = g_type_register_static (TYPE_PLAYER_ITEM, "PlaylistsMenuitem", &g_define_type_info, 0);
+ g_once_init_leave (&playlists_menuitem_type_id__volatile, playlists_menuitem_type_id);
+ }
+ return playlists_menuitem_type_id__volatile;
+}
+
+
+
diff --git a/src/playlists-menu-item.vala b/src/playlists-menu-item.vala
new file mode 100644
index 0000000..024839c
--- /dev/null
+++ b/src/playlists-menu-item.vala
@@ -0,0 +1,87 @@
+/*
+Copyright 2010 Canonical Ltd.
+
+Authors:
+ Conor Curran <conor.curran@canonical.com>
+
+This program is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 3, as published
+by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranties of
+MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+using Dbusmenu;
+using DbusmenuPlaylists;
+using Gee;
+
+public class PlaylistsMenuitem : PlayerItem
+{
+ private HashMap<int, PlaylistDetails?> current_playlists;
+ public Menuitem root_item;
+ public PlaylistsMenuitem ( PlayerController parent )
+ {
+ Object ( item_type: MENUITEM_TYPE, owner: parent );
+ }
+ construct{
+ this.current_playlists = new HashMap<int, PlaylistDetails?>();
+ this.root_item = new Menuitem();
+ this.root_item.property_set ( MENUITEM_PROP_LABEL, "Choose Playlist" );
+ }
+
+ public new void update (PlaylistDetails[] playlists)
+ {
+ foreach ( PlaylistDetails detail in playlists ){
+ if (this.already_observed(detail)) continue;
+ Dbusmenu.Menuitem menuitem = new Menuitem();
+ menuitem.property_set (MENUITEM_PROP_LABEL, detail.name);
+ menuitem.property_set (MENUITEM_PROP_ICON_NAME, "source-smart-playlist");
+ menuitem.property_set_bool (MENUITEM_PROP_VISIBLE, true);
+ menuitem.property_set_bool (MENUITEM_PROP_ENABLED, true);
+ this.current_playlists.set( menuitem.id, detail );
+ menuitem.item_activated.connect(() => {
+ submenu_item_activated (menuitem.id );});
+ this.root_item.child_append( menuitem );
+ }
+ }
+
+ private bool already_observed (PlaylistDetails new_detail)
+ {
+ foreach ( PlaylistDetails detail in this.current_playlists.values ){
+ if (new_detail.path == detail.path) return true;
+ }
+ return false;
+ }
+
+ public void update_active_playlist(PlaylistDetails detail)
+ {
+ var update = detail.name;
+ if ( update == "" ) update = "Choose Playlist";
+ this.root_item.property_set ( MENUITEM_PROP_LABEL, update );
+ }
+
+ private void submenu_item_activated (int menu_item_id)
+ {
+ if(!this.current_playlists.has_key(menu_item_id)){
+ warning( "item %i was activated but we don't have a corresponding playlist",
+ menu_item_id );
+ return;
+ }
+ this.owner.mpris_bridge.activate_playlist ( this.current_playlists[menu_item_id].path );
+ }
+
+ public static HashSet<string> attributes_format()
+ {
+ HashSet<string> attrs = new HashSet<string>();
+ attrs.add(MENUITEM_TITLE);
+ attrs.add(MENUITEM_PLAYLISTS);
+ return attrs;
+ }
+
+}
diff --git a/src/settings-manager.c b/src/settings-manager.c
index 06f3afb..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 */
/*
@@ -25,6 +25,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
+#include <gee.h>
#define TYPE_SETTINGS_MANAGER (settings_manager_get_type ())
@@ -38,6 +39,7 @@ typedef struct _SettingsManager SettingsManager;
typedef struct _SettingsManagerClass SettingsManagerClass;
typedef struct _SettingsManagerPrivate SettingsManagerPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _g_free0(var) (var = (g_free (var), NULL))
struct _SettingsManager {
GObject parent_instance;
@@ -63,8 +65,10 @@ enum {
SettingsManager* settings_manager_new (void);
SettingsManager* settings_manager_construct (GType object_type);
gchar** settings_manager_fetch_blacklist (SettingsManager* self, int* result_length1);
-gchar** settings_manager_fetch_interested (SettingsManager* self, int* result_length1);
-gboolean settings_manager_add_interested (SettingsManager* self, const gchar* app_desktop_name);
+GeeArrayList* settings_manager_fetch_interested (SettingsManager* self);
+static gboolean _vala_string_array_contains (gchar** stack, int stack_length, gchar* needle);
+void settings_manager_clear_list (SettingsManager* self);
+void settings_manager_add_interested (SettingsManager* self, const gchar* app_desktop_name);
static void _vala_array_add1 (gchar*** array, int* length, int* size, gchar* value);
static void settings_manager_on_blacklist_event (SettingsManager* self);
static void g_cclosure_user_marshal_VOID__BOXED_INT (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data);
@@ -102,20 +106,80 @@ gchar** settings_manager_fetch_blacklist (SettingsManager* self, int* result_len
}
-gchar** settings_manager_fetch_interested (SettingsManager* self, int* result_length1) {
- gchar** result = NULL;
+static gboolean _vala_string_array_contains (gchar** stack, int stack_length, gchar* needle) {
+ int i;
+ for (i = 0; i < stack_length; i++) {
+ if (g_strcmp0 (stack[i], needle) == 0) {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+
+GeeArrayList* settings_manager_fetch_interested (SettingsManager* self) {
+ GeeArrayList* result = NULL;
gchar** _tmp0_;
gchar** _tmp1_ = NULL;
+ gint blacklisted_length1;
+ gint _blacklisted_size_;
gchar** _tmp2_;
+ gchar** blacklisted;
+ gchar** _tmp3_;
+ gchar** _tmp4_ = NULL;
+ gint interested_length1;
+ gint _interested_size_;
+ gchar** _tmp5_;
+ gchar** interested;
+ GeeArrayList* _tmp6_ = NULL;
+ GeeArrayList* list;
g_return_val_if_fail (self != NULL, NULL);
- _tmp1_ = _tmp0_ = g_settings_get_strv (self->priv->settings, "interested-media-players");
+ _tmp1_ = _tmp0_ = g_settings_get_strv (self->priv->settings, "blacklisted-media-players");
_tmp2_ = _tmp1_;
- *result_length1 = _vala_array_length (_tmp0_);
- result = _tmp2_;
+ blacklisted_length1 = _vala_array_length (_tmp0_);
+ _blacklisted_size_ = blacklisted_length1;
+ blacklisted = _tmp2_;
+ _tmp4_ = _tmp3_ = g_settings_get_strv (self->priv->settings, "interested-media-players");
+ _tmp5_ = _tmp4_;
+ interested_length1 = _vala_array_length (_tmp3_);
+ _interested_size_ = interested_length1;
+ interested = _tmp5_;
+ _tmp6_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL);
+ list = _tmp6_;
+ {
+ gchar** s_collection;
+ int s_collection_length1;
+ int s_it;
+ s_collection = interested;
+ s_collection_length1 = interested_length1;
+ for (s_it = 0; s_it < interested_length1; s_it = s_it + 1) {
+ gchar* _tmp7_;
+ gchar* s;
+ _tmp7_ = g_strdup (s_collection[s_it]);
+ s = _tmp7_;
+ {
+ if (_vala_string_array_contains (blacklisted, blacklisted_length1, s)) {
+ _g_free0 (s);
+ continue;
+ }
+ gee_abstract_collection_add ((GeeAbstractCollection*) list, s);
+ _g_free0 (s);
+ }
+ }
+ }
+ result = list;
+ interested = (_vala_array_free (interested, interested_length1, (GDestroyNotify) g_free), NULL);
+ blacklisted = (_vala_array_free (blacklisted, blacklisted_length1, (GDestroyNotify) g_free), NULL);
return result;
}
+void settings_manager_clear_list (SettingsManager* self) {
+ g_return_if_fail (self != NULL);
+ g_settings_reset (self->priv->settings, "interested-media-players");
+}
+
+
static void _vala_array_add1 (gchar*** array, int* length, int* size, gchar* value) {
if ((*length) == (*size)) {
*size = (*size) ? (2 * (*size)) : 4;
@@ -126,29 +190,47 @@ static void _vala_array_add1 (gchar*** array, int* length, int* size, gchar* val
}
-gboolean settings_manager_add_interested (SettingsManager* self, const gchar* app_desktop_name) {
- gboolean result = FALSE;
- gint _tmp0_;
+void settings_manager_add_interested (SettingsManager* self, const gchar* app_desktop_name) {
+ gchar** _tmp0_;
gchar** _tmp1_ = NULL;
gint already_interested_length1;
gint _already_interested_size_;
gchar** _tmp2_;
gchar** already_interested;
- gchar* _tmp3_;
- gboolean _tmp4_;
- g_return_val_if_fail (self != NULL, FALSE);
- g_return_val_if_fail (app_desktop_name != NULL, FALSE);
- _tmp1_ = settings_manager_fetch_interested (self, &_tmp0_);
+ gchar* _tmp4_;
+ g_return_if_fail (self != NULL);
+ g_return_if_fail (app_desktop_name != NULL);
+ _tmp1_ = _tmp0_ = g_settings_get_strv (self->priv->settings, "interested-media-players");
_tmp2_ = _tmp1_;
- already_interested_length1 = _tmp0_;
+ already_interested_length1 = _vala_array_length (_tmp0_);
_already_interested_size_ = already_interested_length1;
already_interested = _tmp2_;
- _tmp3_ = g_strdup (app_desktop_name);
- _vala_array_add1 (&already_interested, &already_interested_length1, &_already_interested_size_, _tmp3_);
- _tmp4_ = g_settings_set_strv (self->priv->settings, "interested-media-players", already_interested);
- result = _tmp4_;
+ {
+ gchar** s_collection;
+ int s_collection_length1;
+ int s_it;
+ s_collection = already_interested;
+ s_collection_length1 = already_interested_length1;
+ for (s_it = 0; s_it < already_interested_length1; s_it = s_it + 1) {
+ gchar* _tmp3_;
+ gchar* s;
+ _tmp3_ = g_strdup (s_collection[s_it]);
+ s = _tmp3_;
+ {
+ if (g_strcmp0 (s, app_desktop_name) == 0) {
+ _g_free0 (s);
+ already_interested = (_vala_array_free (already_interested, already_interested_length1, (GDestroyNotify) g_free), NULL);
+ return;
+ }
+ _g_free0 (s);
+ }
+ }
+ }
+ _tmp4_ = g_strdup (app_desktop_name);
+ _vala_array_add1 (&already_interested, &already_interested_length1, &_already_interested_size_, _tmp4_);
+ g_settings_set_strv (self->priv->settings, "interested-media-players", already_interested);
+ g_settings_apply (self->priv->settings);
already_interested = (_vala_array_free (already_interested, already_interested_length1, (GDestroyNotify) g_free), NULL);
- return result;
}
diff --git a/src/settings-manager.vala b/src/settings-manager.vala
index 0a9f0e1..90219c3 100644
--- a/src/settings-manager.vala
+++ b/src/settings-manager.vala
@@ -27,7 +27,7 @@ public class SettingsManager : GLib.Object
}
construct{
this.settings = new Settings ("com.canonical.indicators.sound");
- settings.changed["blacklisted-media-players"].connect (on_blacklist_event);
+ this.settings.changed["blacklisted-media-players"].connect (on_blacklist_event);
}
public string[] fetch_blacklist()
@@ -35,17 +35,33 @@ public class SettingsManager : GLib.Object
return this.settings.get_strv ("blacklisted-media-players");
}
- public string[] fetch_interested()
+ public ArrayList<string> fetch_interested()
{
- return this.settings.get_strv ("interested-media-players");
+ var blacklisted = this.settings.get_strv ("blacklisted-media-players");
+ var interested = this.settings.get_strv ("interested-media-players");
+ var list = new ArrayList<string>();
+ foreach(var s in interested){
+ if ( s in blacklisted ) continue;
+ list.add(s);
+ }
+ return list;
}
- public bool add_interested(string app_desktop_name)
+ public void clear_list()
{
- string[] already_interested = fetch_interested();
+ this.settings.reset("interested-media-players");
+ }
+
+ public void add_interested(string app_desktop_name)
+ {
+ var already_interested = this.settings.get_strv ("interested-media-players");
+ foreach ( var s in already_interested){
+ if ( s == app_desktop_name ) return;
+ }
already_interested += (app_desktop_name);
- return this.settings.set_strv( "interested-media-players",
- already_interested );
+ this.settings.set_strv( "interested-media-players",
+ already_interested );
+ this.settings.apply();
}
private void on_blacklist_event()
diff --git a/src/title-menu-item.c b/src/title-menu-item.c
index 5e4ee1c..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 */
/*
@@ -27,6 +27,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <libdbusmenu-glib/menuitem.h>
#include <libdbusmenu-glib/server.h>
#include <common-defs.h>
+#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <gee.h>
@@ -102,6 +103,7 @@ struct _PlayerController {
gint current_state;
GeeArrayList* custom_items;
Mpris2Controller* mpris_bridge;
+ gboolean* use_playlists;
};
struct _PlayerControllerClass {
@@ -127,7 +129,7 @@ enum {
GType player_controller_get_type (void) G_GNUC_CONST;
TitleMenuitem* title_menuitem_new (PlayerController* parent);
TitleMenuitem* title_menuitem_construct (GType object_type, PlayerController* parent);
-const gchar* player_controller_get_name (PlayerController* self);
+GAppInfo* player_controller_get_app_info (PlayerController* self);
const gchar* player_controller_get_icon_name (PlayerController* self);
static void title_menuitem_real_handle_event (DbusmenuMenuitem* base, const gchar* name, GValue* input_value, guint timestamp);
PlayerController* player_item_get_owner (PlayerItem* self);
@@ -141,15 +143,14 @@ GeeHashSet* title_menuitem_attributes_format (void);
TitleMenuitem* title_menuitem_construct (GType object_type, PlayerController* parent) {
TitleMenuitem * self = NULL;
- const gchar* _tmp0_ = NULL;
+ GAppInfo* _tmp0_ = NULL;
const gchar* _tmp1_ = NULL;
const gchar* _tmp2_ = NULL;
g_return_val_if_fail (parent != NULL, NULL);
self = (TitleMenuitem*) g_object_new (object_type, "item-type", DBUSMENU_TITLE_MENUITEM_TYPE, "owner", parent, NULL);
- _tmp0_ = player_controller_get_name (parent);
- dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, DBUSMENU_TITLE_MENUITEM_NAME, _tmp0_);
- _tmp1_ = player_controller_get_icon_name (parent);
- g_debug ("title-menu-item.vala:30: title init - icon name = %s", _tmp1_);
+ _tmp0_ = player_controller_get_app_info (parent);
+ _tmp1_ = g_app_info_get_name (_tmp0_);
+ dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, DBUSMENU_TITLE_MENUITEM_NAME, _tmp1_);
_tmp2_ = player_controller_get_icon_name (parent);
dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, DBUSMENU_TITLE_MENUITEM_ICON, _tmp2_);
dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) self, DBUSMENU_TITLE_MENUITEM_RUNNING, FALSE);
diff --git a/src/title-menu-item.vala b/src/title-menu-item.vala
index d782e84..0b99ae3 100644
--- a/src/title-menu-item.vala
+++ b/src/title-menu-item.vala
@@ -26,8 +26,7 @@ public class TitleMenuitem : PlayerItem
public TitleMenuitem(PlayerController parent)
{
Object(item_type: MENUITEM_TYPE, owner: parent);
- this.property_set(MENUITEM_NAME, parent.name);
- debug("title init - icon name = %s", parent.icon_name);
+ this.property_set(MENUITEM_NAME, parent.app_info.get_name());
this.property_set(MENUITEM_ICON, parent.icon_name);
this.property_set_bool(MENUITEM_RUNNING, false);
}
diff --git a/src/title-widget.c b/src/title-widget.c
index cbdf28e..08b4b81 100644
--- a/src/title-widget.c
+++ b/src/title-widget.c
@@ -92,7 +92,7 @@ title_widget_set_icon(TitleWidget *self)
GString* app_panel = g_string_new ( g_utf8_strdown ( dbusmenu_menuitem_property_get(priv->twin_item, DBUSMENU_TITLE_MENUITEM_NAME),
-1 ));
GtkWidget * icon = NULL;
-
+
// Not ideal but apparently we want the banshee icon to be the greyscale one
// and any others to be the icon from the desktop file => colour.
if ( g_string_equal ( banshee_string, app_panel ) == TRUE &&
@@ -153,18 +153,12 @@ title_widget_property_update(DbusmenuMenuitem* item, gchar* property,
{
g_return_if_fail (IS_TITLE_WIDGET (userdata));
TitleWidget* mitem = TITLE_WIDGET(userdata);
- g_debug("PROPERTY UPDATE FOR THE TITLE");
if(g_ascii_strcasecmp(DBUSMENU_TITLE_MENUITEM_NAME, property) == 0){
gtk_menu_item_set_label (GTK_MENU_ITEM(mitem),
g_value_get_string(value));
}
else if(g_ascii_strcasecmp(DBUSMENU_TITLE_MENUITEM_ICON, property) == 0){
- g_debug("changing the icon data on the title - %s",
- g_value_get_string(value));
- GtkWidget * icon = gtk_image_new_from_icon_name(g_value_get_string(value),
- GTK_ICON_SIZE_MENU);
- gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(mitem), GTK_WIDGET(icon));
-
+ title_widget_set_icon (mitem);
}
}
diff --git a/src/transport-menu-item.c b/src/transport-menu-item.c
index 37a63d9..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 */
/*
@@ -29,6 +29,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <common-defs.h>
#include <stdlib.h>
#include <string.h>
+#include <gio/gio.h>
#include <gee.h>
@@ -116,6 +117,7 @@ struct _PlayerController {
gint current_state;
GeeArrayList* custom_items;
Mpris2Controller* mpris_bridge;
+ gboolean* use_playlists;
};
struct _PlayerControllerClass {
@@ -138,7 +140,7 @@ TransportMenuitem* transport_menuitem_construct (GType object_type, PlayerContro
void transport_menuitem_change_play_state (TransportMenuitem* self, TransportMenuitemstate update);
static void transport_menuitem_real_handle_event (DbusmenuMenuitem* base, const gchar* name, GValue* input_value, guint timestamp);
PlayerController* player_item_get_owner (PlayerItem* self);
-const gchar* player_controller_get_name (PlayerController* self);
+GAppInfo* player_controller_get_app_info (PlayerController* self);
GType mpris2_controller_get_type (void) G_GNUC_CONST;
void mpris2_controller_transport_update (Mpris2Controller* self, TransportMenuitemaction command);
GeeHashSet* transport_menuitem_attributes_format (void);
@@ -197,8 +199,9 @@ static void transport_menuitem_real_handle_event (DbusmenuMenuitem* base, const
gchar* _tmp1_ = NULL;
gchar* _tmp2_;
PlayerController* _tmp3_ = NULL;
- const gchar* _tmp4_ = NULL;
- PlayerController* _tmp5_ = NULL;
+ GAppInfo* _tmp4_ = NULL;
+ const gchar* _tmp5_ = NULL;
+ PlayerController* _tmp6_ = NULL;
self = (TransportMenuitem*) base;
g_return_if_fail (name != NULL);
_tmp0_ = g_value_get_int (input_value);
@@ -208,10 +211,11 @@ static void transport_menuitem_real_handle_event (DbusmenuMenuitem* base, const
g_debug ("transport-menu-item.vala:53: handle_event with value %s", _tmp2_);
_g_free0 (_tmp2_);
_tmp3_ = player_item_get_owner ((PlayerItem*) self);
- _tmp4_ = player_controller_get_name (_tmp3_);
- g_debug ("transport-menu-item.vala:54: transport owner name = %s", _tmp4_);
- _tmp5_ = player_item_get_owner ((PlayerItem*) self);
- mpris2_controller_transport_update (_tmp5_->mpris_bridge, (TransportMenuitemaction) input);
+ _tmp4_ = player_controller_get_app_info (_tmp3_);
+ _tmp5_ = g_app_info_get_name (_tmp4_);
+ g_debug ("transport-menu-item.vala:54: transport owner name = %s", _tmp5_);
+ _tmp6_ = player_item_get_owner ((PlayerItem*) self);
+ mpris2_controller_transport_update (_tmp6_->mpris_bridge, (TransportMenuitemaction) input);
}
diff --git a/src/transport-menu-item.vala b/src/transport-menu-item.vala
index 57eb67b..0e4e6ee 100644
--- a/src/transport-menu-item.vala
+++ b/src/transport-menu-item.vala
@@ -51,7 +51,7 @@ public class TransportMenuitem : PlayerItem
{
int input = input_value.get_int();
debug("handle_event with value %s", input.to_string());
- debug("transport owner name = %s", this.owner.name);
+ debug("transport owner name = %s", this.owner.app_info.get_name());
this.owner.mpris_bridge.transport_update((action)input);
}
diff --git a/src/transport-widget.c b/src/transport-widget.c
index d9c499d..d7f4b75 100644
--- a/src/transport-widget.c
+++ b/src/transport-widget.c
@@ -4,6 +4,7 @@ Copyright 2010 Canonical Ltd.
Authors:
Conor Curran <conor.curran@canonical.com>
Mirco Müller <mirco.mueller@canonical.com>
+ Andrea Cimitan <andrea.cimitan@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
@@ -1156,6 +1157,7 @@ static void
draw (GtkWidget* button, cairo_t *cr)
{
g_return_if_fail(IS_TRANSPORT_WIDGET(button));
+ g_return_if_fail( cr != NULL );
TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE(button);
cairo_surface_t* surf = NULL;
diff --git a/vapi/common-defs.vapi b/vapi/common-defs.vapi
index 6938420..2946d25 100644
--- a/vapi/common-defs.vapi
+++ b/vapi/common-defs.vapi
@@ -19,31 +19,38 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
[CCode (cheader_filename = "common-defs.h")]
namespace DbusmenuMetadata{
- public const string MENUITEM_TYPE;
- public const string MENUITEM_ARTIST;
- public const string MENUITEM_TITLE;
- public const string MENUITEM_ALBUM;
- public const string MENUITEM_ARTURL;
+ public const string MENUITEM_TYPE;
+ public const string MENUITEM_ARTIST;
+ public const string MENUITEM_TITLE;
+ public const string MENUITEM_ALBUM;
+ public const string MENUITEM_ARTURL;
}
[CCode (cheader_filename = "common-defs.h")]
namespace DbusmenuTransport{
- public const string MENUITEM_TYPE;
- public const string MENUITEM_PLAY_STATE;
+ public const string MENUITEM_TYPE;
+ public const string MENUITEM_PLAY_STATE;
}
[CCode (cheader_filename = "common-defs.h")]
namespace DbusmenuTitle{
- public const string MENUITEM_TYPE;
- public const string MENUITEM_NAME;
- public const string MENUITEM_ICON;
- public const string MENUITEM_RUNNING;
+ public const string MENUITEM_TYPE;
+ public const string MENUITEM_NAME;
+ public const string MENUITEM_ICON;
+ public const string MENUITEM_RUNNING;
}
[CCode (cheader_filename = "common-defs.h")]
namespace DbusmenuScrub{
- public const string MENUITEM_TYPE;
- public const string MENUITEM_POSITION;
- public const string MENUITEM_DURATION;
- public const string MENUITEM_PLAY_STATE;
+ public const string MENUITEM_TYPE;
+ public const string MENUITEM_POSITION;
+ public const string MENUITEM_DURATION;
+ public const string MENUITEM_PLAY_STATE;
+}
+
+[CCode (cheader_filename = "common-defs.h")]
+namespace DbusmenuPlaylists{
+ public const string MENUITEM_TYPE;
+ public const string MENUITEM_TITLE;
+ public const string MENUITEM_PLAYLISTS;
} \ No newline at end of file