diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.in | 1081 | ||||
-rw-r--r-- | src/familiar-players-db.c | 533 | ||||
-rw-r--r-- | src/fetch-file.c | 480 | ||||
-rw-r--r-- | src/metadata-menu-item.c | 502 | ||||
-rw-r--r-- | src/mpris2-controller.c | 4971 | ||||
-rw-r--r-- | src/music-player-bridge.c | 543 | ||||
-rw-r--r-- | src/music-player-bridge.h | 426 | ||||
-rw-r--r-- | src/player-controller.c | 673 | ||||
-rw-r--r-- | src/player-item.c | 475 | ||||
-rw-r--r-- | src/scrub-menu-item.vala | 56 | ||||
-rw-r--r-- | src/scrub-widget.c | 376 | ||||
-rw-r--r-- | src/scrub-widget.h | 53 | ||||
-rw-r--r-- | src/sound-service-client.h | 102 | ||||
-rw-r--r-- | src/sound-service-server.h | 122 | ||||
-rw-r--r-- | src/title-menu-item.c | 210 | ||||
-rw-r--r-- | src/transport-menu-item.c | 239 |
16 files changed, 10357 insertions, 485 deletions
diff --git a/src/Makefile.in b/src/Makefile.in new file mode 100644 index 0000000..088cefe --- /dev/null +++ b/src/Makefile.in @@ -0,0 +1,1081 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +libexec_PROGRAMS = indicator-sound-service$(EXEEXT) +subdir = src +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +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)$(soundmenulibdir)" \ + "$(DESTDIR)$(libexecdir)" +LTLIBRARIES = $(soundmenulib_LTLIBRARIES) +am__DEPENDENCIES_1 = +libsoundmenu_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_libsoundmenu_la_OBJECTS = libsoundmenu_la-transport-widget.lo \ + libsoundmenu_la-metadata-widget.lo \ + libsoundmenu_la-indicator-sound.lo \ + libsoundmenu_la-title-widget.lo \ + libsoundmenu_la-volume-widget.lo +libsoundmenu_la_OBJECTS = $(am_libsoundmenu_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +libsoundmenu_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(libsoundmenu_la_CFLAGS) $(CFLAGS) $(libsoundmenu_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +PROGRAMS = $(libexec_PROGRAMS) +am__objects_1 = indicator_sound_service-music-player-bridge.$(OBJEXT) \ + indicator_sound_service-transport-menu-item.$(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-controller.$(OBJEXT) \ + indicator_sound_service-player-item.$(OBJEXT) \ + indicator_sound_service-familiar-players-db.$(OBJEXT) \ + indicator_sound_service-fetch-file.$(OBJEXT) +am_indicator_sound_service_OBJECTS = \ + indicator_sound_service-sound-service.$(OBJEXT) \ + indicator_sound_service-dbus-menu-manager.$(OBJEXT) \ + indicator_sound_service-pulse-manager.$(OBJEXT) \ + indicator_sound_service-sound-service-dbus.$(OBJEXT) \ + indicator_sound_service-slider-menu-item.$(OBJEXT) \ + $(am__objects_1) +indicator_sound_service_OBJECTS = \ + $(am_indicator_sound_service_OBJECTS) +indicator_sound_service_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +indicator_sound_service_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(indicator_sound_service_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(libsoundmenu_la_SOURCES) \ + $(indicator_sound_service_SOURCES) +DIST_SOURCES = $(libsoundmenu_la_SOURCES) \ + $(indicator_sound_service_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +APPLET_CFLAGS = @APPLET_CFLAGS@ +APPLET_LIBS = @APPLET_LIBS@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DBUSSERVICEDIR = @DBUSSERVICEDIR@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GCONFTOOL = @GCONFTOOL@ +GCONF_CFLAGS = @GCONF_CFLAGS@ +GCONF_LIBS = @GCONF_LIBS@ +GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ +GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOMELOCALEDIR = @GNOMELOCALEDIR@ +GREP = @GREP@ +INDICATORDIR = @INDICATORDIR@ +INDICATORICONSDIR = @INDICATORICONSDIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POFILES = @POFILES@ +POSUB = @POSUB@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +PULSEAUDIO_CFLAGS = @PULSEAUDIO_CFLAGS@ +PULSEAUDIO_LIBS = @PULSEAUDIO_LIBS@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOUNDERVICE_LIBS = @SOUNDERVICE_LIBS@ +SOUNDSERVICE_CFLAGS = @SOUNDSERVICE_CFLAGS@ +SOUNDSERVICE_LIBS = @SOUNDSERVICE_LIBS@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VALAC = @VALAC@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ + +################### +# Indicator Stuff +################### +soundmenulibdir = $(INDICATORDIR) +soundmenulib_LTLIBRARIES = libsoundmenu.la +libsoundmenu_la_SOURCES = \ + common-defs.h \ + indicator-sound.h \ + transport-widget.c \ + transport-widget.h \ + metadata-widget.c \ + metadata-widget.h \ + indicator-sound.c \ + title-widget.c \ + title-widget.h \ + volume-widget.c \ + volume-widget.h \ + dbus-shared-names.h \ + sound-service-client.h + +libsoundmenu_la_CFLAGS = $(APPLET_CFLAGS) -Wall -DG_LOG_DOMAIN=\"Indicator-Sound\" +libsoundmenu_la_LIBADD = $(APPLET_LIBS) +libsoundmenu_la_LDFLAGS = -module -avoid-version + +##################### +# libsoundmenu vala +##################### +music_bridge_VALASOURCES = \ + music-player-bridge.vala \ + transport-menu-item.vala \ + metadata-menu-item.vala \ + title-menu-item.vala \ + player-controller.vala \ + mpris2-controller.vala \ + player-item.vala \ + familiar-players-db.vala \ + fetch-file.vala + +music_bridge_VALAFLAGS = \ + --ccode \ + --disable-dbus-transformation \ + -H music-player-bridge.h -d . \ + --vapidir=$(top_srcdir)/vapi/ \ + --vapidir=./ \ + --thread \ + --pkg gee-1.0 \ + --pkg Indicate-0.2 \ + --pkg Dbusmenu-Glib-0.2 \ + --pkg common-defs \ + --pkg dbus-glib-1 \ + --pkg gio-unix-2.0 \ + --pkg gdk-pixbuf-2.0 + +music_bridge_APIFILES = \ + music-player-bridge.h + + +############################### +# libsoundmenu C +############################### +indicator_sound_service_SOURCES = \ + common-defs.h \ + sound-service.h \ + sound-service.c \ + dbus-menu-manager.c \ + dbus-menu-manager.h \ + pulse-manager.h \ + pulse-manager.c \ + sound-service-dbus.h \ + sound-service-dbus.c \ + sound-service-server.h \ + slider-menu-item.h \ + slider-menu-item.c \ + $(music_bridge_VALASOURCES:.vala=.c) + +indicator_sound_service_CFLAGS = $(PULSEAUDIO_CFLAGS) $(SOUNDSERVICE_CFLAGS) $(GCONF_CFLAGS) -DLIBEXECDIR=\"$(libexecdir)\" -Wall +indicator_sound_service_LDADD = $(PULSEAUDIO_LIBS) $(SOUNDSERVICE_LIBS) $(GCONF_LIBS) + +######################### +# Extra stuff to package +######################### +EXTRA_DIST = \ + sound-service.xml \ + sound-service.list \ + $(music_bridge_APIFILES) \ + $(music_bridge_VALASOURCES) + + +####################### +# Stuff to clean Stuff +####################### +BUILT_SOURCES = \ + music_bridge_vala.stamp \ + sound-service-client.h \ + sound-service-server.h \ + $(music_bridge_APIFILES) \ + $(music_bridge_VALASOURCES:.vala=.c) + +CLEANFILES = \ + $(BUILT_SOURCES) + +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-soundmenulibLTLIBRARIES: $(soundmenulib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(soundmenulibdir)" || $(MKDIR_P) "$(DESTDIR)$(soundmenulibdir)" + @list='$(soundmenulib_LTLIBRARIES)'; test -n "$(soundmenulibdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(soundmenulibdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(soundmenulibdir)"; \ + } + +uninstall-soundmenulibLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(soundmenulib_LTLIBRARIES)'; test -n "$(soundmenulibdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(soundmenulibdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(soundmenulibdir)/$$f"; \ + done + +clean-soundmenulibLTLIBRARIES: + -test -z "$(soundmenulib_LTLIBRARIES)" || rm -f $(soundmenulib_LTLIBRARIES) + @list='$(soundmenulib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libsoundmenu.la: $(libsoundmenu_la_OBJECTS) $(libsoundmenu_la_DEPENDENCIES) + $(AM_V_CCLD)$(libsoundmenu_la_LINK) -rpath $(soundmenulibdir) $(libsoundmenu_la_OBJECTS) $(libsoundmenu_la_LIBADD) $(LIBS) +install-libexecPROGRAMS: $(libexec_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(libexecdir)" || $(MKDIR_P) "$(DESTDIR)$(libexecdir)" + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(libexecdir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(libexecdir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-libexecPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(libexecdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(libexecdir)" && rm -f $$files + +clean-libexecPROGRAMS: + @list='$(libexec_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +indicator-sound-service$(EXEEXT): $(indicator_sound_service_OBJECTS) $(indicator_sound_service_DEPENDENCIES) + @rm -f indicator-sound-service$(EXEEXT) + $(AM_V_CCLD)$(indicator_sound_service_LINK) $(indicator_sound_service_OBJECTS) $(indicator_sound_service_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +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-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-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@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_sound_service-title-menu-item.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_sound_service-transport-menu-item.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsoundmenu_la-indicator-sound.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsoundmenu_la-metadata-widget.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsoundmenu_la-title-widget.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsoundmenu_la-transport-widget.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsoundmenu_la-volume-widget.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +libsoundmenu_la-transport-widget.lo: transport-widget.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsoundmenu_la_CFLAGS) $(CFLAGS) -MT libsoundmenu_la-transport-widget.lo -MD -MP -MF $(DEPDIR)/libsoundmenu_la-transport-widget.Tpo -c -o libsoundmenu_la-transport-widget.lo `test -f 'transport-widget.c' || echo '$(srcdir)/'`transport-widget.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsoundmenu_la-transport-widget.Tpo $(DEPDIR)/libsoundmenu_la-transport-widget.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='transport-widget.c' object='libsoundmenu_la-transport-widget.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsoundmenu_la_CFLAGS) $(CFLAGS) -c -o libsoundmenu_la-transport-widget.lo `test -f 'transport-widget.c' || echo '$(srcdir)/'`transport-widget.c + +libsoundmenu_la-metadata-widget.lo: metadata-widget.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsoundmenu_la_CFLAGS) $(CFLAGS) -MT libsoundmenu_la-metadata-widget.lo -MD -MP -MF $(DEPDIR)/libsoundmenu_la-metadata-widget.Tpo -c -o libsoundmenu_la-metadata-widget.lo `test -f 'metadata-widget.c' || echo '$(srcdir)/'`metadata-widget.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsoundmenu_la-metadata-widget.Tpo $(DEPDIR)/libsoundmenu_la-metadata-widget.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='metadata-widget.c' object='libsoundmenu_la-metadata-widget.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsoundmenu_la_CFLAGS) $(CFLAGS) -c -o libsoundmenu_la-metadata-widget.lo `test -f 'metadata-widget.c' || echo '$(srcdir)/'`metadata-widget.c + +libsoundmenu_la-indicator-sound.lo: indicator-sound.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsoundmenu_la_CFLAGS) $(CFLAGS) -MT libsoundmenu_la-indicator-sound.lo -MD -MP -MF $(DEPDIR)/libsoundmenu_la-indicator-sound.Tpo -c -o libsoundmenu_la-indicator-sound.lo `test -f 'indicator-sound.c' || echo '$(srcdir)/'`indicator-sound.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsoundmenu_la-indicator-sound.Tpo $(DEPDIR)/libsoundmenu_la-indicator-sound.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='indicator-sound.c' object='libsoundmenu_la-indicator-sound.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsoundmenu_la_CFLAGS) $(CFLAGS) -c -o libsoundmenu_la-indicator-sound.lo `test -f 'indicator-sound.c' || echo '$(srcdir)/'`indicator-sound.c + +libsoundmenu_la-title-widget.lo: title-widget.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsoundmenu_la_CFLAGS) $(CFLAGS) -MT libsoundmenu_la-title-widget.lo -MD -MP -MF $(DEPDIR)/libsoundmenu_la-title-widget.Tpo -c -o libsoundmenu_la-title-widget.lo `test -f 'title-widget.c' || echo '$(srcdir)/'`title-widget.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsoundmenu_la-title-widget.Tpo $(DEPDIR)/libsoundmenu_la-title-widget.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='title-widget.c' object='libsoundmenu_la-title-widget.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsoundmenu_la_CFLAGS) $(CFLAGS) -c -o libsoundmenu_la-title-widget.lo `test -f 'title-widget.c' || echo '$(srcdir)/'`title-widget.c + +libsoundmenu_la-volume-widget.lo: volume-widget.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsoundmenu_la_CFLAGS) $(CFLAGS) -MT libsoundmenu_la-volume-widget.lo -MD -MP -MF $(DEPDIR)/libsoundmenu_la-volume-widget.Tpo -c -o libsoundmenu_la-volume-widget.lo `test -f 'volume-widget.c' || echo '$(srcdir)/'`volume-widget.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsoundmenu_la-volume-widget.Tpo $(DEPDIR)/libsoundmenu_la-volume-widget.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='volume-widget.c' object='libsoundmenu_la-volume-widget.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsoundmenu_la_CFLAGS) $(CFLAGS) -c -o libsoundmenu_la-volume-widget.lo `test -f 'volume-widget.c' || echo '$(srcdir)/'`volume-widget.c + +indicator_sound_service-sound-service.o: sound-service.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -MT indicator_sound_service-sound-service.o -MD -MP -MF $(DEPDIR)/indicator_sound_service-sound-service.Tpo -c -o indicator_sound_service-sound-service.o `test -f 'sound-service.c' || echo '$(srcdir)/'`sound-service.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-sound-service.Tpo $(DEPDIR)/indicator_sound_service-sound-service.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sound-service.c' object='indicator_sound_service-sound-service.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-sound-service.o `test -f 'sound-service.c' || echo '$(srcdir)/'`sound-service.c + +indicator_sound_service-sound-service.obj: sound-service.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -MT indicator_sound_service-sound-service.obj -MD -MP -MF $(DEPDIR)/indicator_sound_service-sound-service.Tpo -c -o indicator_sound_service-sound-service.obj `if test -f 'sound-service.c'; then $(CYGPATH_W) 'sound-service.c'; else $(CYGPATH_W) '$(srcdir)/sound-service.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-sound-service.Tpo $(DEPDIR)/indicator_sound_service-sound-service.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sound-service.c' object='indicator_sound_service-sound-service.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-sound-service.obj `if test -f 'sound-service.c'; then $(CYGPATH_W) 'sound-service.c'; else $(CYGPATH_W) '$(srcdir)/sound-service.c'; fi` + +indicator_sound_service-dbus-menu-manager.o: dbus-menu-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-dbus-menu-manager.o -MD -MP -MF $(DEPDIR)/indicator_sound_service-dbus-menu-manager.Tpo -c -o indicator_sound_service-dbus-menu-manager.o `test -f 'dbus-menu-manager.c' || echo '$(srcdir)/'`dbus-menu-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-dbus-menu-manager.Tpo $(DEPDIR)/indicator_sound_service-dbus-menu-manager.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dbus-menu-manager.c' object='indicator_sound_service-dbus-menu-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-dbus-menu-manager.o `test -f 'dbus-menu-manager.c' || echo '$(srcdir)/'`dbus-menu-manager.c + +indicator_sound_service-dbus-menu-manager.obj: dbus-menu-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-dbus-menu-manager.obj -MD -MP -MF $(DEPDIR)/indicator_sound_service-dbus-menu-manager.Tpo -c -o indicator_sound_service-dbus-menu-manager.obj `if test -f 'dbus-menu-manager.c'; then $(CYGPATH_W) 'dbus-menu-manager.c'; else $(CYGPATH_W) '$(srcdir)/dbus-menu-manager.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-dbus-menu-manager.Tpo $(DEPDIR)/indicator_sound_service-dbus-menu-manager.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dbus-menu-manager.c' object='indicator_sound_service-dbus-menu-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-dbus-menu-manager.obj `if test -f 'dbus-menu-manager.c'; then $(CYGPATH_W) 'dbus-menu-manager.c'; else $(CYGPATH_W) '$(srcdir)/dbus-menu-manager.c'; fi` + +indicator_sound_service-pulse-manager.o: pulse-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-pulse-manager.o -MD -MP -MF $(DEPDIR)/indicator_sound_service-pulse-manager.Tpo -c -o indicator_sound_service-pulse-manager.o `test -f 'pulse-manager.c' || echo '$(srcdir)/'`pulse-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-pulse-manager.Tpo $(DEPDIR)/indicator_sound_service-pulse-manager.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pulse-manager.c' object='indicator_sound_service-pulse-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-pulse-manager.o `test -f 'pulse-manager.c' || echo '$(srcdir)/'`pulse-manager.c + +indicator_sound_service-pulse-manager.obj: pulse-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-pulse-manager.obj -MD -MP -MF $(DEPDIR)/indicator_sound_service-pulse-manager.Tpo -c -o indicator_sound_service-pulse-manager.obj `if test -f 'pulse-manager.c'; then $(CYGPATH_W) 'pulse-manager.c'; else $(CYGPATH_W) '$(srcdir)/pulse-manager.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-pulse-manager.Tpo $(DEPDIR)/indicator_sound_service-pulse-manager.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pulse-manager.c' object='indicator_sound_service-pulse-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-pulse-manager.obj `if test -f 'pulse-manager.c'; then $(CYGPATH_W) 'pulse-manager.c'; else $(CYGPATH_W) '$(srcdir)/pulse-manager.c'; fi` + +indicator_sound_service-sound-service-dbus.o: sound-service-dbus.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -MT indicator_sound_service-sound-service-dbus.o -MD -MP -MF $(DEPDIR)/indicator_sound_service-sound-service-dbus.Tpo -c -o indicator_sound_service-sound-service-dbus.o `test -f 'sound-service-dbus.c' || echo '$(srcdir)/'`sound-service-dbus.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-sound-service-dbus.Tpo $(DEPDIR)/indicator_sound_service-sound-service-dbus.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sound-service-dbus.c' object='indicator_sound_service-sound-service-dbus.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-sound-service-dbus.o `test -f 'sound-service-dbus.c' || echo '$(srcdir)/'`sound-service-dbus.c + +indicator_sound_service-sound-service-dbus.obj: sound-service-dbus.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -MT indicator_sound_service-sound-service-dbus.obj -MD -MP -MF $(DEPDIR)/indicator_sound_service-sound-service-dbus.Tpo -c -o indicator_sound_service-sound-service-dbus.obj `if test -f 'sound-service-dbus.c'; then $(CYGPATH_W) 'sound-service-dbus.c'; else $(CYGPATH_W) '$(srcdir)/sound-service-dbus.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-sound-service-dbus.Tpo $(DEPDIR)/indicator_sound_service-sound-service-dbus.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sound-service-dbus.c' object='indicator_sound_service-sound-service-dbus.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-sound-service-dbus.obj `if test -f 'sound-service-dbus.c'; then $(CYGPATH_W) 'sound-service-dbus.c'; else $(CYGPATH_W) '$(srcdir)/sound-service-dbus.c'; fi` + +indicator_sound_service-slider-menu-item.o: slider-menu-item.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -MT indicator_sound_service-slider-menu-item.o -MD -MP -MF $(DEPDIR)/indicator_sound_service-slider-menu-item.Tpo -c -o indicator_sound_service-slider-menu-item.o `test -f 'slider-menu-item.c' || echo '$(srcdir)/'`slider-menu-item.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-slider-menu-item.Tpo $(DEPDIR)/indicator_sound_service-slider-menu-item.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='slider-menu-item.c' object='indicator_sound_service-slider-menu-item.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -c -o indicator_sound_service-slider-menu-item.o `test -f 'slider-menu-item.c' || echo '$(srcdir)/'`slider-menu-item.c + +indicator_sound_service-slider-menu-item.obj: slider-menu-item.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -MT indicator_sound_service-slider-menu-item.obj -MD -MP -MF $(DEPDIR)/indicator_sound_service-slider-menu-item.Tpo -c -o indicator_sound_service-slider-menu-item.obj `if test -f 'slider-menu-item.c'; then $(CYGPATH_W) 'slider-menu-item.c'; else $(CYGPATH_W) '$(srcdir)/slider-menu-item.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-slider-menu-item.Tpo $(DEPDIR)/indicator_sound_service-slider-menu-item.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='slider-menu-item.c' object='indicator_sound_service-slider-menu-item.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -c -o indicator_sound_service-slider-menu-item.obj `if test -f 'slider-menu-item.c'; then $(CYGPATH_W) 'slider-menu-item.c'; else $(CYGPATH_W) '$(srcdir)/slider-menu-item.c'; fi` + +indicator_sound_service-music-player-bridge.o: music-player-bridge.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -MT indicator_sound_service-music-player-bridge.o -MD -MP -MF $(DEPDIR)/indicator_sound_service-music-player-bridge.Tpo -c -o indicator_sound_service-music-player-bridge.o `test -f 'music-player-bridge.c' || echo '$(srcdir)/'`music-player-bridge.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-music-player-bridge.Tpo $(DEPDIR)/indicator_sound_service-music-player-bridge.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='music-player-bridge.c' object='indicator_sound_service-music-player-bridge.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-music-player-bridge.o `test -f 'music-player-bridge.c' || echo '$(srcdir)/'`music-player-bridge.c + +indicator_sound_service-music-player-bridge.obj: music-player-bridge.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -MT indicator_sound_service-music-player-bridge.obj -MD -MP -MF $(DEPDIR)/indicator_sound_service-music-player-bridge.Tpo -c -o indicator_sound_service-music-player-bridge.obj `if test -f 'music-player-bridge.c'; then $(CYGPATH_W) 'music-player-bridge.c'; else $(CYGPATH_W) '$(srcdir)/music-player-bridge.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-music-player-bridge.Tpo $(DEPDIR)/indicator_sound_service-music-player-bridge.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='music-player-bridge.c' object='indicator_sound_service-music-player-bridge.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-music-player-bridge.obj `if test -f 'music-player-bridge.c'; then $(CYGPATH_W) 'music-player-bridge.c'; else $(CYGPATH_W) '$(srcdir)/music-player-bridge.c'; fi` + +indicator_sound_service-transport-menu-item.o: transport-menu-item.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -MT indicator_sound_service-transport-menu-item.o -MD -MP -MF $(DEPDIR)/indicator_sound_service-transport-menu-item.Tpo -c -o indicator_sound_service-transport-menu-item.o `test -f 'transport-menu-item.c' || echo '$(srcdir)/'`transport-menu-item.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-transport-menu-item.Tpo $(DEPDIR)/indicator_sound_service-transport-menu-item.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='transport-menu-item.c' object='indicator_sound_service-transport-menu-item.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -c -o indicator_sound_service-transport-menu-item.o `test -f 'transport-menu-item.c' || echo '$(srcdir)/'`transport-menu-item.c + +indicator_sound_service-transport-menu-item.obj: transport-menu-item.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -MT indicator_sound_service-transport-menu-item.obj -MD -MP -MF $(DEPDIR)/indicator_sound_service-transport-menu-item.Tpo -c -o indicator_sound_service-transport-menu-item.obj `if test -f 'transport-menu-item.c'; then $(CYGPATH_W) 'transport-menu-item.c'; else $(CYGPATH_W) '$(srcdir)/transport-menu-item.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-transport-menu-item.Tpo $(DEPDIR)/indicator_sound_service-transport-menu-item.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='transport-menu-item.c' object='indicator_sound_service-transport-menu-item.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -c -o indicator_sound_service-transport-menu-item.obj `if test -f 'transport-menu-item.c'; then $(CYGPATH_W) 'transport-menu-item.c'; else $(CYGPATH_W) '$(srcdir)/transport-menu-item.c'; fi` + +indicator_sound_service-metadata-menu-item.o: metadata-menu-item.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -MT indicator_sound_service-metadata-menu-item.o -MD -MP -MF $(DEPDIR)/indicator_sound_service-metadata-menu-item.Tpo -c -o indicator_sound_service-metadata-menu-item.o `test -f 'metadata-menu-item.c' || echo '$(srcdir)/'`metadata-menu-item.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-metadata-menu-item.Tpo $(DEPDIR)/indicator_sound_service-metadata-menu-item.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='metadata-menu-item.c' object='indicator_sound_service-metadata-menu-item.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -c -o indicator_sound_service-metadata-menu-item.o `test -f 'metadata-menu-item.c' || echo '$(srcdir)/'`metadata-menu-item.c + +indicator_sound_service-metadata-menu-item.obj: metadata-menu-item.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -MT indicator_sound_service-metadata-menu-item.obj -MD -MP -MF $(DEPDIR)/indicator_sound_service-metadata-menu-item.Tpo -c -o indicator_sound_service-metadata-menu-item.obj `if test -f 'metadata-menu-item.c'; then $(CYGPATH_W) 'metadata-menu-item.c'; else $(CYGPATH_W) '$(srcdir)/metadata-menu-item.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-metadata-menu-item.Tpo $(DEPDIR)/indicator_sound_service-metadata-menu-item.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='metadata-menu-item.c' object='indicator_sound_service-metadata-menu-item.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -c -o indicator_sound_service-metadata-menu-item.obj `if test -f 'metadata-menu-item.c'; then $(CYGPATH_W) 'metadata-menu-item.c'; else $(CYGPATH_W) '$(srcdir)/metadata-menu-item.c'; fi` + +indicator_sound_service-title-menu-item.o: title-menu-item.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -MT indicator_sound_service-title-menu-item.o -MD -MP -MF $(DEPDIR)/indicator_sound_service-title-menu-item.Tpo -c -o indicator_sound_service-title-menu-item.o `test -f 'title-menu-item.c' || echo '$(srcdir)/'`title-menu-item.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-title-menu-item.Tpo $(DEPDIR)/indicator_sound_service-title-menu-item.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='title-menu-item.c' object='indicator_sound_service-title-menu-item.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -c -o indicator_sound_service-title-menu-item.o `test -f 'title-menu-item.c' || echo '$(srcdir)/'`title-menu-item.c + +indicator_sound_service-title-menu-item.obj: title-menu-item.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -MT indicator_sound_service-title-menu-item.obj -MD -MP -MF $(DEPDIR)/indicator_sound_service-title-menu-item.Tpo -c -o indicator_sound_service-title-menu-item.obj `if test -f 'title-menu-item.c'; then $(CYGPATH_W) 'title-menu-item.c'; else $(CYGPATH_W) '$(srcdir)/title-menu-item.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-title-menu-item.Tpo $(DEPDIR)/indicator_sound_service-title-menu-item.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='title-menu-item.c' object='indicator_sound_service-title-menu-item.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -c -o indicator_sound_service-title-menu-item.obj `if test -f 'title-menu-item.c'; then $(CYGPATH_W) 'title-menu-item.c'; else $(CYGPATH_W) '$(srcdir)/title-menu-item.c'; fi` + +indicator_sound_service-player-controller.o: player-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-player-controller.o -MD -MP -MF $(DEPDIR)/indicator_sound_service-player-controller.Tpo -c -o indicator_sound_service-player-controller.o `test -f 'player-controller.c' || echo '$(srcdir)/'`player-controller.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-player-controller.Tpo $(DEPDIR)/indicator_sound_service-player-controller.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='player-controller.c' object='indicator_sound_service-player-controller.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-player-controller.o `test -f 'player-controller.c' || echo '$(srcdir)/'`player-controller.c + +indicator_sound_service-player-controller.obj: player-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-player-controller.obj -MD -MP -MF $(DEPDIR)/indicator_sound_service-player-controller.Tpo -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` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-player-controller.Tpo $(DEPDIR)/indicator_sound_service-player-controller.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='player-controller.c' object='indicator_sound_service-player-controller.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-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-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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mpris2-controller.c' object='indicator_sound_service-mpris2-controller.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-controller.o `test -f 'mpris2-controller.c' || echo '$(srcdir)/'`mpris2-controller.c + +indicator_sound_service-mpris2-controller.obj: 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.obj -MD -MP -MF $(DEPDIR)/indicator_sound_service-mpris2-controller.Tpo -c -o indicator_sound_service-mpris2-controller.obj `if test -f 'mpris2-controller.c'; then $(CYGPATH_W) 'mpris2-controller.c'; else $(CYGPATH_W) '$(srcdir)/mpris2-controller.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-mpris2-controller.Tpo $(DEPDIR)/indicator_sound_service-mpris2-controller.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mpris2-controller.c' object='indicator_sound_service-mpris2-controller.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-controller.obj `if test -f 'mpris2-controller.c'; then $(CYGPATH_W) 'mpris2-controller.c'; else $(CYGPATH_W) '$(srcdir)/mpris2-controller.c'; fi` + +indicator_sound_service-player-item.o: player-item.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -MT indicator_sound_service-player-item.o -MD -MP -MF $(DEPDIR)/indicator_sound_service-player-item.Tpo -c -o indicator_sound_service-player-item.o `test -f 'player-item.c' || echo '$(srcdir)/'`player-item.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-player-item.Tpo $(DEPDIR)/indicator_sound_service-player-item.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='player-item.c' object='indicator_sound_service-player-item.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -c -o indicator_sound_service-player-item.o `test -f 'player-item.c' || echo '$(srcdir)/'`player-item.c + +indicator_sound_service-player-item.obj: player-item.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -MT indicator_sound_service-player-item.obj -MD -MP -MF $(DEPDIR)/indicator_sound_service-player-item.Tpo -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` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-player-item.Tpo $(DEPDIR)/indicator_sound_service-player-item.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='player-item.c' object='indicator_sound_service-player-item.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -c -o indicator_sound_service-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 +@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@ 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 + +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 +@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@ 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` + +indicator_sound_service-fetch-file.o: fetch-file.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -MT indicator_sound_service-fetch-file.o -MD -MP -MF $(DEPDIR)/indicator_sound_service-fetch-file.Tpo -c -o indicator_sound_service-fetch-file.o `test -f 'fetch-file.c' || echo '$(srcdir)/'`fetch-file.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-fetch-file.Tpo $(DEPDIR)/indicator_sound_service-fetch-file.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fetch-file.c' object='indicator_sound_service-fetch-file.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-fetch-file.o `test -f 'fetch-file.c' || echo '$(srcdir)/'`fetch-file.c + +indicator_sound_service-fetch-file.obj: 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.obj -MD -MP -MF $(DEPDIR)/indicator_sound_service-fetch-file.Tpo -c -o indicator_sound_service-fetch-file.obj `if test -f 'fetch-file.c'; then $(CYGPATH_W) 'fetch-file.c'; else $(CYGPATH_W) '$(srcdir)/fetch-file.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-fetch-file.Tpo $(DEPDIR)/indicator_sound_service-fetch-file.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fetch-file.c' object='indicator_sound_service-fetch-file.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-fetch-file.obj `if test -f 'fetch-file.c'; then $(CYGPATH_W) 'fetch-file.c'; else $(CYGPATH_W) '$(srcdir)/fetch-file.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-am +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) +installdirs: + for dir in "$(DESTDIR)$(soundmenulibdir)" "$(DESTDIR)$(libexecdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +clean: clean-am + +clean-am: clean-generic clean-libexecPROGRAMS clean-libtool \ + clean-soundmenulibLTLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-soundmenulibLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libexecPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-libexecPROGRAMS \ + uninstall-soundmenulibLTLIBRARIES + +.MAKE: all check install install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libexecPROGRAMS clean-libtool \ + clean-soundmenulibLTLIBRARIES ctags distclean \ + distclean-compile 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-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am \ + install-libexecPROGRAMS install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-soundmenulibLTLIBRARIES \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-libexecPROGRAMS uninstall-soundmenulibLTLIBRARIES + + +checkxml: $(srcdir)/sound-service.xml + @xmllint -valid -noout $< + @echo $< checks out ok + +sound-service-client.h: $(srcdir)/sound-service.xml + dbus-binding-tool \ + --prefix=_sound_service_client \ + --mode=glib-client \ + --output=sound-service-client.h \ + $(srcdir)/sound-service.xml + +#################################################################### +# Sound Service +#################################################################### + +################# +# dbus interface +################# +sound-service-server.h: $(srcdir)/sound-service.xml + dbus-binding-tool \ + --prefix=_sound_service_server \ + --mode=glib-server \ + --output=sound-service-server.h \ + $(srcdir)/sound-service.xml + + $(MAINTAINER_VALAFLAGS) + +music_bridge_vala.stamp $(music_bridge_APIFILES): $(music_bridge_VALASOURCES) + $(AM_V_GEN) $(VALAC) $(music_bridge_VALAFLAGS) $^ + touch music_bridge_vala.stamp + +# 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/src/familiar-players-db.c b/src/familiar-players-db.c new file mode 100644 index 0000000..e0fff11 --- /dev/null +++ b/src/familiar-players-db.c @@ -0,0 +1,533 @@ +/* familiar-players-db.c generated by valac 0.10.0, 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; + char* file_name; + char* 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" +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_check_for_keys (FamiliarPlayersDB* self); +static gboolean familiar_players_db_load_data_from_key_file (FamiliarPlayersDB* self); +static gboolean familiar_players_db_write_db (FamiliarPlayersDB* self); +static void _vala_array_add1 (char*** array, int* length, int* size, char* value); +void familiar_players_db_insert (FamiliarPlayersDB* self, const char* desktop); +gboolean familiar_players_db_already_familiar (FamiliarPlayersDB* self, const char* desktop); +static gboolean _familiar_players_db_write_db_gsource_func (gpointer self); +GeeSet* familiar_players_db_records (FamiliarPlayersDB* self); +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; + GeeHashMap* _tmp0_; + char* _tmp1_; + char* _tmp2_; + gboolean _tmp3_ = FALSE; + gboolean _tmp4_ = FALSE; + self = (FamiliarPlayersDB*) g_object_new (object_type, NULL); + self->priv->write_id = (guint) 0; + self->priv->players_DB = (_tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_BOOLEAN, NULL, NULL, NULL, NULL, NULL), _g_object_unref0 (self->priv->players_DB), _tmp0_); + self->priv->dir_name = (_tmp1_ = g_build_filename (g_get_user_cache_dir (), "indicators", "sound", NULL), _g_free0 (self->priv->dir_name), _tmp1_); + self->priv->file_name = (_tmp2_ = g_build_filename (self->priv->dir_name, "familiar-players-db.keyfile", NULL), _g_free0 (self->priv->file_name), _tmp2_); + if (familiar_players_db_create_key_file (self)) { + _tmp4_ = familiar_players_db_check_for_keys (self); + } else { + _tmp4_ = FALSE; + } + if (_tmp4_) { + _tmp3_ = familiar_players_db_load_data_from_key_file (self); + } else { + _tmp3_ = FALSE; + } + if (_tmp3_) { + g_debug ("familiar-players-db.vala:45: keyfiles in place and ready for action"); + } else { + GKeyFile* _tmp5_; + self->priv->key_file = (_tmp5_ = NULL, _g_key_file_free0 (self->priv->key_file), _tmp5_); + g_warning ("familiar-players-db.vala:49: 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_; + GError * _inner_error_ = NULL; + g_return_val_if_fail (self != NULL, FALSE); + _result_ = FALSE; + if (g_file_test (self->priv->file_name, G_FILE_TEST_EXISTS)) { + GKeyFile* _tmp0_; + self->priv->key_file = (_tmp0_ = g_key_file_new (), _g_key_file_free0 (self->priv->key_file), _tmp0_); + { + gboolean _tmp1_; + _tmp1_ = g_key_file_load_from_file (self->priv->key_file, self->priv->file_name, G_KEY_FILE_NONE, &_inner_error_); + 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_ = _tmp1_; + } + goto __finally6; + __catch6_g_key_file_error: + { + GError * e; + e = _inner_error_; + _inner_error_ = NULL; + { + g_warning ("familiar-players-db.vala:61: 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:64: 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; + GError * _inner_error_ = NULL; + g_return_val_if_fail (self != NULL, FALSE); + { + gboolean _tmp0_; + _tmp0_ = g_key_file_has_key (self->priv->key_file, FAMILIAR_PLAYERS_DB_GROUP_NAME, FAMILIAR_PLAYERS_DB_KEY_NAME, &_inner_error_); + 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 (_tmp0_ == 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:79: 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; + GError * _inner_error_ = NULL; + g_return_val_if_fail (self != NULL, FALSE); + { + gint desktops_length1; + gint _desktops_size_; + char** _tmp1_; + gsize _tmp0_; + char** desktops; + desktops = (_tmp1_ = g_key_file_get_string_list (self->priv->key_file, FAMILIAR_PLAYERS_DB_GROUP_NAME, FAMILIAR_PLAYERS_DB_KEY_NAME, &_tmp0_, &_inner_error_), desktops_length1 = _tmp0_, _desktops_size_ = desktops_length1, _tmp1_); + 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; + } + { + char** 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) { + char* s; + s = g_strdup (s_collection[s_it]); + { + 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; + } + goto __finally8; + __catch8_g_key_file_error: + { + GError * _error_; + _error_ = _inner_error_; + _inner_error_ = NULL; + { + g_warning ("familiar-players-db.vala:93: 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 (char*** array, int* length, int* size, char* value) { + if ((*length) == (*size)) { + *size = (*size) ? (2 * (*size)) : 4; + *array = g_renew (char*, *array, (*size) + 1); + } + (*array)[(*length)++] = value; + (*array)[*length] = NULL; +} + + +static gboolean familiar_players_db_write_db (FamiliarPlayersDB* self) { + gboolean result = FALSE; + GKeyFile* keyfile; + gint desktops_length1; + gint _desktops_size_; + char** _tmp1_; + char** _tmp0_ = NULL; + char** desktops; + gsize data_length = 0UL; + char* data; + GError * _inner_error_ = NULL; + g_return_val_if_fail (self != NULL, FALSE); + keyfile = g_key_file_new (); + desktops = (_tmp1_ = (_tmp0_ = g_new0 (char*, 0 + 1), _tmp0_), desktops_length1 = 0, _desktops_size_ = desktops_length1, _tmp1_); + { + GeeSet* _tmp2_; + GeeIterator* _tmp3_; + GeeIterator* _key_it; + _key_it = (_tmp3_ = gee_iterable_iterator ((GeeIterable*) (_tmp2_ = gee_map_get_keys ((GeeMap*) self->priv->players_DB))), _g_object_unref0 (_tmp2_), _tmp3_); + while (TRUE) { + char* key; + if (!gee_iterator_next (_key_it)) { + break; + } + key = (char*) gee_iterator_get (_key_it); + _vala_array_add1 (&desktops, &desktops_length1, &_desktops_size_, g_strdup (key)); + _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; + { + char* _tmp4_; + data = (_tmp4_ = g_key_file_to_data (keyfile, &data_length, NULL), _g_free0 (data), _tmp4_); + } + goto __finally9; + __catch9_g_key_file_error: + { + GError * e; + e = _inner_error_; + _inner_error_ = NULL; + { + g_warning ("familiar-players-db.vala:114: 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; + } + if (g_mkdir_with_parents (self->priv->dir_name, 0700) != 0) { + g_warning ("familiar-players-db.vala:119: 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; + } + { + gboolean _tmp5_; + _tmp5_ = g_file_set_contents (self->priv->file_name, data, (gssize) data_length, &_inner_error_); + 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 (_tmp5_ == FALSE) { + g_warning ("familiar-players-db.vala:125: 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:129: 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 char* desktop) { + g_return_if_fail (self != NULL); + g_return_if_fail (desktop != NULL); + if (familiar_players_db_already_familiar (self, desktop) == FALSE) { + char* _tmp0_; + if (self->priv->write_id != 0) { + g_source_remove (self->priv->write_id); + self->priv->write_id = (guint) 0; + } + self->priv->write_id = g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, (guint) 60, _familiar_players_db_write_db_gsource_func, g_object_ref (self), g_object_unref); + gee_abstract_map_set ((GeeAbstractMap*) self->priv->players_DB, _tmp0_ = g_strdup (desktop), GINT_TO_POINTER (TRUE)); + _g_free0 (_tmp0_); + } +} + + +static char* bool_to_string (gboolean self) { + char* result = NULL; + if (self) { + result = g_strdup ("true"); + return result; + } else { + result = g_strdup ("false"); + return result; + } +} + + +gboolean familiar_players_db_already_familiar (FamiliarPlayersDB* self, const char* desktop) { + gboolean result = FALSE; + GeeSet* _tmp0_; + char* _tmp1_; + GeeSet* _tmp2_; + gboolean _tmp3_; + g_return_val_if_fail (self != NULL, FALSE); + g_return_val_if_fail (desktop != NULL, FALSE); + g_debug ("familiar-players-db.vala:148: playerDB->already_familiar - result %s", _tmp1_ = bool_to_string (gee_collection_contains ((GeeCollection*) (_tmp0_ = gee_map_get_keys ((GeeMap*) self->priv->players_DB)), desktop))); + _g_free0 (_tmp1_); + _g_object_unref0 (_tmp0_); + result = (_tmp3_ = gee_collection_contains ((GeeCollection*) (_tmp2_ = gee_map_get_keys ((GeeMap*) self->priv->players_DB)), desktop), _g_object_unref0 (_tmp2_), _tmp3_); + return result; +} + + +GeeSet* familiar_players_db_records (FamiliarPlayersDB* self) { + GeeSet* result = NULL; + g_return_val_if_fail (self != NULL, NULL); + result = gee_map_get_keys ((GeeMap*) self->priv->players_DB); + return result; +} + + +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/fetch-file.c b/src/fetch-file.c new file mode 100644 index 0000000..c5a22ac --- /dev/null +++ b/src/fetch-file.c @@ -0,0 +1,480 @@ +/* fetch-file.c generated by valac 0.10.0, the Vala compiler + * generated from fetch-file.vala, do not modify */ + +/* + * Copyright (C) 2010 Canonical, Ltd. + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License + * version 3.0 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3.0 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * <http://www.gnu.org/licenses/>. + * + * Authors + * Gordon Allott <gord.allott@canonical.com> + * Conor Curran <conor.curran@canonical.com> + */ + +#include <glib.h> +#include <glib-object.h> +#include <stdlib.h> +#include <string.h> +#include <gio/gio.h> + + +#define TYPE_FETCH_FILE (fetch_file_get_type ()) +#define FETCH_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FETCH_FILE, FetchFile)) +#define FETCH_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FETCH_FILE, FetchFileClass)) +#define IS_FETCH_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FETCH_FILE)) +#define IS_FETCH_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FETCH_FILE)) +#define FETCH_FILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FETCH_FILE, FetchFileClass)) + +typedef struct _FetchFile FetchFile; +typedef struct _FetchFileClass FetchFileClass; +typedef struct _FetchFilePrivate FetchFilePrivate; +#define _g_free0(var) (var = (g_free (var), NULL)) +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _g_byte_array_free0(var) ((var == NULL) ? NULL : (var = (g_byte_array_free (var, TRUE), NULL))) +#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) +typedef struct _FetchFileFetchDataData FetchFileFetchDataData; +typedef struct _FetchFileReadSomethingAsyncData FetchFileReadSomethingAsyncData; + +struct _FetchFile { + GObject parent_instance; + FetchFilePrivate * priv; +}; + +struct _FetchFileClass { + GObjectClass parent_class; +}; + +struct _FetchFilePrivate { + char* _uri; + char* _intended_property; + GDataInputStream* stream; + GFile* file; + GByteArray* data; +}; + +struct _FetchFileFetchDataData { + int _state_; + GAsyncResult* _res_; + GSimpleAsyncResult* _async_result; + FetchFile* self; + GFileInputStream* _tmp0_; + GFileInputStream* _tmp1_; + GDataInputStream* _tmp2_; + GError * e; + GError * _inner_error_; +}; + +struct _FetchFileReadSomethingAsyncData { + int _state_; + GAsyncResult* _res_; + GSimpleAsyncResult* _async_result; + FetchFile* self; + gssize size; + guint8* buffer; + gint buffer_length1; + gint _buffer_size_; + guint8* _tmp0_; + gssize bufsize; + gboolean _tmp1_; + gssize _tmp2_; + guint8* cpybuf; + gint cpybuf_length1; + gint _cpybuf_size_; + guint8* _tmp3_; + GError * e; + GError * _inner_error_; +}; + + +static gpointer fetch_file_parent_class = NULL; + +GType fetch_file_get_type (void) G_GNUC_CONST; +#define FETCH_FILE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_FETCH_FILE, FetchFilePrivate)) +enum { + FETCH_FILE_DUMMY_PROPERTY, + FETCH_FILE_URI, + FETCH_FILE_INTENDED_PROPERTY +}; +FetchFile* fetch_file_new (const char* uri, const char* prop); +FetchFile* fetch_file_construct (GType object_type, const char* uri, const char* prop); +static void fetch_file_fetch_data_data_free (gpointer _data); +static void fetch_file_fetch_data_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_); +void fetch_file_fetch_data (FetchFile* self, GAsyncReadyCallback _callback_, gpointer _user_data_); +void fetch_file_fetch_data_finish (FetchFile* self, GAsyncResult* _res_); +static gboolean fetch_file_fetch_data_co (FetchFileFetchDataData* data); +static void fetch_file_read_something_async (FetchFile* self, GAsyncReadyCallback _callback_, gpointer _user_data_); +static void fetch_file_read_something_finish (FetchFile* self, GAsyncResult* _res_); +static void fetch_file_read_something_async_data_free (gpointer _data); +static void fetch_file_read_something_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_); +static gboolean fetch_file_read_something_async_co (FetchFileReadSomethingAsyncData* data); +const char* fetch_file_get_intended_property (FetchFile* self); +const char* fetch_file_get_uri (FetchFile* self); +static void fetch_file_set_uri (FetchFile* self, const char* value); +static void fetch_file_set_intended_property (FetchFile* self, const char* value); +static GObject * fetch_file_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); +static void fetch_file_finalize (GObject* obj); +static void fetch_file_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void fetch_file_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); + + +static void g_cclosure_user_marshal_VOID__POINTER_STRING (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data); + +FetchFile* fetch_file_construct (GType object_type, const char* uri, const char* prop) { + FetchFile * self; + g_return_val_if_fail (uri != NULL, NULL); + g_return_val_if_fail (prop != NULL, NULL); + self = (FetchFile*) g_object_new (object_type, "uri", uri, "intended-property", prop, NULL); + return self; +} + + +FetchFile* fetch_file_new (const char* uri, const char* prop) { + return fetch_file_construct (TYPE_FETCH_FILE, uri, prop); +} + + +static void fetch_file_fetch_data_data_free (gpointer _data) { + FetchFileFetchDataData* data; + data = _data; + g_object_unref (data->self); + g_slice_free (FetchFileFetchDataData, data); +} + + +void fetch_file_fetch_data (FetchFile* self, GAsyncReadyCallback _callback_, gpointer _user_data_) { + FetchFileFetchDataData* _data_; + _data_ = g_slice_new0 (FetchFileFetchDataData); + _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, fetch_file_fetch_data); + g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, fetch_file_fetch_data_data_free); + _data_->self = g_object_ref (self); + fetch_file_fetch_data_co (_data_); +} + + +void fetch_file_fetch_data_finish (FetchFile* self, GAsyncResult* _res_) { + FetchFileFetchDataData* _data_; + _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_)); +} + + +static void fetch_file_fetch_data_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) { + FetchFileFetchDataData* data; + data = _user_data_; + data->_res_ = _res_; + fetch_file_fetch_data_co (data); +} + + +static gboolean fetch_file_fetch_data_co (FetchFileFetchDataData* data) { + switch (data->_state_) { + case 0: + goto _state_0; + default: + g_assert_not_reached (); + } + _state_0: + { + data->_tmp0_ = g_file_read (data->self->priv->file, NULL, &data->_inner_error_); + if (data->_inner_error_ != NULL) { + goto __catch11_g_error; + } + data->self->priv->stream = (data->_tmp2_ = g_data_input_stream_new ((GInputStream*) (data->_tmp1_ = data->_tmp0_)), _g_object_unref0 (data->self->priv->stream), data->_tmp2_); + _g_object_unref0 (data->_tmp1_); + g_data_input_stream_set_byte_order (data->self->priv->stream, G_DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN); + } + 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); + } + } + __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_); + return FALSE; + } + fetch_file_read_something_async (data->self, NULL, 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 fetch_file_read_something_async_data_free (gpointer _data) { + FetchFileReadSomethingAsyncData* data; + data = _data; + g_object_unref (data->self); + g_slice_free (FetchFileReadSomethingAsyncData, data); +} + + +static void fetch_file_read_something_async (FetchFile* self, GAsyncReadyCallback _callback_, gpointer _user_data_) { + FetchFileReadSomethingAsyncData* _data_; + _data_ = g_slice_new0 (FetchFileReadSomethingAsyncData); + _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, fetch_file_read_something_async); + g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, fetch_file_read_something_async_data_free); + _data_->self = g_object_ref (self); + fetch_file_read_something_async_co (_data_); +} + + +static void fetch_file_read_something_finish (FetchFile* self, GAsyncResult* _res_) { + FetchFileReadSomethingAsyncData* _data_; + _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_)); +} + + +static void fetch_file_read_something_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) { + FetchFileReadSomethingAsyncData* data; + data = _user_data_; + data->_res_ = _res_; + fetch_file_read_something_async_co (data); +} + + +static gboolean fetch_file_read_something_async_co (FetchFileReadSomethingAsyncData* data) { + switch (data->_state_) { + case 0: + goto _state_0; + default: + g_assert_not_reached (); + case 1: + goto _state_1; + } + _state_0: + data->size = (gssize) 1024; + data->buffer = (data->_tmp0_ = g_new0 (guint8, data->size), data->buffer_length1 = data->size, data->_buffer_size_ = data->buffer_length1, data->_tmp0_); + data->bufsize = (gssize) 1; + { + data->_tmp1_ = TRUE; + while (TRUE) { + if (!data->_tmp1_) { + if (!(data->bufsize > 0)) { + break; + } + } + data->_tmp1_ = FALSE; + { + data->_state_ = 1; + g_input_stream_read_async ((GInputStream*) data->self->priv->stream, data->buffer, (gsize) data->size, G_PRIORITY_DEFAULT, NULL, fetch_file_read_something_async_ready, data); + return FALSE; + _state_1: + data->_tmp2_ = g_input_stream_read_finish ((GInputStream*) data->self->priv->stream, data->_res_, &data->_inner_error_); + if (data->_inner_error_ != NULL) { + goto __catch12_g_error; + } + data->bufsize = data->_tmp2_; + if (data->bufsize < 1) { + break; + } + if (data->bufsize != data->size) { + data->cpybuf = (data->_tmp3_ = g_new0 (guint8, data->bufsize), data->cpybuf_length1 = data->bufsize, data->_cpybuf_size_ = data->cpybuf_length1, data->_tmp3_); + memcpy (data->cpybuf, data->buffer, (gsize) data->bufsize); + g_byte_array_append (data->self->priv->data, data->cpybuf, data->cpybuf_length1); + data->cpybuf = (g_free (data->cpybuf), NULL); + } else { + g_byte_array_append (data->self->priv->data, data->buffer, data->buffer_length1); + } + } + 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); + } + } + __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); + g_clear_error (&data->_inner_error_); + return FALSE; + } + } + } + g_signal_emit_by_name (data->self, "completed", data->self->priv->data, data->self->priv->_intended_property); + data->buffer = (g_free (data->buffer), 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; + } +} + + +const char* fetch_file_get_uri (FetchFile* self) { + const char* result; + g_return_val_if_fail (self != NULL, NULL); + result = self->priv->_uri; + return result; +} + + +static void fetch_file_set_uri (FetchFile* self, const char* value) { + char* _tmp0_; + g_return_if_fail (self != NULL); + self->priv->_uri = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_uri), _tmp0_); + g_object_notify ((GObject *) self, "uri"); +} + + +const char* fetch_file_get_intended_property (FetchFile* self) { + const char* result; + g_return_val_if_fail (self != NULL, NULL); + result = self->priv->_intended_property; + return result; +} + + +static void fetch_file_set_intended_property (FetchFile* self, const char* value) { + char* _tmp0_; + g_return_if_fail (self != NULL); + self->priv->_intended_property = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_intended_property), _tmp0_); + g_object_notify ((GObject *) self, "intended-property"); +} + + +static GObject * fetch_file_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) { + GObject * obj; + GObjectClass * parent_class; + FetchFile * self; + parent_class = G_OBJECT_CLASS (fetch_file_parent_class); + obj = parent_class->constructor (type, n_construct_properties, construct_properties); + self = FETCH_FILE (obj); + { + GFile* _tmp0_; + GByteArray* _tmp1_; + self->priv->file = (_tmp0_ = g_file_new_for_uri (self->priv->_uri), _g_object_unref0 (self->priv->file), _tmp0_); + self->priv->data = (_tmp1_ = g_byte_array_new (), _g_byte_array_free0 (self->priv->data), _tmp1_); + } + return obj; +} + + +static void fetch_file_class_init (FetchFileClass * klass) { + fetch_file_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (FetchFilePrivate)); + G_OBJECT_CLASS (klass)->get_property = fetch_file_get_property; + G_OBJECT_CLASS (klass)->set_property = fetch_file_set_property; + G_OBJECT_CLASS (klass)->constructor = fetch_file_constructor; + G_OBJECT_CLASS (klass)->finalize = fetch_file_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), FETCH_FILE_URI, g_param_spec_string ("uri", "uri", "uri", NULL, 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), FETCH_FILE_INTENDED_PROPERTY, g_param_spec_string ("intended-property", "intended-property", "intended-property", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_signal_new ("failed", TYPE_FETCH_FILE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); + g_signal_new ("completed", TYPE_FETCH_FILE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__POINTER_STRING, G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_STRING); +} + + +static void fetch_file_instance_init (FetchFile * self) { + self->priv = FETCH_FILE_GET_PRIVATE (self); +} + + +static void fetch_file_finalize (GObject* obj) { + FetchFile * self; + self = FETCH_FILE (obj); + _g_free0 (self->priv->_uri); + _g_free0 (self->priv->_intended_property); + _g_object_unref0 (self->priv->stream); + _g_object_unref0 (self->priv->file); + _g_byte_array_free0 (self->priv->data); + G_OBJECT_CLASS (fetch_file_parent_class)->finalize (obj); +} + + +GType fetch_file_get_type (void) { + static volatile gsize fetch_file_type_id__volatile = 0; + if (g_once_init_enter (&fetch_file_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (FetchFileClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) fetch_file_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FetchFile), 0, (GInstanceInitFunc) fetch_file_instance_init, NULL }; + GType fetch_file_type_id; + fetch_file_type_id = g_type_register_static (G_TYPE_OBJECT, "FetchFile", &g_define_type_info, 0); + g_once_init_leave (&fetch_file_type_id__volatile, fetch_file_type_id); + } + return fetch_file_type_id__volatile; +} + + +static void fetch_file_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + FetchFile * self; + self = FETCH_FILE (object); + switch (property_id) { + case FETCH_FILE_URI: + g_value_set_string (value, fetch_file_get_uri (self)); + break; + case FETCH_FILE_INTENDED_PROPERTY: + g_value_set_string (value, fetch_file_get_intended_property (self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void fetch_file_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + FetchFile * self; + self = FETCH_FILE (object); + switch (property_id) { + case FETCH_FILE_URI: + fetch_file_set_uri (self, g_value_get_string (value)); + break; + case FETCH_FILE_INTENDED_PROPERTY: + fetch_file_set_intended_property (self, g_value_get_string (value)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + + +static void g_cclosure_user_marshal_VOID__POINTER_STRING (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data) { + typedef void (*GMarshalFunc_VOID__POINTER_STRING) (gpointer data1, gpointer arg_1, const char* arg_2, gpointer data2); + register GMarshalFunc_VOID__POINTER_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__POINTER_STRING) (marshal_data ? marshal_data : cc->callback); + callback (data1, g_value_get_pointer (param_values + 1), g_value_get_string (param_values + 2), data2); +} + + + diff --git a/src/metadata-menu-item.c b/src/metadata-menu-item.c new file mode 100644 index 0000000..5cb2d03 --- /dev/null +++ b/src/metadata-menu-item.c @@ -0,0 +1,502 @@ +/* metadata-menu-item.c generated by valac 0.10.0, the Vala compiler + * generated from metadata-menu-item.vala, do not modify */ + +/* +Copyright 2010 Canonical Ltd. + +Authors: + Conor Curran <conor.curran@canonical.com> + +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published +by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include <glib.h> +#include <glib-object.h> +#include <libdbusmenu-glib/client.h> +#include <libdbusmenu-glib/menuitem-proxy.h> +#include <libdbusmenu-glib/menuitem.h> +#include <libdbusmenu-glib/server.h> +#include <stdlib.h> +#include <string.h> +#include <common-defs.h> +#include <gee.h> +#include <gio/gio.h> +#include <gdk-pixbuf/gdk-pixdata.h> +#include <glib/gstdio.h> + + +#define TYPE_PLAYER_ITEM (player_item_get_type ()) +#define PLAYER_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYER_ITEM, PlayerItem)) +#define PLAYER_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYER_ITEM, PlayerItemClass)) +#define IS_PLAYER_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYER_ITEM)) +#define IS_PLAYER_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYER_ITEM)) +#define PLAYER_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYER_ITEM, PlayerItemClass)) + +typedef struct _PlayerItem PlayerItem; +typedef struct _PlayerItemClass PlayerItemClass; +typedef struct _PlayerItemPrivate PlayerItemPrivate; + +#define TYPE_METADATA_MENUITEM (metadata_menuitem_get_type ()) +#define METADATA_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_METADATA_MENUITEM, MetadataMenuitem)) +#define METADATA_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_METADATA_MENUITEM, MetadataMenuitemClass)) +#define IS_METADATA_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_METADATA_MENUITEM)) +#define IS_METADATA_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_METADATA_MENUITEM)) +#define METADATA_MENUITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_METADATA_MENUITEM, MetadataMenuitemClass)) + +typedef struct _MetadataMenuitem MetadataMenuitem; +typedef struct _MetadataMenuitemClass MetadataMenuitemClass; +typedef struct _MetadataMenuitemPrivate MetadataMenuitemPrivate; + +#define TYPE_FETCH_FILE (fetch_file_get_type ()) +#define FETCH_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FETCH_FILE, FetchFile)) +#define FETCH_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FETCH_FILE, FetchFileClass)) +#define IS_FETCH_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FETCH_FILE)) +#define IS_FETCH_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FETCH_FILE)) +#define FETCH_FILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FETCH_FILE, FetchFileClass)) + +typedef struct _FetchFile FetchFile; +typedef struct _FetchFileClass FetchFileClass; +#define _g_free0(var) (var = (g_free (var), NULL)) +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) + +struct _PlayerItem { + DbusmenuMenuitem parent_instance; + PlayerItemPrivate * priv; +}; + +struct _PlayerItemClass { + DbusmenuMenuitemClass parent_class; +}; + +struct _MetadataMenuitem { + PlayerItem parent_instance; + MetadataMenuitemPrivate * priv; +}; + +struct _MetadataMenuitemClass { + PlayerItemClass parent_class; +}; + +struct _MetadataMenuitemPrivate { + char* previous_temp_album_art_path; +}; + + +extern char* metadata_menuitem_album_art_cache_dir; +char* metadata_menuitem_album_art_cache_dir = NULL; +static FetchFile* metadata_menuitem_fetcher; +static FetchFile* metadata_menuitem_fetcher = NULL; +static gpointer metadata_menuitem_parent_class = NULL; + +GType player_item_get_type (void) G_GNUC_CONST; +GType metadata_menuitem_get_type (void) G_GNUC_CONST; +#define METADATA_MENUITEM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_METADATA_MENUITEM, MetadataMenuitemPrivate)) +enum { + METADATA_MENUITEM_DUMMY_PROPERTY +}; +GType fetch_file_get_type (void) G_GNUC_CONST; +#define METADATA_MENUITEM_ALBUM_ART_DIR_SUFFIX "indicators/sound/album-art-cache" +MetadataMenuitem* metadata_menuitem_new (void); +MetadataMenuitem* metadata_menuitem_construct (GType object_type); +void player_item_reset (PlayerItem* self, GeeHashSet* attrs); +GeeHashSet* metadata_menuitem_attributes_format (void); +static void metadata_menuitem_clean_album_art_temp_dir (void); +static gboolean metadata_menuitem_delete_album_art_contents (GFile* dir); +static char* metadata_menuitem_create_album_art_temp_dir (void); +void metadata_menuitem_fetch_art (MetadataMenuitem* self, const char* uri, const char* prop); +FetchFile* fetch_file_new (const char* uri, const char* prop); +FetchFile* fetch_file_construct (GType object_type, const char* uri, const char* prop); +static void _lambda0_ (MetadataMenuitem* self); +static void metadata_menuitem_on_fetcher_failed (MetadataMenuitem* self); +static void __lambda0__fetch_file_failed (FetchFile* _sender, gpointer self); +static void metadata_menuitem_on_fetcher_completed (MetadataMenuitem* self, GByteArray* update, const char* property); +static void _metadata_menuitem_on_fetcher_completed_fetch_file_completed (FetchFile* _sender, GByteArray* data, const char* property, gpointer self); +void fetch_file_fetch_data (FetchFile* self, GAsyncReadyCallback _callback_, gpointer _user_data_); +void fetch_file_fetch_data_finish (FetchFile* self, GAsyncResult* _res_); +static GObject * metadata_menuitem_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); +static void metadata_menuitem_finalize (GObject* obj); + + + +MetadataMenuitem* metadata_menuitem_construct (GType object_type) { + MetadataMenuitem * self; + GeeHashSet* _tmp0_; + self = (MetadataMenuitem*) g_object_new (object_type, "item-type", DBUSMENU_METADATA_MENUITEM_TYPE, NULL); + player_item_reset ((PlayerItem*) self, _tmp0_ = metadata_menuitem_attributes_format ()); + _g_object_unref0 (_tmp0_); + return self; +} + + +MetadataMenuitem* metadata_menuitem_new (void) { + return metadata_menuitem_construct (TYPE_METADATA_MENUITEM); +} + + +static void metadata_menuitem_clean_album_art_temp_dir (void) { + char* path; + GFile* album_art_dir; + path = g_build_filename (g_get_user_cache_dir (), METADATA_MENUITEM_ALBUM_ART_DIR_SUFFIX, NULL); + album_art_dir = g_file_new_for_path (path); + if (metadata_menuitem_delete_album_art_contents (album_art_dir) == FALSE) { + g_warning ("metadata-menu-item.vala:52: could not remove the temp album art files " \ +"%s", path); + } + _g_object_unref0 (album_art_dir); + _g_free0 (path); +} + + +static char* metadata_menuitem_create_album_art_temp_dir (void) { + char* result = NULL; + char* path; + path = g_build_filename (g_get_user_cache_dir (), METADATA_MENUITEM_ALBUM_ART_DIR_SUFFIX, NULL); + if (g_mkdir (path, 0700) == (-1)) { + g_warning ("metadata-menu-item.vala:60: could not create a temp dir for remote alb" \ +"um art, it must have been created already"); + } + result = path; + return result; +} + + +static const char* string_to_string (const char* self) { + const char* result = NULL; + g_return_val_if_fail (self != NULL, NULL); + result = self; + return result; +} + + +static gboolean metadata_menuitem_delete_album_art_contents (GFile* dir) { + gboolean result = FALSE; + gboolean _result_; + GError * _inner_error_ = NULL; + g_return_val_if_fail (dir != NULL, FALSE); + _result_ = TRUE; + { + GFileEnumerator* e; + e = g_file_enumerate_children (dir, G_FILE_ATTRIBUTE_STANDARD_NAME, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL, &_inner_error_); + if (_inner_error_ != NULL) { + goto __catch0_g_error; + } + while (TRUE) { + GFileInfo* file; + GFile* child; + file = g_file_enumerator_next_file (e, NULL, &_inner_error_); + if (_inner_error_ != NULL) { + _g_object_unref0 (e); + goto __catch0_g_error; + } + g_debug ("metadata-menu-item.vala:76: file name = %s", g_file_info_get_name (file)); + if (file == NULL) { + _g_object_unref0 (file); + break; + } + child = g_file_get_child (dir, g_file_info_get_name (file)); + { + g_file_delete (child, NULL, &_inner_error_); + if (_inner_error_ != NULL) { + goto __catch1_g_error; + } + } + goto __finally1; + __catch1_g_error: + { + GError * error_; + error_ = _inner_error_; + _inner_error_ = NULL; + { + char* _tmp0_; + char* _tmp1_; + g_warning ("metadata-menu-item.vala:86: %s", _tmp1_ = g_strconcat ("Unable to delete file '", string_to_string (_tmp0_ = g_file_get_basename (child)), ": ", string_to_string (error_->message), NULL)); + _g_free0 (_tmp1_); + _g_free0 (_tmp0_); + _result_ = FALSE; + _g_error_free0 (error_); + } + } + __finally1: + if (_inner_error_ != NULL) { + _g_object_unref0 (child); + _g_object_unref0 (file); + _g_object_unref0 (e); + goto __catch0_g_error; + } + _g_object_unref0 (child); + _g_object_unref0 (file); + } + _g_object_unref0 (e); + } + goto __finally0; + __catch0_g_error: + { + GError * _error_; + _error_ = _inner_error_; + _inner_error_ = NULL; + { + char* _tmp2_; + char* _tmp3_; + g_warning (_tmp3_ = g_strconcat ("Unable to read files from directory '", string_to_string (_tmp2_ = g_file_get_basename (dir)), "': %s", NULL), _error_->message); + _g_free0 (_tmp3_); + _g_free0 (_tmp2_); + _result_ = FALSE; + _g_error_free0 (_error_); + } + } + __finally0: + 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 char* string_strip (const char* self) { + char* result = NULL; + char* _result_; + g_return_val_if_fail (self != NULL, NULL); + _result_ = g_strdup (self); + g_strstrip (_result_); + result = _result_; + return result; +} + + +static void _lambda0_ (MetadataMenuitem* self) { + metadata_menuitem_on_fetcher_failed (self); +} + + +static void __lambda0__fetch_file_failed (FetchFile* _sender, gpointer self) { + _lambda0_ (self); +} + + +static void _metadata_menuitem_on_fetcher_completed_fetch_file_completed (FetchFile* _sender, GByteArray* data, const char* property, gpointer self) { + metadata_menuitem_on_fetcher_completed (self, data, property); +} + + +void metadata_menuitem_fetch_art (MetadataMenuitem* self, const char* uri, const char* prop) { + GFile* art_file; + FetchFile* _tmp4_; + GError * _inner_error_ = NULL; + g_return_if_fail (self != NULL); + g_return_if_fail (uri != NULL); + g_return_if_fail (prop != NULL); + art_file = g_file_new_for_uri (uri); + if (g_file_is_native (art_file) == TRUE) { + char* path; + path = NULL; + { + char* _tmp0_; + char* _tmp1_; + char* _tmp2_; + char* _tmp3_; + _tmp2_ = (_tmp1_ = g_filename_from_uri (_tmp0_ = string_strip (uri), NULL, &_inner_error_), _g_free0 (_tmp0_), _tmp1_); + if (_inner_error_ != NULL) { + if (_inner_error_->domain == G_CONVERT_ERROR) { + goto __catch2_g_convert_error; + } + _g_free0 (path); + _g_object_unref0 (art_file); + 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; + } + path = (_tmp3_ = _tmp2_, _g_free0 (path), _tmp3_); + dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, prop, path); + } + goto __finally2; + __catch2_g_convert_error: + { + GError * e; + e = _inner_error_; + _inner_error_ = NULL; + { + g_warning ("metadata-menu-item.vala:108: Problem converting URI %s to file path", uri); + _g_error_free0 (e); + } + } + __finally2: + if (_inner_error_ != NULL) { + _g_free0 (path); + _g_object_unref0 (art_file); + 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; + } + _g_free0 (path); + _g_object_unref0 (art_file); + return; + } + g_debug ("metadata-menu-item.vala:114: fetch_art -remotely %s", metadata_menuitem_album_art_cache_dir); + if (metadata_menuitem_album_art_cache_dir == NULL) { + _g_object_unref0 (art_file); + return; + } + metadata_menuitem_fetcher = (_tmp4_ = fetch_file_new (uri, prop), _g_object_unref0 (metadata_menuitem_fetcher), _tmp4_); + g_signal_connect_object (metadata_menuitem_fetcher, "failed", (GCallback) __lambda0__fetch_file_failed, self, 0); + g_signal_connect_object (metadata_menuitem_fetcher, "completed", (GCallback) _metadata_menuitem_on_fetcher_completed_fetch_file_completed, self, 0); + fetch_file_fetch_data (metadata_menuitem_fetcher, NULL, NULL); + _g_object_unref0 (art_file); +} + + +static void metadata_menuitem_on_fetcher_failed (MetadataMenuitem* self) { + g_return_if_fail (self != NULL); + g_warning ("metadata-menu-item.vala:129: on_fetcher_failed -> could not fetch artw" \ +"ork"); +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static void metadata_menuitem_on_fetcher_completed (MetadataMenuitem* self, GByteArray* update, const char* property) { + GError * _inner_error_ = NULL; + g_return_if_fail (self != NULL); + g_return_if_fail (update != NULL); + g_return_if_fail (property != NULL); + { + GdkPixbufLoader* loader; + GdkPixbuf* icon; + char* path; + gint r; + loader = gdk_pixbuf_loader_new (); + gdk_pixbuf_loader_write (loader, update->data, (gsize) update->len, &_inner_error_); + if (_inner_error_ != NULL) { + _g_object_unref0 (loader); + goto __catch3_g_error; + } + gdk_pixbuf_loader_close (loader, &_inner_error_); + if (_inner_error_ != NULL) { + _g_object_unref0 (loader); + goto __catch3_g_error; + } + icon = _g_object_ref0 (gdk_pixbuf_loader_get_pixbuf (loader)); + path = g_strconcat (metadata_menuitem_album_art_cache_dir, "/downloaded-coverart-XXXXXX", NULL); + r = g_mkstemp (path); + if (r != (-1)) { + char* _tmp0_; + gdk_pixbuf_save (icon, path, gdk_pixbuf_format_get_name (gdk_pixbuf_loader_get_format (loader)), &_inner_error_, NULL); + if (_inner_error_ != NULL) { + _g_free0 (path); + _g_object_unref0 (icon); + _g_object_unref0 (loader); + goto __catch3_g_error; + } + dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, property, path); + if (self->priv->previous_temp_album_art_path != NULL) { + g_remove (self->priv->previous_temp_album_art_path); + } + self->priv->previous_temp_album_art_path = (_tmp0_ = g_strdup (path), _g_free0 (self->priv->previous_temp_album_art_path), _tmp0_); + } + _g_free0 (path); + _g_object_unref0 (icon); + _g_object_unref0 (loader); + } + goto __finally3; + __catch3_g_error: + { + GError * e; + e = _inner_error_; + _inner_error_ = NULL; + { + g_warning ("metadata-menu-item.vala:151: Problem creating file from bytearray fetc" \ +"hed from the interweb - error: %s", e->message); + _g_error_free0 (e); + } + } + __finally3: + 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; + } +} + + +GeeHashSet* metadata_menuitem_attributes_format (void) { + GeeHashSet* result = NULL; + GeeHashSet* attrs; + attrs = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL); + gee_abstract_collection_add ((GeeAbstractCollection*) attrs, DBUSMENU_METADATA_MENUITEM_TITLE); + gee_abstract_collection_add ((GeeAbstractCollection*) attrs, DBUSMENU_METADATA_MENUITEM_ARTIST); + gee_abstract_collection_add ((GeeAbstractCollection*) attrs, DBUSMENU_METADATA_MENUITEM_ALBUM); + gee_abstract_collection_add ((GeeAbstractCollection*) attrs, DBUSMENU_METADATA_MENUITEM_ARTURL); + result = attrs; + return result; +} + + +static GObject * metadata_menuitem_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) { + GObject * obj; + GObjectClass * parent_class; + MetadataMenuitem * self; + parent_class = G_OBJECT_CLASS (metadata_menuitem_parent_class); + obj = parent_class->constructor (type, n_construct_properties, construct_properties); + self = METADATA_MENUITEM (obj); + { + char* _tmp0_; + char* _tmp1_; + metadata_menuitem_clean_album_art_temp_dir (); + self->priv->previous_temp_album_art_path = (_tmp0_ = NULL, _g_free0 (self->priv->previous_temp_album_art_path), _tmp0_); + metadata_menuitem_album_art_cache_dir = (_tmp1_ = metadata_menuitem_create_album_art_temp_dir (), _g_free0 (metadata_menuitem_album_art_cache_dir), _tmp1_); + } + return obj; +} + + +static void metadata_menuitem_class_init (MetadataMenuitemClass * klass) { + metadata_menuitem_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (MetadataMenuitemPrivate)); + G_OBJECT_CLASS (klass)->constructor = metadata_menuitem_constructor; + G_OBJECT_CLASS (klass)->finalize = metadata_menuitem_finalize; +} + + +static void metadata_menuitem_instance_init (MetadataMenuitem * self) { + self->priv = METADATA_MENUITEM_GET_PRIVATE (self); +} + + +static void metadata_menuitem_finalize (GObject* obj) { + MetadataMenuitem * self; + self = METADATA_MENUITEM (obj); + _g_free0 (self->priv->previous_temp_album_art_path); + G_OBJECT_CLASS (metadata_menuitem_parent_class)->finalize (obj); +} + + +GType metadata_menuitem_get_type (void) { + static volatile gsize metadata_menuitem_type_id__volatile = 0; + if (g_once_init_enter (&metadata_menuitem_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (MetadataMenuitemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) metadata_menuitem_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MetadataMenuitem), 0, (GInstanceInitFunc) metadata_menuitem_instance_init, NULL }; + GType metadata_menuitem_type_id; + metadata_menuitem_type_id = g_type_register_static (TYPE_PLAYER_ITEM, "MetadataMenuitem", &g_define_type_info, 0); + g_once_init_leave (&metadata_menuitem_type_id__volatile, metadata_menuitem_type_id); + } + return metadata_menuitem_type_id__volatile; +} + + + + diff --git a/src/mpris2-controller.c b/src/mpris2-controller.c new file mode 100644 index 0000000..1ee4ebf --- /dev/null +++ b/src/mpris2-controller.c @@ -0,0 +1,4971 @@ +/* mpris2-controller.c generated by valac 0.10.0, the Vala compiler + * generated from mpris2-controller.vala, do not modify */ + +/* +Copyright 2010 Canonical Ltd. + +Authors: + Conor Curran <conor.curran@canonical.com> + +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published +by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include <glib.h> +#include <glib-object.h> +#include <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 <gee.h> +#include <libdbusmenu-glib/client.h> +#include <libdbusmenu-glib/menuitem-proxy.h> +#include <libdbusmenu-glib/menuitem.h> +#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)) +#define FREE_DESKTOP_PROPERTIES_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_FREE_DESKTOP_PROPERTIES, FreeDesktopPropertiesIface)) + +typedef struct _FreeDesktopProperties FreeDesktopProperties; +typedef struct _FreeDesktopPropertiesIface FreeDesktopPropertiesIface; +typedef struct _FreeDesktopPropertiesDBusProxy FreeDesktopPropertiesDBusProxy; +typedef DBusGProxyClass FreeDesktopPropertiesDBusProxyClass; + +#define TYPE_MPRIS2_CONTROLLER (mpris2_controller_get_type ()) +#define MPRIS2_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS2_CONTROLLER, Mpris2Controller)) +#define MPRIS2_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS2_CONTROLLER, Mpris2ControllerClass)) +#define IS_MPRIS2_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS2_CONTROLLER)) +#define IS_MPRIS2_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS2_CONTROLLER)) +#define MPRIS2_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS2_CONTROLLER, Mpris2ControllerClass)) + +typedef struct _Mpris2Controller Mpris2Controller; +typedef struct _Mpris2ControllerClass Mpris2ControllerClass; +typedef struct _Mpris2ControllerPrivate Mpris2ControllerPrivate; + +#define TYPE_PLAYER_CONTROLLER (player_controller_get_type ()) +#define PLAYER_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYER_CONTROLLER, PlayerController)) +#define PLAYER_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYER_CONTROLLER, PlayerControllerClass)) +#define IS_PLAYER_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYER_CONTROLLER)) +#define IS_PLAYER_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYER_CONTROLLER)) +#define PLAYER_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYER_CONTROLLER, PlayerControllerClass)) + +typedef struct _PlayerController PlayerController; +typedef struct _PlayerControllerClass PlayerControllerClass; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) + +#define TRANSPORT_MENUITEM_TYPE_STATE (transport_menuitem_state_get_type ()) +typedef struct _PlayerControllerPrivate PlayerControllerPrivate; + +#define TYPE_PLAYER_ITEM (player_item_get_type ()) +#define PLAYER_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYER_ITEM, PlayerItem)) +#define PLAYER_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYER_ITEM, PlayerItemClass)) +#define IS_PLAYER_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYER_ITEM)) +#define IS_PLAYER_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYER_ITEM)) +#define PLAYER_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYER_ITEM, PlayerItemClass)) + +typedef struct _PlayerItem PlayerItem; +typedef struct _PlayerItemClass PlayerItemClass; + +#define PLAYER_CONTROLLER_TYPE_WIDGET_ORDER (player_controller_widget_order_get_type ()) + +#define TYPE_TRANSPORT_MENUITEM (transport_menuitem_get_type ()) +#define TRANSPORT_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TRANSPORT_MENUITEM, TransportMenuitem)) +#define TRANSPORT_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TRANSPORT_MENUITEM, TransportMenuitemClass)) +#define IS_TRANSPORT_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TRANSPORT_MENUITEM)) +#define IS_TRANSPORT_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TRANSPORT_MENUITEM)) +#define TRANSPORT_MENUITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TRANSPORT_MENUITEM, TransportMenuitemClass)) + +typedef struct _TransportMenuitem TransportMenuitem; +typedef struct _TransportMenuitemClass TransportMenuitemClass; +#define __vala_GValue_free0(var) ((var == NULL) ? NULL : (var = (_vala_GValue_free (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 _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); + char* (*get_Identity) (MprisRoot* self); + void (*set_Identity) (MprisRoot* self, const char* value); + char* (*get_DesktopEntry) (MprisRoot* self); + void (*set_DesktopEntry) (MprisRoot* self, const char* 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_); + 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); + char* (*get_PlaybackStatus) (MprisPlayer* self); + void (*set_PlaybackStatus) (MprisPlayer* self, const char* 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; +}; + +typedef enum { + TRANSPORT_MENUITEM_STATE_PLAYING, + TRANSPORT_MENUITEM_STATE_PAUSED +} TransportMenuitemstate; + +struct _PlayerController { + GObject parent_instance; + PlayerControllerPrivate * priv; + gint current_state; + GeeArrayList* custom_items; + Mpris2Controller* mpris_bridge; +}; + +struct _PlayerControllerClass { + GObjectClass parent_class; +}; + +typedef enum { + PLAYER_CONTROLLER_WIDGET_ORDER_SEPARATOR, + PLAYER_CONTROLLER_WIDGET_ORDER_TITLE, + PLAYER_CONTROLLER_WIDGET_ORDER_METADATA, + PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT +} PlayerControllerwidget_order; + +typedef enum { + TRANSPORT_MENUITEM_ACTION_PREVIOUS, + TRANSPORT_MENUITEM_ACTION_PLAY_PAUSE, + TRANSPORT_MENUITEM_ACTION_NEXT +} TransportMenuitemaction; + + +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); +char* mpris_root_get_Identity (MprisRoot* self); +void mpris_root_set_Identity (MprisRoot* self, const char* value); +char* mpris_root_get_DesktopEntry (MprisRoot* self); +void mpris_root_set_DesktopEntry (MprisRoot* self, const char* 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 char* mpris_root_dbus_proxy_get_Identity (MprisRoot* self); +static void mpris_root_dbus_proxy_set_Identity (MprisRoot* self, const char* value); +static char* mpris_root_dbus_proxy_get_DesktopEntry (MprisRoot* self); +static void mpris_root_dbus_proxy_set_DesktopEntry (MprisRoot* self, const char* value); +static void mpris_root_dbus_proxy_mpris_root__interface_init (MprisRootIface* iface); +static void mpris_root_dbus_proxy_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void 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); +char* mpris_player_get_PlaybackStatus (MprisPlayer* self); +void mpris_player_set_PlaybackStatus (MprisPlayer* self, const char* value); +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 char* mpris_player_dbus_proxy_get_PlaybackStatus (MprisPlayer* self); +static void mpris_player_dbus_proxy_set_PlaybackStatus (MprisPlayer* self, const char* value); +static void mpris_player_dbus_proxy_mpris_player__interface_init (MprisPlayerIface* iface); +static void mpris_player_dbus_proxy_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void 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); +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 char* source, GHashTable* changed_properties, char** 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 free_desktop_properties_dbus_proxy_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void free_desktop_properties_dbus_proxy_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +GType mpris2_controller_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 +}; +#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 char* interface_source, GHashTable* changed_properties, char** invalid, int invalid_length1); +PlayerController* mpris2_controller_get_owner (Mpris2Controller* self); +const char* player_controller_get_mpris_name (PlayerController* self); +static GValue* _g_value_dup (GValue* self); +MprisPlayer* mpris2_controller_get_player (Mpris2Controller* self); +GType transport_menuitem_state_get_type (void) G_GNUC_CONST; +static TransportMenuitemstate mpris2_controller_determine_play_state (Mpris2Controller* self, const char* status); +GType player_item_get_type (void) G_GNUC_CONST; +GType player_controller_widget_order_get_type (void) G_GNUC_CONST; +GType transport_menuitem_get_type (void) G_GNUC_CONST; +void transport_menuitem_change_play_state (TransportMenuitem* self, TransportMenuitemstate update); +static GHashTable* mpris2_controller_clean_metadata (Mpris2Controller* self); +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); +static char** _vala_array_dup1 (char** self, int length); +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); +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); +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_property_changed_cb_free_desktop_properties_properties_changed (FreeDesktopProperties* _sender, const char* source, GHashTable* changed_properties, char** invalid, int invalid_length1, gpointer self); +static GObject * mpris2_controller_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); +static void mpris2_controller_finalize (GObject* obj); +static void mpris2_controller_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void mpris2_controller_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func); +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func); +static int _vala_strcmp0 (const char * str1, const char * str2); + +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}; + +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 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 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); +} + + +char* mpris_root_get_Identity (MprisRoot* self) { + return MPRIS_ROOT_GET_INTERFACE (self)->get_Identity (self); +} + + +void mpris_root_set_Identity (MprisRoot* self, const char* value) { + MPRIS_ROOT_GET_INTERFACE (self)->set_Identity (self, value); +} + + +char* mpris_root_get_DesktopEntry (MprisRoot* self) { + return MPRIS_ROOT_GET_INTERFACE (self)->get_DesktopEntry (self); +} + + +void mpris_root_set_DesktopEntry (MprisRoot* self, const char* 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)) { + char* 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)) { + char* 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)) { + char* 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)) { + char* 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); + } + { + char* 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); + } + { + char* 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 = mpris_root_dbus_proxy_get_property; + G_OBJECT_CLASS (klass)->set_property = 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; + gint _ecode; + 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; + gint _ecode; + 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 char* 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_; + char* _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 char* 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 char* 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_; + char* _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 char* 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 mpris_root_dbus_proxy_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { +} + + +static void 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); +} + + +char* mpris_player_get_PlaybackStatus (MprisPlayer* self) { + return MPRIS_PLAYER_GET_INTERFACE (self)->get_PlaybackStatus (self); +} + + +void mpris_player_set_PlaybackStatus (MprisPlayer* self, const char* value) { + MPRIS_PLAYER_GET_INTERFACE (self)->set_PlaybackStatus (self, value); +} + + +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_)) { + char* _key; + GValue* _value; + const char* _tmp7_; + DBusMessageIter _tmp8_; + dbus_message_iter_open_container (&_tmp2_, DBUS_TYPE_DICT_ENTRY, NULL, &_tmp3_); + _key = (char*) _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 char** _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)) { + char* 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_)) { + char* _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 char** _tmp43_; + int _tmp43__length; + int _tmp43__size; + int _tmp43__length1; + DBusMessageIter _tmp44_; + _tmp43_ = g_new (const char*, 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 char*, _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)) { + char* 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_)) { + char* _key; + GValue* _value; + const char* _tmp54_; + DBusMessageIter _tmp55_; + dbus_message_iter_open_container (&_tmp49_, DBUS_TYPE_DICT_ENTRY, NULL, &_tmp50_); + _key = (char*) _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 char** _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); + } + { + char* 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 = mpris_player_dbus_proxy_get_property; + G_OBJECT_CLASS (klass)->set_property = 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; + gint _ecode; + 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; + gint _ecode; + 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; + gint _ecode; + 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_)) { + char* _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 char** _tmp56_; + int _tmp56__length; + int _tmp56__size; + int _tmp56__length1; + DBusMessageIter _tmp57_; + _tmp56_ = g_new (const char*, 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 char*, _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_)) { + char* _key; + GValue* _value; + const char* _tmp66_; + DBusMessageIter _tmp67_; + dbus_message_iter_open_container (&_tmp61_, DBUS_TYPE_DICT_ENTRY, NULL, &_tmp62_); + _key = (char*) _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 char** _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 char* 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_; + char* _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 char* 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 mpris_player_dbus_proxy_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { +} + + +static void mpris_player_dbus_proxy_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { +} + + +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 char* source, GHashTable* changed_properties, char** invalid, int invalid_length1, DBusConnection* _connection) { + const char * _path; + DBusMessage *_message; + DBusMessageIter _iter; + const char* _tmp1_; + DBusMessageIter _tmp2_, _tmp3_; + GHashTableIter _tmp4_; + gpointer _tmp5_, _tmp6_; + char** _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_)) { + char* _key; + GValue* _value; + const char* _tmp7_; + DBusMessageIter _tmp8_; + dbus_message_iter_open_container (&_tmp2_, DBUS_TYPE_DICT_ENTRY, NULL, &_tmp3_); + _key = (char*) _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 char** _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)); + } +} + + +GType free_desktop_properties_get_type (void) { + static volatile gsize free_desktop_properties_type_id__volatile = 0; + if (g_once_init_enter (&free_desktop_properties_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (FreeDesktopPropertiesIface), (GBaseInitFunc) free_desktop_properties_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL }; + GType free_desktop_properties_type_id; + free_desktop_properties_type_id = g_type_register_static (G_TYPE_INTERFACE, "FreeDesktopProperties", &g_define_type_info, 0); + g_type_interface_add_prerequisite (free_desktop_properties_type_id, 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_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; +} + + +static void _dbus_handle_free_desktop_properties_properties_changed (FreeDesktopProperties* self, DBusConnection* connection, DBusMessage* message) { + DBusMessageIter iter; + char* source = NULL; + const char* _tmp92_; + GHashTable* changed_properties = NULL; + GHashTable* _tmp93_; + DBusMessageIter _tmp94_; + DBusMessageIter _tmp95_; + char** invalid = NULL; + int invalid_length1; + char** _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_)) { + char* _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 char** _tmp111_; + int _tmp111__length; + int _tmp111__size; + int _tmp111__length1; + DBusMessageIter _tmp112_; + _tmp111_ = g_new (const char*, 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 char*, _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_; + invalid_length1 = 0; + _tmp114_ = g_new (char*, 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 (char*, _tmp114_, _tmp114__size + 1); + } + dbus_message_iter_get_basic (&_tmp115_, &_tmp116_); + dbus_message_iter_next (&_tmp115_); + _tmp114_[_tmp114__length++] = g_strdup (_tmp116_); + } + invalid_length1 = _tmp114__length1; + _tmp114_[_tmp114__length] = NULL; + dbus_message_iter_next (&iter); + invalid = _tmp114_; + g_signal_emit_by_name (self, "properties-changed", source, changed_properties, invalid, invalid_length1); + _g_free0 (source); + _g_hash_table_unref0 (changed_properties); + invalid = (_vala_array_free (invalid, invalid_length1, (GDestroyNotify) g_free), NULL); +} + + +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); + } + } + 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_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 = free_desktop_properties_dbus_proxy_get_property; + G_OBJECT_CLASS (klass)->set_property = free_desktop_properties_dbus_proxy_set_property; +} + + +static void free_desktop_properties_dbus_proxy_init (FreeDesktopPropertiesDBusProxy* self) { +} + + +static void free_desktop_properties_dbus_proxy_free_desktop_properties__interface_init (FreeDesktopPropertiesIface* iface) { +} + + +static void free_desktop_properties_dbus_proxy_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { +} + + +static void free_desktop_properties_dbus_proxy_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { +} + + +Mpris2Controller* mpris2_controller_construct (GType object_type, PlayerController* ctrl) { + Mpris2Controller * self; + g_return_val_if_fail (ctrl != NULL, NULL); + self = (Mpris2Controller*) g_object_new (object_type, "owner", ctrl, NULL); + return self; +} + + +Mpris2Controller* mpris2_controller_new (PlayerController* ctrl) { + return mpris2_controller_construct (TYPE_MPRIS2_CONTROLLER, 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 void _vala_GValue_free (GValue* self) { + g_value_unset (self); + g_free (self); +} + + +void mpris2_controller_property_changed_cb (Mpris2Controller* self, const char* interface_source, GHashTable* changed_properties, char** invalid, int invalid_length1) { + gboolean _tmp0_ = FALSE; + GValue* play_v; + GValue* meta_v; + g_return_if_fail (self != NULL); + g_return_if_fail (interface_source != NULL); + g_return_if_fail (changed_properties != NULL); + g_debug ("mpris2-controller.vala:95: properties-changed for interface %s and own" \ +"er %s", interface_source, player_controller_get_mpris_name (self->priv->_owner)); + if (changed_properties == NULL) { + _tmp0_ = TRUE; + } else { + _tmp0_ = g_str_has_prefix (interface_source, MPRIS2_CONTROLLER_root_interface) == FALSE; + } + if (_tmp0_) { + g_warning ("mpris2-controller.vala:98: Property-changed hash is null or this is an" \ +" interface that doesn't concerns us"); + return; + } + play_v = __g_value_dup0 ((GValue*) g_hash_table_lookup (changed_properties, "PlaybackStatus")); + if (play_v != NULL) { + char* state; + TransportMenuitemstate p; + PlayerItem* _tmp1_; + TransportMenuitem* _tmp2_; + state = mpris_player_get_PlaybackStatus (self->priv->_player); + p = (TransportMenuitemstate) mpris2_controller_determine_play_state (self, state); + transport_menuitem_change_play_state (_tmp2_ = (_tmp1_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT), IS_TRANSPORT_MENUITEM (_tmp1_) ? ((TransportMenuitem*) _tmp1_) : NULL), p); + _g_object_unref0 (_tmp2_); + _g_free0 (state); + } + meta_v = __g_value_dup0 ((GValue*) g_hash_table_lookup (changed_properties, "Metadata")); + if (meta_v != NULL) { + GHashTable* changed_updates; + PlayerItem* metadata; + GeeHashSet* _tmp3_; + GeeHashSet* _tmp4_; + GeeHashSet* _tmp5_; + changed_updates = mpris2_controller_clean_metadata (self); + metadata = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA); + player_item_reset (metadata, _tmp3_ = metadata_menuitem_attributes_format ()); + _g_object_unref0 (_tmp3_); + player_item_update (metadata, changed_updates, _tmp4_ = metadata_menuitem_attributes_format ()); + _g_object_unref0 (_tmp4_); + dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) metadata, DBUSMENU_MENUITEM_PROP_VISIBLE, player_item_populated (metadata, _tmp5_ = metadata_menuitem_attributes_format ())); + _g_object_unref0 (_tmp5_); + _g_object_unref0 (metadata); + _g_hash_table_unref0 (changed_updates); + } + __vala_GValue_free0 (meta_v); + __vala_GValue_free0 (play_v); +} + + +static char** _vala_array_dup1 (char** self, int length) { + char** result; + int i; + result = g_new0 (char*, length + 1); + for (i = 0; i < length; i++) { + result[i] = g_strdup (self[i]); + } + return result; +} + + +static GHashTable* mpris2_controller_clean_metadata (Mpris2Controller* self) { + GHashTable* result = NULL; + GHashTable* changed_updates; + GHashTable* _tmp0_; + GValue* _tmp1_; + GValue* artist_v; + GHashTable* _tmp7_; + GValue* _tmp8_; + GValue* length_v; + g_return_val_if_fail (self != NULL, NULL); + changed_updates = mpris_player_get_Metadata (self->priv->_player); + artist_v = (_tmp1_ = __g_value_dup0 ((GValue*) g_hash_table_lookup (_tmp0_ = mpris_player_get_Metadata (self->priv->_player), "xesam:artist")), _g_hash_table_unref0 (_tmp0_), _tmp1_); + if (artist_v != NULL) { + gint artists_length1; + gint _artists_size_; + char** _tmp5_; + GHashTable* _tmp2_; + char** _tmp3_; + char** _tmp4_; + char** artists; + char* display_artists; + GValue* _tmp6_ = NULL; + artists = (_tmp5_ = (_tmp4_ = (_tmp3_ = g_value_get_boxed ((GValue*) g_hash_table_lookup (_tmp2_ = mpris_player_get_Metadata (self->priv->_player), "xesam:artist")), (_tmp3_ == NULL) ? ((gpointer) _tmp3_) : _vala_array_dup1 (_tmp3_, g_strv_length (g_value_get_boxed ((GValue*) g_hash_table_lookup (_tmp2_ = mpris_player_get_Metadata (self->priv->_player), "xesam:artist"))))), _g_hash_table_unref0 (_tmp2_), _tmp4_), artists_length1 = g_strv_length (g_value_get_boxed ((GValue*) g_hash_table_lookup (_tmp2_ = mpris_player_get_Metadata (self->priv->_player), "xesam:artist"))), _artists_size_ = artists_length1, _tmp5_); + display_artists = g_strjoinv (", ", artists); + g_hash_table_replace (changed_updates, g_strdup ("xesam:artist"), (_tmp6_ = g_new0 (GValue, 1), g_value_init (_tmp6_, G_TYPE_STRING), g_value_set_string (_tmp6_, display_artists), _tmp6_)); + g_debug ("mpris2-controller.vala:128: artist : %s", display_artists); + _g_free0 (display_artists); + artists = (_vala_array_free (artists, artists_length1, (GDestroyNotify) g_free), NULL); + } + length_v = (_tmp8_ = __g_value_dup0 ((GValue*) g_hash_table_lookup (_tmp7_ = mpris_player_get_Metadata (self->priv->_player), "mpris:length")), _g_hash_table_unref0 (_tmp7_), _tmp8_); + if (length_v != NULL) { + GHashTable* _tmp9_; + gint64 _tmp10_; + gint64 duration; + GValue* _tmp11_ = NULL; + duration = (_tmp10_ = g_value_get_int64 ((GValue*) g_hash_table_lookup (_tmp9_ = mpris_player_get_Metadata (self->priv->_player), "mpris:length")), _g_hash_table_unref0 (_tmp9_), _tmp10_); + g_hash_table_replace (changed_updates, g_strdup ("mpris:length"), (_tmp11_ = g_new0 (GValue, 1), g_value_init (_tmp11_, G_TYPE_INT64), g_value_set_int64 (_tmp11_, duration / 1000000), _tmp11_)); + } + result = changed_updates; + __vala_GValue_free0 (length_v); + __vala_GValue_free0 (artist_v); + return result; +} + + +static TransportMenuitemstate mpris2_controller_determine_play_state (Mpris2Controller* self, const char* status) { + 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_ = _vala_strcmp0 (status, "Playing") == 0; + } else { + _tmp0_ = FALSE; + } + if (_tmp0_) { + result = TRANSPORT_MENUITEM_STATE_PLAYING; + return result; + } + result = TRANSPORT_MENUITEM_STATE_PAUSED; + return result; +} + + +void mpris2_controller_initial_update (Mpris2Controller* self) { + TransportMenuitemstate update = 0; + char* _tmp0_; + gboolean _tmp1_; + PlayerItem* _tmp3_; + TransportMenuitem* _tmp4_; + GHashTable* cleaned_metadata; + PlayerItem* _tmp5_; + GeeHashSet* _tmp6_; + g_return_if_fail (self != NULL); + if ((_tmp1_ = (_tmp0_ = mpris_player_get_PlaybackStatus (self->priv->_player)) == NULL, _g_free0 (_tmp0_), _tmp1_)) { + update = TRANSPORT_MENUITEM_STATE_PAUSED; + } else { + char* _tmp2_; + update = mpris2_controller_determine_play_state (self, _tmp2_ = mpris_player_get_PlaybackStatus (self->priv->_player)); + _g_free0 (_tmp2_); + } + transport_menuitem_change_play_state (_tmp4_ = (_tmp3_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT), IS_TRANSPORT_MENUITEM (_tmp3_) ? ((TransportMenuitem*) _tmp3_) : NULL), update); + _g_object_unref0 (_tmp4_); + cleaned_metadata = mpris2_controller_clean_metadata (self); + player_item_update (_tmp5_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), cleaned_metadata, _tmp6_ = metadata_menuitem_attributes_format ()); + _g_object_unref0 (_tmp6_); + _g_object_unref0 (_tmp5_); + _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); + if (command == TRANSPORT_MENUITEM_ACTION_PLAY_PAUSE) { + mpris_player_PlayPause (self->priv->_player, NULL, NULL); + } else { + if (command == TRANSPORT_MENUITEM_ACTION_PREVIOUS) { + mpris_player_Previous (self->priv->_player, NULL, NULL); + } else { + if (command == TRANSPORT_MENUITEM_ACTION_NEXT) { + mpris_player_Next (self->priv->_player, NULL, NULL); + } + } + } +} + + +gboolean mpris2_controller_connected (Mpris2Controller* self) { + gboolean result = FALSE; + gboolean _tmp0_ = FALSE; + g_return_val_if_fail (self != NULL, FALSE); + if (self->priv->_player != NULL) { + _tmp0_ = self->priv->_mpris2_root != NULL; + } else { + _tmp0_ = FALSE; + } + result = _tmp0_; + return result; +} + + +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) { + g_return_if_fail (self != NULL); + if (mpris2_controller_connected (self) == TRUE) { + mpris_root_Raise (self->priv->_mpris2_root, NULL, NULL); + } +} + + +MprisRoot* mpris2_controller_get_mpris2_root (Mpris2Controller* self) { + MprisRoot* result; + g_return_val_if_fail (self != NULL, NULL); + result = self->priv->_mpris2_root; + return result; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static void mpris2_controller_set_mpris2_root (Mpris2Controller* self, MprisRoot* value) { + MprisRoot* _tmp0_; + g_return_if_fail (self != NULL); + self->priv->_mpris2_root = (_tmp0_ = _g_object_ref0 (value), _g_object_unref0 (self->priv->_mpris2_root), _tmp0_); + g_object_notify ((GObject *) self, "mpris2-root"); +} + + +MprisPlayer* mpris2_controller_get_player (Mpris2Controller* self) { + MprisPlayer* result; + g_return_val_if_fail (self != NULL, NULL); + result = self->priv->_player; + return result; +} + + +static void mpris2_controller_set_player (Mpris2Controller* self, MprisPlayer* value) { + MprisPlayer* _tmp0_; + g_return_if_fail (self != NULL); + self->priv->_player = (_tmp0_ = _g_object_ref0 (value), _g_object_unref0 (self->priv->_player), _tmp0_); + g_object_notify ((GObject *) self, "player"); +} + + +PlayerController* mpris2_controller_get_owner (Mpris2Controller* self) { + PlayerController* result; + g_return_val_if_fail (self != NULL, NULL); + result = self->priv->_owner; + return result; +} + + +static void mpris2_controller_set_owner (Mpris2Controller* self, PlayerController* value) { + PlayerController* _tmp0_; + g_return_if_fail (self != NULL); + self->priv->_owner = (_tmp0_ = _g_object_ref0 (value), _g_object_unref0 (self->priv->_owner), _tmp0_); + g_object_notify ((GObject *) self, "owner"); +} + + +FreeDesktopProperties* mpris2_controller_get_properties_interface (Mpris2Controller* self) { + FreeDesktopProperties* result; + g_return_val_if_fail (self != NULL, NULL); + result = self->priv->_properties_interface; + return result; +} + + +static void mpris2_controller_set_properties_interface (Mpris2Controller* self, FreeDesktopProperties* value) { + FreeDesktopProperties* _tmp0_; + g_return_if_fail (self != NULL); + self->priv->_properties_interface = (_tmp0_ = _g_object_ref0 (value), _g_object_unref0 (self->priv->_properties_interface), _tmp0_); + g_object_notify ((GObject *) self, "properties-interface"); +} + + +static void _mpris2_controller_property_changed_cb_free_desktop_properties_properties_changed (FreeDesktopProperties* _sender, const char* source, GHashTable* changed_properties, char** invalid, int invalid_length1, gpointer self) { + mpris2_controller_property_changed_cb (self, source, changed_properties, invalid, invalid_length1); +} + + +static GObject * mpris2_controller_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) { + GObject * obj; + GObjectClass * parent_class; + Mpris2Controller * self; + GError * _inner_error_; + parent_class = G_OBJECT_CLASS (mpris2_controller_parent_class); + obj = parent_class->constructor (type, n_construct_properties, construct_properties); + self = MPRIS2_CONTROLLER (obj); + _inner_error_ = NULL; + { + { + DBusGConnection* connection; + char* _tmp0_; + char* _tmp1_; + char* _tmp2_; + char* _tmp3_; + MprisRoot* _tmp4_; + char* _tmp5_; + char* _tmp6_; + char* _tmp7_; + char* _tmp8_; + char* _tmp9_; + MprisPlayer* _tmp10_; + FreeDesktopProperties* _tmp11_; + connection = dbus_g_bus_get (DBUS_BUS_SESSION, &_inner_error_); + if (_inner_error_ != NULL) { + if (_inner_error_->domain == DBUS_GERROR) { + goto __catch5_dbus_gerror; + } + 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_); + } + mpris2_controller_set_mpris2_root (self, _tmp4_ = mpris_root_dbus_proxy_new (connection, _tmp3_ = g_strconcat (_tmp2_ = g_strconcat (MPRIS2_CONTROLLER_root_interface, ".", NULL), player_controller_get_mpris_name (self->priv->_owner), NULL), "/org/mpris/MediaPlayer2")); + _g_object_unref0 (_tmp4_); + _g_free0 (_tmp3_); + _g_free0 (_tmp2_); + _g_free0 (_tmp1_); + _g_free0 (_tmp0_); + mpris2_controller_set_player (self, _tmp10_ = mpris_player_dbus_proxy_new (connection, _tmp9_ = g_strconcat (_tmp8_ = g_strconcat (MPRIS2_CONTROLLER_root_interface, ".", NULL), player_controller_get_mpris_name (self->priv->_owner), NULL), "/org/mpris/MediaPlayer2")); + _g_object_unref0 (_tmp10_); + _g_free0 (_tmp9_); + _g_free0 (_tmp8_); + _g_free0 (_tmp7_); + _g_free0 (_tmp6_); + _g_free0 (_tmp5_); + mpris2_controller_set_properties_interface (self, _tmp11_ = free_desktop_properties_dbus_proxy_new (connection, "org.freedesktop.Properties.PropertiesChanged", "/org/mpris/MediaPlayer2")); + _g_object_unref0 (_tmp11_); + 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: + { + 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_free0 (e); + } + } + __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_); + } + } + return obj; +} + + +static void mpris2_controller_class_init (Mpris2ControllerClass * klass) { + mpris2_controller_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (Mpris2ControllerPrivate)); + G_OBJECT_CLASS (klass)->get_property = mpris2_controller_get_property; + G_OBJECT_CLASS (klass)->set_property = mpris2_controller_set_property; + G_OBJECT_CLASS (klass)->constructor = mpris2_controller_constructor; + G_OBJECT_CLASS (klass)->finalize = mpris2_controller_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS2_CONTROLLER_MPRIS2_ROOT, g_param_spec_object ("mpris2-root", "mpris2-root", "mpris2-root", TYPE_MPRIS_ROOT, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS2_CONTROLLER_PLAYER, g_param_spec_object ("player", "player", "player", TYPE_MPRIS_PLAYER, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS2_CONTROLLER_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)); +} + + +static void mpris2_controller_instance_init (Mpris2Controller * self) { + self->priv = MPRIS2_CONTROLLER_GET_PRIVATE (self); +} + + +static void mpris2_controller_finalize (GObject* obj) { + Mpris2Controller * self; + self = MPRIS2_CONTROLLER (obj); + _g_object_unref0 (self->priv->_mpris2_root); + _g_object_unref0 (self->priv->_player); + _g_object_unref0 (self->priv->_owner); + _g_object_unref0 (self->priv->_properties_interface); + G_OBJECT_CLASS (mpris2_controller_parent_class)->finalize (obj); +} + + +GType mpris2_controller_get_type (void) { + static volatile gsize mpris2_controller_type_id__volatile = 0; + if (g_once_init_enter (&mpris2_controller_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (Mpris2ControllerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) mpris2_controller_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Mpris2Controller), 0, (GInstanceInitFunc) mpris2_controller_instance_init, NULL }; + GType mpris2_controller_type_id; + mpris2_controller_type_id = g_type_register_static (G_TYPE_OBJECT, "Mpris2Controller", &g_define_type_info, 0); + g_once_init_leave (&mpris2_controller_type_id__volatile, mpris2_controller_type_id); + } + return mpris2_controller_type_id__volatile; +} + + +static void mpris2_controller_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + Mpris2Controller * self; + self = MPRIS2_CONTROLLER (object); + switch (property_id) { + case MPRIS2_CONTROLLER_MPRIS2_ROOT: + g_value_set_object (value, mpris2_controller_get_mpris2_root (self)); + break; + case MPRIS2_CONTROLLER_PLAYER: + g_value_set_object (value, mpris2_controller_get_player (self)); + break; + case MPRIS2_CONTROLLER_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; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void mpris2_controller_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + Mpris2Controller * self; + self = MPRIS2_CONTROLLER (object); + switch (property_id) { + case MPRIS2_CONTROLLER_MPRIS2_ROOT: + mpris2_controller_set_mpris2_root (self, g_value_get_object (value)); + break; + case MPRIS2_CONTROLLER_PLAYER: + mpris2_controller_set_player (self, g_value_get_object (value)); + break; + case MPRIS2_CONTROLLER_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; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) { + if ((array != NULL) && (destroy_func != NULL)) { + int i; + for (i = 0; i < array_length; i = i + 1) { + if (((gpointer*) array)[i] != NULL) { + destroy_func (((gpointer*) array)[i]); + } + } + } +} + + +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) { + _vala_array_destroy (array, array_length, destroy_func); + g_free (array); +} + + +static int _vala_strcmp0 (const char * str1, const char * str2) { + if (str1 == NULL) { + return -(str1 != str2); + } + if (str2 == NULL) { + return str1 != str2; + } + return strcmp (str1, str2); +} + + + +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 g_cclosure_user_marshal_VOID__STRING_BOXED_BOXED_INT (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data) { + typedef void (*GMarshalFunc_VOID__STRING_BOXED_BOXED_INT) (gpointer data1, const char* arg_1, gpointer arg_2, gpointer arg_3, gint arg_4, gpointer data2); + register GMarshalFunc_VOID__STRING_BOXED_BOXED_INT callback; + register GCClosure * cc; + register gpointer data1, data2; + cc = (GCClosure *) closure; + g_return_if_fail (n_param_values == 5); + if (G_CCLOSURE_SWAP_DATA (closure)) { + data1 = closure->data; + data2 = param_values->data[0].v_pointer; + } else { + data1 = param_values->data[0].v_pointer; + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__STRING_BOXED_BOXED_INT) (marshal_data ? marshal_data : cc->callback); + callback (data1, g_value_get_string (param_values + 1), g_value_get_boxed (param_values + 2), g_value_get_boxed (param_values + 3), g_value_get_int (param_values + 4), data2); +} + + + diff --git a/src/music-player-bridge.c b/src/music-player-bridge.c new file mode 100644 index 0000000..dddaa1a --- /dev/null +++ b/src/music-player-bridge.c @@ -0,0 +1,543 @@ +/* music-player-bridge.c generated by valac 0.10.0, the Vala compiler + * generated from music-player-bridge.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 <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> +#include <libdbusmenu-glib/server.h> +#include <gee.h> +#include <stdlib.h> +#include <string.h> +#include <gio/gdesktopappinfo.h> +#include <gio/gio.h> + + +#define TYPE_MUSIC_PLAYER_BRIDGE (music_player_bridge_get_type ()) +#define MUSIC_PLAYER_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MUSIC_PLAYER_BRIDGE, MusicPlayerBridge)) +#define MUSIC_PLAYER_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MUSIC_PLAYER_BRIDGE, MusicPlayerBridgeClass)) +#define IS_MUSIC_PLAYER_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MUSIC_PLAYER_BRIDGE)) +#define IS_MUSIC_PLAYER_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MUSIC_PLAYER_BRIDGE)) +#define MUSIC_PLAYER_BRIDGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MUSIC_PLAYER_BRIDGE, MusicPlayerBridgeClass)) + +typedef struct _MusicPlayerBridge MusicPlayerBridge; +typedef struct _MusicPlayerBridgeClass MusicPlayerBridgeClass; +typedef struct _MusicPlayerBridgePrivate MusicPlayerBridgePrivate; + +#define TYPE_PLAYER_CONTROLLER (player_controller_get_type ()) +#define PLAYER_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYER_CONTROLLER, PlayerController)) +#define PLAYER_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYER_CONTROLLER, PlayerControllerClass)) +#define IS_PLAYER_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYER_CONTROLLER)) +#define IS_PLAYER_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYER_CONTROLLER)) +#define PLAYER_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYER_CONTROLLER, PlayerControllerClass)) + +typedef struct _PlayerController PlayerController; +typedef struct _PlayerControllerClass PlayerControllerClass; + +#define 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; +#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 ()) + +struct _MusicPlayerBridge { + GObject parent_instance; + MusicPlayerBridgePrivate * priv; +}; + +struct _MusicPlayerBridgeClass { + GObjectClass parent_class; +}; + +struct _MusicPlayerBridgePrivate { + IndicateListener* listener; + DbusmenuMenuitem* root_menu; + GeeHashMap* registered_clients; + FamiliarPlayersDB* playersDB; +}; + +typedef enum { + PLAYER_CONTROLLER_STATE_OFFLINE, + PLAYER_CONTROLLER_STATE_INSTANTIATING, + PLAYER_CONTROLLER_STATE_READY, + PLAYER_CONTROLLER_STATE_CONNECTED, + PLAYER_CONTROLLER_STATE_DISCONNECTED +} PlayerControllerstate; + + +static gpointer music_player_bridge_parent_class = NULL; + +GType music_player_bridge_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; +#define MUSIC_PLAYER_BRIDGE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_MUSIC_PLAYER_BRIDGE, MusicPlayerBridgePrivate)) +enum { + MUSIC_PLAYER_BRIDGE_DUMMY_PROPERTY +}; +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 char* type); +static void _music_player_bridge_on_server_added_indicate_listener_server_added (IndicateListener* _sender, IndicateListenerServer* object, const char* p0, gpointer self); +void music_player_bridge_on_server_removed (MusicPlayerBridge* self, IndicateListenerServer* object, const char* type); +static void _music_player_bridge_on_server_removed_indicate_listener_server_removed (IndicateListener* _sender, IndicateListenerServer* object, const char* p0, gpointer self); +static void music_player_bridge_try_to_add_inactive_familiar_clients (MusicPlayerBridge* self); +GeeSet* familiar_players_db_records (FamiliarPlayersDB* self); +static char* music_player_bridge_truncate_player_name (char* app_info_name); +static char* music_player_bridge_determine_key (char* 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, const char* client_name, const char* mpris_name, gint offset, PlayerControllerstate initial_state); +PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, const char* client_name, const char* mpris_name, gint offset, PlayerControllerstate initial_state); +void player_controller_set_app_info (PlayerController* self, GAppInfo* value); +GAppInfo* player_controller_get_app_info (PlayerController* self); +#define PLAYER_CONTROLLER_WIDGET_QUANTITY 4 +static gboolean music_player_bridge_server_is_not_of_interest (MusicPlayerBridge* self, const char* type); +static void music_player_bridge_desktop_info_callback (MusicPlayerBridge* self, IndicateListenerServer* server, char* path, void* data); +GAppInfo* music_player_bridge_create_app_info (const char* path); +gboolean familiar_players_db_already_familiar (FamiliarPlayersDB* self, const char* desktop); +void familiar_players_db_insert (FamiliarPlayersDB* self, const char* desktop); +void player_controller_update_state (PlayerController* self, PlayerControllerstate new_state); +void player_controller_activate (PlayerController* self); +void player_controller_hibernate (PlayerController* self); +void music_player_bridge_set_root_menu_item (MusicPlayerBridge* self, DbusmenuMenuitem* menu); +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 char* 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 char* p0, gpointer self) { + music_player_bridge_on_server_removed (self, object, p0); +} + + +MusicPlayerBridge* music_player_bridge_construct (GType object_type) { + MusicPlayerBridge * self; + FamiliarPlayersDB* _tmp0_; + GeeHashMap* _tmp1_; + IndicateListener* _tmp2_; + self = (MusicPlayerBridge*) g_object_new (object_type, NULL); + self->priv->playersDB = (_tmp0_ = familiar_players_db_new (), _g_object_unref0 (self->priv->playersDB), _tmp0_); + self->priv->registered_clients = (_tmp1_ = 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), _g_object_unref0 (self->priv->registered_clients), _tmp1_); + self->priv->listener = (_tmp2_ = indicate_listener_ref_default (), _g_object_unref0 (self->priv->listener), _tmp2_); + 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; +} + + +MusicPlayerBridge* music_player_bridge_new (void) { + return music_player_bridge_construct (TYPE_MUSIC_PLAYER_BRIDGE); +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static void music_player_bridge_try_to_add_inactive_familiar_clients (MusicPlayerBridge* self) { + g_return_if_fail (self != NULL); + { + GeeSet* _tmp0_; + GeeIterator* _tmp1_; + GeeIterator* _app_it; + _app_it = (_tmp1_ = gee_iterable_iterator ((GeeIterable*) (_tmp0_ = familiar_players_db_records (self->priv->playersDB))), _g_object_unref0 (_tmp0_), _tmp1_); + while (TRUE) { + char* app; + GDesktopAppInfo* info; + GDesktopAppInfo* _tmp2_; + GAppInfo* app_info; + char* _tmp3_; + char* _tmp4_; + PlayerController* _tmp5_; + PlayerController* ctrl; + char* _tmp6_; + if (!gee_iterator_next (_app_it)) { + break; + } + app = (char*) gee_iterator_get (_app_it); + if (app == NULL) { + g_warning ("music-player-bridge.vala:45: App string in keyfile is null therefore m" \ +"oving on to next player"); + _g_free0 (app); + continue; + } + g_debug ("music-player-bridge.vala:49: attempting to make an app info from %s", app); + info = g_desktop_app_info_new_from_filename (app); + if (info == NULL) { + g_warning ("music-player-bridge.vala:54: Could not create a desktopappinfo instanc" \ +"e from app: %s", app); + _g_object_unref0 (info); + _g_free0 (app); + continue; + } + app_info = _g_object_ref0 ((_tmp2_ = info, G_IS_APP_INFO (_tmp2_) ? ((GAppInfo*) _tmp2_) : NULL)); + ctrl = (_tmp5_ = player_controller_new (self->priv->root_menu, _tmp3_ = music_player_bridge_truncate_player_name (g_strdup (g_app_info_get_name (app_info))), _tmp4_ = music_player_bridge_determine_key (g_strdup (app)), music_player_bridge_calculate_menu_position (self), PLAYER_CONTROLLER_STATE_OFFLINE), _g_free0 (_tmp4_), _g_free0 (_tmp3_), _tmp5_); + player_controller_set_app_info (ctrl, app_info); + if (player_controller_get_app_info (ctrl) == NULL) { + g_warning ("music-player-bridge.vala:66: for some reason the app info is null"); + } + gee_abstract_map_set ((GeeAbstractMap*) self->priv->registered_clients, _tmp6_ = music_player_bridge_determine_key (g_strdup (app)), ctrl); + _g_free0 (_tmp6_); + _g_object_unref0 (ctrl); + _g_object_unref0 (app_info); + _g_object_unref0 (info); + _g_free0 (app); + } + _g_object_unref0 (_app_it); + } +} + + +static gint music_player_bridge_calculate_menu_position (MusicPlayerBridge* self) { + gint result = 0; + g_return_val_if_fail (self != NULL, 0); + if (gee_map_get_size ((GeeMap*) self->priv->registered_clients) == 0) { + result = 2; + return result; + } else { + result = 2 + (gee_map_get_size ((GeeMap*) self->priv->registered_clients) * PLAYER_CONTROLLER_WIDGET_QUANTITY); + return result; + } +} + + +void music_player_bridge_on_server_added (MusicPlayerBridge* self, IndicateListenerServer* object, const char* type) { + g_return_if_fail (self != NULL); + g_return_if_fail (type != NULL); + g_debug ("music-player-bridge.vala:83: MusicPlayerBridge -> on_server_added with" \ +" value %s", type); + if (music_player_bridge_server_is_not_of_interest (self, type)) { + 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 gboolean string_contains (const char* self, const char* needle) { + gboolean result = FALSE; + g_return_val_if_fail (self != NULL, FALSE); + g_return_val_if_fail (needle != NULL, FALSE); + result = strstr (self, needle) != NULL; + return result; +} + + +static void music_player_bridge_desktop_info_callback (MusicPlayerBridge* self, IndicateListenerServer* server, char* path, void* data) { + void* _tmp0_; + MusicPlayerBridge* bridge; + GAppInfo* app_info; + char* name; + gboolean _tmp1_ = FALSE; + g_return_if_fail (self != NULL); + g_return_if_fail (path != NULL); + bridge = _g_object_ref0 ((_tmp0_ = data, IS_MUSIC_PLAYER_BRIDGE (_tmp0_) ? ((MusicPlayerBridge*) _tmp0_) : NULL)); + app_info = music_player_bridge_create_app_info (path); + name = music_player_bridge_truncate_player_name (g_strdup (g_app_info_get_name (app_info))); + if (string_contains (path, "/")) { + _tmp1_ = familiar_players_db_already_familiar (bridge->priv->playersDB, path) == FALSE; + } else { + _tmp1_ = FALSE; + } + if (_tmp1_) { + char* _tmp2_; + PlayerController* _tmp3_; + PlayerController* ctrl; + char* _tmp4_; + g_debug ("music-player-bridge.vala:99: About to store desktop file path: %s", path); + familiar_players_db_insert (bridge->priv->playersDB, path); + ctrl = (_tmp3_ = player_controller_new (bridge->priv->root_menu, name, _tmp2_ = music_player_bridge_determine_key (g_strdup (path)), music_player_bridge_calculate_menu_position (bridge), PLAYER_CONTROLLER_STATE_READY), _g_free0 (_tmp2_), _tmp3_); + g_object_set ((GObject*) ctrl, "app_info", app_info, NULL); + gee_abstract_map_set ((GeeAbstractMap*) bridge->priv->registered_clients, _tmp4_ = music_player_bridge_determine_key (g_strdup (path)), ctrl); + _g_free0 (_tmp4_); + g_debug ("music-player-bridge.vala:108: successfully created appinfo and instanc" \ +"e from path and set it on the respective instance"); + _g_object_unref0 (ctrl); + } else { + char* key; + PlayerController* _tmp5_; + PlayerController* _tmp6_; + key = music_player_bridge_determine_key (g_strdup (path)); + player_controller_update_state (_tmp5_ = (PlayerController*) gee_abstract_map_get ((GeeAbstractMap*) bridge->priv->registered_clients, key), PLAYER_CONTROLLER_STATE_READY); + _g_object_unref0 (_tmp5_); + player_controller_activate (_tmp6_ = (PlayerController*) gee_abstract_map_get ((GeeAbstractMap*) bridge->priv->registered_clients, key)); + _g_object_unref0 (_tmp6_); + g_debug ("music-player-bridge.vala:114: Ignoring desktop file path callback beca" \ +"use the db cache file has it already: %s", path); + _g_free0 (key); + } + _g_free0 (name); + _g_object_unref0 (app_info); + _g_object_unref0 (bridge); + _g_free0 (path); +} + + +void music_player_bridge_on_server_removed (MusicPlayerBridge* self, IndicateListenerServer* object, const char* type) { + g_return_if_fail (self != NULL); + g_return_if_fail (type != NULL); + g_debug ("music-player-bridge.vala:120: MusicPlayerBridge -> on_server_removed w" \ +"ith value %s", type); + if (music_player_bridge_server_is_not_of_interest (self, type)) { + return; + } + if (self->priv->root_menu != NULL) { + gint tmp_length1; + gint _tmp_size_; + char** _tmp1_; + char** _tmp0_; + char** tmp; + tmp = (_tmp1_ = _tmp0_ = g_strsplit (type, ".", 0), tmp_length1 = _vala_array_length (_tmp0_), _tmp_size_ = tmp_length1, _tmp1_); + g_debug ("music-player-bridge.vala:124: attempt to remove %s", tmp[tmp_length1 - 1]); + if (tmp_length1 > 0) { + PlayerController* _tmp2_; + player_controller_hibernate (_tmp2_ = (PlayerController*) gee_abstract_map_get ((GeeAbstractMap*) self->priv->registered_clients, tmp[tmp_length1 - 1])); + _g_object_unref0 (_tmp2_); + g_debug ("music-player-bridge.vala:127: Successively offlined client %s", tmp[tmp_length1 - 1]); + } + tmp = (_vala_array_free (tmp, tmp_length1, (GDestroyNotify) g_free), NULL); + } +} + + +static gboolean music_player_bridge_server_is_not_of_interest (MusicPlayerBridge* self, const char* type) { + gboolean result = FALSE; + g_return_val_if_fail (self != NULL, FALSE); + g_return_val_if_fail (type != NULL, FALSE); + if (type == NULL) { + result = TRUE; + return result; + } + if (string_contains (type, "music") == FALSE) { + g_debug ("music-player-bridge.vala:135: server is of no interest, it is not an " \ +"music server"); + result = TRUE; + return result; + } + result = FALSE; + return result; +} + + +void music_player_bridge_set_root_menu_item (MusicPlayerBridge* self, DbusmenuMenuitem* menu) { + DbusmenuMenuitem* _tmp0_; + g_return_if_fail (self != NULL); + g_return_if_fail (menu != NULL); + self->priv->root_menu = (_tmp0_ = _g_object_ref0 (menu), _g_object_unref0 (self->priv->root_menu), _tmp0_); + music_player_bridge_try_to_add_inactive_familiar_clients (self); +} + + +GAppInfo* music_player_bridge_create_app_info (const char* path) { + GAppInfo* result = NULL; + GDesktopAppInfo* info; + GDesktopAppInfo* _tmp0_; + GAppInfo* app_info; + g_return_val_if_fail (path != NULL, NULL); + info = g_desktop_app_info_new_from_filename (path); + if (path == NULL) { + g_warning ("music-player-bridge.vala:151: Could not create a desktopappinfo instan" \ +"ce from app: %s", path); + result = NULL; + _g_object_unref0 (info); + return result; + } + app_info = _g_object_ref0 ((_tmp0_ = info, G_IS_APP_INFO (_tmp0_) ? ((GAppInfo*) _tmp0_) : NULL)); + result = app_info; + _g_object_unref0 (info); + return result; +} + + +static char* string_strip (const char* self) { + char* result = NULL; + char* _result_; + g_return_val_if_fail (self != NULL, NULL); + _result_ = g_strdup (self); + g_strstrip (_result_); + result = _result_; + return result; +} + + +static char* music_player_bridge_truncate_player_name (char* app_info_name) { + char* result = NULL; + char* _tmp0_; + char* _tmp1_; + char* _result_; + gint tokens_length1; + gint _tokens_size_; + char** _tmp3_; + char** _tmp2_; + char** tokens; + g_return_val_if_fail (app_info_name != NULL, NULL); + _result_ = (_tmp1_ = string_strip (_tmp0_ = g_utf8_strdown (app_info_name, -1)), _g_free0 (_tmp0_), _tmp1_); + tokens = (_tmp3_ = _tmp2_ = g_strsplit (_result_, " ", 0), tokens_length1 = _vala_array_length (_tmp2_), _tokens_size_ = tokens_length1, _tmp3_); + if (tokens_length1 > 1) { + char* _tmp4_; + _result_ = (_tmp4_ = g_strdup (tokens[0]), _g_free0 (_result_), _tmp4_); + } + g_debug ("music-player-bridge.vala:167: truncate player name %s", _result_); + result = _result_; + tokens = (_vala_array_free (tokens, tokens_length1, (GDestroyNotify) g_free), NULL); + _g_free0 (app_info_name); + return result; +} + + +static char* music_player_bridge_determine_key (char* path) { + char* result = NULL; + gint tokens_length1; + gint _tokens_size_; + char** _tmp1_; + char** _tmp0_; + char** tokens; + char* filename; + char** _tmp2_; + char** _tmp3_; + gint _tmp3__length1; + char* _tmp4_; + char* _result_; + gint temp_length1; + gint _temp_size_; + char** _tmp6_; + char** _tmp5_; + char** temp; + g_return_val_if_fail (path != NULL, NULL); + tokens = (_tmp1_ = _tmp0_ = g_strsplit (path, "/", 0), tokens_length1 = _vala_array_length (_tmp0_), _tokens_size_ = tokens_length1, _tmp1_); + if (tokens_length1 < 2) { + result = NULL; + tokens = (_vala_array_free (tokens, tokens_length1, (GDestroyNotify) g_free), NULL); + _g_free0 (path); + return result; + } + filename = g_strdup (tokens[tokens_length1 - 1]); + _result_ = (_tmp4_ = g_strdup ((_tmp3_ = _tmp2_ = g_strsplit (filename, ".", 0), _tmp3__length1 = _vala_array_length (_tmp2_), _tmp3_)[0]), _tmp3_ = (_vala_array_free (_tmp3_, _tmp3__length1, (GDestroyNotify) g_free), NULL), _tmp4_); + temp = (_tmp6_ = _tmp5_ = g_strsplit (_result_, "-", 0), temp_length1 = _vala_array_length (_tmp5_), _temp_size_ = temp_length1, _tmp6_); + if (temp_length1 > 1) { + char* _tmp7_; + _result_ = (_tmp7_ = g_strdup (temp[0]), _g_free0 (_result_), _tmp7_); + } + g_debug ("music-player-bridge.vala:181: determine key result = %s", _result_); + result = _result_; + temp = (_vala_array_free (temp, temp_length1, (GDestroyNotify) g_free), NULL); + _g_free0 (filename); + tokens = (_vala_array_free (tokens, tokens_length1, (GDestroyNotify) g_free), NULL); + _g_free0 (path); + return result; +} + + +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)->finalize = music_player_bridge_finalize; +} + + +static void music_player_bridge_instance_init (MusicPlayerBridge * self) { + self->priv = MUSIC_PLAYER_BRIDGE_GET_PRIVATE (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->root_menu); + _g_object_unref0 (self->priv->registered_clients); + _g_object_unref0 (self->priv->playersDB); + G_OBJECT_CLASS (music_player_bridge_parent_class)->finalize (obj); +} + + +GType music_player_bridge_get_type (void) { + static volatile gsize music_player_bridge_type_id__volatile = 0; + if (g_once_init_enter (&music_player_bridge_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (MusicPlayerBridgeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) music_player_bridge_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MusicPlayerBridge), 0, (GInstanceInitFunc) music_player_bridge_instance_init, NULL }; + GType music_player_bridge_type_id; + music_player_bridge_type_id = g_type_register_static (G_TYPE_OBJECT, "MusicPlayerBridge", &g_define_type_info, 0); + g_once_init_leave (&music_player_bridge_type_id__volatile, music_player_bridge_type_id); + } + return music_player_bridge_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/music-player-bridge.h b/src/music-player-bridge.h new file mode 100644 index 0000000..41ea682 --- /dev/null +++ b/src/music-player-bridge.h @@ -0,0 +1,426 @@ +/* music-player-bridge.h generated by valac 0.10.0, the Vala compiler, do not modify */ + + +#ifndef __MUSIC_PLAYER_BRIDGE_H__ +#define __MUSIC_PLAYER_BRIDGE_H__ + +#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> + +G_BEGIN_DECLS + + +#define TYPE_MUSIC_PLAYER_BRIDGE (music_player_bridge_get_type ()) +#define MUSIC_PLAYER_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MUSIC_PLAYER_BRIDGE, MusicPlayerBridge)) +#define MUSIC_PLAYER_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MUSIC_PLAYER_BRIDGE, MusicPlayerBridgeClass)) +#define IS_MUSIC_PLAYER_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MUSIC_PLAYER_BRIDGE)) +#define IS_MUSIC_PLAYER_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MUSIC_PLAYER_BRIDGE)) +#define MUSIC_PLAYER_BRIDGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MUSIC_PLAYER_BRIDGE, MusicPlayerBridgeClass)) + +typedef struct _MusicPlayerBridge MusicPlayerBridge; +typedef struct _MusicPlayerBridgeClass MusicPlayerBridgeClass; +typedef struct _MusicPlayerBridgePrivate MusicPlayerBridgePrivate; + +#define TYPE_PLAYER_ITEM (player_item_get_type ()) +#define PLAYER_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYER_ITEM, PlayerItem)) +#define PLAYER_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYER_ITEM, PlayerItemClass)) +#define IS_PLAYER_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYER_ITEM)) +#define IS_PLAYER_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYER_ITEM)) +#define PLAYER_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYER_ITEM, PlayerItemClass)) + +typedef struct _PlayerItem PlayerItem; +typedef struct _PlayerItemClass PlayerItemClass; +typedef struct _PlayerItemPrivate PlayerItemPrivate; + +#define TYPE_TRANSPORT_MENUITEM (transport_menuitem_get_type ()) +#define TRANSPORT_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TRANSPORT_MENUITEM, TransportMenuitem)) +#define TRANSPORT_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TRANSPORT_MENUITEM, TransportMenuitemClass)) +#define IS_TRANSPORT_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TRANSPORT_MENUITEM)) +#define IS_TRANSPORT_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TRANSPORT_MENUITEM)) +#define TRANSPORT_MENUITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TRANSPORT_MENUITEM, TransportMenuitemClass)) + +typedef struct _TransportMenuitem TransportMenuitem; +typedef struct _TransportMenuitemClass TransportMenuitemClass; +typedef struct _TransportMenuitemPrivate TransportMenuitemPrivate; + +#define TRANSPORT_MENUITEM_TYPE_ACTION (transport_menuitem_action_get_type ()) + +#define TRANSPORT_MENUITEM_TYPE_STATE (transport_menuitem_state_get_type ()) + +#define TYPE_PLAYER_CONTROLLER (player_controller_get_type ()) +#define PLAYER_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYER_CONTROLLER, PlayerController)) +#define PLAYER_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYER_CONTROLLER, PlayerControllerClass)) +#define IS_PLAYER_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYER_CONTROLLER)) +#define IS_PLAYER_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYER_CONTROLLER)) +#define PLAYER_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYER_CONTROLLER, PlayerControllerClass)) + +typedef struct _PlayerController PlayerController; +typedef struct _PlayerControllerClass PlayerControllerClass; + +#define TYPE_METADATA_MENUITEM (metadata_menuitem_get_type ()) +#define METADATA_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_METADATA_MENUITEM, MetadataMenuitem)) +#define METADATA_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_METADATA_MENUITEM, MetadataMenuitemClass)) +#define IS_METADATA_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_METADATA_MENUITEM)) +#define IS_METADATA_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_METADATA_MENUITEM)) +#define METADATA_MENUITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_METADATA_MENUITEM, MetadataMenuitemClass)) + +typedef struct _MetadataMenuitem MetadataMenuitem; +typedef struct _MetadataMenuitemClass MetadataMenuitemClass; +typedef struct _MetadataMenuitemPrivate MetadataMenuitemPrivate; + +#define TYPE_TITLE_MENUITEM (title_menuitem_get_type ()) +#define TITLE_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TITLE_MENUITEM, TitleMenuitem)) +#define TITLE_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TITLE_MENUITEM, TitleMenuitemClass)) +#define IS_TITLE_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TITLE_MENUITEM)) +#define IS_TITLE_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TITLE_MENUITEM)) +#define TITLE_MENUITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TITLE_MENUITEM, TitleMenuitemClass)) + +typedef struct _TitleMenuitem TitleMenuitem; +typedef struct _TitleMenuitemClass TitleMenuitemClass; +typedef struct _TitleMenuitemPrivate TitleMenuitemPrivate; +typedef struct _PlayerControllerPrivate PlayerControllerPrivate; + +#define TYPE_MPRIS2_CONTROLLER (mpris2_controller_get_type ()) +#define MPRIS2_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS2_CONTROLLER, Mpris2Controller)) +#define MPRIS2_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS2_CONTROLLER, Mpris2ControllerClass)) +#define IS_MPRIS2_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS2_CONTROLLER)) +#define IS_MPRIS2_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS2_CONTROLLER)) +#define MPRIS2_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS2_CONTROLLER, Mpris2ControllerClass)) + +typedef struct _Mpris2Controller Mpris2Controller; +typedef struct _Mpris2ControllerClass Mpris2ControllerClass; + +#define PLAYER_CONTROLLER_TYPE_WIDGET_ORDER (player_controller_widget_order_get_type ()) + +#define PLAYER_CONTROLLER_TYPE_STATE (player_controller_state_get_type ()) + +#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_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_FREE_DESKTOP_PROPERTIES (free_desktop_properties_get_type ()) +#define FREE_DESKTOP_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FREE_DESKTOP_PROPERTIES, FreeDesktopProperties)) +#define IS_FREE_DESKTOP_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FREE_DESKTOP_PROPERTIES)) +#define FREE_DESKTOP_PROPERTIES_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_FREE_DESKTOP_PROPERTIES, FreeDesktopPropertiesIface)) + +typedef struct _FreeDesktopProperties FreeDesktopProperties; +typedef struct _FreeDesktopPropertiesIface FreeDesktopPropertiesIface; +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)) + +typedef struct _FamiliarPlayersDB FamiliarPlayersDB; +typedef struct _FamiliarPlayersDBClass FamiliarPlayersDBClass; +typedef struct _FamiliarPlayersDBPrivate FamiliarPlayersDBPrivate; + +#define TYPE_FETCH_FILE (fetch_file_get_type ()) +#define FETCH_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FETCH_FILE, FetchFile)) +#define FETCH_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FETCH_FILE, FetchFileClass)) +#define IS_FETCH_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FETCH_FILE)) +#define IS_FETCH_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FETCH_FILE)) +#define FETCH_FILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FETCH_FILE, FetchFileClass)) + +typedef struct _FetchFile FetchFile; +typedef struct _FetchFileClass FetchFileClass; +typedef struct _FetchFilePrivate FetchFilePrivate; + +struct _MusicPlayerBridge { + GObject parent_instance; + MusicPlayerBridgePrivate * priv; +}; + +struct _MusicPlayerBridgeClass { + GObjectClass parent_class; +}; + +struct _PlayerItem { + DbusmenuMenuitem parent_instance; + PlayerItemPrivate * priv; +}; + +struct _PlayerItemClass { + DbusmenuMenuitemClass parent_class; +}; + +struct _TransportMenuitem { + PlayerItem parent_instance; + TransportMenuitemPrivate * priv; +}; + +struct _TransportMenuitemClass { + PlayerItemClass parent_class; +}; + +typedef enum { + TRANSPORT_MENUITEM_ACTION_PREVIOUS, + TRANSPORT_MENUITEM_ACTION_PLAY_PAUSE, + TRANSPORT_MENUITEM_ACTION_NEXT +} TransportMenuitemaction; + +typedef enum { + TRANSPORT_MENUITEM_STATE_PLAYING, + TRANSPORT_MENUITEM_STATE_PAUSED +} TransportMenuitemstate; + +struct _MetadataMenuitem { + PlayerItem parent_instance; + MetadataMenuitemPrivate * priv; +}; + +struct _MetadataMenuitemClass { + PlayerItemClass parent_class; +}; + +struct _TitleMenuitem { + PlayerItem parent_instance; + TitleMenuitemPrivate * priv; +}; + +struct _TitleMenuitemClass { + PlayerItemClass parent_class; +}; + +struct _PlayerController { + GObject parent_instance; + PlayerControllerPrivate * priv; + gint current_state; + GeeArrayList* custom_items; + Mpris2Controller* mpris_bridge; +}; + +struct _PlayerControllerClass { + GObjectClass parent_class; +}; + +typedef enum { + PLAYER_CONTROLLER_WIDGET_ORDER_SEPARATOR, + PLAYER_CONTROLLER_WIDGET_ORDER_TITLE, + PLAYER_CONTROLLER_WIDGET_ORDER_METADATA, + PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT +} PlayerControllerwidget_order; + +typedef enum { + PLAYER_CONTROLLER_STATE_OFFLINE, + PLAYER_CONTROLLER_STATE_INSTANTIATING, + PLAYER_CONTROLLER_STATE_READY, + PLAYER_CONTROLLER_STATE_CONNECTED, + PLAYER_CONTROLLER_STATE_DISCONNECTED +} PlayerControllerstate; + +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); + char* (*get_Identity) (MprisRoot* self); + void (*set_Identity) (MprisRoot* self, const char* value); + char* (*get_DesktopEntry) (MprisRoot* self); + void (*set_DesktopEntry) (MprisRoot* self, const char* 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); + char* (*get_PlaybackStatus) (MprisPlayer* self); + void (*set_PlaybackStatus) (MprisPlayer* self, const char* value); +}; + +struct _FreeDesktopPropertiesIface { + GTypeInterface parent_iface; +}; + +struct _Mpris2Controller { + GObject parent_instance; + Mpris2ControllerPrivate * priv; +}; + +struct _Mpris2ControllerClass { + GObjectClass parent_class; +}; + +struct _FamiliarPlayersDB { + GObject parent_instance; + FamiliarPlayersDBPrivate * priv; +}; + +struct _FamiliarPlayersDBClass { + GObjectClass parent_class; +}; + +struct _FetchFile { + GObject parent_instance; + FetchFilePrivate * priv; +}; + +struct _FetchFileClass { + GObjectClass parent_class; +}; + + +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 char* type); +void music_player_bridge_on_server_removed (MusicPlayerBridge* self, IndicateListenerServer* object, const char* type); +void music_player_bridge_set_root_menu_item (MusicPlayerBridge* self, DbusmenuMenuitem* menu); +GAppInfo* music_player_bridge_create_app_info (const char* 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; +GType transport_menuitem_state_get_type (void) G_GNUC_CONST; +GType player_controller_get_type (void) G_GNUC_CONST; +TransportMenuitem* transport_menuitem_new (PlayerController* parent); +TransportMenuitem* transport_menuitem_construct (GType object_type, PlayerController* parent); +void transport_menuitem_change_play_state (TransportMenuitem* self, TransportMenuitemstate update); +GeeHashSet* transport_menuitem_attributes_format (void); +GType metadata_menuitem_get_type (void) G_GNUC_CONST; +extern char* metadata_menuitem_album_art_cache_dir; +#define METADATA_MENUITEM_ALBUM_ART_DIR_SUFFIX "indicators/sound/album-art-cache" +MetadataMenuitem* metadata_menuitem_new (void); +MetadataMenuitem* metadata_menuitem_construct (GType object_type); +void metadata_menuitem_fetch_art (MetadataMenuitem* self, const char* uri, const char* prop); +GeeHashSet* metadata_menuitem_attributes_format (void); +GType title_menuitem_get_type (void) G_GNUC_CONST; +TitleMenuitem* title_menuitem_new (PlayerController* parent); +TitleMenuitem* title_menuitem_construct (GType object_type, PlayerController* parent); +void title_menuitem_toggle_active_triangle (TitleMenuitem* self, gboolean update); +GeeHashSet* title_menuitem_attributes_format (void); +GType mpris2_controller_get_type (void) G_GNUC_CONST; +GType player_controller_widget_order_get_type (void) G_GNUC_CONST; +GType player_controller_state_get_type (void) G_GNUC_CONST; +#define PLAYER_CONTROLLER_WIDGET_QUANTITY 4 +PlayerController* player_controller_new (DbusmenuMenuitem* root, const char* client_name, const char* mpris_name, gint offset, PlayerControllerstate initial_state); +PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, const char* client_name, const char* mpris_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_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 char* player_controller_get_name (PlayerController* self); +void player_controller_set_name (PlayerController* self, const char* value); +const char* player_controller_get_mpris_name (PlayerController* self); +void player_controller_set_mpris_name (PlayerController* self, const char* 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); +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); +char* mpris_root_get_Identity (MprisRoot* self); +void mpris_root_set_Identity (MprisRoot* self, const char* value); +char* mpris_root_get_DesktopEntry (MprisRoot* self); +void mpris_root_set_DesktopEntry (MprisRoot* self, const char* value); +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); +char* mpris_player_get_PlaybackStatus (MprisPlayer* self); +void mpris_player_set_PlaybackStatus (MprisPlayer* self, const char* value); +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" +Mpris2Controller* mpris2_controller_new (PlayerController* ctrl); +Mpris2Controller* mpris2_controller_construct (GType object_type, PlayerController* ctrl); +void mpris2_controller_property_changed_cb (Mpris2Controller* self, const char* interface_source, GHashTable* changed_properties, char** 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); +PlayerItem* player_item_new (const char* type); +PlayerItem* player_item_construct (GType object_type, const char* type); +void player_item_reset (PlayerItem* self, GeeHashSet* attrs); +void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attributes); +gboolean player_item_populated (PlayerItem* self, GeeHashSet* attrs); +PlayerController* player_item_get_owner (PlayerItem* self); +const char* 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 char* desktop); +gboolean familiar_players_db_already_familiar (FamiliarPlayersDB* self, const char* desktop); +GeeSet* familiar_players_db_records (FamiliarPlayersDB* self); +GType fetch_file_get_type (void) G_GNUC_CONST; +FetchFile* fetch_file_new (const char* uri, const char* prop); +FetchFile* fetch_file_construct (GType object_type, const char* uri, const char* prop); +void fetch_file_fetch_data (FetchFile* self, GAsyncReadyCallback _callback_, gpointer _user_data_); +void fetch_file_fetch_data_finish (FetchFile* self, GAsyncResult* _res_); +const char* fetch_file_get_uri (FetchFile* self); +const char* fetch_file_get_intended_property (FetchFile* self); + + +G_END_DECLS + +#endif diff --git a/src/player-controller.c b/src/player-controller.c new file mode 100644 index 0000000..3eee29a --- /dev/null +++ b/src/player-controller.c @@ -0,0 +1,673 @@ +/* player-controller.c generated by valac 0.10.0, the Vala compiler + * generated from player-controller.vala, do not modify */ + +/* +This service primarily controls PulseAudio and is driven by the sound indicator menu on the panel. +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 <libdbusmenu-glib/client.h> +#include <libdbusmenu-glib/menuitem-proxy.h> +#include <libdbusmenu-glib/menuitem.h> +#include <libdbusmenu-glib/server.h> +#include <stdlib.h> +#include <string.h> +#include <gio/gio.h> + + +#define TYPE_PLAYER_CONTROLLER (player_controller_get_type ()) +#define PLAYER_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYER_CONTROLLER, PlayerController)) +#define PLAYER_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYER_CONTROLLER, PlayerControllerClass)) +#define IS_PLAYER_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYER_CONTROLLER)) +#define IS_PLAYER_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYER_CONTROLLER)) +#define PLAYER_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYER_CONTROLLER, PlayerControllerClass)) + +typedef struct _PlayerController PlayerController; +typedef struct _PlayerControllerClass PlayerControllerClass; +typedef struct _PlayerControllerPrivate PlayerControllerPrivate; + +#define TYPE_PLAYER_ITEM (player_item_get_type ()) +#define PLAYER_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYER_ITEM, PlayerItem)) +#define PLAYER_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYER_ITEM, PlayerItemClass)) +#define IS_PLAYER_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYER_ITEM)) +#define IS_PLAYER_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYER_ITEM)) +#define PLAYER_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYER_ITEM, PlayerItemClass)) + +typedef struct _PlayerItem PlayerItem; +typedef struct _PlayerItemClass PlayerItemClass; + +#define TYPE_MPRIS2_CONTROLLER (mpris2_controller_get_type ()) +#define MPRIS2_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS2_CONTROLLER, Mpris2Controller)) +#define MPRIS2_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS2_CONTROLLER, Mpris2ControllerClass)) +#define IS_MPRIS2_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS2_CONTROLLER)) +#define IS_MPRIS2_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS2_CONTROLLER)) +#define MPRIS2_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS2_CONTROLLER, Mpris2ControllerClass)) + +typedef struct _Mpris2Controller Mpris2Controller; +typedef struct _Mpris2ControllerClass Mpris2ControllerClass; + +#define PLAYER_CONTROLLER_TYPE_WIDGET_ORDER (player_controller_widget_order_get_type ()) + +#define PLAYER_CONTROLLER_TYPE_STATE (player_controller_state_get_type ()) +#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_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) + +#define TYPE_TITLE_MENUITEM (title_menuitem_get_type ()) +#define TITLE_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TITLE_MENUITEM, TitleMenuitem)) +#define TITLE_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TITLE_MENUITEM, TitleMenuitemClass)) +#define IS_TITLE_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TITLE_MENUITEM)) +#define IS_TITLE_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TITLE_MENUITEM)) +#define TITLE_MENUITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TITLE_MENUITEM, TitleMenuitemClass)) + +typedef struct _TitleMenuitem TitleMenuitem; +typedef struct _TitleMenuitemClass TitleMenuitemClass; + +#define TYPE_METADATA_MENUITEM (metadata_menuitem_get_type ()) +#define METADATA_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_METADATA_MENUITEM, MetadataMenuitem)) +#define METADATA_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_METADATA_MENUITEM, MetadataMenuitemClass)) +#define IS_METADATA_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_METADATA_MENUITEM)) +#define IS_METADATA_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_METADATA_MENUITEM)) +#define METADATA_MENUITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_METADATA_MENUITEM, MetadataMenuitemClass)) + +typedef struct _MetadataMenuitem MetadataMenuitem; +typedef struct _MetadataMenuitemClass MetadataMenuitemClass; + +#define TYPE_TRANSPORT_MENUITEM (transport_menuitem_get_type ()) +#define TRANSPORT_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TRANSPORT_MENUITEM, TransportMenuitem)) +#define TRANSPORT_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TRANSPORT_MENUITEM, TransportMenuitemClass)) +#define IS_TRANSPORT_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TRANSPORT_MENUITEM)) +#define IS_TRANSPORT_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TRANSPORT_MENUITEM)) +#define TRANSPORT_MENUITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TRANSPORT_MENUITEM, TransportMenuitemClass)) + +typedef struct _TransportMenuitem TransportMenuitem; +typedef struct _TransportMenuitemClass TransportMenuitemClass; + +#define TRANSPORT_MENUITEM_TYPE_STATE (transport_menuitem_state_get_type ()) + +struct _PlayerController { + GObject parent_instance; + PlayerControllerPrivate * priv; + gint current_state; + GeeArrayList* custom_items; + Mpris2Controller* mpris_bridge; +}; + +struct _PlayerControllerClass { + GObjectClass parent_class; +}; + +struct _PlayerControllerPrivate { + DbusmenuMenuitem* root_menu; + char* _name; + char* _mpris_name; + GAppInfo* _app_info; + gint _menu_offset; +}; + +typedef enum { + PLAYER_CONTROLLER_WIDGET_ORDER_SEPARATOR, + PLAYER_CONTROLLER_WIDGET_ORDER_TITLE, + PLAYER_CONTROLLER_WIDGET_ORDER_METADATA, + PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT +} PlayerControllerwidget_order; + +typedef enum { + PLAYER_CONTROLLER_STATE_OFFLINE, + PLAYER_CONTROLLER_STATE_INSTANTIATING, + PLAYER_CONTROLLER_STATE_READY, + PLAYER_CONTROLLER_STATE_CONNECTED, + PLAYER_CONTROLLER_STATE_DISCONNECTED +} PlayerControllerstate; + +typedef enum { + TRANSPORT_MENUITEM_STATE_PLAYING, + TRANSPORT_MENUITEM_STATE_PAUSED +} TransportMenuitemstate; + + +static gpointer player_controller_parent_class = NULL; + +GType player_controller_get_type (void) G_GNUC_CONST; +GType player_item_get_type (void) G_GNUC_CONST; +GType mpris2_controller_get_type (void) G_GNUC_CONST; +#define PLAYER_CONTROLLER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_PLAYER_CONTROLLER, PlayerControllerPrivate)) +enum { + PLAYER_CONTROLLER_DUMMY_PROPERTY, + PLAYER_CONTROLLER_NAME, + PLAYER_CONTROLLER_MPRIS_NAME, + PLAYER_CONTROLLER_APP_INFO, + PLAYER_CONTROLLER_MENU_OFFSET +}; +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, const char* client_name, const char* mpris_name, gint offset, PlayerControllerstate initial_state); +PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, const char* client_name, const char* mpris_name, gint offset, PlayerControllerstate initial_state); +static char* player_controller_format_client_name (const char* client_name); +void player_controller_set_name (PlayerController* self, const char* value); +void player_controller_set_mpris_name (PlayerController* self, const char* value); +void player_controller_set_menu_offset (PlayerController* self, gint value); +static void player_controller_construct_widgets (PlayerController* self); +static void player_controller_establish_mpris_connection (PlayerController* self); +void player_controller_update_layout (PlayerController* self); +void player_controller_update_state (PlayerController* self, PlayerControllerstate new_state); +const char* player_controller_get_name (PlayerController* self); +void player_controller_activate (PlayerController* self); +void player_controller_instantiate (PlayerController* self); +GAppInfo* player_controller_get_app_info (PlayerController* self); +Mpris2Controller* mpris2_controller_new (PlayerController* ctrl); +Mpris2Controller* mpris2_controller_construct (GType object_type, PlayerController* ctrl); +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); +GeeHashSet* transport_menuitem_attributes_format (void); +GeeHashSet* metadata_menuitem_attributes_format (void); +GType title_menuitem_get_type (void) G_GNUC_CONST; +void title_menuitem_toggle_active_triangle (TitleMenuitem* self, gboolean update); +gboolean player_item_populated (PlayerItem* self, GeeHashSet* attrs); +PlayerItem* player_item_new (const char* type); +PlayerItem* player_item_construct (GType object_type, const char* type); +TitleMenuitem* title_menuitem_new (PlayerController* parent); +TitleMenuitem* title_menuitem_construct (GType object_type, PlayerController* parent); +MetadataMenuitem* metadata_menuitem_new (void); +MetadataMenuitem* metadata_menuitem_construct (GType object_type); +GType metadata_menuitem_get_type (void) G_GNUC_CONST; +TransportMenuitem* transport_menuitem_new (PlayerController* parent); +TransportMenuitem* transport_menuitem_construct (GType object_type, PlayerController* parent); +GType transport_menuitem_get_type (void) G_GNUC_CONST; +gint player_controller_get_menu_offset (PlayerController* self); +gboolean mpris2_controller_connected (Mpris2Controller* self); +GType transport_menuitem_state_get_type (void) G_GNUC_CONST; +void transport_menuitem_change_play_state (TransportMenuitem* self, TransportMenuitemstate update); +const char* player_controller_get_mpris_name (PlayerController* self); +void player_controller_set_app_info (PlayerController* self, GAppInfo* value); +static void player_controller_finalize (GObject* obj); +static void player_controller_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void player_controller_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); + + + +GType player_controller_widget_order_get_type (void) { + static volatile gsize player_controller_widget_order_type_id__volatile = 0; + if (g_once_init_enter (&player_controller_widget_order_type_id__volatile)) { + static const GEnumValue values[] = {{PLAYER_CONTROLLER_WIDGET_ORDER_SEPARATOR, "PLAYER_CONTROLLER_WIDGET_ORDER_SEPARATOR", "separator"}, {PLAYER_CONTROLLER_WIDGET_ORDER_TITLE, "PLAYER_CONTROLLER_WIDGET_ORDER_TITLE", "title"}, {PLAYER_CONTROLLER_WIDGET_ORDER_METADATA, "PLAYER_CONTROLLER_WIDGET_ORDER_METADATA", "metadata"}, {PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT, "PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT", "transport"}, {0, NULL, NULL}}; + GType player_controller_widget_order_type_id; + player_controller_widget_order_type_id = g_enum_register_static ("PlayerControllerwidget_order", values); + g_once_init_leave (&player_controller_widget_order_type_id__volatile, player_controller_widget_order_type_id); + } + return player_controller_widget_order_type_id__volatile; +} + + +GType player_controller_state_get_type (void) { + static volatile gsize player_controller_state_type_id__volatile = 0; + if (g_once_init_enter (&player_controller_state_type_id__volatile)) { + static const GEnumValue values[] = {{PLAYER_CONTROLLER_STATE_OFFLINE, "PLAYER_CONTROLLER_STATE_OFFLINE", "offline"}, {PLAYER_CONTROLLER_STATE_INSTANTIATING, "PLAYER_CONTROLLER_STATE_INSTANTIATING", "instantiating"}, {PLAYER_CONTROLLER_STATE_READY, "PLAYER_CONTROLLER_STATE_READY", "ready"}, {PLAYER_CONTROLLER_STATE_CONNECTED, "PLAYER_CONTROLLER_STATE_CONNECTED", "connected"}, {PLAYER_CONTROLLER_STATE_DISCONNECTED, "PLAYER_CONTROLLER_STATE_DISCONNECTED", "disconnected"}, {0, NULL, NULL}}; + GType player_controller_state_type_id; + player_controller_state_type_id = g_enum_register_static ("PlayerControllerstate", values); + g_once_init_leave (&player_controller_state_type_id__volatile, player_controller_state_type_id); + } + return player_controller_state_type_id__volatile; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static char* string_strip (const char* self) { + char* result = NULL; + char* _result_; + g_return_val_if_fail (self != NULL, NULL); + _result_ = g_strdup (self); + g_strstrip (_result_); + result = _result_; + return result; +} + + +PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, const char* client_name, const char* mpris_name, gint offset, PlayerControllerstate initial_state) { + PlayerController * self; + DbusmenuMenuitem* _tmp0_; + char* _tmp1_; + char* _tmp2_; + GeeArrayList* _tmp3_; + g_return_val_if_fail (root != NULL, NULL); + g_return_val_if_fail (client_name != NULL, NULL); + g_return_val_if_fail (mpris_name != NULL, NULL); + self = (PlayerController*) g_object_new (object_type, NULL); + self->priv->root_menu = (_tmp0_ = _g_object_ref0 (root), _g_object_unref0 (self->priv->root_menu), _tmp0_); + player_controller_set_name (self, _tmp2_ = player_controller_format_client_name (_tmp1_ = string_strip (client_name))); + _g_free0 (_tmp2_); + _g_free0 (_tmp1_); + player_controller_set_mpris_name (self, mpris_name); + self->custom_items = (_tmp3_ = gee_array_list_new (TYPE_PLAYER_ITEM, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL), _g_object_unref0 (self->custom_items), _tmp3_); + self->current_state = (gint) initial_state; + player_controller_set_menu_offset (self, offset); + player_controller_construct_widgets (self); + player_controller_establish_mpris_connection (self); + player_controller_update_layout (self); + return self; +} + + +PlayerController* player_controller_new (DbusmenuMenuitem* root, const char* client_name, const char* mpris_name, gint offset, PlayerControllerstate initial_state) { + return player_controller_construct (TYPE_PLAYER_CONTROLLER, root, client_name, mpris_name, offset, initial_state); +} + + +void player_controller_update_state (PlayerController* self, PlayerControllerstate new_state) { + g_return_if_fail (self != NULL); + g_debug ("player-controller.vala:72: update_state - player controller %s : new s" \ +"tate %i", self->priv->_name, (gint) new_state); + self->current_state = (gint) new_state; + player_controller_update_layout (self); +} + + +void player_controller_activate (PlayerController* self) { + g_return_if_fail (self != NULL); + player_controller_establish_mpris_connection (self); +} + + +void player_controller_instantiate (PlayerController* self) { + GError * _inner_error_ = NULL; + g_return_if_fail (self != NULL); + g_debug ("player-controller.vala:90: 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; + } + player_controller_update_state (self, PLAYER_CONTROLLER_STATE_INSTANTIATING); + } + goto __finally4; + __catch4_g_error: + { + GError * _error_; + _error_ = _inner_error_; + _inner_error_ = NULL; + { + g_warning ("player-controller.vala:96: Failed to launch app %s with error message:" \ +" %s", self->priv->_name, _error_->message); + _g_error_free0 (_error_); + } + } + __finally4: + 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; + } +} + + +static void player_controller_establish_mpris_connection (PlayerController* self) { + Mpris2Controller* _tmp0_; + g_return_if_fail (self != NULL); + if (self->current_state != PLAYER_CONTROLLER_STATE_READY) { + g_debug ("player-controller.vala:103: establish_mpris_connection - Not ready to " \ +"connect"); + return; + } + self->mpris_bridge = (_tmp0_ = mpris2_controller_new (self), _g_object_unref0 (self->mpris_bridge), _tmp0_); + player_controller_determine_state (self); +} + + +void player_controller_vanish (PlayerController* self) { + g_return_if_fail (self != NULL); + { + GeeIterator* _item_it; + _item_it = gee_abstract_collection_iterator ((GeeAbstractCollection*) self->custom_items); + while (TRUE) { + DbusmenuMenuitem* item; + if (!gee_iterator_next (_item_it)) { + break; + } + item = (DbusmenuMenuitem*) ((PlayerItem*) gee_iterator_get (_item_it)); + dbusmenu_menuitem_child_delete (self->priv->root_menu, item); + _g_object_unref0 (item); + } + _g_object_unref0 (_item_it); + } +} + + +void player_controller_hibernate (PlayerController* self) { + PlayerItem* _tmp0_; + GeeHashSet* _tmp1_; + PlayerItem* _tmp2_; + GeeHashSet* _tmp3_; + PlayerItem* _tmp4_; + TitleMenuitem* title; + g_return_if_fail (self != NULL); + player_controller_update_state (self, PLAYER_CONTROLLER_STATE_OFFLINE); + player_item_reset (_tmp0_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT), _tmp1_ = transport_menuitem_attributes_format ()); + _g_object_unref0 (_tmp1_); + _g_object_unref0 (_tmp0_); + player_item_reset (_tmp2_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), _tmp3_ = metadata_menuitem_attributes_format ()); + _g_object_unref0 (_tmp3_); + _g_object_unref0 (_tmp2_); + title = (_tmp4_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TITLE), IS_TITLE_MENUITEM (_tmp4_) ? ((TitleMenuitem*) _tmp4_) : NULL); + title_menuitem_toggle_active_triangle (title, FALSE); + _g_object_unref0 (title); +} + + +void player_controller_update_layout (PlayerController* self) { + PlayerItem* _tmp2_; + PlayerItem* _tmp3_; + GeeHashSet* _tmp4_; + PlayerItem* _tmp5_; + g_return_if_fail (self != NULL); + if (self->current_state != PLAYER_CONTROLLER_STATE_CONNECTED) { + PlayerItem* _tmp0_; + PlayerItem* _tmp1_; + dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp0_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT)), DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE); + _g_object_unref0 (_tmp0_); + dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp1_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA)), DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE); + _g_object_unref0 (_tmp1_); + return; + } + dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp2_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA)), DBUSMENU_MENUITEM_PROP_VISIBLE, player_item_populated (_tmp3_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), _tmp4_ = metadata_menuitem_attributes_format ())); + _g_object_unref0 (_tmp4_); + _g_object_unref0 (_tmp3_); + _g_object_unref0 (_tmp2_); + dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp5_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT)), DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); + _g_object_unref0 (_tmp5_); +} + + +static void player_controller_construct_widgets (PlayerController* self) { + PlayerItem* _tmp0_; + TitleMenuitem* title_menu_item; + MetadataMenuitem* metadata_item; + TransportMenuitem* transport_item; + g_return_if_fail (self != NULL); + gee_abstract_collection_add ((GeeAbstractCollection*) self->custom_items, _tmp0_ = player_item_new (DBUSMENU_CLIENT_TYPES_SEPARATOR)); + _g_object_unref0 (_tmp0_); + title_menu_item = title_menuitem_new (self); + gee_abstract_collection_add ((GeeAbstractCollection*) self->custom_items, (PlayerItem*) title_menu_item); + metadata_item = metadata_menuitem_new (); + gee_abstract_collection_add ((GeeAbstractCollection*) self->custom_items, (PlayerItem*) metadata_item); + transport_item = transport_menuitem_new (self); + gee_abstract_collection_add ((GeeAbstractCollection*) self->custom_items, (PlayerItem*) transport_item); + { + GeeIterator* _item_it; + _item_it = gee_abstract_collection_iterator ((GeeAbstractCollection*) self->custom_items); + while (TRUE) { + PlayerItem* item; + if (!gee_iterator_next (_item_it)) { + break; + } + item = (PlayerItem*) gee_iterator_get (_item_it); + dbusmenu_menuitem_child_add_position (self->priv->root_menu, (DbusmenuMenuitem*) item, (guint) (self->priv->_menu_offset + gee_abstract_list_index_of ((GeeAbstractList*) self->custom_items, item))); + _g_object_unref0 (item); + } + _g_object_unref0 (_item_it); + } + _g_object_unref0 (transport_item); + _g_object_unref0 (metadata_item); + _g_object_unref0 (title_menu_item); +} + + +static glong string_get_length (const char* self) { + glong result; + g_return_val_if_fail (self != NULL, 0L); + result = g_utf8_strlen (self, (gssize) (-1)); + return result; +} + + +static char* string_slice (const char* self, glong start, glong end) { + char* result = NULL; + glong string_length; + gboolean _tmp0_ = FALSE; + gboolean _tmp1_ = FALSE; + const char* start_string; + g_return_val_if_fail (self != NULL, NULL); + string_length = string_get_length (self); + if (start < 0) { + start = string_length + start; + } + if (end < 0) { + end = string_length + end; + } + if (start >= 0) { + _tmp0_ = start <= string_length; + } else { + _tmp0_ = FALSE; + } + g_return_val_if_fail (_tmp0_, NULL); + if (end >= 0) { + _tmp1_ = end <= string_length; + } else { + _tmp1_ = FALSE; + } + g_return_val_if_fail (_tmp1_, NULL); + g_return_val_if_fail (start <= end, NULL); + start_string = g_utf8_offset_to_pointer (self, start); + result = g_strndup (start_string, ((gchar*) g_utf8_offset_to_pointer (start_string, end - start)) - ((gchar*) start_string)); + return result; +} + + +static char* player_controller_format_client_name (const char* client_name) { + char* result = NULL; + char* formatted; + g_return_val_if_fail (client_name != NULL, NULL); + formatted = g_strdup (client_name); + if (string_get_length (formatted) > 1) { + char* _tmp0_; + char* _tmp1_; + char* _tmp2_; + formatted = (_tmp2_ = g_strconcat (_tmp0_ = g_utf8_strup (client_name, (gssize) 1), _tmp1_ = string_slice (client_name, (glong) 1, string_get_length (client_name)), NULL), _g_free0 (formatted), _tmp2_); + _g_free0 (_tmp1_); + _g_free0 (_tmp0_); + g_debug ("player-controller.vala:168: PlayerController->format_client_name - : %" \ +"s", formatted); + } + result = formatted; + return result; +} + + +void player_controller_determine_state (PlayerController* self) { + g_return_if_fail (self != NULL); + if (mpris2_controller_connected (self->mpris_bridge) == TRUE) { + PlayerItem* _tmp0_; + TitleMenuitem* title; + PlayerItem* _tmp1_; + TransportMenuitem* transport; + player_controller_update_state (self, PLAYER_CONTROLLER_STATE_CONNECTED); + title = (_tmp0_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TITLE), IS_TITLE_MENUITEM (_tmp0_) ? ((TitleMenuitem*) _tmp0_) : NULL); + title_menuitem_toggle_active_triangle (title, TRUE); + transport = (_tmp1_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT), IS_TRANSPORT_MENUITEM (_tmp1_) ? ((TransportMenuitem*) _tmp1_) : NULL); + transport_menuitem_change_play_state (transport, TRANSPORT_MENUITEM_STATE_PAUSED); + _g_object_unref0 (transport); + _g_object_unref0 (title); + } else { + player_controller_update_state (self, PLAYER_CONTROLLER_STATE_DISCONNECTED); + } +} + + +const char* player_controller_get_name (PlayerController* self) { + const char* result; + g_return_val_if_fail (self != NULL, NULL); + result = self->priv->_name; + return result; +} + + +void player_controller_set_name (PlayerController* self, const char* value) { + char* _tmp0_; + g_return_if_fail (self != NULL); + self->priv->_name = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_name), _tmp0_); + g_object_notify ((GObject *) self, "name"); +} + + +const char* player_controller_get_mpris_name (PlayerController* self) { + const char* result; + g_return_val_if_fail (self != NULL, NULL); + result = self->priv->_mpris_name; + return result; +} + + +void player_controller_set_mpris_name (PlayerController* self, const char* value) { + char* _tmp0_; + g_return_if_fail (self != NULL); + self->priv->_mpris_name = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_mpris_name), _tmp0_); + g_object_notify ((GObject *) self, "mpris-name"); +} + + +GAppInfo* player_controller_get_app_info (PlayerController* self) { + GAppInfo* result; + g_return_val_if_fail (self != NULL, NULL); + result = self->priv->_app_info; + return result; +} + + +void player_controller_set_app_info (PlayerController* self, GAppInfo* value) { + GAppInfo* _tmp0_; + g_return_if_fail (self != NULL); + self->priv->_app_info = (_tmp0_ = _g_object_ref0 (value), _g_object_unref0 (self->priv->_app_info), _tmp0_); + g_object_notify ((GObject *) self, "app-info"); +} + + +gint player_controller_get_menu_offset (PlayerController* self) { + gint result; + g_return_val_if_fail (self != NULL, 0); + result = self->priv->_menu_offset; + return result; +} + + +void player_controller_set_menu_offset (PlayerController* self, gint value) { + g_return_if_fail (self != NULL); + self->priv->_menu_offset = value; + g_object_notify ((GObject *) self, "menu-offset"); +} + + +static void player_controller_class_init (PlayerControllerClass * klass) { + player_controller_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (PlayerControllerPrivate)); + G_OBJECT_CLASS (klass)->get_property = player_controller_get_property; + G_OBJECT_CLASS (klass)->set_property = 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_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)); +} + + +static void player_controller_instance_init (PlayerController * self) { + self->priv = PLAYER_CONTROLLER_GET_PRIVATE (self); + self->current_state = (gint) PLAYER_CONTROLLER_STATE_OFFLINE; +} + + +static void player_controller_finalize (GObject* obj) { + PlayerController * self; + self = PLAYER_CONTROLLER (obj); + _g_object_unref0 (self->priv->root_menu); + _g_free0 (self->priv->_name); + _g_free0 (self->priv->_mpris_name); + _g_object_unref0 (self->custom_items); + _g_object_unref0 (self->mpris_bridge); + _g_object_unref0 (self->priv->_app_info); + G_OBJECT_CLASS (player_controller_parent_class)->finalize (obj); +} + + +GType player_controller_get_type (void) { + static volatile gsize player_controller_type_id__volatile = 0; + if (g_once_init_enter (&player_controller_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (PlayerControllerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) player_controller_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PlayerController), 0, (GInstanceInitFunc) player_controller_instance_init, NULL }; + GType player_controller_type_id; + player_controller_type_id = g_type_register_static (G_TYPE_OBJECT, "PlayerController", &g_define_type_info, 0); + g_once_init_leave (&player_controller_type_id__volatile, player_controller_type_id); + } + return player_controller_type_id__volatile; +} + + +static void player_controller_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + PlayerController * self; + self = PLAYER_CONTROLLER (object); + switch (property_id) { + case PLAYER_CONTROLLER_NAME: + g_value_set_string (value, player_controller_get_name (self)); + break; + case PLAYER_CONTROLLER_MPRIS_NAME: + g_value_set_string (value, player_controller_get_mpris_name (self)); + break; + case PLAYER_CONTROLLER_APP_INFO: + g_value_set_object (value, player_controller_get_app_info (self)); + break; + case PLAYER_CONTROLLER_MENU_OFFSET: + g_value_set_int (value, player_controller_get_menu_offset (self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void player_controller_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + PlayerController * self; + self = PLAYER_CONTROLLER (object); + switch (property_id) { + case PLAYER_CONTROLLER_NAME: + player_controller_set_name (self, g_value_get_string (value)); + break; + case PLAYER_CONTROLLER_MPRIS_NAME: + player_controller_set_mpris_name (self, g_value_get_string (value)); + break; + case PLAYER_CONTROLLER_APP_INFO: + player_controller_set_app_info (self, g_value_get_object (value)); + break; + case PLAYER_CONTROLLER_MENU_OFFSET: + player_controller_set_menu_offset (self, g_value_get_int (value)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + + + diff --git a/src/player-item.c b/src/player-item.c new file mode 100644 index 0000000..707d161 --- /dev/null +++ b/src/player-item.c @@ -0,0 +1,475 @@ +/* player-item.c generated by valac 0.10.0, the Vala compiler + * generated from player-item.vala, do not modify */ + +/* +Copyright 2010 Canonical Ltd. + +Authors: + Conor Curran <conor.curran@canonical.com> + +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published +by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include <glib.h> +#include <glib-object.h> +#include <libdbusmenu-glib/client.h> +#include <libdbusmenu-glib/menuitem-proxy.h> +#include <libdbusmenu-glib/menuitem.h> +#include <libdbusmenu-glib/server.h> +#include <stdlib.h> +#include <string.h> +#include <gee.h> + + +#define TYPE_PLAYER_ITEM (player_item_get_type ()) +#define PLAYER_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYER_ITEM, PlayerItem)) +#define PLAYER_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYER_ITEM, PlayerItemClass)) +#define IS_PLAYER_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYER_ITEM)) +#define IS_PLAYER_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYER_ITEM)) +#define PLAYER_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYER_ITEM, PlayerItemClass)) + +typedef struct _PlayerItem PlayerItem; +typedef struct _PlayerItemClass PlayerItemClass; +typedef struct _PlayerItemPrivate PlayerItemPrivate; + +#define TYPE_PLAYER_CONTROLLER (player_controller_get_type ()) +#define PLAYER_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYER_CONTROLLER, PlayerController)) +#define PLAYER_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYER_CONTROLLER, PlayerControllerClass)) +#define IS_PLAYER_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYER_CONTROLLER)) +#define IS_PLAYER_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYER_CONTROLLER)) +#define PLAYER_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYER_CONTROLLER, PlayerControllerClass)) + +typedef struct _PlayerController PlayerController; +typedef struct _PlayerControllerClass PlayerControllerClass; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _g_free0(var) (var = (g_free (var), NULL)) + +#define TYPE_METADATA_MENUITEM (metadata_menuitem_get_type ()) +#define METADATA_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_METADATA_MENUITEM, MetadataMenuitem)) +#define METADATA_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_METADATA_MENUITEM, MetadataMenuitemClass)) +#define IS_METADATA_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_METADATA_MENUITEM)) +#define IS_METADATA_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_METADATA_MENUITEM)) +#define METADATA_MENUITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_METADATA_MENUITEM, MetadataMenuitemClass)) + +typedef struct _MetadataMenuitem MetadataMenuitem; +typedef struct _MetadataMenuitemClass MetadataMenuitemClass; +#define __vala_GValue_free0(var) ((var == NULL) ? NULL : (var = (_vala_GValue_free (var), NULL))) + +struct _PlayerItem { + DbusmenuMenuitem parent_instance; + PlayerItemPrivate * priv; +}; + +struct _PlayerItemClass { + DbusmenuMenuitemClass parent_class; +}; + +struct _PlayerItemPrivate { + PlayerController* _owner; + char* _item_type; +}; + + +static gpointer player_item_parent_class = NULL; + +GType player_item_get_type (void) G_GNUC_CONST; +GType player_controller_get_type (void) G_GNUC_CONST; +#define PLAYER_ITEM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_PLAYER_ITEM, PlayerItemPrivate)) +enum { + PLAYER_ITEM_DUMMY_PROPERTY, + PLAYER_ITEM_OWNER, + PLAYER_ITEM_ITEM_TYPE +}; +#define PLAYER_ITEM_EMPTY (-1) +PlayerItem* player_item_new (const char* type); +PlayerItem* player_item_construct (GType object_type, const char* 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 char* uri, const char* 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); +const char* player_item_get_item_type (PlayerItem* self); +static void player_item_set_item_type (PlayerItem* self, const char* value); +static GObject * player_item_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); +static void player_item_finalize (GObject* obj); +static void player_item_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void player_item_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func); +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func); +static gint _vala_array_length (gpointer array); + + + +PlayerItem* player_item_construct (GType object_type, const char* type) { + PlayerItem * self; + g_return_val_if_fail (type != NULL, NULL); + self = (PlayerItem*) g_object_new (object_type, "item-type", type, NULL); + return self; +} + + +PlayerItem* player_item_new (const char* type) { + return player_item_construct (TYPE_PLAYER_ITEM, type); +} + + +void player_item_reset (PlayerItem* self, GeeHashSet* attrs) { + g_return_if_fail (self != NULL); + g_return_if_fail (attrs != NULL); + { + GeeIterator* _s_it; + _s_it = gee_abstract_collection_iterator ((GeeAbstractCollection*) attrs); + while (TRUE) { + char* s; + if (!gee_iterator_next (_s_it)) { + break; + } + s = (char*) gee_iterator_get (_s_it); + g_debug ("player-item.vala:40: attempting to set prop %s to EMPTY", s); + dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, s, PLAYER_ITEM_EMPTY); + _g_free0 (s); + } + _g_object_unref0 (_s_it); + } +} + + +/** + * 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; +} + + +static char* string_strip (const char* self) { + char* result = NULL; + char* _result_; + g_return_val_if_fail (self != NULL, NULL); + _result_ = g_strdup (self); + g_strstrip (_result_); + result = _result_; + return result; +} + + +static gboolean string_contains (const char* self, const char* needle) { + gboolean result = FALSE; + g_return_val_if_fail (self != NULL, FALSE); + g_return_val_if_fail (needle != NULL, FALSE); + result = strstr (self, needle) != NULL; + return result; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static void _vala_GValue_free (GValue* self) { + g_value_unset (self); + g_free (self); +} + + +static char* bool_to_string (gboolean self) { + char* result = NULL; + if (self) { + result = g_strdup ("true"); + return result; + } else { + result = g_strdup ("false"); + return result; + } +} + + +void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attributes) { + g_return_if_fail (self != NULL); + g_return_if_fail (data != NULL); + g_return_if_fail (attributes != NULL); + g_debug ("player-item.vala:53: PlayerItem::update()"); + if (data == NULL) { + g_debug ("player-item.vala:55: PlayerItem::Update -> The hashtable was null - ju" \ +"st leave it!"); + return; + } + { + GeeIterator* _property_it; + _property_it = gee_abstract_collection_iterator ((GeeAbstractCollection*) attributes); + while (TRUE) { + char* property; + gint input_keys_length1; + gint _input_keys_size_; + char** _tmp1_; + char** _tmp0_; + char** input_keys; + gint _tmp2_; + char** _tmp3_ = NULL; + char* search_key; + GValue* v; + if (!gee_iterator_next (_property_it)) { + break; + } + property = (char*) gee_iterator_get (_property_it); + input_keys = (_tmp1_ = _tmp0_ = g_strsplit (property, "-", 0), input_keys_length1 = _vala_array_length (_tmp0_), _input_keys_size_ = input_keys_length1, _tmp1_); + search_key = g_strdup ((_tmp3_ = input_keys + (input_keys_length1 - 1), _tmp2_ = input_keys_length1 - (input_keys_length1 - 1), _tmp3_)[0]); + g_debug ("player-item.vala:62: search key = %s", search_key); + v = __g_value_dup0 ((GValue*) g_hash_table_lookup (data, search_key)); + if (G_VALUE_HOLDS (v, G_TYPE_STRING)) { + char* update; + update = string_strip (g_value_get_string (v)); + g_debug ("player-item.vala:67: with value : %s", update); + if (string_contains (property, "mpris:artUrl")) { + PlayerItem* _tmp4_; + MetadataMenuitem* metadata; + char* _tmp5_; + metadata = _g_object_ref0 ((_tmp4_ = self, IS_METADATA_MENUITEM (_tmp4_) ? ((MetadataMenuitem*) _tmp4_) : NULL)); + metadata_menuitem_fetch_art (metadata, _tmp5_ = string_strip (update), property); + _g_free0 (_tmp5_); + _g_object_unref0 (metadata); + _g_free0 (update); + __vala_GValue_free0 (v); + _g_free0 (search_key); + input_keys = (_vala_array_free (input_keys, input_keys_length1, (GDestroyNotify) g_free), NULL); + _g_free0 (property); + continue; + } + dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, property, update); + _g_free0 (update); + } else { + if (G_VALUE_HOLDS (v, G_TYPE_INT)) { + g_debug ("player-item.vala:78: with value : %i", g_value_get_int (v)); + dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, property, g_value_get_int (v)); + } else { + if (G_VALUE_HOLDS (v, G_TYPE_INT64)) { + g_debug ("player-item.vala:82: with value : %i", (gint) g_value_get_int64 (v)); + dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, property, (gint) g_value_get_int64 (v)); + } else { + if (G_VALUE_HOLDS (v, G_TYPE_BOOLEAN)) { + char* _tmp6_; + g_debug ("player-item.vala:86: with value : %s", _tmp6_ = bool_to_string (g_value_get_boolean (v))); + _g_free0 (_tmp6_); + dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) self, property, g_value_get_boolean (v)); + } + } + } + } + __vala_GValue_free0 (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); + } + if (dbusmenu_menuitem_property_get_bool ((DbusmenuMenuitem*) self, DBUSMENU_MENUITEM_PROP_VISIBLE) == FALSE) { + dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) self, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); + } +} + + +gboolean player_item_populated (PlayerItem* self, GeeHashSet* attrs) { + gboolean result = FALSE; + g_return_val_if_fail (self != NULL, FALSE); + g_return_val_if_fail (attrs != NULL, FALSE); + { + GeeIterator* _prop_it; + _prop_it = gee_abstract_collection_iterator ((GeeAbstractCollection*) attrs); + while (TRUE) { + char* prop; + gint value_int; + if (!gee_iterator_next (_prop_it)) { + break; + } + prop = (char*) gee_iterator_get (_prop_it); + g_debug ("player-item.vala:98: populated ? - prop: %s", prop); + value_int = dbusmenu_menuitem_property_get_int ((DbusmenuMenuitem*) self, prop); + g_debug ("player-item.vala:100: populated ? - prop %s and value %i", prop, value_int); + if (dbusmenu_menuitem_property_get_int ((DbusmenuMenuitem*) self, prop) != PLAYER_ITEM_EMPTY) { + result = TRUE; + _g_free0 (prop); + _g_object_unref0 (_prop_it); + return result; + } + _g_free0 (prop); + } + _g_object_unref0 (_prop_it); + } + result = FALSE; + return result; +} + + +PlayerController* player_item_get_owner (PlayerItem* self) { + PlayerController* result; + g_return_val_if_fail (self != NULL, NULL); + result = self->priv->_owner; + return result; +} + + +static void player_item_set_owner (PlayerItem* self, PlayerController* value) { + PlayerController* _tmp0_; + g_return_if_fail (self != NULL); + self->priv->_owner = (_tmp0_ = _g_object_ref0 (value), _g_object_unref0 (self->priv->_owner), _tmp0_); + g_object_notify ((GObject *) self, "owner"); +} + + +const char* player_item_get_item_type (PlayerItem* self) { + const char* result; + g_return_val_if_fail (self != NULL, NULL); + result = self->priv->_item_type; + return result; +} + + +static void player_item_set_item_type (PlayerItem* self, const char* value) { + char* _tmp0_; + g_return_if_fail (self != NULL); + self->priv->_item_type = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_item_type), _tmp0_); + g_object_notify ((GObject *) self, "item-type"); +} + + +static GObject * player_item_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) { + GObject * obj; + GObjectClass * parent_class; + PlayerItem * self; + parent_class = G_OBJECT_CLASS (player_item_parent_class); + obj = parent_class->constructor (type, n_construct_properties, construct_properties); + self = PLAYER_ITEM (obj); + { + dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, DBUSMENU_MENUITEM_PROP_TYPE, self->priv->_item_type); + } + return obj; +} + + +static void player_item_class_init (PlayerItemClass * klass) { + player_item_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (PlayerItemPrivate)); + G_OBJECT_CLASS (klass)->get_property = player_item_get_property; + G_OBJECT_CLASS (klass)->set_property = player_item_set_property; + G_OBJECT_CLASS (klass)->constructor = player_item_constructor; + G_OBJECT_CLASS (klass)->finalize = player_item_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYER_ITEM_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), PLAYER_ITEM_ITEM_TYPE, g_param_spec_string ("item-type", "item-type", "item-type", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); +} + + +static void player_item_instance_init (PlayerItem * self) { + self->priv = PLAYER_ITEM_GET_PRIVATE (self); +} + + +static void player_item_finalize (GObject* obj) { + PlayerItem * self; + self = PLAYER_ITEM (obj); + _g_object_unref0 (self->priv->_owner); + _g_free0 (self->priv->_item_type); + G_OBJECT_CLASS (player_item_parent_class)->finalize (obj); +} + + +GType player_item_get_type (void) { + static volatile gsize player_item_type_id__volatile = 0; + if (g_once_init_enter (&player_item_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (PlayerItemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) player_item_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PlayerItem), 0, (GInstanceInitFunc) player_item_instance_init, NULL }; + GType player_item_type_id; + player_item_type_id = g_type_register_static (DBUSMENU_TYPE_MENUITEM, "PlayerItem", &g_define_type_info, 0); + g_once_init_leave (&player_item_type_id__volatile, player_item_type_id); + } + return player_item_type_id__volatile; +} + + +static void player_item_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + PlayerItem * self; + self = PLAYER_ITEM (object); + switch (property_id) { + case PLAYER_ITEM_OWNER: + g_value_set_object (value, player_item_get_owner (self)); + break; + case PLAYER_ITEM_ITEM_TYPE: + g_value_set_string (value, player_item_get_item_type (self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void player_item_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + PlayerItem * self; + self = PLAYER_ITEM (object); + switch (property_id) { + case PLAYER_ITEM_OWNER: + player_item_set_owner (self, g_value_get_object (value)); + break; + case PLAYER_ITEM_ITEM_TYPE: + player_item_set_item_type (self, g_value_get_string (value)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) { + if ((array != NULL) && (destroy_func != NULL)) { + int i; + for (i = 0; i < array_length; i = i + 1) { + if (((gpointer*) array)[i] != NULL) { + destroy_func (((gpointer*) array)[i]); + } + } + } +} + + +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) { + _vala_array_destroy (array, array_length, destroy_func); + g_free (array); +} + + +static gint _vala_array_length (gpointer array) { + int length; + length = 0; + if (array) { + while (((gpointer*) array)[length]) { + length++; + } + } + return length; +} + + + + diff --git a/src/scrub-menu-item.vala b/src/scrub-menu-item.vala deleted file mode 100644 index d7b60a0..0000000 --- a/src/scrub-menu-item.vala +++ /dev/null @@ -1,56 +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 Dbusmenu; -using DbusmenuScrub; -using Gee; - -public class ScrubMenuitem : PlayerItem -{ - public ScrubMenuitem(PlayerController parent) - { - Object(item_type: MENUITEM_TYPE, owner: parent); - reset(attributes_format()); - } - - public override void handle_event(string name, GLib.Value input_value, uint timestamp) - { - debug("handle_event for owner %s with value: %f", this.owner.name, input_value.get_double()); - this.owner.mpris_bridge.set_track_position(input_value.get_double()); - } - - public void update_position(int32 new_position) - { - this.property_set_int(MENUITEM_POSITION, new_position); - } - - public void update_playstate(int state) - { - this.property_set_int(MENUITEM_PLAY_STATE, state); - } - - public static HashSet<string> attributes_format() - { - HashSet<string> attrs = new HashSet<string>(); - attrs.add(MENUITEM_DURATION); - attrs.add(MENUITEM_POSITION); - attrs.add(MENUITEM_PLAY_STATE); - return attrs; - } -}
\ No newline at end of file diff --git a/src/scrub-widget.c b/src/scrub-widget.c deleted file mode 100644 index a1d45d5..0000000 --- a/src/scrub-widget.c +++ /dev/null @@ -1,376 +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/>. -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <glib/gi18n.h> -#include "scrub-widget.h" -#include "common-defs.h" -#include <libido/idoscalemenuitem.h> -#include <libido/idotimeline.h> - -typedef struct _ScrubWidgetPrivate ScrubWidgetPrivate; - -struct _ScrubWidgetPrivate -{ - DbusmenuMenuitem* twin_item; - GtkWidget* ido_scrub_bar; - IdoTimeline* time_line; - gboolean scrubbing; -}; - -#define SCRUB_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SCRUB_WIDGET_TYPE, ScrubWidgetPrivate)) - -/* Prototypes */ -static void scrub_widget_class_init (ScrubWidgetClass *klass); -static void scrub_widget_init (ScrubWidget *self); -static void scrub_widget_dispose (GObject *object); -static void scrub_widget_finalize (GObject *object); -static void scrub_widget_property_update( DbusmenuMenuitem* item, gchar* property, - GValue* value, gpointer userdata); -static void scrub_widget_set_twin_item( ScrubWidget* self, - DbusmenuMenuitem* twin_item); -static gchar* scrub_widget_format_time(gint time); -static void scrub_widget_set_ido_position(ScrubWidget* self, - gint position, - gint duration); -static gboolean scrub_widget_change_value_cb (GtkRange *range, - GtkScrollType scroll, - gdouble value, - gpointer user_data); - -static void scrub_widget_timeline_frame_cb(IdoTimeline *timeline, - gdouble progress, - gpointer userdata); -static void scrub_widget_timeline_started_cb(IdoTimeline *timeline, - gpointer userdata); -static void scrub_widget_timeline_finished_cb(IdoTimeline *timeline, - gpointer userdata); -static gdouble scrub_widget_calculate_progress(ScrubWidget* widget); -static void scrub_widget_check_play_state(ScrubWidget* self); -static void scrub_widget_slider_grabbed(GtkWidget *widget, gpointer user_data); -static void scrub_widget_slider_released(GtkWidget *widget, gpointer user_data); - - - -G_DEFINE_TYPE (ScrubWidget, scrub_widget, G_TYPE_OBJECT); - -static void -scrub_widget_class_init (ScrubWidgetClass *klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - - g_type_class_add_private (klass, sizeof (ScrubWidgetPrivate)); - - gobject_class->dispose = scrub_widget_dispose; - gobject_class->finalize = scrub_widget_finalize; -} - -static void -scrub_widget_init (ScrubWidget *self) -{ - g_debug("ScrubWidget::scrub_widget_init"); - ScrubWidgetPrivate * priv = SCRUB_WIDGET_GET_PRIVATE(self); - - priv->ido_scrub_bar = ido_scale_menu_item_new_with_range ("Scrub", IDO_RANGE_STYLE_SMALL, 0, 0, 100, 1); - priv->time_line = ido_timeline_new(0); - - ido_scale_menu_item_set_style (IDO_SCALE_MENU_ITEM(priv->ido_scrub_bar), IDO_SCALE_MENU_ITEM_STYLE_LABEL); - - g_object_set(priv->ido_scrub_bar, "reverse-scroll-events", TRUE, NULL); - priv->scrubbing = FALSE; - - gtk_widget_set_size_request(GTK_WIDGET(priv->ido_scrub_bar), 100, 25); - - // register slider changes listening on the range - GtkWidget* scrub_widget = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_scrub_bar); - g_signal_connect(scrub_widget, "change-value", G_CALLBACK(scrub_widget_change_value_cb), self); - g_signal_connect(priv->time_line, "frame", G_CALLBACK(scrub_widget_timeline_frame_cb), self); - g_signal_connect(priv->time_line, "started", G_CALLBACK(scrub_widget_timeline_started_cb), self); - g_signal_connect(priv->time_line, "finished", G_CALLBACK(scrub_widget_timeline_finished_cb), self); - g_signal_connect(priv->ido_scrub_bar, "slider-grabbed", G_CALLBACK(scrub_widget_slider_grabbed), self); - g_signal_connect(priv->ido_scrub_bar, "slider-released", G_CALLBACK(scrub_widget_slider_released), self); - -} - -static void -scrub_widget_dispose (GObject *object) -{ - G_OBJECT_CLASS (scrub_widget_parent_class)->dispose (object); -} - -static void -scrub_widget_finalize (GObject *object) -{ - G_OBJECT_CLASS (scrub_widget_parent_class)->finalize (object); -} - -static void -scrub_widget_property_update(DbusmenuMenuitem* item, gchar* property, - GValue* value, gpointer userdata) -{ - g_debug("scrub-widget::property_update"); - - g_return_if_fail (IS_SCRUB_WIDGET (userdata)); - ScrubWidget* mitem = SCRUB_WIDGET(userdata); - ScrubWidgetPrivate * priv = SCRUB_WIDGET_GET_PRIVATE(mitem); - - if(g_ascii_strcasecmp(DBUSMENU_SCRUB_MENUITEM_DURATION, property) == 0){ - g_debug("scrub-widget::update length = %i", g_value_get_int(value)); - - ido_scale_menu_item_set_secondary_label(IDO_SCALE_MENU_ITEM(priv->ido_scrub_bar), - scrub_widget_format_time(g_value_get_int(value))); - - ido_timeline_set_duration(priv->time_line, g_value_get_int(value) * 1000); - ido_timeline_rewind(priv->time_line); - scrub_widget_check_play_state(mitem); - //g_debug("timeline is running: %i", (gint)ido_timeline_is_running(priv->time_line)); - //g_debug("timeline duration = %i", ido_timeline_get_duration(priv->time_line)); - - scrub_widget_set_ido_position(mitem, - dbusmenu_menuitem_property_get_int(priv->twin_item, DBUSMENU_SCRUB_MENUITEM_POSITION)/1000, - dbusmenu_menuitem_property_get_int(priv->twin_item, DBUSMENU_SCRUB_MENUITEM_DURATION)); - } - else if(g_ascii_strcasecmp(DBUSMENU_SCRUB_MENUITEM_POSITION, property) == 0){ - g_debug("scrub-widget::update position = %i", g_value_get_int(value)); - ido_timeline_pause(priv->time_line); - ido_scale_menu_item_set_primary_label(IDO_SCALE_MENU_ITEM(priv->ido_scrub_bar), - scrub_widget_format_time(g_value_get_int(value)/1000)); - - g_debug("scrub-widget::update progress = %f", scrub_widget_calculate_progress(mitem)*100); - - ido_timeline_set_progress(priv->time_line, scrub_widget_calculate_progress(mitem)); - scrub_widget_set_ido_position(mitem, g_value_get_int(value)/1000, - dbusmenu_menuitem_property_get_int(priv->twin_item, DBUSMENU_SCRUB_MENUITEM_DURATION)); - - scrub_widget_check_play_state(mitem); - } - else if(g_ascii_strcasecmp(DBUSMENU_SCRUB_MENUITEM_PLAY_STATE, property) == 0){ - scrub_widget_check_play_state(mitem); - } -} - -static void -scrub_widget_check_play_state(ScrubWidget* self) -{ - ScrubWidgetPrivate * priv = SCRUB_WIDGET_GET_PRIVATE(self); - gint play_state = dbusmenu_menuitem_property_get_int(priv->twin_item, - DBUSMENU_SCRUB_MENUITEM_PLAY_STATE); - g_debug("play-state = %i", play_state); - if(play_state == 0){ - g_debug("START TIMELINE"); - ido_timeline_start(priv->time_line); - } - else{ - g_debug("PAUSE TIMELINE"); - ido_timeline_pause(priv->time_line); - } -} - -static void -scrub_widget_set_twin_item(ScrubWidget* self, - DbusmenuMenuitem* twin_item) -{ - ScrubWidgetPrivate * priv = SCRUB_WIDGET_GET_PRIVATE(self); - priv->twin_item = twin_item; - - g_signal_connect(G_OBJECT(twin_item), "property-changed", - G_CALLBACK(scrub_widget_property_update), self); - - gchar* left_text = scrub_widget_format_time(dbusmenu_menuitem_property_get_int(priv->twin_item, - DBUSMENU_SCRUB_MENUITEM_POSITION)/1000); - gchar* right_text = scrub_widget_format_time(dbusmenu_menuitem_property_get_int(priv->twin_item, - DBUSMENU_SCRUB_MENUITEM_DURATION)); - scrub_widget_set_ido_position(self, - dbusmenu_menuitem_property_get_int(priv->twin_item, DBUSMENU_SCRUB_MENUITEM_POSITION)/1000, - dbusmenu_menuitem_property_get_int(priv->twin_item, DBUSMENU_SCRUB_MENUITEM_DURATION)); - - ido_scale_menu_item_set_primary_label(IDO_SCALE_MENU_ITEM(priv->ido_scrub_bar), left_text); - ido_scale_menu_item_set_secondary_label(IDO_SCALE_MENU_ITEM(priv->ido_scrub_bar), right_text); - g_free(left_text); - g_free(right_text); -} - -static gboolean -scrub_widget_change_value_cb (GtkRange *range, - GtkScrollType scroll, - gdouble new_value, - gpointer user_data) -{ - g_return_val_if_fail (IS_SCRUB_WIDGET (user_data), FALSE); - ScrubWidget* mitem = SCRUB_WIDGET(user_data); - ScrubWidgetPrivate * priv = SCRUB_WIDGET_GET_PRIVATE(mitem); - - // Don't bother when the slider is grabbed - if(priv->scrubbing == TRUE) - return FALSE; - - GValue value = {0}; - g_value_init(&value, G_TYPE_DOUBLE); - gdouble clamped = CLAMP(new_value, 0, 100); - g_value_set_double(&value, clamped); - dbusmenu_menuitem_handle_event (priv->twin_item, "scrubbing", &value, 0); - return TRUE; -} - -GtkWidget* -scrub_widget_get_ido_bar(ScrubWidget* self) -{ - ScrubWidgetPrivate * priv = SCRUB_WIDGET_GET_PRIVATE(self); - return priv->ido_scrub_bar; -} - -static gchar* -scrub_widget_format_time(gint time) -{ -// Assuming its in seconds for now ... - gchar* prefix = "-"; - gchar* seconds_prefix = "-"; - - if(time != DBUSMENU_PROPERTY_EMPTY){ - gint minutes = time/60; - gint seconds = time % 60; - prefix="0"; - seconds_prefix="0"; - if(minutes > 9) - prefix=""; - if(seconds > 9) - seconds_prefix=""; - return g_strdup_printf("%s%i:%s%i", prefix, minutes, seconds_prefix, seconds); - - } - else{ - return g_strdup_printf("%s-:%s-", prefix, seconds_prefix); - } -} - -static void -scrub_widget_set_ido_position(ScrubWidget* self, - gint position, - gint duration) -{ - ScrubWidgetPrivate * priv = SCRUB_WIDGET_GET_PRIVATE(self); - gdouble ido_position = position/(gdouble)duration * 100.0; - g_debug("scrub_widget_set_ido_position - pos: %i, duration: %i, ido_pos: %f", position, duration, ido_position); - GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_scrub_bar); - GtkRange *range = (GtkRange*)slider; - if(duration == 0) - ido_position = 0.0; - gtk_range_set_value(range, ido_position); -} - -static gdouble -scrub_widget_calculate_progress(ScrubWidget* widget) -{ - ScrubWidgetPrivate * priv = SCRUB_WIDGET_GET_PRIVATE(widget); - gint position = dbusmenu_menuitem_property_get_int(priv->twin_item, - DBUSMENU_SCRUB_MENUITEM_POSITION)/1000; - gint duration = dbusmenu_menuitem_property_get_int(priv->twin_item, - DBUSMENU_SCRUB_MENUITEM_DURATION); - gdouble ido_position = position/(gdouble)duration; - g_debug("scrub_widget_calculate_progress %f", ido_position); - - return ido_position; -} - - -static void -scrub_widget_timeline_frame_cb( IdoTimeline *timeline, - gdouble progress, - gpointer user_data) -{ - - //g_debug("Timeline CB : %f", progress); - g_return_if_fail (IS_SCRUB_WIDGET (user_data)); - ScrubWidget* mitem = SCRUB_WIDGET(user_data); - ScrubWidgetPrivate * priv = SCRUB_WIDGET_GET_PRIVATE(mitem); - if(priv->scrubbing == TRUE) - { - g_debug("don't update the slider or timeline, slider is being scrubbed"); - return; - } - gint position = progress * dbusmenu_menuitem_property_get_int(priv->twin_item, - DBUSMENU_SCRUB_MENUITEM_DURATION); - gchar* left_text = scrub_widget_format_time(position); - ido_scale_menu_item_set_primary_label(IDO_SCALE_MENU_ITEM(priv->ido_scrub_bar), left_text); - GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_scrub_bar); - GtkRange *range = (GtkRange*)slider; - gtk_range_set_value(range, progress * 100); - /*g_debug("position in seconds %i and in words %s", position, left_text); - g_debug("timeline is running: %i", (gint)ido_timeline_is_running(priv->time_line)); - g_debug("timeline duration = %i", ido_timeline_get_duration(priv->time_line)); - */ - //g_debug("timeline-update - progress = %f", progress); - g_free(left_text); -} - - -static void -scrub_widget_slider_released(GtkWidget *widget, gpointer user_data) -{ - ScrubWidget* mitem = SCRUB_WIDGET(user_data); - ScrubWidgetPrivate * priv = SCRUB_WIDGET_GET_PRIVATE(mitem); - priv->scrubbing = FALSE; - GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_scrub_bar); - gdouble new_value = gtk_range_get_value(GTK_RANGE(slider)); - g_debug("okay set the scrub position with %f", new_value); - GValue value = {0}; - g_value_init(&value, G_TYPE_DOUBLE); - gdouble clamped = CLAMP(new_value, 0, 100); - g_value_set_double(&value, clamped); - dbusmenu_menuitem_handle_event (priv->twin_item, "scrubbing", &value, 0); -} - -static void -scrub_widget_slider_grabbed(GtkWidget *widget, gpointer user_data) -{ - ScrubWidget* mitem = SCRUB_WIDGET(user_data); - ScrubWidgetPrivate * priv = SCRUB_WIDGET_GET_PRIVATE(mitem); - priv->scrubbing = TRUE; -} - -static void -scrub_widget_timeline_started_cb( IdoTimeline *timeline, - gpointer user_data) -{ - g_debug("Timeline Started!"); -} - -static void -scrub_widget_timeline_finished_cb(IdoTimeline *timeline, - gpointer user_data) -{ - g_debug("Timeline Finished!"); -} - -/** - * scrub_widget_new: - * @returns: a new #ScrubWidget. - **/ -GtkWidget* -scrub_widget_new(DbusmenuMenuitem *item) -{ - GtkWidget* widget = g_object_new(SCRUB_WIDGET_TYPE, NULL); - scrub_widget_set_twin_item((ScrubWidget*)widget, item); - return widget; -} - - diff --git a/src/scrub-widget.h b/src/scrub-widget.h deleted file mode 100644 index e518a80..0000000 --- a/src/scrub-widget.h +++ /dev/null @@ -1,53 +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/>. -*/ -#ifndef __SCRUB_WIDGET_H__ -#define __SCRUB_WIDGET_H__ - -#include <glib.h> -#include <glib-object.h> -#include <libdbusmenu-gtk/menuitem.h> - -G_BEGIN_DECLS - -#define SCRUB_WIDGET_TYPE (scrub_widget_get_type ()) -#define SCRUB_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SCRUB_WIDGET_TYPE, ScrubWidget)) -#define SCRUB_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SCRUB_WIDGET_TYPE, ScrubWidgetClass)) -#define IS_SCRUB_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SCRUB_WIDGET_TYPE)) -#define IS_SCRUB_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SCRUB_WIDGET_TYPE)) -#define SCRUB_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SCRUB_WIDGET_TYPE, ScrubWidgetClass)) - -typedef struct _ScrubWidget ScrubWidget; -typedef struct _ScrubWidgetClass ScrubWidgetClass; - -struct _ScrubWidgetClass { - GObjectClass parent_class; -}; - -struct _ScrubWidget { - GObject parent; -}; - -GType scrub_widget_get_type (void) G_GNUC_CONST; -GtkWidget* scrub_widget_new(DbusmenuMenuitem* twin_item); -GtkWidget* scrub_widget_get_ido_bar(ScrubWidget* self); - -G_END_DECLS - -#endif - diff --git a/src/sound-service-client.h b/src/sound-service-client.h new file mode 100644 index 0000000..ab1acd1 --- /dev/null +++ b/src/sound-service-client.h @@ -0,0 +1,102 @@ +/* Generated by dbus-binding-tool; do not edit! */ + +#include <glib.h> +#include <dbus/dbus-glib.h> + +G_BEGIN_DECLS + +#ifndef _DBUS_GLIB_ASYNC_DATA_FREE +#define _DBUS_GLIB_ASYNC_DATA_FREE +static +#ifdef G_HAVE_INLINE +inline +#endif +void +_dbus_glib_async_data_free (gpointer stuff) +{ + g_slice_free (DBusGAsyncData, stuff); +} +#endif + +#ifndef DBUS_GLIB_CLIENT_WRAPPERS_org_ayatana_indicator_sound +#define DBUS_GLIB_CLIENT_WRAPPERS_org_ayatana_indicator_sound + +static +#ifdef G_HAVE_INLINE +inline +#endif +gboolean +org_ayatana_indicator_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); + +static void +org_ayatana_indicator_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); + return; +} + +static +#ifdef G_HAVE_INLINE +inline +#endif +DBusGProxyCall* +org_ayatana_indicator_sound_get_sink_mute_async (DBusGProxy *proxy, org_ayatana_indicator_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); +} +static +#ifdef G_HAVE_INLINE +inline +#endif +gboolean +org_ayatana_indicator_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); + +static void +org_ayatana_indicator_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); + return; +} + +static +#ifdef G_HAVE_INLINE +inline +#endif +DBusGProxyCall* +org_ayatana_indicator_sound_get_sink_availability_async (DBusGProxy *proxy, org_ayatana_indicator_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); +} +#endif /* defined DBUS_GLIB_CLIENT_WRAPPERS_org_ayatana_indicator_sound */ + +G_END_DECLS diff --git a/src/sound-service-server.h b/src/sound-service-server.h new file mode 100644 index 0000000..19d3f89 --- /dev/null +++ b/src/sound-service-server.h @@ -0,0 +1,122 @@ +/* Generated by dbus-binding-tool; do not edit! */ + + +#ifndef __dbus_glib_marshal__sound_service_server_MARSHAL_H__ +#define __dbus_glib_marshal__sound_service_server_MARSHAL_H__ + +#include <glib-object.h> + +G_BEGIN_DECLS + +#ifdef G_ENABLE_DEBUG +#define g_marshal_value_peek_boolean(v) g_value_get_boolean (v) +#define g_marshal_value_peek_char(v) g_value_get_char (v) +#define g_marshal_value_peek_uchar(v) g_value_get_uchar (v) +#define g_marshal_value_peek_int(v) g_value_get_int (v) +#define g_marshal_value_peek_uint(v) g_value_get_uint (v) +#define g_marshal_value_peek_long(v) g_value_get_long (v) +#define g_marshal_value_peek_ulong(v) g_value_get_ulong (v) +#define g_marshal_value_peek_int64(v) g_value_get_int64 (v) +#define g_marshal_value_peek_uint64(v) g_value_get_uint64 (v) +#define g_marshal_value_peek_enum(v) g_value_get_enum (v) +#define g_marshal_value_peek_flags(v) g_value_get_flags (v) +#define g_marshal_value_peek_float(v) g_value_get_float (v) +#define g_marshal_value_peek_double(v) g_value_get_double (v) +#define g_marshal_value_peek_string(v) (char*) g_value_get_string (v) +#define g_marshal_value_peek_param(v) g_value_get_param (v) +#define g_marshal_value_peek_boxed(v) g_value_get_boxed (v) +#define g_marshal_value_peek_pointer(v) g_value_get_pointer (v) +#define g_marshal_value_peek_object(v) g_value_get_object (v) +#define g_marshal_value_peek_variant(v) g_value_get_variant (v) +#else /* !G_ENABLE_DEBUG */ +/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API. + * Do not access GValues directly in your code. Instead, use the + * g_value_get_*() functions + */ +#define g_marshal_value_peek_boolean(v) (v)->data[0].v_int +#define g_marshal_value_peek_char(v) (v)->data[0].v_int +#define g_marshal_value_peek_uchar(v) (v)->data[0].v_uint +#define g_marshal_value_peek_int(v) (v)->data[0].v_int +#define g_marshal_value_peek_uint(v) (v)->data[0].v_uint +#define g_marshal_value_peek_long(v) (v)->data[0].v_long +#define g_marshal_value_peek_ulong(v) (v)->data[0].v_ulong +#define g_marshal_value_peek_int64(v) (v)->data[0].v_int64 +#define g_marshal_value_peek_uint64(v) (v)->data[0].v_uint64 +#define g_marshal_value_peek_enum(v) (v)->data[0].v_long +#define g_marshal_value_peek_flags(v) (v)->data[0].v_ulong +#define g_marshal_value_peek_float(v) (v)->data[0].v_float +#define g_marshal_value_peek_double(v) (v)->data[0].v_double +#define g_marshal_value_peek_string(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_param(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_boxed(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_pointer(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_object(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_variant(v) (v)->data[0].v_pointer +#endif /* !G_ENABLE_DEBUG */ + + +/* BOOLEAN:POINTER,POINTER */ +extern void dbus_glib_marshal__sound_service_server_BOOLEAN__POINTER_POINTER (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +void +dbus_glib_marshal__sound_service_server_BOOLEAN__POINTER_POINTER (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef gboolean (*GMarshalFunc_BOOLEAN__POINTER_POINTER) (gpointer data1, + gpointer arg_1, + gpointer arg_2, + gpointer data2); + register GMarshalFunc_BOOLEAN__POINTER_POINTER callback; + register GCClosure *cc = (GCClosure*) closure; + register gpointer data1, data2; + gboolean v_return; + + g_return_if_fail (return_value != NULL); + g_return_if_fail (n_param_values == 3); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_BOOLEAN__POINTER_POINTER) (marshal_data ? marshal_data : cc->callback); + + v_return = callback (data1, + g_marshal_value_peek_pointer (param_values + 1), + g_marshal_value_peek_pointer (param_values + 2), + data2); + + g_value_set_boolean (return_value, v_return); +} + +G_END_DECLS + +#endif /* __dbus_glib_marshal__sound_service_server_MARSHAL_H__ */ + +#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 }, +}; + +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", +"\0" +}; + diff --git a/src/title-menu-item.c b/src/title-menu-item.c new file mode 100644 index 0000000..8ae80c4 --- /dev/null +++ b/src/title-menu-item.c @@ -0,0 +1,210 @@ +/* title-menu-item.c generated by valac 0.10.0, the Vala compiler + * generated from title-menu-item.vala, do not modify */ + +/* +Copyright 2010 Canonical Ltd. + +Authors: + Conor Curran <conor.curran@canonical.com> + +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published +by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include <glib.h> +#include <glib-object.h> +#include <libdbusmenu-glib/client.h> +#include <libdbusmenu-glib/menuitem-proxy.h> +#include <libdbusmenu-glib/menuitem.h> +#include <libdbusmenu-glib/server.h> +#include <common-defs.h> +#include <stdlib.h> +#include <string.h> +#include <gee.h> + + +#define TYPE_PLAYER_ITEM (player_item_get_type ()) +#define PLAYER_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYER_ITEM, PlayerItem)) +#define PLAYER_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYER_ITEM, PlayerItemClass)) +#define IS_PLAYER_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYER_ITEM)) +#define IS_PLAYER_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYER_ITEM)) +#define PLAYER_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYER_ITEM, PlayerItemClass)) + +typedef struct _PlayerItem PlayerItem; +typedef struct _PlayerItemClass PlayerItemClass; +typedef struct _PlayerItemPrivate PlayerItemPrivate; + +#define TYPE_TITLE_MENUITEM (title_menuitem_get_type ()) +#define TITLE_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TITLE_MENUITEM, TitleMenuitem)) +#define TITLE_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TITLE_MENUITEM, TitleMenuitemClass)) +#define IS_TITLE_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TITLE_MENUITEM)) +#define IS_TITLE_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TITLE_MENUITEM)) +#define TITLE_MENUITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TITLE_MENUITEM, TitleMenuitemClass)) + +typedef struct _TitleMenuitem TitleMenuitem; +typedef struct _TitleMenuitemClass TitleMenuitemClass; +typedef struct _TitleMenuitemPrivate TitleMenuitemPrivate; + +#define TYPE_PLAYER_CONTROLLER (player_controller_get_type ()) +#define PLAYER_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYER_CONTROLLER, PlayerController)) +#define PLAYER_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYER_CONTROLLER, PlayerControllerClass)) +#define IS_PLAYER_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYER_CONTROLLER)) +#define IS_PLAYER_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYER_CONTROLLER)) +#define PLAYER_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYER_CONTROLLER, PlayerControllerClass)) + +typedef struct _PlayerController PlayerController; +typedef struct _PlayerControllerClass PlayerControllerClass; +typedef struct _PlayerControllerPrivate PlayerControllerPrivate; + +#define TYPE_MPRIS2_CONTROLLER (mpris2_controller_get_type ()) +#define MPRIS2_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS2_CONTROLLER, Mpris2Controller)) +#define MPRIS2_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS2_CONTROLLER, Mpris2ControllerClass)) +#define IS_MPRIS2_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS2_CONTROLLER)) +#define IS_MPRIS2_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS2_CONTROLLER)) +#define MPRIS2_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS2_CONTROLLER, Mpris2ControllerClass)) + +typedef struct _Mpris2Controller Mpris2Controller; +typedef struct _Mpris2ControllerClass Mpris2ControllerClass; + +#define PLAYER_CONTROLLER_TYPE_STATE (player_controller_state_get_type ()) +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) + +struct _PlayerItem { + DbusmenuMenuitem parent_instance; + PlayerItemPrivate * priv; +}; + +struct _PlayerItemClass { + DbusmenuMenuitemClass parent_class; +}; + +struct _TitleMenuitem { + PlayerItem parent_instance; + TitleMenuitemPrivate * priv; +}; + +struct _TitleMenuitemClass { + PlayerItemClass parent_class; +}; + +struct _PlayerController { + GObject parent_instance; + PlayerControllerPrivate * priv; + gint current_state; + GeeArrayList* custom_items; + Mpris2Controller* mpris_bridge; +}; + +struct _PlayerControllerClass { + GObjectClass parent_class; +}; + +typedef enum { + PLAYER_CONTROLLER_STATE_OFFLINE, + PLAYER_CONTROLLER_STATE_INSTANTIATING, + PLAYER_CONTROLLER_STATE_READY, + PLAYER_CONTROLLER_STATE_CONNECTED, + PLAYER_CONTROLLER_STATE_DISCONNECTED +} PlayerControllerstate; + + +static gpointer title_menuitem_parent_class = NULL; + +GType player_item_get_type (void) G_GNUC_CONST; +GType title_menuitem_get_type (void) G_GNUC_CONST; +enum { + TITLE_MENUITEM_DUMMY_PROPERTY +}; +GType player_controller_get_type (void) G_GNUC_CONST; +TitleMenuitem* title_menuitem_new (PlayerController* parent); +TitleMenuitem* title_menuitem_construct (GType object_type, PlayerController* parent); +const char* player_controller_get_name (PlayerController* self); +static void title_menuitem_real_handle_event (DbusmenuMenuitem* base, const char* name, GValue* input_value, guint timestamp); +PlayerController* player_item_get_owner (PlayerItem* self); +GType mpris2_controller_get_type (void) G_GNUC_CONST; +GType player_controller_state_get_type (void) G_GNUC_CONST; +void player_controller_instantiate (PlayerController* self); +void mpris2_controller_expose (Mpris2Controller* self); +void title_menuitem_toggle_active_triangle (TitleMenuitem* self, gboolean update); +GeeHashSet* title_menuitem_attributes_format (void); + + + +TitleMenuitem* title_menuitem_construct (GType object_type, PlayerController* parent) { + TitleMenuitem * self; + g_return_val_if_fail (parent != NULL, NULL); + self = (TitleMenuitem*) g_object_new (object_type, "item-type", DBUSMENU_TITLE_MENUITEM_TYPE, "owner", parent, NULL); + dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, DBUSMENU_TITLE_MENUITEM_NAME, player_controller_get_name (parent)); + dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) self, DBUSMENU_TITLE_MENUITEM_RUNNING, FALSE); + return self; +} + + +TitleMenuitem* title_menuitem_new (PlayerController* parent) { + return title_menuitem_construct (TYPE_TITLE_MENUITEM, parent); +} + + +static void title_menuitem_real_handle_event (DbusmenuMenuitem* base, const char* name, GValue* input_value, guint timestamp) { + TitleMenuitem * self; + self = (TitleMenuitem*) base; + g_return_if_fail (name != NULL); + if (player_item_get_owner ((PlayerItem*) self)->current_state == PLAYER_CONTROLLER_STATE_OFFLINE) { + player_controller_instantiate (player_item_get_owner ((PlayerItem*) self)); + } else { + if (player_item_get_owner ((PlayerItem*) self)->current_state == PLAYER_CONTROLLER_STATE_CONNECTED) { + mpris2_controller_expose (player_item_get_owner ((PlayerItem*) self)->mpris_bridge); + } + } +} + + +void title_menuitem_toggle_active_triangle (TitleMenuitem* self, gboolean update) { + g_return_if_fail (self != NULL); + dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) self, DBUSMENU_TITLE_MENUITEM_RUNNING, update); +} + + +GeeHashSet* title_menuitem_attributes_format (void) { + GeeHashSet* result = NULL; + GeeHashSet* attrs; + attrs = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL); + gee_abstract_collection_add ((GeeAbstractCollection*) attrs, DBUSMENU_TITLE_MENUITEM_NAME); + result = attrs; + return result; +} + + +static void title_menuitem_class_init (TitleMenuitemClass * klass) { + title_menuitem_parent_class = g_type_class_peek_parent (klass); + DBUSMENU_MENUITEM_CLASS (klass)->handle_event = title_menuitem_real_handle_event; +} + + +static void title_menuitem_instance_init (TitleMenuitem * self) { +} + + +GType title_menuitem_get_type (void) { + static volatile gsize title_menuitem_type_id__volatile = 0; + if (g_once_init_enter (&title_menuitem_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (TitleMenuitemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) title_menuitem_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TitleMenuitem), 0, (GInstanceInitFunc) title_menuitem_instance_init, NULL }; + GType title_menuitem_type_id; + title_menuitem_type_id = g_type_register_static (TYPE_PLAYER_ITEM, "TitleMenuitem", &g_define_type_info, 0); + g_once_init_leave (&title_menuitem_type_id__volatile, title_menuitem_type_id); + } + return title_menuitem_type_id__volatile; +} + + + + diff --git a/src/transport-menu-item.c b/src/transport-menu-item.c new file mode 100644 index 0000000..3161da8 --- /dev/null +++ b/src/transport-menu-item.c @@ -0,0 +1,239 @@ +/* transport-menu-item.c generated by valac 0.10.0, the Vala compiler + * generated from transport-menu-item.vala, do not modify */ + +/* +Copyright 2010 Canonical Ltd. + +Authors: + Conor Curran <conor.curran@canonical.com> + +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published +by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include <glib.h> +#include <glib-object.h> +#include <libdbusmenu-glib/client.h> +#include <libdbusmenu-glib/menuitem-proxy.h> +#include <libdbusmenu-glib/menuitem.h> +#include <libdbusmenu-glib/server.h> +#include <common-defs.h> +#include <stdlib.h> +#include <string.h> +#include <gee.h> + + +#define TYPE_PLAYER_ITEM (player_item_get_type ()) +#define PLAYER_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYER_ITEM, PlayerItem)) +#define PLAYER_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYER_ITEM, PlayerItemClass)) +#define IS_PLAYER_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYER_ITEM)) +#define IS_PLAYER_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYER_ITEM)) +#define PLAYER_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYER_ITEM, PlayerItemClass)) + +typedef struct _PlayerItem PlayerItem; +typedef struct _PlayerItemClass PlayerItemClass; +typedef struct _PlayerItemPrivate PlayerItemPrivate; + +#define TYPE_TRANSPORT_MENUITEM (transport_menuitem_get_type ()) +#define TRANSPORT_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TRANSPORT_MENUITEM, TransportMenuitem)) +#define TRANSPORT_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TRANSPORT_MENUITEM, TransportMenuitemClass)) +#define IS_TRANSPORT_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TRANSPORT_MENUITEM)) +#define IS_TRANSPORT_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TRANSPORT_MENUITEM)) +#define TRANSPORT_MENUITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TRANSPORT_MENUITEM, TransportMenuitemClass)) + +typedef struct _TransportMenuitem TransportMenuitem; +typedef struct _TransportMenuitemClass TransportMenuitemClass; +typedef struct _TransportMenuitemPrivate TransportMenuitemPrivate; + +#define TRANSPORT_MENUITEM_TYPE_ACTION (transport_menuitem_action_get_type ()) + +#define TRANSPORT_MENUITEM_TYPE_STATE (transport_menuitem_state_get_type ()) + +#define TYPE_PLAYER_CONTROLLER (player_controller_get_type ()) +#define PLAYER_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYER_CONTROLLER, PlayerController)) +#define PLAYER_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYER_CONTROLLER, PlayerControllerClass)) +#define IS_PLAYER_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYER_CONTROLLER)) +#define IS_PLAYER_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYER_CONTROLLER)) +#define PLAYER_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYER_CONTROLLER, PlayerControllerClass)) + +typedef struct _PlayerController PlayerController; +typedef struct _PlayerControllerClass PlayerControllerClass; +#define _g_free0(var) (var = (g_free (var), NULL)) +typedef struct _PlayerControllerPrivate PlayerControllerPrivate; + +#define TYPE_MPRIS2_CONTROLLER (mpris2_controller_get_type ()) +#define MPRIS2_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS2_CONTROLLER, Mpris2Controller)) +#define MPRIS2_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS2_CONTROLLER, Mpris2ControllerClass)) +#define IS_MPRIS2_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS2_CONTROLLER)) +#define IS_MPRIS2_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS2_CONTROLLER)) +#define MPRIS2_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS2_CONTROLLER, Mpris2ControllerClass)) + +typedef struct _Mpris2Controller Mpris2Controller; +typedef struct _Mpris2ControllerClass Mpris2ControllerClass; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) + +struct _PlayerItem { + DbusmenuMenuitem parent_instance; + PlayerItemPrivate * priv; +}; + +struct _PlayerItemClass { + DbusmenuMenuitemClass parent_class; +}; + +struct _TransportMenuitem { + PlayerItem parent_instance; + TransportMenuitemPrivate * priv; +}; + +struct _TransportMenuitemClass { + PlayerItemClass parent_class; +}; + +typedef enum { + TRANSPORT_MENUITEM_ACTION_PREVIOUS, + TRANSPORT_MENUITEM_ACTION_PLAY_PAUSE, + TRANSPORT_MENUITEM_ACTION_NEXT +} TransportMenuitemaction; + +typedef enum { + TRANSPORT_MENUITEM_STATE_PLAYING, + TRANSPORT_MENUITEM_STATE_PAUSED +} TransportMenuitemstate; + +struct _PlayerController { + GObject parent_instance; + PlayerControllerPrivate * priv; + gint current_state; + GeeArrayList* custom_items; + Mpris2Controller* mpris_bridge; +}; + +struct _PlayerControllerClass { + GObjectClass parent_class; +}; + + +static gpointer transport_menuitem_parent_class = NULL; + +GType player_item_get_type (void) G_GNUC_CONST; +GType transport_menuitem_get_type (void) G_GNUC_CONST; +enum { + TRANSPORT_MENUITEM_DUMMY_PROPERTY +}; +GType transport_menuitem_action_get_type (void) G_GNUC_CONST; +GType transport_menuitem_state_get_type (void) G_GNUC_CONST; +GType player_controller_get_type (void) G_GNUC_CONST; +TransportMenuitem* transport_menuitem_new (PlayerController* parent); +TransportMenuitem* transport_menuitem_construct (GType object_type, PlayerController* parent); +void transport_menuitem_change_play_state (TransportMenuitem* self, TransportMenuitemstate update); +static void transport_menuitem_real_handle_event (DbusmenuMenuitem* base, const char* name, GValue* input_value, guint timestamp); +PlayerController* player_item_get_owner (PlayerItem* self); +const char* player_controller_get_name (PlayerController* self); +GType mpris2_controller_get_type (void) G_GNUC_CONST; +void mpris2_controller_transport_update (Mpris2Controller* self, TransportMenuitemaction command); +GeeHashSet* transport_menuitem_attributes_format (void); + + + +GType transport_menuitem_action_get_type (void) { + static volatile gsize transport_menuitem_action_type_id__volatile = 0; + if (g_once_init_enter (&transport_menuitem_action_type_id__volatile)) { + static const GEnumValue values[] = {{TRANSPORT_MENUITEM_ACTION_PREVIOUS, "TRANSPORT_MENUITEM_ACTION_PREVIOUS", "previous"}, {TRANSPORT_MENUITEM_ACTION_PLAY_PAUSE, "TRANSPORT_MENUITEM_ACTION_PLAY_PAUSE", "play-pause"}, {TRANSPORT_MENUITEM_ACTION_NEXT, "TRANSPORT_MENUITEM_ACTION_NEXT", "next"}, {0, NULL, NULL}}; + GType transport_menuitem_action_type_id; + transport_menuitem_action_type_id = g_enum_register_static ("TransportMenuitemaction", values); + g_once_init_leave (&transport_menuitem_action_type_id__volatile, transport_menuitem_action_type_id); + } + return transport_menuitem_action_type_id__volatile; +} + + +GType transport_menuitem_state_get_type (void) { + static volatile gsize transport_menuitem_state_type_id__volatile = 0; + if (g_once_init_enter (&transport_menuitem_state_type_id__volatile)) { + static const GEnumValue values[] = {{TRANSPORT_MENUITEM_STATE_PLAYING, "TRANSPORT_MENUITEM_STATE_PLAYING", "playing"}, {TRANSPORT_MENUITEM_STATE_PAUSED, "TRANSPORT_MENUITEM_STATE_PAUSED", "paused"}, {0, NULL, NULL}}; + GType transport_menuitem_state_type_id; + transport_menuitem_state_type_id = g_enum_register_static ("TransportMenuitemstate", values); + g_once_init_leave (&transport_menuitem_state_type_id__volatile, transport_menuitem_state_type_id); + } + return transport_menuitem_state_type_id__volatile; +} + + +TransportMenuitem* transport_menuitem_construct (GType object_type, PlayerController* parent) { + TransportMenuitem * self; + g_return_val_if_fail (parent != NULL, NULL); + self = (TransportMenuitem*) g_object_new (object_type, "item-type", DBUSMENU_TRANSPORT_MENUITEM_TYPE, "owner", parent, NULL); + dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, DBUSMENU_TRANSPORT_MENUITEM_PLAY_STATE, 1); + return self; +} + + +TransportMenuitem* transport_menuitem_new (PlayerController* parent) { + return transport_menuitem_construct (TYPE_TRANSPORT_MENUITEM, parent); +} + + +void transport_menuitem_change_play_state (TransportMenuitem* self, TransportMenuitemstate update) { + g_return_if_fail (self != NULL); + dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, DBUSMENU_TRANSPORT_MENUITEM_PLAY_STATE, (gint) update); +} + + +static void transport_menuitem_real_handle_event (DbusmenuMenuitem* base, const char* name, GValue* input_value, guint timestamp) { + TransportMenuitem * self; + gint input; + char* _tmp0_; + self = (TransportMenuitem*) base; + g_return_if_fail (name != NULL); + input = g_value_get_int (input_value); + g_debug ("transport-menu-item.vala:51: handle_event with value %s", _tmp0_ = g_strdup_printf ("%i", input)); + _g_free0 (_tmp0_); + g_debug ("transport-menu-item.vala:52: transport owner name = %s", player_controller_get_name (player_item_get_owner ((PlayerItem*) self))); + mpris2_controller_transport_update (player_item_get_owner ((PlayerItem*) self)->mpris_bridge, (TransportMenuitemaction) input); +} + + +GeeHashSet* transport_menuitem_attributes_format (void) { + GeeHashSet* result = NULL; + GeeHashSet* attrs; + attrs = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL); + gee_abstract_collection_add ((GeeAbstractCollection*) attrs, DBUSMENU_TRANSPORT_MENUITEM_PLAY_STATE); + result = attrs; + return result; +} + + +static void transport_menuitem_class_init (TransportMenuitemClass * klass) { + transport_menuitem_parent_class = g_type_class_peek_parent (klass); + DBUSMENU_MENUITEM_CLASS (klass)->handle_event = transport_menuitem_real_handle_event; +} + + +static void transport_menuitem_instance_init (TransportMenuitem * self) { +} + + +GType transport_menuitem_get_type (void) { + static volatile gsize transport_menuitem_type_id__volatile = 0; + if (g_once_init_enter (&transport_menuitem_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (TransportMenuitemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) transport_menuitem_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TransportMenuitem), 0, (GInstanceInitFunc) transport_menuitem_instance_init, NULL }; + GType transport_menuitem_type_id; + transport_menuitem_type_id = g_type_register_static (TYPE_PLAYER_ITEM, "TransportMenuitem", &g_define_type_info, 0); + g_once_init_leave (&transport_menuitem_type_id__volatile, transport_menuitem_type_id); + } + return transport_menuitem_type_id__volatile; +} + + + + |