aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.in3
-rw-r--r--aclocal.m482
-rwxr-xr-xconfigure289
-rw-r--r--configure.ac10
-rw-r--r--data/Makefile.am46
-rw-r--r--data/Makefile.in93
-rw-r--r--data/com.canonical.indicators.sound.gschema.xml29
-rw-r--r--data/icons/16x16/Makefile.in3
-rw-r--r--data/icons/16x16/status/Makefile.in3
-rw-r--r--data/icons/Makefile.in3
-rw-r--r--data/icons/scalable/Makefile.in3
-rw-r--r--data/icons/scalable/status/Makefile.in3
-rw-r--r--data/indicator-sound.schemas.in16
-rw-r--r--data/indicator-sound.service.in2
-rw-r--r--debian/changelog11
-rw-r--r--src/Makefile.am7
-rw-r--r--src/Makefile.in70
-rw-r--r--src/common-defs.h46
-rw-r--r--src/dbus-menu-manager.c4
-rw-r--r--src/dbus-shared-names.h22
-rw-r--r--src/familiar-players-db.c697
-rw-r--r--src/familiar-players-db.vala188
-rw-r--r--src/fetch-file.c20
-rw-r--r--src/fetch-file.vala6
-rw-r--r--src/indicator-sound.c152
-rw-r--r--src/metadata-menu-item.c40
-rw-r--r--src/metadata-menu-item.vala212
-rw-r--r--src/metadata-widget.c432
-rw-r--r--src/metadata-widget.h4
-rw-r--r--src/mpris2-controller.c4855
-rw-r--r--src/mpris2-controller.vala282
-rw-r--r--src/mpris2-interfaces.c1518
-rw-r--r--src/mpris2-interfaces.vala46
-rw-r--r--src/mpris2-watcher.c851
-rw-r--r--src/mpris2-watcher.vala116
-rw-r--r--src/music-player-bridge.c678
-rw-r--r--src/music-player-bridge.h126
-rw-r--r--src/music-player-bridge.vala256
-rw-r--r--src/player-controller.c89
-rw-r--r--src/player-controller.vala304
-rw-r--r--src/player-item.c120
-rw-r--r--src/player-item.vala154
-rw-r--r--src/pulse-manager.c26
-rw-r--r--src/settings-manager.c275
-rw-r--r--src/settings-manager.vala55
-rw-r--r--src/slider-menu-item.c4
-rw-r--r--src/sound-service-client.h30
-rw-r--r--src/sound-service-dbus.c1
-rw-r--r--src/sound-service-server.h6
-rw-r--r--src/sound-service.c1
-rw-r--r--src/sound-service.xml4
-rw-r--r--src/title-menu-item.vala60
-rw-r--r--src/title-widget.c146
-rw-r--r--src/title-widget.h4
-rw-r--r--src/transport-menu-item.vala64
-rw-r--r--src/transport-widget.c2436
-rw-r--r--src/transport-widget.h22
-rw-r--r--src/volume-widget.c164
-rw-r--r--src/volume-widget.h6
-rw-r--r--tests/Makefile.in3
60 files changed, 6843 insertions, 8355 deletions
diff --git a/Makefile.in b/Makefile.in
index 9d62c4a..9dfd4fc 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -145,10 +145,12 @@ GCONF_LIBS = @GCONF_LIBS@
GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@
GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@
GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
+GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
GNOMELOCALEDIR = @GNOMELOCALEDIR@
GREP = @GREP@
+GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@
INDICATORDIR = @INDICATORDIR@
INDICATORICONSDIR = @INDICATORICONSDIR@
INSTALL = @INSTALL@
@@ -235,6 +237,7 @@ datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
+gsettingsschemadir = @gsettingsschemadir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
diff --git a/aclocal.m4 b/aclocal.m4
index aaaa093..5b73575 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -497,6 +497,88 @@ sed 's/^/| /' conftest.foo >&AS_MESSAGE_LOG_FD
fi])
+dnl GLIB_GSETTINGS
+dnl Defines GSETTINGS_SCHEMAS_INSTALL which controls whether
+dnl the schema should be compiled
+dnl
+
+AC_DEFUN([GLIB_GSETTINGS],
+[
+ m4_pattern_allow([AM_V_GEN])
+ AC_ARG_ENABLE(schemas-compile,
+ AC_HELP_STRING([--disable-schemas-compile],
+ [Disable regeneration of gschemas.compiled on install]),
+ [case ${enableval} in
+ yes) GSETTINGS_DISABLE_SCHEMAS_COMPILE="" ;;
+ no) GSETTINGS_DISABLE_SCHEMAS_COMPILE="1" ;;
+ *) AC_MSG_ERROR([bad value ${enableval} for --enable-schemas-compile]) ;;
+ esac])
+ AC_SUBST([GSETTINGS_DISABLE_SCHEMAS_COMPILE])
+ PKG_PROG_PKG_CONFIG([0.16])
+ AC_SUBST(gsettingsschemadir, [${datadir}/glib-2.0/schemas])
+ if test x$cross_compiling != xyes; then
+ GLIB_COMPILE_SCHEMAS=`$PKG_CONFIG --variable glib_compile_schemas gio-2.0`
+ else
+ AC_PATH_PROG(GLIB_COMPILE_SCHEMAS, glib-compile-schemas)
+ fi
+ AC_SUBST(GLIB_COMPILE_SCHEMAS)
+ if test "x$GLIB_COMPILE_SCHEMAS" = "x"; then
+ ifelse([$2],,[AC_MSG_ERROR([glib-compile-schemas not found.])],[$2])
+ else
+ ifelse([$1],,[:],[$1])
+ fi
+
+ GSETTINGS_RULES='
+.PHONY : uninstall-gsettings-schemas install-gsettings-schemas clean-gsettings-schemas
+
+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 [$]@
+
+all-am: $(gsettings_SCHEMAS:.xml=.valid)
+uninstall-am: uninstall-gsettings-schemas
+install-data-am: install-gsettings-schemas
+
+.SECONDARY: $(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)
+
+uninstall-gsettings-schemas:
+ @$(NORMAL_UNINSTALL)
+ @list='\''$(gsettings_SCHEMAS) $(gsettings__enum_file)'\''; test -n "$(gsettingsschemadir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e '\''s|^.*/||'\''`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '\''$(DESTDIR)$(gsettingsschemadir)'\'' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(gsettingsschemadir)" && rm -f $$files
+ test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir)
+
+clean-gsettings-schemas:
+ rm -f $(gsettings_SCHEMAS:.xml=.valid) $(gsettings__enum_file)
+
+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 [$]@
+endif
+'
+ _GSETTINGS_SUBST(GSETTINGS_RULES)
+])
+
+dnl _GSETTINGS_SUBST(VARIABLE)
+dnl Abstract macro to do either _AM_SUBST_NOTMAKE or AC_SUBST
+AC_DEFUN([_GSETTINGS_SUBST],
+[
+AC_SUBST([$1])
+m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([$1])])
+]
+)
+
dnl IT_PROG_INTLTOOL([MINIMUM-VERSION], [no-xml])
# serial 40 IT_PROG_INTLTOOL
diff --git a/configure b/configure
index b6c9ed5..1bc85bf 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.2.
+# Generated by GNU Autoconf 2.67 for indicator-sound 0.5.3.
#
# 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.2'
-PACKAGE_STRING='indicator-sound 0.5.2'
+PACKAGE_VERSION='0.5.3'
+PACKAGE_STRING='indicator-sound 0.5.3'
PACKAGE_BUGREPORT='conor.curran@canonical.com'
PACKAGE_URL=''
@@ -820,6 +820,10 @@ MSGFMT_OPTS
GNOMELOCALEDIR
GETTEXT_PACKAGE
DBUSSERVICEDIR
+GSETTINGS_RULES
+GLIB_COMPILE_SCHEMAS
+gsettingsschemadir
+GSETTINGS_DISABLE_SCHEMAS_COMPILE
INDICATORICONSDIR
INDICATORDIR
GCONF_LIBS
@@ -997,6 +1001,7 @@ with_gconf_source
with_gconf_schema_file_dir
enable_schemas_install
enable_localinstall
+enable_schemas_compile
'
ac_precious_vars='build_alias
host_alias
@@ -1560,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.2 to adapt to many kinds of systems.
+\`configure' configures indicator-sound 0.5.3 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1630,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.2:";;
+ short | recursive ) echo "Configuration of indicator-sound 0.5.3:";;
esac
cat <<\_ACEOF
@@ -1654,6 +1659,8 @@ Optional Features:
Disable the schemas installation
--enable-localinstall install all of the files localy instead of system
directories (for distcheck)
+ --disable-schemas-compile
+ Disable regeneration of gschemas.compiled on install
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -1761,7 +1768,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-indicator-sound configure 0.5.2
+indicator-sound configure 0.5.3
generated by GNU Autoconf 2.67
Copyright (C) 2010 Free Software Foundation, Inc.
@@ -2130,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.2, which was
+It was created by indicator-sound $as_me 0.5.3, which was
generated by GNU Autoconf 2.67. Invocation command line was
$ $0 $@
@@ -2950,7 +2957,7 @@ fi
# Define the identity of the package.
PACKAGE=indicator-sound
- VERSION=0.5.2
+ VERSION=0.5.3
cat >>confdefs.h <<_ACEOF
@@ -6404,13 +6411,13 @@ if test "${lt_cv_nm_interface+set}" = set; then :
else
lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext
- (eval echo "\"\$as_me:6407: $ac_compile\"" >&5)
+ (eval echo "\"\$as_me:6414: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5
- (eval echo "\"\$as_me:6410: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval echo "\"\$as_me:6417: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5
- (eval echo "\"\$as_me:6413: output\"" >&5)
+ (eval echo "\"\$as_me:6420: output\"" >&5)
cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
@@ -7615,7 +7622,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 7618 "configure"' > conftest.$ac_ext
+ echo '#line 7625 "configure"' > conftest.$ac_ext
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -8890,11 +8897,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:8893: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:8900: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:8897: \$? = $ac_status" >&5
+ echo "$as_me:8904: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -9229,11 +9236,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:9232: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:9239: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:9236: \$? = $ac_status" >&5
+ echo "$as_me:9243: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -9334,11 +9341,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:9337: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:9344: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:9341: \$? = $ac_status" >&5
+ echo "$as_me:9348: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -9389,11 +9396,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:9392: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:9399: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:9396: \$? = $ac_status" >&5
+ echo "$as_me:9403: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -11773,7 +11780,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11776 "configure"
+#line 11783 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11869,7 +11876,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11872 "configure"
+#line 11879 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12791,6 +12798,240 @@ fi
###########################
+# Grab the GSettings Macros
+###########################
+
+
+
+ # Check whether --enable-schemas-compile was given.
+if test "${enable_schemas_compile+set}" = set; then :
+ enableval=$enable_schemas_compile; case ${enableval} in
+ yes) GSETTINGS_DISABLE_SCHEMAS_COMPILE="" ;;
+ no) GSETTINGS_DISABLE_SCHEMAS_COMPILE="1" ;;
+ *) as_fn_error $? "bad value ${enableval} for --enable-schemas-compile" "$LINENO" 5 ;;
+ esac
+fi
+
+
+
+
+
+
+
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $PKG_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+if test -n "$PKG_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
+$as_echo "$PKG_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_PKG_CONFIG"; then
+ ac_pt_PKG_CONFIG=$PKG_CONFIG
+ # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_PKG_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
+if test -n "$ac_pt_PKG_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
+$as_echo "$ac_pt_PKG_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_PKG_CONFIG" = x; then
+ PKG_CONFIG=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ PKG_CONFIG=$ac_pt_PKG_CONFIG
+ fi
+else
+ PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
+fi
+
+fi
+if test -n "$PKG_CONFIG"; then
+ _pkg_min_version=0.16
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
+$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
+ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ PKG_CONFIG=""
+ fi
+fi
+ gsettingsschemadir=${datadir}/glib-2.0/schemas
+
+ if test x$cross_compiling != xyes; then
+ GLIB_COMPILE_SCHEMAS=`$PKG_CONFIG --variable glib_compile_schemas gio-2.0`
+ else
+ # Extract the first word of "glib-compile-schemas", so it can be a program name with args.
+set dummy glib-compile-schemas; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_GLIB_COMPILE_SCHEMAS+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $GLIB_COMPILE_SCHEMAS in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_GLIB_COMPILE_SCHEMAS="$GLIB_COMPILE_SCHEMAS" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_GLIB_COMPILE_SCHEMAS="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+GLIB_COMPILE_SCHEMAS=$ac_cv_path_GLIB_COMPILE_SCHEMAS
+if test -n "$GLIB_COMPILE_SCHEMAS"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GLIB_COMPILE_SCHEMAS" >&5
+$as_echo "$GLIB_COMPILE_SCHEMAS" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ fi
+
+ if test "x$GLIB_COMPILE_SCHEMAS" = "x"; then
+ as_fn_error $? "glib-compile-schemas not found." "$LINENO" 5
+ else
+ :
+ fi
+
+ GSETTINGS_RULES='
+.PHONY : uninstall-gsettings-schemas install-gsettings-schemas clean-gsettings-schemas
+
+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 $@
+
+all-am: $(gsettings_SCHEMAS:.xml=.valid)
+uninstall-am: uninstall-gsettings-schemas
+install-data-am: install-gsettings-schemas
+
+.SECONDARY: $(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)
+
+uninstall-gsettings-schemas:
+ @$(NORMAL_UNINSTALL)
+ @list='\''$(gsettings_SCHEMAS) $(gsettings__enum_file)'\''; test -n "$(gsettingsschemadir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e '\''s|^.*/||'\''`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '\''$(DESTDIR)$(gsettingsschemadir)'\'' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(gsettingsschemadir)" && rm -f $$files
+ test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir)
+
+clean-gsettings-schemas:
+ rm -f $(gsettings_SCHEMAS:.xml=.valid) $(gsettings__enum_file)
+
+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 $@
+endif
+'
+
+
+
+
+
+
+
+###########################
# DBus Service Info
###########################
@@ -14081,7 +14322,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.2, which was
+This file was extended by indicator-sound $as_me 0.5.3, which was
generated by GNU Autoconf 2.67. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -14147,7 +14388,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.2
+indicator-sound config.status 0.5.3
configured by $0, generated by GNU Autoconf 2.67,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index c8ae871..88ffe6d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,10 +1,10 @@
-AC_INIT(indicator-sound, 0.5.2, conor.curran@canonical.com)
+AC_INIT(indicator-sound, 0.5.3, conor.curran@canonical.com)
AC_PREREQ(2.53)
AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(indicator-sound, 0.5.2)
+AM_INIT_AUTOMAKE(indicator-sound, 0.5.3)
AM_MAINTAINER_MODE
@@ -90,6 +90,12 @@ AC_SUBST(INDICATORDIR)
AC_SUBST(INDICATORICONSDIR)
###########################
+# Grab the GSettings Macros
+###########################
+
+GLIB_GSETTINGS
+
+###########################
# DBus Service Info
###########################
diff --git a/data/Makefile.am b/data/Makefile.am
index aaa6ca4..f33b470 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -1,43 +1,19 @@
SUBDIRS = icons
+gsettings_SCHEMAS = \
+ com.canonical.indicators.sound.gschema.xml
+@GSETTINGS_RULES@
+
dbus_servicesdir = $(DBUSSERVICEDIR)
-service_in_files = indicator-sound.service.in
-dbus_services_DATA = $(service_in_files:.service.in=.service)
+dbus_services_DATA = indicator-sound.service
%.service: %.service.in
sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@
-##############################
-# GConf Schema
-##############################
-
-schemadir = \
- $(GCONF_SCHEMA_FILE_DIR)
-
-schema_in_files = \
- indicator-sound.schemas.in
-
-schema_DATA = \
- $(schema_in_files:.schemas.in=.schemas)
-
-@INTLTOOL_SCHEMAS_RULE@
-
-
-#$(dbus_services_DATA): $(service_in_files) Makefile
-# sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@
-
-EXTRA_DIST = \
- $(service_in_files) \
- $(schema_in_files)
-
-CLEANFILES = \
- $(dbus_services_DATA) \
- $(schema_DATA)
+EXTRA_DIST = \
+ $(gsettings_SCHEMAS) \
+ indicator-sound.service.in
-if GCONF_SCHEMAS_INSTALL
-install-data-local:
- GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) \
- gconftool-2 --makefile-install-rule $(schema_DATA)
-else
-install-data-local:
-endif
+CLEANFILES = \
+ $(dbus_services_DATA)
+ \ No newline at end of file
diff --git a/data/Makefile.in b/data/Makefile.in
index f77a3c9..619dc34 100644
--- a/data/Makefile.in
+++ b/data/Makefile.in
@@ -80,9 +80,8 @@ am__nobase_list = $(am__nobase_strip_setup); \
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__installdirs = "$(DESTDIR)$(dbus_servicesdir)" \
- "$(DESTDIR)$(schemadir)"
-DATA = $(dbus_services_DATA) $(schema_DATA)
+am__installdirs = "$(DESTDIR)$(dbus_servicesdir)"
+DATA = $(dbus_services_DATA)
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
@@ -154,10 +153,12 @@ GCONF_LIBS = @GCONF_LIBS@
GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@
GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@
GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
+GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
GNOMELOCALEDIR = @GNOMELOCALEDIR@
GREP = @GREP@
+GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@
INDICATORDIR = @INDICATORDIR@
INDICATORICONSDIR = @INDICATORICONSDIR@
INSTALL = @INSTALL@
@@ -244,6 +245,7 @@ datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
+gsettingsschemadir = @gsettingsschemadir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -274,32 +276,17 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
SUBDIRS = icons
-dbus_servicesdir = $(DBUSSERVICEDIR)
-service_in_files = indicator-sound.service.in
-dbus_services_DATA = $(service_in_files:.service.in=.service)
-
-##############################
-# GConf Schema
-##############################
-schemadir = \
- $(GCONF_SCHEMA_FILE_DIR)
-
-schema_in_files = \
- indicator-sound.schemas.in
-
-schema_DATA = \
- $(schema_in_files:.schemas.in=.schemas)
-
+gsettings_SCHEMAS = \
+ com.canonical.indicators.sound.gschema.xml
-#$(dbus_services_DATA): $(service_in_files) Makefile
-# sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@
+dbus_servicesdir = $(DBUSSERVICEDIR)
+dbus_services_DATA = indicator-sound.service
EXTRA_DIST = \
- $(service_in_files) \
- $(schema_in_files)
+ $(gsettings_SCHEMAS) \
+ indicator-sound.service.in
CLEANFILES = \
- $(dbus_services_DATA) \
- $(schema_DATA)
+ $(dbus_services_DATA)
all: all-recursive
@@ -360,26 +347,6 @@ uninstall-dbus_servicesDATA:
test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(dbus_servicesdir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(dbus_servicesdir)" && rm -f $$files
-install-schemaDATA: $(schema_DATA)
- @$(NORMAL_INSTALL)
- test -z "$(schemadir)" || $(MKDIR_P) "$(DESTDIR)$(schemadir)"
- @list='$(schema_DATA)'; test -n "$(schemadir)" || list=; \
- for p in $$list; do \
- if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
- echo "$$d$$p"; \
- done | $(am__base_list) | \
- while read files; do \
- echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(schemadir)'"; \
- $(INSTALL_DATA) $$files "$(DESTDIR)$(schemadir)" || exit $$?; \
- done
-
-uninstall-schemaDATA:
- @$(NORMAL_UNINSTALL)
- @list='$(schema_DATA)'; test -n "$(schemadir)" || list=; \
- files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
- test -n "$$files" || exit 0; \
- echo " ( cd '$(DESTDIR)$(schemadir)' && rm -f" $$files ")"; \
- cd "$(DESTDIR)$(schemadir)" && rm -f $$files
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
@@ -579,7 +546,7 @@ check: check-recursive
all-am: Makefile $(DATA)
installdirs: installdirs-recursive
installdirs-am:
- for dir in "$(DESTDIR)$(dbus_servicesdir)" "$(DESTDIR)$(schemadir)"; do \
+ for dir in "$(DESTDIR)$(dbus_servicesdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-recursive
@@ -628,8 +595,7 @@ info: info-recursive
info-am:
-install-data-am: install-data-local install-dbus_servicesDATA \
- install-schemaDATA
+install-data-am: install-dbus_servicesDATA
install-dvi: install-dvi-recursive
@@ -673,7 +639,7 @@ ps: ps-recursive
ps-am:
-uninstall-am: uninstall-dbus_servicesDATA uninstall-schemaDATA
+uninstall-am: uninstall-dbus_servicesDATA
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
install-am install-strip tags-recursive
@@ -683,28 +649,21 @@ uninstall-am: uninstall-dbus_servicesDATA uninstall-schemaDATA
ctags ctags-recursive distclean distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
- install-data-am install-data-local install-dbus_servicesDATA \
- install-dvi install-dvi-am install-exec install-exec-am \
- install-html install-html-am install-info install-info-am \
- install-man install-pdf install-pdf-am install-ps \
- install-ps-am install-schemaDATA install-strip installcheck \
- installcheck-am installdirs installdirs-am maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-generic \
- mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
- uninstall uninstall-am uninstall-dbus_servicesDATA \
- uninstall-schemaDATA
-
+ install-data-am install-dbus_servicesDATA install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+ ps ps-am tags tags-recursive uninstall uninstall-am \
+ uninstall-dbus_servicesDATA
+
+@GSETTINGS_RULES@
%.service: %.service.in
sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@
-@INTLTOOL_SCHEMAS_RULE@
-
-@GCONF_SCHEMAS_INSTALL_TRUE@install-data-local:
-@GCONF_SCHEMAS_INSTALL_TRUE@ GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) \
-@GCONF_SCHEMAS_INSTALL_TRUE@ gconftool-2 --makefile-install-rule $(schema_DATA)
-@GCONF_SCHEMAS_INSTALL_FALSE@install-data-local:
-
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/data/com.canonical.indicators.sound.gschema.xml b/data/com.canonical.indicators.sound.gschema.xml
new file mode 100644
index 0000000..3850f65
--- /dev/null
+++ b/data/com.canonical.indicators.sound.gschema.xml
@@ -0,0 +1,29 @@
+<schemalist>
+ <schema id="com.canonical.indicators.sound" path="/apps/indicators/sound/" gettext-domain="indicator-sound">
+ <key name="blacklisted-media-players" type="as">
+ <summary>A list of applications blacklisted from the sound menu</summary>
+ <default>[]</default>
+ <description>
+ Each media player which abides by the MPRIS2 spec will automatically appear in the menu.
+ This array should contain the desktop file names (minus .desktop suffix) of applications which
+ do not want to be included in the sound menu.
+ </description>
+ </key>
+ <key name="interested-media-players" type="as">
+ <summary>A list of applications which at some point have registered with the sound menu</summary>
+ <default>[ 'banshee-1' ]</default>
+ <description>
+ Each media player which abides by the MPRIS2 spec will automatically appear in the menu.
+ This array should contain the desktop file names (minus .desktop suffix) of applications which
+ have at some point appeared in the menU. This allows the menu remember and display offlined applications.
+ </description>
+ </key>
+ <key name="global-mute" type="b">
+ <default>false</default>
+ <summary>Initial setting for global mute (mute all) on the menu </summary>
+ <description>
+ On start up volume should not be muted.
+ </description>
+ </key>
+ </schema>
+</schemalist>
diff --git a/data/icons/16x16/Makefile.in b/data/icons/16x16/Makefile.in
index d393a18..28412f2 100644
--- a/data/icons/16x16/Makefile.in
+++ b/data/icons/16x16/Makefile.in
@@ -129,10 +129,12 @@ GCONF_LIBS = @GCONF_LIBS@
GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@
GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@
GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
+GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
GNOMELOCALEDIR = @GNOMELOCALEDIR@
GREP = @GREP@
+GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@
INDICATORDIR = @INDICATORDIR@
INDICATORICONSDIR = @INDICATORICONSDIR@
INSTALL = @INSTALL@
@@ -219,6 +221,7 @@ datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
+gsettingsschemadir = @gsettingsschemadir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
diff --git a/data/icons/16x16/status/Makefile.in b/data/icons/16x16/status/Makefile.in
index be8093d..232aac8 100644
--- a/data/icons/16x16/status/Makefile.in
+++ b/data/icons/16x16/status/Makefile.in
@@ -113,10 +113,12 @@ GCONF_LIBS = @GCONF_LIBS@
GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@
GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@
GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
+GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
GNOMELOCALEDIR = @GNOMELOCALEDIR@
GREP = @GREP@
+GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@
INDICATORDIR = @INDICATORDIR@
INDICATORICONSDIR = @INDICATORICONSDIR@
INSTALL = @INSTALL@
@@ -203,6 +205,7 @@ datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
+gsettingsschemadir = @gsettingsschemadir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
diff --git a/data/icons/Makefile.in b/data/icons/Makefile.in
index b294f77..c95537f 100644
--- a/data/icons/Makefile.in
+++ b/data/icons/Makefile.in
@@ -129,10 +129,12 @@ GCONF_LIBS = @GCONF_LIBS@
GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@
GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@
GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
+GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
GNOMELOCALEDIR = @GNOMELOCALEDIR@
GREP = @GREP@
+GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@
INDICATORDIR = @INDICATORDIR@
INDICATORICONSDIR = @INDICATORICONSDIR@
INSTALL = @INSTALL@
@@ -219,6 +221,7 @@ datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
+gsettingsschemadir = @gsettingsschemadir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
diff --git a/data/icons/scalable/Makefile.in b/data/icons/scalable/Makefile.in
index 31c68e5..f4dade1 100644
--- a/data/icons/scalable/Makefile.in
+++ b/data/icons/scalable/Makefile.in
@@ -129,10 +129,12 @@ GCONF_LIBS = @GCONF_LIBS@
GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@
GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@
GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
+GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
GNOMELOCALEDIR = @GNOMELOCALEDIR@
GREP = @GREP@
+GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@
INDICATORDIR = @INDICATORDIR@
INDICATORICONSDIR = @INDICATORICONSDIR@
INSTALL = @INSTALL@
@@ -219,6 +221,7 @@ datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
+gsettingsschemadir = @gsettingsschemadir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
diff --git a/data/icons/scalable/status/Makefile.in b/data/icons/scalable/status/Makefile.in
index b0a620a..60dc50e 100644
--- a/data/icons/scalable/status/Makefile.in
+++ b/data/icons/scalable/status/Makefile.in
@@ -113,10 +113,12 @@ GCONF_LIBS = @GCONF_LIBS@
GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@
GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@
GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
+GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
GNOMELOCALEDIR = @GNOMELOCALEDIR@
GREP = @GREP@
+GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@
INDICATORDIR = @INDICATORDIR@
INDICATORICONSDIR = @INDICATORICONSDIR@
INSTALL = @INSTALL@
@@ -203,6 +205,7 @@ datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
+gsettingsschemadir = @gsettingsschemadir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
diff --git a/data/indicator-sound.schemas.in b/data/indicator-sound.schemas.in
deleted file mode 100644
index 9ad0f39..0000000
--- a/data/indicator-sound.schemas.in
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0"?>
-<gconfschemafile>
- <schemalist>
- <schema>
- <key>/schemas/apps/indicator-sound/volume_mute</key>
- <applyto>/apps/indicator-sound/volume_mute</applyto>
- <owner>indicator-sound</owner>
- <type>bool</type>
- <default>FALSE</default>
- <locale name="C">
- <short>Volume is not muted by default</short>
- <long>On start up volume should not be muted.</long>
- </locale>
- </schema>
- </schemalist>
-</gconfschemafile>
diff --git a/data/indicator-sound.service.in b/data/indicator-sound.service.in
index 883d31d..a80cd03 100644
--- a/data/indicator-sound.service.in
+++ b/data/indicator-sound.service.in
@@ -1,3 +1,3 @@
[D-BUS Service]
-Name=org.ayatana.indicator.sound
+Name=com.canonical.indicators.sound
Exec=@libexecdir@/indicator-sound-service
diff --git a/debian/changelog b/debian/changelog
index a762724..2b6eedb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,14 @@
+indicator-sound (0.5.3-0ubuntu1) natty; urgency=low
+
+ * New upstream release.
+ - Libindicate removed from registration process (LP: #691189)
+ - Vala code now using Gdbus exclusively for mpris interaction
+ - Fixed memory leak with album art resizing (LP: #689686)
+ - Gconf removed and Gsettings schema added (LP: #656405)
+ - registration process now uses gsettings
+
+ -- Ken VanDine <ken.vandine@canonical.com> Thu, 16 Dec 2010 15:03:15 -0500
+
indicator-sound (0.5.2-0ubuntu2) natty; urgency=low
* debian/control
diff --git a/src/Makefile.am b/src/Makefile.am
index b23e9c1..5ef9ef0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -60,9 +60,11 @@ music_bridge_VALASOURCES = \
metadata-menu-item.vala \
title-menu-item.vala \
player-controller.vala \
+ mpris2-interfaces.vala \
+ mpris2-watcher.vala \
mpris2-controller.vala \
player-item.vala \
- familiar-players-db.vala \
+ settings-manager.vala \
fetch-file.vala
@@ -74,10 +76,9 @@ music_bridge_VALAFLAGS = \
--vapidir=./ \
--thread \
--pkg gee-1.0 \
- --pkg Indicate-0.2 \
--pkg Dbusmenu-Glib-0.2 \
--pkg common-defs \
- --pkg dbus-glib-1 \
+ --pkg gio-2.0 \
--pkg gio-unix-2.0 \
--pkg gdk-pixbuf-2.0
diff --git a/src/Makefile.in b/src/Makefile.in
index 088cefe..3f0467f 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -91,9 +91,11 @@ am__objects_1 = indicator_sound_service-music-player-bridge.$(OBJEXT) \
indicator_sound_service-metadata-menu-item.$(OBJEXT) \
indicator_sound_service-title-menu-item.$(OBJEXT) \
indicator_sound_service-player-controller.$(OBJEXT) \
+ indicator_sound_service-mpris2-interfaces.$(OBJEXT) \
+ indicator_sound_service-mpris2-watcher.$(OBJEXT) \
indicator_sound_service-mpris2-controller.$(OBJEXT) \
indicator_sound_service-player-item.$(OBJEXT) \
- indicator_sound_service-familiar-players-db.$(OBJEXT) \
+ indicator_sound_service-settings-manager.$(OBJEXT) \
indicator_sound_service-fetch-file.$(OBJEXT)
am_indicator_sound_service_OBJECTS = \
indicator_sound_service-sound-service.$(OBJEXT) \
@@ -180,10 +182,12 @@ GCONF_LIBS = @GCONF_LIBS@
GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@
GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@
GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
+GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
GNOMELOCALEDIR = @GNOMELOCALEDIR@
GREP = @GREP@
+GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@
INDICATORDIR = @INDICATORDIR@
INDICATORICONSDIR = @INDICATORICONSDIR@
INSTALL = @INSTALL@
@@ -270,6 +274,7 @@ datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
+gsettingsschemadir = @gsettingsschemadir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -333,9 +338,11 @@ music_bridge_VALASOURCES = \
metadata-menu-item.vala \
title-menu-item.vala \
player-controller.vala \
+ mpris2-interfaces.vala \
+ mpris2-watcher.vala \
mpris2-controller.vala \
player-item.vala \
- familiar-players-db.vala \
+ settings-manager.vala \
fetch-file.vala
music_bridge_VALAFLAGS = \
@@ -346,10 +353,9 @@ music_bridge_VALAFLAGS = \
--vapidir=./ \
--thread \
--pkg gee-1.0 \
- --pkg Indicate-0.2 \
--pkg Dbusmenu-Glib-0.2 \
--pkg common-defs \
- --pkg dbus-glib-1 \
+ --pkg gio-2.0 \
--pkg gio-unix-2.0 \
--pkg gdk-pixbuf-2.0
@@ -523,14 +529,16 @@ distclean-compile:
-rm -f *.tab.c
@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-familiar-players-db.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-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@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_sound_service-mpris2-watcher.Po@am__quote@
@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-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@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_sound_service-sound-service-dbus.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_sound_service-sound-service.Po@am__quote@
@@ -766,6 +774,38 @@ indicator_sound_service-player-controller.obj: player-controller.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-player-controller.obj `if test -f 'player-controller.c'; then $(CYGPATH_W) 'player-controller.c'; else $(CYGPATH_W) '$(srcdir)/player-controller.c'; fi`
+indicator_sound_service-mpris2-interfaces.o: mpris2-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-mpris2-interfaces.o -MD -MP -MF $(DEPDIR)/indicator_sound_service-mpris2-interfaces.Tpo -c -o indicator_sound_service-mpris2-interfaces.o `test -f 'mpris2-interfaces.c' || echo '$(srcdir)/'`mpris2-interfaces.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-mpris2-interfaces.Tpo $(DEPDIR)/indicator_sound_service-mpris2-interfaces.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mpris2-interfaces.c' object='indicator_sound_service-mpris2-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-mpris2-interfaces.o `test -f 'mpris2-interfaces.c' || echo '$(srcdir)/'`mpris2-interfaces.c
+
+indicator_sound_service-mpris2-interfaces.obj: mpris2-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-mpris2-interfaces.obj -MD -MP -MF $(DEPDIR)/indicator_sound_service-mpris2-interfaces.Tpo -c -o indicator_sound_service-mpris2-interfaces.obj `if test -f 'mpris2-interfaces.c'; then $(CYGPATH_W) 'mpris2-interfaces.c'; else $(CYGPATH_W) '$(srcdir)/mpris2-interfaces.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-mpris2-interfaces.Tpo $(DEPDIR)/indicator_sound_service-mpris2-interfaces.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mpris2-interfaces.c' object='indicator_sound_service-mpris2-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-mpris2-interfaces.obj `if test -f 'mpris2-interfaces.c'; then $(CYGPATH_W) 'mpris2-interfaces.c'; else $(CYGPATH_W) '$(srcdir)/mpris2-interfaces.c'; fi`
+
+indicator_sound_service-mpris2-watcher.o: mpris2-watcher.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -MT indicator_sound_service-mpris2-watcher.o -MD -MP -MF $(DEPDIR)/indicator_sound_service-mpris2-watcher.Tpo -c -o indicator_sound_service-mpris2-watcher.o `test -f 'mpris2-watcher.c' || echo '$(srcdir)/'`mpris2-watcher.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-mpris2-watcher.Tpo $(DEPDIR)/indicator_sound_service-mpris2-watcher.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mpris2-watcher.c' object='indicator_sound_service-mpris2-watcher.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-mpris2-watcher.o `test -f 'mpris2-watcher.c' || echo '$(srcdir)/'`mpris2-watcher.c
+
+indicator_sound_service-mpris2-watcher.obj: mpris2-watcher.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -MT indicator_sound_service-mpris2-watcher.obj -MD -MP -MF $(DEPDIR)/indicator_sound_service-mpris2-watcher.Tpo -c -o indicator_sound_service-mpris2-watcher.obj `if test -f 'mpris2-watcher.c'; then $(CYGPATH_W) 'mpris2-watcher.c'; else $(CYGPATH_W) '$(srcdir)/mpris2-watcher.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-mpris2-watcher.Tpo $(DEPDIR)/indicator_sound_service-mpris2-watcher.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mpris2-watcher.c' object='indicator_sound_service-mpris2-watcher.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-mpris2-watcher.obj `if test -f 'mpris2-watcher.c'; then $(CYGPATH_W) 'mpris2-watcher.c'; else $(CYGPATH_W) '$(srcdir)/mpris2-watcher.c'; fi`
+
indicator_sound_service-mpris2-controller.o: mpris2-controller.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -MT indicator_sound_service-mpris2-controller.o -MD -MP -MF $(DEPDIR)/indicator_sound_service-mpris2-controller.Tpo -c -o indicator_sound_service-mpris2-controller.o `test -f 'mpris2-controller.c' || echo '$(srcdir)/'`mpris2-controller.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-mpris2-controller.Tpo $(DEPDIR)/indicator_sound_service-mpris2-controller.Po
@@ -798,21 +838,21 @@ indicator_sound_service-player-item.obj: player-item.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -c -o indicator_sound_service-player-item.obj `if test -f 'player-item.c'; then $(CYGPATH_W) 'player-item.c'; else $(CYGPATH_W) '$(srcdir)/player-item.c'; fi`
-indicator_sound_service-familiar-players-db.o: familiar-players-db.c
-@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -MT indicator_sound_service-familiar-players-db.o -MD -MP -MF $(DEPDIR)/indicator_sound_service-familiar-players-db.Tpo -c -o indicator_sound_service-familiar-players-db.o `test -f 'familiar-players-db.c' || echo '$(srcdir)/'`familiar-players-db.c
-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-familiar-players-db.Tpo $(DEPDIR)/indicator_sound_service-familiar-players-db.Po
+indicator_sound_service-settings-manager.o: settings-manager.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -MT indicator_sound_service-settings-manager.o -MD -MP -MF $(DEPDIR)/indicator_sound_service-settings-manager.Tpo -c -o indicator_sound_service-settings-manager.o `test -f 'settings-manager.c' || echo '$(srcdir)/'`settings-manager.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-settings-manager.Tpo $(DEPDIR)/indicator_sound_service-settings-manager.Po
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='familiar-players-db.c' object='indicator_sound_service-familiar-players-db.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='settings-manager.c' object='indicator_sound_service-settings-manager.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-familiar-players-db.o `test -f 'familiar-players-db.c' || echo '$(srcdir)/'`familiar-players-db.c
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -c -o indicator_sound_service-settings-manager.o `test -f 'settings-manager.c' || echo '$(srcdir)/'`settings-manager.c
-indicator_sound_service-familiar-players-db.obj: familiar-players-db.c
-@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -MT indicator_sound_service-familiar-players-db.obj -MD -MP -MF $(DEPDIR)/indicator_sound_service-familiar-players-db.Tpo -c -o indicator_sound_service-familiar-players-db.obj `if test -f 'familiar-players-db.c'; then $(CYGPATH_W) 'familiar-players-db.c'; else $(CYGPATH_W) '$(srcdir)/familiar-players-db.c'; fi`
-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-familiar-players-db.Tpo $(DEPDIR)/indicator_sound_service-familiar-players-db.Po
+indicator_sound_service-settings-manager.obj: settings-manager.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -MT indicator_sound_service-settings-manager.obj -MD -MP -MF $(DEPDIR)/indicator_sound_service-settings-manager.Tpo -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`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-settings-manager.Tpo $(DEPDIR)/indicator_sound_service-settings-manager.Po
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='familiar-players-db.c' object='indicator_sound_service-familiar-players-db.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='settings-manager.c' object='indicator_sound_service-settings-manager.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-familiar-players-db.obj `if test -f 'familiar-players-db.c'; then $(CYGPATH_W) 'familiar-players-db.c'; else $(CYGPATH_W) '$(srcdir)/familiar-players-db.c'; fi`
+@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-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
diff --git a/src/common-defs.h b/src/common-defs.h
index 27dfd32..214f60a 100644
--- a/src/common-defs.h
+++ b/src/common-defs.h
@@ -19,33 +19,33 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
/* constants used for signals on the dbus. This file is shared between client and server implementation */
-#define SIGNAL_SINK_INPUT_WHILE_MUTED "SinkInputWhileMuted"
-#define SIGNAL_SINK_VOLUME_UPDATE "SinkVolumeUpdate"
-#define SIGNAL_SINK_MUTE_UPDATE "SinkMuteUpdate"
-#define SIGNAL_SINK_AVAILABLE_UPDATE "SinkAvailableUpdate"
+#define SIGNAL_SINK_INPUT_WHILE_MUTED "SinkInputWhileMuted"
+#define SIGNAL_SINK_VOLUME_UPDATE "SinkVolumeUpdate"
+#define SIGNAL_SINK_MUTE_UPDATE "SinkMuteUpdate"
+#define SIGNAL_SINK_AVAILABLE_UPDATE "SinkAvailableUpdate"
-#define DBUSMENU_PROPERTY_EMPTY -1
+#define DBUSMENU_PROPERTY_EMPTY -1
/* DBUS Custom Items */
-#define DBUSMENU_VOLUME_MENUITEM_TYPE "x-canonical-ido-volume-type"
-#define DBUSMENU_VOLUME_MENUITEM_LEVEL "x-canonical-ido-volume-level"
+#define DBUSMENU_VOLUME_MENUITEM_TYPE "x-canonical-ido-volume-type"
+#define DBUSMENU_VOLUME_MENUITEM_LEVEL "x-canonical-ido-volume-level"
-#define DBUSMENU_TRANSPORT_MENUITEM_TYPE "x-canonical-sound-menu-player-transport-type"
+#define DBUSMENU_TRANSPORT_MENUITEM_TYPE "x-canonical-sound-menu-player-transport-type"
#define DBUSMENU_TRANSPORT_MENUITEM_PLAY_STATE "x-canonical-sound-menu-player-transport-state"
-#define DBUSMENU_METADATA_MENUITEM_TYPE "x-canonical-sound-menu-player-metadata-type"
-#define DBUSMENU_METADATA_MENUITEM_ARTIST "x-canonical-sound-menu-player-metadata-xesam:artist"
-#define DBUSMENU_METADATA_MENUITEM_TITLE "x-canonical-sound-menu-player-metadata-xesam:title"
-#define DBUSMENU_METADATA_MENUITEM_ALBUM "x-canonical-sound-menu-player-metadata-xesam:album"
-#define DBUSMENU_METADATA_MENUITEM_ARTURL "x-canonical-sound-menu-player-metadata-mpris:artUrl"
-
-#define DBUSMENU_TITLE_MENUITEM_TYPE "x-canonical-sound-menu-player-title-type"
-#define DBUSMENU_TITLE_MENUITEM_NAME "x-canonical-sound-menu-player-title-name"
-#define DBUSMENU_TITLE_MENUITEM_ICON "x-canonical-sound-menu-player-title-icon"
-#define DBUSMENU_TITLE_MENUITEM_RUNNING "x-canonical-sound-menu-player-title-running"
-
-#define DBUSMENU_SCRUB_MENUITEM_TYPE "x-canonical-sound-menu-player-scrub-type"
-#define DBUSMENU_SCRUB_MENUITEM_DURATION "x-canonical-sound-menu-player-scrub-mpris:length"
-#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_METADATA_MENUITEM_TYPE "x-canonical-sound-menu-player-metadata-type"
+#define DBUSMENU_METADATA_MENUITEM_ARTIST "x-canonical-sound-menu-player-metadata-xesam:artist"
+#define DBUSMENU_METADATA_MENUITEM_TITLE "x-canonical-sound-menu-player-metadata-xesam:title"
+#define DBUSMENU_METADATA_MENUITEM_ALBUM "x-canonical-sound-menu-player-metadata-xesam:album"
+#define DBUSMENU_METADATA_MENUITEM_ARTURL "x-canonical-sound-menu-player-metadata-mpris:artUrl"
+
+#define DBUSMENU_TITLE_MENUITEM_TYPE "x-canonical-sound-menu-player-title-type"
+#define DBUSMENU_TITLE_MENUITEM_NAME "x-canonical-sound-menu-player-title-name"
+#define DBUSMENU_TITLE_MENUITEM_ICON "x-canonical-sound-menu-player-title-icon"
+#define DBUSMENU_TITLE_MENUITEM_RUNNING "x-canonical-sound-menu-player-title-running"
+
+#define DBUSMENU_SCRUB_MENUITEM_TYPE "x-canonical-sound-menu-player-scrub-type"
+#define DBUSMENU_SCRUB_MENUITEM_DURATION "x-canonical-sound-menu-player-scrub-mpris:length"
+#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"
diff --git a/src/dbus-menu-manager.c b/src/dbus-menu-manager.c
index 63e91b4..37e1c18 100644
--- a/src/dbus-menu-manager.c
+++ b/src/dbus-menu-manager.c
@@ -82,7 +82,7 @@ void dbus_menu_manager_update_volume(gdouble volume)
GValue value = {0};
g_value_init(&value, G_TYPE_DOUBLE);
g_value_set_double(&value, volume);
- dbusmenu_menuitem_property_set_value(DBUSMENU_MENUITEM(volume_slider_menuitem), DBUSMENU_VOLUME_MENUITEM_LEVEL, &value);
+ dbusmenu_menuitem_property_set_value(DBUSMENU_MENUITEM(volume_slider_menuitem), DBUSMENU_VOLUME_MENUITEM_LEVEL, &value);
}
@@ -106,7 +106,7 @@ void dbus_menu_manager_update_pa_state(gboolean pa_state, gboolean sink_availabl
// Emit the signals after the menus are setup/torn down
// preserve ordering !
sound_service_dbus_update_sink_availability(dbus_interface, sink_available);
- dbus_menu_manager_update_volume(percent);
+ dbus_menu_manager_update_volume(percent);
sound_service_dbus_update_sink_mute(dbus_interface, sink_muted);
dbus_menu_manager_update_mute_ui(b_all_muted);
}
diff --git a/src/dbus-shared-names.h b/src/dbus-shared-names.h
index 3062ac5..9d1e875 100644
--- a/src/dbus-shared-names.h
+++ b/src/dbus-shared-names.h
@@ -25,24 +25,10 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef __DBUS_SHARED_NAMES_H__
#define __DBUS_SHARED_NAMES_H__ 1
-#define INDICATOR_STATUS_DBUS_NAME "org.ayatana.indicator.status"
-#define INDICATOR_STATUS_DBUS_OBJECT "/org/ayatana/indicator/status/menu"
-#define INDICATOR_STATUS_SERVICE_DBUS_OBJECT "/org/ayatana/indicator/status/service"
-#define INDICATOR_STATUS_SERVICE_DBUS_INTERFACE "org.ayatana.indicator.status.service"
-
-#define INDICATOR_USERS_DBUS_NAME "org.ayatana.indicator.users"
-#define INDICATOR_USERS_DBUS_OBJECT "/org/ayatana/indicator/users/menu"
-#define INDICATOR_USERS_SERVICE_DBUS_OBJECT "/org/gnome/DisplayManager/UserManager"
-#define INDICATOR_USERS_SERVICE_DBUS_INTERFACE "org.gnome.DisplayManager.UserManager"
-
-#define INDICATOR_SESSION_DBUS_NAME "org.ayatana.indicator.session"
-#define INDICATOR_SESSION_DBUS_OBJECT "/org/ayatana/indicator/session/menu"
-#define INDICATOR_SESSION_DBUS_VERSION 0
-
-#define INDICATOR_SOUND_DBUS_NAME "org.ayatana.indicator.sound"
-#define INDICATOR_SOUND_DBUS_OBJECT "/org/ayatana/indicator/sound/menu"
-#define INDICATOR_SOUND_SERVICE_DBUS_OBJECT "/org/ayatana/indicator/sound/service"
-#define INDICATOR_SOUND_SERVICE_DBUS_INTERFACE "org.ayatana.indicator.sound"
+#define INDICATOR_SOUND_DBUS_NAME "com.canonical.indicators.sound"
+#define INDICATOR_SOUND_DBUS_OBJECT "/com/canonical/indicators/sound/menu"
+#define INDICATOR_SOUND_SERVICE_DBUS_OBJECT "/com/canonical/indicators/sound/service"
+#define INDICATOR_SOUND_SERVICE_DBUS_INTERFACE "com.canonical.indicators.sound"
#define INDICATOR_SOUND_DBUS_VERSION 0
#endif /* __DBUS_SHARED_NAMES_H__ */
diff --git a/src/familiar-players-db.c b/src/familiar-players-db.c
deleted file mode 100644
index 7b082a2..0000000
--- a/src/familiar-players-db.c
+++ /dev/null
@@ -1,697 +0,0 @@
-/* familiar-players-db.c generated by valac 0.11.2, the Vala compiler
- * generated from familiar-players-db.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 <gee.h>
-#include <stdlib.h>
-#include <string.h>
-#include <glib/gstdio.h>
-
-
-#define TYPE_FAMILIAR_PLAYERS_DB (familiar_players_db_get_type ())
-#define FAMILIAR_PLAYERS_DB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FAMILIAR_PLAYERS_DB, FamiliarPlayersDB))
-#define FAMILIAR_PLAYERS_DB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FAMILIAR_PLAYERS_DB, FamiliarPlayersDBClass))
-#define IS_FAMILIAR_PLAYERS_DB(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FAMILIAR_PLAYERS_DB))
-#define IS_FAMILIAR_PLAYERS_DB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FAMILIAR_PLAYERS_DB))
-#define FAMILIAR_PLAYERS_DB_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FAMILIAR_PLAYERS_DB, FamiliarPlayersDBClass))
-
-typedef struct _FamiliarPlayersDB FamiliarPlayersDB;
-typedef struct _FamiliarPlayersDBClass FamiliarPlayersDBClass;
-typedef struct _FamiliarPlayersDBPrivate FamiliarPlayersDBPrivate;
-#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
-#define _g_free0(var) (var = (g_free (var), NULL))
-#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)))
-
-struct _FamiliarPlayersDB {
- GObject parent_instance;
- FamiliarPlayersDBPrivate * priv;
-};
-
-struct _FamiliarPlayersDBClass {
- GObjectClass parent_class;
-};
-
-struct _FamiliarPlayersDBPrivate {
- GeeHashMap* players_DB;
- gchar* file_name;
- gchar* dir_name;
- GKeyFile* key_file;
- guint write_id;
-};
-
-
-static gpointer familiar_players_db_parent_class = NULL;
-
-GType familiar_players_db_get_type (void) G_GNUC_CONST;
-#define FAMILIAR_PLAYERS_DB_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_FAMILIAR_PLAYERS_DB, FamiliarPlayersDBPrivate))
-enum {
- FAMILIAR_PLAYERS_DB_DUMMY_PROPERTY
-};
-#define FAMILIAR_PLAYERS_DB_GROUP_NAME "Seen Database"
-#define FAMILIAR_PLAYERS_DB_KEY_NAME "DesktopFiles"
-#define FAMILIAR_PLAYERS_DB_DEFAULT_APP_DESKTOP "/usr/share/applications/banshee-1.desktop"
-FamiliarPlayersDB* familiar_players_db_new (void);
-FamiliarPlayersDB* familiar_players_db_construct (GType object_type);
-static gboolean familiar_players_db_create_key_file (FamiliarPlayersDB* self);
-static gboolean familiar_players_db_write_db (FamiliarPlayersDB* self);
-static gboolean familiar_players_db_check_for_keys (FamiliarPlayersDB* self);
-static gboolean familiar_players_db_load_data_from_key_file (FamiliarPlayersDB* self);
-static void _vala_array_add1 (gchar*** array, int* length, int* size, gchar* value);
-void familiar_players_db_insert (FamiliarPlayersDB* self, const gchar* desktop);
-gboolean familiar_players_db_already_familiar (FamiliarPlayersDB* self, const gchar* desktop);
-static gboolean _familiar_players_db_write_db_gsource_func (gpointer self);
-GeeSet* familiar_players_db_records (FamiliarPlayersDB* self);
-gchar* familiar_players_db_fetch_icon_name (const gchar* desktop_path);
-static void familiar_players_db_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);
-
-
-FamiliarPlayersDB* familiar_players_db_construct (GType object_type) {
- FamiliarPlayersDB * self = NULL;
- GeeHashMap* _tmp0_ = NULL;
- GeeHashMap* _tmp1_;
- gboolean _tmp2_;
- const gchar* _tmp3_ = NULL;
- gchar* _tmp4_ = NULL;
- gchar* _tmp5_;
- gchar* _tmp6_ = NULL;
- gchar* _tmp7_;
- gboolean _tmp8_ = FALSE;
- gboolean _tmp9_ = FALSE;
- gboolean _tmp10_;
- self = (FamiliarPlayersDB*) g_object_new (object_type, NULL);
- self->priv->write_id = (guint) 0;
- _tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_BOOLEAN, NULL, NULL, NULL, NULL, NULL);
- _tmp1_ = _tmp0_;
- _g_object_unref0 (self->priv->players_DB);
- self->priv->players_DB = _tmp1_;
- _tmp2_ = familiar_players_db_create_key_file (self);
- if (!_tmp2_) {
- gee_abstract_map_set ((GeeAbstractMap*) self->priv->players_DB, FAMILIAR_PLAYERS_DB_DEFAULT_APP_DESKTOP, GINT_TO_POINTER (TRUE));
- familiar_players_db_write_db (self);
- }
- _tmp3_ = g_get_user_cache_dir ();
- _tmp4_ = g_build_filename (_tmp3_, "indicators", "sound", NULL);
- _tmp5_ = _tmp4_;
- _g_free0 (self->priv->dir_name);
- self->priv->dir_name = _tmp5_;
- _tmp6_ = g_build_filename (self->priv->dir_name, "familiar-players-db.keyfile", NULL);
- _tmp7_ = _tmp6_;
- _g_free0 (self->priv->file_name);
- self->priv->file_name = _tmp7_;
- _tmp10_ = familiar_players_db_create_key_file (self);
- if (_tmp10_) {
- gboolean _tmp11_;
- _tmp11_ = familiar_players_db_check_for_keys (self);
- _tmp9_ = _tmp11_;
- } else {
- _tmp9_ = FALSE;
- }
- if (_tmp9_) {
- gboolean _tmp12_;
- _tmp12_ = familiar_players_db_load_data_from_key_file (self);
- _tmp8_ = _tmp12_;
- } else {
- _tmp8_ = FALSE;
- }
- if (_tmp8_) {
- g_debug ("familiar-players-db.vala:51: keyfiles in place and ready for action");
- } else {
- GKeyFile* _tmp13_;
- _tmp13_ = NULL;
- _g_key_file_free0 (self->priv->key_file);
- self->priv->key_file = _tmp13_;
- g_warning ("familiar-players-db.vala:55: FamiliarPlayersDB:: problems loading key " \
-"file - can't go any further");
- }
- return self;
-}
-
-
-FamiliarPlayersDB* familiar_players_db_new (void) {
- return familiar_players_db_construct (TYPE_FAMILIAR_PLAYERS_DB);
-}
-
-
-static gboolean familiar_players_db_create_key_file (FamiliarPlayersDB* self) {
- gboolean result = FALSE;
- gboolean _result_;
- gboolean _tmp0_;
- GError * _inner_error_ = NULL;
- g_return_val_if_fail (self != NULL, FALSE);
- _result_ = FALSE;
- _tmp0_ = g_file_test (self->priv->file_name, G_FILE_TEST_EXISTS);
- if (_tmp0_) {
- GKeyFile* _tmp1_ = NULL;
- GKeyFile* _tmp2_;
- gboolean _tmp3_;
- gboolean _tmp4_;
- _tmp1_ = g_key_file_new ();
- _tmp2_ = _tmp1_;
- _g_key_file_free0 (self->priv->key_file);
- self->priv->key_file = _tmp2_;
- _tmp3_ = g_key_file_load_from_file (self->priv->key_file, self->priv->file_name, G_KEY_FILE_NONE, &_inner_error_);
- _tmp4_ = _tmp3_;
- if (_inner_error_ != NULL) {
- if (_inner_error_->domain == G_KEY_FILE_ERROR) {
- goto __catch6_g_key_file_error;
- }
- if (_inner_error_->domain == G_FILE_ERROR) {
- goto __catch6_g_file_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_);
- return FALSE;
- }
- _result_ = _tmp4_;
- goto __finally6;
- __catch6_g_key_file_error:
- {
- GError * e;
- e = _inner_error_;
- _inner_error_ = NULL;
- g_warning ("familiar-players-db.vala:67: FamiliarPlayersDB::create_key_file() - Ke" \
-"yFileError");
- _g_error_free0 (e);
- }
- goto __finally6;
- __catch6_g_file_error:
- {
- GError * e;
- e = _inner_error_;
- _inner_error_ = NULL;
- g_warning ("familiar-players-db.vala:70: FamiliarPlayersDB::create_key_file() - Fi" \
-"leError");
- _g_error_free0 (e);
- }
- __finally6:
- 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 FALSE;
- }
- }
- result = _result_;
- return result;
-}
-
-
-static gboolean familiar_players_db_check_for_keys (FamiliarPlayersDB* self) {
- gboolean result = FALSE;
- gboolean _tmp0_;
- gboolean _tmp1_;
- GError * _inner_error_ = NULL;
- g_return_val_if_fail (self != NULL, FALSE);
- _tmp0_ = g_key_file_has_key (self->priv->key_file, FAMILIAR_PLAYERS_DB_GROUP_NAME, FAMILIAR_PLAYERS_DB_KEY_NAME, &_inner_error_);
- _tmp1_ = _tmp0_;
- if (_inner_error_ != NULL) {
- if (_inner_error_->domain == G_KEY_FILE_ERROR) {
- goto __catch7_g_key_file_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_);
- return FALSE;
- }
- if (_tmp1_ == TRUE) {
- result = TRUE;
- return result;
- }
- goto __finally7;
- __catch7_g_key_file_error:
- {
- GError * e;
- e = _inner_error_;
- _inner_error_ = NULL;
- result = FALSE;
- _g_error_free0 (e);
- return result;
- }
- __finally7:
- 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 FALSE;
- }
- g_warning ("familiar-players-db.vala:85: Seen DB '%s' does not have key '%s' in gr" \
-"oup '%s'", self->priv->file_name, FAMILIAR_PLAYERS_DB_KEY_NAME, FAMILIAR_PLAYERS_DB_GROUP_NAME);
- result = FALSE;
- return result;
-}
-
-
-static gboolean familiar_players_db_load_data_from_key_file (FamiliarPlayersDB* self) {
- gboolean result = FALSE;
- gsize _tmp0_;
- gchar** _tmp1_ = NULL;
- gint desktops_length1;
- gint _desktops_size_;
- gchar** _tmp2_;
- gchar** desktops;
- GError * _inner_error_ = NULL;
- g_return_val_if_fail (self != NULL, FALSE);
- _tmp1_ = g_key_file_get_string_list (self->priv->key_file, FAMILIAR_PLAYERS_DB_GROUP_NAME, FAMILIAR_PLAYERS_DB_KEY_NAME, &_tmp0_, &_inner_error_);
- _tmp2_ = _tmp1_;
- desktops_length1 = _tmp0_;
- _desktops_size_ = desktops_length1;
- desktops = _tmp2_;
- if (_inner_error_ != NULL) {
- if (_inner_error_->domain == G_KEY_FILE_ERROR) {
- goto __catch8_g_key_file_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_);
- return FALSE;
- }
- {
- gchar** s_collection;
- int s_collection_length1;
- int s_it;
- s_collection = desktops;
- s_collection_length1 = desktops_length1;
- for (s_it = 0; s_it < desktops_length1; s_it = s_it + 1) {
- gchar* _tmp3_;
- gchar* s;
- _tmp3_ = g_strdup (s_collection[s_it]);
- s = _tmp3_;
- {
- gee_abstract_map_set ((GeeAbstractMap*) self->priv->players_DB, s, GINT_TO_POINTER (TRUE));
- _g_free0 (s);
- }
- }
- }
- result = TRUE;
- desktops = (_vala_array_free (desktops, desktops_length1, (GDestroyNotify) g_free), NULL);
- return result;
- desktops = (_vala_array_free (desktops, desktops_length1, (GDestroyNotify) g_free), NULL);
- goto __finally8;
- __catch8_g_key_file_error:
- {
- GError * _error_;
- _error_ = _inner_error_;
- _inner_error_ = NULL;
- g_warning ("familiar-players-db.vala:99: Error loading the Desktop string list");
- result = FALSE;
- _g_error_free0 (_error_);
- return result;
- }
- __finally8:
- 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;
-}
-
-
-static void _vala_array_add1 (gchar*** array, int* length, int* size, gchar* value) {
- if ((*length) == (*size)) {
- *size = (*size) ? (2 * (*size)) : 4;
- *array = g_renew (gchar*, *array, (*size) + 1);
- }
- (*array)[(*length)++] = value;
- (*array)[*length] = NULL;
-}
-
-
-static gboolean familiar_players_db_write_db (FamiliarPlayersDB* self) {
- gboolean result = FALSE;
- GKeyFile* _tmp0_ = NULL;
- GKeyFile* keyfile;
- gchar** _tmp1_ = NULL;
- gint desktops_length1;
- gint _desktops_size_;
- gchar** _tmp2_;
- gchar** desktops;
- gsize data_length = 0UL;
- gchar* data;
- gsize _tmp10_;
- gchar* _tmp11_ = NULL;
- gchar* _tmp12_;
- gint _tmp13_;
- gboolean _tmp14_;
- gboolean _tmp15_;
- GError * _inner_error_ = NULL;
- g_return_val_if_fail (self != NULL, FALSE);
- _tmp0_ = g_key_file_new ();
- keyfile = _tmp0_;
- _tmp1_ = g_new0 (gchar*, 0 + 1);
- _tmp2_ = _tmp1_;
- desktops_length1 = 0;
- _desktops_size_ = desktops_length1;
- desktops = _tmp2_;
- {
- GeeSet* _tmp3_ = NULL;
- GeeSet* _tmp4_;
- GeeIterator* _tmp5_ = NULL;
- GeeIterator* _tmp6_;
- GeeIterator* _key_it;
- _tmp3_ = gee_map_get_keys ((GeeMap*) self->priv->players_DB);
- _tmp4_ = _tmp3_;
- _tmp5_ = gee_iterable_iterator ((GeeIterable*) _tmp4_);
- _key_it = (_tmp6_ = _tmp5_, _g_object_unref0 (_tmp4_), _tmp6_);
- while (TRUE) {
- gboolean _tmp7_;
- gpointer _tmp8_ = NULL;
- gchar* key;
- gchar* _tmp9_;
- _tmp7_ = gee_iterator_next (_key_it);
- if (!_tmp7_) {
- break;
- }
- _tmp8_ = gee_iterator_get (_key_it);
- key = (gchar*) _tmp8_;
- _tmp9_ = g_strdup (key);
- _vala_array_add1 (&desktops, &desktops_length1, &_desktops_size_, _tmp9_);
- _g_free0 (key);
- }
- _g_object_unref0 (_key_it);
- }
- g_key_file_set_string_list (keyfile, FAMILIAR_PLAYERS_DB_GROUP_NAME, FAMILIAR_PLAYERS_DB_KEY_NAME, (const gchar* const*) desktops, desktops_length1);
- data = NULL;
- _tmp11_ = g_key_file_to_data (keyfile, &_tmp10_, NULL);
- data_length = _tmp10_;
- _tmp12_ = _tmp11_;
- _g_free0 (data);
- data = _tmp12_;
- goto __finally9;
- __catch9_g_key_file_error:
- {
- GError * e;
- e = _inner_error_;
- _inner_error_ = NULL;
- g_warning ("familiar-players-db.vala:120: Problems dumping keyfile to a string");
- result = FALSE;
- _g_error_free0 (e);
- _g_free0 (data);
- desktops = (_vala_array_free (desktops, desktops_length1, (GDestroyNotify) g_free), NULL);
- _g_key_file_free0 (keyfile);
- return result;
- }
- __finally9:
- if (_inner_error_ != NULL) {
- _g_free0 (data);
- desktops = (_vala_array_free (desktops, desktops_length1, (GDestroyNotify) g_free), NULL);
- _g_key_file_free0 (keyfile);
- 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;
- }
- _tmp13_ = g_mkdir_with_parents (self->priv->dir_name, 0700);
- if (_tmp13_ != 0) {
- g_warning ("familiar-players-db.vala:125: Unable to make directory: %s", self->priv->dir_name);
- result = FALSE;
- _g_free0 (data);
- desktops = (_vala_array_free (desktops, desktops_length1, (GDestroyNotify) g_free), NULL);
- _g_key_file_free0 (keyfile);
- return result;
- }
- _tmp14_ = g_file_set_contents (self->priv->file_name, data, (gssize) data_length, &_inner_error_);
- _tmp15_ = _tmp14_;
- if (_inner_error_ != NULL) {
- if (_inner_error_->domain == G_FILE_ERROR) {
- goto __catch10_g_file_error;
- }
- _g_free0 (data);
- desktops = (_vala_array_free (desktops, desktops_length1, (GDestroyNotify) g_free), NULL);
- _g_key_file_free0 (keyfile);
- 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;
- }
- if (_tmp15_ == FALSE) {
- g_warning ("familiar-players-db.vala:131: Unable to write out file '%s'", self->priv->file_name);
- }
- goto __finally10;
- __catch10_g_file_error:
- {
- GError * err;
- err = _inner_error_;
- _inner_error_ = NULL;
- g_warning ("familiar-players-db.vala:135: Unable to write out file '%s'", self->priv->file_name);
- _g_error_free0 (err);
- }
- __finally10:
- if (_inner_error_ != NULL) {
- _g_free0 (data);
- desktops = (_vala_array_free (desktops, desktops_length1, (GDestroyNotify) g_free), NULL);
- _g_key_file_free0 (keyfile);
- 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 = TRUE;
- _g_free0 (data);
- desktops = (_vala_array_free (desktops, desktops_length1, (GDestroyNotify) g_free), NULL);
- _g_key_file_free0 (keyfile);
- return result;
-}
-
-
-static gboolean _familiar_players_db_write_db_gsource_func (gpointer self) {
- gboolean result;
- result = familiar_players_db_write_db (self);
- return result;
-}
-
-
-void familiar_players_db_insert (FamiliarPlayersDB* self, const gchar* desktop) {
- gboolean _tmp0_;
- g_return_if_fail (self != NULL);
- g_return_if_fail (desktop != NULL);
- _tmp0_ = familiar_players_db_already_familiar (self, desktop);
- if (_tmp0_ == FALSE) {
- guint _tmp1_;
- gchar* _tmp2_ = NULL;
- gchar* _tmp3_;
- if (self->priv->write_id != 0) {
- g_source_remove (self->priv->write_id);
- self->priv->write_id = (guint) 0;
- }
- _tmp1_ = g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, (guint) 60, _familiar_players_db_write_db_gsource_func, g_object_ref (self), g_object_unref);
- self->priv->write_id = _tmp1_;
- _tmp2_ = g_strdup (desktop);
- _tmp3_ = _tmp2_;
- gee_abstract_map_set ((GeeAbstractMap*) self->priv->players_DB, _tmp3_, GINT_TO_POINTER (TRUE));
- _g_free0 (_tmp3_);
- }
-}
-
-
-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;
- }
-}
-
-
-gboolean familiar_players_db_already_familiar (FamiliarPlayersDB* self, const gchar* desktop) {
- gboolean result = FALSE;
- GeeSet* _tmp0_ = NULL;
- GeeSet* _tmp1_;
- gboolean _tmp2_;
- gchar* _tmp3_ = NULL;
- gchar* _tmp4_;
- GeeSet* _tmp5_ = NULL;
- GeeSet* _tmp6_;
- gboolean _tmp7_;
- gboolean _tmp8_;
- g_return_val_if_fail (self != NULL, FALSE);
- g_return_val_if_fail (desktop != NULL, FALSE);
- _tmp0_ = gee_map_get_keys ((GeeMap*) self->priv->players_DB);
- _tmp1_ = _tmp0_;
- _tmp2_ = gee_collection_contains ((GeeCollection*) _tmp1_, desktop);
- _tmp3_ = bool_to_string (_tmp2_);
- _tmp4_ = _tmp3_;
- g_debug ("familiar-players-db.vala:154: playerDB->already_familiar - result %s", _tmp4_);
- _g_free0 (_tmp4_);
- _g_object_unref0 (_tmp1_);
- _tmp5_ = gee_map_get_keys ((GeeMap*) self->priv->players_DB);
- _tmp6_ = _tmp5_;
- _tmp7_ = gee_collection_contains ((GeeCollection*) _tmp6_, desktop);
- result = (_tmp8_ = _tmp7_, _g_object_unref0 (_tmp6_), _tmp8_);
- return result;
-}
-
-
-GeeSet* familiar_players_db_records (FamiliarPlayersDB* self) {
- GeeSet* result = NULL;
- GeeSet* _tmp0_ = NULL;
- g_return_val_if_fail (self != NULL, NULL);
- _tmp0_ = gee_map_get_keys ((GeeMap*) self->priv->players_DB);
- result = _tmp0_;
- return result;
-}
-
-
-gchar* familiar_players_db_fetch_icon_name (const gchar* desktop_path) {
- gchar* result = NULL;
- GKeyFile* _tmp0_ = NULL;
- GKeyFile* desktop_keyfile;
- gchar* _tmp1_ = NULL;
- gchar* _tmp2_;
- 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_);
- if (_inner_error_ != NULL) {
- if (_inner_error_->domain == G_FILE_ERROR) {
- goto __catch11_g_file_error;
- }
- if (_inner_error_->domain == G_KEY_FILE_ERROR) {
- goto __catch11_g_key_file_error;
- }
- _g_key_file_free0 (desktop_keyfile);
- 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;
- }
- goto __finally11;
- __catch11_g_file_error:
- {
- GError * _error_;
- _error_ = _inner_error_;
- _inner_error_ = NULL;
- g_warning ("familiar-players-db.vala:170: Error loading keyfile - FileError");
- result = NULL;
- _g_error_free0 (_error_);
- _g_key_file_free0 (desktop_keyfile);
- return result;
- }
- goto __finally11;
- __catch11_g_key_file_error:
- {
- GError * _error_;
- _error_ = _inner_error_;
- _inner_error_ = NULL;
- g_warning ("familiar-players-db.vala:174: Error loading keyfile - KeyFileError");
- result = NULL;
- _g_error_free0 (_error_);
- _g_key_file_free0 (desktop_keyfile);
- return result;
- }
- __finally11:
- if (_inner_error_ != NULL) {
- _g_key_file_free0 (desktop_keyfile);
- 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_;
- if (_inner_error_ != NULL) {
- if (_inner_error_->domain == G_KEY_FILE_ERROR) {
- goto __catch12_g_key_file_error;
- }
- _g_key_file_free0 (desktop_keyfile);
- 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_;
- _g_key_file_free0 (desktop_keyfile);
- return result;
- goto __finally12;
- __catch12_g_key_file_error:
- {
- GError * _error_;
- _error_ = _inner_error_;
- _inner_error_ = NULL;
- g_warning ("familiar-players-db.vala:183: Error trying to fetch the icon name from" \
-" the keyfile");
- result = NULL;
- _g_error_free0 (_error_);
- _g_key_file_free0 (desktop_keyfile);
- return result;
- }
- __finally12:
- _g_key_file_free0 (desktop_keyfile);
- 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 void familiar_players_db_class_init (FamiliarPlayersDBClass * klass) {
- familiar_players_db_parent_class = g_type_class_peek_parent (klass);
- g_type_class_add_private (klass, sizeof (FamiliarPlayersDBPrivate));
- G_OBJECT_CLASS (klass)->finalize = familiar_players_db_finalize;
-}
-
-
-static void familiar_players_db_instance_init (FamiliarPlayersDB * self) {
- self->priv = FAMILIAR_PLAYERS_DB_GET_PRIVATE (self);
-}
-
-
-static void familiar_players_db_finalize (GObject* obj) {
- FamiliarPlayersDB * self;
- self = FAMILIAR_PLAYERS_DB (obj);
- _g_object_unref0 (self->priv->players_DB);
- _g_free0 (self->priv->file_name);
- _g_free0 (self->priv->dir_name);
- _g_key_file_free0 (self->priv->key_file);
- G_OBJECT_CLASS (familiar_players_db_parent_class)->finalize (obj);
-}
-
-
-GType familiar_players_db_get_type (void) {
- static volatile gsize familiar_players_db_type_id__volatile = 0;
- if (g_once_init_enter (&familiar_players_db_type_id__volatile)) {
- static const GTypeInfo g_define_type_info = { sizeof (FamiliarPlayersDBClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) familiar_players_db_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FamiliarPlayersDB), 0, (GInstanceInitFunc) familiar_players_db_instance_init, NULL };
- GType familiar_players_db_type_id;
- familiar_players_db_type_id = g_type_register_static (G_TYPE_OBJECT, "FamiliarPlayersDB", &g_define_type_info, 0);
- g_once_init_leave (&familiar_players_db_type_id__volatile, familiar_players_db_type_id);
- }
- return familiar_players_db_type_id__volatile;
-}
-
-
-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/familiar-players-db.vala b/src/familiar-players-db.vala
deleted file mode 100644
index 47ddc70..0000000
--- a/src/familiar-players-db.vala
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
-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 Gee;
-using GLib.Path;
-using GLib.DirUtils;
-using GLib.FileUtils;
-using GLib.Timeout;
-using GLib.Environment;
-
-// TODO: more refactoring needed here
-public class FamiliarPlayersDB : GLib.Object
-{
- private const string GROUP_NAME = "Seen Database";
- private const string KEY_NAME = "DesktopFiles";
- private const string DEFAULT_APP_DESKTOP = "/usr/share/applications/banshee-1.desktop";
- private HashMap<string, bool> players_DB;
- private string file_name;
- private string dir_name;
- private KeyFile key_file;
- private uint write_id;
-
- public FamiliarPlayersDB()
- {
- this.write_id = 0;
- this.players_DB = new HashMap<string, bool>();
- if ( !create_key_file() ){
- this.players_DB.set(DEFAULT_APP_DESKTOP, true);
- this.write_db();
- }
-
- this.dir_name = build_filename(get_user_cache_dir(), "indicators", "sound");
- this.file_name = build_filename(this.dir_name, "familiar-players-db.keyfile");
- if(create_key_file() && check_for_keys() && load_data_from_key_file()){
- debug("keyfiles in place and ready for action");
- }
- else{
- this.key_file = null;
- warning("FamiliarPlayersDB:: problems loading key file - can't go any further");
- }
- }
-
- private bool create_key_file(){
- bool result = false;
- if (test(this.file_name, GLib.FileTest.EXISTS)) {
- this.key_file = new KeyFile();
- try{
- result = this.key_file.load_from_file(this.file_name, KeyFileFlags.NONE);
- }
- catch(GLib.KeyFileError e){
- warning("FamiliarPlayersDB::create_key_file() - KeyFileError");
- }
- catch(GLib.FileError e){
- warning("FamiliarPlayersDB::create_key_file() - FileError");
- }
- }
- return result;
- }
-
- private bool check_for_keys(){
- try{
- if(this.key_file.has_key(GROUP_NAME, KEY_NAME) == true){
- return true;
- }
- }
- catch(KeyFileError e){
- return false;
- }
- warning("Seen DB '%s' does not have key '%s' in group '%s'", this.file_name, KEY_NAME, GROUP_NAME);
- return false;
- }
-
- private bool load_data_from_key_file(){
- try{
- string[] desktops = this.key_file.get_string_list(GROUP_NAME,
- KEY_NAME);
- foreach(string s in desktops){
- this.players_DB.set(s, true);
- }
- return true;
- }
- catch(GLib.KeyFileError error){
- warning("Error loading the Desktop string list");
- return false;
- }
- }
-
- private bool write_db()
- {
- KeyFile keyfile = new KeyFile();
- string[] desktops = {};
- foreach(string key in this.players_DB.keys){
- desktops += key;
- }
- keyfile.set_string_list(GROUP_NAME,
- KEY_NAME,
- desktops);
- size_t data_length;
- string data = null;
- try{
- data = keyfile.to_data(out data_length);
- }
- catch(GLib.KeyFileError e){
- warning("Problems dumping keyfile to a string");
- return false;
- }
-
- if(create_with_parents(this.dir_name, 0700) != 0){
- warning("Unable to make directory: %s", this.dir_name);
- return false;
- }
-
- try{
- if(set_contents(this.file_name, data, (ssize_t)data_length) == false){
- warning("Unable to write out file '%s'", this.file_name);
- }
- }
- catch(FileError err){
- warning("Unable to write out file '%s'", this.file_name);
- }
- return true;
- }
-
- public void insert(string desktop)
- {
- if(already_familiar(desktop) == false){
- if(this.write_id != 0){
- Source.remove(this.write_id);
- this.write_id = 0;
- }
- this.write_id = Timeout.add_seconds(60, write_db);
- this.players_DB.set(desktop.dup(), true);
- }
- }
-
- public bool already_familiar(string desktop)
- {
- debug("playerDB->already_familiar - result %s", this.players_DB.keys.contains(desktop).to_string());
- return this.players_DB.keys.contains(desktop);
- }
-
- public Gee.Set<string> records()
- {
- return this.players_DB.keys;
- }
-
- public static string? fetch_icon_name(string desktop_path)
- {
- KeyFile desktop_keyfile = new KeyFile ();
- try{
- desktop_keyfile.load_from_file (desktop_path, KeyFileFlags.NONE);
- }
- catch(GLib.FileError error){
- warning("Error loading keyfile - FileError");
- return null;
- }
- catch(GLib.KeyFileError error){
- warning("Error loading keyfile - KeyFileError");
- return null;
- }
-
- try{
- return desktop_keyfile.get_string (KeyFileDesktop.GROUP,
- KeyFileDesktop.KEY_ICON);
- }
- catch(GLib.KeyFileError error){
- warning("Error trying to fetch the icon name from the keyfile");
- return null;
- }
- }
-
-} \ No newline at end of file
diff --git a/src/fetch-file.c b/src/fetch-file.c
index 680a582..1e6c1af 100644
--- a/src/fetch-file.c
+++ b/src/fetch-file.c
@@ -18,8 +18,8 @@
* <http://www.gnu.org/licenses/>.
*
* Authors
- * Gordon Allott <gord.allott@canonical.com>
- * Conor Curran <conor.curran@canonical.com>
+ * Gordon Allott <gord.allott@canonical.com>
+ * Conor Curran <conor.curran@canonical.com>
*/
#include <glib.h>
@@ -200,7 +200,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 __catch13_g_error;
+ goto __catch11_g_error;
}
data->_tmp2_ = data->_tmp1_;
data->_tmp3_ = NULL;
@@ -210,15 +210,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 __finally13;
- __catch13_g_error:
+ goto __finally11;
+ __catch11_g_error:
{
data->e = data->_inner_error_;
data->_inner_error_ = NULL;
g_signal_emit_by_name (data->self, "failed");
_g_error_free0 (data->e);
}
- __finally13:
+ __finally11:
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 +302,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 __catch14_g_error;
+ goto __catch12_g_error;
}
data->bufsize = data->_tmp4_;
if (data->bufsize < 1) {
@@ -321,15 +321,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 __finally14;
- __catch14_g_error:
+ goto __finally12;
+ __catch12_g_error:
{
data->e = data->_inner_error_;
data->_inner_error_ = NULL;
g_signal_emit_by_name (data->self, "failed");
_g_error_free0 (data->e);
}
- __finally14:
+ __finally12:
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/fetch-file.vala b/src/fetch-file.vala
index e6fc11d..e94afef 100644
--- a/src/fetch-file.vala
+++ b/src/fetch-file.vala
@@ -15,15 +15,15 @@
* <http://www.gnu.org/licenses/>.
*
* Authors
- * Gordon Allott <gord.allott@canonical.com>
- * Conor Curran <conor.curran@canonical.com>
+ * Gordon Allott <gord.allott@canonical.com>
+ * Conor Curran <conor.curran@canonical.com>
*/
public class FetchFile : Object
{
/* public variables */
public string uri {get; construct;}
- public string intended_property {get; construct;}
+ public string intended_property {get; construct;}
/* private variables */
private DataInputStream stream;
diff --git a/src/indicator-sound.c b/src/indicator-sound.c
index 7797f49..34f5ed9 100644
--- a/src/indicator-sound.c
+++ b/src/indicator-sound.c
@@ -46,7 +46,7 @@ typedef struct _IndicatorSoundPrivate IndicatorSoundPrivate;
struct _IndicatorSoundPrivate
{
- GtkWidget* volume_widget;
+ GtkWidget* volume_widget;
GList* transport_widgets_list;
};
@@ -67,7 +67,7 @@ G_DEFINE_TYPE (IndicatorSound, indicator_sound, INDICATOR_OBJECT_TYPE);
static GtkLabel * get_label (IndicatorObject * io);
static GtkImage * get_icon (IndicatorObject * io);
static GtkMenu * get_menu (IndicatorObject * io);
-static void indicator_sound_scroll (IndicatorObject* io, gint delta, IndicatorScrollDirection direction);
+static void indicator_sound_scroll (IndicatorObject* io, gint delta, IndicatorScrollDirection direction);
//Slider related
static gboolean new_volume_slider_widget(DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client);
@@ -131,8 +131,8 @@ indicator_sound_class_init (IndicatorSoundClass *klass)
IndicatorObjectClass *io_class = INDICATOR_OBJECT_CLASS(klass);
- g_type_class_add_private (klass, sizeof (IndicatorSoundPrivate));
-
+ g_type_class_add_private (klass, sizeof (IndicatorSoundPrivate));
+
io_class->get_label = get_label;
io_class->get_image = get_icon;
io_class->get_menu = get_menu;
@@ -153,13 +153,13 @@ indicator_sound_init (IndicatorSound *self)
blocked_id = 0;
initial_mute = FALSE;
device_available = TRUE;
-
- IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(self);
- priv->volume_widget = NULL;
+
+ IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(self);
+ priv->volume_widget = NULL;
GList* t_list = NULL;
priv->transport_widgets_list = t_list;
- g_signal_connect(G_OBJECT(self->service),
+ g_signal_connect(G_OBJECT(self->service),
INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE,
G_CALLBACK(connection_changed), self);
return;
@@ -178,7 +178,7 @@ indicator_sound_dispose (GObject *object)
free_the_animation_list();
- IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(INDICATOR_SOUND (self));
+ IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(INDICATOR_SOUND (self));
g_list_free ( priv->transport_widgets_list );
@@ -204,7 +204,7 @@ static GtkImage *
get_icon (IndicatorObject * io)
{
gchar* current_name = g_hash_table_lookup(volume_states,
- GINT_TO_POINTER(current_state));
+ GINT_TO_POINTER(current_state));
//g_debug("At start-up attempting to set the image to %s",
// current_name);
speaker_image = indicator_image_helper(current_name);
@@ -220,18 +220,18 @@ static GtkMenu *
get_menu (IndicatorObject * io)
{
DbusmenuGtkMenu* menu = dbusmenu_gtkmenu_new(INDICATOR_SOUND_DBUS_NAME, INDICATOR_SOUND_DBUS_OBJECT);
-
+
DbusmenuGtkClient *client = dbusmenu_gtkmenu_get_client(menu);
g_object_set_data (G_OBJECT (client), "indicator", io);
dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_VOLUME_MENUITEM_TYPE, new_volume_slider_widget);
dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_TRANSPORT_MENUITEM_TYPE, new_transport_widget);
dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_METADATA_MENUITEM_TYPE, new_metadata_widget);
dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_TITLE_MENUITEM_TYPE, new_title_widget);
- // register Key-press listening on the menu widget as the slider does not allow this.
+ // register Key-press listening on the menu widget as the slider does not allow this.
g_signal_connect(menu, "key-press-event", G_CALLBACK(key_press_cb), io);
g_signal_connect(menu, "key-release-event", G_CALLBACK(key_release_cb), io);
- return GTK_MENU(menu);
+ return GTK_MENU(menu);
}
static void
@@ -256,13 +256,13 @@ new_transport_widget(DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbus
g_return_val_if_fail(DBUSMENU_IS_GTKCLIENT(client), FALSE);
bar = transport_widget_new(newitem);
- io = g_object_get_data (G_OBJECT (client), "indicator");
- IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(INDICATOR_SOUND (io));
+ io = g_object_get_data (G_OBJECT (client), "indicator");
+ IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(INDICATOR_SOUND (io));
priv->transport_widgets_list = g_list_append ( priv->transport_widgets_list, bar );
GtkMenuItem *menu_transport_bar = GTK_MENU_ITEM(bar);
- gtk_widget_show_all(bar);
+ gtk_widget_show_all(bar);
dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, menu_transport_bar, parent);
return TRUE;
@@ -281,7 +281,7 @@ new_metadata_widget(DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbusm
metadata = metadata_widget_new (newitem);
GtkMenuItem *menu_metadata_widget = GTK_MENU_ITEM(metadata);
- gtk_widget_show_all(metadata);
+ gtk_widget_show_all(metadata);
dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, menu_metadata_widget, parent);
return TRUE;
@@ -290,22 +290,22 @@ new_metadata_widget(DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbusm
static gboolean
new_title_widget(DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client)
{
- //g_debug("indicator-sound: new_title_widget");
+ //g_debug("indicator-sound: new_title_widget");
g_return_val_if_fail(DBUSMENU_IS_MENUITEM(newitem), FALSE);
g_return_val_if_fail(DBUSMENU_IS_GTKCLIENT(client), FALSE);
- //g_debug ("%s (\"%s\")", __func__, dbusmenu_menuitem_property_get(newitem, DBUSMENU_TITLE_MENUITEM_NAME));
+ //g_debug ("%s (\"%s\")", __func__, dbusmenu_menuitem_property_get(newitem, DBUSMENU_TITLE_MENUITEM_NAME));
- GtkWidget* title = NULL;
+ GtkWidget* title = NULL;
title = title_widget_new (newitem);
GtkMenuItem *menu_title_widget = GTK_MENU_ITEM(title);
-
+
gtk_widget_show_all(title);
- dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client),
- newitem,
- menu_title_widget, parent);
+ dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client),
+ newitem,
+ menu_title_widget, parent);
return TRUE;
}
@@ -320,27 +320,27 @@ new_volume_slider_widget(DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent,
g_return_val_if_fail(DBUSMENU_IS_MENUITEM(newitem), FALSE);
g_return_val_if_fail(DBUSMENU_IS_GTKCLIENT(client), FALSE);
- volume_widget = volume_widget_new (newitem);
- io = g_object_get_data (G_OBJECT (client), "indicator");
- IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(INDICATOR_SOUND (io));
+ volume_widget = volume_widget_new (newitem);
+ io = g_object_get_data (G_OBJECT (client), "indicator");
+ IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(INDICATOR_SOUND (io));
priv->volume_widget = volume_widget;
- GtkWidget* ido_slider_widget = volume_widget_get_ido_slider(VOLUME_WIDGET(priv->volume_widget));
+ GtkWidget* ido_slider_widget = volume_widget_get_ido_slider(VOLUME_WIDGET(priv->volume_widget));
- g_signal_connect(ido_slider_widget, "style-set", G_CALLBACK(style_changed_cb), NULL);
- gtk_widget_set_sensitive(ido_slider_widget,
- !initial_mute);
- gtk_widget_show_all(ido_slider_widget);
+ g_signal_connect(ido_slider_widget, "style-set", G_CALLBACK(style_changed_cb), NULL);
+ gtk_widget_set_sensitive(ido_slider_widget,
+ !initial_mute);
+ gtk_widget_show_all(ido_slider_widget);
-
+
GtkMenuItem *menu_volume_item = GTK_MENU_ITEM(ido_slider_widget);
- dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client),
- newitem,
- menu_volume_item,
- parent);
+ dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client),
+ newitem,
+ menu_volume_item,
+ parent);
fetch_mute_value_from_dbus();
fetch_sink_availability_from_dbus(INDICATOR_SOUND (io));
- return TRUE;
+ return TRUE;
}
@@ -374,14 +374,14 @@ connection_changed (IndicatorServiceManager * sm, gboolean connected, gpointer u
dbus_g_proxy_add_signal(sound_dbus_proxy, SIGNAL_SINK_MUTE_UPDATE, G_TYPE_BOOLEAN, G_TYPE_INVALID);
dbus_g_proxy_connect_signal(sound_dbus_proxy, SIGNAL_SINK_MUTE_UPDATE, G_CALLBACK(catch_signal_sink_mute_update), user_data, NULL);
dbus_g_proxy_add_signal(sound_dbus_proxy, SIGNAL_SINK_AVAILABLE_UPDATE, G_TYPE_BOOLEAN, G_TYPE_INVALID);
- dbus_g_proxy_connect_signal(sound_dbus_proxy, SIGNAL_SINK_AVAILABLE_UPDATE, G_CALLBACK(catch_signal_sink_availability_update), NULL, NULL);
+ dbus_g_proxy_connect_signal(sound_dbus_proxy, SIGNAL_SINK_AVAILABLE_UPDATE, G_CALLBACK(catch_signal_sink_availability_update), NULL, NULL);
if( service_restart == TRUE){
fetch_mute_value_from_dbus();
// Ensure UI is in sync with service again.
IndicatorSound* indicator = INDICATOR_SOUND(user_data);
fetch_sink_availability_from_dbus(indicator);
- IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(indicator);
+ IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(indicator);
if(priv->volume_widget != NULL){
determine_state_from_volume (volume_widget_get_current_volume(priv->volume_widget));
}
@@ -390,7 +390,7 @@ connection_changed (IndicatorServiceManager * sm, gboolean connected, gpointer u
else{
g_warning("Indicator has been disconnected from the service -> SHOCK HORROR");
IndicatorSound* indicator = INDICATOR_SOUND(user_data);
- IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(indicator);
+ IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(indicator);
if(priv->volume_widget != NULL){
g_warning("indicator still has a slider, service must have crashed");
@@ -556,29 +556,29 @@ reset_mute_blocking_animation()
static void
fetch_sink_availability_from_dbus(IndicatorSound* self)
{
- g_return_if_fail(IS_INDICATOR_SOUND(self));
-
+ g_return_if_fail(IS_INDICATOR_SOUND(self));
+
GError * error = NULL;
gboolean * available_input;
available_input = g_new0(gboolean, 1);
- org_ayatana_indicator_sound_get_sink_availability(sound_dbus_proxy, available_input, &error);
+ com_canonical_indicators_sound_get_sink_availability(sound_dbus_proxy, available_input, &error);
if (error != NULL) {
g_warning("Unable to fetch AVAILABILITY at indicator start up: %s", error->message);
g_error_free(error);
g_free(available_input);
return;
}
-
+
device_available = *available_input;
if (device_available == FALSE) {
update_state(STATE_SINKS_NONE);
//g_debug("NO DEVICE AVAILABLE");
}
- IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(self);
+ IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(self);
if(priv->volume_widget != NULL){
- GtkWidget* slider_widget = volume_widget_get_ido_slider(VOLUME_WIDGET(priv->volume_widget));
+ GtkWidget* slider_widget = volume_widget_get_ido_slider(VOLUME_WIDGET(priv->volume_widget));
gtk_widget_set_sensitive(slider_widget, device_available);
}
@@ -593,7 +593,7 @@ fetch_mute_value_from_dbus()
GError * error = NULL;
gboolean *mute_input;
mute_input = g_new0(gboolean, 1);
- org_ayatana_indicator_sound_get_sink_mute(sound_dbus_proxy, mute_input, &error);
+ com_canonical_indicators_sound_get_sink_mute(sound_dbus_proxy, mute_input, &error);
if (error != NULL) {
g_warning("Unable to fetch MUTE at indicator start up: %s", error->message);
g_error_free(error);
@@ -635,14 +635,14 @@ catch_signal_sink_mute_update(DBusGProxy *proxy, gboolean mute_value, gpointer u
reset_mute_blocking_animation();
}
//g_debug("signal caught - sink mute update with mute value: %i", mute_value);
- g_return_if_fail(IS_INDICATOR_SOUND(userdata));
- IndicatorSound* indicator = INDICATOR_SOUND(userdata);
- IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(indicator);
-
- if(priv->volume_widget == NULL){
- return;
- }
- GtkWidget* slider_widget = volume_widget_get_ido_slider(VOLUME_WIDGET(priv->volume_widget));
+ g_return_if_fail(IS_INDICATOR_SOUND(userdata));
+ IndicatorSound* indicator = INDICATOR_SOUND(userdata);
+ IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(indicator);
+
+ if(priv->volume_widget == NULL){
+ return;
+ }
+ GtkWidget* slider_widget = volume_widget_get_ido_slider(VOLUME_WIDGET(priv->volume_widget));
gtk_widget_set_sensitive(slider_widget, !mute_value);
}
@@ -669,16 +669,16 @@ key_press_cb(GtkWidget* widget, GdkEventKey* event, gpointer data)
{
gboolean digested = FALSE;
- g_return_val_if_fail(IS_INDICATOR_SOUND(data), FALSE);
+ g_return_val_if_fail(IS_INDICATOR_SOUND(data), FALSE);
- IndicatorSound *indicator = INDICATOR_SOUND (data);
+ IndicatorSound *indicator = INDICATOR_SOUND (data);
- IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(indicator);
- if(priv->volume_widget == NULL){
- return FALSE;
- }
-
- GtkWidget* slider_widget = volume_widget_get_ido_slider(VOLUME_WIDGET(priv->volume_widget));
+ IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(indicator);
+ if(priv->volume_widget == NULL){
+ return FALSE;
+ }
+
+ GtkWidget* slider_widget = volume_widget_get_ido_slider(VOLUME_WIDGET(priv->volume_widget));
GtkWidget* slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)slider_widget);
GtkRange* range = (GtkRange*)slider;
g_return_val_if_fail(GTK_IS_RANGE(range), FALSE);
@@ -720,7 +720,7 @@ key_press_cb(GtkWidget* widget, GdkEventKey* event, gpointer data)
new_value = CLAMP(new_value, 0, 100);
if (new_value != current_value && current_state != STATE_MUTED) {
//g_debug("Attempting to set the range from the key listener to %f", new_value);
- volume_widget_update(VOLUME_WIDGET(priv->volume_widget), new_value);
+ volume_widget_update(VOLUME_WIDGET(priv->volume_widget), new_value);
}
}
else if (IS_TRANSPORT_WIDGET(menuitem) == TRUE) {
@@ -769,11 +769,11 @@ key_release_cb(GtkWidget* widget, GdkEventKey* event, gpointer data)
{
gboolean digested = FALSE;
- g_return_val_if_fail(IS_INDICATOR_SOUND(data), FALSE);
+ g_return_val_if_fail(IS_INDICATOR_SOUND(data), FALSE);
- IndicatorSound *indicator = INDICATOR_SOUND (data);
+ IndicatorSound *indicator = INDICATOR_SOUND (data);
- IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(indicator);
+ IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(indicator);
GtkWidget *menuitem;
@@ -829,25 +829,25 @@ style_changed_cb(GtkWidget *widget, gpointer user_data)
static void
indicator_sound_scroll (IndicatorObject *io, gint delta, IndicatorScrollDirection direction)
{
- //g_debug("indicator-sound-scroll - current slider value");
+ //g_debug("indicator-sound-scroll - current slider value");
- if (device_available == FALSE || current_state == STATE_MUTED)
+ if (device_available == FALSE || current_state == STATE_MUTED)
return;
- IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(INDICATOR_SOUND (io));
-
- GtkWidget* slider_widget = volume_widget_get_ido_slider(VOLUME_WIDGET(priv->volume_widget));
+ IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(INDICATOR_SOUND (io));
+
+ GtkWidget* slider_widget = volume_widget_get_ido_slider(VOLUME_WIDGET(priv->volume_widget));
GtkWidget* slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)slider_widget);
GtkRange* range = (GtkRange*)slider;
g_return_if_fail(GTK_IS_RANGE(range));
gdouble value = gtk_range_get_value(range);
GtkAdjustment *adj = gtk_range_get_adjustment (GTK_RANGE (slider));
- //g_debug("indicator-sound-scroll - current slider value %f", value);
+ //g_debug("indicator-sound-scroll - current slider value %f", value);
if (direction == INDICATOR_OBJECT_SCROLL_UP) {
value += adj->step_increment;
} else {
value -= adj->step_increment;
}
- //g_debug("indicator-sound-scroll - update slider with value %f", value);
- volume_widget_update(VOLUME_WIDGET(priv->volume_widget), value);
+ //g_debug("indicator-sound-scroll - update slider with value %f", value);
+ volume_widget_update(VOLUME_WIDGET(priv->volume_widget), value);
}
diff --git a/src/metadata-menu-item.c b/src/metadata-menu-item.c
index 8acf1ed..7e1bdbf 100644
--- a/src/metadata-menu-item.c
+++ b/src/metadata-menu-item.c
@@ -206,7 +206,7 @@ static gboolean metadata_menuitem_delete_album_art_contents (GFile* dir) {
_tmp0_ = g_file_enumerate_children (dir, G_FILE_ATTRIBUTE_STANDARD_NAME, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL, &_inner_error_);
e = _tmp0_;
if (_inner_error_ != NULL) {
- goto __catch0_g_error;
+ goto __catch2_g_error;
}
while (TRUE) {
GFileInfo* _tmp1_ = NULL;
@@ -219,7 +219,7 @@ static gboolean metadata_menuitem_delete_album_art_contents (GFile* dir) {
file = _tmp1_;
if (_inner_error_ != NULL) {
_g_object_unref0 (e);
- goto __catch0_g_error;
+ goto __catch2_g_error;
}
_tmp2_ = g_file_info_get_name (file);
g_debug ("metadata-menu-item.vala:76: file name = %s", _tmp2_);
@@ -232,10 +232,10 @@ static gboolean metadata_menuitem_delete_album_art_contents (GFile* dir) {
child = _tmp4_;
g_file_delete (child, NULL, &_inner_error_);
if (_inner_error_ != NULL) {
- goto __catch1_g_error;
+ goto __catch3_g_error;
}
- goto __finally1;
- __catch1_g_error:
+ goto __finally3;
+ __catch3_g_error:
{
GError * error_;
gchar* _tmp5_ = NULL;
@@ -258,19 +258,19 @@ static gboolean metadata_menuitem_delete_album_art_contents (GFile* dir) {
_result_ = FALSE;
_g_error_free0 (error_);
}
- __finally1:
+ __finally3:
if (_inner_error_ != NULL) {
_g_object_unref0 (child);
_g_object_unref0 (file);
_g_object_unref0 (e);
- goto __catch0_g_error;
+ goto __catch2_g_error;
}
_g_object_unref0 (child);
_g_object_unref0 (file);
}
_g_object_unref0 (e);
- goto __finally0;
- __catch0_g_error:
+ goto __finally2;
+ __catch2_g_error:
{
GError * _error_;
gchar* _tmp11_ = NULL;
@@ -291,7 +291,7 @@ static gboolean metadata_menuitem_delete_album_art_contents (GFile* dir) {
_result_ = FALSE;
_g_error_free0 (_error_);
}
- __finally0:
+ __finally2:
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_);
@@ -358,7 +358,7 @@ void metadata_menuitem_fetch_art (MetadataMenuitem* self, const gchar* uri, cons
_tmp6_ = (_tmp5_ = _tmp4_, _g_free0 (_tmp3_), _tmp5_);
if (_inner_error_ != NULL) {
if (_inner_error_->domain == G_CONVERT_ERROR) {
- goto __catch2_g_convert_error;
+ goto __catch4_g_convert_error;
}
_g_free0 (path);
_g_object_unref0 (art_file);
@@ -370,8 +370,8 @@ void metadata_menuitem_fetch_art (MetadataMenuitem* self, const gchar* uri, cons
_g_free0 (path);
path = _tmp7_;
dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, prop, path);
- goto __finally2;
- __catch2_g_convert_error:
+ goto __finally4;
+ __catch4_g_convert_error:
{
GError * e;
e = _inner_error_;
@@ -379,7 +379,7 @@ void metadata_menuitem_fetch_art (MetadataMenuitem* self, const gchar* uri, cons
g_warning ("metadata-menu-item.vala:108: Problem converting URI %s to file path", uri);
_g_error_free0 (e);
}
- __finally2:
+ __finally4:
if (_inner_error_ != NULL) {
_g_free0 (path);
_g_object_unref0 (art_file);
@@ -438,12 +438,12 @@ static void metadata_menuitem_on_fetcher_completed (MetadataMenuitem* self, GByt
gdk_pixbuf_loader_write (loader, update->data, (gsize) ((gint) update->len), &_inner_error_);
if (_inner_error_ != NULL) {
_g_object_unref0 (loader);
- goto __catch3_g_error;
+ goto __catch5_g_error;
}
gdk_pixbuf_loader_close (loader, &_inner_error_);
if (_inner_error_ != NULL) {
_g_object_unref0 (loader);
- goto __catch3_g_error;
+ goto __catch5_g_error;
}
_tmp1_ = gdk_pixbuf_loader_get_pixbuf (loader);
_tmp2_ = _g_object_ref0 (_tmp1_);
@@ -464,7 +464,7 @@ static void metadata_menuitem_on_fetcher_completed (MetadataMenuitem* self, GByt
_g_free0 (path);
_g_object_unref0 (icon);
_g_object_unref0 (loader);
- goto __catch3_g_error;
+ goto __catch5_g_error;
}
dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, property, path);
if (self->priv->previous_temp_album_art_path != NULL) {
@@ -478,8 +478,8 @@ static void metadata_menuitem_on_fetcher_completed (MetadataMenuitem* self, GByt
_g_free0 (path);
_g_object_unref0 (icon);
_g_object_unref0 (loader);
- goto __finally3;
- __catch3_g_error:
+ goto __finally5;
+ __catch5_g_error:
{
GError * e;
e = _inner_error_;
@@ -488,7 +488,7 @@ static void metadata_menuitem_on_fetcher_completed (MetadataMenuitem* self, GByt
"hed from the interweb - error: %s", e->message);
_g_error_free0 (e);
}
- __finally3:
+ __finally5:
if (_inner_error_ != NULL) {
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
g_clear_error (&_inner_error_);
diff --git a/src/metadata-menu-item.vala b/src/metadata-menu-item.vala
index c9ab4dd..741bb9f 100644
--- a/src/metadata-menu-item.vala
+++ b/src/metadata-menu-item.vala
@@ -23,48 +23,48 @@ using Gdk;
public class MetadataMenuitem : PlayerItem
{
- public const string ALBUM_ART_DIR_SUFFIX = "indicators/sound/album-art-cache";
-
- public static string album_art_cache_dir;
- private static FetchFile fetcher;
- private string previous_temp_album_art_path;
-
- public MetadataMenuitem()
+ public const string ALBUM_ART_DIR_SUFFIX = "indicators/sound/album-art-cache";
+
+ public static string album_art_cache_dir;
+ private static FetchFile fetcher;
+ private string previous_temp_album_art_path;
+
+ public MetadataMenuitem()
{
- Object(item_type: MENUITEM_TYPE);
- reset(attributes_format());
- }
-
- construct{
- MetadataMenuitem.clean_album_art_temp_dir();
- this.previous_temp_album_art_path = null;
- this.album_art_cache_dir = MetadataMenuitem.create_album_art_temp_dir();
- }
+ Object(item_type: MENUITEM_TYPE);
+ reset(attributes_format());
+ }
+
+ construct{
+ MetadataMenuitem.clean_album_art_temp_dir();
+ this.previous_temp_album_art_path = null;
+ this.album_art_cache_dir = MetadataMenuitem.create_album_art_temp_dir();
+ }
- private static void clean_album_art_temp_dir()
- {
- string path = GLib.Path.build_filename(Environment.get_user_cache_dir(), ALBUM_ART_DIR_SUFFIX);
+ private static void clean_album_art_temp_dir()
+ {
+ string path = GLib.Path.build_filename(Environment.get_user_cache_dir(), ALBUM_ART_DIR_SUFFIX);
- GLib.File? album_art_dir = GLib.File.new_for_path(path);
-
- if(delete_album_art_contents(album_art_dir) == false)
- {
- warning("could not remove the temp album art files %s", path);
- }
- }
+ GLib.File? album_art_dir = GLib.File.new_for_path(path);
+
+ if(delete_album_art_contents(album_art_dir) == false)
+ {
+ warning("could not remove the temp album art files %s", path);
+ }
+ }
- private static string? create_album_art_temp_dir()
- {
- string path = GLib.Path.build_filename(Environment.get_user_cache_dir(), ALBUM_ART_DIR_SUFFIX);
- if(DirUtils.create(path, 0700) == -1){
- warning("could not create a temp dir for remote album art, it must have been created already");
- }
- return path;
- }
-
- private static bool delete_album_art_contents (GLib.File dir)
+ private static string? create_album_art_temp_dir()
+ {
+ string path = GLib.Path.build_filename(Environment.get_user_cache_dir(), ALBUM_ART_DIR_SUFFIX);
+ if(DirUtils.create(path, 0700) == -1){
+ warning("could not create a temp dir for remote album art, it must have been created already");
+ }
+ return path;
+ }
+
+ private static bool delete_album_art_contents (GLib.File dir)
{
- bool result = true;
+ bool result = true;
try {
var e = dir.enumerate_children (FILE_ATTRIBUTE_STANDARD_NAME,
FileQueryInfoFlags.NOFOLLOW_SYMLINKS,
@@ -73,9 +73,9 @@ public class MetadataMenuitem : PlayerItem
{
var file = e.next_file (null);
- debug("file name = %s", file.get_name());
-
- if (file == null)
+ debug("file name = %s", file.get_name());
+
+ if (file == null)
break;
var child = dir.get_child (file.get_name ());
@@ -84,82 +84,82 @@ public class MetadataMenuitem : PlayerItem
child.delete (null);
} catch (Error error_) {
warning (@"Unable to delete file '$(child.get_basename ()): $(error_.message)");
- result = false;
+ result = false;
}
}
} catch (Error error) {
warning (@"Unable to read files from directory '$(dir.get_basename ())': %s",
error.message);
- result = false;
+ result = false;
}
- return result;
+ return result;
}
- public void fetch_art(string uri, string prop)
- {
- File art_file = File.new_for_uri(uri);
- if(art_file.is_native() == true){
- string path;
- try{
- path = Filename.from_uri(uri.strip());
- this.property_set(prop, path);
- }
- catch(ConvertError e){
- warning("Problem converting URI %s to file path",
- uri);
- }
- // eitherway return, the artwork was local
- return;
- }
- debug("fetch_art -remotely %s", this.album_art_cache_dir);
- // If we didn't manage to create the temp dir
- // don't bother with remote
- if(this.album_art_cache_dir == null){
- return;
- }
- // green light to go remote
- this.fetcher = new FetchFile (uri, prop);
- this.fetcher.failed.connect (() => { this.on_fetcher_failed ();});
- this.fetcher.completed.connect (this.on_fetcher_completed);
- this.fetcher.fetch_data ();
- }
-
- private void on_fetcher_failed ()
- {
- warning("on_fetcher_failed -> could not fetch artwork");
- }
+ public void fetch_art(string uri, string prop)
+ {
+ File art_file = File.new_for_uri(uri);
+ if(art_file.is_native() == true){
+ string path;
+ try{
+ path = Filename.from_uri ( uri.strip() );
+ this.property_set ( prop, path );
+ }
+ catch(ConvertError e){
+ warning("Problem converting URI %s to file path",
+ uri);
+ }
+ // eitherway return, the artwork was local
+ return;
+ }
+ debug("fetch_art -remotely %s", this.album_art_cache_dir);
+ // If we didn't manage to create the temp dir
+ // don't bother with remote
+ if(this.album_art_cache_dir == null){
+ return;
+ }
+ // green light to go remote
+ this.fetcher = new FetchFile (uri, prop);
+ this.fetcher.failed.connect (() => { this.on_fetcher_failed ();});
+ this.fetcher.completed.connect (this.on_fetcher_completed);
+ this.fetcher.fetch_data ();
+ }
+
+ private void on_fetcher_failed ()
+ {
+ warning("on_fetcher_failed -> could not fetch artwork");
+ }
- private void on_fetcher_completed(ByteArray update, string property)
- {
- try{
- PixbufLoader loader = new PixbufLoader ();
- loader.write (update.data);
- loader.close ();
- Pixbuf icon = loader.get_pixbuf ();
- string path = this.album_art_cache_dir.concat("/downloaded-coverart-XXXXXX");
- int r = FileUtils.mkstemp(path);
- if(r != -1){
- icon.save (path, loader.get_format().get_name());
- this.property_set(property, path);
- if(this.previous_temp_album_art_path != null){
- FileUtils.remove(this.previous_temp_album_art_path);
- }
- this.previous_temp_album_art_path = path;
- }
- }
- catch(GLib.Error e){
- warning("Problem creating file from bytearray fetched from the interweb - error: %s",
- e.message);
- }
- }
-
- public static HashSet<string> attributes_format()
- {
- HashSet<string> attrs = new HashSet<string>();
- attrs.add(MENUITEM_TITLE);
+ private void on_fetcher_completed(ByteArray update, string property)
+ {
+ try{
+ PixbufLoader loader = new PixbufLoader ();
+ loader.write (update.data);
+ loader.close ();
+ Pixbuf icon = loader.get_pixbuf ();
+ string path = this.album_art_cache_dir.concat("/downloaded-coverart-XXXXXX");
+ int r = FileUtils.mkstemp(path);
+ if(r != -1){
+ icon.save (path, loader.get_format().get_name());
+ this.property_set(property, path);
+ if(this.previous_temp_album_art_path != null){
+ FileUtils.remove(this.previous_temp_album_art_path);
+ }
+ this.previous_temp_album_art_path = path;
+ }
+ }
+ catch(GLib.Error e){
+ warning("Problem creating file from bytearray fetched from the interweb - error: %s",
+ e.message);
+ }
+ }
+
+ public static HashSet<string> attributes_format()
+ {
+ HashSet<string> attrs = new HashSet<string>();
+ attrs.add(MENUITEM_TITLE);
attrs.add(MENUITEM_ARTIST);
attrs.add(MENUITEM_ALBUM);
attrs.add(MENUITEM_ARTURL);
- return attrs;
- }
+ return attrs;
+ }
}
diff --git a/src/metadata-widget.c b/src/metadata-widget.c
index ac8355c..191e134 100644
--- a/src/metadata-widget.c
+++ b/src/metadata-widget.c
@@ -34,14 +34,14 @@ typedef struct _MetadataWidgetPrivate MetadataWidgetPrivate;
struct _MetadataWidgetPrivate
{
gboolean theme_change_occured;
- GtkWidget* hbox;
- GtkWidget* album_art;
- GString* image_path;
- GString* old_image_path;
- GtkWidget* artist_label;
- GtkWidget* piece_label;
- GtkWidget* container_label;
- DbusmenuMenuitem* twin_item;
+ GtkWidget* hbox;
+ GtkWidget* album_art;
+ GString* image_path;
+ GString* old_image_path;
+ GtkWidget* artist_label;
+ GtkWidget* piece_label;
+ GtkWidget* container_label;
+ DbusmenuMenuitem* twin_item;
};
#define METADATA_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), METADATA_WIDGET_TYPE, MetadataWidgetPrivate))
@@ -57,11 +57,11 @@ static void metadata_widget_set_twin_item (MetadataWidget* self, DbusmenuMenuite
// keyevent consumers
static gboolean metadata_widget_button_press_event (GtkWidget *menuitem,
- GdkEventButton *event);
+ GdkEventButton *event);
// Dbusmenuitem properties update callback
static void metadata_widget_property_update (DbusmenuMenuitem* item,
gchar* property,
- GValue* value,
+ GValue* value,
gpointer userdata);
static void metadata_widget_style_labels ( MetadataWidget* self,
GtkLabel* label);
@@ -77,105 +77,105 @@ G_DEFINE_TYPE (MetadataWidget, metadata_widget, GTK_TYPE_MENU_ITEM);
static void
metadata_widget_class_init (MetadataWidgetClass *klass)
{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- widget_class->button_press_event = metadata_widget_button_press_event;
-
- g_type_class_add_private (klass, sizeof (MetadataWidgetPrivate));
+ widget_class->button_press_event = metadata_widget_button_press_event;
+
+ g_type_class_add_private (klass, sizeof (MetadataWidgetPrivate));
- gobject_class->dispose = metadata_widget_dispose;
- gobject_class->finalize = metadata_widget_finalize;
+ gobject_class->dispose = metadata_widget_dispose;
+ gobject_class->finalize = metadata_widget_finalize;
}
static void
metadata_widget_init (MetadataWidget *self)
{
- //g_debug("MetadataWidget::metadata_widget_init");
+ //g_debug("MetadataWidget::metadata_widget_init");
- MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(self);
- GtkWidget *hbox;
+ MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(self);
+ GtkWidget *hbox;
- hbox = gtk_hbox_new(FALSE, 0);
- priv->hbox = hbox;
+ hbox = gtk_hbox_new(FALSE, 0);
+ priv->hbox = hbox;
- // image
- priv->album_art = gtk_image_new();
- priv->image_path = g_string_new(dbusmenu_menuitem_property_get(priv->twin_item,
+ // image
+ priv->album_art = gtk_image_new();
+ priv->image_path = g_string_new(dbusmenu_menuitem_property_get(priv->twin_item,
DBUSMENU_METADATA_MENUITEM_ARTURL));
- priv->old_image_path = g_string_new("");
-
+ priv->old_image_path = g_string_new("");
+
g_signal_connect(priv->album_art, "expose-event",
G_CALLBACK(metadata_image_expose),
- GTK_WIDGET(self));
- gtk_widget_set_size_request(GTK_WIDGET(priv->album_art), 60, 60);
-
- gtk_box_pack_start (GTK_BOX (priv->hbox),
+ GTK_WIDGET(self));
+ gtk_widget_set_size_request(GTK_WIDGET(priv->album_art), 60, 60);
+
+ gtk_box_pack_start (GTK_BOX (priv->hbox),
priv->album_art,
FALSE,
FALSE,
- 1);
+ 1);
priv->theme_change_occured = FALSE;
GtkWidget* vbox = gtk_vbox_new(FALSE, 0);
-
- // artist
- GtkWidget* artist;
- artist = gtk_label_new(dbusmenu_menuitem_property_get(priv->twin_item,
- DBUSMENU_METADATA_MENUITEM_ARTIST));
- gtk_misc_set_alignment(GTK_MISC(artist), (gfloat)0, (gfloat)0);
- gtk_misc_set_padding (GTK_MISC(artist), (gfloat)10, (gfloat)0);
+
+ // artist
+ GtkWidget* artist;
+ artist = gtk_label_new(dbusmenu_menuitem_property_get(priv->twin_item,
+ DBUSMENU_METADATA_MENUITEM_ARTIST));
+ gtk_misc_set_alignment(GTK_MISC(artist), (gfloat)0, (gfloat)0);
+ gtk_misc_set_padding (GTK_MISC(artist), (gfloat)10, (gfloat)0);
gtk_widget_set_size_request (artist, 140, 15);
- gtk_label_set_ellipsize(GTK_LABEL(artist), PANGO_ELLIPSIZE_MIDDLE);
- metadata_widget_style_labels(self, GTK_LABEL(artist));
- priv->artist_label = artist;
-
- // title
- GtkWidget* piece;
- piece = gtk_label_new(dbusmenu_menuitem_property_get( priv->twin_item,
- DBUSMENU_METADATA_MENUITEM_TITLE) );
- gtk_misc_set_alignment(GTK_MISC(piece), (gfloat)0, (gfloat)0);
- gtk_misc_set_padding (GTK_MISC(piece), (gfloat)10, (gfloat)-5);
+ gtk_label_set_ellipsize(GTK_LABEL(artist), PANGO_ELLIPSIZE_MIDDLE);
+ metadata_widget_style_labels(self, GTK_LABEL(artist));
+ priv->artist_label = artist;
+
+ // title
+ GtkWidget* piece;
+ piece = gtk_label_new(dbusmenu_menuitem_property_get( priv->twin_item,
+ DBUSMENU_METADATA_MENUITEM_TITLE) );
+ gtk_misc_set_alignment(GTK_MISC(piece), (gfloat)0, (gfloat)0);
+ gtk_misc_set_padding (GTK_MISC(piece), (gfloat)10, (gfloat)-5);
gtk_widget_set_size_request (piece, 140, 15);
gtk_label_set_ellipsize(GTK_LABEL(piece), PANGO_ELLIPSIZE_MIDDLE);
- metadata_widget_style_labels(self, GTK_LABEL(piece));
- priv->piece_label = piece;
-
- // container
- GtkWidget* container;
- container = gtk_label_new(dbusmenu_menuitem_property_get( priv->twin_item,
- DBUSMENU_METADATA_MENUITEM_ALBUM) );
- gtk_misc_set_alignment(GTK_MISC(container), (gfloat)0, (gfloat)0);
- gtk_misc_set_padding (GTK_MISC(container), (gfloat)10, (gfloat)0);
+ metadata_widget_style_labels(self, GTK_LABEL(piece));
+ priv->piece_label = piece;
+
+ // container
+ GtkWidget* container;
+ container = gtk_label_new(dbusmenu_menuitem_property_get( priv->twin_item,
+ DBUSMENU_METADATA_MENUITEM_ALBUM) );
+ gtk_misc_set_alignment(GTK_MISC(container), (gfloat)0, (gfloat)0);
+ gtk_misc_set_padding (GTK_MISC(container), (gfloat)10, (gfloat)0);
gtk_widget_set_size_request (container, 140, 15);
- gtk_label_set_ellipsize(GTK_LABEL(container), PANGO_ELLIPSIZE_MIDDLE);
- metadata_widget_style_labels(self, GTK_LABEL(container));
- priv->container_label = container;
+ gtk_label_set_ellipsize(GTK_LABEL(container), PANGO_ELLIPSIZE_MIDDLE);
+ metadata_widget_style_labels(self, GTK_LABEL(container));
+ priv->container_label = container;
- gtk_box_pack_start (GTK_BOX (vbox), priv->piece_label, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), priv->artist_label, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), priv->container_label, FALSE, FALSE, 0);
-
- gtk_box_pack_start (GTK_BOX (priv->hbox), vbox, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), priv->piece_label, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), priv->artist_label, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), priv->container_label, FALSE, FALSE, 0);
+
+ gtk_box_pack_start (GTK_BOX (priv->hbox), vbox, FALSE, FALSE, 0);
g_signal_connect(self, "style-set",
- G_CALLBACK(metadata_widget_set_style), GTK_WIDGET(self));
- g_signal_connect (self, "selection-received",
+ G_CALLBACK(metadata_widget_set_style), GTK_WIDGET(self));
+ g_signal_connect (self, "selection-received",
G_CALLBACK(metadata_widget_selection_received_event_callback),
- GTK_WIDGET(self));
- gtk_widget_set_size_request(GTK_WIDGET(self), 200, 75);
+ GTK_WIDGET(self));
+ gtk_widget_set_size_request(GTK_WIDGET(self), 200, 75);
gtk_container_add (GTK_CONTAINER (self), hbox);
}
static void
metadata_widget_dispose (GObject *object)
{
- G_OBJECT_CLASS (metadata_widget_parent_class)->dispose (object);
+ G_OBJECT_CLASS (metadata_widget_parent_class)->dispose (object);
}
static void
metadata_widget_finalize (GObject *object)
{
- G_OBJECT_CLASS (metadata_widget_parent_class)->finalize (object);
+ G_OBJECT_CLASS (metadata_widget_parent_class)->finalize (object);
}
@@ -186,46 +186,48 @@ metadata_widget_finalize (GObject *object)
static gboolean
metadata_image_expose (GtkWidget *metadata, GdkEventExpose *event, gpointer user_data)
{
- g_return_val_if_fail(IS_METADATA_WIDGET(user_data), FALSE);
- MetadataWidget* widget = METADATA_WIDGET(user_data);
- MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(widget);
+ g_return_val_if_fail(IS_METADATA_WIDGET(user_data), FALSE);
+ MetadataWidget* widget = METADATA_WIDGET(user_data);
+ MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(widget);
draw_album_border(metadata, FALSE);
- if(priv->image_path->len > 0){
- if(g_string_equal(priv->image_path, priv->old_image_path) == FALSE ||
+ if(priv->image_path->len > 0){
+ if(g_string_equal(priv->image_path, priv->old_image_path) == FALSE ||
priv->theme_change_occured == TRUE){
priv->theme_change_occured = FALSE;
- GdkPixbuf* pixbuf;
- pixbuf = gdk_pixbuf_new_from_file(priv->image_path->str, NULL);
- //g_debug("metadata_load_new_image -> pixbuf from %s",
- // priv->image_path->str);
- if(GDK_IS_PIXBUF(pixbuf) == FALSE){
- //g_debug("problem loading the downloaded image just use the placeholder instead");
- draw_album_art_placeholder(metadata);
- return TRUE;
- }
- pixbuf = gdk_pixbuf_scale_simple(pixbuf,60, 60, GDK_INTERP_BILINEAR);
- gtk_image_set_from_pixbuf(GTK_IMAGE(priv->album_art), pixbuf);
- g_string_erase(priv->old_image_path, 0, -1);
- g_string_overwrite(priv->old_image_path, 0, priv->image_path->str);
-
- g_object_unref(pixbuf);
- }
- return FALSE;
- }
- draw_album_art_placeholder(metadata);
- return TRUE;
+ GdkPixbuf* orig_pixbuf;
+ orig_pixbuf = gdk_pixbuf_new_from_file(priv->image_path->str, NULL);
+ //g_debug("metadata_load_new_image -> pixbuf from %s",
+ // priv->image_path->str);
+ if(GDK_IS_PIXBUF(orig_pixbuf) == FALSE){
+ //g_debug("problem loading the downloaded image just use the placeholder instead");
+ draw_album_art_placeholder(metadata);
+ return TRUE;
+ }
+ GdkPixbuf* pixbuf;
+ pixbuf = gdk_pixbuf_scale_simple(orig_pixbuf,60, 60, GDK_INTERP_BILINEAR);
+ gtk_image_set_from_pixbuf(GTK_IMAGE(priv->album_art), pixbuf);
+ g_string_erase(priv->old_image_path, 0, -1);
+ g_string_overwrite(priv->old_image_path, 0, priv->image_path->str);
+
+ g_object_unref(pixbuf);
+ g_object_unref(orig_pixbuf);
+ }
+ return FALSE;
+ }
+ draw_album_art_placeholder(metadata);
+ return TRUE;
}
static void
draw_album_border(GtkWidget *metadata, gboolean selected)
{
- cairo_t *cr;
- cr = gdk_cairo_create (metadata->window);
+ cairo_t *cr;
+ cr = gdk_cairo_create (metadata->window);
GtkStyle *style;
- style = gtk_widget_get_style (metadata);
+ style = gtk_widget_get_style (metadata);
- GtkAllocation alloc;
- gtk_widget_get_allocation (metadata, &alloc);
+ GtkAllocation alloc;
+ gtk_widget_get_allocation (metadata, &alloc);
gint offset = 1;
alloc.width = alloc.width + (offset * 2);
@@ -236,14 +238,14 @@ draw_album_border(GtkWidget *metadata, gboolean selected)
CairoColorRGB bg_normal, fg_normal;
bg_normal.r = style->bg[0].red/65535.0;
- bg_normal.g = style->bg[0].green/65535.0;
- bg_normal.b = style->bg[0].blue/65535.0;
+ bg_normal.g = style->bg[0].green/65535.0;
+ bg_normal.b = style->bg[0].blue/65535.0;
gint state = selected ? 5 : 0;
- fg_normal.r = style->fg[state].red/65535.0;
- fg_normal.g = style->fg[state].green/65535.0;
- fg_normal.b = style->fg[state].blue/65535.0;
+ fg_normal.r = style->fg[state].red/65535.0;
+ fg_normal.g = style->fg[state].green/65535.0;
+ fg_normal.b = style->fg[state].blue/65535.0;
CairoColorRGB dark_top_color;
CairoColorRGB light_bottom_color;
@@ -259,15 +261,15 @@ draw_album_border(GtkWidget *metadata, gboolean selected)
cairo_set_line_width (cr, 1.0);
- cairo_clip ( cr );
+ cairo_clip ( cr );
cairo_move_to (cr, alloc.x, alloc.y );
- cairo_line_to (cr, alloc.x + alloc.width,
- alloc.y );
+ cairo_line_to (cr, alloc.x + alloc.width,
+ alloc.y );
cairo_line_to ( cr, alloc.x + alloc.width,
- alloc.y + alloc.height );
- cairo_line_to ( cr, alloc.x, alloc.y + alloc.height );
- cairo_line_to ( cr, alloc.x, alloc.y);
+ alloc.y + alloc.height );
+ cairo_line_to ( cr, alloc.x, alloc.y + alloc.height );
+ cairo_line_to ( cr, alloc.x, alloc.y);
cairo_close_path (cr);
cairo_set_source_rgba ( cr,
@@ -278,9 +280,9 @@ draw_album_border(GtkWidget *metadata, gboolean selected)
cairo_fill ( cr );
- cairo_move_to (cr, alloc.x, alloc.y );
- cairo_line_to (cr, alloc.x + alloc.width,
- alloc.y );
+ cairo_move_to (cr, alloc.x, alloc.y );
+ cairo_line_to (cr, alloc.x + alloc.width,
+ alloc.y );
cairo_close_path (cr);
cairo_set_source_rgba ( cr,
@@ -291,11 +293,11 @@ draw_album_border(GtkWidget *metadata, gboolean selected)
cairo_stroke ( cr );
- cairo_move_to ( cr, alloc.x + alloc.width,
- alloc.y + alloc.height );
- cairo_line_to ( cr, alloc.x, alloc.y + alloc.height );
+ cairo_move_to ( cr, alloc.x + alloc.width,
+ alloc.y + alloc.height );
+ cairo_line_to ( cr, alloc.x, alloc.y + alloc.height );
- cairo_close_path (cr);
+ cairo_close_path (cr);
cairo_set_source_rgba ( cr,
light_bottom_color.r,
light_bottom_color.g,
@@ -303,41 +305,41 @@ draw_album_border(GtkWidget *metadata, gboolean selected)
1.0);
cairo_stroke ( cr );
- cairo_destroy (cr);
+ cairo_destroy (cr);
}
static void
draw_album_art_placeholder(GtkWidget *metadata)
-{
- cairo_t *cr;
- cr = gdk_cairo_create (metadata->window);
+{
+ cairo_t *cr;
+ cr = gdk_cairo_create (metadata->window);
GtkStyle *style;
- style = gtk_widget_get_style (metadata);
+ style = gtk_widget_get_style (metadata);
- GtkAllocation alloc;
- gtk_widget_get_allocation (metadata, &alloc);
+ GtkAllocation alloc;
+ gtk_widget_get_allocation (metadata, &alloc);
PangoLayout *layout;
- PangoFontDescription *desc;
- layout = pango_cairo_create_layout(cr);
- PangoContext* pcontext = pango_cairo_create_context(cr);
- pango_cairo_context_set_resolution (pcontext, 96);
-
- GString* string = g_string_new("");
- gssize size = -1;
- gunichar code = g_utf8_get_char_validated("\342\231\253", size);
- g_string_append_unichar (string, code);
-
- pango_layout_set_text(layout, string->str, -1);
- desc = pango_font_description_from_string("Sans Bold 30");
- pango_layout_set_font_description(layout, desc);
- pango_font_description_free(desc);
+ PangoFontDescription *desc;
+ layout = pango_cairo_create_layout(cr);
+ PangoContext* pcontext = pango_cairo_create_context(cr);
+ pango_cairo_context_set_resolution (pcontext, 96);
+
+ GString* string = g_string_new("");
+ gssize size = -1;
+ gunichar code = g_utf8_get_char_validated("\342\231\253", size);
+ g_string_append_unichar (string, code);
+
+ pango_layout_set_text(layout, string->str, -1);
+ desc = pango_font_description_from_string("Sans Bold 30");
+ pango_layout_set_font_description(layout, desc);
+ pango_font_description_free(desc);
CairoColorRGB fg_normal, light_bottom_color;
- fg_normal.r = style->fg[0].red/65535.0;
- fg_normal.g = style->fg[0].green/65535.0;
- fg_normal.b = style->fg[0].blue/65535.0;
+ fg_normal.r = style->fg[0].red/65535.0;
+ fg_normal.g = style->fg[0].green/65535.0;
+ fg_normal.b = style->fg[0].blue/65535.0;
_color_shade ( &fg_normal, 0.78, &light_bottom_color );
@@ -348,14 +350,14 @@ draw_album_art_placeholder(GtkWidget *metadata)
light_bottom_color.b,
1.0);
- pango_cairo_update_layout(cr, layout);
- cairo_move_to (cr, alloc.x + alloc.width/6, alloc.y + alloc.height/8);
- pango_cairo_show_layout(cr, layout);
+ pango_cairo_update_layout(cr, layout);
+ cairo_move_to (cr, alloc.x + alloc.width/6, alloc.y + alloc.height/8);
+ pango_cairo_show_layout(cr, layout);
- g_object_unref(layout);
- g_object_unref(pcontext);
- g_string_free (string, TRUE);
- cairo_destroy (cr);
+ g_object_unref(layout);
+ g_object_unref(pcontext);
+ g_string_free (string, TRUE);
+ cairo_destroy (cr);
}
@@ -366,9 +368,9 @@ metadata_widget_selection_received_event_callback ( GtkWidget *widget,
gpointer user_data )
{
- //g_return_val_if_fail(IS_METADATA_WIDGET(user_data), FALSE);
- //MetadataWidget* widget = METADATA_WIDGET(user_data);
- //MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(widget);
+ //g_return_val_if_fail(IS_METADATA_WIDGET(user_data), FALSE);
+ //MetadataWidget* widget = METADATA_WIDGET(user_data);
+ //MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(widget);
g_debug("metadata_widget_selection_request_event_callback");
draw_album_border(widget, TRUE);
}
@@ -378,21 +380,21 @@ static gboolean
metadata_widget_button_press_event (GtkWidget *menuitem,
GdkEventButton *event)
{
- GtkClipboard* board = gtk_clipboard_get (GDK_NONE);
+ GtkClipboard* board = gtk_clipboard_get (GDK_NONE);
- MetadataWidgetPrivate* priv = METADATA_WIDGET_GET_PRIVATE(METADATA_WIDGET(menuitem));
+ MetadataWidgetPrivate* priv = METADATA_WIDGET_GET_PRIVATE(METADATA_WIDGET(menuitem));
- gchar* contents = g_strdup_printf("artist: %s \ntitle: %s \nalbum: %s",
+ gchar* contents = g_strdup_printf("artist: %s \ntitle: %s \nalbum: %s",
dbusmenu_menuitem_property_get(priv->twin_item,
- DBUSMENU_METADATA_MENUITEM_ARTIST),
+ DBUSMENU_METADATA_MENUITEM_ARTIST),
dbusmenu_menuitem_property_get(priv->twin_item,
- DBUSMENU_METADATA_MENUITEM_TITLE),
+ DBUSMENU_METADATA_MENUITEM_TITLE),
dbusmenu_menuitem_property_get(priv->twin_item,
- DBUSMENU_METADATA_MENUITEM_ALBUM));
- gtk_clipboard_set_text (board, contents, -1);
- gtk_clipboard_store (board);
- g_free(contents);
- return FALSE;
+ DBUSMENU_METADATA_MENUITEM_ALBUM));
+ gtk_clipboard_set_text (board, contents, -1);
+ gtk_clipboard_store (board);
+ g_free(contents);
+ return FALSE;
}
// TODO: Manage empty/mangled music details <unknown artist> etc.
@@ -400,65 +402,65 @@ static void
metadata_widget_property_update(DbusmenuMenuitem* item, gchar* property,
GValue* value, gpointer userdata)
{
- g_return_if_fail (IS_METADATA_WIDGET (userdata));
-
- if(g_value_get_int(value) == DBUSMENU_PROPERTY_EMPTY){
- //g_debug("Metadata widget: property update - reset");
- GValue new_value = {0};
- g_value_init(&new_value, G_TYPE_STRING);
- g_value_set_string(&new_value, g_strdup(""));
- value = &new_value;
- }
-
- MetadataWidget* mitem = METADATA_WIDGET(userdata);
- MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(mitem);
-
- if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_ARTIST, property) == 0){
- gtk_label_set_text(GTK_LABEL(priv->artist_label), g_value_get_string(value));
- metadata_widget_style_labels(mitem, GTK_LABEL(priv->artist_label));
- }
- else if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_TITLE, property) == 0){
- gtk_label_set_text(GTK_LABEL(priv->piece_label), g_value_get_string(value));
- metadata_widget_style_labels(mitem, GTK_LABEL(priv->piece_label));
- }
- else if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_ALBUM, property) == 0){
- gtk_label_set_text(GTK_LABEL(priv->container_label), g_value_get_string(value));
- metadata_widget_style_labels(mitem, GTK_LABEL(priv->container_label));
- }
- else if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_ARTURL, property) == 0){
- g_string_erase(priv->image_path, 0, -1);
- g_string_overwrite(priv->image_path, 0, g_value_get_string (value));
- // if its a remote image queue a redraw incase the download took too long
- if (g_str_has_prefix(g_value_get_string (value), g_get_user_cache_dir())){
- //g_debug("the image update is a download so redraw");
- gtk_widget_queue_draw(GTK_WIDGET(mitem));
- }
- }
+ g_return_if_fail (IS_METADATA_WIDGET (userdata));
+
+ if(g_value_get_int(value) == DBUSMENU_PROPERTY_EMPTY){
+ //g_debug("Metadata widget: property update - reset");
+ GValue new_value = {0};
+ g_value_init(&new_value, G_TYPE_STRING);
+ g_value_set_string(&new_value, g_strdup(""));
+ value = &new_value;
+ }
+
+ MetadataWidget* mitem = METADATA_WIDGET(userdata);
+ MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(mitem);
+
+ if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_ARTIST, property) == 0){
+ gtk_label_set_text(GTK_LABEL(priv->artist_label), g_value_get_string(value));
+ metadata_widget_style_labels(mitem, GTK_LABEL(priv->artist_label));
+ }
+ else if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_TITLE, property) == 0){
+ gtk_label_set_text(GTK_LABEL(priv->piece_label), g_value_get_string(value));
+ metadata_widget_style_labels(mitem, GTK_LABEL(priv->piece_label));
+ }
+ else if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_ALBUM, property) == 0){
+ gtk_label_set_text(GTK_LABEL(priv->container_label), g_value_get_string(value));
+ metadata_widget_style_labels(mitem, GTK_LABEL(priv->container_label));
+ }
+ else if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_ARTURL, property) == 0){
+ g_string_erase(priv->image_path, 0, -1);
+ g_string_overwrite(priv->image_path, 0, g_value_get_string (value));
+ // if its a remote image queue a redraw incase the download took too long
+ if (g_str_has_prefix(g_value_get_string (value), g_get_user_cache_dir())){
+ //g_debug("the image update is a download so redraw");
+ gtk_widget_queue_draw(GTK_WIDGET(mitem));
+ }
+ }
}
static void
metadata_widget_style_labels(MetadataWidget* self, GtkLabel* label)
{
- char* markup;
- markup = g_markup_printf_escaped ("<span size=\"smaller\">%s</span>",
- gtk_label_get_text(GTK_LABEL(label)));
- gtk_label_set_markup (GTK_LABEL (label), markup);
- g_free(markup);
+ char* markup;
+ markup = g_markup_printf_escaped ("<span size=\"smaller\">%s</span>",
+ gtk_label_get_text(GTK_LABEL(label)));
+ gtk_label_set_markup (GTK_LABEL (label), markup);
+ g_free(markup);
}
static void
metadata_widget_set_style(GtkWidget* metadata, GtkStyle* style)
{
- g_return_if_fail(IS_METADATA_WIDGET(metadata));
- MetadataWidget* widg = METADATA_WIDGET(metadata);
- MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(widg);
+ g_return_if_fail(IS_METADATA_WIDGET(metadata));
+ MetadataWidget* widg = METADATA_WIDGET(metadata);
+ MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(widg);
priv->theme_change_occured = TRUE;
- gtk_widget_queue_draw(GTK_WIDGET(metadata));
+ gtk_widget_queue_draw(GTK_WIDGET(metadata));
}
static void
metadata_widget_set_twin_item(MetadataWidget* self,
- DbusmenuMenuitem* twin_item)
+ DbusmenuMenuitem* twin_item)
{
MetadataWidgetPrivate* priv = METADATA_WIDGET_GET_PRIVATE(self);
priv->twin_item = twin_item;
@@ -467,27 +469,27 @@ metadata_widget_set_twin_item(MetadataWidget* self,
gtk_label_set_text( GTK_LABEL(priv->container_label),
dbusmenu_menuitem_property_get( priv->twin_item,
DBUSMENU_METADATA_MENUITEM_ALBUM));
- metadata_widget_style_labels( self, GTK_LABEL(priv->container_label));
+ metadata_widget_style_labels( self, GTK_LABEL(priv->container_label));
gtk_label_set_text( GTK_LABEL(priv->piece_label),
dbusmenu_menuitem_property_get( priv->twin_item,
DBUSMENU_METADATA_MENUITEM_TITLE));
- metadata_widget_style_labels( self, GTK_LABEL(priv->piece_label));
+ metadata_widget_style_labels( self, GTK_LABEL(priv->piece_label));
gtk_label_set_text( GTK_LABEL(priv->artist_label),
dbusmenu_menuitem_property_get( priv->twin_item,
DBUSMENU_METADATA_MENUITEM_ARTIST));
- metadata_widget_style_labels( self, GTK_LABEL(priv->artist_label));
+ metadata_widget_style_labels( self, GTK_LABEL(priv->artist_label));
g_string_erase(priv->image_path, 0, -1);
- g_string_overwrite( priv->image_path,
+ g_string_overwrite( priv->image_path,
0,
dbusmenu_menuitem_property_get( priv->twin_item,
DBUSMENU_METADATA_MENUITEM_ARTURL ));
- // if its a remote image queue a redraw incase the download took too long
- if (g_str_has_prefix (dbusmenu_menuitem_property_get (priv->twin_item, DBUSMENU_METADATA_MENUITEM_ARTURL ),
+ // if its a remote image queue a redraw incase the download took too long
+ if (g_str_has_prefix (dbusmenu_menuitem_property_get (priv->twin_item, DBUSMENU_METADATA_MENUITEM_ARTURL ),
g_get_user_cache_dir())){
- gtk_widget_queue_draw(GTK_WIDGET(self));
+ gtk_widget_queue_draw(GTK_WIDGET(self));
}
}
@@ -499,7 +501,7 @@ GtkWidget*
metadata_widget_new(DbusmenuMenuitem *item)
{
- GtkWidget* widget = g_object_new(METADATA_WIDGET_TYPE, NULL);
+ GtkWidget* widget = g_object_new(METADATA_WIDGET_TYPE, NULL);
metadata_widget_set_twin_item ( METADATA_WIDGET(widget),
item );
return widget;
diff --git a/src/metadata-widget.h b/src/metadata-widget.h
index 814d5e8..6021af5 100644
--- a/src/metadata-widget.h
+++ b/src/metadata-widget.h
@@ -35,11 +35,11 @@ typedef struct _MetadataWidget MetadataWidget;
typedef struct _MetadataWidgetClass MetadataWidgetClass;
struct _MetadataWidgetClass {
- GtkMenuItemClass parent_class;
+ GtkMenuItemClass parent_class;
};
struct _MetadataWidget {
- GtkMenuItem parent;
+ GtkMenuItem parent;
};
GType metadata_widget_get_type (void);
diff --git a/src/mpris2-controller.c b/src/mpris2-controller.c
index c482dd4..edb443a 100644
--- a/src/mpris2-controller.c
+++ b/src/mpris2-controller.c
@@ -22,12 +22,9 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <glib.h>
#include <glib-object.h>
-#include <dbus/dbus-glib-lowlevel.h>
-#include <dbus/dbus-glib.h>
-#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
-#include <dbus/dbus.h>
+#include <gio/gio.h>
#include <gee.h>
#include <libdbusmenu-glib/client.h>
#include <libdbusmenu-glib/menuitem-proxy.h>
@@ -35,34 +32,6 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <libdbusmenu-glib/server.h>
-#define TYPE_MPRIS_ROOT (mpris_root_get_type ())
-#define MPRIS_ROOT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_ROOT, MprisRoot))
-#define IS_MPRIS_ROOT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_ROOT))
-#define MPRIS_ROOT_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_MPRIS_ROOT, MprisRootIface))
-
-typedef struct _MprisRoot MprisRoot;
-typedef struct _MprisRootIface MprisRootIface;
-typedef struct _DBusObjectVTable _DBusObjectVTable;
-#define _g_free0(var) (var = (g_free (var), NULL))
-typedef struct _MprisRootDBusProxy MprisRootDBusProxy;
-typedef DBusGProxyClass MprisRootDBusProxyClass;
-typedef struct _MprisRootDBusProxyQuitData MprisRootDBusProxyQuitData;
-typedef struct _MprisRootDBusProxyRaiseData MprisRootDBusProxyRaiseData;
-
-#define TYPE_MPRIS_PLAYER (mpris_player_get_type ())
-#define MPRIS_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_PLAYER, MprisPlayer))
-#define IS_MPRIS_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_PLAYER))
-#define MPRIS_PLAYER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_MPRIS_PLAYER, MprisPlayerIface))
-
-typedef struct _MprisPlayer MprisPlayer;
-typedef struct _MprisPlayerIface MprisPlayerIface;
-#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
-typedef struct _MprisPlayerDBusProxy MprisPlayerDBusProxy;
-typedef DBusGProxyClass MprisPlayerDBusProxyClass;
-typedef struct _MprisPlayerDBusProxyPlayPauseData MprisPlayerDBusProxyPlayPauseData;
-typedef struct _MprisPlayerDBusProxyNextData MprisPlayerDBusProxyNextData;
-typedef struct _MprisPlayerDBusProxyPreviousData MprisPlayerDBusProxyPreviousData;
-
#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))
@@ -70,8 +39,12 @@ typedef struct _MprisPlayerDBusProxyPreviousData MprisPlayerDBusProxyPreviousDat
typedef struct _FreeDesktopProperties FreeDesktopProperties;
typedef struct _FreeDesktopPropertiesIface FreeDesktopPropertiesIface;
-typedef struct _FreeDesktopPropertiesDBusProxy FreeDesktopPropertiesDBusProxy;
-typedef DBusGProxyClass FreeDesktopPropertiesDBusProxyClass;
+
+#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))
@@ -84,6 +57,26 @@ typedef struct _Mpris2Controller Mpris2Controller;
typedef struct _Mpris2ControllerClass Mpris2ControllerClass;
typedef struct _Mpris2ControllerPrivate Mpris2ControllerPrivate;
+#define TYPE_MPRIS_ROOT (mpris_root_get_type ())
+#define MPRIS_ROOT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_ROOT, MprisRoot))
+#define IS_MPRIS_ROOT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_ROOT))
+#define MPRIS_ROOT_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_MPRIS_ROOT, MprisRootIface))
+
+typedef struct _MprisRoot MprisRoot;
+typedef struct _MprisRootIface MprisRootIface;
+
+#define TYPE_MPRIS_ROOT_PROXY (mpris_root_proxy_get_type ())
+
+#define TYPE_MPRIS_PLAYER (mpris_player_get_type ())
+#define MPRIS_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_PLAYER, MprisPlayer))
+#define IS_MPRIS_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_PLAYER))
+#define MPRIS_PLAYER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_MPRIS_PLAYER, MprisPlayerIface))
+
+typedef struct _MprisPlayer MprisPlayer;
+typedef struct _MprisPlayerIface MprisPlayerIface;
+
+#define TYPE_MPRIS_PLAYER_PROXY (mpris_player_proxy_get_type ())
+
#define TYPE_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))
@@ -119,12 +112,24 @@ typedef struct _PlayerItemClass PlayerItemClass;
typedef struct _TransportMenuitem TransportMenuitem;
typedef struct _TransportMenuitemClass TransportMenuitemClass;
-#define __vala_GValue_free0(var) ((var == NULL) ? NULL : (var = (_vala_GValue_free (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 _dbus_g_connection_unref0(var) ((var == NULL) ? NULL : (var = (dbus_g_connection_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
+struct _FreeDesktopPropertiesIface {
+ GTypeInterface parent_iface;
+};
+
+struct _Mpris2Controller {
+ GObject parent_instance;
+ Mpris2ControllerPrivate * priv;
+};
+
+struct _Mpris2ControllerClass {
+ GObjectClass parent_class;
+};
+
struct _MprisRootIface {
GTypeInterface parent_iface;
void (*Quit) (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
@@ -143,27 +148,6 @@ struct _MprisRootIface {
void (*set_DesktopEntry) (MprisRoot* self, const gchar* value);
};
-struct _DBusObjectVTable {
- void (*register_object) (DBusConnection*, const char*, void*);
-};
-
-struct _MprisRootDBusProxy {
- DBusGProxy parent_instance;
- gboolean disposed;
-};
-
-struct _MprisRootDBusProxyQuitData {
- GAsyncReadyCallback _callback_;
- gpointer _user_data_;
- DBusPendingCall* pending;
-};
-
-struct _MprisRootDBusProxyRaiseData {
- GAsyncReadyCallback _callback_;
- gpointer _user_data_;
- DBusPendingCall* pending;
-};
-
struct _MprisPlayerIface {
GTypeInterface parent_iface;
void (*PlayPause) (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
@@ -180,52 +164,11 @@ struct _MprisPlayerIface {
void (*set_PlaybackStatus) (MprisPlayer* self, const gchar* value);
};
-struct _MprisPlayerDBusProxy {
- DBusGProxy parent_instance;
- gboolean disposed;
-};
-
-struct _MprisPlayerDBusProxyPlayPauseData {
- GAsyncReadyCallback _callback_;
- gpointer _user_data_;
- DBusPendingCall* pending;
-};
-
-struct _MprisPlayerDBusProxyNextData {
- GAsyncReadyCallback _callback_;
- gpointer _user_data_;
- DBusPendingCall* pending;
-};
-
-struct _MprisPlayerDBusProxyPreviousData {
- GAsyncReadyCallback _callback_;
- gpointer _user_data_;
- DBusPendingCall* pending;
-};
-
-struct _FreeDesktopPropertiesIface {
- GTypeInterface parent_iface;
-};
-
-struct _FreeDesktopPropertiesDBusProxy {
- DBusGProxy parent_instance;
- gboolean disposed;
-};
-
-struct _Mpris2Controller {
- GObject parent_instance;
- Mpris2ControllerPrivate * priv;
-};
-
-struct _Mpris2ControllerClass {
- GObjectClass parent_class;
-};
-
struct _Mpris2ControllerPrivate {
MprisRoot* _mpris2_root;
MprisPlayer* _player;
- PlayerController* _owner;
FreeDesktopProperties* _properties_interface;
+ PlayerController* _owner;
};
typedef enum {
@@ -261,156 +204,44 @@ typedef enum {
static gpointer mpris2_controller_parent_class = NULL;
-MprisRoot* mpris_root_dbus_proxy_new (DBusGConnection* connection, const char* name, const char* path);
-GType mpris_root_get_type (void) G_GNUC_CONST;
-void mpris_root_Quit (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
-void mpris_root_Quit_finish (MprisRoot* self, GAsyncResult* _res_, GError** error);
-void mpris_root_Raise (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
-void mpris_root_Raise_finish (MprisRoot* self, GAsyncResult* _res_, GError** error);
-gboolean mpris_root_get_HasTracklist (MprisRoot* self);
-void mpris_root_set_HasTracklist (MprisRoot* self, gboolean value);
-gboolean mpris_root_get_CanQuit (MprisRoot* self);
-void mpris_root_set_CanQuit (MprisRoot* self, gboolean value);
-gboolean mpris_root_get_CanRaise (MprisRoot* self);
-void mpris_root_set_CanRaise (MprisRoot* self, gboolean value);
-gchar* mpris_root_get_Identity (MprisRoot* self);
-void mpris_root_set_Identity (MprisRoot* self, const gchar* value);
-gchar* mpris_root_get_DesktopEntry (MprisRoot* self);
-void mpris_root_set_DesktopEntry (MprisRoot* self, const gchar* value);
-static void _vala_dbus_register_object (DBusConnection* connection, const char* path, void* object);
-static void _vala_dbus_unregister_object (gpointer connection, GObject* object);
-void mpris_root_dbus_register_object (DBusConnection* connection, const char* path, void* object);
-void _mpris_root_dbus_unregister (DBusConnection* connection, void* _user_data_);
-DBusHandlerResult mpris_root_dbus_message (DBusConnection* connection, DBusMessage* message, void* object);
-static DBusHandlerResult _dbus_mpris_root_introspect (MprisRoot* self, DBusConnection* connection, DBusMessage* message);
-static DBusHandlerResult _dbus_mpris_root_property_get (MprisRoot* self, DBusConnection* connection, DBusMessage* message);
-static DBusHandlerResult _dbus_mpris_root_property_set (MprisRoot* self, DBusConnection* connection, DBusMessage* message);
-static DBusHandlerResult _dbus_mpris_root_property_get_all (MprisRoot* self, DBusConnection* connection, DBusMessage* message);
-static DBusHandlerResult _dbus_mpris_root_Quit (MprisRoot* self, DBusConnection* connection, DBusMessage* message);
-static void _dbus_mpris_root_Quit_ready (GObject * source_object, GAsyncResult * _res_, gpointer * _user_data_);
-static DBusHandlerResult _dbus_mpris_root_Raise (MprisRoot* self, DBusConnection* connection, DBusMessage* message);
-static void _dbus_mpris_root_Raise_ready (GObject * source_object, GAsyncResult * _res_, gpointer * _user_data_);
-GType mpris_root_dbus_proxy_get_type (void) G_GNUC_CONST;
-DBusHandlerResult mpris_root_dbus_proxy_filter (DBusConnection* connection, DBusMessage* message, void* user_data);
-enum {
- MPRIS_ROOT_DBUS_PROXY_DUMMY_PROPERTY,
- MPRIS_ROOT_DBUS_PROXY_HAS_TRACKLIST,
- MPRIS_ROOT_DBUS_PROXY_CAN_QUIT,
- MPRIS_ROOT_DBUS_PROXY_CAN_RAISE,
- MPRIS_ROOT_DBUS_PROXY_IDENTITY,
- MPRIS_ROOT_DBUS_PROXY_DESKTOP_ENTRY
-};
-static void mpris_root_dbus_proxy_Quit_async (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
-static void mpris_root_dbus_proxy_Quit_ready (DBusPendingCall* pending, void* user_data);
-static void mpris_root_dbus_proxy_Quit_finish (MprisRoot* self, GAsyncResult* _res_, GError** error);
-static void mpris_root_dbus_proxy_Raise_async (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
-static void mpris_root_dbus_proxy_Raise_ready (DBusPendingCall* pending, void* user_data);
-static void mpris_root_dbus_proxy_Raise_finish (MprisRoot* self, GAsyncResult* _res_, GError** error);
-static gboolean mpris_root_dbus_proxy_get_HasTracklist (MprisRoot* self);
-static void mpris_root_dbus_proxy_set_HasTracklist (MprisRoot* self, gboolean value);
-static gboolean mpris_root_dbus_proxy_get_CanQuit (MprisRoot* self);
-static void mpris_root_dbus_proxy_set_CanQuit (MprisRoot* self, gboolean value);
-static gboolean mpris_root_dbus_proxy_get_CanRaise (MprisRoot* self);
-static void mpris_root_dbus_proxy_set_CanRaise (MprisRoot* self, gboolean value);
-static gchar* mpris_root_dbus_proxy_get_Identity (MprisRoot* self);
-static void mpris_root_dbus_proxy_set_Identity (MprisRoot* self, const gchar* value);
-static gchar* mpris_root_dbus_proxy_get_DesktopEntry (MprisRoot* self);
-static void mpris_root_dbus_proxy_set_DesktopEntry (MprisRoot* self, const gchar* value);
-static void mpris_root_dbus_proxy_mpris_root__interface_init (MprisRootIface* iface);
-static void _vala_mpris_root_dbus_proxy_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
-static void _vala_mpris_root_dbus_proxy_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
-MprisPlayer* mpris_player_dbus_proxy_new (DBusGConnection* connection, const char* name, const char* path);
-GType mpris_player_get_type (void) G_GNUC_CONST;
-void mpris_player_PlayPause (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
-void mpris_player_PlayPause_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
-void mpris_player_Next (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
-void mpris_player_Next_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
-void mpris_player_Previous (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
-void mpris_player_Previous_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
-GHashTable* mpris_player_get_Metadata (MprisPlayer* self);
-void mpris_player_set_Metadata (MprisPlayer* self, GHashTable* value);
-gint32 mpris_player_get_Position (MprisPlayer* self);
-void mpris_player_set_Position (MprisPlayer* self, gint32 value);
-gchar* mpris_player_get_PlaybackStatus (MprisPlayer* self);
-void mpris_player_set_PlaybackStatus (MprisPlayer* self, const gchar* value);
-static void g_cclosure_user_marshal_VOID__INT64 (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data);
-void mpris_player_dbus_register_object (DBusConnection* connection, const char* path, void* object);
-void _mpris_player_dbus_unregister (DBusConnection* connection, void* _user_data_);
-DBusHandlerResult mpris_player_dbus_message (DBusConnection* connection, DBusMessage* message, void* object);
-static DBusHandlerResult _dbus_mpris_player_introspect (MprisPlayer* self, DBusConnection* connection, DBusMessage* message);
-static DBusHandlerResult _dbus_mpris_player_property_get (MprisPlayer* self, DBusConnection* connection, DBusMessage* message);
-static DBusHandlerResult _dbus_mpris_player_property_set (MprisPlayer* self, DBusConnection* connection, DBusMessage* message);
-static DBusHandlerResult _dbus_mpris_player_property_get_all (MprisPlayer* self, DBusConnection* connection, DBusMessage* message);
-static DBusHandlerResult _dbus_mpris_player_PlayPause (MprisPlayer* self, DBusConnection* connection, DBusMessage* message);
-static void _dbus_mpris_player_PlayPause_ready (GObject * source_object, GAsyncResult * _res_, gpointer * _user_data_);
-static DBusHandlerResult _dbus_mpris_player_Next (MprisPlayer* self, DBusConnection* connection, DBusMessage* message);
-static void _dbus_mpris_player_Next_ready (GObject * source_object, GAsyncResult * _res_, gpointer * _user_data_);
-static DBusHandlerResult _dbus_mpris_player_Previous (MprisPlayer* self, DBusConnection* connection, DBusMessage* message);
-static void _dbus_mpris_player_Previous_ready (GObject * source_object, GAsyncResult * _res_, gpointer * _user_data_);
-static void _dbus_mpris_player_seeked (GObject* _sender, gint64 new_position, DBusConnection* _connection);
-GType mpris_player_dbus_proxy_get_type (void) G_GNUC_CONST;
-static void _dbus_handle_mpris_player_seeked (MprisPlayer* self, DBusConnection* connection, DBusMessage* message);
-DBusHandlerResult mpris_player_dbus_proxy_filter (DBusConnection* connection, DBusMessage* message, void* user_data);
-enum {
- MPRIS_PLAYER_DBUS_PROXY_DUMMY_PROPERTY,
- MPRIS_PLAYER_DBUS_PROXY_METADATA,
- MPRIS_PLAYER_DBUS_PROXY_POSITION,
- MPRIS_PLAYER_DBUS_PROXY_PLAYBACK_STATUS
-};
-static void mpris_player_dbus_proxy_PlayPause_async (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
-static void mpris_player_dbus_proxy_PlayPause_ready (DBusPendingCall* pending, void* user_data);
-static void mpris_player_dbus_proxy_PlayPause_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
-static void mpris_player_dbus_proxy_Next_async (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
-static void mpris_player_dbus_proxy_Next_ready (DBusPendingCall* pending, void* user_data);
-static void mpris_player_dbus_proxy_Next_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
-static void mpris_player_dbus_proxy_Previous_async (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
-static void mpris_player_dbus_proxy_Previous_ready (DBusPendingCall* pending, void* user_data);
-static void mpris_player_dbus_proxy_Previous_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
-static GHashTable* mpris_player_dbus_proxy_get_Metadata (MprisPlayer* self);
-static void mpris_player_dbus_proxy_set_Metadata (MprisPlayer* self, GHashTable* value);
-static gint32 mpris_player_dbus_proxy_get_Position (MprisPlayer* self);
-static void mpris_player_dbus_proxy_set_Position (MprisPlayer* self, gint32 value);
-static gchar* mpris_player_dbus_proxy_get_PlaybackStatus (MprisPlayer* self);
-static void mpris_player_dbus_proxy_set_PlaybackStatus (MprisPlayer* self, const gchar* value);
-static void mpris_player_dbus_proxy_mpris_player__interface_init (MprisPlayerIface* iface);
-static void _vala_mpris_player_dbus_proxy_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
-static void _vala_mpris_player_dbus_proxy_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
GType free_desktop_properties_get_type (void) G_GNUC_CONST;
-FreeDesktopProperties* free_desktop_properties_dbus_proxy_new (DBusGConnection* connection, const char* name, const char* path);
+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);
-void free_desktop_properties_dbus_register_object (DBusConnection* connection, const char* path, void* object);
-void _free_desktop_properties_dbus_unregister (DBusConnection* connection, void* _user_data_);
-DBusHandlerResult free_desktop_properties_dbus_message (DBusConnection* connection, DBusMessage* message, void* object);
-static DBusHandlerResult _dbus_free_desktop_properties_introspect (FreeDesktopProperties* self, DBusConnection* connection, DBusMessage* message);
-static DBusHandlerResult _dbus_free_desktop_properties_property_get_all (FreeDesktopProperties* self, DBusConnection* connection, DBusMessage* message);
-static void _dbus_free_desktop_properties_properties_changed (GObject* _sender, const gchar* source, GHashTable* changed_properties, gchar** invalid, int invalid_length1, DBusConnection* _connection);
-GType free_desktop_properties_dbus_proxy_get_type (void) G_GNUC_CONST;
-static void _dbus_handle_free_desktop_properties_properties_changed (FreeDesktopProperties* self, DBusConnection* connection, DBusMessage* message);
-DBusHandlerResult free_desktop_properties_dbus_proxy_filter (DBusConnection* connection, DBusMessage* message, void* user_data);
-enum {
- FREE_DESKTOP_PROPERTIES_DBUS_PROXY_DUMMY_PROPERTY
-};
-static void free_desktop_properties_dbus_proxy_free_desktop_properties__interface_init (FreeDesktopPropertiesIface* iface);
-static void _vala_free_desktop_properties_dbus_proxy_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
-static void _vala_free_desktop_properties_dbus_proxy_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
+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);
+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 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_OWNER,
- MPRIS2_CONTROLLER_PROPERTIES_INTERFACE
+ MPRIS2_CONTROLLER_PROPERTIES_INTERFACE,
+ MPRIS2_CONTROLLER_OWNER
};
-#define MPRIS2_CONTROLLER_root_interface "org.mpris.MediaPlayer2"
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);
PlayerController* mpris2_controller_get_owner (Mpris2Controller* self);
-const gchar* player_controller_get_mpris_name (PlayerController* self);
-static GValue* _g_value_dup (GValue* self);
+const gchar* player_controller_get_dbus_name (PlayerController* self);
+#define MPRIS2_WATCHER_MPRIS_PREFIX "org.mpris.MediaPlayer2."
MprisPlayer* mpris2_controller_get_player (Mpris2Controller* self);
+gchar* mpris_player_get_PlaybackStatus (MprisPlayer* self);
+static gboolean mpris2_controller_ensure_correct_playback_status (Mpris2Controller* self);
+static gboolean _mpris2_controller_ensure_correct_playback_status_gsource_func (gpointer self);
GType transport_menuitem_state_get_type (void) G_GNUC_CONST;
static TransportMenuitemstate mpris2_controller_determine_play_state (Mpris2Controller* self, const gchar* status);
GType player_item_get_type (void) G_GNUC_CONST;
@@ -422,20 +253,31 @@ 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 void _vala_GValue_free (GValue* 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);
+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);
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_);
+void mpris_player_PlayPause_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+void mpris_player_Previous (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+void mpris_player_Previous_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+void mpris_player_Next (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+void mpris_player_Next_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
gboolean mpris2_controller_connected (Mpris2Controller* self);
MprisRoot* mpris2_controller_get_mpris2_root (Mpris2Controller* self);
-gboolean mpris2_controller_was_successfull (Mpris2Controller* self);
void mpris2_controller_expose (Mpris2Controller* self);
+void mpris_root_Raise (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+void mpris_root_Raise_finish (MprisRoot* self, GAsyncResult* _res_, GError** error);
static void mpris2_controller_set_mpris2_root (Mpris2Controller* self, MprisRoot* value);
static void mpris2_controller_set_player (Mpris2Controller* self, MprisPlayer* value);
-static void mpris2_controller_set_owner (Mpris2Controller* self, PlayerController* value);
FreeDesktopProperties* mpris2_controller_get_properties_interface (Mpris2Controller* self);
static void mpris2_controller_set_properties_interface (Mpris2Controller* self, FreeDesktopProperties* value);
+static void mpris2_controller_set_owner (Mpris2Controller* self, PlayerController* value);
static GObject * mpris2_controller_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
static void _mpris2_controller_property_changed_cb_free_desktop_properties_properties_changed (FreeDesktopProperties* _sender, const gchar* source, GHashTable* changed_properties, gchar** invalid, int invalid_length1, gpointer self);
static void mpris2_controller_finalize (GObject* obj);
@@ -444,3553 +286,16 @@ 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 DBusObjectPathVTable _mpris_root_dbus_path_vtable = {_mpris_root_dbus_unregister, mpris_root_dbus_message};
-static const _DBusObjectVTable _mpris_root_dbus_vtable = {mpris_root_dbus_register_object};
-static const DBusObjectPathVTable _mpris_player_dbus_path_vtable = {_mpris_player_dbus_unregister, mpris_player_dbus_message};
-static const _DBusObjectVTable _mpris_player_dbus_vtable = {mpris_player_dbus_register_object};
-static const DBusObjectPathVTable _free_desktop_properties_dbus_path_vtable = {_free_desktop_properties_dbus_unregister, free_desktop_properties_dbus_message};
-static const _DBusObjectVTable _free_desktop_properties_dbus_vtable = {free_desktop_properties_dbus_register_object};
-
-void mpris_root_Quit (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
- MPRIS_ROOT_GET_INTERFACE (self)->Quit (self, _callback_, _user_data_);
-}
-
-
-void mpris_root_Quit_finish (MprisRoot* self, GAsyncResult* _res_, GError** error) {
- MPRIS_ROOT_GET_INTERFACE (self)->Quit_finish (self, _res_, error);
-}
-
-
-void mpris_root_Raise (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
- MPRIS_ROOT_GET_INTERFACE (self)->Raise (self, _callback_, _user_data_);
-}
-
-
-void mpris_root_Raise_finish (MprisRoot* self, GAsyncResult* _res_, GError** error) {
- MPRIS_ROOT_GET_INTERFACE (self)->Raise_finish (self, _res_, error);
-}
-
-
-gboolean mpris_root_get_HasTracklist (MprisRoot* self) {
- return MPRIS_ROOT_GET_INTERFACE (self)->get_HasTracklist (self);
-}
-
-
-void mpris_root_set_HasTracklist (MprisRoot* self, gboolean value) {
- MPRIS_ROOT_GET_INTERFACE (self)->set_HasTracklist (self, value);
-}
-
-
-gboolean mpris_root_get_CanQuit (MprisRoot* self) {
- return MPRIS_ROOT_GET_INTERFACE (self)->get_CanQuit (self);
-}
-
-
-void mpris_root_set_CanQuit (MprisRoot* self, gboolean value) {
- MPRIS_ROOT_GET_INTERFACE (self)->set_CanQuit (self, value);
-}
-
-
-gboolean mpris_root_get_CanRaise (MprisRoot* self) {
- return MPRIS_ROOT_GET_INTERFACE (self)->get_CanRaise (self);
-}
-
-
-void mpris_root_set_CanRaise (MprisRoot* self, gboolean value) {
- MPRIS_ROOT_GET_INTERFACE (self)->set_CanRaise (self, value);
-}
-
-
-gchar* mpris_root_get_Identity (MprisRoot* self) {
- return MPRIS_ROOT_GET_INTERFACE (self)->get_Identity (self);
-}
-
-
-void mpris_root_set_Identity (MprisRoot* self, const gchar* value) {
- MPRIS_ROOT_GET_INTERFACE (self)->set_Identity (self, value);
-}
-
-
-gchar* mpris_root_get_DesktopEntry (MprisRoot* self) {
- return MPRIS_ROOT_GET_INTERFACE (self)->get_DesktopEntry (self);
-}
-
-
-void mpris_root_set_DesktopEntry (MprisRoot* self, const gchar* value) {
- MPRIS_ROOT_GET_INTERFACE (self)->set_DesktopEntry (self, value);
-}
-
-
-static void _vala_dbus_register_object (DBusConnection* connection, const char* path, void* object) {
- const _DBusObjectVTable * vtable;
- vtable = g_type_get_qdata (G_TYPE_FROM_INSTANCE (object), g_quark_from_static_string ("DBusObjectVTable"));
- if (vtable) {
- vtable->register_object (connection, path, object);
- } else {
- g_warning ("Object does not implement any D-Bus interface");
- }
-}
-
-
-static void _vala_dbus_unregister_object (gpointer connection, GObject* object) {
- char* path;
- path = g_object_steal_data ((GObject*) object, "dbus_object_path");
- dbus_connection_unregister_object_path (connection, path);
- g_free (path);
-}
-
-
-void _mpris_root_dbus_unregister (DBusConnection* connection, void* _user_data_) {
-}
-
-
-static DBusHandlerResult _dbus_mpris_root_introspect (MprisRoot* self, DBusConnection* connection, DBusMessage* message) {
- DBusMessage* reply;
- DBusMessageIter iter;
- GString* xml_data;
- char** children;
- int i;
- reply = dbus_message_new_method_return (message);
- dbus_message_iter_init_append (reply, &iter);
- xml_data = g_string_new ("<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\" \"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">\n");
- g_string_append (xml_data, "<node>\n<interface name=\"org.freedesktop.DBus.Introspectable\">\n <method name=\"Introspect\">\n <arg name=\"data\" direction=\"out\" type=\"s\"/>\n </method>\n</interface>\n<interface name=\"org.freedesktop.DBus.Properties\">\n <method name=\"Get\">\n <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n <arg name=\"propname\" direction=\"in\" type=\"s\"/>\n <arg name=\"value\" direction=\"out\" type=\"v\"/>\n </method>\n <method name=\"Set\">\n <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n <arg name=\"propname\" direction=\"in\" type=\"s\"/>\n <arg name=\"value\" direction=\"in\" type=\"v\"/>\n </method>\n <method name=\"GetAll\">\n <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n <arg name=\"props\" direction=\"out\" type=\"a{sv}\"/>\n </method>\n</interface>\n<interface name=\"org.mpris.MediaPlayer2\">\n <method name=\"Quit\">\n </method>\n <method name=\"Raise\">\n </method>\n <property name=\"HasTracklist\" type=\"b\" access=\"readwrite\"/>\n <property name=\"CanQuit\" type=\"b\" access=\"readwrite\"/>\n <property name=\"CanRaise\" type=\"b\" access=\"readwrite\"/>\n <property name=\"Identity\" type=\"s\" access=\"readwrite\"/>\n <property name=\"DesktopEntry\" type=\"s\" access=\"readwrite\"/>\n</interface>\n");
- dbus_connection_list_registered (connection, g_object_get_data ((GObject *) self, "dbus_object_path"), &children);
- for (i = 0; children[i]; i++) {
- g_string_append_printf (xml_data, "<node name=\"%s\"/>\n", children[i]);
- }
- dbus_free_string_array (children);
- g_string_append (xml_data, "</node>\n");
- dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &xml_data->str);
- g_string_free (xml_data, TRUE);
- if (reply) {
- dbus_connection_send (connection, reply, NULL);
- dbus_message_unref (reply);
- return DBUS_HANDLER_RESULT_HANDLED;
- } else {
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
-}
-
-
-static DBusHandlerResult _dbus_mpris_root_property_get (MprisRoot* self, DBusConnection* connection, DBusMessage* message) {
- DBusMessage* reply;
- DBusMessageIter iter, reply_iter, subiter;
- char* interface_name;
- const char* _tmp0_;
- char* property_name;
- const char* _tmp1_;
- if (strcmp (dbus_message_get_signature (message), "ss")) {
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
- dbus_message_iter_init (message, &iter);
- reply = dbus_message_new_method_return (message);
- dbus_message_iter_init_append (reply, &reply_iter);
- dbus_message_iter_get_basic (&iter, &_tmp0_);
- dbus_message_iter_next (&iter);
- interface_name = g_strdup (_tmp0_);
- dbus_message_iter_get_basic (&iter, &_tmp1_);
- dbus_message_iter_next (&iter);
- property_name = g_strdup (_tmp1_);
- if ((strcmp (interface_name, "org.mpris.MediaPlayer2") == 0) && (strcmp (property_name, "HasTracklist") == 0)) {
- gboolean result;
- dbus_bool_t _tmp2_;
- dbus_message_iter_open_container (&reply_iter, DBUS_TYPE_VARIANT, "b", &subiter);
- result = mpris_root_get_HasTracklist (self);
- _tmp2_ = result;
- dbus_message_iter_append_basic (&subiter, DBUS_TYPE_BOOLEAN, &_tmp2_);
- dbus_message_iter_close_container (&reply_iter, &subiter);
- } else if ((strcmp (interface_name, "org.mpris.MediaPlayer2") == 0) && (strcmp (property_name, "CanQuit") == 0)) {
- gboolean result;
- dbus_bool_t _tmp3_;
- dbus_message_iter_open_container (&reply_iter, DBUS_TYPE_VARIANT, "b", &subiter);
- result = mpris_root_get_CanQuit (self);
- _tmp3_ = result;
- dbus_message_iter_append_basic (&subiter, DBUS_TYPE_BOOLEAN, &_tmp3_);
- dbus_message_iter_close_container (&reply_iter, &subiter);
- } else if ((strcmp (interface_name, "org.mpris.MediaPlayer2") == 0) && (strcmp (property_name, "CanRaise") == 0)) {
- gboolean result;
- dbus_bool_t _tmp4_;
- dbus_message_iter_open_container (&reply_iter, DBUS_TYPE_VARIANT, "b", &subiter);
- result = mpris_root_get_CanRaise (self);
- _tmp4_ = result;
- dbus_message_iter_append_basic (&subiter, DBUS_TYPE_BOOLEAN, &_tmp4_);
- dbus_message_iter_close_container (&reply_iter, &subiter);
- } else if ((strcmp (interface_name, "org.mpris.MediaPlayer2") == 0) && (strcmp (property_name, "Identity") == 0)) {
- gchar* result;
- const char* _tmp5_;
- dbus_message_iter_open_container (&reply_iter, DBUS_TYPE_VARIANT, "s", &subiter);
- result = mpris_root_get_Identity (self);
- _tmp5_ = result;
- dbus_message_iter_append_basic (&subiter, DBUS_TYPE_STRING, &_tmp5_);
- _g_free0 (result);
- dbus_message_iter_close_container (&reply_iter, &subiter);
- } else if ((strcmp (interface_name, "org.mpris.MediaPlayer2") == 0) && (strcmp (property_name, "DesktopEntry") == 0)) {
- gchar* result;
- const char* _tmp6_;
- dbus_message_iter_open_container (&reply_iter, DBUS_TYPE_VARIANT, "s", &subiter);
- result = mpris_root_get_DesktopEntry (self);
- _tmp6_ = result;
- dbus_message_iter_append_basic (&subiter, DBUS_TYPE_STRING, &_tmp6_);
- _g_free0 (result);
- dbus_message_iter_close_container (&reply_iter, &subiter);
- } else {
- dbus_message_unref (reply);
- reply = NULL;
- }
- g_free (interface_name);
- g_free (property_name);
- if (reply) {
- dbus_connection_send (connection, reply, NULL);
- dbus_message_unref (reply);
- return DBUS_HANDLER_RESULT_HANDLED;
- } else {
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
-}
-
-
-static DBusHandlerResult _dbus_mpris_root_property_set (MprisRoot* self, DBusConnection* connection, DBusMessage* message) {
- DBusMessage* reply;
- DBusMessageIter iter, subiter;
- char* interface_name;
- const char* _tmp7_;
- char* property_name;
- const char* _tmp8_;
- if (strcmp (dbus_message_get_signature (message), "ssv")) {
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
- dbus_message_iter_init (message, &iter);
- reply = dbus_message_new_method_return (message);
- dbus_message_iter_get_basic (&iter, &_tmp7_);
- dbus_message_iter_next (&iter);
- interface_name = g_strdup (_tmp7_);
- dbus_message_iter_get_basic (&iter, &_tmp8_);
- dbus_message_iter_next (&iter);
- property_name = g_strdup (_tmp8_);
- dbus_message_iter_recurse (&iter, &subiter);
- if ((strcmp (interface_name, "org.mpris.MediaPlayer2") == 0) && (strcmp (property_name, "HasTracklist") == 0)) {
- gboolean value;
- dbus_bool_t _tmp9_;
- dbus_message_iter_get_basic (&subiter, &_tmp9_);
- dbus_message_iter_next (&subiter);
- value = _tmp9_;
- mpris_root_set_HasTracklist (self, value);
- } else if ((strcmp (interface_name, "org.mpris.MediaPlayer2") == 0) && (strcmp (property_name, "CanQuit") == 0)) {
- gboolean value;
- dbus_bool_t _tmp10_;
- dbus_message_iter_get_basic (&subiter, &_tmp10_);
- dbus_message_iter_next (&subiter);
- value = _tmp10_;
- mpris_root_set_CanQuit (self, value);
- } else if ((strcmp (interface_name, "org.mpris.MediaPlayer2") == 0) && (strcmp (property_name, "CanRaise") == 0)) {
- gboolean value;
- dbus_bool_t _tmp11_;
- dbus_message_iter_get_basic (&subiter, &_tmp11_);
- dbus_message_iter_next (&subiter);
- value = _tmp11_;
- mpris_root_set_CanRaise (self, value);
- } else if ((strcmp (interface_name, "org.mpris.MediaPlayer2") == 0) && (strcmp (property_name, "Identity") == 0)) {
- gchar* value;
- const char* _tmp12_;
- dbus_message_iter_get_basic (&subiter, &_tmp12_);
- dbus_message_iter_next (&subiter);
- value = g_strdup (_tmp12_);
- mpris_root_set_Identity (self, value);
- _g_free0 (value);
- } else if ((strcmp (interface_name, "org.mpris.MediaPlayer2") == 0) && (strcmp (property_name, "DesktopEntry") == 0)) {
- gchar* value;
- const char* _tmp13_;
- dbus_message_iter_get_basic (&subiter, &_tmp13_);
- dbus_message_iter_next (&subiter);
- value = g_strdup (_tmp13_);
- mpris_root_set_DesktopEntry (self, value);
- _g_free0 (value);
- } else {
- dbus_message_unref (reply);
- reply = NULL;
- }
- g_free (interface_name);
- g_free (property_name);
- if (reply) {
- dbus_connection_send (connection, reply, NULL);
- dbus_message_unref (reply);
- return DBUS_HANDLER_RESULT_HANDLED;
- } else {
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
-}
-
-
-static DBusHandlerResult _dbus_mpris_root_property_get_all (MprisRoot* self, DBusConnection* connection, DBusMessage* message) {
- DBusMessage* reply;
- DBusMessageIter iter, reply_iter, subiter, entry_iter, value_iter;
- char* interface_name;
- const char* _tmp14_;
- const char* property_name;
- if (strcmp (dbus_message_get_signature (message), "s")) {
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
- dbus_message_iter_init (message, &iter);
- reply = dbus_message_new_method_return (message);
- dbus_message_iter_init_append (reply, &reply_iter);
- dbus_message_iter_get_basic (&iter, &_tmp14_);
- dbus_message_iter_next (&iter);
- interface_name = g_strdup (_tmp14_);
- if (strcmp (interface_name, "org.mpris.MediaPlayer2") == 0) {
- dbus_message_iter_open_container (&reply_iter, DBUS_TYPE_ARRAY, "{sv}", &subiter);
- {
- gboolean result;
- dbus_bool_t _tmp15_;
- dbus_message_iter_open_container (&subiter, DBUS_TYPE_DICT_ENTRY, NULL, &entry_iter);
- property_name = "HasTracklist";
- dbus_message_iter_append_basic (&entry_iter, DBUS_TYPE_STRING, &property_name);
- dbus_message_iter_open_container (&entry_iter, DBUS_TYPE_VARIANT, "b", &value_iter);
- result = mpris_root_get_HasTracklist (self);
- _tmp15_ = result;
- dbus_message_iter_append_basic (&value_iter, DBUS_TYPE_BOOLEAN, &_tmp15_);
- dbus_message_iter_close_container (&entry_iter, &value_iter);
- dbus_message_iter_close_container (&subiter, &entry_iter);
- }
- {
- gboolean result;
- dbus_bool_t _tmp16_;
- dbus_message_iter_open_container (&subiter, DBUS_TYPE_DICT_ENTRY, NULL, &entry_iter);
- property_name = "CanQuit";
- dbus_message_iter_append_basic (&entry_iter, DBUS_TYPE_STRING, &property_name);
- dbus_message_iter_open_container (&entry_iter, DBUS_TYPE_VARIANT, "b", &value_iter);
- result = mpris_root_get_CanQuit (self);
- _tmp16_ = result;
- dbus_message_iter_append_basic (&value_iter, DBUS_TYPE_BOOLEAN, &_tmp16_);
- dbus_message_iter_close_container (&entry_iter, &value_iter);
- dbus_message_iter_close_container (&subiter, &entry_iter);
- }
- {
- gboolean result;
- dbus_bool_t _tmp17_;
- dbus_message_iter_open_container (&subiter, DBUS_TYPE_DICT_ENTRY, NULL, &entry_iter);
- property_name = "CanRaise";
- dbus_message_iter_append_basic (&entry_iter, DBUS_TYPE_STRING, &property_name);
- dbus_message_iter_open_container (&entry_iter, DBUS_TYPE_VARIANT, "b", &value_iter);
- result = mpris_root_get_CanRaise (self);
- _tmp17_ = result;
- dbus_message_iter_append_basic (&value_iter, DBUS_TYPE_BOOLEAN, &_tmp17_);
- dbus_message_iter_close_container (&entry_iter, &value_iter);
- dbus_message_iter_close_container (&subiter, &entry_iter);
- }
- {
- gchar* result;
- const char* _tmp18_;
- dbus_message_iter_open_container (&subiter, DBUS_TYPE_DICT_ENTRY, NULL, &entry_iter);
- property_name = "Identity";
- dbus_message_iter_append_basic (&entry_iter, DBUS_TYPE_STRING, &property_name);
- dbus_message_iter_open_container (&entry_iter, DBUS_TYPE_VARIANT, "s", &value_iter);
- result = mpris_root_get_Identity (self);
- _tmp18_ = result;
- dbus_message_iter_append_basic (&value_iter, DBUS_TYPE_STRING, &_tmp18_);
- _g_free0 (result);
- dbus_message_iter_close_container (&entry_iter, &value_iter);
- dbus_message_iter_close_container (&subiter, &entry_iter);
- }
- {
- gchar* result;
- const char* _tmp19_;
- dbus_message_iter_open_container (&subiter, DBUS_TYPE_DICT_ENTRY, NULL, &entry_iter);
- property_name = "DesktopEntry";
- dbus_message_iter_append_basic (&entry_iter, DBUS_TYPE_STRING, &property_name);
- dbus_message_iter_open_container (&entry_iter, DBUS_TYPE_VARIANT, "s", &value_iter);
- result = mpris_root_get_DesktopEntry (self);
- _tmp19_ = result;
- dbus_message_iter_append_basic (&value_iter, DBUS_TYPE_STRING, &_tmp19_);
- _g_free0 (result);
- dbus_message_iter_close_container (&entry_iter, &value_iter);
- dbus_message_iter_close_container (&subiter, &entry_iter);
- }
- dbus_message_iter_close_container (&reply_iter, &subiter);
- } else {
- dbus_message_unref (reply);
- reply = NULL;
- }
- g_free (interface_name);
- if (reply) {
- dbus_connection_send (connection, reply, NULL);
- dbus_message_unref (reply);
- return DBUS_HANDLER_RESULT_HANDLED;
- } else {
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
-}
-
-
-static DBusHandlerResult _dbus_mpris_root_Quit (MprisRoot* self, DBusConnection* connection, DBusMessage* message) {
- DBusMessageIter iter;
- gpointer * _user_data_;
- if (strcmp (dbus_message_get_signature (message), "")) {
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
- dbus_message_iter_init (message, &iter);
- _user_data_ = g_new0 (gpointer, 2);
- _user_data_[0] = dbus_connection_ref (connection);
- _user_data_[1] = dbus_message_ref (message);
- mpris_root_Quit (self, (GAsyncReadyCallback) _dbus_mpris_root_Quit_ready, _user_data_);
- return DBUS_HANDLER_RESULT_HANDLED;
-}
-
-
-static void _dbus_mpris_root_Quit_ready (GObject * source_object, GAsyncResult * _res_, gpointer * _user_data_) {
- DBusConnection * connection;
- DBusMessage * message;
- DBusMessageIter iter;
- GError* error;
- DBusMessage* reply;
- connection = _user_data_[0];
- message = _user_data_[1];
- error = NULL;
- mpris_root_Quit_finish ((MprisRoot*) source_object, _res_, &error);
- if (error) {
- if (error->domain == DBUS_GERROR) {
- switch (error->code) {
- case DBUS_GERROR_FAILED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Failed", error->message);
- break;
- case DBUS_GERROR_NO_MEMORY:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoMemory", error->message);
- break;
- case DBUS_GERROR_SERVICE_UNKNOWN:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.ServiceUnknown", error->message);
- break;
- case DBUS_GERROR_NAME_HAS_NO_OWNER:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NameHasNoOwner", error->message);
- break;
- case DBUS_GERROR_NO_REPLY:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoReply", error->message);
- break;
- case DBUS_GERROR_IO_ERROR:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.IOError", error->message);
- break;
- case DBUS_GERROR_BAD_ADDRESS:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.BadAddress", error->message);
- break;
- case DBUS_GERROR_NOT_SUPPORTED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NotSupported", error->message);
- break;
- case DBUS_GERROR_LIMITS_EXCEEDED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.LimitsExceeded", error->message);
- break;
- case DBUS_GERROR_ACCESS_DENIED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.AccessDenied", error->message);
- break;
- case DBUS_GERROR_AUTH_FAILED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.AuthFailed", error->message);
- break;
- case DBUS_GERROR_NO_SERVER:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoServer", error->message);
- break;
- case DBUS_GERROR_TIMEOUT:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Timeout", error->message);
- break;
- case DBUS_GERROR_NO_NETWORK:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoNetwork", error->message);
- break;
- case DBUS_GERROR_ADDRESS_IN_USE:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.AddressInUse", error->message);
- break;
- case DBUS_GERROR_DISCONNECTED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Disconnected", error->message);
- break;
- case DBUS_GERROR_INVALID_ARGS:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.InvalidArgs", error->message);
- break;
- case DBUS_GERROR_FILE_NOT_FOUND:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.FileNotFound", error->message);
- break;
- case DBUS_GERROR_FILE_EXISTS:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.FileExists", error->message);
- break;
- case DBUS_GERROR_UNKNOWN_METHOD:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.UnknownMethod", error->message);
- break;
- case DBUS_GERROR_TIMED_OUT:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.TimedOut", error->message);
- break;
- case DBUS_GERROR_MATCH_RULE_NOT_FOUND:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.MatchRuleNotFound", error->message);
- break;
- case DBUS_GERROR_MATCH_RULE_INVALID:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.MatchRuleInvalid", error->message);
- break;
- case DBUS_GERROR_SPAWN_EXEC_FAILED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ExecFailed", error->message);
- break;
- case DBUS_GERROR_SPAWN_FORK_FAILED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ForkFailed", error->message);
- break;
- case DBUS_GERROR_SPAWN_CHILD_EXITED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ChildExited", error->message);
- break;
- case DBUS_GERROR_SPAWN_CHILD_SIGNALED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ChildSignaled", error->message);
- break;
- case DBUS_GERROR_SPAWN_FAILED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.Failed", error->message);
- break;
- case DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.UnixProcessIdUnknown", error->message);
- break;
- case DBUS_GERROR_INVALID_SIGNATURE:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.InvalidSignature", error->message);
- break;
- case DBUS_GERROR_INVALID_FILE_CONTENT:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.InvalidFileContent", error->message);
- break;
- case DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.SELinuxSecurityContextUnknown", error->message);
- break;
- case DBUS_GERROR_REMOTE_EXCEPTION:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.RemoteException", error->message);
- break;
- }
- }
- dbus_connection_send (connection, reply, NULL);
- dbus_message_unref (reply);
- return;
- }
- reply = dbus_message_new_method_return (message);
- dbus_message_iter_init_append (reply, &iter);
- dbus_connection_send (connection, reply, NULL);
- dbus_message_unref (reply);
- dbus_connection_unref (connection);
- dbus_message_unref (message);
- g_free (_user_data_);
-}
-
-
-static DBusHandlerResult _dbus_mpris_root_Raise (MprisRoot* self, DBusConnection* connection, DBusMessage* message) {
- DBusMessageIter iter;
- gpointer * _user_data_;
- if (strcmp (dbus_message_get_signature (message), "")) {
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
- dbus_message_iter_init (message, &iter);
- _user_data_ = g_new0 (gpointer, 2);
- _user_data_[0] = dbus_connection_ref (connection);
- _user_data_[1] = dbus_message_ref (message);
- mpris_root_Raise (self, (GAsyncReadyCallback) _dbus_mpris_root_Raise_ready, _user_data_);
- return DBUS_HANDLER_RESULT_HANDLED;
-}
-
-
-static void _dbus_mpris_root_Raise_ready (GObject * source_object, GAsyncResult * _res_, gpointer * _user_data_) {
- DBusConnection * connection;
- DBusMessage * message;
- DBusMessageIter iter;
- GError* error;
- DBusMessage* reply;
- connection = _user_data_[0];
- message = _user_data_[1];
- error = NULL;
- mpris_root_Raise_finish ((MprisRoot*) source_object, _res_, &error);
- if (error) {
- if (error->domain == DBUS_GERROR) {
- switch (error->code) {
- case DBUS_GERROR_FAILED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Failed", error->message);
- break;
- case DBUS_GERROR_NO_MEMORY:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoMemory", error->message);
- break;
- case DBUS_GERROR_SERVICE_UNKNOWN:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.ServiceUnknown", error->message);
- break;
- case DBUS_GERROR_NAME_HAS_NO_OWNER:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NameHasNoOwner", error->message);
- break;
- case DBUS_GERROR_NO_REPLY:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoReply", error->message);
- break;
- case DBUS_GERROR_IO_ERROR:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.IOError", error->message);
- break;
- case DBUS_GERROR_BAD_ADDRESS:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.BadAddress", error->message);
- break;
- case DBUS_GERROR_NOT_SUPPORTED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NotSupported", error->message);
- break;
- case DBUS_GERROR_LIMITS_EXCEEDED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.LimitsExceeded", error->message);
- break;
- case DBUS_GERROR_ACCESS_DENIED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.AccessDenied", error->message);
- break;
- case DBUS_GERROR_AUTH_FAILED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.AuthFailed", error->message);
- break;
- case DBUS_GERROR_NO_SERVER:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoServer", error->message);
- break;
- case DBUS_GERROR_TIMEOUT:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Timeout", error->message);
- break;
- case DBUS_GERROR_NO_NETWORK:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoNetwork", error->message);
- break;
- case DBUS_GERROR_ADDRESS_IN_USE:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.AddressInUse", error->message);
- break;
- case DBUS_GERROR_DISCONNECTED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Disconnected", error->message);
- break;
- case DBUS_GERROR_INVALID_ARGS:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.InvalidArgs", error->message);
- break;
- case DBUS_GERROR_FILE_NOT_FOUND:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.FileNotFound", error->message);
- break;
- case DBUS_GERROR_FILE_EXISTS:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.FileExists", error->message);
- break;
- case DBUS_GERROR_UNKNOWN_METHOD:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.UnknownMethod", error->message);
- break;
- case DBUS_GERROR_TIMED_OUT:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.TimedOut", error->message);
- break;
- case DBUS_GERROR_MATCH_RULE_NOT_FOUND:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.MatchRuleNotFound", error->message);
- break;
- case DBUS_GERROR_MATCH_RULE_INVALID:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.MatchRuleInvalid", error->message);
- break;
- case DBUS_GERROR_SPAWN_EXEC_FAILED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ExecFailed", error->message);
- break;
- case DBUS_GERROR_SPAWN_FORK_FAILED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ForkFailed", error->message);
- break;
- case DBUS_GERROR_SPAWN_CHILD_EXITED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ChildExited", error->message);
- break;
- case DBUS_GERROR_SPAWN_CHILD_SIGNALED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ChildSignaled", error->message);
- break;
- case DBUS_GERROR_SPAWN_FAILED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.Failed", error->message);
- break;
- case DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.UnixProcessIdUnknown", error->message);
- break;
- case DBUS_GERROR_INVALID_SIGNATURE:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.InvalidSignature", error->message);
- break;
- case DBUS_GERROR_INVALID_FILE_CONTENT:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.InvalidFileContent", error->message);
- break;
- case DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.SELinuxSecurityContextUnknown", error->message);
- break;
- case DBUS_GERROR_REMOTE_EXCEPTION:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.RemoteException", error->message);
- break;
- }
- }
- dbus_connection_send (connection, reply, NULL);
- dbus_message_unref (reply);
- return;
- }
- reply = dbus_message_new_method_return (message);
- dbus_message_iter_init_append (reply, &iter);
- dbus_connection_send (connection, reply, NULL);
- dbus_message_unref (reply);
- dbus_connection_unref (connection);
- dbus_message_unref (message);
- g_free (_user_data_);
-}
-
-
-DBusHandlerResult mpris_root_dbus_message (DBusConnection* connection, DBusMessage* message, void* object) {
- DBusHandlerResult result;
- result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- if (dbus_message_is_method_call (message, "org.freedesktop.DBus.Introspectable", "Introspect")) {
- result = _dbus_mpris_root_introspect (object, connection, message);
- } else if (dbus_message_is_method_call (message, "org.freedesktop.DBus.Properties", "Get")) {
- result = _dbus_mpris_root_property_get (object, connection, message);
- } else if (dbus_message_is_method_call (message, "org.freedesktop.DBus.Properties", "Set")) {
- result = _dbus_mpris_root_property_set (object, connection, message);
- } else if (dbus_message_is_method_call (message, "org.freedesktop.DBus.Properties", "GetAll")) {
- result = _dbus_mpris_root_property_get_all (object, connection, message);
- } else if (dbus_message_is_method_call (message, "org.mpris.MediaPlayer2", "Quit")) {
- result = _dbus_mpris_root_Quit (object, connection, message);
- } else if (dbus_message_is_method_call (message, "org.mpris.MediaPlayer2", "Raise")) {
- result = _dbus_mpris_root_Raise (object, connection, message);
- }
- if (result == DBUS_HANDLER_RESULT_HANDLED) {
- return result;
- } else {
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
-}
-
-
-void mpris_root_dbus_register_object (DBusConnection* connection, const char* path, void* object) {
- if (!g_object_get_data (object, "dbus_object_path")) {
- g_object_set_data (object, "dbus_object_path", g_strdup (path));
- dbus_connection_register_object_path (connection, path, &_mpris_root_dbus_path_vtable, object);
- g_object_weak_ref (object, _vala_dbus_unregister_object, connection);
- }
-}
-
-
-static void mpris_root_base_init (MprisRootIface * iface) {
- static gboolean initialized = FALSE;
- if (!initialized) {
- initialized = TRUE;
- g_object_interface_install_property (iface, g_param_spec_boolean ("HasTracklist", "HasTracklist", "HasTracklist", FALSE, 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_boolean ("CanQuit", "CanQuit", "CanQuit", FALSE, 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_boolean ("CanRaise", "CanRaise", "CanRaise", FALSE, 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_string ("Identity", "Identity", "Identity", NULL, 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_string ("DesktopEntry", "DesktopEntry", "DesktopEntry", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
- g_type_set_qdata (TYPE_MPRIS_ROOT, g_quark_from_static_string ("DBusObjectVTable"), (void*) (&_mpris_root_dbus_vtable));
- }
-}
-
-
-GType mpris_root_get_type (void) {
- static volatile gsize mpris_root_type_id__volatile = 0;
- if (g_once_init_enter (&mpris_root_type_id__volatile)) {
- static const GTypeInfo g_define_type_info = { sizeof (MprisRootIface), (GBaseInitFunc) mpris_root_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
- GType mpris_root_type_id;
- mpris_root_type_id = g_type_register_static (G_TYPE_INTERFACE, "MprisRoot", &g_define_type_info, 0);
- g_type_interface_add_prerequisite (mpris_root_type_id, DBUS_TYPE_G_PROXY);
- g_type_set_qdata (mpris_root_type_id, g_quark_from_string ("ValaDBusInterfaceProxyType"), &mpris_root_dbus_proxy_get_type);
- g_once_init_leave (&mpris_root_type_id__volatile, mpris_root_type_id);
- }
- return mpris_root_type_id__volatile;
-}
-
-
-G_DEFINE_TYPE_EXTENDED (MprisRootDBusProxy, mpris_root_dbus_proxy, DBUS_TYPE_G_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_MPRIS_ROOT, mpris_root_dbus_proxy_mpris_root__interface_init) );
-MprisRoot* mpris_root_dbus_proxy_new (DBusGConnection* connection, const char* name, const char* path) {
- MprisRoot* self;
- self = g_object_new (mpris_root_dbus_proxy_get_type (), "connection", connection, "name", name, "path", path, "interface", "org.mpris.MediaPlayer2", NULL);
- return self;
-}
-
-
-static GObject* mpris_root_dbus_proxy_construct (GType gtype, guint n_properties, GObjectConstructParam* properties) {
- GObject* self;
- DBusGConnection *connection;
- char* path;
- char* filter;
- self = G_OBJECT_CLASS (mpris_root_dbus_proxy_parent_class)->constructor (gtype, n_properties, properties);
- g_object_get (self, "connection", &connection, NULL);
- g_object_get (self, "path", &path, NULL);
- dbus_connection_add_filter (dbus_g_connection_get_connection (connection), mpris_root_dbus_proxy_filter, self, NULL);
- filter = g_strdup_printf ("type='signal',path='%s'", path);
- dbus_bus_add_match (dbus_g_connection_get_connection (connection), filter, NULL);
- dbus_g_connection_unref (connection);
- g_free (path);
- g_free (filter);
- return self;
-}
-
-
-DBusHandlerResult mpris_root_dbus_proxy_filter (DBusConnection* connection, DBusMessage* message, void* user_data) {
- if (dbus_message_has_path (message, dbus_g_proxy_get_path (user_data))) {
- }
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-
-static void mpris_root_dbus_proxy_dispose (GObject* self) {
- DBusGConnection *connection;
- if (((MprisRootDBusProxy*) self)->disposed) {
- return;
- }
- ((MprisRootDBusProxy*) self)->disposed = TRUE;
- g_object_get (self, "connection", &connection, NULL);
- dbus_connection_remove_filter (dbus_g_connection_get_connection (connection), mpris_root_dbus_proxy_filter, self);
- G_OBJECT_CLASS (mpris_root_dbus_proxy_parent_class)->dispose (self);
-}
-
-
-static void mpris_root_dbus_proxy_class_init (MprisRootDBusProxyClass* klass) {
- G_OBJECT_CLASS (klass)->constructor = mpris_root_dbus_proxy_construct;
- G_OBJECT_CLASS (klass)->dispose = mpris_root_dbus_proxy_dispose;
- G_OBJECT_CLASS (klass)->get_property = _vala_mpris_root_dbus_proxy_get_property;
- G_OBJECT_CLASS (klass)->set_property = _vala_mpris_root_dbus_proxy_set_property;
- g_object_class_override_property (G_OBJECT_CLASS (klass), MPRIS_ROOT_DBUS_PROXY_HAS_TRACKLIST, "HasTracklist");
- g_object_class_override_property (G_OBJECT_CLASS (klass), MPRIS_ROOT_DBUS_PROXY_CAN_QUIT, "CanQuit");
- g_object_class_override_property (G_OBJECT_CLASS (klass), MPRIS_ROOT_DBUS_PROXY_CAN_RAISE, "CanRaise");
- g_object_class_override_property (G_OBJECT_CLASS (klass), MPRIS_ROOT_DBUS_PROXY_IDENTITY, "Identity");
- g_object_class_override_property (G_OBJECT_CLASS (klass), MPRIS_ROOT_DBUS_PROXY_DESKTOP_ENTRY, "DesktopEntry");
-}
-
-
-static void mpris_root_dbus_proxy_init (MprisRootDBusProxy* self) {
-}
-
-
-static void mpris_root_dbus_proxy_Quit_async (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
- DBusGConnection *_connection;
- DBusMessage *_message;
- DBusPendingCall *_pending;
- DBusMessageIter _iter;
- MprisRootDBusProxyQuitData* _data_;
- _message = dbus_message_new_method_call (dbus_g_proxy_get_bus_name ((DBusGProxy*) self), dbus_g_proxy_get_path ((DBusGProxy*) self), "org.mpris.MediaPlayer2", "Quit");
- dbus_message_iter_init_append (_message, &_iter);
- g_object_get (self, "connection", &_connection, NULL);
- dbus_connection_send_with_reply (dbus_g_connection_get_connection (_connection), _message, &_pending, -1);
- dbus_g_connection_unref (_connection);
- dbus_message_unref (_message);
- _data_ = g_slice_new0 (MprisRootDBusProxyQuitData);
- _data_->_callback_ = _callback_;
- _data_->_user_data_ = _user_data_;
- _data_->pending = _pending;
- dbus_pending_call_set_notify (_pending, mpris_root_dbus_proxy_Quit_ready, _data_, NULL);
-}
-
-
-static void mpris_root_dbus_proxy_Quit_ready (DBusPendingCall* pending, void* user_data) {
- MprisRootDBusProxyQuitData* _data_;
- GObject * _obj_;
- GSimpleAsyncResult * _res_;
- _data_ = user_data;
- _obj_ = g_object_newv (G_TYPE_OBJECT, 0, NULL);
- _res_ = g_simple_async_result_new (_obj_, _data_->_callback_, _data_->_user_data_, _data_);
- g_simple_async_result_complete (_res_);
- g_object_unref (_obj_);
- g_object_unref (_res_);
- g_slice_free (MprisRootDBusProxyQuitData, _data_);
- dbus_pending_call_unref (pending);
-}
-
-
-static void mpris_root_dbus_proxy_Quit_finish (MprisRoot* self, GAsyncResult* _res_, GError** error) {
- MprisRootDBusProxyQuitData* _data_;
- DBusError _dbus_error;
- DBusMessage *_reply;
- DBusMessageIter _iter;
- _data_ = g_simple_async_result_get_source_tag ((GSimpleAsyncResult *) _res_);
- dbus_error_init (&_dbus_error);
- _reply = dbus_pending_call_steal_reply (_data_->pending);
- dbus_set_error_from_message (&_dbus_error, _reply);
- if (dbus_error_is_set (&_dbus_error)) {
- GQuark _edomain = 0;
- gint _ecode = 0;
- if (strstr (_dbus_error.name, "org.freedesktop.DBus.Error") == _dbus_error.name) {
- const char* _tmp0_;
- _edomain = DBUS_GERROR;
- _tmp0_ = _dbus_error.name + 27;
- if (strcmp (_tmp0_, "Failed") == 0) {
- _ecode = DBUS_GERROR_FAILED;
- } else if (strcmp (_tmp0_, "NoMemory") == 0) {
- _ecode = DBUS_GERROR_NO_MEMORY;
- } else if (strcmp (_tmp0_, "ServiceUnknown") == 0) {
- _ecode = DBUS_GERROR_SERVICE_UNKNOWN;
- } else if (strcmp (_tmp0_, "NameHasNoOwner") == 0) {
- _ecode = DBUS_GERROR_NAME_HAS_NO_OWNER;
- } else if (strcmp (_tmp0_, "NoReply") == 0) {
- _ecode = DBUS_GERROR_NO_REPLY;
- } else if (strcmp (_tmp0_, "IOError") == 0) {
- _ecode = DBUS_GERROR_IO_ERROR;
- } else if (strcmp (_tmp0_, "BadAddress") == 0) {
- _ecode = DBUS_GERROR_BAD_ADDRESS;
- } else if (strcmp (_tmp0_, "NotSupported") == 0) {
- _ecode = DBUS_GERROR_NOT_SUPPORTED;
- } else if (strcmp (_tmp0_, "LimitsExceeded") == 0) {
- _ecode = DBUS_GERROR_LIMITS_EXCEEDED;
- } else if (strcmp (_tmp0_, "AccessDenied") == 0) {
- _ecode = DBUS_GERROR_ACCESS_DENIED;
- } else if (strcmp (_tmp0_, "AuthFailed") == 0) {
- _ecode = DBUS_GERROR_AUTH_FAILED;
- } else if (strcmp (_tmp0_, "NoServer") == 0) {
- _ecode = DBUS_GERROR_NO_SERVER;
- } else if (strcmp (_tmp0_, "Timeout") == 0) {
- _ecode = DBUS_GERROR_TIMEOUT;
- } else if (strcmp (_tmp0_, "NoNetwork") == 0) {
- _ecode = DBUS_GERROR_NO_NETWORK;
- } else if (strcmp (_tmp0_, "AddressInUse") == 0) {
- _ecode = DBUS_GERROR_ADDRESS_IN_USE;
- } else if (strcmp (_tmp0_, "Disconnected") == 0) {
- _ecode = DBUS_GERROR_DISCONNECTED;
- } else if (strcmp (_tmp0_, "InvalidArgs") == 0) {
- _ecode = DBUS_GERROR_INVALID_ARGS;
- } else if (strcmp (_tmp0_, "FileNotFound") == 0) {
- _ecode = DBUS_GERROR_FILE_NOT_FOUND;
- } else if (strcmp (_tmp0_, "FileExists") == 0) {
- _ecode = DBUS_GERROR_FILE_EXISTS;
- } else if (strcmp (_tmp0_, "UnknownMethod") == 0) {
- _ecode = DBUS_GERROR_UNKNOWN_METHOD;
- } else if (strcmp (_tmp0_, "TimedOut") == 0) {
- _ecode = DBUS_GERROR_TIMED_OUT;
- } else if (strcmp (_tmp0_, "MatchRuleNotFound") == 0) {
- _ecode = DBUS_GERROR_MATCH_RULE_NOT_FOUND;
- } else if (strcmp (_tmp0_, "MatchRuleInvalid") == 0) {
- _ecode = DBUS_GERROR_MATCH_RULE_INVALID;
- } else if (strcmp (_tmp0_, "Spawn.ExecFailed") == 0) {
- _ecode = DBUS_GERROR_SPAWN_EXEC_FAILED;
- } else if (strcmp (_tmp0_, "Spawn.ForkFailed") == 0) {
- _ecode = DBUS_GERROR_SPAWN_FORK_FAILED;
- } else if (strcmp (_tmp0_, "Spawn.ChildExited") == 0) {
- _ecode = DBUS_GERROR_SPAWN_CHILD_EXITED;
- } else if (strcmp (_tmp0_, "Spawn.ChildSignaled") == 0) {
- _ecode = DBUS_GERROR_SPAWN_CHILD_SIGNALED;
- } else if (strcmp (_tmp0_, "Spawn.Failed") == 0) {
- _ecode = DBUS_GERROR_SPAWN_FAILED;
- } else if (strcmp (_tmp0_, "UnixProcessIdUnknown") == 0) {
- _ecode = DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN;
- } else if (strcmp (_tmp0_, "InvalidSignature") == 0) {
- _ecode = DBUS_GERROR_INVALID_SIGNATURE;
- } else if (strcmp (_tmp0_, "InvalidFileContent") == 0) {
- _ecode = DBUS_GERROR_INVALID_FILE_CONTENT;
- } else if (strcmp (_tmp0_, "SELinuxSecurityContextUnknown") == 0) {
- _ecode = DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN;
- } else if (strcmp (_tmp0_, "RemoteException") == 0) {
- _ecode = DBUS_GERROR_REMOTE_EXCEPTION;
- }
- }
- g_set_error (error, _edomain, _ecode, "%s", _dbus_error.message);
- dbus_error_free (&_dbus_error);
- return;
- }
- if (strcmp (dbus_message_get_signature (_reply), "")) {
- g_set_error (error, DBUS_GERROR, DBUS_GERROR_INVALID_SIGNATURE, "Invalid signature, expected \"%s\", got \"%s\"", "", dbus_message_get_signature (_reply));
- dbus_message_unref (_reply);
- return;
- }
- dbus_message_iter_init (_reply, &_iter);
- dbus_message_unref (_reply);
-}
-
-
-static void mpris_root_dbus_proxy_Raise_async (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
- DBusGConnection *_connection;
- DBusMessage *_message;
- DBusPendingCall *_pending;
- DBusMessageIter _iter;
- MprisRootDBusProxyRaiseData* _data_;
- _message = dbus_message_new_method_call (dbus_g_proxy_get_bus_name ((DBusGProxy*) self), dbus_g_proxy_get_path ((DBusGProxy*) self), "org.mpris.MediaPlayer2", "Raise");
- dbus_message_iter_init_append (_message, &_iter);
- g_object_get (self, "connection", &_connection, NULL);
- dbus_connection_send_with_reply (dbus_g_connection_get_connection (_connection), _message, &_pending, -1);
- dbus_g_connection_unref (_connection);
- dbus_message_unref (_message);
- _data_ = g_slice_new0 (MprisRootDBusProxyRaiseData);
- _data_->_callback_ = _callback_;
- _data_->_user_data_ = _user_data_;
- _data_->pending = _pending;
- dbus_pending_call_set_notify (_pending, mpris_root_dbus_proxy_Raise_ready, _data_, NULL);
-}
-
-
-static void mpris_root_dbus_proxy_Raise_ready (DBusPendingCall* pending, void* user_data) {
- MprisRootDBusProxyRaiseData* _data_;
- GObject * _obj_;
- GSimpleAsyncResult * _res_;
- _data_ = user_data;
- _obj_ = g_object_newv (G_TYPE_OBJECT, 0, NULL);
- _res_ = g_simple_async_result_new (_obj_, _data_->_callback_, _data_->_user_data_, _data_);
- g_simple_async_result_complete (_res_);
- g_object_unref (_obj_);
- g_object_unref (_res_);
- g_slice_free (MprisRootDBusProxyRaiseData, _data_);
- dbus_pending_call_unref (pending);
-}
-
-
-static void mpris_root_dbus_proxy_Raise_finish (MprisRoot* self, GAsyncResult* _res_, GError** error) {
- MprisRootDBusProxyRaiseData* _data_;
- DBusError _dbus_error;
- DBusMessage *_reply;
- DBusMessageIter _iter;
- _data_ = g_simple_async_result_get_source_tag ((GSimpleAsyncResult *) _res_);
- dbus_error_init (&_dbus_error);
- _reply = dbus_pending_call_steal_reply (_data_->pending);
- dbus_set_error_from_message (&_dbus_error, _reply);
- if (dbus_error_is_set (&_dbus_error)) {
- GQuark _edomain = 0;
- gint _ecode = 0;
- if (strstr (_dbus_error.name, "org.freedesktop.DBus.Error") == _dbus_error.name) {
- const char* _tmp1_;
- _edomain = DBUS_GERROR;
- _tmp1_ = _dbus_error.name + 27;
- if (strcmp (_tmp1_, "Failed") == 0) {
- _ecode = DBUS_GERROR_FAILED;
- } else if (strcmp (_tmp1_, "NoMemory") == 0) {
- _ecode = DBUS_GERROR_NO_MEMORY;
- } else if (strcmp (_tmp1_, "ServiceUnknown") == 0) {
- _ecode = DBUS_GERROR_SERVICE_UNKNOWN;
- } else if (strcmp (_tmp1_, "NameHasNoOwner") == 0) {
- _ecode = DBUS_GERROR_NAME_HAS_NO_OWNER;
- } else if (strcmp (_tmp1_, "NoReply") == 0) {
- _ecode = DBUS_GERROR_NO_REPLY;
- } else if (strcmp (_tmp1_, "IOError") == 0) {
- _ecode = DBUS_GERROR_IO_ERROR;
- } else if (strcmp (_tmp1_, "BadAddress") == 0) {
- _ecode = DBUS_GERROR_BAD_ADDRESS;
- } else if (strcmp (_tmp1_, "NotSupported") == 0) {
- _ecode = DBUS_GERROR_NOT_SUPPORTED;
- } else if (strcmp (_tmp1_, "LimitsExceeded") == 0) {
- _ecode = DBUS_GERROR_LIMITS_EXCEEDED;
- } else if (strcmp (_tmp1_, "AccessDenied") == 0) {
- _ecode = DBUS_GERROR_ACCESS_DENIED;
- } else if (strcmp (_tmp1_, "AuthFailed") == 0) {
- _ecode = DBUS_GERROR_AUTH_FAILED;
- } else if (strcmp (_tmp1_, "NoServer") == 0) {
- _ecode = DBUS_GERROR_NO_SERVER;
- } else if (strcmp (_tmp1_, "Timeout") == 0) {
- _ecode = DBUS_GERROR_TIMEOUT;
- } else if (strcmp (_tmp1_, "NoNetwork") == 0) {
- _ecode = DBUS_GERROR_NO_NETWORK;
- } else if (strcmp (_tmp1_, "AddressInUse") == 0) {
- _ecode = DBUS_GERROR_ADDRESS_IN_USE;
- } else if (strcmp (_tmp1_, "Disconnected") == 0) {
- _ecode = DBUS_GERROR_DISCONNECTED;
- } else if (strcmp (_tmp1_, "InvalidArgs") == 0) {
- _ecode = DBUS_GERROR_INVALID_ARGS;
- } else if (strcmp (_tmp1_, "FileNotFound") == 0) {
- _ecode = DBUS_GERROR_FILE_NOT_FOUND;
- } else if (strcmp (_tmp1_, "FileExists") == 0) {
- _ecode = DBUS_GERROR_FILE_EXISTS;
- } else if (strcmp (_tmp1_, "UnknownMethod") == 0) {
- _ecode = DBUS_GERROR_UNKNOWN_METHOD;
- } else if (strcmp (_tmp1_, "TimedOut") == 0) {
- _ecode = DBUS_GERROR_TIMED_OUT;
- } else if (strcmp (_tmp1_, "MatchRuleNotFound") == 0) {
- _ecode = DBUS_GERROR_MATCH_RULE_NOT_FOUND;
- } else if (strcmp (_tmp1_, "MatchRuleInvalid") == 0) {
- _ecode = DBUS_GERROR_MATCH_RULE_INVALID;
- } else if (strcmp (_tmp1_, "Spawn.ExecFailed") == 0) {
- _ecode = DBUS_GERROR_SPAWN_EXEC_FAILED;
- } else if (strcmp (_tmp1_, "Spawn.ForkFailed") == 0) {
- _ecode = DBUS_GERROR_SPAWN_FORK_FAILED;
- } else if (strcmp (_tmp1_, "Spawn.ChildExited") == 0) {
- _ecode = DBUS_GERROR_SPAWN_CHILD_EXITED;
- } else if (strcmp (_tmp1_, "Spawn.ChildSignaled") == 0) {
- _ecode = DBUS_GERROR_SPAWN_CHILD_SIGNALED;
- } else if (strcmp (_tmp1_, "Spawn.Failed") == 0) {
- _ecode = DBUS_GERROR_SPAWN_FAILED;
- } else if (strcmp (_tmp1_, "UnixProcessIdUnknown") == 0) {
- _ecode = DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN;
- } else if (strcmp (_tmp1_, "InvalidSignature") == 0) {
- _ecode = DBUS_GERROR_INVALID_SIGNATURE;
- } else if (strcmp (_tmp1_, "InvalidFileContent") == 0) {
- _ecode = DBUS_GERROR_INVALID_FILE_CONTENT;
- } else if (strcmp (_tmp1_, "SELinuxSecurityContextUnknown") == 0) {
- _ecode = DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN;
- } else if (strcmp (_tmp1_, "RemoteException") == 0) {
- _ecode = DBUS_GERROR_REMOTE_EXCEPTION;
- }
- }
- g_set_error (error, _edomain, _ecode, "%s", _dbus_error.message);
- dbus_error_free (&_dbus_error);
- return;
- }
- if (strcmp (dbus_message_get_signature (_reply), "")) {
- g_set_error (error, DBUS_GERROR, DBUS_GERROR_INVALID_SIGNATURE, "Invalid signature, expected \"%s\", got \"%s\"", "", dbus_message_get_signature (_reply));
- dbus_message_unref (_reply);
- return;
- }
- dbus_message_iter_init (_reply, &_iter);
- dbus_message_unref (_reply);
-}
-
-
-static gboolean mpris_root_dbus_proxy_get_HasTracklist (MprisRoot* self) {
- DBusError _dbus_error;
- DBusGConnection *_connection;
- DBusMessage *_message, *_reply;
- DBusMessageIter _iter, _subiter;
- const char* _tmp2_;
- const char* _tmp3_;
- gboolean _result;
- dbus_bool_t _tmp4_;
- if (((MprisRootDBusProxy*) self)->disposed) {
- return FALSE;
- }
- _message = dbus_message_new_method_call (dbus_g_proxy_get_bus_name ((DBusGProxy*) self), dbus_g_proxy_get_path ((DBusGProxy*) self), "org.freedesktop.DBus.Properties", "Get");
- dbus_message_iter_init_append (_message, &_iter);
- _tmp2_ = "org.mpris.MediaPlayer2";
- dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp2_);
- _tmp3_ = "HasTracklist";
- dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp3_);
- g_object_get (self, "connection", &_connection, NULL);
- dbus_error_init (&_dbus_error);
- _reply = dbus_connection_send_with_reply_and_block (dbus_g_connection_get_connection (_connection), _message, -1, &_dbus_error);
- dbus_g_connection_unref (_connection);
- dbus_message_unref (_message);
- if (dbus_error_is_set (&_dbus_error)) {
- g_critical ("file %s: line %d: uncaught error: %s (%s)", __FILE__, __LINE__, _dbus_error.message, _dbus_error.name);
- dbus_error_free (&_dbus_error);
- return FALSE;
- }
- if (strcmp (dbus_message_get_signature (_reply), "v")) {
- g_critical ("file %s: line %d: Invalid signature, expected \"%s\", got \"%s\"", __FILE__, __LINE__, "v", dbus_message_get_signature (_reply));
- dbus_message_unref (_reply);
- return FALSE;
- }
- dbus_message_iter_init (_reply, &_iter);
- dbus_message_iter_recurse (&_iter, &_subiter);
- if (strcmp (dbus_message_iter_get_signature (&_subiter), "b")) {
- g_critical ("file %s: line %d: Invalid signature, expected \"%s\", got \"%s\"", __FILE__, __LINE__, "b", dbus_message_iter_get_signature (&_subiter));
- dbus_message_unref (_reply);
- return FALSE;
- }
- dbus_message_iter_get_basic (&_subiter, &_tmp4_);
- dbus_message_iter_next (&_subiter);
- _result = _tmp4_;
- dbus_message_unref (_reply);
- return _result;
-}
-
-
-static void mpris_root_dbus_proxy_set_HasTracklist (MprisRoot* self, gboolean value) {
- DBusError _dbus_error;
- DBusGConnection *_connection;
- DBusMessage *_message, *_reply;
- DBusMessageIter _iter, _subiter;
- const char* _tmp5_;
- const char* _tmp6_;
- dbus_bool_t _tmp7_;
- if (((MprisRootDBusProxy*) self)->disposed) {
- return;
- }
- _message = dbus_message_new_method_call (dbus_g_proxy_get_bus_name ((DBusGProxy*) self), dbus_g_proxy_get_path ((DBusGProxy*) self), "org.freedesktop.DBus.Properties", "Set");
- dbus_message_iter_init_append (_message, &_iter);
- _tmp5_ = "org.mpris.MediaPlayer2";
- dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp5_);
- _tmp6_ = "HasTracklist";
- dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp6_);
- dbus_message_iter_open_container (&_iter, DBUS_TYPE_VARIANT, "b", &_subiter);
- _tmp7_ = value;
- dbus_message_iter_append_basic (&_subiter, DBUS_TYPE_BOOLEAN, &_tmp7_);
- dbus_message_iter_close_container (&_iter, &_subiter);
- g_object_get (self, "connection", &_connection, NULL);
- dbus_error_init (&_dbus_error);
- _reply = dbus_connection_send_with_reply_and_block (dbus_g_connection_get_connection (_connection), _message, -1, &_dbus_error);
- dbus_g_connection_unref (_connection);
- dbus_message_unref (_message);
- if (dbus_error_is_set (&_dbus_error)) {
- g_critical ("file %s: line %d: uncaught error: %s (%s)", __FILE__, __LINE__, _dbus_error.message, _dbus_error.name);
- dbus_error_free (&_dbus_error);
- return;
- }
- if (strcmp (dbus_message_get_signature (_reply), "")) {
- g_critical ("file %s: line %d: Invalid signature, expected \"%s\", got \"%s\"", __FILE__, __LINE__, "", dbus_message_get_signature (_reply));
- dbus_message_unref (_reply);
- return;
- }
- dbus_message_iter_init (_reply, &_iter);
- dbus_message_unref (_reply);
-}
-
-
-static gboolean mpris_root_dbus_proxy_get_CanQuit (MprisRoot* self) {
- DBusError _dbus_error;
- DBusGConnection *_connection;
- DBusMessage *_message, *_reply;
- DBusMessageIter _iter, _subiter;
- const char* _tmp8_;
- const char* _tmp9_;
- gboolean _result;
- dbus_bool_t _tmp10_;
- if (((MprisRootDBusProxy*) self)->disposed) {
- return FALSE;
- }
- _message = dbus_message_new_method_call (dbus_g_proxy_get_bus_name ((DBusGProxy*) self), dbus_g_proxy_get_path ((DBusGProxy*) self), "org.freedesktop.DBus.Properties", "Get");
- dbus_message_iter_init_append (_message, &_iter);
- _tmp8_ = "org.mpris.MediaPlayer2";
- dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp8_);
- _tmp9_ = "CanQuit";
- dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp9_);
- g_object_get (self, "connection", &_connection, NULL);
- dbus_error_init (&_dbus_error);
- _reply = dbus_connection_send_with_reply_and_block (dbus_g_connection_get_connection (_connection), _message, -1, &_dbus_error);
- dbus_g_connection_unref (_connection);
- dbus_message_unref (_message);
- if (dbus_error_is_set (&_dbus_error)) {
- g_critical ("file %s: line %d: uncaught error: %s (%s)", __FILE__, __LINE__, _dbus_error.message, _dbus_error.name);
- dbus_error_free (&_dbus_error);
- return FALSE;
- }
- if (strcmp (dbus_message_get_signature (_reply), "v")) {
- g_critical ("file %s: line %d: Invalid signature, expected \"%s\", got \"%s\"", __FILE__, __LINE__, "v", dbus_message_get_signature (_reply));
- dbus_message_unref (_reply);
- return FALSE;
- }
- dbus_message_iter_init (_reply, &_iter);
- dbus_message_iter_recurse (&_iter, &_subiter);
- if (strcmp (dbus_message_iter_get_signature (&_subiter), "b")) {
- g_critical ("file %s: line %d: Invalid signature, expected \"%s\", got \"%s\"", __FILE__, __LINE__, "b", dbus_message_iter_get_signature (&_subiter));
- dbus_message_unref (_reply);
- return FALSE;
- }
- dbus_message_iter_get_basic (&_subiter, &_tmp10_);
- dbus_message_iter_next (&_subiter);
- _result = _tmp10_;
- dbus_message_unref (_reply);
- return _result;
-}
-
-
-static void mpris_root_dbus_proxy_set_CanQuit (MprisRoot* self, gboolean value) {
- DBusError _dbus_error;
- DBusGConnection *_connection;
- DBusMessage *_message, *_reply;
- DBusMessageIter _iter, _subiter;
- const char* _tmp11_;
- const char* _tmp12_;
- dbus_bool_t _tmp13_;
- if (((MprisRootDBusProxy*) self)->disposed) {
- return;
- }
- _message = dbus_message_new_method_call (dbus_g_proxy_get_bus_name ((DBusGProxy*) self), dbus_g_proxy_get_path ((DBusGProxy*) self), "org.freedesktop.DBus.Properties", "Set");
- dbus_message_iter_init_append (_message, &_iter);
- _tmp11_ = "org.mpris.MediaPlayer2";
- dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp11_);
- _tmp12_ = "CanQuit";
- dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp12_);
- dbus_message_iter_open_container (&_iter, DBUS_TYPE_VARIANT, "b", &_subiter);
- _tmp13_ = value;
- dbus_message_iter_append_basic (&_subiter, DBUS_TYPE_BOOLEAN, &_tmp13_);
- dbus_message_iter_close_container (&_iter, &_subiter);
- g_object_get (self, "connection", &_connection, NULL);
- dbus_error_init (&_dbus_error);
- _reply = dbus_connection_send_with_reply_and_block (dbus_g_connection_get_connection (_connection), _message, -1, &_dbus_error);
- dbus_g_connection_unref (_connection);
- dbus_message_unref (_message);
- if (dbus_error_is_set (&_dbus_error)) {
- g_critical ("file %s: line %d: uncaught error: %s (%s)", __FILE__, __LINE__, _dbus_error.message, _dbus_error.name);
- dbus_error_free (&_dbus_error);
- return;
- }
- if (strcmp (dbus_message_get_signature (_reply), "")) {
- g_critical ("file %s: line %d: Invalid signature, expected \"%s\", got \"%s\"", __FILE__, __LINE__, "", dbus_message_get_signature (_reply));
- dbus_message_unref (_reply);
- return;
- }
- dbus_message_iter_init (_reply, &_iter);
- dbus_message_unref (_reply);
-}
-
-
-static gboolean mpris_root_dbus_proxy_get_CanRaise (MprisRoot* self) {
- DBusError _dbus_error;
- DBusGConnection *_connection;
- DBusMessage *_message, *_reply;
- DBusMessageIter _iter, _subiter;
- const char* _tmp14_;
- const char* _tmp15_;
- gboolean _result;
- dbus_bool_t _tmp16_;
- if (((MprisRootDBusProxy*) self)->disposed) {
- return FALSE;
- }
- _message = dbus_message_new_method_call (dbus_g_proxy_get_bus_name ((DBusGProxy*) self), dbus_g_proxy_get_path ((DBusGProxy*) self), "org.freedesktop.DBus.Properties", "Get");
- dbus_message_iter_init_append (_message, &_iter);
- _tmp14_ = "org.mpris.MediaPlayer2";
- dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp14_);
- _tmp15_ = "CanRaise";
- dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp15_);
- g_object_get (self, "connection", &_connection, NULL);
- dbus_error_init (&_dbus_error);
- _reply = dbus_connection_send_with_reply_and_block (dbus_g_connection_get_connection (_connection), _message, -1, &_dbus_error);
- dbus_g_connection_unref (_connection);
- dbus_message_unref (_message);
- if (dbus_error_is_set (&_dbus_error)) {
- g_critical ("file %s: line %d: uncaught error: %s (%s)", __FILE__, __LINE__, _dbus_error.message, _dbus_error.name);
- dbus_error_free (&_dbus_error);
- return FALSE;
- }
- if (strcmp (dbus_message_get_signature (_reply), "v")) {
- g_critical ("file %s: line %d: Invalid signature, expected \"%s\", got \"%s\"", __FILE__, __LINE__, "v", dbus_message_get_signature (_reply));
- dbus_message_unref (_reply);
- return FALSE;
- }
- dbus_message_iter_init (_reply, &_iter);
- dbus_message_iter_recurse (&_iter, &_subiter);
- if (strcmp (dbus_message_iter_get_signature (&_subiter), "b")) {
- g_critical ("file %s: line %d: Invalid signature, expected \"%s\", got \"%s\"", __FILE__, __LINE__, "b", dbus_message_iter_get_signature (&_subiter));
- dbus_message_unref (_reply);
- return FALSE;
- }
- dbus_message_iter_get_basic (&_subiter, &_tmp16_);
- dbus_message_iter_next (&_subiter);
- _result = _tmp16_;
- dbus_message_unref (_reply);
- return _result;
-}
-
-
-static void mpris_root_dbus_proxy_set_CanRaise (MprisRoot* self, gboolean value) {
- DBusError _dbus_error;
- DBusGConnection *_connection;
- DBusMessage *_message, *_reply;
- DBusMessageIter _iter, _subiter;
- const char* _tmp17_;
- const char* _tmp18_;
- dbus_bool_t _tmp19_;
- if (((MprisRootDBusProxy*) self)->disposed) {
- return;
- }
- _message = dbus_message_new_method_call (dbus_g_proxy_get_bus_name ((DBusGProxy*) self), dbus_g_proxy_get_path ((DBusGProxy*) self), "org.freedesktop.DBus.Properties", "Set");
- dbus_message_iter_init_append (_message, &_iter);
- _tmp17_ = "org.mpris.MediaPlayer2";
- dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp17_);
- _tmp18_ = "CanRaise";
- dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp18_);
- dbus_message_iter_open_container (&_iter, DBUS_TYPE_VARIANT, "b", &_subiter);
- _tmp19_ = value;
- dbus_message_iter_append_basic (&_subiter, DBUS_TYPE_BOOLEAN, &_tmp19_);
- dbus_message_iter_close_container (&_iter, &_subiter);
- g_object_get (self, "connection", &_connection, NULL);
- dbus_error_init (&_dbus_error);
- _reply = dbus_connection_send_with_reply_and_block (dbus_g_connection_get_connection (_connection), _message, -1, &_dbus_error);
- dbus_g_connection_unref (_connection);
- dbus_message_unref (_message);
- if (dbus_error_is_set (&_dbus_error)) {
- g_critical ("file %s: line %d: uncaught error: %s (%s)", __FILE__, __LINE__, _dbus_error.message, _dbus_error.name);
- dbus_error_free (&_dbus_error);
- return;
- }
- if (strcmp (dbus_message_get_signature (_reply), "")) {
- g_critical ("file %s: line %d: Invalid signature, expected \"%s\", got \"%s\"", __FILE__, __LINE__, "", dbus_message_get_signature (_reply));
- dbus_message_unref (_reply);
- return;
- }
- dbus_message_iter_init (_reply, &_iter);
- dbus_message_unref (_reply);
-}
-
-
-static gchar* mpris_root_dbus_proxy_get_Identity (MprisRoot* self) {
- DBusError _dbus_error;
- DBusGConnection *_connection;
- DBusMessage *_message, *_reply;
- DBusMessageIter _iter, _subiter;
- const char* _tmp20_;
- const char* _tmp21_;
- gchar* _result;
- const char* _tmp22_;
- if (((MprisRootDBusProxy*) self)->disposed) {
- return NULL;
- }
- _message = dbus_message_new_method_call (dbus_g_proxy_get_bus_name ((DBusGProxy*) self), dbus_g_proxy_get_path ((DBusGProxy*) self), "org.freedesktop.DBus.Properties", "Get");
- dbus_message_iter_init_append (_message, &_iter);
- _tmp20_ = "org.mpris.MediaPlayer2";
- dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp20_);
- _tmp21_ = "Identity";
- dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp21_);
- g_object_get (self, "connection", &_connection, NULL);
- dbus_error_init (&_dbus_error);
- _reply = dbus_connection_send_with_reply_and_block (dbus_g_connection_get_connection (_connection), _message, -1, &_dbus_error);
- dbus_g_connection_unref (_connection);
- dbus_message_unref (_message);
- if (dbus_error_is_set (&_dbus_error)) {
- g_critical ("file %s: line %d: uncaught error: %s (%s)", __FILE__, __LINE__, _dbus_error.message, _dbus_error.name);
- dbus_error_free (&_dbus_error);
- return NULL;
- }
- if (strcmp (dbus_message_get_signature (_reply), "v")) {
- g_critical ("file %s: line %d: Invalid signature, expected \"%s\", got \"%s\"", __FILE__, __LINE__, "v", dbus_message_get_signature (_reply));
- dbus_message_unref (_reply);
- return NULL;
- }
- dbus_message_iter_init (_reply, &_iter);
- dbus_message_iter_recurse (&_iter, &_subiter);
- if (strcmp (dbus_message_iter_get_signature (&_subiter), "s")) {
- g_critical ("file %s: line %d: Invalid signature, expected \"%s\", got \"%s\"", __FILE__, __LINE__, "s", dbus_message_iter_get_signature (&_subiter));
- dbus_message_unref (_reply);
- return NULL;
- }
- dbus_message_iter_get_basic (&_subiter, &_tmp22_);
- dbus_message_iter_next (&_subiter);
- _result = g_strdup (_tmp22_);
- dbus_message_unref (_reply);
- return _result;
-}
-
-
-static void mpris_root_dbus_proxy_set_Identity (MprisRoot* self, const gchar* value) {
- DBusError _dbus_error;
- DBusGConnection *_connection;
- DBusMessage *_message, *_reply;
- DBusMessageIter _iter, _subiter;
- const char* _tmp23_;
- const char* _tmp24_;
- const char* _tmp25_;
- if (((MprisRootDBusProxy*) self)->disposed) {
- return;
- }
- _message = dbus_message_new_method_call (dbus_g_proxy_get_bus_name ((DBusGProxy*) self), dbus_g_proxy_get_path ((DBusGProxy*) self), "org.freedesktop.DBus.Properties", "Set");
- dbus_message_iter_init_append (_message, &_iter);
- _tmp23_ = "org.mpris.MediaPlayer2";
- dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp23_);
- _tmp24_ = "Identity";
- dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp24_);
- dbus_message_iter_open_container (&_iter, DBUS_TYPE_VARIANT, "s", &_subiter);
- _tmp25_ = value;
- dbus_message_iter_append_basic (&_subiter, DBUS_TYPE_STRING, &_tmp25_);
- dbus_message_iter_close_container (&_iter, &_subiter);
- g_object_get (self, "connection", &_connection, NULL);
- dbus_error_init (&_dbus_error);
- _reply = dbus_connection_send_with_reply_and_block (dbus_g_connection_get_connection (_connection), _message, -1, &_dbus_error);
- dbus_g_connection_unref (_connection);
- dbus_message_unref (_message);
- if (dbus_error_is_set (&_dbus_error)) {
- g_critical ("file %s: line %d: uncaught error: %s (%s)", __FILE__, __LINE__, _dbus_error.message, _dbus_error.name);
- dbus_error_free (&_dbus_error);
- return;
- }
- if (strcmp (dbus_message_get_signature (_reply), "")) {
- g_critical ("file %s: line %d: Invalid signature, expected \"%s\", got \"%s\"", __FILE__, __LINE__, "", dbus_message_get_signature (_reply));
- dbus_message_unref (_reply);
- return;
- }
- dbus_message_iter_init (_reply, &_iter);
- dbus_message_unref (_reply);
-}
-
-
-static gchar* mpris_root_dbus_proxy_get_DesktopEntry (MprisRoot* self) {
- DBusError _dbus_error;
- DBusGConnection *_connection;
- DBusMessage *_message, *_reply;
- DBusMessageIter _iter, _subiter;
- const char* _tmp26_;
- const char* _tmp27_;
- gchar* _result;
- const char* _tmp28_;
- if (((MprisRootDBusProxy*) self)->disposed) {
- return NULL;
- }
- _message = dbus_message_new_method_call (dbus_g_proxy_get_bus_name ((DBusGProxy*) self), dbus_g_proxy_get_path ((DBusGProxy*) self), "org.freedesktop.DBus.Properties", "Get");
- dbus_message_iter_init_append (_message, &_iter);
- _tmp26_ = "org.mpris.MediaPlayer2";
- dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp26_);
- _tmp27_ = "DesktopEntry";
- dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp27_);
- g_object_get (self, "connection", &_connection, NULL);
- dbus_error_init (&_dbus_error);
- _reply = dbus_connection_send_with_reply_and_block (dbus_g_connection_get_connection (_connection), _message, -1, &_dbus_error);
- dbus_g_connection_unref (_connection);
- dbus_message_unref (_message);
- if (dbus_error_is_set (&_dbus_error)) {
- g_critical ("file %s: line %d: uncaught error: %s (%s)", __FILE__, __LINE__, _dbus_error.message, _dbus_error.name);
- dbus_error_free (&_dbus_error);
- return NULL;
- }
- if (strcmp (dbus_message_get_signature (_reply), "v")) {
- g_critical ("file %s: line %d: Invalid signature, expected \"%s\", got \"%s\"", __FILE__, __LINE__, "v", dbus_message_get_signature (_reply));
- dbus_message_unref (_reply);
- return NULL;
- }
- dbus_message_iter_init (_reply, &_iter);
- dbus_message_iter_recurse (&_iter, &_subiter);
- if (strcmp (dbus_message_iter_get_signature (&_subiter), "s")) {
- g_critical ("file %s: line %d: Invalid signature, expected \"%s\", got \"%s\"", __FILE__, __LINE__, "s", dbus_message_iter_get_signature (&_subiter));
- dbus_message_unref (_reply);
- return NULL;
- }
- dbus_message_iter_get_basic (&_subiter, &_tmp28_);
- dbus_message_iter_next (&_subiter);
- _result = g_strdup (_tmp28_);
- dbus_message_unref (_reply);
- return _result;
-}
-
-
-static void mpris_root_dbus_proxy_set_DesktopEntry (MprisRoot* self, const gchar* value) {
- DBusError _dbus_error;
- DBusGConnection *_connection;
- DBusMessage *_message, *_reply;
- DBusMessageIter _iter, _subiter;
- const char* _tmp29_;
- const char* _tmp30_;
- const char* _tmp31_;
- if (((MprisRootDBusProxy*) self)->disposed) {
- return;
- }
- _message = dbus_message_new_method_call (dbus_g_proxy_get_bus_name ((DBusGProxy*) self), dbus_g_proxy_get_path ((DBusGProxy*) self), "org.freedesktop.DBus.Properties", "Set");
- dbus_message_iter_init_append (_message, &_iter);
- _tmp29_ = "org.mpris.MediaPlayer2";
- dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp29_);
- _tmp30_ = "DesktopEntry";
- dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp30_);
- dbus_message_iter_open_container (&_iter, DBUS_TYPE_VARIANT, "s", &_subiter);
- _tmp31_ = value;
- dbus_message_iter_append_basic (&_subiter, DBUS_TYPE_STRING, &_tmp31_);
- dbus_message_iter_close_container (&_iter, &_subiter);
- g_object_get (self, "connection", &_connection, NULL);
- dbus_error_init (&_dbus_error);
- _reply = dbus_connection_send_with_reply_and_block (dbus_g_connection_get_connection (_connection), _message, -1, &_dbus_error);
- dbus_g_connection_unref (_connection);
- dbus_message_unref (_message);
- if (dbus_error_is_set (&_dbus_error)) {
- g_critical ("file %s: line %d: uncaught error: %s (%s)", __FILE__, __LINE__, _dbus_error.message, _dbus_error.name);
- dbus_error_free (&_dbus_error);
- return;
- }
- if (strcmp (dbus_message_get_signature (_reply), "")) {
- g_critical ("file %s: line %d: Invalid signature, expected \"%s\", got \"%s\"", __FILE__, __LINE__, "", dbus_message_get_signature (_reply));
- dbus_message_unref (_reply);
- return;
- }
- dbus_message_iter_init (_reply, &_iter);
- dbus_message_unref (_reply);
-}
-
-
-static void mpris_root_dbus_proxy_mpris_root__interface_init (MprisRootIface* iface) {
- iface->Quit = mpris_root_dbus_proxy_Quit_async;
- iface->Quit_finish = mpris_root_dbus_proxy_Quit_finish;
- iface->Raise = mpris_root_dbus_proxy_Raise_async;
- iface->Raise_finish = mpris_root_dbus_proxy_Raise_finish;
- iface->get_HasTracklist = mpris_root_dbus_proxy_get_HasTracklist;
- iface->set_HasTracklist = mpris_root_dbus_proxy_set_HasTracklist;
- iface->get_CanQuit = mpris_root_dbus_proxy_get_CanQuit;
- iface->set_CanQuit = mpris_root_dbus_proxy_set_CanQuit;
- iface->get_CanRaise = mpris_root_dbus_proxy_get_CanRaise;
- iface->set_CanRaise = mpris_root_dbus_proxy_set_CanRaise;
- iface->get_Identity = mpris_root_dbus_proxy_get_Identity;
- iface->set_Identity = mpris_root_dbus_proxy_set_Identity;
- iface->get_DesktopEntry = mpris_root_dbus_proxy_get_DesktopEntry;
- iface->set_DesktopEntry = mpris_root_dbus_proxy_set_DesktopEntry;
-}
-
-
-static void _vala_mpris_root_dbus_proxy_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
-}
-
-
-static void _vala_mpris_root_dbus_proxy_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
-}
-
-
-void mpris_player_PlayPause (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
- MPRIS_PLAYER_GET_INTERFACE (self)->PlayPause (self, _callback_, _user_data_);
-}
-
-
-void mpris_player_PlayPause_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error) {
- MPRIS_PLAYER_GET_INTERFACE (self)->PlayPause_finish (self, _res_, error);
-}
-
-
-void mpris_player_Next (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
- MPRIS_PLAYER_GET_INTERFACE (self)->Next (self, _callback_, _user_data_);
-}
-
-
-void mpris_player_Next_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error) {
- MPRIS_PLAYER_GET_INTERFACE (self)->Next_finish (self, _res_, error);
-}
-
-
-void mpris_player_Previous (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
- MPRIS_PLAYER_GET_INTERFACE (self)->Previous (self, _callback_, _user_data_);
-}
-
-
-void mpris_player_Previous_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error) {
- MPRIS_PLAYER_GET_INTERFACE (self)->Previous_finish (self, _res_, error);
-}
-
-
-GHashTable* mpris_player_get_Metadata (MprisPlayer* self) {
- return MPRIS_PLAYER_GET_INTERFACE (self)->get_Metadata (self);
-}
-
-
-void mpris_player_set_Metadata (MprisPlayer* self, GHashTable* value) {
- MPRIS_PLAYER_GET_INTERFACE (self)->set_Metadata (self, value);
-}
-
-
-gint32 mpris_player_get_Position (MprisPlayer* self) {
- return MPRIS_PLAYER_GET_INTERFACE (self)->get_Position (self);
-}
-
-
-void mpris_player_set_Position (MprisPlayer* self, gint32 value) {
- MPRIS_PLAYER_GET_INTERFACE (self)->set_Position (self, value);
-}
-
-
-gchar* mpris_player_get_PlaybackStatus (MprisPlayer* self) {
- return MPRIS_PLAYER_GET_INTERFACE (self)->get_PlaybackStatus (self);
-}
-
-
-void mpris_player_set_PlaybackStatus (MprisPlayer* self, const gchar* value) {
- MPRIS_PLAYER_GET_INTERFACE (self)->set_PlaybackStatus (self, value);
-}
-
-
-static void g_cclosure_user_marshal_VOID__INT64 (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data) {
- typedef void (*GMarshalFunc_VOID__INT64) (gpointer data1, gint64 arg_1, gpointer data2);
- register GMarshalFunc_VOID__INT64 callback;
- register GCClosure * cc;
- register gpointer data1, data2;
- cc = (GCClosure *) closure;
- g_return_if_fail (n_param_values == 2);
- if (G_CCLOSURE_SWAP_DATA (closure)) {
- data1 = closure->data;
- data2 = param_values->data[0].v_pointer;
- } else {
- data1 = param_values->data[0].v_pointer;
- data2 = closure->data;
- }
- callback = (GMarshalFunc_VOID__INT64) (marshal_data ? marshal_data : cc->callback);
- callback (data1, g_value_get_int64 (param_values + 1), data2);
-}
-
-
-void _mpris_player_dbus_unregister (DBusConnection* connection, void* _user_data_) {
-}
-
-
-static DBusHandlerResult _dbus_mpris_player_introspect (MprisPlayer* self, DBusConnection* connection, DBusMessage* message) {
- DBusMessage* reply;
- DBusMessageIter iter;
- GString* xml_data;
- char** children;
- int i;
- reply = dbus_message_new_method_return (message);
- dbus_message_iter_init_append (reply, &iter);
- xml_data = g_string_new ("<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\" \"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">\n");
- g_string_append (xml_data, "<node>\n<interface name=\"org.freedesktop.DBus.Introspectable\">\n <method name=\"Introspect\">\n <arg name=\"data\" direction=\"out\" type=\"s\"/>\n </method>\n</interface>\n<interface name=\"org.freedesktop.DBus.Properties\">\n <method name=\"Get\">\n <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n <arg name=\"propname\" direction=\"in\" type=\"s\"/>\n <arg name=\"value\" direction=\"out\" type=\"v\"/>\n </method>\n <method name=\"Set\">\n <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n <arg name=\"propname\" direction=\"in\" type=\"s\"/>\n <arg name=\"value\" direction=\"in\" type=\"v\"/>\n </method>\n <method name=\"GetAll\">\n <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n <arg name=\"props\" direction=\"out\" type=\"a{sv}\"/>\n </method>\n</interface>\n<interface name=\"org.mpris.MediaPlayer2.Player\">\n <method name=\"PlayPause\">\n </method>\n <method name=\"Next\">\n </method>\n <method name=\"Previous\">\n </method>\n <property name=\"Metadata\" type=\"a{sv}\" access=\"readwrite\"/>\n <property name=\"Position\" type=\"i\" access=\"readwrite\"/>\n <property name=\"PlaybackStatus\" type=\"s\" access=\"readwrite\"/>\n <signal name=\"Seeked\">\n <arg name=\"new_position\" type=\"x\"/>\n </signal>\n</interface>\n");
- dbus_connection_list_registered (connection, g_object_get_data ((GObject *) self, "dbus_object_path"), &children);
- for (i = 0; children[i]; i++) {
- g_string_append_printf (xml_data, "<node name=\"%s\"/>\n", children[i]);
- }
- dbus_free_string_array (children);
- g_string_append (xml_data, "</node>\n");
- dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &xml_data->str);
- g_string_free (xml_data, TRUE);
- if (reply) {
- dbus_connection_send (connection, reply, NULL);
- dbus_message_unref (reply);
- return DBUS_HANDLER_RESULT_HANDLED;
- } else {
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
-}
-
-
-static DBusHandlerResult _dbus_mpris_player_property_get (MprisPlayer* self, DBusConnection* connection, DBusMessage* message) {
- DBusMessage* reply;
- DBusMessageIter iter, reply_iter, subiter;
- char* interface_name;
- const char* _tmp0_;
- char* property_name;
- const char* _tmp1_;
- if (strcmp (dbus_message_get_signature (message), "ss")) {
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
- dbus_message_iter_init (message, &iter);
- reply = dbus_message_new_method_return (message);
- dbus_message_iter_init_append (reply, &reply_iter);
- dbus_message_iter_get_basic (&iter, &_tmp0_);
- dbus_message_iter_next (&iter);
- interface_name = g_strdup (_tmp0_);
- dbus_message_iter_get_basic (&iter, &_tmp1_);
- dbus_message_iter_next (&iter);
- property_name = g_strdup (_tmp1_);
- if ((strcmp (interface_name, "org.mpris.MediaPlayer2.Player") == 0) && (strcmp (property_name, "Metadata") == 0)) {
- GHashTable* result;
- DBusMessageIter _tmp2_, _tmp3_;
- GHashTableIter _tmp4_;
- gpointer _tmp5_, _tmp6_;
- dbus_message_iter_open_container (&reply_iter, DBUS_TYPE_VARIANT, "a{sv}", &subiter);
- result = mpris_player_get_Metadata (self);
- dbus_message_iter_open_container (&subiter, DBUS_TYPE_ARRAY, "{sv}", &_tmp2_);
- g_hash_table_iter_init (&_tmp4_, result);
- while (g_hash_table_iter_next (&_tmp4_, &_tmp5_, &_tmp6_)) {
- gchar* _key;
- GValue* _value;
- const char* _tmp7_;
- DBusMessageIter _tmp8_;
- dbus_message_iter_open_container (&_tmp2_, DBUS_TYPE_DICT_ENTRY, NULL, &_tmp3_);
- _key = (gchar*) _tmp5_;
- _value = (GValue*) _tmp6_;
- _tmp7_ = _key;
- dbus_message_iter_append_basic (&_tmp3_, DBUS_TYPE_STRING, &_tmp7_);
- if (G_VALUE_TYPE (_value) == G_TYPE_UCHAR) {
- guint8 _tmp9_;
- dbus_message_iter_open_container (&_tmp3_, DBUS_TYPE_VARIANT, "y", &_tmp8_);
- _tmp9_ = g_value_get_uchar (_value);
- dbus_message_iter_append_basic (&_tmp8_, DBUS_TYPE_BYTE, &_tmp9_);
- dbus_message_iter_close_container (&_tmp3_, &_tmp8_);
- } else if (G_VALUE_TYPE (_value) == G_TYPE_BOOLEAN) {
- dbus_bool_t _tmp10_;
- dbus_message_iter_open_container (&_tmp3_, DBUS_TYPE_VARIANT, "b", &_tmp8_);
- _tmp10_ = g_value_get_boolean (_value);
- dbus_message_iter_append_basic (&_tmp8_, DBUS_TYPE_BOOLEAN, &_tmp10_);
- dbus_message_iter_close_container (&_tmp3_, &_tmp8_);
- } else if (G_VALUE_TYPE (_value) == G_TYPE_INT) {
- dbus_int32_t _tmp11_;
- dbus_message_iter_open_container (&_tmp3_, DBUS_TYPE_VARIANT, "i", &_tmp8_);
- _tmp11_ = g_value_get_int (_value);
- dbus_message_iter_append_basic (&_tmp8_, DBUS_TYPE_INT32, &_tmp11_);
- dbus_message_iter_close_container (&_tmp3_, &_tmp8_);
- } else if (G_VALUE_TYPE (_value) == G_TYPE_UINT) {
- dbus_uint32_t _tmp12_;
- dbus_message_iter_open_container (&_tmp3_, DBUS_TYPE_VARIANT, "u", &_tmp8_);
- _tmp12_ = g_value_get_uint (_value);
- dbus_message_iter_append_basic (&_tmp8_, DBUS_TYPE_UINT32, &_tmp12_);
- dbus_message_iter_close_container (&_tmp3_, &_tmp8_);
- } else if (G_VALUE_TYPE (_value) == G_TYPE_INT64) {
- dbus_int64_t _tmp13_;
- dbus_message_iter_open_container (&_tmp3_, DBUS_TYPE_VARIANT, "x", &_tmp8_);
- _tmp13_ = g_value_get_int64 (_value);
- dbus_message_iter_append_basic (&_tmp8_, DBUS_TYPE_INT64, &_tmp13_);
- dbus_message_iter_close_container (&_tmp3_, &_tmp8_);
- } else if (G_VALUE_TYPE (_value) == G_TYPE_UINT64) {
- dbus_uint64_t _tmp14_;
- dbus_message_iter_open_container (&_tmp3_, DBUS_TYPE_VARIANT, "t", &_tmp8_);
- _tmp14_ = g_value_get_uint64 (_value);
- dbus_message_iter_append_basic (&_tmp8_, DBUS_TYPE_UINT64, &_tmp14_);
- dbus_message_iter_close_container (&_tmp3_, &_tmp8_);
- } else if (G_VALUE_TYPE (_value) == G_TYPE_DOUBLE) {
- double _tmp15_;
- dbus_message_iter_open_container (&_tmp3_, DBUS_TYPE_VARIANT, "d", &_tmp8_);
- _tmp15_ = g_value_get_double (_value);
- dbus_message_iter_append_basic (&_tmp8_, DBUS_TYPE_DOUBLE, &_tmp15_);
- dbus_message_iter_close_container (&_tmp3_, &_tmp8_);
- } else if (G_VALUE_TYPE (_value) == G_TYPE_STRING) {
- const char* _tmp16_;
- dbus_message_iter_open_container (&_tmp3_, DBUS_TYPE_VARIANT, "s", &_tmp8_);
- _tmp16_ = g_value_get_string (_value);
- dbus_message_iter_append_basic (&_tmp8_, DBUS_TYPE_STRING, &_tmp16_);
- dbus_message_iter_close_container (&_tmp3_, &_tmp8_);
- } else if (G_VALUE_TYPE (_value) == G_TYPE_STRV) {
- const gchar** _tmp17_;
- DBusMessageIter _tmp18_;
- int _tmp19_;
- dbus_message_iter_open_container (&_tmp3_, DBUS_TYPE_VARIANT, "as", &_tmp8_);
- _tmp17_ = g_value_get_boxed (_value);
- dbus_message_iter_open_container (&_tmp8_, DBUS_TYPE_ARRAY, "s", &_tmp18_);
- for (_tmp19_ = 0; _tmp19_ < g_strv_length (g_value_get_boxed (_value)); _tmp19_++) {
- const char* _tmp20_;
- _tmp20_ = *_tmp17_;
- dbus_message_iter_append_basic (&_tmp18_, DBUS_TYPE_STRING, &_tmp20_);
- _tmp17_++;
- }
- dbus_message_iter_close_container (&_tmp8_, &_tmp18_);
- dbus_message_iter_close_container (&_tmp3_, &_tmp8_);
- }
- dbus_message_iter_close_container (&_tmp2_, &_tmp3_);
- }
- dbus_message_iter_close_container (&subiter, &_tmp2_);
- _g_hash_table_unref0 (result);
- dbus_message_iter_close_container (&reply_iter, &subiter);
- } else if ((strcmp (interface_name, "org.mpris.MediaPlayer2.Player") == 0) && (strcmp (property_name, "Position") == 0)) {
- gint32 result;
- dbus_int32_t _tmp21_;
- dbus_message_iter_open_container (&reply_iter, DBUS_TYPE_VARIANT, "i", &subiter);
- result = mpris_player_get_Position (self);
- _tmp21_ = result;
- dbus_message_iter_append_basic (&subiter, DBUS_TYPE_INT32, &_tmp21_);
- dbus_message_iter_close_container (&reply_iter, &subiter);
- } else if ((strcmp (interface_name, "org.mpris.MediaPlayer2.Player") == 0) && (strcmp (property_name, "PlaybackStatus") == 0)) {
- gchar* result;
- const char* _tmp22_;
- dbus_message_iter_open_container (&reply_iter, DBUS_TYPE_VARIANT, "s", &subiter);
- result = mpris_player_get_PlaybackStatus (self);
- _tmp22_ = result;
- dbus_message_iter_append_basic (&subiter, DBUS_TYPE_STRING, &_tmp22_);
- _g_free0 (result);
- dbus_message_iter_close_container (&reply_iter, &subiter);
- } else {
- dbus_message_unref (reply);
- reply = NULL;
- }
- g_free (interface_name);
- g_free (property_name);
- if (reply) {
- dbus_connection_send (connection, reply, NULL);
- dbus_message_unref (reply);
- return DBUS_HANDLER_RESULT_HANDLED;
- } else {
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
-}
-
-
-static DBusHandlerResult _dbus_mpris_player_property_set (MprisPlayer* self, DBusConnection* connection, DBusMessage* message) {
- DBusMessage* reply;
- DBusMessageIter iter, subiter;
- char* interface_name;
- const char* _tmp23_;
- char* property_name;
- const char* _tmp24_;
- if (strcmp (dbus_message_get_signature (message), "ssv")) {
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
- dbus_message_iter_init (message, &iter);
- reply = dbus_message_new_method_return (message);
- dbus_message_iter_get_basic (&iter, &_tmp23_);
- dbus_message_iter_next (&iter);
- interface_name = g_strdup (_tmp23_);
- dbus_message_iter_get_basic (&iter, &_tmp24_);
- dbus_message_iter_next (&iter);
- property_name = g_strdup (_tmp24_);
- dbus_message_iter_recurse (&iter, &subiter);
- if ((strcmp (interface_name, "org.mpris.MediaPlayer2.Player") == 0) && (strcmp (property_name, "Metadata") == 0)) {
- GHashTable* value;
- GHashTable* _tmp25_;
- DBusMessageIter _tmp26_;
- DBusMessageIter _tmp27_;
- _tmp25_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
- dbus_message_iter_recurse (&subiter, &_tmp26_);
- while (dbus_message_iter_get_arg_type (&_tmp26_)) {
- gchar* _key;
- GValue* _value;
- const char* _tmp28_;
- GValue _tmp29_ = {0};
- DBusMessageIter _tmp30_;
- dbus_message_iter_recurse (&_tmp26_, &_tmp27_);
- dbus_message_iter_get_basic (&_tmp27_, &_tmp28_);
- dbus_message_iter_next (&_tmp27_);
- _key = g_strdup (_tmp28_);
- dbus_message_iter_recurse (&_tmp27_, &_tmp30_);
- if (dbus_message_iter_get_arg_type (&_tmp30_) == DBUS_TYPE_BYTE) {
- guint8 _tmp31_;
- dbus_message_iter_get_basic (&_tmp30_, &_tmp31_);
- g_value_init (&_tmp29_, G_TYPE_UCHAR);
- g_value_set_uchar (&_tmp29_, _tmp31_);
- } else if (dbus_message_iter_get_arg_type (&_tmp30_) == DBUS_TYPE_BOOLEAN) {
- dbus_bool_t _tmp32_;
- dbus_message_iter_get_basic (&_tmp30_, &_tmp32_);
- g_value_init (&_tmp29_, G_TYPE_BOOLEAN);
- g_value_set_boolean (&_tmp29_, _tmp32_);
- } else if (dbus_message_iter_get_arg_type (&_tmp30_) == DBUS_TYPE_INT16) {
- dbus_int16_t _tmp33_;
- dbus_message_iter_get_basic (&_tmp30_, &_tmp33_);
- g_value_init (&_tmp29_, G_TYPE_INT);
- g_value_set_int (&_tmp29_, _tmp33_);
- } else if (dbus_message_iter_get_arg_type (&_tmp30_) == DBUS_TYPE_UINT16) {
- dbus_uint16_t _tmp34_;
- dbus_message_iter_get_basic (&_tmp30_, &_tmp34_);
- g_value_init (&_tmp29_, G_TYPE_UINT);
- g_value_set_uint (&_tmp29_, _tmp34_);
- } else if (dbus_message_iter_get_arg_type (&_tmp30_) == DBUS_TYPE_INT32) {
- dbus_int32_t _tmp35_;
- dbus_message_iter_get_basic (&_tmp30_, &_tmp35_);
- g_value_init (&_tmp29_, G_TYPE_INT);
- g_value_set_int (&_tmp29_, _tmp35_);
- } else if (dbus_message_iter_get_arg_type (&_tmp30_) == DBUS_TYPE_UINT32) {
- dbus_uint32_t _tmp36_;
- dbus_message_iter_get_basic (&_tmp30_, &_tmp36_);
- g_value_init (&_tmp29_, G_TYPE_UINT);
- g_value_set_uint (&_tmp29_, _tmp36_);
- } else if (dbus_message_iter_get_arg_type (&_tmp30_) == DBUS_TYPE_INT64) {
- dbus_int64_t _tmp37_;
- dbus_message_iter_get_basic (&_tmp30_, &_tmp37_);
- g_value_init (&_tmp29_, G_TYPE_INT64);
- g_value_set_int64 (&_tmp29_, _tmp37_);
- } else if (dbus_message_iter_get_arg_type (&_tmp30_) == DBUS_TYPE_UINT64) {
- dbus_uint64_t _tmp38_;
- dbus_message_iter_get_basic (&_tmp30_, &_tmp38_);
- g_value_init (&_tmp29_, G_TYPE_UINT64);
- g_value_set_uint64 (&_tmp29_, _tmp38_);
- } else if (dbus_message_iter_get_arg_type (&_tmp30_) == DBUS_TYPE_DOUBLE) {
- double _tmp39_;
- dbus_message_iter_get_basic (&_tmp30_, &_tmp39_);
- g_value_init (&_tmp29_, G_TYPE_DOUBLE);
- g_value_set_double (&_tmp29_, _tmp39_);
- } else if (dbus_message_iter_get_arg_type (&_tmp30_) == DBUS_TYPE_STRING) {
- const char* _tmp40_;
- dbus_message_iter_get_basic (&_tmp30_, &_tmp40_);
- g_value_init (&_tmp29_, G_TYPE_STRING);
- g_value_take_string (&_tmp29_, g_strdup (_tmp40_));
- } else if (dbus_message_iter_get_arg_type (&_tmp30_) == DBUS_TYPE_OBJECT_PATH) {
- const char* _tmp41_;
- dbus_message_iter_get_basic (&_tmp30_, &_tmp41_);
- g_value_init (&_tmp29_, G_TYPE_STRING);
- g_value_take_string (&_tmp29_, g_strdup (_tmp41_));
- } else if (dbus_message_iter_get_arg_type (&_tmp30_) == DBUS_TYPE_SIGNATURE) {
- const char* _tmp42_;
- dbus_message_iter_get_basic (&_tmp30_, &_tmp42_);
- g_value_init (&_tmp29_, G_TYPE_STRING);
- g_value_take_string (&_tmp29_, g_strdup (_tmp42_));
- } else if ((dbus_message_iter_get_arg_type (&_tmp30_) == DBUS_TYPE_ARRAY) && (dbus_message_iter_get_element_type (&_tmp30_) == DBUS_TYPE_STRING)) {
- const gchar** _tmp43_;
- int _tmp43__length;
- int _tmp43__size;
- int _tmp43__length1;
- DBusMessageIter _tmp44_;
- _tmp43_ = g_new (const gchar*, 5);
- _tmp43__length = 0;
- _tmp43__size = 4;
- _tmp43__length1 = 0;
- dbus_message_iter_recurse (&_tmp30_, &_tmp44_);
- for (; dbus_message_iter_get_arg_type (&_tmp44_); _tmp43__length1++) {
- const char* _tmp45_;
- if (_tmp43__size == _tmp43__length) {
- _tmp43__size = 2 * _tmp43__size;
- _tmp43_ = g_renew (const gchar*, _tmp43_, _tmp43__size + 1);
- }
- dbus_message_iter_get_basic (&_tmp44_, &_tmp45_);
- dbus_message_iter_next (&_tmp44_);
- _tmp43_[_tmp43__length++] = g_strdup (_tmp45_);
- }
- _tmp43_[_tmp43__length] = NULL;
- g_value_init (&_tmp29_, G_TYPE_STRV);
- g_value_take_boxed (&_tmp29_, _tmp43_);
- }
- dbus_message_iter_next (&_tmp27_);
- _value = g_memdup (&_tmp29_, sizeof (GValue));
- g_hash_table_insert (_tmp25_, _key, _value);
- dbus_message_iter_next (&_tmp26_);
- }
- dbus_message_iter_next (&subiter);
- value = _tmp25_;
- mpris_player_set_Metadata (self, value);
- _g_hash_table_unref0 (value);
- } else if ((strcmp (interface_name, "org.mpris.MediaPlayer2.Player") == 0) && (strcmp (property_name, "Position") == 0)) {
- gint32 value;
- dbus_int32_t _tmp46_;
- dbus_message_iter_get_basic (&subiter, &_tmp46_);
- dbus_message_iter_next (&subiter);
- value = _tmp46_;
- mpris_player_set_Position (self, value);
- } else if ((strcmp (interface_name, "org.mpris.MediaPlayer2.Player") == 0) && (strcmp (property_name, "PlaybackStatus") == 0)) {
- gchar* value;
- const char* _tmp47_;
- dbus_message_iter_get_basic (&subiter, &_tmp47_);
- dbus_message_iter_next (&subiter);
- value = g_strdup (_tmp47_);
- mpris_player_set_PlaybackStatus (self, value);
- _g_free0 (value);
- } else {
- dbus_message_unref (reply);
- reply = NULL;
- }
- g_free (interface_name);
- g_free (property_name);
- if (reply) {
- dbus_connection_send (connection, reply, NULL);
- dbus_message_unref (reply);
- return DBUS_HANDLER_RESULT_HANDLED;
- } else {
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
-}
-
-
-static DBusHandlerResult _dbus_mpris_player_property_get_all (MprisPlayer* self, DBusConnection* connection, DBusMessage* message) {
- DBusMessage* reply;
- DBusMessageIter iter, reply_iter, subiter, entry_iter, value_iter;
- char* interface_name;
- const char* _tmp48_;
- const char* property_name;
- if (strcmp (dbus_message_get_signature (message), "s")) {
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
- dbus_message_iter_init (message, &iter);
- reply = dbus_message_new_method_return (message);
- dbus_message_iter_init_append (reply, &reply_iter);
- dbus_message_iter_get_basic (&iter, &_tmp48_);
- dbus_message_iter_next (&iter);
- interface_name = g_strdup (_tmp48_);
- if (strcmp (interface_name, "org.mpris.MediaPlayer2.Player") == 0) {
- dbus_message_iter_open_container (&reply_iter, DBUS_TYPE_ARRAY, "{sv}", &subiter);
- {
- GHashTable* result;
- DBusMessageIter _tmp49_, _tmp50_;
- GHashTableIter _tmp51_;
- gpointer _tmp52_, _tmp53_;
- dbus_message_iter_open_container (&subiter, DBUS_TYPE_DICT_ENTRY, NULL, &entry_iter);
- property_name = "Metadata";
- dbus_message_iter_append_basic (&entry_iter, DBUS_TYPE_STRING, &property_name);
- dbus_message_iter_open_container (&entry_iter, DBUS_TYPE_VARIANT, "a{sv}", &value_iter);
- result = mpris_player_get_Metadata (self);
- dbus_message_iter_open_container (&value_iter, DBUS_TYPE_ARRAY, "{sv}", &_tmp49_);
- g_hash_table_iter_init (&_tmp51_, result);
- while (g_hash_table_iter_next (&_tmp51_, &_tmp52_, &_tmp53_)) {
- gchar* _key;
- GValue* _value;
- const char* _tmp54_;
- DBusMessageIter _tmp55_;
- dbus_message_iter_open_container (&_tmp49_, DBUS_TYPE_DICT_ENTRY, NULL, &_tmp50_);
- _key = (gchar*) _tmp52_;
- _value = (GValue*) _tmp53_;
- _tmp54_ = _key;
- dbus_message_iter_append_basic (&_tmp50_, DBUS_TYPE_STRING, &_tmp54_);
- if (G_VALUE_TYPE (_value) == G_TYPE_UCHAR) {
- guint8 _tmp56_;
- dbus_message_iter_open_container (&_tmp50_, DBUS_TYPE_VARIANT, "y", &_tmp55_);
- _tmp56_ = g_value_get_uchar (_value);
- dbus_message_iter_append_basic (&_tmp55_, DBUS_TYPE_BYTE, &_tmp56_);
- dbus_message_iter_close_container (&_tmp50_, &_tmp55_);
- } else if (G_VALUE_TYPE (_value) == G_TYPE_BOOLEAN) {
- dbus_bool_t _tmp57_;
- dbus_message_iter_open_container (&_tmp50_, DBUS_TYPE_VARIANT, "b", &_tmp55_);
- _tmp57_ = g_value_get_boolean (_value);
- dbus_message_iter_append_basic (&_tmp55_, DBUS_TYPE_BOOLEAN, &_tmp57_);
- dbus_message_iter_close_container (&_tmp50_, &_tmp55_);
- } else if (G_VALUE_TYPE (_value) == G_TYPE_INT) {
- dbus_int32_t _tmp58_;
- dbus_message_iter_open_container (&_tmp50_, DBUS_TYPE_VARIANT, "i", &_tmp55_);
- _tmp58_ = g_value_get_int (_value);
- dbus_message_iter_append_basic (&_tmp55_, DBUS_TYPE_INT32, &_tmp58_);
- dbus_message_iter_close_container (&_tmp50_, &_tmp55_);
- } else if (G_VALUE_TYPE (_value) == G_TYPE_UINT) {
- dbus_uint32_t _tmp59_;
- dbus_message_iter_open_container (&_tmp50_, DBUS_TYPE_VARIANT, "u", &_tmp55_);
- _tmp59_ = g_value_get_uint (_value);
- dbus_message_iter_append_basic (&_tmp55_, DBUS_TYPE_UINT32, &_tmp59_);
- dbus_message_iter_close_container (&_tmp50_, &_tmp55_);
- } else if (G_VALUE_TYPE (_value) == G_TYPE_INT64) {
- dbus_int64_t _tmp60_;
- dbus_message_iter_open_container (&_tmp50_, DBUS_TYPE_VARIANT, "x", &_tmp55_);
- _tmp60_ = g_value_get_int64 (_value);
- dbus_message_iter_append_basic (&_tmp55_, DBUS_TYPE_INT64, &_tmp60_);
- dbus_message_iter_close_container (&_tmp50_, &_tmp55_);
- } else if (G_VALUE_TYPE (_value) == G_TYPE_UINT64) {
- dbus_uint64_t _tmp61_;
- dbus_message_iter_open_container (&_tmp50_, DBUS_TYPE_VARIANT, "t", &_tmp55_);
- _tmp61_ = g_value_get_uint64 (_value);
- dbus_message_iter_append_basic (&_tmp55_, DBUS_TYPE_UINT64, &_tmp61_);
- dbus_message_iter_close_container (&_tmp50_, &_tmp55_);
- } else if (G_VALUE_TYPE (_value) == G_TYPE_DOUBLE) {
- double _tmp62_;
- dbus_message_iter_open_container (&_tmp50_, DBUS_TYPE_VARIANT, "d", &_tmp55_);
- _tmp62_ = g_value_get_double (_value);
- dbus_message_iter_append_basic (&_tmp55_, DBUS_TYPE_DOUBLE, &_tmp62_);
- dbus_message_iter_close_container (&_tmp50_, &_tmp55_);
- } else if (G_VALUE_TYPE (_value) == G_TYPE_STRING) {
- const char* _tmp63_;
- dbus_message_iter_open_container (&_tmp50_, DBUS_TYPE_VARIANT, "s", &_tmp55_);
- _tmp63_ = g_value_get_string (_value);
- dbus_message_iter_append_basic (&_tmp55_, DBUS_TYPE_STRING, &_tmp63_);
- dbus_message_iter_close_container (&_tmp50_, &_tmp55_);
- } else if (G_VALUE_TYPE (_value) == G_TYPE_STRV) {
- const gchar** _tmp64_;
- DBusMessageIter _tmp65_;
- int _tmp66_;
- dbus_message_iter_open_container (&_tmp50_, DBUS_TYPE_VARIANT, "as", &_tmp55_);
- _tmp64_ = g_value_get_boxed (_value);
- dbus_message_iter_open_container (&_tmp55_, DBUS_TYPE_ARRAY, "s", &_tmp65_);
- for (_tmp66_ = 0; _tmp66_ < g_strv_length (g_value_get_boxed (_value)); _tmp66_++) {
- const char* _tmp67_;
- _tmp67_ = *_tmp64_;
- dbus_message_iter_append_basic (&_tmp65_, DBUS_TYPE_STRING, &_tmp67_);
- _tmp64_++;
- }
- dbus_message_iter_close_container (&_tmp55_, &_tmp65_);
- dbus_message_iter_close_container (&_tmp50_, &_tmp55_);
- }
- dbus_message_iter_close_container (&_tmp49_, &_tmp50_);
- }
- dbus_message_iter_close_container (&value_iter, &_tmp49_);
- _g_hash_table_unref0 (result);
- dbus_message_iter_close_container (&entry_iter, &value_iter);
- dbus_message_iter_close_container (&subiter, &entry_iter);
- }
- {
- gint32 result;
- dbus_int32_t _tmp68_;
- dbus_message_iter_open_container (&subiter, DBUS_TYPE_DICT_ENTRY, NULL, &entry_iter);
- property_name = "Position";
- dbus_message_iter_append_basic (&entry_iter, DBUS_TYPE_STRING, &property_name);
- dbus_message_iter_open_container (&entry_iter, DBUS_TYPE_VARIANT, "i", &value_iter);
- result = mpris_player_get_Position (self);
- _tmp68_ = result;
- dbus_message_iter_append_basic (&value_iter, DBUS_TYPE_INT32, &_tmp68_);
- dbus_message_iter_close_container (&entry_iter, &value_iter);
- dbus_message_iter_close_container (&subiter, &entry_iter);
- }
- {
- gchar* result;
- const char* _tmp69_;
- dbus_message_iter_open_container (&subiter, DBUS_TYPE_DICT_ENTRY, NULL, &entry_iter);
- property_name = "PlaybackStatus";
- dbus_message_iter_append_basic (&entry_iter, DBUS_TYPE_STRING, &property_name);
- dbus_message_iter_open_container (&entry_iter, DBUS_TYPE_VARIANT, "s", &value_iter);
- result = mpris_player_get_PlaybackStatus (self);
- _tmp69_ = result;
- dbus_message_iter_append_basic (&value_iter, DBUS_TYPE_STRING, &_tmp69_);
- _g_free0 (result);
- dbus_message_iter_close_container (&entry_iter, &value_iter);
- dbus_message_iter_close_container (&subiter, &entry_iter);
- }
- dbus_message_iter_close_container (&reply_iter, &subiter);
- } else {
- dbus_message_unref (reply);
- reply = NULL;
- }
- g_free (interface_name);
- if (reply) {
- dbus_connection_send (connection, reply, NULL);
- dbus_message_unref (reply);
- return DBUS_HANDLER_RESULT_HANDLED;
- } else {
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
-}
-
-
-static DBusHandlerResult _dbus_mpris_player_PlayPause (MprisPlayer* self, DBusConnection* connection, DBusMessage* message) {
- DBusMessageIter iter;
- gpointer * _user_data_;
- if (strcmp (dbus_message_get_signature (message), "")) {
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
- dbus_message_iter_init (message, &iter);
- _user_data_ = g_new0 (gpointer, 2);
- _user_data_[0] = dbus_connection_ref (connection);
- _user_data_[1] = dbus_message_ref (message);
- mpris_player_PlayPause (self, (GAsyncReadyCallback) _dbus_mpris_player_PlayPause_ready, _user_data_);
- return DBUS_HANDLER_RESULT_HANDLED;
-}
-
-
-static void _dbus_mpris_player_PlayPause_ready (GObject * source_object, GAsyncResult * _res_, gpointer * _user_data_) {
- DBusConnection * connection;
- DBusMessage * message;
- DBusMessageIter iter;
- GError* error;
- DBusMessage* reply;
- connection = _user_data_[0];
- message = _user_data_[1];
- error = NULL;
- mpris_player_PlayPause_finish ((MprisPlayer*) source_object, _res_, &error);
- if (error) {
- if (error->domain == DBUS_GERROR) {
- switch (error->code) {
- case DBUS_GERROR_FAILED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Failed", error->message);
- break;
- case DBUS_GERROR_NO_MEMORY:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoMemory", error->message);
- break;
- case DBUS_GERROR_SERVICE_UNKNOWN:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.ServiceUnknown", error->message);
- break;
- case DBUS_GERROR_NAME_HAS_NO_OWNER:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NameHasNoOwner", error->message);
- break;
- case DBUS_GERROR_NO_REPLY:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoReply", error->message);
- break;
- case DBUS_GERROR_IO_ERROR:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.IOError", error->message);
- break;
- case DBUS_GERROR_BAD_ADDRESS:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.BadAddress", error->message);
- break;
- case DBUS_GERROR_NOT_SUPPORTED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NotSupported", error->message);
- break;
- case DBUS_GERROR_LIMITS_EXCEEDED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.LimitsExceeded", error->message);
- break;
- case DBUS_GERROR_ACCESS_DENIED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.AccessDenied", error->message);
- break;
- case DBUS_GERROR_AUTH_FAILED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.AuthFailed", error->message);
- break;
- case DBUS_GERROR_NO_SERVER:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoServer", error->message);
- break;
- case DBUS_GERROR_TIMEOUT:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Timeout", error->message);
- break;
- case DBUS_GERROR_NO_NETWORK:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoNetwork", error->message);
- break;
- case DBUS_GERROR_ADDRESS_IN_USE:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.AddressInUse", error->message);
- break;
- case DBUS_GERROR_DISCONNECTED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Disconnected", error->message);
- break;
- case DBUS_GERROR_INVALID_ARGS:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.InvalidArgs", error->message);
- break;
- case DBUS_GERROR_FILE_NOT_FOUND:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.FileNotFound", error->message);
- break;
- case DBUS_GERROR_FILE_EXISTS:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.FileExists", error->message);
- break;
- case DBUS_GERROR_UNKNOWN_METHOD:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.UnknownMethod", error->message);
- break;
- case DBUS_GERROR_TIMED_OUT:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.TimedOut", error->message);
- break;
- case DBUS_GERROR_MATCH_RULE_NOT_FOUND:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.MatchRuleNotFound", error->message);
- break;
- case DBUS_GERROR_MATCH_RULE_INVALID:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.MatchRuleInvalid", error->message);
- break;
- case DBUS_GERROR_SPAWN_EXEC_FAILED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ExecFailed", error->message);
- break;
- case DBUS_GERROR_SPAWN_FORK_FAILED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ForkFailed", error->message);
- break;
- case DBUS_GERROR_SPAWN_CHILD_EXITED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ChildExited", error->message);
- break;
- case DBUS_GERROR_SPAWN_CHILD_SIGNALED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ChildSignaled", error->message);
- break;
- case DBUS_GERROR_SPAWN_FAILED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.Failed", error->message);
- break;
- case DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.UnixProcessIdUnknown", error->message);
- break;
- case DBUS_GERROR_INVALID_SIGNATURE:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.InvalidSignature", error->message);
- break;
- case DBUS_GERROR_INVALID_FILE_CONTENT:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.InvalidFileContent", error->message);
- break;
- case DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.SELinuxSecurityContextUnknown", error->message);
- break;
- case DBUS_GERROR_REMOTE_EXCEPTION:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.RemoteException", error->message);
- break;
- }
- }
- dbus_connection_send (connection, reply, NULL);
- dbus_message_unref (reply);
- return;
- }
- reply = dbus_message_new_method_return (message);
- dbus_message_iter_init_append (reply, &iter);
- dbus_connection_send (connection, reply, NULL);
- dbus_message_unref (reply);
- dbus_connection_unref (connection);
- dbus_message_unref (message);
- g_free (_user_data_);
-}
-
-
-static DBusHandlerResult _dbus_mpris_player_Next (MprisPlayer* self, DBusConnection* connection, DBusMessage* message) {
- DBusMessageIter iter;
- gpointer * _user_data_;
- if (strcmp (dbus_message_get_signature (message), "")) {
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
- dbus_message_iter_init (message, &iter);
- _user_data_ = g_new0 (gpointer, 2);
- _user_data_[0] = dbus_connection_ref (connection);
- _user_data_[1] = dbus_message_ref (message);
- mpris_player_Next (self, (GAsyncReadyCallback) _dbus_mpris_player_Next_ready, _user_data_);
- return DBUS_HANDLER_RESULT_HANDLED;
-}
-
-
-static void _dbus_mpris_player_Next_ready (GObject * source_object, GAsyncResult * _res_, gpointer * _user_data_) {
- DBusConnection * connection;
- DBusMessage * message;
- DBusMessageIter iter;
- GError* error;
- DBusMessage* reply;
- connection = _user_data_[0];
- message = _user_data_[1];
- error = NULL;
- mpris_player_Next_finish ((MprisPlayer*) source_object, _res_, &error);
- if (error) {
- if (error->domain == DBUS_GERROR) {
- switch (error->code) {
- case DBUS_GERROR_FAILED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Failed", error->message);
- break;
- case DBUS_GERROR_NO_MEMORY:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoMemory", error->message);
- break;
- case DBUS_GERROR_SERVICE_UNKNOWN:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.ServiceUnknown", error->message);
- break;
- case DBUS_GERROR_NAME_HAS_NO_OWNER:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NameHasNoOwner", error->message);
- break;
- case DBUS_GERROR_NO_REPLY:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoReply", error->message);
- break;
- case DBUS_GERROR_IO_ERROR:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.IOError", error->message);
- break;
- case DBUS_GERROR_BAD_ADDRESS:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.BadAddress", error->message);
- break;
- case DBUS_GERROR_NOT_SUPPORTED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NotSupported", error->message);
- break;
- case DBUS_GERROR_LIMITS_EXCEEDED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.LimitsExceeded", error->message);
- break;
- case DBUS_GERROR_ACCESS_DENIED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.AccessDenied", error->message);
- break;
- case DBUS_GERROR_AUTH_FAILED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.AuthFailed", error->message);
- break;
- case DBUS_GERROR_NO_SERVER:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoServer", error->message);
- break;
- case DBUS_GERROR_TIMEOUT:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Timeout", error->message);
- break;
- case DBUS_GERROR_NO_NETWORK:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoNetwork", error->message);
- break;
- case DBUS_GERROR_ADDRESS_IN_USE:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.AddressInUse", error->message);
- break;
- case DBUS_GERROR_DISCONNECTED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Disconnected", error->message);
- break;
- case DBUS_GERROR_INVALID_ARGS:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.InvalidArgs", error->message);
- break;
- case DBUS_GERROR_FILE_NOT_FOUND:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.FileNotFound", error->message);
- break;
- case DBUS_GERROR_FILE_EXISTS:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.FileExists", error->message);
- break;
- case DBUS_GERROR_UNKNOWN_METHOD:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.UnknownMethod", error->message);
- break;
- case DBUS_GERROR_TIMED_OUT:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.TimedOut", error->message);
- break;
- case DBUS_GERROR_MATCH_RULE_NOT_FOUND:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.MatchRuleNotFound", error->message);
- break;
- case DBUS_GERROR_MATCH_RULE_INVALID:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.MatchRuleInvalid", error->message);
- break;
- case DBUS_GERROR_SPAWN_EXEC_FAILED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ExecFailed", error->message);
- break;
- case DBUS_GERROR_SPAWN_FORK_FAILED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ForkFailed", error->message);
- break;
- case DBUS_GERROR_SPAWN_CHILD_EXITED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ChildExited", error->message);
- break;
- case DBUS_GERROR_SPAWN_CHILD_SIGNALED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ChildSignaled", error->message);
- break;
- case DBUS_GERROR_SPAWN_FAILED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.Failed", error->message);
- break;
- case DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.UnixProcessIdUnknown", error->message);
- break;
- case DBUS_GERROR_INVALID_SIGNATURE:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.InvalidSignature", error->message);
- break;
- case DBUS_GERROR_INVALID_FILE_CONTENT:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.InvalidFileContent", error->message);
- break;
- case DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.SELinuxSecurityContextUnknown", error->message);
- break;
- case DBUS_GERROR_REMOTE_EXCEPTION:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.RemoteException", error->message);
- break;
- }
- }
- dbus_connection_send (connection, reply, NULL);
- dbus_message_unref (reply);
- return;
- }
- reply = dbus_message_new_method_return (message);
- dbus_message_iter_init_append (reply, &iter);
- dbus_connection_send (connection, reply, NULL);
- dbus_message_unref (reply);
- dbus_connection_unref (connection);
- dbus_message_unref (message);
- g_free (_user_data_);
-}
-
-
-static DBusHandlerResult _dbus_mpris_player_Previous (MprisPlayer* self, DBusConnection* connection, DBusMessage* message) {
- DBusMessageIter iter;
- gpointer * _user_data_;
- if (strcmp (dbus_message_get_signature (message), "")) {
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
- dbus_message_iter_init (message, &iter);
- _user_data_ = g_new0 (gpointer, 2);
- _user_data_[0] = dbus_connection_ref (connection);
- _user_data_[1] = dbus_message_ref (message);
- mpris_player_Previous (self, (GAsyncReadyCallback) _dbus_mpris_player_Previous_ready, _user_data_);
- return DBUS_HANDLER_RESULT_HANDLED;
-}
-
-
-static void _dbus_mpris_player_Previous_ready (GObject * source_object, GAsyncResult * _res_, gpointer * _user_data_) {
- DBusConnection * connection;
- DBusMessage * message;
- DBusMessageIter iter;
- GError* error;
- DBusMessage* reply;
- connection = _user_data_[0];
- message = _user_data_[1];
- error = NULL;
- mpris_player_Previous_finish ((MprisPlayer*) source_object, _res_, &error);
- if (error) {
- if (error->domain == DBUS_GERROR) {
- switch (error->code) {
- case DBUS_GERROR_FAILED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Failed", error->message);
- break;
- case DBUS_GERROR_NO_MEMORY:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoMemory", error->message);
- break;
- case DBUS_GERROR_SERVICE_UNKNOWN:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.ServiceUnknown", error->message);
- break;
- case DBUS_GERROR_NAME_HAS_NO_OWNER:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NameHasNoOwner", error->message);
- break;
- case DBUS_GERROR_NO_REPLY:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoReply", error->message);
- break;
- case DBUS_GERROR_IO_ERROR:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.IOError", error->message);
- break;
- case DBUS_GERROR_BAD_ADDRESS:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.BadAddress", error->message);
- break;
- case DBUS_GERROR_NOT_SUPPORTED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NotSupported", error->message);
- break;
- case DBUS_GERROR_LIMITS_EXCEEDED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.LimitsExceeded", error->message);
- break;
- case DBUS_GERROR_ACCESS_DENIED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.AccessDenied", error->message);
- break;
- case DBUS_GERROR_AUTH_FAILED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.AuthFailed", error->message);
- break;
- case DBUS_GERROR_NO_SERVER:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoServer", error->message);
- break;
- case DBUS_GERROR_TIMEOUT:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Timeout", error->message);
- break;
- case DBUS_GERROR_NO_NETWORK:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoNetwork", error->message);
- break;
- case DBUS_GERROR_ADDRESS_IN_USE:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.AddressInUse", error->message);
- break;
- case DBUS_GERROR_DISCONNECTED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Disconnected", error->message);
- break;
- case DBUS_GERROR_INVALID_ARGS:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.InvalidArgs", error->message);
- break;
- case DBUS_GERROR_FILE_NOT_FOUND:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.FileNotFound", error->message);
- break;
- case DBUS_GERROR_FILE_EXISTS:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.FileExists", error->message);
- break;
- case DBUS_GERROR_UNKNOWN_METHOD:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.UnknownMethod", error->message);
- break;
- case DBUS_GERROR_TIMED_OUT:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.TimedOut", error->message);
- break;
- case DBUS_GERROR_MATCH_RULE_NOT_FOUND:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.MatchRuleNotFound", error->message);
- break;
- case DBUS_GERROR_MATCH_RULE_INVALID:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.MatchRuleInvalid", error->message);
- break;
- case DBUS_GERROR_SPAWN_EXEC_FAILED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ExecFailed", error->message);
- break;
- case DBUS_GERROR_SPAWN_FORK_FAILED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ForkFailed", error->message);
- break;
- case DBUS_GERROR_SPAWN_CHILD_EXITED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ChildExited", error->message);
- break;
- case DBUS_GERROR_SPAWN_CHILD_SIGNALED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ChildSignaled", error->message);
- break;
- case DBUS_GERROR_SPAWN_FAILED:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.Failed", error->message);
- break;
- case DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.UnixProcessIdUnknown", error->message);
- break;
- case DBUS_GERROR_INVALID_SIGNATURE:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.InvalidSignature", error->message);
- break;
- case DBUS_GERROR_INVALID_FILE_CONTENT:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.InvalidFileContent", error->message);
- break;
- case DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.SELinuxSecurityContextUnknown", error->message);
- break;
- case DBUS_GERROR_REMOTE_EXCEPTION:
- reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.RemoteException", error->message);
- break;
- }
- }
- dbus_connection_send (connection, reply, NULL);
- dbus_message_unref (reply);
- return;
- }
- reply = dbus_message_new_method_return (message);
- dbus_message_iter_init_append (reply, &iter);
- dbus_connection_send (connection, reply, NULL);
- dbus_message_unref (reply);
- dbus_connection_unref (connection);
- dbus_message_unref (message);
- g_free (_user_data_);
-}
-
-
-DBusHandlerResult mpris_player_dbus_message (DBusConnection* connection, DBusMessage* message, void* object) {
- DBusHandlerResult result;
- result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- if (dbus_message_is_method_call (message, "org.freedesktop.DBus.Introspectable", "Introspect")) {
- result = _dbus_mpris_player_introspect (object, connection, message);
- } else if (dbus_message_is_method_call (message, "org.freedesktop.DBus.Properties", "Get")) {
- result = _dbus_mpris_player_property_get (object, connection, message);
- } else if (dbus_message_is_method_call (message, "org.freedesktop.DBus.Properties", "Set")) {
- result = _dbus_mpris_player_property_set (object, connection, message);
- } else if (dbus_message_is_method_call (message, "org.freedesktop.DBus.Properties", "GetAll")) {
- result = _dbus_mpris_player_property_get_all (object, connection, message);
- } else if (dbus_message_is_method_call (message, "org.mpris.MediaPlayer2.Player", "PlayPause")) {
- result = _dbus_mpris_player_PlayPause (object, connection, message);
- } else if (dbus_message_is_method_call (message, "org.mpris.MediaPlayer2.Player", "Next")) {
- result = _dbus_mpris_player_Next (object, connection, message);
- } else if (dbus_message_is_method_call (message, "org.mpris.MediaPlayer2.Player", "Previous")) {
- result = _dbus_mpris_player_Previous (object, connection, message);
- }
- if (result == DBUS_HANDLER_RESULT_HANDLED) {
- return result;
- } else {
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
-}
-
-
-static void _dbus_mpris_player_seeked (GObject* _sender, gint64 new_position, DBusConnection* _connection) {
- const char * _path;
- DBusMessage *_message;
- DBusMessageIter _iter;
- dbus_int64_t _tmp70_;
- _path = g_object_get_data (_sender, "dbus_object_path");
- _message = dbus_message_new_signal (_path, "org.mpris.MediaPlayer2.Player", "Seeked");
- dbus_message_iter_init_append (_message, &_iter);
- _tmp70_ = new_position;
- dbus_message_iter_append_basic (&_iter, DBUS_TYPE_INT64, &_tmp70_);
- dbus_connection_send (_connection, _message, NULL);
- dbus_message_unref (_message);
-}
-
-
-void mpris_player_dbus_register_object (DBusConnection* connection, const char* path, void* object) {
- if (!g_object_get_data (object, "dbus_object_path")) {
- g_object_set_data (object, "dbus_object_path", g_strdup (path));
- dbus_connection_register_object_path (connection, path, &_mpris_player_dbus_path_vtable, object);
- g_object_weak_ref (object, _vala_dbus_unregister_object, connection);
- }
- g_signal_connect (object, "seeked", (GCallback) _dbus_mpris_player_seeked, connection);
-}
-
-
-static void mpris_player_base_init (MprisPlayerIface * iface) {
- static gboolean initialized = FALSE;
- if (!initialized) {
- initialized = TRUE;
- g_object_interface_install_property (iface, g_param_spec_boxed ("Metadata", "Metadata", "Metadata", G_TYPE_HASH_TABLE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
- g_object_interface_install_property (iface, g_param_spec_int ("Position", "Position", "Position", G_MININT, G_MAXINT, 0, 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_string ("PlaybackStatus", "PlaybackStatus", "PlaybackStatus", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
- g_signal_new ("seeked", TYPE_MPRIS_PLAYER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__INT64, G_TYPE_NONE, 1, G_TYPE_INT64);
- g_type_set_qdata (TYPE_MPRIS_PLAYER, g_quark_from_static_string ("DBusObjectVTable"), (void*) (&_mpris_player_dbus_vtable));
- }
-}
-
-
-GType mpris_player_get_type (void) {
- static volatile gsize mpris_player_type_id__volatile = 0;
- if (g_once_init_enter (&mpris_player_type_id__volatile)) {
- static const GTypeInfo g_define_type_info = { sizeof (MprisPlayerIface), (GBaseInitFunc) mpris_player_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
- GType mpris_player_type_id;
- mpris_player_type_id = g_type_register_static (G_TYPE_INTERFACE, "MprisPlayer", &g_define_type_info, 0);
- g_type_interface_add_prerequisite (mpris_player_type_id, DBUS_TYPE_G_PROXY);
- g_type_set_qdata (mpris_player_type_id, g_quark_from_string ("ValaDBusInterfaceProxyType"), &mpris_player_dbus_proxy_get_type);
- g_once_init_leave (&mpris_player_type_id__volatile, mpris_player_type_id);
- }
- return mpris_player_type_id__volatile;
-}
-
-
-G_DEFINE_TYPE_EXTENDED (MprisPlayerDBusProxy, mpris_player_dbus_proxy, DBUS_TYPE_G_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_MPRIS_PLAYER, mpris_player_dbus_proxy_mpris_player__interface_init) );
-MprisPlayer* mpris_player_dbus_proxy_new (DBusGConnection* connection, const char* name, const char* path) {
- MprisPlayer* self;
- self = g_object_new (mpris_player_dbus_proxy_get_type (), "connection", connection, "name", name, "path", path, "interface", "org.mpris.MediaPlayer2.Player", NULL);
- return self;
-}
-
-
-static GObject* mpris_player_dbus_proxy_construct (GType gtype, guint n_properties, GObjectConstructParam* properties) {
- GObject* self;
- DBusGConnection *connection;
- char* path;
- char* filter;
- self = G_OBJECT_CLASS (mpris_player_dbus_proxy_parent_class)->constructor (gtype, n_properties, properties);
- g_object_get (self, "connection", &connection, NULL);
- g_object_get (self, "path", &path, NULL);
- dbus_connection_add_filter (dbus_g_connection_get_connection (connection), mpris_player_dbus_proxy_filter, self, NULL);
- filter = g_strdup_printf ("type='signal',path='%s'", path);
- dbus_bus_add_match (dbus_g_connection_get_connection (connection), filter, NULL);
- dbus_g_connection_unref (connection);
- g_free (path);
- g_free (filter);
- return self;
-}
-
-
-static void _dbus_handle_mpris_player_seeked (MprisPlayer* self, DBusConnection* connection, DBusMessage* message) {
- DBusMessageIter iter;
- gint64 new_position = 0LL;
- dbus_int64_t _tmp32_;
- DBusMessage* reply;
- if (strcmp (dbus_message_get_signature (message), "x")) {
- return;
- }
- dbus_message_iter_init (message, &iter);
- dbus_message_iter_get_basic (&iter, &_tmp32_);
- dbus_message_iter_next (&iter);
- new_position = _tmp32_;
- g_signal_emit_by_name (self, "seeked", new_position);
-}
-
-
-DBusHandlerResult mpris_player_dbus_proxy_filter (DBusConnection* connection, DBusMessage* message, void* user_data) {
- if (dbus_message_has_path (message, dbus_g_proxy_get_path (user_data))) {
- if (dbus_message_is_signal (message, "org.mpris.MediaPlayer2.Player", "Seeked")) {
- _dbus_handle_mpris_player_seeked (user_data, connection, message);
- }
- }
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-
-static void mpris_player_dbus_proxy_dispose (GObject* self) {
- DBusGConnection *connection;
- if (((MprisPlayerDBusProxy*) self)->disposed) {
- return;
- }
- ((MprisPlayerDBusProxy*) self)->disposed = TRUE;
- g_object_get (self, "connection", &connection, NULL);
- dbus_connection_remove_filter (dbus_g_connection_get_connection (connection), mpris_player_dbus_proxy_filter, self);
- G_OBJECT_CLASS (mpris_player_dbus_proxy_parent_class)->dispose (self);
-}
-
-
-static void mpris_player_dbus_proxy_class_init (MprisPlayerDBusProxyClass* klass) {
- G_OBJECT_CLASS (klass)->constructor = mpris_player_dbus_proxy_construct;
- G_OBJECT_CLASS (klass)->dispose = mpris_player_dbus_proxy_dispose;
- G_OBJECT_CLASS (klass)->get_property = _vala_mpris_player_dbus_proxy_get_property;
- G_OBJECT_CLASS (klass)->set_property = _vala_mpris_player_dbus_proxy_set_property;
- g_object_class_override_property (G_OBJECT_CLASS (klass), MPRIS_PLAYER_DBUS_PROXY_METADATA, "Metadata");
- g_object_class_override_property (G_OBJECT_CLASS (klass), MPRIS_PLAYER_DBUS_PROXY_POSITION, "Position");
- g_object_class_override_property (G_OBJECT_CLASS (klass), MPRIS_PLAYER_DBUS_PROXY_PLAYBACK_STATUS, "PlaybackStatus");
-}
-
-
-static void mpris_player_dbus_proxy_init (MprisPlayerDBusProxy* self) {
-}
-
-
-static void mpris_player_dbus_proxy_PlayPause_async (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
- DBusGConnection *_connection;
- DBusMessage *_message;
- DBusPendingCall *_pending;
- DBusMessageIter _iter;
- MprisPlayerDBusProxyPlayPauseData* _data_;
- _message = dbus_message_new_method_call (dbus_g_proxy_get_bus_name ((DBusGProxy*) self), dbus_g_proxy_get_path ((DBusGProxy*) self), "org.mpris.MediaPlayer2.Player", "PlayPause");
- dbus_message_iter_init_append (_message, &_iter);
- g_object_get (self, "connection", &_connection, NULL);
- dbus_connection_send_with_reply (dbus_g_connection_get_connection (_connection), _message, &_pending, -1);
- dbus_g_connection_unref (_connection);
- dbus_message_unref (_message);
- _data_ = g_slice_new0 (MprisPlayerDBusProxyPlayPauseData);
- _data_->_callback_ = _callback_;
- _data_->_user_data_ = _user_data_;
- _data_->pending = _pending;
- dbus_pending_call_set_notify (_pending, mpris_player_dbus_proxy_PlayPause_ready, _data_, NULL);
-}
-
-
-static void mpris_player_dbus_proxy_PlayPause_ready (DBusPendingCall* pending, void* user_data) {
- MprisPlayerDBusProxyPlayPauseData* _data_;
- GObject * _obj_;
- GSimpleAsyncResult * _res_;
- _data_ = user_data;
- _obj_ = g_object_newv (G_TYPE_OBJECT, 0, NULL);
- _res_ = g_simple_async_result_new (_obj_, _data_->_callback_, _data_->_user_data_, _data_);
- g_simple_async_result_complete (_res_);
- g_object_unref (_obj_);
- g_object_unref (_res_);
- g_slice_free (MprisPlayerDBusProxyPlayPauseData, _data_);
- dbus_pending_call_unref (pending);
-}
-
-
-static void mpris_player_dbus_proxy_PlayPause_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error) {
- MprisPlayerDBusProxyPlayPauseData* _data_;
- DBusError _dbus_error;
- DBusMessage *_reply;
- DBusMessageIter _iter;
- _data_ = g_simple_async_result_get_source_tag ((GSimpleAsyncResult *) _res_);
- dbus_error_init (&_dbus_error);
- _reply = dbus_pending_call_steal_reply (_data_->pending);
- dbus_set_error_from_message (&_dbus_error, _reply);
- if (dbus_error_is_set (&_dbus_error)) {
- GQuark _edomain = 0;
- gint _ecode = 0;
- if (strstr (_dbus_error.name, "org.freedesktop.DBus.Error") == _dbus_error.name) {
- const char* _tmp33_;
- _edomain = DBUS_GERROR;
- _tmp33_ = _dbus_error.name + 27;
- if (strcmp (_tmp33_, "Failed") == 0) {
- _ecode = DBUS_GERROR_FAILED;
- } else if (strcmp (_tmp33_, "NoMemory") == 0) {
- _ecode = DBUS_GERROR_NO_MEMORY;
- } else if (strcmp (_tmp33_, "ServiceUnknown") == 0) {
- _ecode = DBUS_GERROR_SERVICE_UNKNOWN;
- } else if (strcmp (_tmp33_, "NameHasNoOwner") == 0) {
- _ecode = DBUS_GERROR_NAME_HAS_NO_OWNER;
- } else if (strcmp (_tmp33_, "NoReply") == 0) {
- _ecode = DBUS_GERROR_NO_REPLY;
- } else if (strcmp (_tmp33_, "IOError") == 0) {
- _ecode = DBUS_GERROR_IO_ERROR;
- } else if (strcmp (_tmp33_, "BadAddress") == 0) {
- _ecode = DBUS_GERROR_BAD_ADDRESS;
- } else if (strcmp (_tmp33_, "NotSupported") == 0) {
- _ecode = DBUS_GERROR_NOT_SUPPORTED;
- } else if (strcmp (_tmp33_, "LimitsExceeded") == 0) {
- _ecode = DBUS_GERROR_LIMITS_EXCEEDED;
- } else if (strcmp (_tmp33_, "AccessDenied") == 0) {
- _ecode = DBUS_GERROR_ACCESS_DENIED;
- } else if (strcmp (_tmp33_, "AuthFailed") == 0) {
- _ecode = DBUS_GERROR_AUTH_FAILED;
- } else if (strcmp (_tmp33_, "NoServer") == 0) {
- _ecode = DBUS_GERROR_NO_SERVER;
- } else if (strcmp (_tmp33_, "Timeout") == 0) {
- _ecode = DBUS_GERROR_TIMEOUT;
- } else if (strcmp (_tmp33_, "NoNetwork") == 0) {
- _ecode = DBUS_GERROR_NO_NETWORK;
- } else if (strcmp (_tmp33_, "AddressInUse") == 0) {
- _ecode = DBUS_GERROR_ADDRESS_IN_USE;
- } else if (strcmp (_tmp33_, "Disconnected") == 0) {
- _ecode = DBUS_GERROR_DISCONNECTED;
- } else if (strcmp (_tmp33_, "InvalidArgs") == 0) {
- _ecode = DBUS_GERROR_INVALID_ARGS;
- } else if (strcmp (_tmp33_, "FileNotFound") == 0) {
- _ecode = DBUS_GERROR_FILE_NOT_FOUND;
- } else if (strcmp (_tmp33_, "FileExists") == 0) {
- _ecode = DBUS_GERROR_FILE_EXISTS;
- } else if (strcmp (_tmp33_, "UnknownMethod") == 0) {
- _ecode = DBUS_GERROR_UNKNOWN_METHOD;
- } else if (strcmp (_tmp33_, "TimedOut") == 0) {
- _ecode = DBUS_GERROR_TIMED_OUT;
- } else if (strcmp (_tmp33_, "MatchRuleNotFound") == 0) {
- _ecode = DBUS_GERROR_MATCH_RULE_NOT_FOUND;
- } else if (strcmp (_tmp33_, "MatchRuleInvalid") == 0) {
- _ecode = DBUS_GERROR_MATCH_RULE_INVALID;
- } else if (strcmp (_tmp33_, "Spawn.ExecFailed") == 0) {
- _ecode = DBUS_GERROR_SPAWN_EXEC_FAILED;
- } else if (strcmp (_tmp33_, "Spawn.ForkFailed") == 0) {
- _ecode = DBUS_GERROR_SPAWN_FORK_FAILED;
- } else if (strcmp (_tmp33_, "Spawn.ChildExited") == 0) {
- _ecode = DBUS_GERROR_SPAWN_CHILD_EXITED;
- } else if (strcmp (_tmp33_, "Spawn.ChildSignaled") == 0) {
- _ecode = DBUS_GERROR_SPAWN_CHILD_SIGNALED;
- } else if (strcmp (_tmp33_, "Spawn.Failed") == 0) {
- _ecode = DBUS_GERROR_SPAWN_FAILED;
- } else if (strcmp (_tmp33_, "UnixProcessIdUnknown") == 0) {
- _ecode = DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN;
- } else if (strcmp (_tmp33_, "InvalidSignature") == 0) {
- _ecode = DBUS_GERROR_INVALID_SIGNATURE;
- } else if (strcmp (_tmp33_, "InvalidFileContent") == 0) {
- _ecode = DBUS_GERROR_INVALID_FILE_CONTENT;
- } else if (strcmp (_tmp33_, "SELinuxSecurityContextUnknown") == 0) {
- _ecode = DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN;
- } else if (strcmp (_tmp33_, "RemoteException") == 0) {
- _ecode = DBUS_GERROR_REMOTE_EXCEPTION;
- }
- }
- g_set_error (error, _edomain, _ecode, "%s", _dbus_error.message);
- dbus_error_free (&_dbus_error);
- return;
- }
- if (strcmp (dbus_message_get_signature (_reply), "")) {
- g_set_error (error, DBUS_GERROR, DBUS_GERROR_INVALID_SIGNATURE, "Invalid signature, expected \"%s\", got \"%s\"", "", dbus_message_get_signature (_reply));
- dbus_message_unref (_reply);
- return;
- }
- dbus_message_iter_init (_reply, &_iter);
- dbus_message_unref (_reply);
-}
-
-
-static void mpris_player_dbus_proxy_Next_async (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
- DBusGConnection *_connection;
- DBusMessage *_message;
- DBusPendingCall *_pending;
- DBusMessageIter _iter;
- MprisPlayerDBusProxyNextData* _data_;
- _message = dbus_message_new_method_call (dbus_g_proxy_get_bus_name ((DBusGProxy*) self), dbus_g_proxy_get_path ((DBusGProxy*) self), "org.mpris.MediaPlayer2.Player", "Next");
- dbus_message_iter_init_append (_message, &_iter);
- g_object_get (self, "connection", &_connection, NULL);
- dbus_connection_send_with_reply (dbus_g_connection_get_connection (_connection), _message, &_pending, -1);
- dbus_g_connection_unref (_connection);
- dbus_message_unref (_message);
- _data_ = g_slice_new0 (MprisPlayerDBusProxyNextData);
- _data_->_callback_ = _callback_;
- _data_->_user_data_ = _user_data_;
- _data_->pending = _pending;
- dbus_pending_call_set_notify (_pending, mpris_player_dbus_proxy_Next_ready, _data_, NULL);
-}
-
-
-static void mpris_player_dbus_proxy_Next_ready (DBusPendingCall* pending, void* user_data) {
- MprisPlayerDBusProxyNextData* _data_;
- GObject * _obj_;
- GSimpleAsyncResult * _res_;
- _data_ = user_data;
- _obj_ = g_object_newv (G_TYPE_OBJECT, 0, NULL);
- _res_ = g_simple_async_result_new (_obj_, _data_->_callback_, _data_->_user_data_, _data_);
- g_simple_async_result_complete (_res_);
- g_object_unref (_obj_);
- g_object_unref (_res_);
- g_slice_free (MprisPlayerDBusProxyNextData, _data_);
- dbus_pending_call_unref (pending);
-}
-
-
-static void mpris_player_dbus_proxy_Next_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error) {
- MprisPlayerDBusProxyNextData* _data_;
- DBusError _dbus_error;
- DBusMessage *_reply;
- DBusMessageIter _iter;
- _data_ = g_simple_async_result_get_source_tag ((GSimpleAsyncResult *) _res_);
- dbus_error_init (&_dbus_error);
- _reply = dbus_pending_call_steal_reply (_data_->pending);
- dbus_set_error_from_message (&_dbus_error, _reply);
- if (dbus_error_is_set (&_dbus_error)) {
- GQuark _edomain = 0;
- gint _ecode = 0;
- if (strstr (_dbus_error.name, "org.freedesktop.DBus.Error") == _dbus_error.name) {
- const char* _tmp34_;
- _edomain = DBUS_GERROR;
- _tmp34_ = _dbus_error.name + 27;
- if (strcmp (_tmp34_, "Failed") == 0) {
- _ecode = DBUS_GERROR_FAILED;
- } else if (strcmp (_tmp34_, "NoMemory") == 0) {
- _ecode = DBUS_GERROR_NO_MEMORY;
- } else if (strcmp (_tmp34_, "ServiceUnknown") == 0) {
- _ecode = DBUS_GERROR_SERVICE_UNKNOWN;
- } else if (strcmp (_tmp34_, "NameHasNoOwner") == 0) {
- _ecode = DBUS_GERROR_NAME_HAS_NO_OWNER;
- } else if (strcmp (_tmp34_, "NoReply") == 0) {
- _ecode = DBUS_GERROR_NO_REPLY;
- } else if (strcmp (_tmp34_, "IOError") == 0) {
- _ecode = DBUS_GERROR_IO_ERROR;
- } else if (strcmp (_tmp34_, "BadAddress") == 0) {
- _ecode = DBUS_GERROR_BAD_ADDRESS;
- } else if (strcmp (_tmp34_, "NotSupported") == 0) {
- _ecode = DBUS_GERROR_NOT_SUPPORTED;
- } else if (strcmp (_tmp34_, "LimitsExceeded") == 0) {
- _ecode = DBUS_GERROR_LIMITS_EXCEEDED;
- } else if (strcmp (_tmp34_, "AccessDenied") == 0) {
- _ecode = DBUS_GERROR_ACCESS_DENIED;
- } else if (strcmp (_tmp34_, "AuthFailed") == 0) {
- _ecode = DBUS_GERROR_AUTH_FAILED;
- } else if (strcmp (_tmp34_, "NoServer") == 0) {
- _ecode = DBUS_GERROR_NO_SERVER;
- } else if (strcmp (_tmp34_, "Timeout") == 0) {
- _ecode = DBUS_GERROR_TIMEOUT;
- } else if (strcmp (_tmp34_, "NoNetwork") == 0) {
- _ecode = DBUS_GERROR_NO_NETWORK;
- } else if (strcmp (_tmp34_, "AddressInUse") == 0) {
- _ecode = DBUS_GERROR_ADDRESS_IN_USE;
- } else if (strcmp (_tmp34_, "Disconnected") == 0) {
- _ecode = DBUS_GERROR_DISCONNECTED;
- } else if (strcmp (_tmp34_, "InvalidArgs") == 0) {
- _ecode = DBUS_GERROR_INVALID_ARGS;
- } else if (strcmp (_tmp34_, "FileNotFound") == 0) {
- _ecode = DBUS_GERROR_FILE_NOT_FOUND;
- } else if (strcmp (_tmp34_, "FileExists") == 0) {
- _ecode = DBUS_GERROR_FILE_EXISTS;
- } else if (strcmp (_tmp34_, "UnknownMethod") == 0) {
- _ecode = DBUS_GERROR_UNKNOWN_METHOD;
- } else if (strcmp (_tmp34_, "TimedOut") == 0) {
- _ecode = DBUS_GERROR_TIMED_OUT;
- } else if (strcmp (_tmp34_, "MatchRuleNotFound") == 0) {
- _ecode = DBUS_GERROR_MATCH_RULE_NOT_FOUND;
- } else if (strcmp (_tmp34_, "MatchRuleInvalid") == 0) {
- _ecode = DBUS_GERROR_MATCH_RULE_INVALID;
- } else if (strcmp (_tmp34_, "Spawn.ExecFailed") == 0) {
- _ecode = DBUS_GERROR_SPAWN_EXEC_FAILED;
- } else if (strcmp (_tmp34_, "Spawn.ForkFailed") == 0) {
- _ecode = DBUS_GERROR_SPAWN_FORK_FAILED;
- } else if (strcmp (_tmp34_, "Spawn.ChildExited") == 0) {
- _ecode = DBUS_GERROR_SPAWN_CHILD_EXITED;
- } else if (strcmp (_tmp34_, "Spawn.ChildSignaled") == 0) {
- _ecode = DBUS_GERROR_SPAWN_CHILD_SIGNALED;
- } else if (strcmp (_tmp34_, "Spawn.Failed") == 0) {
- _ecode = DBUS_GERROR_SPAWN_FAILED;
- } else if (strcmp (_tmp34_, "UnixProcessIdUnknown") == 0) {
- _ecode = DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN;
- } else if (strcmp (_tmp34_, "InvalidSignature") == 0) {
- _ecode = DBUS_GERROR_INVALID_SIGNATURE;
- } else if (strcmp (_tmp34_, "InvalidFileContent") == 0) {
- _ecode = DBUS_GERROR_INVALID_FILE_CONTENT;
- } else if (strcmp (_tmp34_, "SELinuxSecurityContextUnknown") == 0) {
- _ecode = DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN;
- } else if (strcmp (_tmp34_, "RemoteException") == 0) {
- _ecode = DBUS_GERROR_REMOTE_EXCEPTION;
- }
- }
- g_set_error (error, _edomain, _ecode, "%s", _dbus_error.message);
- dbus_error_free (&_dbus_error);
- return;
- }
- if (strcmp (dbus_message_get_signature (_reply), "")) {
- g_set_error (error, DBUS_GERROR, DBUS_GERROR_INVALID_SIGNATURE, "Invalid signature, expected \"%s\", got \"%s\"", "", dbus_message_get_signature (_reply));
- dbus_message_unref (_reply);
- return;
- }
- dbus_message_iter_init (_reply, &_iter);
- dbus_message_unref (_reply);
-}
-
-
-static void mpris_player_dbus_proxy_Previous_async (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
- DBusGConnection *_connection;
- DBusMessage *_message;
- DBusPendingCall *_pending;
- DBusMessageIter _iter;
- MprisPlayerDBusProxyPreviousData* _data_;
- _message = dbus_message_new_method_call (dbus_g_proxy_get_bus_name ((DBusGProxy*) self), dbus_g_proxy_get_path ((DBusGProxy*) self), "org.mpris.MediaPlayer2.Player", "Previous");
- dbus_message_iter_init_append (_message, &_iter);
- g_object_get (self, "connection", &_connection, NULL);
- dbus_connection_send_with_reply (dbus_g_connection_get_connection (_connection), _message, &_pending, -1);
- dbus_g_connection_unref (_connection);
- dbus_message_unref (_message);
- _data_ = g_slice_new0 (MprisPlayerDBusProxyPreviousData);
- _data_->_callback_ = _callback_;
- _data_->_user_data_ = _user_data_;
- _data_->pending = _pending;
- dbus_pending_call_set_notify (_pending, mpris_player_dbus_proxy_Previous_ready, _data_, NULL);
-}
-
-
-static void mpris_player_dbus_proxy_Previous_ready (DBusPendingCall* pending, void* user_data) {
- MprisPlayerDBusProxyPreviousData* _data_;
- GObject * _obj_;
- GSimpleAsyncResult * _res_;
- _data_ = user_data;
- _obj_ = g_object_newv (G_TYPE_OBJECT, 0, NULL);
- _res_ = g_simple_async_result_new (_obj_, _data_->_callback_, _data_->_user_data_, _data_);
- g_simple_async_result_complete (_res_);
- g_object_unref (_obj_);
- g_object_unref (_res_);
- g_slice_free (MprisPlayerDBusProxyPreviousData, _data_);
- dbus_pending_call_unref (pending);
-}
-
-
-static void mpris_player_dbus_proxy_Previous_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error) {
- MprisPlayerDBusProxyPreviousData* _data_;
- DBusError _dbus_error;
- DBusMessage *_reply;
- DBusMessageIter _iter;
- _data_ = g_simple_async_result_get_source_tag ((GSimpleAsyncResult *) _res_);
- dbus_error_init (&_dbus_error);
- _reply = dbus_pending_call_steal_reply (_data_->pending);
- dbus_set_error_from_message (&_dbus_error, _reply);
- if (dbus_error_is_set (&_dbus_error)) {
- GQuark _edomain = 0;
- gint _ecode = 0;
- if (strstr (_dbus_error.name, "org.freedesktop.DBus.Error") == _dbus_error.name) {
- const char* _tmp35_;
- _edomain = DBUS_GERROR;
- _tmp35_ = _dbus_error.name + 27;
- if (strcmp (_tmp35_, "Failed") == 0) {
- _ecode = DBUS_GERROR_FAILED;
- } else if (strcmp (_tmp35_, "NoMemory") == 0) {
- _ecode = DBUS_GERROR_NO_MEMORY;
- } else if (strcmp (_tmp35_, "ServiceUnknown") == 0) {
- _ecode = DBUS_GERROR_SERVICE_UNKNOWN;
- } else if (strcmp (_tmp35_, "NameHasNoOwner") == 0) {
- _ecode = DBUS_GERROR_NAME_HAS_NO_OWNER;
- } else if (strcmp (_tmp35_, "NoReply") == 0) {
- _ecode = DBUS_GERROR_NO_REPLY;
- } else if (strcmp (_tmp35_, "IOError") == 0) {
- _ecode = DBUS_GERROR_IO_ERROR;
- } else if (strcmp (_tmp35_, "BadAddress") == 0) {
- _ecode = DBUS_GERROR_BAD_ADDRESS;
- } else if (strcmp (_tmp35_, "NotSupported") == 0) {
- _ecode = DBUS_GERROR_NOT_SUPPORTED;
- } else if (strcmp (_tmp35_, "LimitsExceeded") == 0) {
- _ecode = DBUS_GERROR_LIMITS_EXCEEDED;
- } else if (strcmp (_tmp35_, "AccessDenied") == 0) {
- _ecode = DBUS_GERROR_ACCESS_DENIED;
- } else if (strcmp (_tmp35_, "AuthFailed") == 0) {
- _ecode = DBUS_GERROR_AUTH_FAILED;
- } else if (strcmp (_tmp35_, "NoServer") == 0) {
- _ecode = DBUS_GERROR_NO_SERVER;
- } else if (strcmp (_tmp35_, "Timeout") == 0) {
- _ecode = DBUS_GERROR_TIMEOUT;
- } else if (strcmp (_tmp35_, "NoNetwork") == 0) {
- _ecode = DBUS_GERROR_NO_NETWORK;
- } else if (strcmp (_tmp35_, "AddressInUse") == 0) {
- _ecode = DBUS_GERROR_ADDRESS_IN_USE;
- } else if (strcmp (_tmp35_, "Disconnected") == 0) {
- _ecode = DBUS_GERROR_DISCONNECTED;
- } else if (strcmp (_tmp35_, "InvalidArgs") == 0) {
- _ecode = DBUS_GERROR_INVALID_ARGS;
- } else if (strcmp (_tmp35_, "FileNotFound") == 0) {
- _ecode = DBUS_GERROR_FILE_NOT_FOUND;
- } else if (strcmp (_tmp35_, "FileExists") == 0) {
- _ecode = DBUS_GERROR_FILE_EXISTS;
- } else if (strcmp (_tmp35_, "UnknownMethod") == 0) {
- _ecode = DBUS_GERROR_UNKNOWN_METHOD;
- } else if (strcmp (_tmp35_, "TimedOut") == 0) {
- _ecode = DBUS_GERROR_TIMED_OUT;
- } else if (strcmp (_tmp35_, "MatchRuleNotFound") == 0) {
- _ecode = DBUS_GERROR_MATCH_RULE_NOT_FOUND;
- } else if (strcmp (_tmp35_, "MatchRuleInvalid") == 0) {
- _ecode = DBUS_GERROR_MATCH_RULE_INVALID;
- } else if (strcmp (_tmp35_, "Spawn.ExecFailed") == 0) {
- _ecode = DBUS_GERROR_SPAWN_EXEC_FAILED;
- } else if (strcmp (_tmp35_, "Spawn.ForkFailed") == 0) {
- _ecode = DBUS_GERROR_SPAWN_FORK_FAILED;
- } else if (strcmp (_tmp35_, "Spawn.ChildExited") == 0) {
- _ecode = DBUS_GERROR_SPAWN_CHILD_EXITED;
- } else if (strcmp (_tmp35_, "Spawn.ChildSignaled") == 0) {
- _ecode = DBUS_GERROR_SPAWN_CHILD_SIGNALED;
- } else if (strcmp (_tmp35_, "Spawn.Failed") == 0) {
- _ecode = DBUS_GERROR_SPAWN_FAILED;
- } else if (strcmp (_tmp35_, "UnixProcessIdUnknown") == 0) {
- _ecode = DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN;
- } else if (strcmp (_tmp35_, "InvalidSignature") == 0) {
- _ecode = DBUS_GERROR_INVALID_SIGNATURE;
- } else if (strcmp (_tmp35_, "InvalidFileContent") == 0) {
- _ecode = DBUS_GERROR_INVALID_FILE_CONTENT;
- } else if (strcmp (_tmp35_, "SELinuxSecurityContextUnknown") == 0) {
- _ecode = DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN;
- } else if (strcmp (_tmp35_, "RemoteException") == 0) {
- _ecode = DBUS_GERROR_REMOTE_EXCEPTION;
- }
- }
- g_set_error (error, _edomain, _ecode, "%s", _dbus_error.message);
- dbus_error_free (&_dbus_error);
- return;
- }
- if (strcmp (dbus_message_get_signature (_reply), "")) {
- g_set_error (error, DBUS_GERROR, DBUS_GERROR_INVALID_SIGNATURE, "Invalid signature, expected \"%s\", got \"%s\"", "", dbus_message_get_signature (_reply));
- dbus_message_unref (_reply);
- return;
- }
- dbus_message_iter_init (_reply, &_iter);
- dbus_message_unref (_reply);
-}
-
-
-static GHashTable* mpris_player_dbus_proxy_get_Metadata (MprisPlayer* self) {
- DBusError _dbus_error;
- DBusGConnection *_connection;
- DBusMessage *_message, *_reply;
- DBusMessageIter _iter, _subiter;
- const char* _tmp36_;
- const char* _tmp37_;
- GHashTable* _result;
- GHashTable* _tmp38_;
- DBusMessageIter _tmp39_;
- DBusMessageIter _tmp40_;
- if (((MprisPlayerDBusProxy*) self)->disposed) {
- return NULL;
- }
- _message = dbus_message_new_method_call (dbus_g_proxy_get_bus_name ((DBusGProxy*) self), dbus_g_proxy_get_path ((DBusGProxy*) self), "org.freedesktop.DBus.Properties", "Get");
- dbus_message_iter_init_append (_message, &_iter);
- _tmp36_ = "org.mpris.MediaPlayer2.Player";
- dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp36_);
- _tmp37_ = "Metadata";
- dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp37_);
- g_object_get (self, "connection", &_connection, NULL);
- dbus_error_init (&_dbus_error);
- _reply = dbus_connection_send_with_reply_and_block (dbus_g_connection_get_connection (_connection), _message, -1, &_dbus_error);
- dbus_g_connection_unref (_connection);
- dbus_message_unref (_message);
- if (dbus_error_is_set (&_dbus_error)) {
- g_critical ("file %s: line %d: uncaught error: %s (%s)", __FILE__, __LINE__, _dbus_error.message, _dbus_error.name);
- dbus_error_free (&_dbus_error);
- return NULL;
- }
- if (strcmp (dbus_message_get_signature (_reply), "v")) {
- g_critical ("file %s: line %d: Invalid signature, expected \"%s\", got \"%s\"", __FILE__, __LINE__, "v", dbus_message_get_signature (_reply));
- dbus_message_unref (_reply);
- return NULL;
- }
- dbus_message_iter_init (_reply, &_iter);
- dbus_message_iter_recurse (&_iter, &_subiter);
- if (strcmp (dbus_message_iter_get_signature (&_subiter), "a{sv}")) {
- g_critical ("file %s: line %d: Invalid signature, expected \"%s\", got \"%s\"", __FILE__, __LINE__, "a{sv}", dbus_message_iter_get_signature (&_subiter));
- dbus_message_unref (_reply);
- return NULL;
- }
- _tmp38_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
- dbus_message_iter_recurse (&_subiter, &_tmp39_);
- while (dbus_message_iter_get_arg_type (&_tmp39_)) {
- gchar* _key;
- GValue* _value;
- const char* _tmp41_;
- GValue _tmp42_ = {0};
- DBusMessageIter _tmp43_;
- dbus_message_iter_recurse (&_tmp39_, &_tmp40_);
- dbus_message_iter_get_basic (&_tmp40_, &_tmp41_);
- dbus_message_iter_next (&_tmp40_);
- _key = g_strdup (_tmp41_);
- dbus_message_iter_recurse (&_tmp40_, &_tmp43_);
- if (dbus_message_iter_get_arg_type (&_tmp43_) == DBUS_TYPE_BYTE) {
- guint8 _tmp44_;
- dbus_message_iter_get_basic (&_tmp43_, &_tmp44_);
- g_value_init (&_tmp42_, G_TYPE_UCHAR);
- g_value_set_uchar (&_tmp42_, _tmp44_);
- } else if (dbus_message_iter_get_arg_type (&_tmp43_) == DBUS_TYPE_BOOLEAN) {
- dbus_bool_t _tmp45_;
- dbus_message_iter_get_basic (&_tmp43_, &_tmp45_);
- g_value_init (&_tmp42_, G_TYPE_BOOLEAN);
- g_value_set_boolean (&_tmp42_, _tmp45_);
- } else if (dbus_message_iter_get_arg_type (&_tmp43_) == DBUS_TYPE_INT16) {
- dbus_int16_t _tmp46_;
- dbus_message_iter_get_basic (&_tmp43_, &_tmp46_);
- g_value_init (&_tmp42_, G_TYPE_INT);
- g_value_set_int (&_tmp42_, _tmp46_);
- } else if (dbus_message_iter_get_arg_type (&_tmp43_) == DBUS_TYPE_UINT16) {
- dbus_uint16_t _tmp47_;
- dbus_message_iter_get_basic (&_tmp43_, &_tmp47_);
- g_value_init (&_tmp42_, G_TYPE_UINT);
- g_value_set_uint (&_tmp42_, _tmp47_);
- } else if (dbus_message_iter_get_arg_type (&_tmp43_) == DBUS_TYPE_INT32) {
- dbus_int32_t _tmp48_;
- dbus_message_iter_get_basic (&_tmp43_, &_tmp48_);
- g_value_init (&_tmp42_, G_TYPE_INT);
- g_value_set_int (&_tmp42_, _tmp48_);
- } else if (dbus_message_iter_get_arg_type (&_tmp43_) == DBUS_TYPE_UINT32) {
- dbus_uint32_t _tmp49_;
- dbus_message_iter_get_basic (&_tmp43_, &_tmp49_);
- g_value_init (&_tmp42_, G_TYPE_UINT);
- g_value_set_uint (&_tmp42_, _tmp49_);
- } else if (dbus_message_iter_get_arg_type (&_tmp43_) == DBUS_TYPE_INT64) {
- dbus_int64_t _tmp50_;
- dbus_message_iter_get_basic (&_tmp43_, &_tmp50_);
- g_value_init (&_tmp42_, G_TYPE_INT64);
- g_value_set_int64 (&_tmp42_, _tmp50_);
- } else if (dbus_message_iter_get_arg_type (&_tmp43_) == DBUS_TYPE_UINT64) {
- dbus_uint64_t _tmp51_;
- dbus_message_iter_get_basic (&_tmp43_, &_tmp51_);
- g_value_init (&_tmp42_, G_TYPE_UINT64);
- g_value_set_uint64 (&_tmp42_, _tmp51_);
- } else if (dbus_message_iter_get_arg_type (&_tmp43_) == DBUS_TYPE_DOUBLE) {
- double _tmp52_;
- dbus_message_iter_get_basic (&_tmp43_, &_tmp52_);
- g_value_init (&_tmp42_, G_TYPE_DOUBLE);
- g_value_set_double (&_tmp42_, _tmp52_);
- } else if (dbus_message_iter_get_arg_type (&_tmp43_) == DBUS_TYPE_STRING) {
- const char* _tmp53_;
- dbus_message_iter_get_basic (&_tmp43_, &_tmp53_);
- g_value_init (&_tmp42_, G_TYPE_STRING);
- g_value_take_string (&_tmp42_, g_strdup (_tmp53_));
- } else if (dbus_message_iter_get_arg_type (&_tmp43_) == DBUS_TYPE_OBJECT_PATH) {
- const char* _tmp54_;
- dbus_message_iter_get_basic (&_tmp43_, &_tmp54_);
- g_value_init (&_tmp42_, G_TYPE_STRING);
- g_value_take_string (&_tmp42_, g_strdup (_tmp54_));
- } else if (dbus_message_iter_get_arg_type (&_tmp43_) == DBUS_TYPE_SIGNATURE) {
- const char* _tmp55_;
- dbus_message_iter_get_basic (&_tmp43_, &_tmp55_);
- g_value_init (&_tmp42_, G_TYPE_STRING);
- g_value_take_string (&_tmp42_, g_strdup (_tmp55_));
- } else if ((dbus_message_iter_get_arg_type (&_tmp43_) == DBUS_TYPE_ARRAY) && (dbus_message_iter_get_element_type (&_tmp43_) == DBUS_TYPE_STRING)) {
- const gchar** _tmp56_;
- int _tmp56__length;
- int _tmp56__size;
- int _tmp56__length1;
- DBusMessageIter _tmp57_;
- _tmp56_ = g_new (const gchar*, 5);
- _tmp56__length = 0;
- _tmp56__size = 4;
- _tmp56__length1 = 0;
- dbus_message_iter_recurse (&_tmp43_, &_tmp57_);
- for (; dbus_message_iter_get_arg_type (&_tmp57_); _tmp56__length1++) {
- const char* _tmp58_;
- if (_tmp56__size == _tmp56__length) {
- _tmp56__size = 2 * _tmp56__size;
- _tmp56_ = g_renew (const gchar*, _tmp56_, _tmp56__size + 1);
- }
- dbus_message_iter_get_basic (&_tmp57_, &_tmp58_);
- dbus_message_iter_next (&_tmp57_);
- _tmp56_[_tmp56__length++] = g_strdup (_tmp58_);
- }
- _tmp56_[_tmp56__length] = NULL;
- g_value_init (&_tmp42_, G_TYPE_STRV);
- g_value_take_boxed (&_tmp42_, _tmp56_);
- }
- dbus_message_iter_next (&_tmp40_);
- _value = g_memdup (&_tmp42_, sizeof (GValue));
- g_hash_table_insert (_tmp38_, _key, _value);
- dbus_message_iter_next (&_tmp39_);
- }
- dbus_message_iter_next (&_subiter);
- _result = _tmp38_;
- dbus_message_unref (_reply);
- return _result;
-}
-
-
-static void mpris_player_dbus_proxy_set_Metadata (MprisPlayer* self, GHashTable* value) {
- DBusError _dbus_error;
- DBusGConnection *_connection;
- DBusMessage *_message, *_reply;
- DBusMessageIter _iter, _subiter;
- const char* _tmp59_;
- const char* _tmp60_;
- DBusMessageIter _tmp61_, _tmp62_;
- GHashTableIter _tmp63_;
- gpointer _tmp64_, _tmp65_;
- if (((MprisPlayerDBusProxy*) self)->disposed) {
- return;
- }
- _message = dbus_message_new_method_call (dbus_g_proxy_get_bus_name ((DBusGProxy*) self), dbus_g_proxy_get_path ((DBusGProxy*) self), "org.freedesktop.DBus.Properties", "Set");
- dbus_message_iter_init_append (_message, &_iter);
- _tmp59_ = "org.mpris.MediaPlayer2.Player";
- dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp59_);
- _tmp60_ = "Metadata";
- dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp60_);
- dbus_message_iter_open_container (&_iter, DBUS_TYPE_VARIANT, "a{sv}", &_subiter);
- dbus_message_iter_open_container (&_subiter, DBUS_TYPE_ARRAY, "{sv}", &_tmp61_);
- g_hash_table_iter_init (&_tmp63_, value);
- while (g_hash_table_iter_next (&_tmp63_, &_tmp64_, &_tmp65_)) {
- gchar* _key;
- GValue* _value;
- const char* _tmp66_;
- DBusMessageIter _tmp67_;
- dbus_message_iter_open_container (&_tmp61_, DBUS_TYPE_DICT_ENTRY, NULL, &_tmp62_);
- _key = (gchar*) _tmp64_;
- _value = (GValue*) _tmp65_;
- _tmp66_ = _key;
- dbus_message_iter_append_basic (&_tmp62_, DBUS_TYPE_STRING, &_tmp66_);
- if (G_VALUE_TYPE (_value) == G_TYPE_UCHAR) {
- guint8 _tmp68_;
- dbus_message_iter_open_container (&_tmp62_, DBUS_TYPE_VARIANT, "y", &_tmp67_);
- _tmp68_ = g_value_get_uchar (_value);
- dbus_message_iter_append_basic (&_tmp67_, DBUS_TYPE_BYTE, &_tmp68_);
- dbus_message_iter_close_container (&_tmp62_, &_tmp67_);
- } else if (G_VALUE_TYPE (_value) == G_TYPE_BOOLEAN) {
- dbus_bool_t _tmp69_;
- dbus_message_iter_open_container (&_tmp62_, DBUS_TYPE_VARIANT, "b", &_tmp67_);
- _tmp69_ = g_value_get_boolean (_value);
- dbus_message_iter_append_basic (&_tmp67_, DBUS_TYPE_BOOLEAN, &_tmp69_);
- dbus_message_iter_close_container (&_tmp62_, &_tmp67_);
- } else if (G_VALUE_TYPE (_value) == G_TYPE_INT) {
- dbus_int32_t _tmp70_;
- dbus_message_iter_open_container (&_tmp62_, DBUS_TYPE_VARIANT, "i", &_tmp67_);
- _tmp70_ = g_value_get_int (_value);
- dbus_message_iter_append_basic (&_tmp67_, DBUS_TYPE_INT32, &_tmp70_);
- dbus_message_iter_close_container (&_tmp62_, &_tmp67_);
- } else if (G_VALUE_TYPE (_value) == G_TYPE_UINT) {
- dbus_uint32_t _tmp71_;
- dbus_message_iter_open_container (&_tmp62_, DBUS_TYPE_VARIANT, "u", &_tmp67_);
- _tmp71_ = g_value_get_uint (_value);
- dbus_message_iter_append_basic (&_tmp67_, DBUS_TYPE_UINT32, &_tmp71_);
- dbus_message_iter_close_container (&_tmp62_, &_tmp67_);
- } else if (G_VALUE_TYPE (_value) == G_TYPE_INT64) {
- dbus_int64_t _tmp72_;
- dbus_message_iter_open_container (&_tmp62_, DBUS_TYPE_VARIANT, "x", &_tmp67_);
- _tmp72_ = g_value_get_int64 (_value);
- dbus_message_iter_append_basic (&_tmp67_, DBUS_TYPE_INT64, &_tmp72_);
- dbus_message_iter_close_container (&_tmp62_, &_tmp67_);
- } else if (G_VALUE_TYPE (_value) == G_TYPE_UINT64) {
- dbus_uint64_t _tmp73_;
- dbus_message_iter_open_container (&_tmp62_, DBUS_TYPE_VARIANT, "t", &_tmp67_);
- _tmp73_ = g_value_get_uint64 (_value);
- dbus_message_iter_append_basic (&_tmp67_, DBUS_TYPE_UINT64, &_tmp73_);
- dbus_message_iter_close_container (&_tmp62_, &_tmp67_);
- } else if (G_VALUE_TYPE (_value) == G_TYPE_DOUBLE) {
- double _tmp74_;
- dbus_message_iter_open_container (&_tmp62_, DBUS_TYPE_VARIANT, "d", &_tmp67_);
- _tmp74_ = g_value_get_double (_value);
- dbus_message_iter_append_basic (&_tmp67_, DBUS_TYPE_DOUBLE, &_tmp74_);
- dbus_message_iter_close_container (&_tmp62_, &_tmp67_);
- } else if (G_VALUE_TYPE (_value) == G_TYPE_STRING) {
- const char* _tmp75_;
- dbus_message_iter_open_container (&_tmp62_, DBUS_TYPE_VARIANT, "s", &_tmp67_);
- _tmp75_ = g_value_get_string (_value);
- dbus_message_iter_append_basic (&_tmp67_, DBUS_TYPE_STRING, &_tmp75_);
- dbus_message_iter_close_container (&_tmp62_, &_tmp67_);
- } else if (G_VALUE_TYPE (_value) == G_TYPE_STRV) {
- const gchar** _tmp76_;
- DBusMessageIter _tmp77_;
- int _tmp78_;
- dbus_message_iter_open_container (&_tmp62_, DBUS_TYPE_VARIANT, "as", &_tmp67_);
- _tmp76_ = g_value_get_boxed (_value);
- dbus_message_iter_open_container (&_tmp67_, DBUS_TYPE_ARRAY, "s", &_tmp77_);
- for (_tmp78_ = 0; _tmp78_ < g_strv_length (g_value_get_boxed (_value)); _tmp78_++) {
- const char* _tmp79_;
- _tmp79_ = *_tmp76_;
- dbus_message_iter_append_basic (&_tmp77_, DBUS_TYPE_STRING, &_tmp79_);
- _tmp76_++;
- }
- dbus_message_iter_close_container (&_tmp67_, &_tmp77_);
- dbus_message_iter_close_container (&_tmp62_, &_tmp67_);
- }
- dbus_message_iter_close_container (&_tmp61_, &_tmp62_);
- }
- dbus_message_iter_close_container (&_subiter, &_tmp61_);
- dbus_message_iter_close_container (&_iter, &_subiter);
- g_object_get (self, "connection", &_connection, NULL);
- dbus_error_init (&_dbus_error);
- _reply = dbus_connection_send_with_reply_and_block (dbus_g_connection_get_connection (_connection), _message, -1, &_dbus_error);
- dbus_g_connection_unref (_connection);
- dbus_message_unref (_message);
- if (dbus_error_is_set (&_dbus_error)) {
- g_critical ("file %s: line %d: uncaught error: %s (%s)", __FILE__, __LINE__, _dbus_error.message, _dbus_error.name);
- dbus_error_free (&_dbus_error);
- return;
- }
- if (strcmp (dbus_message_get_signature (_reply), "")) {
- g_critical ("file %s: line %d: Invalid signature, expected \"%s\", got \"%s\"", __FILE__, __LINE__, "", dbus_message_get_signature (_reply));
- dbus_message_unref (_reply);
- return;
- }
- dbus_message_iter_init (_reply, &_iter);
- dbus_message_unref (_reply);
-}
-
-
-static gint32 mpris_player_dbus_proxy_get_Position (MprisPlayer* self) {
- DBusError _dbus_error;
- DBusGConnection *_connection;
- DBusMessage *_message, *_reply;
- DBusMessageIter _iter, _subiter;
- const char* _tmp80_;
- const char* _tmp81_;
- gint32 _result;
- dbus_int32_t _tmp82_;
- if (((MprisPlayerDBusProxy*) self)->disposed) {
- return 0;
- }
- _message = dbus_message_new_method_call (dbus_g_proxy_get_bus_name ((DBusGProxy*) self), dbus_g_proxy_get_path ((DBusGProxy*) self), "org.freedesktop.DBus.Properties", "Get");
- dbus_message_iter_init_append (_message, &_iter);
- _tmp80_ = "org.mpris.MediaPlayer2.Player";
- dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp80_);
- _tmp81_ = "Position";
- dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp81_);
- g_object_get (self, "connection", &_connection, NULL);
- dbus_error_init (&_dbus_error);
- _reply = dbus_connection_send_with_reply_and_block (dbus_g_connection_get_connection (_connection), _message, -1, &_dbus_error);
- dbus_g_connection_unref (_connection);
- dbus_message_unref (_message);
- if (dbus_error_is_set (&_dbus_error)) {
- g_critical ("file %s: line %d: uncaught error: %s (%s)", __FILE__, __LINE__, _dbus_error.message, _dbus_error.name);
- dbus_error_free (&_dbus_error);
- return 0;
- }
- if (strcmp (dbus_message_get_signature (_reply), "v")) {
- g_critical ("file %s: line %d: Invalid signature, expected \"%s\", got \"%s\"", __FILE__, __LINE__, "v", dbus_message_get_signature (_reply));
- dbus_message_unref (_reply);
- return 0;
- }
- dbus_message_iter_init (_reply, &_iter);
- dbus_message_iter_recurse (&_iter, &_subiter);
- if (strcmp (dbus_message_iter_get_signature (&_subiter), "i")) {
- g_critical ("file %s: line %d: Invalid signature, expected \"%s\", got \"%s\"", __FILE__, __LINE__, "i", dbus_message_iter_get_signature (&_subiter));
- dbus_message_unref (_reply);
- return 0;
- }
- dbus_message_iter_get_basic (&_subiter, &_tmp82_);
- dbus_message_iter_next (&_subiter);
- _result = _tmp82_;
- dbus_message_unref (_reply);
- return _result;
-}
-
-
-static void mpris_player_dbus_proxy_set_Position (MprisPlayer* self, gint32 value) {
- DBusError _dbus_error;
- DBusGConnection *_connection;
- DBusMessage *_message, *_reply;
- DBusMessageIter _iter, _subiter;
- const char* _tmp83_;
- const char* _tmp84_;
- dbus_int32_t _tmp85_;
- if (((MprisPlayerDBusProxy*) self)->disposed) {
- return;
- }
- _message = dbus_message_new_method_call (dbus_g_proxy_get_bus_name ((DBusGProxy*) self), dbus_g_proxy_get_path ((DBusGProxy*) self), "org.freedesktop.DBus.Properties", "Set");
- dbus_message_iter_init_append (_message, &_iter);
- _tmp83_ = "org.mpris.MediaPlayer2.Player";
- dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp83_);
- _tmp84_ = "Position";
- dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp84_);
- dbus_message_iter_open_container (&_iter, DBUS_TYPE_VARIANT, "i", &_subiter);
- _tmp85_ = value;
- dbus_message_iter_append_basic (&_subiter, DBUS_TYPE_INT32, &_tmp85_);
- dbus_message_iter_close_container (&_iter, &_subiter);
- g_object_get (self, "connection", &_connection, NULL);
- dbus_error_init (&_dbus_error);
- _reply = dbus_connection_send_with_reply_and_block (dbus_g_connection_get_connection (_connection), _message, -1, &_dbus_error);
- dbus_g_connection_unref (_connection);
- dbus_message_unref (_message);
- if (dbus_error_is_set (&_dbus_error)) {
- g_critical ("file %s: line %d: uncaught error: %s (%s)", __FILE__, __LINE__, _dbus_error.message, _dbus_error.name);
- dbus_error_free (&_dbus_error);
- return;
- }
- if (strcmp (dbus_message_get_signature (_reply), "")) {
- g_critical ("file %s: line %d: Invalid signature, expected \"%s\", got \"%s\"", __FILE__, __LINE__, "", dbus_message_get_signature (_reply));
- dbus_message_unref (_reply);
- return;
- }
- dbus_message_iter_init (_reply, &_iter);
- dbus_message_unref (_reply);
-}
-
-
-static gchar* mpris_player_dbus_proxy_get_PlaybackStatus (MprisPlayer* self) {
- DBusError _dbus_error;
- DBusGConnection *_connection;
- DBusMessage *_message, *_reply;
- DBusMessageIter _iter, _subiter;
- const char* _tmp86_;
- const char* _tmp87_;
- gchar* _result;
- const char* _tmp88_;
- if (((MprisPlayerDBusProxy*) self)->disposed) {
- return NULL;
- }
- _message = dbus_message_new_method_call (dbus_g_proxy_get_bus_name ((DBusGProxy*) self), dbus_g_proxy_get_path ((DBusGProxy*) self), "org.freedesktop.DBus.Properties", "Get");
- dbus_message_iter_init_append (_message, &_iter);
- _tmp86_ = "org.mpris.MediaPlayer2.Player";
- dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp86_);
- _tmp87_ = "PlaybackStatus";
- dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp87_);
- g_object_get (self, "connection", &_connection, NULL);
- dbus_error_init (&_dbus_error);
- _reply = dbus_connection_send_with_reply_and_block (dbus_g_connection_get_connection (_connection), _message, -1, &_dbus_error);
- dbus_g_connection_unref (_connection);
- dbus_message_unref (_message);
- if (dbus_error_is_set (&_dbus_error)) {
- g_critical ("file %s: line %d: uncaught error: %s (%s)", __FILE__, __LINE__, _dbus_error.message, _dbus_error.name);
- dbus_error_free (&_dbus_error);
- return NULL;
- }
- if (strcmp (dbus_message_get_signature (_reply), "v")) {
- g_critical ("file %s: line %d: Invalid signature, expected \"%s\", got \"%s\"", __FILE__, __LINE__, "v", dbus_message_get_signature (_reply));
- dbus_message_unref (_reply);
- return NULL;
- }
- dbus_message_iter_init (_reply, &_iter);
- dbus_message_iter_recurse (&_iter, &_subiter);
- if (strcmp (dbus_message_iter_get_signature (&_subiter), "s")) {
- g_critical ("file %s: line %d: Invalid signature, expected \"%s\", got \"%s\"", __FILE__, __LINE__, "s", dbus_message_iter_get_signature (&_subiter));
- dbus_message_unref (_reply);
- return NULL;
- }
- dbus_message_iter_get_basic (&_subiter, &_tmp88_);
- dbus_message_iter_next (&_subiter);
- _result = g_strdup (_tmp88_);
- dbus_message_unref (_reply);
- return _result;
-}
-
-
-static void mpris_player_dbus_proxy_set_PlaybackStatus (MprisPlayer* self, const gchar* value) {
- DBusError _dbus_error;
- DBusGConnection *_connection;
- DBusMessage *_message, *_reply;
- DBusMessageIter _iter, _subiter;
- const char* _tmp89_;
- const char* _tmp90_;
- const char* _tmp91_;
- if (((MprisPlayerDBusProxy*) self)->disposed) {
- return;
- }
- _message = dbus_message_new_method_call (dbus_g_proxy_get_bus_name ((DBusGProxy*) self), dbus_g_proxy_get_path ((DBusGProxy*) self), "org.freedesktop.DBus.Properties", "Set");
- dbus_message_iter_init_append (_message, &_iter);
- _tmp89_ = "org.mpris.MediaPlayer2.Player";
- dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp89_);
- _tmp90_ = "PlaybackStatus";
- dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp90_);
- dbus_message_iter_open_container (&_iter, DBUS_TYPE_VARIANT, "s", &_subiter);
- _tmp91_ = value;
- dbus_message_iter_append_basic (&_subiter, DBUS_TYPE_STRING, &_tmp91_);
- dbus_message_iter_close_container (&_iter, &_subiter);
- g_object_get (self, "connection", &_connection, NULL);
- dbus_error_init (&_dbus_error);
- _reply = dbus_connection_send_with_reply_and_block (dbus_g_connection_get_connection (_connection), _message, -1, &_dbus_error);
- dbus_g_connection_unref (_connection);
- dbus_message_unref (_message);
- if (dbus_error_is_set (&_dbus_error)) {
- g_critical ("file %s: line %d: uncaught error: %s (%s)", __FILE__, __LINE__, _dbus_error.message, _dbus_error.name);
- dbus_error_free (&_dbus_error);
- return;
- }
- if (strcmp (dbus_message_get_signature (_reply), "")) {
- g_critical ("file %s: line %d: Invalid signature, expected \"%s\", got \"%s\"", __FILE__, __LINE__, "", dbus_message_get_signature (_reply));
- dbus_message_unref (_reply);
- return;
- }
- dbus_message_iter_init (_reply, &_iter);
- dbus_message_unref (_reply);
-}
-
-
-static void mpris_player_dbus_proxy_mpris_player__interface_init (MprisPlayerIface* iface) {
- iface->PlayPause = mpris_player_dbus_proxy_PlayPause_async;
- iface->PlayPause_finish = mpris_player_dbus_proxy_PlayPause_finish;
- iface->Next = mpris_player_dbus_proxy_Next_async;
- iface->Next_finish = mpris_player_dbus_proxy_Next_finish;
- iface->Previous = mpris_player_dbus_proxy_Previous_async;
- iface->Previous_finish = mpris_player_dbus_proxy_Previous_finish;
- iface->get_Metadata = mpris_player_dbus_proxy_get_Metadata;
- iface->set_Metadata = mpris_player_dbus_proxy_set_Metadata;
- iface->get_Position = mpris_player_dbus_proxy_get_Position;
- iface->set_Position = mpris_player_dbus_proxy_set_Position;
- iface->get_PlaybackStatus = mpris_player_dbus_proxy_get_PlaybackStatus;
- iface->set_PlaybackStatus = mpris_player_dbus_proxy_set_PlaybackStatus;
-}
-
-
-static void _vala_mpris_player_dbus_proxy_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
-}
-
-
-static void _vala_mpris_player_dbus_proxy_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
-}
-
+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);
@@ -4011,211 +316,12 @@ static void g_cclosure_user_marshal_VOID__STRING_BOXED_BOXED_INT (GClosure * clo
}
-void _free_desktop_properties_dbus_unregister (DBusConnection* connection, void* _user_data_) {
-}
-
-
-static DBusHandlerResult _dbus_free_desktop_properties_introspect (FreeDesktopProperties* self, DBusConnection* connection, DBusMessage* message) {
- DBusMessage* reply;
- DBusMessageIter iter;
- GString* xml_data;
- char** children;
- int i;
- reply = dbus_message_new_method_return (message);
- dbus_message_iter_init_append (reply, &iter);
- xml_data = g_string_new ("<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\" \"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">\n");
- g_string_append (xml_data, "<node>\n<interface name=\"org.freedesktop.DBus.Introspectable\">\n <method name=\"Introspect\">\n <arg name=\"data\" direction=\"out\" type=\"s\"/>\n </method>\n</interface>\n<interface name=\"org.freedesktop.DBus.Properties\">\n <method name=\"Get\">\n <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n <arg name=\"propname\" direction=\"in\" type=\"s\"/>\n <arg name=\"value\" direction=\"out\" type=\"v\"/>\n </method>\n <method name=\"Set\">\n <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n <arg name=\"propname\" direction=\"in\" type=\"s\"/>\n <arg name=\"value\" direction=\"in\" type=\"v\"/>\n </method>\n <method name=\"GetAll\">\n <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n <arg name=\"props\" direction=\"out\" type=\"a{sv}\"/>\n </method>\n</interface>\n<interface name=\"org.freedesktop.DBus.Properties\">\n <signal name=\"PropertiesChanged\">\n <arg name=\"source\" type=\"s\"/>\n <arg name=\"changed_properties\" type=\"a{sv}\"/>\n <arg name=\"invalid\" type=\"as\"/>\n </signal>\n</interface>\n");
- dbus_connection_list_registered (connection, g_object_get_data ((GObject *) self, "dbus_object_path"), &children);
- for (i = 0; children[i]; i++) {
- g_string_append_printf (xml_data, "<node name=\"%s\"/>\n", children[i]);
- }
- dbus_free_string_array (children);
- g_string_append (xml_data, "</node>\n");
- dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &xml_data->str);
- g_string_free (xml_data, TRUE);
- if (reply) {
- dbus_connection_send (connection, reply, NULL);
- dbus_message_unref (reply);
- return DBUS_HANDLER_RESULT_HANDLED;
- } else {
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
-}
-
-
-static DBusHandlerResult _dbus_free_desktop_properties_property_get_all (FreeDesktopProperties* self, DBusConnection* connection, DBusMessage* message) {
- DBusMessage* reply;
- DBusMessageIter iter, reply_iter, subiter;
- char* interface_name;
- const char* _tmp0_;
- if (strcmp (dbus_message_get_signature (message), "s")) {
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
- dbus_message_iter_init (message, &iter);
- reply = dbus_message_new_method_return (message);
- dbus_message_iter_init_append (reply, &reply_iter);
- dbus_message_iter_get_basic (&iter, &_tmp0_);
- dbus_message_iter_next (&iter);
- interface_name = g_strdup (_tmp0_);
- if (strcmp (interface_name, "org.freedesktop.DBus.Properties") == 0) {
- dbus_message_iter_open_container (&reply_iter, DBUS_TYPE_ARRAY, "{sv}", &subiter);
- dbus_message_iter_close_container (&reply_iter, &subiter);
- } else {
- dbus_message_unref (reply);
- reply = NULL;
- }
- g_free (interface_name);
- if (reply) {
- dbus_connection_send (connection, reply, NULL);
- dbus_message_unref (reply);
- return DBUS_HANDLER_RESULT_HANDLED;
- } else {
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
-}
-
-
-DBusHandlerResult free_desktop_properties_dbus_message (DBusConnection* connection, DBusMessage* message, void* object) {
- DBusHandlerResult result;
- result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- if (dbus_message_is_method_call (message, "org.freedesktop.DBus.Introspectable", "Introspect")) {
- result = _dbus_free_desktop_properties_introspect (object, connection, message);
- } else if (dbus_message_is_method_call (message, "org.freedesktop.DBus.Properties", "GetAll")) {
- result = _dbus_free_desktop_properties_property_get_all (object, connection, message);
- }
- if (result == DBUS_HANDLER_RESULT_HANDLED) {
- return result;
- } else {
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
-}
-
-
-static void _dbus_free_desktop_properties_properties_changed (GObject* _sender, const gchar* source, GHashTable* changed_properties, gchar** invalid, int invalid_length1, DBusConnection* _connection) {
- const char * _path;
- DBusMessage *_message;
- DBusMessageIter _iter;
- const char* _tmp1_;
- DBusMessageIter _tmp2_, _tmp3_;
- GHashTableIter _tmp4_;
- gpointer _tmp5_, _tmp6_;
- gchar** _tmp21_;
- DBusMessageIter _tmp22_;
- int _tmp23_;
- _path = g_object_get_data (_sender, "dbus_object_path");
- _message = dbus_message_new_signal (_path, "org.freedesktop.DBus.Properties", "PropertiesChanged");
- dbus_message_iter_init_append (_message, &_iter);
- _tmp1_ = source;
- dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp1_);
- dbus_message_iter_open_container (&_iter, DBUS_TYPE_ARRAY, "{sv}", &_tmp2_);
- g_hash_table_iter_init (&_tmp4_, changed_properties);
- while (g_hash_table_iter_next (&_tmp4_, &_tmp5_, &_tmp6_)) {
- gchar* _key;
- GValue* _value;
- const char* _tmp7_;
- DBusMessageIter _tmp8_;
- dbus_message_iter_open_container (&_tmp2_, DBUS_TYPE_DICT_ENTRY, NULL, &_tmp3_);
- _key = (gchar*) _tmp5_;
- _value = (GValue*) _tmp6_;
- _tmp7_ = _key;
- dbus_message_iter_append_basic (&_tmp3_, DBUS_TYPE_STRING, &_tmp7_);
- if (G_VALUE_TYPE (_value) == G_TYPE_UCHAR) {
- guint8 _tmp9_;
- dbus_message_iter_open_container (&_tmp3_, DBUS_TYPE_VARIANT, "y", &_tmp8_);
- _tmp9_ = g_value_get_uchar (_value);
- dbus_message_iter_append_basic (&_tmp8_, DBUS_TYPE_BYTE, &_tmp9_);
- dbus_message_iter_close_container (&_tmp3_, &_tmp8_);
- } else if (G_VALUE_TYPE (_value) == G_TYPE_BOOLEAN) {
- dbus_bool_t _tmp10_;
- dbus_message_iter_open_container (&_tmp3_, DBUS_TYPE_VARIANT, "b", &_tmp8_);
- _tmp10_ = g_value_get_boolean (_value);
- dbus_message_iter_append_basic (&_tmp8_, DBUS_TYPE_BOOLEAN, &_tmp10_);
- dbus_message_iter_close_container (&_tmp3_, &_tmp8_);
- } else if (G_VALUE_TYPE (_value) == G_TYPE_INT) {
- dbus_int32_t _tmp11_;
- dbus_message_iter_open_container (&_tmp3_, DBUS_TYPE_VARIANT, "i", &_tmp8_);
- _tmp11_ = g_value_get_int (_value);
- dbus_message_iter_append_basic (&_tmp8_, DBUS_TYPE_INT32, &_tmp11_);
- dbus_message_iter_close_container (&_tmp3_, &_tmp8_);
- } else if (G_VALUE_TYPE (_value) == G_TYPE_UINT) {
- dbus_uint32_t _tmp12_;
- dbus_message_iter_open_container (&_tmp3_, DBUS_TYPE_VARIANT, "u", &_tmp8_);
- _tmp12_ = g_value_get_uint (_value);
- dbus_message_iter_append_basic (&_tmp8_, DBUS_TYPE_UINT32, &_tmp12_);
- dbus_message_iter_close_container (&_tmp3_, &_tmp8_);
- } else if (G_VALUE_TYPE (_value) == G_TYPE_INT64) {
- dbus_int64_t _tmp13_;
- dbus_message_iter_open_container (&_tmp3_, DBUS_TYPE_VARIANT, "x", &_tmp8_);
- _tmp13_ = g_value_get_int64 (_value);
- dbus_message_iter_append_basic (&_tmp8_, DBUS_TYPE_INT64, &_tmp13_);
- dbus_message_iter_close_container (&_tmp3_, &_tmp8_);
- } else if (G_VALUE_TYPE (_value) == G_TYPE_UINT64) {
- dbus_uint64_t _tmp14_;
- dbus_message_iter_open_container (&_tmp3_, DBUS_TYPE_VARIANT, "t", &_tmp8_);
- _tmp14_ = g_value_get_uint64 (_value);
- dbus_message_iter_append_basic (&_tmp8_, DBUS_TYPE_UINT64, &_tmp14_);
- dbus_message_iter_close_container (&_tmp3_, &_tmp8_);
- } else if (G_VALUE_TYPE (_value) == G_TYPE_DOUBLE) {
- double _tmp15_;
- dbus_message_iter_open_container (&_tmp3_, DBUS_TYPE_VARIANT, "d", &_tmp8_);
- _tmp15_ = g_value_get_double (_value);
- dbus_message_iter_append_basic (&_tmp8_, DBUS_TYPE_DOUBLE, &_tmp15_);
- dbus_message_iter_close_container (&_tmp3_, &_tmp8_);
- } else if (G_VALUE_TYPE (_value) == G_TYPE_STRING) {
- const char* _tmp16_;
- dbus_message_iter_open_container (&_tmp3_, DBUS_TYPE_VARIANT, "s", &_tmp8_);
- _tmp16_ = g_value_get_string (_value);
- dbus_message_iter_append_basic (&_tmp8_, DBUS_TYPE_STRING, &_tmp16_);
- dbus_message_iter_close_container (&_tmp3_, &_tmp8_);
- } else if (G_VALUE_TYPE (_value) == G_TYPE_STRV) {
- const gchar** _tmp17_;
- DBusMessageIter _tmp18_;
- int _tmp19_;
- dbus_message_iter_open_container (&_tmp3_, DBUS_TYPE_VARIANT, "as", &_tmp8_);
- _tmp17_ = g_value_get_boxed (_value);
- dbus_message_iter_open_container (&_tmp8_, DBUS_TYPE_ARRAY, "s", &_tmp18_);
- for (_tmp19_ = 0; _tmp19_ < g_strv_length (g_value_get_boxed (_value)); _tmp19_++) {
- const char* _tmp20_;
- _tmp20_ = *_tmp17_;
- dbus_message_iter_append_basic (&_tmp18_, DBUS_TYPE_STRING, &_tmp20_);
- _tmp17_++;
- }
- dbus_message_iter_close_container (&_tmp8_, &_tmp18_);
- dbus_message_iter_close_container (&_tmp3_, &_tmp8_);
- }
- dbus_message_iter_close_container (&_tmp2_, &_tmp3_);
- }
- dbus_message_iter_close_container (&_iter, &_tmp2_);
- _tmp21_ = invalid;
- dbus_message_iter_open_container (&_iter, DBUS_TYPE_ARRAY, "s", &_tmp22_);
- for (_tmp23_ = 0; _tmp23_ < invalid_length1; _tmp23_++) {
- const char* _tmp24_;
- _tmp24_ = *_tmp21_;
- dbus_message_iter_append_basic (&_tmp22_, DBUS_TYPE_STRING, &_tmp24_);
- _tmp21_++;
- }
- dbus_message_iter_close_container (&_iter, &_tmp22_);
- dbus_connection_send (_connection, _message, NULL);
- dbus_message_unref (_message);
-}
-
-
-void free_desktop_properties_dbus_register_object (DBusConnection* connection, const char* path, void* object) {
- if (!g_object_get_data (object, "dbus_object_path")) {
- g_object_set_data (object, "dbus_object_path", g_strdup (path));
- dbus_connection_register_object_path (connection, path, &_free_desktop_properties_dbus_path_vtable, object);
- g_object_weak_ref (object, _vala_dbus_unregister_object, connection);
- }
- g_signal_connect (object, "properties-changed", (GCallback) _dbus_free_desktop_properties_properties_changed, connection);
-}
-
-
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 ("DBusObjectVTable"), (void*) (&_free_desktop_properties_dbus_vtable));
+ g_type_set_qdata (TYPE_FREE_DESKTOP_PROPERTIES, g_quark_from_static_string ("vala-dbus-register-object"), (void*) free_desktop_properties_register_object);
}
}
@@ -4226,188 +332,69 @@ GType free_desktop_properties_get_type (void) {
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, DBUS_TYPE_G_PROXY);
- g_type_set_qdata (free_desktop_properties_type_id, g_quark_from_string ("ValaDBusInterfaceProxyType"), &free_desktop_properties_dbus_proxy_get_type);
+ 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 (FreeDesktopPropertiesDBusProxy, free_desktop_properties_dbus_proxy, DBUS_TYPE_G_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_FREE_DESKTOP_PROPERTIES, free_desktop_properties_dbus_proxy_free_desktop_properties__interface_init) );
-FreeDesktopProperties* free_desktop_properties_dbus_proxy_new (DBusGConnection* connection, const char* name, const char* path) {
- FreeDesktopProperties* self;
- self = g_object_new (free_desktop_properties_dbus_proxy_get_type (), "connection", connection, "name", name, "path", path, "interface", "org.freedesktop.DBus.Properties", NULL);
- return self;
-}
-
-
-static GObject* free_desktop_properties_dbus_proxy_construct (GType gtype, guint n_properties, GObjectConstructParam* properties) {
- GObject* self;
- DBusGConnection *connection;
- char* path;
- char* filter;
- self = G_OBJECT_CLASS (free_desktop_properties_dbus_proxy_parent_class)->constructor (gtype, n_properties, properties);
- g_object_get (self, "connection", &connection, NULL);
- g_object_get (self, "path", &path, NULL);
- dbus_connection_add_filter (dbus_g_connection_get_connection (connection), free_desktop_properties_dbus_proxy_filter, self, NULL);
- filter = g_strdup_printf ("type='signal',path='%s'", path);
- dbus_bus_add_match (dbus_g_connection_get_connection (connection), filter, NULL);
- dbus_g_connection_unref (connection);
- g_free (path);
- g_free (filter);
- return self;
+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, DBusConnection* connection, DBusMessage* message) {
- DBusMessageIter iter;
+static void _dbus_handle_free_desktop_properties_properties_changed (FreeDesktopProperties* self, GVariant* parameters) {
+ GVariantIter _arguments_iter;
gchar* source = NULL;
- const char* _tmp92_;
+ GVariant* _tmp27_;
GHashTable* changed_properties = NULL;
- GHashTable* _tmp93_;
- DBusMessageIter _tmp94_;
- DBusMessageIter _tmp95_;
+ GVariant* _tmp28_;
+ GHashTable* _tmp29_;
+ GVariantIter _tmp30_;
+ GVariant* _tmp31_;
+ GVariant* _tmp32_;
gchar** invalid = NULL;
int invalid_length1;
- gchar** _tmp114_;
- int _tmp114__length;
- int _tmp114__size;
- int _tmp114__length1;
- DBusMessageIter _tmp115_;
- DBusMessage* reply;
- if (strcmp (dbus_message_get_signature (message), "sa{sv}as")) {
- return;
- }
- dbus_message_iter_init (message, &iter);
- dbus_message_iter_get_basic (&iter, &_tmp92_);
- dbus_message_iter_next (&iter);
- source = g_strdup (_tmp92_);
- _tmp93_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
- dbus_message_iter_recurse (&iter, &_tmp94_);
- while (dbus_message_iter_get_arg_type (&_tmp94_)) {
- gchar* _key;
- GValue* _value;
- const char* _tmp96_;
- GValue _tmp97_ = {0};
- DBusMessageIter _tmp98_;
- dbus_message_iter_recurse (&_tmp94_, &_tmp95_);
- dbus_message_iter_get_basic (&_tmp95_, &_tmp96_);
- dbus_message_iter_next (&_tmp95_);
- _key = g_strdup (_tmp96_);
- dbus_message_iter_recurse (&_tmp95_, &_tmp98_);
- if (dbus_message_iter_get_arg_type (&_tmp98_) == DBUS_TYPE_BYTE) {
- guint8 _tmp99_;
- dbus_message_iter_get_basic (&_tmp98_, &_tmp99_);
- g_value_init (&_tmp97_, G_TYPE_UCHAR);
- g_value_set_uchar (&_tmp97_, _tmp99_);
- } else if (dbus_message_iter_get_arg_type (&_tmp98_) == DBUS_TYPE_BOOLEAN) {
- dbus_bool_t _tmp100_;
- dbus_message_iter_get_basic (&_tmp98_, &_tmp100_);
- g_value_init (&_tmp97_, G_TYPE_BOOLEAN);
- g_value_set_boolean (&_tmp97_, _tmp100_);
- } else if (dbus_message_iter_get_arg_type (&_tmp98_) == DBUS_TYPE_INT16) {
- dbus_int16_t _tmp101_;
- dbus_message_iter_get_basic (&_tmp98_, &_tmp101_);
- g_value_init (&_tmp97_, G_TYPE_INT);
- g_value_set_int (&_tmp97_, _tmp101_);
- } else if (dbus_message_iter_get_arg_type (&_tmp98_) == DBUS_TYPE_UINT16) {
- dbus_uint16_t _tmp102_;
- dbus_message_iter_get_basic (&_tmp98_, &_tmp102_);
- g_value_init (&_tmp97_, G_TYPE_UINT);
- g_value_set_uint (&_tmp97_, _tmp102_);
- } else if (dbus_message_iter_get_arg_type (&_tmp98_) == DBUS_TYPE_INT32) {
- dbus_int32_t _tmp103_;
- dbus_message_iter_get_basic (&_tmp98_, &_tmp103_);
- g_value_init (&_tmp97_, G_TYPE_INT);
- g_value_set_int (&_tmp97_, _tmp103_);
- } else if (dbus_message_iter_get_arg_type (&_tmp98_) == DBUS_TYPE_UINT32) {
- dbus_uint32_t _tmp104_;
- dbus_message_iter_get_basic (&_tmp98_, &_tmp104_);
- g_value_init (&_tmp97_, G_TYPE_UINT);
- g_value_set_uint (&_tmp97_, _tmp104_);
- } else if (dbus_message_iter_get_arg_type (&_tmp98_) == DBUS_TYPE_INT64) {
- dbus_int64_t _tmp105_;
- dbus_message_iter_get_basic (&_tmp98_, &_tmp105_);
- g_value_init (&_tmp97_, G_TYPE_INT64);
- g_value_set_int64 (&_tmp97_, _tmp105_);
- } else if (dbus_message_iter_get_arg_type (&_tmp98_) == DBUS_TYPE_UINT64) {
- dbus_uint64_t _tmp106_;
- dbus_message_iter_get_basic (&_tmp98_, &_tmp106_);
- g_value_init (&_tmp97_, G_TYPE_UINT64);
- g_value_set_uint64 (&_tmp97_, _tmp106_);
- } else if (dbus_message_iter_get_arg_type (&_tmp98_) == DBUS_TYPE_DOUBLE) {
- double _tmp107_;
- dbus_message_iter_get_basic (&_tmp98_, &_tmp107_);
- g_value_init (&_tmp97_, G_TYPE_DOUBLE);
- g_value_set_double (&_tmp97_, _tmp107_);
- } else if (dbus_message_iter_get_arg_type (&_tmp98_) == DBUS_TYPE_STRING) {
- const char* _tmp108_;
- dbus_message_iter_get_basic (&_tmp98_, &_tmp108_);
- g_value_init (&_tmp97_, G_TYPE_STRING);
- g_value_take_string (&_tmp97_, g_strdup (_tmp108_));
- } else if (dbus_message_iter_get_arg_type (&_tmp98_) == DBUS_TYPE_OBJECT_PATH) {
- const char* _tmp109_;
- dbus_message_iter_get_basic (&_tmp98_, &_tmp109_);
- g_value_init (&_tmp97_, G_TYPE_STRING);
- g_value_take_string (&_tmp97_, g_strdup (_tmp109_));
- } else if (dbus_message_iter_get_arg_type (&_tmp98_) == DBUS_TYPE_SIGNATURE) {
- const char* _tmp110_;
- dbus_message_iter_get_basic (&_tmp98_, &_tmp110_);
- g_value_init (&_tmp97_, G_TYPE_STRING);
- g_value_take_string (&_tmp97_, g_strdup (_tmp110_));
- } else if ((dbus_message_iter_get_arg_type (&_tmp98_) == DBUS_TYPE_ARRAY) && (dbus_message_iter_get_element_type (&_tmp98_) == DBUS_TYPE_STRING)) {
- const gchar** _tmp111_;
- int _tmp111__length;
- int _tmp111__size;
- int _tmp111__length1;
- DBusMessageIter _tmp112_;
- _tmp111_ = g_new (const gchar*, 5);
- _tmp111__length = 0;
- _tmp111__size = 4;
- _tmp111__length1 = 0;
- dbus_message_iter_recurse (&_tmp98_, &_tmp112_);
- for (; dbus_message_iter_get_arg_type (&_tmp112_); _tmp111__length1++) {
- const char* _tmp113_;
- if (_tmp111__size == _tmp111__length) {
- _tmp111__size = 2 * _tmp111__size;
- _tmp111_ = g_renew (const gchar*, _tmp111_, _tmp111__size + 1);
- }
- dbus_message_iter_get_basic (&_tmp112_, &_tmp113_);
- dbus_message_iter_next (&_tmp112_);
- _tmp111_[_tmp111__length++] = g_strdup (_tmp113_);
- }
- _tmp111_[_tmp111__length] = NULL;
- g_value_init (&_tmp97_, G_TYPE_STRV);
- g_value_take_boxed (&_tmp97_, _tmp111_);
- }
- dbus_message_iter_next (&_tmp95_);
- _value = g_memdup (&_tmp97_, sizeof (GValue));
- g_hash_table_insert (_tmp93_, _key, _value);
- dbus_message_iter_next (&_tmp94_);
- }
- dbus_message_iter_next (&iter);
- changed_properties = _tmp93_;
+ 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;
- _tmp114_ = g_new (gchar*, 5);
- _tmp114__length = 0;
- _tmp114__size = 4;
- _tmp114__length1 = 0;
- dbus_message_iter_recurse (&iter, &_tmp115_);
- for (; dbus_message_iter_get_arg_type (&_tmp115_); _tmp114__length1++) {
- const char* _tmp116_;
- if (_tmp114__size == _tmp114__length) {
- _tmp114__size = 2 * _tmp114__size;
- _tmp114_ = g_renew (gchar*, _tmp114_, _tmp114__size + 1);
+ _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);
}
- dbus_message_iter_get_basic (&_tmp115_, &_tmp116_);
- dbus_message_iter_next (&_tmp115_);
- _tmp114_[_tmp114__length++] = g_strdup (_tmp116_);
+ _tmp34_[_tmp34__length++] = g_variant_dup_string (_tmp36_, NULL);
+ g_variant_unref (_tmp36_);
}
- invalid_length1 = _tmp114__length1;
- _tmp114_[_tmp114__length] = NULL;
- dbus_message_iter_next (&iter);
- invalid = _tmp114_;
+ 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);
@@ -4415,49 +402,109 @@ static void _dbus_handle_free_desktop_properties_properties_changed (FreeDesktop
}
-DBusHandlerResult free_desktop_properties_dbus_proxy_filter (DBusConnection* connection, DBusMessage* message, void* user_data) {
- if (dbus_message_has_path (message, dbus_g_proxy_get_path (user_data))) {
- if (dbus_message_is_signal (message, "org.freedesktop.DBus.Properties", "PropertiesChanged")) {
- _dbus_handle_free_desktop_properties_properties_changed (user_data, connection, message);
- }
+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);
}
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
-static void free_desktop_properties_dbus_proxy_dispose (GObject* self) {
- DBusGConnection *connection;
- if (((FreeDesktopPropertiesDBusProxy*) self)->disposed) {
- return;
- }
- ((FreeDesktopPropertiesDBusProxy*) self)->disposed = TRUE;
- g_object_get (self, "connection", &connection, NULL);
- dbus_connection_remove_filter (dbus_g_connection_get_connection (connection), free_desktop_properties_dbus_proxy_filter, self);
- G_OBJECT_CLASS (free_desktop_properties_dbus_proxy_parent_class)->dispose (self);
+static void free_desktop_properties_proxy_init (FreeDesktopPropertiesProxy* self) {
}
-static void free_desktop_properties_dbus_proxy_class_init (FreeDesktopPropertiesDBusProxyClass* klass) {
- G_OBJECT_CLASS (klass)->constructor = free_desktop_properties_dbus_proxy_construct;
- G_OBJECT_CLASS (klass)->dispose = free_desktop_properties_dbus_proxy_dispose;
- G_OBJECT_CLASS (klass)->get_property = _vala_free_desktop_properties_dbus_proxy_get_property;
- G_OBJECT_CLASS (klass)->set_property = _vala_free_desktop_properties_dbus_proxy_set_property;
+static void free_desktop_properties_proxy_free_desktop_properties_interface_init (FreeDesktopPropertiesIface* iface) {
}
-static void free_desktop_properties_dbus_proxy_init (FreeDesktopPropertiesDBusProxy* self) {
+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 void free_desktop_properties_dbus_proxy_free_desktop_properties__interface_init (FreeDesktopPropertiesIface* iface) {
+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 void _vala_free_desktop_properties_dbus_proxy_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
+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 _vala_free_desktop_properties_dbus_proxy_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
+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);
}
@@ -4474,19 +521,15 @@ Mpris2Controller* mpris2_controller_new (PlayerController* ctrl) {
}
-static GValue* _g_value_dup (GValue* self) {
- return g_boxed_copy (G_TYPE_VALUE, self);
-}
-
-
-static gpointer __g_value_dup0 (gpointer self) {
- return self ? _g_value_dup (self) : NULL;
+static gpointer _g_variant_ref0 (gpointer self) {
+ return self ? g_variant_ref (self) : NULL;
}
-static void _vala_GValue_free (GValue* self) {
- g_value_unset (self);
- g_free (self);
+static gboolean _mpris2_controller_ensure_correct_playback_status_gsource_func (gpointer self) {
+ gboolean result;
+ result = mpris2_controller_ensure_correct_playback_status (self);
+ return result;
}
@@ -4494,31 +537,31 @@ void mpris2_controller_property_changed_cb (Mpris2Controller* self, const gchar*
const gchar* _tmp0_ = NULL;
gboolean _tmp1_ = FALSE;
gconstpointer _tmp3_ = NULL;
- GValue* _tmp4_;
- GValue* play_v;
+ GVariant* _tmp4_;
+ GVariant* play_v;
gconstpointer _tmp10_ = NULL;
- GValue* _tmp11_;
- GValue* meta_v;
+ GVariant* _tmp11_;
+ GVariant* meta_v;
g_return_if_fail (self != NULL);
g_return_if_fail (interface_source != NULL);
g_return_if_fail (changed_properties != NULL);
- _tmp0_ = player_controller_get_mpris_name (self->priv->_owner);
- g_debug ("mpris2-controller.vala:95: properties-changed for interface %s and own" \
+ _tmp0_ = player_controller_get_dbus_name (self->priv->_owner);
+ g_debug ("mpris2-controller.vala:68: 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_CONTROLLER_root_interface);
+ _tmp2_ = g_str_has_prefix (interface_source, MPRIS2_WATCHER_MPRIS_PREFIX);
_tmp1_ = _tmp2_ == FALSE;
}
if (_tmp1_) {
- g_warning ("mpris2-controller.vala:98: Property-changed hash is null or this is an" \
+ g_warning ("mpris2-controller.vala:71: Property-changed hash is null or this is an" \
" interface that doesn't concerns us");
return;
}
_tmp3_ = g_hash_table_lookup (changed_properties, "PlaybackStatus");
- _tmp4_ = __g_value_dup0 ((GValue*) _tmp3_);
+ _tmp4_ = _g_variant_ref0 ((GVariant*) _tmp3_);
play_v = _tmp4_;
if (play_v != NULL) {
gchar* _tmp5_ = NULL;
@@ -4530,6 +573,7 @@ void mpris2_controller_property_changed_cb (Mpris2Controller* self, const gchar*
TransportMenuitem* _tmp9_;
_tmp5_ = mpris_player_get_PlaybackStatus (self->priv->_player);
state = _tmp5_;
+ g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 200, _mpris2_controller_ensure_correct_playback_status_gsource_func, g_object_ref (self), g_object_unref);
_tmp6_ = mpris2_controller_determine_play_state (self, state);
p = (TransportMenuitemstate) _tmp6_;
_tmp7_ = gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT);
@@ -4539,7 +583,7 @@ void mpris2_controller_property_changed_cb (Mpris2Controller* self, const gchar*
_g_free0 (state);
}
_tmp10_ = g_hash_table_lookup (changed_properties, "Metadata");
- _tmp11_ = __g_value_dup0 ((GValue*) _tmp10_);
+ _tmp11_ = _g_variant_ref0 ((GVariant*) _tmp10_);
meta_v = _tmp11_;
if (meta_v != NULL) {
GHashTable* _tmp12_ = NULL;
@@ -4573,8 +617,64 @@ void mpris2_controller_property_changed_cb (Mpris2Controller* self, const gchar*
_g_object_unref0 (metadata);
_g_hash_table_unref0 (changed_updates);
}
- __vala_GValue_free0 (meta_v);
- __vala_GValue_free0 (play_v);
+ _g_variant_unref0 (meta_v);
+ _g_variant_unref0 (play_v);
+}
+
+
+static gboolean mpris2_controller_ensure_correct_playback_status (Mpris2Controller* self) {
+ gboolean result = FALSE;
+ gchar* _tmp0_ = NULL;
+ gchar* _tmp1_;
+ gchar* _tmp2_ = NULL;
+ gchar* _tmp3_;
+ TransportMenuitemstate _tmp4_;
+ TransportMenuitemstate _tmp5_;
+ TransportMenuitemstate p;
+ gpointer _tmp6_ = NULL;
+ PlayerItem* _tmp7_;
+ TransportMenuitem* _tmp8_;
+ 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_free0 (_tmp1_);
+ _tmp2_ = mpris_player_get_PlaybackStatus (self->priv->_player);
+ _tmp3_ = _tmp2_;
+ _tmp4_ = mpris2_controller_determine_play_state (self, _tmp3_);
+ p = (_tmp5_ = (TransportMenuitemstate) _tmp4_, _g_free0 (_tmp3_), _tmp5_);
+ _tmp6_ = gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT);
+ _tmp8_ = (_tmp7_ = (PlayerItem*) _tmp6_, IS_TRANSPORT_MENUITEM (_tmp7_) ? ((TransportMenuitem*) _tmp7_) : NULL);
+ transport_menuitem_change_play_state (_tmp8_, p);
+ _g_object_unref0 (_tmp8_);
+ result = FALSE;
+ return result;
+}
+
+
+static gchar** _variant_get1 (GVariant* value, int* result_length1) {
+ gchar** _tmp10_;
+ int _tmp10__length;
+ int _tmp10__size;
+ int _tmp10__length1;
+ GVariantIter _tmp11_;
+ GVariant* _tmp12_;
+ _tmp10_ = g_new (gchar*, 5);
+ _tmp10__length = 0;
+ _tmp10__size = 4;
+ _tmp10__length1 = 0;
+ g_variant_iter_init (&_tmp11_, value);
+ for (; _tmp12_ = g_variant_iter_next_value (&_tmp11_); _tmp10__length1++) {
+ if (_tmp10__size == _tmp10__length) {
+ _tmp10__size = 2 * _tmp10__size;
+ _tmp10_ = g_renew (gchar*, _tmp10_, _tmp10__size + 1);
+ }
+ _tmp10_[_tmp10__length++] = g_variant_dup_string (_tmp12_, NULL);
+ g_variant_unref (_tmp12_);
+ }
+ *result_length1 = _tmp10__length1;
+ _tmp10_[_tmp10__length] = NULL;
+ return _tmp10_;
}
@@ -4589,6 +689,21 @@ static gchar** _vala_array_dup1 (gchar** self, int length) {
}
+static GVariant* _variant_new2 (const gchar* value) {
+ return g_variant_ref_sink (g_variant_new_string (value));
+}
+
+
+static const gchar* _variant_get3 (GVariant* value) {
+ return g_variant_dup_string (value, NULL);
+}
+
+
+static GVariant* _variant_new4 (gint64 value) {
+ return g_variant_ref_sink (g_variant_new_int64 (value));
+}
+
+
static GHashTable* mpris2_controller_clean_metadata (Mpris2Controller* self) {
GHashTable* result = NULL;
GHashTable* _tmp0_ = NULL;
@@ -4596,79 +711,80 @@ static GHashTable* mpris2_controller_clean_metadata (Mpris2Controller* self) {
GHashTable* _tmp1_ = NULL;
GHashTable* _tmp2_;
gconstpointer _tmp3_ = NULL;
- GValue* _tmp4_;
- GValue* _tmp5_;
- GValue* artist_v;
- GHashTable* _tmp16_ = NULL;
- GHashTable* _tmp17_;
- gconstpointer _tmp18_ = NULL;
- GValue* _tmp19_;
- GValue* _tmp20_;
- GValue* length_v;
+ GVariant* _tmp4_;
+ GVariant* _tmp5_;
+ GVariant* artist_v;
+ GHashTable* _tmp20_ = NULL;
+ GHashTable* _tmp21_;
+ gconstpointer _tmp22_ = NULL;
+ GVariant* _tmp23_;
+ GVariant* _tmp24_;
+ GVariant* length_v;
g_return_val_if_fail (self != NULL, NULL);
_tmp0_ = mpris_player_get_Metadata (self->priv->_player);
changed_updates = _tmp0_;
_tmp1_ = mpris_player_get_Metadata (self->priv->_player);
_tmp2_ = _tmp1_;
_tmp3_ = g_hash_table_lookup (_tmp2_, "xesam:artist");
- _tmp4_ = __g_value_dup0 ((GValue*) _tmp3_);
+ _tmp4_ = _g_variant_ref0 ((GVariant*) _tmp3_);
artist_v = (_tmp5_ = _tmp4_, _g_hash_table_unref0 (_tmp2_), _tmp5_);
if (artist_v != NULL) {
GHashTable* _tmp6_ = NULL;
GHashTable* _tmp7_;
gconstpointer _tmp8_ = NULL;
- gchar** _tmp9_;
- gchar** _tmp10_;
- gchar** _tmp11_;
+ gint _tmp9_;
+ gchar** _tmp13_;
+ gchar** _tmp14_;
+ gchar** _tmp15_;
gint artists_length1;
gint _artists_size_;
- gchar** _tmp12_;
+ gchar** _tmp16_;
gchar** artists;
- gchar* _tmp13_ = NULL;
+ gchar* _tmp17_ = NULL;
gchar* display_artists;
- gchar* _tmp14_;
- GValue* _tmp15_ = NULL;
+ gchar* _tmp18_;
+ gconstpointer _tmp19_ = NULL;
_tmp6_ = mpris_player_get_Metadata (self->priv->_player);
_tmp7_ = _tmp6_;
_tmp8_ = g_hash_table_lookup (_tmp7_, "xesam:artist");
- _tmp9_ = (_tmp10_ = g_value_get_boxed ((GValue*) _tmp8_), (_tmp10_ == NULL) ? ((gpointer) _tmp10_) : _vala_array_dup1 (_tmp10_, g_strv_length (g_value_get_boxed ((GValue*) _tmp8_))));
- _tmp12_ = (_tmp11_ = _tmp9_, _g_hash_table_unref0 (_tmp7_), _tmp11_);
- artists_length1 = g_strv_length (g_value_get_boxed ((GValue*) _tmp8_));
+ _tmp13_ = (_tmp14_ = _variant_get1 ((GVariant*) _tmp8_, &_tmp9_), (_tmp14_ == NULL) ? ((gpointer) _tmp14_) : _vala_array_dup1 (_tmp14_, _tmp9_));
+ _tmp16_ = (_tmp15_ = _tmp13_, _g_hash_table_unref0 (_tmp7_), _tmp15_);
+ artists_length1 = _tmp9_;
_artists_size_ = artists_length1;
- artists = _tmp12_;
- _tmp13_ = g_strjoinv (", ", artists);
- display_artists = _tmp13_;
- _tmp14_ = g_strdup ("xesam:artist");
- g_hash_table_replace (changed_updates, _tmp14_, (_tmp15_ = g_new0 (GValue, 1), g_value_init (_tmp15_, G_TYPE_STRING), g_value_set_string (_tmp15_, display_artists), _tmp15_));
- g_debug ("mpris2-controller.vala:128: artist : %s", display_artists);
+ artists = _tmp16_;
+ _tmp17_ = g_strjoinv (", ", artists);
+ display_artists = _tmp17_;
+ _tmp18_ = g_strdup ("xesam:artist");
+ g_hash_table_replace (changed_updates, _tmp18_, _variant_new2 (display_artists));
+ _tmp19_ = g_hash_table_lookup (changed_updates, "xesam:artist");
+ g_debug ("mpris2-controller.vala:111: artist : %s", _variant_get3 ((GVariant*) _tmp19_));
_g_free0 (display_artists);
artists = (_vala_array_free (artists, artists_length1, (GDestroyNotify) g_free), NULL);
}
- _tmp16_ = mpris_player_get_Metadata (self->priv->_player);
- _tmp17_ = _tmp16_;
- _tmp18_ = g_hash_table_lookup (_tmp17_, "mpris:length");
- _tmp19_ = __g_value_dup0 ((GValue*) _tmp18_);
- length_v = (_tmp20_ = _tmp19_, _g_hash_table_unref0 (_tmp17_), _tmp20_);
+ _tmp20_ = mpris_player_get_Metadata (self->priv->_player);
+ _tmp21_ = _tmp20_;
+ _tmp22_ = g_hash_table_lookup (_tmp21_, "mpris:length");
+ _tmp23_ = _g_variant_ref0 ((GVariant*) _tmp22_);
+ length_v = (_tmp24_ = _tmp23_, _g_hash_table_unref0 (_tmp21_), _tmp24_);
if (length_v != NULL) {
- GHashTable* _tmp21_ = NULL;
- GHashTable* _tmp22_;
- gconstpointer _tmp23_ = NULL;
- gint64 _tmp24_;
- gint64 _tmp25_;
+ GHashTable* _tmp25_ = NULL;
+ GHashTable* _tmp26_;
+ gconstpointer _tmp27_ = NULL;
+ gint64 _tmp28_;
+ gint64 _tmp29_;
gint64 duration;
- gchar* _tmp26_;
- GValue* _tmp27_ = NULL;
- _tmp21_ = mpris_player_get_Metadata (self->priv->_player);
- _tmp22_ = _tmp21_;
- _tmp23_ = g_hash_table_lookup (_tmp22_, "mpris:length");
- _tmp24_ = g_value_get_int64 ((GValue*) _tmp23_);
- duration = (_tmp25_ = _tmp24_, _g_hash_table_unref0 (_tmp22_), _tmp25_);
- _tmp26_ = g_strdup ("mpris:length");
- g_hash_table_replace (changed_updates, _tmp26_, (_tmp27_ = g_new0 (GValue, 1), g_value_init (_tmp27_, G_TYPE_INT64), g_value_set_int64 (_tmp27_, duration / 1000000), _tmp27_));
+ gchar* _tmp30_;
+ _tmp25_ = mpris_player_get_Metadata (self->priv->_player);
+ _tmp26_ = _tmp25_;
+ _tmp27_ = g_hash_table_lookup (_tmp26_, "mpris:length");
+ _tmp28_ = g_variant_get_int64 ((GVariant*) _tmp27_);
+ duration = (_tmp29_ = _tmp28_, _g_hash_table_unref0 (_tmp26_), _tmp29_);
+ _tmp30_ = g_strdup ("mpris:length");
+ g_hash_table_replace (changed_updates, _tmp30_, _variant_new4 (duration / 1000000));
}
result = changed_updates;
- __vala_GValue_free0 (length_v);
- __vala_GValue_free0 (artist_v);
+ _g_variant_unref0 (length_v);
+ _g_variant_unref0 (artist_v);
return result;
}
@@ -4677,7 +793,6 @@ static TransportMenuitemstate mpris2_controller_determine_play_state (Mpris2Cont
TransportMenuitemstate result = 0;
gboolean _tmp0_ = FALSE;
g_return_val_if_fail (self != NULL, 0);
- g_return_val_if_fail (status != NULL, 0);
if (status != NULL) {
_tmp0_ = g_strcmp0 (status, "Playing") == 0;
} else {
@@ -4697,50 +812,44 @@ void mpris2_controller_initial_update (Mpris2Controller* self) {
gchar* _tmp0_ = NULL;
gchar* _tmp1_;
gboolean _tmp2_;
- gpointer _tmp6_ = NULL;
- PlayerItem* _tmp7_;
- TransportMenuitem* _tmp8_;
- GHashTable* _tmp9_ = NULL;
+ TransportMenuitemstate _tmp3_;
+ gpointer _tmp4_ = NULL;
+ PlayerItem* _tmp5_;
+ TransportMenuitem* _tmp6_;
+ GHashTable* _tmp7_ = NULL;
GHashTable* cleaned_metadata;
- gpointer _tmp10_ = NULL;
- PlayerItem* _tmp11_;
- GeeHashSet* _tmp12_ = NULL;
- GeeHashSet* _tmp13_;
+ gpointer _tmp8_ = NULL;
+ PlayerItem* _tmp9_;
+ GeeHashSet* _tmp10_ = NULL;
+ GeeHashSet* _tmp11_;
g_return_if_fail (self != NULL);
_tmp0_ = mpris_player_get_PlaybackStatus (self->priv->_player);
_tmp1_ = _tmp0_;
if ((_tmp2_ = _tmp1_ == NULL, _g_free0 (_tmp1_), _tmp2_)) {
update = TRANSPORT_MENUITEM_STATE_PAUSED;
- } else {
- gchar* _tmp3_ = NULL;
- gchar* _tmp4_;
- TransportMenuitemstate _tmp5_;
- _tmp3_ = mpris_player_get_PlaybackStatus (self->priv->_player);
- _tmp4_ = _tmp3_;
- _tmp5_ = mpris2_controller_determine_play_state (self, _tmp4_);
- update = _tmp5_;
- _g_free0 (_tmp4_);
}
- _tmp6_ = gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT);
- _tmp8_ = (_tmp7_ = (PlayerItem*) _tmp6_, IS_TRANSPORT_MENUITEM (_tmp7_) ? ((TransportMenuitem*) _tmp7_) : NULL);
- transport_menuitem_change_play_state (_tmp8_, update);
- _g_object_unref0 (_tmp8_);
- _tmp9_ = mpris2_controller_clean_metadata (self);
- cleaned_metadata = _tmp9_;
- _tmp10_ = gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA);
- _tmp11_ = (PlayerItem*) _tmp10_;
- _tmp12_ = metadata_menuitem_attributes_format ();
- _tmp13_ = _tmp12_;
- player_item_update (_tmp11_, cleaned_metadata, _tmp13_);
- _g_object_unref0 (_tmp13_);
+ _tmp3_ = mpris2_controller_determine_play_state (self, NULL);
+ update = _tmp3_;
+ _tmp4_ = gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT);
+ _tmp6_ = (_tmp5_ = (PlayerItem*) _tmp4_, IS_TRANSPORT_MENUITEM (_tmp5_) ? ((TransportMenuitem*) _tmp5_) : NULL);
+ transport_menuitem_change_play_state (_tmp6_, TRANSPORT_MENUITEM_STATE_PAUSED);
+ _g_object_unref0 (_tmp6_);
+ _tmp7_ = mpris2_controller_clean_metadata (self);
+ cleaned_metadata = _tmp7_;
+ _tmp8_ = gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA);
+ _tmp9_ = (PlayerItem*) _tmp8_;
+ _tmp10_ = metadata_menuitem_attributes_format ();
+ _tmp11_ = _tmp10_;
+ player_item_update (_tmp9_, cleaned_metadata, _tmp11_);
_g_object_unref0 (_tmp11_);
+ _g_object_unref0 (_tmp9_);
_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:162: transport_event input = %i", (gint) command);
+ g_debug ("mpris2-controller.vala:145: transport_event input = %i", (gint) command);
if (command == TRANSPORT_MENUITEM_ACTION_PLAY_PAUSE) {
mpris_player_PlayPause (self->priv->_player, NULL, NULL);
} else {
@@ -4769,24 +878,6 @@ gboolean mpris2_controller_connected (Mpris2Controller* self) {
}
-gboolean mpris2_controller_was_successfull (Mpris2Controller* self) {
- gboolean result = FALSE;
- gboolean _tmp0_ = FALSE;
- g_return_val_if_fail (self != NULL, FALSE);
- if (self->priv->_mpris2_root == NULL) {
- _tmp0_ = TRUE;
- } else {
- _tmp0_ = self->priv->_player == NULL;
- }
- if (_tmp0_) {
- result = FALSE;
- return result;
- }
- result = TRUE;
- return result;
-}
-
-
void mpris2_controller_expose (Mpris2Controller* self) {
gboolean _tmp0_;
g_return_if_fail (self != NULL);
@@ -4842,43 +933,43 @@ static void mpris2_controller_set_player (Mpris2Controller* self, MprisPlayer* v
}
-PlayerController* mpris2_controller_get_owner (Mpris2Controller* self) {
- PlayerController* result;
+FreeDesktopProperties* mpris2_controller_get_properties_interface (Mpris2Controller* self) {
+ FreeDesktopProperties* result;
g_return_val_if_fail (self != NULL, NULL);
- result = self->priv->_owner;
+ result = self->priv->_properties_interface;
return result;
}
-static void mpris2_controller_set_owner (Mpris2Controller* self, PlayerController* value) {
- PlayerController* _tmp0_;
- PlayerController* _tmp1_;
+static void mpris2_controller_set_properties_interface (Mpris2Controller* self, FreeDesktopProperties* value) {
+ FreeDesktopProperties* _tmp0_;
+ FreeDesktopProperties* _tmp1_;
g_return_if_fail (self != NULL);
_tmp0_ = _g_object_ref0 (value);
_tmp1_ = _tmp0_;
- _g_object_unref0 (self->priv->_owner);
- self->priv->_owner = _tmp1_;
- g_object_notify ((GObject *) self, "owner");
+ _g_object_unref0 (self->priv->_properties_interface);
+ self->priv->_properties_interface = _tmp1_;
+ g_object_notify ((GObject *) self, "properties-interface");
}
-FreeDesktopProperties* mpris2_controller_get_properties_interface (Mpris2Controller* self) {
- FreeDesktopProperties* result;
+PlayerController* mpris2_controller_get_owner (Mpris2Controller* self) {
+ PlayerController* result;
g_return_val_if_fail (self != NULL, NULL);
- result = self->priv->_properties_interface;
+ result = self->priv->_owner;
return result;
}
-static void mpris2_controller_set_properties_interface (Mpris2Controller* self, FreeDesktopProperties* value) {
- FreeDesktopProperties* _tmp0_;
- FreeDesktopProperties* _tmp1_;
+static void mpris2_controller_set_owner (Mpris2Controller* self, PlayerController* value) {
+ PlayerController* _tmp0_;
+ PlayerController* _tmp1_;
g_return_if_fail (self != NULL);
_tmp0_ = _g_object_ref0 (value);
_tmp1_ = _tmp0_;
- _g_object_unref0 (self->priv->_properties_interface);
- self->priv->_properties_interface = _tmp1_;
- g_object_notify ((GObject *) self, "properties-interface");
+ _g_object_unref0 (self->priv->_owner);
+ self->priv->_owner = _tmp1_;
+ g_object_notify ((GObject *) self, "owner");
}
@@ -4891,104 +982,68 @@ static GObject * mpris2_controller_constructor (GType type, guint n_construct_pr
GObject * obj;
GObjectClass * parent_class;
Mpris2Controller * self;
- DBusGConnection* _tmp0_ = NULL;
- DBusGConnection* connection;
- gchar* _tmp1_ = NULL;
- gchar* _tmp2_;
- const gchar* _tmp3_ = NULL;
- gchar* _tmp4_ = NULL;
- gchar* _tmp5_;
- DBusGProxy* _tmp6_ = NULL;
- gchar* _tmp7_ = NULL;
- gchar* _tmp8_;
- const gchar* _tmp9_ = NULL;
- gchar* _tmp10_ = NULL;
- gchar* _tmp11_;
- MprisRoot* _tmp12_;
- gchar* _tmp13_ = NULL;
- gchar* _tmp14_;
- const gchar* _tmp15_ = NULL;
- gchar* _tmp16_ = NULL;
- gchar* _tmp17_;
- gchar* _tmp18_ = NULL;
- gchar* _tmp19_;
- DBusGProxy* _tmp20_ = NULL;
- gchar* _tmp21_ = NULL;
- gchar* _tmp22_;
- const gchar* _tmp23_ = NULL;
- gchar* _tmp24_ = NULL;
- gchar* _tmp25_;
- MprisPlayer* _tmp26_;
- DBusGProxy* _tmp27_ = NULL;
- FreeDesktopProperties* _tmp28_;
+ const gchar* _tmp0_ = NULL;
+ const gchar* _tmp1_ = NULL;
+ MprisRoot* _tmp2_;
+ MprisRoot* _tmp3_;
+ const gchar* _tmp4_ = NULL;
+ const gchar* _tmp5_ = NULL;
+ MprisPlayer* _tmp6_;
+ MprisPlayer* _tmp7_;
+ FreeDesktopProperties* _tmp8_;
+ FreeDesktopProperties* _tmp9_;
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_ = dbus_g_bus_get (DBUS_BUS_SESSION, &_inner_error_);
- connection = _tmp0_;
+ _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);
if (_inner_error_ != NULL) {
- if (_inner_error_->domain == DBUS_GERROR) {
- goto __catch5_dbus_gerror;
+ if (_inner_error_->domain == 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_ = g_strconcat (MPRIS2_CONTROLLER_root_interface, ".", NULL);
- _tmp2_ = _tmp1_;
- _tmp3_ = player_controller_get_mpris_name (self->priv->_owner);
- _tmp4_ = g_strconcat (_tmp2_, _tmp3_, NULL);
- _tmp5_ = _tmp4_;
- _tmp6_ = dbus_g_proxy_new_for_name (connection, _tmp5_, "/org/mpris/MediaPlayer2", MPRIS2_CONTROLLER_root_interface);
- _tmp7_ = g_strconcat (MPRIS2_CONTROLLER_root_interface, ".", NULL);
- _tmp8_ = _tmp7_;
- _tmp9_ = player_controller_get_mpris_name (self->priv->_owner);
- _tmp10_ = g_strconcat (_tmp8_, _tmp9_, NULL);
- _tmp11_ = _tmp10_;
- _tmp12_ = mpris_root_dbus_proxy_new (connection, _tmp11_, "/org/mpris/MediaPlayer2");
- mpris2_controller_set_mpris2_root (self, _tmp12_);
- _g_object_unref0 (_tmp12_);
- _g_free0 (_tmp11_);
- _g_free0 (_tmp8_);
- _g_free0 (_tmp5_);
- _g_free0 (_tmp2_);
- _tmp13_ = g_strconcat (MPRIS2_CONTROLLER_root_interface, ".", NULL);
- _tmp14_ = _tmp13_;
- _tmp15_ = player_controller_get_mpris_name (self->priv->_owner);
- _tmp16_ = g_strconcat (_tmp14_, _tmp15_, NULL);
- _tmp17_ = _tmp16_;
- _tmp18_ = g_strconcat (MPRIS2_CONTROLLER_root_interface, ".Player", NULL);
- _tmp19_ = _tmp18_;
- _tmp20_ = dbus_g_proxy_new_for_name (connection, _tmp17_, "/org/mpris/MediaPlayer2", _tmp19_);
- _tmp21_ = g_strconcat (MPRIS2_CONTROLLER_root_interface, ".", NULL);
- _tmp22_ = _tmp21_;
- _tmp23_ = player_controller_get_mpris_name (self->priv->_owner);
- _tmp24_ = g_strconcat (_tmp22_, _tmp23_, NULL);
- _tmp25_ = _tmp24_;
- _tmp26_ = mpris_player_dbus_proxy_new (connection, _tmp25_, "/org/mpris/MediaPlayer2");
- mpris2_controller_set_player (self, _tmp26_);
- _g_object_unref0 (_tmp26_);
- _g_free0 (_tmp25_);
- _g_free0 (_tmp22_);
- _g_free0 (_tmp19_);
- _g_free0 (_tmp17_);
- _g_free0 (_tmp14_);
- _tmp27_ = dbus_g_proxy_new_for_name (connection, "org.freedesktop.Properties.PropertiesChanged", "/org/mpris/MediaPlayer2", NULL);
- _tmp28_ = free_desktop_properties_dbus_proxy_new (connection, "org.freedesktop.Properties.PropertiesChanged", "/org/mpris/MediaPlayer2");
- mpris2_controller_set_properties_interface (self, _tmp28_);
- _g_object_unref0 (_tmp28_);
+ _tmp3_ = _tmp2_;
+ mpris2_controller_set_mpris2_root (self, _tmp3_);
+ _g_object_unref0 (_tmp3_);
+ _tmp4_ = player_controller_get_dbus_name (self->priv->_owner);
+ _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);
+ if (_inner_error_ != NULL) {
+ if (_inner_error_->domain == 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_);
+ }
+ _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);
+ if (_inner_error_ != NULL) {
+ if (_inner_error_->domain == 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_);
+ }
+ _tmp9_ = _tmp8_;
+ mpris2_controller_set_properties_interface (self, _tmp9_);
+ _g_object_unref0 (_tmp9_);
g_signal_connect_object (self->priv->_properties_interface, "properties-changed", (GCallback) _mpris2_controller_property_changed_cb_free_desktop_properties_properties_changed, self, 0);
- _dbus_g_connection_unref0 (connection);
- goto __finally5;
- __catch5_dbus_gerror:
+ goto __finally10;
+ __catch10_g_io_error:
{
GError * e;
e = _inner_error_;
_inner_error_ = NULL;
- g_error ("mpris2-controller.vala:89: Problems connecting to the session bus - %s", e->message);
+ g_error ("mpris2-controller.vala:60: Problems connecting to the session bus - %s", e->message);
_g_error_free0 (e);
}
- __finally5:
+ __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_);
@@ -5006,8 +1061,8 @@ 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_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));
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));
}
@@ -5021,8 +1076,8 @@ 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->_owner);
_g_object_unref0 (self->priv->_properties_interface);
+ _g_object_unref0 (self->priv->_owner);
G_OBJECT_CLASS (mpris2_controller_parent_class)->finalize (obj);
}
@@ -5049,12 +1104,12 @@ 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_OWNER:
- g_value_set_object (value, mpris2_controller_get_owner (self));
- break;
case MPRIS2_CONTROLLER_PROPERTIES_INTERFACE:
g_value_set_object (value, mpris2_controller_get_properties_interface (self));
break;
+ case MPRIS2_CONTROLLER_OWNER:
+ g_value_set_object (value, mpris2_controller_get_owner (self));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -5072,12 +1127,12 @@ 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_OWNER:
- mpris2_controller_set_owner (self, g_value_get_object (value));
- break;
case MPRIS2_CONTROLLER_PROPERTIES_INTERFACE:
mpris2_controller_set_properties_interface (self, g_value_get_object (value));
break;
+ case MPRIS2_CONTROLLER_OWNER:
+ mpris2_controller_set_owner (self, g_value_get_object (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala
index f440c13..7f14efe 100644
--- a/src/mpris2-controller.vala
+++ b/src/mpris2-controller.vala
@@ -16,42 +16,12 @@ 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 DBus;
using Dbusmenu;
-[DBus (name = "org.mpris.MediaPlayer2")]
-public interface MprisRoot : DBus.Object {
- // properties
- public abstract bool HasTracklist{owned get; set;}
- public abstract bool CanQuit{owned get; set;}
- public abstract bool CanRaise{owned get; set;}
- public abstract string Identity{owned get; set;}
- public abstract string DesktopEntry{owned get; set;}
- // methods
- public abstract async void Quit() throws DBus.Error;
- public abstract async void Raise() throws DBus.Error;
-}
-
-[DBus (name = "org.mpris.MediaPlayer2.Player")]
-public interface MprisPlayer : DBus.Object {
-
- // properties
- public abstract HashTable<string, Value?> Metadata{owned get; set;}
- public abstract int32 Position{owned get; set;}
- public abstract string PlaybackStatus{owned get; set;}
- // methods
- public abstract async void PlayPause() throws DBus.Error;
- public abstract async void Next() throws DBus.Error;
- public abstract async void Previous() throws DBus.Error;
- // signals
- public signal void Seeked(int64 new_position);
-}
[DBus (name = "org.freedesktop.DBus.Properties")]
-public interface FreeDesktopProperties : DBus.Object{
- // signals
- public signal void PropertiesChanged(string source, HashTable<string,
- Value?> changed_properties,
+ public interface FreeDesktopProperties : Object{
+ public signal void PropertiesChanged(string source, HashTable<string, Variant?> changed_properties,
string[] invalid);
}
@@ -60,137 +30,139 @@ public interface FreeDesktopProperties : DBus.Object{
point in trying to get encorporate both into the same object model.
*/
public class Mpris2Controller : GLib.Object
-{
- public static const string root_interface = "org.mpris.MediaPlayer2" ;
- public MprisRoot mpris2_root {get; construct;}
- public MprisPlayer player {get; construct;}
- public PlayerController owner {get; construct;}
- public FreeDesktopProperties properties_interface {get; construct;}
-
- public Mpris2Controller(PlayerController ctrl)
- {
- GLib.Object(owner: ctrl);
- }
-
- construct{
+{
+ public MprisRoot mpris2_root {get; construct;}
+ public MprisPlayer player {get; construct;}
+ public FreeDesktopProperties properties_interface {get; construct;}
+
+ public PlayerController owner {get; construct;}
+
+ public Mpris2Controller(PlayerController ctrl)
+ {
+ GLib.Object(owner: ctrl);
+ }
+
+ construct{
try {
- var connection = DBus.Bus.get (DBus.BusType.SESSION);
- this.mpris2_root = (MprisRoot) connection.get_object (root_interface.concat(".").concat(this.owner.mpris_name),
- "/org/mpris/MediaPlayer2",
- root_interface);
- this.player = (MprisPlayer) connection.get_object (root_interface.concat(".").concat(this.owner.mpris_name),
- "/org/mpris/MediaPlayer2",
- root_interface.concat(".Player"));
- this.properties_interface = (FreeDesktopProperties) connection.get_object("org.freedesktop.Properties.PropertiesChanged",
- "/org/mpris/MediaPlayer2");
- this.properties_interface.PropertiesChanged += property_changed_cb;
+ this.mpris2_root = Bus.get_proxy_sync ( BusType.SESSION,
+ this.owner.dbus_name,
+ "/org/mpris/MediaPlayer2" );
+ this.player = Bus.get_proxy_sync ( BusType.SESSION,
+ this.owner.dbus_name,
+ "/org/mpris/MediaPlayer2" );
- } catch (DBus.Error e) {
- error("Problems connecting to the session bus - %s", e.message);
- }
- }
-
- public void property_changed_cb(string interface_source, HashTable<string, Value?> changed_properties, string[] invalid )
- {
- debug("properties-changed for interface %s and owner %s", interface_source, this.owner.mpris_name);
-
- if(changed_properties == null || interface_source.has_prefix(this.root_interface) == false ){
- warning("Property-changed hash is null or this is an interface that doesn't concerns us");
- return;
- }
- Value? play_v = changed_properties.lookup("PlaybackStatus");
- if(play_v != null){
- string state = this.player.PlaybackStatus;
- TransportMenuitem.state p = (TransportMenuitem.state)this.determine_play_state(state);
- (this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(p);
- }
-
- Value? meta_v = changed_properties.lookup("Metadata");
- if(meta_v != null){
- GLib.HashTable<string, Value?> changed_updates = clean_metadata();
+ this.properties_interface = Bus.get_proxy_sync ( BusType.SESSION,
+ "org.freedesktop.Properties.PropertiesChanged",
+ "/org/mpris/MediaPlayer2" );
+ this.properties_interface.PropertiesChanged.connect ( property_changed_cb );
+ }
+ catch (IOError e) {
+ error("Problems connecting to the session bus - %s", e.message);
+ }
+ }
+
+ public void property_changed_cb ( string interface_source,
+ HashTable<string, Variant?> changed_properties,
+ string[] invalid )
+ {
+ 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 ){
+ warning("Property-changed hash is null or this is an interface that doesn't concerns us");
+ return;
+ }
+ Variant? play_v = changed_properties.lookup("PlaybackStatus");
+ if(play_v != null){
+ // Race condition sometimes appears with the playback status
+ // 200ms timeout ensures we have the correct playback status at all times.
+ string state = this.player.PlaybackStatus;
+ //debug("in the property update and the playback status = %s and update = %s", state, (string)play_v);
+ Timeout.add ( 200, ensure_correct_playback_status );
+ TransportMenuitem.state p = (TransportMenuitem.state)this.determine_play_state(state);
+ (this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(p);
+ }
+ Variant? meta_v = changed_properties.lookup("Metadata");
+ if(meta_v != null){
+ GLib.HashTable<string, Variant?> changed_updates = clean_metadata();
PlayerItem metadata = this.owner.custom_items[PlayerController.widget_order.METADATA];
- metadata.reset(MetadataMenuitem.attributes_format());
- metadata.update(changed_updates,
- MetadataMenuitem.attributes_format());
- metadata.property_set_bool(MENUITEM_PROP_VISIBLE,
- metadata.populated(MetadataMenuitem.attributes_format()));
+ metadata.reset ( MetadataMenuitem.attributes_format());
+ metadata.update ( changed_updates,
+ MetadataMenuitem.attributes_format());
+ metadata.property_set_bool ( MENUITEM_PROP_VISIBLE,
+ metadata.populated(MetadataMenuitem.attributes_format()));
}
- }
-
- private GLib.HashTable<string, Value?> clean_metadata()
- {
- GLib.HashTable<string, Value?> changed_updates = this.player.Metadata;
- Value? artist_v = this.player.Metadata.lookup("xesam:artist");
+ }
+
+ 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);
+ (this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(p);
+ return false;
+ }
+
+ private GLib.HashTable<string, Variant?>? clean_metadata()
+ {
+ GLib.HashTable<string, Variant?> changed_updates = this.player.Metadata;
+ Variant? artist_v = this.player.Metadata.lookup("xesam:artist");
if(artist_v != null){
- string[] artists = (string[])this.player.Metadata.lookup("xesam:artist");
- string display_artists = string.joinv(", ", artists);
- changed_updates.replace("xesam:artist", display_artists);
- debug("artist : %s", display_artists);
+ string[] artists = (string[])this.player.Metadata.lookup("xesam:artist");
+ string display_artists = string.joinv(", ", artists);
+ changed_updates.replace("xesam:artist", display_artists);
+ debug("artist : %s", (string)changed_updates.lookup("xesam:artist"));
}
- Value? length_v = this.player.Metadata.lookup("mpris:length");
+ Variant? length_v = this.player.Metadata.lookup("mpris:length");
if(length_v != null){
- int64 duration = this.player.Metadata.lookup("mpris:length").get_int64();
- changed_updates.replace("mpris:length", duration/1000000);
+ int64 duration = this.player.Metadata.lookup("mpris:length").get_int64();
+ changed_updates.replace("mpris:length", duration/1000000);
}
- return changed_updates;
- }
-
- private TransportMenuitem.state determine_play_state(string status){
- if(status != null && status == "Playing"){
- return TransportMenuitem.state.PLAYING;
- }
- return TransportMenuitem.state.PAUSED;
- }
-
- public void initial_update()
- {
- TransportMenuitem.state update;
- if(this.player.PlaybackStatus == null){
- update = TransportMenuitem.state.PAUSED;
- }
- else{
- update = determine_play_state(this.player.PlaybackStatus);
- }
- (this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(update);
- GLib.HashTable<string, Value?> cleaned_metadata = this.clean_metadata();
- this.owner.custom_items[PlayerController.widget_order.METADATA].update(cleaned_metadata,
- MetadataMenuitem.attributes_format());
- }
-
- public void transport_update(TransportMenuitem.action command)
- {
- debug("transport_event input = %i", (int)command);
- if(command == TransportMenuitem.action.PLAY_PAUSE){
- this.player.PlayPause.begin();
- }
- else if(command == TransportMenuitem.action.PREVIOUS){
- this.player.Previous.begin();
- }
- else if(command == TransportMenuitem.action.NEXT){
- this.player.Next.begin();
- }
- }
-
- public bool connected()
- {
- return (this.player != null && this.mpris2_root != null);
- }
-
-
- public bool was_successfull(){
- if(this.mpris2_root == null || this.player == null){
- return false;
- }
- return true;
- }
+ return changed_updates;
+ }
- public void expose()
- {
- if(this.connected() == true){
- this.mpris2_root.Raise.begin();
- }
- }
-}
-
+ private TransportMenuitem.state determine_play_state(string? status){
+ if(status != null && status == "Playing"){
+ return TransportMenuitem.state.PLAYING;
+ }
+ return TransportMenuitem.state.PAUSED;
+ }
+
+ public void initial_update()
+ {
+ TransportMenuitem.state update;
+ if(this.player.PlaybackStatus == null){
+ update = TransportMenuitem.state.PAUSED;
+ }
+ update = determine_play_state(null);
+
+ (this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(TransportMenuitem.state.PAUSED);
+ GLib.HashTable<string, Value?>? cleaned_metadata = this.clean_metadata();
+ this.owner.custom_items[PlayerController.widget_order.METADATA].update(cleaned_metadata,
+ MetadataMenuitem.attributes_format());
+ }
+
+ public void transport_update(TransportMenuitem.action command)
+ {
+ debug("transport_event input = %i", (int)command);
+ if(command == TransportMenuitem.action.PLAY_PAUSE){
+ this.player.PlayPause.begin();
+ }
+ else if(command == TransportMenuitem.action.PREVIOUS){
+ this.player.Previous.begin();
+ }
+ else if(command == TransportMenuitem.action.NEXT){
+ this.player.Next.begin();
+ }
+ }
+ public bool connected()
+ {
+ return (this.player != null && this.mpris2_root != null);
+ }
+
+ public void expose()
+ {
+ if(this.connected() == true){
+ this.mpris2_root.Raise.begin();
+ }
+ }
+} \ No newline at end of file
diff --git a/src/mpris2-interfaces.c b/src/mpris2-interfaces.c
new file mode 100644
index 0000000..2755782
--- /dev/null
+++ b/src/mpris2-interfaces.c
@@ -0,0 +1,1518 @@
+/* mpris2-interfaces.c generated by valac 0.11.2, the Vala compiler
+ * generated from mpris2-interfaces.vala, do not modify */
+
+/*
+Copyright 2010 Canonical Ltd.
+
+Authors:
+ Conor Curran <conor.curran@canonical.com>
+
+This program is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 3, as published
+by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranties of
+MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+#define TYPE_MPRIS_ROOT (mpris_root_get_type ())
+#define MPRIS_ROOT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_ROOT, MprisRoot))
+#define IS_MPRIS_ROOT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_ROOT))
+#define MPRIS_ROOT_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_MPRIS_ROOT, MprisRootIface))
+
+typedef struct _MprisRoot MprisRoot;
+typedef struct _MprisRootIface MprisRootIface;
+
+#define TYPE_MPRIS_ROOT_PROXY (mpris_root_proxy_get_type ())
+typedef GDBusProxy MprisRootProxy;
+typedef GDBusProxyClass MprisRootProxyClass;
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+#define TYPE_MPRIS_PLAYER (mpris_player_get_type ())
+#define MPRIS_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_PLAYER, MprisPlayer))
+#define IS_MPRIS_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_PLAYER))
+#define MPRIS_PLAYER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_MPRIS_PLAYER, MprisPlayerIface))
+
+typedef struct _MprisPlayer MprisPlayer;
+typedef struct _MprisPlayerIface MprisPlayerIface;
+
+#define TYPE_MPRIS_PLAYER_PROXY (mpris_player_proxy_get_type ())
+typedef GDBusProxy MprisPlayerProxy;
+typedef GDBusProxyClass MprisPlayerProxyClass;
+#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
+
+struct _MprisRootIface {
+ GTypeInterface parent_iface;
+ void (*Quit) (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+ void (*Quit_finish) (MprisRoot* self, GAsyncResult* _res_, GError** error);
+ void (*Raise) (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+ void (*Raise_finish) (MprisRoot* self, GAsyncResult* _res_, GError** error);
+ gboolean (*get_HasTracklist) (MprisRoot* self);
+ void (*set_HasTracklist) (MprisRoot* self, gboolean value);
+ gboolean (*get_CanQuit) (MprisRoot* self);
+ void (*set_CanQuit) (MprisRoot* self, gboolean value);
+ gboolean (*get_CanRaise) (MprisRoot* self);
+ void (*set_CanRaise) (MprisRoot* self, gboolean value);
+ gchar* (*get_Identity) (MprisRoot* self);
+ void (*set_Identity) (MprisRoot* self, const gchar* value);
+ gchar* (*get_DesktopEntry) (MprisRoot* self);
+ void (*set_DesktopEntry) (MprisRoot* self, const gchar* value);
+};
+
+struct _MprisPlayerIface {
+ GTypeInterface parent_iface;
+ void (*PlayPause) (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+ void (*PlayPause_finish) (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+ void (*Next) (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+ void (*Next_finish) (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+ void (*Previous) (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+ void (*Previous_finish) (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+ GHashTable* (*get_Metadata) (MprisPlayer* self);
+ void (*set_Metadata) (MprisPlayer* self, GHashTable* value);
+ gint32 (*get_Position) (MprisPlayer* self);
+ void (*set_Position) (MprisPlayer* self, gint32 value);
+ gchar* (*get_PlaybackStatus) (MprisPlayer* self);
+ void (*set_PlaybackStatus) (MprisPlayer* self, const gchar* value);
+};
+
+
+
+GType mpris_root_proxy_get_type (void) G_GNUC_CONST;
+guint mpris_root_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
+GType mpris_root_get_type (void) G_GNUC_CONST;
+void mpris_root_Quit (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+void mpris_root_Quit_finish (MprisRoot* self, GAsyncResult* _res_, GError** error);
+void mpris_root_Raise (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+void mpris_root_Raise_finish (MprisRoot* self, GAsyncResult* _res_, GError** error);
+gboolean mpris_root_get_HasTracklist (MprisRoot* self);
+void mpris_root_set_HasTracklist (MprisRoot* self, gboolean value);
+gboolean mpris_root_get_CanQuit (MprisRoot* self);
+void mpris_root_set_CanQuit (MprisRoot* self, gboolean value);
+gboolean mpris_root_get_CanRaise (MprisRoot* self);
+void mpris_root_set_CanRaise (MprisRoot* self, gboolean value);
+gchar* mpris_root_get_Identity (MprisRoot* self);
+void mpris_root_set_Identity (MprisRoot* self, const gchar* value);
+gchar* mpris_root_get_DesktopEntry (MprisRoot* self);
+void mpris_root_set_DesktopEntry (MprisRoot* self, const gchar* value);
+static void mpris_root_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters);
+static void _vala_g_async_ready_callback (GObject *source_object, GAsyncResult *res, void *user_data);
+static void mpris_root_proxy_Quit_async (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+static void mpris_root_proxy_Quit_finish (MprisRoot* self, GAsyncResult* _res_, GError** error);
+static void mpris_root_proxy_Raise_async (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+static void mpris_root_proxy_Raise_finish (MprisRoot* self, GAsyncResult* _res_, GError** error);
+static gboolean mpris_root_dbus_proxy_get_HasTracklist (MprisRoot* self);
+static void mpris_root_dbus_proxy_set_HasTracklist (MprisRoot* self, gboolean value);
+static gboolean mpris_root_dbus_proxy_get_CanQuit (MprisRoot* self);
+static void mpris_root_dbus_proxy_set_CanQuit (MprisRoot* self, gboolean value);
+static gboolean mpris_root_dbus_proxy_get_CanRaise (MprisRoot* self);
+static void mpris_root_dbus_proxy_set_CanRaise (MprisRoot* self, gboolean value);
+static gchar* mpris_root_dbus_proxy_get_Identity (MprisRoot* self);
+static void mpris_root_dbus_proxy_set_Identity (MprisRoot* self, const gchar* value);
+static gchar* mpris_root_dbus_proxy_get_DesktopEntry (MprisRoot* self);
+static void mpris_root_dbus_proxy_set_DesktopEntry (MprisRoot* self, const gchar* value);
+static void mpris_root_proxy_mpris_root_interface_init (MprisRootIface* iface);
+static void _dbus_mpris_root_Quit (MprisRoot* self, GVariant* parameters, GDBusMethodInvocation* invocation);
+static void _dbus_mpris_root_Quit_ready (GObject * source_object, GAsyncResult * _res_, gpointer * _user_data_);
+static void _dbus_mpris_root_Raise (MprisRoot* self, GVariant* parameters, GDBusMethodInvocation* invocation);
+static void _dbus_mpris_root_Raise_ready (GObject * source_object, GAsyncResult * _res_, gpointer * _user_data_);
+static void mpris_root_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data);
+static GVariant* mpris_root_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data);
+static GVariant* _dbus_mpris_root_get_HasTracklist (MprisRoot* self);
+static GVariant* _dbus_mpris_root_get_CanQuit (MprisRoot* self);
+static GVariant* _dbus_mpris_root_get_CanRaise (MprisRoot* self);
+static GVariant* _dbus_mpris_root_get_Identity (MprisRoot* self);
+static GVariant* _dbus_mpris_root_get_DesktopEntry (MprisRoot* self);
+static gboolean mpris_root_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data);
+static void _dbus_mpris_root_set_HasTracklist (MprisRoot* self, GVariant* _value);
+static void _dbus_mpris_root_set_CanQuit (MprisRoot* self, GVariant* _value);
+static void _dbus_mpris_root_set_CanRaise (MprisRoot* self, GVariant* _value);
+static void _dbus_mpris_root_set_Identity (MprisRoot* self, GVariant* _value);
+static void _dbus_mpris_root_set_DesktopEntry (MprisRoot* self, GVariant* _value);
+static void _mpris_root_unregister_object (gpointer user_data);
+GType mpris_player_proxy_get_type (void) G_GNUC_CONST;
+guint mpris_player_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
+GType mpris_player_get_type (void) G_GNUC_CONST;
+void mpris_player_PlayPause (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+void mpris_player_PlayPause_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+void mpris_player_Next (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+void mpris_player_Next_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+void mpris_player_Previous (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+void mpris_player_Previous_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+GHashTable* mpris_player_get_Metadata (MprisPlayer* self);
+void mpris_player_set_Metadata (MprisPlayer* self, GHashTable* value);
+gint32 mpris_player_get_Position (MprisPlayer* self);
+void mpris_player_set_Position (MprisPlayer* self, gint32 value);
+gchar* mpris_player_get_PlaybackStatus (MprisPlayer* self);
+void mpris_player_set_PlaybackStatus (MprisPlayer* self, const gchar* value);
+static void g_cclosure_user_marshal_VOID__INT64 (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data);
+static void mpris_player_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters);
+static void _dbus_handle_mpris_player_seeked (MprisPlayer* self, GVariant* parameters);
+static void mpris_player_proxy_PlayPause_async (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+static void mpris_player_proxy_PlayPause_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+static void mpris_player_proxy_Next_async (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+static void mpris_player_proxy_Next_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+static void mpris_player_proxy_Previous_async (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+static void mpris_player_proxy_Previous_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+static GHashTable* mpris_player_dbus_proxy_get_Metadata (MprisPlayer* self);
+static void mpris_player_dbus_proxy_set_Metadata (MprisPlayer* self, GHashTable* value);
+static gint32 mpris_player_dbus_proxy_get_Position (MprisPlayer* self);
+static void mpris_player_dbus_proxy_set_Position (MprisPlayer* self, gint32 value);
+static gchar* mpris_player_dbus_proxy_get_PlaybackStatus (MprisPlayer* self);
+static void mpris_player_dbus_proxy_set_PlaybackStatus (MprisPlayer* self, const gchar* value);
+static void mpris_player_proxy_mpris_player_interface_init (MprisPlayerIface* iface);
+static void _dbus_mpris_player_PlayPause (MprisPlayer* self, GVariant* parameters, GDBusMethodInvocation* invocation);
+static void _dbus_mpris_player_PlayPause_ready (GObject * source_object, GAsyncResult * _res_, gpointer * _user_data_);
+static void _dbus_mpris_player_Next (MprisPlayer* self, GVariant* parameters, GDBusMethodInvocation* invocation);
+static void _dbus_mpris_player_Next_ready (GObject * source_object, GAsyncResult * _res_, gpointer * _user_data_);
+static void _dbus_mpris_player_Previous (MprisPlayer* self, GVariant* parameters, GDBusMethodInvocation* invocation);
+static void _dbus_mpris_player_Previous_ready (GObject * source_object, GAsyncResult * _res_, gpointer * _user_data_);
+static void mpris_player_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data);
+static GVariant* mpris_player_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data);
+static GVariant* _dbus_mpris_player_get_Metadata (MprisPlayer* self);
+static GVariant* _dbus_mpris_player_get_Position (MprisPlayer* self);
+static GVariant* _dbus_mpris_player_get_PlaybackStatus (MprisPlayer* self);
+static gboolean mpris_player_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data);
+static void _dbus_mpris_player_set_Metadata (MprisPlayer* self, GVariant* _value);
+static void _dbus_mpris_player_set_Position (MprisPlayer* self, GVariant* _value);
+static void _dbus_mpris_player_set_PlaybackStatus (MprisPlayer* self, GVariant* _value);
+static void _dbus_mpris_player_seeked (GObject* _sender, gint64 new_position, gpointer* _data);
+static void _mpris_player_unregister_object (gpointer user_data);
+
+static const GDBusArgInfo * const _mpris_root_dbus_arg_info_Quit_in[] = {NULL};
+static const GDBusArgInfo * const _mpris_root_dbus_arg_info_Quit_out[] = {NULL};
+static const GDBusMethodInfo _mpris_root_dbus_method_info_Quit = {-1, "Quit", (GDBusArgInfo **) (&_mpris_root_dbus_arg_info_Quit_in), (GDBusArgInfo **) (&_mpris_root_dbus_arg_info_Quit_out)};
+static const GDBusArgInfo * const _mpris_root_dbus_arg_info_Raise_in[] = {NULL};
+static const GDBusArgInfo * const _mpris_root_dbus_arg_info_Raise_out[] = {NULL};
+static const GDBusMethodInfo _mpris_root_dbus_method_info_Raise = {-1, "Raise", (GDBusArgInfo **) (&_mpris_root_dbus_arg_info_Raise_in), (GDBusArgInfo **) (&_mpris_root_dbus_arg_info_Raise_out)};
+static const GDBusMethodInfo * const _mpris_root_dbus_method_info[] = {&_mpris_root_dbus_method_info_Quit, &_mpris_root_dbus_method_info_Raise, NULL};
+static const GDBusSignalInfo * const _mpris_root_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo _mpris_root_dbus_property_info_HasTracklist = {-1, "HasTracklist", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE};
+static const GDBusPropertyInfo _mpris_root_dbus_property_info_CanQuit = {-1, "CanQuit", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE};
+static const GDBusPropertyInfo _mpris_root_dbus_property_info_CanRaise = {-1, "CanRaise", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE};
+static const GDBusPropertyInfo _mpris_root_dbus_property_info_Identity = {-1, "Identity", "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE};
+static const GDBusPropertyInfo _mpris_root_dbus_property_info_DesktopEntry = {-1, "DesktopEntry", "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE};
+static const GDBusPropertyInfo * const _mpris_root_dbus_property_info[] = {&_mpris_root_dbus_property_info_HasTracklist, &_mpris_root_dbus_property_info_CanQuit, &_mpris_root_dbus_property_info_CanRaise, &_mpris_root_dbus_property_info_Identity, &_mpris_root_dbus_property_info_DesktopEntry, NULL};
+static const GDBusInterfaceInfo _mpris_root_dbus_interface_info = {-1, "org.mpris.MediaPlayer2", (GDBusMethodInfo **) (&_mpris_root_dbus_method_info), (GDBusSignalInfo **) (&_mpris_root_dbus_signal_info), (GDBusPropertyInfo **) (&_mpris_root_dbus_property_info)};
+static const GDBusInterfaceVTable _mpris_root_dbus_interface_vtable = {mpris_root_dbus_interface_method_call, mpris_root_dbus_interface_get_property, mpris_root_dbus_interface_set_property};
+static const GDBusArgInfo * const _mpris_player_dbus_arg_info_PlayPause_in[] = {NULL};
+static const GDBusArgInfo * const _mpris_player_dbus_arg_info_PlayPause_out[] = {NULL};
+static const GDBusMethodInfo _mpris_player_dbus_method_info_PlayPause = {-1, "PlayPause", (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_PlayPause_in), (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_PlayPause_out)};
+static const GDBusArgInfo * const _mpris_player_dbus_arg_info_Next_in[] = {NULL};
+static const GDBusArgInfo * const _mpris_player_dbus_arg_info_Next_out[] = {NULL};
+static const GDBusMethodInfo _mpris_player_dbus_method_info_Next = {-1, "Next", (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_Next_in), (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_Next_out)};
+static const GDBusArgInfo * const _mpris_player_dbus_arg_info_Previous_in[] = {NULL};
+static const GDBusArgInfo * const _mpris_player_dbus_arg_info_Previous_out[] = {NULL};
+static const GDBusMethodInfo _mpris_player_dbus_method_info_Previous = {-1, "Previous", (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_Previous_in), (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_Previous_out)};
+static const GDBusMethodInfo * const _mpris_player_dbus_method_info[] = {&_mpris_player_dbus_method_info_PlayPause, &_mpris_player_dbus_method_info_Next, &_mpris_player_dbus_method_info_Previous, NULL};
+static const GDBusArgInfo _mpris_player_dbus_arg_info_seeked_new_position = {-1, "new_position", "x"};
+static const GDBusArgInfo * const _mpris_player_dbus_arg_info_seeked[] = {&_mpris_player_dbus_arg_info_seeked_new_position, NULL};
+static const GDBusSignalInfo _mpris_player_dbus_signal_info_seeked = {-1, "Seeked", (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_seeked)};
+static const GDBusSignalInfo * const _mpris_player_dbus_signal_info[] = {&_mpris_player_dbus_signal_info_seeked, NULL};
+static const GDBusPropertyInfo _mpris_player_dbus_property_info_Metadata = {-1, "Metadata", "a{sv}", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE};
+static const GDBusPropertyInfo _mpris_player_dbus_property_info_Position = {-1, "Position", "i", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE};
+static const GDBusPropertyInfo _mpris_player_dbus_property_info_PlaybackStatus = {-1, "PlaybackStatus", "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE};
+static const GDBusPropertyInfo * const _mpris_player_dbus_property_info[] = {&_mpris_player_dbus_property_info_Metadata, &_mpris_player_dbus_property_info_Position, &_mpris_player_dbus_property_info_PlaybackStatus, NULL};
+static const GDBusInterfaceInfo _mpris_player_dbus_interface_info = {-1, "org.mpris.MediaPlayer2.Player", (GDBusMethodInfo **) (&_mpris_player_dbus_method_info), (GDBusSignalInfo **) (&_mpris_player_dbus_signal_info), (GDBusPropertyInfo **) (&_mpris_player_dbus_property_info)};
+static const GDBusInterfaceVTable _mpris_player_dbus_interface_vtable = {mpris_player_dbus_interface_method_call, mpris_player_dbus_interface_get_property, mpris_player_dbus_interface_set_property};
+
+void mpris_root_Quit (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
+ MPRIS_ROOT_GET_INTERFACE (self)->Quit (self, _callback_, _user_data_);
+}
+
+
+void mpris_root_Quit_finish (MprisRoot* self, GAsyncResult* _res_, GError** error) {
+ MPRIS_ROOT_GET_INTERFACE (self)->Quit_finish (self, _res_, error);
+}
+
+
+void mpris_root_Raise (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
+ MPRIS_ROOT_GET_INTERFACE (self)->Raise (self, _callback_, _user_data_);
+}
+
+
+void mpris_root_Raise_finish (MprisRoot* self, GAsyncResult* _res_, GError** error) {
+ MPRIS_ROOT_GET_INTERFACE (self)->Raise_finish (self, _res_, error);
+}
+
+
+gboolean mpris_root_get_HasTracklist (MprisRoot* self) {
+ return MPRIS_ROOT_GET_INTERFACE (self)->get_HasTracklist (self);
+}
+
+
+void mpris_root_set_HasTracklist (MprisRoot* self, gboolean value) {
+ MPRIS_ROOT_GET_INTERFACE (self)->set_HasTracklist (self, value);
+}
+
+
+gboolean mpris_root_get_CanQuit (MprisRoot* self) {
+ return MPRIS_ROOT_GET_INTERFACE (self)->get_CanQuit (self);
+}
+
+
+void mpris_root_set_CanQuit (MprisRoot* self, gboolean value) {
+ MPRIS_ROOT_GET_INTERFACE (self)->set_CanQuit (self, value);
+}
+
+
+gboolean mpris_root_get_CanRaise (MprisRoot* self) {
+ return MPRIS_ROOT_GET_INTERFACE (self)->get_CanRaise (self);
+}
+
+
+void mpris_root_set_CanRaise (MprisRoot* self, gboolean value) {
+ MPRIS_ROOT_GET_INTERFACE (self)->set_CanRaise (self, value);
+}
+
+
+gchar* mpris_root_get_Identity (MprisRoot* self) {
+ return MPRIS_ROOT_GET_INTERFACE (self)->get_Identity (self);
+}
+
+
+void mpris_root_set_Identity (MprisRoot* self, const gchar* value) {
+ MPRIS_ROOT_GET_INTERFACE (self)->set_Identity (self, value);
+}
+
+
+gchar* mpris_root_get_DesktopEntry (MprisRoot* self) {
+ return MPRIS_ROOT_GET_INTERFACE (self)->get_DesktopEntry (self);
+}
+
+
+void mpris_root_set_DesktopEntry (MprisRoot* self, const gchar* value) {
+ MPRIS_ROOT_GET_INTERFACE (self)->set_DesktopEntry (self, value);
+}
+
+
+static void mpris_root_base_init (MprisRootIface * iface) {
+ static gboolean initialized = FALSE;
+ if (!initialized) {
+ initialized = TRUE;
+ g_object_interface_install_property (iface, g_param_spec_boolean ("HasTracklist", "HasTracklist", "HasTracklist", FALSE, 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_boolean ("CanQuit", "CanQuit", "CanQuit", FALSE, 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_boolean ("CanRaise", "CanRaise", "CanRaise", FALSE, 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_string ("Identity", "Identity", "Identity", NULL, 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_string ("DesktopEntry", "DesktopEntry", "DesktopEntry", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
+ g_type_set_qdata (TYPE_MPRIS_ROOT, g_quark_from_static_string ("vala-dbus-register-object"), (void*) mpris_root_register_object);
+ }
+}
+
+
+GType mpris_root_get_type (void) {
+ static volatile gsize mpris_root_type_id__volatile = 0;
+ if (g_once_init_enter (&mpris_root_type_id__volatile)) {
+ static const GTypeInfo g_define_type_info = { sizeof (MprisRootIface), (GBaseInitFunc) mpris_root_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
+ GType mpris_root_type_id;
+ mpris_root_type_id = g_type_register_static (G_TYPE_INTERFACE, "MprisRoot", &g_define_type_info, 0);
+ g_type_interface_add_prerequisite (mpris_root_type_id, G_TYPE_OBJECT);
+ g_once_init_leave (&mpris_root_type_id__volatile, mpris_root_type_id);
+ }
+ return mpris_root_type_id__volatile;
+}
+
+
+G_DEFINE_TYPE_EXTENDED (MprisRootProxy, mpris_root_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_MPRIS_ROOT, mpris_root_proxy_mpris_root_interface_init) );
+static void mpris_root_proxy_class_init (MprisRootProxyClass* klass) {
+ G_DBUS_PROXY_CLASS (klass)->g_signal = mpris_root_proxy_g_signal;
+}
+
+
+static void mpris_root_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters) {
+}
+
+
+static void mpris_root_proxy_init (MprisRootProxy* self) {
+}
+
+
+static void _vala_g_async_ready_callback (GObject *source_object, GAsyncResult *res, void *user_data) {
+ g_simple_async_result_set_op_res_gpointer (user_data, g_object_ref (res), g_object_unref);
+ g_simple_async_result_complete (user_data);
+ g_object_unref (user_data);
+}
+
+
+static void mpris_root_proxy_Quit_async (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
+ GDBusMessage *_message;
+ GVariant *_arguments;
+ GVariantBuilder _arguments_builder;
+ G_IO_ERROR;
+ _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.mpris.MediaPlayer2", "Quit");
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ g_dbus_message_set_body (_message, _arguments);
+ g_dbus_connection_send_message_with_reply (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, _vala_g_async_ready_callback, g_simple_async_result_new (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);
+ if (!_reply_message) {
+ return;
+ }
+ if (g_dbus_message_to_gerror (_reply_message, error)) {
+ g_object_unref (_reply_message);
+ return;
+ }
+ g_object_unref (_reply_message);
+}
+
+
+static void mpris_root_proxy_Raise_async (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
+ GDBusMessage *_message;
+ GVariant *_arguments;
+ GVariantBuilder _arguments_builder;
+ G_IO_ERROR;
+ _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.mpris.MediaPlayer2", "Raise");
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ g_dbus_message_set_body (_message, _arguments);
+ g_dbus_connection_send_message_with_reply (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, _vala_g_async_ready_callback, g_simple_async_result_new (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);
+ if (!_reply_message) {
+ return;
+ }
+ if (g_dbus_message_to_gerror (_reply_message, error)) {
+ g_object_unref (_reply_message);
+ return;
+ }
+ g_object_unref (_reply_message);
+}
+
+
+static gboolean mpris_root_dbus_proxy_get_HasTracklist (MprisRoot* self) {
+ GVariant *_inner_reply;
+ gboolean _result;
+ _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "HasTracklist");
+ if (!_inner_reply) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("HasTracklist"));
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return FALSE;
+ }
+ g_variant_get (_reply, "(v)", &_inner_reply);
+ g_variant_unref (_reply);
+ }
+ _result = g_variant_get_boolean (_inner_reply);
+ g_variant_unref (_inner_reply);
+ return _result;
+}
+
+
+static void mpris_root_dbus_proxy_set_HasTracklist (MprisRoot* self, gboolean value) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("HasTracklist"));
+ g_variant_builder_open (&_arguments_builder, G_VARIANT_TYPE_VARIANT);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_boolean (value));
+ g_variant_builder_close (&_arguments_builder);
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Set", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return;
+ }
+ g_variant_unref (_reply);
+}
+
+
+static gboolean mpris_root_dbus_proxy_get_CanQuit (MprisRoot* self) {
+ GVariant *_inner_reply;
+ gboolean _result;
+ _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "CanQuit");
+ if (!_inner_reply) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("CanQuit"));
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return FALSE;
+ }
+ g_variant_get (_reply, "(v)", &_inner_reply);
+ g_variant_unref (_reply);
+ }
+ _result = g_variant_get_boolean (_inner_reply);
+ g_variant_unref (_inner_reply);
+ return _result;
+}
+
+
+static void mpris_root_dbus_proxy_set_CanQuit (MprisRoot* self, gboolean value) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("CanQuit"));
+ g_variant_builder_open (&_arguments_builder, G_VARIANT_TYPE_VARIANT);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_boolean (value));
+ g_variant_builder_close (&_arguments_builder);
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Set", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return;
+ }
+ g_variant_unref (_reply);
+}
+
+
+static gboolean mpris_root_dbus_proxy_get_CanRaise (MprisRoot* self) {
+ GVariant *_inner_reply;
+ gboolean _result;
+ _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "CanRaise");
+ if (!_inner_reply) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("CanRaise"));
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return FALSE;
+ }
+ g_variant_get (_reply, "(v)", &_inner_reply);
+ g_variant_unref (_reply);
+ }
+ _result = g_variant_get_boolean (_inner_reply);
+ g_variant_unref (_inner_reply);
+ return _result;
+}
+
+
+static void mpris_root_dbus_proxy_set_CanRaise (MprisRoot* self, gboolean value) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("CanRaise"));
+ g_variant_builder_open (&_arguments_builder, G_VARIANT_TYPE_VARIANT);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_boolean (value));
+ g_variant_builder_close (&_arguments_builder);
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Set", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return;
+ }
+ g_variant_unref (_reply);
+}
+
+
+static gchar* mpris_root_dbus_proxy_get_Identity (MprisRoot* self) {
+ GVariant *_inner_reply;
+ gchar* _result;
+ _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "Identity");
+ if (!_inner_reply) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("Identity"));
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return NULL;
+ }
+ g_variant_get (_reply, "(v)", &_inner_reply);
+ g_variant_unref (_reply);
+ }
+ _result = g_variant_dup_string (_inner_reply, NULL);
+ g_variant_unref (_inner_reply);
+ return _result;
+}
+
+
+static void mpris_root_dbus_proxy_set_Identity (MprisRoot* self, const gchar* value) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("Identity"));
+ g_variant_builder_open (&_arguments_builder, G_VARIANT_TYPE_VARIANT);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (value));
+ g_variant_builder_close (&_arguments_builder);
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Set", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return;
+ }
+ g_variant_unref (_reply);
+}
+
+
+static gchar* mpris_root_dbus_proxy_get_DesktopEntry (MprisRoot* self) {
+ GVariant *_inner_reply;
+ gchar* _result;
+ _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "DesktopEntry");
+ if (!_inner_reply) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("DesktopEntry"));
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return NULL;
+ }
+ g_variant_get (_reply, "(v)", &_inner_reply);
+ g_variant_unref (_reply);
+ }
+ _result = g_variant_dup_string (_inner_reply, NULL);
+ g_variant_unref (_inner_reply);
+ return _result;
+}
+
+
+static void mpris_root_dbus_proxy_set_DesktopEntry (MprisRoot* self, const gchar* value) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("DesktopEntry"));
+ g_variant_builder_open (&_arguments_builder, G_VARIANT_TYPE_VARIANT);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (value));
+ g_variant_builder_close (&_arguments_builder);
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Set", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return;
+ }
+ g_variant_unref (_reply);
+}
+
+
+static void mpris_root_proxy_mpris_root_interface_init (MprisRootIface* iface) {
+ iface->Quit = mpris_root_proxy_Quit_async;
+ iface->Quit_finish = mpris_root_proxy_Quit_finish;
+ iface->Raise = mpris_root_proxy_Raise_async;
+ iface->Raise_finish = mpris_root_proxy_Raise_finish;
+ iface->get_HasTracklist = mpris_root_dbus_proxy_get_HasTracklist;
+ iface->set_HasTracklist = mpris_root_dbus_proxy_set_HasTracklist;
+ iface->get_CanQuit = mpris_root_dbus_proxy_get_CanQuit;
+ iface->set_CanQuit = mpris_root_dbus_proxy_set_CanQuit;
+ iface->get_CanRaise = mpris_root_dbus_proxy_get_CanRaise;
+ iface->set_CanRaise = mpris_root_dbus_proxy_set_CanRaise;
+ iface->get_Identity = mpris_root_dbus_proxy_get_Identity;
+ iface->set_Identity = mpris_root_dbus_proxy_set_Identity;
+ iface->get_DesktopEntry = mpris_root_dbus_proxy_get_DesktopEntry;
+ iface->set_DesktopEntry = mpris_root_dbus_proxy_set_DesktopEntry;
+}
+
+
+static void _dbus_mpris_root_Quit (MprisRoot* self, GVariant* parameters, GDBusMethodInvocation* invocation) {
+ GVariantIter _arguments_iter;
+ g_variant_iter_init (&_arguments_iter, parameters);
+ mpris_root_Quit (self, (GAsyncReadyCallback) _dbus_mpris_root_Quit_ready, g_object_ref (invocation));
+}
+
+
+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;
+ invocation = _user_data_;
+ error = NULL;
+ mpris_root_Quit_finish ((MprisRoot*) 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 _dbus_mpris_root_Raise (MprisRoot* self, GVariant* parameters, GDBusMethodInvocation* invocation) {
+ GVariantIter _arguments_iter;
+ g_variant_iter_init (&_arguments_iter, parameters);
+ mpris_root_Raise (self, (GAsyncReadyCallback) _dbus_mpris_root_Raise_ready, g_object_ref (invocation));
+}
+
+
+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;
+ invocation = _user_data_;
+ error = NULL;
+ mpris_root_Raise_finish ((MprisRoot*) 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 mpris_root_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data) {
+ gpointer* data;
+ gpointer object;
+ data = user_data;
+ object = data[0];
+ if (strcmp (method_name, "Quit") == 0) {
+ _dbus_mpris_root_Quit (object, parameters, invocation);
+ } else if (strcmp (method_name, "Raise") == 0) {
+ _dbus_mpris_root_Raise (object, parameters, invocation);
+ }
+ g_object_unref (invocation);
+}
+
+
+static GVariant* _dbus_mpris_root_get_HasTracklist (MprisRoot* self) {
+ gboolean result;
+ GVariant* _reply;
+ result = mpris_root_get_HasTracklist (self);
+ _reply = g_variant_new_boolean (result);
+ return _reply;
+}
+
+
+static GVariant* _dbus_mpris_root_get_CanQuit (MprisRoot* self) {
+ gboolean result;
+ GVariant* _reply;
+ result = mpris_root_get_CanQuit (self);
+ _reply = g_variant_new_boolean (result);
+ return _reply;
+}
+
+
+static GVariant* _dbus_mpris_root_get_CanRaise (MprisRoot* self) {
+ gboolean result;
+ GVariant* _reply;
+ result = mpris_root_get_CanRaise (self);
+ _reply = g_variant_new_boolean (result);
+ return _reply;
+}
+
+
+static GVariant* _dbus_mpris_root_get_Identity (MprisRoot* self) {
+ gchar* result;
+ GVariant* _reply;
+ result = mpris_root_get_Identity (self);
+ _reply = g_variant_new_string (result);
+ _g_free0 (result);
+ return _reply;
+}
+
+
+static GVariant* _dbus_mpris_root_get_DesktopEntry (MprisRoot* self) {
+ gchar* result;
+ GVariant* _reply;
+ result = mpris_root_get_DesktopEntry (self);
+ _reply = g_variant_new_string (result);
+ _g_free0 (result);
+ return _reply;
+}
+
+
+static GVariant* mpris_root_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data) {
+ gpointer* data;
+ gpointer object;
+ data = user_data;
+ object = data[0];
+ if (strcmp (property_name, "HasTracklist") == 0) {
+ return _dbus_mpris_root_get_HasTracklist (object);
+ } else if (strcmp (property_name, "CanQuit") == 0) {
+ return _dbus_mpris_root_get_CanQuit (object);
+ } else if (strcmp (property_name, "CanRaise") == 0) {
+ return _dbus_mpris_root_get_CanRaise (object);
+ } else if (strcmp (property_name, "Identity") == 0) {
+ return _dbus_mpris_root_get_Identity (object);
+ } else if (strcmp (property_name, "DesktopEntry") == 0) {
+ return _dbus_mpris_root_get_DesktopEntry (object);
+ }
+ return NULL;
+}
+
+
+static void _dbus_mpris_root_set_HasTracklist (MprisRoot* self, GVariant* _value) {
+ gboolean value = FALSE;
+ value = g_variant_get_boolean (_value);
+ mpris_root_set_HasTracklist (self, value);
+}
+
+
+static void _dbus_mpris_root_set_CanQuit (MprisRoot* self, GVariant* _value) {
+ gboolean value = FALSE;
+ value = g_variant_get_boolean (_value);
+ mpris_root_set_CanQuit (self, value);
+}
+
+
+static void _dbus_mpris_root_set_CanRaise (MprisRoot* self, GVariant* _value) {
+ gboolean value = FALSE;
+ value = g_variant_get_boolean (_value);
+ mpris_root_set_CanRaise (self, value);
+}
+
+
+static void _dbus_mpris_root_set_Identity (MprisRoot* self, GVariant* _value) {
+ gchar* value = NULL;
+ value = g_variant_dup_string (_value, NULL);
+ mpris_root_set_Identity (self, value);
+ _g_free0 (value);
+}
+
+
+static void _dbus_mpris_root_set_DesktopEntry (MprisRoot* self, GVariant* _value) {
+ gchar* value = NULL;
+ value = g_variant_dup_string (_value, NULL);
+ mpris_root_set_DesktopEntry (self, value);
+ _g_free0 (value);
+}
+
+
+static gboolean mpris_root_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data) {
+ gpointer* data;
+ gpointer object;
+ data = user_data;
+ object = data[0];
+ if (strcmp (property_name, "HasTracklist") == 0) {
+ _dbus_mpris_root_set_HasTracklist (object, value);
+ return TRUE;
+ } else if (strcmp (property_name, "CanQuit") == 0) {
+ _dbus_mpris_root_set_CanQuit (object, value);
+ return TRUE;
+ } else if (strcmp (property_name, "CanRaise") == 0) {
+ _dbus_mpris_root_set_CanRaise (object, value);
+ return TRUE;
+ } else if (strcmp (property_name, "Identity") == 0) {
+ _dbus_mpris_root_set_Identity (object, value);
+ return TRUE;
+ } else if (strcmp (property_name, "DesktopEntry") == 0) {
+ _dbus_mpris_root_set_DesktopEntry (object, value);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+guint mpris_root_register_object (gpointer object, GDBusConnection* connection, const gchar* path, GError** error) {
+ guint result;
+ gpointer *data;
+ data = g_new (gpointer, 3);
+ data[0] = g_object_ref (object);
+ data[1] = g_object_ref (connection);
+ data[2] = g_strdup (path);
+ result = g_dbus_connection_register_object (connection, path, &_mpris_root_dbus_interface_info, &_mpris_root_dbus_interface_vtable, data, _mpris_root_unregister_object, error);
+ if (!result) {
+ return 0;
+ }
+ return result;
+}
+
+
+static void _mpris_root_unregister_object (gpointer user_data) {
+ gpointer* data;
+ data = user_data;
+ g_object_unref (data[0]);
+ g_object_unref (data[1]);
+ g_free (data[2]);
+ g_free (data);
+}
+
+
+void mpris_player_PlayPause (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
+ MPRIS_PLAYER_GET_INTERFACE (self)->PlayPause (self, _callback_, _user_data_);
+}
+
+
+void mpris_player_PlayPause_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error) {
+ MPRIS_PLAYER_GET_INTERFACE (self)->PlayPause_finish (self, _res_, error);
+}
+
+
+void mpris_player_Next (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
+ MPRIS_PLAYER_GET_INTERFACE (self)->Next (self, _callback_, _user_data_);
+}
+
+
+void mpris_player_Next_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error) {
+ MPRIS_PLAYER_GET_INTERFACE (self)->Next_finish (self, _res_, error);
+}
+
+
+void mpris_player_Previous (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
+ MPRIS_PLAYER_GET_INTERFACE (self)->Previous (self, _callback_, _user_data_);
+}
+
+
+void mpris_player_Previous_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error) {
+ MPRIS_PLAYER_GET_INTERFACE (self)->Previous_finish (self, _res_, error);
+}
+
+
+GHashTable* mpris_player_get_Metadata (MprisPlayer* self) {
+ return MPRIS_PLAYER_GET_INTERFACE (self)->get_Metadata (self);
+}
+
+
+void mpris_player_set_Metadata (MprisPlayer* self, GHashTable* value) {
+ MPRIS_PLAYER_GET_INTERFACE (self)->set_Metadata (self, value);
+}
+
+
+gint32 mpris_player_get_Position (MprisPlayer* self) {
+ return MPRIS_PLAYER_GET_INTERFACE (self)->get_Position (self);
+}
+
+
+void mpris_player_set_Position (MprisPlayer* self, gint32 value) {
+ MPRIS_PLAYER_GET_INTERFACE (self)->set_Position (self, value);
+}
+
+
+gchar* mpris_player_get_PlaybackStatus (MprisPlayer* self) {
+ return MPRIS_PLAYER_GET_INTERFACE (self)->get_PlaybackStatus (self);
+}
+
+
+void mpris_player_set_PlaybackStatus (MprisPlayer* self, const gchar* value) {
+ MPRIS_PLAYER_GET_INTERFACE (self)->set_PlaybackStatus (self, value);
+}
+
+
+static void g_cclosure_user_marshal_VOID__INT64 (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data) {
+ typedef void (*GMarshalFunc_VOID__INT64) (gpointer data1, gint64 arg_1, gpointer data2);
+ register GMarshalFunc_VOID__INT64 callback;
+ register GCClosure * cc;
+ register gpointer data1, data2;
+ cc = (GCClosure *) closure;
+ g_return_if_fail (n_param_values == 2);
+ if (G_CCLOSURE_SWAP_DATA (closure)) {
+ data1 = closure->data;
+ data2 = param_values->data[0].v_pointer;
+ } else {
+ data1 = param_values->data[0].v_pointer;
+ data2 = closure->data;
+ }
+ callback = (GMarshalFunc_VOID__INT64) (marshal_data ? marshal_data : cc->callback);
+ callback (data1, g_value_get_int64 (param_values + 1), data2);
+}
+
+
+static void mpris_player_base_init (MprisPlayerIface * iface) {
+ static gboolean initialized = FALSE;
+ if (!initialized) {
+ initialized = TRUE;
+ g_object_interface_install_property (iface, g_param_spec_boxed ("Metadata", "Metadata", "Metadata", G_TYPE_HASH_TABLE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
+ g_object_interface_install_property (iface, g_param_spec_int ("Position", "Position", "Position", G_MININT, G_MAXINT, 0, 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_string ("PlaybackStatus", "PlaybackStatus", "PlaybackStatus", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
+ g_signal_new ("seeked", TYPE_MPRIS_PLAYER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__INT64, G_TYPE_NONE, 1, G_TYPE_INT64);
+ g_type_set_qdata (TYPE_MPRIS_PLAYER, g_quark_from_static_string ("vala-dbus-register-object"), (void*) mpris_player_register_object);
+ }
+}
+
+
+GType mpris_player_get_type (void) {
+ static volatile gsize mpris_player_type_id__volatile = 0;
+ if (g_once_init_enter (&mpris_player_type_id__volatile)) {
+ static const GTypeInfo g_define_type_info = { sizeof (MprisPlayerIface), (GBaseInitFunc) mpris_player_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
+ GType mpris_player_type_id;
+ mpris_player_type_id = g_type_register_static (G_TYPE_INTERFACE, "MprisPlayer", &g_define_type_info, 0);
+ g_type_interface_add_prerequisite (mpris_player_type_id, G_TYPE_OBJECT);
+ g_once_init_leave (&mpris_player_type_id__volatile, mpris_player_type_id);
+ }
+ return mpris_player_type_id__volatile;
+}
+
+
+G_DEFINE_TYPE_EXTENDED (MprisPlayerProxy, mpris_player_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_MPRIS_PLAYER, mpris_player_proxy_mpris_player_interface_init) );
+static void mpris_player_proxy_class_init (MprisPlayerProxyClass* klass) {
+ G_DBUS_PROXY_CLASS (klass)->g_signal = mpris_player_proxy_g_signal;
+}
+
+
+static void _dbus_handle_mpris_player_seeked (MprisPlayer* self, GVariant* parameters) {
+ GVariantIter _arguments_iter;
+ gint64 new_position = 0LL;
+ GVariant* _tmp0_;
+ g_variant_iter_init (&_arguments_iter, parameters);
+ _tmp0_ = g_variant_iter_next_value (&_arguments_iter);
+ new_position = g_variant_get_int64 (_tmp0_);
+ g_variant_unref (_tmp0_);
+ g_signal_emit_by_name (self, "seeked", new_position);
+}
+
+
+static void mpris_player_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters) {
+ if (strcmp (signal_name, "Seeked") == 0) {
+ _dbus_handle_mpris_player_seeked (proxy, parameters);
+ }
+}
+
+
+static void mpris_player_proxy_init (MprisPlayerProxy* self) {
+}
+
+
+static void mpris_player_proxy_PlayPause_async (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
+ GDBusMessage *_message;
+ GVariant *_arguments;
+ GVariantBuilder _arguments_builder;
+ G_IO_ERROR;
+ _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.mpris.MediaPlayer2.Player", "PlayPause");
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ g_dbus_message_set_body (_message, _arguments);
+ g_dbus_connection_send_message_with_reply (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, _vala_g_async_ready_callback, g_simple_async_result_new (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);
+ if (!_reply_message) {
+ return;
+ }
+ if (g_dbus_message_to_gerror (_reply_message, error)) {
+ g_object_unref (_reply_message);
+ return;
+ }
+ g_object_unref (_reply_message);
+}
+
+
+static void mpris_player_proxy_Next_async (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
+ GDBusMessage *_message;
+ GVariant *_arguments;
+ GVariantBuilder _arguments_builder;
+ G_IO_ERROR;
+ _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.mpris.MediaPlayer2.Player", "Next");
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ g_dbus_message_set_body (_message, _arguments);
+ g_dbus_connection_send_message_with_reply (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, _vala_g_async_ready_callback, g_simple_async_result_new (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);
+ if (!_reply_message) {
+ return;
+ }
+ if (g_dbus_message_to_gerror (_reply_message, error)) {
+ g_object_unref (_reply_message);
+ return;
+ }
+ g_object_unref (_reply_message);
+}
+
+
+static void mpris_player_proxy_Previous_async (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
+ GDBusMessage *_message;
+ GVariant *_arguments;
+ GVariantBuilder _arguments_builder;
+ G_IO_ERROR;
+ _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.mpris.MediaPlayer2.Player", "Previous");
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ g_dbus_message_set_body (_message, _arguments);
+ g_dbus_connection_send_message_with_reply (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, _vala_g_async_ready_callback, g_simple_async_result_new (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);
+ if (!_reply_message) {
+ return;
+ }
+ if (g_dbus_message_to_gerror (_reply_message, error)) {
+ g_object_unref (_reply_message);
+ return;
+ }
+ g_object_unref (_reply_message);
+}
+
+
+static GHashTable* mpris_player_dbus_proxy_get_Metadata (MprisPlayer* self) {
+ GVariant *_inner_reply;
+ GHashTable* _result;
+ GHashTable* _tmp1_;
+ GVariantIter _tmp2_;
+ GVariant* _tmp3_;
+ GVariant* _tmp4_;
+ _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "Metadata");
+ if (!_inner_reply) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2.Player"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("Metadata"));
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return NULL;
+ }
+ g_variant_get (_reply, "(v)", &_inner_reply);
+ g_variant_unref (_reply);
+ }
+ _tmp1_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+ g_variant_iter_init (&_tmp2_, _inner_reply);
+ while (g_variant_iter_loop (&_tmp2_, "{?*}", &_tmp3_, &_tmp4_)) {
+ g_hash_table_insert (_tmp1_, g_variant_dup_string (_tmp3_, NULL), g_variant_get_variant (_tmp4_));
+ }
+ _result = _tmp1_;
+ g_variant_unref (_inner_reply);
+ return _result;
+}
+
+
+static void mpris_player_dbus_proxy_set_Metadata (MprisPlayer* self, GHashTable* value) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ GVariantBuilder _tmp5_;
+ GHashTableIter _tmp6_;
+ gpointer _tmp7_;
+ gpointer _tmp8_;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2.Player"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("Metadata"));
+ g_variant_builder_open (&_arguments_builder, G_VARIANT_TYPE_VARIANT);
+ g_hash_table_iter_init (&_tmp6_, value);
+ g_variant_builder_init (&_tmp5_, G_VARIANT_TYPE_DICTIONARY);
+ while (g_hash_table_iter_next (&_tmp6_, &_tmp7_, &_tmp8_)) {
+ gchar* _key;
+ GVariant* _value;
+ _key = (gchar*) _tmp7_;
+ _value = (GVariant*) _tmp8_;
+ g_variant_builder_add (&_tmp5_, "{?*}", g_variant_new_string (_key), g_variant_new_variant (_value));
+ }
+ g_variant_builder_add_value (&_arguments_builder, g_variant_builder_end (&_tmp5_));
+ g_variant_builder_close (&_arguments_builder);
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Set", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return;
+ }
+ g_variant_unref (_reply);
+}
+
+
+static gint32 mpris_player_dbus_proxy_get_Position (MprisPlayer* self) {
+ GVariant *_inner_reply;
+ gint32 _result;
+ _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "Position");
+ if (!_inner_reply) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2.Player"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("Position"));
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return 0;
+ }
+ g_variant_get (_reply, "(v)", &_inner_reply);
+ g_variant_unref (_reply);
+ }
+ _result = g_variant_get_int32 (_inner_reply);
+ g_variant_unref (_inner_reply);
+ return _result;
+}
+
+
+static void mpris_player_dbus_proxy_set_Position (MprisPlayer* self, gint32 value) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2.Player"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("Position"));
+ g_variant_builder_open (&_arguments_builder, G_VARIANT_TYPE_VARIANT);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (value));
+ g_variant_builder_close (&_arguments_builder);
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Set", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return;
+ }
+ g_variant_unref (_reply);
+}
+
+
+static gchar* mpris_player_dbus_proxy_get_PlaybackStatus (MprisPlayer* self) {
+ GVariant *_inner_reply;
+ gchar* _result;
+ _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "PlaybackStatus");
+ if (!_inner_reply) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2.Player"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("PlaybackStatus"));
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return NULL;
+ }
+ g_variant_get (_reply, "(v)", &_inner_reply);
+ g_variant_unref (_reply);
+ }
+ _result = g_variant_dup_string (_inner_reply, NULL);
+ g_variant_unref (_inner_reply);
+ return _result;
+}
+
+
+static void mpris_player_dbus_proxy_set_PlaybackStatus (MprisPlayer* self, const gchar* value) {
+ GVariant *_arguments;
+ GVariant *_reply;
+ GVariantBuilder _arguments_builder;
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2.Player"));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("PlaybackStatus"));
+ g_variant_builder_open (&_arguments_builder, G_VARIANT_TYPE_VARIANT);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (value));
+ g_variant_builder_close (&_arguments_builder);
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Set", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+ if (!_reply) {
+ return;
+ }
+ g_variant_unref (_reply);
+}
+
+
+static void mpris_player_proxy_mpris_player_interface_init (MprisPlayerIface* iface) {
+ iface->PlayPause = mpris_player_proxy_PlayPause_async;
+ iface->PlayPause_finish = mpris_player_proxy_PlayPause_finish;
+ iface->Next = mpris_player_proxy_Next_async;
+ iface->Next_finish = mpris_player_proxy_Next_finish;
+ iface->Previous = mpris_player_proxy_Previous_async;
+ iface->Previous_finish = mpris_player_proxy_Previous_finish;
+ iface->get_Metadata = mpris_player_dbus_proxy_get_Metadata;
+ iface->set_Metadata = mpris_player_dbus_proxy_set_Metadata;
+ iface->get_Position = mpris_player_dbus_proxy_get_Position;
+ iface->set_Position = mpris_player_dbus_proxy_set_Position;
+ iface->get_PlaybackStatus = mpris_player_dbus_proxy_get_PlaybackStatus;
+ iface->set_PlaybackStatus = mpris_player_dbus_proxy_set_PlaybackStatus;
+}
+
+
+static void _dbus_mpris_player_PlayPause (MprisPlayer* self, GVariant* parameters, GDBusMethodInvocation* invocation) {
+ GVariantIter _arguments_iter;
+ g_variant_iter_init (&_arguments_iter, parameters);
+ mpris_player_PlayPause (self, (GAsyncReadyCallback) _dbus_mpris_player_PlayPause_ready, g_object_ref (invocation));
+}
+
+
+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;
+ invocation = _user_data_;
+ error = NULL;
+ mpris_player_PlayPause_finish ((MprisPlayer*) 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 _dbus_mpris_player_Next (MprisPlayer* self, GVariant* parameters, GDBusMethodInvocation* invocation) {
+ GVariantIter _arguments_iter;
+ g_variant_iter_init (&_arguments_iter, parameters);
+ mpris_player_Next (self, (GAsyncReadyCallback) _dbus_mpris_player_Next_ready, g_object_ref (invocation));
+}
+
+
+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;
+ invocation = _user_data_;
+ error = NULL;
+ mpris_player_Next_finish ((MprisPlayer*) 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 _dbus_mpris_player_Previous (MprisPlayer* self, GVariant* parameters, GDBusMethodInvocation* invocation) {
+ GVariantIter _arguments_iter;
+ g_variant_iter_init (&_arguments_iter, parameters);
+ mpris_player_Previous (self, (GAsyncReadyCallback) _dbus_mpris_player_Previous_ready, g_object_ref (invocation));
+}
+
+
+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;
+ invocation = _user_data_;
+ error = NULL;
+ mpris_player_Previous_finish ((MprisPlayer*) 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 mpris_player_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data) {
+ gpointer* data;
+ gpointer object;
+ data = user_data;
+ object = data[0];
+ if (strcmp (method_name, "PlayPause") == 0) {
+ _dbus_mpris_player_PlayPause (object, parameters, invocation);
+ } else if (strcmp (method_name, "Next") == 0) {
+ _dbus_mpris_player_Next (object, parameters, invocation);
+ } else if (strcmp (method_name, "Previous") == 0) {
+ _dbus_mpris_player_Previous (object, parameters, invocation);
+ }
+ g_object_unref (invocation);
+}
+
+
+static GVariant* _dbus_mpris_player_get_Metadata (MprisPlayer* self) {
+ GHashTable* result;
+ GVariantBuilder _tmp9_;
+ GHashTableIter _tmp10_;
+ gpointer _tmp11_;
+ gpointer _tmp12_;
+ GVariant* _reply;
+ result = mpris_player_get_Metadata (self);
+ g_hash_table_iter_init (&_tmp10_, result);
+ g_variant_builder_init (&_tmp9_, G_VARIANT_TYPE_DICTIONARY);
+ while (g_hash_table_iter_next (&_tmp10_, &_tmp11_, &_tmp12_)) {
+ gchar* _key;
+ GVariant* _value;
+ _key = (gchar*) _tmp11_;
+ _value = (GVariant*) _tmp12_;
+ g_variant_builder_add (&_tmp9_, "{?*}", g_variant_new_string (_key), g_variant_new_variant (_value));
+ }
+ _reply = g_variant_builder_end (&_tmp9_);
+ _g_hash_table_unref0 (result);
+ return _reply;
+}
+
+
+static GVariant* _dbus_mpris_player_get_Position (MprisPlayer* self) {
+ gint32 result;
+ GVariant* _reply;
+ result = mpris_player_get_Position (self);
+ _reply = g_variant_new_int32 (result);
+ return _reply;
+}
+
+
+static GVariant* _dbus_mpris_player_get_PlaybackStatus (MprisPlayer* self) {
+ gchar* result;
+ GVariant* _reply;
+ result = mpris_player_get_PlaybackStatus (self);
+ _reply = g_variant_new_string (result);
+ _g_free0 (result);
+ return _reply;
+}
+
+
+static GVariant* mpris_player_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data) {
+ gpointer* data;
+ gpointer object;
+ data = user_data;
+ object = data[0];
+ if (strcmp (property_name, "Metadata") == 0) {
+ return _dbus_mpris_player_get_Metadata (object);
+ } else if (strcmp (property_name, "Position") == 0) {
+ return _dbus_mpris_player_get_Position (object);
+ } else if (strcmp (property_name, "PlaybackStatus") == 0) {
+ return _dbus_mpris_player_get_PlaybackStatus (object);
+ }
+ return NULL;
+}
+
+
+static void _dbus_mpris_player_set_Metadata (MprisPlayer* self, GVariant* _value) {
+ GHashTable* value = NULL;
+ GHashTable* _tmp13_;
+ GVariantIter _tmp14_;
+ GVariant* _tmp15_;
+ GVariant* _tmp16_;
+ _tmp13_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+ g_variant_iter_init (&_tmp14_, _value);
+ while (g_variant_iter_loop (&_tmp14_, "{?*}", &_tmp15_, &_tmp16_)) {
+ g_hash_table_insert (_tmp13_, g_variant_dup_string (_tmp15_, NULL), g_variant_get_variant (_tmp16_));
+ }
+ value = _tmp13_;
+ mpris_player_set_Metadata (self, value);
+ _g_hash_table_unref0 (value);
+}
+
+
+static void _dbus_mpris_player_set_Position (MprisPlayer* self, GVariant* _value) {
+ gint32 value = 0;
+ value = g_variant_get_int32 (_value);
+ mpris_player_set_Position (self, value);
+}
+
+
+static void _dbus_mpris_player_set_PlaybackStatus (MprisPlayer* self, GVariant* _value) {
+ gchar* value = NULL;
+ value = g_variant_dup_string (_value, NULL);
+ mpris_player_set_PlaybackStatus (self, value);
+ _g_free0 (value);
+}
+
+
+static gboolean mpris_player_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data) {
+ gpointer* data;
+ gpointer object;
+ data = user_data;
+ object = data[0];
+ if (strcmp (property_name, "Metadata") == 0) {
+ _dbus_mpris_player_set_Metadata (object, value);
+ return TRUE;
+ } else if (strcmp (property_name, "Position") == 0) {
+ _dbus_mpris_player_set_Position (object, value);
+ return TRUE;
+ } else if (strcmp (property_name, "PlaybackStatus") == 0) {
+ _dbus_mpris_player_set_PlaybackStatus (object, value);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+static void _dbus_mpris_player_seeked (GObject* _sender, gint64 new_position, gpointer* _data) {
+ GDBusConnection * _connection;
+ const gchar * _path;
+ GVariant *_arguments;
+ GVariantBuilder _arguments_builder;
+ _connection = _data[1];
+ _path = _data[2];
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_int64 (new_position));
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ g_dbus_connection_emit_signal (_connection, NULL, _path, "org.mpris.MediaPlayer2.Player", "Seeked", _arguments, NULL);
+}
+
+
+guint mpris_player_register_object (gpointer object, GDBusConnection* connection, const gchar* path, GError** error) {
+ guint result;
+ gpointer *data;
+ data = g_new (gpointer, 3);
+ data[0] = g_object_ref (object);
+ data[1] = g_object_ref (connection);
+ data[2] = g_strdup (path);
+ result = g_dbus_connection_register_object (connection, path, &_mpris_player_dbus_interface_info, &_mpris_player_dbus_interface_vtable, data, _mpris_player_unregister_object, error);
+ if (!result) {
+ return 0;
+ }
+ g_signal_connect (object, "seeked", (GCallback) _dbus_mpris_player_seeked, data);
+ return result;
+}
+
+
+static void _mpris_player_unregister_object (gpointer user_data) {
+ gpointer* data;
+ data = user_data;
+ g_object_unref (data[0]);
+ g_object_unref (data[1]);
+ g_free (data[2]);
+ g_free (data);
+}
+
+
+
diff --git a/src/mpris2-interfaces.vala b/src/mpris2-interfaces.vala
new file mode 100644
index 0000000..ebea135
--- /dev/null
+++ b/src/mpris2-interfaces.vala
@@ -0,0 +1,46 @@
+/*
+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.mpris.MediaPlayer2")]
+public interface MprisRoot : Object {
+ // properties
+ public abstract bool HasTracklist{owned get; set;}
+ public abstract bool CanQuit{owned get; set;}
+ public abstract bool CanRaise{owned get; set;}
+ public abstract string Identity{owned get; set;}
+ public abstract string DesktopEntry{owned get; set;}
+ // methods
+ public abstract async void Quit() throws IOError;
+ public abstract async void Raise() throws IOError;
+}
+
+[DBus (name = "org.mpris.MediaPlayer2.Player")]
+public interface MprisPlayer : Object {
+ // properties
+ public abstract HashTable<string, Variant?> Metadata{owned get; set;}
+ public abstract int32 Position{owned get; set;}
+ public abstract string PlaybackStatus{owned get; set;}
+ // methods
+ public abstract async void PlayPause() throws IOError;
+ public abstract async void Next() throws IOError;
+ public abstract async void Previous() throws IOError;
+ // signals
+ public signal void Seeked(int64 new_position);
+}
diff --git a/src/mpris2-watcher.c b/src/mpris2-watcher.c
new file mode 100644
index 0000000..f6b5805
--- /dev/null
+++ b/src/mpris2-watcher.c
@@ -0,0 +1,851 @@
+/* mpris2-watcher.c generated by valac 0.11.2, the Vala compiler
+ * generated from mpris2-watcher.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_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))
+#define IS_MPRIS2_WATCHER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS2_WATCHER))
+#define IS_MPRIS2_WATCHER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS2_WATCHER))
+#define MPRIS2_WATCHER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS2_WATCHER, Mpris2WatcherClass))
+
+typedef struct _Mpris2Watcher Mpris2Watcher;
+typedef struct _Mpris2WatcherClass Mpris2WatcherClass;
+typedef struct _Mpris2WatcherPrivate Mpris2WatcherPrivate;
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+
+#define TYPE_MPRIS_ROOT (mpris_root_get_type ())
+#define MPRIS_ROOT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_ROOT, MprisRoot))
+#define IS_MPRIS_ROOT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_ROOT))
+#define MPRIS_ROOT_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_MPRIS_ROOT, MprisRootIface))
+
+typedef struct _MprisRoot MprisRoot;
+typedef struct _MprisRootIface MprisRootIface;
+
+#define TYPE_MPRIS_ROOT_PROXY (mpris_root_proxy_get_type ())
+#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_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);
+};
+
+struct _Mpris2Watcher {
+ GObject parent_instance;
+ Mpris2WatcherPrivate * priv;
+};
+
+struct _Mpris2WatcherClass {
+ GObjectClass parent_class;
+};
+
+struct _Mpris2WatcherPrivate {
+ FreeDesktopObject* fdesktop_obj;
+};
+
+struct _MprisRootIface {
+ GTypeInterface parent_iface;
+ void (*Quit) (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+ void (*Quit_finish) (MprisRoot* self, GAsyncResult* _res_, GError** error);
+ void (*Raise) (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+ void (*Raise_finish) (MprisRoot* self, GAsyncResult* _res_, GError** error);
+ gboolean (*get_HasTracklist) (MprisRoot* self);
+ void (*set_HasTracklist) (MprisRoot* self, gboolean value);
+ gboolean (*get_CanQuit) (MprisRoot* self);
+ void (*set_CanQuit) (MprisRoot* self, gboolean value);
+ gboolean (*get_CanRaise) (MprisRoot* self);
+ void (*set_CanRaise) (MprisRoot* self, gboolean value);
+ gchar* (*get_Identity) (MprisRoot* self);
+ void (*set_Identity) (MprisRoot* self, const gchar* value);
+ gchar* (*get_DesktopEntry) (MprisRoot* self);
+ void (*set_DesktopEntry) (MprisRoot* self, const gchar* value);
+};
+
+struct _Mpris2WatcherCheckForActiveClientsData {
+ int _state_;
+ GObject* _source_object_;
+ GAsyncResult* _res_;
+ GSimpleAsyncResult* _async_result;
+ Mpris2Watcher* self;
+ gint interfaces_length1;
+ gint _interfaces_size_;
+ gchar** interfaces;
+ gint _tmp0_;
+ gchar** _tmp1_;
+ gint _tmp2__length1;
+ gint __tmp2__size_;
+ gchar** _tmp3_;
+ gchar** _tmp2_;
+ gchar** _tmp4_;
+ GError * e;
+ gchar** address_collection;
+ int address_collection_length1;
+ int address_it;
+ gchar* _tmp5_;
+ gchar* address;
+ gboolean _tmp6_;
+ MprisRoot* _tmp7_;
+ MprisRoot* mpris2_root;
+ gchar* _tmp8_;
+ gchar* _tmp9_;
+ GError * _inner_error_;
+};
+
+
+static gpointer mpris2_watcher_parent_class = NULL;
+
+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);
+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);
+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 GObject * mpris2_watcher_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
+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;
+ self = (Mpris2Watcher*) g_object_new (object_type, NULL);
+ return self;
+}
+
+
+Mpris2Watcher* mpris2_watcher_new (void) {
+ return mpris2_watcher_construct (TYPE_MPRIS2_WATCHER);
+}
+
+
+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;
+ _g_object_unref0 (data->self);
+ g_slice_free (Mpris2WatcherCheckForActiveClientsData, data);
+}
+
+
+static gpointer _g_object_ref0 (gpointer self) {
+ return self ? g_object_ref (self) : NULL;
+}
+
+
+static void mpris2_watcher_check_for_active_clients (Mpris2Watcher* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
+ Mpris2WatcherCheckForActiveClientsData* _data_;
+ _data_ = g_slice_new0 (Mpris2WatcherCheckForActiveClientsData);
+ _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, mpris2_watcher_check_for_active_clients);
+ g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, mpris2_watcher_check_for_active_clients_data_free);
+ _data_->self = _g_object_ref0 (self);
+ mpris2_watcher_check_for_active_clients_co (_data_);
+}
+
+
+static void mpris2_watcher_check_for_active_clients_finish (Mpris2Watcher* self, GAsyncResult* _res_) {
+ Mpris2WatcherCheckForActiveClientsData* _data_;
+ _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
+}
+
+
+static void mpris2_watcher_check_for_active_clients_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
+ Mpris2WatcherCheckForActiveClientsData* data;
+ data = _user_data_;
+ data->_source_object_ = source_object;
+ data->_res_ = _res_;
+ mpris2_watcher_check_for_active_clients_co (data);
+}
+
+
+static gboolean mpris2_watcher_check_for_active_clients_co (Mpris2WatcherCheckForActiveClientsData* data) {
+ switch (data->_state_) {
+ case 0:
+ goto _state_0;
+ case 1:
+ goto _state_1;
+ default:
+ g_assert_not_reached ();
+ }
+ _state_0:
+ data->interfaces_length1 = 0;
+ data->_state_ = 1;
+ free_desktop_object_list_names (data->self->priv->fdesktop_obj, mpris2_watcher_check_for_active_clients_ready, data);
+ return FALSE;
+ _state_1:
+ data->_tmp1_ = NULL;
+ data->_tmp1_ = free_desktop_object_list_names_finish (data->self->priv->fdesktop_obj, data->_res_, &data->_tmp0_, &data->_inner_error_);
+ data->_tmp3_ = data->_tmp1_;
+ data->_tmp2__length1 = data->_tmp0_;
+ data->__tmp2__size_ = data->_tmp2__length1;
+ data->_tmp2_ = data->_tmp3_;
+ if (data->_inner_error_ != NULL) {
+ if (data->_inner_error_->domain == G_IO_ERROR) {
+ goto __catch8_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);
+ g_clear_error (&data->_inner_error_);
+ return FALSE;
+ }
+ data->_tmp4_ = data->_tmp2_;
+ data->interfaces = (_vala_array_free (data->interfaces, data->interfaces_length1, (GDestroyNotify) g_free), NULL);
+ data->interfaces_length1 = data->_tmp2__length1;
+ data->_interfaces_size_ = data->interfaces_length1;
+ data->interfaces = data->_tmp4_;
+ goto __finally8;
+ __catch8_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_error_free0 (data->e);
+ data->interfaces = (_vala_array_free (data->interfaces, data->interfaces_length1, (GDestroyNotify) g_free), NULL);
+ if (data->_state_ == 0) {
+ g_simple_async_result_complete_in_idle (data->_async_result);
+ } else {
+ g_simple_async_result_complete (data->_async_result);
+ }
+ g_object_unref (data->_async_result);
+ return FALSE;
+ }
+ __finally8:
+ 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);
+ g_clear_error (&data->_inner_error_);
+ return FALSE;
+ }
+ {
+ data->address_collection = data->interfaces;
+ data->address_collection_length1 = data->interfaces_length1;
+ for (data->address_it = 0; data->address_it < data->interfaces_length1; data->address_it = data->address_it + 1) {
+ 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);
+ if (data->_tmp6_) {
+ data->_tmp7_ = NULL;
+ data->_tmp7_ = mpris2_watcher_create_mpris_root (data->self, data->address);
+ data->mpris2_root = data->_tmp7_;
+ if (data->mpris2_root == NULL) {
+ _g_object_unref0 (data->mpris2_root);
+ _g_free0 (data->address);
+ data->interfaces = (_vala_array_free (data->interfaces, data->interfaces_length1, (GDestroyNotify) g_free), NULL);
+ if (data->_state_ == 0) {
+ g_simple_async_result_complete_in_idle (data->_async_result);
+ } else {
+ g_simple_async_result_complete (data->_async_result);
+ }
+ g_object_unref (data->_async_result);
+ return FALSE;
+ }
+ 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_);
+ _g_object_unref0 (data->mpris2_root);
+ }
+ _g_free0 (data->address);
+ }
+ }
+ }
+ data->interfaces = (_vala_array_free (data->interfaces, data->interfaces_length1, (GDestroyNotify) g_free), NULL);
+ if (data->_state_ == 0) {
+ g_simple_async_result_complete_in_idle (data->_async_result);
+ } else {
+ g_simple_async_result_complete (data->_async_result);
+ }
+ g_object_unref (data->_async_result);
+ return FALSE;
+}
+
+
+static 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;
+ register GCClosure * cc;
+ register gpointer data1, data2;
+ cc = (GCClosure *) closure;
+ g_return_if_fail (n_param_values == 3);
+ 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) (marshal_data ? marshal_data : cc->callback);
+ callback (data1, g_value_get_string (param_values + 1), g_value_get_string (param_values + 2), data2);
+}
+
+
+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) {
+ mpris2_watcher_name_changes_detected (self, _sender, name, old_owner, new_owner);
+}
+
+
+static GObject * mpris2_watcher_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
+ GObject * obj;
+ GObjectClass * parent_class;
+ Mpris2Watcher * self;
+ FreeDesktopObject* _tmp0_;
+ FreeDesktopObject* _tmp1_;
+ 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);
+ if (_inner_error_ != NULL) {
+ if (_inner_error_->domain == G_IO_ERROR) {
+ goto __catch9_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_;
+ _g_object_unref0 (self->priv->fdesktop_obj);
+ self->priv->fdesktop_obj = _tmp1_;
+ 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:
+ {
+ GError * e;
+ e = _inner_error_;
+ _inner_error_ = NULL;
+ g_warning ("mpris2-watcher.vala:55: Mpris2watcher could not set up a watch for mpr" \
+"is clients appearing on the bus: %s", e->message);
+ _g_error_free0 (e);
+ }
+ __finally9:
+ if (_inner_error_ != NULL) {
+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
+ g_clear_error (&_inner_error_);
+ }
+ return obj;
+}
+
+
+static void mpris2_watcher_class_init (Mpris2WatcherClass * klass) {
+ mpris2_watcher_parent_class = g_type_class_peek_parent (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_disappeared", TYPE_MPRIS2_WATCHER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
+}
+
+
+static void mpris2_watcher_instance_init (Mpris2Watcher * self) {
+ self->priv = MPRIS2_WATCHER_GET_PRIVATE (self);
+}
+
+
+static void mpris2_watcher_finalize (GObject* obj) {
+ Mpris2Watcher * self;
+ self = MPRIS2_WATCHER (obj);
+ _g_object_unref0 (self->priv->fdesktop_obj);
+ G_OBJECT_CLASS (mpris2_watcher_parent_class)->finalize (obj);
+}
+
+
+GType mpris2_watcher_get_type (void) {
+ static volatile gsize mpris2_watcher_type_id__volatile = 0;
+ if (g_once_init_enter (&mpris2_watcher_type_id__volatile)) {
+ static const GTypeInfo g_define_type_info = { sizeof (Mpris2WatcherClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) mpris2_watcher_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Mpris2Watcher), 0, (GInstanceInitFunc) mpris2_watcher_instance_init, NULL };
+ GType mpris2_watcher_type_id;
+ mpris2_watcher_type_id = g_type_register_static (G_TYPE_OBJECT, "Mpris2Watcher", &g_define_type_info, 0);
+ g_once_init_leave (&mpris2_watcher_type_id__volatile, mpris2_watcher_type_id);
+ }
+ return mpris2_watcher_type_id__volatile;
+}
+
+
+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-watcher.vala b/src/mpris2-watcher.vala
new file mode 100644
index 0000000..7814975
--- /dev/null
+++ b/src/mpris2-watcher.vala
@@ -0,0 +1,116 @@
+/*
+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 );
+}
+
+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_disappeared ( string dbus_name );
+
+ public Mpris2Watcher ()
+ {
+ }
+
+ construct
+ {
+ try {
+ this.fdesktop_obj = Bus.get_proxy_sync ( BusType.SESSION,
+ FREEDESKTOP_SERVICE,
+ FREEDESKTOP_OBJECT,
+ DBusProxyFlags.DO_NOT_LOAD_PROPERTIES );
+ this.fdesktop_obj.name_owner_changed.connect (this.name_changes_detected);
+ this.check_for_active_clients.begin();
+ }
+ catch ( IOError e ){
+ warning( "Mpris2watcher could not set up a watch for mpris clients appearing on the bus: %s",
+ e.message );
+ }
+ }
+
+ private void name_changes_detected ( FreeDesktopObject dbus_obj,
+ string name,
+ string previous_owner,
+ string current_owner )
+ {
+ 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);
+ }
+ }
+
+ 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 );
+ }
+ catch (IOError e){
+ warning( "Mpris2watcher could not create a root interface: %s",
+ e.message );
+ }
+ }
+ 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()
+ {
+ 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;
+ client_appeared (mpris2_root.DesktopEntry, address);
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/music-player-bridge.c b/src/music-player-bridge.c
index 7c29522..e397913 100644
--- a/src/music-player-bridge.c
+++ b/src/music-player-bridge.c
@@ -22,11 +22,6 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <glib.h>
#include <glib-object.h>
-#include <libindicate/./indicator-messages.h>
-#include <libindicate/./indicator.h>
-#include <libindicate/./interests.h>
-#include <libindicate/./listener.h>
-#include <libindicate/./server.h>
#include <libdbusmenu-glib/client.h>
#include <libdbusmenu-glib/menuitem-proxy.h>
#include <libdbusmenu-glib/menuitem.h>
@@ -34,8 +29,8 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <gee.h>
#include <stdlib.h>
#include <string.h>
-#include <gio/gdesktopappinfo.h>
#include <gio/gio.h>
+#include <gio/gdesktopappinfo.h>
#define TYPE_MUSIC_PLAYER_BRIDGE (music_player_bridge_get_type ())
@@ -49,6 +44,16 @@ typedef struct _MusicPlayerBridge MusicPlayerBridge;
typedef struct _MusicPlayerBridgeClass MusicPlayerBridgeClass;
typedef struct _MusicPlayerBridgePrivate MusicPlayerBridgePrivate;
+#define TYPE_SETTINGS_MANAGER (settings_manager_get_type ())
+#define SETTINGS_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SETTINGS_MANAGER, SettingsManager))
+#define SETTINGS_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SETTINGS_MANAGER, SettingsManagerClass))
+#define IS_SETTINGS_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SETTINGS_MANAGER))
+#define IS_SETTINGS_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SETTINGS_MANAGER))
+#define SETTINGS_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SETTINGS_MANAGER, SettingsManagerClass))
+
+typedef struct _SettingsManager SettingsManager;
+typedef struct _SettingsManagerClass SettingsManagerClass;
+
#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))
@@ -59,19 +64,21 @@ typedef struct _MusicPlayerBridgePrivate MusicPlayerBridgePrivate;
typedef struct _PlayerController PlayerController;
typedef struct _PlayerControllerClass PlayerControllerClass;
-#define TYPE_FAMILIAR_PLAYERS_DB (familiar_players_db_get_type ())
-#define FAMILIAR_PLAYERS_DB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FAMILIAR_PLAYERS_DB, FamiliarPlayersDB))
-#define FAMILIAR_PLAYERS_DB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FAMILIAR_PLAYERS_DB, FamiliarPlayersDBClass))
-#define IS_FAMILIAR_PLAYERS_DB(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FAMILIAR_PLAYERS_DB))
-#define IS_FAMILIAR_PLAYERS_DB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FAMILIAR_PLAYERS_DB))
-#define FAMILIAR_PLAYERS_DB_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FAMILIAR_PLAYERS_DB, FamiliarPlayersDBClass))
+#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))
+#define IS_MPRIS2_WATCHER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS2_WATCHER))
+#define IS_MPRIS2_WATCHER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS2_WATCHER))
+#define MPRIS2_WATCHER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS2_WATCHER, Mpris2WatcherClass))
-typedef struct _FamiliarPlayersDB FamiliarPlayersDB;
-typedef struct _FamiliarPlayersDBClass FamiliarPlayersDBClass;
+typedef struct _Mpris2Watcher Mpris2Watcher;
+typedef struct _Mpris2WatcherClass Mpris2WatcherClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define PLAYER_CONTROLLER_TYPE_STATE (player_controller_state_get_type ())
+#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)))
struct _MusicPlayerBridge {
GObject parent_instance;
@@ -83,10 +90,11 @@ struct _MusicPlayerBridgeClass {
};
struct _MusicPlayerBridgePrivate {
- IndicateListener* listener;
+ SettingsManager* settings_manager;
DbusmenuMenuitem* root_menu;
GeeHashMap* registered_clients;
- FamiliarPlayersDB* playersDB;
+ Mpris2Watcher* watcher;
+ GSettings* settings;
};
typedef enum {
@@ -101,77 +109,51 @@ typedef enum {
static gpointer music_player_bridge_parent_class = NULL;
GType music_player_bridge_get_type (void) G_GNUC_CONST;
+GType settings_manager_get_type (void) G_GNUC_CONST;
GType player_controller_get_type (void) G_GNUC_CONST;
-GType familiar_players_db_get_type (void) G_GNUC_CONST;
+GType mpris2_watcher_get_type (void) G_GNUC_CONST;
#define MUSIC_PLAYER_BRIDGE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_MUSIC_PLAYER_BRIDGE, MusicPlayerBridgePrivate))
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);
-FamiliarPlayersDB* familiar_players_db_new (void);
-FamiliarPlayersDB* familiar_players_db_construct (GType object_type);
-void music_player_bridge_on_server_added (MusicPlayerBridge* self, IndicateListenerServer* object, const gchar* type);
-static void _music_player_bridge_on_server_added_indicate_listener_server_added (IndicateListener* _sender, IndicateListenerServer* object, const gchar* p0, gpointer self);
-void music_player_bridge_on_server_removed (MusicPlayerBridge* self, IndicateListenerServer* object, const gchar* type);
-static void _music_player_bridge_on_server_removed_indicate_listener_server_removed (IndicateListener* _sender, IndicateListenerServer* object, const gchar* p0, gpointer self);
+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);
-GeeSet* familiar_players_db_records (FamiliarPlayersDB* 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);
-gchar* familiar_players_db_fetch_icon_name (const gchar* desktop_path);
+static gchar* music_player_bridge_fetch_icon_name (const gchar* desktop_path);
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* mpris_name, const gchar* icon_name, gint offset, PlayerControllerstate initial_state);
-PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, GAppInfo* app, const gchar* mpris_name, const gchar* icon_name, gint offset, PlayerControllerstate initial_state);
+PlayerController* player_controller_new (DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, 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
-static gboolean music_player_bridge_server_is_not_of_interest (MusicPlayerBridge* self, const gchar* type);
-static void music_player_bridge_desktop_info_callback (MusicPlayerBridge* self, IndicateListenerServer* server, gchar* path, void* data);
-GAppInfo* music_player_bridge_create_app_info (const gchar* path);
-gboolean familiar_players_db_already_familiar (FamiliarPlayersDB* self, const gchar* desktop);
-void familiar_players_db_insert (FamiliarPlayersDB* self, const gchar* desktop);
+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);
void player_controller_update_state (PlayerController* self, PlayerControllerstate new_state);
-void player_controller_activate (PlayerController* self);
+void player_controller_activate (PlayerController* self, const gchar* dbus_name);
+void music_player_bridge_client_has_vanished (MusicPlayerBridge* self, const gchar* mpris_root_interface);
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_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);
+SettingsManager* settings_manager_construct (GType object_type);
+static void _music_player_bridge_on_blacklist_update_settings_manager_blacklist_updates (SettingsManager* _sender, gchar** new_blacklist, int new_blacklist_length1, gpointer self);
static void music_player_bridge_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 gint _vala_array_length (gpointer array);
-static void _music_player_bridge_on_server_added_indicate_listener_server_added (IndicateListener* _sender, IndicateListenerServer* object, const gchar* p0, gpointer self) {
- music_player_bridge_on_server_added (self, object, p0);
-}
-
-
-static void _music_player_bridge_on_server_removed_indicate_listener_server_removed (IndicateListener* _sender, IndicateListenerServer* object, const gchar* p0, gpointer self) {
- music_player_bridge_on_server_removed (self, object, p0);
-}
-
-
MusicPlayerBridge* music_player_bridge_construct (GType object_type) {
MusicPlayerBridge * self = NULL;
- FamiliarPlayersDB* _tmp0_ = NULL;
- FamiliarPlayersDB* _tmp1_;
- GeeHashMap* _tmp2_ = NULL;
- GeeHashMap* _tmp3_;
- IndicateListener* _tmp4_ = NULL;
- IndicateListener* _tmp5_;
self = (MusicPlayerBridge*) g_object_new (object_type, NULL);
- _tmp0_ = familiar_players_db_new ();
- _tmp1_ = _tmp0_;
- _g_object_unref0 (self->priv->playersDB);
- self->priv->playersDB = _tmp1_;
- _tmp2_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, TYPE_PLAYER_CONTROLLER, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, NULL);
- _tmp3_ = _tmp2_;
- _g_object_unref0 (self->priv->registered_clients);
- self->priv->registered_clients = _tmp3_;
- _tmp4_ = indicate_listener_ref_default ();
- _tmp5_ = _tmp4_;
- _g_object_unref0 (self->priv->listener);
- self->priv->listener = _tmp5_;
- g_signal_connect_object (self->priv->listener, "server-added", (GCallback) _music_player_bridge_on_server_added_indicate_listener_server_added, self, 0);
- g_signal_connect_object (self->priv->listener, "server-removed", (GCallback) _music_player_bridge_on_server_removed_indicate_listener_server_removed, self, 0);
return self;
}
@@ -181,81 +163,77 @@ MusicPlayerBridge* music_player_bridge_new (void) {
}
-static gpointer _g_object_ref0 (gpointer self) {
- return self ? g_object_ref (self) : NULL;
+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");
}
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_);
{
- GeeSet* _tmp0_ = NULL;
- GeeSet* _tmp1_;
- GeeIterator* _tmp2_ = NULL;
- GeeIterator* _tmp3_;
- GeeIterator* _app_it;
- _tmp0_ = familiar_players_db_records (self->priv->playersDB);
- _tmp1_ = _tmp0_;
- _tmp2_ = gee_iterable_iterator ((GeeIterable*) _tmp1_);
- _app_it = (_tmp3_ = _tmp2_, _g_object_unref0 (_tmp1_), _tmp3_);
- while (TRUE) {
- gboolean _tmp4_;
- gpointer _tmp5_ = NULL;
- gchar* app;
- GDesktopAppInfo* _tmp6_ = NULL;
- GDesktopAppInfo* info;
- GDesktopAppInfo* _tmp7_;
- GAppInfo* _tmp8_;
- GAppInfo* app_info;
- gchar* _tmp9_;
- gchar* _tmp10_ = NULL;
- gchar* mpris_key;
- gchar* _tmp11_ = NULL;
- gchar* _tmp12_;
- gint _tmp13_;
- PlayerController* _tmp14_ = NULL;
- PlayerController* _tmp15_;
- PlayerController* ctrl;
- _tmp4_ = gee_iterator_next (_app_it);
- if (!_tmp4_) {
- break;
- }
- _tmp5_ = gee_iterator_get (_app_it);
- app = (gchar*) _tmp5_;
- if (app == NULL) {
- g_warning ("music-player-bridge.vala:44: App string in keyfile is null therefore m" \
-"oving on to next player");
- _g_free0 (app);
- continue;
- }
- g_debug ("music-player-bridge.vala:48: attempting to make an app info from %s", app);
- _tmp6_ = g_desktop_app_info_new_from_filename (app);
- info = _tmp6_;
- if (info == NULL) {
- g_warning ("music-player-bridge.vala:53: Could not create a desktopappinfo instanc" \
-"e from app,: %s , moving on to the next client", app);
- _g_object_unref0 (info);
- _g_free0 (app);
- continue;
+ 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_;
+ 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);
+ _g_object_unref0 (app_info);
+ _g_free0 (path);
+ _g_free0 (desktop);
}
- _tmp8_ = _g_object_ref0 ((_tmp7_ = info, G_IS_APP_INFO (_tmp7_) ? ((GAppInfo*) _tmp7_) : NULL));
- app_info = _tmp8_;
- _tmp9_ = g_strdup (app);
- _tmp10_ = music_player_bridge_determine_key (_tmp9_);
- mpris_key = _tmp10_;
- _tmp11_ = familiar_players_db_fetch_icon_name (app);
- _tmp12_ = _tmp11_;
- _tmp13_ = music_player_bridge_calculate_menu_position (self);
- _tmp14_ = player_controller_new (self->priv->root_menu, app_info, mpris_key, _tmp12_, _tmp13_, PLAYER_CONTROLLER_STATE_OFFLINE);
- ctrl = (_tmp15_ = _tmp14_, _g_free0 (_tmp12_), _tmp15_);
- 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_object_unref0 (info);
- _g_free0 (app);
}
- _g_object_unref0 (_app_it);
+ desktop_collection = (_vala_array_free (desktop_collection, desktop_collection_length1, (GDestroyNotify) g_free), NULL);
}
}
@@ -277,201 +255,275 @@ static gint music_player_bridge_calculate_menu_position (MusicPlayerBridge* self
}
-void music_player_bridge_on_server_added (MusicPlayerBridge* self, IndicateListenerServer* object, const gchar* type) {
- gboolean _tmp0_;
+void music_player_bridge_client_has_become_available (MusicPlayerBridge* self, const gchar* desktop, const gchar* dbus_name) {
+ gboolean _tmp0_ = FALSE;
+ gchar* _tmp1_ = NULL;
+ gchar* _tmp2_;
+ gchar* _tmp3_ = NULL;
+ gchar* _tmp4_;
+ gchar* path;
+ GAppInfo* _tmp5_ = NULL;
+ GAppInfo* app_info;
+ gchar* _tmp6_;
+ gchar* _tmp7_ = NULL;
+ gchar* mpris_key;
+ gboolean _tmp8_;
g_return_if_fail (self != NULL);
- g_return_if_fail (type != NULL);
- g_debug ("music-player-bridge.vala:81: MusicPlayerBridge -> on_server_added with" \
-" value %s", type);
- _tmp0_ = music_player_bridge_server_is_not_of_interest (self, type);
+ g_return_if_fail (desktop != NULL);
+ g_return_if_fail (dbus_name != NULL);
+ if (desktop == NULL) {
+ _tmp0_ = TRUE;
+ } else {
+ _tmp0_ = g_strcmp0 (desktop, "") == 0;
+ }
if (_tmp0_) {
+ g_warning ("music-player-bridge.vala:82: Client %s attempting to register without " \
+"desktop entry being set on the mpris root", dbus_name);
return;
}
- if (self->priv->root_menu != NULL) {
- indicate_listener_get_server_property_cb cb;
- cb = (indicate_listener_get_server_property_cb) music_player_bridge_desktop_info_callback;
- indicate_listener_server_get_desktop (self->priv->listener, object, cb, self);
- }
-}
-
-
-static void music_player_bridge_desktop_info_callback (MusicPlayerBridge* self, IndicateListenerServer* server, gchar* path, void* data) {
- void* _tmp0_;
- MusicPlayerBridge* _tmp1_;
- MusicPlayerBridge* bridge;
- GAppInfo* _tmp2_ = NULL;
- GAppInfo* app_info;
- gchar* _tmp3_;
- gchar* _tmp4_ = NULL;
- gchar* mpris_key;
- gboolean _tmp5_;
- g_return_if_fail (self != NULL);
- g_return_if_fail (path != NULL);
- _tmp1_ = _g_object_ref0 ((_tmp0_ = data, IS_MUSIC_PLAYER_BRIDGE (_tmp0_) ? ((MusicPlayerBridge*) _tmp0_) : NULL));
- bridge = _tmp1_;
- _tmp2_ = music_player_bridge_create_app_info (path);
- app_info = _tmp2_;
+ 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_;
if (app_info == NULL) {
- g_warning ("music-player-bridge.vala:96: Could not create app_info for path %s \n" \
+ g_warning ("music-player-bridge.vala:90: Could not create app_info for path %s \n" \
" Getting out of here ", path);
_g_object_unref0 (app_info);
- _g_object_unref0 (bridge);
_g_free0 (path);
return;
}
- _tmp3_ = g_strdup (path);
- _tmp4_ = music_player_bridge_determine_key (_tmp3_);
- mpris_key = _tmp4_;
- _tmp5_ = familiar_players_db_already_familiar (bridge->priv->playersDB, path);
- if (_tmp5_ == FALSE) {
- gchar* _tmp6_ = NULL;
- gchar* _tmp7_;
- gint _tmp8_;
- PlayerController* _tmp9_ = NULL;
- PlayerController* _tmp10_;
+ _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_;
PlayerController* ctrl;
- g_debug ("music-player-bridge.vala:103: New client has registered that we have s" \
-"een before: %s", path);
- familiar_players_db_insert (bridge->priv->playersDB, path);
- _tmp6_ = familiar_players_db_fetch_icon_name (path);
- _tmp7_ = _tmp6_;
- _tmp8_ = music_player_bridge_calculate_menu_position (bridge);
- _tmp9_ = player_controller_new (bridge->priv->root_menu, app_info, mpris_key, _tmp7_, _tmp8_, PLAYER_CONTROLLER_STATE_READY);
- ctrl = (_tmp10_ = _tmp9_, _g_free0 (_tmp7_), _tmp10_);
- gee_abstract_map_set ((GeeAbstractMap*) bridge->priv->registered_clients, mpris_key, ctrl);
- g_debug ("music-player-bridge.vala:112: successfully created appinfo and instanc" \
-"e from path and set it on the respective instance");
+ 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_);
+ 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" \
+"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_object_unref0 (ctrl);
} else {
- gpointer _tmp11_ = NULL;
- PlayerController* _tmp12_;
- gpointer _tmp13_ = NULL;
- PlayerController* _tmp14_;
- _tmp11_ = gee_abstract_map_get ((GeeAbstractMap*) bridge->priv->registered_clients, mpris_key);
- _tmp12_ = (PlayerController*) _tmp11_;
- player_controller_update_state (_tmp12_, PLAYER_CONTROLLER_STATE_READY);
- _g_object_unref0 (_tmp12_);
- _tmp13_ = gee_abstract_map_get ((GeeAbstractMap*) bridge->priv->registered_clients, mpris_key);
- _tmp14_ = (PlayerController*) _tmp13_;
- player_controller_activate (_tmp14_);
- _g_object_unref0 (_tmp14_);
- g_debug ("music-player-bridge.vala:117: Ignoring desktop file path callback beca" \
-"use the db cache file has it already: %s \n", path);
+ 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" \
+"ken the hibernation: %s \n", dbus_name);
}
_g_free0 (mpris_key);
_g_object_unref0 (app_info);
- _g_object_unref0 (bridge);
_g_free0 (path);
}
-void music_player_bridge_on_server_removed (MusicPlayerBridge* self, IndicateListenerServer* object, const gchar* type) {
- gboolean _tmp0_;
+void music_player_bridge_client_has_vanished (MusicPlayerBridge* self, const gchar* mpris_root_interface) {
g_return_if_fail (self != NULL);
- g_return_if_fail (type != NULL);
- g_debug ("music-player-bridge.vala:123: MusicPlayerBridge -> on_server_removed w" \
-"ith value %s", type);
- _tmp0_ = music_player_bridge_server_is_not_of_interest (self, type);
- if (_tmp0_) {
- return;
- }
+ 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);
if (self->priv->root_menu != NULL) {
- gchar** _tmp1_;
- gchar** _tmp2_ = NULL;
- gint tmp_length1;
- gint _tmp_size_;
- gchar** _tmp3_;
- gchar** tmp;
- _tmp2_ = _tmp1_ = g_strsplit (type, ".", 0);
- _tmp3_ = _tmp2_;
- tmp_length1 = _vala_array_length (_tmp1_);
- _tmp_size_ = tmp_length1;
- tmp = _tmp3_;
- g_debug ("music-player-bridge.vala:127: attempt to remove %s", tmp[tmp_length1 - 1]);
- if (tmp_length1 > 0) {
- gpointer _tmp4_ = NULL;
- PlayerController* _tmp5_;
- _tmp4_ = gee_abstract_map_get ((GeeAbstractMap*) self->priv->registered_clients, tmp[tmp_length1 - 1]);
- _tmp5_ = (PlayerController*) _tmp4_;
- player_controller_hibernate (_tmp5_);
- _g_object_unref0 (_tmp5_);
- g_debug ("music-player-bridge.vala:130: Successively offlined client %s", tmp[tmp_length1 - 1]);
+ gchar* _tmp0_;
+ gchar* _tmp1_ = NULL;
+ gchar* mpris_key;
+ g_debug ("music-player-bridge.vala:120: 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);
}
- tmp = (_vala_array_free (tmp, tmp_length1, (GDestroyNotify) g_free), NULL);
+ _g_free0 (mpris_key);
}
}
-static gboolean string_contains (const gchar* self, const gchar* needle) {
- gboolean result = FALSE;
- const gchar* _tmp0_ = NULL;
- g_return_val_if_fail (self != NULL, FALSE);
- g_return_val_if_fail (needle != NULL, FALSE);
- _tmp0_ = strstr (self, needle);
- result = _tmp0_ != NULL;
- return result;
+static gpointer _g_object_ref0 (gpointer self) {
+ return self ? g_object_ref (self) : NULL;
}
-static gboolean music_player_bridge_server_is_not_of_interest (MusicPlayerBridge* self, const gchar* type) {
- gboolean result = FALSE;
- gboolean _tmp0_;
- g_return_val_if_fail (self != NULL, FALSE);
- g_return_val_if_fail (type != NULL, FALSE);
- if (type == NULL) {
- result = TRUE;
- return result;
- }
- _tmp0_ = string_contains (type, "music");
- if (_tmp0_ == FALSE) {
- g_debug ("music-player-bridge.vala:138: server is of no interest, it is not an " \
-"music server");
- result = TRUE;
- return result;
- }
- result = FALSE;
- return result;
+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_vanished_mpris2_watcher_client_disappeared (Mpris2Watcher* _sender, const gchar* dbus_name, gpointer self) {
+ music_player_bridge_client_has_vanished (self, dbus_name);
}
void music_player_bridge_set_root_menu_item (MusicPlayerBridge* self, DbusmenuMenuitem* menu) {
DbusmenuMenuitem* _tmp0_;
DbusmenuMenuitem* _tmp1_;
+ Mpris2Watcher* _tmp2_ = NULL;
+ Mpris2Watcher* _tmp3_;
g_return_if_fail (self != NULL);
g_return_if_fail (menu != NULL);
_tmp0_ = _g_object_ref0 (menu);
_tmp1_ = _tmp0_;
_g_object_unref0 (self->priv->root_menu);
self->priv->root_menu = _tmp1_;
+ _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);
}
-GAppInfo* music_player_bridge_create_app_info (const gchar* path) {
+static GAppInfo* music_player_bridge_create_app_info (const gchar* path) {
GAppInfo* result = NULL;
GDesktopAppInfo* _tmp0_ = NULL;
GDesktopAppInfo* info;
- GDesktopAppInfo* _tmp1_;
- GAppInfo* _tmp2_;
+ gboolean _tmp1_ = FALSE;
+ GDesktopAppInfo* _tmp2_;
+ GAppInfo* _tmp3_;
GAppInfo* app_info;
g_return_val_if_fail (path != NULL, NULL);
_tmp0_ = g_desktop_app_info_new_from_filename (path);
info = _tmp0_;
if (path == NULL) {
- g_warning ("music-player-bridge.vala:154: Could not create a desktopappinfo instan" \
+ _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);
result = NULL;
_g_object_unref0 (info);
return result;
}
- _tmp2_ = _g_object_ref0 ((_tmp1_ = info, G_IS_APP_INFO (_tmp1_) ? ((GAppInfo*) _tmp1_) : NULL));
- app_info = _tmp2_;
+ _tmp3_ = _g_object_ref0 ((_tmp2_ = info, G_IS_APP_INFO (_tmp2_) ? ((GAppInfo*) _tmp2_) : NULL));
+ app_info = _tmp3_;
result = app_info;
_g_object_unref0 (info);
return result;
}
+static gchar* music_player_bridge_fetch_icon_name (const gchar* desktop_path) {
+ gchar* result = NULL;
+ GKeyFile* _tmp0_ = NULL;
+ GKeyFile* desktop_keyfile;
+ gchar* _tmp1_ = NULL;
+ gchar* _tmp2_;
+ 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_);
+ if (_inner_error_ != NULL) {
+ if (_inner_error_->domain == G_FILE_ERROR) {
+ goto __catch0_g_file_error;
+ }
+ if (_inner_error_->domain == G_KEY_FILE_ERROR) {
+ goto __catch0_g_key_file_error;
+ }
+ _g_key_file_free0 (desktop_keyfile);
+ 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;
+ }
+ goto __finally0;
+ __catch0_g_file_error:
+ {
+ GError * _error_;
+ _error_ = _inner_error_;
+ _inner_error_ = NULL;
+ g_warning ("music-player-bridge.vala:156: Error loading keyfile - FileError");
+ result = NULL;
+ _g_error_free0 (_error_);
+ _g_key_file_free0 (desktop_keyfile);
+ return result;
+ }
+ goto __finally0;
+ __catch0_g_key_file_error:
+ {
+ GError * _error_;
+ _error_ = _inner_error_;
+ _inner_error_ = NULL;
+ g_warning ("music-player-bridge.vala:160: Error loading keyfile - KeyFileError");
+ result = NULL;
+ _g_error_free0 (_error_);
+ _g_key_file_free0 (desktop_keyfile);
+ return result;
+ }
+ __finally0:
+ if (_inner_error_ != NULL) {
+ _g_key_file_free0 (desktop_keyfile);
+ 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_;
+ 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_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_;
+ _g_key_file_free0 (desktop_keyfile);
+ return result;
+ goto __finally1;
+ __catch1_g_key_file_error:
+ {
+ GError * _error_;
+ _error_ = _inner_error_;
+ _inner_error_ = NULL;
+ g_warning ("music-player-bridge.vala:169: Error trying to fetch the icon name from" \
+" the keyfile");
+ result = NULL;
+ _g_error_free0 (_error_);
+ _g_key_file_free0 (desktop_keyfile);
+ return result;
+ }
+ __finally1:
+ _g_key_file_free0 (desktop_keyfile);
+ 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) {
gchar* result = NULL;
gchar** _tmp0_;
@@ -480,20 +532,20 @@ static gchar* music_player_bridge_determine_key (gchar* path) {
gint _tokens_size_;
gchar** _tmp2_;
gchar** tokens;
- gchar* _tmp3_;
+ gchar* _tmp6_;
gchar* filename;
- gchar** _tmp4_;
- gchar** _tmp5_ = NULL;
- gchar** _tmp6_;
- gint _tmp6__length1;
- gchar* _tmp7_;
- gchar* _tmp8_;
- gchar* _result_;
+ gchar** _tmp7_;
+ gchar** _tmp8_ = NULL;
gchar** _tmp9_;
- gchar** _tmp10_ = NULL;
+ gint _tmp9__length1;
+ gchar* _tmp10_;
+ gchar* _tmp11_;
+ gchar* _result_;
+ gchar** _tmp12_;
+ gchar** _tmp13_ = NULL;
gint temp_length1;
gint _temp_size_;
- gchar** _tmp11_;
+ gchar** _tmp14_;
gchar** temp;
g_return_val_if_fail (path != NULL, NULL);
_tmp1_ = _tmp0_ = g_strsplit (path, "/", 0);
@@ -502,32 +554,43 @@ static gchar* music_player_bridge_determine_key (gchar* path) {
_tokens_size_ = tokens_length1;
tokens = _tmp2_;
if (tokens_length1 < 2) {
- result = NULL;
+ gchar** _tmp3_;
+ gchar** _tmp4_ = NULL;
+ gchar** _tmp5_;
+ _tmp4_ = _tmp3_ = g_strsplit (path, ".", 0);
+ _tmp5_ = _tmp4_;
tokens = (_vala_array_free (tokens, tokens_length1, (GDestroyNotify) g_free), NULL);
- _g_free0 (path);
- return result;
+ 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;
+ }
}
- _tmp3_ = g_strdup (tokens[tokens_length1 - 1]);
- filename = _tmp3_;
- _tmp5_ = _tmp4_ = g_strsplit (filename, ".", 0);
- _tmp6_ = _tmp5_;
- _tmp6__length1 = _vala_array_length (_tmp4_);
- _tmp7_ = g_strdup (_tmp6_[0]);
- _result_ = (_tmp8_ = _tmp7_, _tmp6_ = (_vala_array_free (_tmp6_, _tmp6__length1, (GDestroyNotify) g_free), NULL), _tmp8_);
- _tmp10_ = _tmp9_ = g_strsplit (_result_, "-", 0);
- _tmp11_ = _tmp10_;
- temp_length1 = _vala_array_length (_tmp9_);
+ _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_);
_temp_size_ = temp_length1;
- temp = _tmp11_;
+ temp = _tmp14_;
if (temp_length1 > 1) {
- gchar* _tmp12_;
- gchar* _tmp13_;
- _tmp12_ = g_strdup (temp[0]);
- _tmp13_ = _tmp12_;
+ gchar* _tmp15_;
+ gchar* _tmp16_;
+ _tmp15_ = g_strdup (temp[0]);
+ _tmp16_ = _tmp15_;
_g_free0 (_result_);
- _result_ = _tmp13_;
+ _result_ = _tmp16_;
}
- g_debug ("music-player-bridge.vala:171: determine key result = %s", _result_);
+ g_debug ("music-player-bridge.vala:197: determine key result = %s", _result_);
result = _result_;
temp = (_vala_array_free (temp, temp_length1, (GDestroyNotify) g_free), NULL);
_g_free0 (filename);
@@ -537,9 +600,39 @@ static gchar* music_player_bridge_determine_key (gchar* path) {
}
+static void _music_player_bridge_on_blacklist_update_settings_manager_blacklist_updates (SettingsManager* _sender, gchar** new_blacklist, int new_blacklist_length1, gpointer self) {
+ music_player_bridge_on_blacklist_update (self, new_blacklist, new_blacklist_length1);
+}
+
+
+static GObject * music_player_bridge_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
+ GObject * obj;
+ GObjectClass * parent_class;
+ MusicPlayerBridge * self;
+ GeeHashMap* _tmp0_ = NULL;
+ GeeHashMap* _tmp1_;
+ SettingsManager* _tmp2_ = NULL;
+ SettingsManager* _tmp3_;
+ parent_class = G_OBJECT_CLASS (music_player_bridge_parent_class);
+ obj = parent_class->constructor (type, n_construct_properties, construct_properties);
+ self = MUSIC_PLAYER_BRIDGE (obj);
+ _tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, TYPE_PLAYER_CONTROLLER, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, NULL);
+ _tmp1_ = _tmp0_;
+ _g_object_unref0 (self->priv->registered_clients);
+ self->priv->registered_clients = _tmp1_;
+ _tmp2_ = settings_manager_new ();
+ _tmp3_ = _tmp2_;
+ _g_object_unref0 (self->priv->settings_manager);
+ self->priv->settings_manager = _tmp3_;
+ g_signal_connect_object (self->priv->settings_manager, "blacklist-updates", (GCallback) _music_player_bridge_on_blacklist_update_settings_manager_blacklist_updates, self, 0);
+ return obj;
+}
+
+
static void music_player_bridge_class_init (MusicPlayerBridgeClass * klass) {
music_player_bridge_parent_class = g_type_class_peek_parent (klass);
g_type_class_add_private (klass, sizeof (MusicPlayerBridgePrivate));
+ G_OBJECT_CLASS (klass)->constructor = music_player_bridge_constructor;
G_OBJECT_CLASS (klass)->finalize = music_player_bridge_finalize;
}
@@ -552,10 +645,11 @@ static void music_player_bridge_instance_init (MusicPlayerBridge * self) {
static void music_player_bridge_finalize (GObject* obj) {
MusicPlayerBridge * self;
self = MUSIC_PLAYER_BRIDGE (obj);
- _g_object_unref0 (self->priv->listener);
+ _g_object_unref0 (self->priv->settings_manager);
_g_object_unref0 (self->priv->root_menu);
_g_object_unref0 (self->priv->registered_clients);
- _g_object_unref0 (self->priv->playersDB);
+ _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 26c9974..13eebe1 100644
--- a/src/music-player-bridge.h
+++ b/src/music-player-bridge.h
@@ -6,21 +6,14 @@
#include <glib.h>
#include <glib-object.h>
-#include <libindicate/./indicator-messages.h>
-#include <libindicate/./indicator.h>
-#include <libindicate/./interests.h>
-#include <libindicate/./listener.h>
-#include <libindicate/./server.h>
#include <stdlib.h>
#include <string.h>
#include <libdbusmenu-glib/client.h>
#include <libdbusmenu-glib/menuitem-proxy.h>
#include <libdbusmenu-glib/menuitem.h>
#include <libdbusmenu-glib/server.h>
-#include <gio/gio.h>
#include <gee.h>
-#include <dbus/dbus-glib-lowlevel.h>
-#include <dbus/dbus-glib.h>
+#include <gio/gio.h>
G_BEGIN_DECLS
@@ -117,6 +110,8 @@ typedef struct _Mpris2ControllerClass Mpris2ControllerClass;
typedef struct _MprisRoot MprisRoot;
typedef struct _MprisRootIface MprisRootIface;
+#define TYPE_MPRIS_ROOT_PROXY (mpris_root_proxy_get_type ())
+
#define TYPE_MPRIS_PLAYER (mpris_player_get_type ())
#define MPRIS_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_PLAYER, MprisPlayer))
#define IS_MPRIS_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_PLAYER))
@@ -125,6 +120,29 @@ typedef struct _MprisRootIface MprisRootIface;
typedef struct _MprisPlayer MprisPlayer;
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))
+
+typedef struct _FreeDesktopObject FreeDesktopObject;
+typedef struct _FreeDesktopObjectIface FreeDesktopObjectIface;
+
+#define TYPE_FREE_DESKTOP_OBJECT_PROXY (free_desktop_object_proxy_get_type ())
+
+#define TYPE_MPRIS2_WATCHER (mpris2_watcher_get_type ())
+#define MPRIS2_WATCHER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS2_WATCHER, Mpris2Watcher))
+#define MPRIS2_WATCHER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS2_WATCHER, Mpris2WatcherClass))
+#define IS_MPRIS2_WATCHER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS2_WATCHER))
+#define IS_MPRIS2_WATCHER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS2_WATCHER))
+#define MPRIS2_WATCHER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS2_WATCHER, Mpris2WatcherClass))
+
+typedef struct _Mpris2Watcher Mpris2Watcher;
+typedef struct _Mpris2WatcherClass Mpris2WatcherClass;
+typedef struct _Mpris2WatcherPrivate Mpris2WatcherPrivate;
+
#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))
@@ -132,18 +150,20 @@ typedef struct _MprisPlayerIface MprisPlayerIface;
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_FAMILIAR_PLAYERS_DB (familiar_players_db_get_type ())
-#define FAMILIAR_PLAYERS_DB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FAMILIAR_PLAYERS_DB, FamiliarPlayersDB))
-#define FAMILIAR_PLAYERS_DB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FAMILIAR_PLAYERS_DB, FamiliarPlayersDBClass))
-#define IS_FAMILIAR_PLAYERS_DB(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FAMILIAR_PLAYERS_DB))
-#define IS_FAMILIAR_PLAYERS_DB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FAMILIAR_PLAYERS_DB))
-#define FAMILIAR_PLAYERS_DB_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FAMILIAR_PLAYERS_DB, FamiliarPlayersDBClass))
+#define TYPE_SETTINGS_MANAGER (settings_manager_get_type ())
+#define SETTINGS_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SETTINGS_MANAGER, SettingsManager))
+#define SETTINGS_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SETTINGS_MANAGER, SettingsManagerClass))
+#define IS_SETTINGS_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SETTINGS_MANAGER))
+#define IS_SETTINGS_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SETTINGS_MANAGER))
+#define SETTINGS_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SETTINGS_MANAGER, SettingsManagerClass))
-typedef struct _FamiliarPlayersDB FamiliarPlayersDB;
-typedef struct _FamiliarPlayersDBClass FamiliarPlayersDBClass;
-typedef struct _FamiliarPlayersDBPrivate FamiliarPlayersDBPrivate;
+typedef struct _SettingsManager SettingsManager;
+typedef struct _SettingsManagerClass SettingsManagerClass;
+typedef struct _SettingsManagerPrivate SettingsManagerPrivate;
#define TYPE_FETCH_FILE (fetch_file_get_type ())
#define FETCH_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FETCH_FILE, FetchFile))
@@ -273,6 +293,21 @@ struct _MprisPlayerIface {
void (*set_PlaybackStatus) (MprisPlayer* self, const gchar* value);
};
+struct _FreeDesktopObjectIface {
+ GTypeInterface parent_iface;
+ void (*list_names) (FreeDesktopObject* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+ gchar** (*list_names_finish) (FreeDesktopObject* self, GAsyncResult* _res_, int* result_length1, GError** error);
+};
+
+struct _Mpris2Watcher {
+ GObject parent_instance;
+ Mpris2WatcherPrivate * priv;
+};
+
+struct _Mpris2WatcherClass {
+ GObjectClass parent_class;
+};
+
struct _FreeDesktopPropertiesIface {
GTypeInterface parent_iface;
};
@@ -286,12 +321,12 @@ struct _Mpris2ControllerClass {
GObjectClass parent_class;
};
-struct _FamiliarPlayersDB {
+struct _SettingsManager {
GObject parent_instance;
- FamiliarPlayersDBPrivate * priv;
+ SettingsManagerPrivate * priv;
};
-struct _FamiliarPlayersDBClass {
+struct _SettingsManagerClass {
GObjectClass parent_class;
};
@@ -308,10 +343,9 @@ 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_on_server_added (MusicPlayerBridge* self, IndicateListenerServer* object, const gchar* type);
-void music_player_bridge_on_server_removed (MusicPlayerBridge* self, IndicateListenerServer* object, const gchar* type);
+void music_player_bridge_client_has_become_available (MusicPlayerBridge* self, const gchar* desktop, const gchar* dbus_name);
+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);
-GAppInfo* music_player_bridge_create_app_info (const gchar* path);
GType player_item_get_type (void) G_GNUC_CONST;
GType transport_menuitem_get_type (void) G_GNUC_CONST;
GType transport_menuitem_action_get_type (void) G_GNUC_CONST;
@@ -337,26 +371,26 @@ 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* mpris_name, const gchar* icon_name, gint offset, PlayerControllerstate initial_state);
-PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, GAppInfo* app, const gchar* mpris_name, const gchar* icon_name, gint offset, PlayerControllerstate initial_state);
+PlayerController* player_controller_new (DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, 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);
void player_controller_update_state (PlayerController* self, PlayerControllerstate new_state);
-void player_controller_activate (PlayerController* self);
+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);
-void player_controller_determine_state (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_mpris_name (PlayerController* self);
-void player_controller_set_mpris_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);
void player_controller_set_app_info (PlayerController* self, GAppInfo* value);
gint player_controller_get_menu_offset (PlayerController* self);
void player_controller_set_menu_offset (PlayerController* self, gint value);
const gchar* player_controller_get_icon_name (PlayerController* self);
void player_controller_set_icon_name (PlayerController* self, const gchar* value);
-MprisRoot* mpris_root_dbus_proxy_new (DBusGConnection* connection, const char* name, const char* path);
+GType mpris_root_proxy_get_type (void) G_GNUC_CONST;
+guint mpris_root_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
GType mpris_root_get_type (void) G_GNUC_CONST;
void mpris_root_Quit (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
void mpris_root_Quit_finish (MprisRoot* self, GAsyncResult* _res_, GError** error);
@@ -372,7 +406,8 @@ gchar* mpris_root_get_Identity (MprisRoot* self);
void mpris_root_set_Identity (MprisRoot* self, const gchar* value);
gchar* mpris_root_get_DesktopEntry (MprisRoot* self);
void mpris_root_set_DesktopEntry (MprisRoot* self, const gchar* value);
-MprisPlayer* mpris_player_dbus_proxy_new (DBusGConnection* connection, const char* name, const char* path);
+GType mpris_player_proxy_get_type (void) G_GNUC_CONST;
+guint mpris_player_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
GType mpris_player_get_type (void) G_GNUC_CONST;
void mpris_player_PlayPause (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
void mpris_player_PlayPause_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
@@ -386,21 +421,29 @@ 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 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;
-FreeDesktopProperties* free_desktop_properties_dbus_proxy_new (DBusGConnection* connection, const char* name, const char* path);
-#define MPRIS2_CONTROLLER_root_interface "org.mpris.MediaPlayer2"
+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);
gboolean mpris2_controller_connected (Mpris2Controller* self);
-gboolean mpris2_controller_was_successfull (Mpris2Controller* self);
void mpris2_controller_expose (Mpris2Controller* self);
MprisRoot* mpris2_controller_get_mpris2_root (Mpris2Controller* self);
MprisPlayer* mpris2_controller_get_player (Mpris2Controller* self);
-PlayerController* mpris2_controller_get_owner (Mpris2Controller* self);
FreeDesktopProperties* mpris2_controller_get_properties_interface (Mpris2Controller* self);
+PlayerController* mpris2_controller_get_owner (Mpris2Controller* self);
PlayerItem* player_item_new (const gchar* type);
PlayerItem* player_item_construct (GType object_type, const gchar* type);
void player_item_reset (PlayerItem* self, GeeHashSet* attrs);
@@ -408,13 +451,12 @@ void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attribu
gboolean player_item_populated (PlayerItem* self, GeeHashSet* attrs);
PlayerController* player_item_get_owner (PlayerItem* self);
const gchar* player_item_get_item_type (PlayerItem* self);
-GType familiar_players_db_get_type (void) G_GNUC_CONST;
-FamiliarPlayersDB* familiar_players_db_new (void);
-FamiliarPlayersDB* familiar_players_db_construct (GType object_type);
-void familiar_players_db_insert (FamiliarPlayersDB* self, const gchar* desktop);
-gboolean familiar_players_db_already_familiar (FamiliarPlayersDB* self, const gchar* desktop);
-GeeSet* familiar_players_db_records (FamiliarPlayersDB* self);
-gchar* familiar_players_db_fetch_icon_name (const gchar* desktop_path);
+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);
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 f13c2f4..327a775 100644
--- a/src/music-player-bridge.vala
+++ b/src/music-player-bridge.vala
@@ -17,151 +17,177 @@ 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 Indicate;
using Dbusmenu;
using Gee;
using GLib;
public class MusicPlayerBridge : GLib.Object
{
- private Listener listener;
+ private SettingsManager settings_manager;
private Dbusmenu.Menuitem root_menu;
- private HashMap<string, PlayerController> registered_clients;
- private FamiliarPlayersDB playersDB;
-
+ private HashMap<string, PlayerController> registered_clients;
+ private Mpris2Watcher watcher;
+ private const string DESKTOP_PREFIX = "/usr/share/applications/";
+ private Settings settings;
+
public MusicPlayerBridge()
{
- playersDB = new FamiliarPlayersDB();
- registered_clients = new HashMap<string, PlayerController> ();
- listener = Listener.ref_default();
- listener.server_added.connect(on_server_added);
- listener.server_removed.connect(on_server_removed);
+ }
+
+ construct{
+ this.registered_clients = new HashMap<string, PlayerController> ();
+ this.settings_manager = new SettingsManager();
+ this.settings_manager.blacklist_updates.connect ( this.on_blacklist_update );
+ }
+
+ private void on_blacklist_update ( string[] blacklist )
+ {
+ debug("some blacklist update");
}
- private void try_to_add_inactive_familiar_clients(){
- foreach(string app in this.playersDB.records()){
- if(app == null){
- warning("App string in keyfile is null therefore moving on to next player");
- continue;
- }
-
- debug("attempting to make an app info from %s", app);
-
- DesktopAppInfo info = new DesktopAppInfo.from_filename(app);
+ private void try_to_add_inactive_familiar_clients()
+ {
+ 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 );
+ if ( app_info == null ){
+ warning ( "Could not create app_info for path %s \n Getting out of here ", path);
+ continue;
+ }
+ var mpris_key = determine_key ( path );
+ PlayerController ctrl = new PlayerController ( this.root_menu,
+ app_info,
+ null,
+ this.fetch_icon_name(path),
+ calculate_menu_position(),
+ PlayerController.state.OFFLINE );
+ this.registered_clients.set(mpris_key, ctrl);
+ }
+ }
- if(info == null){
- warning("Could not create a desktopappinfo instance from app,: %s , moving on to the next client", app);
- continue;
- }
-
- GLib.AppInfo app_info = info as GLib.AppInfo;
- var mpris_key = determine_key(app);
- PlayerController ctrl = new PlayerController(this.root_menu,
- app_info,
- mpris_key,
- playersDB.fetch_icon_name(app),
- calculate_menu_position(),
- PlayerController.state.OFFLINE);
- this.registered_clients.set(mpris_key, ctrl);
- }
- }
-
- private int calculate_menu_position()
- {
- if(this.registered_clients.size == 0){
- return 2;
- }
- else{
- return (2 + (this.registered_clients.size * PlayerController.WIDGET_QUANTITY));
- }
- }
-
- public void on_server_added(Indicate.ListenerServer object, string type)
+ private int calculate_menu_position()
{
- debug("MusicPlayerBridge -> on_server_added with value %s", type);
- if(server_is_not_of_interest(type)) return;
- if ( this.root_menu != null ){
- listener_get_server_property_cb cb = (listener_get_server_property_cb)desktop_info_callback;
- this.listener.server_get_desktop(object, cb, this);
- }
+ if(this.registered_clients.size == 0){
+ return 2;
+ }
+ else{
+ return (2 + (this.registered_clients.size * PlayerController.WIDGET_QUANTITY));
+ }
}
- private void desktop_info_callback ( Indicate.ListenerServer server,
- owned string path,
- void* data )
- {
- MusicPlayerBridge bridge = data as MusicPlayerBridge;
- AppInfo? app_info = create_app_info(path);
+ public void client_has_become_available ( string desktop, string dbus_name )
+ {
+ if (desktop == null || desktop == ""){
+ warning("Client %s attempting to register without desktop entry being set on the mpris root",
+ dbus_name);
+ return;
+ }
+ debug ( "client_has_become_available %s", desktop );
+ string path = DESKTOP_PREFIX.concat ( desktop.concat( ".desktop" ) );
+ AppInfo? app_info = create_app_info ( path );
if ( app_info == null ){
warning ( "Could not create app_info for path %s \n Getting out of here ", path);
return;
}
- var mpris_key = determine_key(path);
-
- if(bridge.playersDB.already_familiar(path) == false){
- debug("New client has registered that we have seen before: %s", path);
- bridge.playersDB.insert(path);
- PlayerController ctrl = new PlayerController ( bridge.root_menu,
- app_info,
- mpris_key,
- playersDB.fetch_icon_name(path),
- bridge.calculate_menu_position(),
- PlayerController.state.READY );
- bridge.registered_clients.set(mpris_key, ctrl);
- debug("successfully created appinfo and instance from path and set it on the respective instance");
- }
- else{
- bridge.registered_clients[mpris_key].update_state(PlayerController.state.READY);
- bridge.registered_clients[mpris_key].activate();
- debug("Ignoring desktop file path callback because the db cache file has it already: %s \n", path);
- }
- }
+ var mpris_key = determine_key ( path );
+ // 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.calculate_menu_position(),
+ PlayerController.state.READY );
+ this.registered_clients.set ( mpris_key, ctrl );
+ debug ( "Have not seen this %s before, new controller created.", desktop );
+ this.settings_manager.add_interested ( desktop );
+ debug ( "application added to the interested list" );
+ }
+ else{
+ 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 );
+ }
+ }
- public void on_server_removed(Indicate.ListenerServer object, string type)
+ public void client_has_vanished ( string mpris_root_interface )
{
- debug("MusicPlayerBridge -> on_server_removed with value %s", type);
- if(server_is_not_of_interest(type)) return;
- if (root_menu != null){
- var tmp = type.split(".");
- debug("attempt to remove %s", tmp[tmp.length-1]);
- if(tmp.length > 0){
- registered_clients[tmp[tmp.length - 1]].hibernate();
- debug("Successively offlined client %s", tmp[tmp.length - 1]);
+ debug("MusicPlayerBridge -> on_server_removed with value %s", 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 ){
+ registered_clients[mpris_key].hibernate();
+ debug("Successively offlined client %s", mpris_key);
}
- }
- }
-
- private bool server_is_not_of_interest(string type){
- if (type == null) return true;
- if (type.contains("music") == false) {
- debug("server is of no interest, it is not an music server");
- return true;
}
- return false;
- }
-
- public void set_root_menu_item(Dbusmenu.Menuitem menu)
+ }
+
+ public void set_root_menu_item ( Dbusmenu.Menuitem menu )
{
- this.root_menu = menu;
- try_to_add_inactive_familiar_clients();
+ this.root_menu = menu;
+ 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();
}
- public static AppInfo? create_app_info(string path)
- {
- DesktopAppInfo info = new DesktopAppInfo.from_filename(path);
- if(path == null){
- warning("Could not create a desktopappinfo instance from app: %s", path);
- return null;
- }
- GLib.AppInfo app_info = info as GLib.AppInfo;
- return app_info;
- }
+ private static AppInfo? create_app_info ( string path )
+ {
+ DesktopAppInfo info = new DesktopAppInfo.from_filename ( path ) ;
+ if ( path == null || info == null ){
+ warning ( "Could not create a desktopappinfo instance from app: %s", path );
+ return null;
+ }
+ GLib.AppInfo app_info = info as GLib.AppInfo;
+ return app_info;
+ }
+
+ private static string? fetch_icon_name(string desktop_path)
+ {
+ KeyFile desktop_keyfile = new KeyFile ();
+ try{
+ desktop_keyfile.load_from_file (desktop_path, KeyFileFlags.NONE);
+ }
+ catch(GLib.FileError error){
+ warning("Error loading keyfile - FileError");
+ return null;
+ }
+ catch(GLib.KeyFileError error){
+ warning("Error loading keyfile - KeyFileError");
+ return null;
+ }
+
+ try{
+ return desktop_keyfile.get_string (KeyFileDesktop.GROUP,
+ KeyFileDesktop.KEY_ICON);
+ }
+ catch(GLib.KeyFileError error){
+ warning("Error trying to fetch the icon name from the keyfile");
+ return null;
+ }
+ }
+ /*
+ 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.
+ */
private static string? determine_key(owned string path)
{
- var tokens = path.split("/");
- if ( tokens.length < 2) return null;
+ 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 filename = tokens[tokens.length - 1];
var result = filename.split(".")[0];
var temp = result.split("-");
diff --git a/src/player-controller.c b/src/player-controller.c
index e4a2172..2872736 100644
--- a/src/player-controller.c
+++ b/src/player-controller.c
@@ -116,7 +116,7 @@ struct _PlayerControllerClass {
struct _PlayerControllerPrivate {
DbusmenuMenuitem* root_menu;
gchar* _name;
- gchar* _mpris_name;
+ gchar* _dbus_name;
GAppInfo* _app_info;
gint _menu_offset;
gchar* _icon_name;
@@ -147,7 +147,7 @@ GType mpris2_controller_get_type (void) G_GNUC_CONST;
enum {
PLAYER_CONTROLLER_DUMMY_PROPERTY,
PLAYER_CONTROLLER_NAME,
- PLAYER_CONTROLLER_MPRIS_NAME,
+ PLAYER_CONTROLLER_DBUS_NAME,
PLAYER_CONTROLLER_APP_INFO,
PLAYER_CONTROLLER_MENU_OFFSET,
PLAYER_CONTROLLER_ICON_NAME
@@ -155,13 +155,13 @@ 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* mpris_name, const gchar* icon_name, gint offset, PlayerControllerstate initial_state);
-PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, GAppInfo* app, const gchar* mpris_name, const gchar* icon_name, gint offset, PlayerControllerstate initial_state);
+PlayerController* player_controller_new (DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, 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);
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_mpris_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);
@@ -169,11 +169,12 @@ 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);
-void player_controller_activate (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);
Mpris2Controller* mpris2_controller_new (PlayerController* ctrl);
Mpris2Controller* mpris2_controller_construct (GType object_type, PlayerController* ctrl);
-void player_controller_determine_state (PlayerController* self);
+static void player_controller_determine_state (PlayerController* self);
void player_controller_vanish (PlayerController* self);
void player_controller_hibernate (PlayerController* self);
void player_item_reset (PlayerItem* self, GeeHashSet* attrs);
@@ -195,7 +196,6 @@ GType transport_menuitem_get_type (void) G_GNUC_CONST;
gint player_controller_get_menu_offset (PlayerController* self);
gboolean mpris2_controller_connected (Mpris2Controller* self);
void mpris2_controller_initial_update (Mpris2Controller* self);
-const gchar* player_controller_get_mpris_name (PlayerController* self);
const gchar* player_controller_get_icon_name (PlayerController* self);
static void player_controller_finalize (GObject* obj);
static void _vala_player_controller_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
@@ -234,7 +234,7 @@ static gpointer _g_object_ref0 (gpointer self) {
}
-PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, GAppInfo* app, const gchar* mpris_name, const gchar* icon_name, gint offset, PlayerControllerstate initial_state) {
+PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, PlayerControllerstate initial_state) {
PlayerController * self = NULL;
DbusmenuMenuitem* _tmp0_;
DbusmenuMenuitem* _tmp1_;
@@ -246,7 +246,6 @@ PlayerController* player_controller_construct (GType object_type, DbusmenuMenuit
GeeArrayList* _tmp7_;
g_return_val_if_fail (root != NULL, NULL);
g_return_val_if_fail (app != NULL, NULL);
- g_return_val_if_fail (mpris_name != NULL, NULL);
g_return_val_if_fail (icon_name != NULL, NULL);
self = (PlayerController*) g_object_new (object_type, NULL);
_tmp0_ = _g_object_ref0 (root);
@@ -254,13 +253,13 @@ PlayerController* player_controller_construct (GType object_type, DbusmenuMenuit
_g_object_unref0 (self->priv->root_menu);
self->priv->root_menu = _tmp1_;
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_mpris_name (self, mpris_name);
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_;
@@ -275,8 +274,8 @@ PlayerController* player_controller_construct (GType object_type, DbusmenuMenuit
}
-PlayerController* player_controller_new (DbusmenuMenuitem* root, GAppInfo* app, const gchar* mpris_name, const gchar* icon_name, gint offset, PlayerControllerstate initial_state) {
- return player_controller_construct (TYPE_PLAYER_CONTROLLER, root, app, mpris_name, icon_name, offset, initial_state);
+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);
}
@@ -289,8 +288,10 @@ void player_controller_update_state (PlayerController* self, PlayerControllersta
}
-void player_controller_activate (PlayerController* self) {
+void player_controller_activate (PlayerController* self, const gchar* dbus_name) {
g_return_if_fail (self != NULL);
+ g_return_if_fail (dbus_name != NULL);
+ player_controller_set_dbus_name (self, dbus_name);
player_controller_establish_mpris_connection (self);
}
@@ -298,23 +299,23 @@ void player_controller_activate (PlayerController* self) {
void player_controller_instantiate (PlayerController* self) {
GError * _inner_error_ = NULL;
g_return_if_fail (self != NULL);
- g_debug ("player-controller.vala:94: instantiate in player controller for %s", self->priv->_name);
+ g_debug ("player-controller.vala:95: instantiate in player controller for %s", self->priv->_name);
g_app_info_launch (self->priv->_app_info, NULL, NULL, &_inner_error_);
if (_inner_error_ != NULL) {
- goto __catch4_g_error;
+ goto __catch6_g_error;
}
player_controller_update_state (self, PLAYER_CONTROLLER_STATE_INSTANTIATING);
- goto __finally4;
- __catch4_g_error:
+ goto __finally6;
+ __catch6_g_error:
{
GError * _error_;
_error_ = _inner_error_;
_inner_error_ = NULL;
- g_warning ("player-controller.vala:100: Failed to launch app %s with error message" \
+ g_warning ("player-controller.vala:101: Failed to launch app %s with error message" \
": %s", self->priv->_name, _error_->message);
_g_error_free0 (_error_);
}
- __finally4:
+ __finally6:
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_);
@@ -324,18 +325,24 @@ void player_controller_instantiate (PlayerController* self) {
static void player_controller_establish_mpris_connection (PlayerController* self) {
- Mpris2Controller* _tmp0_ = NULL;
- Mpris2Controller* _tmp1_;
+ gboolean _tmp0_ = FALSE;
+ Mpris2Controller* _tmp1_ = NULL;
+ Mpris2Controller* _tmp2_;
g_return_if_fail (self != NULL);
if (self->current_state != PLAYER_CONTROLLER_STATE_READY) {
- g_debug ("player-controller.vala:107: establish_mpris_connection - Not ready to " \
+ _tmp0_ = TRUE;
+ } else {
+ _tmp0_ = self->priv->_dbus_name == NULL;
+ }
+ if (_tmp0_) {
+ g_debug ("player-controller.vala:108: establish_mpris_connection - Not ready to " \
"connect");
return;
}
- _tmp0_ = mpris2_controller_new (self);
- _tmp1_ = _tmp0_;
+ _tmp1_ = mpris2_controller_new (self);
+ _tmp2_ = _tmp1_;
_g_object_unref0 (self->mpris_bridge);
- self->mpris_bridge = _tmp1_;
+ self->mpris_bridge = _tmp2_;
player_controller_determine_state (self);
}
@@ -619,9 +626,9 @@ static gchar* player_controller_format_player_name (gchar* app_info_name) {
_result_ = _tmp16_;
_g_free0 (_tmp14_);
_g_free0 (_tmp11_);
- g_debug ("player-controller.vala:176: PlayerController->format_player_name - : %" \
-"s", _result_);
}
+ g_debug ("player-controller.vala:178: PlayerController->format_player_name - : %" \
+"s", _result_);
result = _result_;
tokens = (_vala_array_free (tokens, tokens_length1, (GDestroyNotify) g_free), NULL);
_g_free0 (app_info_name);
@@ -629,7 +636,7 @@ static gchar* player_controller_format_player_name (gchar* app_info_name) {
}
-void player_controller_determine_state (PlayerController* self) {
+static void player_controller_determine_state (PlayerController* self) {
gboolean _tmp0_;
g_return_if_fail (self != NULL);
_tmp0_ = mpris2_controller_connected (self->mpris_bridge);
@@ -669,23 +676,23 @@ void player_controller_set_name (PlayerController* self, const gchar* value) {
}
-const gchar* player_controller_get_mpris_name (PlayerController* self) {
+const gchar* player_controller_get_dbus_name (PlayerController* self) {
const gchar* result;
g_return_val_if_fail (self != NULL, NULL);
- result = self->priv->_mpris_name;
+ result = self->priv->_dbus_name;
return result;
}
-void player_controller_set_mpris_name (PlayerController* self, const gchar* value) {
+void player_controller_set_dbus_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->_mpris_name);
- self->priv->_mpris_name = _tmp1_;
- g_object_notify ((GObject *) self, "mpris-name");
+ _g_free0 (self->priv->_dbus_name);
+ self->priv->_dbus_name = _tmp1_;
+ g_object_notify ((GObject *) self, "dbus-name");
}
@@ -751,7 +758,7 @@ static void player_controller_class_init (PlayerControllerClass * klass) {
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_MPRIS_NAME, g_param_spec_string ("mpris-name", "mpris-name", "mpris-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));
g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYER_CONTROLLER_ICON_NAME, g_param_spec_string ("icon-name", "icon-name", "icon-name", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
@@ -769,7 +776,7 @@ static void player_controller_finalize (GObject* obj) {
self = PLAYER_CONTROLLER (obj);
_g_object_unref0 (self->priv->root_menu);
_g_free0 (self->priv->_name);
- _g_free0 (self->priv->_mpris_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);
@@ -797,8 +804,8 @@ static void _vala_player_controller_get_property (GObject * object, guint proper
case PLAYER_CONTROLLER_NAME:
g_value_set_string (value, player_controller_get_name (self));
break;
- case PLAYER_CONTROLLER_MPRIS_NAME:
- g_value_set_string (value, player_controller_get_mpris_name (self));
+ case PLAYER_CONTROLLER_DBUS_NAME:
+ g_value_set_string (value, player_controller_get_dbus_name (self));
break;
case PLAYER_CONTROLLER_APP_INFO:
g_value_set_object (value, player_controller_get_app_info (self));
@@ -823,8 +830,8 @@ static void _vala_player_controller_set_property (GObject * object, guint proper
case PLAYER_CONTROLLER_NAME:
player_controller_set_name (self, g_value_get_string (value));
break;
- case PLAYER_CONTROLLER_MPRIS_NAME:
- player_controller_set_mpris_name (self, g_value_get_string (value));
+ case PLAYER_CONTROLLER_DBUS_NAME:
+ player_controller_set_dbus_name (self, g_value_get_string (value));
break;
case PLAYER_CONTROLLER_APP_INFO:
player_controller_set_app_info (self, g_value_get_object (value));
diff --git a/src/player-controller.vala b/src/player-controller.vala
index e2ae4d7..97f5303 100644
--- a/src/player-controller.vala
+++ b/src/player-controller.vala
@@ -23,147 +23,148 @@ using Gee;
public class PlayerController : GLib.Object
{
- public const int WIDGET_QUANTITY = 4;
-
- public static enum widget_order{
- SEPARATOR,
- TITLE,
- METADATA,
- TRANSPORT,
- }
-
- public enum state{
- OFFLINE,
- INSTANTIATING,
- READY,
- CONNECTED,
- DISCONNECTED
- }
-
- public int current_state = state.OFFLINE;
-
- private Dbusmenu.Menuitem root_menu;
- public string name { get; set;}
- public string mpris_name { get; set;}
- public ArrayList<PlayerItem> custom_items;
- public Mpris2Controller mpris_bridge;
- public AppInfo? app_info { get; set;}
- public int menu_offset { get; set;}
+ public const int WIDGET_QUANTITY = 4;
+
+ public static enum widget_order{
+ SEPARATOR,
+ TITLE,
+ METADATA,
+ TRANSPORT
+ }
+
+ public enum state{
+ OFFLINE,
+ INSTANTIATING,
+ READY,
+ CONNECTED,
+ DISCONNECTED
+ }
+
+ 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 Mpris2Controller mpris_bridge;
+ public AppInfo? app_info { get; set;}
+ public int menu_offset { get; set;}
public string icon_name { get; set; }
-
- public PlayerController(Dbusmenu.Menuitem root,
+
+ public PlayerController(Dbusmenu.Menuitem root,
GLib.AppInfo app,
- string mpris_name,
+ string? dbus_name,
string icon_name,
- int offset,
- state initial_state)
- {
- this.root_menu = root;
+ int offset,
+ state initial_state)
+ {
+ this.root_menu = root;
this.app_info = app;
- this.name = format_player_name(this.app_info.get_name());
- this.mpris_name = mpris_name;
+ 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;
- construct_widgets();
- establish_mpris_connection();
- this.update_layout();
- }
-
- public void update_state(state new_state)
- {
- debug("update_state - player controller %s : new state %i", this.name, new_state);
- this.current_state = new_state;
- this.update_layout();
- }
-
- public void activate()
- {
- this.establish_mpris_connection();
- }
-
- /*
- instantiate()
- The user should be able to start the app from the transport bar when in an offline state
- There is a need to wait before the application is on DBus before attempting to access its mpris address
- Hence only when the it has registered with us via libindicate do we attempt to kick off mpris communication
- */
- public void instantiate()
- {
- debug("instantiate in player controller for %s", this.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);
- }
- }
-
- private void establish_mpris_connection()
- {
- if(this.current_state != state.READY){
- debug("establish_mpris_connection - Not ready to connect");
- return;
- }
- this.mpris_bridge = new Mpris2Controller(this);
- this.determine_state();
- }
-
- public void vanish()
- {
- foreach(Dbusmenu.Menuitem item in this.custom_items){
- root_menu.child_delete(item);
- }
- }
-
- public void hibernate()
- {
- update_state(PlayerController.state.OFFLINE);
- 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);
- }
-
- public void update_layout()
- {
- 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);
- 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);
- }
-
- private void construct_widgets()
- {
- // Separator item
- this.custom_items.add(new PlayerItem(CLIENT_TYPES_SEPARATOR));
-
- // Title item
- TitleMenuitem title_menu_item = new TitleMenuitem(this);
- this.custom_items.add(title_menu_item);
-
- // Metadata item
- MetadataMenuitem metadata_item = new MetadataMenuitem();
- this.custom_items.add(metadata_item);
-
- // Transport item
- TransportMenuitem transport_item = new TransportMenuitem(this);
- this.custom_items.add(transport_item);
-
- foreach(PlayerItem item in this.custom_items){
- root_menu.child_add_position(item, this.menu_offset + this.custom_items.index_of(item));
- }
- }
-
+ 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();
+ }
+
+ public void update_state(state new_state)
+ {
+ debug("update_state - player controller %s : new state %i", this.name, new_state);
+ this.current_state = new_state;
+ this.update_layout();
+ }
+
+ public void activate( string dbus_name )
+ {
+ this.dbus_name = dbus_name;
+ this.establish_mpris_connection();
+ }
+
+ /*
+ instantiate()
+ The user should be able to start the app from the transport bar when in an offline state
+ There is a need to wait before the application is on DBus before attempting to access its mpris address
+ Hence only when the it has registered with us via libindicate do we attempt to kick off mpris communication
+ */
+ public void instantiate()
+ {
+ debug("instantiate in player controller for %s", this.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);
+ }
+ }
+
+ private void establish_mpris_connection()
+ {
+ if(this.current_state != state.READY || this.dbus_name == null ){
+ debug("establish_mpris_connection - Not ready to connect");
+ return;
+ }
+ this.mpris_bridge = new Mpris2Controller(this);
+ this.determine_state();
+ }
+
+ public void vanish()
+ {
+ foreach(Dbusmenu.Menuitem item in this.custom_items){
+ root_menu.child_delete(item);
+ }
+ }
+
+ public void hibernate()
+ {
+ update_state(PlayerController.state.OFFLINE);
+ 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);
+ }
+
+ public void update_layout()
+ {
+ 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);
+ 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);
+ }
+
+ private void construct_widgets()
+ {
+ // Separator item
+ this.custom_items.add(new PlayerItem(CLIENT_TYPES_SEPARATOR));
+
+ // Title item
+ TitleMenuitem title_menu_item = new TitleMenuitem(this);
+ this.custom_items.add(title_menu_item);
+
+ // Metadata item
+ MetadataMenuitem metadata_item = new MetadataMenuitem();
+ this.custom_items.add(metadata_item);
+
+ // Transport item
+ TransportMenuitem transport_item = new TransportMenuitem(this);
+ this.custom_items.add(transport_item);
+
+ foreach(PlayerItem item in this.custom_items){
+ root_menu.child_add_position(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();
@@ -172,25 +173,22 @@ public class PlayerController : GLib.Object
result = tokens[0];
}
if(result.length > 1){
- result = result.up(1).concat(result.slice(1, result.length));
- debug("PlayerController->format_player_name - : %s", result);
- }
+ result = result.up(1).concat(result.slice(1, result.length));
+ }
+ debug("PlayerController->format_player_name - : %s", result);
return result;
}
- // Temporarily we will need to handle to different mpris implemenations
- // Do it for now - a couple of weeks should see this messy carry on out of
- // the codebase.
- public void determine_state()
- {
- 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);
+ private void determine_state()
+ {
+ 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);
this.mpris_bridge.initial_update();
- }
- else{
- this.update_state(state.DISCONNECTED);
- }
- }
+ }
+ else{
+ this.update_state(state.DISCONNECTED);
+ }
+ }
}
diff --git a/src/player-item.c b/src/player-item.c
index 073fd80..ea68900 100644
--- a/src/player-item.c
+++ b/src/player-item.c
@@ -63,7 +63,7 @@ typedef struct _PlayerControllerClass PlayerControllerClass;
typedef struct _MetadataMenuitem MetadataMenuitem;
typedef struct _MetadataMenuitemClass MetadataMenuitemClass;
-#define __vala_GValue_free0(var) ((var == NULL) ? NULL : (var = (_vala_GValue_free (var), NULL)))
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
struct _PlayerItem {
DbusmenuMenuitem parent_instance;
@@ -95,10 +95,8 @@ PlayerItem* player_item_new (const gchar* type);
PlayerItem* player_item_construct (GType object_type, const gchar* type);
void player_item_reset (PlayerItem* self, GeeHashSet* attrs);
void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attributes);
-static GValue* _g_value_dup (GValue* self);
GType metadata_menuitem_get_type (void) G_GNUC_CONST;
void metadata_menuitem_fetch_art (MetadataMenuitem* self, const gchar* uri, const gchar* prop);
-static void _vala_GValue_free (GValue* self);
gboolean player_item_populated (PlayerItem* self, GeeHashSet* attrs);
PlayerController* player_item_get_owner (PlayerItem* self);
static void player_item_set_owner (PlayerItem* self, PlayerController* value);
@@ -154,18 +152,13 @@ void player_item_reset (PlayerItem* self, GeeHashSet* attrs) {
/**
- * update()
- * Base update method for playeritems, takes the attributes and the incoming updates
- * and attmepts to update the appropriate props on the object.
- * Album art is handled separately to deal with remote and local file paths.
- */
-static GValue* _g_value_dup (GValue* self) {
- return g_boxed_copy (G_TYPE_VALUE, self);
-}
-
-
-static gpointer __g_value_dup0 (gpointer self) {
- return self ? _g_value_dup (self) : NULL;
+ * update()
+ * Base update method for playeritems, takes the attributes and the incoming updates
+ * and attmepts to update the appropriate props on the object.
+ * Album art is handled separately to deal with remote and local file paths.
+ */
+static gpointer _g_variant_ref0 (gpointer self) {
+ return self ? g_variant_ref (self) : NULL;
}
@@ -198,12 +191,6 @@ static gpointer _g_object_ref0 (gpointer self) {
}
-static void _vala_GValue_free (GValue* self) {
- g_value_unset (self);
- g_free (self);
-}
-
-
static gchar* bool_to_string (gboolean self) {
gchar* result = NULL;
if (self) {
@@ -221,7 +208,7 @@ static gchar* bool_to_string (gboolean self) {
void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attributes) {
- gboolean _tmp28_;
+ gboolean _tmp26_;
g_return_if_fail (self != NULL);
g_return_if_fail (data != NULL);
g_return_if_fail (attributes != NULL);
@@ -249,8 +236,8 @@ void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attribu
gchar* _tmp6_;
gchar* search_key;
gconstpointer _tmp7_ = NULL;
- GValue* _tmp8_;
- GValue* v;
+ GVariant* _tmp8_;
+ GVariant* v;
gboolean _tmp9_;
_tmp1_ = gee_iterator_next (_property_it);
if (!_tmp1_) {
@@ -267,15 +254,15 @@ void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attribu
search_key = _tmp6_;
g_debug ("player-item.vala:62: search key = %s", search_key);
_tmp7_ = g_hash_table_lookup (data, search_key);
- _tmp8_ = __g_value_dup0 ((GValue*) _tmp7_);
+ _tmp8_ = _g_variant_ref0 ((GVariant*) _tmp7_);
v = _tmp8_;
- _tmp9_ = G_VALUE_HOLDS (v, G_TYPE_STRING);
+ _tmp9_ = g_variant_is_of_type (v, G_VARIANT_TYPE_STRING);
if (_tmp9_) {
const gchar* _tmp10_ = NULL;
gchar* _tmp11_ = NULL;
gchar* update;
gboolean _tmp12_;
- _tmp10_ = g_value_get_string (v);
+ _tmp10_ = g_variant_get_string (v, NULL);
_tmp11_ = string_strip (_tmp10_);
update = _tmp11_;
g_debug ("player-item.vala:67: with value : %s", update);
@@ -284,17 +271,12 @@ void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attribu
PlayerItem* _tmp13_;
MetadataMenuitem* _tmp14_;
MetadataMenuitem* metadata;
- gchar* _tmp15_ = NULL;
- gchar* _tmp16_;
_tmp14_ = _g_object_ref0 ((_tmp13_ = self, IS_METADATA_MENUITEM (_tmp13_) ? ((MetadataMenuitem*) _tmp13_) : NULL));
metadata = _tmp14_;
- _tmp15_ = string_strip (update);
- _tmp16_ = _tmp15_;
- metadata_menuitem_fetch_art (metadata, _tmp16_, property);
- _g_free0 (_tmp16_);
+ metadata_menuitem_fetch_art (metadata, update, property);
_g_object_unref0 (metadata);
_g_free0 (update);
- __vala_GValue_free0 (v);
+ _g_variant_unref0 (v);
_g_free0 (search_key);
input_keys = (_vala_array_free (input_keys, input_keys_length1, (GDestroyNotify) g_free), NULL);
_g_free0 (property);
@@ -303,53 +285,53 @@ void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attribu
dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, property, update);
_g_free0 (update);
} else {
- gboolean _tmp17_;
- _tmp17_ = G_VALUE_HOLDS (v, G_TYPE_INT);
- if (_tmp17_) {
- gint _tmp18_;
- gint _tmp19_;
- _tmp18_ = g_value_get_int (v);
- g_debug ("player-item.vala:78: with value : %i", _tmp18_);
- _tmp19_ = g_value_get_int (v);
- dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, property, _tmp19_);
+ gboolean _tmp15_;
+ _tmp15_ = g_variant_is_of_type (v, G_VARIANT_TYPE_INT32);
+ if (_tmp15_) {
+ gint32 _tmp16_;
+ gint32 _tmp17_;
+ _tmp16_ = g_variant_get_int32 (v);
+ g_debug ("player-item.vala:78: with value : %i", (gint) _tmp16_);
+ _tmp17_ = g_variant_get_int32 (v);
+ dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, property, (gint) _tmp17_);
} else {
- gboolean _tmp20_;
- _tmp20_ = G_VALUE_HOLDS (v, G_TYPE_INT64);
- if (_tmp20_) {
- gint64 _tmp21_;
- gint64 _tmp22_;
- _tmp21_ = g_value_get_int64 (v);
- g_debug ("player-item.vala:82: with value : %i", (gint) _tmp21_);
- _tmp22_ = g_value_get_int64 (v);
- dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, property, (gint) _tmp22_);
+ gboolean _tmp18_;
+ _tmp18_ = g_variant_is_of_type (v, G_VARIANT_TYPE_INT64);
+ if (_tmp18_) {
+ gint64 _tmp19_;
+ gint64 _tmp20_;
+ _tmp19_ = g_variant_get_int64 (v);
+ g_debug ("player-item.vala:82: with value : %i", (gint) _tmp19_);
+ _tmp20_ = g_variant_get_int64 (v);
+ dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, property, (gint) _tmp20_);
} else {
- gboolean _tmp23_;
- _tmp23_ = G_VALUE_HOLDS (v, G_TYPE_BOOLEAN);
- if (_tmp23_) {
- gboolean _tmp24_;
- gchar* _tmp25_ = NULL;
- gchar* _tmp26_;
- gboolean _tmp27_;
- _tmp24_ = g_value_get_boolean (v);
- _tmp25_ = bool_to_string (_tmp24_);
- _tmp26_ = _tmp25_;
- g_debug ("player-item.vala:86: with value : %s", _tmp26_);
- _g_free0 (_tmp26_);
- _tmp27_ = g_value_get_boolean (v);
- dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) self, property, _tmp27_);
+ gboolean _tmp21_;
+ _tmp21_ = g_variant_is_of_type (v, G_VARIANT_TYPE_BOOLEAN);
+ if (_tmp21_) {
+ gboolean _tmp22_;
+ gchar* _tmp23_ = NULL;
+ gchar* _tmp24_;
+ gboolean _tmp25_;
+ _tmp22_ = g_variant_get_boolean (v);
+ _tmp23_ = bool_to_string (_tmp22_);
+ _tmp24_ = _tmp23_;
+ g_debug ("player-item.vala:86: with value : %s", _tmp24_);
+ _g_free0 (_tmp24_);
+ _tmp25_ = g_variant_get_boolean (v);
+ dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) self, property, _tmp25_);
}
}
}
}
- __vala_GValue_free0 (v);
+ _g_variant_unref0 (v);
_g_free0 (search_key);
input_keys = (_vala_array_free (input_keys, input_keys_length1, (GDestroyNotify) g_free), NULL);
_g_free0 (property);
}
_g_object_unref0 (_property_it);
}
- _tmp28_ = player_item_populated (self, attributes);
- dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) self, DBUSMENU_MENUITEM_PROP_VISIBLE, _tmp28_);
+ _tmp26_ = player_item_populated (self, attributes);
+ dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) self, DBUSMENU_MENUITEM_PROP_VISIBLE, _tmp26_);
}
diff --git a/src/player-item.vala b/src/player-item.vala
index 51471d1..c80a17d 100644
--- a/src/player-item.vala
+++ b/src/player-item.vala
@@ -22,86 +22,86 @@ using Gee;
public class PlayerItem : Dbusmenu.Menuitem
{
- public PlayerController owner {get; construct;}
- public string item_type { get; construct; }
- private const int EMPTY = -1;
+ public PlayerController owner {get; construct;}
+ public string item_type { get; construct; }
+ private const int EMPTY = -1;
- public PlayerItem(string type)
- {
- Object(item_type: type);
- }
-
- construct {
- this.property_set(MENUITEM_PROP_TYPE, item_type);
- }
+ public PlayerItem(string type)
+ {
+ Object(item_type: type);
+ }
+
+ construct {
+ this.property_set(MENUITEM_PROP_TYPE, item_type);
+ }
- public void reset(HashSet<string> attrs){
- foreach(string s in attrs){
- debug("attempting to set prop %s to EMPTY", s);
- this.property_set_int(s, EMPTY);
- }
- }
-
- /**
- * update()
- * Base update method for playeritems, takes the attributes and the incoming updates
- * and attmepts to update the appropriate props on the object.
- * Album art is handled separately to deal with remote and local file paths.
- */
- public void update(HashTable<string, Value?> data, HashSet<string> attributes)
- {
- debug("PlayerItem::update()");
- if(data == null){
- debug("PlayerItem::Update -> The hashtable was null - just leave it!");
- return;
- }
-
- foreach(string property in attributes){
- string[] input_keys = property.split("-");
- string search_key = input_keys[input_keys.length-1 : input_keys.length][0];
- debug("search key = %s", search_key);
- Value? v = data.lookup(search_key);
-
- if (v.holds (typeof (string))){
- string update = v.get_string().strip();
- debug("with value : %s", update);
- if(property.contains("mpris:artUrl")){
- // We know its a metadata instance because thats the only
- // object with the arturl prop
- MetadataMenuitem metadata = this as MetadataMenuitem;
- metadata.fetch_art(update.strip(), property);
- continue;
- }
- this.property_set(property, update);
- }
- else if (v.holds (typeof (int))){
- debug("with value : %i", v.get_int());
- this.property_set_int(property, v.get_int());
- }
- else if (v.holds (typeof (int64))){
- debug("with value : %i", (int)v.get_int64());
- this.property_set_int(property, (int)v.get_int64());
- }
- else if(v.holds (typeof (bool))){
- debug("with value : %s", v.get_boolean().to_string());
- this.property_set_bool(property, v.get_boolean());
- }
- }
+ public void reset(HashSet<string> attrs){
+ foreach(string s in attrs){
+ debug("attempting to set prop %s to EMPTY", s);
+ this.property_set_int(s, EMPTY);
+ }
+ }
+
+ /**
+ * update()
+ * Base update method for playeritems, takes the attributes and the incoming updates
+ * and attmepts to update the appropriate props on the object.
+ * Album art is handled separately to deal with remote and local file paths.
+ */
+ public void update(HashTable<string, Variant?> data, HashSet<string> attributes)
+ {
+ debug("PlayerItem::update()");
+ if(data == null){
+ debug("PlayerItem::Update -> The hashtable was null - just leave it!");
+ return;
+ }
+
+ foreach(string property in attributes){
+ string[] input_keys = property.split("-");
+ string search_key = input_keys[input_keys.length-1 : input_keys.length][0];
+ debug("search key = %s", search_key);
+ Variant? v = data.lookup(search_key);
+
+ if (v.is_of_type ( VariantType.STRING )){
+ string update = v.get_string().strip();
+ debug("with value : %s", update);
+ if(property.contains("mpris:artUrl")){
+ // We know its a metadata instance because thats the only
+ // object with the arturl prop
+ MetadataMenuitem metadata = this as MetadataMenuitem;
+ metadata.fetch_art ( update, property );
+ continue;
+ }
+ this.property_set(property, update);
+ }
+ else if (v.is_of_type (VariantType.INT32 )){
+ debug("with value : %i", v.get_int32());
+ this.property_set_int(property, v.get_int32());
+ }
+ else if (v.is_of_type (VariantType.INT64 )){
+ debug("with value : %i", (int)v.get_int64());
+ this.property_set_int(property, (int)v.get_int64());
+ }
+ else if(v.is_of_type ( VariantType.BOOLEAN )){
+ debug("with value : %s", v.get_boolean().to_string());
+ this.property_set_bool(property, v.get_boolean());
+ }
+ }
this.property_set_bool(MENUITEM_PROP_VISIBLE, populated(attributes));
- }
-
- public bool populated(HashSet<string> attrs)
- {
- foreach(string prop in attrs){
- debug("populated ? - prop: %s", prop);
- int value_int = property_get_int(prop);
- if(property_get_int(prop) != EMPTY){
- debug("populated - prop %s and value %i", prop, value_int);
- return true;
- }
- }
- return false;
- }
+ }
+
+ public bool populated(HashSet<string> attrs)
+ {
+ foreach(string prop in attrs){
+ debug("populated ? - prop: %s", prop);
+ int value_int = property_get_int(prop);
+ if(property_get_int(prop) != EMPTY){
+ debug("populated - prop %s and value %i", prop, value_int);
+ return true;
+ }
+ }
+ return false;
+ }
}
diff --git a/src/pulse-manager.c b/src/pulse-manager.c
index 14633fe..4443044 100644
--- a/src/pulse-manager.c
+++ b/src/pulse-manager.c
@@ -65,7 +65,7 @@ void establish_pulse_activities(SoundServiceDbus *service)
pa_main_loop = pa_glib_mainloop_new(g_main_context_default());
g_assert(pa_main_loop);
pulse_context = pa_context_new(pa_glib_mainloop_get_api(pa_main_loop),
- "ayatana.indicator.sound");
+ "com.canonical.indicators.sound");
g_assert(pulse_context);
sink_hash = g_hash_table_new_full(g_direct_hash,
@@ -103,7 +103,7 @@ reconnect_to_pulse()
sink_hash = NULL;
}
pulse_context = pa_context_new( pa_glib_mainloop_get_api( pa_main_loop ),
- "ayatana.indicator.sound" );
+ "com.canonical.indicators.sound" );
g_assert(pulse_context);
sink_hash = g_hash_table_new_full( g_direct_hash, g_direct_equal,
NULL,
@@ -131,7 +131,7 @@ void close_pulse_activites()
{
if (pulse_context != NULL) {
/* g_debug("freeing the pulse context");*/
- pa_context_unref(pulse_context);
+ pa_context_unref(pulse_context);
pulse_context = NULL;
}
g_hash_table_destroy(sink_hash);
@@ -223,7 +223,7 @@ static void mute_each_sink(gpointer key, gpointer value, gpointer user_data)
if (GPOINTER_TO_INT(user_data) == 1) {
sound_service_dbus_update_sink_mute(dbus_service, TRUE);
} else {
- dbus_menu_manager_update_volume(get_default_sink_volume());
+ dbus_menu_manager_update_volume(get_default_sink_volume());
}
/* g_debug("in the pulse manager: mute each sink %i", GPOINTER_TO_INT(user_data));*/
@@ -364,7 +364,7 @@ static void pulse_sink_input_info_callback(pa_context *c, const pa_sink_input_in
/* g_warning("\n Sink input info callback : SINK INPUT INFO IS NULL BUT EOL was not POSITIVE!!!");*/
return;
}
- /* g_debug("\n SINK INPUT INFO sink index : %d \n", info->sink);*/
+ /* g_debug("\n SINK INPUT INFO sink index : %d \n", info->sink);*/
check_sink_input_while_muted_event(info->sink);
}
}
@@ -419,7 +419,7 @@ static void update_sink_info(pa_context *c, const pa_sink_info *info, int eol, v
pa_volume_t vol = pa_cvolume_max(&s->volume);
gdouble volume_percent = ((gdouble) vol * 100) / PA_VOLUME_NORM;
/* g_debug("Updating volume from PA manager with volume = %f", volume_percent);*/
- dbus_menu_manager_update_volume(volume_percent);
+ dbus_menu_manager_update_volume(volume_percent);
}
}
}
@@ -505,12 +505,12 @@ static void subscribed_events_callback(pa_context *c, enum pa_subscription_event
}
/* g_debug("subscribed_events_callback - Now what is our default sink : %i", DEFAULT_SINK_INDEX); */
} else {
- /* g_debug("subscribed_events_callback - PA_SUBSCRIPTION_EVENT_SINK: a generic sink event - will trigger an update"); */
+ /* g_debug("subscribed_events_callback - PA_SUBSCRIPTION_EVENT_SINK: a generic sink event - will trigger an update"); */
pa_operation_unref(pa_context_get_sink_info_by_index(c, index, update_sink_info, userdata));
}
break;
case PA_SUBSCRIPTION_EVENT_SINK_INPUT:
- /* g_debug("subscribed_events_callback - PA_SUBSCRIPTION_EVENT_SINK_INPUT event triggered!!");*/
+ /* g_debug("subscribed_events_callback - PA_SUBSCRIPTION_EVENT_SINK_INPUT event triggered!!");*/
if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) {
//handle the sink input remove event - not relevant for current design
} else {
@@ -534,16 +534,16 @@ static void context_state_callback(pa_context *c, void *userdata)
{
switch (pa_context_get_state(c)) {
case PA_CONTEXT_UNCONNECTED:
- g_debug("unconnected");
+ g_debug("unconnected");
break;
case PA_CONTEXT_CONNECTING:
- g_debug("connecting - waiting for the server to become available");
+ g_debug("connecting - waiting for the server to become available");
break;
case PA_CONTEXT_AUTHORIZING:
- /* g_debug("authorizing");*/
+ /* g_debug("authorizing");*/
break;
case PA_CONTEXT_SETTING_NAME:
- /* g_debug("context setting name");*/
+ /* g_debug("context setting name");*/
break;
case PA_CONTEXT_FAILED:
g_warning("PA_CONTEXT_FAILED - Is PulseAudio Daemon running ?");
@@ -560,7 +560,7 @@ static void context_state_callback(pa_context *c, void *userdata)
}
break;
case PA_CONTEXT_TERMINATED:
- /* g_debug("context terminated");*/
+ /* g_debug("context terminated");*/
break;
case PA_CONTEXT_READY:
g_debug("PA_CONTEXT_READY");
diff --git a/src/settings-manager.c b/src/settings-manager.c
new file mode 100644
index 0000000..06f3afb
--- /dev/null
+++ b/src/settings-manager.c
@@ -0,0 +1,275 @@
+/* settings-manager.c generated by valac 0.11.2, the Vala compiler
+ * generated from settings-manager.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_SETTINGS_MANAGER (settings_manager_get_type ())
+#define SETTINGS_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SETTINGS_MANAGER, SettingsManager))
+#define SETTINGS_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SETTINGS_MANAGER, SettingsManagerClass))
+#define IS_SETTINGS_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SETTINGS_MANAGER))
+#define IS_SETTINGS_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SETTINGS_MANAGER))
+#define SETTINGS_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SETTINGS_MANAGER, SettingsManagerClass))
+
+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)))
+
+struct _SettingsManager {
+ GObject parent_instance;
+ SettingsManagerPrivate * priv;
+};
+
+struct _SettingsManagerClass {
+ GObjectClass parent_class;
+};
+
+struct _SettingsManagerPrivate {
+ GSettings* settings;
+};
+
+
+static gpointer settings_manager_parent_class = NULL;
+
+GType settings_manager_get_type (void) G_GNUC_CONST;
+#define SETTINGS_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_SETTINGS_MANAGER, SettingsManagerPrivate))
+enum {
+ SETTINGS_MANAGER_DUMMY_PROPERTY
+};
+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);
+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);
+static GObject * settings_manager_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
+static void _settings_manager_on_blacklist_event_g_settings_changed (GSettings* _sender, const gchar* key, gpointer self);
+static void settings_manager_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 gint _vala_array_length (gpointer array);
+
+
+SettingsManager* settings_manager_construct (GType object_type) {
+ SettingsManager * self = NULL;
+ self = (SettingsManager*) g_object_new (object_type, NULL);
+ return self;
+}
+
+
+SettingsManager* settings_manager_new (void) {
+ return settings_manager_construct (TYPE_SETTINGS_MANAGER);
+}
+
+
+gchar** settings_manager_fetch_blacklist (SettingsManager* self, int* result_length1) {
+ gchar** result = NULL;
+ gchar** _tmp0_;
+ gchar** _tmp1_ = NULL;
+ gchar** _tmp2_;
+ g_return_val_if_fail (self != NULL, NULL);
+ _tmp1_ = _tmp0_ = g_settings_get_strv (self->priv->settings, "blacklisted-media-players");
+ _tmp2_ = _tmp1_;
+ *result_length1 = _vala_array_length (_tmp0_);
+ result = _tmp2_;
+ return result;
+}
+
+
+gchar** settings_manager_fetch_interested (SettingsManager* self, int* result_length1) {
+ gchar** result = NULL;
+ gchar** _tmp0_;
+ gchar** _tmp1_ = NULL;
+ gchar** _tmp2_;
+ g_return_val_if_fail (self != NULL, NULL);
+ _tmp1_ = _tmp0_ = g_settings_get_strv (self->priv->settings, "interested-media-players");
+ _tmp2_ = _tmp1_;
+ *result_length1 = _vala_array_length (_tmp0_);
+ result = _tmp2_;
+ return result;
+}
+
+
+static void _vala_array_add1 (gchar*** array, int* length, int* size, gchar* value) {
+ if ((*length) == (*size)) {
+ *size = (*size) ? (2 * (*size)) : 4;
+ *array = g_renew (gchar*, *array, (*size) + 1);
+ }
+ (*array)[(*length)++] = value;
+ (*array)[*length] = NULL;
+}
+
+
+gboolean settings_manager_add_interested (SettingsManager* self, const gchar* app_desktop_name) {
+ gboolean result = FALSE;
+ gint _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_);
+ _tmp2_ = _tmp1_;
+ already_interested_length1 = _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_;
+ already_interested = (_vala_array_free (already_interested, already_interested_length1, (GDestroyNotify) g_free), NULL);
+ return result;
+}
+
+
+static void settings_manager_on_blacklist_event (SettingsManager* self) {
+ gchar** _tmp0_;
+ gchar** _tmp1_ = NULL;
+ gchar** _tmp2_;
+ gint _tmp2__length1;
+ g_return_if_fail (self != NULL);
+ _tmp1_ = _tmp0_ = g_settings_get_strv (self->priv->settings, "blacklisted-media-players");
+ _tmp2_ = _tmp1_;
+ _tmp2__length1 = _vala_array_length (_tmp0_);
+ g_signal_emit_by_name (self, "blacklist-updates", _tmp2_, _vala_array_length (_tmp0_));
+ _tmp2_ = (_vala_array_free (_tmp2_, _tmp2__length1, (GDestroyNotify) g_free), NULL);
+}
+
+
+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) {
+ typedef void (*GMarshalFunc_VOID__BOXED_INT) (gpointer data1, gpointer arg_1, gint arg_2, gpointer data2);
+ register GMarshalFunc_VOID__BOXED_INT callback;
+ register GCClosure * cc;
+ register gpointer data1, data2;
+ cc = (GCClosure *) closure;
+ g_return_if_fail (n_param_values == 3);
+ if (G_CCLOSURE_SWAP_DATA (closure)) {
+ data1 = closure->data;
+ data2 = param_values->data[0].v_pointer;
+ } else {
+ data1 = param_values->data[0].v_pointer;
+ data2 = closure->data;
+ }
+ callback = (GMarshalFunc_VOID__BOXED_INT) (marshal_data ? marshal_data : cc->callback);
+ callback (data1, g_value_get_boxed (param_values + 1), g_value_get_int (param_values + 2), data2);
+}
+
+
+static void _settings_manager_on_blacklist_event_g_settings_changed (GSettings* _sender, const gchar* key, gpointer self) {
+ settings_manager_on_blacklist_event (self);
+}
+
+
+static GObject * settings_manager_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
+ GObject * obj;
+ GObjectClass * parent_class;
+ SettingsManager * self;
+ GSettings* _tmp0_ = NULL;
+ GSettings* _tmp1_;
+ parent_class = G_OBJECT_CLASS (settings_manager_parent_class);
+ obj = parent_class->constructor (type, n_construct_properties, construct_properties);
+ self = SETTINGS_MANAGER (obj);
+ _tmp0_ = g_settings_new ("com.canonical.indicators.sound");
+ _tmp1_ = _tmp0_;
+ _g_object_unref0 (self->priv->settings);
+ self->priv->settings = _tmp1_;
+ g_signal_connect_object (self->priv->settings, "changed::blacklisted-media-players", (GCallback) _settings_manager_on_blacklist_event_g_settings_changed, self, 0);
+ return obj;
+}
+
+
+static void settings_manager_class_init (SettingsManagerClass * klass) {
+ settings_manager_parent_class = g_type_class_peek_parent (klass);
+ g_type_class_add_private (klass, sizeof (SettingsManagerPrivate));
+ G_OBJECT_CLASS (klass)->constructor = settings_manager_constructor;
+ G_OBJECT_CLASS (klass)->finalize = settings_manager_finalize;
+ g_signal_new ("blacklist_updates", TYPE_SETTINGS_MANAGER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__BOXED_INT, G_TYPE_NONE, 2, G_TYPE_STRV, G_TYPE_INT);
+}
+
+
+static void settings_manager_instance_init (SettingsManager * self) {
+ self->priv = SETTINGS_MANAGER_GET_PRIVATE (self);
+}
+
+
+static void settings_manager_finalize (GObject* obj) {
+ SettingsManager * self;
+ self = SETTINGS_MANAGER (obj);
+ _g_object_unref0 (self->priv->settings);
+ G_OBJECT_CLASS (settings_manager_parent_class)->finalize (obj);
+}
+
+
+GType settings_manager_get_type (void) {
+ static volatile gsize settings_manager_type_id__volatile = 0;
+ if (g_once_init_enter (&settings_manager_type_id__volatile)) {
+ static const GTypeInfo g_define_type_info = { sizeof (SettingsManagerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) settings_manager_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SettingsManager), 0, (GInstanceInitFunc) settings_manager_instance_init, NULL };
+ GType settings_manager_type_id;
+ settings_manager_type_id = g_type_register_static (G_TYPE_OBJECT, "SettingsManager", &g_define_type_info, 0);
+ g_once_init_leave (&settings_manager_type_id__volatile, settings_manager_type_id);
+ }
+ return settings_manager_type_id__volatile;
+}
+
+
+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);
+}
+
+
+static gint _vala_array_length (gpointer array) {
+ int length;
+ length = 0;
+ if (array) {
+ while (((gpointer*) array)[length]) {
+ length++;
+ }
+ }
+ return length;
+}
+
+
+
diff --git a/src/settings-manager.vala b/src/settings-manager.vala
new file mode 100644
index 0000000..0a9f0e1
--- /dev/null
+++ b/src/settings-manager.vala
@@ -0,0 +1,55 @@
+/*
+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 Gee;
+
+public class SettingsManager : GLib.Object
+{
+ private Settings settings;
+ public signal void blacklist_updates ( string[] new_blacklist );
+
+ public SettingsManager ( ){
+ }
+ construct{
+ this.settings = new Settings ("com.canonical.indicators.sound");
+ settings.changed["blacklisted-media-players"].connect (on_blacklist_event);
+ }
+
+ public string[] fetch_blacklist()
+ {
+ return this.settings.get_strv ("blacklisted-media-players");
+ }
+
+ public string[] fetch_interested()
+ {
+ return this.settings.get_strv ("interested-media-players");
+ }
+
+ public bool add_interested(string app_desktop_name)
+ {
+ string[] already_interested = fetch_interested();
+ already_interested += (app_desktop_name);
+ return this.settings.set_strv( "interested-media-players",
+ already_interested );
+ }
+
+ private void on_blacklist_event()
+ {
+ this.blacklist_updates(this.settings.get_strv ("blacklisted-media-players"));
+ }
+}
diff --git a/src/slider-menu-item.c b/src/slider-menu-item.c
index c850cdc..d0d2050 100644
--- a/src/slider-menu-item.c
+++ b/src/slider-menu-item.c
@@ -88,11 +88,11 @@ handle_event (DbusmenuMenuitem * mi, const gchar * name, const GValue * value, g
SliderMenuItem* slider_menu_item_new(gboolean sinks_available, gdouble start_volume)
-{
+{
SliderMenuItem *self = g_object_new(SLIDER_MENU_ITEM_TYPE, NULL);
dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_VOLUME_MENUITEM_TYPE);
- dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_ENABLED, sinks_available);
+ dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_ENABLED, sinks_available);
dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_VISIBLE, sinks_available);
return self;
}
diff --git a/src/sound-service-client.h b/src/sound-service-client.h
index ab1acd1..5d95f44 100644
--- a/src/sound-service-client.h
+++ b/src/sound-service-client.h
@@ -18,30 +18,30 @@ _dbus_glib_async_data_free (gpointer stuff)
}
#endif
-#ifndef DBUS_GLIB_CLIENT_WRAPPERS_org_ayatana_indicator_sound
-#define DBUS_GLIB_CLIENT_WRAPPERS_org_ayatana_indicator_sound
+#ifndef DBUS_GLIB_CLIENT_WRAPPERS_com_canonical_indicators_sound
+#define DBUS_GLIB_CLIENT_WRAPPERS_com_canonical_indicators_sound
static
#ifdef G_HAVE_INLINE
inline
#endif
gboolean
-org_ayatana_indicator_sound_get_sink_mute (DBusGProxy *proxy, gboolean* OUT_mute_input, GError **error)
+com_canonical_indicators_sound_get_sink_mute (DBusGProxy *proxy, gboolean* OUT_mute_input, GError **error)
{
return dbus_g_proxy_call (proxy, "GetSinkMute", error, G_TYPE_INVALID, G_TYPE_BOOLEAN, OUT_mute_input, G_TYPE_INVALID);
}
-typedef void (*org_ayatana_indicator_sound_get_sink_mute_reply) (DBusGProxy *proxy, gboolean OUT_mute_input, GError *error, gpointer userdata);
+typedef void (*com_canonical_indicators_sound_get_sink_mute_reply) (DBusGProxy *proxy, gboolean OUT_mute_input, GError *error, gpointer userdata);
static void
-org_ayatana_indicator_sound_get_sink_mute_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
+com_canonical_indicators_sound_get_sink_mute_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
{
DBusGAsyncData *data = (DBusGAsyncData*) user_data;
GError *error = NULL;
gboolean OUT_mute_input;
dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_BOOLEAN, &OUT_mute_input, G_TYPE_INVALID);
- (*(org_ayatana_indicator_sound_get_sink_mute_reply)data->cb) (proxy, OUT_mute_input, error, data->userdata);
+ (*(com_canonical_indicators_sound_get_sink_mute_reply)data->cb) (proxy, OUT_mute_input, error, data->userdata);
return;
}
@@ -50,36 +50,36 @@ static
inline
#endif
DBusGProxyCall*
-org_ayatana_indicator_sound_get_sink_mute_async (DBusGProxy *proxy, org_ayatana_indicator_sound_get_sink_mute_reply callback, gpointer userdata)
+com_canonical_indicators_sound_get_sink_mute_async (DBusGProxy *proxy, com_canonical_indicators_sound_get_sink_mute_reply callback, gpointer userdata)
{
DBusGAsyncData *stuff;
stuff = g_slice_new (DBusGAsyncData);
stuff->cb = G_CALLBACK (callback);
stuff->userdata = userdata;
- return dbus_g_proxy_begin_call (proxy, "GetSinkMute", org_ayatana_indicator_sound_get_sink_mute_async_callback, stuff, _dbus_glib_async_data_free, G_TYPE_INVALID);
+ return dbus_g_proxy_begin_call (proxy, "GetSinkMute", com_canonical_indicators_sound_get_sink_mute_async_callback, stuff, _dbus_glib_async_data_free, G_TYPE_INVALID);
}
static
#ifdef G_HAVE_INLINE
inline
#endif
gboolean
-org_ayatana_indicator_sound_get_sink_availability (DBusGProxy *proxy, gboolean* OUT_availability_input, GError **error)
+com_canonical_indicators_sound_get_sink_availability (DBusGProxy *proxy, gboolean* OUT_availability_input, GError **error)
{
return dbus_g_proxy_call (proxy, "GetSinkAvailability", error, G_TYPE_INVALID, G_TYPE_BOOLEAN, OUT_availability_input, G_TYPE_INVALID);
}
-typedef void (*org_ayatana_indicator_sound_get_sink_availability_reply) (DBusGProxy *proxy, gboolean OUT_availability_input, GError *error, gpointer userdata);
+typedef void (*com_canonical_indicators_sound_get_sink_availability_reply) (DBusGProxy *proxy, gboolean OUT_availability_input, GError *error, gpointer userdata);
static void
-org_ayatana_indicator_sound_get_sink_availability_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
+com_canonical_indicators_sound_get_sink_availability_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
{
DBusGAsyncData *data = (DBusGAsyncData*) user_data;
GError *error = NULL;
gboolean OUT_availability_input;
dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_BOOLEAN, &OUT_availability_input, G_TYPE_INVALID);
- (*(org_ayatana_indicator_sound_get_sink_availability_reply)data->cb) (proxy, OUT_availability_input, error, data->userdata);
+ (*(com_canonical_indicators_sound_get_sink_availability_reply)data->cb) (proxy, OUT_availability_input, error, data->userdata);
return;
}
@@ -88,15 +88,15 @@ static
inline
#endif
DBusGProxyCall*
-org_ayatana_indicator_sound_get_sink_availability_async (DBusGProxy *proxy, org_ayatana_indicator_sound_get_sink_availability_reply callback, gpointer userdata)
+com_canonical_indicators_sound_get_sink_availability_async (DBusGProxy *proxy, com_canonical_indicators_sound_get_sink_availability_reply callback, gpointer userdata)
{
DBusGAsyncData *stuff;
stuff = g_slice_new (DBusGAsyncData);
stuff->cb = G_CALLBACK (callback);
stuff->userdata = userdata;
- return dbus_g_proxy_begin_call (proxy, "GetSinkAvailability", org_ayatana_indicator_sound_get_sink_availability_async_callback, stuff, _dbus_glib_async_data_free, G_TYPE_INVALID);
+ return dbus_g_proxy_begin_call (proxy, "GetSinkAvailability", com_canonical_indicators_sound_get_sink_availability_async_callback, stuff, _dbus_glib_async_data_free, G_TYPE_INVALID);
}
-#endif /* defined DBUS_GLIB_CLIENT_WRAPPERS_org_ayatana_indicator_sound */
+#endif /* defined DBUS_GLIB_CLIENT_WRAPPERS_com_canonical_indicators_sound */
G_END_DECLS
diff --git a/src/sound-service-dbus.c b/src/sound-service-dbus.c
index d553285..0760247 100644
--- a/src/sound-service-dbus.c
+++ b/src/sound-service-dbus.c
@@ -42,7 +42,6 @@ struct _SoundServiceDbusPrivate {
gboolean sink_availability;
};
-
/* Signals */
enum {
SINK_INPUT_WHILE_MUTED,
diff --git a/src/sound-service-server.h b/src/sound-service-server.h
index 19d3f89..0e4481e 100644
--- a/src/sound-service-server.h
+++ b/src/sound-service-server.h
@@ -109,14 +109,14 @@ G_END_DECLS
#include <dbus/dbus-glib.h>
static const DBusGMethodInfo dbus_glib__sound_service_server_methods[] = {
{ (GCallback) sound_service_dbus_get_sink_mute, dbus_glib_marshal__sound_service_server_BOOLEAN__POINTER_POINTER, 0 },
- { (GCallback) sound_service_dbus_get_sink_availability, dbus_glib_marshal__sound_service_server_BOOLEAN__POINTER_POINTER, 62 },
+ { (GCallback) sound_service_dbus_get_sink_availability, dbus_glib_marshal__sound_service_server_BOOLEAN__POINTER_POINTER, 65 },
};
const DBusGObjectInfo dbus_glib__sound_service_server_object_info = { 1,
dbus_glib__sound_service_server_methods,
2,
-"org.ayatana.indicator.sound\0GetSinkMute\0S\0mute_input\0O\0F\0N\0b\0\0org.ayatana.indicator.sound\0GetSinkAvailability\0S\0availability_input\0O\0F\0N\0b\0\0\0",
-"org.ayatana.indicator.sound\0SinkInputWhileMuted\0org.ayatana.indicator.sound\0SinkMuteUpdate\0org.ayatana.indicator.sound\0SinkAvailableUpdate\0\0",
+"com.canonical.indicators.sound\0GetSinkMute\0S\0mute_input\0O\0F\0N\0b\0\0com.canonical.indicators.sound\0GetSinkAvailability\0S\0availability_input\0O\0F\0N\0b\0\0\0",
+"com.canonical.indicators.sound\0SinkInputWhileMuted\0com.canonical.indicators.sound\0SinkMuteUpdate\0com.canonical.indicators.sound\0SinkAvailableUpdate\0\0",
"\0"
};
diff --git a/src/sound-service.c b/src/sound-service.c
index f19379d..98f1881 100644
--- a/src/sound-service.c
+++ b/src/sound-service.c
@@ -40,7 +40,6 @@ service_shutdown (IndicatorService *service, gpointer user_data)
{
if (mainloop != NULL) {
g_debug("Service shutdown !");
- //TODO: uncomment for release !!
close_pulse_activites();
g_main_loop_quit(mainloop);
}
diff --git a/src/sound-service.xml b/src/sound-service.xml
index ee19ceb..a552d52 100644
--- a/src/sound-service.xml
+++ b/src/sound-service.xml
@@ -1,6 +1,6 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
-<node name="/org/ayatana/indicator/sound">
- <interface name="org.ayatana.indicator.sound">
+<node name="/com/canonical/indicators/sound">
+ <interface name="com.canonical.indicators.sound">
<method name = "GetSinkMute">
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="sound_service_dbus_get_sink_mute"/>
<arg type='b' name='mute_input' direction="out"/>
diff --git a/src/title-menu-item.vala b/src/title-menu-item.vala
index 64ddebf..d782e84 100644
--- a/src/title-menu-item.vala
+++ b/src/title-menu-item.vala
@@ -23,37 +23,37 @@ using Gee;
public class TitleMenuitem : PlayerItem
{
- public TitleMenuitem(PlayerController parent)
- {
- Object(item_type: MENUITEM_TYPE, owner: parent);
- this.property_set(MENUITEM_NAME, parent.name);
+ 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_ICON, parent.icon_name);
- this.property_set_bool(MENUITEM_RUNNING, false);
- }
-
- public override void handle_event(string name, GLib.Value input_value, uint timestamp)
- {
- if(this.owner.current_state == PlayerController.state.OFFLINE)
- {
- this.owner.instantiate();
- }
- else if(this.owner.current_state == PlayerController.state.CONNECTED){
- this.owner.mpris_bridge.expose();
- }
- }
-
- public void toggle_active_triangle(bool update)
- {
- this.property_set_bool(MENUITEM_RUNNING, update);
- }
-
- public static HashSet<string> attributes_format()
- {
- HashSet<string> attrs = new HashSet<string>();
- attrs.add(MENUITEM_NAME);
- attrs.add(MENUITEM_RUNNING);
- attrs.add(MENUITEM_ICON);
+ this.property_set_bool(MENUITEM_RUNNING, false);
+ }
+
+ public override void handle_event(string name, GLib.Value input_value, uint timestamp)
+ {
+ if(this.owner.current_state == PlayerController.state.OFFLINE)
+ {
+ this.owner.instantiate();
+ }
+ else if(this.owner.current_state == PlayerController.state.CONNECTED){
+ this.owner.mpris_bridge.expose();
+ }
+ }
+
+ public void toggle_active_triangle(bool update)
+ {
+ this.property_set_bool(MENUITEM_RUNNING, update);
+ }
+
+ public static HashSet<string> attributes_format()
+ {
+ HashSet<string> attrs = new HashSet<string>();
+ attrs.add(MENUITEM_NAME);
+ attrs.add(MENUITEM_RUNNING);
+ attrs.add(MENUITEM_ICON);
return attrs;
- }
+ }
} \ No newline at end of file
diff --git a/src/title-widget.c b/src/title-widget.c
index 1524a4a..cbdf28e 100644
--- a/src/title-widget.c
+++ b/src/title-widget.c
@@ -32,7 +32,7 @@ typedef struct _TitleWidgetPrivate TitleWidgetPrivate;
struct _TitleWidgetPrivate
{
- DbusmenuMenuitem* twin_item;
+ DbusmenuMenuitem* twin_item;
};
#define TITLE_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TITLE_WIDGET_TYPE, TitleWidgetPrivate))
@@ -45,12 +45,12 @@ static void title_widget_finalize (GObject *object);
// keyevent consumers
static gboolean title_widget_button_press_event (GtkWidget *menuitem,
- GdkEventButton *event);
+ GdkEventButton *event);
// Dbusmenuitem properties update callback
static void title_widget_property_update(DbusmenuMenuitem* item, gchar* property,
GValue* value, gpointer userdata);
-static void title_widget_set_twin_item( TitleWidget* self,
+static void title_widget_set_twin_item( TitleWidget* self,
DbusmenuMenuitem* twin_item);
static gboolean title_widget_triangle_draw_cb (GtkWidget *widget,
GdkEventExpose *event,
@@ -61,7 +61,7 @@ G_DEFINE_TYPE (TitleWidget, title_widget, GTK_TYPE_IMAGE_MENU_ITEM);
static void
title_widget_class_init (TitleWidgetClass *klass)
{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
widget_class->button_press_event = title_widget_button_press_event;
@@ -75,7 +75,7 @@ title_widget_class_init (TitleWidgetClass *klass)
static void
title_widget_init (TitleWidget *self)
{
- //g_debug("TitleWidget::title_widget_init");
+ //g_debug("TitleWidget::title_widget_init");
}
static void
@@ -84,9 +84,9 @@ title_widget_set_icon(TitleWidget *self)
TitleWidgetPrivate *priv = TITLE_WIDGET_GET_PRIVATE(self);
gint padding = 0;
- gtk_widget_style_get(GTK_WIDGET(self), "horizontal-padding", &padding, NULL);
- gint width, height;
- gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height);
+ gtk_widget_style_get(GTK_WIDGET(self), "horizontal-padding", &padding, NULL);
+ gint width, height;
+ gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height);
GString* banshee_string = g_string_new ( "banshee" );
GString* app_panel = g_string_new ( g_utf8_strdown ( dbusmenu_menuitem_property_get(priv->twin_item, DBUSMENU_TITLE_MENUITEM_NAME),
@@ -98,7 +98,7 @@ title_widget_set_icon(TitleWidget *self)
if ( g_string_equal ( banshee_string, app_panel ) == TRUE &&
gtk_icon_theme_has_icon ( gtk_icon_theme_get_default(), app_panel->str ) ){
g_string_append ( app_panel, "-panel" );
- icon = gtk_image_new_from_icon_name ( app_panel->str,
+ icon = gtk_image_new_from_icon_name ( app_panel->str,
GTK_ICON_SIZE_MENU );
}
else{
@@ -112,22 +112,22 @@ title_widget_set_icon(TitleWidget *self)
+ 5 /* ref triangle is 5x9 pixels */
+ 1 /* padding */,
height);
- gtk_misc_set_alignment(GTK_MISC(icon), 0.5 /* right aligned */, 0);
+ gtk_misc_set_alignment(GTK_MISC(icon), 0.5 /* right aligned */, 0);
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(self), GTK_WIDGET(icon));
- gtk_widget_show(icon);
+ gtk_widget_show(icon);
}
static void
title_widget_dispose (GObject *object)
{
- G_OBJECT_CLASS (title_widget_parent_class)->dispose (object);
+ G_OBJECT_CLASS (title_widget_parent_class)->dispose (object);
}
static void
title_widget_finalize (GObject *object)
{
- G_OBJECT_CLASS (title_widget_parent_class)->finalize (object);
+ G_OBJECT_CLASS (title_widget_parent_class)->finalize (object);
}
/* Suppress/consume keyevents */
@@ -135,37 +135,37 @@ static gboolean
title_widget_button_press_event (GtkWidget *menuitem,
GdkEventButton *event)
{
- //g_debug("TitleWidget::menu_press_event");
- TitleWidgetPrivate * priv = TITLE_WIDGET_GET_PRIVATE(menuitem);
-
- GValue value = {0};
+ //g_debug("TitleWidget::menu_press_event");
+ TitleWidgetPrivate * priv = TITLE_WIDGET_GET_PRIVATE(menuitem);
+
+ GValue value = {0};
g_value_init(&value, G_TYPE_BOOLEAN);
- g_value_set_boolean(&value, TRUE);
- dbusmenu_menuitem_handle_event (priv->twin_item, "Title menu event", &value, 0);
-
- return FALSE;
+ g_value_set_boolean(&value, TRUE);
+ dbusmenu_menuitem_handle_event (priv->twin_item, "Title menu event", &value, 0);
+
+ return FALSE;
}
static void
title_widget_property_update(DbusmenuMenuitem* item, gchar* property,
GValue* value, gpointer userdata)
{
- g_return_if_fail (IS_TITLE_WIDGET (userdata));
- TitleWidget* mitem = TITLE_WIDGET(userdata);
+ 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){
+ 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){
+ }
+ 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),
+ 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));
- }
+ }
}
static void
@@ -194,48 +194,48 @@ title_widget_set_twin_item(TitleWidget* self,
static gboolean
title_widget_triangle_draw_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
{
- GtkStyle *style;
- cairo_t *cr;
- int x, y, arrow_width, arrow_height;
-
- if (!GTK_IS_WIDGET (widget)) return FALSE;
- if (!DBUSMENU_IS_MENUITEM (data)) return FALSE;
-
- /* render the triangle indicator only if the application is running */
- if (! dbusmenu_menuitem_property_get_bool (DBUSMENU_MENUITEM(data),
- DBUSMENU_TITLE_MENUITEM_RUNNING)){
- return FALSE;
- }
-
- /* get style */
- style = gtk_widget_get_style (widget);
-
- /* set arrow position / dimensions */
- arrow_width = 5; /* the pixel-based reference triangle is 5x9 */
- arrow_height = 9;
- x = widget->allocation.x;
- y = widget->allocation.y + widget->allocation.height/2.0 - (double)arrow_height/2.0;
-
- /* initialize cairo drawing area */
- cr = (cairo_t*) gdk_cairo_create (widget->window);
-
- /* set line width */
- cairo_set_line_width (cr, 1.0);
-
- /* cairo drawing code */
- cairo_move_to (cr, x, y);
- cairo_line_to (cr, x, y + arrow_height);
- cairo_line_to (cr, x + arrow_width, y + (double)arrow_height/2.0);
- cairo_close_path (cr);
- cairo_set_source_rgb (cr, style->fg[gtk_widget_get_state(widget)].red/65535.0,
- style->fg[gtk_widget_get_state(widget)].green/65535.0,
- style->fg[gtk_widget_get_state(widget)].blue/65535.0);
- cairo_fill (cr);
-
- /* remember to destroy cairo context to avoid leaks */
- cairo_destroy (cr);
-
- return FALSE;
+ GtkStyle *style;
+ cairo_t *cr;
+ int x, y, arrow_width, arrow_height;
+
+ if (!GTK_IS_WIDGET (widget)) return FALSE;
+ if (!DBUSMENU_IS_MENUITEM (data)) return FALSE;
+
+ /* render the triangle indicator only if the application is running */
+ if (! dbusmenu_menuitem_property_get_bool (DBUSMENU_MENUITEM(data),
+ DBUSMENU_TITLE_MENUITEM_RUNNING)){
+ return FALSE;
+ }
+
+ /* get style */
+ style = gtk_widget_get_style (widget);
+
+ /* set arrow position / dimensions */
+ arrow_width = 5; /* the pixel-based reference triangle is 5x9 */
+ arrow_height = 9;
+ x = widget->allocation.x;
+ y = widget->allocation.y + widget->allocation.height/2.0 - (double)arrow_height/2.0;
+
+ /* initialize cairo drawing area */
+ cr = (cairo_t*) gdk_cairo_create (widget->window);
+
+ /* set line width */
+ cairo_set_line_width (cr, 1.0);
+
+ /* cairo drawing code */
+ cairo_move_to (cr, x, y);
+ cairo_line_to (cr, x, y + arrow_height);
+ cairo_line_to (cr, x + arrow_width, y + (double)arrow_height/2.0);
+ cairo_close_path (cr);
+ cairo_set_source_rgb (cr, style->fg[gtk_widget_get_state(widget)].red/65535.0,
+ style->fg[gtk_widget_get_state(widget)].green/65535.0,
+ style->fg[gtk_widget_get_state(widget)].blue/65535.0);
+ cairo_fill (cr);
+
+ /* remember to destroy cairo context to avoid leaks */
+ cairo_destroy (cr);
+
+ return FALSE;
}
/**
@@ -245,11 +245,11 @@ title_widget_triangle_draw_cb (GtkWidget *widget, GdkEventExpose *event, gpointe
GtkWidget*
title_widget_new(DbusmenuMenuitem *item)
{
- GtkWidget* widget = g_object_new (TITLE_WIDGET_TYPE,
+ GtkWidget* widget = g_object_new (TITLE_WIDGET_TYPE,
NULL);
gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (widget), TRUE);
- title_widget_set_twin_item((TitleWidget*)widget, item);
+ title_widget_set_twin_item((TitleWidget*)widget, item);
- return widget;
+ return widget;
}
diff --git a/src/title-widget.h b/src/title-widget.h
index 029aba4..2be904a 100644
--- a/src/title-widget.h
+++ b/src/title-widget.h
@@ -36,11 +36,11 @@ typedef struct _TitleWidget TitleWidget;
typedef struct _TitleWidgetClass TitleWidgetClass;
struct _TitleWidgetClass {
- GtkImageMenuItemClass parent_class;
+ GtkImageMenuItemClass parent_class;
};
struct _TitleWidget {
- GtkImageMenuItem parent;
+ GtkImageMenuItem parent;
};
GType title_widget_get_type (void);
diff --git a/src/transport-menu-item.vala b/src/transport-menu-item.vala
index 36429e8..57eb67b 100644
--- a/src/transport-menu-item.vala
+++ b/src/transport-menu-item.vala
@@ -23,43 +23,43 @@ using DbusmenuTransport;
public class TransportMenuitem : PlayerItem
{
- public enum action{
- PREVIOUS,
- PLAY_PAUSE,
- NEXT
- }
+ public enum action{
+ PREVIOUS,
+ PLAY_PAUSE,
+ NEXT
+ }
- public enum state{
- PLAYING,
- PAUSED
- }
-
- public TransportMenuitem(PlayerController parent)
+ public enum state{
+ PLAYING,
+ PAUSED
+ }
+
+ public TransportMenuitem(PlayerController parent)
{
- Object(item_type: MENUITEM_TYPE, owner: parent);
- this.property_set_int(MENUITEM_PLAY_STATE, 1);
- }
+ Object(item_type: MENUITEM_TYPE, owner: parent);
+ this.property_set_int(MENUITEM_PLAY_STATE, 1);
+ }
- public void change_play_state(state update)
- {
+ public void change_play_state(state update)
+ {
debug("UPDATING THE TRANSPORT DBUSMENUITEM PLAY STATE WITH VALUE %i",
(int)update);
- this.property_set_int(MENUITEM_PLAY_STATE, update);
- }
-
- public override void handle_event(string name, GLib.Value input_value, uint timestamp)
- {
- int input = input_value.get_int();
- debug("handle_event with value %s", input.to_string());
- debug("transport owner name = %s", this.owner.name);
- this.owner.mpris_bridge.transport_update((action)input);
- }
+ this.property_set_int(MENUITEM_PLAY_STATE, update);
+ }
+
+ public override void handle_event(string name, GLib.Value input_value, uint timestamp)
+ {
+ int input = input_value.get_int();
+ debug("handle_event with value %s", input.to_string());
+ debug("transport owner name = %s", this.owner.name);
+ this.owner.mpris_bridge.transport_update((action)input);
+ }
- public static HashSet<string> attributes_format()
- {
- HashSet<string> attrs = new HashSet<string>();
- attrs.add(MENUITEM_PLAY_STATE);
- return attrs;
- }
+ public static HashSet<string> attributes_format()
+ {
+ HashSet<string> attrs = new HashSet<string>();
+ attrs.add(MENUITEM_PLAY_STATE);
+ return attrs;
+ }
} \ No newline at end of file
diff --git a/src/transport-widget.c b/src/transport-widget.c
index 5be9d4a..d9c499d 100644
--- a/src/transport-widget.c
+++ b/src/transport-widget.c
@@ -33,12 +33,12 @@ Uses code from ctk
#define Y 7.0f
#define X 80.0f
#define INNER_RADIUS 12.5
-#define MIDDLE_RADIUS 13.0f
+#define MIDDLE_RADIUS 13.0f
#define OUTER_RADIUS 14.5f
#define CIRCLE_RADIUS 21.0f
#define PREV_WIDTH 25.0f
#define PREV_HEIGHT 17.0f
-#define NEXT_WIDTH 25.0f //PREV_WIDTH
+#define NEXT_WIDTH 25.0f //PREV_WIDTH
#define NEXT_HEIGHT 17.0f //PREV_HEIGHT
#define TRI_WIDTH 11.0f
#define TRI_HEIGHT 13.0f
@@ -53,7 +53,7 @@ Uses code from ctk
#define BAR_HEIGHT 24.0f
#define BAR_OFFSET 10.0f
#define PAUSE_X 121.0f
-#define PAUSE_Y 7.0f
+#define PAUSE_Y 7.0f
#define PLAY_WIDTH 28.0f
#define PLAY_HEIGHT 29.0f
#define PLAY_PADDING 5.0f
@@ -76,12 +76,12 @@ typedef struct _TransportWidgetPrivate TransportWidgetPrivate;
struct _TransportWidgetPrivate
{
- TransportWidgetEvent current_command;
- TransportWidgetEvent key_event;
- TransportWidgetEvent motion_event;
- TransportWidgetState current_state;
- GHashTable* command_coordinates;
- DbusmenuMenuitem* twin_item;
+ TransportWidgetEvent current_command;
+ TransportWidgetEvent key_event;
+ TransportWidgetEvent motion_event;
+ TransportWidgetState current_state;
+ GHashTable* command_coordinates;
+ DbusmenuMenuitem* twin_item;
gboolean has_focus;
};
@@ -101,18 +101,18 @@ static gboolean transport_widget_expose ( GtkWidget *button, GdkEventExpose *eve
static void draw (GtkWidget* button, cairo_t *cr);
/* UI and dbusmenu callbacks */
-static gboolean transport_widget_button_press_event (GtkWidget *menuitem,
- GdkEventButton *event);
+static gboolean transport_widget_button_press_event (GtkWidget *menuitem,
+ GdkEventButton *event);
static gboolean transport_widget_button_release_event (GtkWidget *menuitem,
- GdkEventButton *event);
+ GdkEventButton *event);
static gboolean transport_widget_motion_notify_event (GtkWidget *menuitem,
- GdkEventMotion *event);
+ GdkEventMotion *event);
static gboolean transport_widget_leave_notify_event (GtkWidget *menuitem,
- GdkEventCrossing *event);
+ GdkEventCrossing *event);
static void transport_widget_property_update ( DbusmenuMenuitem* item,
- gchar * property,
- GValue * value,
- gpointer userdata );
+ gchar * property,
+ GValue * value,
+ gpointer userdata );
static void transport_widget_menu_hidden ( GtkWidget *menu,
TransportWidget *transport);
static void transport_widget_notify ( GObject *item,
@@ -134,64 +134,64 @@ static void transport_widget_deselect (GtkItem* menu, gpointer Userdata);
static void
transport_widget_class_init (TransportWidgetClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (klass);
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (klass);
- g_type_class_add_private (klass, sizeof (TransportWidgetPrivate));
+ g_type_class_add_private (klass, sizeof (TransportWidgetPrivate));
widget_class->button_press_event = transport_widget_button_press_event;
widget_class->button_release_event = transport_widget_button_release_event;
widget_class->motion_notify_event = transport_widget_motion_notify_event;
widget_class->leave_notify_event = transport_widget_leave_notify_event;
- widget_class->expose_event = transport_widget_expose;
+ widget_class->expose_event = transport_widget_expose;
- gobject_class->dispose = transport_widget_dispose;
+ gobject_class->dispose = transport_widget_dispose;
gobject_class->finalize = transport_widget_finalize;
}
static void
transport_widget_init (TransportWidget *self)
{
- TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE(self);
- priv->current_command = TRANSPORT_NADA;
- priv->current_state = PAUSE;
- priv->key_event = TRANSPORT_NADA;
- priv->motion_event = TRANSPORT_NADA;
+ TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE(self);
+ priv->current_command = TRANSPORT_NADA;
+ priv->current_state = PAUSE;
+ priv->key_event = TRANSPORT_NADA;
+ priv->motion_event = TRANSPORT_NADA;
priv->has_focus = FALSE;
- priv->command_coordinates = g_hash_table_new_full(g_direct_hash,
- g_direct_equal,
- NULL,
- (GDestroyNotify)g_list_free);
- GList* previous_list = NULL;
- previous_list = g_list_insert(previous_list, GINT_TO_POINTER(15), 0);
- previous_list = g_list_insert(previous_list, GINT_TO_POINTER(5), 1);
- previous_list = g_list_insert(previous_list, GINT_TO_POINTER(60), 2);
- previous_list = g_list_insert(previous_list, GINT_TO_POINTER(34), 3);
+ priv->command_coordinates = g_hash_table_new_full(g_direct_hash,
+ g_direct_equal,
+ NULL,
+ (GDestroyNotify)g_list_free);
+ GList* previous_list = NULL;
+ previous_list = g_list_insert(previous_list, GINT_TO_POINTER(15), 0);
+ previous_list = g_list_insert(previous_list, GINT_TO_POINTER(5), 1);
+ previous_list = g_list_insert(previous_list, GINT_TO_POINTER(60), 2);
+ previous_list = g_list_insert(previous_list, GINT_TO_POINTER(34), 3);
g_hash_table_insert(priv->command_coordinates,
GINT_TO_POINTER(TRANSPORT_PREVIOUS),
previous_list);
- GList* play_list = NULL;
- play_list = g_list_insert(play_list, GINT_TO_POINTER(58), 0);
- play_list = g_list_insert(play_list, GINT_TO_POINTER(0), 1);
- play_list = g_list_insert(play_list, GINT_TO_POINTER(50), 2);
- play_list = g_list_insert(play_list, GINT_TO_POINTER(43), 3);
+ GList* play_list = NULL;
+ play_list = g_list_insert(play_list, GINT_TO_POINTER(58), 0);
+ play_list = g_list_insert(play_list, GINT_TO_POINTER(0), 1);
+ play_list = g_list_insert(play_list, GINT_TO_POINTER(50), 2);
+ play_list = g_list_insert(play_list, GINT_TO_POINTER(43), 3);
- g_hash_table_insert(priv->command_coordinates,
+ g_hash_table_insert(priv->command_coordinates,
GINT_TO_POINTER(TRANSPORT_PLAY_PAUSE),
play_list);
- GList* next_list = NULL;
- next_list = g_list_insert(next_list, GINT_TO_POINTER(100), 0);
- next_list = g_list_insert(next_list, GINT_TO_POINTER(5), 1);
- next_list = g_list_insert(next_list, GINT_TO_POINTER(60), 2);
- next_list = g_list_insert(next_list, GINT_TO_POINTER(34), 3);
+ GList* next_list = NULL;
+ next_list = g_list_insert(next_list, GINT_TO_POINTER(100), 0);
+ next_list = g_list_insert(next_list, GINT_TO_POINTER(5), 1);
+ next_list = g_list_insert(next_list, GINT_TO_POINTER(60), 2);
+ next_list = g_list_insert(next_list, GINT_TO_POINTER(34), 3);
- g_hash_table_insert(priv->command_coordinates,
+ g_hash_table_insert(priv->command_coordinates,
GINT_TO_POINTER(TRANSPORT_NEXT),
next_list);
- gtk_widget_set_size_request(GTK_WIDGET(self), 200, 43);
+ gtk_widget_set_size_request(GTK_WIDGET(self), 200, 43);
g_signal_connect (G_OBJECT(self),
"notify",
G_CALLBACK (transport_widget_notify),
@@ -211,37 +211,37 @@ transport_widget_init (TransportWidget *self)
static void
transport_widget_dispose (GObject *object)
{
- G_OBJECT_CLASS (transport_widget_parent_class)->dispose (object);
+ G_OBJECT_CLASS (transport_widget_parent_class)->dispose (object);
}
static void
transport_widget_finalize (GObject *object)
{
- G_OBJECT_CLASS (transport_widget_parent_class)->finalize (object);
+ G_OBJECT_CLASS (transport_widget_parent_class)->finalize (object);
}
static gboolean
transport_widget_expose (GtkWidget *button, GdkEventExpose *event)
{
- cairo_t *cr;
- cr = gdk_cairo_create (button->window);
+ cairo_t *cr;
+ cr = gdk_cairo_create (button->window);
//g_debug("In the playbutton's expose method, x = %i, y=%i and width: %i and height: %i'");
- cairo_rectangle (cr,
+ cairo_rectangle (cr,
event->area.x, event->area.y,
event->area.width, event->area.height);
- cairo_clip(cr);
+ cairo_clip(cr);
draw (button, cr);
- cairo_destroy (cr);
- return FALSE;
+ cairo_destroy (cr);
+ return FALSE;
}
gboolean
transport_widget_is_selected ( TransportWidget* widget )
{
- TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE(widget);
+ TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE(widget);
return priv->has_focus;
}
@@ -249,10 +249,10 @@ static void
transport_widget_toggle_play_pause(TransportWidget* button,
TransportWidgetState update)
{
- TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE(button);
- priv->current_state = update;
- //g_debug("TransportWidget::toggle play state : %i", priv->current_state);
- gtk_widget_queue_draw (GTK_WIDGET(button));
+ TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE(button);
+ priv->current_state = update;
+ //g_debug("TransportWidget::toggle play state : %i", priv->current_state);
+ gtk_widget_queue_draw (GTK_WIDGET(button));
}
static void
@@ -274,62 +274,62 @@ static void
transport_widget_menu_hidden ( GtkWidget *menu,
TransportWidget *transport)
{
- g_return_if_fail(IS_TRANSPORT_WIDGET(transport));
- transport_widget_react_to_button_release(transport, TRANSPORT_NADA);
+ g_return_if_fail(IS_TRANSPORT_WIDGET(transport));
+ transport_widget_react_to_button_release(transport, TRANSPORT_NADA);
}
static gboolean
transport_widget_motion_notify_event (GtkWidget *menuitem,
- GdkEventMotion *event)
+ GdkEventMotion *event)
{
- g_return_val_if_fail ( IS_TRANSPORT_WIDGET(menuitem), FALSE );
- TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE ( TRANSPORT_WIDGET(menuitem) );
- TransportWidgetEvent result = transport_widget_determine_motion_event ( TRANSPORT_WIDGET(menuitem),
+ g_return_val_if_fail ( IS_TRANSPORT_WIDGET(menuitem), FALSE );
+ TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE ( TRANSPORT_WIDGET(menuitem) );
+ TransportWidgetEvent result = transport_widget_determine_motion_event ( TRANSPORT_WIDGET(menuitem),
event);
- priv->motion_event = result;
+ priv->motion_event = result;
cairo_t *cr;
cr = gdk_cairo_create (menuitem->window);
draw ( menuitem, cr );
cairo_destroy ( cr );
- return TRUE;
+ return TRUE;
}
static gboolean
transport_widget_leave_notify_event (GtkWidget *menuitem,
GdkEventCrossing *event)
{
- g_return_val_if_fail ( IS_TRANSPORT_WIDGET(menuitem), FALSE );
- TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE ( TRANSPORT_WIDGET(menuitem) );
-
- priv->motion_event = TRANSPORT_NADA;
+ g_return_val_if_fail ( IS_TRANSPORT_WIDGET(menuitem), FALSE );
+ TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE ( TRANSPORT_WIDGET(menuitem) );
+
+ priv->motion_event = TRANSPORT_NADA;
cairo_t *cr;
cr = gdk_cairo_create (menuitem->window);
draw ( menuitem, cr );
cairo_destroy ( cr );
- return TRUE;
+ return TRUE;
}
/* keyevents */
static gboolean
transport_widget_button_press_event (GtkWidget *menuitem,
- GdkEventButton *event)
+ GdkEventButton *event)
{
- g_return_val_if_fail ( IS_TRANSPORT_WIDGET(menuitem), FALSE );
- TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE ( TRANSPORT_WIDGET(menuitem) );
+ g_return_val_if_fail ( IS_TRANSPORT_WIDGET(menuitem), FALSE );
+ TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE ( TRANSPORT_WIDGET(menuitem) );
TransportWidgetEvent result = transport_widget_determine_button_event ( TRANSPORT_WIDGET(menuitem),
event);
- if(result != TRANSPORT_NADA){
+ if(result != TRANSPORT_NADA){
priv->current_command = result;
cairo_t *cr;
cr = gdk_cairo_create (menuitem->window);
draw ( menuitem, cr );
cairo_destroy ( cr );
}
- return TRUE;
+ return TRUE;
}
static gboolean
@@ -339,14 +339,14 @@ transport_widget_button_release_event (GtkWidget *menuitem,
//g_debug("TransportWidget::menu_release_event");
g_return_val_if_fail(IS_TRANSPORT_WIDGET(menuitem), FALSE);
TransportWidget* transport = TRANSPORT_WIDGET(menuitem);
- TransportWidgetPrivate * priv = TRANSPORT_WIDGET_GET_PRIVATE ( transport );
+ TransportWidgetPrivate * priv = TRANSPORT_WIDGET_GET_PRIVATE ( transport );
TransportWidgetEvent result = transport_widget_determine_button_event ( transport,
event );
if(result != TRANSPORT_NADA){
GValue value = {0};
g_value_init(&value, G_TYPE_INT);
//g_debug("TransportWidget::menu_press_event - going to send value %i", (int)result);
- g_value_set_int(&value, (int)result);
+ g_value_set_int(&value, (int)result);
dbusmenu_menuitem_handle_event ( priv->twin_item,
"Transport state change",
&value,
@@ -361,7 +361,7 @@ static void
transport_widget_select (GtkItem* item, gpointer Userdata)
{
TransportWidget* transport = TRANSPORT_WIDGET(item);
- TransportWidgetPrivate * priv = TRANSPORT_WIDGET_GET_PRIVATE ( transport );
+ TransportWidgetPrivate * priv = TRANSPORT_WIDGET_GET_PRIVATE ( transport );
priv->has_focus = TRUE;
}
@@ -369,7 +369,7 @@ static void
transport_widget_deselect (GtkItem* item, gpointer Userdata)
{
TransportWidget* transport = TRANSPORT_WIDGET(item);
- TransportWidgetPrivate * priv = TRANSPORT_WIDGET_GET_PRIVATE ( transport );
+ TransportWidgetPrivate * priv = TRANSPORT_WIDGET_GET_PRIVATE ( transport );
priv->has_focus = FALSE;
}
@@ -391,7 +391,7 @@ transport_widget_react_to_key_press_event ( TransportWidget* transport,
printf("transport_widget_react_to_key_press_event: before drawing\n");
cr = gdk_cairo_create ( GTK_WIDGET(transport)->window );
draw ( GTK_WIDGET(transport), cr );
- cairo_destroy (cr);
+ cairo_destroy (cr);
}
}
@@ -400,11 +400,11 @@ transport_widget_react_to_key_release_event ( TransportWidget* transport,
TransportWidgetEvent transport_event )
{
if(transport_event != TRANSPORT_NADA){
- TransportWidgetPrivate * priv = TRANSPORT_WIDGET_GET_PRIVATE ( transport );
+ TransportWidgetPrivate * priv = TRANSPORT_WIDGET_GET_PRIVATE ( transport );
GValue value = {0};
g_value_init(&value, G_TYPE_INT);
//g_debug("TransportWidget::menu_press_event - going to send value %i", (int)result);
- g_value_set_int(&value, (int)transport_event);
+ g_value_set_int(&value, (int)transport_event);
dbusmenu_menuitem_handle_event ( priv->twin_item,
"Transport state change",
&value,
@@ -417,7 +417,7 @@ transport_widget_react_to_key_release_event ( TransportWidget* transport,
void
transport_widget_focus_update ( TransportWidget* transport, gboolean focus )
{
- TransportWidgetPrivate * priv = TRANSPORT_WIDGET_GET_PRIVATE ( transport );
+ TransportWidgetPrivate * priv = TRANSPORT_WIDGET_GET_PRIVATE ( transport );
priv->has_focus = focus;
g_debug("new focus update = %i", focus);
}
@@ -426,65 +426,65 @@ static TransportWidgetEvent
transport_widget_determine_button_event( TransportWidget* button,
GdkEventButton* event )
{
- //g_debug("event x coordinate = %f", event->x);
- //g_debug("event y coordinate = %f", event->y);
- TransportWidgetEvent button_event = TRANSPORT_NADA;
- // For now very simple rectangular collision detection
- if(event->x > 67 && event->x < 112
- && event->y > 12 && event->y < 40){
- button_event = TRANSPORT_PREVIOUS;
- }
- else if(event->x > 111 && event->x < 153
- && event->y > 5 && event->y < 47){
- button_event = TRANSPORT_PLAY_PAUSE;
- }
- else if(event->x > 152 && event->x < 197
- && event->y > 12 && event->y < 40){
- button_event = TRANSPORT_NEXT;
- }
- return button_event;
+ //g_debug("event x coordinate = %f", event->x);
+ //g_debug("event y coordinate = %f", event->y);
+ TransportWidgetEvent button_event = TRANSPORT_NADA;
+ // For now very simple rectangular collision detection
+ if(event->x > 67 && event->x < 112
+ && event->y > 12 && event->y < 40){
+ button_event = TRANSPORT_PREVIOUS;
+ }
+ else if(event->x > 111 && event->x < 153
+ && event->y > 5 && event->y < 47){
+ button_event = TRANSPORT_PLAY_PAUSE;
+ }
+ else if(event->x > 152 && event->x < 197
+ && event->y > 12 && event->y < 40){
+ button_event = TRANSPORT_NEXT;
+ }
+ return button_event;
}
static TransportWidgetEvent
transport_widget_determine_motion_event( TransportWidget* button,
GdkEventMotion* event )
{
-/* g_debug("event x coordinate = %f", event->x);*/
-/* g_debug("event y coordinate = %f", event->y);*/
- TransportWidgetEvent motion_event = TRANSPORT_NADA;
- // For now very simple rectangular collision detection
- if(event->x > 67 && event->x < 112
- && event->y > 12 && event->y < 40){
- motion_event = TRANSPORT_PREVIOUS;
- }
- else if(event->x > 111 && event->x < 153
- && event->y > 5 && event->y < 47){
- motion_event = TRANSPORT_PLAY_PAUSE;
- }
- else if(event->x > 152 && event->x < 197
- && event->y > 12 && event->y < 40){
- motion_event = TRANSPORT_NEXT;
- }
- return motion_event;
+/* g_debug("event x coordinate = %f", event->x);*/
+/* g_debug("event y coordinate = %f", event->y);*/
+ TransportWidgetEvent motion_event = TRANSPORT_NADA;
+ // For now very simple rectangular collision detection
+ if(event->x > 67 && event->x < 112
+ && event->y > 12 && event->y < 40){
+ motion_event = TRANSPORT_PREVIOUS;
+ }
+ else if(event->x > 111 && event->x < 153
+ && event->y > 5 && event->y < 47){
+ motion_event = TRANSPORT_PLAY_PAUSE;
+ }
+ else if(event->x > 152 && event->x < 197
+ && event->y > 12 && event->y < 40){
+ motion_event = TRANSPORT_NEXT;
+ }
+ return motion_event;
}
static void
transport_widget_react_to_button_release ( TransportWidget* button,
TransportWidgetEvent command )
{
- g_return_if_fail(IS_TRANSPORT_WIDGET(button));
- TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE(button);
- if(priv->current_command != TRANSPORT_NADA &&
- command != TRANSPORT_NADA){
- priv->current_command = command;
- }
- cairo_t *cr;
- cr = gdk_cairo_create ( GTK_WIDGET(button)->window );
-
- priv->current_command = TRANSPORT_NADA;
+ g_return_if_fail(IS_TRANSPORT_WIDGET(button));
+ TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE(button);
+ if(priv->current_command != TRANSPORT_NADA &&
+ command != TRANSPORT_NADA){
+ priv->current_command = command;
+ }
+ cairo_t *cr;
+ cr = gdk_cairo_create ( GTK_WIDGET(button)->window );
+
+ priv->current_command = TRANSPORT_NADA;
priv->key_event = TRANSPORT_NADA;
- draw ( GTK_WIDGET(button), cr );
- cairo_destroy (cr);
+ draw ( GTK_WIDGET(button), cr );
+ cairo_destroy (cr);
}
/// internal helper functions //////////////////////////////////////////////////
@@ -498,182 +498,182 @@ draw_gradient (cairo_t* cr,
double* rgba_start,
double* rgba_end)
{
- cairo_pattern_t* pattern = NULL;
-
- cairo_move_to (cr, x, y);
- cairo_line_to (cr, x + w - 2.0f * r, y);
- cairo_arc (cr,
- x + w - 2.0f * r,
- y + r,
- r,
- -90.0f * G_PI / 180.0f,
- 90.0f * G_PI / 180.0f);
- cairo_line_to (cr, x, y + 2.0f * r);
- cairo_arc (cr,
- x,
- y + r,
- r,
- 90.0f * G_PI / 180.0f,
- 270.0f * G_PI / 180.0f);
- cairo_close_path (cr);
-
- pattern = cairo_pattern_create_linear (x, y, x, y + 2.0f * r);
- cairo_pattern_add_color_stop_rgba (pattern,
- 0.0f,
- rgba_start[0],
- rgba_start[1],
- rgba_start[2],
- rgba_start[3]);
- cairo_pattern_add_color_stop_rgba (pattern,
- 1.0f,
- rgba_end[0],
- rgba_end[1],
- rgba_end[2],
- rgba_end[3]);
- cairo_set_source (cr, pattern);
- cairo_fill (cr);
- cairo_pattern_destroy (pattern);
+ cairo_pattern_t* pattern = NULL;
+
+ cairo_move_to (cr, x, y);
+ cairo_line_to (cr, x + w - 2.0f * r, y);
+ cairo_arc (cr,
+ x + w - 2.0f * r,
+ y + r,
+ r,
+ -90.0f * G_PI / 180.0f,
+ 90.0f * G_PI / 180.0f);
+ cairo_line_to (cr, x, y + 2.0f * r);
+ cairo_arc (cr,
+ x,
+ y + r,
+ r,
+ 90.0f * G_PI / 180.0f,
+ 270.0f * G_PI / 180.0f);
+ cairo_close_path (cr);
+
+ pattern = cairo_pattern_create_linear (x, y, x, y + 2.0f * r);
+ cairo_pattern_add_color_stop_rgba (pattern,
+ 0.0f,
+ rgba_start[0],
+ rgba_start[1],
+ rgba_start[2],
+ rgba_start[3]);
+ cairo_pattern_add_color_stop_rgba (pattern,
+ 1.0f,
+ rgba_end[0],
+ rgba_end[1],
+ rgba_end[2],
+ rgba_end[3]);
+ cairo_set_source (cr, pattern);
+ cairo_fill (cr);
+ cairo_pattern_destroy (pattern);
}
static void
draw_circle (cairo_t* cr,
- double x,
- double y,
- double r,
- double* rgba_start,
- double* rgba_end)
+ double x,
+ double y,
+ double r,
+ double* rgba_start,
+ double* rgba_end)
{
- cairo_pattern_t* pattern = NULL;
-
- cairo_move_to (cr, x, y);
- cairo_arc (cr,
- x + r,
- y + r,
- r,
- 0.0f * G_PI / 180.0f,
- 360.0f * G_PI / 180.0f);
-
- pattern = cairo_pattern_create_linear (x, y, x, y + 2.0f * r);
- cairo_pattern_add_color_stop_rgba (pattern,
- 0.0f,
- rgba_start[0],
- rgba_start[1],
- rgba_start[2],
- rgba_start[3]);
- cairo_pattern_add_color_stop_rgba (pattern,
- 1.0f,
- rgba_end[0],
- rgba_end[1],
- rgba_end[2],
- rgba_end[3]);
- cairo_set_source (cr, pattern);
- cairo_fill (cr);
- cairo_pattern_destroy (pattern);
+ cairo_pattern_t* pattern = NULL;
+
+ cairo_move_to (cr, x, y);
+ cairo_arc (cr,
+ x + r,
+ y + r,
+ r,
+ 0.0f * G_PI / 180.0f,
+ 360.0f * G_PI / 180.0f);
+
+ pattern = cairo_pattern_create_linear (x, y, x, y + 2.0f * r);
+ cairo_pattern_add_color_stop_rgba (pattern,
+ 0.0f,
+ rgba_start[0],
+ rgba_start[1],
+ rgba_start[2],
+ rgba_start[3]);
+ cairo_pattern_add_color_stop_rgba (pattern,
+ 1.0f,
+ rgba_end[0],
+ rgba_end[1],
+ rgba_end[2],
+ rgba_end[3]);
+ cairo_set_source (cr, pattern);
+ cairo_fill (cr);
+ cairo_pattern_destroy (pattern);
}
static void
_setup (cairo_t** cr,
- cairo_surface_t** surf,
- gint width,
- gint height)
+ cairo_surface_t** surf,
+ gint width,
+ gint height)
{
- if (!cr || !surf)
- return;
-
- *surf = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height);
- *cr = cairo_create (*surf);
- cairo_scale (*cr, 1.0f, 1.0f);
- cairo_set_operator (*cr, CAIRO_OPERATOR_CLEAR);
- cairo_paint (*cr);
- cairo_set_operator (*cr, CAIRO_OPERATOR_OVER);
+ if (!cr || !surf)
+ return;
+
+ *surf = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height);
+ *cr = cairo_create (*surf);
+ cairo_scale (*cr, 1.0f, 1.0f);
+ cairo_set_operator (*cr, CAIRO_OPERATOR_CLEAR);
+ cairo_paint (*cr);
+ cairo_set_operator (*cr, CAIRO_OPERATOR_OVER);
}
static void
_mask_prev (cairo_t* cr,
- double x,
- double y,
- double tri_width,
- double tri_height,
- double tri_offset)
+ double x,
+ double y,
+ double tri_width,
+ double tri_height,
+ double tri_offset)
{
- if (!cr)
- return;
-
- cairo_move_to (cr, x, y + tri_height / 2.0f);
- cairo_line_to (cr, x + tri_width, y);
- cairo_line_to (cr, x + tri_width, y + tri_height);
- x += tri_offset;
- cairo_move_to (cr, x, y + tri_height / 2.0f);
- cairo_line_to (cr, x + tri_width, y);
- cairo_line_to (cr, x + tri_width, y + tri_height);
- x -= tri_offset;
- cairo_rectangle (cr, x, y, 2.5f, tri_height);
- cairo_close_path (cr);
+ if (!cr)
+ return;
+
+ cairo_move_to (cr, x, y + tri_height / 2.0f);
+ cairo_line_to (cr, x + tri_width, y);
+ cairo_line_to (cr, x + tri_width, y + tri_height);
+ x += tri_offset;
+ cairo_move_to (cr, x, y + tri_height / 2.0f);
+ cairo_line_to (cr, x + tri_width, y);
+ cairo_line_to (cr, x + tri_width, y + tri_height);
+ x -= tri_offset;
+ cairo_rectangle (cr, x, y, 2.5f, tri_height);
+ cairo_close_path (cr);
}
static void
_mask_next (cairo_t* cr,
- double x,
- double y,
- double tri_width,
- double tri_height,
- double tri_offset)
+ double x,
+ double y,
+ double tri_width,
+ double tri_height,
+ double tri_offset)
{
- if (!cr)
- return;
-
- cairo_move_to (cr, x, y);
- cairo_line_to (cr, x + tri_width, y + tri_height / 2.0f);
- cairo_line_to (cr, x, y + tri_height);
- x += tri_offset;
- cairo_move_to (cr, x, y);
- cairo_line_to (cr, x + tri_width, y + tri_height / 2.0f);
- cairo_line_to (cr, x, y + tri_height);
- x -= tri_offset;
- x += 2.0f * tri_width - tri_offset - 1.0f;
- cairo_rectangle (cr, x, y, 2.5f, tri_height);
-
- cairo_close_path (cr);
+ if (!cr)
+ return;
+
+ cairo_move_to (cr, x, y);
+ cairo_line_to (cr, x + tri_width, y + tri_height / 2.0f);
+ cairo_line_to (cr, x, y + tri_height);
+ x += tri_offset;
+ cairo_move_to (cr, x, y);
+ cairo_line_to (cr, x + tri_width, y + tri_height / 2.0f);
+ cairo_line_to (cr, x, y + tri_height);
+ x -= tri_offset;
+ x += 2.0f * tri_width - tri_offset - 1.0f;
+ cairo_rectangle (cr, x, y, 2.5f, tri_height);
+
+ cairo_close_path (cr);
}
static void
_mask_pause (cairo_t* cr,
- double x,
- double y,
- double bar_width,
- double bar_height,
- double bar_offset)
+ double x,
+ double y,
+ double bar_width,
+ double bar_height,
+ double bar_offset)
{
- if (!cr)
- return;
+ if (!cr)
+ return;
- cairo_set_line_width (cr, bar_width);
- cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
+ cairo_set_line_width (cr, bar_width);
+ cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
- x += bar_width;
- y += bar_width;
- cairo_move_to (cr, x, y);
- cairo_line_to (cr, x, y + bar_height);
- cairo_move_to (cr, x + bar_offset, y);
- cairo_line_to (cr, x + bar_offset, y + bar_height);
+ x += bar_width;
+ y += bar_width;
+ cairo_move_to (cr, x, y);
+ cairo_line_to (cr, x, y + bar_height);
+ cairo_move_to (cr, x + bar_offset, y);
+ cairo_line_to (cr, x + bar_offset, y + bar_height);
}
static void
_mask_play (cairo_t* cr,
- double x,
- double y,
- double tri_width,
- double tri_height)
+ double x,
+ double y,
+ double tri_width,
+ double tri_height)
{
- if (!cr)
- return;
-
- cairo_move_to (cr, x, y);
- cairo_line_to (cr, x + tri_width, y + tri_height / 2.0f);
- cairo_line_to (cr, x, y + tri_height);
- cairo_close_path (cr);
-
+ if (!cr)
+ return;
+
+ cairo_move_to (cr, x, y);
+ cairo_line_to (cr, x + tri_width, y + tri_height / 2.0f);
+ cairo_line_to (cr, x, y + tri_height);
+ cairo_close_path (cr);
+
}
static void
@@ -686,68 +686,68 @@ _fill (cairo_t* cr,
double* rgba_end,
gboolean stroke)
{
- cairo_pattern_t* pattern = NULL;
-
- if (!cr || !rgba_start || !rgba_end)
- return;
-
- pattern = cairo_pattern_create_linear (x_start, y_start, x_end, y_end);
- cairo_pattern_add_color_stop_rgba (pattern,
- 0.0f,
- rgba_start[0],
- rgba_start[1],
- rgba_start[2],
- rgba_start[3]);
- cairo_pattern_add_color_stop_rgba (pattern,
- 1.0f,
- rgba_end[0],
- rgba_end[1],
- rgba_end[2],
- rgba_end[3]);
- cairo_set_source (cr, pattern);
- if (stroke)
- cairo_stroke (cr);
- else
- cairo_fill (cr);
- cairo_pattern_destroy (pattern);
+ cairo_pattern_t* pattern = NULL;
+
+ if (!cr || !rgba_start || !rgba_end)
+ return;
+
+ pattern = cairo_pattern_create_linear (x_start, y_start, x_end, y_end);
+ cairo_pattern_add_color_stop_rgba (pattern,
+ 0.0f,
+ rgba_start[0],
+ rgba_start[1],
+ rgba_start[2],
+ rgba_start[3]);
+ cairo_pattern_add_color_stop_rgba (pattern,
+ 1.0f,
+ rgba_end[0],
+ rgba_end[1],
+ rgba_end[2],
+ rgba_end[3]);
+ cairo_set_source (cr, pattern);
+ if (stroke)
+ cairo_stroke (cr);
+ else
+ cairo_fill (cr);
+ cairo_pattern_destroy (pattern);
}
static void
_finalize (cairo_t* cr,
- cairo_t** cr_surf,
- cairo_surface_t** surf,
- double x,
- double y)
+ cairo_t** cr_surf,
+ cairo_surface_t** surf,
+ double x,
+ double y)
{
- if (!cr || !cr_surf || !surf)
- return;
+ if (!cr || !cr_surf || !surf)
+ return;
- cairo_set_source_surface (cr, *surf, x, y);
- cairo_paint (cr);
- cairo_surface_destroy (*surf);
- cairo_destroy (*cr_surf);
+ cairo_set_source_surface (cr, *surf, x, y);
+ cairo_paint (cr);
+ cairo_surface_destroy (*surf);
+ cairo_destroy (*cr_surf);
}
static void
_finalize_repaint (cairo_t* cr,
- cairo_t** cr_surf,
- cairo_surface_t** surf,
- double x,
- double y,
- int repaints)
+ cairo_t** cr_surf,
+ cairo_surface_t** surf,
+ double x,
+ double y,
+ int repaints)
{
- if (!cr || !cr_surf || !surf)
- return;
-
- while (repaints > 0)
- {
- cairo_set_source_surface (cr, *surf, x, y);
- cairo_paint (cr);
- repaints--;
- }
-
- cairo_surface_destroy (*surf);
- cairo_destroy (*cr_surf);
+ if (!cr || !cr_surf || !surf)
+ return;
+
+ while (repaints > 0)
+ {
+ cairo_set_source_surface (cr, *surf, x, y);
+ cairo_paint (cr);
+ repaints--;
+ }
+
+ cairo_surface_destroy (*surf);
+ cairo_destroy (*cr_surf);
}
static void
@@ -755,74 +755,74 @@ _color_rgb_to_hls (gdouble *r,
gdouble *g,
gdouble *b)
{
- gdouble min;
- gdouble max;
- gdouble red;
- gdouble green;
- gdouble blue;
- gdouble h, l, s;
- gdouble delta;
-
- red = *r;
- green = *g;
- blue = *b;
-
- if (red > green)
- {
- if (red > blue)
- max = red;
- else
- max = blue;
-
- if (green < blue)
- min = green;
- else
- min = blue;
- }
- else
- {
- if (green > blue)
- max = green;
- else
- max = blue;
-
- if (red < blue)
- min = red;
- else
- min = blue;
- }
- l = (max+min)/2;
+ gdouble min;
+ gdouble max;
+ gdouble red;
+ gdouble green;
+ gdouble blue;
+ gdouble h, l, s;
+ gdouble delta;
+
+ red = *r;
+ green = *g;
+ blue = *b;
+
+ if (red > green)
+ {
+ if (red > blue)
+ max = red;
+ else
+ max = blue;
+
+ if (green < blue)
+ min = green;
+ else
+ min = blue;
+ }
+ else
+ {
+ if (green > blue)
+ max = green;
+ else
+ max = blue;
+
+ if (red < blue)
+ min = red;
+ else
+ min = blue;
+ }
+ l = (max+min)/2;
if (fabs (max-min) < 0.0001)
{
- h = 0;
- s = 0;
- }
- else
+ h = 0;
+ s = 0;
+ }
+ else
{
- if (l <= 0.5)
- s = (max-min)/(max+min);
- else
- s = (max-min)/(2-max-min);
+ if (l <= 0.5)
+ s = (max-min)/(max+min);
+ else
+ s = (max-min)/(2-max-min);
- delta = (max -min) != 0 ? (max -min) : 1;
+ delta = (max -min) != 0 ? (max -min) : 1;
if(delta == 0)
delta = 1;
- if (red == max)
- h = (green-blue)/delta;
- else if (green == max)
- h = 2+(blue-red)/delta;
- else if (blue == max)
- h = 4+(red-green)/delta;
-
- h *= 60;
- if (h < 0.0)
- h += 360;
- }
-
- *r = h;
- *g = l;
- *b = s;
+ if (red == max)
+ h = (green-blue)/delta;
+ else if (green == max)
+ h = 2+(blue-red)/delta;
+ else if (blue == max)
+ h = 4+(red-green)/delta;
+
+ h *= 60;
+ if (h < 0.0)
+ h += 360;
+ }
+
+ *r = h;
+ *g = l;
+ *b = s;
}
static void
@@ -830,866 +830,866 @@ _color_hls_to_rgb (gdouble *h,
gdouble *l,
gdouble *s)
{
- gdouble hue;
- gdouble lightness;
- gdouble saturation;
- gdouble m1, m2;
- gdouble r, g, b;
-
- lightness = *l;
- saturation = *s;
-
- if (lightness <= 0.5)
- m2 = lightness*(1+saturation);
- else
- m2 = lightness+saturation-lightness*saturation;
-
- m1 = 2*lightness-m2;
-
- if (saturation == 0)
- {
- *h = lightness;
- *l = lightness;
- *s = lightness;
- }
- else
- {
- hue = *h+120;
- while (hue > 360)
- hue -= 360;
- while (hue < 0)
- hue += 360;
-
- if (hue < 60)
- r = m1+(m2-m1)*hue/60;
- else if (hue < 180)
- r = m2;
- else if (hue < 240)
- r = m1+(m2-m1)*(240-hue)/60;
- else
- r = m1;
-
- hue = *h;
- while (hue > 360)
- hue -= 360;
- while (hue < 0)
- hue += 360;
-
- if (hue < 60)
- g = m1+(m2-m1)*hue/60;
- else if (hue < 180)
- g = m2;
- else if (hue < 240)
- g = m1+(m2-m1)*(240-hue)/60;
- else
- g = m1;
-
- hue = *h-120;
- while (hue > 360)
- hue -= 360;
- while (hue < 0)
- hue += 360;
-
- if (hue < 60)
- b = m1+(m2-m1)*hue/60;
- else if (hue < 180)
- b = m2;
- else if (hue < 240)
- b = m1+(m2-m1)*(240-hue)/60;
- else
- b = m1;
-
- *h = r;
- *l = g;
- *s = b;
- }
+ gdouble hue;
+ gdouble lightness;
+ gdouble saturation;
+ gdouble m1, m2;
+ gdouble r, g, b;
+
+ lightness = *l;
+ saturation = *s;
+
+ if (lightness <= 0.5)
+ m2 = lightness*(1+saturation);
+ else
+ m2 = lightness+saturation-lightness*saturation;
+
+ m1 = 2*lightness-m2;
+
+ if (saturation == 0)
+ {
+ *h = lightness;
+ *l = lightness;
+ *s = lightness;
+ }
+ else
+ {
+ hue = *h+120;
+ while (hue > 360)
+ hue -= 360;
+ while (hue < 0)
+ hue += 360;
+
+ if (hue < 60)
+ r = m1+(m2-m1)*hue/60;
+ else if (hue < 180)
+ r = m2;
+ else if (hue < 240)
+ r = m1+(m2-m1)*(240-hue)/60;
+ else
+ r = m1;
+
+ hue = *h;
+ while (hue > 360)
+ hue -= 360;
+ while (hue < 0)
+ hue += 360;
+
+ if (hue < 60)
+ g = m1+(m2-m1)*hue/60;
+ else if (hue < 180)
+ g = m2;
+ else if (hue < 240)
+ g = m1+(m2-m1)*(240-hue)/60;
+ else
+ g = m1;
+
+ hue = *h-120;
+ while (hue > 360)
+ hue -= 360;
+ while (hue < 0)
+ hue += 360;
+
+ if (hue < 60)
+ b = m1+(m2-m1)*hue/60;
+ else if (hue < 180)
+ b = m2;
+ else if (hue < 240)
+ b = m1+(m2-m1)*(240-hue)/60;
+ else
+ b = m1;
+
+ *h = r;
+ *l = g;
+ *s = b;
+ }
}
void
_color_shade (const CairoColorRGB *a, float k, CairoColorRGB *b)
{
- double red;
- double green;
- double blue;
-
- red = a->r;
- green = a->g;
- blue = a->b;
-
- if (k == 1.0)
- {
- b->r = red;
- b->g = green;
- b->b = blue;
- return;
- }
-
- _color_rgb_to_hls (&red, &green, &blue);
-
- green *= k;
- if (green > 1.0)
- green = 1.0;
- else if (green < 0.0)
- green = 0.0;
-
- blue *= k;
- if (blue > 1.0)
- blue = 1.0;
- else if (blue < 0.0)
- blue = 0.0;
-
- _color_hls_to_rgb (&red, &green, &blue);
-
- b->r = red;
- b->g = green;
- b->b = blue;
+ double red;
+ double green;
+ double blue;
+
+ red = a->r;
+ green = a->g;
+ blue = a->b;
+
+ if (k == 1.0)
+ {
+ b->r = red;
+ b->g = green;
+ b->b = blue;
+ return;
+ }
+
+ _color_rgb_to_hls (&red, &green, &blue);
+
+ green *= k;
+ if (green > 1.0)
+ green = 1.0;
+ else if (green < 0.0)
+ green = 0.0;
+
+ blue *= k;
+ if (blue > 1.0)
+ blue = 1.0;
+ else if (blue < 0.0)
+ blue = 0.0;
+
+ _color_hls_to_rgb (&red, &green, &blue);
+
+ b->r = red;
+ b->g = green;
+ b->b = blue;
}
static inline void
_blurinner (guchar* pixel,
- gint* zR,
- gint* zG,
- gint* zB,
- gint* zA,
- gint alpha,
- gint aprec,
- gint zprec)
+ gint* zR,
+ gint* zG,
+ gint* zB,
+ gint* zA,
+ gint alpha,
+ gint aprec,
+ gint zprec)
{
- gint R;
- gint G;
- gint B;
- guchar A;
-
- R = *pixel;
- G = *(pixel + 1);
- B = *(pixel + 2);
- A = *(pixel + 3);
-
- *zR += (alpha * ((R << zprec) - *zR)) >> aprec;
- *zG += (alpha * ((G << zprec) - *zG)) >> aprec;
- *zB += (alpha * ((B << zprec) - *zB)) >> aprec;
- *zA += (alpha * ((A << zprec) - *zA)) >> aprec;
-
- *pixel = *zR >> zprec;
- *(pixel + 1) = *zG >> zprec;
- *(pixel + 2) = *zB >> zprec;
- *(pixel + 3) = *zA >> zprec;
+ gint R;
+ gint G;
+ gint B;
+ guchar A;
+
+ R = *pixel;
+ G = *(pixel + 1);
+ B = *(pixel + 2);
+ A = *(pixel + 3);
+
+ *zR += (alpha * ((R << zprec) - *zR)) >> aprec;
+ *zG += (alpha * ((G << zprec) - *zG)) >> aprec;
+ *zB += (alpha * ((B << zprec) - *zB)) >> aprec;
+ *zA += (alpha * ((A << zprec) - *zA)) >> aprec;
+
+ *pixel = *zR >> zprec;
+ *(pixel + 1) = *zG >> zprec;
+ *(pixel + 2) = *zB >> zprec;
+ *(pixel + 3) = *zA >> zprec;
}
static inline void
_blurrow (guchar* pixels,
- gint width,
- gint height,
- gint channels,
- gint line,
- gint alpha,
- gint aprec,
- gint zprec)
+ gint width,
+ gint height,
+ gint channels,
+ gint line,
+ gint alpha,
+ gint aprec,
+ gint zprec)
{
- gint zR;
- gint zG;
- gint zB;
- gint zA;
- gint index;
- guchar* scanline;
-
- scanline = &(pixels[line * width * channels]);
-
- zR = *scanline << zprec;
- zG = *(scanline + 1) << zprec;
- zB = *(scanline + 2) << zprec;
- zA = *(scanline + 3) << zprec;
-
- for (index = 0; index < width; index ++)
- _blurinner (&scanline[index * channels],
- &zR,
- &zG,
- &zB,
- &zA,
- alpha,
- aprec,
- zprec);
-
- for (index = width - 2; index >= 0; index--)
- _blurinner (&scanline[index * channels],
- &zR,
- &zG,
- &zB,
- &zA,
- alpha,
- aprec,
- zprec);
+ gint zR;
+ gint zG;
+ gint zB;
+ gint zA;
+ gint index;
+ guchar* scanline;
+
+ scanline = &(pixels[line * width * channels]);
+
+ zR = *scanline << zprec;
+ zG = *(scanline + 1) << zprec;
+ zB = *(scanline + 2) << zprec;
+ zA = *(scanline + 3) << zprec;
+
+ for (index = 0; index < width; index ++)
+ _blurinner (&scanline[index * channels],
+ &zR,
+ &zG,
+ &zB,
+ &zA,
+ alpha,
+ aprec,
+ zprec);
+
+ for (index = width - 2; index >= 0; index--)
+ _blurinner (&scanline[index * channels],
+ &zR,
+ &zG,
+ &zB,
+ &zA,
+ alpha,
+ aprec,
+ zprec);
}
static inline void
_blurcol (guchar* pixels,
- gint width,
- gint height,
- gint channels,
- gint x,
- gint alpha,
- gint aprec,
- gint zprec)
+ gint width,
+ gint height,
+ gint channels,
+ gint x,
+ gint alpha,
+ gint aprec,
+ gint zprec)
{
- gint zR;
- gint zG;
- gint zB;
- gint zA;
- gint index;
- guchar* ptr;
-
- ptr = pixels;
-
- ptr += x * channels;
-
- zR = *((guchar*) ptr ) << zprec;
- zG = *((guchar*) ptr + 1) << zprec;
- zB = *((guchar*) ptr + 2) << zprec;
- zA = *((guchar*) ptr + 3) << zprec;
-
- for (index = width; index < (height - 1) * width; index += width)
- _blurinner ((guchar*) &ptr[index * channels],
- &zR,
- &zG,
- &zB,
- &zA,
- alpha,
- aprec,
- zprec);
-
- for (index = (height - 2) * width; index >= 0; index -= width)
- _blurinner ((guchar*) &ptr[index * channels],
- &zR,
- &zG,
- &zB,
- &zA,
- alpha,
- aprec,
- zprec);
+ gint zR;
+ gint zG;
+ gint zB;
+ gint zA;
+ gint index;
+ guchar* ptr;
+
+ ptr = pixels;
+
+ ptr += x * channels;
+
+ zR = *((guchar*) ptr ) << zprec;
+ zG = *((guchar*) ptr + 1) << zprec;
+ zB = *((guchar*) ptr + 2) << zprec;
+ zA = *((guchar*) ptr + 3) << zprec;
+
+ for (index = width; index < (height - 1) * width; index += width)
+ _blurinner ((guchar*) &ptr[index * channels],
+ &zR,
+ &zG,
+ &zB,
+ &zA,
+ alpha,
+ aprec,
+ zprec);
+
+ for (index = (height - 2) * width; index >= 0; index -= width)
+ _blurinner ((guchar*) &ptr[index * channels],
+ &zR,
+ &zG,
+ &zB,
+ &zA,
+ alpha,
+ aprec,
+ zprec);
}
void
_expblur (guchar* pixels,
- gint width,
- gint height,
- gint channels,
- gint radius,
- gint aprec,
- gint zprec)
+ gint width,
+ gint height,
+ gint channels,
+ gint radius,
+ gint aprec,
+ gint zprec)
{
- gint alpha;
- gint row = 0;
- gint col = 0;
-
- if (radius < 1)
- return;
-
- // calculate the alpha such that 90% of
- // the kernel is within the radius.
- // (Kernel extends to infinity)
- alpha = (gint) ((1 << aprec) * (1.0f - expf (-2.3f / (radius + 1.f))));
-
- for (; row < height; row++)
- _blurrow (pixels,
- width,
- height,
- channels,
- row,
- alpha,
- aprec,
- zprec);
-
- for(; col < width; col++)
- _blurcol (pixels,
- width,
- height,
- channels,
- col,
- alpha,
- aprec,
- zprec);
-
- return;
+ gint alpha;
+ gint row = 0;
+ gint col = 0;
+
+ if (radius < 1)
+ return;
+
+ // calculate the alpha such that 90% of
+ // the kernel is within the radius.
+ // (Kernel extends to infinity)
+ alpha = (gint) ((1 << aprec) * (1.0f - expf (-2.3f / (radius + 1.f))));
+
+ for (; row < height; row++)
+ _blurrow (pixels,
+ width,
+ height,
+ channels,
+ row,
+ alpha,
+ aprec,
+ zprec);
+
+ for(; col < width; col++)
+ _blurcol (pixels,
+ width,
+ height,
+ channels,
+ col,
+ alpha,
+ aprec,
+ zprec);
+
+ return;
}
void
_surface_blur (cairo_surface_t* surface,
guint radius)
{
- guchar* pixels;
- guint width;
- guint height;
- cairo_format_t format;
-
- // before we mess with the surface execute any pending drawing
- cairo_surface_flush (surface);
-
- pixels = cairo_image_surface_get_data (surface);
- width = cairo_image_surface_get_width (surface);
- height = cairo_image_surface_get_height (surface);
- format = cairo_image_surface_get_format (surface);
-
- switch (format)
- {
- case CAIRO_FORMAT_ARGB32:
- _expblur (pixels, width, height, 4, radius, 16, 7);
- break;
-
- case CAIRO_FORMAT_RGB24:
- _expblur (pixels, width, height, 3, radius, 16, 7);
- break;
-
- case CAIRO_FORMAT_A8:
- _expblur (pixels, width, height, 1, radius, 16, 7);
- break;
-
- default :
- // do nothing
- break;
- }
-
- // inform cairo we altered the surfaces contents
- cairo_surface_mark_dirty (surface);
+ guchar* pixels;
+ guint width;
+ guint height;
+ cairo_format_t format;
+
+ // before we mess with the surface execute any pending drawing
+ cairo_surface_flush (surface);
+
+ pixels = cairo_image_surface_get_data (surface);
+ width = cairo_image_surface_get_width (surface);
+ height = cairo_image_surface_get_height (surface);
+ format = cairo_image_surface_get_format (surface);
+
+ switch (format)
+ {
+ case CAIRO_FORMAT_ARGB32:
+ _expblur (pixels, width, height, 4, radius, 16, 7);
+ break;
+
+ case CAIRO_FORMAT_RGB24:
+ _expblur (pixels, width, height, 3, radius, 16, 7);
+ break;
+
+ case CAIRO_FORMAT_A8:
+ _expblur (pixels, width, height, 1, radius, 16, 7);
+ break;
+
+ default :
+ // do nothing
+ break;
+ }
+
+ // inform cairo we altered the surfaces contents
+ cairo_surface_mark_dirty (surface);
}
static void
draw (GtkWidget* button, cairo_t *cr)
{
- g_return_if_fail(IS_TRANSPORT_WIDGET(button));
- TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE(button);
-
- cairo_surface_t* surf = NULL;
- cairo_t* cr_surf = NULL;
-
- cairo_translate (cr, button->allocation.x, button->allocation.y);
-
- //g_debug("button x allocation = %i", button->allocation.x);
- //g_debug("button y allocation = %i", button->allocation.y);
-
- GtkStyle *style;
-
- CairoColorRGB bg_color, fg_color, bg_selected, bg_prelight;
- CairoColorRGB color_middle[2], color_middle_prelight[2], color_outer[2], color_outer_prelight[2],
- color_play_outer[2], color_play_outer_prelight[2],
- color_button[4], color_button_shadow, color_inner[2], color_inner_compressed[2];
-
- style = gtk_widget_get_style (button);
-
- bg_color.r = style->bg[0].red/65535.0;
- bg_color.g = style->bg[0].green/65535.0;
- bg_color.b = style->bg[0].blue/65535.0;
-
- bg_prelight.r = style->bg[GTK_STATE_PRELIGHT].red/65535.0;
- bg_prelight.g = style->bg[GTK_STATE_PRELIGHT].green/65535.0;
- bg_prelight.b = style->bg[GTK_STATE_PRELIGHT].blue/65535.0;
-
- bg_selected.r = style->bg[GTK_STATE_SELECTED].red/65535.0;
- bg_selected.g = style->bg[GTK_STATE_SELECTED].green/65535.0;
- bg_selected.b = style->bg[GTK_STATE_SELECTED].blue/65535.0;
-
- fg_color.r = style->fg[0].red/65535.0;
- fg_color.g = style->fg[0].green/65535.0;
- fg_color.b = style->fg[0].blue/65535.0;
-
- _color_shade (&bg_color, MIDDLE_START_SHADE, &color_middle[0]);
- _color_shade (&bg_color, MIDDLE_END_SHADE, &color_middle[1]);
- _color_shade (&bg_prelight, MIDDLE_START_SHADE, &color_middle_prelight[0]);
- _color_shade (&bg_prelight, MIDDLE_END_SHADE, &color_middle_prelight[1]);
- _color_shade (&bg_color, OUTER_START_SHADE, &color_outer[0]);
- _color_shade (&bg_color, OUTER_END_SHADE, &color_outer[1]);
- _color_shade (&bg_prelight, OUTER_START_SHADE, &color_outer_prelight[0]);
- _color_shade (&bg_prelight, OUTER_END_SHADE, &color_outer_prelight[1]);
- _color_shade (&bg_color, OUTER_PLAY_START_SHADE, &color_play_outer[0]);
- _color_shade (&bg_color, OUTER_PLAY_END_SHADE, &color_play_outer[1]);
- _color_shade (&bg_prelight, OUTER_PLAY_START_SHADE, &color_play_outer_prelight[0]);
- _color_shade (&bg_prelight, OUTER_PLAY_END_SHADE, &color_play_outer_prelight[1]);
- _color_shade (&bg_color, INNER_START_SHADE, &color_inner[0]);
- _color_shade (&bg_color, INNER_END_SHADE, &color_inner[1]);
- _color_shade (&fg_color, BUTTON_START_SHADE, &color_button[0]);
- _color_shade (&fg_color, BUTTON_END_SHADE, &color_button[1]);
- _color_shade (&bg_color, BUTTON_SHADOW_SHADE, &color_button[2]);
- _color_shade (&bg_color, SHADOW_BUTTON_SHADE, &color_button_shadow);
- _color_shade (&bg_selected, 1.0, &color_button[3]);
- _color_shade (&bg_color, INNER_COMPRESSED_START_SHADE, &color_inner_compressed[0]);
- _color_shade (&bg_color, INNER_COMPRESSED_END_SHADE, &color_inner_compressed[1]);
-
- double MIDDLE_END[] = {color_middle[0].r, color_middle[0].g, color_middle[0].b, 1.0f};
- double MIDDLE_START[] = {color_middle[1].r, color_middle[1].g, color_middle[1].b, 1.0f};
- double MIDDLE_END_PRELIGHT[] = {color_middle_prelight[0].r, color_middle_prelight[0].g, color_middle_prelight[0].b, 1.0f};
- double MIDDLE_START_PRELIGHT[] = {color_middle_prelight[1].r, color_middle_prelight[1].g, color_middle_prelight[1].b, 1.0f};
- double OUTER_END[] = {color_outer[0].r, color_outer[0].g, color_outer[0].b, 1.0f};
- double OUTER_START[] = {color_outer[1].r, color_outer[1].g, color_outer[1].b, 1.0f};
- double OUTER_END_PRELIGHT[] = {color_outer_prelight[0].r, color_outer_prelight[0].g, color_outer_prelight[0].b, 1.0f};
- double OUTER_START_PRELIGHT[] = {color_outer_prelight[1].r, color_outer_prelight[1].g, color_outer_prelight[1].b, 1.0f};
- double SHADOW_BUTTON[] = {color_button_shadow.r, color_button_shadow.g, color_button_shadow.b, 0.3f};
- double OUTER_PLAY_END[] = {color_play_outer[0].r, color_play_outer[0].g, color_play_outer[0].b, 1.0f};
- double OUTER_PLAY_START[] = {color_play_outer[1].r, color_play_outer[1].g, color_play_outer[1].b, 1.0f};
- double OUTER_PLAY_END_PRELIGHT[] = {color_play_outer_prelight[0].r, color_play_outer_prelight[0].g, color_play_outer_prelight[0].b, 1.0f};
- double OUTER_PLAY_START_PRELIGHT[] = {color_play_outer_prelight[1].r, color_play_outer_prelight[1].g, color_play_outer_prelight[1].b, 1.0f};
- double BUTTON_END[] = {color_button[0].r, color_button[0].g, color_button[0].b, 1.0f};
- double BUTTON_START[] = {color_button[1].r, color_button[1].g, color_button[1].b, 1.0f};
- double BUTTON_SHADOW[] = {color_button[2].r, color_button[2].g, color_button[2].b, 0.75f};
- double BUTTON_SHADOW_FOCUS[] = {color_button[3].r, color_button[3].g, color_button[3].b, 1.0f};
- double INNER_COMPRESSED_END[] = {color_inner_compressed[1].r, color_inner_compressed[1].g, color_inner_compressed[1].b, 1.0f};
- double INNER_COMPRESSED_START[] = {color_inner_compressed[0].r, color_inner_compressed[0].g, color_inner_compressed[0].b, 1.0f};
-
-
- draw_gradient (cr,
- X,
- Y,
- RECT_WIDTH,
- OUTER_RADIUS,
- OUTER_START,
- OUTER_END);
-
- draw_gradient (cr,
- X,
- Y + 1,
- RECT_WIDTH - 2,
- MIDDLE_RADIUS,
- MIDDLE_START,
- MIDDLE_END);
-
- draw_gradient (cr,
- X,
- Y + 2,
- RECT_WIDTH - 4,
- MIDDLE_RADIUS,
- MIDDLE_START,
- MIDDLE_END);
-
- //prev/next button
- if(priv->current_command == TRANSPORT_PREVIOUS)
- {
- draw_gradient (cr,
- X,
- Y,
- RECT_WIDTH/2,
- OUTER_RADIUS,
- OUTER_END,
- OUTER_START);
-
- draw_gradient (cr,
- X,
- Y + 1,
- RECT_WIDTH/2,
- MIDDLE_RADIUS,
- INNER_COMPRESSED_START,
- INNER_COMPRESSED_END);
-
- draw_gradient (cr,
- X,
- Y + 2,
- RECT_WIDTH/2,
- MIDDLE_RADIUS,
- INNER_COMPRESSED_START,
- INNER_COMPRESSED_END);
- }
- else if(priv->current_command == TRANSPORT_NEXT)
- {
- draw_gradient (cr,
- RECT_WIDTH / 2 + X,
- Y,
- RECT_WIDTH/2,
- OUTER_RADIUS,
- OUTER_END,
- OUTER_START);
-
- draw_gradient (cr,
- RECT_WIDTH / 2 + X,
- Y + 1,
- (RECT_WIDTH - 7)/2,
- MIDDLE_RADIUS,
- INNER_COMPRESSED_START,
- INNER_COMPRESSED_END);
-
- draw_gradient (cr,
- RECT_WIDTH / 2 + X,
- Y + 2,
- (RECT_WIDTH - 7)/2,
- MIDDLE_RADIUS,
- INNER_COMPRESSED_START,
- INNER_COMPRESSED_END);
- }
- else if (priv->motion_event == TRANSPORT_PREVIOUS)
- {
- draw_gradient (cr,
- X,
- Y,
- RECT_WIDTH/2,
- OUTER_RADIUS,
- OUTER_START_PRELIGHT,
- OUTER_END_PRELIGHT);
-
- draw_gradient (cr,
- X,
- Y + 1,
- RECT_WIDTH/2,
- MIDDLE_RADIUS,
- MIDDLE_START_PRELIGHT,
- MIDDLE_END_PRELIGHT);
-
- draw_gradient (cr,
- X,
- Y + 2,
- RECT_WIDTH/2,
- MIDDLE_RADIUS,
- MIDDLE_START_PRELIGHT,
- MIDDLE_END_PRELIGHT);
- }
- else if (priv->motion_event == TRANSPORT_NEXT)
- {
- draw_gradient (cr,
- RECT_WIDTH / 2 + X,
- Y,
- RECT_WIDTH/2,
- OUTER_RADIUS,
- OUTER_START_PRELIGHT,
- OUTER_END_PRELIGHT);
-
- draw_gradient (cr,
- RECT_WIDTH / 2 + X,
- Y + 1,
- (RECT_WIDTH - 7)/2,
- MIDDLE_RADIUS,
- MIDDLE_START_PRELIGHT,
- MIDDLE_END_PRELIGHT);
-
- draw_gradient (cr,
- RECT_WIDTH / 2 + X,
- Y + 2,
- (RECT_WIDTH - 7)/2,
- MIDDLE_RADIUS,
- MIDDLE_START_PRELIGHT,
- MIDDLE_END_PRELIGHT);
- }
-
- // play/pause shadow
- if(priv->current_command != TRANSPORT_PLAY_PAUSE)
- {
- cairo_save (cr);
- cairo_rectangle (cr, X, Y, RECT_WIDTH, MIDDLE_RADIUS*2);
- cairo_clip (cr);
-
- draw_circle (cr,
- X + RECT_WIDTH / 2.0f - 2.0f * OUTER_RADIUS - 5.5f - 1.0f,
- Y - ((CIRCLE_RADIUS - OUTER_RADIUS)) - 1.0f,
- CIRCLE_RADIUS + 1.0f,
- SHADOW_BUTTON,
- SHADOW_BUTTON);
-
- cairo_restore (cr);
- }
-
- // play/pause button
- if(priv->current_command == TRANSPORT_PLAY_PAUSE)
- {
- draw_circle (cr,
- X + RECT_WIDTH / 2.0f - 2.0f * OUTER_RADIUS - 5.5f,
- Y - ((CIRCLE_RADIUS - OUTER_RADIUS)) ,
- CIRCLE_RADIUS,
- OUTER_PLAY_END,
- OUTER_PLAY_START);
-
- draw_circle (cr,
- X + RECT_WIDTH / 2.0f - 2.0f * OUTER_RADIUS - 5.5f + 1.25f,
- Y - ((CIRCLE_RADIUS - OUTER_RADIUS)) + 1.25f,
- CIRCLE_RADIUS - 1.25,
- INNER_COMPRESSED_START,
- INNER_COMPRESSED_END);
- }
- else if (priv->motion_event == TRANSPORT_PLAY_PAUSE)
- {
- /* this subtle offset is to fix alpha borders, should be removed once this draw routine will be refactored */
- draw_circle (cr,
- X + RECT_WIDTH / 2.0f - 2.0f * OUTER_RADIUS - 5.5f + 0.1,
- Y - ((CIRCLE_RADIUS - OUTER_RADIUS)) + 0.1,
- CIRCLE_RADIUS - 0.1,
- OUTER_PLAY_START_PRELIGHT,
- OUTER_PLAY_END_PRELIGHT);
-
- draw_circle (cr,
- X + RECT_WIDTH / 2.0f - 2.0f * OUTER_RADIUS - 5.5f + 1.25f,
- Y - ((CIRCLE_RADIUS - OUTER_RADIUS)) + 1.25f,
- CIRCLE_RADIUS - 1.25,
- MIDDLE_START_PRELIGHT,
- MIDDLE_END_PRELIGHT);
- }
- else
- {
- draw_circle (cr,
- X + RECT_WIDTH / 2.0f - 2.0f * OUTER_RADIUS - 5.5f,
- Y - ((CIRCLE_RADIUS - OUTER_RADIUS)),
- CIRCLE_RADIUS,
- OUTER_PLAY_START,
- OUTER_PLAY_END);
-
- draw_circle (cr,
- X + RECT_WIDTH / 2.0f - 2.0f * OUTER_RADIUS - 5.5f + 1.25f,
- Y - ((CIRCLE_RADIUS - OUTER_RADIUS)) + 1.25f,
- CIRCLE_RADIUS - 1.25,
- MIDDLE_START,
- MIDDLE_END);
- }
-
- // draw previous-button drop-shadow
- if (priv->has_focus && priv->key_event == TRANSPORT_PREVIOUS)
- {
- _setup (&cr_surf, &surf, PREV_WIDTH+6, PREV_HEIGHT+6);
- _mask_prev (cr_surf,
- (PREV_WIDTH - (2.0f * TRI_WIDTH - TRI_OFFSET)) / 2.0f,
- (PREV_HEIGHT - TRI_HEIGHT) / 2.0f,
- TRI_WIDTH,
- TRI_HEIGHT,
- TRI_OFFSET);
- _fill (cr_surf,
- (PREV_WIDTH - (2.0f * TRI_WIDTH - TRI_OFFSET)) / 2.0f,
- (PREV_HEIGHT - TRI_HEIGHT) / 2.0f,
- (PREV_WIDTH - (2.0f * TRI_WIDTH - TRI_OFFSET)) / 2.0f,
- (double) TRI_HEIGHT,
- BUTTON_SHADOW_FOCUS,
- BUTTON_SHADOW_FOCUS,
- FALSE);
- _surface_blur (surf, 3);
- _finalize_repaint (cr, &cr_surf, &surf, PREV_X, PREV_Y + 0.5f, 3);
- }
- else
- {
- _setup (&cr_surf, &surf, PREV_WIDTH, PREV_HEIGHT);
- _mask_prev (cr_surf,
- (PREV_WIDTH - (2.0f * TRI_WIDTH - TRI_OFFSET)) / 2.0f,
- (PREV_HEIGHT - TRI_HEIGHT) / 2.0f,
- TRI_WIDTH,
- TRI_HEIGHT,
- TRI_OFFSET);
- _fill (cr_surf,
- (PREV_WIDTH - (2.0f * TRI_WIDTH - TRI_OFFSET)) / 2.0f,
- (PREV_HEIGHT - TRI_HEIGHT) / 2.0f,
- (PREV_WIDTH - (2.0f * TRI_WIDTH - TRI_OFFSET)) / 2.0f,
- (double) TRI_HEIGHT,
- BUTTON_SHADOW,
- BUTTON_SHADOW,
- FALSE);
- _surface_blur (surf, 1);
- _finalize (cr, &cr_surf, &surf, PREV_X, PREV_Y + 1.0f);
- }
-
- // draw previous-button
- _setup (&cr_surf, &surf, PREV_WIDTH, PREV_HEIGHT);
- _mask_prev (cr_surf,
- (PREV_WIDTH - (2.0f * TRI_WIDTH - TRI_OFFSET)) / 2.0f,
- (PREV_HEIGHT - TRI_HEIGHT) / 2.0f,
- TRI_WIDTH,
- TRI_HEIGHT,
- TRI_OFFSET);
- _fill (cr_surf,
- (PREV_WIDTH - (2.0f * TRI_WIDTH - TRI_OFFSET)) / 2.0f,
- (PREV_HEIGHT - TRI_HEIGHT) / 2.0f,
- (PREV_WIDTH - (2.0f * TRI_WIDTH - TRI_OFFSET)) / 2.0f,
- (double) TRI_HEIGHT,
- BUTTON_START,
- BUTTON_END,
- FALSE);
- _finalize (cr, &cr_surf, &surf, PREV_X, PREV_Y);
-
- // draw next-button drop-shadow
- if (priv->has_focus && priv->key_event == TRANSPORT_NEXT)
- {
- _setup (&cr_surf, &surf, NEXT_WIDTH+6, NEXT_HEIGHT+6);
- _mask_next (cr_surf,
- (NEXT_WIDTH - (2.0f * TRI_WIDTH - TRI_OFFSET)) / 2.0f,
- (NEXT_HEIGHT - TRI_HEIGHT) / 2.0f,
- TRI_WIDTH,
- TRI_HEIGHT,
- TRI_OFFSET);
- _fill (cr_surf,
- (NEXT_WIDTH - (2.0f * TRI_WIDTH - TRI_OFFSET)) / 2.0f,
- (NEXT_HEIGHT - TRI_HEIGHT) / 2.0f,
- (NEXT_WIDTH - (2.0f * TRI_WIDTH - TRI_OFFSET)) / 2.0f,
- (double) TRI_HEIGHT,
- BUTTON_SHADOW_FOCUS,
- BUTTON_SHADOW_FOCUS,
- FALSE);
- _surface_blur (surf, 3);
- _finalize_repaint (cr, &cr_surf, &surf, NEXT_X, NEXT_Y + 0.5f, 3);
- }
- else
- {
- _setup (&cr_surf, &surf, NEXT_WIDTH, NEXT_HEIGHT);
- _mask_next (cr_surf,
- (NEXT_WIDTH - (2.0f * TRI_WIDTH - TRI_OFFSET)) / 2.0f,
- (NEXT_HEIGHT - TRI_HEIGHT) / 2.0f,
- TRI_WIDTH,
- TRI_HEIGHT,
- TRI_OFFSET);
- _fill (cr_surf,
- (NEXT_WIDTH - (2.0f * TRI_WIDTH - TRI_OFFSET)) / 2.0f,
- (NEXT_HEIGHT - TRI_HEIGHT) / 2.0f,
- (NEXT_WIDTH - (2.0f * TRI_WIDTH - TRI_OFFSET)) / 2.0f,
- (double) TRI_HEIGHT,
- BUTTON_SHADOW,
- BUTTON_SHADOW,
- FALSE);
- _surface_blur (surf, 1);
- _finalize (cr, &cr_surf, &surf, NEXT_X, NEXT_Y + 1.0f);
- }
-
- // draw next-button
- _setup (&cr_surf, &surf, NEXT_WIDTH, NEXT_HEIGHT);
- _mask_next (cr_surf,
- (NEXT_WIDTH - (2.0f * TRI_WIDTH - TRI_OFFSET)) / 2.0f,
- (NEXT_HEIGHT - TRI_HEIGHT) / 2.0f,
- TRI_WIDTH,
- TRI_HEIGHT,
- TRI_OFFSET);
- _fill (cr_surf,
- (NEXT_WIDTH - (2.0f * TRI_WIDTH - TRI_OFFSET)) / 2.0f,
- (NEXT_HEIGHT - TRI_HEIGHT) / 2.0f,
- (NEXT_WIDTH - (2.0f * TRI_WIDTH - TRI_OFFSET)) / 2.0f,
- (double) TRI_HEIGHT,
- BUTTON_START,
- BUTTON_END,
- FALSE);
- _finalize (cr, &cr_surf, &surf, NEXT_X, NEXT_Y);
-
- // draw pause-button drop-shadow
- if(priv->current_state == PLAY)
- {
- if (priv->has_focus && (priv->key_event == TRANSPORT_NADA || priv->key_event == TRANSPORT_PLAY_PAUSE))
- {
- _setup (&cr_surf, &surf, PAUSE_WIDTH+6, PAUSE_HEIGHT+6);
- _mask_pause (cr_surf,
- (PAUSE_WIDTH - (2.0f * BAR_WIDTH + BAR_OFFSET)) / 2.0f,
- (PAUSE_HEIGHT - BAR_HEIGHT) / 2.0f,
- BAR_WIDTH,
- BAR_HEIGHT - 2.0f * BAR_WIDTH,
- BAR_OFFSET);
- _fill (cr_surf,
- (PAUSE_WIDTH - (2.0f * BAR_WIDTH + BAR_OFFSET)) / 2.0f,
- (PAUSE_HEIGHT - BAR_HEIGHT) / 2.0f,
- (PAUSE_WIDTH - (2.0f * BAR_WIDTH + BAR_OFFSET)) / 2.0f,
- (double) BAR_HEIGHT,
- BUTTON_SHADOW_FOCUS,
- BUTTON_SHADOW_FOCUS,
- TRUE);
- _surface_blur (surf, 3);
- _finalize_repaint (cr, &cr_surf, &surf, PAUSE_X, PAUSE_Y + 0.5f, 3);
- }
- else
- {
- _setup (&cr_surf, &surf, PAUSE_WIDTH, PAUSE_HEIGHT);
- _mask_pause (cr_surf,
- (PAUSE_WIDTH - (2.0f * BAR_WIDTH + BAR_OFFSET)) / 2.0f,
- (PAUSE_HEIGHT - BAR_HEIGHT) / 2.0f,
- BAR_WIDTH,
- BAR_HEIGHT - 2.0f * BAR_WIDTH,
- BAR_OFFSET);
- _fill (cr_surf,
- (PAUSE_WIDTH - (2.0f * BAR_WIDTH + BAR_OFFSET)) / 2.0f,
- (PAUSE_HEIGHT - BAR_HEIGHT) / 2.0f,
- (PAUSE_WIDTH - (2.0f * BAR_WIDTH + BAR_OFFSET)) / 2.0f,
- (double) BAR_HEIGHT,
- BUTTON_SHADOW,
- BUTTON_SHADOW,
- TRUE);
- _surface_blur (surf, 1);
- _finalize (cr, &cr_surf, &surf, PAUSE_X, PAUSE_Y + 1.0f);
- }
-
- // draw pause-button
- _setup (&cr_surf, &surf, PAUSE_WIDTH, PAUSE_HEIGHT);
- _mask_pause (cr_surf,
- (PAUSE_WIDTH - (2.0f * BAR_WIDTH + BAR_OFFSET)) / 2.0f,
- (PAUSE_HEIGHT - BAR_HEIGHT) / 2.0f,
- BAR_WIDTH,
- BAR_HEIGHT - 2.0f * BAR_WIDTH,
- BAR_OFFSET);
- _fill (cr_surf,
- (PAUSE_WIDTH - (2.0f * BAR_WIDTH + BAR_OFFSET)) / 2.0f,
- (PAUSE_HEIGHT - BAR_HEIGHT) / 2.0f,
- (PAUSE_WIDTH - (2.0f * BAR_WIDTH + BAR_OFFSET)) / 2.0f,
- (double) BAR_HEIGHT,
- BUTTON_START,
- BUTTON_END,
- TRUE);
- _finalize (cr, &cr_surf, &surf, PAUSE_X, PAUSE_Y);
- }
- else if(priv->current_state == PAUSE)
- {
- if (priv->has_focus && (priv->key_event == TRANSPORT_NADA || priv->key_event == TRANSPORT_PLAY_PAUSE))
- {
- _setup (&cr_surf, &surf, PLAY_WIDTH+6, PLAY_HEIGHT+6);
- _mask_play (cr_surf,
- PLAY_PADDING,
- PLAY_PADDING,
- PLAY_WIDTH - (2*PLAY_PADDING),
- PLAY_HEIGHT - (2*PLAY_PADDING));
- _fill (cr_surf,
- PLAY_PADDING,
- PLAY_PADDING,
- PLAY_WIDTH - (2*PLAY_PADDING),
- PLAY_HEIGHT - (2*PLAY_PADDING),
- BUTTON_SHADOW_FOCUS,
- BUTTON_SHADOW_FOCUS,
- FALSE);
- _surface_blur (surf, 3);
- _finalize_repaint (cr, &cr_surf, &surf, PAUSE_X-0.5f, PAUSE_Y + 0.5f, 3);
- }
- else
- {
- _setup (&cr_surf, &surf, PLAY_WIDTH, PLAY_HEIGHT);
- _mask_play (cr_surf,
- PLAY_PADDING,
- PLAY_PADDING,
- PLAY_WIDTH - (2*PLAY_PADDING),
- PLAY_HEIGHT - (2*PLAY_PADDING));
- _fill (cr_surf,
- PLAY_PADDING,
- PLAY_PADDING,
- PLAY_WIDTH - (2*PLAY_PADDING),
- PLAY_HEIGHT - (2*PLAY_PADDING),
- BUTTON_SHADOW,
- BUTTON_SHADOW,
- FALSE);
- _surface_blur (surf, 1);
- _finalize (cr, &cr_surf, &surf, PAUSE_X-0.75f, PAUSE_Y + 1.0f);
- }
-
- // draw play-button
- _setup (&cr_surf, &surf, PLAY_WIDTH, PLAY_HEIGHT);
- cairo_set_line_width (cr, 10.5);
- cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);
- cairo_set_line_join(cr, CAIRO_LINE_JOIN_ROUND);
- _mask_play (cr_surf,
- PLAY_PADDING,
- PLAY_PADDING,
- PLAY_WIDTH - (2*PLAY_PADDING),
- PLAY_HEIGHT - (2*PLAY_PADDING));
- _fill (cr_surf,
- PLAY_PADDING,
- PLAY_PADDING,
- PLAY_WIDTH - (2*PLAY_PADDING),
- PLAY_HEIGHT - (2*PLAY_PADDING),
- BUTTON_START,
- BUTTON_END,
- FALSE);
- _finalize (cr, &cr_surf, &surf, PAUSE_X-0.5f, PAUSE_Y);
- }
+ g_return_if_fail(IS_TRANSPORT_WIDGET(button));
+ TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE(button);
+
+ cairo_surface_t* surf = NULL;
+ cairo_t* cr_surf = NULL;
+
+ cairo_translate (cr, button->allocation.x, button->allocation.y);
+
+ //g_debug("button x allocation = %i", button->allocation.x);
+ //g_debug("button y allocation = %i", button->allocation.y);
+
+ GtkStyle *style;
+
+ CairoColorRGB bg_color, fg_color, bg_selected, bg_prelight;
+ CairoColorRGB color_middle[2], color_middle_prelight[2], color_outer[2], color_outer_prelight[2],
+ color_play_outer[2], color_play_outer_prelight[2],
+ color_button[4], color_button_shadow, color_inner[2], color_inner_compressed[2];
+
+ style = gtk_widget_get_style (button);
+
+ bg_color.r = style->bg[0].red/65535.0;
+ bg_color.g = style->bg[0].green/65535.0;
+ bg_color.b = style->bg[0].blue/65535.0;
+
+ bg_prelight.r = style->bg[GTK_STATE_PRELIGHT].red/65535.0;
+ bg_prelight.g = style->bg[GTK_STATE_PRELIGHT].green/65535.0;
+ bg_prelight.b = style->bg[GTK_STATE_PRELIGHT].blue/65535.0;
+
+ bg_selected.r = style->bg[GTK_STATE_SELECTED].red/65535.0;
+ bg_selected.g = style->bg[GTK_STATE_SELECTED].green/65535.0;
+ bg_selected.b = style->bg[GTK_STATE_SELECTED].blue/65535.0;
+
+ fg_color.r = style->fg[0].red/65535.0;
+ fg_color.g = style->fg[0].green/65535.0;
+ fg_color.b = style->fg[0].blue/65535.0;
+
+ _color_shade (&bg_color, MIDDLE_START_SHADE, &color_middle[0]);
+ _color_shade (&bg_color, MIDDLE_END_SHADE, &color_middle[1]);
+ _color_shade (&bg_prelight, MIDDLE_START_SHADE, &color_middle_prelight[0]);
+ _color_shade (&bg_prelight, MIDDLE_END_SHADE, &color_middle_prelight[1]);
+ _color_shade (&bg_color, OUTER_START_SHADE, &color_outer[0]);
+ _color_shade (&bg_color, OUTER_END_SHADE, &color_outer[1]);
+ _color_shade (&bg_prelight, OUTER_START_SHADE, &color_outer_prelight[0]);
+ _color_shade (&bg_prelight, OUTER_END_SHADE, &color_outer_prelight[1]);
+ _color_shade (&bg_color, OUTER_PLAY_START_SHADE, &color_play_outer[0]);
+ _color_shade (&bg_color, OUTER_PLAY_END_SHADE, &color_play_outer[1]);
+ _color_shade (&bg_prelight, OUTER_PLAY_START_SHADE, &color_play_outer_prelight[0]);
+ _color_shade (&bg_prelight, OUTER_PLAY_END_SHADE, &color_play_outer_prelight[1]);
+ _color_shade (&bg_color, INNER_START_SHADE, &color_inner[0]);
+ _color_shade (&bg_color, INNER_END_SHADE, &color_inner[1]);
+ _color_shade (&fg_color, BUTTON_START_SHADE, &color_button[0]);
+ _color_shade (&fg_color, BUTTON_END_SHADE, &color_button[1]);
+ _color_shade (&bg_color, BUTTON_SHADOW_SHADE, &color_button[2]);
+ _color_shade (&bg_color, SHADOW_BUTTON_SHADE, &color_button_shadow);
+ _color_shade (&bg_selected, 1.0, &color_button[3]);
+ _color_shade (&bg_color, INNER_COMPRESSED_START_SHADE, &color_inner_compressed[0]);
+ _color_shade (&bg_color, INNER_COMPRESSED_END_SHADE, &color_inner_compressed[1]);
+
+ double MIDDLE_END[] = {color_middle[0].r, color_middle[0].g, color_middle[0].b, 1.0f};
+ double MIDDLE_START[] = {color_middle[1].r, color_middle[1].g, color_middle[1].b, 1.0f};
+ double MIDDLE_END_PRELIGHT[] = {color_middle_prelight[0].r, color_middle_prelight[0].g, color_middle_prelight[0].b, 1.0f};
+ double MIDDLE_START_PRELIGHT[] = {color_middle_prelight[1].r, color_middle_prelight[1].g, color_middle_prelight[1].b, 1.0f};
+ double OUTER_END[] = {color_outer[0].r, color_outer[0].g, color_outer[0].b, 1.0f};
+ double OUTER_START[] = {color_outer[1].r, color_outer[1].g, color_outer[1].b, 1.0f};
+ double OUTER_END_PRELIGHT[] = {color_outer_prelight[0].r, color_outer_prelight[0].g, color_outer_prelight[0].b, 1.0f};
+ double OUTER_START_PRELIGHT[] = {color_outer_prelight[1].r, color_outer_prelight[1].g, color_outer_prelight[1].b, 1.0f};
+ double SHADOW_BUTTON[] = {color_button_shadow.r, color_button_shadow.g, color_button_shadow.b, 0.3f};
+ double OUTER_PLAY_END[] = {color_play_outer[0].r, color_play_outer[0].g, color_play_outer[0].b, 1.0f};
+ double OUTER_PLAY_START[] = {color_play_outer[1].r, color_play_outer[1].g, color_play_outer[1].b, 1.0f};
+ double OUTER_PLAY_END_PRELIGHT[] = {color_play_outer_prelight[0].r, color_play_outer_prelight[0].g, color_play_outer_prelight[0].b, 1.0f};
+ double OUTER_PLAY_START_PRELIGHT[] = {color_play_outer_prelight[1].r, color_play_outer_prelight[1].g, color_play_outer_prelight[1].b, 1.0f};
+ double BUTTON_END[] = {color_button[0].r, color_button[0].g, color_button[0].b, 1.0f};
+ double BUTTON_START[] = {color_button[1].r, color_button[1].g, color_button[1].b, 1.0f};
+ double BUTTON_SHADOW[] = {color_button[2].r, color_button[2].g, color_button[2].b, 0.75f};
+ double BUTTON_SHADOW_FOCUS[] = {color_button[3].r, color_button[3].g, color_button[3].b, 1.0f};
+ double INNER_COMPRESSED_END[] = {color_inner_compressed[1].r, color_inner_compressed[1].g, color_inner_compressed[1].b, 1.0f};
+ double INNER_COMPRESSED_START[] = {color_inner_compressed[0].r, color_inner_compressed[0].g, color_inner_compressed[0].b, 1.0f};
+
+
+ draw_gradient (cr,
+ X,
+ Y,
+ RECT_WIDTH,
+ OUTER_RADIUS,
+ OUTER_START,
+ OUTER_END);
+
+ draw_gradient (cr,
+ X,
+ Y + 1,
+ RECT_WIDTH - 2,
+ MIDDLE_RADIUS,
+ MIDDLE_START,
+ MIDDLE_END);
+
+ draw_gradient (cr,
+ X,
+ Y + 2,
+ RECT_WIDTH - 4,
+ MIDDLE_RADIUS,
+ MIDDLE_START,
+ MIDDLE_END);
+
+ //prev/next button
+ if(priv->current_command == TRANSPORT_PREVIOUS)
+ {
+ draw_gradient (cr,
+ X,
+ Y,
+ RECT_WIDTH/2,
+ OUTER_RADIUS,
+ OUTER_END,
+ OUTER_START);
+
+ draw_gradient (cr,
+ X,
+ Y + 1,
+ RECT_WIDTH/2,
+ MIDDLE_RADIUS,
+ INNER_COMPRESSED_START,
+ INNER_COMPRESSED_END);
+
+ draw_gradient (cr,
+ X,
+ Y + 2,
+ RECT_WIDTH/2,
+ MIDDLE_RADIUS,
+ INNER_COMPRESSED_START,
+ INNER_COMPRESSED_END);
+ }
+ else if(priv->current_command == TRANSPORT_NEXT)
+ {
+ draw_gradient (cr,
+ RECT_WIDTH / 2 + X,
+ Y,
+ RECT_WIDTH/2,
+ OUTER_RADIUS,
+ OUTER_END,
+ OUTER_START);
+
+ draw_gradient (cr,
+ RECT_WIDTH / 2 + X,
+ Y + 1,
+ (RECT_WIDTH - 7)/2,
+ MIDDLE_RADIUS,
+ INNER_COMPRESSED_START,
+ INNER_COMPRESSED_END);
+
+ draw_gradient (cr,
+ RECT_WIDTH / 2 + X,
+ Y + 2,
+ (RECT_WIDTH - 7)/2,
+ MIDDLE_RADIUS,
+ INNER_COMPRESSED_START,
+ INNER_COMPRESSED_END);
+ }
+ else if (priv->motion_event == TRANSPORT_PREVIOUS)
+ {
+ draw_gradient (cr,
+ X,
+ Y,
+ RECT_WIDTH/2,
+ OUTER_RADIUS,
+ OUTER_START_PRELIGHT,
+ OUTER_END_PRELIGHT);
+
+ draw_gradient (cr,
+ X,
+ Y + 1,
+ RECT_WIDTH/2,
+ MIDDLE_RADIUS,
+ MIDDLE_START_PRELIGHT,
+ MIDDLE_END_PRELIGHT);
+
+ draw_gradient (cr,
+ X,
+ Y + 2,
+ RECT_WIDTH/2,
+ MIDDLE_RADIUS,
+ MIDDLE_START_PRELIGHT,
+ MIDDLE_END_PRELIGHT);
+ }
+ else if (priv->motion_event == TRANSPORT_NEXT)
+ {
+ draw_gradient (cr,
+ RECT_WIDTH / 2 + X,
+ Y,
+ RECT_WIDTH/2,
+ OUTER_RADIUS,
+ OUTER_START_PRELIGHT,
+ OUTER_END_PRELIGHT);
+
+ draw_gradient (cr,
+ RECT_WIDTH / 2 + X,
+ Y + 1,
+ (RECT_WIDTH - 7)/2,
+ MIDDLE_RADIUS,
+ MIDDLE_START_PRELIGHT,
+ MIDDLE_END_PRELIGHT);
+
+ draw_gradient (cr,
+ RECT_WIDTH / 2 + X,
+ Y + 2,
+ (RECT_WIDTH - 7)/2,
+ MIDDLE_RADIUS,
+ MIDDLE_START_PRELIGHT,
+ MIDDLE_END_PRELIGHT);
+ }
+
+ // play/pause shadow
+ if(priv->current_command != TRANSPORT_PLAY_PAUSE)
+ {
+ cairo_save (cr);
+ cairo_rectangle (cr, X, Y, RECT_WIDTH, MIDDLE_RADIUS*2);
+ cairo_clip (cr);
+
+ draw_circle (cr,
+ X + RECT_WIDTH / 2.0f - 2.0f * OUTER_RADIUS - 5.5f - 1.0f,
+ Y - ((CIRCLE_RADIUS - OUTER_RADIUS)) - 1.0f,
+ CIRCLE_RADIUS + 1.0f,
+ SHADOW_BUTTON,
+ SHADOW_BUTTON);
+
+ cairo_restore (cr);
+ }
+
+ // play/pause button
+ if(priv->current_command == TRANSPORT_PLAY_PAUSE)
+ {
+ draw_circle (cr,
+ X + RECT_WIDTH / 2.0f - 2.0f * OUTER_RADIUS - 5.5f,
+ Y - ((CIRCLE_RADIUS - OUTER_RADIUS)) ,
+ CIRCLE_RADIUS,
+ OUTER_PLAY_END,
+ OUTER_PLAY_START);
+
+ draw_circle (cr,
+ X + RECT_WIDTH / 2.0f - 2.0f * OUTER_RADIUS - 5.5f + 1.25f,
+ Y - ((CIRCLE_RADIUS - OUTER_RADIUS)) + 1.25f,
+ CIRCLE_RADIUS - 1.25,
+ INNER_COMPRESSED_START,
+ INNER_COMPRESSED_END);
+ }
+ else if (priv->motion_event == TRANSPORT_PLAY_PAUSE)
+ {
+ /* this subtle offset is to fix alpha borders, should be removed once this draw routine will be refactored */
+ draw_circle (cr,
+ X + RECT_WIDTH / 2.0f - 2.0f * OUTER_RADIUS - 5.5f + 0.1,
+ Y - ((CIRCLE_RADIUS - OUTER_RADIUS)) + 0.1,
+ CIRCLE_RADIUS - 0.1,
+ OUTER_PLAY_START_PRELIGHT,
+ OUTER_PLAY_END_PRELIGHT);
+
+ draw_circle (cr,
+ X + RECT_WIDTH / 2.0f - 2.0f * OUTER_RADIUS - 5.5f + 1.25f,
+ Y - ((CIRCLE_RADIUS - OUTER_RADIUS)) + 1.25f,
+ CIRCLE_RADIUS - 1.25,
+ MIDDLE_START_PRELIGHT,
+ MIDDLE_END_PRELIGHT);
+ }
+ else
+ {
+ draw_circle (cr,
+ X + RECT_WIDTH / 2.0f - 2.0f * OUTER_RADIUS - 5.5f,
+ Y - ((CIRCLE_RADIUS - OUTER_RADIUS)),
+ CIRCLE_RADIUS,
+ OUTER_PLAY_START,
+ OUTER_PLAY_END);
+
+ draw_circle (cr,
+ X + RECT_WIDTH / 2.0f - 2.0f * OUTER_RADIUS - 5.5f + 1.25f,
+ Y - ((CIRCLE_RADIUS - OUTER_RADIUS)) + 1.25f,
+ CIRCLE_RADIUS - 1.25,
+ MIDDLE_START,
+ MIDDLE_END);
+ }
+
+ // draw previous-button drop-shadow
+ if (priv->has_focus && priv->key_event == TRANSPORT_PREVIOUS)
+ {
+ _setup (&cr_surf, &surf, PREV_WIDTH+6, PREV_HEIGHT+6);
+ _mask_prev (cr_surf,
+ (PREV_WIDTH - (2.0f * TRI_WIDTH - TRI_OFFSET)) / 2.0f,
+ (PREV_HEIGHT - TRI_HEIGHT) / 2.0f,
+ TRI_WIDTH,
+ TRI_HEIGHT,
+ TRI_OFFSET);
+ _fill (cr_surf,
+ (PREV_WIDTH - (2.0f * TRI_WIDTH - TRI_OFFSET)) / 2.0f,
+ (PREV_HEIGHT - TRI_HEIGHT) / 2.0f,
+ (PREV_WIDTH - (2.0f * TRI_WIDTH - TRI_OFFSET)) / 2.0f,
+ (double) TRI_HEIGHT,
+ BUTTON_SHADOW_FOCUS,
+ BUTTON_SHADOW_FOCUS,
+ FALSE);
+ _surface_blur (surf, 3);
+ _finalize_repaint (cr, &cr_surf, &surf, PREV_X, PREV_Y + 0.5f, 3);
+ }
+ else
+ {
+ _setup (&cr_surf, &surf, PREV_WIDTH, PREV_HEIGHT);
+ _mask_prev (cr_surf,
+ (PREV_WIDTH - (2.0f * TRI_WIDTH - TRI_OFFSET)) / 2.0f,
+ (PREV_HEIGHT - TRI_HEIGHT) / 2.0f,
+ TRI_WIDTH,
+ TRI_HEIGHT,
+ TRI_OFFSET);
+ _fill (cr_surf,
+ (PREV_WIDTH - (2.0f * TRI_WIDTH - TRI_OFFSET)) / 2.0f,
+ (PREV_HEIGHT - TRI_HEIGHT) / 2.0f,
+ (PREV_WIDTH - (2.0f * TRI_WIDTH - TRI_OFFSET)) / 2.0f,
+ (double) TRI_HEIGHT,
+ BUTTON_SHADOW,
+ BUTTON_SHADOW,
+ FALSE);
+ _surface_blur (surf, 1);
+ _finalize (cr, &cr_surf, &surf, PREV_X, PREV_Y + 1.0f);
+ }
+
+ // draw previous-button
+ _setup (&cr_surf, &surf, PREV_WIDTH, PREV_HEIGHT);
+ _mask_prev (cr_surf,
+ (PREV_WIDTH - (2.0f * TRI_WIDTH - TRI_OFFSET)) / 2.0f,
+ (PREV_HEIGHT - TRI_HEIGHT) / 2.0f,
+ TRI_WIDTH,
+ TRI_HEIGHT,
+ TRI_OFFSET);
+ _fill (cr_surf,
+ (PREV_WIDTH - (2.0f * TRI_WIDTH - TRI_OFFSET)) / 2.0f,
+ (PREV_HEIGHT - TRI_HEIGHT) / 2.0f,
+ (PREV_WIDTH - (2.0f * TRI_WIDTH - TRI_OFFSET)) / 2.0f,
+ (double) TRI_HEIGHT,
+ BUTTON_START,
+ BUTTON_END,
+ FALSE);
+ _finalize (cr, &cr_surf, &surf, PREV_X, PREV_Y);
+
+ // draw next-button drop-shadow
+ if (priv->has_focus && priv->key_event == TRANSPORT_NEXT)
+ {
+ _setup (&cr_surf, &surf, NEXT_WIDTH+6, NEXT_HEIGHT+6);
+ _mask_next (cr_surf,
+ (NEXT_WIDTH - (2.0f * TRI_WIDTH - TRI_OFFSET)) / 2.0f,
+ (NEXT_HEIGHT - TRI_HEIGHT) / 2.0f,
+ TRI_WIDTH,
+ TRI_HEIGHT,
+ TRI_OFFSET);
+ _fill (cr_surf,
+ (NEXT_WIDTH - (2.0f * TRI_WIDTH - TRI_OFFSET)) / 2.0f,
+ (NEXT_HEIGHT - TRI_HEIGHT) / 2.0f,
+ (NEXT_WIDTH - (2.0f * TRI_WIDTH - TRI_OFFSET)) / 2.0f,
+ (double) TRI_HEIGHT,
+ BUTTON_SHADOW_FOCUS,
+ BUTTON_SHADOW_FOCUS,
+ FALSE);
+ _surface_blur (surf, 3);
+ _finalize_repaint (cr, &cr_surf, &surf, NEXT_X, NEXT_Y + 0.5f, 3);
+ }
+ else
+ {
+ _setup (&cr_surf, &surf, NEXT_WIDTH, NEXT_HEIGHT);
+ _mask_next (cr_surf,
+ (NEXT_WIDTH - (2.0f * TRI_WIDTH - TRI_OFFSET)) / 2.0f,
+ (NEXT_HEIGHT - TRI_HEIGHT) / 2.0f,
+ TRI_WIDTH,
+ TRI_HEIGHT,
+ TRI_OFFSET);
+ _fill (cr_surf,
+ (NEXT_WIDTH - (2.0f * TRI_WIDTH - TRI_OFFSET)) / 2.0f,
+ (NEXT_HEIGHT - TRI_HEIGHT) / 2.0f,
+ (NEXT_WIDTH - (2.0f * TRI_WIDTH - TRI_OFFSET)) / 2.0f,
+ (double) TRI_HEIGHT,
+ BUTTON_SHADOW,
+ BUTTON_SHADOW,
+ FALSE);
+ _surface_blur (surf, 1);
+ _finalize (cr, &cr_surf, &surf, NEXT_X, NEXT_Y + 1.0f);
+ }
+
+ // draw next-button
+ _setup (&cr_surf, &surf, NEXT_WIDTH, NEXT_HEIGHT);
+ _mask_next (cr_surf,
+ (NEXT_WIDTH - (2.0f * TRI_WIDTH - TRI_OFFSET)) / 2.0f,
+ (NEXT_HEIGHT - TRI_HEIGHT) / 2.0f,
+ TRI_WIDTH,
+ TRI_HEIGHT,
+ TRI_OFFSET);
+ _fill (cr_surf,
+ (NEXT_WIDTH - (2.0f * TRI_WIDTH - TRI_OFFSET)) / 2.0f,
+ (NEXT_HEIGHT - TRI_HEIGHT) / 2.0f,
+ (NEXT_WIDTH - (2.0f * TRI_WIDTH - TRI_OFFSET)) / 2.0f,
+ (double) TRI_HEIGHT,
+ BUTTON_START,
+ BUTTON_END,
+ FALSE);
+ _finalize (cr, &cr_surf, &surf, NEXT_X, NEXT_Y);
+
+ // draw pause-button drop-shadow
+ if(priv->current_state == PLAY)
+ {
+ if (priv->has_focus && (priv->key_event == TRANSPORT_NADA || priv->key_event == TRANSPORT_PLAY_PAUSE))
+ {
+ _setup (&cr_surf, &surf, PAUSE_WIDTH+6, PAUSE_HEIGHT+6);
+ _mask_pause (cr_surf,
+ (PAUSE_WIDTH - (2.0f * BAR_WIDTH + BAR_OFFSET)) / 2.0f,
+ (PAUSE_HEIGHT - BAR_HEIGHT) / 2.0f,
+ BAR_WIDTH,
+ BAR_HEIGHT - 2.0f * BAR_WIDTH,
+ BAR_OFFSET);
+ _fill (cr_surf,
+ (PAUSE_WIDTH - (2.0f * BAR_WIDTH + BAR_OFFSET)) / 2.0f,
+ (PAUSE_HEIGHT - BAR_HEIGHT) / 2.0f,
+ (PAUSE_WIDTH - (2.0f * BAR_WIDTH + BAR_OFFSET)) / 2.0f,
+ (double) BAR_HEIGHT,
+ BUTTON_SHADOW_FOCUS,
+ BUTTON_SHADOW_FOCUS,
+ TRUE);
+ _surface_blur (surf, 3);
+ _finalize_repaint (cr, &cr_surf, &surf, PAUSE_X, PAUSE_Y + 0.5f, 3);
+ }
+ else
+ {
+ _setup (&cr_surf, &surf, PAUSE_WIDTH, PAUSE_HEIGHT);
+ _mask_pause (cr_surf,
+ (PAUSE_WIDTH - (2.0f * BAR_WIDTH + BAR_OFFSET)) / 2.0f,
+ (PAUSE_HEIGHT - BAR_HEIGHT) / 2.0f,
+ BAR_WIDTH,
+ BAR_HEIGHT - 2.0f * BAR_WIDTH,
+ BAR_OFFSET);
+ _fill (cr_surf,
+ (PAUSE_WIDTH - (2.0f * BAR_WIDTH + BAR_OFFSET)) / 2.0f,
+ (PAUSE_HEIGHT - BAR_HEIGHT) / 2.0f,
+ (PAUSE_WIDTH - (2.0f * BAR_WIDTH + BAR_OFFSET)) / 2.0f,
+ (double) BAR_HEIGHT,
+ BUTTON_SHADOW,
+ BUTTON_SHADOW,
+ TRUE);
+ _surface_blur (surf, 1);
+ _finalize (cr, &cr_surf, &surf, PAUSE_X, PAUSE_Y + 1.0f);
+ }
+
+ // draw pause-button
+ _setup (&cr_surf, &surf, PAUSE_WIDTH, PAUSE_HEIGHT);
+ _mask_pause (cr_surf,
+ (PAUSE_WIDTH - (2.0f * BAR_WIDTH + BAR_OFFSET)) / 2.0f,
+ (PAUSE_HEIGHT - BAR_HEIGHT) / 2.0f,
+ BAR_WIDTH,
+ BAR_HEIGHT - 2.0f * BAR_WIDTH,
+ BAR_OFFSET);
+ _fill (cr_surf,
+ (PAUSE_WIDTH - (2.0f * BAR_WIDTH + BAR_OFFSET)) / 2.0f,
+ (PAUSE_HEIGHT - BAR_HEIGHT) / 2.0f,
+ (PAUSE_WIDTH - (2.0f * BAR_WIDTH + BAR_OFFSET)) / 2.0f,
+ (double) BAR_HEIGHT,
+ BUTTON_START,
+ BUTTON_END,
+ TRUE);
+ _finalize (cr, &cr_surf, &surf, PAUSE_X, PAUSE_Y);
+ }
+ else if(priv->current_state == PAUSE)
+ {
+ if (priv->has_focus && (priv->key_event == TRANSPORT_NADA || priv->key_event == TRANSPORT_PLAY_PAUSE))
+ {
+ _setup (&cr_surf, &surf, PLAY_WIDTH+6, PLAY_HEIGHT+6);
+ _mask_play (cr_surf,
+ PLAY_PADDING,
+ PLAY_PADDING,
+ PLAY_WIDTH - (2*PLAY_PADDING),
+ PLAY_HEIGHT - (2*PLAY_PADDING));
+ _fill (cr_surf,
+ PLAY_PADDING,
+ PLAY_PADDING,
+ PLAY_WIDTH - (2*PLAY_PADDING),
+ PLAY_HEIGHT - (2*PLAY_PADDING),
+ BUTTON_SHADOW_FOCUS,
+ BUTTON_SHADOW_FOCUS,
+ FALSE);
+ _surface_blur (surf, 3);
+ _finalize_repaint (cr, &cr_surf, &surf, PAUSE_X-0.5f, PAUSE_Y + 0.5f, 3);
+ }
+ else
+ {
+ _setup (&cr_surf, &surf, PLAY_WIDTH, PLAY_HEIGHT);
+ _mask_play (cr_surf,
+ PLAY_PADDING,
+ PLAY_PADDING,
+ PLAY_WIDTH - (2*PLAY_PADDING),
+ PLAY_HEIGHT - (2*PLAY_PADDING));
+ _fill (cr_surf,
+ PLAY_PADDING,
+ PLAY_PADDING,
+ PLAY_WIDTH - (2*PLAY_PADDING),
+ PLAY_HEIGHT - (2*PLAY_PADDING),
+ BUTTON_SHADOW,
+ BUTTON_SHADOW,
+ FALSE);
+ _surface_blur (surf, 1);
+ _finalize (cr, &cr_surf, &surf, PAUSE_X-0.75f, PAUSE_Y + 1.0f);
+ }
+
+ // draw play-button
+ _setup (&cr_surf, &surf, PLAY_WIDTH, PLAY_HEIGHT);
+ cairo_set_line_width (cr, 10.5);
+ cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);
+ cairo_set_line_join(cr, CAIRO_LINE_JOIN_ROUND);
+ _mask_play (cr_surf,
+ PLAY_PADDING,
+ PLAY_PADDING,
+ PLAY_WIDTH - (2*PLAY_PADDING),
+ PLAY_HEIGHT - (2*PLAY_PADDING));
+ _fill (cr_surf,
+ PLAY_PADDING,
+ PLAY_PADDING,
+ PLAY_WIDTH - (2*PLAY_PADDING),
+ PLAY_HEIGHT - (2*PLAY_PADDING),
+ BUTTON_START,
+ BUTTON_END,
+ FALSE);
+ _finalize (cr, &cr_surf, &surf, PAUSE_X-0.5f, PAUSE_Y);
+ }
}
static void
transport_widget_set_twin_item(TransportWidget* self,
- DbusmenuMenuitem* twin_item)
+ DbusmenuMenuitem* twin_item)
{
TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE(self);
priv->twin_item = twin_item;
g_signal_connect(G_OBJECT(priv->twin_item), "property-changed",
G_CALLBACK(transport_widget_property_update), self);
- gint initial_state = dbusmenu_menuitem_property_get_int( twin_item,
+ gint initial_state = dbusmenu_menuitem_property_get_int( twin_item,
DBUSMENU_TRANSPORT_MENUITEM_PLAY_STATE );
//g_debug("TRANSPORT WIDGET - INITIAL UPDATE = %i", initial_state);
- transport_widget_toggle_play_pause( self,
- (TransportWidgetState)initial_state);
+ transport_widget_toggle_play_pause( self,
+ (TransportWidgetState)initial_state);
}
/**
@@ -1700,16 +1700,16 @@ static void
transport_widget_property_update(DbusmenuMenuitem* item, gchar* property,
GValue* value, gpointer userdata)
{
- //g_debug("transport_widget_update_state - with property %s", property);
- TransportWidget* bar = (TransportWidget*)userdata;
- g_return_if_fail(IS_TRANSPORT_WIDGET(bar));
-
- if(g_ascii_strcasecmp(DBUSMENU_TRANSPORT_MENUITEM_PLAY_STATE, property) == 0)
- {
- int update_value = g_value_get_int(value);
- //g_debug("transport_widget_update_state - with value %i", update_value);
- transport_widget_toggle_play_pause(bar, (TransportWidgetState)update_value);
- }
+ //g_debug("transport_widget_update_state - with property %s", property);
+ TransportWidget* bar = (TransportWidget*)userdata;
+ g_return_if_fail(IS_TRANSPORT_WIDGET(bar));
+
+ if(g_ascii_strcasecmp(DBUSMENU_TRANSPORT_MENUITEM_PLAY_STATE, property) == 0)
+ {
+ int update_value = g_value_get_int(value);
+ //g_debug("transport_widget_update_state - with value %i", update_value);
+ transport_widget_toggle_play_pause(bar, (TransportWidgetState)update_value);
+ }
}
@@ -1719,10 +1719,10 @@ transport_widget_property_update(DbusmenuMenuitem* item, gchar* property,
**/
GtkWidget*
transport_widget_new ( DbusmenuMenuitem *item )
-{
- GtkWidget* widget = g_object_new(TRANSPORT_WIDGET_TYPE, NULL);
- gtk_widget_set_app_paintable (widget, TRUE);
- transport_widget_set_twin_item((TransportWidget*)widget, item);
- return widget;
+{
+ GtkWidget* widget = g_object_new(TRANSPORT_WIDGET_TYPE, NULL);
+ gtk_widget_set_app_paintable (widget, TRUE);
+ transport_widget_set_twin_item((TransportWidget*)widget, item);
+ return widget;
}
diff --git a/src/transport-widget.h b/src/transport-widget.h
index 70ce6aa..d02f59b 100644
--- a/src/transport-widget.h
+++ b/src/transport-widget.h
@@ -36,30 +36,30 @@ typedef struct _TransportWidget TransportWidget;
typedef struct _TransportWidgetClass TransportWidgetClass;
typedef enum {
- TRANSPORT_PREVIOUS,
- TRANSPORT_PLAY_PAUSE,
- TRANSPORT_NEXT,
- TRANSPORT_NADA
+ TRANSPORT_PREVIOUS,
+ TRANSPORT_PLAY_PAUSE,
+ TRANSPORT_NEXT,
+ TRANSPORT_NADA
}TransportWidgetEvent;
typedef enum {
- PLAY,
- PAUSE
+ PLAY,
+ PAUSE
}TransportWidgetState;
struct _TransportWidgetClass {
- GtkMenuItemClass parent_class;
+ GtkMenuItemClass parent_class;
};
struct _TransportWidget {
- GtkMenuItem parent;
+ GtkMenuItem parent;
};
typedef struct
{
- double r;
- double g;
- double b;
+ double r;
+ double g;
+ double b;
} CairoColorRGB;
diff --git a/src/volume-widget.c b/src/volume-widget.c
index 6964741..c37f9c7 100644
--- a/src/volume-widget.c
+++ b/src/volume-widget.c
@@ -33,9 +33,9 @@ typedef struct _VolumeWidgetPrivate VolumeWidgetPrivate;
struct _VolumeWidgetPrivate
{
- DbusmenuMenuitem* twin_item;
- GtkWidget* ido_volume_slider;
- gboolean grabbed;
+ DbusmenuMenuitem* twin_item;
+ GtkWidget* ido_volume_slider;
+ gboolean grabbed;
};
#define VOLUME_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), VOLUME_WIDGET_TYPE, VolumeWidgetPrivate))
@@ -46,14 +46,14 @@ static void volume_widget_init (VolumeWidget *self);
static void volume_widget_dispose (GObject *object);
static void volume_widget_finalize (GObject *object);
static void volume_widget_set_twin_item( VolumeWidget* self,
- DbusmenuMenuitem* twin_item);
+ DbusmenuMenuitem* twin_item);
static void volume_widget_property_update( DbusmenuMenuitem* item, gchar* property,
- GValue* value, gpointer userdata);
+ GValue* value, gpointer userdata);
static gboolean volume_widget_change_value_cb (GtkRange *range,
- GtkScrollType scroll,
- gdouble value,
- gpointer user_data);
+ GtkScrollType scroll,
+ gdouble value,
+ gpointer user_data);
static gboolean volume_widget_value_changed_cb(GtkRange *range, gpointer user_data);
static void volume_widget_slider_grabbed(GtkWidget *widget, gpointer user_data);
static void volume_widget_slider_released(GtkWidget *widget, gpointer user_data);
@@ -65,33 +65,33 @@ G_DEFINE_TYPE (VolumeWidget, volume_widget, G_TYPE_OBJECT);
static void
volume_widget_class_init (VolumeWidgetClass *klass)
{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- g_type_class_add_private (klass, sizeof (VolumeWidgetPrivate));
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (VolumeWidgetPrivate));
- gobject_class->dispose = volume_widget_dispose;
- gobject_class->finalize = volume_widget_finalize;
+ gobject_class->dispose = volume_widget_dispose;
+ gobject_class->finalize = volume_widget_finalize;
}
static void
volume_widget_init (VolumeWidget *self)
{
- //g_debug("VolumeWidget::volume_widget_init");
- VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(self);
+ //g_debug("VolumeWidget::volume_widget_init");
+ VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(self);
priv->ido_volume_slider = ido_scale_menu_item_new_with_range ("VOLUME", IDO_RANGE_STYLE_DEFAULT, 0, 0, 100, 1);
- g_object_ref (priv->ido_volume_slider);
- ido_scale_menu_item_set_style (IDO_SCALE_MENU_ITEM (priv->ido_volume_slider), IDO_SCALE_MENU_ITEM_STYLE_IMAGE);
+ g_object_ref (priv->ido_volume_slider);
+ ido_scale_menu_item_set_style (IDO_SCALE_MENU_ITEM (priv->ido_volume_slider), IDO_SCALE_MENU_ITEM_STYLE_IMAGE);
g_object_set(priv->ido_volume_slider, "reverse-scroll-events", TRUE, NULL);
g_signal_connect (priv->ido_volume_slider,
"notify::parent", G_CALLBACK (volume_widget_parent_changed),
NULL);
-
- GtkWidget* volume_widget = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider);
-
- g_signal_connect(volume_widget, "change-value", G_CALLBACK(volume_widget_change_value_cb), self);
- g_signal_connect(volume_widget, "value-changed", G_CALLBACK(volume_widget_value_changed_cb), self);
+
+ GtkWidget* volume_widget = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider);
+
+ g_signal_connect(volume_widget, "change-value", G_CALLBACK(volume_widget_change_value_cb), self);
+ g_signal_connect(volume_widget, "value-changed", G_CALLBACK(volume_widget_value_changed_cb), self);
g_signal_connect(priv->ido_volume_slider, "slider-grabbed", G_CALLBACK(volume_widget_slider_grabbed), self);
g_signal_connect(priv->ido_volume_slider, "slider-released", G_CALLBACK(volume_widget_slider_released), self);
@@ -112,64 +112,64 @@ volume_widget_init (VolumeWidget *self)
static void
volume_widget_dispose (GObject *object)
{
- G_OBJECT_CLASS (volume_widget_parent_class)->dispose (object);
+ G_OBJECT_CLASS (volume_widget_parent_class)->dispose (object);
}
static void
volume_widget_finalize (GObject *object)
{
- G_OBJECT_CLASS (volume_widget_parent_class)->finalize (object);
+ G_OBJECT_CLASS (volume_widget_parent_class)->finalize (object);
}
static void
volume_widget_property_update(DbusmenuMenuitem* item, gchar* property,
GValue* value, gpointer userdata)
-{
- g_return_if_fail (IS_VOLUME_WIDGET (userdata));
- VolumeWidget* mitem = VOLUME_WIDGET(userdata);
- VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(mitem);
- //g_debug("scrub-widget::property_update for prop %s", property);
- if(g_ascii_strcasecmp(DBUSMENU_VOLUME_MENUITEM_LEVEL, property) == 0){
- if(priv->grabbed == FALSE){
- GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider);
- GtkRange *range = (GtkRange*)slider;
- gdouble update = g_value_get_double (value);
- //g_debug("volume-widget - update level with value %f", update);
- gtk_range_set_value(range, update);
- determine_state_from_volume(update);
- }
- }
+{
+ g_return_if_fail (IS_VOLUME_WIDGET (userdata));
+ VolumeWidget* mitem = VOLUME_WIDGET(userdata);
+ VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(mitem);
+ //g_debug("scrub-widget::property_update for prop %s", property);
+ if(g_ascii_strcasecmp(DBUSMENU_VOLUME_MENUITEM_LEVEL, property) == 0){
+ if(priv->grabbed == FALSE){
+ GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider);
+ GtkRange *range = (GtkRange*)slider;
+ gdouble update = g_value_get_double (value);
+ //g_debug("volume-widget - update level with value %f", update);
+ gtk_range_set_value(range, update);
+ determine_state_from_volume(update);
+ }
+ }
}
static void
volume_widget_set_twin_item(VolumeWidget* self,
DbusmenuMenuitem* twin_item)
{
- VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(self);
- priv->twin_item = twin_item;
- g_object_ref(priv->twin_item);
- g_signal_connect(G_OBJECT(twin_item), "property-changed",
- G_CALLBACK(volume_widget_property_update), self);
- gdouble initial_level = g_value_get_double (dbusmenu_menuitem_property_get_value(twin_item,
- DBUSMENU_VOLUME_MENUITEM_LEVEL));
- //g_debug("volume_widget_set_twin_item initial level = %f", initial_level);
+ VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(self);
+ priv->twin_item = twin_item;
+ g_object_ref(priv->twin_item);
+ g_signal_connect(G_OBJECT(twin_item), "property-changed",
+ G_CALLBACK(volume_widget_property_update), self);
+ gdouble initial_level = g_value_get_double (dbusmenu_menuitem_property_get_value(twin_item,
+ DBUSMENU_VOLUME_MENUITEM_LEVEL));
+ //g_debug("volume_widget_set_twin_item initial level = %f", initial_level);
GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider);
GtkRange *range = (GtkRange*)slider;
- gtk_range_set_value(range, initial_level);
- determine_state_from_volume(initial_level);
+ gtk_range_set_value(range, initial_level);
+ determine_state_from_volume(initial_level);
}
static gboolean
volume_widget_change_value_cb (GtkRange *range,
- GtkScrollType scroll,
- gdouble new_value,
- gpointer user_data)
+ GtkScrollType scroll,
+ gdouble new_value,
+ gpointer user_data)
{
- g_return_val_if_fail (IS_VOLUME_WIDGET (user_data), FALSE);
- VolumeWidget* mitem = VOLUME_WIDGET(user_data);
- volume_widget_update(mitem, new_value);
+ g_return_val_if_fail (IS_VOLUME_WIDGET (user_data), FALSE);
+ VolumeWidget* mitem = VOLUME_WIDGET(user_data);
+ volume_widget_update(mitem, new_value);
determine_state_from_volume(new_value);
- return FALSE;
+ return FALSE;
}
/*
@@ -179,25 +179,25 @@ volume_widget_change_value_cb (GtkRange *range,
static gboolean
volume_widget_value_changed_cb(GtkRange *range, gpointer user_data)
{
- g_return_val_if_fail (IS_VOLUME_WIDGET (user_data), FALSE);
- VolumeWidget* mitem = VOLUME_WIDGET(user_data);
- VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(mitem);
- GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider);
+ g_return_val_if_fail (IS_VOLUME_WIDGET (user_data), FALSE);
+ VolumeWidget* mitem = VOLUME_WIDGET(user_data);
+ VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(mitem);
+ GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider);
gdouble current_value = CLAMP(gtk_range_get_value(GTK_RANGE(slider)), 0, 100);
-
- if(current_value == 0 || current_value == 100){
- volume_widget_update(mitem, current_value);
- }
+
+ if(current_value == 0 || current_value == 100){
+ volume_widget_update(mitem, current_value);
+ }
return FALSE;
}
void
volume_widget_update(VolumeWidget* self, gdouble update)
{
- VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(self);
- GValue value = {0};
+ VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(self);
+ GValue value = {0};
g_value_init(&value, G_TYPE_DOUBLE);
- gdouble clamped = CLAMP(update, 0, 100);
+ gdouble clamped = CLAMP(update, 0, 100);
g_value_set_double(&value, clamped);
dbusmenu_menuitem_handle_event (priv->twin_item, "update", &value, 0);
}
@@ -205,13 +205,13 @@ volume_widget_update(VolumeWidget* self, gdouble update)
GtkWidget*
volume_widget_get_ido_slider(VolumeWidget* self)
{
- VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(self);
- return priv->ido_volume_slider;
+ VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(self);
+ return priv->ido_volume_slider;
}
static void
volume_widget_parent_changed (GtkWidget *widget,
- gpointer user_data)
+ gpointer user_data)
{
gtk_widget_set_size_request (widget, 200, -1);
//g_debug("volume_widget_parent_changed");
@@ -220,24 +220,24 @@ volume_widget_parent_changed (GtkWidget *widget,
static void
volume_widget_slider_grabbed(GtkWidget *widget, gpointer user_data)
{
- VolumeWidget* mitem = VOLUME_WIDGET(user_data);
- VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(mitem);
- priv->grabbed = TRUE;
+ VolumeWidget* mitem = VOLUME_WIDGET(user_data);
+ VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(mitem);
+ priv->grabbed = TRUE;
}
static void
volume_widget_slider_released(GtkWidget *widget, gpointer user_data)
{
- VolumeWidget* mitem = VOLUME_WIDGET(user_data);
- VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(mitem);
- priv->grabbed = FALSE;
+ VolumeWidget* mitem = VOLUME_WIDGET(user_data);
+ VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(mitem);
+ priv->grabbed = FALSE;
}
void
volume_widget_tidy_up (GtkWidget *widget)
{
VolumeWidget* mitem = VOLUME_WIDGET(widget);
- VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(mitem);
+ VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(mitem);
gtk_widget_destroy (priv->ido_volume_slider);
}
@@ -245,9 +245,9 @@ gdouble
volume_widget_get_current_volume ( GtkWidget *widget )
{
VolumeWidget* mitem = VOLUME_WIDGET(widget);
- VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(mitem);
+ VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(mitem);
gdouble vol = g_value_get_double ( dbusmenu_menuitem_property_get_value( priv->twin_item,
- DBUSMENU_VOLUME_MENUITEM_LEVEL));
+ DBUSMENU_VOLUME_MENUITEM_LEVEL));
return vol;
}
@@ -258,9 +258,9 @@ volume_widget_get_current_volume ( GtkWidget *widget )
GtkWidget*
volume_widget_new(DbusmenuMenuitem *item)
{
- GtkWidget* widget = g_object_new(VOLUME_WIDGET_TYPE, NULL);
- volume_widget_set_twin_item((VolumeWidget*)widget, item);
- return widget;
+ GtkWidget* widget = g_object_new(VOLUME_WIDGET_TYPE, NULL);
+ volume_widget_set_twin_item((VolumeWidget*)widget, item);
+ return widget;
}
diff --git a/src/volume-widget.h b/src/volume-widget.h
index 202bbb3..072cfde 100644
--- a/src/volume-widget.h
+++ b/src/volume-widget.h
@@ -32,15 +32,15 @@ G_BEGIN_DECLS
#define IS_VOLUME_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VOLUME_WIDGET_TYPE))
#define VOLUME_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VOLUME_WIDGET_TYPE, VolumeWidgetClass))
-typedef struct _VolumeWidget VolumeWidget;
-typedef struct _VolumeWidgetClass VolumeWidgetClass;
+typedef struct _VolumeWidget VolumeWidget;
+typedef struct _VolumeWidgetClass VolumeWidgetClass;
struct _VolumeWidgetClass {
GObjectClass parent_class;
};
struct _VolumeWidget {
- GObject parent;
+ GObject parent;
};
GType volume_widget_get_type (void) G_GNUC_CONST;
diff --git a/tests/Makefile.in b/tests/Makefile.in
index c82797d..89390f2 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -187,10 +187,12 @@ GCONF_LIBS = @GCONF_LIBS@
GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@
GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@
GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
+GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
GNOMELOCALEDIR = @GNOMELOCALEDIR@
GREP = @GREP@
+GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@
INDICATORDIR = @INDICATORDIR@
INDICATORICONSDIR = @INDICATORICONSDIR@
INSTALL = @INSTALL@
@@ -277,6 +279,7 @@ datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
+gsettingsschemadir = @gsettingsschemadir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@