From b4d305f16bae6804dcf2acf8b9ecc4629807c150 Mon Sep 17 00:00:00 2001 From: Sebastien Bacher Date: Wed, 18 Aug 2010 15:51:01 +0200 Subject: Import upstream version 0.4.0 --- src/Makefile.am | 9 +- src/Makefile.in | 63 +- src/common-defs.h | 3 +- src/dbus-menu-manager.c | 18 +- src/dbus-menu-manager.h | 1 + src/familiar-players-db.c | 46 +- src/indicator-sound.c | 367 +-- src/indicator-sound.h | 31 +- src/metadata-menu-item.c | 2 +- src/metadata-widget.c | 6 +- src/metadata-widget.h | 2 +- src/mpris-bridge.c | 246 ++ src/mpris-bridge.vala | 70 + src/mpris-controller-v2.c | 130 - src/mpris-controller-v2.vala | 28 - src/mpris-controller.c | 99 +- src/mpris-controller.vala | 17 +- src/mpris2-controller.c | 5424 ++++++++++++++++++++++++++++++++++++++++++ src/mpris2-controller.vala | 266 +++ src/music-player-bridge.c | 30 +- src/music-player-bridge.h | 182 +- src/music-player-bridge.vala | 6 +- src/play-button.c | 29 +- src/player-controller.c | 194 +- src/player-controller.vala | 91 +- src/player-item.c | 27 +- src/player-item.vala | 2 + src/pulse-manager.c | 10 +- src/scrub-menu-item.c | 33 +- src/scrub-menu-item.vala | 7 +- src/scrub-widget.c | 2 +- src/scrub-widget.h | 2 +- src/slider-menu-item.c | 7 +- src/sound-service-client.h | 75 - src/sound-service-dbus.c | 46 - src/sound-service-dbus.h | 1 - src/sound-service-server.h | 59 +- src/sound-service.c | 1 - src/sound-service.xml | 14 - src/title-menu-item.c | 27 +- src/title-menu-item.vala | 3 + src/title-widget.h | 2 +- src/transport-menu-item.c | 26 +- src/transport-menu-item.vala | 2 +- src/transport-widget.h | 2 +- src/volume-widget.c | 247 ++ src/volume-widget.h | 54 + 47 files changed, 7004 insertions(+), 1005 deletions(-) create mode 100644 src/mpris-bridge.c create mode 100644 src/mpris-bridge.vala delete mode 100644 src/mpris-controller-v2.c delete mode 100644 src/mpris-controller-v2.vala create mode 100644 src/mpris2-controller.c create mode 100644 src/mpris2-controller.vala create mode 100644 src/volume-widget.c create mode 100644 src/volume-widget.h (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index ed3e394..74e0297 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -20,6 +20,8 @@ libsoundmenu_la_SOURCES = \ title-widget.h \ scrub-widget.c \ scrub-widget.h \ + volume-widget.c \ + volume-widget.h \ dbus-shared-names.h \ sound-service-client.h @@ -63,13 +65,15 @@ music_bridge_VALASOURCES = \ scrub-menu-item.vala \ title-menu-item.vala \ player-controller.vala \ - mpris-controller-v2.vala \ + mpris-bridge.vala \ mpris-controller.vala \ + mpris2-controller.vala \ player-item.vala \ familiar-players-db.vala music_bridge_VALAFLAGS = \ --ccode \ + --disable-dbus-transformation \ -H music-player-bridge.h -d . \ --vapidir=$(top_srcdir)/vapi/ \ --vapidir=./ \ @@ -79,7 +83,8 @@ music_bridge_VALAFLAGS = \ --pkg Dbusmenu-Glib-0.2 \ --pkg common-defs \ --pkg dbus-glib-1 \ - --pkg gio-unix-2.0 + --pkg gio-unix-2.0 + $(MAINTAINER_VALAFLAGS) music_bridge_APIFILES = \ diff --git a/src/Makefile.in b/src/Makefile.in index 164eee4..534aa81 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -77,7 +77,8 @@ am_libsoundmenu_la_OBJECTS = libsoundmenu_la-transport-widget.lo \ libsoundmenu_la-play-button.lo \ libsoundmenu_la-indicator-sound.lo \ libsoundmenu_la-title-widget.lo \ - libsoundmenu_la-scrub-widget.lo + libsoundmenu_la-scrub-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)) @@ -93,8 +94,9 @@ am__objects_1 = indicator_sound_service-music-player-bridge.$(OBJEXT) \ indicator_sound_service-scrub-menu-item.$(OBJEXT) \ indicator_sound_service-title-menu-item.$(OBJEXT) \ indicator_sound_service-player-controller.$(OBJEXT) \ - indicator_sound_service-mpris-controller-v2.$(OBJEXT) \ + indicator_sound_service-mpris-bridge.$(OBJEXT) \ indicator_sound_service-mpris-controller.$(OBJEXT) \ + indicator_sound_service-mpris2-controller.$(OBJEXT) \ indicator_sound_service-player-item.$(OBJEXT) \ indicator_sound_service-familiar-players-db.$(OBJEXT) am_indicator_sound_service_OBJECTS = \ @@ -321,6 +323,8 @@ libsoundmenu_la_SOURCES = \ title-widget.h \ scrub-widget.c \ scrub-widget.h \ + volume-widget.c \ + volume-widget.h \ dbus-shared-names.h \ sound-service-client.h @@ -338,13 +342,15 @@ music_bridge_VALASOURCES = \ scrub-menu-item.vala \ title-menu-item.vala \ player-controller.vala \ - mpris-controller-v2.vala \ + mpris-bridge.vala \ mpris-controller.vala \ + mpris2-controller.vala \ player-item.vala \ familiar-players-db.vala music_bridge_VALAFLAGS = \ --ccode \ + --disable-dbus-transformation \ -H music-player-bridge.h -d . \ --vapidir=$(top_srcdir)/vapi/ \ --vapidir=./ \ @@ -354,7 +360,7 @@ music_bridge_VALAFLAGS = \ --pkg Dbusmenu-Glib-0.2 \ --pkg common-defs \ --pkg dbus-glib-1 \ - --pkg gio-unix-2.0 + --pkg gio-unix-2.0 music_bridge_APIFILES = \ music-player-bridge.h @@ -528,8 +534,9 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_sound_service-dbus-menu-manager.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_sound_service-familiar-players-db.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-mpris-controller-v2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_sound_service-mpris-bridge.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_sound_service-mpris-controller.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@ @@ -546,6 +553,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsoundmenu_la-scrub-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 $@ $< @@ -619,6 +627,14 @@ libsoundmenu_la-scrub-widget.lo: scrub-widget.c @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-scrub-widget.lo `test -f 'scrub-widget.c' || echo '$(srcdir)/'`scrub-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 @@ -795,21 +811,21 @@ indicator_sound_service-player-controller.obj: player-controller.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -c -o indicator_sound_service-player-controller.obj `if test -f 'player-controller.c'; then $(CYGPATH_W) 'player-controller.c'; else $(CYGPATH_W) '$(srcdir)/player-controller.c'; fi` -indicator_sound_service-mpris-controller-v2.o: mpris-controller-v2.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -MT indicator_sound_service-mpris-controller-v2.o -MD -MP -MF $(DEPDIR)/indicator_sound_service-mpris-controller-v2.Tpo -c -o indicator_sound_service-mpris-controller-v2.o `test -f 'mpris-controller-v2.c' || echo '$(srcdir)/'`mpris-controller-v2.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-mpris-controller-v2.Tpo $(DEPDIR)/indicator_sound_service-mpris-controller-v2.Po +indicator_sound_service-mpris-bridge.o: mpris-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-mpris-bridge.o -MD -MP -MF $(DEPDIR)/indicator_sound_service-mpris-bridge.Tpo -c -o indicator_sound_service-mpris-bridge.o `test -f 'mpris-bridge.c' || echo '$(srcdir)/'`mpris-bridge.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-mpris-bridge.Tpo $(DEPDIR)/indicator_sound_service-mpris-bridge.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mpris-controller-v2.c' object='indicator_sound_service-mpris-controller-v2.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mpris-bridge.c' object='indicator_sound_service-mpris-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-mpris-controller-v2.o `test -f 'mpris-controller-v2.c' || echo '$(srcdir)/'`mpris-controller-v2.c +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -c -o indicator_sound_service-mpris-bridge.o `test -f 'mpris-bridge.c' || echo '$(srcdir)/'`mpris-bridge.c -indicator_sound_service-mpris-controller-v2.obj: mpris-controller-v2.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -MT indicator_sound_service-mpris-controller-v2.obj -MD -MP -MF $(DEPDIR)/indicator_sound_service-mpris-controller-v2.Tpo -c -o indicator_sound_service-mpris-controller-v2.obj `if test -f 'mpris-controller-v2.c'; then $(CYGPATH_W) 'mpris-controller-v2.c'; else $(CYGPATH_W) '$(srcdir)/mpris-controller-v2.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-mpris-controller-v2.Tpo $(DEPDIR)/indicator_sound_service-mpris-controller-v2.Po +indicator_sound_service-mpris-bridge.obj: mpris-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-mpris-bridge.obj -MD -MP -MF $(DEPDIR)/indicator_sound_service-mpris-bridge.Tpo -c -o indicator_sound_service-mpris-bridge.obj `if test -f 'mpris-bridge.c'; then $(CYGPATH_W) 'mpris-bridge.c'; else $(CYGPATH_W) '$(srcdir)/mpris-bridge.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-mpris-bridge.Tpo $(DEPDIR)/indicator_sound_service-mpris-bridge.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mpris-controller-v2.c' object='indicator_sound_service-mpris-controller-v2.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mpris-bridge.c' object='indicator_sound_service-mpris-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-mpris-controller-v2.obj `if test -f 'mpris-controller-v2.c'; then $(CYGPATH_W) 'mpris-controller-v2.c'; else $(CYGPATH_W) '$(srcdir)/mpris-controller-v2.c'; fi` +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -c -o indicator_sound_service-mpris-bridge.obj `if test -f 'mpris-bridge.c'; then $(CYGPATH_W) 'mpris-bridge.c'; else $(CYGPATH_W) '$(srcdir)/mpris-bridge.c'; fi` indicator_sound_service-mpris-controller.o: mpris-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-mpris-controller.o -MD -MP -MF $(DEPDIR)/indicator_sound_service-mpris-controller.Tpo -c -o indicator_sound_service-mpris-controller.o `test -f 'mpris-controller.c' || echo '$(srcdir)/'`mpris-controller.c @@ -827,6 +843,22 @@ indicator_sound_service-mpris-controller.obj: mpris-controller.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -c -o indicator_sound_service-mpris-controller.obj `if test -f 'mpris-controller.c'; then $(CYGPATH_W) 'mpris-controller.c'; else $(CYGPATH_W) '$(srcdir)/mpris-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 @@ -1098,6 +1130,7 @@ sound-service-server.h: $(srcdir)/sound-service.xml --mode=glib-server \ --output=sound-service-server.h \ $(srcdir)/sound-service.xml + $(MAINTAINER_VALAFLAGS) music_bridge_vala.stamp $(music_bridge_APIFILES): $(music_bridge_VALASOURCES) diff --git a/src/common-defs.h b/src/common-defs.h index 46ff520..e3b4552 100644 --- a/src/common-defs.h +++ b/src/common-defs.h @@ -27,7 +27,8 @@ with this program. If not, see . #define DBUSMENU_PROPERTY_EMPTY -1 /* DBUS Custom Items */ -#define DBUSMENU_SLIDER_MENUITEM_TYPE "x-canonical-ido-slider-type" +#define DBUSMENU_VOLUME_MENUITEM_TYPE "x-canonical-ido-volume-type" +#define DBUSMENU_VOLUME_MENUITEM_LEVEL "x-canonical-ido-volume-level" #define DBUSMENU_TRANSPORT_MENUITEM_TYPE "x-canonical-sound-menu-player-transport-type" #define DBUSMENU_TRANSPORT_MENUITEM_PLAY_STATE "x-canonical-sound-menu-player-transport-state" diff --git a/src/dbus-menu-manager.c b/src/dbus-menu-manager.c index 4cd4a6b..6f0af9e 100644 --- a/src/dbus-menu-manager.c +++ b/src/dbus-menu-manager.c @@ -31,6 +31,7 @@ with this program. If not, see . #include "sound-service-dbus.h" #include "pulse-manager.h" #include "slider-menu-item.h" +#include "common-defs.h" #include "dbus-shared-names.h" @@ -74,13 +75,15 @@ DbusmenuMenuitem* dbus_menu_manager_setup() return root_menuitem; } -/** -teardown: -**/ -void dbus_menu_manager_teardown() + +void dbus_menu_manager_update_volume(gdouble volume) { - //TODO tidy up dbus_interface and items! + GValue value = {0}; + g_value_init(&value, G_TYPE_DOUBLE); + g_value_set_double(&value, volume); + dbusmenu_menuitem_property_set_value(DBUSMENU_MENUITEM(volume_slider_menuitem), DBUSMENU_VOLUME_MENUITEM_LEVEL, &value); } + /** update_pa_state: @@ -102,7 +105,7 @@ void dbus_menu_manager_update_pa_state(gboolean pa_state, gboolean sink_availabl // Emit the signals after the menus are setup/torn down // preserve ordering ! sound_service_dbus_update_sink_availability(dbus_interface, sink_available); - sound_service_dbus_update_sink_volume(dbus_interface, percent); + dbus_menu_manager_update_volume(percent); sound_service_dbus_update_sink_mute(dbus_interface, sink_muted); dbus_menu_manager_update_mute_ui(b_all_muted); } @@ -123,7 +126,6 @@ void dbus_menu_manager_update_mute_ui(gboolean incoming_mute_value) /*-------------------------------------------------------------------------*/ // Private Methods /*-------------------------------------------------------------------------*/ - static void refresh_menu() { g_debug("in the refresh menu method"); @@ -172,7 +174,7 @@ Bring up the gnome volume preferences dialog static void show_sound_settings_dialog (DbusmenuMenuitem *mi, gpointer user_data) { GError * error = NULL; - if (!g_spawn_command_line_async("gnome-volume-control", &error) && + if (!g_spawn_command_line_async("gnome-volume-control --page=applications", &error) && !g_spawn_command_line_async("xfce4-mixer", &error)) { g_warning("Unable to show dialog: %s", error->message); diff --git a/src/dbus-menu-manager.h b/src/dbus-menu-manager.h index 926e292..ec2b2e2 100644 --- a/src/dbus-menu-manager.h +++ b/src/dbus-menu-manager.h @@ -25,6 +25,7 @@ with this program. If not, see . DbusmenuMenuitem* dbus_menu_manager_setup(); void dbus_menu_manager_teardown(); +void dbus_menu_manager_update_volume(gdouble volume); void dbus_menu_manager_update_pa_state(gboolean pa_state, gboolean sink_available, gboolean sink_muted, gdouble current_vol); // TODO update pa_state should incorporate the method below ! void dbus_menu_manager_update_mute_ui(gboolean incoming_mute_value); diff --git a/src/familiar-players-db.c b/src/familiar-players-db.c index c7bfda3..4d2b452 100644 --- a/src/familiar-players-db.c +++ b/src/familiar-players-db.c @@ -1,4 +1,4 @@ -/* familiar-players-db.c generated by valac, the Vala compiler +/* familiar-players-db.c generated by valac 0.9.5, the Vala compiler * generated from familiar-players-db.vala, do not modify */ /* @@ -141,10 +141,10 @@ static gboolean familiar_players_db_create_key_file (FamiliarPlayersDB* self) { _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 __catch3_g_key_file_error; + goto __catch9_g_key_file_error; } if (_inner_error_->domain == G_FILE_ERROR) { - goto __catch3_g_file_error; + goto __catch9_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_); @@ -152,8 +152,8 @@ static gboolean familiar_players_db_create_key_file (FamiliarPlayersDB* self) { } _result_ = _tmp1_; } - goto __finally3; - __catch3_g_key_file_error: + goto __finally9; + __catch9_g_key_file_error: { GError * e; e = _inner_error_; @@ -164,8 +164,8 @@ static gboolean familiar_players_db_create_key_file (FamiliarPlayersDB* self) { _g_error_free0 (e); } } - goto __finally3; - __catch3_g_file_error: + goto __finally9; + __catch9_g_file_error: { GError * e; e = _inner_error_; @@ -176,7 +176,7 @@ static gboolean familiar_players_db_create_key_file (FamiliarPlayersDB* self) { _g_error_free0 (e); } } - __finally3: + __finally9: if (_inner_error_ != NULL) { g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); g_clear_error (&_inner_error_); @@ -198,7 +198,7 @@ static gboolean familiar_players_db_check_for_keys (FamiliarPlayersDB* self) { _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 __catch4_g_key_file_error; + goto __catch10_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_); @@ -209,8 +209,8 @@ static gboolean familiar_players_db_check_for_keys (FamiliarPlayersDB* self) { return result; } } - goto __finally4; - __catch4_g_key_file_error: + goto __finally10; + __catch10_g_key_file_error: { GError * e; e = _inner_error_; @@ -221,7 +221,7 @@ static gboolean familiar_players_db_check_for_keys (FamiliarPlayersDB* self) { return result; } } - __finally4: + __finally10: if (_inner_error_ != NULL) { g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); g_clear_error (&_inner_error_); @@ -248,7 +248,7 @@ static gboolean familiar_players_db_load_data_from_key_file (FamiliarPlayersDB* 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 __catch5_g_key_file_error; + goto __catch11_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_); @@ -273,8 +273,8 @@ static gboolean familiar_players_db_load_data_from_key_file (FamiliarPlayersDB* desktops = (_vala_array_free (desktops, desktops_length1, (GDestroyNotify) g_free), NULL); return result; } - goto __finally5; - __catch5_g_key_file_error: + goto __finally11; + __catch11_g_key_file_error: { GError * _error_; _error_ = _inner_error_; @@ -286,7 +286,7 @@ static gboolean familiar_players_db_load_data_from_key_file (FamiliarPlayersDB* return result; } } - __finally5: + __finally11: { 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_); @@ -342,8 +342,8 @@ static gboolean familiar_players_db_write_db (FamiliarPlayersDB* self) { char* _tmp4_; data = (_tmp4_ = g_key_file_to_data (keyfile, &data_length, NULL), _g_free0 (data), _tmp4_); } - goto __finally6; - __catch6_g_key_file_error: + goto __finally12; + __catch12_g_key_file_error: { GError * e; e = _inner_error_; @@ -358,7 +358,7 @@ static gboolean familiar_players_db_write_db (FamiliarPlayersDB* self) { return result; } } - __finally6: + __finally12: if (_inner_error_ != NULL) { _g_free0 (data); desktops = (_vala_array_free (desktops, desktops_length1, (GDestroyNotify) g_free), NULL); @@ -380,7 +380,7 @@ static gboolean familiar_players_db_write_db (FamiliarPlayersDB* self) { _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 __catch7_g_file_error; + goto __catch13_g_file_error; } _g_free0 (data); desktops = (_vala_array_free (desktops, desktops_length1, (GDestroyNotify) g_free), NULL); @@ -393,8 +393,8 @@ static gboolean familiar_players_db_write_db (FamiliarPlayersDB* self) { g_warning ("familiar-players-db.vala:125: Unable to write out file '%s'", self->priv->file_name); } } - goto __finally7; - __catch7_g_file_error: + goto __finally13; + __catch13_g_file_error: { GError * err; err = _inner_error_; @@ -404,7 +404,7 @@ static gboolean familiar_players_db_write_db (FamiliarPlayersDB* self) { _g_error_free0 (err); } } - __finally7: + __finally13: if (_inner_error_ != NULL) { _g_free0 (data); desktops = (_vala_array_free (desktops, desktops_length1, (GDestroyNotify) g_free), NULL); diff --git a/src/indicator-sound.c b/src/indicator-sound.c index 1c6041b..3a7abe9 100644 --- a/src/indicator-sound.c +++ b/src/indicator-sound.c @@ -32,44 +32,27 @@ with this program. If not, see . #include #include -#include -#include -#include -#include - #include "indicator-sound.h" #include "transport-widget.h" #include "metadata-widget.h" #include "title-widget.h" #include "scrub-widget.h" +#include "volume-widget.h" + #include "dbus-shared-names.h" #include "sound-service-client.h" #include "common-defs.h" -// GObject Boiler plate -#define INDICATOR_SOUND_TYPE (indicator_sound_get_type ()) -#define INDICATOR_SOUND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), INDICATOR_SOUND_TYPE, IndicatorSound)) -#define INDICATOR_SOUND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), INDICATOR_SOUND_TYPE, IndicatorSoundClass)) -#define IS_INDICATOR_SOUND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), INDICATOR_SOUND_TYPE)) -#define IS_INDICATOR_SOUND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), INDICATOR_SOUND_TYPE)) -#define INDICATOR_SOUND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), INDICATOR_SOUND_TYPE, IndicatorSoundClass)) - -typedef struct _IndicatorSound IndicatorSound; -typedef struct _IndicatorSoundClass IndicatorSoundClass; - -//GObject class struct -struct _IndicatorSoundClass { - IndicatorObjectClass parent_class; -}; +typedef struct _IndicatorSoundPrivate IndicatorSoundPrivate; -//GObject instance struct -struct _IndicatorSound { - IndicatorObject parent; - GtkWidget *slider; - IndicatorServiceManager *service; +struct _IndicatorSoundPrivate +{ + GtkWidget* volume_widget; }; + +#define INDICATOR_SOUND_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), INDICATOR_SOUND_TYPE, IndicatorSoundPrivate)) + // GObject Boiler plate -GType indicator_sound_get_type (void); INDICATOR_SET_VERSION INDICATOR_SET_TYPE(INDICATOR_SOUND_TYPE) @@ -84,15 +67,10 @@ G_DEFINE_TYPE (IndicatorSound, indicator_sound, INDICATOR_OBJECT_TYPE); static GtkLabel * get_label (IndicatorObject * io); static GtkImage * get_icon (IndicatorObject * io); static GtkMenu * get_menu (IndicatorObject * io); -static void scroll (IndicatorObject*io, gint delta, IndicatorScrollDirection direction); //Slider related -static GtkWidget *volume_slider = NULL; -static gboolean new_slider_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client); -static gboolean value_changed_event_cb(GtkRange *range, gpointer user_data); +static gboolean new_volume_slider_widget(DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client); static gboolean key_press_cb(GtkWidget* widget, GdkEventKey* event, gpointer data); -static void slider_grabbed(GtkWidget *widget, gpointer user_data); -static void slider_released(GtkWidget *widget, gpointer user_data); static void style_changed_cb(GtkWidget *widget, gpointer user_data); //player widget realisation methods @@ -105,12 +83,10 @@ static gboolean new_scrub_bar_widget(DbusmenuMenuitem * newitem, DbusmenuMenuite static DBusGProxy *sound_dbus_proxy = NULL; static void connection_changed (IndicatorServiceManager * sm, gboolean connected, gpointer userdata); static void catch_signal_sink_input_while_muted(DBusGProxy * proxy, gboolean value, gpointer userdata); -static void catch_signal_sink_volume_update(DBusGProxy * proxy, gdouble volume_percent, gpointer userdata); static void catch_signal_sink_mute_update(DBusGProxy *proxy, gboolean mute_value, gpointer userdata); static void catch_signal_sink_availability_update(DBusGProxy *proxy, gboolean available_value, gpointer userdata); -static void fetch_volume_percent_from_dbus(); static void fetch_mute_value_from_dbus(); -static void fetch_sink_availability_from_dbus(); +static void fetch_sink_availability_from_dbus(IndicatorSound* self); /****Volume States 'members' ***/ static void update_state(const gint state); @@ -122,18 +98,14 @@ static const gint STATE_MEDIUM = 3; static const gint STATE_HIGH = 4; static const gint STATE_MUTED_WHILE_INPUT = 5; static const gint STATE_SINKS_NONE = 6; -static const gint OUT_OF_RANGE = -10; static GHashTable *volume_states = NULL; static GtkImage *speaker_image = NULL; static gint current_state = 0; static gint previous_state = 0; -static gdouble initial_volume_percent; static gboolean initial_mute ; static gboolean device_available; -static gboolean slider_in_direct_use; -static gdouble exterior_vol_update; static GtkIconSize design_team_size; static gint blocked_id; @@ -157,10 +129,12 @@ indicator_sound_class_init (IndicatorSoundClass *klass) object_class->finalize = indicator_sound_finalize; IndicatorObjectClass *io_class = INDICATOR_OBJECT_CLASS(klass); + + g_type_class_add_private (klass, sizeof (IndicatorSoundPrivate)); + io_class->get_label = get_label; io_class->get_image = get_icon; io_class->get_menu = get_menu; - io_class->scroll = scroll; design_team_size = gtk_icon_size_register("design-team-size", 22, 22); @@ -178,10 +152,11 @@ indicator_sound_init (IndicatorSound *self) blocked_id = 0; initial_mute = FALSE; device_available = TRUE; - slider_in_direct_use = FALSE; - exterior_vol_update = OUT_OF_RANGE; + + IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(self); + priv->volume_widget = NULL; - g_signal_connect(G_OBJECT(self->service), INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE, G_CALLBACK(connection_changed), self); + g_signal_connect(G_OBJECT(self->service), INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE, G_CALLBACK(connection_changed), self); return; } @@ -202,15 +177,6 @@ indicator_sound_dispose (GObject *object) return; } -static void -free_the_animation_list() -{ - if (blocked_animation_list != NULL) { - g_list_foreach (blocked_animation_list, (GFunc)g_object_unref, NULL); - g_list_free(blocked_animation_list); - blocked_animation_list = NULL; - } -} static void indicator_sound_finalize (GObject *object) @@ -244,80 +210,25 @@ get_menu (IndicatorObject * io) DbusmenuGtkMenu *menu = dbusmenu_gtkmenu_new(INDICATOR_SOUND_DBUS_NAME, INDICATOR_SOUND_DBUS_OBJECT); DbusmenuGtkClient *client = dbusmenu_gtkmenu_get_client(menu); g_object_set_data (G_OBJECT (client), "indicator", io); - dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_SLIDER_MENUITEM_TYPE, new_slider_item); + dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_VOLUME_MENUITEM_TYPE, new_volume_slider_widget); dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_TRANSPORT_MENUITEM_TYPE, new_transport_widget); dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_METADATA_MENUITEM_TYPE, new_metadata_widget); dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_TITLE_MENUITEM_TYPE, new_title_widget); dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_SCRUB_MENUITEM_TYPE, new_scrub_bar_widget); // register Key-press listening on the menu widget as the slider does not allow this. - g_signal_connect(menu, "key-press-event", G_CALLBACK(key_press_cb), NULL); + g_signal_connect(menu, "key-press-event", G_CALLBACK(key_press_cb), io); return GTK_MENU(menu); } static void -slider_parent_changed (GtkWidget *widget, - gpointer user_data) -{ - gtk_widget_set_size_request (widget, 200, -1); - g_debug("slider parent changed"); -} - -/** -new_slider_item: -Create a new dBusMenu Slider item. -**/ -static gboolean -new_slider_item(DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client) +free_the_animation_list() { - IndicatorObject *io = NULL; - - g_return_val_if_fail(DBUSMENU_IS_MENUITEM(newitem), FALSE); - g_return_val_if_fail(DBUSMENU_IS_GTKCLIENT(client), FALSE); - - io = g_object_get_data (G_OBJECT (client), "indicator"); - - volume_slider = ido_scale_menu_item_new_with_range ("Volume", IDO_RANGE_STYLE_DEFAULT, initial_volume_percent, 0, 100, 1); - ido_scale_menu_item_set_style (IDO_SCALE_MENU_ITEM (volume_slider), IDO_SCALE_MENU_ITEM_STYLE_IMAGE); - g_object_set(volume_slider, "reverse-scroll-events", TRUE, NULL); - - g_signal_connect (volume_slider, - "notify::parent", G_CALLBACK (slider_parent_changed), - NULL); - - GtkMenuItem *menu_volume_slider = GTK_MENU_ITEM(volume_slider); - - dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, menu_volume_slider, parent); - - // register slider changes listening on the range - GtkWidget* slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)volume_slider); - - INDICATOR_SOUND (io)->slider = slider; - - g_signal_connect(slider, "value-changed", G_CALLBACK(value_changed_event_cb), newitem); - g_signal_connect(volume_slider, "slider-grabbed", G_CALLBACK(slider_grabbed), NULL); - g_signal_connect(volume_slider, "slider-released", G_CALLBACK(slider_released), NULL); - g_signal_connect(slider, "style-set", G_CALLBACK(style_changed_cb), NULL); - - // Set images on the ido - GtkWidget* primary_image = ido_scale_menu_item_get_primary_image((IdoScaleMenuItem*)volume_slider); - GIcon * primary_gicon = g_themed_icon_new_with_default_fallbacks(g_hash_table_lookup(volume_states, GINT_TO_POINTER(STATE_ZERO))); - gtk_image_set_from_gicon(GTK_IMAGE(primary_image), primary_gicon, GTK_ICON_SIZE_MENU); - g_object_unref(primary_gicon); - - GtkWidget* secondary_image = ido_scale_menu_item_get_secondary_image((IdoScaleMenuItem*)volume_slider); - GIcon * secondary_gicon = g_themed_icon_new_with_default_fallbacks(g_hash_table_lookup(volume_states, GINT_TO_POINTER(STATE_HIGH))); - gtk_image_set_from_gicon(GTK_IMAGE(secondary_image), secondary_gicon, GTK_ICON_SIZE_MENU); - g_object_unref(secondary_gicon); - - gtk_widget_set_sensitive(volume_slider, !initial_mute); - - GtkAdjustment *adj = gtk_range_get_adjustment (GTK_RANGE (slider)); - gtk_adjustment_set_step_increment(adj, 3); - - gtk_widget_show_all(volume_slider); - - return TRUE; + if (blocked_animation_list != NULL) { + g_list_foreach (blocked_animation_list, (GFunc)g_object_unref, NULL); + g_list_free(blocked_animation_list); + blocked_animation_list = NULL; + } } static gboolean @@ -398,6 +309,42 @@ new_scrub_bar_widget(DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbus return TRUE; } +static gboolean +new_volume_slider_widget(DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client) +{ + g_debug("indicator-sound: new_volume_slider_widget"); + + GtkWidget* volume_widget = NULL; + IndicatorObject *io = NULL; + + g_return_val_if_fail(DBUSMENU_IS_MENUITEM(newitem), FALSE); + g_return_val_if_fail(DBUSMENU_IS_GTKCLIENT(client), FALSE); + + volume_widget = volume_widget_new (newitem); + io = g_object_get_data (G_OBJECT (client), "indicator"); + IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(INDICATOR_SOUND (io)); + priv->volume_widget = volume_widget; + + GtkWidget* ido_slider_widget = volume_widget_get_ido_slider(VOLUME_WIDGET(priv->volume_widget)); + + g_signal_connect(ido_slider_widget, "style-set", G_CALLBACK(style_changed_cb), NULL); + gtk_widget_set_sensitive(ido_slider_widget, + !initial_mute); + gtk_widget_show_all(ido_slider_widget); + + + GtkMenuItem *menu_volume_item = GTK_MENU_ITEM(ido_slider_widget); + dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), + newitem, + menu_volume_item, + parent); + + fetch_mute_value_from_dbus(); + fetch_sink_availability_from_dbus(INDICATOR_SOUND (io)); + + return TRUE; +} + static void connection_changed (IndicatorServiceManager * sm, gboolean connected, gpointer userdata) @@ -420,27 +367,18 @@ connection_changed (IndicatorServiceManager * sm, gboolean connected, gpointer u } g_debug("about to connect to the signals"); dbus_g_proxy_add_signal(sound_dbus_proxy, SIGNAL_SINK_INPUT_WHILE_MUTED, G_TYPE_BOOLEAN, G_TYPE_INVALID); - dbus_g_proxy_connect_signal(sound_dbus_proxy, SIGNAL_SINK_INPUT_WHILE_MUTED, G_CALLBACK(catch_signal_sink_input_while_muted), NULL, NULL); - dbus_g_proxy_add_signal(sound_dbus_proxy, SIGNAL_SINK_VOLUME_UPDATE, G_TYPE_DOUBLE, G_TYPE_INVALID); - dbus_g_proxy_connect_signal(sound_dbus_proxy, SIGNAL_SINK_VOLUME_UPDATE, G_CALLBACK(catch_signal_sink_volume_update), NULL, NULL); dbus_g_proxy_add_signal(sound_dbus_proxy, SIGNAL_SINK_MUTE_UPDATE, G_TYPE_BOOLEAN, G_TYPE_INVALID); - dbus_g_proxy_connect_signal(sound_dbus_proxy, SIGNAL_SINK_MUTE_UPDATE, G_CALLBACK(catch_signal_sink_mute_update), NULL, NULL); + dbus_g_proxy_connect_signal(sound_dbus_proxy, SIGNAL_SINK_MUTE_UPDATE, G_CALLBACK(catch_signal_sink_mute_update), userdata, NULL); dbus_g_proxy_add_signal(sound_dbus_proxy, SIGNAL_SINK_AVAILABLE_UPDATE, G_TYPE_BOOLEAN, G_TYPE_INVALID); dbus_g_proxy_connect_signal(sound_dbus_proxy, SIGNAL_SINK_AVAILABLE_UPDATE, G_CALLBACK(catch_signal_sink_availability_update), NULL, NULL); + g_return_if_fail(IS_INDICATOR_SOUND(userdata)); + // Ensure we are in a coherent state with the service at start up. // Preserve ordering! - fetch_volume_percent_from_dbus(); - fetch_mute_value_from_dbus(); - fetch_sink_availability_from_dbus(); } - - } else { - //TODO : will need to handle this scenario - // Not much can we do here really, if there is no dbus connection tis goosed. } - return; } @@ -498,7 +436,6 @@ prepare_blocked_animation() g_object_unref(blocked_buf); } - gint get_state() { @@ -564,7 +501,7 @@ start_animation() { blocked_iter = blocked_animation_list; blocked_id = 0; - g_debug("exit from blocked hold start the animation\n"); + //g_debug("exit from blocked hold start the animation\n"); animation_id = g_timeout_add(50, fade_back_to_mute_image, NULL); return FALSE; } @@ -584,12 +521,30 @@ fade_back_to_mute_image() } } +static void +reset_mute_blocking_animation() +{ + if (animation_id != 0) { + g_debug("about to remove the animation_id callback from the mainloop!!**"); + g_source_remove(animation_id); + animation_id = 0; + } + if (blocked_id != 0) { + g_debug("about to remove the blocked_id callback from the mainloop!!**"); + g_source_remove(blocked_id); + blocked_id = 0; + } +} + + /*******************************************************************/ //DBus method handlers /*******************************************************************/ static void -fetch_sink_availability_from_dbus() +fetch_sink_availability_from_dbus(IndicatorSound* self) { + g_return_if_fail(IS_INDICATOR_SOUND(self)); + GError * error = NULL; gboolean * available_input; available_input = g_new0(gboolean, 1); @@ -600,38 +555,21 @@ fetch_sink_availability_from_dbus() g_free(available_input); return; } + device_available = *available_input; if (device_available == FALSE) { update_state(STATE_SINKS_NONE); g_debug("NO DEVICE AVAILABLE"); } - if (GTK_IS_WIDGET (volume_slider)) - gtk_widget_set_sensitive(volume_slider, device_available); + IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(self); + GtkWidget* slider_widget = volume_widget_get_ido_slider(VOLUME_WIDGET(priv->volume_widget)); + gtk_widget_set_sensitive(slider_widget, device_available); g_free(available_input); - g_debug("IndicatorSound::fetch_sink_availability_from_dbus -> AVAILABILTY returned from dbus method is %i", device_available); - + g_debug("IndicatorSound::fetch_sink_availability_from_dbus ->%i", device_available); } -static void -fetch_volume_percent_from_dbus() -{ - GError * error = NULL; - gdouble *volume_percent_input; - volume_percent_input = g_new0(gdouble, 1); - org_ayatana_indicator_sound_get_sink_volume(sound_dbus_proxy, volume_percent_input, &error); - if (error != NULL) { - g_warning("Unable to fetch VOLUME at indicator start up: %s", error->message); - g_error_free(error); - g_free(volume_percent_input); - return; - } - initial_volume_percent = *volume_percent_input; - determine_state_from_volume(initial_volume_percent); - g_free(volume_percent_input); - g_debug("at the indicator start up and the volume percent returned from dbus method is %f", initial_volume_percent); -} static void fetch_mute_value_from_dbus() @@ -667,52 +605,31 @@ catch_signal_sink_input_while_muted(DBusGProxy * proxy, gboolean block_value, gp } } - -static void -catch_signal_sink_volume_update(DBusGProxy *proxy, gdouble volume_percent, gpointer userdata) -{ - if (slider_in_direct_use == FALSE) { - GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)volume_slider); - GtkRange *range = (GtkRange*)slider; - - // DEBUG - gdouble current_value = gtk_range_get_value(range); - g_debug("SIGNAL- update sink volume - current_value : %f and new value : %f", current_value, volume_percent); - exterior_vol_update = volume_percent; - gtk_range_set_value(range, volume_percent); - determine_state_from_volume(volume_percent); - } -} - +/* + We can be sure the service won't send a mute signal unless it has changed ! + UNMUTE's force a volume update therefore icon is updated appropriately => no need for unmute handling here. +*/ static void catch_signal_sink_mute_update(DBusGProxy *proxy, gboolean mute_value, gpointer userdata) { - //We can be sure the service won't send a mute signal unless it has changed ! - //UNMUTE's force a volume update therefore icon is updated appropriately => no need for unmute handling here. if (mute_value == TRUE && device_available == TRUE) { update_state(STATE_MUTED); } else { reset_mute_blocking_animation(); } g_debug("signal caught - sink mute update with mute value: %i", mute_value); - gtk_widget_set_sensitive(volume_slider, !mute_value); -} + g_return_if_fail(IS_INDICATOR_SOUND(userdata)); + IndicatorSound* indicator = INDICATOR_SOUND(userdata); + IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(indicator); -static void -reset_mute_blocking_animation() -{ - if (animation_id != 0) { - g_debug("about to remove the animation_id callback from the mainloop!!**"); - g_source_remove(animation_id); - animation_id = 0; - } - if (blocked_id != 0) { - g_debug("about to remove the blocked_id callback from the mainloop!!**"); - g_source_remove(blocked_id); - blocked_id = 0; - } + if(priv->volume_widget == NULL){ + return; + } + GtkWidget* slider_widget = volume_widget_get_ido_slider(VOLUME_WIDGET(priv->volume_widget)); + gtk_widget_set_sensitive(slider_widget, !mute_value); } + static void catch_signal_sink_availability_update(DBusGProxy *proxy, gboolean available_value, gpointer userdata) { @@ -723,51 +640,9 @@ catch_signal_sink_availability_update(DBusGProxy *proxy, gboolean available_valu g_debug("signal caught - sink availability update with value: %i", available_value); } - - - /*******************************************************************/ //UI callbacks /******************************************************************/ -/** -value_changed_event_cb: -This callback will get triggered irregardless of whether its a user change or a programmatic change. -**/ -static gboolean -value_changed_event_cb(GtkRange *range, gpointer user_data) -{ - gdouble current_value = CLAMP(gtk_range_get_value(range), 0, 100); - if (current_value == exterior_vol_update) { - g_debug("ignore the value changed event - its come from the outside"); - return FALSE; - } - DbusmenuMenuitem *item = (DbusmenuMenuitem*)user_data; - GValue value = {0}; - g_value_init(&value, G_TYPE_DOUBLE); - g_value_set_double(&value, current_value); - g_debug("Value changed callback - = %f", current_value); - dbusmenu_menuitem_handle_event (item, "slider_change", &value, 0); - // This is not ideal in that the icon ui will update on ui actions and not on actual service feedback. - // but necessary for now as the server does not send volume update information if the source of change was this ui. - determine_state_from_volume(current_value); - return FALSE; -} - - -static void -slider_grabbed (GtkWidget *widget, gpointer user_data) -{ - slider_in_direct_use = TRUE; - g_debug ("!!!!!! grabbed\n"); -} - -static void -slider_released (GtkWidget *widget, gpointer user_data) -{ - slider_in_direct_use = FALSE; - g_debug ("!!!!!! released\n"); -} - /** key_press_cb: @@ -777,7 +652,17 @@ key_press_cb(GtkWidget* widget, GdkEventKey* event, gpointer data) { gboolean digested = FALSE; - GtkWidget* slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)volume_slider); + g_return_val_if_fail(IS_INDICATOR_SOUND(data), FALSE); + + IndicatorSound *indicator = INDICATOR_SOUND (data); + + IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(indicator); + if(priv->volume_widget == NULL){ + return FALSE; + } + + GtkWidget* slider_widget = volume_widget_get_ido_slider(VOLUME_WIDGET(priv->volume_widget)); + GtkWidget* slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)slider_widget); GtkRange* range = (GtkRange*)slider; gdouble current_value = gtk_range_get_value(range); gdouble new_value = current_value; @@ -814,14 +699,10 @@ key_press_cb(GtkWidget* widget, GdkEventKey* event, gpointer data) default: break; } - new_value = CLAMP(new_value, 0, 100); if (new_value != current_value && current_state != STATE_MUTED) { g_debug("Attempting to set the range from the key listener to %f", new_value); - // In order to ensure that the exterior filtering does not catch this, reset the exterior_vol_update - // to ensure these updates. - exterior_vol_update = OUT_OF_RANGE; - gtk_range_set_value(range, new_value); + volume_widget_update(VOLUME_WIDGET(priv->volume_widget), new_value); } } return digested; @@ -837,21 +718,3 @@ style_changed_cb(GtkWidget *widget, gpointer user_data) free_the_animation_list(); prepare_blocked_animation(); } - -static void -scroll (IndicatorObject *io, gint delta, IndicatorScrollDirection direction) -{ - if (device_available == FALSE || current_state == STATE_MUTED) - return; - - IndicatorSound *sound = INDICATOR_SOUND (io); - GtkAdjustment *adj = gtk_range_get_adjustment (GTK_RANGE (sound->slider)); - gdouble value = gtk_range_get_value (GTK_RANGE (sound->slider)); - - if (direction == INDICATOR_OBJECT_SCROLL_UP) { - value += adj->step_increment; - } else { - value -= adj->step_increment; - } - gtk_range_set_value (GTK_RANGE (sound->slider), value); -} diff --git a/src/indicator-sound.h b/src/indicator-sound.h index 386ad2a..9f829bb 100644 --- a/src/indicator-sound.h +++ b/src/indicator-sound.h @@ -23,10 +23,37 @@ 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 . */ +#include +#include +#include +#include + +#define INDICATOR_SOUND_TYPE (indicator_sound_get_type ()) +#define INDICATOR_SOUND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), INDICATOR_SOUND_TYPE, IndicatorSound)) +#define INDICATOR_SOUND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), INDICATOR_SOUND_TYPE, IndicatorSoundClass)) +#define IS_INDICATOR_SOUND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), INDICATOR_SOUND_TYPE)) +#define IS_INDICATOR_SOUND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), INDICATOR_SOUND_TYPE)) +#define INDICATOR_SOUND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), INDICATOR_SOUND_TYPE, IndicatorSoundClass)) + +typedef struct _IndicatorSound IndicatorSound; +typedef struct _IndicatorSoundClass IndicatorSoundClass; + +//GObject class struct +struct _IndicatorSoundClass { + IndicatorObjectClass parent_class; +}; + +//GObject instance struct +struct _IndicatorSound { + IndicatorObject parent; + IndicatorServiceManager *service; +}; + +// GObject Boiler plate +GType indicator_sound_get_type (void); -// Essentially these are all exported to faciltiate testing void prepare_state_machine(); -void determine_state_from_volume(gdouble volume_percent); +extern void determine_state_from_volume(gdouble volume_percent); gint get_state(); gchar* get_state_image_name(gint state); void prepare_for_tests(IndicatorObject * io); diff --git a/src/metadata-menu-item.c b/src/metadata-menu-item.c index aadaf2c..662a9ea 100644 --- a/src/metadata-menu-item.c +++ b/src/metadata-menu-item.c @@ -1,4 +1,4 @@ -/* metadata-menu-item.c generated by valac, the Vala compiler +/* metadata-menu-item.c generated by valac 0.9.5, the Vala compiler * generated from metadata-menu-item.vala, do not modify */ /* diff --git a/src/metadata-widget.c b/src/metadata-widget.c index 670d983..aaf71e2 100644 --- a/src/metadata-widget.c +++ b/src/metadata-widget.c @@ -150,8 +150,8 @@ metadata_widget_init (MetadataWidget *self) g_signal_connect(G_OBJECT(twin_item), "property-changed", G_CALLBACK(metadata_widget_property_update), self); gtk_widget_show_all (priv->hbox); - gtk_container_add (GTK_CONTAINER (self), hbox); - + gtk_widget_set_size_request(GTK_WIDGET(self), 200, 60); + gtk_container_add (GTK_CONTAINER (self), hbox); } static gboolean @@ -201,11 +201,9 @@ metadata_widget_property_update(DbusmenuMenuitem* item, gchar* property, if(g_value_get_int(value) == DBUSMENU_PROPERTY_EMPTY){ g_debug("Metadata widget: property update - reset"); - gchar* empty = ""; GValue new_value = {0}; g_value_init(&new_value, G_TYPE_STRING); g_value_set_string(&new_value, g_strdup("")); - //g_free(empty); value = &new_value; } diff --git a/src/metadata-widget.h b/src/metadata-widget.h index 6f1d4d3..814d5e8 100644 --- a/src/metadata-widget.h +++ b/src/metadata-widget.h @@ -20,7 +20,7 @@ with this program. If not, see . #define __METADATA_WIDGET_H__ #include -#include +#include G_BEGIN_DECLS diff --git a/src/mpris-bridge.c b/src/mpris-bridge.c new file mode 100644 index 0000000..15ad9d5 --- /dev/null +++ b/src/mpris-bridge.c @@ -0,0 +1,246 @@ +/* mpris-bridge.c generated by valac 0.9.5, the Vala compiler + * generated from mpris-bridge.vala, do not modify */ + + +#include +#include +#include +#include +#include +#include + + +#define TYPE_MPRIS_BRIDGE (mpris_bridge_get_type ()) +#define MPRIS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_BRIDGE, MprisBridge)) +#define MPRIS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS_BRIDGE, MprisBridgeClass)) +#define IS_MPRIS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_BRIDGE)) +#define IS_MPRIS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS_BRIDGE)) +#define MPRIS_BRIDGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS_BRIDGE, MprisBridgeClass)) + +typedef struct _MprisBridge MprisBridge; +typedef struct _MprisBridgeClass MprisBridgeClass; +typedef struct _MprisBridgePrivate MprisBridgePrivate; + +#define TYPE_MPRIS_CONTROLLER (mpris_controller_get_type ()) +#define MPRIS_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_CONTROLLER, MprisController)) +#define MPRIS_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS_CONTROLLER, MprisControllerClass)) +#define IS_MPRIS_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_CONTROLLER)) +#define IS_MPRIS_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS_CONTROLLER)) +#define MPRIS_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS_CONTROLLER, MprisControllerClass)) + +typedef struct _MprisController MprisController; +typedef struct _MprisControllerClass MprisControllerClass; + +#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 MPRIS_BRIDGE_TYPE_MODE (mpris_bridge_mode_get_type ()) +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) + +#define TYPE_PLAYER_CONTROLLER (player_controller_get_type ()) +#define PLAYER_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYER_CONTROLLER, PlayerController)) +#define PLAYER_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYER_CONTROLLER, PlayerControllerClass)) +#define IS_PLAYER_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYER_CONTROLLER)) +#define IS_PLAYER_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYER_CONTROLLER)) +#define PLAYER_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYER_CONTROLLER, PlayerControllerClass)) + +typedef struct _PlayerController PlayerController; +typedef struct _PlayerControllerClass PlayerControllerClass; + +#define TRANSPORT_MENUITEM_TYPE_ACTION (transport_menuitem_action_get_type ()) + +struct _MprisBridge { + GObject parent_instance; + MprisBridgePrivate * priv; +}; + +struct _MprisBridgeClass { + GObjectClass parent_class; +}; + +typedef enum { + MPRIS_BRIDGE_MODE_MPRIS_1, + MPRIS_BRIDGE_MODE_MPRIS_2 +} MprisBridgemode; + +struct _MprisBridgePrivate { + MprisController* mpris1_controller; + Mpris2Controller* mpris2_controller; + MprisBridgemode mode_in_use; +}; + +typedef enum { + TRANSPORT_MENUITEM_ACTION_PREVIOUS, + TRANSPORT_MENUITEM_ACTION_PLAY_PAUSE, + TRANSPORT_MENUITEM_ACTION_NEXT +} TransportMenuitemaction; + + +static gpointer mpris_bridge_parent_class = NULL; + +GType mpris_bridge_get_type (void) G_GNUC_CONST; +GType mpris_controller_get_type (void) G_GNUC_CONST; +GType mpris2_controller_get_type (void) G_GNUC_CONST; +static GType mpris_bridge_mode_get_type (void) G_GNUC_UNUSED; +#define MPRIS_BRIDGE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_MPRIS_BRIDGE, MprisBridgePrivate)) +enum { + MPRIS_BRIDGE_DUMMY_PROPERTY +}; +GType player_controller_get_type (void) G_GNUC_CONST; +Mpris2Controller* mpris2_controller_new (PlayerController* ctrl); +Mpris2Controller* mpris2_controller_construct (GType object_type, PlayerController* ctrl); +gboolean mpris2_controller_was_successfull (Mpris2Controller* self); +void mpris2_controller_initial_update (Mpris2Controller* self); +MprisController* mpris_controller_new (PlayerController* ctrl, const char* inter); +MprisController* mpris_controller_construct (GType object_type, PlayerController* ctrl, const char* inter); +MprisBridge* mpris_bridge_new (PlayerController* ctrl); +MprisBridge* mpris_bridge_construct (GType object_type, PlayerController* ctrl); +gboolean mpris_controller_connected (MprisController* self); +gboolean mpris2_controller_connected (Mpris2Controller* self); +gboolean mpris_bridge_connected (MprisBridge* self); +GType transport_menuitem_action_get_type (void) G_GNUC_CONST; +void mpris_controller_transport_event (MprisController* self, TransportMenuitemaction command); +void mpris2_controller_transport_event (Mpris2Controller* self, TransportMenuitemaction command); +void mpris_bridge_transport_update (MprisBridge* self, TransportMenuitemaction update); +void mpris2_controller_expose (Mpris2Controller* self); +void mpris_bridge_expose (MprisBridge* self); +void mpris_controller_set_position (MprisController* self, double position); +void mpris2_controller_set_position (Mpris2Controller* self, double position); +void mpris_bridge_set_track_position (MprisBridge* self, double pos); +static void mpris_bridge_finalize (GObject* obj); + + + +static GType mpris_bridge_mode_get_type (void) { + static volatile gsize mpris_bridge_mode_type_id__volatile = 0; + if (g_once_init_enter (&mpris_bridge_mode_type_id__volatile)) { + static const GEnumValue values[] = {{MPRIS_BRIDGE_MODE_MPRIS_1, "MPRIS_BRIDGE_MODE_MPRIS_1", "mpris-1"}, {MPRIS_BRIDGE_MODE_MPRIS_2, "MPRIS_BRIDGE_MODE_MPRIS_2", "mpris-2"}, {0, NULL, NULL}}; + GType mpris_bridge_mode_type_id; + mpris_bridge_mode_type_id = g_enum_register_static ("MprisBridgemode", values); + g_once_init_leave (&mpris_bridge_mode_type_id__volatile, mpris_bridge_mode_type_id); + } + return mpris_bridge_mode_type_id__volatile; +} + + +MprisBridge* mpris_bridge_construct (GType object_type, PlayerController* ctrl) { + MprisBridge * self; + Mpris2Controller* _tmp0_; + g_return_val_if_fail (ctrl != NULL, NULL); + self = (MprisBridge*) g_object_new (object_type, NULL); + self->priv->mpris2_controller = (_tmp0_ = mpris2_controller_new (ctrl), _g_object_unref0 (self->priv->mpris2_controller), _tmp0_); + if (mpris2_controller_was_successfull (self->priv->mpris2_controller) == TRUE) { + MprisController* _tmp1_; + self->priv->mode_in_use = MPRIS_BRIDGE_MODE_MPRIS_2; + self->priv->mpris1_controller = (_tmp1_ = NULL, _g_object_unref0 (self->priv->mpris1_controller), _tmp1_); + mpris2_controller_initial_update (self->priv->mpris2_controller); + } else { + Mpris2Controller* _tmp2_; + MprisController* _tmp3_; + self->priv->mpris2_controller = (_tmp2_ = NULL, _g_object_unref0 (self->priv->mpris2_controller), _tmp2_); + self->priv->mode_in_use = MPRIS_BRIDGE_MODE_MPRIS_1; + self->priv->mpris1_controller = (_tmp3_ = mpris_controller_new (ctrl, "org.freedesktop.MediaPlayer"), _g_object_unref0 (self->priv->mpris1_controller), _tmp3_); + } + return self; +} + + +MprisBridge* mpris_bridge_new (PlayerController* ctrl) { + return mpris_bridge_construct (TYPE_MPRIS_BRIDGE, ctrl); +} + + +gboolean mpris_bridge_connected (MprisBridge* self) { + gboolean result = FALSE; + g_return_val_if_fail (self != NULL, FALSE); + if (self->priv->mode_in_use == MPRIS_BRIDGE_MODE_MPRIS_1) { + result = mpris_controller_connected (self->priv->mpris1_controller); + return result; + } else { + if (self->priv->mode_in_use == MPRIS_BRIDGE_MODE_MPRIS_2) { + result = mpris2_controller_connected (self->priv->mpris2_controller); + return result; + } + } + result = FALSE; + return result; +} + + +void mpris_bridge_transport_update (MprisBridge* self, TransportMenuitemaction update) { + g_return_if_fail (self != NULL); + if (self->priv->mode_in_use == MPRIS_BRIDGE_MODE_MPRIS_1) { + mpris_controller_transport_event (self->priv->mpris1_controller, update); + } else { + if (self->priv->mode_in_use == MPRIS_BRIDGE_MODE_MPRIS_2) { + mpris2_controller_transport_event (self->priv->mpris2_controller, update); + } + } +} + + +void mpris_bridge_expose (MprisBridge* self) { + g_return_if_fail (self != NULL); + if (self->priv->mode_in_use == MPRIS_BRIDGE_MODE_MPRIS_2) { + mpris2_controller_expose (self->priv->mpris2_controller); + } else { + g_warning ("mpris-bridge.vala:56: MPRIS1 clients don't have the ability to raise/e" \ +"xpose the client"); + } +} + + +void mpris_bridge_set_track_position (MprisBridge* self, double pos) { + g_return_if_fail (self != NULL); + if (self->priv->mode_in_use == MPRIS_BRIDGE_MODE_MPRIS_1) { + mpris_controller_set_position (self->priv->mpris1_controller, pos); + } else { + if (self->priv->mode_in_use == MPRIS_BRIDGE_MODE_MPRIS_2) { + mpris2_controller_set_position (self->priv->mpris2_controller, pos); + } + } +} + + +static void mpris_bridge_class_init (MprisBridgeClass * klass) { + mpris_bridge_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (MprisBridgePrivate)); + G_OBJECT_CLASS (klass)->finalize = mpris_bridge_finalize; +} + + +static void mpris_bridge_instance_init (MprisBridge * self) { + self->priv = MPRIS_BRIDGE_GET_PRIVATE (self); +} + + +static void mpris_bridge_finalize (GObject* obj) { + MprisBridge * self; + self = MPRIS_BRIDGE (obj); + _g_object_unref0 (self->priv->mpris1_controller); + _g_object_unref0 (self->priv->mpris2_controller); + G_OBJECT_CLASS (mpris_bridge_parent_class)->finalize (obj); +} + + +GType mpris_bridge_get_type (void) { + static volatile gsize mpris_bridge_type_id__volatile = 0; + if (g_once_init_enter (&mpris_bridge_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (MprisBridgeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) mpris_bridge_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MprisBridge), 0, (GInstanceInitFunc) mpris_bridge_instance_init, NULL }; + GType mpris_bridge_type_id; + mpris_bridge_type_id = g_type_register_static (G_TYPE_OBJECT, "MprisBridge", &g_define_type_info, 0); + g_once_init_leave (&mpris_bridge_type_id__volatile, mpris_bridge_type_id); + } + return mpris_bridge_type_id__volatile; +} + + + + diff --git a/src/mpris-bridge.vala b/src/mpris-bridge.vala new file mode 100644 index 0000000..bd9d472 --- /dev/null +++ b/src/mpris-bridge.vala @@ -0,0 +1,70 @@ +public class MprisBridge : GLib.Object +{ + private MprisController mpris1_controller; + private Mpris2Controller mpris2_controller; + private enum mode{ + MPRIS_1, + MPRIS_2 + } + private mode mode_in_use; + + public MprisBridge(PlayerController ctrl) + { + this.mpris2_controller = new Mpris2Controller(ctrl); + if(this.mpris2_controller.was_successfull() == true){ + this.mode_in_use = mode.MPRIS_2; + this.mpris1_controller = null; + this.mpris2_controller.initial_update(); + } + else{ + this.mpris2_controller = null; + this.mode_in_use = mode.MPRIS_1; + this.mpris1_controller = new MprisController(ctrl); + } + } + + // The handling of both mpris controllers can be abstracted further + // once the mpris2 is implemented. This will allow for one instance + // variable to point at the active controller. For now handle both ... + public bool connected() + { + if(this.mode_in_use == mode.MPRIS_1){ + return this.mpris1_controller.connected(); + } + else if(this.mode_in_use == mode.MPRIS_2){ + return this.mpris2_controller.connected(); + } + return false; + } + + public void transport_update(TransportMenuitem.action update) + { + if(this.mode_in_use == mode.MPRIS_1){ + this.mpris1_controller.transport_event(update); + } + else if(this.mode_in_use == mode.MPRIS_2){ + this.mpris2_controller.transport_event(update); + } + } + + public void expose() + { + if(this.mode_in_use == mode.MPRIS_2){ + this.mpris2_controller.expose(); + } + else{ + warning("MPRIS1 clients don't have the ability to raise/expose the client"); + } + } + + + public void set_track_position(double pos) + { + if(this.mode_in_use == mode.MPRIS_1){ + this.mpris1_controller.set_position(pos); + } + else if(this.mode_in_use == mode.MPRIS_2){ + this.mpris2_controller.set_position(pos); + } + } +} \ No newline at end of file diff --git a/src/mpris-controller-v2.c b/src/mpris-controller-v2.c deleted file mode 100644 index 03665a5..0000000 --- a/src/mpris-controller-v2.c +++ /dev/null @@ -1,130 +0,0 @@ -/* mpris-controller-v2.c generated by valac, the Vala compiler - * generated from mpris-controller-v2.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 - -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 . -*/ - -#include -#include -#include -#include - - -#define TYPE_MPRIS_CONTROLLER (mpris_controller_get_type ()) -#define MPRIS_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_CONTROLLER, MprisController)) -#define MPRIS_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS_CONTROLLER, MprisControllerClass)) -#define IS_MPRIS_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_CONTROLLER)) -#define IS_MPRIS_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS_CONTROLLER)) -#define MPRIS_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS_CONTROLLER, MprisControllerClass)) - -typedef struct _MprisController MprisController; -typedef struct _MprisControllerClass MprisControllerClass; -typedef struct _MprisControllerPrivate MprisControllerPrivate; - -#define TYPE_MPRIS_CONTROLLER_V2 (mpris_controller_v2_get_type ()) -#define MPRIS_CONTROLLER_V2(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_CONTROLLER_V2, MprisControllerV2)) -#define MPRIS_CONTROLLER_V2_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS_CONTROLLER_V2, MprisControllerV2Class)) -#define IS_MPRIS_CONTROLLER_V2(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_CONTROLLER_V2)) -#define IS_MPRIS_CONTROLLER_V2_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS_CONTROLLER_V2)) -#define MPRIS_CONTROLLER_V2_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS_CONTROLLER_V2, MprisControllerV2Class)) - -typedef struct _MprisControllerV2 MprisControllerV2; -typedef struct _MprisControllerV2Class MprisControllerV2Class; -typedef struct _MprisControllerV2Private MprisControllerV2Private; - -#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; - -struct _MprisController { - GObject parent_instance; - MprisControllerPrivate * priv; -}; - -struct _MprisControllerClass { - GObjectClass parent_class; -}; - -struct _MprisControllerV2 { - MprisController parent_instance; - MprisControllerV2Private * priv; -}; - -struct _MprisControllerV2Class { - MprisControllerClass parent_class; -}; - - -static gpointer mpris_controller_v2_parent_class = NULL; - -GType mpris_controller_get_type (void) G_GNUC_CONST; -GType mpris_controller_v2_get_type (void) G_GNUC_CONST; -enum { - MPRIS_CONTROLLER_V2_DUMMY_PROPERTY -}; -GType player_controller_get_type (void) G_GNUC_CONST; -MprisControllerV2* mpris_controller_v2_new (PlayerController* ctrl, const char* inter); -MprisControllerV2* mpris_controller_v2_construct (GType object_type, PlayerController* ctrl, const char* inter); - - - -MprisControllerV2* mpris_controller_v2_construct (GType object_type, PlayerController* ctrl, const char* inter) { - MprisControllerV2 * self; - g_return_val_if_fail (ctrl != NULL, NULL); - g_return_val_if_fail (inter != NULL, NULL); - self = (MprisControllerV2*) g_object_new (object_type, "owner", ctrl, "mpris-interface", inter, NULL); - return self; -} - - -MprisControllerV2* mpris_controller_v2_new (PlayerController* ctrl, const char* inter) { - return mpris_controller_v2_construct (TYPE_MPRIS_CONTROLLER_V2, ctrl, inter); -} - - -static void mpris_controller_v2_class_init (MprisControllerV2Class * klass) { - mpris_controller_v2_parent_class = g_type_class_peek_parent (klass); -} - - -static void mpris_controller_v2_instance_init (MprisControllerV2 * self) { -} - - -GType mpris_controller_v2_get_type (void) { - static volatile gsize mpris_controller_v2_type_id__volatile = 0; - if (g_once_init_enter (&mpris_controller_v2_type_id__volatile)) { - static const GTypeInfo g_define_type_info = { sizeof (MprisControllerV2Class), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) mpris_controller_v2_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MprisControllerV2), 0, (GInstanceInitFunc) mpris_controller_v2_instance_init, NULL }; - GType mpris_controller_v2_type_id; - mpris_controller_v2_type_id = g_type_register_static (TYPE_MPRIS_CONTROLLER, "MprisControllerV2", &g_define_type_info, 0); - g_once_init_leave (&mpris_controller_v2_type_id__volatile, mpris_controller_v2_type_id); - } - return mpris_controller_v2_type_id__volatile; -} - - - - diff --git a/src/mpris-controller-v2.vala b/src/mpris-controller-v2.vala deleted file mode 100644 index efb5084..0000000 --- a/src/mpris-controller-v2.vala +++ /dev/null @@ -1,28 +0,0 @@ -/* -This service primarily controls PulseAudio and is driven by the sound indicator menu on the panel. -Copyright 2010 Canonical Ltd. - -Authors: - Conor Curran - -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 . -*/ -using Gee; - -public class MprisControllerV2 : MprisController -{ - public MprisControllerV2(PlayerController ctrl, string inter="org.mpris.MediaPlayer.Player"){ - Object(owner: ctrl, mpris_interface: inter); - } - -} diff --git a/src/mpris-controller.c b/src/mpris-controller.c index 14a462b..1f891f7 100644 --- a/src/mpris-controller.c +++ b/src/mpris-controller.c @@ -1,4 +1,4 @@ -/* mpris-controller.c generated by valac, the Vala compiler +/* mpris-controller.c generated by valac 0.9.5, the Vala compiler * generated from mpris-controller.vala, do not modify */ /* @@ -74,6 +74,16 @@ typedef struct _PlayerControllerPrivate PlayerControllerPrivate; typedef struct _PlayerItem PlayerItem; typedef struct _PlayerItemClass PlayerItemClass; +#define TYPE_MPRIS_BRIDGE (mpris_bridge_get_type ()) +#define MPRIS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_BRIDGE, MprisBridge)) +#define MPRIS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS_BRIDGE, MprisBridgeClass)) +#define IS_MPRIS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_BRIDGE)) +#define IS_MPRIS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS_BRIDGE)) +#define MPRIS_BRIDGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS_BRIDGE, MprisBridgeClass)) + +typedef struct _MprisBridge MprisBridge; +typedef struct _MprisBridgeClass MprisBridgeClass; + #define PLAYER_CONTROLLER_TYPE_WIDGET_ORDER (player_controller_widget_order_get_type ()) #define TYPE_TRANSPORT_MENUITEM (transport_menuitem_get_type ()) @@ -128,7 +138,7 @@ struct _PlayerController { PlayerControllerPrivate * priv; gint current_state; GeeArrayList* custom_items; - MprisController* mpris_adaptor; + MprisBridge* mpris_bridge; }; struct _PlayerControllerClass { @@ -140,8 +150,7 @@ typedef enum { PLAYER_CONTROLLER_WIDGET_ORDER_TITLE, PLAYER_CONTROLLER_WIDGET_ORDER_METADATA, PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB, - PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT, - PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLIST + PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT } PlayerControllerwidget_order; typedef enum { @@ -171,6 +180,7 @@ static void mpris_controller_status_free (MprisControllerstatus* self); static void _dynamic_GetStatus0 (DBusGProxy* self, MprisControllerstatus* result, GError** error); PlayerController* mpris_controller_get_owner (MprisController* self); GType player_item_get_type (void) G_GNUC_CONST; +GType mpris_bridge_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, gint state); @@ -197,8 +207,10 @@ gboolean mpris_controller_connected (MprisController* self); GeeHashSet* transport_menuitem_attributes_format (void); static void mpris_controller_onStatusChange (MprisController* self, DBusGProxy* mpris_client, MprisControllerstatus* st); void player_item_reset (PlayerItem* self, GeeHashSet* attrs); -static GHashTable* _dynamic_GetMetadata10 (DBusGProxy* self, GError** error); -static gint32 _dynamic_PositionGet11 (DBusGProxy* self, GError** error); +static void _dynamic_GetStatus10 (DBusGProxy* self, MprisControllerstatus* result, GError** error); +void scrub_menuitem_update_playstate (ScrubMenuitem* self, gint state); +static GHashTable* _dynamic_GetMetadata11 (DBusGProxy* self, GError** error); +static gint32 _dynamic_PositionGet12 (DBusGProxy* self, GError** error); static void mpris_controller_onTrackChange (MprisController* self, DBusGProxy* mpris_client, GHashTable* ht); static void mpris_controller_set_mpris_player (MprisController* self, DBusGProxy* value); static void mpris_controller_set_owner (MprisController* self, PlayerController* value); @@ -365,9 +377,9 @@ void mpris_controller_transport_event (MprisController* self, TransportMenuitema GError * _inner_error_; g_return_if_fail (self != NULL); _inner_error_ = NULL; - g_debug ("mpris-controller.vala:73: transport_event input = %i", (gint) command); + g_debug ("mpris-controller.vala:72: transport_event input = %i", (gint) command); if (command == TRANSPORT_MENUITEM_ACTION_PLAY_PAUSE) { - g_debug ("mpris-controller.vala:75: transport_event PLAY_PAUSE"); + g_debug ("mpris-controller.vala:74: transport_event PLAY_PAUSE"); _dynamic_Pause4 (self->priv->_mpris_player, &_inner_error_); 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); @@ -445,7 +457,7 @@ void mpris_controller_set_position (MprisController* self, double position) { gint32 _tmp1_; g_return_if_fail (self != NULL); _inner_error_ = NULL; - g_debug ("mpris-controller.vala:88: Set position with pos (0-100) %f", position); + g_debug ("mpris-controller.vala:87: Set position with pos (0-100) %f", position); data = _dynamic_GetMetadata7 (self->priv->_mpris_player, &_inner_error_); 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); @@ -454,16 +466,16 @@ void mpris_controller_set_position (MprisController* self, double position) { } time_value = __g_value_dup0 ((GValue*) g_hash_table_lookup (data, "time")); if (time_value == NULL) { - g_warning ("mpris-controller.vala:92: Can't fetch the duration of the track theref" \ + g_warning ("mpris-controller.vala:91: Can't fetch the duration of the track theref" \ "ore cant set the position"); _g_free0 (time_value); _g_hash_table_unref0 (data); return; } total_time = (guint32) g_value_get_uint (time_value); - g_debug ("mpris-controller.vala:96: total time of track = %i", (gint) total_time); + g_debug ("mpris-controller.vala:95: total time of track = %i", (gint) total_time); new_time_position = (total_time * position) / 100.0; - g_debug ("mpris-controller.vala:98: new position = %f", new_time_position * 1000); + g_debug ("mpris-controller.vala:97: new position = %f", new_time_position * 1000); _dynamic_PositionSet8 (self->priv->_mpris_player, (gint32) new_time_position, &_inner_error_); if (_inner_error_ != NULL) { _g_free0 (time_value); @@ -509,11 +521,11 @@ static void mpris_controller_onStatusChange (MprisController* self, DBusGProxy* PlayerItem* _tmp2_; g_return_if_fail (self != NULL); g_return_if_fail (mpris_client != NULL); - g_debug ("mpris-controller.vala:111: onStatusChange - signal received"); + g_debug ("mpris-controller.vala:110: onStatusChange - signal received"); status = st; ar = (GValueArray*) status; play_state = g_value_get_int (g_value_array_get_nth (ar, (guint) 0)); - g_debug ("mpris-controller.vala:115: onStatusChange - play state %i", play_state); + g_debug ("mpris-controller.vala:114: onStatusChange - play state %i", play_state); ht = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); g_value_init (&v, G_TYPE_INT); g_value_set_int (&v, play_state); @@ -529,7 +541,20 @@ static void mpris_controller_onStatusChange (MprisController* self, DBusGProxy* } -static GHashTable* _dynamic_GetMetadata10 (DBusGProxy* self, GError** error) { +static void _dynamic_GetStatus10 (DBusGProxy* self, MprisControllerstatus* result, GError** error) { + GValueArray* dbus_result; + dbus_g_proxy_call (self, "GetStatus", error, G_TYPE_INVALID, dbus_g_type_get_struct ("GValueArray", G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INVALID), &dbus_result, G_TYPE_INVALID); + if (*error) { + return; + } + result->playback = g_value_get_int (&dbus_result->values[0]); + result->shuffle = g_value_get_int (&dbus_result->values[1]); + result->repeat = g_value_get_int (&dbus_result->values[2]); + result->endless = g_value_get_int (&dbus_result->values[3]); +} + + +static GHashTable* _dynamic_GetMetadata11 (DBusGProxy* self, GError** error) { GHashTable* result; dbus_g_proxy_call (self, "GetMetadata", error, G_TYPE_INVALID, dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE), &result, G_TYPE_INVALID); if (*error) { @@ -539,7 +564,7 @@ static GHashTable* _dynamic_GetMetadata10 (DBusGProxy* self, GError** error) { } -static gint32 _dynamic_PositionGet11 (DBusGProxy* self, GError** error) { +static gint32 _dynamic_PositionGet12 (DBusGProxy* self, GError** error) { gint32 result; dbus_g_proxy_call (self, "PositionGet", error, G_TYPE_INVALID, G_TYPE_INT, &result, G_TYPE_INVALID); if (*error) { @@ -555,33 +580,43 @@ static void mpris_controller_onTrackChange (MprisController* self, DBusGProxy* m PlayerItem* _tmp0_; GeeHashSet* _tmp3_; PlayerItem* _tmp2_; - GeeHashSet* _tmp5_; - PlayerItem* _tmp4_; + MprisControllerstatus _tmp4_ = {0}; + MprisControllerstatus st; + gint play_state; + PlayerItem* _tmp5_; + ScrubMenuitem* scrub; GHashTable* _tmp6_; GeeHashSet* _tmp9_; GHashTable* _tmp8_; PlayerItem* _tmp7_; + GeeHashSet* _tmp11_; PlayerItem* _tmp10_; - ScrubMenuitem* scrub; - gint32 _tmp11_; + gint32 _tmp12_; g_return_if_fail (self != NULL); g_return_if_fail (mpris_client != NULL); g_return_if_fail (ht != NULL); _inner_error_ = NULL; - g_debug ("mpris-controller.vala:126: onTrackChange"); + g_debug ("mpris-controller.vala:125: onTrackChange"); player_item_reset (_tmp0_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), _tmp1_ = metadata_menuitem_attributes_format ()); _g_object_unref0 (_tmp1_); _g_object_unref0 (_tmp0_); player_item_reset (_tmp2_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), _tmp3_ = scrub_menuitem_attributes_format ()); _g_object_unref0 (_tmp3_); _g_object_unref0 (_tmp2_); - player_item_update (_tmp4_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), ht, _tmp5_ = metadata_menuitem_attributes_format ()); - _g_object_unref0 (_tmp5_); - _g_object_unref0 (_tmp4_); - g_debug ("mpris-controller.vala:131: about to update the duration on the scrub b" \ -"ar"); - _tmp6_ = _dynamic_GetMetadata10 (self->priv->_mpris_player, &_inner_error_); + st = (_dynamic_GetStatus10 (self->priv->_mpris_player, &_tmp4_, &_inner_error_), _tmp4_); + 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; + } + play_state = (gint) st.playback; + g_debug ("mpris-controller.vala:133: GetStatusChange, about to update scrub with" \ +" play state - %i", play_state); + scrub = (_tmp5_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), IS_SCRUB_MENUITEM (_tmp5_) ? ((ScrubMenuitem*) _tmp5_) : NULL); + scrub_menuitem_update_playstate (scrub, play_state); + _tmp6_ = _dynamic_GetMetadata11 (self->priv->_mpris_player, &_inner_error_); if (_inner_error_ != NULL) { + _g_object_unref0 (scrub); 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; @@ -590,15 +625,19 @@ static void mpris_controller_onTrackChange (MprisController* self, DBusGProxy* m _g_object_unref0 (_tmp9_); _g_hash_table_unref0 (_tmp8_); _g_object_unref0 (_tmp7_); - scrub = (_tmp10_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), IS_SCRUB_MENUITEM (_tmp10_) ? ((ScrubMenuitem*) _tmp10_) : NULL); - _tmp11_ = _dynamic_PositionGet11 (self->priv->_mpris_player, &_inner_error_); + player_item_update (_tmp10_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), ht, _tmp11_ = metadata_menuitem_attributes_format ()); + _g_object_unref0 (_tmp11_); + _g_object_unref0 (_tmp10_); + g_debug ("mpris-controller.vala:141: about to update the duration on the scrub b" \ +"ar"); + _tmp12_ = _dynamic_PositionGet12 (self->priv->_mpris_player, &_inner_error_); if (_inner_error_ != NULL) { _g_object_unref0 (scrub); 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; } - scrub_menuitem_update_position (scrub, _tmp11_); + scrub_menuitem_update_position (scrub, _tmp12_); _g_object_unref0 (scrub); } diff --git a/src/mpris-controller.vala b/src/mpris-controller.vala index 8ecd20a..1e1e00a 100644 --- a/src/mpris-controller.vala +++ b/src/mpris-controller.vala @@ -63,7 +63,6 @@ public class MprisController : GLib.Object MetadataMenuitem.attributes_format()); this.owner.custom_items[PlayerController.widget_order.SCRUB].update(this.mpris_player.GetMetadata(), ScrubMenuitem.attributes_format()); - // temporary fix ScrubMenuitem scrub = this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem; scrub.update_position(this.mpris_player.PositionGet()); } @@ -124,17 +123,23 @@ public class MprisController : GLib.Object private void onTrackChange(dynamic DBus.Object mpris_client, HashTable ht) { debug("onTrackChange"); + this.owner.custom_items[PlayerController.widget_order.METADATA].reset(MetadataMenuitem.attributes_format()); this.owner.custom_items[PlayerController.widget_order.SCRUB].reset(ScrubMenuitem.attributes_format()); + //HashTable status_hash = new HashTable(str_hash, str_equal); + + status st = this.mpris_player.GetStatus(); + int play_state = st.playback; + debug("GetStatusChange, about to update scrub with play state - %i", play_state); + + ScrubMenuitem scrub = this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem; + scrub.update_playstate(play_state); + this.owner.custom_items[PlayerController.widget_order.SCRUB].update(this.mpris_player.GetMetadata(), + ScrubMenuitem.attributes_format()); this.owner.custom_items[PlayerController.widget_order.METADATA].update(ht, MetadataMenuitem.attributes_format()); debug("about to update the duration on the scrub bar"); - this.owner.custom_items[PlayerController.widget_order.SCRUB].update(this.mpris_player.GetMetadata(), - ScrubMenuitem.attributes_format()); // temporary fix - ScrubMenuitem scrub = this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem; scrub.update_position(this.mpris_player.PositionGet()); } - - } diff --git a/src/mpris2-controller.c b/src/mpris2-controller.c new file mode 100644 index 0000000..a6546bb --- /dev/null +++ b/src/mpris2-controller.c @@ -0,0 +1,5424 @@ +/* mpris2-controller.c generated by valac 0.9.5, the Vala compiler + * generated from mpris2-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 + +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 . +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#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; + +#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; + +#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))) +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_MPRIS_BRIDGE (mpris_bridge_get_type ()) +#define MPRIS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_BRIDGE, MprisBridge)) +#define MPRIS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS_BRIDGE, MprisBridgeClass)) +#define IS_MPRIS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_BRIDGE)) +#define IS_MPRIS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS_BRIDGE)) +#define MPRIS_BRIDGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS_BRIDGE, MprisBridgeClass)) + +typedef struct _MprisBridge MprisBridge; +typedef struct _MprisBridgeClass MprisBridgeClass; + +#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 TYPE_SCRUB_MENUITEM (scrub_menuitem_get_type ()) +#define SCRUB_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SCRUB_MENUITEM, ScrubMenuitem)) +#define SCRUB_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SCRUB_MENUITEM, ScrubMenuitemClass)) +#define IS_SCRUB_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SCRUB_MENUITEM)) +#define IS_SCRUB_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SCRUB_MENUITEM)) +#define SCRUB_MENUITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SCRUB_MENUITEM, ScrubMenuitemClass)) + +typedef struct _ScrubMenuitem ScrubMenuitem; +typedef struct _ScrubMenuitemClass ScrubMenuitemClass; + +#define TRANSPORT_MENUITEM_TYPE_ACTION (transport_menuitem_action_get_type ()) +#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) +#define _dbus_g_connection_unref0(var) ((var == NULL) ? NULL : (var = (dbus_g_connection_unref (var), NULL))) + +struct _MprisRootIface { + GTypeInterface parent_iface; + void (*Quit) (MprisRoot* self, GError** error); + void (*Raise) (MprisRoot* self, 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 _MprisPlayerIface { + GTypeInterface parent_iface; + void (*SetPosition) (MprisPlayer* self, const char* path, gint64 pos, GError** error); + void (*PlayPause) (MprisPlayer* self, GError** error); + void (*Pause) (MprisPlayer* self, GError** error); + void (*Next) (MprisPlayer* self, GError** error); + void (*Previous) (MprisPlayer* self, 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 _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; +}; + +struct _PlayerController { + GObject parent_instance; + PlayerControllerPrivate * priv; + gint current_state; + GeeArrayList* custom_items; + MprisBridge* 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_SCRUB, + 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, GError** error); +void mpris_root_Raise (MprisRoot* self, 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 DBusHandlerResult _dbus_mpris_root_Raise (MprisRoot* self, DBusConnection* connection, DBusMessage* message); +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 (MprisRoot* self, GError** error); +static void mpris_root_dbus_proxy_Raise (MprisRoot* self, 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_SetPosition (MprisPlayer* self, const char* path, gint64 pos, GError** error); +void mpris_player_PlayPause (MprisPlayer* self, GError** error); +void mpris_player_Pause (MprisPlayer* self, GError** error); +void mpris_player_Next (MprisPlayer* self, GError** error); +void mpris_player_Previous (MprisPlayer* self, 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_SetPosition (MprisPlayer* self, DBusConnection* connection, DBusMessage* message); +static DBusHandlerResult _dbus_mpris_player_PlayPause (MprisPlayer* self, DBusConnection* connection, DBusMessage* message); +static DBusHandlerResult _dbus_mpris_player_Pause (MprisPlayer* self, DBusConnection* connection, DBusMessage* message); +static DBusHandlerResult _dbus_mpris_player_Next (MprisPlayer* self, DBusConnection* connection, DBusMessage* message); +static DBusHandlerResult _dbus_mpris_player_Previous (MprisPlayer* self, DBusConnection* connection, DBusMessage* message); +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_SetPosition (MprisPlayer* self, const char* path, gint64 pos, GError** error); +static void mpris_player_dbus_proxy_PlayPause (MprisPlayer* self, GError** error); +static void mpris_player_dbus_proxy_Pause (MprisPlayer* self, GError** error); +static void mpris_player_dbus_proxy_Next (MprisPlayer* self, GError** error); +static void mpris_player_dbus_proxy_Previous (MprisPlayer* self, 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); +static GValue* _g_value_dup (GValue* self); +static gint mpris2_controller_determine_play_state (Mpris2Controller* self, const char* status); +PlayerController* mpris2_controller_get_owner (Mpris2Controller* self); +GType player_item_get_type (void) G_GNUC_CONST; +GType mpris_bridge_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, gint state); +GType scrub_menuitem_get_type (void) G_GNUC_CONST; +void scrub_menuitem_update_playstate (ScrubMenuitem* self, gint state); +void scrub_menuitem_update_position (ScrubMenuitem* self, gint32 new_position); +MprisPlayer* mpris2_controller_get_player (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); +GeeHashSet* scrub_menuitem_attributes_format (void); +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); +GType transport_menuitem_action_get_type (void) G_GNUC_CONST; +void mpris2_controller_transport_event (Mpris2Controller* self, TransportMenuitemaction command); +void mpris2_controller_set_position (Mpris2Controller* self, double position); +void mpris2_controller_onSeeked (Mpris2Controller* self, gint64 position); +MprisRoot* mpris2_controller_get_mpris2_root (Mpris2Controller* self); +gboolean mpris2_controller_connected (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); +const char* player_controller_get_name (PlayerController* self); +static void _mpris2_controller_onSeeked_mpris_player_seeked (MprisPlayer* _sender, gint64 new_position, gpointer self); +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, GError** error) { + MPRIS_ROOT_GET_INTERFACE (self)->Quit (self, error); +} + + +void mpris_root_Raise (MprisRoot* self, GError** error) { + MPRIS_ROOT_GET_INTERFACE (self)->Raise (self, 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 ("\n"); + g_string_append (xml_data, "\n\n \n \n \n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n\n \n \n \n \n \n \n \n \n \n\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, "\n", children[i]); + } + dbus_free_string_array (children); + g_string_append (xml_data, "\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; + GError* error; + DBusMessage* reply; + error = NULL; + if (strcmp (dbus_message_get_signature (message), "")) { + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + } + dbus_message_iter_init (message, &iter); + mpris_root_Quit (self, &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 DBUS_HANDLER_RESULT_HANDLED; + } + reply = dbus_message_new_method_return (message); + dbus_message_iter_init_append (reply, &iter); + 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_Raise (MprisRoot* self, DBusConnection* connection, DBusMessage* message) { + DBusMessageIter iter; + GError* error; + DBusMessage* reply; + error = NULL; + if (strcmp (dbus_message_get_signature (message), "")) { + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + } + dbus_message_iter_init (message, &iter); + mpris_root_Raise (self, &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 DBUS_HANDLER_RESULT_HANDLED; + } + reply = dbus_message_new_method_return (message); + dbus_message_iter_init_append (reply, &iter); + 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 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 (MprisRoot* self, GError** error) { + DBusError _dbus_error; + DBusGConnection *_connection; + DBusMessage *_message, *_reply; + DBusMessageIter _iter; + if (((MprisRootDBusProxy*) self)->disposed) { + g_set_error (error, DBUS_GERROR, DBUS_GERROR_DISCONNECTED, "%s", "Connection is closed"); + return; + } + _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_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)) { + GQuark _edomain; + gint _ecode; + if (strstr (_dbus_error.name, "org.freedesktop.DBus.Error") == _dbus_error.name) { + const char* _tmp20_; + _edomain = DBUS_GERROR; + _tmp20_ = _dbus_error.name + 27; + if (strcmp (_tmp20_, "Failed") == 0) { + _ecode = DBUS_GERROR_FAILED; + } else if (strcmp (_tmp20_, "NoMemory") == 0) { + _ecode = DBUS_GERROR_NO_MEMORY; + } else if (strcmp (_tmp20_, "ServiceUnknown") == 0) { + _ecode = DBUS_GERROR_SERVICE_UNKNOWN; + } else if (strcmp (_tmp20_, "NameHasNoOwner") == 0) { + _ecode = DBUS_GERROR_NAME_HAS_NO_OWNER; + } else if (strcmp (_tmp20_, "NoReply") == 0) { + _ecode = DBUS_GERROR_NO_REPLY; + } else if (strcmp (_tmp20_, "IOError") == 0) { + _ecode = DBUS_GERROR_IO_ERROR; + } else if (strcmp (_tmp20_, "BadAddress") == 0) { + _ecode = DBUS_GERROR_BAD_ADDRESS; + } else if (strcmp (_tmp20_, "NotSupported") == 0) { + _ecode = DBUS_GERROR_NOT_SUPPORTED; + } else if (strcmp (_tmp20_, "LimitsExceeded") == 0) { + _ecode = DBUS_GERROR_LIMITS_EXCEEDED; + } else if (strcmp (_tmp20_, "AccessDenied") == 0) { + _ecode = DBUS_GERROR_ACCESS_DENIED; + } else if (strcmp (_tmp20_, "AuthFailed") == 0) { + _ecode = DBUS_GERROR_AUTH_FAILED; + } else if (strcmp (_tmp20_, "NoServer") == 0) { + _ecode = DBUS_GERROR_NO_SERVER; + } else if (strcmp (_tmp20_, "Timeout") == 0) { + _ecode = DBUS_GERROR_TIMEOUT; + } else if (strcmp (_tmp20_, "NoNetwork") == 0) { + _ecode = DBUS_GERROR_NO_NETWORK; + } else if (strcmp (_tmp20_, "AddressInUse") == 0) { + _ecode = DBUS_GERROR_ADDRESS_IN_USE; + } else if (strcmp (_tmp20_, "Disconnected") == 0) { + _ecode = DBUS_GERROR_DISCONNECTED; + } else if (strcmp (_tmp20_, "InvalidArgs") == 0) { + _ecode = DBUS_GERROR_INVALID_ARGS; + } else if (strcmp (_tmp20_, "FileNotFound") == 0) { + _ecode = DBUS_GERROR_FILE_NOT_FOUND; + } else if (strcmp (_tmp20_, "FileExists") == 0) { + _ecode = DBUS_GERROR_FILE_EXISTS; + } else if (strcmp (_tmp20_, "UnknownMethod") == 0) { + _ecode = DBUS_GERROR_UNKNOWN_METHOD; + } else if (strcmp (_tmp20_, "TimedOut") == 0) { + _ecode = DBUS_GERROR_TIMED_OUT; + } else if (strcmp (_tmp20_, "MatchRuleNotFound") == 0) { + _ecode = DBUS_GERROR_MATCH_RULE_NOT_FOUND; + } else if (strcmp (_tmp20_, "MatchRuleInvalid") == 0) { + _ecode = DBUS_GERROR_MATCH_RULE_INVALID; + } else if (strcmp (_tmp20_, "Spawn.ExecFailed") == 0) { + _ecode = DBUS_GERROR_SPAWN_EXEC_FAILED; + } else if (strcmp (_tmp20_, "Spawn.ForkFailed") == 0) { + _ecode = DBUS_GERROR_SPAWN_FORK_FAILED; + } else if (strcmp (_tmp20_, "Spawn.ChildExited") == 0) { + _ecode = DBUS_GERROR_SPAWN_CHILD_EXITED; + } else if (strcmp (_tmp20_, "Spawn.ChildSignaled") == 0) { + _ecode = DBUS_GERROR_SPAWN_CHILD_SIGNALED; + } else if (strcmp (_tmp20_, "Spawn.Failed") == 0) { + _ecode = DBUS_GERROR_SPAWN_FAILED; + } else if (strcmp (_tmp20_, "UnixProcessIdUnknown") == 0) { + _ecode = DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN; + } else if (strcmp (_tmp20_, "InvalidSignature") == 0) { + _ecode = DBUS_GERROR_INVALID_SIGNATURE; + } else if (strcmp (_tmp20_, "InvalidFileContent") == 0) { + _ecode = DBUS_GERROR_INVALID_FILE_CONTENT; + } else if (strcmp (_tmp20_, "SELinuxSecurityContextUnknown") == 0) { + _ecode = DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN; + } else if (strcmp (_tmp20_, "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 (MprisRoot* self, GError** error) { + DBusError _dbus_error; + DBusGConnection *_connection; + DBusMessage *_message, *_reply; + DBusMessageIter _iter; + if (((MprisRootDBusProxy*) self)->disposed) { + g_set_error (error, DBUS_GERROR, DBUS_GERROR_DISCONNECTED, "%s", "Connection is closed"); + return; + } + _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_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)) { + GQuark _edomain; + gint _ecode; + if (strstr (_dbus_error.name, "org.freedesktop.DBus.Error") == _dbus_error.name) { + const char* _tmp21_; + _edomain = DBUS_GERROR; + _tmp21_ = _dbus_error.name + 27; + if (strcmp (_tmp21_, "Failed") == 0) { + _ecode = DBUS_GERROR_FAILED; + } else if (strcmp (_tmp21_, "NoMemory") == 0) { + _ecode = DBUS_GERROR_NO_MEMORY; + } else if (strcmp (_tmp21_, "ServiceUnknown") == 0) { + _ecode = DBUS_GERROR_SERVICE_UNKNOWN; + } else if (strcmp (_tmp21_, "NameHasNoOwner") == 0) { + _ecode = DBUS_GERROR_NAME_HAS_NO_OWNER; + } else if (strcmp (_tmp21_, "NoReply") == 0) { + _ecode = DBUS_GERROR_NO_REPLY; + } else if (strcmp (_tmp21_, "IOError") == 0) { + _ecode = DBUS_GERROR_IO_ERROR; + } else if (strcmp (_tmp21_, "BadAddress") == 0) { + _ecode = DBUS_GERROR_BAD_ADDRESS; + } else if (strcmp (_tmp21_, "NotSupported") == 0) { + _ecode = DBUS_GERROR_NOT_SUPPORTED; + } else if (strcmp (_tmp21_, "LimitsExceeded") == 0) { + _ecode = DBUS_GERROR_LIMITS_EXCEEDED; + } else if (strcmp (_tmp21_, "AccessDenied") == 0) { + _ecode = DBUS_GERROR_ACCESS_DENIED; + } else if (strcmp (_tmp21_, "AuthFailed") == 0) { + _ecode = DBUS_GERROR_AUTH_FAILED; + } else if (strcmp (_tmp21_, "NoServer") == 0) { + _ecode = DBUS_GERROR_NO_SERVER; + } else if (strcmp (_tmp21_, "Timeout") == 0) { + _ecode = DBUS_GERROR_TIMEOUT; + } else if (strcmp (_tmp21_, "NoNetwork") == 0) { + _ecode = DBUS_GERROR_NO_NETWORK; + } else if (strcmp (_tmp21_, "AddressInUse") == 0) { + _ecode = DBUS_GERROR_ADDRESS_IN_USE; + } else if (strcmp (_tmp21_, "Disconnected") == 0) { + _ecode = DBUS_GERROR_DISCONNECTED; + } else if (strcmp (_tmp21_, "InvalidArgs") == 0) { + _ecode = DBUS_GERROR_INVALID_ARGS; + } else if (strcmp (_tmp21_, "FileNotFound") == 0) { + _ecode = DBUS_GERROR_FILE_NOT_FOUND; + } else if (strcmp (_tmp21_, "FileExists") == 0) { + _ecode = DBUS_GERROR_FILE_EXISTS; + } else if (strcmp (_tmp21_, "UnknownMethod") == 0) { + _ecode = DBUS_GERROR_UNKNOWN_METHOD; + } else if (strcmp (_tmp21_, "TimedOut") == 0) { + _ecode = DBUS_GERROR_TIMED_OUT; + } else if (strcmp (_tmp21_, "MatchRuleNotFound") == 0) { + _ecode = DBUS_GERROR_MATCH_RULE_NOT_FOUND; + } else if (strcmp (_tmp21_, "MatchRuleInvalid") == 0) { + _ecode = DBUS_GERROR_MATCH_RULE_INVALID; + } else if (strcmp (_tmp21_, "Spawn.ExecFailed") == 0) { + _ecode = DBUS_GERROR_SPAWN_EXEC_FAILED; + } else if (strcmp (_tmp21_, "Spawn.ForkFailed") == 0) { + _ecode = DBUS_GERROR_SPAWN_FORK_FAILED; + } else if (strcmp (_tmp21_, "Spawn.ChildExited") == 0) { + _ecode = DBUS_GERROR_SPAWN_CHILD_EXITED; + } else if (strcmp (_tmp21_, "Spawn.ChildSignaled") == 0) { + _ecode = DBUS_GERROR_SPAWN_CHILD_SIGNALED; + } else if (strcmp (_tmp21_, "Spawn.Failed") == 0) { + _ecode = DBUS_GERROR_SPAWN_FAILED; + } else if (strcmp (_tmp21_, "UnixProcessIdUnknown") == 0) { + _ecode = DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN; + } else if (strcmp (_tmp21_, "InvalidSignature") == 0) { + _ecode = DBUS_GERROR_INVALID_SIGNATURE; + } else if (strcmp (_tmp21_, "InvalidFileContent") == 0) { + _ecode = DBUS_GERROR_INVALID_FILE_CONTENT; + } else if (strcmp (_tmp21_, "SELinuxSecurityContextUnknown") == 0) { + _ecode = DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN; + } else if (strcmp (_tmp21_, "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* _tmp22_; + const char* _tmp23_; + gboolean _result; + dbus_bool_t _tmp24_; + 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); + _tmp22_ = "org.mpris.MediaPlayer2"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp22_); + _tmp23_ = "HasTracklist"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp23_); + 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, &_tmp24_); + dbus_message_iter_next (&_subiter); + _result = _tmp24_; + 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* _tmp25_; + const char* _tmp26_; + dbus_bool_t _tmp27_; + 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); + _tmp25_ = "org.mpris.MediaPlayer2"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp25_); + _tmp26_ = "HasTracklist"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp26_); + dbus_message_iter_open_container (&_iter, DBUS_TYPE_VARIANT, "b", &_subiter); + _tmp27_ = value; + dbus_message_iter_append_basic (&_subiter, DBUS_TYPE_BOOLEAN, &_tmp27_); + 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* _tmp28_; + const char* _tmp29_; + gboolean _result; + dbus_bool_t _tmp30_; + 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); + _tmp28_ = "org.mpris.MediaPlayer2"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp28_); + _tmp29_ = "CanQuit"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp29_); + 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, &_tmp30_); + dbus_message_iter_next (&_subiter); + _result = _tmp30_; + 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* _tmp31_; + const char* _tmp32_; + dbus_bool_t _tmp33_; + 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); + _tmp31_ = "org.mpris.MediaPlayer2"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp31_); + _tmp32_ = "CanQuit"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp32_); + dbus_message_iter_open_container (&_iter, DBUS_TYPE_VARIANT, "b", &_subiter); + _tmp33_ = value; + dbus_message_iter_append_basic (&_subiter, DBUS_TYPE_BOOLEAN, &_tmp33_); + 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* _tmp34_; + const char* _tmp35_; + gboolean _result; + dbus_bool_t _tmp36_; + 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); + _tmp34_ = "org.mpris.MediaPlayer2"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp34_); + _tmp35_ = "CanRaise"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp35_); + 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, &_tmp36_); + dbus_message_iter_next (&_subiter); + _result = _tmp36_; + 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* _tmp37_; + const char* _tmp38_; + dbus_bool_t _tmp39_; + 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); + _tmp37_ = "org.mpris.MediaPlayer2"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp37_); + _tmp38_ = "CanRaise"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp38_); + dbus_message_iter_open_container (&_iter, DBUS_TYPE_VARIANT, "b", &_subiter); + _tmp39_ = value; + dbus_message_iter_append_basic (&_subiter, DBUS_TYPE_BOOLEAN, &_tmp39_); + 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* _tmp40_; + const char* _tmp41_; + char* _result; + const char* _tmp42_; + 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); + _tmp40_ = "org.mpris.MediaPlayer2"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp40_); + _tmp41_ = "Identity"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp41_); + 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, &_tmp42_); + dbus_message_iter_next (&_subiter); + _result = g_strdup (_tmp42_); + 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* _tmp43_; + const char* _tmp44_; + const char* _tmp45_; + 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); + _tmp43_ = "org.mpris.MediaPlayer2"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp43_); + _tmp44_ = "Identity"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp44_); + dbus_message_iter_open_container (&_iter, DBUS_TYPE_VARIANT, "s", &_subiter); + _tmp45_ = value; + dbus_message_iter_append_basic (&_subiter, DBUS_TYPE_STRING, &_tmp45_); + 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* _tmp46_; + const char* _tmp47_; + char* _result; + const char* _tmp48_; + 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); + _tmp46_ = "org.mpris.MediaPlayer2"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp46_); + _tmp47_ = "DesktopEntry"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp47_); + 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, &_tmp48_); + dbus_message_iter_next (&_subiter); + _result = g_strdup (_tmp48_); + 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* _tmp49_; + const char* _tmp50_; + const char* _tmp51_; + 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); + _tmp49_ = "org.mpris.MediaPlayer2"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp49_); + _tmp50_ = "DesktopEntry"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp50_); + dbus_message_iter_open_container (&_iter, DBUS_TYPE_VARIANT, "s", &_subiter); + _tmp51_ = value; + dbus_message_iter_append_basic (&_subiter, DBUS_TYPE_STRING, &_tmp51_); + 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; + iface->Raise = mpris_root_dbus_proxy_Raise; + 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_SetPosition (MprisPlayer* self, const char* path, gint64 pos, GError** error) { + MPRIS_PLAYER_GET_INTERFACE (self)->SetPosition (self, path, pos, error); +} + + +void mpris_player_PlayPause (MprisPlayer* self, GError** error) { + MPRIS_PLAYER_GET_INTERFACE (self)->PlayPause (self, error); +} + + +void mpris_player_Pause (MprisPlayer* self, GError** error) { + MPRIS_PLAYER_GET_INTERFACE (self)->Pause (self, error); +} + + +void mpris_player_Next (MprisPlayer* self, GError** error) { + MPRIS_PLAYER_GET_INTERFACE (self)->Next (self, error); +} + + +void mpris_player_Previous (MprisPlayer* self, GError** error) { + MPRIS_PLAYER_GET_INTERFACE (self)->Previous (self, 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 ("\n"); + g_string_append (xml_data, "\n\n \n \n \n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\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, "\n", children[i]); + } + dbus_free_string_array (children); + g_string_append (xml_data, "\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* _tmp52_; + char* property_name; + const char* _tmp53_; + 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, &_tmp52_); + dbus_message_iter_next (&iter); + interface_name = g_strdup (_tmp52_); + dbus_message_iter_get_basic (&iter, &_tmp53_); + dbus_message_iter_next (&iter); + property_name = g_strdup (_tmp53_); + if ((strcmp (interface_name, "org.mpris.MediaPlayer2.Player") == 0) && (strcmp (property_name, "Metadata") == 0)) { + GHashTable* result; + DBusMessageIter _tmp54_, _tmp55_; + GHashTableIter _tmp56_; + gpointer _tmp57_, _tmp58_; + 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}", &_tmp54_); + g_hash_table_iter_init (&_tmp56_, result); + while (g_hash_table_iter_next (&_tmp56_, &_tmp57_, &_tmp58_)) { + char* _key; + GValue* _value; + const char* _tmp59_; + DBusMessageIter _tmp60_; + dbus_message_iter_open_container (&_tmp54_, DBUS_TYPE_DICT_ENTRY, NULL, &_tmp55_); + _key = (char*) _tmp57_; + _value = (GValue*) _tmp58_; + _tmp59_ = _key; + dbus_message_iter_append_basic (&_tmp55_, DBUS_TYPE_STRING, &_tmp59_); + if (G_VALUE_TYPE (_value) == G_TYPE_UCHAR) { + guint8 _tmp61_; + dbus_message_iter_open_container (&_tmp55_, DBUS_TYPE_VARIANT, "y", &_tmp60_); + _tmp61_ = g_value_get_uchar (_value); + dbus_message_iter_append_basic (&_tmp60_, DBUS_TYPE_BYTE, &_tmp61_); + dbus_message_iter_close_container (&_tmp55_, &_tmp60_); + } else if (G_VALUE_TYPE (_value) == G_TYPE_BOOLEAN) { + dbus_bool_t _tmp62_; + dbus_message_iter_open_container (&_tmp55_, DBUS_TYPE_VARIANT, "b", &_tmp60_); + _tmp62_ = g_value_get_boolean (_value); + dbus_message_iter_append_basic (&_tmp60_, DBUS_TYPE_BOOLEAN, &_tmp62_); + dbus_message_iter_close_container (&_tmp55_, &_tmp60_); + } else if (G_VALUE_TYPE (_value) == G_TYPE_INT) { + dbus_int32_t _tmp63_; + dbus_message_iter_open_container (&_tmp55_, DBUS_TYPE_VARIANT, "i", &_tmp60_); + _tmp63_ = g_value_get_int (_value); + dbus_message_iter_append_basic (&_tmp60_, DBUS_TYPE_INT32, &_tmp63_); + dbus_message_iter_close_container (&_tmp55_, &_tmp60_); + } else if (G_VALUE_TYPE (_value) == G_TYPE_UINT) { + dbus_uint32_t _tmp64_; + dbus_message_iter_open_container (&_tmp55_, DBUS_TYPE_VARIANT, "u", &_tmp60_); + _tmp64_ = g_value_get_uint (_value); + dbus_message_iter_append_basic (&_tmp60_, DBUS_TYPE_UINT32, &_tmp64_); + dbus_message_iter_close_container (&_tmp55_, &_tmp60_); + } else if (G_VALUE_TYPE (_value) == G_TYPE_INT64) { + dbus_int64_t _tmp65_; + dbus_message_iter_open_container (&_tmp55_, DBUS_TYPE_VARIANT, "x", &_tmp60_); + _tmp65_ = g_value_get_int64 (_value); + dbus_message_iter_append_basic (&_tmp60_, DBUS_TYPE_INT64, &_tmp65_); + dbus_message_iter_close_container (&_tmp55_, &_tmp60_); + } else if (G_VALUE_TYPE (_value) == G_TYPE_UINT64) { + dbus_uint64_t _tmp66_; + dbus_message_iter_open_container (&_tmp55_, DBUS_TYPE_VARIANT, "t", &_tmp60_); + _tmp66_ = g_value_get_uint64 (_value); + dbus_message_iter_append_basic (&_tmp60_, DBUS_TYPE_UINT64, &_tmp66_); + dbus_message_iter_close_container (&_tmp55_, &_tmp60_); + } else if (G_VALUE_TYPE (_value) == G_TYPE_DOUBLE) { + double _tmp67_; + dbus_message_iter_open_container (&_tmp55_, DBUS_TYPE_VARIANT, "d", &_tmp60_); + _tmp67_ = g_value_get_double (_value); + dbus_message_iter_append_basic (&_tmp60_, DBUS_TYPE_DOUBLE, &_tmp67_); + dbus_message_iter_close_container (&_tmp55_, &_tmp60_); + } else if (G_VALUE_TYPE (_value) == G_TYPE_STRING) { + const char* _tmp68_; + dbus_message_iter_open_container (&_tmp55_, DBUS_TYPE_VARIANT, "s", &_tmp60_); + _tmp68_ = g_value_get_string (_value); + dbus_message_iter_append_basic (&_tmp60_, DBUS_TYPE_STRING, &_tmp68_); + dbus_message_iter_close_container (&_tmp55_, &_tmp60_); + } else if (G_VALUE_TYPE (_value) == G_TYPE_STRV) { + const char** _tmp69_; + DBusMessageIter _tmp70_; + int _tmp71_; + dbus_message_iter_open_container (&_tmp55_, DBUS_TYPE_VARIANT, "as", &_tmp60_); + _tmp69_ = g_value_get_boxed (_value); + dbus_message_iter_open_container (&_tmp60_, DBUS_TYPE_ARRAY, "s", &_tmp70_); + for (_tmp71_ = 0; _tmp71_ < g_strv_length (g_value_get_boxed (_value)); _tmp71_++) { + const char* _tmp72_; + _tmp72_ = *_tmp69_; + dbus_message_iter_append_basic (&_tmp70_, DBUS_TYPE_STRING, &_tmp72_); + _tmp69_++; + } + dbus_message_iter_close_container (&_tmp60_, &_tmp70_); + dbus_message_iter_close_container (&_tmp55_, &_tmp60_); + } + dbus_message_iter_close_container (&_tmp54_, &_tmp55_); + } + dbus_message_iter_close_container (&subiter, &_tmp54_); + _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 _tmp73_; + dbus_message_iter_open_container (&reply_iter, DBUS_TYPE_VARIANT, "i", &subiter); + result = mpris_player_get_Position (self); + _tmp73_ = result; + dbus_message_iter_append_basic (&subiter, DBUS_TYPE_INT32, &_tmp73_); + 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* _tmp74_; + dbus_message_iter_open_container (&reply_iter, DBUS_TYPE_VARIANT, "s", &subiter); + result = mpris_player_get_PlaybackStatus (self); + _tmp74_ = result; + dbus_message_iter_append_basic (&subiter, DBUS_TYPE_STRING, &_tmp74_); + _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* _tmp75_; + char* property_name; + const char* _tmp76_; + 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, &_tmp75_); + dbus_message_iter_next (&iter); + interface_name = g_strdup (_tmp75_); + dbus_message_iter_get_basic (&iter, &_tmp76_); + dbus_message_iter_next (&iter); + property_name = g_strdup (_tmp76_); + dbus_message_iter_recurse (&iter, &subiter); + if ((strcmp (interface_name, "org.mpris.MediaPlayer2.Player") == 0) && (strcmp (property_name, "Metadata") == 0)) { + GHashTable* value; + GHashTable* _tmp77_; + DBusMessageIter _tmp78_; + DBusMessageIter _tmp79_; + _tmp77_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); + dbus_message_iter_recurse (&subiter, &_tmp78_); + while (dbus_message_iter_get_arg_type (&_tmp78_)) { + char* _key; + GValue* _value; + const char* _tmp80_; + GValue _tmp81_ = {0}; + DBusMessageIter _tmp82_; + dbus_message_iter_recurse (&_tmp78_, &_tmp79_); + dbus_message_iter_get_basic (&_tmp79_, &_tmp80_); + dbus_message_iter_next (&_tmp79_); + _key = g_strdup (_tmp80_); + dbus_message_iter_recurse (&_tmp79_, &_tmp82_); + if (dbus_message_iter_get_arg_type (&_tmp82_) == DBUS_TYPE_BYTE) { + guint8 _tmp83_; + dbus_message_iter_get_basic (&_tmp82_, &_tmp83_); + g_value_init (&_tmp81_, G_TYPE_UCHAR); + g_value_set_uchar (&_tmp81_, _tmp83_); + } else if (dbus_message_iter_get_arg_type (&_tmp82_) == DBUS_TYPE_BOOLEAN) { + dbus_bool_t _tmp84_; + dbus_message_iter_get_basic (&_tmp82_, &_tmp84_); + g_value_init (&_tmp81_, G_TYPE_BOOLEAN); + g_value_set_boolean (&_tmp81_, _tmp84_); + } else if (dbus_message_iter_get_arg_type (&_tmp82_) == DBUS_TYPE_INT16) { + dbus_int16_t _tmp85_; + dbus_message_iter_get_basic (&_tmp82_, &_tmp85_); + g_value_init (&_tmp81_, G_TYPE_INT); + g_value_set_int (&_tmp81_, _tmp85_); + } else if (dbus_message_iter_get_arg_type (&_tmp82_) == DBUS_TYPE_UINT16) { + dbus_uint16_t _tmp86_; + dbus_message_iter_get_basic (&_tmp82_, &_tmp86_); + g_value_init (&_tmp81_, G_TYPE_UINT); + g_value_set_uint (&_tmp81_, _tmp86_); + } else if (dbus_message_iter_get_arg_type (&_tmp82_) == DBUS_TYPE_INT32) { + dbus_int32_t _tmp87_; + dbus_message_iter_get_basic (&_tmp82_, &_tmp87_); + g_value_init (&_tmp81_, G_TYPE_INT); + g_value_set_int (&_tmp81_, _tmp87_); + } else if (dbus_message_iter_get_arg_type (&_tmp82_) == DBUS_TYPE_UINT32) { + dbus_uint32_t _tmp88_; + dbus_message_iter_get_basic (&_tmp82_, &_tmp88_); + g_value_init (&_tmp81_, G_TYPE_UINT); + g_value_set_uint (&_tmp81_, _tmp88_); + } else if (dbus_message_iter_get_arg_type (&_tmp82_) == DBUS_TYPE_INT64) { + dbus_int64_t _tmp89_; + dbus_message_iter_get_basic (&_tmp82_, &_tmp89_); + g_value_init (&_tmp81_, G_TYPE_INT64); + g_value_set_int64 (&_tmp81_, _tmp89_); + } else if (dbus_message_iter_get_arg_type (&_tmp82_) == DBUS_TYPE_UINT64) { + dbus_uint64_t _tmp90_; + dbus_message_iter_get_basic (&_tmp82_, &_tmp90_); + g_value_init (&_tmp81_, G_TYPE_UINT64); + g_value_set_uint64 (&_tmp81_, _tmp90_); + } else if (dbus_message_iter_get_arg_type (&_tmp82_) == DBUS_TYPE_DOUBLE) { + double _tmp91_; + dbus_message_iter_get_basic (&_tmp82_, &_tmp91_); + g_value_init (&_tmp81_, G_TYPE_DOUBLE); + g_value_set_double (&_tmp81_, _tmp91_); + } else if (dbus_message_iter_get_arg_type (&_tmp82_) == DBUS_TYPE_STRING) { + const char* _tmp92_; + dbus_message_iter_get_basic (&_tmp82_, &_tmp92_); + g_value_init (&_tmp81_, G_TYPE_STRING); + g_value_take_string (&_tmp81_, g_strdup (_tmp92_)); + } else if (dbus_message_iter_get_arg_type (&_tmp82_) == DBUS_TYPE_OBJECT_PATH) { + const char* _tmp93_; + dbus_message_iter_get_basic (&_tmp82_, &_tmp93_); + g_value_init (&_tmp81_, G_TYPE_STRING); + g_value_take_string (&_tmp81_, g_strdup (_tmp93_)); + } else if (dbus_message_iter_get_arg_type (&_tmp82_) == DBUS_TYPE_SIGNATURE) { + const char* _tmp94_; + dbus_message_iter_get_basic (&_tmp82_, &_tmp94_); + g_value_init (&_tmp81_, G_TYPE_STRING); + g_value_take_string (&_tmp81_, g_strdup (_tmp94_)); + } else if ((dbus_message_iter_get_arg_type (&_tmp82_) == DBUS_TYPE_ARRAY) && (dbus_message_iter_get_element_type (&_tmp82_) == DBUS_TYPE_STRING)) { + const char** _tmp95_; + int _tmp95__length; + int _tmp95__size; + int _tmp95__length1; + DBusMessageIter _tmp96_; + _tmp95_ = g_new (const char*, 5); + _tmp95__length = 0; + _tmp95__size = 4; + _tmp95__length1 = 0; + dbus_message_iter_recurse (&_tmp82_, &_tmp96_); + for (; dbus_message_iter_get_arg_type (&_tmp96_); _tmp95__length1++) { + const char* _tmp97_; + if (_tmp95__size == _tmp95__length) { + _tmp95__size = 2 * _tmp95__size; + _tmp95_ = g_renew (const char*, _tmp95_, _tmp95__size + 1); + } + dbus_message_iter_get_basic (&_tmp96_, &_tmp97_); + dbus_message_iter_next (&_tmp96_); + _tmp95_[_tmp95__length++] = g_strdup (_tmp97_); + } + _tmp95_[_tmp95__length] = NULL; + g_value_init (&_tmp81_, G_TYPE_STRV); + g_value_take_boxed (&_tmp81_, _tmp95_); + } + dbus_message_iter_next (&_tmp79_); + _value = g_memdup (&_tmp81_, sizeof (GValue)); + g_hash_table_insert (_tmp77_, _key, _value); + dbus_message_iter_next (&_tmp78_); + } + dbus_message_iter_next (&subiter); + value = _tmp77_; + 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 _tmp98_; + dbus_message_iter_get_basic (&subiter, &_tmp98_); + dbus_message_iter_next (&subiter); + value = _tmp98_; + 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* _tmp99_; + dbus_message_iter_get_basic (&subiter, &_tmp99_); + dbus_message_iter_next (&subiter); + value = g_strdup (_tmp99_); + 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* _tmp100_; + 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, &_tmp100_); + dbus_message_iter_next (&iter); + interface_name = g_strdup (_tmp100_); + if (strcmp (interface_name, "org.mpris.MediaPlayer2.Player") == 0) { + dbus_message_iter_open_container (&reply_iter, DBUS_TYPE_ARRAY, "{sv}", &subiter); + { + GHashTable* result; + DBusMessageIter _tmp101_, _tmp102_; + GHashTableIter _tmp103_; + gpointer _tmp104_, _tmp105_; + 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}", &_tmp101_); + g_hash_table_iter_init (&_tmp103_, result); + while (g_hash_table_iter_next (&_tmp103_, &_tmp104_, &_tmp105_)) { + char* _key; + GValue* _value; + const char* _tmp106_; + DBusMessageIter _tmp107_; + dbus_message_iter_open_container (&_tmp101_, DBUS_TYPE_DICT_ENTRY, NULL, &_tmp102_); + _key = (char*) _tmp104_; + _value = (GValue*) _tmp105_; + _tmp106_ = _key; + dbus_message_iter_append_basic (&_tmp102_, DBUS_TYPE_STRING, &_tmp106_); + if (G_VALUE_TYPE (_value) == G_TYPE_UCHAR) { + guint8 _tmp108_; + dbus_message_iter_open_container (&_tmp102_, DBUS_TYPE_VARIANT, "y", &_tmp107_); + _tmp108_ = g_value_get_uchar (_value); + dbus_message_iter_append_basic (&_tmp107_, DBUS_TYPE_BYTE, &_tmp108_); + dbus_message_iter_close_container (&_tmp102_, &_tmp107_); + } else if (G_VALUE_TYPE (_value) == G_TYPE_BOOLEAN) { + dbus_bool_t _tmp109_; + dbus_message_iter_open_container (&_tmp102_, DBUS_TYPE_VARIANT, "b", &_tmp107_); + _tmp109_ = g_value_get_boolean (_value); + dbus_message_iter_append_basic (&_tmp107_, DBUS_TYPE_BOOLEAN, &_tmp109_); + dbus_message_iter_close_container (&_tmp102_, &_tmp107_); + } else if (G_VALUE_TYPE (_value) == G_TYPE_INT) { + dbus_int32_t _tmp110_; + dbus_message_iter_open_container (&_tmp102_, DBUS_TYPE_VARIANT, "i", &_tmp107_); + _tmp110_ = g_value_get_int (_value); + dbus_message_iter_append_basic (&_tmp107_, DBUS_TYPE_INT32, &_tmp110_); + dbus_message_iter_close_container (&_tmp102_, &_tmp107_); + } else if (G_VALUE_TYPE (_value) == G_TYPE_UINT) { + dbus_uint32_t _tmp111_; + dbus_message_iter_open_container (&_tmp102_, DBUS_TYPE_VARIANT, "u", &_tmp107_); + _tmp111_ = g_value_get_uint (_value); + dbus_message_iter_append_basic (&_tmp107_, DBUS_TYPE_UINT32, &_tmp111_); + dbus_message_iter_close_container (&_tmp102_, &_tmp107_); + } else if (G_VALUE_TYPE (_value) == G_TYPE_INT64) { + dbus_int64_t _tmp112_; + dbus_message_iter_open_container (&_tmp102_, DBUS_TYPE_VARIANT, "x", &_tmp107_); + _tmp112_ = g_value_get_int64 (_value); + dbus_message_iter_append_basic (&_tmp107_, DBUS_TYPE_INT64, &_tmp112_); + dbus_message_iter_close_container (&_tmp102_, &_tmp107_); + } else if (G_VALUE_TYPE (_value) == G_TYPE_UINT64) { + dbus_uint64_t _tmp113_; + dbus_message_iter_open_container (&_tmp102_, DBUS_TYPE_VARIANT, "t", &_tmp107_); + _tmp113_ = g_value_get_uint64 (_value); + dbus_message_iter_append_basic (&_tmp107_, DBUS_TYPE_UINT64, &_tmp113_); + dbus_message_iter_close_container (&_tmp102_, &_tmp107_); + } else if (G_VALUE_TYPE (_value) == G_TYPE_DOUBLE) { + double _tmp114_; + dbus_message_iter_open_container (&_tmp102_, DBUS_TYPE_VARIANT, "d", &_tmp107_); + _tmp114_ = g_value_get_double (_value); + dbus_message_iter_append_basic (&_tmp107_, DBUS_TYPE_DOUBLE, &_tmp114_); + dbus_message_iter_close_container (&_tmp102_, &_tmp107_); + } else if (G_VALUE_TYPE (_value) == G_TYPE_STRING) { + const char* _tmp115_; + dbus_message_iter_open_container (&_tmp102_, DBUS_TYPE_VARIANT, "s", &_tmp107_); + _tmp115_ = g_value_get_string (_value); + dbus_message_iter_append_basic (&_tmp107_, DBUS_TYPE_STRING, &_tmp115_); + dbus_message_iter_close_container (&_tmp102_, &_tmp107_); + } else if (G_VALUE_TYPE (_value) == G_TYPE_STRV) { + const char** _tmp116_; + DBusMessageIter _tmp117_; + int _tmp118_; + dbus_message_iter_open_container (&_tmp102_, DBUS_TYPE_VARIANT, "as", &_tmp107_); + _tmp116_ = g_value_get_boxed (_value); + dbus_message_iter_open_container (&_tmp107_, DBUS_TYPE_ARRAY, "s", &_tmp117_); + for (_tmp118_ = 0; _tmp118_ < g_strv_length (g_value_get_boxed (_value)); _tmp118_++) { + const char* _tmp119_; + _tmp119_ = *_tmp116_; + dbus_message_iter_append_basic (&_tmp117_, DBUS_TYPE_STRING, &_tmp119_); + _tmp116_++; + } + dbus_message_iter_close_container (&_tmp107_, &_tmp117_); + dbus_message_iter_close_container (&_tmp102_, &_tmp107_); + } + dbus_message_iter_close_container (&_tmp101_, &_tmp102_); + } + dbus_message_iter_close_container (&value_iter, &_tmp101_); + _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 _tmp120_; + 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); + _tmp120_ = result; + dbus_message_iter_append_basic (&value_iter, DBUS_TYPE_INT32, &_tmp120_); + dbus_message_iter_close_container (&entry_iter, &value_iter); + dbus_message_iter_close_container (&subiter, &entry_iter); + } + { + char* result; + const char* _tmp121_; + 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); + _tmp121_ = result; + dbus_message_iter_append_basic (&value_iter, DBUS_TYPE_STRING, &_tmp121_); + _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_SetPosition (MprisPlayer* self, DBusConnection* connection, DBusMessage* message) { + DBusMessageIter iter; + GError* error; + char* path = NULL; + const char* _tmp122_; + gint64 pos = 0LL; + dbus_int64_t _tmp123_; + DBusMessage* reply; + error = NULL; + if (strcmp (dbus_message_get_signature (message), "ox")) { + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + } + dbus_message_iter_init (message, &iter); + dbus_message_iter_get_basic (&iter, &_tmp122_); + dbus_message_iter_next (&iter); + path = g_strdup (_tmp122_); + dbus_message_iter_get_basic (&iter, &_tmp123_); + dbus_message_iter_next (&iter); + pos = _tmp123_; + mpris_player_SetPosition (self, path, pos, &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 DBUS_HANDLER_RESULT_HANDLED; + } + reply = dbus_message_new_method_return (message); + dbus_message_iter_init_append (reply, &iter); + _g_free0 (path); + 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; + GError* error; + DBusMessage* reply; + error = NULL; + if (strcmp (dbus_message_get_signature (message), "")) { + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + } + dbus_message_iter_init (message, &iter); + mpris_player_PlayPause (self, &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 DBUS_HANDLER_RESULT_HANDLED; + } + reply = dbus_message_new_method_return (message); + dbus_message_iter_init_append (reply, &iter); + 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_Pause (MprisPlayer* self, DBusConnection* connection, DBusMessage* message) { + DBusMessageIter iter; + GError* error; + DBusMessage* reply; + error = NULL; + if (strcmp (dbus_message_get_signature (message), "")) { + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + } + dbus_message_iter_init (message, &iter); + mpris_player_Pause (self, &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 DBUS_HANDLER_RESULT_HANDLED; + } + reply = dbus_message_new_method_return (message); + dbus_message_iter_init_append (reply, &iter); + 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_Next (MprisPlayer* self, DBusConnection* connection, DBusMessage* message) { + DBusMessageIter iter; + GError* error; + DBusMessage* reply; + error = NULL; + if (strcmp (dbus_message_get_signature (message), "")) { + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + } + dbus_message_iter_init (message, &iter); + mpris_player_Next (self, &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 DBUS_HANDLER_RESULT_HANDLED; + } + reply = dbus_message_new_method_return (message); + dbus_message_iter_init_append (reply, &iter); + 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_Previous (MprisPlayer* self, DBusConnection* connection, DBusMessage* message) { + DBusMessageIter iter; + GError* error; + DBusMessage* reply; + error = NULL; + if (strcmp (dbus_message_get_signature (message), "")) { + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + } + dbus_message_iter_init (message, &iter); + mpris_player_Previous (self, &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 DBUS_HANDLER_RESULT_HANDLED; + } + reply = dbus_message_new_method_return (message); + dbus_message_iter_init_append (reply, &iter); + 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 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", "SetPosition")) { + result = _dbus_mpris_player_SetPosition (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", "Pause")) { + result = _dbus_mpris_player_Pause (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 _tmp124_; + _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); + _tmp124_ = new_position; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_INT64, &_tmp124_); + 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 _tmp125_; + DBusMessage* reply; + if (strcmp (dbus_message_get_signature (message), "x")) { + return; + } + dbus_message_iter_init (message, &iter); + dbus_message_iter_get_basic (&iter, &_tmp125_); + dbus_message_iter_next (&iter); + new_position = _tmp125_; + 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_SetPosition (MprisPlayer* self, const char* path, gint64 pos, GError** error) { + DBusError _dbus_error; + DBusGConnection *_connection; + DBusMessage *_message, *_reply; + DBusMessageIter _iter; + const char* _tmp126_; + dbus_int64_t _tmp127_; + if (((MprisPlayerDBusProxy*) self)->disposed) { + g_set_error (error, DBUS_GERROR, DBUS_GERROR_DISCONNECTED, "%s", "Connection is closed"); + return; + } + _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", "SetPosition"); + dbus_message_iter_init_append (_message, &_iter); + _tmp126_ = path; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_OBJECT_PATH, &_tmp126_); + _tmp127_ = pos; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_INT64, &_tmp127_); + 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)) { + GQuark _edomain; + gint _ecode; + if (strstr (_dbus_error.name, "org.freedesktop.DBus.Error") == _dbus_error.name) { + const char* _tmp128_; + _edomain = DBUS_GERROR; + _tmp128_ = _dbus_error.name + 27; + if (strcmp (_tmp128_, "Failed") == 0) { + _ecode = DBUS_GERROR_FAILED; + } else if (strcmp (_tmp128_, "NoMemory") == 0) { + _ecode = DBUS_GERROR_NO_MEMORY; + } else if (strcmp (_tmp128_, "ServiceUnknown") == 0) { + _ecode = DBUS_GERROR_SERVICE_UNKNOWN; + } else if (strcmp (_tmp128_, "NameHasNoOwner") == 0) { + _ecode = DBUS_GERROR_NAME_HAS_NO_OWNER; + } else if (strcmp (_tmp128_, "NoReply") == 0) { + _ecode = DBUS_GERROR_NO_REPLY; + } else if (strcmp (_tmp128_, "IOError") == 0) { + _ecode = DBUS_GERROR_IO_ERROR; + } else if (strcmp (_tmp128_, "BadAddress") == 0) { + _ecode = DBUS_GERROR_BAD_ADDRESS; + } else if (strcmp (_tmp128_, "NotSupported") == 0) { + _ecode = DBUS_GERROR_NOT_SUPPORTED; + } else if (strcmp (_tmp128_, "LimitsExceeded") == 0) { + _ecode = DBUS_GERROR_LIMITS_EXCEEDED; + } else if (strcmp (_tmp128_, "AccessDenied") == 0) { + _ecode = DBUS_GERROR_ACCESS_DENIED; + } else if (strcmp (_tmp128_, "AuthFailed") == 0) { + _ecode = DBUS_GERROR_AUTH_FAILED; + } else if (strcmp (_tmp128_, "NoServer") == 0) { + _ecode = DBUS_GERROR_NO_SERVER; + } else if (strcmp (_tmp128_, "Timeout") == 0) { + _ecode = DBUS_GERROR_TIMEOUT; + } else if (strcmp (_tmp128_, "NoNetwork") == 0) { + _ecode = DBUS_GERROR_NO_NETWORK; + } else if (strcmp (_tmp128_, "AddressInUse") == 0) { + _ecode = DBUS_GERROR_ADDRESS_IN_USE; + } else if (strcmp (_tmp128_, "Disconnected") == 0) { + _ecode = DBUS_GERROR_DISCONNECTED; + } else if (strcmp (_tmp128_, "InvalidArgs") == 0) { + _ecode = DBUS_GERROR_INVALID_ARGS; + } else if (strcmp (_tmp128_, "FileNotFound") == 0) { + _ecode = DBUS_GERROR_FILE_NOT_FOUND; + } else if (strcmp (_tmp128_, "FileExists") == 0) { + _ecode = DBUS_GERROR_FILE_EXISTS; + } else if (strcmp (_tmp128_, "UnknownMethod") == 0) { + _ecode = DBUS_GERROR_UNKNOWN_METHOD; + } else if (strcmp (_tmp128_, "TimedOut") == 0) { + _ecode = DBUS_GERROR_TIMED_OUT; + } else if (strcmp (_tmp128_, "MatchRuleNotFound") == 0) { + _ecode = DBUS_GERROR_MATCH_RULE_NOT_FOUND; + } else if (strcmp (_tmp128_, "MatchRuleInvalid") == 0) { + _ecode = DBUS_GERROR_MATCH_RULE_INVALID; + } else if (strcmp (_tmp128_, "Spawn.ExecFailed") == 0) { + _ecode = DBUS_GERROR_SPAWN_EXEC_FAILED; + } else if (strcmp (_tmp128_, "Spawn.ForkFailed") == 0) { + _ecode = DBUS_GERROR_SPAWN_FORK_FAILED; + } else if (strcmp (_tmp128_, "Spawn.ChildExited") == 0) { + _ecode = DBUS_GERROR_SPAWN_CHILD_EXITED; + } else if (strcmp (_tmp128_, "Spawn.ChildSignaled") == 0) { + _ecode = DBUS_GERROR_SPAWN_CHILD_SIGNALED; + } else if (strcmp (_tmp128_, "Spawn.Failed") == 0) { + _ecode = DBUS_GERROR_SPAWN_FAILED; + } else if (strcmp (_tmp128_, "UnixProcessIdUnknown") == 0) { + _ecode = DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN; + } else if (strcmp (_tmp128_, "InvalidSignature") == 0) { + _ecode = DBUS_GERROR_INVALID_SIGNATURE; + } else if (strcmp (_tmp128_, "InvalidFileContent") == 0) { + _ecode = DBUS_GERROR_INVALID_FILE_CONTENT; + } else if (strcmp (_tmp128_, "SELinuxSecurityContextUnknown") == 0) { + _ecode = DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN; + } else if (strcmp (_tmp128_, "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_PlayPause (MprisPlayer* self, GError** error) { + DBusError _dbus_error; + DBusGConnection *_connection; + DBusMessage *_message, *_reply; + DBusMessageIter _iter; + if (((MprisPlayerDBusProxy*) self)->disposed) { + g_set_error (error, DBUS_GERROR, DBUS_GERROR_DISCONNECTED, "%s", "Connection is closed"); + return; + } + _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_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)) { + GQuark _edomain; + gint _ecode; + if (strstr (_dbus_error.name, "org.freedesktop.DBus.Error") == _dbus_error.name) { + const char* _tmp129_; + _edomain = DBUS_GERROR; + _tmp129_ = _dbus_error.name + 27; + if (strcmp (_tmp129_, "Failed") == 0) { + _ecode = DBUS_GERROR_FAILED; + } else if (strcmp (_tmp129_, "NoMemory") == 0) { + _ecode = DBUS_GERROR_NO_MEMORY; + } else if (strcmp (_tmp129_, "ServiceUnknown") == 0) { + _ecode = DBUS_GERROR_SERVICE_UNKNOWN; + } else if (strcmp (_tmp129_, "NameHasNoOwner") == 0) { + _ecode = DBUS_GERROR_NAME_HAS_NO_OWNER; + } else if (strcmp (_tmp129_, "NoReply") == 0) { + _ecode = DBUS_GERROR_NO_REPLY; + } else if (strcmp (_tmp129_, "IOError") == 0) { + _ecode = DBUS_GERROR_IO_ERROR; + } else if (strcmp (_tmp129_, "BadAddress") == 0) { + _ecode = DBUS_GERROR_BAD_ADDRESS; + } else if (strcmp (_tmp129_, "NotSupported") == 0) { + _ecode = DBUS_GERROR_NOT_SUPPORTED; + } else if (strcmp (_tmp129_, "LimitsExceeded") == 0) { + _ecode = DBUS_GERROR_LIMITS_EXCEEDED; + } else if (strcmp (_tmp129_, "AccessDenied") == 0) { + _ecode = DBUS_GERROR_ACCESS_DENIED; + } else if (strcmp (_tmp129_, "AuthFailed") == 0) { + _ecode = DBUS_GERROR_AUTH_FAILED; + } else if (strcmp (_tmp129_, "NoServer") == 0) { + _ecode = DBUS_GERROR_NO_SERVER; + } else if (strcmp (_tmp129_, "Timeout") == 0) { + _ecode = DBUS_GERROR_TIMEOUT; + } else if (strcmp (_tmp129_, "NoNetwork") == 0) { + _ecode = DBUS_GERROR_NO_NETWORK; + } else if (strcmp (_tmp129_, "AddressInUse") == 0) { + _ecode = DBUS_GERROR_ADDRESS_IN_USE; + } else if (strcmp (_tmp129_, "Disconnected") == 0) { + _ecode = DBUS_GERROR_DISCONNECTED; + } else if (strcmp (_tmp129_, "InvalidArgs") == 0) { + _ecode = DBUS_GERROR_INVALID_ARGS; + } else if (strcmp (_tmp129_, "FileNotFound") == 0) { + _ecode = DBUS_GERROR_FILE_NOT_FOUND; + } else if (strcmp (_tmp129_, "FileExists") == 0) { + _ecode = DBUS_GERROR_FILE_EXISTS; + } else if (strcmp (_tmp129_, "UnknownMethod") == 0) { + _ecode = DBUS_GERROR_UNKNOWN_METHOD; + } else if (strcmp (_tmp129_, "TimedOut") == 0) { + _ecode = DBUS_GERROR_TIMED_OUT; + } else if (strcmp (_tmp129_, "MatchRuleNotFound") == 0) { + _ecode = DBUS_GERROR_MATCH_RULE_NOT_FOUND; + } else if (strcmp (_tmp129_, "MatchRuleInvalid") == 0) { + _ecode = DBUS_GERROR_MATCH_RULE_INVALID; + } else if (strcmp (_tmp129_, "Spawn.ExecFailed") == 0) { + _ecode = DBUS_GERROR_SPAWN_EXEC_FAILED; + } else if (strcmp (_tmp129_, "Spawn.ForkFailed") == 0) { + _ecode = DBUS_GERROR_SPAWN_FORK_FAILED; + } else if (strcmp (_tmp129_, "Spawn.ChildExited") == 0) { + _ecode = DBUS_GERROR_SPAWN_CHILD_EXITED; + } else if (strcmp (_tmp129_, "Spawn.ChildSignaled") == 0) { + _ecode = DBUS_GERROR_SPAWN_CHILD_SIGNALED; + } else if (strcmp (_tmp129_, "Spawn.Failed") == 0) { + _ecode = DBUS_GERROR_SPAWN_FAILED; + } else if (strcmp (_tmp129_, "UnixProcessIdUnknown") == 0) { + _ecode = DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN; + } else if (strcmp (_tmp129_, "InvalidSignature") == 0) { + _ecode = DBUS_GERROR_INVALID_SIGNATURE; + } else if (strcmp (_tmp129_, "InvalidFileContent") == 0) { + _ecode = DBUS_GERROR_INVALID_FILE_CONTENT; + } else if (strcmp (_tmp129_, "SELinuxSecurityContextUnknown") == 0) { + _ecode = DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN; + } else if (strcmp (_tmp129_, "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_Pause (MprisPlayer* self, GError** error) { + DBusError _dbus_error; + DBusGConnection *_connection; + DBusMessage *_message, *_reply; + DBusMessageIter _iter; + if (((MprisPlayerDBusProxy*) self)->disposed) { + g_set_error (error, DBUS_GERROR, DBUS_GERROR_DISCONNECTED, "%s", "Connection is closed"); + return; + } + _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", "Pause"); + dbus_message_iter_init_append (_message, &_iter); + 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)) { + GQuark _edomain; + gint _ecode; + if (strstr (_dbus_error.name, "org.freedesktop.DBus.Error") == _dbus_error.name) { + const char* _tmp130_; + _edomain = DBUS_GERROR; + _tmp130_ = _dbus_error.name + 27; + if (strcmp (_tmp130_, "Failed") == 0) { + _ecode = DBUS_GERROR_FAILED; + } else if (strcmp (_tmp130_, "NoMemory") == 0) { + _ecode = DBUS_GERROR_NO_MEMORY; + } else if (strcmp (_tmp130_, "ServiceUnknown") == 0) { + _ecode = DBUS_GERROR_SERVICE_UNKNOWN; + } else if (strcmp (_tmp130_, "NameHasNoOwner") == 0) { + _ecode = DBUS_GERROR_NAME_HAS_NO_OWNER; + } else if (strcmp (_tmp130_, "NoReply") == 0) { + _ecode = DBUS_GERROR_NO_REPLY; + } else if (strcmp (_tmp130_, "IOError") == 0) { + _ecode = DBUS_GERROR_IO_ERROR; + } else if (strcmp (_tmp130_, "BadAddress") == 0) { + _ecode = DBUS_GERROR_BAD_ADDRESS; + } else if (strcmp (_tmp130_, "NotSupported") == 0) { + _ecode = DBUS_GERROR_NOT_SUPPORTED; + } else if (strcmp (_tmp130_, "LimitsExceeded") == 0) { + _ecode = DBUS_GERROR_LIMITS_EXCEEDED; + } else if (strcmp (_tmp130_, "AccessDenied") == 0) { + _ecode = DBUS_GERROR_ACCESS_DENIED; + } else if (strcmp (_tmp130_, "AuthFailed") == 0) { + _ecode = DBUS_GERROR_AUTH_FAILED; + } else if (strcmp (_tmp130_, "NoServer") == 0) { + _ecode = DBUS_GERROR_NO_SERVER; + } else if (strcmp (_tmp130_, "Timeout") == 0) { + _ecode = DBUS_GERROR_TIMEOUT; + } else if (strcmp (_tmp130_, "NoNetwork") == 0) { + _ecode = DBUS_GERROR_NO_NETWORK; + } else if (strcmp (_tmp130_, "AddressInUse") == 0) { + _ecode = DBUS_GERROR_ADDRESS_IN_USE; + } else if (strcmp (_tmp130_, "Disconnected") == 0) { + _ecode = DBUS_GERROR_DISCONNECTED; + } else if (strcmp (_tmp130_, "InvalidArgs") == 0) { + _ecode = DBUS_GERROR_INVALID_ARGS; + } else if (strcmp (_tmp130_, "FileNotFound") == 0) { + _ecode = DBUS_GERROR_FILE_NOT_FOUND; + } else if (strcmp (_tmp130_, "FileExists") == 0) { + _ecode = DBUS_GERROR_FILE_EXISTS; + } else if (strcmp (_tmp130_, "UnknownMethod") == 0) { + _ecode = DBUS_GERROR_UNKNOWN_METHOD; + } else if (strcmp (_tmp130_, "TimedOut") == 0) { + _ecode = DBUS_GERROR_TIMED_OUT; + } else if (strcmp (_tmp130_, "MatchRuleNotFound") == 0) { + _ecode = DBUS_GERROR_MATCH_RULE_NOT_FOUND; + } else if (strcmp (_tmp130_, "MatchRuleInvalid") == 0) { + _ecode = DBUS_GERROR_MATCH_RULE_INVALID; + } else if (strcmp (_tmp130_, "Spawn.ExecFailed") == 0) { + _ecode = DBUS_GERROR_SPAWN_EXEC_FAILED; + } else if (strcmp (_tmp130_, "Spawn.ForkFailed") == 0) { + _ecode = DBUS_GERROR_SPAWN_FORK_FAILED; + } else if (strcmp (_tmp130_, "Spawn.ChildExited") == 0) { + _ecode = DBUS_GERROR_SPAWN_CHILD_EXITED; + } else if (strcmp (_tmp130_, "Spawn.ChildSignaled") == 0) { + _ecode = DBUS_GERROR_SPAWN_CHILD_SIGNALED; + } else if (strcmp (_tmp130_, "Spawn.Failed") == 0) { + _ecode = DBUS_GERROR_SPAWN_FAILED; + } else if (strcmp (_tmp130_, "UnixProcessIdUnknown") == 0) { + _ecode = DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN; + } else if (strcmp (_tmp130_, "InvalidSignature") == 0) { + _ecode = DBUS_GERROR_INVALID_SIGNATURE; + } else if (strcmp (_tmp130_, "InvalidFileContent") == 0) { + _ecode = DBUS_GERROR_INVALID_FILE_CONTENT; + } else if (strcmp (_tmp130_, "SELinuxSecurityContextUnknown") == 0) { + _ecode = DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN; + } else if (strcmp (_tmp130_, "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 (MprisPlayer* self, GError** error) { + DBusError _dbus_error; + DBusGConnection *_connection; + DBusMessage *_message, *_reply; + DBusMessageIter _iter; + if (((MprisPlayerDBusProxy*) self)->disposed) { + g_set_error (error, DBUS_GERROR, DBUS_GERROR_DISCONNECTED, "%s", "Connection is closed"); + return; + } + _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_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)) { + GQuark _edomain; + gint _ecode; + if (strstr (_dbus_error.name, "org.freedesktop.DBus.Error") == _dbus_error.name) { + const char* _tmp131_; + _edomain = DBUS_GERROR; + _tmp131_ = _dbus_error.name + 27; + if (strcmp (_tmp131_, "Failed") == 0) { + _ecode = DBUS_GERROR_FAILED; + } else if (strcmp (_tmp131_, "NoMemory") == 0) { + _ecode = DBUS_GERROR_NO_MEMORY; + } else if (strcmp (_tmp131_, "ServiceUnknown") == 0) { + _ecode = DBUS_GERROR_SERVICE_UNKNOWN; + } else if (strcmp (_tmp131_, "NameHasNoOwner") == 0) { + _ecode = DBUS_GERROR_NAME_HAS_NO_OWNER; + } else if (strcmp (_tmp131_, "NoReply") == 0) { + _ecode = DBUS_GERROR_NO_REPLY; + } else if (strcmp (_tmp131_, "IOError") == 0) { + _ecode = DBUS_GERROR_IO_ERROR; + } else if (strcmp (_tmp131_, "BadAddress") == 0) { + _ecode = DBUS_GERROR_BAD_ADDRESS; + } else if (strcmp (_tmp131_, "NotSupported") == 0) { + _ecode = DBUS_GERROR_NOT_SUPPORTED; + } else if (strcmp (_tmp131_, "LimitsExceeded") == 0) { + _ecode = DBUS_GERROR_LIMITS_EXCEEDED; + } else if (strcmp (_tmp131_, "AccessDenied") == 0) { + _ecode = DBUS_GERROR_ACCESS_DENIED; + } else if (strcmp (_tmp131_, "AuthFailed") == 0) { + _ecode = DBUS_GERROR_AUTH_FAILED; + } else if (strcmp (_tmp131_, "NoServer") == 0) { + _ecode = DBUS_GERROR_NO_SERVER; + } else if (strcmp (_tmp131_, "Timeout") == 0) { + _ecode = DBUS_GERROR_TIMEOUT; + } else if (strcmp (_tmp131_, "NoNetwork") == 0) { + _ecode = DBUS_GERROR_NO_NETWORK; + } else if (strcmp (_tmp131_, "AddressInUse") == 0) { + _ecode = DBUS_GERROR_ADDRESS_IN_USE; + } else if (strcmp (_tmp131_, "Disconnected") == 0) { + _ecode = DBUS_GERROR_DISCONNECTED; + } else if (strcmp (_tmp131_, "InvalidArgs") == 0) { + _ecode = DBUS_GERROR_INVALID_ARGS; + } else if (strcmp (_tmp131_, "FileNotFound") == 0) { + _ecode = DBUS_GERROR_FILE_NOT_FOUND; + } else if (strcmp (_tmp131_, "FileExists") == 0) { + _ecode = DBUS_GERROR_FILE_EXISTS; + } else if (strcmp (_tmp131_, "UnknownMethod") == 0) { + _ecode = DBUS_GERROR_UNKNOWN_METHOD; + } else if (strcmp (_tmp131_, "TimedOut") == 0) { + _ecode = DBUS_GERROR_TIMED_OUT; + } else if (strcmp (_tmp131_, "MatchRuleNotFound") == 0) { + _ecode = DBUS_GERROR_MATCH_RULE_NOT_FOUND; + } else if (strcmp (_tmp131_, "MatchRuleInvalid") == 0) { + _ecode = DBUS_GERROR_MATCH_RULE_INVALID; + } else if (strcmp (_tmp131_, "Spawn.ExecFailed") == 0) { + _ecode = DBUS_GERROR_SPAWN_EXEC_FAILED; + } else if (strcmp (_tmp131_, "Spawn.ForkFailed") == 0) { + _ecode = DBUS_GERROR_SPAWN_FORK_FAILED; + } else if (strcmp (_tmp131_, "Spawn.ChildExited") == 0) { + _ecode = DBUS_GERROR_SPAWN_CHILD_EXITED; + } else if (strcmp (_tmp131_, "Spawn.ChildSignaled") == 0) { + _ecode = DBUS_GERROR_SPAWN_CHILD_SIGNALED; + } else if (strcmp (_tmp131_, "Spawn.Failed") == 0) { + _ecode = DBUS_GERROR_SPAWN_FAILED; + } else if (strcmp (_tmp131_, "UnixProcessIdUnknown") == 0) { + _ecode = DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN; + } else if (strcmp (_tmp131_, "InvalidSignature") == 0) { + _ecode = DBUS_GERROR_INVALID_SIGNATURE; + } else if (strcmp (_tmp131_, "InvalidFileContent") == 0) { + _ecode = DBUS_GERROR_INVALID_FILE_CONTENT; + } else if (strcmp (_tmp131_, "SELinuxSecurityContextUnknown") == 0) { + _ecode = DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN; + } else if (strcmp (_tmp131_, "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 (MprisPlayer* self, GError** error) { + DBusError _dbus_error; + DBusGConnection *_connection; + DBusMessage *_message, *_reply; + DBusMessageIter _iter; + if (((MprisPlayerDBusProxy*) self)->disposed) { + g_set_error (error, DBUS_GERROR, DBUS_GERROR_DISCONNECTED, "%s", "Connection is closed"); + return; + } + _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_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)) { + GQuark _edomain; + gint _ecode; + if (strstr (_dbus_error.name, "org.freedesktop.DBus.Error") == _dbus_error.name) { + const char* _tmp132_; + _edomain = DBUS_GERROR; + _tmp132_ = _dbus_error.name + 27; + if (strcmp (_tmp132_, "Failed") == 0) { + _ecode = DBUS_GERROR_FAILED; + } else if (strcmp (_tmp132_, "NoMemory") == 0) { + _ecode = DBUS_GERROR_NO_MEMORY; + } else if (strcmp (_tmp132_, "ServiceUnknown") == 0) { + _ecode = DBUS_GERROR_SERVICE_UNKNOWN; + } else if (strcmp (_tmp132_, "NameHasNoOwner") == 0) { + _ecode = DBUS_GERROR_NAME_HAS_NO_OWNER; + } else if (strcmp (_tmp132_, "NoReply") == 0) { + _ecode = DBUS_GERROR_NO_REPLY; + } else if (strcmp (_tmp132_, "IOError") == 0) { + _ecode = DBUS_GERROR_IO_ERROR; + } else if (strcmp (_tmp132_, "BadAddress") == 0) { + _ecode = DBUS_GERROR_BAD_ADDRESS; + } else if (strcmp (_tmp132_, "NotSupported") == 0) { + _ecode = DBUS_GERROR_NOT_SUPPORTED; + } else if (strcmp (_tmp132_, "LimitsExceeded") == 0) { + _ecode = DBUS_GERROR_LIMITS_EXCEEDED; + } else if (strcmp (_tmp132_, "AccessDenied") == 0) { + _ecode = DBUS_GERROR_ACCESS_DENIED; + } else if (strcmp (_tmp132_, "AuthFailed") == 0) { + _ecode = DBUS_GERROR_AUTH_FAILED; + } else if (strcmp (_tmp132_, "NoServer") == 0) { + _ecode = DBUS_GERROR_NO_SERVER; + } else if (strcmp (_tmp132_, "Timeout") == 0) { + _ecode = DBUS_GERROR_TIMEOUT; + } else if (strcmp (_tmp132_, "NoNetwork") == 0) { + _ecode = DBUS_GERROR_NO_NETWORK; + } else if (strcmp (_tmp132_, "AddressInUse") == 0) { + _ecode = DBUS_GERROR_ADDRESS_IN_USE; + } else if (strcmp (_tmp132_, "Disconnected") == 0) { + _ecode = DBUS_GERROR_DISCONNECTED; + } else if (strcmp (_tmp132_, "InvalidArgs") == 0) { + _ecode = DBUS_GERROR_INVALID_ARGS; + } else if (strcmp (_tmp132_, "FileNotFound") == 0) { + _ecode = DBUS_GERROR_FILE_NOT_FOUND; + } else if (strcmp (_tmp132_, "FileExists") == 0) { + _ecode = DBUS_GERROR_FILE_EXISTS; + } else if (strcmp (_tmp132_, "UnknownMethod") == 0) { + _ecode = DBUS_GERROR_UNKNOWN_METHOD; + } else if (strcmp (_tmp132_, "TimedOut") == 0) { + _ecode = DBUS_GERROR_TIMED_OUT; + } else if (strcmp (_tmp132_, "MatchRuleNotFound") == 0) { + _ecode = DBUS_GERROR_MATCH_RULE_NOT_FOUND; + } else if (strcmp (_tmp132_, "MatchRuleInvalid") == 0) { + _ecode = DBUS_GERROR_MATCH_RULE_INVALID; + } else if (strcmp (_tmp132_, "Spawn.ExecFailed") == 0) { + _ecode = DBUS_GERROR_SPAWN_EXEC_FAILED; + } else if (strcmp (_tmp132_, "Spawn.ForkFailed") == 0) { + _ecode = DBUS_GERROR_SPAWN_FORK_FAILED; + } else if (strcmp (_tmp132_, "Spawn.ChildExited") == 0) { + _ecode = DBUS_GERROR_SPAWN_CHILD_EXITED; + } else if (strcmp (_tmp132_, "Spawn.ChildSignaled") == 0) { + _ecode = DBUS_GERROR_SPAWN_CHILD_SIGNALED; + } else if (strcmp (_tmp132_, "Spawn.Failed") == 0) { + _ecode = DBUS_GERROR_SPAWN_FAILED; + } else if (strcmp (_tmp132_, "UnixProcessIdUnknown") == 0) { + _ecode = DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN; + } else if (strcmp (_tmp132_, "InvalidSignature") == 0) { + _ecode = DBUS_GERROR_INVALID_SIGNATURE; + } else if (strcmp (_tmp132_, "InvalidFileContent") == 0) { + _ecode = DBUS_GERROR_INVALID_FILE_CONTENT; + } else if (strcmp (_tmp132_, "SELinuxSecurityContextUnknown") == 0) { + _ecode = DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN; + } else if (strcmp (_tmp132_, "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* _tmp133_; + const char* _tmp134_; + GHashTable* _result; + GHashTable* _tmp135_; + DBusMessageIter _tmp136_; + DBusMessageIter _tmp137_; + 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); + _tmp133_ = "org.mpris.MediaPlayer2.Player"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp133_); + _tmp134_ = "Metadata"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp134_); + 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; + } + _tmp135_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); + dbus_message_iter_recurse (&_subiter, &_tmp136_); + while (dbus_message_iter_get_arg_type (&_tmp136_)) { + char* _key; + GValue* _value; + const char* _tmp138_; + GValue _tmp139_ = {0}; + DBusMessageIter _tmp140_; + dbus_message_iter_recurse (&_tmp136_, &_tmp137_); + dbus_message_iter_get_basic (&_tmp137_, &_tmp138_); + dbus_message_iter_next (&_tmp137_); + _key = g_strdup (_tmp138_); + dbus_message_iter_recurse (&_tmp137_, &_tmp140_); + if (dbus_message_iter_get_arg_type (&_tmp140_) == DBUS_TYPE_BYTE) { + guint8 _tmp141_; + dbus_message_iter_get_basic (&_tmp140_, &_tmp141_); + g_value_init (&_tmp139_, G_TYPE_UCHAR); + g_value_set_uchar (&_tmp139_, _tmp141_); + } else if (dbus_message_iter_get_arg_type (&_tmp140_) == DBUS_TYPE_BOOLEAN) { + dbus_bool_t _tmp142_; + dbus_message_iter_get_basic (&_tmp140_, &_tmp142_); + g_value_init (&_tmp139_, G_TYPE_BOOLEAN); + g_value_set_boolean (&_tmp139_, _tmp142_); + } else if (dbus_message_iter_get_arg_type (&_tmp140_) == DBUS_TYPE_INT16) { + dbus_int16_t _tmp143_; + dbus_message_iter_get_basic (&_tmp140_, &_tmp143_); + g_value_init (&_tmp139_, G_TYPE_INT); + g_value_set_int (&_tmp139_, _tmp143_); + } else if (dbus_message_iter_get_arg_type (&_tmp140_) == DBUS_TYPE_UINT16) { + dbus_uint16_t _tmp144_; + dbus_message_iter_get_basic (&_tmp140_, &_tmp144_); + g_value_init (&_tmp139_, G_TYPE_UINT); + g_value_set_uint (&_tmp139_, _tmp144_); + } else if (dbus_message_iter_get_arg_type (&_tmp140_) == DBUS_TYPE_INT32) { + dbus_int32_t _tmp145_; + dbus_message_iter_get_basic (&_tmp140_, &_tmp145_); + g_value_init (&_tmp139_, G_TYPE_INT); + g_value_set_int (&_tmp139_, _tmp145_); + } else if (dbus_message_iter_get_arg_type (&_tmp140_) == DBUS_TYPE_UINT32) { + dbus_uint32_t _tmp146_; + dbus_message_iter_get_basic (&_tmp140_, &_tmp146_); + g_value_init (&_tmp139_, G_TYPE_UINT); + g_value_set_uint (&_tmp139_, _tmp146_); + } else if (dbus_message_iter_get_arg_type (&_tmp140_) == DBUS_TYPE_INT64) { + dbus_int64_t _tmp147_; + dbus_message_iter_get_basic (&_tmp140_, &_tmp147_); + g_value_init (&_tmp139_, G_TYPE_INT64); + g_value_set_int64 (&_tmp139_, _tmp147_); + } else if (dbus_message_iter_get_arg_type (&_tmp140_) == DBUS_TYPE_UINT64) { + dbus_uint64_t _tmp148_; + dbus_message_iter_get_basic (&_tmp140_, &_tmp148_); + g_value_init (&_tmp139_, G_TYPE_UINT64); + g_value_set_uint64 (&_tmp139_, _tmp148_); + } else if (dbus_message_iter_get_arg_type (&_tmp140_) == DBUS_TYPE_DOUBLE) { + double _tmp149_; + dbus_message_iter_get_basic (&_tmp140_, &_tmp149_); + g_value_init (&_tmp139_, G_TYPE_DOUBLE); + g_value_set_double (&_tmp139_, _tmp149_); + } else if (dbus_message_iter_get_arg_type (&_tmp140_) == DBUS_TYPE_STRING) { + const char* _tmp150_; + dbus_message_iter_get_basic (&_tmp140_, &_tmp150_); + g_value_init (&_tmp139_, G_TYPE_STRING); + g_value_take_string (&_tmp139_, g_strdup (_tmp150_)); + } else if (dbus_message_iter_get_arg_type (&_tmp140_) == DBUS_TYPE_OBJECT_PATH) { + const char* _tmp151_; + dbus_message_iter_get_basic (&_tmp140_, &_tmp151_); + g_value_init (&_tmp139_, G_TYPE_STRING); + g_value_take_string (&_tmp139_, g_strdup (_tmp151_)); + } else if (dbus_message_iter_get_arg_type (&_tmp140_) == DBUS_TYPE_SIGNATURE) { + const char* _tmp152_; + dbus_message_iter_get_basic (&_tmp140_, &_tmp152_); + g_value_init (&_tmp139_, G_TYPE_STRING); + g_value_take_string (&_tmp139_, g_strdup (_tmp152_)); + } else if ((dbus_message_iter_get_arg_type (&_tmp140_) == DBUS_TYPE_ARRAY) && (dbus_message_iter_get_element_type (&_tmp140_) == DBUS_TYPE_STRING)) { + const char** _tmp153_; + int _tmp153__length; + int _tmp153__size; + int _tmp153__length1; + DBusMessageIter _tmp154_; + _tmp153_ = g_new (const char*, 5); + _tmp153__length = 0; + _tmp153__size = 4; + _tmp153__length1 = 0; + dbus_message_iter_recurse (&_tmp140_, &_tmp154_); + for (; dbus_message_iter_get_arg_type (&_tmp154_); _tmp153__length1++) { + const char* _tmp155_; + if (_tmp153__size == _tmp153__length) { + _tmp153__size = 2 * _tmp153__size; + _tmp153_ = g_renew (const char*, _tmp153_, _tmp153__size + 1); + } + dbus_message_iter_get_basic (&_tmp154_, &_tmp155_); + dbus_message_iter_next (&_tmp154_); + _tmp153_[_tmp153__length++] = g_strdup (_tmp155_); + } + _tmp153_[_tmp153__length] = NULL; + g_value_init (&_tmp139_, G_TYPE_STRV); + g_value_take_boxed (&_tmp139_, _tmp153_); + } + dbus_message_iter_next (&_tmp137_); + _value = g_memdup (&_tmp139_, sizeof (GValue)); + g_hash_table_insert (_tmp135_, _key, _value); + dbus_message_iter_next (&_tmp136_); + } + dbus_message_iter_next (&_subiter); + _result = _tmp135_; + 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* _tmp156_; + const char* _tmp157_; + DBusMessageIter _tmp158_, _tmp159_; + GHashTableIter _tmp160_; + gpointer _tmp161_, _tmp162_; + 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); + _tmp156_ = "org.mpris.MediaPlayer2.Player"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp156_); + _tmp157_ = "Metadata"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp157_); + dbus_message_iter_open_container (&_iter, DBUS_TYPE_VARIANT, "a{sv}", &_subiter); + dbus_message_iter_open_container (&_subiter, DBUS_TYPE_ARRAY, "{sv}", &_tmp158_); + g_hash_table_iter_init (&_tmp160_, value); + while (g_hash_table_iter_next (&_tmp160_, &_tmp161_, &_tmp162_)) { + char* _key; + GValue* _value; + const char* _tmp163_; + DBusMessageIter _tmp164_; + dbus_message_iter_open_container (&_tmp158_, DBUS_TYPE_DICT_ENTRY, NULL, &_tmp159_); + _key = (char*) _tmp161_; + _value = (GValue*) _tmp162_; + _tmp163_ = _key; + dbus_message_iter_append_basic (&_tmp159_, DBUS_TYPE_STRING, &_tmp163_); + if (G_VALUE_TYPE (_value) == G_TYPE_UCHAR) { + guint8 _tmp165_; + dbus_message_iter_open_container (&_tmp159_, DBUS_TYPE_VARIANT, "y", &_tmp164_); + _tmp165_ = g_value_get_uchar (_value); + dbus_message_iter_append_basic (&_tmp164_, DBUS_TYPE_BYTE, &_tmp165_); + dbus_message_iter_close_container (&_tmp159_, &_tmp164_); + } else if (G_VALUE_TYPE (_value) == G_TYPE_BOOLEAN) { + dbus_bool_t _tmp166_; + dbus_message_iter_open_container (&_tmp159_, DBUS_TYPE_VARIANT, "b", &_tmp164_); + _tmp166_ = g_value_get_boolean (_value); + dbus_message_iter_append_basic (&_tmp164_, DBUS_TYPE_BOOLEAN, &_tmp166_); + dbus_message_iter_close_container (&_tmp159_, &_tmp164_); + } else if (G_VALUE_TYPE (_value) == G_TYPE_INT) { + dbus_int32_t _tmp167_; + dbus_message_iter_open_container (&_tmp159_, DBUS_TYPE_VARIANT, "i", &_tmp164_); + _tmp167_ = g_value_get_int (_value); + dbus_message_iter_append_basic (&_tmp164_, DBUS_TYPE_INT32, &_tmp167_); + dbus_message_iter_close_container (&_tmp159_, &_tmp164_); + } else if (G_VALUE_TYPE (_value) == G_TYPE_UINT) { + dbus_uint32_t _tmp168_; + dbus_message_iter_open_container (&_tmp159_, DBUS_TYPE_VARIANT, "u", &_tmp164_); + _tmp168_ = g_value_get_uint (_value); + dbus_message_iter_append_basic (&_tmp164_, DBUS_TYPE_UINT32, &_tmp168_); + dbus_message_iter_close_container (&_tmp159_, &_tmp164_); + } else if (G_VALUE_TYPE (_value) == G_TYPE_INT64) { + dbus_int64_t _tmp169_; + dbus_message_iter_open_container (&_tmp159_, DBUS_TYPE_VARIANT, "x", &_tmp164_); + _tmp169_ = g_value_get_int64 (_value); + dbus_message_iter_append_basic (&_tmp164_, DBUS_TYPE_INT64, &_tmp169_); + dbus_message_iter_close_container (&_tmp159_, &_tmp164_); + } else if (G_VALUE_TYPE (_value) == G_TYPE_UINT64) { + dbus_uint64_t _tmp170_; + dbus_message_iter_open_container (&_tmp159_, DBUS_TYPE_VARIANT, "t", &_tmp164_); + _tmp170_ = g_value_get_uint64 (_value); + dbus_message_iter_append_basic (&_tmp164_, DBUS_TYPE_UINT64, &_tmp170_); + dbus_message_iter_close_container (&_tmp159_, &_tmp164_); + } else if (G_VALUE_TYPE (_value) == G_TYPE_DOUBLE) { + double _tmp171_; + dbus_message_iter_open_container (&_tmp159_, DBUS_TYPE_VARIANT, "d", &_tmp164_); + _tmp171_ = g_value_get_double (_value); + dbus_message_iter_append_basic (&_tmp164_, DBUS_TYPE_DOUBLE, &_tmp171_); + dbus_message_iter_close_container (&_tmp159_, &_tmp164_); + } else if (G_VALUE_TYPE (_value) == G_TYPE_STRING) { + const char* _tmp172_; + dbus_message_iter_open_container (&_tmp159_, DBUS_TYPE_VARIANT, "s", &_tmp164_); + _tmp172_ = g_value_get_string (_value); + dbus_message_iter_append_basic (&_tmp164_, DBUS_TYPE_STRING, &_tmp172_); + dbus_message_iter_close_container (&_tmp159_, &_tmp164_); + } else if (G_VALUE_TYPE (_value) == G_TYPE_STRV) { + const char** _tmp173_; + DBusMessageIter _tmp174_; + int _tmp175_; + dbus_message_iter_open_container (&_tmp159_, DBUS_TYPE_VARIANT, "as", &_tmp164_); + _tmp173_ = g_value_get_boxed (_value); + dbus_message_iter_open_container (&_tmp164_, DBUS_TYPE_ARRAY, "s", &_tmp174_); + for (_tmp175_ = 0; _tmp175_ < g_strv_length (g_value_get_boxed (_value)); _tmp175_++) { + const char* _tmp176_; + _tmp176_ = *_tmp173_; + dbus_message_iter_append_basic (&_tmp174_, DBUS_TYPE_STRING, &_tmp176_); + _tmp173_++; + } + dbus_message_iter_close_container (&_tmp164_, &_tmp174_); + dbus_message_iter_close_container (&_tmp159_, &_tmp164_); + } + dbus_message_iter_close_container (&_tmp158_, &_tmp159_); + } + dbus_message_iter_close_container (&_subiter, &_tmp158_); + 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* _tmp177_; + const char* _tmp178_; + gint32 _result; + dbus_int32_t _tmp179_; + 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); + _tmp177_ = "org.mpris.MediaPlayer2.Player"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp177_); + _tmp178_ = "Position"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp178_); + 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, &_tmp179_); + dbus_message_iter_next (&_subiter); + _result = _tmp179_; + 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* _tmp180_; + const char* _tmp181_; + dbus_int32_t _tmp182_; + 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); + _tmp180_ = "org.mpris.MediaPlayer2.Player"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp180_); + _tmp181_ = "Position"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp181_); + dbus_message_iter_open_container (&_iter, DBUS_TYPE_VARIANT, "i", &_subiter); + _tmp182_ = value; + dbus_message_iter_append_basic (&_subiter, DBUS_TYPE_INT32, &_tmp182_); + 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* _tmp183_; + const char* _tmp184_; + char* _result; + const char* _tmp185_; + 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); + _tmp183_ = "org.mpris.MediaPlayer2.Player"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp183_); + _tmp184_ = "PlaybackStatus"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp184_); + 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, &_tmp185_); + dbus_message_iter_next (&_subiter); + _result = g_strdup (_tmp185_); + 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* _tmp186_; + const char* _tmp187_; + const char* _tmp188_; + 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); + _tmp186_ = "org.mpris.MediaPlayer2.Player"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp186_); + _tmp187_ = "PlaybackStatus"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp187_); + dbus_message_iter_open_container (&_iter, DBUS_TYPE_VARIANT, "s", &_subiter); + _tmp188_ = value; + dbus_message_iter_append_basic (&_subiter, DBUS_TYPE_STRING, &_tmp188_); + 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->SetPosition = mpris_player_dbus_proxy_SetPosition; + iface->PlayPause = mpris_player_dbus_proxy_PlayPause; + iface->Pause = mpris_player_dbus_proxy_Pause; + iface->Next = mpris_player_dbus_proxy_Next; + iface->Previous = mpris_player_dbus_proxy_Previous; + 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 ("\n"); + g_string_append (xml_data, "\n\n \n \n \n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n\n \n \n \n \n \n\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, "\n", children[i]); + } + dbus_free_string_array (children); + g_string_append (xml_data, "\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* _tmp189_; + 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, &_tmp189_); + dbus_message_iter_next (&iter); + interface_name = g_strdup (_tmp189_); + 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* _tmp190_; + DBusMessageIter _tmp191_, _tmp192_; + GHashTableIter _tmp193_; + gpointer _tmp194_, _tmp195_; + char** _tmp210_; + DBusMessageIter _tmp211_; + int _tmp212_; + _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); + _tmp190_ = source; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp190_); + dbus_message_iter_open_container (&_iter, DBUS_TYPE_ARRAY, "{sv}", &_tmp191_); + g_hash_table_iter_init (&_tmp193_, changed_properties); + while (g_hash_table_iter_next (&_tmp193_, &_tmp194_, &_tmp195_)) { + char* _key; + GValue* _value; + const char* _tmp196_; + DBusMessageIter _tmp197_; + dbus_message_iter_open_container (&_tmp191_, DBUS_TYPE_DICT_ENTRY, NULL, &_tmp192_); + _key = (char*) _tmp194_; + _value = (GValue*) _tmp195_; + _tmp196_ = _key; + dbus_message_iter_append_basic (&_tmp192_, DBUS_TYPE_STRING, &_tmp196_); + if (G_VALUE_TYPE (_value) == G_TYPE_UCHAR) { + guint8 _tmp198_; + dbus_message_iter_open_container (&_tmp192_, DBUS_TYPE_VARIANT, "y", &_tmp197_); + _tmp198_ = g_value_get_uchar (_value); + dbus_message_iter_append_basic (&_tmp197_, DBUS_TYPE_BYTE, &_tmp198_); + dbus_message_iter_close_container (&_tmp192_, &_tmp197_); + } else if (G_VALUE_TYPE (_value) == G_TYPE_BOOLEAN) { + dbus_bool_t _tmp199_; + dbus_message_iter_open_container (&_tmp192_, DBUS_TYPE_VARIANT, "b", &_tmp197_); + _tmp199_ = g_value_get_boolean (_value); + dbus_message_iter_append_basic (&_tmp197_, DBUS_TYPE_BOOLEAN, &_tmp199_); + dbus_message_iter_close_container (&_tmp192_, &_tmp197_); + } else if (G_VALUE_TYPE (_value) == G_TYPE_INT) { + dbus_int32_t _tmp200_; + dbus_message_iter_open_container (&_tmp192_, DBUS_TYPE_VARIANT, "i", &_tmp197_); + _tmp200_ = g_value_get_int (_value); + dbus_message_iter_append_basic (&_tmp197_, DBUS_TYPE_INT32, &_tmp200_); + dbus_message_iter_close_container (&_tmp192_, &_tmp197_); + } else if (G_VALUE_TYPE (_value) == G_TYPE_UINT) { + dbus_uint32_t _tmp201_; + dbus_message_iter_open_container (&_tmp192_, DBUS_TYPE_VARIANT, "u", &_tmp197_); + _tmp201_ = g_value_get_uint (_value); + dbus_message_iter_append_basic (&_tmp197_, DBUS_TYPE_UINT32, &_tmp201_); + dbus_message_iter_close_container (&_tmp192_, &_tmp197_); + } else if (G_VALUE_TYPE (_value) == G_TYPE_INT64) { + dbus_int64_t _tmp202_; + dbus_message_iter_open_container (&_tmp192_, DBUS_TYPE_VARIANT, "x", &_tmp197_); + _tmp202_ = g_value_get_int64 (_value); + dbus_message_iter_append_basic (&_tmp197_, DBUS_TYPE_INT64, &_tmp202_); + dbus_message_iter_close_container (&_tmp192_, &_tmp197_); + } else if (G_VALUE_TYPE (_value) == G_TYPE_UINT64) { + dbus_uint64_t _tmp203_; + dbus_message_iter_open_container (&_tmp192_, DBUS_TYPE_VARIANT, "t", &_tmp197_); + _tmp203_ = g_value_get_uint64 (_value); + dbus_message_iter_append_basic (&_tmp197_, DBUS_TYPE_UINT64, &_tmp203_); + dbus_message_iter_close_container (&_tmp192_, &_tmp197_); + } else if (G_VALUE_TYPE (_value) == G_TYPE_DOUBLE) { + double _tmp204_; + dbus_message_iter_open_container (&_tmp192_, DBUS_TYPE_VARIANT, "d", &_tmp197_); + _tmp204_ = g_value_get_double (_value); + dbus_message_iter_append_basic (&_tmp197_, DBUS_TYPE_DOUBLE, &_tmp204_); + dbus_message_iter_close_container (&_tmp192_, &_tmp197_); + } else if (G_VALUE_TYPE (_value) == G_TYPE_STRING) { + const char* _tmp205_; + dbus_message_iter_open_container (&_tmp192_, DBUS_TYPE_VARIANT, "s", &_tmp197_); + _tmp205_ = g_value_get_string (_value); + dbus_message_iter_append_basic (&_tmp197_, DBUS_TYPE_STRING, &_tmp205_); + dbus_message_iter_close_container (&_tmp192_, &_tmp197_); + } else if (G_VALUE_TYPE (_value) == G_TYPE_STRV) { + const char** _tmp206_; + DBusMessageIter _tmp207_; + int _tmp208_; + dbus_message_iter_open_container (&_tmp192_, DBUS_TYPE_VARIANT, "as", &_tmp197_); + _tmp206_ = g_value_get_boxed (_value); + dbus_message_iter_open_container (&_tmp197_, DBUS_TYPE_ARRAY, "s", &_tmp207_); + for (_tmp208_ = 0; _tmp208_ < g_strv_length (g_value_get_boxed (_value)); _tmp208_++) { + const char* _tmp209_; + _tmp209_ = *_tmp206_; + dbus_message_iter_append_basic (&_tmp207_, DBUS_TYPE_STRING, &_tmp209_); + _tmp206_++; + } + dbus_message_iter_close_container (&_tmp197_, &_tmp207_); + dbus_message_iter_close_container (&_tmp192_, &_tmp197_); + } + dbus_message_iter_close_container (&_tmp191_, &_tmp192_); + } + dbus_message_iter_close_container (&_iter, &_tmp191_); + _tmp210_ = invalid; + dbus_message_iter_open_container (&_iter, DBUS_TYPE_ARRAY, "s", &_tmp211_); + for (_tmp212_ = 0; _tmp212_ < invalid_length1; _tmp212_++) { + const char* _tmp213_; + _tmp213_ = *_tmp210_; + dbus_message_iter_append_basic (&_tmp211_, DBUS_TYPE_STRING, &_tmp213_); + _tmp210_++; + } + dbus_message_iter_close_container (&_iter, &_tmp211_); + 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* _tmp214_; + GHashTable* changed_properties = NULL; + GHashTable* _tmp215_; + DBusMessageIter _tmp216_; + DBusMessageIter _tmp217_; + char** invalid = NULL; + int invalid_length1; + char** _tmp236_; + int _tmp236__length; + int _tmp236__size; + int _tmp236__length1; + DBusMessageIter _tmp237_; + 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, &_tmp214_); + dbus_message_iter_next (&iter); + source = g_strdup (_tmp214_); + _tmp215_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); + dbus_message_iter_recurse (&iter, &_tmp216_); + while (dbus_message_iter_get_arg_type (&_tmp216_)) { + char* _key; + GValue* _value; + const char* _tmp218_; + GValue _tmp219_ = {0}; + DBusMessageIter _tmp220_; + dbus_message_iter_recurse (&_tmp216_, &_tmp217_); + dbus_message_iter_get_basic (&_tmp217_, &_tmp218_); + dbus_message_iter_next (&_tmp217_); + _key = g_strdup (_tmp218_); + dbus_message_iter_recurse (&_tmp217_, &_tmp220_); + if (dbus_message_iter_get_arg_type (&_tmp220_) == DBUS_TYPE_BYTE) { + guint8 _tmp221_; + dbus_message_iter_get_basic (&_tmp220_, &_tmp221_); + g_value_init (&_tmp219_, G_TYPE_UCHAR); + g_value_set_uchar (&_tmp219_, _tmp221_); + } else if (dbus_message_iter_get_arg_type (&_tmp220_) == DBUS_TYPE_BOOLEAN) { + dbus_bool_t _tmp222_; + dbus_message_iter_get_basic (&_tmp220_, &_tmp222_); + g_value_init (&_tmp219_, G_TYPE_BOOLEAN); + g_value_set_boolean (&_tmp219_, _tmp222_); + } else if (dbus_message_iter_get_arg_type (&_tmp220_) == DBUS_TYPE_INT16) { + dbus_int16_t _tmp223_; + dbus_message_iter_get_basic (&_tmp220_, &_tmp223_); + g_value_init (&_tmp219_, G_TYPE_INT); + g_value_set_int (&_tmp219_, _tmp223_); + } else if (dbus_message_iter_get_arg_type (&_tmp220_) == DBUS_TYPE_UINT16) { + dbus_uint16_t _tmp224_; + dbus_message_iter_get_basic (&_tmp220_, &_tmp224_); + g_value_init (&_tmp219_, G_TYPE_UINT); + g_value_set_uint (&_tmp219_, _tmp224_); + } else if (dbus_message_iter_get_arg_type (&_tmp220_) == DBUS_TYPE_INT32) { + dbus_int32_t _tmp225_; + dbus_message_iter_get_basic (&_tmp220_, &_tmp225_); + g_value_init (&_tmp219_, G_TYPE_INT); + g_value_set_int (&_tmp219_, _tmp225_); + } else if (dbus_message_iter_get_arg_type (&_tmp220_) == DBUS_TYPE_UINT32) { + dbus_uint32_t _tmp226_; + dbus_message_iter_get_basic (&_tmp220_, &_tmp226_); + g_value_init (&_tmp219_, G_TYPE_UINT); + g_value_set_uint (&_tmp219_, _tmp226_); + } else if (dbus_message_iter_get_arg_type (&_tmp220_) == DBUS_TYPE_INT64) { + dbus_int64_t _tmp227_; + dbus_message_iter_get_basic (&_tmp220_, &_tmp227_); + g_value_init (&_tmp219_, G_TYPE_INT64); + g_value_set_int64 (&_tmp219_, _tmp227_); + } else if (dbus_message_iter_get_arg_type (&_tmp220_) == DBUS_TYPE_UINT64) { + dbus_uint64_t _tmp228_; + dbus_message_iter_get_basic (&_tmp220_, &_tmp228_); + g_value_init (&_tmp219_, G_TYPE_UINT64); + g_value_set_uint64 (&_tmp219_, _tmp228_); + } else if (dbus_message_iter_get_arg_type (&_tmp220_) == DBUS_TYPE_DOUBLE) { + double _tmp229_; + dbus_message_iter_get_basic (&_tmp220_, &_tmp229_); + g_value_init (&_tmp219_, G_TYPE_DOUBLE); + g_value_set_double (&_tmp219_, _tmp229_); + } else if (dbus_message_iter_get_arg_type (&_tmp220_) == DBUS_TYPE_STRING) { + const char* _tmp230_; + dbus_message_iter_get_basic (&_tmp220_, &_tmp230_); + g_value_init (&_tmp219_, G_TYPE_STRING); + g_value_take_string (&_tmp219_, g_strdup (_tmp230_)); + } else if (dbus_message_iter_get_arg_type (&_tmp220_) == DBUS_TYPE_OBJECT_PATH) { + const char* _tmp231_; + dbus_message_iter_get_basic (&_tmp220_, &_tmp231_); + g_value_init (&_tmp219_, G_TYPE_STRING); + g_value_take_string (&_tmp219_, g_strdup (_tmp231_)); + } else if (dbus_message_iter_get_arg_type (&_tmp220_) == DBUS_TYPE_SIGNATURE) { + const char* _tmp232_; + dbus_message_iter_get_basic (&_tmp220_, &_tmp232_); + g_value_init (&_tmp219_, G_TYPE_STRING); + g_value_take_string (&_tmp219_, g_strdup (_tmp232_)); + } else if ((dbus_message_iter_get_arg_type (&_tmp220_) == DBUS_TYPE_ARRAY) && (dbus_message_iter_get_element_type (&_tmp220_) == DBUS_TYPE_STRING)) { + const char** _tmp233_; + int _tmp233__length; + int _tmp233__size; + int _tmp233__length1; + DBusMessageIter _tmp234_; + _tmp233_ = g_new (const char*, 5); + _tmp233__length = 0; + _tmp233__size = 4; + _tmp233__length1 = 0; + dbus_message_iter_recurse (&_tmp220_, &_tmp234_); + for (; dbus_message_iter_get_arg_type (&_tmp234_); _tmp233__length1++) { + const char* _tmp235_; + if (_tmp233__size == _tmp233__length) { + _tmp233__size = 2 * _tmp233__size; + _tmp233_ = g_renew (const char*, _tmp233_, _tmp233__size + 1); + } + dbus_message_iter_get_basic (&_tmp234_, &_tmp235_); + dbus_message_iter_next (&_tmp234_); + _tmp233_[_tmp233__length++] = g_strdup (_tmp235_); + } + _tmp233_[_tmp233__length] = NULL; + g_value_init (&_tmp219_, G_TYPE_STRV); + g_value_take_boxed (&_tmp219_, _tmp233_); + } + dbus_message_iter_next (&_tmp217_); + _value = g_memdup (&_tmp219_, sizeof (GValue)); + g_hash_table_insert (_tmp215_, _key, _value); + dbus_message_iter_next (&_tmp216_); + } + dbus_message_iter_next (&iter); + changed_properties = _tmp215_; + invalid_length1 = 0; + _tmp236_ = g_new (char*, 5); + _tmp236__length = 0; + _tmp236__size = 4; + _tmp236__length1 = 0; + dbus_message_iter_recurse (&iter, &_tmp237_); + for (; dbus_message_iter_get_arg_type (&_tmp237_); _tmp236__length1++) { + const char* _tmp238_; + if (_tmp236__size == _tmp236__length) { + _tmp236__size = 2 * _tmp236__size; + _tmp236_ = g_renew (char*, _tmp236_, _tmp236__size + 1); + } + dbus_message_iter_get_basic (&_tmp237_, &_tmp238_); + dbus_message_iter_next (&_tmp237_); + _tmp236_[_tmp236__length++] = g_strdup (_tmp238_); + } + invalid_length1 = _tmp236__length1; + _tmp236_[_tmp236__length] = NULL; + dbus_message_iter_next (&iter); + invalid = _tmp236_; + 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; +} + + +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* pos_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:98: properties-changed for interface %s", interface_source); + 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:100: Property-changed hash is null or this is a" \ +"n interface that concerns us"); + return; + } + play_v = __g_value_dup0 ((GValue*) g_hash_table_lookup (changed_properties, "PlaybackStatus")); + if (play_v != NULL) { + char* state; + gint p; + TransportMenuitem* _tmp2_; + PlayerItem* _tmp1_; + ScrubMenuitem* _tmp4_; + PlayerItem* _tmp3_; + state = g_strdup (g_value_get_string (play_v)); + g_debug ("mpris2-controller.vala:106: new playback state = %s", state); + p = 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_); + scrub_menuitem_update_playstate (_tmp4_ = (_tmp3_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), IS_SCRUB_MENUITEM (_tmp3_) ? ((ScrubMenuitem*) _tmp3_) : NULL), p); + _g_object_unref0 (_tmp4_); + _g_free0 (state); + } + pos_v = __g_value_dup0 ((GValue*) g_hash_table_lookup (changed_properties, "Position")); + if (pos_v != NULL) { + gint64 pos; + ScrubMenuitem* _tmp6_; + PlayerItem* _tmp5_; + pos = g_value_get_int64 (pos_v); + g_debug ("mpris2-controller.vala:115: new position = %i", (gint) pos); + scrub_menuitem_update_position (_tmp6_ = (_tmp5_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), IS_SCRUB_MENUITEM (_tmp5_) ? ((ScrubMenuitem*) _tmp5_) : NULL), (gint32) pos); + _g_object_unref0 (_tmp6_); + } + meta_v = __g_value_dup0 ((GValue*) g_hash_table_lookup (changed_properties, "Metadata")); + if (meta_v != NULL) { + GHashTable* _tmp7_; + GeeHashSet* _tmp9_; + PlayerItem* _tmp8_; + GeeHashSet* _tmp12_; + GHashTable* _tmp11_; + PlayerItem* _tmp10_; + GeeHashSet* _tmp14_; + PlayerItem* _tmp13_; + gboolean _tmp15_ = FALSE; + GHashTable* _tmp16_; + gboolean _tmp17_; + char* _tmp24_; + ScrubMenuitem* _tmp23_; + PlayerItem* _tmp22_; + g_debug ("mpris2-controller.vala:121: metadata is not empty"); + g_debug ("mpris2-controller.vala:122: artist : %s", g_value_get_string ((GValue*) g_hash_table_lookup (_tmp7_ = mpris_player_get_Metadata (self->priv->_player), "artist"))); + _g_hash_table_unref0 (_tmp7_); + player_item_reset (_tmp8_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), _tmp9_ = metadata_menuitem_attributes_format ()); + _g_object_unref0 (_tmp9_); + _g_object_unref0 (_tmp8_); + player_item_update (_tmp10_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), _tmp11_ = mpris_player_get_Metadata (self->priv->_player), _tmp12_ = metadata_menuitem_attributes_format ()); + _g_object_unref0 (_tmp12_); + _g_hash_table_unref0 (_tmp11_); + _g_object_unref0 (_tmp10_); + player_item_reset (_tmp13_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), _tmp14_ = scrub_menuitem_attributes_format ()); + _g_object_unref0 (_tmp14_); + _g_object_unref0 (_tmp13_); + if ((_tmp17_ = ((gint) g_utf8_strlen (g_value_get_string ((GValue*) g_hash_table_lookup (_tmp16_ = mpris_player_get_Metadata (self->priv->_player), "artist")), -1)) > 0, _g_hash_table_unref0 (_tmp16_), _tmp17_)) { + _tmp15_ = TRUE; + } else { + GHashTable* _tmp18_; + _tmp15_ = ((gint) g_utf8_strlen (g_value_get_string ((GValue*) g_hash_table_lookup (_tmp18_ = mpris_player_get_Metadata (self->priv->_player), "artist")), -1)) > 0; + _g_hash_table_unref0 (_tmp18_); + } + if (_tmp15_) { + GeeHashSet* _tmp21_; + GHashTable* _tmp20_; + PlayerItem* _tmp19_; + player_item_update (_tmp19_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), _tmp20_ = mpris_player_get_Metadata (self->priv->_player), _tmp21_ = scrub_menuitem_attributes_format ()); + _g_object_unref0 (_tmp21_); + _g_hash_table_unref0 (_tmp20_); + _g_object_unref0 (_tmp19_); + } + scrub_menuitem_update_playstate (_tmp23_ = (_tmp22_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), IS_SCRUB_MENUITEM (_tmp22_) ? ((ScrubMenuitem*) _tmp22_) : NULL), mpris2_controller_determine_play_state (self, _tmp24_ = mpris_player_get_PlaybackStatus (self->priv->_player))); + _g_free0 (_tmp24_); + _g_object_unref0 (_tmp23_); + } + _g_free0 (meta_v); + _g_free0 (pos_v); + _g_free0 (play_v); +} + + +static gint mpris2_controller_determine_play_state (Mpris2Controller* self, const char* status) { + gint result = 0; + gboolean _tmp0_ = FALSE; + g_return_val_if_fail (self != NULL, 0); + g_return_val_if_fail (status != NULL, 0); + if (status == NULL) { + result = 1; + return result; + } + if (status != NULL) { + _tmp0_ = _vala_strcmp0 (status, "Playing") == 0; + } else { + _tmp0_ = FALSE; + } + if (_tmp0_) { + g_debug ("mpris2-controller.vala:142: determine play state - state = %s", status); + result = 0; + return result; + } + result = 1; + return result; +} + + +void mpris2_controller_initial_update (Mpris2Controller* self) { + gint32 status = 0; + char* _tmp0_; + gboolean _tmp1_; + TransportMenuitem* _tmp4_; + PlayerItem* _tmp3_; + GeeHashSet* _tmp7_; + GHashTable* _tmp6_; + PlayerItem* _tmp5_; + GeeHashSet* _tmp10_; + GHashTable* _tmp9_; + PlayerItem* _tmp8_; + g_return_if_fail (self != NULL); + if ((_tmp1_ = (_tmp0_ = mpris_player_get_PlaybackStatus (self->priv->_player)) == NULL, _g_free0 (_tmp0_), _tmp1_)) { + status = (gint32) 1; + } else { + char* _tmp2_; + status = (gint32) mpris2_controller_determine_play_state (self, _tmp2_ = mpris_player_get_PlaybackStatus (self->priv->_player)); + _g_free0 (_tmp2_); + } + g_debug ("mpris2-controller.vala:157: initial update - play state %i", (gint) status); + 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), (gint) status); + _g_object_unref0 (_tmp4_); + player_item_update (_tmp5_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), _tmp6_ = mpris_player_get_Metadata (self->priv->_player), _tmp7_ = metadata_menuitem_attributes_format ()); + _g_object_unref0 (_tmp7_); + _g_hash_table_unref0 (_tmp6_); + _g_object_unref0 (_tmp5_); + player_item_update (_tmp8_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), _tmp9_ = mpris_player_get_Metadata (self->priv->_player), _tmp10_ = scrub_menuitem_attributes_format ()); + _g_object_unref0 (_tmp10_); + _g_hash_table_unref0 (_tmp9_); + _g_object_unref0 (_tmp8_); +} + + +void mpris2_controller_transport_event (Mpris2Controller* self, TransportMenuitemaction command) { + GError * _inner_error_; + g_return_if_fail (self != NULL); + _inner_error_ = NULL; + g_debug ("mpris2-controller.vala:168: transport_event input = %i", (gint) command); + if (command == TRANSPORT_MENUITEM_ACTION_PLAY_PAUSE) { + g_debug ("mpris2-controller.vala:170: transport_event PLAY_PAUSE"); + { + mpris_player_PlayPause (self->priv->_player, &_inner_error_); + if (_inner_error_ != NULL) { + if (_inner_error_->domain == DBUS_GERROR) { + goto __catch2_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_); + return; + } + } + goto __finally2; + __catch2_dbus_gerror: + { + GError * _error_; + _error_ = _inner_error_; + _inner_error_ = NULL; + { + g_warning ("mpris2-controller.vala:175: DBus Error calling the player objects Play" \ +"Pause method %s", _error_->message); + _g_error_free0 (_error_); + } + } + __finally2: + if (_inner_error_ != NULL) { + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); + g_clear_error (&_inner_error_); + return; + } + } else { + if (command == TRANSPORT_MENUITEM_ACTION_PREVIOUS) { + { + mpris_player_Previous (self->priv->_player, &_inner_error_); + if (_inner_error_ != NULL) { + if (_inner_error_->domain == DBUS_GERROR) { + goto __catch3_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_); + return; + } + } + goto __finally3; + __catch3_dbus_gerror: + { + GError * _error_; + _error_ = _inner_error_; + _inner_error_ = NULL; + { + g_warning ("mpris2-controller.vala:184: DBus Error calling the player objects Prev" \ +"ious method %s", _error_->message); + _g_error_free0 (_error_); + } + } + __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; + } + } else { + if (command == TRANSPORT_MENUITEM_ACTION_NEXT) { + { + mpris_player_Next (self->priv->_player, &_inner_error_); + if (_inner_error_ != NULL) { + if (_inner_error_->domain == DBUS_GERROR) { + goto __catch4_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_); + return; + } + } + goto __finally4; + __catch4_dbus_gerror: + { + GError * _error_; + _error_ = _inner_error_; + _inner_error_ = NULL; + { + g_warning ("mpris2-controller.vala:193: DBus Error calling the player objects Next" \ +" method %s", _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; + } + } + } + } +} + + +/** +TODO: SetPosition on the player object is not working with rhythmbox, + runtime error - "dbus function not supported" + */ +void mpris2_controller_set_position (Mpris2Controller* self, double position) { + GError * _inner_error_; + GHashTable* data; + GValue* time_value; + guint32 total_time; + double new_time_position; + GHashTable* _tmp0_; + GValue* _tmp1_; + GValue* v; + g_return_if_fail (self != NULL); + _inner_error_ = NULL; + g_debug ("mpris2-controller.vala:204: Set position with pos (0-100) %f", position); + data = mpris_player_get_Metadata (self->priv->_player); + time_value = __g_value_dup0 ((GValue*) g_hash_table_lookup (data, "time")); + if (time_value == NULL) { + g_warning ("mpris2-controller.vala:208: Can't fetch the duration of the track ther" \ +"efore cant set the position"); + _g_free0 (time_value); + _g_hash_table_unref0 (data); + return; + } + total_time = (guint32) (g_value_get_uint (time_value) * 1000); + g_debug ("mpris2-controller.vala:213: total time of track = %i", (gint) total_time); + new_time_position = (total_time * position) / 100.0; + g_debug ("mpris2-controller.vala:215: new position = %f", new_time_position); + v = (_tmp1_ = __g_value_dup0 ((GValue*) g_hash_table_lookup (_tmp0_ = mpris_player_get_Metadata (self->priv->_player), "trackid")), _g_hash_table_unref0 (_tmp0_), _tmp1_); + if (v != NULL) { + if (G_VALUE_HOLDS (v, G_TYPE_STRING)) { + char* path; + g_debug ("mpris2-controller.vala:220: the trackid = %s", g_value_get_string (v)); + path = g_strdup (g_value_get_string (v)); + { + } + goto __finally5; + __catch5_dbus_gerror: + { + GError * e; + e = _inner_error_; + _inner_error_ = NULL; + { + g_error ("mpris2-controller.vala:226: DBus Error calling the player objects SetP" \ +"osition method %s", e->message); + _g_error_free0 (e); + } + } + __finally5: + if (_inner_error_ != NULL) { + _g_free0 (path); + _g_free0 (v); + _g_free0 (time_value); + _g_hash_table_unref0 (data); + 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_free0 (v); + _g_free0 (time_value); + _g_hash_table_unref0 (data); +} + + +void mpris2_controller_onSeeked (Mpris2Controller* self, gint64 position) { + PlayerItem* _tmp0_; + ScrubMenuitem* scrub; + g_return_if_fail (self != NULL); + g_debug ("mpris2-controller.vala:234: Seeked signal callback with pos = %i", ((gint) position) / 1000); + scrub = (_tmp0_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), IS_SCRUB_MENUITEM (_tmp0_) ? ((ScrubMenuitem*) _tmp0_) : NULL); + scrub_menuitem_update_position (scrub, ((gint32) position) / 1000); + _g_object_unref0 (scrub); +} + + +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) { + GError * _inner_error_; + g_return_if_fail (self != NULL); + _inner_error_ = NULL; + if (mpris2_controller_connected (self) == TRUE) { + { + mpris_root_Raise (self->priv->_mpris2_root, &_inner_error_); + if (_inner_error_ != NULL) { + if (_inner_error_->domain == DBUS_GERROR) { + goto __catch6_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_); + return; + } + } + goto __finally6; + __catch6_dbus_gerror: + { + GError * e; + e = _inner_error_; + _inner_error_ = NULL; + { + g_error ("mpris2-controller.vala:259: Exception thrown while calling root functi" \ +"on Raise - %s", e->message); + _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; + } + } +} + + +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_onSeeked_mpris_player_seeked (MprisPlayer* _sender, gint64 new_position, gpointer self) { + mpris2_controller_onSeeked (self, new_position); +} + + +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; + MprisRoot* _tmp245_; + char* _tmp244_; + char* _tmp243_; + char* _tmp242_; + char* _tmp241_; + char* _tmp240_; + char* _tmp239_; + MprisPlayer* _tmp253_; + char* _tmp252_; + char* _tmp251_; + char* _tmp250_; + char* _tmp249_; + char* _tmp248_; + char* _tmp247_; + char* _tmp246_; + FreeDesktopProperties* _tmp260_; + char* _tmp259_; + char* _tmp258_; + char* _tmp257_; + char* _tmp256_; + char* _tmp255_; + char* _tmp254_; + connection = dbus_g_bus_get (DBUS_BUS_SESSION, &_inner_error_); + if (_inner_error_ != NULL) { + if (_inner_error_->domain == DBUS_GERROR) { + goto __catch7_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, _tmp245_ = mpris_root_dbus_proxy_new (connection, _tmp244_ = g_strconcat (_tmp242_ = g_strconcat (MPRIS2_CONTROLLER_root_interface, ".", NULL), _tmp243_ = g_utf8_strdown (player_controller_get_name (self->priv->_owner), -1), NULL), "/org/mpris/MediaPlayer2")); + _g_object_unref0 (_tmp245_); + _g_free0 (_tmp244_); + _g_free0 (_tmp243_); + _g_free0 (_tmp242_); + _g_free0 (_tmp241_); + _g_free0 (_tmp240_); + _g_free0 (_tmp239_); + mpris2_controller_set_player (self, _tmp253_ = mpris_player_dbus_proxy_new (connection, _tmp252_ = g_strconcat (_tmp250_ = g_strconcat (MPRIS2_CONTROLLER_root_interface, ".", NULL), _tmp251_ = g_utf8_strdown (player_controller_get_name (self->priv->_owner), -1), NULL), "/org/mpris/MediaPlayer2")); + _g_object_unref0 (_tmp253_); + _g_free0 (_tmp252_); + _g_free0 (_tmp251_); + _g_free0 (_tmp250_); + _g_free0 (_tmp249_); + _g_free0 (_tmp248_); + _g_free0 (_tmp247_); + _g_free0 (_tmp246_); + g_signal_connect_object (self->priv->_player, "seeked", (GCallback) _mpris2_controller_onSeeked_mpris_player_seeked, self, 0); + mpris2_controller_set_properties_interface (self, _tmp260_ = free_desktop_properties_dbus_proxy_new (connection, _tmp259_ = g_strconcat (_tmp257_ = g_strconcat (MPRIS2_CONTROLLER_root_interface, ".", NULL), _tmp258_ = g_utf8_strdown (player_controller_get_name (self->priv->_owner), -1), NULL), "/org/mpris/MediaPlayer2")); + _g_object_unref0 (_tmp260_); + _g_free0 (_tmp259_); + _g_free0 (_tmp258_); + _g_free0 (_tmp257_); + _g_free0 (_tmp256_); + _g_free0 (_tmp255_); + _g_free0 (_tmp254_); + 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 __finally7; + __catch7_dbus_gerror: + { + GError * e; + e = _inner_error_; + _inner_error_ = NULL; + { + g_error ("mpris2-controller.vala:92: Problems connecting to the session bus - %s", e->message); + _g_error_free0 (e); + } + } + __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 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/mpris2-controller.vala b/src/mpris2-controller.vala new file mode 100644 index 0000000..65d881a --- /dev/null +++ b/src/mpris2-controller.vala @@ -0,0 +1,266 @@ +/* +This service primarily controls PulseAudio and is driven by the sound indicator menu on the panel. +Copyright 2010 Canonical Ltd. + +Authors: + Conor Curran + +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 . +*/ +using DBus; + +[DBus (name = "org.mpris.MediaPlayer2")] +public interface MprisRoot : DBus.Object { + // properties + public abstract bool HasTracklist{owned get; set;} + public abstract bool CanQuit{owned get; set;} + public abstract bool CanRaise{owned get; set;} + public abstract string Identity{owned get; set;} + public abstract string DesktopEntry{owned get; set;} + // methods + public abstract void Quit() throws DBus.Error; + public abstract void Raise() throws DBus.Error; +} + +[DBus (name = "org.mpris.MediaPlayer2.Player")] +public interface MprisPlayer : DBus.Object { + + // properties + public abstract HashTable Metadata{owned get; set;} + public abstract int32 Position{owned get; set;} + public abstract string PlaybackStatus{owned get; set;} + // methods + public abstract void SetPosition(DBus.ObjectPath path, int64 pos) throws DBus.Error; + public abstract void PlayPause() throws DBus.Error; + public abstract void Pause() throws DBus.Error; + public abstract void Next() throws DBus.Error; + public abstract void Previous() throws DBus.Error; + // signals + public signal void Seeked(int64 new_position); +} + +[DBus (name = "org.freedesktop.DBus.Properties")] +public interface FreeDesktopProperties : DBus.Object{ + // signals + public signal void PropertiesChanged(string source, HashTable changed_properties, string[] invalid); +} + +/* + This class will entirely replace mpris-controller.vala hence why there is no + point in trying to get encorporate both into the same object model. + */ +public class Mpris2Controller : GLib.Object +{ + public static const string root_interface = "org.mpris.MediaPlayer2" ; + public MprisRoot mpris2_root {get; construct;} + public MprisPlayer player {get; construct;} + public PlayerController owner {get; construct;} + public FreeDesktopProperties properties_interface {get; construct;} + + public Mpris2Controller(PlayerController ctrl) + { + GLib.Object(owner: ctrl); + } + + construct{ + try { + var connection = DBus.Bus.get (DBus.BusType.SESSION); + this.mpris2_root = (MprisRoot) connection.get_object (root_interface.concat(".").concat(this.owner.name.down()), + "/org/mpris/MediaPlayer2", + root_interface); + this.player = (MprisPlayer) connection.get_object (root_interface.concat(".").concat(this.owner.name.down()), + "/org/mpris/MediaPlayer2", + root_interface.concat(".Player")); + this.player.Seeked += onSeeked; + + this.properties_interface = (FreeDesktopProperties) connection.get_object(root_interface.concat(".").concat(this.owner.name.down()), + "/org/mpris/MediaPlayer2", + "org.freedesktop.DBus.Properties"); + this.properties_interface.PropertiesChanged += property_changed_cb; + + } catch (DBus.Error e) { + error("Problems connecting to the session bus - %s", e.message); + } + } + + public void property_changed_cb(string interface_source, HashTable changed_properties, string[] invalid ) + { + debug("properties-changed for interface %s", interface_source); + if(changed_properties == null || interface_source.has_prefix(this.root_interface) == false){ + warning("Property-changed hash is null or this is an interface that concerns us"); + return; + } + Value? play_v = changed_properties.lookup("PlaybackStatus"); + if(play_v != null){ + string state = play_v.get_string(); + debug("new playback state = %s", state); + int p = this.determine_play_state(state); + (this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(p); + (this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem).update_playstate(p); + } + + Value? pos_v = changed_properties.lookup("Position"); + if(pos_v != null){ + int64 pos = pos_v.get_int64(); + debug("new position = %i", (int)pos); + (this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem).update_position((int32)pos); + } + + Value? meta_v = changed_properties.lookup("Metadata"); + if(meta_v != null){ + debug("metadata is not empty"); + debug("artist : %s", this.player.Metadata.lookup("artist").get_string()); + this.owner.custom_items[PlayerController.widget_order.METADATA].reset(MetadataMenuitem.attributes_format()); + this.owner.custom_items[PlayerController.widget_order.METADATA].update(this.player.Metadata, + MetadataMenuitem.attributes_format()); + this.owner.custom_items[PlayerController.widget_order.SCRUB].reset(ScrubMenuitem.attributes_format()); + if((int)this.player.Metadata.lookup("artist").get_string().len() > 0 || + (int)this.player.Metadata.lookup("artist").get_string().len() > 0){ + this.owner.custom_items[PlayerController.widget_order.SCRUB].update(this.player.Metadata, + ScrubMenuitem.attributes_format()); + } + (this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem).update_playstate(this.determine_play_state(this.player.PlaybackStatus)); + + } + } + + private int determine_play_state(string status){ + if(status == null) + return 1; + + if(status != null && status == "Playing"){ + debug("determine play state - state = %s", status); + return 0; + } + return 1; + } + + public void initial_update() + { + int32 status; + if(this.player.PlaybackStatus == null){ + status = 1; + } + else{ + status = determine_play_state(this.player.PlaybackStatus); + } + debug("initial update - play state %i", status); + + (this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(status); + this.owner.custom_items[PlayerController.widget_order.METADATA].update(this.player.Metadata, + MetadataMenuitem.attributes_format()); + this.owner.custom_items[PlayerController.widget_order.SCRUB].update(this.player.Metadata, + ScrubMenuitem.attributes_format()); + } + + public void transport_event(TransportMenuitem.action command) + { + debug("transport_event input = %i", (int)command); + if(command == TransportMenuitem.action.PLAY_PAUSE){ + debug("transport_event PLAY_PAUSE"); + try{ + this.player.PlayPause(); + } + catch(DBus.Error error){ + warning("DBus Error calling the player objects PlayPause method %s", + error.message); + } + } + else if(command == TransportMenuitem.action.PREVIOUS){ + try{ + this.player.Previous(); + } + catch(DBus.Error error){ + warning("DBus Error calling the player objects Previous method %s", + error.message); + } + } + else if(command == TransportMenuitem.action.NEXT){ + try{ + this.player.Next(); + } + catch(DBus.Error error){ + warning("DBus Error calling the player objects Next method %s", + error.message); + } + } + } + /** + TODO: SetPosition on the player object is not working with rhythmbox, + runtime error - "dbus function not supported" + */ + public void set_position(double position) + { + debug("Set position with pos (0-100) %f", position); + HashTable data = this.player.Metadata; + Value? time_value = data.lookup("time"); + if(time_value == null){ + warning("Can't fetch the duration of the track therefore cant set the position"); + return; + } + // work in microseconds (scale up by 10 TTP-of 3) + uint32 total_time = time_value.get_uint() * 1000; + debug("total time of track = %i", (int)total_time); + double new_time_position = total_time * position/100.0; + debug("new position = %f", (new_time_position)); + + Value? v = this.player.Metadata.lookup("trackid"); + if(v != null){ + if(v.holds (typeof (string))){ + debug("the trackid = %s", v.get_string()); + DBus.ObjectPath path = new ObjectPath(v.get_string()); + try{ + //this.player.SetPosition(path, (int64)(new_time_position)); + } + catch(DBus.Error e){ + error("DBus Error calling the player objects SetPosition method %s", + e.message); + } + } + } + } + + public void onSeeked(int64 position){ + debug("Seeked signal callback with pos = %i", (int)position/1000); + ScrubMenuitem scrub = this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem; + scrub.update_position((int32)position/1000); + } + + public bool connected() + { + return (this.player != null && this.mpris2_root != null); + } + + + public bool was_successfull(){ + if(this.mpris2_root == null ||this.player == null){ + return false; + } + return true; + } + + public void expose() + { + if(this.connected() == true){ + try{ + this.mpris2_root.Raise(); + } + catch(DBus.Error e){ + error("Exception thrown while calling root function Raise - %s", e.message); + } + } + } +} + + + diff --git a/src/music-player-bridge.c b/src/music-player-bridge.c index 6579e17..3e83e7c 100644 --- a/src/music-player-bridge.c +++ b/src/music-player-bridge.c @@ -1,4 +1,4 @@ -/* music-player-bridge.c generated by valac, the Vala compiler +/* music-player-bridge.c generated by valac 0.9.5, the Vala compiler * generated from music-player-bridge.vala, do not modify */ /* @@ -129,13 +129,13 @@ GType player_controller_state_get_type (void) G_GNUC_CONST; PlayerController* player_controller_new (DbusmenuMenuitem* root, const char* client_name, gint offset, PlayerControllerstate initial_state); PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, const char* client_name, gint offset, PlayerControllerstate initial_state); static void music_player_bridge_try_to_add_inactive_familiar_clients (MusicPlayerBridge* self); -#define PLAYER_CONTROLLER_WIDGET_QUANTITY 6 +#define PLAYER_CONTROLLER_WIDGET_QUANTITY 5 static gboolean music_player_bridge_server_is_not_of_interest (MusicPlayerBridge* self, const char* type); void player_controller_update_state (PlayerController* self, PlayerControllerstate new_state); void player_controller_activate (PlayerController* self); GAppInfo* player_controller_get_app_info (PlayerController* self); static void music_player_bridge_desktop_info_callback (MusicPlayerBridge* self, IndicateListenerServer* server, char* path, void* data); -void player_controller_vanish (PlayerController* self); +void player_controller_hibernate (PlayerController* self); gboolean familiar_players_db_already_familiar (FamiliarPlayersDB* self, const char* desktop); void familiar_players_db_insert (FamiliarPlayersDB* self, const char* desktop); GAppInfo* music_player_bridge_create_app_info (const char* path); @@ -365,11 +365,9 @@ void music_player_bridge_on_server_removed (MusicPlayerBridge* self, IndicateLis } if (_tmp3_) { PlayerController* _tmp4_; - player_controller_vanish (_tmp4_ = (PlayerController*) gee_abstract_map_get ((GeeAbstractMap*) self->priv->registered_clients, client_name)); + player_controller_hibernate (_tmp4_ = (PlayerController*) gee_abstract_map_get ((GeeAbstractMap*) self->priv->registered_clients, client_name)); _g_object_unref0 (_tmp4_); - gee_map_remove ((GeeMap*) self->priv->registered_clients, client_name, NULL); - g_debug ("music-player-bridge.vala:121: Successively removed menu_item for clien" \ -"t %s from registered_clients", client_name); + g_debug ("music-player-bridge.vala:120: Successively offlined client %s", client_name); } _g_free0 (client_name); } @@ -393,7 +391,7 @@ static gboolean music_player_bridge_server_is_not_of_interest (MusicPlayerBridge return result; } if (string_contains (type, "music") == FALSE) { - g_debug ("music-player-bridge.vala:129: server is of no interest, it is not an " \ + g_debug ("music-player-bridge.vala:127: server is of no interest, it is not an " \ "music server"); result = TRUE; return result; @@ -417,7 +415,7 @@ static void music_player_bridge_desktop_info_callback (MusicPlayerBridge* self, } if (_tmp1_) { GAppInfo* app_info; - g_debug ("music-player-bridge.vala:140: About to store desktop file path: %s", path); + g_debug ("music-player-bridge.vala:138: About to store desktop file path: %s", path); familiar_players_db_insert (bridge->priv->playersDB, path); app_info = music_player_bridge_create_app_info (path); if (app_info != NULL) { @@ -427,13 +425,13 @@ static void music_player_bridge_desktop_info_callback (MusicPlayerBridge* self, PlayerController* ctrl; ctrl = (_tmp4_ = (PlayerController*) gee_abstract_map_get ((GeeAbstractMap*) bridge->priv->registered_clients, _tmp3_ = string_strip (_tmp2_ = g_utf8_strdown (g_app_info_get_name (app_info), -1))), _g_free0 (_tmp3_), _g_free0 (_tmp2_), _tmp4_); g_object_set ((GObject*) ctrl, "app_info", app_info, NULL); - g_debug ("music-player-bridge.vala:146: successfully created appinfo from path a" \ + g_debug ("music-player-bridge.vala:144: successfully created appinfo from path a" \ "nd set it on the respective instance"); _g_object_unref0 (ctrl); } _g_object_unref0 (app_info); } else { - g_debug ("music-player-bridge.vala:150: Ignoring desktop file path because its e" \ + g_debug ("music-player-bridge.vala:148: Ignoring desktop file path because its e" \ "ither invalid of the db cache file has it already: %s", path); } _g_object_unref0 (bridge); @@ -452,20 +450,20 @@ void music_player_bridge_set_root_menu_item (MusicPlayerBridge* self, DbusmenuMe void music_player_bridge_on_server_count_changed (MusicPlayerBridge* self, IndicateListenerServer* object, guint i) { g_return_if_fail (self != NULL); - g_debug ("music-player-bridge.vala:162: MusicPlayerBridge-> on_server_count_chan" \ + g_debug ("music-player-bridge.vala:160: MusicPlayerBridge-> on_server_count_chan" \ "ged with value %u", i); } void music_player_bridge_on_indicator_added (MusicPlayerBridge* self, IndicateListenerServer* object, IndicateListenerIndicator* p0) { g_return_if_fail (self != NULL); - g_debug ("music-player-bridge.vala:166: MusicPlayerBridge-> on_indicator_added"); + g_debug ("music-player-bridge.vala:164: MusicPlayerBridge-> on_indicator_added"); } void music_player_bridge_on_indicator_removed (MusicPlayerBridge* self, IndicateListenerServer* object, IndicateListenerIndicator* p0) { g_return_if_fail (self != NULL); - g_debug ("music-player-bridge.vala:171: MusicPlayerBridge -> on_indicator_remove" \ + g_debug ("music-player-bridge.vala:169: MusicPlayerBridge -> on_indicator_remove" \ "d"); } @@ -473,7 +471,7 @@ void music_player_bridge_on_indicator_removed (MusicPlayerBridge* self, Indicate void music_player_bridge_on_indicator_modified (MusicPlayerBridge* self, IndicateListenerServer* object, IndicateListenerIndicator* p0, const char* s) { g_return_if_fail (self != NULL); g_return_if_fail (s != NULL); - g_debug ("music-player-bridge.vala:176: MusicPlayerBridge -> indicator_modified " \ + g_debug ("music-player-bridge.vala:174: MusicPlayerBridge -> indicator_modified " \ "with vale %s", s); } @@ -486,7 +484,7 @@ GAppInfo* music_player_bridge_create_app_info (const char* path) { 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:183: Could not create a desktopappinfo instan" \ + g_warning ("music-player-bridge.vala:181: Could not create a desktopappinfo instan" \ "ce from app: %s", path); result = NULL; _g_object_unref0 (info); diff --git a/src/music-player-bridge.h b/src/music-player-bridge.h index 6f08b8e..1670d28 100644 --- a/src/music-player-bridge.h +++ b/src/music-player-bridge.h @@ -1,4 +1,4 @@ -/* music-player-bridge.h generated by valac, the Vala compiler, do not modify */ +/* music-player-bridge.h generated by valac 0.9.5, the Vala compiler, do not modify */ #ifndef __MUSIC_PLAYER_BRIDGE_H__ @@ -106,6 +106,21 @@ typedef struct _TitleMenuitemClass TitleMenuitemClass; typedef struct _TitleMenuitemPrivate TitleMenuitemPrivate; typedef struct _PlayerControllerPrivate PlayerControllerPrivate; +#define TYPE_MPRIS_BRIDGE (mpris_bridge_get_type ()) +#define MPRIS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_BRIDGE, MprisBridge)) +#define MPRIS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS_BRIDGE, MprisBridgeClass)) +#define IS_MPRIS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_BRIDGE)) +#define IS_MPRIS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS_BRIDGE)) +#define MPRIS_BRIDGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS_BRIDGE, MprisBridgeClass)) + +typedef struct _MprisBridge MprisBridge; +typedef struct _MprisBridgeClass MprisBridgeClass; + +#define PLAYER_CONTROLLER_TYPE_WIDGET_ORDER (player_controller_widget_order_get_type ()) + +#define PLAYER_CONTROLLER_TYPE_STATE (player_controller_state_get_type ()) +typedef struct _MprisBridgePrivate MprisBridgePrivate; + #define TYPE_MPRIS_CONTROLLER (mpris_controller_get_type ()) #define MPRIS_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_CONTROLLER, MprisController)) #define MPRIS_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS_CONTROLLER, MprisControllerClass)) @@ -115,22 +130,42 @@ typedef struct _PlayerControllerPrivate PlayerControllerPrivate; typedef struct _MprisController MprisController; typedef struct _MprisControllerClass MprisControllerClass; +typedef struct _MprisControllerPrivate MprisControllerPrivate; -#define PLAYER_CONTROLLER_TYPE_WIDGET_ORDER (player_controller_widget_order_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)) -#define PLAYER_CONTROLLER_TYPE_STATE (player_controller_state_get_type ()) -typedef struct _MprisControllerPrivate MprisControllerPrivate; +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_MPRIS_CONTROLLER_V2 (mpris_controller_v2_get_type ()) -#define MPRIS_CONTROLLER_V2(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_CONTROLLER_V2, MprisControllerV2)) -#define MPRIS_CONTROLLER_V2_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS_CONTROLLER_V2, MprisControllerV2Class)) -#define IS_MPRIS_CONTROLLER_V2(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_CONTROLLER_V2)) -#define IS_MPRIS_CONTROLLER_V2_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS_CONTROLLER_V2)) -#define MPRIS_CONTROLLER_V2_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS_CONTROLLER_V2, MprisControllerV2Class)) +#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 _MprisControllerV2 MprisControllerV2; -typedef struct _MprisControllerV2Class MprisControllerV2Class; -typedef struct _MprisControllerV2Private MprisControllerV2Private; +typedef struct _FreeDesktopProperties FreeDesktopProperties; +typedef struct _FreeDesktopPropertiesIface FreeDesktopPropertiesIface; + +#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_FAMILIAR_PLAYERS_DB (familiar_players_db_get_type ()) #define FAMILIAR_PLAYERS_DB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FAMILIAR_PLAYERS_DB, FamiliarPlayersDB)) @@ -208,7 +243,7 @@ struct _PlayerController { PlayerControllerPrivate * priv; gint current_state; GeeArrayList* custom_items; - MprisController* mpris_adaptor; + MprisBridge* mpris_bridge; }; struct _PlayerControllerClass { @@ -220,8 +255,7 @@ typedef enum { PLAYER_CONTROLLER_WIDGET_ORDER_TITLE, PLAYER_CONTROLLER_WIDGET_ORDER_METADATA, PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB, - PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT, - PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLIST + PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT } PlayerControllerwidget_order; typedef enum { @@ -232,6 +266,15 @@ typedef enum { PLAYER_CONTROLLER_STATE_DISCONNECTED } PlayerControllerstate; +struct _MprisBridge { + GObject parent_instance; + MprisBridgePrivate * priv; +}; + +struct _MprisBridgeClass { + GObjectClass parent_class; +}; + struct _MprisController { GObject parent_instance; MprisControllerPrivate * priv; @@ -241,13 +284,48 @@ struct _MprisControllerClass { GObjectClass parent_class; }; -struct _MprisControllerV2 { - MprisController parent_instance; - MprisControllerV2Private * priv; +struct _MprisRootIface { + GTypeInterface parent_iface; + void (*Quit) (MprisRoot* self, GError** error); + void (*Raise) (MprisRoot* self, 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 (*SetPosition) (MprisPlayer* self, const char* path, gint64 pos, GError** error); + void (*PlayPause) (MprisPlayer* self, GError** error); + void (*Pause) (MprisPlayer* self, GError** error); + void (*Next) (MprisPlayer* self, GError** error); + void (*Previous) (MprisPlayer* self, 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 _MprisControllerV2Class { - MprisControllerClass parent_class; +struct _FreeDesktopPropertiesIface { + GTypeInterface parent_iface; +}; + +struct _Mpris2Controller { + GObject parent_instance; + Mpris2ControllerPrivate * priv; +}; + +struct _Mpris2ControllerClass { + GObjectClass parent_class; }; struct _FamiliarPlayersDB { @@ -287,31 +365,38 @@ GType scrub_menuitem_get_type (void) G_GNUC_CONST; ScrubMenuitem* scrub_menuitem_new (PlayerController* parent); ScrubMenuitem* scrub_menuitem_construct (GType object_type, PlayerController* parent); void scrub_menuitem_update_position (ScrubMenuitem* self, gint32 new_position); +void scrub_menuitem_update_playstate (ScrubMenuitem* self, gint state); GeeHashSet* scrub_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); GeeHashSet* title_menuitem_attributes_format (void); -GType mpris_controller_get_type (void) G_GNUC_CONST; +GType mpris_bridge_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 6 +#define PLAYER_CONTROLLER_WIDGET_QUANTITY 5 PlayerController* player_controller_new (DbusmenuMenuitem* root, const char* client_name, gint offset, PlayerControllerstate initial_state); PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, const char* client_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); 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); -GType mpris_controller_v2_get_type (void) G_GNUC_CONST; -MprisControllerV2* mpris_controller_v2_new (PlayerController* ctrl, const char* inter); -MprisControllerV2* mpris_controller_v2_construct (GType object_type, PlayerController* ctrl, const char* inter); +MprisBridge* mpris_bridge_new (PlayerController* ctrl); +MprisBridge* mpris_bridge_construct (GType object_type, PlayerController* ctrl); +gboolean mpris_bridge_connected (MprisBridge* self); +void mpris_bridge_transport_update (MprisBridge* self, TransportMenuitemaction update); +void mpris_bridge_expose (MprisBridge* self); +void mpris_bridge_set_track_position (MprisBridge* self, double pos); +GType mpris_controller_get_type (void) G_GNUC_CONST; MprisController* mpris_controller_new (PlayerController* ctrl, const char* inter); MprisController* mpris_controller_construct (GType object_type, PlayerController* ctrl, const char* inter); void mpris_controller_transport_event (MprisController* self, TransportMenuitemaction command); @@ -320,6 +405,51 @@ gboolean mpris_controller_connected (MprisController* self); DBusGProxy* mpris_controller_get_mpris_player (MprisController* self); PlayerController* mpris_controller_get_owner (MprisController* self); const char* mpris_controller_get_mpris_interface (MprisController* self); +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, GError** error); +void mpris_root_Raise (MprisRoot* self, 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_SetPosition (MprisPlayer* self, const char* path, gint64 pos, GError** error); +void mpris_player_PlayPause (MprisPlayer* self, GError** error); +void mpris_player_Pause (MprisPlayer* self, GError** error); +void mpris_player_Next (MprisPlayer* self, GError** error); +void mpris_player_Previous (MprisPlayer* self, 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); +GType mpris2_controller_get_type (void) G_GNUC_CONST; +#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_event (Mpris2Controller* self, TransportMenuitemaction command); +void mpris2_controller_set_position (Mpris2Controller* self, double position); +void mpris2_controller_onSeeked (Mpris2Controller* self, gint64 position); +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); diff --git a/src/music-player-bridge.vala b/src/music-player-bridge.vala index 352ea7f..daad42f 100644 --- a/src/music-player-bridge.vala +++ b/src/music-player-bridge.vala @@ -116,10 +116,8 @@ public class MusicPlayerBridge : GLib.Object if(server_is_not_of_interest(type)) return; string client_name = type.split(".")[1]; if (root_menu != null && client_name != null){ - registered_clients[client_name].vanish(); - registered_clients.remove(client_name); - debug("Successively removed menu_item for client %s from registered_clients", - client_name); + registered_clients[client_name].hibernate(); + debug("Successively offlined client %s", client_name); } } diff --git a/src/play-button.c b/src/play-button.c index e4382c1..2f3a553 100644 --- a/src/play-button.c +++ b/src/play-button.c @@ -28,7 +28,7 @@ Uses code from ctk #include "play-button.h" #define RECT_WIDTH 130.0f -#define Y 5.0f +#define Y 7.0f #define X 37.0f #define INNER_RADIUS 12.5 #define MIDDLE_RADIUS 13.5f @@ -42,16 +42,16 @@ Uses code from ctk #define TRI_HEIGHT 13.0f #define TRI_OFFSET 6.0f #define PREV_X 35.0f -#define PREV_Y 11.0f +#define PREV_Y 13.0f #define NEXT_X 113.0f -#define NEXT_Y 11.0f //prev_y +#define NEXT_Y 13.0f //prev_y #define PAUSE_WIDTH 21.0f #define PAUSE_HEIGHT 27.0f #define BAR_WIDTH 4.5f #define BAR_HEIGHT 24.0f #define BAR_OFFSET 10.0f #define PAUSE_X 78.0f -#define PAUSE_Y 5.0f +#define PAUSE_Y 7.0f #define PLAY_WIDTH 28.0f #define PLAY_HEIGHT 29.0f #define PLAY_PADDING 5.0f @@ -454,29 +454,8 @@ void play_button_toggle_play_pause(GtkWidget* button, PlayButtonState update) { PlayButtonPrivate* priv = PLAY_BUTTON_GET_PRIVATE(button); - gboolean changed = priv->current_state != update; priv->current_state = update; g_debug("PlayButton::toggle play state : %i", priv->current_state); - - if(changed == TRUE){ - g_debug("Toggle play pause - changed of state detected - redraw button"); - cairo_t *cr; - - cr = gdk_cairo_create (button->window); - - GList* list = g_hash_table_lookup(priv->command_coordinates, - GINT_TO_POINTER(TRANSPORT_PLAY_PAUSE)); - - cairo_rectangle(cr, - GPOINTER_TO_INT(g_list_nth_data(list, 0)), - GPOINTER_TO_INT(g_list_nth_data(list, 1)), - GPOINTER_TO_INT(g_list_nth_data(list, 2)), - GPOINTER_TO_INT(g_list_nth_data(list, 3))); - - cairo_clip(cr); - draw (button, cr); - cairo_destroy (cr); - } } diff --git a/src/player-controller.c b/src/player-controller.c index 55b097f..39189f3 100644 --- a/src/player-controller.c +++ b/src/player-controller.c @@ -1,4 +1,4 @@ -/* player-controller.c generated by valac, the Vala compiler +/* player-controller.c generated by valac 0.9.5, the Vala compiler * generated from player-controller.vala, do not modify */ /* @@ -54,15 +54,15 @@ typedef struct _PlayerControllerPrivate PlayerControllerPrivate; typedef struct _PlayerItem PlayerItem; typedef struct _PlayerItemClass PlayerItemClass; -#define TYPE_MPRIS_CONTROLLER (mpris_controller_get_type ()) -#define MPRIS_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_CONTROLLER, MprisController)) -#define MPRIS_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS_CONTROLLER, MprisControllerClass)) -#define IS_MPRIS_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_CONTROLLER)) -#define IS_MPRIS_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS_CONTROLLER)) -#define MPRIS_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS_CONTROLLER, MprisControllerClass)) +#define TYPE_MPRIS_BRIDGE (mpris_bridge_get_type ()) +#define MPRIS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_BRIDGE, MprisBridge)) +#define MPRIS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS_BRIDGE, MprisBridgeClass)) +#define IS_MPRIS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_BRIDGE)) +#define IS_MPRIS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS_BRIDGE)) +#define MPRIS_BRIDGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS_BRIDGE, MprisBridgeClass)) -typedef struct _MprisController MprisController; -typedef struct _MprisControllerClass MprisControllerClass; +typedef struct _MprisBridge MprisBridge; +typedef struct _MprisBridgeClass MprisBridgeClass; #define PLAYER_CONTROLLER_TYPE_WIDGET_ORDER (player_controller_widget_order_get_type ()) @@ -116,7 +116,7 @@ struct _PlayerController { PlayerControllerPrivate * priv; gint current_state; GeeArrayList* custom_items; - MprisController* mpris_adaptor; + MprisBridge* mpris_bridge; }; struct _PlayerControllerClass { @@ -135,8 +135,7 @@ typedef enum { PLAYER_CONTROLLER_WIDGET_ORDER_TITLE, PLAYER_CONTROLLER_WIDGET_ORDER_METADATA, PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB, - PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT, - PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLIST + PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT } PlayerControllerwidget_order; typedef enum { @@ -152,7 +151,7 @@ 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 mpris_controller_get_type (void) G_GNUC_CONST; +GType mpris_bridge_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, @@ -162,7 +161,7 @@ enum { }; GType player_controller_widget_order_get_type (void) G_GNUC_CONST; GType player_controller_state_get_type (void) G_GNUC_CONST; -#define PLAYER_CONTROLLER_WIDGET_QUANTITY 6 +#define PLAYER_CONTROLLER_WIDGET_QUANTITY 5 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_menu_offset (PlayerController* self, gint value); @@ -176,13 +175,16 @@ void player_controller_update_state (PlayerController* self, PlayerControllersta void player_controller_activate (PlayerController* self); GAppInfo* player_controller_get_app_info (PlayerController* self); void player_controller_instantiate (PlayerController* self); -MprisController* mpris_controller_new (PlayerController* ctrl, const char* inter); -MprisController* mpris_controller_construct (GType object_type, PlayerController* ctrl, const char* inter); -gboolean mpris_controller_connected (MprisController* self); +MprisBridge* mpris_bridge_new (PlayerController* ctrl); +MprisBridge* mpris_bridge_construct (GType object_type, PlayerController* ctrl); +void player_controller_determine_state (PlayerController* self); void player_controller_vanish (PlayerController* self); -gboolean player_item_populated (PlayerItem* self, GeeHashSet* attrs); +void player_item_reset (PlayerItem* self, GeeHashSet* attrs); +GeeHashSet* transport_menuitem_attributes_format (void); GeeHashSet* metadata_menuitem_attributes_format (void); GeeHashSet* scrub_menuitem_attributes_format (void); +void player_controller_hibernate (PlayerController* self); +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); @@ -197,20 +199,19 @@ GType scrub_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; -static PlayerItem* player_controller_create_playlist (PlayerController* self); gint player_controller_get_menu_offset (PlayerController* self); +gboolean mpris_bridge_connected (MprisBridge* 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); -static int _vala_strcmp0 (const char * str1, const char * str2); 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_SCRUB, "PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB", "scrub"}, {PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT, "PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT", "transport"}, {PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLIST, "PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLIST", "playlist"}, {0, NULL, NULL}}; + static const GEnumValue values[] = {{PLAYER_CONTROLLER_WIDGET_ORDER_SEPARATOR, "PLAYER_CONTROLLER_WIDGET_ORDER_SEPARATOR", "separator"}, {PLAYER_CONTROLLER_WIDGET_ORDER_TITLE, "PLAYER_CONTROLLER_WIDGET_ORDER_TITLE", "title"}, {PLAYER_CONTROLLER_WIDGET_ORDER_METADATA, "PLAYER_CONTROLLER_WIDGET_ORDER_METADATA", "metadata"}, {PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB, "PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB", "scrub"}, {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); @@ -277,7 +278,7 @@ PlayerController* player_controller_new (DbusmenuMenuitem* root, const char* cli void player_controller_update_state (PlayerController* self, PlayerControllerstate new_state) { g_return_if_fail (self != NULL); - g_debug ("player-controller.vala:69: update_state - player controller %s : new s" \ + g_debug ("player-controller.vala:67: 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); @@ -285,11 +286,8 @@ void player_controller_update_state (PlayerController* self, PlayerControllersta void player_controller_activate (PlayerController* self) { - PlayerItem* _tmp0_; g_return_if_fail (self != NULL); player_controller_establish_mpris_connection (self); - dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp0_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA)), DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); - _g_object_unref0 (_tmp0_); } @@ -297,7 +295,7 @@ void player_controller_instantiate (PlayerController* self) { GError * _inner_error_; g_return_if_fail (self != NULL); _inner_error_ = NULL; - g_debug ("player-controller.vala:88: instantiate in player controller for %s", self->priv->_name); + g_debug ("player-controller.vala:85: 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) { @@ -312,7 +310,7 @@ void player_controller_instantiate (PlayerController* self) { _error_ = _inner_error_; _inner_error_ = NULL; { - g_warning ("player-controller.vala:94: Failed to launch app %s with error message:" \ + g_warning ("player-controller.vala:91: Failed to launch app %s with error message:" \ " %s", self->priv->_name, _error_->message); _g_error_free0 (_error_); } @@ -327,26 +325,15 @@ void player_controller_instantiate (PlayerController* self) { static void player_controller_establish_mpris_connection (PlayerController* self) { + MprisBridge* _tmp0_; g_return_if_fail (self != NULL); if (self->current_state != PLAYER_CONTROLLER_STATE_READY) { - g_debug ("player-controller.vala:101: establish_mpris_connection - Not ready to " \ -"connect"); + g_debug ("player-controller.vala:98: establish_mpris_connection - Not ready to c" \ +"onnect"); return; } - if (_vala_strcmp0 (self->priv->_name, "Vlc") == 0) { - MprisController* _tmp0_; - g_debug ("player-controller.vala:106: establishing a vlc mpris controller"); - self->mpris_adaptor = (_tmp0_ = mpris_controller_new (self, "org.mpris.MediaPlayer.Player"), _g_object_unref0 (self->mpris_adaptor), _tmp0_); - } else { - MprisController* _tmp1_; - self->mpris_adaptor = (_tmp1_ = mpris_controller_new (self, "org.freedesktop.MediaPlayer"), _g_object_unref0 (self->mpris_adaptor), _tmp1_); - } - if (mpris_controller_connected (self->mpris_adaptor) == TRUE) { - g_debug ("player-controller.vala:114: yup I'm connected"); - player_controller_update_state (self, PLAYER_CONTROLLER_STATE_CONNECTED); - } else { - player_controller_update_state (self, PLAYER_CONTROLLER_STATE_DISCONNECTED); - } + self->mpris_bridge = (_tmp0_ = mpris_bridge_new (self), _g_object_unref0 (self->mpris_bridge), _tmp0_); + player_controller_determine_state (self); } @@ -369,69 +356,58 @@ void player_controller_vanish (PlayerController* 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_controller_hibernate (PlayerController* self) { + GeeHashSet* _tmp1_; + PlayerItem* _tmp0_; + GeeHashSet* _tmp3_; + PlayerItem* _tmp2_; + GeeHashSet* _tmp5_; + PlayerItem* _tmp4_; + 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_); + player_item_reset (_tmp4_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), _tmp5_ = scrub_menuitem_attributes_format ()); + _g_object_unref0 (_tmp5_); + _g_object_unref0 (_tmp4_); } void player_controller_update_layout (PlayerController* self) { - char* _tmp6_; GeeHashSet* _tmp5_; PlayerItem* _tmp4_; - GeeHashSet* _tmp9_; - PlayerItem* _tmp8_; + PlayerItem* _tmp3_; + GeeHashSet* _tmp8_; PlayerItem* _tmp7_; - char* _tmp12_; - GeeHashSet* _tmp11_; - PlayerItem* _tmp10_; - GeeHashSet* _tmp15_; - PlayerItem* _tmp14_; - PlayerItem* _tmp13_; - PlayerItem* _tmp16_; - PlayerItem* _tmp17_; + PlayerItem* _tmp6_; + PlayerItem* _tmp9_; g_return_if_fail (self != NULL); if (self->current_state != PLAYER_CONTROLLER_STATE_CONNECTED) { PlayerItem* _tmp0_; PlayerItem* _tmp1_; PlayerItem* _tmp2_; - PlayerItem* _tmp3_; 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_SCRUB)), DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE); _g_object_unref0 (_tmp1_); 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, FALSE); _g_object_unref0 (_tmp2_); - dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp3_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLIST)), DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE); - _g_object_unref0 (_tmp3_); return; } - g_debug ("player-controller.vala:143: update layout - metadata %s", _tmp6_ = bool_to_string (player_item_populated (_tmp4_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), _tmp5_ = metadata_menuitem_attributes_format ()))); - _g_free0 (_tmp6_); + dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp3_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA)), DBUSMENU_MENUITEM_PROP_VISIBLE, player_item_populated (_tmp4_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), _tmp5_ = metadata_menuitem_attributes_format ())); _g_object_unref0 (_tmp5_); _g_object_unref0 (_tmp4_); - dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp7_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA)), DBUSMENU_MENUITEM_PROP_VISIBLE, player_item_populated (_tmp8_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), _tmp9_ = metadata_menuitem_attributes_format ())); - _g_object_unref0 (_tmp9_); + _g_object_unref0 (_tmp3_); + dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp6_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB)), DBUSMENU_MENUITEM_PROP_VISIBLE, player_item_populated (_tmp7_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), _tmp8_ = scrub_menuitem_attributes_format ())); _g_object_unref0 (_tmp8_); _g_object_unref0 (_tmp7_); - g_debug ("player-controller.vala:146: update layout - scrub %s", _tmp12_ = bool_to_string (player_item_populated (_tmp10_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), _tmp11_ = scrub_menuitem_attributes_format ()))); - _g_free0 (_tmp12_); - _g_object_unref0 (_tmp11_); - _g_object_unref0 (_tmp10_); - dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp13_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB)), DBUSMENU_MENUITEM_PROP_VISIBLE, player_item_populated (_tmp14_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), _tmp15_ = scrub_menuitem_attributes_format ())); - _g_object_unref0 (_tmp15_); - _g_object_unref0 (_tmp14_); - _g_object_unref0 (_tmp13_); - dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp16_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT)), DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); - _g_object_unref0 (_tmp16_); - dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp17_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLIST)), DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); - _g_object_unref0 (_tmp17_); + _g_object_unref0 (_tmp6_); + dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp9_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT)), DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); + _g_object_unref0 (_tmp9_); } @@ -441,7 +417,6 @@ static void player_controller_construct_widgets (PlayerController* self) { MetadataMenuitem* metadata_item; ScrubMenuitem* scrub_item; TransportMenuitem* transport_item; - PlayerItem* _tmp1_; 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_); @@ -453,8 +428,6 @@ static void player_controller_construct_widgets (PlayerController* self) { gee_abstract_collection_add ((GeeAbstractCollection*) self->custom_items, (PlayerItem*) scrub_item); transport_item = transport_menuitem_new (self); gee_abstract_collection_add ((GeeAbstractCollection*) self->custom_items, (PlayerItem*) transport_item); - gee_abstract_collection_add ((GeeAbstractCollection*) self->custom_items, _tmp1_ = player_controller_create_playlist (self)); - _g_object_unref0 (_tmp1_); { GeeIterator* _item_it; _item_it = gee_abstract_collection_iterator ((GeeAbstractCollection*) self->custom_items); @@ -476,32 +449,6 @@ static void player_controller_construct_widgets (PlayerController* self) { } -static PlayerItem* player_controller_create_playlist (PlayerController* self) { - PlayerItem* result = NULL; - PlayerItem* playlist_root; - PlayerItem* subentry_1; - PlayerItem* subentry_2; - PlayerItem* subentry_3; - g_return_val_if_fail (self != NULL, NULL); - playlist_root = player_item_new (DBUSMENU_CLIENT_TYPES_DEFAULT); - dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) playlist_root, DBUSMENU_MENUITEM_PROP_LABEL, "Choose Playlist"); - subentry_1 = player_item_new (DBUSMENU_CLIENT_TYPES_DEFAULT); - dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) subentry_1, DBUSMENU_MENUITEM_PROP_LABEL, "Raster-noton selection"); - subentry_2 = player_item_new (DBUSMENU_CLIENT_TYPES_DEFAULT); - dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) subentry_2, DBUSMENU_MENUITEM_PROP_LABEL, "Rune Grammofon selection"); - subentry_3 = player_item_new (DBUSMENU_CLIENT_TYPES_DEFAULT); - dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) subentry_3, DBUSMENU_MENUITEM_PROP_LABEL, "Kranky selection"); - dbusmenu_menuitem_child_append ((DbusmenuMenuitem*) playlist_root, (DbusmenuMenuitem*) subentry_1); - dbusmenu_menuitem_child_append ((DbusmenuMenuitem*) playlist_root, (DbusmenuMenuitem*) subentry_2); - dbusmenu_menuitem_child_append ((DbusmenuMenuitem*) playlist_root, (DbusmenuMenuitem*) subentry_3); - result = playlist_root; - _g_object_unref0 (subentry_3); - _g_object_unref0 (subentry_2); - _g_object_unref0 (subentry_1); - return result; -} - - static char* string_slice (const char* self, glong start, glong end) { char* result = NULL; glong string_length; @@ -547,7 +494,7 @@ static char* player_controller_format_client_name (const char* client_name) { formatted = (_tmp2_ = g_strconcat (_tmp0_ = g_utf8_strup (client_name, (gssize) 1), _tmp1_ = string_slice (client_name, (glong) 1, g_utf8_strlen (client_name, -1)), NULL), _g_free0 (formatted), _tmp2_); _g_free0 (_tmp1_); _g_free0 (_tmp0_); - g_debug ("player-controller.vala:212: PlayerController->format_client_name - : %" \ + g_debug ("player-controller.vala:171: PlayerController->format_client_name - : %" \ "s", formatted); } result = formatted; @@ -555,6 +502,16 @@ static char* player_controller_format_client_name (const char* client_name) { } +void player_controller_determine_state (PlayerController* self) { + g_return_if_fail (self != NULL); + if (mpris_bridge_connected (self->mpris_bridge) == TRUE) { + player_controller_update_state (self, PLAYER_CONTROLLER_STATE_CONNECTED); + } 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); @@ -626,7 +583,7 @@ static void player_controller_finalize (GObject* obj) { _g_object_unref0 (self->priv->root_menu); _g_free0 (self->priv->_name); _g_object_unref0 (self->custom_items); - _g_object_unref0 (self->mpris_adaptor); + _g_object_unref0 (self->mpris_bridge); _g_object_unref0 (self->priv->_app_info); G_OBJECT_CLASS (player_controller_parent_class)->finalize (obj); } @@ -684,16 +641,5 @@ static void player_controller_set_property (GObject * object, guint property_id, } -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); -} - - diff --git a/src/player-controller.vala b/src/player-controller.vala index fc5ca9b..2aa4382 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -23,7 +23,7 @@ using Gee; public class PlayerController : GLib.Object { - public const int WIDGET_QUANTITY = 6; + public const int WIDGET_QUANTITY = 5; public static enum widget_order{ SEPARATOR, @@ -31,7 +31,6 @@ public class PlayerController : GLib.Object METADATA, SCRUB, TRANSPORT, - PLAYLIST } public enum state{ @@ -43,12 +42,11 @@ public class PlayerController : GLib.Object } public int current_state = state.OFFLINE; - - + private Dbusmenu.Menuitem root_menu; public string name { get; set;} public ArrayList custom_items; - public MprisController mpris_adaptor; + public MprisBridge mpris_bridge; public AppInfo? app_info { get; set;} public int menu_offset { get; set;} @@ -74,7 +72,6 @@ public class PlayerController : GLib.Object public void activate() { this.establish_mpris_connection(); - this.custom_items[widget_order.METADATA].property_set_bool(MENUITEM_PROP_VISIBLE, true); } /* @@ -100,23 +97,9 @@ public class PlayerController : GLib.Object if(this.current_state != state.READY){ debug("establish_mpris_connection - Not ready to connect"); return; - } - - if(this.name == "Vlc"){ - debug("establishing a vlc mpris controller"); - this.mpris_adaptor = new MprisController(this, "org.mpris.MediaPlayer.Player"); - } - else{ - this.mpris_adaptor = new MprisController(this); - } - // TODO refactor - if(this.mpris_adaptor.connected() == true){ - debug("yup I'm connected"); - this.update_state(state.CONNECTED); - } - else{ - this.update_state(state.DISCONNECTED); - } + } + this.mpris_bridge = new MprisBridge(this); + this.determine_state(); } public void vanish() @@ -126,8 +109,17 @@ public class PlayerController : GLib.Object } } + public void hibernate() + { + update_state(PlayerController.state.OFFLINE); + this.custom_items[widget_order.TRANSPORT].reset(TransportMenuitem.attributes_format()); + this.custom_items[widget_order.METADATA].reset(MetadataMenuitem.attributes_format()); + this.custom_items[widget_order.SCRUB].reset(ScrubMenuitem.attributes_format()); + } + public void update_layout() - { + { + if(this.current_state != state.CONNECTED){ this.custom_items[widget_order.TRANSPORT].property_set_bool(MENUITEM_PROP_VISIBLE, false); @@ -135,24 +127,14 @@ public class PlayerController : GLib.Object false); this.custom_items[widget_order.METADATA].property_set_bool(MENUITEM_PROP_VISIBLE, false); - this.custom_items[widget_order.PLAYLIST].property_set_bool(MENUITEM_PROP_VISIBLE, - false); - return; + return; } - - debug("update layout - metadata %s", this.custom_items[widget_order.METADATA].populated(MetadataMenuitem.attributes_format()).to_string()); this.custom_items[widget_order.METADATA].property_set_bool(MENUITEM_PROP_VISIBLE, - this.custom_items[widget_order.METADATA].populated(MetadataMenuitem.attributes_format())); - debug("update layout - scrub %s", this.custom_items[widget_order.SCRUB].populated(ScrubMenuitem.attributes_format()).to_string()); + this.custom_items[widget_order.METADATA].populated(MetadataMenuitem.attributes_format())); this.custom_items[widget_order.SCRUB].property_set_bool(MENUITEM_PROP_VISIBLE, this.custom_items[widget_order.SCRUB].populated(ScrubMenuitem.attributes_format())); - - this.custom_items[widget_order.TRANSPORT].property_set_bool(MENUITEM_PROP_VISIBLE, true); - - this.custom_items[widget_order.PLAYLIST].property_set_bool(MENUITEM_PROP_VISIBLE, - true); } private void construct_widgets() @@ -175,34 +157,11 @@ public class PlayerController : GLib.Object // Transport item TransportMenuitem transport_item = new TransportMenuitem(this); this.custom_items.add(transport_item); - - this.custom_items.add(create_playlist()); - + foreach(PlayerItem item in this.custom_items){ root_menu.child_add_position(item, this.menu_offset + this.custom_items.index_of(item)); } } - - private PlayerItem create_playlist() - { - PlayerItem playlist_root = new PlayerItem(CLIENT_TYPES_DEFAULT); - playlist_root.property_set(MENUITEM_PROP_LABEL, "Choose Playlist"); - - PlayerItem subentry_1 = new PlayerItem(CLIENT_TYPES_DEFAULT); - subentry_1.property_set(MENUITEM_PROP_LABEL, "Raster-noton selection"); - - PlayerItem subentry_2 = new PlayerItem(CLIENT_TYPES_DEFAULT); - subentry_2.property_set(MENUITEM_PROP_LABEL, "Rune Grammofon selection"); - - PlayerItem subentry_3 = new PlayerItem(CLIENT_TYPES_DEFAULT); - subentry_3.property_set(MENUITEM_PROP_LABEL, "Kranky selection"); - - playlist_root.child_append(subentry_1); - playlist_root.child_append(subentry_2); - playlist_root.child_append(subentry_3); - - return playlist_root; - } private static string format_client_name(string client_name) { @@ -214,4 +173,16 @@ public class PlayerController : GLib.Object return formatted; } + // Temporarily we will need to handle to different mpris implemenations + // Do it for now - a couple of weeks should see this messy carry on out of + // the codebase. + public void determine_state() + { + if(this.mpris_bridge.connected() == true){ + this.update_state(state.CONNECTED); + } + else{ + this.update_state(state.DISCONNECTED); + } + } } \ No newline at end of file diff --git a/src/player-item.c b/src/player-item.c index 301fb33..74d3e2f 100644 --- a/src/player-item.c +++ b/src/player-item.c @@ -1,4 +1,4 @@ -/* player-item.c generated by valac, the Vala compiler +/* player-item.c generated by valac 0.9.5, the Vala compiler * generated from player-item.vala, do not modify */ /* @@ -165,6 +165,18 @@ static gboolean string_contains (const char* self, const char* needle) { } +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) { GError * _inner_error_; g_return_if_fail (self != NULL); @@ -212,7 +224,7 @@ void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attribu _tmp6_ = (_tmp5_ = g_filename_from_uri (_tmp4_ = string_strip (update), NULL, &_inner_error_), _g_free0 (_tmp4_), _tmp5_); if (_inner_error_ != NULL) { if (_inner_error_->domain == G_CONVERT_ERROR) { - goto __catch2_g_convert_error; + goto __catch8_g_convert_error; } _g_free0 (update); _g_free0 (v); @@ -226,8 +238,8 @@ void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attribu } update = (_tmp7_ = _tmp6_, _g_free0 (update), _tmp7_); } - goto __finally2; - __catch2_g_convert_error: + goto __finally8; + __catch8_g_convert_error: { GError * e; e = _inner_error_; @@ -237,7 +249,7 @@ void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attribu _g_error_free0 (e); } } - __finally2: + __finally8: if (_inner_error_ != NULL) { _g_free0 (update); _g_free0 (v); @@ -262,6 +274,9 @@ void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attribu dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, property, (gint) g_value_get_uint (v)); } else { if (G_VALUE_HOLDS (v, G_TYPE_BOOLEAN)) { + char* _tmp8_; + g_debug ("player-item.vala:82: with value : %s", _tmp8_ = bool_to_string (g_value_get_boolean (v))); + _g_free0 (_tmp8_); dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) self, property, g_value_get_boolean (v)); } } @@ -295,7 +310,7 @@ gboolean player_item_populated (PlayerItem* self, GeeHashSet* attrs) { } prop = (char*) gee_iterator_get (_prop_it); value_int = dbusmenu_menuitem_property_get_int ((DbusmenuMenuitem*) self, prop); - g_debug ("player-item.vala:94: populate - prop %s and value %i", prop, value_int); + g_debug ("player-item.vala:96: populate - 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); diff --git a/src/player-item.vala b/src/player-item.vala index 288ac47..e5d8bfc 100644 --- a/src/player-item.vala +++ b/src/player-item.vala @@ -79,9 +79,11 @@ public class PlayerItem : Dbusmenu.Menuitem this.property_set_int(property, (int)v.get_uint()); } else if(v.holds (typeof (bool))){ + debug("with value : %s", v.get_boolean().to_string()); this.property_set_bool(property, v.get_boolean()); } } + if(this.property_get_bool(MENUITEM_PROP_VISIBLE) == false){ this.property_set_bool(MENUITEM_PROP_VISIBLE, true); } diff --git a/src/pulse-manager.c b/src/pulse-manager.c index a9a47e4..4ff9e1d 100644 --- a/src/pulse-manager.c +++ b/src/pulse-manager.c @@ -211,7 +211,8 @@ static void mute_each_sink(gpointer key, gpointer value, gpointer user_data) if (GPOINTER_TO_INT(user_data) == 1) { sound_service_dbus_update_sink_mute(dbus_service, TRUE); } else { - sound_service_dbus_update_sink_volume(dbus_service, get_default_sink_volume()); + //sound_service_dbus_update_sink_volume(dbus_service, get_default_sink_volume()); + dbus_menu_manager_update_volume(get_default_sink_volume()); } /* g_debug("in the pulse manager: mute each sink %i", GPOINTER_TO_INT(user_data));*/ @@ -288,7 +289,7 @@ static void context_success_callback(pa_context *c, int success, void *userdata) /** On Service startup this callback will be called multiple times resulting our sinks_hash container to be filled with the available sinks. -For now this callback it assumes it only used at startup. It may be necessary to use if sinks become available after startup. +For now this callback assumes it only used at startup. It may be necessary to use if sinks become available after startup. Major candidate for refactoring. **/ static void pulse_sink_info_callback(pa_context *c, const pa_sink_info *sink, int eol, void *userdata) @@ -399,7 +400,7 @@ static void update_sink_info(pa_context *c, const pa_sink_info *info, int eol, v pa_volume_t vol = pa_cvolume_max(&s->volume); gdouble volume_percent = ((gdouble) vol * 100) / PA_VOLUME_NORM; /* g_debug("Updating volume from PA manager with volume = %f", volume_percent);*/ - sound_service_dbus_update_sink_volume(dbus_service, volume_percent); + dbus_menu_manager_update_volume(volume_percent); } if (mute_changed == TRUE) { @@ -410,7 +411,8 @@ static void update_sink_info(pa_context *c, const pa_sink_info *info, int eol, v pa_volume_t vol = pa_cvolume_max(&s->volume); gdouble volume_percent = ((gdouble) vol * 100) / PA_VOLUME_NORM; /* g_debug("Updating volume from PA manager with volume = %f", volume_percent);*/ - sound_service_dbus_update_sink_volume(dbus_service, volume_percent); + //sound_service_dbus_update_sink_volume(dbus_service, volume_percent); + dbus_menu_manager_update_volume(volume_percent); } } } diff --git a/src/scrub-menu-item.c b/src/scrub-menu-item.c index 4cb0f02..f31b24e 100644 --- a/src/scrub-menu-item.c +++ b/src/scrub-menu-item.c @@ -1,4 +1,4 @@ -/* scrub-menu-item.c generated by valac, the Vala compiler +/* scrub-menu-item.c generated by valac 0.9.5, the Vala compiler * generated from scrub-menu-item.vala, do not modify */ /* @@ -68,15 +68,15 @@ typedef struct _PlayerController PlayerController; typedef struct _PlayerControllerClass PlayerControllerClass; typedef struct _PlayerControllerPrivate PlayerControllerPrivate; -#define TYPE_MPRIS_CONTROLLER (mpris_controller_get_type ()) -#define MPRIS_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_CONTROLLER, MprisController)) -#define MPRIS_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS_CONTROLLER, MprisControllerClass)) -#define IS_MPRIS_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_CONTROLLER)) -#define IS_MPRIS_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS_CONTROLLER)) -#define MPRIS_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS_CONTROLLER, MprisControllerClass)) +#define TYPE_MPRIS_BRIDGE (mpris_bridge_get_type ()) +#define MPRIS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_BRIDGE, MprisBridge)) +#define MPRIS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS_BRIDGE, MprisBridgeClass)) +#define IS_MPRIS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_BRIDGE)) +#define IS_MPRIS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS_BRIDGE)) +#define MPRIS_BRIDGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS_BRIDGE, MprisBridgeClass)) -typedef struct _MprisController MprisController; -typedef struct _MprisControllerClass MprisControllerClass; +typedef struct _MprisBridge MprisBridge; +typedef struct _MprisBridgeClass MprisBridgeClass; struct _PlayerItem { DbusmenuMenuitem parent_instance; @@ -101,7 +101,7 @@ struct _PlayerController { PlayerControllerPrivate * priv; gint current_state; GeeArrayList* custom_items; - MprisController* mpris_adaptor; + MprisBridge* mpris_bridge; }; struct _PlayerControllerClass { @@ -123,10 +123,11 @@ ScrubMenuitem* scrub_menuitem_new (PlayerController* parent); ScrubMenuitem* scrub_menuitem_construct (GType object_type, PlayerController* parent); PlayerController* player_item_get_owner (PlayerItem* self); const char* player_controller_get_name (PlayerController* self); -GType mpris_controller_get_type (void) G_GNUC_CONST; -void mpris_controller_set_position (MprisController* self, double position); +GType mpris_bridge_get_type (void) G_GNUC_CONST; +void mpris_bridge_set_track_position (MprisBridge* self, double pos); static void scrub_menuitem_real_handle_event (DbusmenuMenuitem* base, const char* name, GValue* input_value, guint timestamp); void scrub_menuitem_update_position (ScrubMenuitem* self, gint32 new_position); +void scrub_menuitem_update_playstate (ScrubMenuitem* self, gint state); @@ -151,7 +152,7 @@ static void scrub_menuitem_real_handle_event (DbusmenuMenuitem* base, const char self = (ScrubMenuitem*) base; g_return_if_fail (name != NULL); g_debug ("scrub-menu-item.vala:34: handle_event for owner %s with value: %f", player_controller_get_name (player_item_get_owner ((PlayerItem*) self)), g_value_get_double (input_value)); - mpris_controller_set_position (player_item_get_owner ((PlayerItem*) self)->mpris_adaptor, g_value_get_double (input_value)); + mpris_bridge_set_track_position (player_item_get_owner ((PlayerItem*) self)->mpris_bridge, g_value_get_double (input_value)); } @@ -161,6 +162,12 @@ void scrub_menuitem_update_position (ScrubMenuitem* self, gint32 new_position) { } +void scrub_menuitem_update_playstate (ScrubMenuitem* self, gint state) { + g_return_if_fail (self != NULL); + dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, DBUSMENU_SCRUB_MENUITEM_PLAY_STATE, state); +} + + GeeHashSet* scrub_menuitem_attributes_format (void) { GeeHashSet* result = NULL; GeeHashSet* attrs; diff --git a/src/scrub-menu-item.vala b/src/scrub-menu-item.vala index ca81c38..7368a0c 100644 --- a/src/scrub-menu-item.vala +++ b/src/scrub-menu-item.vala @@ -32,13 +32,18 @@ public class ScrubMenuitem : PlayerItem 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_adaptor.set_position(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 attributes_format() { diff --git a/src/scrub-widget.c b/src/scrub-widget.c index 52d7b83..a1d45d5 100644 --- a/src/scrub-widget.c +++ b/src/scrub-widget.c @@ -174,7 +174,7 @@ 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); diff --git a/src/scrub-widget.h b/src/scrub-widget.h index cebe890..e518a80 100644 --- a/src/scrub-widget.h +++ b/src/scrub-widget.h @@ -21,7 +21,7 @@ with this program. If not, see . #include #include -#include +#include G_BEGIN_DECLS diff --git a/src/slider-menu-item.c b/src/slider-menu-item.c index d56422a..77c8635 100644 --- a/src/slider-menu-item.c +++ b/src/slider-menu-item.c @@ -79,7 +79,6 @@ slider_menu_item_finalize (GObject *object) static void handle_event (DbusmenuMenuitem * mi, const gchar * name, const GValue * value, guint timestamp) { - g_debug("in the handle event method of slider_menu_item"); gdouble volume_input = 0; volume_input = g_value_get_double(value); if (value != NULL) @@ -90,9 +89,11 @@ handle_event (DbusmenuMenuitem * mi, const gchar * name, const GValue * value, g SliderMenuItem* slider_menu_item_new(gboolean sinks_available, gdouble start_volume) { + SliderMenuItem *self = g_object_new(SLIDER_MENU_ITEM_TYPE, NULL); - dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_SLIDER_MENUITEM_TYPE); - dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_ENABLED, sinks_available); + dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_VOLUME_MENUITEM_TYPE); + + dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_ENABLED, sinks_available); dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_VISIBLE, sinks_available); return self; } diff --git a/src/sound-service-client.h b/src/sound-service-client.h index b3d50da..ab1acd1 100644 --- a/src/sound-service-client.h +++ b/src/sound-service-client.h @@ -21,81 +21,6 @@ _dbus_glib_async_data_free (gpointer stuff) #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_set_sink_volume (DBusGProxy *proxy, const guint IN_volume_percent, GError **error) - -{ - return dbus_g_proxy_call (proxy, "SetSinkVolume", error, G_TYPE_UINT, IN_volume_percent, G_TYPE_INVALID, G_TYPE_INVALID); -} - -typedef void (*org_ayatana_indicator_sound_set_sink_volume_reply) (DBusGProxy *proxy, GError *error, gpointer userdata); - -static void -org_ayatana_indicator_sound_set_sink_volume_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) -{ - DBusGAsyncData *data = (DBusGAsyncData*) user_data; - GError *error = NULL; - dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID); - (*(org_ayatana_indicator_sound_set_sink_volume_reply)data->cb) (proxy, error, data->userdata); - return; -} - -static -#ifdef G_HAVE_INLINE -inline -#endif -DBusGProxyCall* -org_ayatana_indicator_sound_set_sink_volume_async (DBusGProxy *proxy, const guint IN_volume_percent, org_ayatana_indicator_sound_set_sink_volume_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, "SetSinkVolume", org_ayatana_indicator_sound_set_sink_volume_async_callback, stuff, _dbus_glib_async_data_free, G_TYPE_UINT, IN_volume_percent, G_TYPE_INVALID); -} -static -#ifdef G_HAVE_INLINE -inline -#endif -gboolean -org_ayatana_indicator_sound_get_sink_volume (DBusGProxy *proxy, gdouble* OUT_volume_percent_input, GError **error) - -{ - return dbus_g_proxy_call (proxy, "GetSinkVolume", error, G_TYPE_INVALID, G_TYPE_DOUBLE, OUT_volume_percent_input, G_TYPE_INVALID); -} - -typedef void (*org_ayatana_indicator_sound_get_sink_volume_reply) (DBusGProxy *proxy, gdouble OUT_volume_percent_input, GError *error, gpointer userdata); - -static void -org_ayatana_indicator_sound_get_sink_volume_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) -{ - DBusGAsyncData *data = (DBusGAsyncData*) user_data; - GError *error = NULL; - gdouble OUT_volume_percent_input; - dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_DOUBLE, &OUT_volume_percent_input, G_TYPE_INVALID); - (*(org_ayatana_indicator_sound_get_sink_volume_reply)data->cb) (proxy, OUT_volume_percent_input, error, data->userdata); - return; -} - -static -#ifdef G_HAVE_INLINE -inline -#endif -DBusGProxyCall* -org_ayatana_indicator_sound_get_sink_volume_async (DBusGProxy *proxy, org_ayatana_indicator_sound_get_sink_volume_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, "GetSinkVolume", org_ayatana_indicator_sound_get_sink_volume_async_callback, stuff, _dbus_glib_async_data_free, G_TYPE_INVALID); -} static #ifdef G_HAVE_INLINE inline diff --git a/src/sound-service-dbus.c b/src/sound-service-dbus.c index 85945d0..d553285 100644 --- a/src/sound-service-dbus.c +++ b/src/sound-service-dbus.c @@ -29,10 +29,8 @@ #include "pulse-manager.h" // DBUS methods -static gboolean sound_service_dbus_get_sink_volume(SoundServiceDbus* service, gdouble* volume_percent_input, GError** gerror); static gboolean sound_service_dbus_get_sink_mute(SoundServiceDbus* service, gboolean* mute_input, GError** gerror); static gboolean sound_service_dbus_get_sink_availability(SoundServiceDbus* service, gboolean* availability_input, GError** gerror); -static void sound_service_dbus_set_sink_volume(SoundServiceDbus* service, const guint volume_percent, GError** gerror); #include "sound-service-server.h" @@ -40,7 +38,6 @@ typedef struct _SoundServiceDbusPrivate SoundServiceDbusPrivate; struct _SoundServiceDbusPrivate { DBusGConnection *connection; - gdouble volume_percent; gboolean mute; gboolean sink_availability; }; @@ -49,7 +46,6 @@ struct _SoundServiceDbusPrivate { /* Signals */ enum { SINK_INPUT_WHILE_MUTED, - SINK_VOLUME_UPDATE, SINK_MUTE_UPDATE, SINK_AVAILABLE_UPDATE, LAST_SIGNAL @@ -65,7 +61,6 @@ static void sound_service_dbus_init (SoundServiceDbus *self); static void sound_service_dbus_dispose (GObject *object); static void sound_service_dbus_finalize (GObject *object); - /* GObject Boilerplate */ G_DEFINE_TYPE (SoundServiceDbus, sound_service_dbus, G_TYPE_OBJECT); @@ -91,14 +86,6 @@ sound_service_dbus_class_init (SoundServiceDbusClass *klass) g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN); - signals[SINK_VOLUME_UPDATE] = g_signal_new("sink-volume-update", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - 0, - NULL, NULL, - g_cclosure_marshal_VOID__DOUBLE, - G_TYPE_NONE, 1, G_TYPE_DOUBLE); - signals[SINK_MUTE_UPDATE] = g_signal_new("sink-mute-update", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, @@ -113,9 +100,6 @@ sound_service_dbus_class_init (SoundServiceDbusClass *klass) NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN); - - - } static void @@ -125,7 +109,6 @@ sound_service_dbus_init (SoundServiceDbus *self) SoundServiceDbusPrivate * priv = SOUND_SERVICE_DBUS_GET_PRIVATE(self); priv->connection = NULL; - priv->volume_percent = 0; priv->mute = FALSE; priv->sink_availability = FALSE; @@ -159,23 +142,6 @@ sound_service_dbus_finalize (GObject *object) } -/** -DBUS Method Callbacks -**/ -static void sound_service_dbus_set_sink_volume(SoundServiceDbus* service, const guint volume_percent, GError** gerror) -{ - g_debug("in the set sink volume method in the sound service dbus!, with volume_percent of %i", volume_percent); - set_sink_volume(volume_percent); -} - -static gboolean sound_service_dbus_get_sink_volume (SoundServiceDbus *self, gdouble *volume_percent_input, GError** gerror) -{ - SoundServiceDbusPrivate *priv = SOUND_SERVICE_DBUS_GET_PRIVATE (self); - g_debug("Get sink volume method in the sound service dbus!, about to send over volume percent of %f", priv->volume_percent); - *volume_percent_input = priv->volume_percent; - return TRUE; -} - static gboolean sound_service_dbus_get_sink_mute (SoundServiceDbus *self, gboolean *mute_input, GError** gerror) { SoundServiceDbusPrivate *priv = SOUND_SERVICE_DBUS_GET_PRIVATE (self); @@ -205,18 +171,6 @@ void sound_service_dbus_sink_input_while_muted(SoundServiceDbus* obj, gboolean block_value); } -void sound_service_dbus_update_sink_volume(SoundServiceDbus* obj, gdouble sink_volume) -{ - SoundServiceDbusPrivate *priv = SOUND_SERVICE_DBUS_GET_PRIVATE (obj); - priv->volume_percent = sink_volume; - - /* g_debug("Emitting signal: SINK_VOLUME_UPDATE, with sink_volme %f", priv->volume_percent);*/ - g_signal_emit(obj, - signals[SINK_VOLUME_UPDATE], - 0, - priv->volume_percent); -} - void sound_service_dbus_update_sink_mute(SoundServiceDbus* obj, gboolean sink_mute) { /* g_debug("Emitting signal: SINK_MUTE_UPDATE, with sink mute %i", sink_mute);*/ diff --git a/src/sound-service-dbus.h b/src/sound-service-dbus.h index 72556ad..b6e8193 100644 --- a/src/sound-service-dbus.h +++ b/src/sound-service-dbus.h @@ -52,7 +52,6 @@ GType sound_service_dbus_get_type (void) G_GNUC_CONST; // Utility methods to get the SIGNAL messages across into the sound-service-dbus void sound_service_dbus_sink_input_while_muted (SoundServiceDbus* obj, gboolean block_value); -void sound_service_dbus_update_sink_volume(SoundServiceDbus* obj, gdouble sink_volume); void sound_service_dbus_update_sink_mute(SoundServiceDbus* obj, gboolean sink_mute); void sound_service_dbus_update_sink_availability(SoundServiceDbus* obj, gboolean sink_availibity); diff --git a/src/sound-service-server.h b/src/sound-service-server.h index e889c2d..0431d64 100644 --- a/src/sound-service-server.h +++ b/src/sound-service-server.h @@ -55,53 +55,6 @@ G_BEGIN_DECLS #endif /* !G_ENABLE_DEBUG */ -/* BOOLEAN:UINT,POINTER */ -extern void dbus_glib_marshal__sound_service_server_BOOLEAN__UINT_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__UINT_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__UINT_POINTER) (gpointer data1, - guint arg_1, - gpointer arg_2, - gpointer data2); - register GMarshalFunc_BOOLEAN__UINT_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__UINT_POINTER) (marshal_data ? marshal_data : cc->callback); - - v_return = callback (data1, - g_marshal_value_peek_uint (param_values + 1), - g_marshal_value_peek_pointer (param_values + 2), - data2); - - g_value_set_boolean (return_value, v_return); -} - /* BOOLEAN:POINTER,POINTER */ extern void dbus_glib_marshal__sound_service_server_BOOLEAN__POINTER_POINTER (GClosure *closure, GValue *return_value, @@ -155,18 +108,16 @@ G_END_DECLS #include static const DBusGMethodInfo dbus_glib__sound_service_server_methods[] = { - { (GCallback) sound_service_dbus_set_sink_volume, dbus_glib_marshal__sound_service_server_BOOLEAN__UINT_POINTER, 0 }, - { (GCallback) sound_service_dbus_get_sink_volume, dbus_glib_marshal__sound_service_server_BOOLEAN__POINTER_POINTER, 64 }, - { (GCallback) sound_service_dbus_get_sink_mute, dbus_glib_marshal__sound_service_server_BOOLEAN__POINTER_POINTER, 138 }, - { (GCallback) sound_service_dbus_get_sink_availability, dbus_glib_marshal__sound_service_server_BOOLEAN__POINTER_POINTER, 200 }, + { (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 = { 0, dbus_glib__sound_service_server_methods, - 4, -"org.ayatana.indicator.sound\0SetSinkVolume\0S\0volume_percent\0I\0u\0\0org.ayatana.indicator.sound\0GetSinkVolume\0S\0volume_percent_input\0O\0F\0N\0d\0\0org.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\0SinkVolumeUpdate\0org.ayatana.indicator.sound\0SinkMuteUpdate\0org.ayatana.indicator.sound\0SinkAvailableUpdate\0\0", + 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/sound-service.c b/src/sound-service.c index 8768cd3..12f067e 100644 --- a/src/sound-service.c +++ b/src/sound-service.c @@ -25,7 +25,6 @@ with this program. If not, see . static GMainLoop *mainloop = NULL; - /**********************************************************************************************************************/ // Init and exit functions /**********************************************************************************************************************/ diff --git a/src/sound-service.xml b/src/sound-service.xml index 12ed03e..ee19ceb 100644 --- a/src/sound-service.xml +++ b/src/sound-service.xml @@ -1,16 +1,6 @@ - - - - - - - - - - @@ -28,10 +18,6 @@ Our respective UI element should listen to this and therefore will be updated wi - - - - diff --git a/src/title-menu-item.c b/src/title-menu-item.c index 70ddc74..a81e2ce 100644 --- a/src/title-menu-item.c +++ b/src/title-menu-item.c @@ -1,4 +1,4 @@ -/* title-menu-item.c generated by valac, the Vala compiler +/* title-menu-item.c generated by valac 0.9.5, the Vala compiler * generated from title-menu-item.vala, do not modify */ /* @@ -65,15 +65,15 @@ typedef struct _PlayerController PlayerController; typedef struct _PlayerControllerClass PlayerControllerClass; typedef struct _PlayerControllerPrivate PlayerControllerPrivate; -#define TYPE_MPRIS_CONTROLLER (mpris_controller_get_type ()) -#define MPRIS_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_CONTROLLER, MprisController)) -#define MPRIS_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS_CONTROLLER, MprisControllerClass)) -#define IS_MPRIS_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_CONTROLLER)) -#define IS_MPRIS_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS_CONTROLLER)) -#define MPRIS_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS_CONTROLLER, MprisControllerClass)) +#define TYPE_MPRIS_BRIDGE (mpris_bridge_get_type ()) +#define MPRIS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_BRIDGE, MprisBridge)) +#define MPRIS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS_BRIDGE, MprisBridgeClass)) +#define IS_MPRIS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_BRIDGE)) +#define IS_MPRIS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS_BRIDGE)) +#define MPRIS_BRIDGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS_BRIDGE, MprisBridgeClass)) -typedef struct _MprisController MprisController; -typedef struct _MprisControllerClass MprisControllerClass; +typedef struct _MprisBridge MprisBridge; +typedef struct _MprisBridgeClass MprisBridgeClass; #define PLAYER_CONTROLLER_TYPE_STATE (player_controller_state_get_type ()) #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) @@ -101,7 +101,7 @@ struct _PlayerController { PlayerControllerPrivate * priv; gint current_state; GeeArrayList* custom_items; - MprisController* mpris_adaptor; + MprisBridge* mpris_bridge; }; struct _PlayerControllerClass { @@ -129,9 +129,10 @@ const char* player_controller_get_name (PlayerController* self); TitleMenuitem* title_menuitem_new (PlayerController* parent); TitleMenuitem* title_menuitem_construct (GType object_type, PlayerController* parent); PlayerController* player_item_get_owner (PlayerItem* self); -GType mpris_controller_get_type (void) G_GNUC_CONST; +GType mpris_bridge_get_type (void) G_GNUC_CONST; GType player_controller_state_get_type (void) G_GNUC_CONST; void player_controller_instantiate (PlayerController* self); +void mpris_bridge_expose (MprisBridge* self); static void title_menuitem_real_handle_event (DbusmenuMenuitem* base, const char* name, GValue* input_value, guint timestamp); GeeHashSet* title_menuitem_attributes_format (void); @@ -157,6 +158,10 @@ static void title_menuitem_real_handle_event (DbusmenuMenuitem* base, const char 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) { + mpris_bridge_expose (player_item_get_owner ((PlayerItem*) self)->mpris_bridge); + } } } diff --git a/src/title-menu-item.vala b/src/title-menu-item.vala index d7e16df..ec1cc62 100644 --- a/src/title-menu-item.vala +++ b/src/title-menu-item.vala @@ -35,6 +35,9 @@ public class TitleMenuitem : PlayerItem { this.owner.instantiate(); } + else if(this.owner.current_state == PlayerController.state.CONNECTED){ + this.owner.mpris_bridge.expose(); + } } diff --git a/src/title-widget.h b/src/title-widget.h index efc0c78..fc8f169 100644 --- a/src/title-widget.h +++ b/src/title-widget.h @@ -20,7 +20,7 @@ with this program. If not, see . #define __TITLE_WIDGET_H__ #include -#include +#include G_BEGIN_DECLS diff --git a/src/transport-menu-item.c b/src/transport-menu-item.c index 50d166b..7c6b46b 100644 --- a/src/transport-menu-item.c +++ b/src/transport-menu-item.c @@ -1,4 +1,4 @@ -/* transport-menu-item.c generated by valac, the Vala compiler +/* transport-menu-item.c generated by valac 0.9.5, the Vala compiler * generated from transport-menu-item.vala, do not modify */ /* @@ -68,15 +68,15 @@ typedef struct _PlayerControllerClass PlayerControllerClass; #define _g_free0(var) (var = (g_free (var), NULL)) typedef struct _PlayerControllerPrivate PlayerControllerPrivate; -#define TYPE_MPRIS_CONTROLLER (mpris_controller_get_type ()) -#define MPRIS_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_CONTROLLER, MprisController)) -#define MPRIS_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS_CONTROLLER, MprisControllerClass)) -#define IS_MPRIS_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_CONTROLLER)) -#define IS_MPRIS_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS_CONTROLLER)) -#define MPRIS_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS_CONTROLLER, MprisControllerClass)) +#define TYPE_MPRIS_BRIDGE (mpris_bridge_get_type ()) +#define MPRIS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_BRIDGE, MprisBridge)) +#define MPRIS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS_BRIDGE, MprisBridgeClass)) +#define IS_MPRIS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_BRIDGE)) +#define IS_MPRIS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS_BRIDGE)) +#define MPRIS_BRIDGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS_BRIDGE, MprisBridgeClass)) -typedef struct _MprisController MprisController; -typedef struct _MprisControllerClass MprisControllerClass; +typedef struct _MprisBridge MprisBridge; +typedef struct _MprisBridgeClass MprisBridgeClass; #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) struct _PlayerItem { @@ -108,7 +108,7 @@ struct _PlayerController { PlayerControllerPrivate * priv; gint current_state; GeeArrayList* custom_items; - MprisController* mpris_adaptor; + MprisBridge* mpris_bridge; }; struct _PlayerControllerClass { @@ -130,8 +130,8 @@ TransportMenuitem* transport_menuitem_construct (GType object_type, PlayerContro void transport_menuitem_change_play_state (TransportMenuitem* self, gint state); PlayerController* player_item_get_owner (PlayerItem* self); const char* player_controller_get_name (PlayerController* self); -GType mpris_controller_get_type (void) G_GNUC_CONST; -void mpris_controller_transport_event (MprisController* self, TransportMenuitemaction command); +GType mpris_bridge_get_type (void) G_GNUC_CONST; +void mpris_bridge_transport_update (MprisBridge* self, TransportMenuitemaction update); static void transport_menuitem_real_handle_event (DbusmenuMenuitem* base, const char* name, GValue* input_value, guint timestamp); GeeHashSet* transport_menuitem_attributes_format (void); @@ -179,7 +179,7 @@ static void transport_menuitem_real_handle_event (DbusmenuMenuitem* base, const g_debug ("transport-menu-item.vala:46: handle_event with value %s", _tmp0_ = g_strdup_printf ("%i", input)); _g_free0 (_tmp0_); g_debug ("transport-menu-item.vala:47: transport owner name = %s", player_controller_get_name (player_item_get_owner ((PlayerItem*) self))); - mpris_controller_transport_event (player_item_get_owner ((PlayerItem*) self)->mpris_adaptor, (TransportMenuitemaction) input); + mpris_bridge_transport_update (player_item_get_owner ((PlayerItem*) self)->mpris_bridge, (TransportMenuitemaction) input); } diff --git a/src/transport-menu-item.vala b/src/transport-menu-item.vala index 3d6dcdd..8bdd2c8 100644 --- a/src/transport-menu-item.vala +++ b/src/transport-menu-item.vala @@ -45,7 +45,7 @@ public class TransportMenuitem : PlayerItem int input = input_value.get_int(); debug("handle_event with value %s", input.to_string()); debug("transport owner name = %s", this.owner.name); - this.owner.mpris_adaptor.transport_event((action)input); + this.owner.mpris_bridge.transport_update((action)input); } public static HashSet attributes_format() diff --git a/src/transport-widget.h b/src/transport-widget.h index 1d1aa6e..c69836a 100644 --- a/src/transport-widget.h +++ b/src/transport-widget.h @@ -20,7 +20,7 @@ with this program. If not, see . #define __TRANSPORT_WIDGET_H__ #include -#include +#include G_BEGIN_DECLS diff --git a/src/volume-widget.c b/src/volume-widget.c new file mode 100644 index 0000000..bf1ddb9 --- /dev/null +++ b/src/volume-widget.c @@ -0,0 +1,247 @@ +/* +Copyright 2010 Canonical Ltd. + +Authors: + Conor Curran + +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 . +*/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include "volume-widget.h" +#include "common-defs.h" +#include + +typedef struct _VolumeWidgetPrivate VolumeWidgetPrivate; + +struct _VolumeWidgetPrivate +{ + DbusmenuMenuitem* twin_item; + GtkWidget* ido_volume_slider; + gboolean grabbed; +}; + +#define VOLUME_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), VOLUME_WIDGET_TYPE, VolumeWidgetPrivate)) + +/* Prototypes */ +static void volume_widget_class_init (VolumeWidgetClass *klass); +static void volume_widget_init (VolumeWidget *self); +static void volume_widget_dispose (GObject *object); +static void volume_widget_finalize (GObject *object); +static void volume_widget_set_twin_item( VolumeWidget* self, + DbusmenuMenuitem* twin_item); +static void volume_widget_property_update( DbusmenuMenuitem* item, gchar* property, + GValue* value, gpointer userdata); +static gboolean volume_widget_change_value_cb (GtkRange *range, + GtkScrollType scroll, + gdouble value, + gpointer user_data); +static gboolean volume_widget_value_changed_cb(GtkRange *range, gpointer user_data); +static void volume_widget_slider_grabbed(GtkWidget *widget, gpointer user_data); +static void volume_widget_slider_released(GtkWidget *widget, gpointer user_data); +static void volume_widget_parent_changed (GtkWidget *widget, gpointer user_data); + +G_DEFINE_TYPE (VolumeWidget, volume_widget, G_TYPE_OBJECT); + +static void +volume_widget_class_init (VolumeWidgetClass *klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + + g_type_class_add_private (klass, sizeof (VolumeWidgetPrivate)); + + gobject_class->dispose = volume_widget_dispose; + gobject_class->finalize = volume_widget_finalize; +} + +static void +volume_widget_init (VolumeWidget *self) +{ + g_debug("VolumeWidget::volume_widget_init"); + VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(self); + + priv->ido_volume_slider = ido_scale_menu_item_new_with_range ("VOLUME", IDO_RANGE_STYLE_DEFAULT, 0, 0, 100, 1); + g_object_ref (priv->ido_volume_slider); + ido_scale_menu_item_set_style (IDO_SCALE_MENU_ITEM (priv->ido_volume_slider), IDO_SCALE_MENU_ITEM_STYLE_IMAGE); + g_object_set(priv->ido_volume_slider, "reverse-scroll-events", TRUE, NULL); + + g_signal_connect (priv->ido_volume_slider, + "notify::parent", G_CALLBACK (volume_widget_parent_changed), + NULL); + + GtkWidget* volume_widget = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider); + + g_signal_connect(volume_widget, "change-value", G_CALLBACK(volume_widget_change_value_cb), self); + g_signal_connect(volume_widget, "value-changed", G_CALLBACK(volume_widget_value_changed_cb), self); + g_signal_connect(priv->ido_volume_slider, "slider-grabbed", G_CALLBACK(volume_widget_slider_grabbed), self); + g_signal_connect(priv->ido_volume_slider, "slider-released", G_CALLBACK(volume_widget_slider_released), self); + + GtkWidget* primary_image = ido_scale_menu_item_get_primary_image((IdoScaleMenuItem*)priv->ido_volume_slider); + GIcon * primary_gicon = g_themed_icon_new_with_default_fallbacks("audio-volume-low-zero-panel"); + gtk_image_set_from_gicon(GTK_IMAGE(primary_image), primary_gicon, GTK_ICON_SIZE_MENU); + g_object_unref(primary_gicon); + + GtkWidget* secondary_image = ido_scale_menu_item_get_secondary_image((IdoScaleMenuItem*)priv->ido_volume_slider); + GIcon * secondary_gicon = g_themed_icon_new_with_default_fallbacks("audio-volume-high-panel"); + gtk_image_set_from_gicon(GTK_IMAGE(secondary_image), secondary_gicon, GTK_ICON_SIZE_MENU); + g_object_unref(secondary_gicon); + + GtkAdjustment *adj = gtk_range_get_adjustment (GTK_RANGE (volume_widget)); + gtk_adjustment_set_step_increment(adj, 3); +} + +static void +volume_widget_dispose (GObject *object) +{ + G_OBJECT_CLASS (volume_widget_parent_class)->dispose (object); +} + +static void +volume_widget_finalize (GObject *object) +{ + G_OBJECT_CLASS (volume_widget_parent_class)->finalize (object); +} + +static void +volume_widget_property_update(DbusmenuMenuitem* item, gchar* property, + GValue* value, gpointer userdata) +{ + g_return_if_fail (IS_VOLUME_WIDGET (userdata)); + VolumeWidget* mitem = VOLUME_WIDGET(userdata); + VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(mitem); + g_debug("scrub-widget::property_update for prop %s", property); + if(g_ascii_strcasecmp(DBUSMENU_VOLUME_MENUITEM_LEVEL, property) == 0){ + if(priv->grabbed == FALSE){ + GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider); + GtkRange *range = (GtkRange*)slider; + gdouble update = g_value_get_double (value); + g_debug("volume-widget - update level with value %f", update); + gtk_range_set_value(range, update); + determine_state_from_volume(update); + } + } +} + +static void +volume_widget_set_twin_item(VolumeWidget* self, + DbusmenuMenuitem* twin_item) +{ + VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(self); + priv->twin_item = twin_item; + g_object_ref(priv->twin_item); + g_signal_connect(G_OBJECT(twin_item), "property-changed", + G_CALLBACK(volume_widget_property_update), self); + gdouble initial_level = g_value_get_double (dbusmenu_menuitem_property_get_value(twin_item, + DBUSMENU_VOLUME_MENUITEM_LEVEL)); + g_debug("volume_widget_set_twin_item initial level = %f", initial_level); + GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider); + GtkRange *range = (GtkRange*)slider; + gtk_range_set_value(range, initial_level); + determine_state_from_volume(initial_level); +} + +static gboolean +volume_widget_change_value_cb (GtkRange *range, + GtkScrollType scroll, + gdouble new_value, + gpointer user_data) +{ + g_return_val_if_fail (IS_VOLUME_WIDGET (user_data), FALSE); + VolumeWidget* mitem = VOLUME_WIDGET(user_data); + volume_widget_update(mitem, new_value); + determine_state_from_volume(new_value); + return FALSE; +} + +/* + We only want this callback to catch mouse icon press events + which set the slider to 0 or 100. Ignore all other events. +*/ +static gboolean +volume_widget_value_changed_cb(GtkRange *range, gpointer user_data) +{ + g_return_val_if_fail (IS_VOLUME_WIDGET (user_data), FALSE); + VolumeWidget* mitem = VOLUME_WIDGET(user_data); + VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(mitem); + GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider); + gdouble current_value = CLAMP(gtk_range_get_value(GTK_RANGE(slider)), 0, 100); + + if(current_value == 0 || current_value == 100){ + volume_widget_update(mitem, current_value); + } + return FALSE; +} + +void +volume_widget_update(VolumeWidget* self, gdouble update) +{ + VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(self); + GValue value = {0}; + g_value_init(&value, G_TYPE_DOUBLE); + gdouble clamped = CLAMP(update, 0, 100); + g_value_set_double(&value, clamped); + dbusmenu_menuitem_handle_event (priv->twin_item, "update", &value, 0); +} + + + +GtkWidget* +volume_widget_get_ido_slider(VolumeWidget* self) +{ + VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(self); + return priv->ido_volume_slider; +} + +static void +volume_widget_parent_changed (GtkWidget *widget, + gpointer user_data) +{ + gtk_widget_set_size_request (widget, 200, -1); + g_debug("volume_widget_parent_changed"); +} + +static void +volume_widget_slider_grabbed(GtkWidget *widget, gpointer user_data) +{ + VolumeWidget* mitem = VOLUME_WIDGET(user_data); + VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(mitem); + priv->grabbed = TRUE; +} + +static void +volume_widget_slider_released(GtkWidget *widget, gpointer user_data) +{ + VolumeWidget* mitem = VOLUME_WIDGET(user_data); + VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(mitem); + priv->grabbed = FALSE; +} + +/** + * volume_widget_new: + * @returns: a new #VolumeWidget. + **/ +GtkWidget* +volume_widget_new(DbusmenuMenuitem *item) +{ + GtkWidget* widget = g_object_new(VOLUME_WIDGET_TYPE, NULL); + volume_widget_set_twin_item((VolumeWidget*)widget, item); + return widget; +} + + diff --git a/src/volume-widget.h b/src/volume-widget.h new file mode 100644 index 0000000..d4929ec --- /dev/null +++ b/src/volume-widget.h @@ -0,0 +1,54 @@ +/* +Copyright 2010 Canonical Ltd. + +Authors: + Conor Curran + +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 . +*/ +#ifndef __VOLUME_WIDGET_H__ +#define __VOLUME_WIDGET_H__ + +#include +#include +#include + +G_BEGIN_DECLS + +#define VOLUME_WIDGET_TYPE (volume_widget_get_type ()) +#define VOLUME_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VOLUME_WIDGET_TYPE, VolumeWidget)) +#define VOLUME_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VOLUME_WIDGET_TYPE, VolumeWidgetClass)) +#define IS_VOLUME_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VOLUME_WIDGET_TYPE)) +#define IS_VOLUME_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VOLUME_WIDGET_TYPE)) +#define VOLUME_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VOLUME_WIDGET_TYPE, VolumeWidgetClass)) + +typedef struct _VolumeWidget VolumeWidget; +typedef struct _VolumeWidgetClass VolumeWidgetClass; + +struct _VolumeWidgetClass { + GObjectClass parent_class; +}; + +struct _VolumeWidget { + GObject parent; +}; + +GType volume_widget_get_type (void) G_GNUC_CONST; +GtkWidget* volume_widget_new(DbusmenuMenuitem* twin_item); +GtkWidget* volume_widget_get_ido_slider(VolumeWidget* self); +void volume_widget_update(VolumeWidget* self, gdouble update); + +G_END_DECLS + +#endif + -- cgit v1.2.3 From 80e5ad4f83a8b1218133761de11d433a7854041e Mon Sep 17 00:00:00 2001 From: Sebastien Bacher Date: Thu, 26 Aug 2010 11:32:53 +0200 Subject: Import upstream version 0.4.1 --- src/Makefile.in | 5 +- src/common-defs.h | 10 +- src/dbus-menu-manager.c | 6 +- src/familiar-players-db.c | 32 +- src/indicator-sound.c | 8 - src/metadata-menu-item.c | 6 +- src/metadata-menu-item.vala | 3 +- src/metadata-widget.c | 382 +++++-- src/mpris-bridge.c | 14 +- src/mpris-controller.c | 259 +---- src/mpris-controller.vala | 15 - src/mpris2-controller.c | 2452 +++++++++++++++++++++---------------------- src/mpris2-controller.vala | 64 +- src/music-player-bridge.c | 24 +- src/music-player-bridge.h | 5 +- src/play-button.c | 64 +- src/player-controller.c | 89 +- src/player-controller.vala | 15 +- src/player-item.c | 24 +- src/player-item.vala | 11 +- src/scrub-menu-item.c | 10 +- src/scrub-menu-item.vala | 2 +- src/title-menu-item.c | 6 +- src/title-widget.c | 29 +- src/transport-menu-item.c | 4 +- 25 files changed, 1753 insertions(+), 1786 deletions(-) (limited to 'src') diff --git a/src/Makefile.in b/src/Makefile.in index 534aa81..fd23190 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -39,7 +39,10 @@ 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__aclocal_m4_deps = $(top_srcdir)/m4/intltool.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs diff --git a/src/common-defs.h b/src/common-defs.h index e3b4552..e554c11 100644 --- a/src/common-defs.h +++ b/src/common-defs.h @@ -34,16 +34,16 @@ with this program. If not, see . #define DBUSMENU_TRANSPORT_MENUITEM_PLAY_STATE "x-canonical-sound-menu-player-transport-state" #define DBUSMENU_METADATA_MENUITEM_TYPE "x-canonical-sound-menu-player-metadata-type" -#define DBUSMENU_METADATA_MENUITEM_ARTIST "x-canonical-sound-menu-player-metadata-artist" -#define DBUSMENU_METADATA_MENUITEM_TITLE "x-canonical-sound-menu-player-metadata-title" -#define DBUSMENU_METADATA_MENUITEM_ALBUM "x-canonical-sound-menu-player-metadata-album" -#define DBUSMENU_METADATA_MENUITEM_ARTURL "x-canonical-sound-menu-player-metadata-arturl" +#define DBUSMENU_METADATA_MENUITEM_ARTIST "x-canonical-sound-menu-player-metadata-xesam:artist" +#define DBUSMENU_METADATA_MENUITEM_TITLE "x-canonical-sound-menu-player-metadata-xesam:title" +#define DBUSMENU_METADATA_MENUITEM_ALBUM "x-canonical-sound-menu-player-metadata-xesam:album" +#define DBUSMENU_METADATA_MENUITEM_ARTURL "x-canonical-sound-menu-player-metadata-mpris:artUrl" #define DBUSMENU_TITLE_MENUITEM_TYPE "x-canonical-sound-menu-player-title-type" #define DBUSMENU_TITLE_MENUITEM_NAME "x-canonical-sound-menu-player-title-name" #define DBUSMENU_SCRUB_MENUITEM_TYPE "x-canonical-sound-menu-player-scrub-type" -#define DBUSMENU_SCRUB_MENUITEM_DURATION "x-canonical-sound-menu-player-scrub-time" +#define DBUSMENU_SCRUB_MENUITEM_DURATION "x-canonical-sound-menu-player-scrub-mpris:length" #define DBUSMENU_SCRUB_MENUITEM_POSITION "x-canonical-sound-menu-player-scrub-position" #define DBUSMENU_SCRUB_MENUITEM_PLAY_STATE "x-canonical-sound-menu-player-scrub-play-state" diff --git a/src/dbus-menu-manager.c b/src/dbus-menu-manager.c index 6f0af9e..5ea561f 100644 --- a/src/dbus-menu-manager.c +++ b/src/dbus-menu-manager.c @@ -119,7 +119,7 @@ void dbus_menu_manager_update_mute_ui(gboolean incoming_mute_value) b_all_muted = incoming_mute_value; dbusmenu_menuitem_property_set(mute_all_menuitem, DBUSMENU_MENUITEM_PROP_LABEL, - b_all_muted == FALSE ? _("Mute All") : _("Unmute")); + b_all_muted == FALSE ? _("Mute") : _("Unmute")); } @@ -190,7 +190,7 @@ static void rebuild_sound_menu(DbusmenuMenuitem *root, SoundServiceDbus *service { // Mute button mute_all_menuitem = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set(mute_all_menuitem, DBUSMENU_MENUITEM_PROP_LABEL, b_all_muted == FALSE ? _("Mute All") : _("Unmute")); + dbusmenu_menuitem_property_set(mute_all_menuitem, DBUSMENU_MENUITEM_PROP_LABEL, b_all_muted == FALSE ? _("Mute") : _("Unmute")); g_signal_connect(G_OBJECT(mute_all_menuitem), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(set_global_mute_from_ui), NULL); dbusmenu_menuitem_property_set_bool(mute_all_menuitem, DBUSMENU_MENUITEM_PROP_ENABLED, b_sink_available); @@ -229,7 +229,7 @@ static void set_global_mute_from_ui() toggle_global_mute(b_all_muted); dbusmenu_menuitem_property_set(mute_all_menuitem, DBUSMENU_MENUITEM_PROP_LABEL, - b_all_muted == FALSE ? _("Mute All") : _("Unmute")); + b_all_muted == FALSE ? _("Mute") : _("Unmute")); } diff --git a/src/familiar-players-db.c b/src/familiar-players-db.c index 4d2b452..ec0c16f 100644 --- a/src/familiar-players-db.c +++ b/src/familiar-players-db.c @@ -1,4 +1,4 @@ -/* familiar-players-db.c generated by valac 0.9.5, the Vala compiler +/* familiar-players-db.c generated by valac 0.9.7, the Vala compiler * generated from familiar-players-db.vala, do not modify */ /* @@ -70,16 +70,16 @@ enum { }; #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); -FamiliarPlayersDB* familiar_players_db_new (void); -FamiliarPlayersDB* familiar_players_db_construct (GType object_type); -static void _vala_array_add1 (char*** array, int* length, int* size, char* value); 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); -void familiar_players_db_insert (FamiliarPlayersDB* self, const char* desktop); 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); @@ -128,10 +128,9 @@ FamiliarPlayersDB* familiar_players_db_new (void) { static gboolean familiar_players_db_create_key_file (FamiliarPlayersDB* self) { gboolean result = FALSE; - GError * _inner_error_; gboolean _result_; + GError * _inner_error_ = NULL; g_return_val_if_fail (self != NULL, FALSE); - _inner_error_ = NULL; _result_ = FALSE; if (g_file_test (self->priv->file_name, G_FILE_TEST_EXISTS)) { GKeyFile* _tmp0_; @@ -190,9 +189,8 @@ static gboolean familiar_players_db_create_key_file (FamiliarPlayersDB* self) { static gboolean familiar_players_db_check_for_keys (FamiliarPlayersDB* self) { gboolean result = FALSE; - GError * _inner_error_; + GError * _inner_error_ = NULL; g_return_val_if_fail (self != NULL, FALSE); - _inner_error_ = NULL; { gboolean _tmp0_; _tmp0_ = g_key_file_has_key (self->priv->key_file, FAMILIAR_PLAYERS_DB_GROUP_NAME, FAMILIAR_PLAYERS_DB_KEY_NAME, &_inner_error_); @@ -236,13 +234,12 @@ static gboolean familiar_players_db_check_for_keys (FamiliarPlayersDB* self) { static gboolean familiar_players_db_load_data_from_key_file (FamiliarPlayersDB* self) { gboolean result = FALSE; - GError * _inner_error_; + GError * _inner_error_ = NULL; g_return_val_if_fail (self != NULL, FALSE); - _inner_error_ = NULL; { - char** _tmp1_; - gint _desktops_size_; 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_); @@ -307,17 +304,16 @@ static void _vala_array_add1 (char*** array, int* length, int* size, char* value static gboolean familiar_players_db_write_db (FamiliarPlayersDB* self) { gboolean result = FALSE; - GError * _inner_error_; GKeyFile* keyfile; - char** _tmp1_; - gint _desktops_size_; 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); - _inner_error_ = NULL; keyfile = g_key_file_new (); desktops = (_tmp1_ = (_tmp0_ = g_new0 (char*, 0 + 1), _tmp0_), desktops_length1 = 0, _desktops_size_ = desktops_length1, _tmp1_); { @@ -458,8 +454,8 @@ static char* bool_to_string (gboolean self) { gboolean familiar_players_db_already_familiar (FamiliarPlayersDB* self, const char* desktop) { gboolean result = FALSE; - char* _tmp1_; GeeSet* _tmp0_; + char* _tmp1_; GeeSet* _tmp2_; gboolean _tmp3_; g_return_val_if_fail (self != NULL, FALSE); diff --git a/src/indicator-sound.c b/src/indicator-sound.c index 3a7abe9..63ad72d 100644 --- a/src/indicator-sound.c +++ b/src/indicator-sound.c @@ -375,8 +375,6 @@ connection_changed (IndicatorServiceManager * sm, gboolean connected, gpointer u g_return_if_fail(IS_INDICATOR_SOUND(userdata)); - // Ensure we are in a coherent state with the service at start up. - // Preserve ordering! } } return; @@ -464,12 +462,7 @@ tidy_up_hash() static void update_state(const gint state) { - /* g_debug("update state beginning - previous_state = %i", previous_state);*/ - previous_state = current_state; - - /* g_debug("update state 3rd line - previous_state = %i", previous_state);*/ - current_state = state; gchar* image_name = g_hash_table_lookup(volume_states, GINT_TO_POINTER(current_state)); indicator_image_helper_update(speaker_image, image_name); @@ -479,7 +472,6 @@ update_state(const gint state) void determine_state_from_volume(gdouble volume_percent) { - /* g_debug("determine_state_from_volume - previous_state = %i", previous_state);*/ if (device_available == FALSE) return; gint state = previous_state; diff --git a/src/metadata-menu-item.c b/src/metadata-menu-item.c index 662a9ea..311057e 100644 --- a/src/metadata-menu-item.c +++ b/src/metadata-menu-item.c @@ -1,4 +1,4 @@ -/* metadata-menu-item.c generated by valac 0.9.5, the Vala compiler +/* metadata-menu-item.c generated by valac 0.9.7, the Vala compiler * generated from metadata-menu-item.vala, do not modify */ /* @@ -81,10 +81,10 @@ GType metadata_menuitem_get_type (void) G_GNUC_CONST; enum { METADATA_MENUITEM_DUMMY_PROPERTY }; -void player_item_reset (PlayerItem* self, GeeHashSet* attrs); -GeeHashSet* metadata_menuitem_attributes_format (void); 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); diff --git a/src/metadata-menu-item.vala b/src/metadata-menu-item.vala index 3818b1c..0bb4a85 100644 --- a/src/metadata-menu-item.vala +++ b/src/metadata-menu-item.vala @@ -29,6 +29,7 @@ public class MetadataMenuitem : PlayerItem reset(attributes_format()); } + public static HashSet attributes_format() { HashSet attrs = new HashSet(); @@ -39,4 +40,4 @@ public class MetadataMenuitem : PlayerItem return attrs; } -} \ No newline at end of file +} diff --git a/src/metadata-widget.c b/src/metadata-widget.c index aaf71e2..f600238 100644 --- a/src/metadata-widget.c +++ b/src/metadata-widget.c @@ -34,10 +34,13 @@ struct _MetadataWidgetPrivate { GtkWidget* hbox; GtkWidget* album_art; - gchar* image_path; + GString* image_path; + GString* old_image_path; GtkWidget* artist_label; GtkWidget* piece_label; GtkWidget* container_label; + GdkColor bevel_colour; + GdkColor eight_note_colour; }; #define METADATA_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), METADATA_WIDGET_TYPE, MetadataWidgetPrivate)) @@ -47,25 +50,28 @@ static void metadata_widget_class_init (MetadataWidgetClass *klass); static void metadata_widget_init (MetadataWidget *self); static void metadata_widget_dispose (GObject *object); static void metadata_widget_finalize (GObject *object); -static gboolean metadata_widget_expose_event(GtkWidget* widget, GdkEventExpose* event); +static gboolean metadata_image_expose (GtkWidget *image, GdkEventExpose *event, gpointer user_data); // keyevent consumers static gboolean metadata_widget_button_press_event (GtkWidget *menuitem, GdkEventButton *event); -static gboolean metadata_widget_button_release_event (GtkWidget *menuitem, - GdkEventButton *event); // Dbusmenuitem properties update callback -static void metadata_widget_property_update(DbusmenuMenuitem* item, gchar* property, - GValue* value, gpointer userdata); +static void metadata_widget_property_update (DbusmenuMenuitem* item, + gchar* property, + GValue* value, + gpointer userdata); -static void update_album_art(MetadataWidget* self); -static void style_artist_text(MetadataWidget* self); -static void style_title_text(MetadataWidget* self); -static void style_album_text(MetadataWidget* self); +static void metadata_widget_style_labels(MetadataWidget* self, + GtkLabel* label); + +void metadata_widget_set_style(GtkWidget* button, GtkStyle* style); +static void image_set_from_pixbuf (GtkWidget *widget, + MetadataWidget* metadata, + GdkPixbuf *source); -G_DEFINE_TYPE (MetadataWidget, metadata_widget, GTK_TYPE_MENU_ITEM); +G_DEFINE_TYPE (MetadataWidget, metadata_widget, GTK_TYPE_MENU_ITEM); static void @@ -75,13 +81,11 @@ metadata_widget_class_init (MetadataWidgetClass *klass) GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); widget_class->button_press_event = metadata_widget_button_press_event; - widget_class->button_release_event = metadata_widget_button_release_event; - widget_class->expose_event = metadata_widget_expose_event; + g_type_class_add_private (klass, sizeof (MetadataWidgetPrivate)); gobject_class->dispose = metadata_widget_dispose; gobject_class->finalize = metadata_widget_finalize; - } static void @@ -98,49 +102,52 @@ metadata_widget_init (MetadataWidget *self) // image priv->album_art = gtk_image_new(); - priv->image_path = g_strdup(dbusmenu_menuitem_property_get(twin_item, DBUSMENU_METADATA_MENUITEM_ARTURL)); - update_album_art(self); - + priv->image_path = g_string_new(dbusmenu_menuitem_property_get(twin_item, DBUSMENU_METADATA_MENUITEM_ARTURL)); + priv->old_image_path = g_string_new(""); + g_debug("Metadata::At startup and image path = %s", priv->image_path->str); + + g_signal_connect(priv->album_art, "expose-event", + G_CALLBACK(metadata_image_expose), + GTK_WIDGET(self)); + gtk_widget_set_size_request(GTK_WIDGET(priv->album_art), 60, 60); + gtk_box_pack_start (GTK_BOX (priv->hbox), priv->album_art, FALSE, FALSE, 0); - GtkWidget* vbox = gtk_vbox_new(FALSE, 0); - gtk_container_set_border_width(GTK_CONTAINER(vbox), 10); + // artist GtkWidget* artist; artist = gtk_label_new(dbusmenu_menuitem_property_get(twin_item, DBUSMENU_METADATA_MENUITEM_ARTIST)); - gtk_misc_set_alignment(GTK_MISC(artist), (gfloat)0, (gfloat)0); + gtk_misc_set_padding (GTK_MISC(artist), (gfloat)10, (gfloat)0); gtk_label_set_width_chars(GTK_LABEL(artist), 15); gtk_label_set_ellipsize(GTK_LABEL(artist), PANGO_ELLIPSIZE_MIDDLE); + metadata_widget_style_labels(self, GTK_LABEL(artist)); priv->artist_label = artist; - // Style it up. - style_artist_text(self); - // piece + // title GtkWidget* piece; piece = gtk_label_new(dbusmenu_menuitem_property_get(twin_item, DBUSMENU_METADATA_MENUITEM_TITLE)); gtk_misc_set_alignment(GTK_MISC(piece), (gfloat)0, (gfloat)0); - gtk_label_set_width_chars(GTK_LABEL(piece), 12); + gtk_misc_set_padding (GTK_MISC(piece), (gfloat)10, (gfloat)0); + gtk_label_set_width_chars(GTK_LABEL(piece), 15); gtk_label_set_ellipsize(GTK_LABEL(piece), PANGO_ELLIPSIZE_MIDDLE); + metadata_widget_style_labels(self, GTK_LABEL(piece)); priv->piece_label = piece; - // Style it up. - style_title_text(self); // container GtkWidget* container; container = gtk_label_new(dbusmenu_menuitem_property_get(twin_item, DBUSMENU_METADATA_MENUITEM_ALBUM)); gtk_misc_set_alignment(GTK_MISC(container), (gfloat)0, (gfloat)0); + gtk_misc_set_padding (GTK_MISC(container), (gfloat)10, (gfloat)0); gtk_label_set_width_chars(GTK_LABEL(container), 15); gtk_label_set_ellipsize(GTK_LABEL(container), PANGO_ELLIPSIZE_MIDDLE); + metadata_widget_style_labels(self, GTK_LABEL(container)); priv->container_label = container; - // Style it up. - style_album_text(self); - // Pack in the right order gtk_box_pack_start (GTK_BOX (vbox), priv->piece_label, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), priv->artist_label, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), priv->container_label, FALSE, FALSE, 0); @@ -150,19 +157,13 @@ metadata_widget_init (MetadataWidget *self) g_signal_connect(G_OBJECT(twin_item), "property-changed", G_CALLBACK(metadata_widget_property_update), self); gtk_widget_show_all (priv->hbox); + + g_signal_connect(self, "style-set", G_CALLBACK(metadata_widget_set_style), GTK_WIDGET(self)); + gtk_widget_set_size_request(GTK_WIDGET(self), 200, 60); gtk_container_add (GTK_CONTAINER (self), hbox); } -static gboolean -metadata_widget_expose_event(GtkWidget* widget, GdkEventExpose* event) -{ - MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(widget); - - gtk_container_propagate_expose(GTK_CONTAINER(widget), priv->hbox, event); - return TRUE; -} - static void metadata_widget_dispose (GObject *object) { @@ -175,21 +176,110 @@ metadata_widget_finalize (GObject *object) G_OBJECT_CLASS (metadata_widget_parent_class)->finalize (object); } -/* Suppress/consume keyevents */ +/** + * We override the expose method to enable primitive drawing of the + * empty album art image (and soon rounded rectangles on the album art) + */ static gboolean -metadata_widget_button_press_event (GtkWidget *menuitem, - GdkEventButton *event) +metadata_image_expose (GtkWidget *metadata, GdkEventExpose *event, gpointer user_data) { - g_debug("MetadataWidget::menu_press_event"); + g_return_val_if_fail(IS_METADATA_WIDGET(user_data), FALSE); + MetadataWidget* widget = METADATA_WIDGET(user_data); + MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(widget); + + if(priv->image_path->len > 0){ + + if(g_string_equal(priv->image_path, priv->old_image_path) == FALSE){ + GdkPixbuf* pixbuf; + pixbuf = gdk_pixbuf_new_from_file(priv->image_path->str, NULL); + g_debug("metadata_widget_expose, album art update -> pixbuf from %s", + priv->image_path->str); + pixbuf = gdk_pixbuf_scale_simple(pixbuf,60, 60, GDK_INTERP_BILINEAR); + image_set_from_pixbuf (metadata, widget, pixbuf); + g_string_erase(priv->old_image_path, 0, -1); + g_string_overwrite(priv->old_image_path, 0, priv->image_path->str); + + g_object_unref(pixbuf); + } + return FALSE; + } + + cairo_t *cr; + cr = gdk_cairo_create (metadata->window); + GtkAllocation alloc; + gtk_widget_get_allocation (metadata, &alloc); + + cairo_rectangle (cr, + alloc.x, alloc.y, + alloc.width, alloc.height); + cairo_clip(cr); + + cairo_move_to (cr, alloc.x , alloc.y); + cairo_line_to(cr, alloc.x + alloc.width, + alloc.y); + cairo_line_to(cr, alloc.x + alloc.width, + alloc.y + alloc.height); + cairo_line_to(cr, alloc.x, alloc.y + alloc.height); + cairo_line_to(cr, alloc.x, alloc.y); + + cairo_close_path (cr); + + cairo_set_source_rgba (cr, 123.0f / 255.0f, 123.0f / 255.0f, 120.0f / 255.0f, .8f); + cairo_set_line_width (cr, 2.0); + + cairo_stroke (cr); + + // Draw the eight note + PangoLayout *layout; + PangoFontDescription *desc; + layout = pango_cairo_create_layout(cr); + PangoContext* pcontext = pango_cairo_create_context(cr); + pango_cairo_context_set_resolution (pcontext, 96); + + GString* string = g_string_new(""); + gssize size = -1; + gunichar code = g_utf8_get_char_validated("\342\231\253", size); + g_string_append_unichar (string, code); + + pango_layout_set_text(layout, string->str, -1); + desc = pango_font_description_from_string("Sans Bold 30"); + pango_layout_set_font_description(layout, desc); + pango_font_description_free(desc); + + cairo_set_source_rgba(cr, 1.0, 1.0, 1.0, 0.8); + pango_cairo_update_layout(cr, layout); + cairo_move_to (cr, alloc.x + alloc.width/6, alloc.y); + pango_cairo_show_layout(cr, layout); + + g_object_unref(layout); + g_object_unref(pcontext); + g_string_free (string, TRUE); + cairo_destroy (cr); + return TRUE; } +/* Suppress/consume keyevents */ static gboolean -metadata_widget_button_release_event (GtkWidget *menuitem, +metadata_widget_button_press_event (GtkWidget *menuitem, GdkEventButton *event) { - g_debug("MetadataWidget::menu_release_event"); - return TRUE; + GtkClipboard* board = gtk_clipboard_get (GDK_NONE); + gchar* title = g_strdup(dbusmenu_menuitem_property_get(twin_item, + DBUSMENU_METADATA_MENUITEM_TITLE)); + gchar* artist = g_strdup(dbusmenu_menuitem_property_get(twin_item, + DBUSMENU_METADATA_MENUITEM_ARTIST)); + gchar* album = g_strdup(dbusmenu_menuitem_property_get(twin_item, + DBUSMENU_METADATA_MENUITEM_ALBUM)); + gchar* contents = g_strdup_printf("artist: %s \ntitle: %s \nalbum: %s", artist, title, album); + g_debug("contents to be copied will be : %s", contents); + gtk_clipboard_set_text (board, contents, -1); + gtk_clipboard_store (board); + g_free(contents); + g_free(title); + g_free(artist); + g_free(album); + return FALSE; } // TODO: Manage empty/mangled music details etc. @@ -212,72 +302,192 @@ metadata_widget_property_update(DbusmenuMenuitem* item, gchar* property, if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_ARTIST, property) == 0){ gtk_label_set_text(GTK_LABEL(priv->artist_label), g_value_get_string(value)); - style_artist_text(mitem); + metadata_widget_style_labels(mitem, GTK_LABEL(priv->artist_label)); } else if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_TITLE, property) == 0){ gtk_label_set_text(GTK_LABEL(priv->piece_label), g_value_get_string(value)); - style_title_text(mitem); + metadata_widget_style_labels(mitem, GTK_LABEL(priv->piece_label)); } else if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_ALBUM, property) == 0){ gtk_label_set_text(GTK_LABEL(priv->container_label), g_value_get_string(value)); - style_album_text(mitem); + metadata_widget_style_labels(mitem, GTK_LABEL(priv->container_label)); } else if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_ARTURL, property) == 0){ - if(priv->image_path != NULL){ - g_free(priv->image_path); - } - priv->image_path = g_value_dup_string(value); - if(priv->image_path != NULL){ - update_album_art(mitem); - } + g_string_erase(priv->image_path, 0, -1); + g_string_overwrite(priv->image_path, 0, g_value_get_string (value)); } } -static void -update_album_art(MetadataWidget* self){ - MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(self); - GdkPixbuf* pixbuf; - pixbuf = gdk_pixbuf_new_from_file(priv->image_path, NULL); - pixbuf = gdk_pixbuf_scale_simple(pixbuf,60, 60, GDK_INTERP_BILINEAR); - g_debug("attempting to set the image with path %s", priv->image_path); - gtk_image_set_from_pixbuf(GTK_IMAGE(priv->album_art), pixbuf); - g_object_unref(pixbuf); + +static cairo_surface_t * +surface_from_pixbuf (GdkPixbuf *pixbuf) +{ + cairo_surface_t *surface; + cairo_t *cr; + + surface = cairo_image_surface_create (gdk_pixbuf_get_has_alpha (pixbuf) ? + CAIRO_FORMAT_ARGB32 : CAIRO_FORMAT_RGB24, + gdk_pixbuf_get_width (pixbuf), + gdk_pixbuf_get_height (pixbuf)); + cr = cairo_create (surface); + gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0); + cairo_paint (cr); + cairo_destroy (cr); + + return surface; } -// TODO refactor next 3 methods into one once the style has been -// "signed off" by design static void -style_artist_text(MetadataWidget* self) +rounded_rectangle (cairo_t *cr, + gdouble aspect, + gdouble x, + gdouble y, + gdouble corner_radius, + gdouble width, + gdouble height) { - MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(self); - char* markup; - markup = g_markup_printf_escaped ("%s", - gtk_label_get_text(GTK_LABEL(priv->artist_label))); - gtk_label_set_markup (GTK_LABEL (priv->artist_label), markup); - g_free(markup); + gdouble radius; + gdouble degrees; + + radius = corner_radius / aspect; + degrees = G_PI / 180.0; + + cairo_new_sub_path (cr); + cairo_arc (cr, + x + width - radius, + y + radius, + radius, + -90 * degrees, + 0 * degrees); + cairo_arc (cr, + x + width - radius, + y + height - radius, + radius, + 0 * degrees, + 90 * degrees); + cairo_arc (cr, + x + radius, + y + height - radius, + radius, + 90 * degrees, + 180 * degrees); + cairo_arc (cr, + x + radius, + y + radius, + radius, + 180 * degrees, + 270 * degrees); + cairo_close_path (cr); } static void -style_title_text(MetadataWidget* self) +image_set_from_pixbuf (GtkWidget *widget, + MetadataWidget* metadata, + GdkPixbuf *source) { - MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(self); + cairo_t *cr; + cairo_t *cr_mask; + cairo_surface_t *surface; + GdkPixmap *pixmap; + GdkPixmap *bitmask; + int w; + int h; + int frame_width; + double radius; + GdkColor color; + double r; + double g; + double b; + + MetadataWidgetPrivate* priv = METADATA_WIDGET_GET_PRIVATE(metadata); + GtkImage* image = GTK_IMAGE(priv->album_art); + frame_width = 5; - char* markup; - markup = g_markup_printf_escaped ("%s", - gtk_label_get_text(GTK_LABEL(priv->piece_label))); - gtk_label_set_markup (GTK_LABEL (priv->piece_label), markup); - g_free(markup); + w = gdk_pixbuf_get_width (source) + frame_width * 2; + h = gdk_pixbuf_get_height (source) + frame_width * 2; + + radius = w / 10; + + pixmap = gdk_pixmap_new (gtk_widget_get_window (widget), w, h, -1); + bitmask = gdk_pixmap_new (gtk_widget_get_window (widget), w, h, 1); + + if (gtk_widget_get_window (widget) == NULL) + return; + + cr = gdk_cairo_create (pixmap); + cr_mask = gdk_cairo_create (bitmask); + + /* setup mask */ + cairo_rectangle (cr_mask, 0, 0, w, h); + cairo_set_operator (cr_mask, CAIRO_OPERATOR_CLEAR); + cairo_fill (cr_mask); + + rounded_rectangle (cr_mask, 1.0, 0.5, 0.5, radius, w - 1, h - 1); + cairo_set_operator (cr_mask, CAIRO_OPERATOR_OVER); + cairo_set_source_rgb (cr_mask, 1, 1, 1); + cairo_fill (cr_mask); + + color = gtk_widget_get_style (GTK_WIDGET (image))->bg [GTK_STATE_NORMAL]; + r = (float)color.red / 65535.0; + g = (float)color.green / 65535.0; + b = (float)color.blue / 65535.0; + + /* set up image */ + cairo_rectangle (cr, 0, 0, w, h); + cairo_set_source_rgb (cr, r, g, b); + cairo_fill (cr); + + rounded_rectangle (cr, + 1.0, + frame_width + 0.5, + frame_width + 0.5, + radius, + w - frame_width * 2 - 1, + h - frame_width * 2 - 1); + cairo_set_source_rgba (cr, 0.5, 0.5, 0.5, 0.3); + cairo_fill_preserve (cr); + + surface = surface_from_pixbuf (source); + cairo_set_source_surface (cr, surface, frame_width, frame_width); + cairo_fill (cr); + + gtk_image_set_from_pixmap (image, pixmap, bitmask); + + cairo_surface_destroy (surface); + + g_object_unref (bitmask); + g_object_unref (pixmap); + + cairo_destroy (cr_mask); + cairo_destroy (cr); } +// TODO refactor next 3 methods into one once the style has been static void -style_album_text(MetadataWidget* self) +metadata_widget_style_labels(MetadataWidget* self, GtkLabel* label) { - MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(self); char* markup; - markup = g_markup_printf_escaped ("%s", - gtk_label_get_text(GTK_LABEL(priv->container_label))); - gtk_label_set_markup (GTK_LABEL (priv->container_label), markup); - g_free(markup); + markup = g_markup_printf_escaped ("%s", + gtk_label_get_text(GTK_LABEL(label))); + gtk_label_set_markup (GTK_LABEL (label), markup); + g_free(markup); +} + +void +metadata_widget_set_style(GtkWidget* metadata, GtkStyle* style) +{ + g_return_if_fail(IS_METADATA_WIDGET(metadata)); + MetadataWidget* widg = METADATA_WIDGET(metadata); + MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(widg); + if(style == NULL){ + g_warning("metadata_widget_set_style -> style is NULL!"); + return; + } + else{ + g_debug("metadata_widget: about to set the style colours"); + priv->eight_note_colour = style->fg[GTK_STATE_NORMAL]; + priv->bevel_colour = style->bg[GTK_STATE_NORMAL]; + } } /** diff --git a/src/mpris-bridge.c b/src/mpris-bridge.c index 15ad9d5..d85ec3d 100644 --- a/src/mpris-bridge.c +++ b/src/mpris-bridge.c @@ -1,4 +1,4 @@ -/* mpris-bridge.c generated by valac 0.9.5, the Vala compiler +/* mpris-bridge.c generated by valac 0.9.7, the Vala compiler * generated from mpris-bridge.vala, do not modify */ @@ -94,26 +94,26 @@ enum { MPRIS_BRIDGE_DUMMY_PROPERTY }; GType player_controller_get_type (void) G_GNUC_CONST; +MprisBridge* mpris_bridge_new (PlayerController* ctrl); +MprisBridge* mpris_bridge_construct (GType object_type, PlayerController* ctrl); Mpris2Controller* mpris2_controller_new (PlayerController* ctrl); Mpris2Controller* mpris2_controller_construct (GType object_type, PlayerController* ctrl); gboolean mpris2_controller_was_successfull (Mpris2Controller* self); void mpris2_controller_initial_update (Mpris2Controller* self); MprisController* mpris_controller_new (PlayerController* ctrl, const char* inter); MprisController* mpris_controller_construct (GType object_type, PlayerController* ctrl, const char* inter); -MprisBridge* mpris_bridge_new (PlayerController* ctrl); -MprisBridge* mpris_bridge_construct (GType object_type, PlayerController* ctrl); +gboolean mpris_bridge_connected (MprisBridge* self); gboolean mpris_controller_connected (MprisController* self); gboolean mpris2_controller_connected (Mpris2Controller* self); -gboolean mpris_bridge_connected (MprisBridge* self); GType transport_menuitem_action_get_type (void) G_GNUC_CONST; +void mpris_bridge_transport_update (MprisBridge* self, TransportMenuitemaction update); void mpris_controller_transport_event (MprisController* self, TransportMenuitemaction command); void mpris2_controller_transport_event (Mpris2Controller* self, TransportMenuitemaction command); -void mpris_bridge_transport_update (MprisBridge* self, TransportMenuitemaction update); -void mpris2_controller_expose (Mpris2Controller* self); void mpris_bridge_expose (MprisBridge* self); +void mpris2_controller_expose (Mpris2Controller* self); +void mpris_bridge_set_track_position (MprisBridge* self, double pos); void mpris_controller_set_position (MprisController* self, double position); void mpris2_controller_set_position (Mpris2Controller* self, double position); -void mpris_bridge_set_track_position (MprisBridge* self, double pos); static void mpris_bridge_finalize (GObject* obj); diff --git a/src/mpris-controller.c b/src/mpris-controller.c index 1f891f7..98151e0 100644 --- a/src/mpris-controller.c +++ b/src/mpris-controller.c @@ -1,4 +1,4 @@ -/* mpris-controller.c generated by valac 0.9.5, the Vala compiler +/* mpris-controller.c generated by valac 0.9.7, the Vala compiler * generated from mpris-controller.vala, do not modify */ /* @@ -97,16 +97,6 @@ typedef struct _TransportMenuitem TransportMenuitem; typedef struct _TransportMenuitemClass TransportMenuitemClass; #define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL))) -#define TYPE_SCRUB_MENUITEM (scrub_menuitem_get_type ()) -#define SCRUB_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SCRUB_MENUITEM, ScrubMenuitem)) -#define SCRUB_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SCRUB_MENUITEM, ScrubMenuitemClass)) -#define IS_SCRUB_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SCRUB_MENUITEM)) -#define IS_SCRUB_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SCRUB_MENUITEM)) -#define SCRUB_MENUITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SCRUB_MENUITEM, ScrubMenuitemClass)) - -typedef struct _ScrubMenuitem ScrubMenuitem; -typedef struct _ScrubMenuitemClass ScrubMenuitemClass; - #define TRANSPORT_MENUITEM_TYPE_ACTION (transport_menuitem_action_get_type ()) #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) @@ -149,7 +139,6 @@ typedef enum { PLAYER_CONTROLLER_WIDGET_ORDER_SEPARATOR, PLAYER_CONTROLLER_WIDGET_ORDER_TITLE, PLAYER_CONTROLLER_WIDGET_ORDER_METADATA, - PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB, PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT } PlayerControllerwidget_order; @@ -173,6 +162,7 @@ enum { }; MprisController* mpris_controller_new (PlayerController* ctrl, const char* inter); MprisController* mpris_controller_construct (GType object_type, PlayerController* ctrl, const char* inter); +static void mpris_controller_initial_update (MprisController* self); DBusGProxy* mpris_controller_get_mpris_player (MprisController* self); static GType mpris_controller_status_get_type (void) G_GNUC_CONST G_GNUC_UNUSED; static MprisControllerstatus* mpris_controller_status_dup (const MprisControllerstatus* self); @@ -187,31 +177,21 @@ void transport_menuitem_change_play_state (TransportMenuitem* self, gint state); static GHashTable* _dynamic_GetMetadata1 (DBusGProxy* self, GError** error); void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attributes); GeeHashSet* metadata_menuitem_attributes_format (void); -static GHashTable* _dynamic_GetMetadata2 (DBusGProxy* self, GError** error); -GeeHashSet* scrub_menuitem_attributes_format (void); -GType scrub_menuitem_get_type (void) G_GNUC_CONST; -static gint32 _dynamic_PositionGet3 (DBusGProxy* self, GError** error); -void scrub_menuitem_update_position (ScrubMenuitem* self, gint32 new_position); -static void mpris_controller_initial_update (MprisController* self); GType transport_menuitem_action_get_type (void) G_GNUC_CONST; -static void _dynamic_Pause4 (DBusGProxy* self, GError** error); -static void _dynamic_Prev5 (DBusGProxy* self, GError** error); -static void _dynamic_Next6 (DBusGProxy* self, GError** error); void mpris_controller_transport_event (MprisController* self, TransportMenuitemaction command); -static GHashTable* _dynamic_GetMetadata7 (DBusGProxy* self, GError** error); -static GValue* _g_value_dup (GValue* self); -static void _dynamic_PositionSet8 (DBusGProxy* self, gint32 param1, GError** error); -static gint32 _dynamic_PositionGet9 (DBusGProxy* self, GError** error); +static void _dynamic_Pause2 (DBusGProxy* self, GError** error); +static void _dynamic_Prev3 (DBusGProxy* self, GError** error); +static void _dynamic_Next4 (DBusGProxy* self, GError** error); void mpris_controller_set_position (MprisController* self, double position); +static GHashTable* _dynamic_GetMetadata5 (DBusGProxy* self, GError** error); +static GValue* _g_value_dup (GValue* self); +static void _dynamic_PositionSet6 (DBusGProxy* self, gint32 param1, GError** error); gboolean mpris_controller_connected (MprisController* self); -GeeHashSet* transport_menuitem_attributes_format (void); static void mpris_controller_onStatusChange (MprisController* self, DBusGProxy* mpris_client, MprisControllerstatus* st); -void player_item_reset (PlayerItem* self, GeeHashSet* attrs); -static void _dynamic_GetStatus10 (DBusGProxy* self, MprisControllerstatus* result, GError** error); -void scrub_menuitem_update_playstate (ScrubMenuitem* self, gint state); -static GHashTable* _dynamic_GetMetadata11 (DBusGProxy* self, GError** error); -static gint32 _dynamic_PositionGet12 (DBusGProxy* self, GError** error); +GeeHashSet* transport_menuitem_attributes_format (void); static void mpris_controller_onTrackChange (MprisController* self, DBusGProxy* mpris_client, GHashTable* ht); +void player_item_reset (PlayerItem* self, GeeHashSet* attrs); +static void _dynamic_GetStatus7 (DBusGProxy* self, MprisControllerstatus* result, GError** error); static void mpris_controller_set_mpris_player (MprisController* self, DBusGProxy* value); static void mpris_controller_set_owner (MprisController* self, PlayerController* value); const char* mpris_controller_get_mpris_interface (MprisController* self); @@ -266,46 +246,18 @@ static GHashTable* _dynamic_GetMetadata1 (DBusGProxy* self, GError** error) { } -static GHashTable* _dynamic_GetMetadata2 (DBusGProxy* self, GError** error) { - GHashTable* result; - dbus_g_proxy_call (self, "GetMetadata", error, G_TYPE_INVALID, dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE), &result, G_TYPE_INVALID); - if (*error) { - return NULL; - } - return result; -} - - -static gint32 _dynamic_PositionGet3 (DBusGProxy* self, GError** error) { - gint32 result; - dbus_g_proxy_call (self, "PositionGet", error, G_TYPE_INVALID, G_TYPE_INT, &result, G_TYPE_INVALID); - if (*error) { - return 0; - } - return result; -} - - static void mpris_controller_initial_update (MprisController* self) { - GError * _inner_error_; MprisControllerstatus _tmp0_ = {0}; MprisControllerstatus st; gint play_state; - TransportMenuitem* _tmp2_; PlayerItem* _tmp1_; + TransportMenuitem* _tmp2_; GHashTable* _tmp3_; - GeeHashSet* _tmp6_; - GHashTable* _tmp5_; PlayerItem* _tmp4_; - GHashTable* _tmp7_; - GeeHashSet* _tmp10_; - GHashTable* _tmp9_; - PlayerItem* _tmp8_; - PlayerItem* _tmp11_; - ScrubMenuitem* scrub; - gint32 _tmp12_; + GHashTable* _tmp5_; + GeeHashSet* _tmp6_; + GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); - _inner_error_ = NULL; st = (_dynamic_GetStatus0 (self->priv->_mpris_player, &_tmp0_, &_inner_error_), _tmp0_); 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); @@ -326,30 +278,10 @@ static void mpris_controller_initial_update (MprisController* self) { _g_object_unref0 (_tmp6_); _g_hash_table_unref0 (_tmp5_); _g_object_unref0 (_tmp4_); - _tmp7_ = _dynamic_GetMetadata2 (self->priv->_mpris_player, &_inner_error_); - 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; - } - player_item_update (_tmp8_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), _tmp9_ = _tmp7_, _tmp10_ = scrub_menuitem_attributes_format ()); - _g_object_unref0 (_tmp10_); - _g_hash_table_unref0 (_tmp9_); - _g_object_unref0 (_tmp8_); - scrub = (_tmp11_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), IS_SCRUB_MENUITEM (_tmp11_) ? ((ScrubMenuitem*) _tmp11_) : NULL); - _tmp12_ = _dynamic_PositionGet3 (self->priv->_mpris_player, &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (scrub); - 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; - } - scrub_menuitem_update_position (scrub, _tmp12_); - _g_object_unref0 (scrub); } -static void _dynamic_Pause4 (DBusGProxy* self, GError** error) { +static void _dynamic_Pause2 (DBusGProxy* self, GError** error) { dbus_g_proxy_call (self, "Pause", error, G_TYPE_INVALID, G_TYPE_INVALID); if (*error) { return; @@ -357,7 +289,7 @@ static void _dynamic_Pause4 (DBusGProxy* self, GError** error) { } -static void _dynamic_Prev5 (DBusGProxy* self, GError** error) { +static void _dynamic_Prev3 (DBusGProxy* self, GError** error) { dbus_g_proxy_call (self, "Prev", error, G_TYPE_INVALID, G_TYPE_INVALID); if (*error) { return; @@ -365,7 +297,7 @@ static void _dynamic_Prev5 (DBusGProxy* self, GError** error) { } -static void _dynamic_Next6 (DBusGProxy* self, GError** error) { +static void _dynamic_Next4 (DBusGProxy* self, GError** error) { dbus_g_proxy_call (self, "Next", error, G_TYPE_INVALID, G_TYPE_INVALID); if (*error) { return; @@ -374,13 +306,12 @@ static void _dynamic_Next6 (DBusGProxy* self, GError** error) { void mpris_controller_transport_event (MprisController* self, TransportMenuitemaction command) { - GError * _inner_error_; + GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); - _inner_error_ = NULL; - g_debug ("mpris-controller.vala:72: transport_event input = %i", (gint) command); + g_debug ("mpris-controller.vala:68: transport_event input = %i", (gint) command); if (command == TRANSPORT_MENUITEM_ACTION_PLAY_PAUSE) { - g_debug ("mpris-controller.vala:74: transport_event PLAY_PAUSE"); - _dynamic_Pause4 (self->priv->_mpris_player, &_inner_error_); + g_debug ("mpris-controller.vala:70: transport_event PLAY_PAUSE"); + _dynamic_Pause2 (self->priv->_mpris_player, &_inner_error_); 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_); @@ -388,7 +319,7 @@ void mpris_controller_transport_event (MprisController* self, TransportMenuitema } } else { if (command == TRANSPORT_MENUITEM_ACTION_PREVIOUS) { - _dynamic_Prev5 (self->priv->_mpris_player, &_inner_error_); + _dynamic_Prev3 (self->priv->_mpris_player, &_inner_error_); 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_); @@ -396,7 +327,7 @@ void mpris_controller_transport_event (MprisController* self, TransportMenuitema } } else { if (command == TRANSPORT_MENUITEM_ACTION_NEXT) { - _dynamic_Next6 (self->priv->_mpris_player, &_inner_error_); + _dynamic_Next4 (self->priv->_mpris_player, &_inner_error_); 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_); @@ -408,7 +339,7 @@ void mpris_controller_transport_event (MprisController* self, TransportMenuitema } -static GHashTable* _dynamic_GetMetadata7 (DBusGProxy* self, GError** error) { +static GHashTable* _dynamic_GetMetadata5 (DBusGProxy* self, GError** error) { GHashTable* result; dbus_g_proxy_call (self, "GetMetadata", error, G_TYPE_INVALID, dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE), &result, G_TYPE_INVALID); if (*error) { @@ -428,7 +359,7 @@ static gpointer __g_value_dup0 (gpointer self) { } -static void _dynamic_PositionSet8 (DBusGProxy* self, gint32 param1, GError** error) { +static void _dynamic_PositionSet6 (DBusGProxy* self, gint32 param1, GError** error) { dbus_g_proxy_call (self, "PositionSet", error, G_TYPE_INT, param1, G_TYPE_INVALID, G_TYPE_INVALID); if (*error) { return; @@ -436,29 +367,15 @@ static void _dynamic_PositionSet8 (DBusGProxy* self, gint32 param1, GError** err } -static gint32 _dynamic_PositionGet9 (DBusGProxy* self, GError** error) { - gint32 result; - dbus_g_proxy_call (self, "PositionGet", error, G_TYPE_INVALID, G_TYPE_INT, &result, G_TYPE_INVALID); - if (*error) { - return 0; - } - return result; -} - - void mpris_controller_set_position (MprisController* self, double position) { - GError * _inner_error_; GHashTable* data; GValue* time_value; guint32 total_time; double new_time_position; - PlayerItem* _tmp0_; - ScrubMenuitem* scrub; - gint32 _tmp1_; + GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); - _inner_error_ = NULL; - g_debug ("mpris-controller.vala:87: Set position with pos (0-100) %f", position); - data = _dynamic_GetMetadata7 (self->priv->_mpris_player, &_inner_error_); + g_debug ("mpris-controller.vala:83: Set position with pos (0-100) %f", position); + data = _dynamic_GetMetadata5 (self->priv->_mpris_player, &_inner_error_); 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_); @@ -466,17 +383,17 @@ void mpris_controller_set_position (MprisController* self, double position) { } time_value = __g_value_dup0 ((GValue*) g_hash_table_lookup (data, "time")); if (time_value == NULL) { - g_warning ("mpris-controller.vala:91: Can't fetch the duration of the track theref" \ + g_warning ("mpris-controller.vala:87: Can't fetch the duration of the track theref" \ "ore cant set the position"); _g_free0 (time_value); _g_hash_table_unref0 (data); return; } total_time = (guint32) g_value_get_uint (time_value); - g_debug ("mpris-controller.vala:95: total time of track = %i", (gint) total_time); + g_debug ("mpris-controller.vala:91: total time of track = %i", (gint) total_time); new_time_position = (total_time * position) / 100.0; - g_debug ("mpris-controller.vala:97: new position = %f", new_time_position * 1000); - _dynamic_PositionSet8 (self->priv->_mpris_player, (gint32) new_time_position, &_inner_error_); + g_debug ("mpris-controller.vala:93: new position = %f", new_time_position * 1000); + _dynamic_PositionSet6 (self->priv->_mpris_player, (gint32) new_time_position, &_inner_error_); if (_inner_error_ != NULL) { _g_free0 (time_value); _g_hash_table_unref0 (data); @@ -484,18 +401,6 @@ void mpris_controller_set_position (MprisController* self, double position) { g_clear_error (&_inner_error_); return; } - scrub = (_tmp0_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), IS_SCRUB_MENUITEM (_tmp0_) ? ((ScrubMenuitem*) _tmp0_) : NULL); - _tmp1_ = _dynamic_PositionGet9 (self->priv->_mpris_player, &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (scrub); - _g_free0 (time_value); - _g_hash_table_unref0 (data); - 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; - } - scrub_menuitem_update_position (scrub, _tmp1_); - _g_object_unref0 (scrub); _g_free0 (time_value); _g_hash_table_unref0 (data); } @@ -515,17 +420,15 @@ static void mpris_controller_onStatusChange (MprisController* self, DBusGProxy* gint play_state; GHashTable* ht; GValue v = {0}; - GeeHashSet* _tmp1_; PlayerItem* _tmp0_; - GeeHashSet* _tmp3_; - PlayerItem* _tmp2_; + GeeHashSet* _tmp1_; g_return_if_fail (self != NULL); g_return_if_fail (mpris_client != NULL); - g_debug ("mpris-controller.vala:110: onStatusChange - signal received"); + g_debug ("mpris-controller.vala:104: onStatusChange - signal received"); status = st; ar = (GValueArray*) status; play_state = g_value_get_int (g_value_array_get_nth (ar, (guint) 0)); - g_debug ("mpris-controller.vala:114: onStatusChange - play state %i", play_state); + g_debug ("mpris-controller.vala:108: onStatusChange - play state %i", play_state); ht = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); g_value_init (&v, G_TYPE_INT); g_value_set_int (&v, play_state); @@ -533,15 +436,12 @@ static void mpris_controller_onStatusChange (MprisController* self, DBusGProxy* player_item_update (_tmp0_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT), ht, _tmp1_ = transport_menuitem_attributes_format ()); _g_object_unref0 (_tmp1_); _g_object_unref0 (_tmp0_); - player_item_update (_tmp2_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), ht, _tmp3_ = scrub_menuitem_attributes_format ()); - _g_object_unref0 (_tmp3_); - _g_object_unref0 (_tmp2_); G_IS_VALUE (&v) ? (g_value_unset (&v), NULL) : NULL; _g_hash_table_unref0 (ht); } -static void _dynamic_GetStatus10 (DBusGProxy* self, MprisControllerstatus* result, GError** error) { +static void _dynamic_GetStatus7 (DBusGProxy* self, MprisControllerstatus* result, GError** error) { GValueArray* dbus_result; dbus_g_proxy_call (self, "GetStatus", error, G_TYPE_INVALID, dbus_g_type_get_struct ("GValueArray", G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INVALID), &dbus_result, G_TYPE_INVALID); if (*error) { @@ -554,91 +454,36 @@ static void _dynamic_GetStatus10 (DBusGProxy* self, MprisControllerstatus* resul } -static GHashTable* _dynamic_GetMetadata11 (DBusGProxy* self, GError** error) { - GHashTable* result; - dbus_g_proxy_call (self, "GetMetadata", error, G_TYPE_INVALID, dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE), &result, G_TYPE_INVALID); - if (*error) { - return NULL; - } - return result; -} - - -static gint32 _dynamic_PositionGet12 (DBusGProxy* self, GError** error) { - gint32 result; - dbus_g_proxy_call (self, "PositionGet", error, G_TYPE_INVALID, G_TYPE_INT, &result, G_TYPE_INVALID); - if (*error) { - return 0; - } - return result; -} - - static void mpris_controller_onTrackChange (MprisController* self, DBusGProxy* mpris_client, GHashTable* ht) { - GError * _inner_error_; - GeeHashSet* _tmp1_; PlayerItem* _tmp0_; - GeeHashSet* _tmp3_; - PlayerItem* _tmp2_; - MprisControllerstatus _tmp4_ = {0}; + GeeHashSet* _tmp1_; + MprisControllerstatus _tmp2_ = {0}; MprisControllerstatus st; gint play_state; - PlayerItem* _tmp5_; - ScrubMenuitem* scrub; - GHashTable* _tmp6_; - GeeHashSet* _tmp9_; - GHashTable* _tmp8_; - PlayerItem* _tmp7_; - GeeHashSet* _tmp11_; - PlayerItem* _tmp10_; - gint32 _tmp12_; + PlayerItem* _tmp3_; + GeeHashSet* _tmp4_; + GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (mpris_client != NULL); g_return_if_fail (ht != NULL); - _inner_error_ = NULL; - g_debug ("mpris-controller.vala:125: onTrackChange"); + g_debug ("mpris-controller.vala:118: onTrackChange"); player_item_reset (_tmp0_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), _tmp1_ = metadata_menuitem_attributes_format ()); _g_object_unref0 (_tmp1_); _g_object_unref0 (_tmp0_); - player_item_reset (_tmp2_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), _tmp3_ = scrub_menuitem_attributes_format ()); - _g_object_unref0 (_tmp3_); - _g_object_unref0 (_tmp2_); - st = (_dynamic_GetStatus10 (self->priv->_mpris_player, &_tmp4_, &_inner_error_), _tmp4_); + st = (_dynamic_GetStatus7 (self->priv->_mpris_player, &_tmp2_, &_inner_error_), _tmp2_); if (_inner_error_ != NULL) { g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); g_clear_error (&_inner_error_); return; } play_state = (gint) st.playback; - g_debug ("mpris-controller.vala:133: GetStatusChange, about to update scrub with" \ + g_debug ("mpris-controller.vala:124: GetStatusChange, about to update scrub with" \ " play state - %i", play_state); - scrub = (_tmp5_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), IS_SCRUB_MENUITEM (_tmp5_) ? ((ScrubMenuitem*) _tmp5_) : NULL); - scrub_menuitem_update_playstate (scrub, play_state); - _tmp6_ = _dynamic_GetMetadata11 (self->priv->_mpris_player, &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (scrub); - 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; - } - player_item_update (_tmp7_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), _tmp8_ = _tmp6_, _tmp9_ = scrub_menuitem_attributes_format ()); - _g_object_unref0 (_tmp9_); - _g_hash_table_unref0 (_tmp8_); - _g_object_unref0 (_tmp7_); - player_item_update (_tmp10_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), ht, _tmp11_ = metadata_menuitem_attributes_format ()); - _g_object_unref0 (_tmp11_); - _g_object_unref0 (_tmp10_); - g_debug ("mpris-controller.vala:141: about to update the duration on the scrub b" \ + player_item_update (_tmp3_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), ht, _tmp4_ = metadata_menuitem_attributes_format ()); + _g_object_unref0 (_tmp4_); + _g_object_unref0 (_tmp3_); + g_debug ("mpris-controller.vala:128: about to update the duration on the scrub b" \ "ar"); - _tmp12_ = _dynamic_PositionGet12 (self->priv->_mpris_player, &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (scrub); - 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; - } - scrub_menuitem_update_position (scrub, _tmp12_); - _g_object_unref0 (scrub); } @@ -729,11 +574,11 @@ static GObject * mpris_controller_constructor (GType type, guint n_construct_pro self = MPRIS_CONTROLLER (obj); _inner_error_ = NULL; { - DBusGProxy* _tmp4_; - char* _tmp3_; char* _tmp2_; - char* _tmp6_; + char* _tmp3_; + DBusGProxy* _tmp4_; char* _tmp5_; + char* _tmp6_; { DBusGConnection* _tmp0_; DBusGConnection* _tmp1_; diff --git a/src/mpris-controller.vala b/src/mpris-controller.vala index 1e1e00a..fc9eee0 100644 --- a/src/mpris-controller.vala +++ b/src/mpris-controller.vala @@ -61,10 +61,6 @@ public class MprisController : GLib.Object (this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(play_state); this.owner.custom_items[PlayerController.widget_order.METADATA].update(this.mpris_player.GetMetadata(), MetadataMenuitem.attributes_format()); - this.owner.custom_items[PlayerController.widget_order.SCRUB].update(this.mpris_player.GetMetadata(), - ScrubMenuitem.attributes_format()); - ScrubMenuitem scrub = this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem; - scrub.update_position(this.mpris_player.PositionGet()); } public void transport_event(TransportMenuitem.action command) @@ -96,8 +92,6 @@ public class MprisController : GLib.Object double new_time_position = total_time * position/100.0; debug("new position = %f", (new_time_position * 1000)); this.mpris_player.PositionSet((int32)(new_time_position)); - ScrubMenuitem scrub = this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem; - scrub.update_position(this.mpris_player.PositionGet()); } public bool connected() @@ -117,7 +111,6 @@ public class MprisController : GLib.Object v.set_int(play_state); ht.insert("state", v); this.owner.custom_items[PlayerController.widget_order.TRANSPORT].update(ht, TransportMenuitem.attributes_format()); - this.owner.custom_items[PlayerController.widget_order.SCRUB].update(ht, ScrubMenuitem.attributes_format()); } private void onTrackChange(dynamic DBus.Object mpris_client, HashTable ht) @@ -125,21 +118,13 @@ public class MprisController : GLib.Object debug("onTrackChange"); this.owner.custom_items[PlayerController.widget_order.METADATA].reset(MetadataMenuitem.attributes_format()); - this.owner.custom_items[PlayerController.widget_order.SCRUB].reset(ScrubMenuitem.attributes_format()); - //HashTable status_hash = new HashTable(str_hash, str_equal); status st = this.mpris_player.GetStatus(); int play_state = st.playback; debug("GetStatusChange, about to update scrub with play state - %i", play_state); - ScrubMenuitem scrub = this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem; - scrub.update_playstate(play_state); - this.owner.custom_items[PlayerController.widget_order.SCRUB].update(this.mpris_player.GetMetadata(), - ScrubMenuitem.attributes_format()); this.owner.custom_items[PlayerController.widget_order.METADATA].update(ht, MetadataMenuitem.attributes_format()); debug("about to update the duration on the scrub bar"); - // temporary fix - scrub.update_position(this.mpris_player.PositionGet()); } } diff --git a/src/mpris2-controller.c b/src/mpris2-controller.c index a6546bb..87ec14a 100644 --- a/src/mpris2-controller.c +++ b/src/mpris2-controller.c @@ -1,4 +1,4 @@ -/* mpris2-controller.c generated by valac 0.9.5, the Vala compiler +/* mpris2-controller.c generated by valac 0.9.7, the Vala compiler * generated from mpris2-controller.vala, do not modify */ /* @@ -125,16 +125,6 @@ typedef struct _MprisBridgeClass MprisBridgeClass; typedef struct _TransportMenuitem TransportMenuitem; typedef struct _TransportMenuitemClass TransportMenuitemClass; -#define TYPE_SCRUB_MENUITEM (scrub_menuitem_get_type ()) -#define SCRUB_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SCRUB_MENUITEM, ScrubMenuitem)) -#define SCRUB_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SCRUB_MENUITEM, ScrubMenuitemClass)) -#define IS_SCRUB_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SCRUB_MENUITEM)) -#define IS_SCRUB_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SCRUB_MENUITEM)) -#define SCRUB_MENUITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SCRUB_MENUITEM, ScrubMenuitemClass)) - -typedef struct _ScrubMenuitem ScrubMenuitem; -typedef struct _ScrubMenuitemClass ScrubMenuitemClass; - #define TRANSPORT_MENUITEM_TYPE_ACTION (transport_menuitem_action_get_type ()) #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) #define _dbus_g_connection_unref0(var) ((var == NULL) ? NULL : (var = (dbus_g_connection_unref (var), NULL))) @@ -225,7 +215,6 @@ typedef enum { PLAYER_CONTROLLER_WIDGET_ORDER_SEPARATOR, PLAYER_CONTROLLER_WIDGET_ORDER_TITLE, PLAYER_CONTROLLER_WIDGET_ORDER_METADATA, - PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB, PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT } PlayerControllerwidget_order; @@ -367,6 +356,7 @@ enum { #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); static GValue* _g_value_dup (GValue* self); static gint mpris2_controller_determine_play_state (Mpris2Controller* self, const char* status); PlayerController* mpris2_controller_get_owner (Mpris2Controller* self); @@ -375,22 +365,19 @@ GType mpris_bridge_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, gint state); -GType scrub_menuitem_get_type (void) G_GNUC_CONST; -void scrub_menuitem_update_playstate (ScrubMenuitem* self, gint state); -void scrub_menuitem_update_position (ScrubMenuitem* self, gint32 new_position); -MprisPlayer* mpris2_controller_get_player (Mpris2Controller* self); +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); -GeeHashSet* scrub_menuitem_attributes_format (void); -void mpris2_controller_property_changed_cb (Mpris2Controller* self, const char* interface_source, GHashTable* changed_properties, char** invalid, int invalid_length1); +MprisPlayer* mpris2_controller_get_player (Mpris2Controller* 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_event (Mpris2Controller* self, TransportMenuitemaction command); void mpris2_controller_set_position (Mpris2Controller* self, double position); void mpris2_controller_onSeeked (Mpris2Controller* self, gint64 position); -MprisRoot* mpris2_controller_get_mpris2_root (Mpris2Controller* self); 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); @@ -1182,74 +1169,74 @@ static void mpris_root_dbus_proxy_Quit (MprisRoot* self, GError** error) { GQuark _edomain; gint _ecode; if (strstr (_dbus_error.name, "org.freedesktop.DBus.Error") == _dbus_error.name) { - const char* _tmp20_; + const char* _tmp0_; _edomain = DBUS_GERROR; - _tmp20_ = _dbus_error.name + 27; - if (strcmp (_tmp20_, "Failed") == 0) { + _tmp0_ = _dbus_error.name + 27; + if (strcmp (_tmp0_, "Failed") == 0) { _ecode = DBUS_GERROR_FAILED; - } else if (strcmp (_tmp20_, "NoMemory") == 0) { + } else if (strcmp (_tmp0_, "NoMemory") == 0) { _ecode = DBUS_GERROR_NO_MEMORY; - } else if (strcmp (_tmp20_, "ServiceUnknown") == 0) { + } else if (strcmp (_tmp0_, "ServiceUnknown") == 0) { _ecode = DBUS_GERROR_SERVICE_UNKNOWN; - } else if (strcmp (_tmp20_, "NameHasNoOwner") == 0) { + } else if (strcmp (_tmp0_, "NameHasNoOwner") == 0) { _ecode = DBUS_GERROR_NAME_HAS_NO_OWNER; - } else if (strcmp (_tmp20_, "NoReply") == 0) { + } else if (strcmp (_tmp0_, "NoReply") == 0) { _ecode = DBUS_GERROR_NO_REPLY; - } else if (strcmp (_tmp20_, "IOError") == 0) { + } else if (strcmp (_tmp0_, "IOError") == 0) { _ecode = DBUS_GERROR_IO_ERROR; - } else if (strcmp (_tmp20_, "BadAddress") == 0) { + } else if (strcmp (_tmp0_, "BadAddress") == 0) { _ecode = DBUS_GERROR_BAD_ADDRESS; - } else if (strcmp (_tmp20_, "NotSupported") == 0) { + } else if (strcmp (_tmp0_, "NotSupported") == 0) { _ecode = DBUS_GERROR_NOT_SUPPORTED; - } else if (strcmp (_tmp20_, "LimitsExceeded") == 0) { + } else if (strcmp (_tmp0_, "LimitsExceeded") == 0) { _ecode = DBUS_GERROR_LIMITS_EXCEEDED; - } else if (strcmp (_tmp20_, "AccessDenied") == 0) { + } else if (strcmp (_tmp0_, "AccessDenied") == 0) { _ecode = DBUS_GERROR_ACCESS_DENIED; - } else if (strcmp (_tmp20_, "AuthFailed") == 0) { + } else if (strcmp (_tmp0_, "AuthFailed") == 0) { _ecode = DBUS_GERROR_AUTH_FAILED; - } else if (strcmp (_tmp20_, "NoServer") == 0) { + } else if (strcmp (_tmp0_, "NoServer") == 0) { _ecode = DBUS_GERROR_NO_SERVER; - } else if (strcmp (_tmp20_, "Timeout") == 0) { + } else if (strcmp (_tmp0_, "Timeout") == 0) { _ecode = DBUS_GERROR_TIMEOUT; - } else if (strcmp (_tmp20_, "NoNetwork") == 0) { + } else if (strcmp (_tmp0_, "NoNetwork") == 0) { _ecode = DBUS_GERROR_NO_NETWORK; - } else if (strcmp (_tmp20_, "AddressInUse") == 0) { + } else if (strcmp (_tmp0_, "AddressInUse") == 0) { _ecode = DBUS_GERROR_ADDRESS_IN_USE; - } else if (strcmp (_tmp20_, "Disconnected") == 0) { + } else if (strcmp (_tmp0_, "Disconnected") == 0) { _ecode = DBUS_GERROR_DISCONNECTED; - } else if (strcmp (_tmp20_, "InvalidArgs") == 0) { + } else if (strcmp (_tmp0_, "InvalidArgs") == 0) { _ecode = DBUS_GERROR_INVALID_ARGS; - } else if (strcmp (_tmp20_, "FileNotFound") == 0) { + } else if (strcmp (_tmp0_, "FileNotFound") == 0) { _ecode = DBUS_GERROR_FILE_NOT_FOUND; - } else if (strcmp (_tmp20_, "FileExists") == 0) { + } else if (strcmp (_tmp0_, "FileExists") == 0) { _ecode = DBUS_GERROR_FILE_EXISTS; - } else if (strcmp (_tmp20_, "UnknownMethod") == 0) { + } else if (strcmp (_tmp0_, "UnknownMethod") == 0) { _ecode = DBUS_GERROR_UNKNOWN_METHOD; - } else if (strcmp (_tmp20_, "TimedOut") == 0) { + } else if (strcmp (_tmp0_, "TimedOut") == 0) { _ecode = DBUS_GERROR_TIMED_OUT; - } else if (strcmp (_tmp20_, "MatchRuleNotFound") == 0) { + } else if (strcmp (_tmp0_, "MatchRuleNotFound") == 0) { _ecode = DBUS_GERROR_MATCH_RULE_NOT_FOUND; - } else if (strcmp (_tmp20_, "MatchRuleInvalid") == 0) { + } else if (strcmp (_tmp0_, "MatchRuleInvalid") == 0) { _ecode = DBUS_GERROR_MATCH_RULE_INVALID; - } else if (strcmp (_tmp20_, "Spawn.ExecFailed") == 0) { + } else if (strcmp (_tmp0_, "Spawn.ExecFailed") == 0) { _ecode = DBUS_GERROR_SPAWN_EXEC_FAILED; - } else if (strcmp (_tmp20_, "Spawn.ForkFailed") == 0) { + } else if (strcmp (_tmp0_, "Spawn.ForkFailed") == 0) { _ecode = DBUS_GERROR_SPAWN_FORK_FAILED; - } else if (strcmp (_tmp20_, "Spawn.ChildExited") == 0) { + } else if (strcmp (_tmp0_, "Spawn.ChildExited") == 0) { _ecode = DBUS_GERROR_SPAWN_CHILD_EXITED; - } else if (strcmp (_tmp20_, "Spawn.ChildSignaled") == 0) { + } else if (strcmp (_tmp0_, "Spawn.ChildSignaled") == 0) { _ecode = DBUS_GERROR_SPAWN_CHILD_SIGNALED; - } else if (strcmp (_tmp20_, "Spawn.Failed") == 0) { + } else if (strcmp (_tmp0_, "Spawn.Failed") == 0) { _ecode = DBUS_GERROR_SPAWN_FAILED; - } else if (strcmp (_tmp20_, "UnixProcessIdUnknown") == 0) { + } else if (strcmp (_tmp0_, "UnixProcessIdUnknown") == 0) { _ecode = DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN; - } else if (strcmp (_tmp20_, "InvalidSignature") == 0) { + } else if (strcmp (_tmp0_, "InvalidSignature") == 0) { _ecode = DBUS_GERROR_INVALID_SIGNATURE; - } else if (strcmp (_tmp20_, "InvalidFileContent") == 0) { + } else if (strcmp (_tmp0_, "InvalidFileContent") == 0) { _ecode = DBUS_GERROR_INVALID_FILE_CONTENT; - } else if (strcmp (_tmp20_, "SELinuxSecurityContextUnknown") == 0) { + } else if (strcmp (_tmp0_, "SELinuxSecurityContextUnknown") == 0) { _ecode = DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN; - } else if (strcmp (_tmp20_, "RemoteException") == 0) { + } else if (strcmp (_tmp0_, "RemoteException") == 0) { _ecode = DBUS_GERROR_REMOTE_EXCEPTION; } } @@ -1287,74 +1274,74 @@ static void mpris_root_dbus_proxy_Raise (MprisRoot* self, GError** error) { GQuark _edomain; gint _ecode; if (strstr (_dbus_error.name, "org.freedesktop.DBus.Error") == _dbus_error.name) { - const char* _tmp21_; + const char* _tmp1_; _edomain = DBUS_GERROR; - _tmp21_ = _dbus_error.name + 27; - if (strcmp (_tmp21_, "Failed") == 0) { + _tmp1_ = _dbus_error.name + 27; + if (strcmp (_tmp1_, "Failed") == 0) { _ecode = DBUS_GERROR_FAILED; - } else if (strcmp (_tmp21_, "NoMemory") == 0) { + } else if (strcmp (_tmp1_, "NoMemory") == 0) { _ecode = DBUS_GERROR_NO_MEMORY; - } else if (strcmp (_tmp21_, "ServiceUnknown") == 0) { + } else if (strcmp (_tmp1_, "ServiceUnknown") == 0) { _ecode = DBUS_GERROR_SERVICE_UNKNOWN; - } else if (strcmp (_tmp21_, "NameHasNoOwner") == 0) { + } else if (strcmp (_tmp1_, "NameHasNoOwner") == 0) { _ecode = DBUS_GERROR_NAME_HAS_NO_OWNER; - } else if (strcmp (_tmp21_, "NoReply") == 0) { + } else if (strcmp (_tmp1_, "NoReply") == 0) { _ecode = DBUS_GERROR_NO_REPLY; - } else if (strcmp (_tmp21_, "IOError") == 0) { + } else if (strcmp (_tmp1_, "IOError") == 0) { _ecode = DBUS_GERROR_IO_ERROR; - } else if (strcmp (_tmp21_, "BadAddress") == 0) { + } else if (strcmp (_tmp1_, "BadAddress") == 0) { _ecode = DBUS_GERROR_BAD_ADDRESS; - } else if (strcmp (_tmp21_, "NotSupported") == 0) { + } else if (strcmp (_tmp1_, "NotSupported") == 0) { _ecode = DBUS_GERROR_NOT_SUPPORTED; - } else if (strcmp (_tmp21_, "LimitsExceeded") == 0) { + } else if (strcmp (_tmp1_, "LimitsExceeded") == 0) { _ecode = DBUS_GERROR_LIMITS_EXCEEDED; - } else if (strcmp (_tmp21_, "AccessDenied") == 0) { + } else if (strcmp (_tmp1_, "AccessDenied") == 0) { _ecode = DBUS_GERROR_ACCESS_DENIED; - } else if (strcmp (_tmp21_, "AuthFailed") == 0) { + } else if (strcmp (_tmp1_, "AuthFailed") == 0) { _ecode = DBUS_GERROR_AUTH_FAILED; - } else if (strcmp (_tmp21_, "NoServer") == 0) { + } else if (strcmp (_tmp1_, "NoServer") == 0) { _ecode = DBUS_GERROR_NO_SERVER; - } else if (strcmp (_tmp21_, "Timeout") == 0) { + } else if (strcmp (_tmp1_, "Timeout") == 0) { _ecode = DBUS_GERROR_TIMEOUT; - } else if (strcmp (_tmp21_, "NoNetwork") == 0) { + } else if (strcmp (_tmp1_, "NoNetwork") == 0) { _ecode = DBUS_GERROR_NO_NETWORK; - } else if (strcmp (_tmp21_, "AddressInUse") == 0) { + } else if (strcmp (_tmp1_, "AddressInUse") == 0) { _ecode = DBUS_GERROR_ADDRESS_IN_USE; - } else if (strcmp (_tmp21_, "Disconnected") == 0) { + } else if (strcmp (_tmp1_, "Disconnected") == 0) { _ecode = DBUS_GERROR_DISCONNECTED; - } else if (strcmp (_tmp21_, "InvalidArgs") == 0) { + } else if (strcmp (_tmp1_, "InvalidArgs") == 0) { _ecode = DBUS_GERROR_INVALID_ARGS; - } else if (strcmp (_tmp21_, "FileNotFound") == 0) { + } else if (strcmp (_tmp1_, "FileNotFound") == 0) { _ecode = DBUS_GERROR_FILE_NOT_FOUND; - } else if (strcmp (_tmp21_, "FileExists") == 0) { + } else if (strcmp (_tmp1_, "FileExists") == 0) { _ecode = DBUS_GERROR_FILE_EXISTS; - } else if (strcmp (_tmp21_, "UnknownMethod") == 0) { + } else if (strcmp (_tmp1_, "UnknownMethod") == 0) { _ecode = DBUS_GERROR_UNKNOWN_METHOD; - } else if (strcmp (_tmp21_, "TimedOut") == 0) { + } else if (strcmp (_tmp1_, "TimedOut") == 0) { _ecode = DBUS_GERROR_TIMED_OUT; - } else if (strcmp (_tmp21_, "MatchRuleNotFound") == 0) { + } else if (strcmp (_tmp1_, "MatchRuleNotFound") == 0) { _ecode = DBUS_GERROR_MATCH_RULE_NOT_FOUND; - } else if (strcmp (_tmp21_, "MatchRuleInvalid") == 0) { + } else if (strcmp (_tmp1_, "MatchRuleInvalid") == 0) { _ecode = DBUS_GERROR_MATCH_RULE_INVALID; - } else if (strcmp (_tmp21_, "Spawn.ExecFailed") == 0) { + } else if (strcmp (_tmp1_, "Spawn.ExecFailed") == 0) { _ecode = DBUS_GERROR_SPAWN_EXEC_FAILED; - } else if (strcmp (_tmp21_, "Spawn.ForkFailed") == 0) { + } else if (strcmp (_tmp1_, "Spawn.ForkFailed") == 0) { _ecode = DBUS_GERROR_SPAWN_FORK_FAILED; - } else if (strcmp (_tmp21_, "Spawn.ChildExited") == 0) { + } else if (strcmp (_tmp1_, "Spawn.ChildExited") == 0) { _ecode = DBUS_GERROR_SPAWN_CHILD_EXITED; - } else if (strcmp (_tmp21_, "Spawn.ChildSignaled") == 0) { + } else if (strcmp (_tmp1_, "Spawn.ChildSignaled") == 0) { _ecode = DBUS_GERROR_SPAWN_CHILD_SIGNALED; - } else if (strcmp (_tmp21_, "Spawn.Failed") == 0) { + } else if (strcmp (_tmp1_, "Spawn.Failed") == 0) { _ecode = DBUS_GERROR_SPAWN_FAILED; - } else if (strcmp (_tmp21_, "UnixProcessIdUnknown") == 0) { + } else if (strcmp (_tmp1_, "UnixProcessIdUnknown") == 0) { _ecode = DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN; - } else if (strcmp (_tmp21_, "InvalidSignature") == 0) { + } else if (strcmp (_tmp1_, "InvalidSignature") == 0) { _ecode = DBUS_GERROR_INVALID_SIGNATURE; - } else if (strcmp (_tmp21_, "InvalidFileContent") == 0) { + } else if (strcmp (_tmp1_, "InvalidFileContent") == 0) { _ecode = DBUS_GERROR_INVALID_FILE_CONTENT; - } else if (strcmp (_tmp21_, "SELinuxSecurityContextUnknown") == 0) { + } else if (strcmp (_tmp1_, "SELinuxSecurityContextUnknown") == 0) { _ecode = DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN; - } else if (strcmp (_tmp21_, "RemoteException") == 0) { + } else if (strcmp (_tmp1_, "RemoteException") == 0) { _ecode = DBUS_GERROR_REMOTE_EXCEPTION; } } @@ -1377,19 +1364,19 @@ static gboolean mpris_root_dbus_proxy_get_HasTracklist (MprisRoot* self) { DBusGConnection *_connection; DBusMessage *_message, *_reply; DBusMessageIter _iter, _subiter; - const char* _tmp22_; - const char* _tmp23_; + const char* _tmp2_; + const char* _tmp3_; gboolean _result; - dbus_bool_t _tmp24_; + 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); - _tmp22_ = "org.mpris.MediaPlayer2"; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp22_); - _tmp23_ = "HasTracklist"; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp23_); + _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); @@ -1412,9 +1399,9 @@ static gboolean mpris_root_dbus_proxy_get_HasTracklist (MprisRoot* self) { dbus_message_unref (_reply); return FALSE; } - dbus_message_iter_get_basic (&_subiter, &_tmp24_); + dbus_message_iter_get_basic (&_subiter, &_tmp4_); dbus_message_iter_next (&_subiter); - _result = _tmp24_; + _result = _tmp4_; dbus_message_unref (_reply); return _result; } @@ -1425,21 +1412,21 @@ static void mpris_root_dbus_proxy_set_HasTracklist (MprisRoot* self, gboolean va DBusGConnection *_connection; DBusMessage *_message, *_reply; DBusMessageIter _iter, _subiter; - const char* _tmp25_; - const char* _tmp26_; - dbus_bool_t _tmp27_; + 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); - _tmp25_ = "org.mpris.MediaPlayer2"; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp25_); - _tmp26_ = "HasTracklist"; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp26_); + _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); - _tmp27_ = value; - dbus_message_iter_append_basic (&_subiter, DBUS_TYPE_BOOLEAN, &_tmp27_); + _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); @@ -1466,19 +1453,19 @@ static gboolean mpris_root_dbus_proxy_get_CanQuit (MprisRoot* self) { DBusGConnection *_connection; DBusMessage *_message, *_reply; DBusMessageIter _iter, _subiter; - const char* _tmp28_; - const char* _tmp29_; + const char* _tmp8_; + const char* _tmp9_; gboolean _result; - dbus_bool_t _tmp30_; + 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); - _tmp28_ = "org.mpris.MediaPlayer2"; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp28_); - _tmp29_ = "CanQuit"; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp29_); + _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); @@ -1501,9 +1488,9 @@ static gboolean mpris_root_dbus_proxy_get_CanQuit (MprisRoot* self) { dbus_message_unref (_reply); return FALSE; } - dbus_message_iter_get_basic (&_subiter, &_tmp30_); + dbus_message_iter_get_basic (&_subiter, &_tmp10_); dbus_message_iter_next (&_subiter); - _result = _tmp30_; + _result = _tmp10_; dbus_message_unref (_reply); return _result; } @@ -1514,21 +1501,21 @@ static void mpris_root_dbus_proxy_set_CanQuit (MprisRoot* self, gboolean value) DBusGConnection *_connection; DBusMessage *_message, *_reply; DBusMessageIter _iter, _subiter; - const char* _tmp31_; - const char* _tmp32_; - dbus_bool_t _tmp33_; + 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); - _tmp31_ = "org.mpris.MediaPlayer2"; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp31_); - _tmp32_ = "CanQuit"; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp32_); + _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); - _tmp33_ = value; - dbus_message_iter_append_basic (&_subiter, DBUS_TYPE_BOOLEAN, &_tmp33_); + _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); @@ -1555,19 +1542,19 @@ static gboolean mpris_root_dbus_proxy_get_CanRaise (MprisRoot* self) { DBusGConnection *_connection; DBusMessage *_message, *_reply; DBusMessageIter _iter, _subiter; - const char* _tmp34_; - const char* _tmp35_; + const char* _tmp14_; + const char* _tmp15_; gboolean _result; - dbus_bool_t _tmp36_; + 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); - _tmp34_ = "org.mpris.MediaPlayer2"; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp34_); - _tmp35_ = "CanRaise"; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp35_); + _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); @@ -1590,9 +1577,9 @@ static gboolean mpris_root_dbus_proxy_get_CanRaise (MprisRoot* self) { dbus_message_unref (_reply); return FALSE; } - dbus_message_iter_get_basic (&_subiter, &_tmp36_); + dbus_message_iter_get_basic (&_subiter, &_tmp16_); dbus_message_iter_next (&_subiter); - _result = _tmp36_; + _result = _tmp16_; dbus_message_unref (_reply); return _result; } @@ -1603,21 +1590,21 @@ static void mpris_root_dbus_proxy_set_CanRaise (MprisRoot* self, gboolean value) DBusGConnection *_connection; DBusMessage *_message, *_reply; DBusMessageIter _iter, _subiter; - const char* _tmp37_; - const char* _tmp38_; - dbus_bool_t _tmp39_; + 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); - _tmp37_ = "org.mpris.MediaPlayer2"; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp37_); - _tmp38_ = "CanRaise"; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp38_); + _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); - _tmp39_ = value; - dbus_message_iter_append_basic (&_subiter, DBUS_TYPE_BOOLEAN, &_tmp39_); + _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); @@ -1644,19 +1631,19 @@ static char* mpris_root_dbus_proxy_get_Identity (MprisRoot* self) { DBusGConnection *_connection; DBusMessage *_message, *_reply; DBusMessageIter _iter, _subiter; - const char* _tmp40_; - const char* _tmp41_; + const char* _tmp20_; + const char* _tmp21_; char* _result; - const char* _tmp42_; + 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); - _tmp40_ = "org.mpris.MediaPlayer2"; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp40_); - _tmp41_ = "Identity"; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp41_); + _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); @@ -1679,9 +1666,9 @@ static char* mpris_root_dbus_proxy_get_Identity (MprisRoot* self) { dbus_message_unref (_reply); return NULL; } - dbus_message_iter_get_basic (&_subiter, &_tmp42_); + dbus_message_iter_get_basic (&_subiter, &_tmp22_); dbus_message_iter_next (&_subiter); - _result = g_strdup (_tmp42_); + _result = g_strdup (_tmp22_); dbus_message_unref (_reply); return _result; } @@ -1692,21 +1679,21 @@ static void mpris_root_dbus_proxy_set_Identity (MprisRoot* self, const char* val DBusGConnection *_connection; DBusMessage *_message, *_reply; DBusMessageIter _iter, _subiter; - const char* _tmp43_; - const char* _tmp44_; - const char* _tmp45_; + 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); - _tmp43_ = "org.mpris.MediaPlayer2"; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp43_); - _tmp44_ = "Identity"; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp44_); + _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); - _tmp45_ = value; - dbus_message_iter_append_basic (&_subiter, DBUS_TYPE_STRING, &_tmp45_); + _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); @@ -1733,19 +1720,19 @@ static char* mpris_root_dbus_proxy_get_DesktopEntry (MprisRoot* self) { DBusGConnection *_connection; DBusMessage *_message, *_reply; DBusMessageIter _iter, _subiter; - const char* _tmp46_; - const char* _tmp47_; + const char* _tmp26_; + const char* _tmp27_; char* _result; - const char* _tmp48_; + 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); - _tmp46_ = "org.mpris.MediaPlayer2"; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp46_); - _tmp47_ = "DesktopEntry"; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp47_); + _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); @@ -1768,9 +1755,9 @@ static char* mpris_root_dbus_proxy_get_DesktopEntry (MprisRoot* self) { dbus_message_unref (_reply); return NULL; } - dbus_message_iter_get_basic (&_subiter, &_tmp48_); + dbus_message_iter_get_basic (&_subiter, &_tmp28_); dbus_message_iter_next (&_subiter); - _result = g_strdup (_tmp48_); + _result = g_strdup (_tmp28_); dbus_message_unref (_reply); return _result; } @@ -1781,21 +1768,21 @@ static void mpris_root_dbus_proxy_set_DesktopEntry (MprisRoot* self, const char* DBusGConnection *_connection; DBusMessage *_message, *_reply; DBusMessageIter _iter, _subiter; - const char* _tmp49_; - const char* _tmp50_; - const char* _tmp51_; + 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); - _tmp49_ = "org.mpris.MediaPlayer2"; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp49_); - _tmp50_ = "DesktopEntry"; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp50_); + _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); - _tmp51_ = value; - dbus_message_iter_append_basic (&_subiter, DBUS_TYPE_STRING, &_tmp51_); + _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); @@ -1932,124 +1919,124 @@ static DBusHandlerResult _dbus_mpris_player_property_get (MprisPlayer* self, DBu DBusMessage* reply; DBusMessageIter iter, reply_iter, subiter; char* interface_name; - const char* _tmp52_; + const char* _tmp0_; char* property_name; - const char* _tmp53_; + 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, &_tmp52_); + dbus_message_iter_get_basic (&iter, &_tmp0_); dbus_message_iter_next (&iter); - interface_name = g_strdup (_tmp52_); - dbus_message_iter_get_basic (&iter, &_tmp53_); + interface_name = g_strdup (_tmp0_); + dbus_message_iter_get_basic (&iter, &_tmp1_); dbus_message_iter_next (&iter); - property_name = g_strdup (_tmp53_); + property_name = g_strdup (_tmp1_); if ((strcmp (interface_name, "org.mpris.MediaPlayer2.Player") == 0) && (strcmp (property_name, "Metadata") == 0)) { GHashTable* result; - DBusMessageIter _tmp54_, _tmp55_; - GHashTableIter _tmp56_; - gpointer _tmp57_, _tmp58_; + 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}", &_tmp54_); - g_hash_table_iter_init (&_tmp56_, result); - while (g_hash_table_iter_next (&_tmp56_, &_tmp57_, &_tmp58_)) { + 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* _tmp59_; - DBusMessageIter _tmp60_; - dbus_message_iter_open_container (&_tmp54_, DBUS_TYPE_DICT_ENTRY, NULL, &_tmp55_); - _key = (char*) _tmp57_; - _value = (GValue*) _tmp58_; - _tmp59_ = _key; - dbus_message_iter_append_basic (&_tmp55_, DBUS_TYPE_STRING, &_tmp59_); + 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 _tmp61_; - dbus_message_iter_open_container (&_tmp55_, DBUS_TYPE_VARIANT, "y", &_tmp60_); - _tmp61_ = g_value_get_uchar (_value); - dbus_message_iter_append_basic (&_tmp60_, DBUS_TYPE_BYTE, &_tmp61_); - dbus_message_iter_close_container (&_tmp55_, &_tmp60_); + 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 _tmp62_; - dbus_message_iter_open_container (&_tmp55_, DBUS_TYPE_VARIANT, "b", &_tmp60_); - _tmp62_ = g_value_get_boolean (_value); - dbus_message_iter_append_basic (&_tmp60_, DBUS_TYPE_BOOLEAN, &_tmp62_); - dbus_message_iter_close_container (&_tmp55_, &_tmp60_); + 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 _tmp63_; - dbus_message_iter_open_container (&_tmp55_, DBUS_TYPE_VARIANT, "i", &_tmp60_); - _tmp63_ = g_value_get_int (_value); - dbus_message_iter_append_basic (&_tmp60_, DBUS_TYPE_INT32, &_tmp63_); - dbus_message_iter_close_container (&_tmp55_, &_tmp60_); + 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 _tmp64_; - dbus_message_iter_open_container (&_tmp55_, DBUS_TYPE_VARIANT, "u", &_tmp60_); - _tmp64_ = g_value_get_uint (_value); - dbus_message_iter_append_basic (&_tmp60_, DBUS_TYPE_UINT32, &_tmp64_); - dbus_message_iter_close_container (&_tmp55_, &_tmp60_); + 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 _tmp65_; - dbus_message_iter_open_container (&_tmp55_, DBUS_TYPE_VARIANT, "x", &_tmp60_); - _tmp65_ = g_value_get_int64 (_value); - dbus_message_iter_append_basic (&_tmp60_, DBUS_TYPE_INT64, &_tmp65_); - dbus_message_iter_close_container (&_tmp55_, &_tmp60_); + 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 _tmp66_; - dbus_message_iter_open_container (&_tmp55_, DBUS_TYPE_VARIANT, "t", &_tmp60_); - _tmp66_ = g_value_get_uint64 (_value); - dbus_message_iter_append_basic (&_tmp60_, DBUS_TYPE_UINT64, &_tmp66_); - dbus_message_iter_close_container (&_tmp55_, &_tmp60_); + 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 _tmp67_; - dbus_message_iter_open_container (&_tmp55_, DBUS_TYPE_VARIANT, "d", &_tmp60_); - _tmp67_ = g_value_get_double (_value); - dbus_message_iter_append_basic (&_tmp60_, DBUS_TYPE_DOUBLE, &_tmp67_); - dbus_message_iter_close_container (&_tmp55_, &_tmp60_); + 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* _tmp68_; - dbus_message_iter_open_container (&_tmp55_, DBUS_TYPE_VARIANT, "s", &_tmp60_); - _tmp68_ = g_value_get_string (_value); - dbus_message_iter_append_basic (&_tmp60_, DBUS_TYPE_STRING, &_tmp68_); - dbus_message_iter_close_container (&_tmp55_, &_tmp60_); + 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** _tmp69_; - DBusMessageIter _tmp70_; - int _tmp71_; - dbus_message_iter_open_container (&_tmp55_, DBUS_TYPE_VARIANT, "as", &_tmp60_); - _tmp69_ = g_value_get_boxed (_value); - dbus_message_iter_open_container (&_tmp60_, DBUS_TYPE_ARRAY, "s", &_tmp70_); - for (_tmp71_ = 0; _tmp71_ < g_strv_length (g_value_get_boxed (_value)); _tmp71_++) { - const char* _tmp72_; - _tmp72_ = *_tmp69_; - dbus_message_iter_append_basic (&_tmp70_, DBUS_TYPE_STRING, &_tmp72_); - _tmp69_++; + 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 (&_tmp60_, &_tmp70_); - dbus_message_iter_close_container (&_tmp55_, &_tmp60_); + dbus_message_iter_close_container (&_tmp8_, &_tmp18_); + dbus_message_iter_close_container (&_tmp3_, &_tmp8_); } - dbus_message_iter_close_container (&_tmp54_, &_tmp55_); + dbus_message_iter_close_container (&_tmp2_, &_tmp3_); } - dbus_message_iter_close_container (&subiter, &_tmp54_); + 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 _tmp73_; + dbus_int32_t _tmp21_; dbus_message_iter_open_container (&reply_iter, DBUS_TYPE_VARIANT, "i", &subiter); result = mpris_player_get_Position (self); - _tmp73_ = result; - dbus_message_iter_append_basic (&subiter, DBUS_TYPE_INT32, &_tmp73_); + _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* _tmp74_; + const char* _tmp22_; dbus_message_iter_open_container (&reply_iter, DBUS_TYPE_VARIANT, "s", &subiter); result = mpris_player_get_PlaybackStatus (self); - _tmp74_ = result; - dbus_message_iter_append_basic (&subiter, DBUS_TYPE_STRING, &_tmp74_); + _tmp22_ = result; + dbus_message_iter_append_basic (&subiter, DBUS_TYPE_STRING, &_tmp22_); _g_free0 (result); dbus_message_iter_close_container (&reply_iter, &subiter); } else { @@ -2072,146 +2059,146 @@ static DBusHandlerResult _dbus_mpris_player_property_set (MprisPlayer* self, DBu DBusMessage* reply; DBusMessageIter iter, subiter; char* interface_name; - const char* _tmp75_; + const char* _tmp23_; char* property_name; - const char* _tmp76_; + 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, &_tmp75_); + dbus_message_iter_get_basic (&iter, &_tmp23_); dbus_message_iter_next (&iter); - interface_name = g_strdup (_tmp75_); - dbus_message_iter_get_basic (&iter, &_tmp76_); + interface_name = g_strdup (_tmp23_); + dbus_message_iter_get_basic (&iter, &_tmp24_); dbus_message_iter_next (&iter); - property_name = g_strdup (_tmp76_); + 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* _tmp77_; - DBusMessageIter _tmp78_; - DBusMessageIter _tmp79_; - _tmp77_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); - dbus_message_iter_recurse (&subiter, &_tmp78_); - while (dbus_message_iter_get_arg_type (&_tmp78_)) { + 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* _tmp80_; - GValue _tmp81_ = {0}; - DBusMessageIter _tmp82_; - dbus_message_iter_recurse (&_tmp78_, &_tmp79_); - dbus_message_iter_get_basic (&_tmp79_, &_tmp80_); - dbus_message_iter_next (&_tmp79_); - _key = g_strdup (_tmp80_); - dbus_message_iter_recurse (&_tmp79_, &_tmp82_); - if (dbus_message_iter_get_arg_type (&_tmp82_) == DBUS_TYPE_BYTE) { - guint8 _tmp83_; - dbus_message_iter_get_basic (&_tmp82_, &_tmp83_); - g_value_init (&_tmp81_, G_TYPE_UCHAR); - g_value_set_uchar (&_tmp81_, _tmp83_); - } else if (dbus_message_iter_get_arg_type (&_tmp82_) == DBUS_TYPE_BOOLEAN) { - dbus_bool_t _tmp84_; - dbus_message_iter_get_basic (&_tmp82_, &_tmp84_); - g_value_init (&_tmp81_, G_TYPE_BOOLEAN); - g_value_set_boolean (&_tmp81_, _tmp84_); - } else if (dbus_message_iter_get_arg_type (&_tmp82_) == DBUS_TYPE_INT16) { - dbus_int16_t _tmp85_; - dbus_message_iter_get_basic (&_tmp82_, &_tmp85_); - g_value_init (&_tmp81_, G_TYPE_INT); - g_value_set_int (&_tmp81_, _tmp85_); - } else if (dbus_message_iter_get_arg_type (&_tmp82_) == DBUS_TYPE_UINT16) { - dbus_uint16_t _tmp86_; - dbus_message_iter_get_basic (&_tmp82_, &_tmp86_); - g_value_init (&_tmp81_, G_TYPE_UINT); - g_value_set_uint (&_tmp81_, _tmp86_); - } else if (dbus_message_iter_get_arg_type (&_tmp82_) == DBUS_TYPE_INT32) { - dbus_int32_t _tmp87_; - dbus_message_iter_get_basic (&_tmp82_, &_tmp87_); - g_value_init (&_tmp81_, G_TYPE_INT); - g_value_set_int (&_tmp81_, _tmp87_); - } else if (dbus_message_iter_get_arg_type (&_tmp82_) == DBUS_TYPE_UINT32) { - dbus_uint32_t _tmp88_; - dbus_message_iter_get_basic (&_tmp82_, &_tmp88_); - g_value_init (&_tmp81_, G_TYPE_UINT); - g_value_set_uint (&_tmp81_, _tmp88_); - } else if (dbus_message_iter_get_arg_type (&_tmp82_) == DBUS_TYPE_INT64) { - dbus_int64_t _tmp89_; - dbus_message_iter_get_basic (&_tmp82_, &_tmp89_); - g_value_init (&_tmp81_, G_TYPE_INT64); - g_value_set_int64 (&_tmp81_, _tmp89_); - } else if (dbus_message_iter_get_arg_type (&_tmp82_) == DBUS_TYPE_UINT64) { - dbus_uint64_t _tmp90_; - dbus_message_iter_get_basic (&_tmp82_, &_tmp90_); - g_value_init (&_tmp81_, G_TYPE_UINT64); - g_value_set_uint64 (&_tmp81_, _tmp90_); - } else if (dbus_message_iter_get_arg_type (&_tmp82_) == DBUS_TYPE_DOUBLE) { - double _tmp91_; - dbus_message_iter_get_basic (&_tmp82_, &_tmp91_); - g_value_init (&_tmp81_, G_TYPE_DOUBLE); - g_value_set_double (&_tmp81_, _tmp91_); - } else if (dbus_message_iter_get_arg_type (&_tmp82_) == DBUS_TYPE_STRING) { - const char* _tmp92_; - dbus_message_iter_get_basic (&_tmp82_, &_tmp92_); - g_value_init (&_tmp81_, G_TYPE_STRING); - g_value_take_string (&_tmp81_, g_strdup (_tmp92_)); - } else if (dbus_message_iter_get_arg_type (&_tmp82_) == DBUS_TYPE_OBJECT_PATH) { - const char* _tmp93_; - dbus_message_iter_get_basic (&_tmp82_, &_tmp93_); - g_value_init (&_tmp81_, G_TYPE_STRING); - g_value_take_string (&_tmp81_, g_strdup (_tmp93_)); - } else if (dbus_message_iter_get_arg_type (&_tmp82_) == DBUS_TYPE_SIGNATURE) { - const char* _tmp94_; - dbus_message_iter_get_basic (&_tmp82_, &_tmp94_); - g_value_init (&_tmp81_, G_TYPE_STRING); - g_value_take_string (&_tmp81_, g_strdup (_tmp94_)); - } else if ((dbus_message_iter_get_arg_type (&_tmp82_) == DBUS_TYPE_ARRAY) && (dbus_message_iter_get_element_type (&_tmp82_) == DBUS_TYPE_STRING)) { - const char** _tmp95_; - int _tmp95__length; - int _tmp95__size; - int _tmp95__length1; - DBusMessageIter _tmp96_; - _tmp95_ = g_new (const char*, 5); - _tmp95__length = 0; - _tmp95__size = 4; - _tmp95__length1 = 0; - dbus_message_iter_recurse (&_tmp82_, &_tmp96_); - for (; dbus_message_iter_get_arg_type (&_tmp96_); _tmp95__length1++) { - const char* _tmp97_; - if (_tmp95__size == _tmp95__length) { - _tmp95__size = 2 * _tmp95__size; - _tmp95_ = g_renew (const char*, _tmp95_, _tmp95__size + 1); + 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 (&_tmp96_, &_tmp97_); - dbus_message_iter_next (&_tmp96_); - _tmp95_[_tmp95__length++] = g_strdup (_tmp97_); + dbus_message_iter_get_basic (&_tmp44_, &_tmp45_); + dbus_message_iter_next (&_tmp44_); + _tmp43_[_tmp43__length++] = g_strdup (_tmp45_); } - _tmp95_[_tmp95__length] = NULL; - g_value_init (&_tmp81_, G_TYPE_STRV); - g_value_take_boxed (&_tmp81_, _tmp95_); + _tmp43_[_tmp43__length] = NULL; + g_value_init (&_tmp29_, G_TYPE_STRV); + g_value_take_boxed (&_tmp29_, _tmp43_); } - dbus_message_iter_next (&_tmp79_); - _value = g_memdup (&_tmp81_, sizeof (GValue)); - g_hash_table_insert (_tmp77_, _key, _value); - dbus_message_iter_next (&_tmp78_); + 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 = _tmp77_; + 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 _tmp98_; - dbus_message_iter_get_basic (&subiter, &_tmp98_); + dbus_int32_t _tmp46_; + dbus_message_iter_get_basic (&subiter, &_tmp46_); dbus_message_iter_next (&subiter); - value = _tmp98_; + 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* _tmp99_; - dbus_message_iter_get_basic (&subiter, &_tmp99_); + const char* _tmp47_; + dbus_message_iter_get_basic (&subiter, &_tmp47_); dbus_message_iter_next (&subiter); - value = g_strdup (_tmp99_); + value = g_strdup (_tmp47_); mpris_player_set_PlaybackStatus (self, value); _g_free0 (value); } else { @@ -2234,7 +2221,7 @@ static DBusHandlerResult _dbus_mpris_player_property_get_all (MprisPlayer* self, DBusMessage* reply; DBusMessageIter iter, reply_iter, subiter, entry_iter, value_iter; char* interface_name; - const char* _tmp100_; + const char* _tmp48_; const char* property_name; if (strcmp (dbus_message_get_signature (message), "s")) { return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; @@ -2242,127 +2229,127 @@ static DBusHandlerResult _dbus_mpris_player_property_get_all (MprisPlayer* self, 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, &_tmp100_); + dbus_message_iter_get_basic (&iter, &_tmp48_); dbus_message_iter_next (&iter); - interface_name = g_strdup (_tmp100_); + 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 _tmp101_, _tmp102_; - GHashTableIter _tmp103_; - gpointer _tmp104_, _tmp105_; + 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}", &_tmp101_); - g_hash_table_iter_init (&_tmp103_, result); - while (g_hash_table_iter_next (&_tmp103_, &_tmp104_, &_tmp105_)) { + 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* _tmp106_; - DBusMessageIter _tmp107_; - dbus_message_iter_open_container (&_tmp101_, DBUS_TYPE_DICT_ENTRY, NULL, &_tmp102_); - _key = (char*) _tmp104_; - _value = (GValue*) _tmp105_; - _tmp106_ = _key; - dbus_message_iter_append_basic (&_tmp102_, DBUS_TYPE_STRING, &_tmp106_); + 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 _tmp108_; - dbus_message_iter_open_container (&_tmp102_, DBUS_TYPE_VARIANT, "y", &_tmp107_); - _tmp108_ = g_value_get_uchar (_value); - dbus_message_iter_append_basic (&_tmp107_, DBUS_TYPE_BYTE, &_tmp108_); - dbus_message_iter_close_container (&_tmp102_, &_tmp107_); + 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 _tmp109_; - dbus_message_iter_open_container (&_tmp102_, DBUS_TYPE_VARIANT, "b", &_tmp107_); - _tmp109_ = g_value_get_boolean (_value); - dbus_message_iter_append_basic (&_tmp107_, DBUS_TYPE_BOOLEAN, &_tmp109_); - dbus_message_iter_close_container (&_tmp102_, &_tmp107_); + 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 _tmp110_; - dbus_message_iter_open_container (&_tmp102_, DBUS_TYPE_VARIANT, "i", &_tmp107_); - _tmp110_ = g_value_get_int (_value); - dbus_message_iter_append_basic (&_tmp107_, DBUS_TYPE_INT32, &_tmp110_); - dbus_message_iter_close_container (&_tmp102_, &_tmp107_); + 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 _tmp111_; - dbus_message_iter_open_container (&_tmp102_, DBUS_TYPE_VARIANT, "u", &_tmp107_); - _tmp111_ = g_value_get_uint (_value); - dbus_message_iter_append_basic (&_tmp107_, DBUS_TYPE_UINT32, &_tmp111_); - dbus_message_iter_close_container (&_tmp102_, &_tmp107_); + 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 _tmp112_; - dbus_message_iter_open_container (&_tmp102_, DBUS_TYPE_VARIANT, "x", &_tmp107_); - _tmp112_ = g_value_get_int64 (_value); - dbus_message_iter_append_basic (&_tmp107_, DBUS_TYPE_INT64, &_tmp112_); - dbus_message_iter_close_container (&_tmp102_, &_tmp107_); + 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 _tmp113_; - dbus_message_iter_open_container (&_tmp102_, DBUS_TYPE_VARIANT, "t", &_tmp107_); - _tmp113_ = g_value_get_uint64 (_value); - dbus_message_iter_append_basic (&_tmp107_, DBUS_TYPE_UINT64, &_tmp113_); - dbus_message_iter_close_container (&_tmp102_, &_tmp107_); + 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 _tmp114_; - dbus_message_iter_open_container (&_tmp102_, DBUS_TYPE_VARIANT, "d", &_tmp107_); - _tmp114_ = g_value_get_double (_value); - dbus_message_iter_append_basic (&_tmp107_, DBUS_TYPE_DOUBLE, &_tmp114_); - dbus_message_iter_close_container (&_tmp102_, &_tmp107_); + 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* _tmp115_; - dbus_message_iter_open_container (&_tmp102_, DBUS_TYPE_VARIANT, "s", &_tmp107_); - _tmp115_ = g_value_get_string (_value); - dbus_message_iter_append_basic (&_tmp107_, DBUS_TYPE_STRING, &_tmp115_); - dbus_message_iter_close_container (&_tmp102_, &_tmp107_); + 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** _tmp116_; - DBusMessageIter _tmp117_; - int _tmp118_; - dbus_message_iter_open_container (&_tmp102_, DBUS_TYPE_VARIANT, "as", &_tmp107_); - _tmp116_ = g_value_get_boxed (_value); - dbus_message_iter_open_container (&_tmp107_, DBUS_TYPE_ARRAY, "s", &_tmp117_); - for (_tmp118_ = 0; _tmp118_ < g_strv_length (g_value_get_boxed (_value)); _tmp118_++) { - const char* _tmp119_; - _tmp119_ = *_tmp116_; - dbus_message_iter_append_basic (&_tmp117_, DBUS_TYPE_STRING, &_tmp119_); - _tmp116_++; + 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 (&_tmp107_, &_tmp117_); - dbus_message_iter_close_container (&_tmp102_, &_tmp107_); + dbus_message_iter_close_container (&_tmp55_, &_tmp65_); + dbus_message_iter_close_container (&_tmp50_, &_tmp55_); } - dbus_message_iter_close_container (&_tmp101_, &_tmp102_); + dbus_message_iter_close_container (&_tmp49_, &_tmp50_); } - dbus_message_iter_close_container (&value_iter, &_tmp101_); + 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 _tmp120_; + 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); - _tmp120_ = result; - dbus_message_iter_append_basic (&value_iter, DBUS_TYPE_INT32, &_tmp120_); + _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* _tmp121_; + 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); - _tmp121_ = result; - dbus_message_iter_append_basic (&value_iter, DBUS_TYPE_STRING, &_tmp121_); + _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); @@ -2387,21 +2374,21 @@ static DBusHandlerResult _dbus_mpris_player_SetPosition (MprisPlayer* self, DBus DBusMessageIter iter; GError* error; char* path = NULL; - const char* _tmp122_; + const char* _tmp70_; gint64 pos = 0LL; - dbus_int64_t _tmp123_; + dbus_int64_t _tmp71_; DBusMessage* reply; error = NULL; if (strcmp (dbus_message_get_signature (message), "ox")) { return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } dbus_message_iter_init (message, &iter); - dbus_message_iter_get_basic (&iter, &_tmp122_); + dbus_message_iter_get_basic (&iter, &_tmp70_); dbus_message_iter_next (&iter); - path = g_strdup (_tmp122_); - dbus_message_iter_get_basic (&iter, &_tmp123_); + path = g_strdup (_tmp70_); + dbus_message_iter_get_basic (&iter, &_tmp71_); dbus_message_iter_next (&iter); - pos = _tmp123_; + pos = _tmp71_; mpris_player_SetPosition (self, path, pos, &error); if (error) { if (error->domain == DBUS_GERROR) { @@ -3078,12 +3065,12 @@ static void _dbus_mpris_player_seeked (GObject* _sender, gint64 new_position, DB const char * _path; DBusMessage *_message; DBusMessageIter _iter; - dbus_int64_t _tmp124_; + dbus_int64_t _tmp72_; _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); - _tmp124_ = new_position; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_INT64, &_tmp124_); + _tmp72_ = new_position; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_INT64, &_tmp72_); dbus_connection_send (_connection, _message, NULL); dbus_message_unref (_message); } @@ -3155,15 +3142,15 @@ static GObject* mpris_player_dbus_proxy_construct (GType gtype, guint n_properti static void _dbus_handle_mpris_player_seeked (MprisPlayer* self, DBusConnection* connection, DBusMessage* message) { DBusMessageIter iter; gint64 new_position = 0LL; - dbus_int64_t _tmp125_; + 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, &_tmp125_); + dbus_message_iter_get_basic (&iter, &_tmp32_); dbus_message_iter_next (&iter); - new_position = _tmp125_; + new_position = _tmp32_; g_signal_emit_by_name (self, "seeked", new_position); } @@ -3210,18 +3197,18 @@ static void mpris_player_dbus_proxy_SetPosition (MprisPlayer* self, const char* DBusGConnection *_connection; DBusMessage *_message, *_reply; DBusMessageIter _iter; - const char* _tmp126_; - dbus_int64_t _tmp127_; + const char* _tmp33_; + dbus_int64_t _tmp34_; if (((MprisPlayerDBusProxy*) self)->disposed) { g_set_error (error, DBUS_GERROR, DBUS_GERROR_DISCONNECTED, "%s", "Connection is closed"); return; } _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", "SetPosition"); dbus_message_iter_init_append (_message, &_iter); - _tmp126_ = path; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_OBJECT_PATH, &_tmp126_); - _tmp127_ = pos; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_INT64, &_tmp127_); + _tmp33_ = path; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_OBJECT_PATH, &_tmp33_); + _tmp34_ = pos; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_INT64, &_tmp34_); 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); @@ -3231,74 +3218,74 @@ static void mpris_player_dbus_proxy_SetPosition (MprisPlayer* self, const char* GQuark _edomain; gint _ecode; if (strstr (_dbus_error.name, "org.freedesktop.DBus.Error") == _dbus_error.name) { - const char* _tmp128_; + const char* _tmp35_; _edomain = DBUS_GERROR; - _tmp128_ = _dbus_error.name + 27; - if (strcmp (_tmp128_, "Failed") == 0) { + _tmp35_ = _dbus_error.name + 27; + if (strcmp (_tmp35_, "Failed") == 0) { _ecode = DBUS_GERROR_FAILED; - } else if (strcmp (_tmp128_, "NoMemory") == 0) { + } else if (strcmp (_tmp35_, "NoMemory") == 0) { _ecode = DBUS_GERROR_NO_MEMORY; - } else if (strcmp (_tmp128_, "ServiceUnknown") == 0) { + } else if (strcmp (_tmp35_, "ServiceUnknown") == 0) { _ecode = DBUS_GERROR_SERVICE_UNKNOWN; - } else if (strcmp (_tmp128_, "NameHasNoOwner") == 0) { + } else if (strcmp (_tmp35_, "NameHasNoOwner") == 0) { _ecode = DBUS_GERROR_NAME_HAS_NO_OWNER; - } else if (strcmp (_tmp128_, "NoReply") == 0) { + } else if (strcmp (_tmp35_, "NoReply") == 0) { _ecode = DBUS_GERROR_NO_REPLY; - } else if (strcmp (_tmp128_, "IOError") == 0) { + } else if (strcmp (_tmp35_, "IOError") == 0) { _ecode = DBUS_GERROR_IO_ERROR; - } else if (strcmp (_tmp128_, "BadAddress") == 0) { + } else if (strcmp (_tmp35_, "BadAddress") == 0) { _ecode = DBUS_GERROR_BAD_ADDRESS; - } else if (strcmp (_tmp128_, "NotSupported") == 0) { + } else if (strcmp (_tmp35_, "NotSupported") == 0) { _ecode = DBUS_GERROR_NOT_SUPPORTED; - } else if (strcmp (_tmp128_, "LimitsExceeded") == 0) { + } else if (strcmp (_tmp35_, "LimitsExceeded") == 0) { _ecode = DBUS_GERROR_LIMITS_EXCEEDED; - } else if (strcmp (_tmp128_, "AccessDenied") == 0) { + } else if (strcmp (_tmp35_, "AccessDenied") == 0) { _ecode = DBUS_GERROR_ACCESS_DENIED; - } else if (strcmp (_tmp128_, "AuthFailed") == 0) { + } else if (strcmp (_tmp35_, "AuthFailed") == 0) { _ecode = DBUS_GERROR_AUTH_FAILED; - } else if (strcmp (_tmp128_, "NoServer") == 0) { + } else if (strcmp (_tmp35_, "NoServer") == 0) { _ecode = DBUS_GERROR_NO_SERVER; - } else if (strcmp (_tmp128_, "Timeout") == 0) { + } else if (strcmp (_tmp35_, "Timeout") == 0) { _ecode = DBUS_GERROR_TIMEOUT; - } else if (strcmp (_tmp128_, "NoNetwork") == 0) { + } else if (strcmp (_tmp35_, "NoNetwork") == 0) { _ecode = DBUS_GERROR_NO_NETWORK; - } else if (strcmp (_tmp128_, "AddressInUse") == 0) { + } else if (strcmp (_tmp35_, "AddressInUse") == 0) { _ecode = DBUS_GERROR_ADDRESS_IN_USE; - } else if (strcmp (_tmp128_, "Disconnected") == 0) { + } else if (strcmp (_tmp35_, "Disconnected") == 0) { _ecode = DBUS_GERROR_DISCONNECTED; - } else if (strcmp (_tmp128_, "InvalidArgs") == 0) { + } else if (strcmp (_tmp35_, "InvalidArgs") == 0) { _ecode = DBUS_GERROR_INVALID_ARGS; - } else if (strcmp (_tmp128_, "FileNotFound") == 0) { + } else if (strcmp (_tmp35_, "FileNotFound") == 0) { _ecode = DBUS_GERROR_FILE_NOT_FOUND; - } else if (strcmp (_tmp128_, "FileExists") == 0) { + } else if (strcmp (_tmp35_, "FileExists") == 0) { _ecode = DBUS_GERROR_FILE_EXISTS; - } else if (strcmp (_tmp128_, "UnknownMethod") == 0) { + } else if (strcmp (_tmp35_, "UnknownMethod") == 0) { _ecode = DBUS_GERROR_UNKNOWN_METHOD; - } else if (strcmp (_tmp128_, "TimedOut") == 0) { + } else if (strcmp (_tmp35_, "TimedOut") == 0) { _ecode = DBUS_GERROR_TIMED_OUT; - } else if (strcmp (_tmp128_, "MatchRuleNotFound") == 0) { + } else if (strcmp (_tmp35_, "MatchRuleNotFound") == 0) { _ecode = DBUS_GERROR_MATCH_RULE_NOT_FOUND; - } else if (strcmp (_tmp128_, "MatchRuleInvalid") == 0) { + } else if (strcmp (_tmp35_, "MatchRuleInvalid") == 0) { _ecode = DBUS_GERROR_MATCH_RULE_INVALID; - } else if (strcmp (_tmp128_, "Spawn.ExecFailed") == 0) { + } else if (strcmp (_tmp35_, "Spawn.ExecFailed") == 0) { _ecode = DBUS_GERROR_SPAWN_EXEC_FAILED; - } else if (strcmp (_tmp128_, "Spawn.ForkFailed") == 0) { + } else if (strcmp (_tmp35_, "Spawn.ForkFailed") == 0) { _ecode = DBUS_GERROR_SPAWN_FORK_FAILED; - } else if (strcmp (_tmp128_, "Spawn.ChildExited") == 0) { + } else if (strcmp (_tmp35_, "Spawn.ChildExited") == 0) { _ecode = DBUS_GERROR_SPAWN_CHILD_EXITED; - } else if (strcmp (_tmp128_, "Spawn.ChildSignaled") == 0) { + } else if (strcmp (_tmp35_, "Spawn.ChildSignaled") == 0) { _ecode = DBUS_GERROR_SPAWN_CHILD_SIGNALED; - } else if (strcmp (_tmp128_, "Spawn.Failed") == 0) { + } else if (strcmp (_tmp35_, "Spawn.Failed") == 0) { _ecode = DBUS_GERROR_SPAWN_FAILED; - } else if (strcmp (_tmp128_, "UnixProcessIdUnknown") == 0) { + } else if (strcmp (_tmp35_, "UnixProcessIdUnknown") == 0) { _ecode = DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN; - } else if (strcmp (_tmp128_, "InvalidSignature") == 0) { + } else if (strcmp (_tmp35_, "InvalidSignature") == 0) { _ecode = DBUS_GERROR_INVALID_SIGNATURE; - } else if (strcmp (_tmp128_, "InvalidFileContent") == 0) { + } else if (strcmp (_tmp35_, "InvalidFileContent") == 0) { _ecode = DBUS_GERROR_INVALID_FILE_CONTENT; - } else if (strcmp (_tmp128_, "SELinuxSecurityContextUnknown") == 0) { + } else if (strcmp (_tmp35_, "SELinuxSecurityContextUnknown") == 0) { _ecode = DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN; - } else if (strcmp (_tmp128_, "RemoteException") == 0) { + } else if (strcmp (_tmp35_, "RemoteException") == 0) { _ecode = DBUS_GERROR_REMOTE_EXCEPTION; } } @@ -3336,74 +3323,74 @@ static void mpris_player_dbus_proxy_PlayPause (MprisPlayer* self, GError** error GQuark _edomain; gint _ecode; if (strstr (_dbus_error.name, "org.freedesktop.DBus.Error") == _dbus_error.name) { - const char* _tmp129_; + const char* _tmp36_; _edomain = DBUS_GERROR; - _tmp129_ = _dbus_error.name + 27; - if (strcmp (_tmp129_, "Failed") == 0) { + _tmp36_ = _dbus_error.name + 27; + if (strcmp (_tmp36_, "Failed") == 0) { _ecode = DBUS_GERROR_FAILED; - } else if (strcmp (_tmp129_, "NoMemory") == 0) { + } else if (strcmp (_tmp36_, "NoMemory") == 0) { _ecode = DBUS_GERROR_NO_MEMORY; - } else if (strcmp (_tmp129_, "ServiceUnknown") == 0) { + } else if (strcmp (_tmp36_, "ServiceUnknown") == 0) { _ecode = DBUS_GERROR_SERVICE_UNKNOWN; - } else if (strcmp (_tmp129_, "NameHasNoOwner") == 0) { + } else if (strcmp (_tmp36_, "NameHasNoOwner") == 0) { _ecode = DBUS_GERROR_NAME_HAS_NO_OWNER; - } else if (strcmp (_tmp129_, "NoReply") == 0) { + } else if (strcmp (_tmp36_, "NoReply") == 0) { _ecode = DBUS_GERROR_NO_REPLY; - } else if (strcmp (_tmp129_, "IOError") == 0) { + } else if (strcmp (_tmp36_, "IOError") == 0) { _ecode = DBUS_GERROR_IO_ERROR; - } else if (strcmp (_tmp129_, "BadAddress") == 0) { + } else if (strcmp (_tmp36_, "BadAddress") == 0) { _ecode = DBUS_GERROR_BAD_ADDRESS; - } else if (strcmp (_tmp129_, "NotSupported") == 0) { + } else if (strcmp (_tmp36_, "NotSupported") == 0) { _ecode = DBUS_GERROR_NOT_SUPPORTED; - } else if (strcmp (_tmp129_, "LimitsExceeded") == 0) { + } else if (strcmp (_tmp36_, "LimitsExceeded") == 0) { _ecode = DBUS_GERROR_LIMITS_EXCEEDED; - } else if (strcmp (_tmp129_, "AccessDenied") == 0) { + } else if (strcmp (_tmp36_, "AccessDenied") == 0) { _ecode = DBUS_GERROR_ACCESS_DENIED; - } else if (strcmp (_tmp129_, "AuthFailed") == 0) { + } else if (strcmp (_tmp36_, "AuthFailed") == 0) { _ecode = DBUS_GERROR_AUTH_FAILED; - } else if (strcmp (_tmp129_, "NoServer") == 0) { + } else if (strcmp (_tmp36_, "NoServer") == 0) { _ecode = DBUS_GERROR_NO_SERVER; - } else if (strcmp (_tmp129_, "Timeout") == 0) { + } else if (strcmp (_tmp36_, "Timeout") == 0) { _ecode = DBUS_GERROR_TIMEOUT; - } else if (strcmp (_tmp129_, "NoNetwork") == 0) { + } else if (strcmp (_tmp36_, "NoNetwork") == 0) { _ecode = DBUS_GERROR_NO_NETWORK; - } else if (strcmp (_tmp129_, "AddressInUse") == 0) { + } else if (strcmp (_tmp36_, "AddressInUse") == 0) { _ecode = DBUS_GERROR_ADDRESS_IN_USE; - } else if (strcmp (_tmp129_, "Disconnected") == 0) { + } else if (strcmp (_tmp36_, "Disconnected") == 0) { _ecode = DBUS_GERROR_DISCONNECTED; - } else if (strcmp (_tmp129_, "InvalidArgs") == 0) { + } else if (strcmp (_tmp36_, "InvalidArgs") == 0) { _ecode = DBUS_GERROR_INVALID_ARGS; - } else if (strcmp (_tmp129_, "FileNotFound") == 0) { + } else if (strcmp (_tmp36_, "FileNotFound") == 0) { _ecode = DBUS_GERROR_FILE_NOT_FOUND; - } else if (strcmp (_tmp129_, "FileExists") == 0) { + } else if (strcmp (_tmp36_, "FileExists") == 0) { _ecode = DBUS_GERROR_FILE_EXISTS; - } else if (strcmp (_tmp129_, "UnknownMethod") == 0) { + } else if (strcmp (_tmp36_, "UnknownMethod") == 0) { _ecode = DBUS_GERROR_UNKNOWN_METHOD; - } else if (strcmp (_tmp129_, "TimedOut") == 0) { + } else if (strcmp (_tmp36_, "TimedOut") == 0) { _ecode = DBUS_GERROR_TIMED_OUT; - } else if (strcmp (_tmp129_, "MatchRuleNotFound") == 0) { + } else if (strcmp (_tmp36_, "MatchRuleNotFound") == 0) { _ecode = DBUS_GERROR_MATCH_RULE_NOT_FOUND; - } else if (strcmp (_tmp129_, "MatchRuleInvalid") == 0) { + } else if (strcmp (_tmp36_, "MatchRuleInvalid") == 0) { _ecode = DBUS_GERROR_MATCH_RULE_INVALID; - } else if (strcmp (_tmp129_, "Spawn.ExecFailed") == 0) { + } else if (strcmp (_tmp36_, "Spawn.ExecFailed") == 0) { _ecode = DBUS_GERROR_SPAWN_EXEC_FAILED; - } else if (strcmp (_tmp129_, "Spawn.ForkFailed") == 0) { + } else if (strcmp (_tmp36_, "Spawn.ForkFailed") == 0) { _ecode = DBUS_GERROR_SPAWN_FORK_FAILED; - } else if (strcmp (_tmp129_, "Spawn.ChildExited") == 0) { + } else if (strcmp (_tmp36_, "Spawn.ChildExited") == 0) { _ecode = DBUS_GERROR_SPAWN_CHILD_EXITED; - } else if (strcmp (_tmp129_, "Spawn.ChildSignaled") == 0) { + } else if (strcmp (_tmp36_, "Spawn.ChildSignaled") == 0) { _ecode = DBUS_GERROR_SPAWN_CHILD_SIGNALED; - } else if (strcmp (_tmp129_, "Spawn.Failed") == 0) { + } else if (strcmp (_tmp36_, "Spawn.Failed") == 0) { _ecode = DBUS_GERROR_SPAWN_FAILED; - } else if (strcmp (_tmp129_, "UnixProcessIdUnknown") == 0) { + } else if (strcmp (_tmp36_, "UnixProcessIdUnknown") == 0) { _ecode = DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN; - } else if (strcmp (_tmp129_, "InvalidSignature") == 0) { + } else if (strcmp (_tmp36_, "InvalidSignature") == 0) { _ecode = DBUS_GERROR_INVALID_SIGNATURE; - } else if (strcmp (_tmp129_, "InvalidFileContent") == 0) { + } else if (strcmp (_tmp36_, "InvalidFileContent") == 0) { _ecode = DBUS_GERROR_INVALID_FILE_CONTENT; - } else if (strcmp (_tmp129_, "SELinuxSecurityContextUnknown") == 0) { + } else if (strcmp (_tmp36_, "SELinuxSecurityContextUnknown") == 0) { _ecode = DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN; - } else if (strcmp (_tmp129_, "RemoteException") == 0) { + } else if (strcmp (_tmp36_, "RemoteException") == 0) { _ecode = DBUS_GERROR_REMOTE_EXCEPTION; } } @@ -3441,74 +3428,74 @@ static void mpris_player_dbus_proxy_Pause (MprisPlayer* self, GError** error) { GQuark _edomain; gint _ecode; if (strstr (_dbus_error.name, "org.freedesktop.DBus.Error") == _dbus_error.name) { - const char* _tmp130_; + const char* _tmp37_; _edomain = DBUS_GERROR; - _tmp130_ = _dbus_error.name + 27; - if (strcmp (_tmp130_, "Failed") == 0) { + _tmp37_ = _dbus_error.name + 27; + if (strcmp (_tmp37_, "Failed") == 0) { _ecode = DBUS_GERROR_FAILED; - } else if (strcmp (_tmp130_, "NoMemory") == 0) { + } else if (strcmp (_tmp37_, "NoMemory") == 0) { _ecode = DBUS_GERROR_NO_MEMORY; - } else if (strcmp (_tmp130_, "ServiceUnknown") == 0) { + } else if (strcmp (_tmp37_, "ServiceUnknown") == 0) { _ecode = DBUS_GERROR_SERVICE_UNKNOWN; - } else if (strcmp (_tmp130_, "NameHasNoOwner") == 0) { + } else if (strcmp (_tmp37_, "NameHasNoOwner") == 0) { _ecode = DBUS_GERROR_NAME_HAS_NO_OWNER; - } else if (strcmp (_tmp130_, "NoReply") == 0) { + } else if (strcmp (_tmp37_, "NoReply") == 0) { _ecode = DBUS_GERROR_NO_REPLY; - } else if (strcmp (_tmp130_, "IOError") == 0) { + } else if (strcmp (_tmp37_, "IOError") == 0) { _ecode = DBUS_GERROR_IO_ERROR; - } else if (strcmp (_tmp130_, "BadAddress") == 0) { + } else if (strcmp (_tmp37_, "BadAddress") == 0) { _ecode = DBUS_GERROR_BAD_ADDRESS; - } else if (strcmp (_tmp130_, "NotSupported") == 0) { + } else if (strcmp (_tmp37_, "NotSupported") == 0) { _ecode = DBUS_GERROR_NOT_SUPPORTED; - } else if (strcmp (_tmp130_, "LimitsExceeded") == 0) { + } else if (strcmp (_tmp37_, "LimitsExceeded") == 0) { _ecode = DBUS_GERROR_LIMITS_EXCEEDED; - } else if (strcmp (_tmp130_, "AccessDenied") == 0) { + } else if (strcmp (_tmp37_, "AccessDenied") == 0) { _ecode = DBUS_GERROR_ACCESS_DENIED; - } else if (strcmp (_tmp130_, "AuthFailed") == 0) { + } else if (strcmp (_tmp37_, "AuthFailed") == 0) { _ecode = DBUS_GERROR_AUTH_FAILED; - } else if (strcmp (_tmp130_, "NoServer") == 0) { + } else if (strcmp (_tmp37_, "NoServer") == 0) { _ecode = DBUS_GERROR_NO_SERVER; - } else if (strcmp (_tmp130_, "Timeout") == 0) { + } else if (strcmp (_tmp37_, "Timeout") == 0) { _ecode = DBUS_GERROR_TIMEOUT; - } else if (strcmp (_tmp130_, "NoNetwork") == 0) { + } else if (strcmp (_tmp37_, "NoNetwork") == 0) { _ecode = DBUS_GERROR_NO_NETWORK; - } else if (strcmp (_tmp130_, "AddressInUse") == 0) { + } else if (strcmp (_tmp37_, "AddressInUse") == 0) { _ecode = DBUS_GERROR_ADDRESS_IN_USE; - } else if (strcmp (_tmp130_, "Disconnected") == 0) { + } else if (strcmp (_tmp37_, "Disconnected") == 0) { _ecode = DBUS_GERROR_DISCONNECTED; - } else if (strcmp (_tmp130_, "InvalidArgs") == 0) { + } else if (strcmp (_tmp37_, "InvalidArgs") == 0) { _ecode = DBUS_GERROR_INVALID_ARGS; - } else if (strcmp (_tmp130_, "FileNotFound") == 0) { + } else if (strcmp (_tmp37_, "FileNotFound") == 0) { _ecode = DBUS_GERROR_FILE_NOT_FOUND; - } else if (strcmp (_tmp130_, "FileExists") == 0) { + } else if (strcmp (_tmp37_, "FileExists") == 0) { _ecode = DBUS_GERROR_FILE_EXISTS; - } else if (strcmp (_tmp130_, "UnknownMethod") == 0) { + } else if (strcmp (_tmp37_, "UnknownMethod") == 0) { _ecode = DBUS_GERROR_UNKNOWN_METHOD; - } else if (strcmp (_tmp130_, "TimedOut") == 0) { + } else if (strcmp (_tmp37_, "TimedOut") == 0) { _ecode = DBUS_GERROR_TIMED_OUT; - } else if (strcmp (_tmp130_, "MatchRuleNotFound") == 0) { + } else if (strcmp (_tmp37_, "MatchRuleNotFound") == 0) { _ecode = DBUS_GERROR_MATCH_RULE_NOT_FOUND; - } else if (strcmp (_tmp130_, "MatchRuleInvalid") == 0) { + } else if (strcmp (_tmp37_, "MatchRuleInvalid") == 0) { _ecode = DBUS_GERROR_MATCH_RULE_INVALID; - } else if (strcmp (_tmp130_, "Spawn.ExecFailed") == 0) { + } else if (strcmp (_tmp37_, "Spawn.ExecFailed") == 0) { _ecode = DBUS_GERROR_SPAWN_EXEC_FAILED; - } else if (strcmp (_tmp130_, "Spawn.ForkFailed") == 0) { + } else if (strcmp (_tmp37_, "Spawn.ForkFailed") == 0) { _ecode = DBUS_GERROR_SPAWN_FORK_FAILED; - } else if (strcmp (_tmp130_, "Spawn.ChildExited") == 0) { + } else if (strcmp (_tmp37_, "Spawn.ChildExited") == 0) { _ecode = DBUS_GERROR_SPAWN_CHILD_EXITED; - } else if (strcmp (_tmp130_, "Spawn.ChildSignaled") == 0) { + } else if (strcmp (_tmp37_, "Spawn.ChildSignaled") == 0) { _ecode = DBUS_GERROR_SPAWN_CHILD_SIGNALED; - } else if (strcmp (_tmp130_, "Spawn.Failed") == 0) { + } else if (strcmp (_tmp37_, "Spawn.Failed") == 0) { _ecode = DBUS_GERROR_SPAWN_FAILED; - } else if (strcmp (_tmp130_, "UnixProcessIdUnknown") == 0) { + } else if (strcmp (_tmp37_, "UnixProcessIdUnknown") == 0) { _ecode = DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN; - } else if (strcmp (_tmp130_, "InvalidSignature") == 0) { + } else if (strcmp (_tmp37_, "InvalidSignature") == 0) { _ecode = DBUS_GERROR_INVALID_SIGNATURE; - } else if (strcmp (_tmp130_, "InvalidFileContent") == 0) { + } else if (strcmp (_tmp37_, "InvalidFileContent") == 0) { _ecode = DBUS_GERROR_INVALID_FILE_CONTENT; - } else if (strcmp (_tmp130_, "SELinuxSecurityContextUnknown") == 0) { + } else if (strcmp (_tmp37_, "SELinuxSecurityContextUnknown") == 0) { _ecode = DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN; - } else if (strcmp (_tmp130_, "RemoteException") == 0) { + } else if (strcmp (_tmp37_, "RemoteException") == 0) { _ecode = DBUS_GERROR_REMOTE_EXCEPTION; } } @@ -3546,74 +3533,74 @@ static void mpris_player_dbus_proxy_Next (MprisPlayer* self, GError** error) { GQuark _edomain; gint _ecode; if (strstr (_dbus_error.name, "org.freedesktop.DBus.Error") == _dbus_error.name) { - const char* _tmp131_; + const char* _tmp38_; _edomain = DBUS_GERROR; - _tmp131_ = _dbus_error.name + 27; - if (strcmp (_tmp131_, "Failed") == 0) { + _tmp38_ = _dbus_error.name + 27; + if (strcmp (_tmp38_, "Failed") == 0) { _ecode = DBUS_GERROR_FAILED; - } else if (strcmp (_tmp131_, "NoMemory") == 0) { + } else if (strcmp (_tmp38_, "NoMemory") == 0) { _ecode = DBUS_GERROR_NO_MEMORY; - } else if (strcmp (_tmp131_, "ServiceUnknown") == 0) { + } else if (strcmp (_tmp38_, "ServiceUnknown") == 0) { _ecode = DBUS_GERROR_SERVICE_UNKNOWN; - } else if (strcmp (_tmp131_, "NameHasNoOwner") == 0) { + } else if (strcmp (_tmp38_, "NameHasNoOwner") == 0) { _ecode = DBUS_GERROR_NAME_HAS_NO_OWNER; - } else if (strcmp (_tmp131_, "NoReply") == 0) { + } else if (strcmp (_tmp38_, "NoReply") == 0) { _ecode = DBUS_GERROR_NO_REPLY; - } else if (strcmp (_tmp131_, "IOError") == 0) { + } else if (strcmp (_tmp38_, "IOError") == 0) { _ecode = DBUS_GERROR_IO_ERROR; - } else if (strcmp (_tmp131_, "BadAddress") == 0) { + } else if (strcmp (_tmp38_, "BadAddress") == 0) { _ecode = DBUS_GERROR_BAD_ADDRESS; - } else if (strcmp (_tmp131_, "NotSupported") == 0) { + } else if (strcmp (_tmp38_, "NotSupported") == 0) { _ecode = DBUS_GERROR_NOT_SUPPORTED; - } else if (strcmp (_tmp131_, "LimitsExceeded") == 0) { + } else if (strcmp (_tmp38_, "LimitsExceeded") == 0) { _ecode = DBUS_GERROR_LIMITS_EXCEEDED; - } else if (strcmp (_tmp131_, "AccessDenied") == 0) { + } else if (strcmp (_tmp38_, "AccessDenied") == 0) { _ecode = DBUS_GERROR_ACCESS_DENIED; - } else if (strcmp (_tmp131_, "AuthFailed") == 0) { + } else if (strcmp (_tmp38_, "AuthFailed") == 0) { _ecode = DBUS_GERROR_AUTH_FAILED; - } else if (strcmp (_tmp131_, "NoServer") == 0) { + } else if (strcmp (_tmp38_, "NoServer") == 0) { _ecode = DBUS_GERROR_NO_SERVER; - } else if (strcmp (_tmp131_, "Timeout") == 0) { + } else if (strcmp (_tmp38_, "Timeout") == 0) { _ecode = DBUS_GERROR_TIMEOUT; - } else if (strcmp (_tmp131_, "NoNetwork") == 0) { + } else if (strcmp (_tmp38_, "NoNetwork") == 0) { _ecode = DBUS_GERROR_NO_NETWORK; - } else if (strcmp (_tmp131_, "AddressInUse") == 0) { + } else if (strcmp (_tmp38_, "AddressInUse") == 0) { _ecode = DBUS_GERROR_ADDRESS_IN_USE; - } else if (strcmp (_tmp131_, "Disconnected") == 0) { + } else if (strcmp (_tmp38_, "Disconnected") == 0) { _ecode = DBUS_GERROR_DISCONNECTED; - } else if (strcmp (_tmp131_, "InvalidArgs") == 0) { + } else if (strcmp (_tmp38_, "InvalidArgs") == 0) { _ecode = DBUS_GERROR_INVALID_ARGS; - } else if (strcmp (_tmp131_, "FileNotFound") == 0) { + } else if (strcmp (_tmp38_, "FileNotFound") == 0) { _ecode = DBUS_GERROR_FILE_NOT_FOUND; - } else if (strcmp (_tmp131_, "FileExists") == 0) { + } else if (strcmp (_tmp38_, "FileExists") == 0) { _ecode = DBUS_GERROR_FILE_EXISTS; - } else if (strcmp (_tmp131_, "UnknownMethod") == 0) { + } else if (strcmp (_tmp38_, "UnknownMethod") == 0) { _ecode = DBUS_GERROR_UNKNOWN_METHOD; - } else if (strcmp (_tmp131_, "TimedOut") == 0) { + } else if (strcmp (_tmp38_, "TimedOut") == 0) { _ecode = DBUS_GERROR_TIMED_OUT; - } else if (strcmp (_tmp131_, "MatchRuleNotFound") == 0) { + } else if (strcmp (_tmp38_, "MatchRuleNotFound") == 0) { _ecode = DBUS_GERROR_MATCH_RULE_NOT_FOUND; - } else if (strcmp (_tmp131_, "MatchRuleInvalid") == 0) { + } else if (strcmp (_tmp38_, "MatchRuleInvalid") == 0) { _ecode = DBUS_GERROR_MATCH_RULE_INVALID; - } else if (strcmp (_tmp131_, "Spawn.ExecFailed") == 0) { + } else if (strcmp (_tmp38_, "Spawn.ExecFailed") == 0) { _ecode = DBUS_GERROR_SPAWN_EXEC_FAILED; - } else if (strcmp (_tmp131_, "Spawn.ForkFailed") == 0) { + } else if (strcmp (_tmp38_, "Spawn.ForkFailed") == 0) { _ecode = DBUS_GERROR_SPAWN_FORK_FAILED; - } else if (strcmp (_tmp131_, "Spawn.ChildExited") == 0) { + } else if (strcmp (_tmp38_, "Spawn.ChildExited") == 0) { _ecode = DBUS_GERROR_SPAWN_CHILD_EXITED; - } else if (strcmp (_tmp131_, "Spawn.ChildSignaled") == 0) { + } else if (strcmp (_tmp38_, "Spawn.ChildSignaled") == 0) { _ecode = DBUS_GERROR_SPAWN_CHILD_SIGNALED; - } else if (strcmp (_tmp131_, "Spawn.Failed") == 0) { + } else if (strcmp (_tmp38_, "Spawn.Failed") == 0) { _ecode = DBUS_GERROR_SPAWN_FAILED; - } else if (strcmp (_tmp131_, "UnixProcessIdUnknown") == 0) { + } else if (strcmp (_tmp38_, "UnixProcessIdUnknown") == 0) { _ecode = DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN; - } else if (strcmp (_tmp131_, "InvalidSignature") == 0) { + } else if (strcmp (_tmp38_, "InvalidSignature") == 0) { _ecode = DBUS_GERROR_INVALID_SIGNATURE; - } else if (strcmp (_tmp131_, "InvalidFileContent") == 0) { + } else if (strcmp (_tmp38_, "InvalidFileContent") == 0) { _ecode = DBUS_GERROR_INVALID_FILE_CONTENT; - } else if (strcmp (_tmp131_, "SELinuxSecurityContextUnknown") == 0) { + } else if (strcmp (_tmp38_, "SELinuxSecurityContextUnknown") == 0) { _ecode = DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN; - } else if (strcmp (_tmp131_, "RemoteException") == 0) { + } else if (strcmp (_tmp38_, "RemoteException") == 0) { _ecode = DBUS_GERROR_REMOTE_EXCEPTION; } } @@ -3651,74 +3638,74 @@ static void mpris_player_dbus_proxy_Previous (MprisPlayer* self, GError** error) GQuark _edomain; gint _ecode; if (strstr (_dbus_error.name, "org.freedesktop.DBus.Error") == _dbus_error.name) { - const char* _tmp132_; + const char* _tmp39_; _edomain = DBUS_GERROR; - _tmp132_ = _dbus_error.name + 27; - if (strcmp (_tmp132_, "Failed") == 0) { + _tmp39_ = _dbus_error.name + 27; + if (strcmp (_tmp39_, "Failed") == 0) { _ecode = DBUS_GERROR_FAILED; - } else if (strcmp (_tmp132_, "NoMemory") == 0) { + } else if (strcmp (_tmp39_, "NoMemory") == 0) { _ecode = DBUS_GERROR_NO_MEMORY; - } else if (strcmp (_tmp132_, "ServiceUnknown") == 0) { + } else if (strcmp (_tmp39_, "ServiceUnknown") == 0) { _ecode = DBUS_GERROR_SERVICE_UNKNOWN; - } else if (strcmp (_tmp132_, "NameHasNoOwner") == 0) { + } else if (strcmp (_tmp39_, "NameHasNoOwner") == 0) { _ecode = DBUS_GERROR_NAME_HAS_NO_OWNER; - } else if (strcmp (_tmp132_, "NoReply") == 0) { + } else if (strcmp (_tmp39_, "NoReply") == 0) { _ecode = DBUS_GERROR_NO_REPLY; - } else if (strcmp (_tmp132_, "IOError") == 0) { + } else if (strcmp (_tmp39_, "IOError") == 0) { _ecode = DBUS_GERROR_IO_ERROR; - } else if (strcmp (_tmp132_, "BadAddress") == 0) { + } else if (strcmp (_tmp39_, "BadAddress") == 0) { _ecode = DBUS_GERROR_BAD_ADDRESS; - } else if (strcmp (_tmp132_, "NotSupported") == 0) { + } else if (strcmp (_tmp39_, "NotSupported") == 0) { _ecode = DBUS_GERROR_NOT_SUPPORTED; - } else if (strcmp (_tmp132_, "LimitsExceeded") == 0) { + } else if (strcmp (_tmp39_, "LimitsExceeded") == 0) { _ecode = DBUS_GERROR_LIMITS_EXCEEDED; - } else if (strcmp (_tmp132_, "AccessDenied") == 0) { + } else if (strcmp (_tmp39_, "AccessDenied") == 0) { _ecode = DBUS_GERROR_ACCESS_DENIED; - } else if (strcmp (_tmp132_, "AuthFailed") == 0) { + } else if (strcmp (_tmp39_, "AuthFailed") == 0) { _ecode = DBUS_GERROR_AUTH_FAILED; - } else if (strcmp (_tmp132_, "NoServer") == 0) { + } else if (strcmp (_tmp39_, "NoServer") == 0) { _ecode = DBUS_GERROR_NO_SERVER; - } else if (strcmp (_tmp132_, "Timeout") == 0) { + } else if (strcmp (_tmp39_, "Timeout") == 0) { _ecode = DBUS_GERROR_TIMEOUT; - } else if (strcmp (_tmp132_, "NoNetwork") == 0) { + } else if (strcmp (_tmp39_, "NoNetwork") == 0) { _ecode = DBUS_GERROR_NO_NETWORK; - } else if (strcmp (_tmp132_, "AddressInUse") == 0) { + } else if (strcmp (_tmp39_, "AddressInUse") == 0) { _ecode = DBUS_GERROR_ADDRESS_IN_USE; - } else if (strcmp (_tmp132_, "Disconnected") == 0) { + } else if (strcmp (_tmp39_, "Disconnected") == 0) { _ecode = DBUS_GERROR_DISCONNECTED; - } else if (strcmp (_tmp132_, "InvalidArgs") == 0) { + } else if (strcmp (_tmp39_, "InvalidArgs") == 0) { _ecode = DBUS_GERROR_INVALID_ARGS; - } else if (strcmp (_tmp132_, "FileNotFound") == 0) { + } else if (strcmp (_tmp39_, "FileNotFound") == 0) { _ecode = DBUS_GERROR_FILE_NOT_FOUND; - } else if (strcmp (_tmp132_, "FileExists") == 0) { + } else if (strcmp (_tmp39_, "FileExists") == 0) { _ecode = DBUS_GERROR_FILE_EXISTS; - } else if (strcmp (_tmp132_, "UnknownMethod") == 0) { + } else if (strcmp (_tmp39_, "UnknownMethod") == 0) { _ecode = DBUS_GERROR_UNKNOWN_METHOD; - } else if (strcmp (_tmp132_, "TimedOut") == 0) { + } else if (strcmp (_tmp39_, "TimedOut") == 0) { _ecode = DBUS_GERROR_TIMED_OUT; - } else if (strcmp (_tmp132_, "MatchRuleNotFound") == 0) { + } else if (strcmp (_tmp39_, "MatchRuleNotFound") == 0) { _ecode = DBUS_GERROR_MATCH_RULE_NOT_FOUND; - } else if (strcmp (_tmp132_, "MatchRuleInvalid") == 0) { + } else if (strcmp (_tmp39_, "MatchRuleInvalid") == 0) { _ecode = DBUS_GERROR_MATCH_RULE_INVALID; - } else if (strcmp (_tmp132_, "Spawn.ExecFailed") == 0) { + } else if (strcmp (_tmp39_, "Spawn.ExecFailed") == 0) { _ecode = DBUS_GERROR_SPAWN_EXEC_FAILED; - } else if (strcmp (_tmp132_, "Spawn.ForkFailed") == 0) { + } else if (strcmp (_tmp39_, "Spawn.ForkFailed") == 0) { _ecode = DBUS_GERROR_SPAWN_FORK_FAILED; - } else if (strcmp (_tmp132_, "Spawn.ChildExited") == 0) { + } else if (strcmp (_tmp39_, "Spawn.ChildExited") == 0) { _ecode = DBUS_GERROR_SPAWN_CHILD_EXITED; - } else if (strcmp (_tmp132_, "Spawn.ChildSignaled") == 0) { + } else if (strcmp (_tmp39_, "Spawn.ChildSignaled") == 0) { _ecode = DBUS_GERROR_SPAWN_CHILD_SIGNALED; - } else if (strcmp (_tmp132_, "Spawn.Failed") == 0) { + } else if (strcmp (_tmp39_, "Spawn.Failed") == 0) { _ecode = DBUS_GERROR_SPAWN_FAILED; - } else if (strcmp (_tmp132_, "UnixProcessIdUnknown") == 0) { + } else if (strcmp (_tmp39_, "UnixProcessIdUnknown") == 0) { _ecode = DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN; - } else if (strcmp (_tmp132_, "InvalidSignature") == 0) { + } else if (strcmp (_tmp39_, "InvalidSignature") == 0) { _ecode = DBUS_GERROR_INVALID_SIGNATURE; - } else if (strcmp (_tmp132_, "InvalidFileContent") == 0) { + } else if (strcmp (_tmp39_, "InvalidFileContent") == 0) { _ecode = DBUS_GERROR_INVALID_FILE_CONTENT; - } else if (strcmp (_tmp132_, "SELinuxSecurityContextUnknown") == 0) { + } else if (strcmp (_tmp39_, "SELinuxSecurityContextUnknown") == 0) { _ecode = DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN; - } else if (strcmp (_tmp132_, "RemoteException") == 0) { + } else if (strcmp (_tmp39_, "RemoteException") == 0) { _ecode = DBUS_GERROR_REMOTE_EXCEPTION; } } @@ -3741,21 +3728,21 @@ static GHashTable* mpris_player_dbus_proxy_get_Metadata (MprisPlayer* self) { DBusGConnection *_connection; DBusMessage *_message, *_reply; DBusMessageIter _iter, _subiter; - const char* _tmp133_; - const char* _tmp134_; + const char* _tmp40_; + const char* _tmp41_; GHashTable* _result; - GHashTable* _tmp135_; - DBusMessageIter _tmp136_; - DBusMessageIter _tmp137_; + GHashTable* _tmp42_; + DBusMessageIter _tmp43_; + DBusMessageIter _tmp44_; 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); - _tmp133_ = "org.mpris.MediaPlayer2.Player"; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp133_); - _tmp134_ = "Metadata"; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp134_); + _tmp40_ = "org.mpris.MediaPlayer2.Player"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp40_); + _tmp41_ = "Metadata"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp41_); 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); @@ -3778,111 +3765,111 @@ static GHashTable* mpris_player_dbus_proxy_get_Metadata (MprisPlayer* self) { dbus_message_unref (_reply); return NULL; } - _tmp135_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); - dbus_message_iter_recurse (&_subiter, &_tmp136_); - while (dbus_message_iter_get_arg_type (&_tmp136_)) { + _tmp42_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); + dbus_message_iter_recurse (&_subiter, &_tmp43_); + while (dbus_message_iter_get_arg_type (&_tmp43_)) { char* _key; GValue* _value; - const char* _tmp138_; - GValue _tmp139_ = {0}; - DBusMessageIter _tmp140_; - dbus_message_iter_recurse (&_tmp136_, &_tmp137_); - dbus_message_iter_get_basic (&_tmp137_, &_tmp138_); - dbus_message_iter_next (&_tmp137_); - _key = g_strdup (_tmp138_); - dbus_message_iter_recurse (&_tmp137_, &_tmp140_); - if (dbus_message_iter_get_arg_type (&_tmp140_) == DBUS_TYPE_BYTE) { - guint8 _tmp141_; - dbus_message_iter_get_basic (&_tmp140_, &_tmp141_); - g_value_init (&_tmp139_, G_TYPE_UCHAR); - g_value_set_uchar (&_tmp139_, _tmp141_); - } else if (dbus_message_iter_get_arg_type (&_tmp140_) == DBUS_TYPE_BOOLEAN) { - dbus_bool_t _tmp142_; - dbus_message_iter_get_basic (&_tmp140_, &_tmp142_); - g_value_init (&_tmp139_, G_TYPE_BOOLEAN); - g_value_set_boolean (&_tmp139_, _tmp142_); - } else if (dbus_message_iter_get_arg_type (&_tmp140_) == DBUS_TYPE_INT16) { - dbus_int16_t _tmp143_; - dbus_message_iter_get_basic (&_tmp140_, &_tmp143_); - g_value_init (&_tmp139_, G_TYPE_INT); - g_value_set_int (&_tmp139_, _tmp143_); - } else if (dbus_message_iter_get_arg_type (&_tmp140_) == DBUS_TYPE_UINT16) { - dbus_uint16_t _tmp144_; - dbus_message_iter_get_basic (&_tmp140_, &_tmp144_); - g_value_init (&_tmp139_, G_TYPE_UINT); - g_value_set_uint (&_tmp139_, _tmp144_); - } else if (dbus_message_iter_get_arg_type (&_tmp140_) == DBUS_TYPE_INT32) { - dbus_int32_t _tmp145_; - dbus_message_iter_get_basic (&_tmp140_, &_tmp145_); - g_value_init (&_tmp139_, G_TYPE_INT); - g_value_set_int (&_tmp139_, _tmp145_); - } else if (dbus_message_iter_get_arg_type (&_tmp140_) == DBUS_TYPE_UINT32) { - dbus_uint32_t _tmp146_; - dbus_message_iter_get_basic (&_tmp140_, &_tmp146_); - g_value_init (&_tmp139_, G_TYPE_UINT); - g_value_set_uint (&_tmp139_, _tmp146_); - } else if (dbus_message_iter_get_arg_type (&_tmp140_) == DBUS_TYPE_INT64) { - dbus_int64_t _tmp147_; - dbus_message_iter_get_basic (&_tmp140_, &_tmp147_); - g_value_init (&_tmp139_, G_TYPE_INT64); - g_value_set_int64 (&_tmp139_, _tmp147_); - } else if (dbus_message_iter_get_arg_type (&_tmp140_) == DBUS_TYPE_UINT64) { - dbus_uint64_t _tmp148_; - dbus_message_iter_get_basic (&_tmp140_, &_tmp148_); - g_value_init (&_tmp139_, G_TYPE_UINT64); - g_value_set_uint64 (&_tmp139_, _tmp148_); - } else if (dbus_message_iter_get_arg_type (&_tmp140_) == DBUS_TYPE_DOUBLE) { - double _tmp149_; - dbus_message_iter_get_basic (&_tmp140_, &_tmp149_); - g_value_init (&_tmp139_, G_TYPE_DOUBLE); - g_value_set_double (&_tmp139_, _tmp149_); - } else if (dbus_message_iter_get_arg_type (&_tmp140_) == DBUS_TYPE_STRING) { - const char* _tmp150_; - dbus_message_iter_get_basic (&_tmp140_, &_tmp150_); - g_value_init (&_tmp139_, G_TYPE_STRING); - g_value_take_string (&_tmp139_, g_strdup (_tmp150_)); - } else if (dbus_message_iter_get_arg_type (&_tmp140_) == DBUS_TYPE_OBJECT_PATH) { - const char* _tmp151_; - dbus_message_iter_get_basic (&_tmp140_, &_tmp151_); - g_value_init (&_tmp139_, G_TYPE_STRING); - g_value_take_string (&_tmp139_, g_strdup (_tmp151_)); - } else if (dbus_message_iter_get_arg_type (&_tmp140_) == DBUS_TYPE_SIGNATURE) { - const char* _tmp152_; - dbus_message_iter_get_basic (&_tmp140_, &_tmp152_); - g_value_init (&_tmp139_, G_TYPE_STRING); - g_value_take_string (&_tmp139_, g_strdup (_tmp152_)); - } else if ((dbus_message_iter_get_arg_type (&_tmp140_) == DBUS_TYPE_ARRAY) && (dbus_message_iter_get_element_type (&_tmp140_) == DBUS_TYPE_STRING)) { - const char** _tmp153_; - int _tmp153__length; - int _tmp153__size; - int _tmp153__length1; - DBusMessageIter _tmp154_; - _tmp153_ = g_new (const char*, 5); - _tmp153__length = 0; - _tmp153__size = 4; - _tmp153__length1 = 0; - dbus_message_iter_recurse (&_tmp140_, &_tmp154_); - for (; dbus_message_iter_get_arg_type (&_tmp154_); _tmp153__length1++) { - const char* _tmp155_; - if (_tmp153__size == _tmp153__length) { - _tmp153__size = 2 * _tmp153__size; - _tmp153_ = g_renew (const char*, _tmp153_, _tmp153__size + 1); + const char* _tmp45_; + GValue _tmp46_ = {0}; + DBusMessageIter _tmp47_; + dbus_message_iter_recurse (&_tmp43_, &_tmp44_); + dbus_message_iter_get_basic (&_tmp44_, &_tmp45_); + dbus_message_iter_next (&_tmp44_); + _key = g_strdup (_tmp45_); + dbus_message_iter_recurse (&_tmp44_, &_tmp47_); + if (dbus_message_iter_get_arg_type (&_tmp47_) == DBUS_TYPE_BYTE) { + guint8 _tmp48_; + dbus_message_iter_get_basic (&_tmp47_, &_tmp48_); + g_value_init (&_tmp46_, G_TYPE_UCHAR); + g_value_set_uchar (&_tmp46_, _tmp48_); + } else if (dbus_message_iter_get_arg_type (&_tmp47_) == DBUS_TYPE_BOOLEAN) { + dbus_bool_t _tmp49_; + dbus_message_iter_get_basic (&_tmp47_, &_tmp49_); + g_value_init (&_tmp46_, G_TYPE_BOOLEAN); + g_value_set_boolean (&_tmp46_, _tmp49_); + } else if (dbus_message_iter_get_arg_type (&_tmp47_) == DBUS_TYPE_INT16) { + dbus_int16_t _tmp50_; + dbus_message_iter_get_basic (&_tmp47_, &_tmp50_); + g_value_init (&_tmp46_, G_TYPE_INT); + g_value_set_int (&_tmp46_, _tmp50_); + } else if (dbus_message_iter_get_arg_type (&_tmp47_) == DBUS_TYPE_UINT16) { + dbus_uint16_t _tmp51_; + dbus_message_iter_get_basic (&_tmp47_, &_tmp51_); + g_value_init (&_tmp46_, G_TYPE_UINT); + g_value_set_uint (&_tmp46_, _tmp51_); + } else if (dbus_message_iter_get_arg_type (&_tmp47_) == DBUS_TYPE_INT32) { + dbus_int32_t _tmp52_; + dbus_message_iter_get_basic (&_tmp47_, &_tmp52_); + g_value_init (&_tmp46_, G_TYPE_INT); + g_value_set_int (&_tmp46_, _tmp52_); + } else if (dbus_message_iter_get_arg_type (&_tmp47_) == DBUS_TYPE_UINT32) { + dbus_uint32_t _tmp53_; + dbus_message_iter_get_basic (&_tmp47_, &_tmp53_); + g_value_init (&_tmp46_, G_TYPE_UINT); + g_value_set_uint (&_tmp46_, _tmp53_); + } else if (dbus_message_iter_get_arg_type (&_tmp47_) == DBUS_TYPE_INT64) { + dbus_int64_t _tmp54_; + dbus_message_iter_get_basic (&_tmp47_, &_tmp54_); + g_value_init (&_tmp46_, G_TYPE_INT64); + g_value_set_int64 (&_tmp46_, _tmp54_); + } else if (dbus_message_iter_get_arg_type (&_tmp47_) == DBUS_TYPE_UINT64) { + dbus_uint64_t _tmp55_; + dbus_message_iter_get_basic (&_tmp47_, &_tmp55_); + g_value_init (&_tmp46_, G_TYPE_UINT64); + g_value_set_uint64 (&_tmp46_, _tmp55_); + } else if (dbus_message_iter_get_arg_type (&_tmp47_) == DBUS_TYPE_DOUBLE) { + double _tmp56_; + dbus_message_iter_get_basic (&_tmp47_, &_tmp56_); + g_value_init (&_tmp46_, G_TYPE_DOUBLE); + g_value_set_double (&_tmp46_, _tmp56_); + } else if (dbus_message_iter_get_arg_type (&_tmp47_) == DBUS_TYPE_STRING) { + const char* _tmp57_; + dbus_message_iter_get_basic (&_tmp47_, &_tmp57_); + g_value_init (&_tmp46_, G_TYPE_STRING); + g_value_take_string (&_tmp46_, g_strdup (_tmp57_)); + } else if (dbus_message_iter_get_arg_type (&_tmp47_) == DBUS_TYPE_OBJECT_PATH) { + const char* _tmp58_; + dbus_message_iter_get_basic (&_tmp47_, &_tmp58_); + g_value_init (&_tmp46_, G_TYPE_STRING); + g_value_take_string (&_tmp46_, g_strdup (_tmp58_)); + } else if (dbus_message_iter_get_arg_type (&_tmp47_) == DBUS_TYPE_SIGNATURE) { + const char* _tmp59_; + dbus_message_iter_get_basic (&_tmp47_, &_tmp59_); + g_value_init (&_tmp46_, G_TYPE_STRING); + g_value_take_string (&_tmp46_, g_strdup (_tmp59_)); + } else if ((dbus_message_iter_get_arg_type (&_tmp47_) == DBUS_TYPE_ARRAY) && (dbus_message_iter_get_element_type (&_tmp47_) == DBUS_TYPE_STRING)) { + const char** _tmp60_; + int _tmp60__length; + int _tmp60__size; + int _tmp60__length1; + DBusMessageIter _tmp61_; + _tmp60_ = g_new (const char*, 5); + _tmp60__length = 0; + _tmp60__size = 4; + _tmp60__length1 = 0; + dbus_message_iter_recurse (&_tmp47_, &_tmp61_); + for (; dbus_message_iter_get_arg_type (&_tmp61_); _tmp60__length1++) { + const char* _tmp62_; + if (_tmp60__size == _tmp60__length) { + _tmp60__size = 2 * _tmp60__size; + _tmp60_ = g_renew (const char*, _tmp60_, _tmp60__size + 1); } - dbus_message_iter_get_basic (&_tmp154_, &_tmp155_); - dbus_message_iter_next (&_tmp154_); - _tmp153_[_tmp153__length++] = g_strdup (_tmp155_); + dbus_message_iter_get_basic (&_tmp61_, &_tmp62_); + dbus_message_iter_next (&_tmp61_); + _tmp60_[_tmp60__length++] = g_strdup (_tmp62_); } - _tmp153_[_tmp153__length] = NULL; - g_value_init (&_tmp139_, G_TYPE_STRV); - g_value_take_boxed (&_tmp139_, _tmp153_); + _tmp60_[_tmp60__length] = NULL; + g_value_init (&_tmp46_, G_TYPE_STRV); + g_value_take_boxed (&_tmp46_, _tmp60_); } - dbus_message_iter_next (&_tmp137_); - _value = g_memdup (&_tmp139_, sizeof (GValue)); - g_hash_table_insert (_tmp135_, _key, _value); - dbus_message_iter_next (&_tmp136_); + dbus_message_iter_next (&_tmp44_); + _value = g_memdup (&_tmp46_, sizeof (GValue)); + g_hash_table_insert (_tmp42_, _key, _value); + dbus_message_iter_next (&_tmp43_); } dbus_message_iter_next (&_subiter); - _result = _tmp135_; + _result = _tmp42_; dbus_message_unref (_reply); return _result; } @@ -3893,100 +3880,100 @@ static void mpris_player_dbus_proxy_set_Metadata (MprisPlayer* self, GHashTable* DBusGConnection *_connection; DBusMessage *_message, *_reply; DBusMessageIter _iter, _subiter; - const char* _tmp156_; - const char* _tmp157_; - DBusMessageIter _tmp158_, _tmp159_; - GHashTableIter _tmp160_; - gpointer _tmp161_, _tmp162_; + const char* _tmp63_; + const char* _tmp64_; + DBusMessageIter _tmp65_, _tmp66_; + GHashTableIter _tmp67_; + gpointer _tmp68_, _tmp69_; 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); - _tmp156_ = "org.mpris.MediaPlayer2.Player"; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp156_); - _tmp157_ = "Metadata"; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp157_); + _tmp63_ = "org.mpris.MediaPlayer2.Player"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp63_); + _tmp64_ = "Metadata"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp64_); dbus_message_iter_open_container (&_iter, DBUS_TYPE_VARIANT, "a{sv}", &_subiter); - dbus_message_iter_open_container (&_subiter, DBUS_TYPE_ARRAY, "{sv}", &_tmp158_); - g_hash_table_iter_init (&_tmp160_, value); - while (g_hash_table_iter_next (&_tmp160_, &_tmp161_, &_tmp162_)) { + dbus_message_iter_open_container (&_subiter, DBUS_TYPE_ARRAY, "{sv}", &_tmp65_); + g_hash_table_iter_init (&_tmp67_, value); + while (g_hash_table_iter_next (&_tmp67_, &_tmp68_, &_tmp69_)) { char* _key; GValue* _value; - const char* _tmp163_; - DBusMessageIter _tmp164_; - dbus_message_iter_open_container (&_tmp158_, DBUS_TYPE_DICT_ENTRY, NULL, &_tmp159_); - _key = (char*) _tmp161_; - _value = (GValue*) _tmp162_; - _tmp163_ = _key; - dbus_message_iter_append_basic (&_tmp159_, DBUS_TYPE_STRING, &_tmp163_); + const char* _tmp70_; + DBusMessageIter _tmp71_; + dbus_message_iter_open_container (&_tmp65_, DBUS_TYPE_DICT_ENTRY, NULL, &_tmp66_); + _key = (char*) _tmp68_; + _value = (GValue*) _tmp69_; + _tmp70_ = _key; + dbus_message_iter_append_basic (&_tmp66_, DBUS_TYPE_STRING, &_tmp70_); if (G_VALUE_TYPE (_value) == G_TYPE_UCHAR) { - guint8 _tmp165_; - dbus_message_iter_open_container (&_tmp159_, DBUS_TYPE_VARIANT, "y", &_tmp164_); - _tmp165_ = g_value_get_uchar (_value); - dbus_message_iter_append_basic (&_tmp164_, DBUS_TYPE_BYTE, &_tmp165_); - dbus_message_iter_close_container (&_tmp159_, &_tmp164_); + guint8 _tmp72_; + dbus_message_iter_open_container (&_tmp66_, DBUS_TYPE_VARIANT, "y", &_tmp71_); + _tmp72_ = g_value_get_uchar (_value); + dbus_message_iter_append_basic (&_tmp71_, DBUS_TYPE_BYTE, &_tmp72_); + dbus_message_iter_close_container (&_tmp66_, &_tmp71_); } else if (G_VALUE_TYPE (_value) == G_TYPE_BOOLEAN) { - dbus_bool_t _tmp166_; - dbus_message_iter_open_container (&_tmp159_, DBUS_TYPE_VARIANT, "b", &_tmp164_); - _tmp166_ = g_value_get_boolean (_value); - dbus_message_iter_append_basic (&_tmp164_, DBUS_TYPE_BOOLEAN, &_tmp166_); - dbus_message_iter_close_container (&_tmp159_, &_tmp164_); + dbus_bool_t _tmp73_; + dbus_message_iter_open_container (&_tmp66_, DBUS_TYPE_VARIANT, "b", &_tmp71_); + _tmp73_ = g_value_get_boolean (_value); + dbus_message_iter_append_basic (&_tmp71_, DBUS_TYPE_BOOLEAN, &_tmp73_); + dbus_message_iter_close_container (&_tmp66_, &_tmp71_); } else if (G_VALUE_TYPE (_value) == G_TYPE_INT) { - dbus_int32_t _tmp167_; - dbus_message_iter_open_container (&_tmp159_, DBUS_TYPE_VARIANT, "i", &_tmp164_); - _tmp167_ = g_value_get_int (_value); - dbus_message_iter_append_basic (&_tmp164_, DBUS_TYPE_INT32, &_tmp167_); - dbus_message_iter_close_container (&_tmp159_, &_tmp164_); + dbus_int32_t _tmp74_; + dbus_message_iter_open_container (&_tmp66_, DBUS_TYPE_VARIANT, "i", &_tmp71_); + _tmp74_ = g_value_get_int (_value); + dbus_message_iter_append_basic (&_tmp71_, DBUS_TYPE_INT32, &_tmp74_); + dbus_message_iter_close_container (&_tmp66_, &_tmp71_); } else if (G_VALUE_TYPE (_value) == G_TYPE_UINT) { - dbus_uint32_t _tmp168_; - dbus_message_iter_open_container (&_tmp159_, DBUS_TYPE_VARIANT, "u", &_tmp164_); - _tmp168_ = g_value_get_uint (_value); - dbus_message_iter_append_basic (&_tmp164_, DBUS_TYPE_UINT32, &_tmp168_); - dbus_message_iter_close_container (&_tmp159_, &_tmp164_); + dbus_uint32_t _tmp75_; + dbus_message_iter_open_container (&_tmp66_, DBUS_TYPE_VARIANT, "u", &_tmp71_); + _tmp75_ = g_value_get_uint (_value); + dbus_message_iter_append_basic (&_tmp71_, DBUS_TYPE_UINT32, &_tmp75_); + dbus_message_iter_close_container (&_tmp66_, &_tmp71_); } else if (G_VALUE_TYPE (_value) == G_TYPE_INT64) { - dbus_int64_t _tmp169_; - dbus_message_iter_open_container (&_tmp159_, DBUS_TYPE_VARIANT, "x", &_tmp164_); - _tmp169_ = g_value_get_int64 (_value); - dbus_message_iter_append_basic (&_tmp164_, DBUS_TYPE_INT64, &_tmp169_); - dbus_message_iter_close_container (&_tmp159_, &_tmp164_); + dbus_int64_t _tmp76_; + dbus_message_iter_open_container (&_tmp66_, DBUS_TYPE_VARIANT, "x", &_tmp71_); + _tmp76_ = g_value_get_int64 (_value); + dbus_message_iter_append_basic (&_tmp71_, DBUS_TYPE_INT64, &_tmp76_); + dbus_message_iter_close_container (&_tmp66_, &_tmp71_); } else if (G_VALUE_TYPE (_value) == G_TYPE_UINT64) { - dbus_uint64_t _tmp170_; - dbus_message_iter_open_container (&_tmp159_, DBUS_TYPE_VARIANT, "t", &_tmp164_); - _tmp170_ = g_value_get_uint64 (_value); - dbus_message_iter_append_basic (&_tmp164_, DBUS_TYPE_UINT64, &_tmp170_); - dbus_message_iter_close_container (&_tmp159_, &_tmp164_); + dbus_uint64_t _tmp77_; + dbus_message_iter_open_container (&_tmp66_, DBUS_TYPE_VARIANT, "t", &_tmp71_); + _tmp77_ = g_value_get_uint64 (_value); + dbus_message_iter_append_basic (&_tmp71_, DBUS_TYPE_UINT64, &_tmp77_); + dbus_message_iter_close_container (&_tmp66_, &_tmp71_); } else if (G_VALUE_TYPE (_value) == G_TYPE_DOUBLE) { - double _tmp171_; - dbus_message_iter_open_container (&_tmp159_, DBUS_TYPE_VARIANT, "d", &_tmp164_); - _tmp171_ = g_value_get_double (_value); - dbus_message_iter_append_basic (&_tmp164_, DBUS_TYPE_DOUBLE, &_tmp171_); - dbus_message_iter_close_container (&_tmp159_, &_tmp164_); + double _tmp78_; + dbus_message_iter_open_container (&_tmp66_, DBUS_TYPE_VARIANT, "d", &_tmp71_); + _tmp78_ = g_value_get_double (_value); + dbus_message_iter_append_basic (&_tmp71_, DBUS_TYPE_DOUBLE, &_tmp78_); + dbus_message_iter_close_container (&_tmp66_, &_tmp71_); } else if (G_VALUE_TYPE (_value) == G_TYPE_STRING) { - const char* _tmp172_; - dbus_message_iter_open_container (&_tmp159_, DBUS_TYPE_VARIANT, "s", &_tmp164_); - _tmp172_ = g_value_get_string (_value); - dbus_message_iter_append_basic (&_tmp164_, DBUS_TYPE_STRING, &_tmp172_); - dbus_message_iter_close_container (&_tmp159_, &_tmp164_); + const char* _tmp79_; + dbus_message_iter_open_container (&_tmp66_, DBUS_TYPE_VARIANT, "s", &_tmp71_); + _tmp79_ = g_value_get_string (_value); + dbus_message_iter_append_basic (&_tmp71_, DBUS_TYPE_STRING, &_tmp79_); + dbus_message_iter_close_container (&_tmp66_, &_tmp71_); } else if (G_VALUE_TYPE (_value) == G_TYPE_STRV) { - const char** _tmp173_; - DBusMessageIter _tmp174_; - int _tmp175_; - dbus_message_iter_open_container (&_tmp159_, DBUS_TYPE_VARIANT, "as", &_tmp164_); - _tmp173_ = g_value_get_boxed (_value); - dbus_message_iter_open_container (&_tmp164_, DBUS_TYPE_ARRAY, "s", &_tmp174_); - for (_tmp175_ = 0; _tmp175_ < g_strv_length (g_value_get_boxed (_value)); _tmp175_++) { - const char* _tmp176_; - _tmp176_ = *_tmp173_; - dbus_message_iter_append_basic (&_tmp174_, DBUS_TYPE_STRING, &_tmp176_); - _tmp173_++; + const char** _tmp80_; + DBusMessageIter _tmp81_; + int _tmp82_; + dbus_message_iter_open_container (&_tmp66_, DBUS_TYPE_VARIANT, "as", &_tmp71_); + _tmp80_ = g_value_get_boxed (_value); + dbus_message_iter_open_container (&_tmp71_, DBUS_TYPE_ARRAY, "s", &_tmp81_); + for (_tmp82_ = 0; _tmp82_ < g_strv_length (g_value_get_boxed (_value)); _tmp82_++) { + const char* _tmp83_; + _tmp83_ = *_tmp80_; + dbus_message_iter_append_basic (&_tmp81_, DBUS_TYPE_STRING, &_tmp83_); + _tmp80_++; } - dbus_message_iter_close_container (&_tmp164_, &_tmp174_); - dbus_message_iter_close_container (&_tmp159_, &_tmp164_); + dbus_message_iter_close_container (&_tmp71_, &_tmp81_); + dbus_message_iter_close_container (&_tmp66_, &_tmp71_); } - dbus_message_iter_close_container (&_tmp158_, &_tmp159_); + dbus_message_iter_close_container (&_tmp65_, &_tmp66_); } - dbus_message_iter_close_container (&_subiter, &_tmp158_); + dbus_message_iter_close_container (&_subiter, &_tmp65_); dbus_message_iter_close_container (&_iter, &_subiter); g_object_get (self, "connection", &_connection, NULL); dbus_error_init (&_dbus_error); @@ -4013,19 +4000,19 @@ static gint32 mpris_player_dbus_proxy_get_Position (MprisPlayer* self) { DBusGConnection *_connection; DBusMessage *_message, *_reply; DBusMessageIter _iter, _subiter; - const char* _tmp177_; - const char* _tmp178_; + const char* _tmp84_; + const char* _tmp85_; gint32 _result; - dbus_int32_t _tmp179_; + dbus_int32_t _tmp86_; 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); - _tmp177_ = "org.mpris.MediaPlayer2.Player"; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp177_); - _tmp178_ = "Position"; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp178_); + _tmp84_ = "org.mpris.MediaPlayer2.Player"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp84_); + _tmp85_ = "Position"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp85_); 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); @@ -4048,9 +4035,9 @@ static gint32 mpris_player_dbus_proxy_get_Position (MprisPlayer* self) { dbus_message_unref (_reply); return 0; } - dbus_message_iter_get_basic (&_subiter, &_tmp179_); + dbus_message_iter_get_basic (&_subiter, &_tmp86_); dbus_message_iter_next (&_subiter); - _result = _tmp179_; + _result = _tmp86_; dbus_message_unref (_reply); return _result; } @@ -4061,21 +4048,21 @@ static void mpris_player_dbus_proxy_set_Position (MprisPlayer* self, gint32 valu DBusGConnection *_connection; DBusMessage *_message, *_reply; DBusMessageIter _iter, _subiter; - const char* _tmp180_; - const char* _tmp181_; - dbus_int32_t _tmp182_; + const char* _tmp87_; + const char* _tmp88_; + dbus_int32_t _tmp89_; 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); - _tmp180_ = "org.mpris.MediaPlayer2.Player"; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp180_); - _tmp181_ = "Position"; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp181_); + _tmp87_ = "org.mpris.MediaPlayer2.Player"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp87_); + _tmp88_ = "Position"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp88_); dbus_message_iter_open_container (&_iter, DBUS_TYPE_VARIANT, "i", &_subiter); - _tmp182_ = value; - dbus_message_iter_append_basic (&_subiter, DBUS_TYPE_INT32, &_tmp182_); + _tmp89_ = value; + dbus_message_iter_append_basic (&_subiter, DBUS_TYPE_INT32, &_tmp89_); dbus_message_iter_close_container (&_iter, &_subiter); g_object_get (self, "connection", &_connection, NULL); dbus_error_init (&_dbus_error); @@ -4102,19 +4089,19 @@ static char* mpris_player_dbus_proxy_get_PlaybackStatus (MprisPlayer* self) { DBusGConnection *_connection; DBusMessage *_message, *_reply; DBusMessageIter _iter, _subiter; - const char* _tmp183_; - const char* _tmp184_; + const char* _tmp90_; + const char* _tmp91_; char* _result; - const char* _tmp185_; + const char* _tmp92_; 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); - _tmp183_ = "org.mpris.MediaPlayer2.Player"; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp183_); - _tmp184_ = "PlaybackStatus"; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp184_); + _tmp90_ = "org.mpris.MediaPlayer2.Player"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp90_); + _tmp91_ = "PlaybackStatus"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp91_); 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); @@ -4137,9 +4124,9 @@ static char* mpris_player_dbus_proxy_get_PlaybackStatus (MprisPlayer* self) { dbus_message_unref (_reply); return NULL; } - dbus_message_iter_get_basic (&_subiter, &_tmp185_); + dbus_message_iter_get_basic (&_subiter, &_tmp92_); dbus_message_iter_next (&_subiter); - _result = g_strdup (_tmp185_); + _result = g_strdup (_tmp92_); dbus_message_unref (_reply); return _result; } @@ -4150,21 +4137,21 @@ static void mpris_player_dbus_proxy_set_PlaybackStatus (MprisPlayer* self, const DBusGConnection *_connection; DBusMessage *_message, *_reply; DBusMessageIter _iter, _subiter; - const char* _tmp186_; - const char* _tmp187_; - const char* _tmp188_; + const char* _tmp93_; + const char* _tmp94_; + const char* _tmp95_; 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); - _tmp186_ = "org.mpris.MediaPlayer2.Player"; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp186_); - _tmp187_ = "PlaybackStatus"; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp187_); + _tmp93_ = "org.mpris.MediaPlayer2.Player"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp93_); + _tmp94_ = "PlaybackStatus"; + dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp94_); dbus_message_iter_open_container (&_iter, DBUS_TYPE_VARIANT, "s", &_subiter); - _tmp188_ = value; - dbus_message_iter_append_basic (&_subiter, DBUS_TYPE_STRING, &_tmp188_); + _tmp95_ = value; + dbus_message_iter_append_basic (&_subiter, DBUS_TYPE_STRING, &_tmp95_); dbus_message_iter_close_container (&_iter, &_subiter); g_object_get (self, "connection", &_connection, NULL); dbus_error_init (&_dbus_error); @@ -4245,16 +4232,16 @@ static DBusHandlerResult _dbus_free_desktop_properties_property_get_all (FreeDes DBusMessage* reply; DBusMessageIter iter, reply_iter, subiter; char* interface_name; - const char* _tmp189_; + 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, &_tmp189_); + dbus_message_iter_get_basic (&iter, &_tmp0_); dbus_message_iter_next (&iter); - interface_name = g_strdup (_tmp189_); + 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); @@ -4293,106 +4280,106 @@ static void _dbus_free_desktop_properties_properties_changed (GObject* _sender, const char * _path; DBusMessage *_message; DBusMessageIter _iter; - const char* _tmp190_; - DBusMessageIter _tmp191_, _tmp192_; - GHashTableIter _tmp193_; - gpointer _tmp194_, _tmp195_; - char** _tmp210_; - DBusMessageIter _tmp211_; - int _tmp212_; + 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); - _tmp190_ = source; - dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp190_); - dbus_message_iter_open_container (&_iter, DBUS_TYPE_ARRAY, "{sv}", &_tmp191_); - g_hash_table_iter_init (&_tmp193_, changed_properties); - while (g_hash_table_iter_next (&_tmp193_, &_tmp194_, &_tmp195_)) { + _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* _tmp196_; - DBusMessageIter _tmp197_; - dbus_message_iter_open_container (&_tmp191_, DBUS_TYPE_DICT_ENTRY, NULL, &_tmp192_); - _key = (char*) _tmp194_; - _value = (GValue*) _tmp195_; - _tmp196_ = _key; - dbus_message_iter_append_basic (&_tmp192_, DBUS_TYPE_STRING, &_tmp196_); + 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 _tmp198_; - dbus_message_iter_open_container (&_tmp192_, DBUS_TYPE_VARIANT, "y", &_tmp197_); - _tmp198_ = g_value_get_uchar (_value); - dbus_message_iter_append_basic (&_tmp197_, DBUS_TYPE_BYTE, &_tmp198_); - dbus_message_iter_close_container (&_tmp192_, &_tmp197_); + 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 _tmp199_; - dbus_message_iter_open_container (&_tmp192_, DBUS_TYPE_VARIANT, "b", &_tmp197_); - _tmp199_ = g_value_get_boolean (_value); - dbus_message_iter_append_basic (&_tmp197_, DBUS_TYPE_BOOLEAN, &_tmp199_); - dbus_message_iter_close_container (&_tmp192_, &_tmp197_); + 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 _tmp200_; - dbus_message_iter_open_container (&_tmp192_, DBUS_TYPE_VARIANT, "i", &_tmp197_); - _tmp200_ = g_value_get_int (_value); - dbus_message_iter_append_basic (&_tmp197_, DBUS_TYPE_INT32, &_tmp200_); - dbus_message_iter_close_container (&_tmp192_, &_tmp197_); + 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 _tmp201_; - dbus_message_iter_open_container (&_tmp192_, DBUS_TYPE_VARIANT, "u", &_tmp197_); - _tmp201_ = g_value_get_uint (_value); - dbus_message_iter_append_basic (&_tmp197_, DBUS_TYPE_UINT32, &_tmp201_); - dbus_message_iter_close_container (&_tmp192_, &_tmp197_); + 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 _tmp202_; - dbus_message_iter_open_container (&_tmp192_, DBUS_TYPE_VARIANT, "x", &_tmp197_); - _tmp202_ = g_value_get_int64 (_value); - dbus_message_iter_append_basic (&_tmp197_, DBUS_TYPE_INT64, &_tmp202_); - dbus_message_iter_close_container (&_tmp192_, &_tmp197_); + 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 _tmp203_; - dbus_message_iter_open_container (&_tmp192_, DBUS_TYPE_VARIANT, "t", &_tmp197_); - _tmp203_ = g_value_get_uint64 (_value); - dbus_message_iter_append_basic (&_tmp197_, DBUS_TYPE_UINT64, &_tmp203_); - dbus_message_iter_close_container (&_tmp192_, &_tmp197_); + 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 _tmp204_; - dbus_message_iter_open_container (&_tmp192_, DBUS_TYPE_VARIANT, "d", &_tmp197_); - _tmp204_ = g_value_get_double (_value); - dbus_message_iter_append_basic (&_tmp197_, DBUS_TYPE_DOUBLE, &_tmp204_); - dbus_message_iter_close_container (&_tmp192_, &_tmp197_); + 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* _tmp205_; - dbus_message_iter_open_container (&_tmp192_, DBUS_TYPE_VARIANT, "s", &_tmp197_); - _tmp205_ = g_value_get_string (_value); - dbus_message_iter_append_basic (&_tmp197_, DBUS_TYPE_STRING, &_tmp205_); - dbus_message_iter_close_container (&_tmp192_, &_tmp197_); + 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** _tmp206_; - DBusMessageIter _tmp207_; - int _tmp208_; - dbus_message_iter_open_container (&_tmp192_, DBUS_TYPE_VARIANT, "as", &_tmp197_); - _tmp206_ = g_value_get_boxed (_value); - dbus_message_iter_open_container (&_tmp197_, DBUS_TYPE_ARRAY, "s", &_tmp207_); - for (_tmp208_ = 0; _tmp208_ < g_strv_length (g_value_get_boxed (_value)); _tmp208_++) { - const char* _tmp209_; - _tmp209_ = *_tmp206_; - dbus_message_iter_append_basic (&_tmp207_, DBUS_TYPE_STRING, &_tmp209_); - _tmp206_++; + 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 (&_tmp197_, &_tmp207_); - dbus_message_iter_close_container (&_tmp192_, &_tmp197_); + dbus_message_iter_close_container (&_tmp8_, &_tmp18_); + dbus_message_iter_close_container (&_tmp3_, &_tmp8_); } - dbus_message_iter_close_container (&_tmp191_, &_tmp192_); - } - dbus_message_iter_close_container (&_iter, &_tmp191_); - _tmp210_ = invalid; - dbus_message_iter_open_container (&_iter, DBUS_TYPE_ARRAY, "s", &_tmp211_); - for (_tmp212_ = 0; _tmp212_ < invalid_length1; _tmp212_++) { - const char* _tmp213_; - _tmp213_ = *_tmp210_; - dbus_message_iter_append_basic (&_tmp211_, DBUS_TYPE_STRING, &_tmp213_); - _tmp210_++; - } - dbus_message_iter_close_container (&_iter, &_tmp211_); + 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); } @@ -4461,151 +4448,151 @@ static GObject* free_desktop_properties_dbus_proxy_construct (GType gtype, guint static void _dbus_handle_free_desktop_properties_properties_changed (FreeDesktopProperties* self, DBusConnection* connection, DBusMessage* message) { DBusMessageIter iter; char* source = NULL; - const char* _tmp214_; + const char* _tmp96_; GHashTable* changed_properties = NULL; - GHashTable* _tmp215_; - DBusMessageIter _tmp216_; - DBusMessageIter _tmp217_; + GHashTable* _tmp97_; + DBusMessageIter _tmp98_; + DBusMessageIter _tmp99_; char** invalid = NULL; int invalid_length1; - char** _tmp236_; - int _tmp236__length; - int _tmp236__size; - int _tmp236__length1; - DBusMessageIter _tmp237_; + char** _tmp118_; + int _tmp118__length; + int _tmp118__size; + int _tmp118__length1; + DBusMessageIter _tmp119_; 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, &_tmp214_); + dbus_message_iter_get_basic (&iter, &_tmp96_); dbus_message_iter_next (&iter); - source = g_strdup (_tmp214_); - _tmp215_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); - dbus_message_iter_recurse (&iter, &_tmp216_); - while (dbus_message_iter_get_arg_type (&_tmp216_)) { + source = g_strdup (_tmp96_); + _tmp97_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); + dbus_message_iter_recurse (&iter, &_tmp98_); + while (dbus_message_iter_get_arg_type (&_tmp98_)) { char* _key; GValue* _value; - const char* _tmp218_; - GValue _tmp219_ = {0}; - DBusMessageIter _tmp220_; - dbus_message_iter_recurse (&_tmp216_, &_tmp217_); - dbus_message_iter_get_basic (&_tmp217_, &_tmp218_); - dbus_message_iter_next (&_tmp217_); - _key = g_strdup (_tmp218_); - dbus_message_iter_recurse (&_tmp217_, &_tmp220_); - if (dbus_message_iter_get_arg_type (&_tmp220_) == DBUS_TYPE_BYTE) { - guint8 _tmp221_; - dbus_message_iter_get_basic (&_tmp220_, &_tmp221_); - g_value_init (&_tmp219_, G_TYPE_UCHAR); - g_value_set_uchar (&_tmp219_, _tmp221_); - } else if (dbus_message_iter_get_arg_type (&_tmp220_) == DBUS_TYPE_BOOLEAN) { - dbus_bool_t _tmp222_; - dbus_message_iter_get_basic (&_tmp220_, &_tmp222_); - g_value_init (&_tmp219_, G_TYPE_BOOLEAN); - g_value_set_boolean (&_tmp219_, _tmp222_); - } else if (dbus_message_iter_get_arg_type (&_tmp220_) == DBUS_TYPE_INT16) { - dbus_int16_t _tmp223_; - dbus_message_iter_get_basic (&_tmp220_, &_tmp223_); - g_value_init (&_tmp219_, G_TYPE_INT); - g_value_set_int (&_tmp219_, _tmp223_); - } else if (dbus_message_iter_get_arg_type (&_tmp220_) == DBUS_TYPE_UINT16) { - dbus_uint16_t _tmp224_; - dbus_message_iter_get_basic (&_tmp220_, &_tmp224_); - g_value_init (&_tmp219_, G_TYPE_UINT); - g_value_set_uint (&_tmp219_, _tmp224_); - } else if (dbus_message_iter_get_arg_type (&_tmp220_) == DBUS_TYPE_INT32) { - dbus_int32_t _tmp225_; - dbus_message_iter_get_basic (&_tmp220_, &_tmp225_); - g_value_init (&_tmp219_, G_TYPE_INT); - g_value_set_int (&_tmp219_, _tmp225_); - } else if (dbus_message_iter_get_arg_type (&_tmp220_) == DBUS_TYPE_UINT32) { - dbus_uint32_t _tmp226_; - dbus_message_iter_get_basic (&_tmp220_, &_tmp226_); - g_value_init (&_tmp219_, G_TYPE_UINT); - g_value_set_uint (&_tmp219_, _tmp226_); - } else if (dbus_message_iter_get_arg_type (&_tmp220_) == DBUS_TYPE_INT64) { - dbus_int64_t _tmp227_; - dbus_message_iter_get_basic (&_tmp220_, &_tmp227_); - g_value_init (&_tmp219_, G_TYPE_INT64); - g_value_set_int64 (&_tmp219_, _tmp227_); - } else if (dbus_message_iter_get_arg_type (&_tmp220_) == DBUS_TYPE_UINT64) { - dbus_uint64_t _tmp228_; - dbus_message_iter_get_basic (&_tmp220_, &_tmp228_); - g_value_init (&_tmp219_, G_TYPE_UINT64); - g_value_set_uint64 (&_tmp219_, _tmp228_); - } else if (dbus_message_iter_get_arg_type (&_tmp220_) == DBUS_TYPE_DOUBLE) { - double _tmp229_; - dbus_message_iter_get_basic (&_tmp220_, &_tmp229_); - g_value_init (&_tmp219_, G_TYPE_DOUBLE); - g_value_set_double (&_tmp219_, _tmp229_); - } else if (dbus_message_iter_get_arg_type (&_tmp220_) == DBUS_TYPE_STRING) { - const char* _tmp230_; - dbus_message_iter_get_basic (&_tmp220_, &_tmp230_); - g_value_init (&_tmp219_, G_TYPE_STRING); - g_value_take_string (&_tmp219_, g_strdup (_tmp230_)); - } else if (dbus_message_iter_get_arg_type (&_tmp220_) == DBUS_TYPE_OBJECT_PATH) { - const char* _tmp231_; - dbus_message_iter_get_basic (&_tmp220_, &_tmp231_); - g_value_init (&_tmp219_, G_TYPE_STRING); - g_value_take_string (&_tmp219_, g_strdup (_tmp231_)); - } else if (dbus_message_iter_get_arg_type (&_tmp220_) == DBUS_TYPE_SIGNATURE) { - const char* _tmp232_; - dbus_message_iter_get_basic (&_tmp220_, &_tmp232_); - g_value_init (&_tmp219_, G_TYPE_STRING); - g_value_take_string (&_tmp219_, g_strdup (_tmp232_)); - } else if ((dbus_message_iter_get_arg_type (&_tmp220_) == DBUS_TYPE_ARRAY) && (dbus_message_iter_get_element_type (&_tmp220_) == DBUS_TYPE_STRING)) { - const char** _tmp233_; - int _tmp233__length; - int _tmp233__size; - int _tmp233__length1; - DBusMessageIter _tmp234_; - _tmp233_ = g_new (const char*, 5); - _tmp233__length = 0; - _tmp233__size = 4; - _tmp233__length1 = 0; - dbus_message_iter_recurse (&_tmp220_, &_tmp234_); - for (; dbus_message_iter_get_arg_type (&_tmp234_); _tmp233__length1++) { - const char* _tmp235_; - if (_tmp233__size == _tmp233__length) { - _tmp233__size = 2 * _tmp233__size; - _tmp233_ = g_renew (const char*, _tmp233_, _tmp233__size + 1); + const char* _tmp100_; + GValue _tmp101_ = {0}; + DBusMessageIter _tmp102_; + dbus_message_iter_recurse (&_tmp98_, &_tmp99_); + dbus_message_iter_get_basic (&_tmp99_, &_tmp100_); + dbus_message_iter_next (&_tmp99_); + _key = g_strdup (_tmp100_); + dbus_message_iter_recurse (&_tmp99_, &_tmp102_); + if (dbus_message_iter_get_arg_type (&_tmp102_) == DBUS_TYPE_BYTE) { + guint8 _tmp103_; + dbus_message_iter_get_basic (&_tmp102_, &_tmp103_); + g_value_init (&_tmp101_, G_TYPE_UCHAR); + g_value_set_uchar (&_tmp101_, _tmp103_); + } else if (dbus_message_iter_get_arg_type (&_tmp102_) == DBUS_TYPE_BOOLEAN) { + dbus_bool_t _tmp104_; + dbus_message_iter_get_basic (&_tmp102_, &_tmp104_); + g_value_init (&_tmp101_, G_TYPE_BOOLEAN); + g_value_set_boolean (&_tmp101_, _tmp104_); + } else if (dbus_message_iter_get_arg_type (&_tmp102_) == DBUS_TYPE_INT16) { + dbus_int16_t _tmp105_; + dbus_message_iter_get_basic (&_tmp102_, &_tmp105_); + g_value_init (&_tmp101_, G_TYPE_INT); + g_value_set_int (&_tmp101_, _tmp105_); + } else if (dbus_message_iter_get_arg_type (&_tmp102_) == DBUS_TYPE_UINT16) { + dbus_uint16_t _tmp106_; + dbus_message_iter_get_basic (&_tmp102_, &_tmp106_); + g_value_init (&_tmp101_, G_TYPE_UINT); + g_value_set_uint (&_tmp101_, _tmp106_); + } else if (dbus_message_iter_get_arg_type (&_tmp102_) == DBUS_TYPE_INT32) { + dbus_int32_t _tmp107_; + dbus_message_iter_get_basic (&_tmp102_, &_tmp107_); + g_value_init (&_tmp101_, G_TYPE_INT); + g_value_set_int (&_tmp101_, _tmp107_); + } else if (dbus_message_iter_get_arg_type (&_tmp102_) == DBUS_TYPE_UINT32) { + dbus_uint32_t _tmp108_; + dbus_message_iter_get_basic (&_tmp102_, &_tmp108_); + g_value_init (&_tmp101_, G_TYPE_UINT); + g_value_set_uint (&_tmp101_, _tmp108_); + } else if (dbus_message_iter_get_arg_type (&_tmp102_) == DBUS_TYPE_INT64) { + dbus_int64_t _tmp109_; + dbus_message_iter_get_basic (&_tmp102_, &_tmp109_); + g_value_init (&_tmp101_, G_TYPE_INT64); + g_value_set_int64 (&_tmp101_, _tmp109_); + } else if (dbus_message_iter_get_arg_type (&_tmp102_) == DBUS_TYPE_UINT64) { + dbus_uint64_t _tmp110_; + dbus_message_iter_get_basic (&_tmp102_, &_tmp110_); + g_value_init (&_tmp101_, G_TYPE_UINT64); + g_value_set_uint64 (&_tmp101_, _tmp110_); + } else if (dbus_message_iter_get_arg_type (&_tmp102_) == DBUS_TYPE_DOUBLE) { + double _tmp111_; + dbus_message_iter_get_basic (&_tmp102_, &_tmp111_); + g_value_init (&_tmp101_, G_TYPE_DOUBLE); + g_value_set_double (&_tmp101_, _tmp111_); + } else if (dbus_message_iter_get_arg_type (&_tmp102_) == DBUS_TYPE_STRING) { + const char* _tmp112_; + dbus_message_iter_get_basic (&_tmp102_, &_tmp112_); + g_value_init (&_tmp101_, G_TYPE_STRING); + g_value_take_string (&_tmp101_, g_strdup (_tmp112_)); + } else if (dbus_message_iter_get_arg_type (&_tmp102_) == DBUS_TYPE_OBJECT_PATH) { + const char* _tmp113_; + dbus_message_iter_get_basic (&_tmp102_, &_tmp113_); + g_value_init (&_tmp101_, G_TYPE_STRING); + g_value_take_string (&_tmp101_, g_strdup (_tmp113_)); + } else if (dbus_message_iter_get_arg_type (&_tmp102_) == DBUS_TYPE_SIGNATURE) { + const char* _tmp114_; + dbus_message_iter_get_basic (&_tmp102_, &_tmp114_); + g_value_init (&_tmp101_, G_TYPE_STRING); + g_value_take_string (&_tmp101_, g_strdup (_tmp114_)); + } else if ((dbus_message_iter_get_arg_type (&_tmp102_) == DBUS_TYPE_ARRAY) && (dbus_message_iter_get_element_type (&_tmp102_) == DBUS_TYPE_STRING)) { + const char** _tmp115_; + int _tmp115__length; + int _tmp115__size; + int _tmp115__length1; + DBusMessageIter _tmp116_; + _tmp115_ = g_new (const char*, 5); + _tmp115__length = 0; + _tmp115__size = 4; + _tmp115__length1 = 0; + dbus_message_iter_recurse (&_tmp102_, &_tmp116_); + for (; dbus_message_iter_get_arg_type (&_tmp116_); _tmp115__length1++) { + const char* _tmp117_; + if (_tmp115__size == _tmp115__length) { + _tmp115__size = 2 * _tmp115__size; + _tmp115_ = g_renew (const char*, _tmp115_, _tmp115__size + 1); } - dbus_message_iter_get_basic (&_tmp234_, &_tmp235_); - dbus_message_iter_next (&_tmp234_); - _tmp233_[_tmp233__length++] = g_strdup (_tmp235_); + dbus_message_iter_get_basic (&_tmp116_, &_tmp117_); + dbus_message_iter_next (&_tmp116_); + _tmp115_[_tmp115__length++] = g_strdup (_tmp117_); } - _tmp233_[_tmp233__length] = NULL; - g_value_init (&_tmp219_, G_TYPE_STRV); - g_value_take_boxed (&_tmp219_, _tmp233_); + _tmp115_[_tmp115__length] = NULL; + g_value_init (&_tmp101_, G_TYPE_STRV); + g_value_take_boxed (&_tmp101_, _tmp115_); } - dbus_message_iter_next (&_tmp217_); - _value = g_memdup (&_tmp219_, sizeof (GValue)); - g_hash_table_insert (_tmp215_, _key, _value); - dbus_message_iter_next (&_tmp216_); + dbus_message_iter_next (&_tmp99_); + _value = g_memdup (&_tmp101_, sizeof (GValue)); + g_hash_table_insert (_tmp97_, _key, _value); + dbus_message_iter_next (&_tmp98_); } dbus_message_iter_next (&iter); - changed_properties = _tmp215_; + changed_properties = _tmp97_; invalid_length1 = 0; - _tmp236_ = g_new (char*, 5); - _tmp236__length = 0; - _tmp236__size = 4; - _tmp236__length1 = 0; - dbus_message_iter_recurse (&iter, &_tmp237_); - for (; dbus_message_iter_get_arg_type (&_tmp237_); _tmp236__length1++) { - const char* _tmp238_; - if (_tmp236__size == _tmp236__length) { - _tmp236__size = 2 * _tmp236__size; - _tmp236_ = g_renew (char*, _tmp236_, _tmp236__size + 1); + _tmp118_ = g_new (char*, 5); + _tmp118__length = 0; + _tmp118__size = 4; + _tmp118__length1 = 0; + dbus_message_iter_recurse (&iter, &_tmp119_); + for (; dbus_message_iter_get_arg_type (&_tmp119_); _tmp118__length1++) { + const char* _tmp120_; + if (_tmp118__size == _tmp118__length) { + _tmp118__size = 2 * _tmp118__size; + _tmp118_ = g_renew (char*, _tmp118_, _tmp118__size + 1); } - dbus_message_iter_get_basic (&_tmp237_, &_tmp238_); - dbus_message_iter_next (&_tmp237_); - _tmp236_[_tmp236__length++] = g_strdup (_tmp238_); + dbus_message_iter_get_basic (&_tmp119_, &_tmp120_); + dbus_message_iter_next (&_tmp119_); + _tmp118_[_tmp118__length++] = g_strdup (_tmp120_); } - invalid_length1 = _tmp236__length1; - _tmp236_[_tmp236__length] = NULL; + invalid_length1 = _tmp118__length1; + _tmp118_[_tmp118__length] = NULL; dbus_message_iter_next (&iter); - invalid = _tmp236_; + invalid = _tmp118_; g_signal_emit_by_name (self, "properties-changed", source, changed_properties, invalid, invalid_length1); _g_free0 (source); _g_hash_table_unref0 (changed_properties); @@ -4690,14 +4677,14 @@ void mpris2_controller_property_changed_cb (Mpris2Controller* self, const char* 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:98: properties-changed for interface %s", interface_source); + g_debug ("mpris2-controller.vala:99: properties-changed for interface %s", interface_source); 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:100: Property-changed hash is null or this is a" \ + g_warning ("mpris2-controller.vala:101: Property-changed hash is null or this is a" \ "n interface that concerns us"); return; } @@ -4705,77 +4692,36 @@ void mpris2_controller_property_changed_cb (Mpris2Controller* self, const char* if (play_v != NULL) { char* state; gint p; - TransportMenuitem* _tmp2_; PlayerItem* _tmp1_; - ScrubMenuitem* _tmp4_; - PlayerItem* _tmp3_; + TransportMenuitem* _tmp2_; state = g_strdup (g_value_get_string (play_v)); - g_debug ("mpris2-controller.vala:106: new playback state = %s", state); + g_debug ("mpris2-controller.vala:107: new playback state = %s", state); p = 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_); - scrub_menuitem_update_playstate (_tmp4_ = (_tmp3_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), IS_SCRUB_MENUITEM (_tmp3_) ? ((ScrubMenuitem*) _tmp3_) : NULL), p); - _g_object_unref0 (_tmp4_); _g_free0 (state); } pos_v = __g_value_dup0 ((GValue*) g_hash_table_lookup (changed_properties, "Position")); if (pos_v != NULL) { gint64 pos; - ScrubMenuitem* _tmp6_; - PlayerItem* _tmp5_; pos = g_value_get_int64 (pos_v); g_debug ("mpris2-controller.vala:115: new position = %i", (gint) pos); - scrub_menuitem_update_position (_tmp6_ = (_tmp5_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), IS_SCRUB_MENUITEM (_tmp5_) ? ((ScrubMenuitem*) _tmp5_) : NULL), (gint32) pos); - _g_object_unref0 (_tmp6_); } meta_v = __g_value_dup0 ((GValue*) g_hash_table_lookup (changed_properties, "Metadata")); if (meta_v != NULL) { - GHashTable* _tmp7_; - GeeHashSet* _tmp9_; - PlayerItem* _tmp8_; - GeeHashSet* _tmp12_; - GHashTable* _tmp11_; - PlayerItem* _tmp10_; - GeeHashSet* _tmp14_; - PlayerItem* _tmp13_; - gboolean _tmp15_ = FALSE; - GHashTable* _tmp16_; - gboolean _tmp17_; - char* _tmp24_; - ScrubMenuitem* _tmp23_; - PlayerItem* _tmp22_; - g_debug ("mpris2-controller.vala:121: metadata is not empty"); - g_debug ("mpris2-controller.vala:122: artist : %s", g_value_get_string ((GValue*) g_hash_table_lookup (_tmp7_ = mpris_player_get_Metadata (self->priv->_player), "artist"))); - _g_hash_table_unref0 (_tmp7_); - player_item_reset (_tmp8_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), _tmp9_ = metadata_menuitem_attributes_format ()); - _g_object_unref0 (_tmp9_); - _g_object_unref0 (_tmp8_); - player_item_update (_tmp10_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), _tmp11_ = mpris_player_get_Metadata (self->priv->_player), _tmp12_ = metadata_menuitem_attributes_format ()); - _g_object_unref0 (_tmp12_); - _g_hash_table_unref0 (_tmp11_); - _g_object_unref0 (_tmp10_); - player_item_reset (_tmp13_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), _tmp14_ = scrub_menuitem_attributes_format ()); - _g_object_unref0 (_tmp14_); - _g_object_unref0 (_tmp13_); - if ((_tmp17_ = ((gint) g_utf8_strlen (g_value_get_string ((GValue*) g_hash_table_lookup (_tmp16_ = mpris_player_get_Metadata (self->priv->_player), "artist")), -1)) > 0, _g_hash_table_unref0 (_tmp16_), _tmp17_)) { - _tmp15_ = TRUE; - } else { - GHashTable* _tmp18_; - _tmp15_ = ((gint) g_utf8_strlen (g_value_get_string ((GValue*) g_hash_table_lookup (_tmp18_ = mpris_player_get_Metadata (self->priv->_player), "artist")), -1)) > 0; - _g_hash_table_unref0 (_tmp18_); - } - if (_tmp15_) { - GeeHashSet* _tmp21_; - GHashTable* _tmp20_; - PlayerItem* _tmp19_; - player_item_update (_tmp19_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), _tmp20_ = mpris_player_get_Metadata (self->priv->_player), _tmp21_ = scrub_menuitem_attributes_format ()); - _g_object_unref0 (_tmp21_); - _g_hash_table_unref0 (_tmp20_); - _g_object_unref0 (_tmp19_); - } - scrub_menuitem_update_playstate (_tmp23_ = (_tmp22_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), IS_SCRUB_MENUITEM (_tmp22_) ? ((ScrubMenuitem*) _tmp22_) : NULL), mpris2_controller_determine_play_state (self, _tmp24_ = mpris_player_get_PlaybackStatus (self->priv->_player))); - _g_free0 (_tmp24_); - _g_object_unref0 (_tmp23_); + GHashTable* changed_updates; + PlayerItem* _tmp3_; + GeeHashSet* _tmp4_; + PlayerItem* _tmp5_; + GeeHashSet* _tmp6_; + changed_updates = mpris2_controller_clean_metadata (self); + player_item_reset (_tmp3_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), _tmp4_ = metadata_menuitem_attributes_format ()); + _g_object_unref0 (_tmp4_); + _g_object_unref0 (_tmp3_); + player_item_update (_tmp5_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), changed_updates, _tmp6_ = metadata_menuitem_attributes_format ()); + _g_object_unref0 (_tmp6_); + _g_object_unref0 (_tmp5_); + _g_hash_table_unref0 (changed_updates); } _g_free0 (meta_v); _g_free0 (pos_v); @@ -4783,6 +4729,62 @@ void mpris2_controller_property_changed_cb (Mpris2Controller* self, const char* } +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:135: 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; + _g_free0 (length_v); + _g_free0 (artist_v); + return result; +} + + static gint mpris2_controller_determine_play_state (Mpris2Controller* self, const char* status) { gint result = 0; gboolean _tmp0_ = FALSE; @@ -4798,7 +4800,7 @@ static gint mpris2_controller_determine_play_state (Mpris2Controller* self, cons _tmp0_ = FALSE; } if (_tmp0_) { - g_debug ("mpris2-controller.vala:142: determine play state - state = %s", status); + g_debug ("mpris2-controller.vala:151: determine play state - state = %s", status); result = 0; return result; } @@ -4811,14 +4813,11 @@ void mpris2_controller_initial_update (Mpris2Controller* self) { gint32 status = 0; char* _tmp0_; gboolean _tmp1_; - TransportMenuitem* _tmp4_; PlayerItem* _tmp3_; - GeeHashSet* _tmp7_; - GHashTable* _tmp6_; + TransportMenuitem* _tmp4_; + GHashTable* cleaned_metadata; PlayerItem* _tmp5_; - GeeHashSet* _tmp10_; - GHashTable* _tmp9_; - PlayerItem* _tmp8_; + GeeHashSet* _tmp6_; g_return_if_fail (self != NULL); if ((_tmp1_ = (_tmp0_ = mpris_player_get_PlaybackStatus (self->priv->_player)) == NULL, _g_free0 (_tmp0_), _tmp1_)) { status = (gint32) 1; @@ -4827,27 +4826,23 @@ void mpris2_controller_initial_update (Mpris2Controller* self) { status = (gint32) mpris2_controller_determine_play_state (self, _tmp2_ = mpris_player_get_PlaybackStatus (self->priv->_player)); _g_free0 (_tmp2_); } - g_debug ("mpris2-controller.vala:157: initial update - play state %i", (gint) status); + g_debug ("mpris2-controller.vala:166: initial update - play state %i", (gint) status); 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), (gint) status); _g_object_unref0 (_tmp4_); - player_item_update (_tmp5_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), _tmp6_ = mpris_player_get_Metadata (self->priv->_player), _tmp7_ = metadata_menuitem_attributes_format ()); - _g_object_unref0 (_tmp7_); - _g_hash_table_unref0 (_tmp6_); + 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_); - player_item_update (_tmp8_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), _tmp9_ = mpris_player_get_Metadata (self->priv->_player), _tmp10_ = scrub_menuitem_attributes_format ()); - _g_object_unref0 (_tmp10_); - _g_hash_table_unref0 (_tmp9_); - _g_object_unref0 (_tmp8_); + _g_hash_table_unref0 (cleaned_metadata); } void mpris2_controller_transport_event (Mpris2Controller* self, TransportMenuitemaction command) { - GError * _inner_error_; + GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); - _inner_error_ = NULL; - g_debug ("mpris2-controller.vala:168: transport_event input = %i", (gint) command); + g_debug ("mpris2-controller.vala:176: transport_event input = %i", (gint) command); if (command == TRANSPORT_MENUITEM_ACTION_PLAY_PAUSE) { - g_debug ("mpris2-controller.vala:170: transport_event PLAY_PAUSE"); + g_debug ("mpris2-controller.vala:178: transport_event PLAY_PAUSE"); { mpris_player_PlayPause (self->priv->_player, &_inner_error_); if (_inner_error_ != NULL) { @@ -4866,7 +4861,7 @@ void mpris2_controller_transport_event (Mpris2Controller* self, TransportMenuite _error_ = _inner_error_; _inner_error_ = NULL; { - g_warning ("mpris2-controller.vala:175: DBus Error calling the player objects Play" \ + g_warning ("mpris2-controller.vala:183: DBus Error calling the player objects Play" \ "Pause method %s", _error_->message); _g_error_free0 (_error_); } @@ -4897,7 +4892,7 @@ void mpris2_controller_transport_event (Mpris2Controller* self, TransportMenuite _error_ = _inner_error_; _inner_error_ = NULL; { - g_warning ("mpris2-controller.vala:184: DBus Error calling the player objects Prev" \ + g_warning ("mpris2-controller.vala:192: DBus Error calling the player objects Prev" \ "ious method %s", _error_->message); _g_error_free0 (_error_); } @@ -4928,7 +4923,7 @@ void mpris2_controller_transport_event (Mpris2Controller* self, TransportMenuite _error_ = _inner_error_; _inner_error_ = NULL; { - g_warning ("mpris2-controller.vala:193: DBus Error calling the player objects Next" \ + g_warning ("mpris2-controller.vala:201: DBus Error calling the player objects Next" \ " method %s", _error_->message); _g_error_free0 (_error_); } @@ -4950,37 +4945,46 @@ TODO: SetPosition on the player object is not working with rhythmbox, runtime error - "dbus function not supported" */ void mpris2_controller_set_position (Mpris2Controller* self, double position) { - GError * _inner_error_; - GHashTable* data; - GValue* time_value; - guint32 total_time; - double new_time_position; GHashTable* _tmp0_; GValue* _tmp1_; + GValue* time_value; + gint64 total_time; + double new_time_position; + GHashTable* _tmp2_; + GValue* _tmp3_; GValue* v; + GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); - _inner_error_ = NULL; - g_debug ("mpris2-controller.vala:204: Set position with pos (0-100) %f", position); - data = mpris_player_get_Metadata (self->priv->_player); - time_value = __g_value_dup0 ((GValue*) g_hash_table_lookup (data, "time")); + g_debug ("mpris2-controller.vala:212: Set position with pos (0-100) %f", position); + time_value = (_tmp1_ = __g_value_dup0 ((GValue*) g_hash_table_lookup (_tmp0_ = mpris_player_get_Metadata (self->priv->_player), "mpris:length")), _g_hash_table_unref0 (_tmp0_), _tmp1_); if (time_value == NULL) { - g_warning ("mpris2-controller.vala:208: Can't fetch the duration of the track ther" \ + g_warning ("mpris2-controller.vala:215: Can't fetch the duration of the track ther" \ "efore cant set the position"); _g_free0 (time_value); - _g_hash_table_unref0 (data); return; } - total_time = (guint32) (g_value_get_uint (time_value) * 1000); - g_debug ("mpris2-controller.vala:213: total time of track = %i", (gint) total_time); - new_time_position = (total_time * position) / 100.0; - g_debug ("mpris2-controller.vala:215: new position = %f", new_time_position); - v = (_tmp1_ = __g_value_dup0 ((GValue*) g_hash_table_lookup (_tmp0_ = mpris_player_get_Metadata (self->priv->_player), "trackid")), _g_hash_table_unref0 (_tmp0_), _tmp1_); + total_time = g_value_get_int64 (time_value); + g_debug ("mpris2-controller.vala:220: total time of track = %i", (gint) total_time); + new_time_position = total_time * (position / 100.0); + g_debug ("mpris2-controller.vala:222: new position = %f", new_time_position); + v = (_tmp3_ = __g_value_dup0 ((GValue*) g_hash_table_lookup (_tmp2_ = mpris_player_get_Metadata (self->priv->_player), "mpris:trackid")), _g_hash_table_unref0 (_tmp2_), _tmp3_); if (v != NULL) { if (G_VALUE_HOLDS (v, G_TYPE_STRING)) { char* path; - g_debug ("mpris2-controller.vala:220: the trackid = %s", g_value_get_string (v)); path = g_strdup (g_value_get_string (v)); { + mpris_player_SetPosition (self->priv->_player, path, (gint64) new_time_position, &_inner_error_); + if (_inner_error_ != NULL) { + if (_inner_error_->domain == DBUS_GERROR) { + goto __catch5_dbus_gerror; + } + _g_free0 (path); + _g_free0 (v); + _g_free0 (time_value); + 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; + } } goto __finally5; __catch5_dbus_gerror: @@ -4989,7 +4993,7 @@ void mpris2_controller_set_position (Mpris2Controller* self, double position) { e = _inner_error_; _inner_error_ = NULL; { - g_error ("mpris2-controller.vala:226: DBus Error calling the player objects SetP" \ + g_error ("mpris2-controller.vala:234: DBus Error calling the player objects SetP" \ "osition method %s", e->message); _g_error_free0 (e); } @@ -4999,7 +5003,6 @@ void mpris2_controller_set_position (Mpris2Controller* self, double position) { _g_free0 (path); _g_free0 (v); _g_free0 (time_value); - _g_hash_table_unref0 (data); 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; @@ -5009,18 +5012,12 @@ void mpris2_controller_set_position (Mpris2Controller* self, double position) { } _g_free0 (v); _g_free0 (time_value); - _g_hash_table_unref0 (data); } void mpris2_controller_onSeeked (Mpris2Controller* self, gint64 position) { - PlayerItem* _tmp0_; - ScrubMenuitem* scrub; g_return_if_fail (self != NULL); - g_debug ("mpris2-controller.vala:234: Seeked signal callback with pos = %i", ((gint) position) / 1000); - scrub = (_tmp0_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), IS_SCRUB_MENUITEM (_tmp0_) ? ((ScrubMenuitem*) _tmp0_) : NULL); - scrub_menuitem_update_position (scrub, ((gint32) position) / 1000); - _g_object_unref0 (scrub); + g_debug ("mpris2-controller.vala:242: Seeked signal callback with pos = %i", ((gint) position) / 1000); } @@ -5057,9 +5054,8 @@ gboolean mpris2_controller_was_successfull (Mpris2Controller* self) { void mpris2_controller_expose (Mpris2Controller* self) { - GError * _inner_error_; + GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); - _inner_error_ = NULL; if (mpris2_controller_connected (self) == TRUE) { { mpris_root_Raise (self->priv->_mpris2_root, &_inner_error_); @@ -5079,7 +5075,7 @@ void mpris2_controller_expose (Mpris2Controller* self) { e = _inner_error_; _inner_error_ = NULL; { - g_error ("mpris2-controller.vala:259: Exception thrown while calling root functi" \ + g_error ("mpris2-controller.vala:267: Exception thrown while calling root functi" \ "on Raise - %s", e->message); _g_error_free0 (e); } @@ -5185,28 +5181,28 @@ static GObject * mpris2_controller_constructor (GType type, guint n_construct_pr { { DBusGConnection* connection; - MprisRoot* _tmp245_; - char* _tmp244_; - char* _tmp243_; - char* _tmp242_; - char* _tmp241_; - char* _tmp240_; - char* _tmp239_; - MprisPlayer* _tmp253_; - char* _tmp252_; - char* _tmp251_; - char* _tmp250_; - char* _tmp249_; - char* _tmp248_; - char* _tmp247_; - char* _tmp246_; - FreeDesktopProperties* _tmp260_; - char* _tmp259_; - char* _tmp258_; - char* _tmp257_; - char* _tmp256_; - char* _tmp255_; - char* _tmp254_; + char* _tmp0_; + char* _tmp1_; + char* _tmp2_; + char* _tmp3_; + char* _tmp4_; + char* _tmp5_; + MprisRoot* _tmp6_; + char* _tmp7_; + char* _tmp8_; + char* _tmp9_; + char* _tmp10_; + char* _tmp11_; + char* _tmp12_; + char* _tmp13_; + MprisPlayer* _tmp14_; + char* _tmp15_; + char* _tmp16_; + char* _tmp17_; + char* _tmp18_; + char* _tmp19_; + char* _tmp20_; + FreeDesktopProperties* _tmp21_; connection = dbus_g_bus_get (DBUS_BUS_SESSION, &_inner_error_); if (_inner_error_ != NULL) { if (_inner_error_->domain == DBUS_GERROR) { @@ -5215,32 +5211,32 @@ static GObject * mpris2_controller_constructor (GType type, guint n_construct_pr 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, _tmp245_ = mpris_root_dbus_proxy_new (connection, _tmp244_ = g_strconcat (_tmp242_ = g_strconcat (MPRIS2_CONTROLLER_root_interface, ".", NULL), _tmp243_ = g_utf8_strdown (player_controller_get_name (self->priv->_owner), -1), NULL), "/org/mpris/MediaPlayer2")); - _g_object_unref0 (_tmp245_); - _g_free0 (_tmp244_); - _g_free0 (_tmp243_); - _g_free0 (_tmp242_); - _g_free0 (_tmp241_); - _g_free0 (_tmp240_); - _g_free0 (_tmp239_); - mpris2_controller_set_player (self, _tmp253_ = mpris_player_dbus_proxy_new (connection, _tmp252_ = g_strconcat (_tmp250_ = g_strconcat (MPRIS2_CONTROLLER_root_interface, ".", NULL), _tmp251_ = g_utf8_strdown (player_controller_get_name (self->priv->_owner), -1), NULL), "/org/mpris/MediaPlayer2")); - _g_object_unref0 (_tmp253_); - _g_free0 (_tmp252_); - _g_free0 (_tmp251_); - _g_free0 (_tmp250_); - _g_free0 (_tmp249_); - _g_free0 (_tmp248_); - _g_free0 (_tmp247_); - _g_free0 (_tmp246_); + mpris2_controller_set_mpris2_root (self, _tmp6_ = mpris_root_dbus_proxy_new (connection, _tmp5_ = g_strconcat (_tmp3_ = g_strconcat (MPRIS2_CONTROLLER_root_interface, ".", NULL), _tmp4_ = g_utf8_strdown (player_controller_get_name (self->priv->_owner), -1), NULL), "/org/mpris/MediaPlayer2")); + _g_object_unref0 (_tmp6_); + _g_free0 (_tmp5_); + _g_free0 (_tmp4_); + _g_free0 (_tmp3_); + _g_free0 (_tmp2_); + _g_free0 (_tmp1_); + _g_free0 (_tmp0_); + mpris2_controller_set_player (self, _tmp14_ = mpris_player_dbus_proxy_new (connection, _tmp13_ = g_strconcat (_tmp11_ = g_strconcat (MPRIS2_CONTROLLER_root_interface, ".", NULL), _tmp12_ = g_utf8_strdown (player_controller_get_name (self->priv->_owner), -1), NULL), "/org/mpris/MediaPlayer2")); + _g_object_unref0 (_tmp14_); + _g_free0 (_tmp13_); + _g_free0 (_tmp12_); + _g_free0 (_tmp11_); + _g_free0 (_tmp10_); + _g_free0 (_tmp9_); + _g_free0 (_tmp8_); + _g_free0 (_tmp7_); g_signal_connect_object (self->priv->_player, "seeked", (GCallback) _mpris2_controller_onSeeked_mpris_player_seeked, self, 0); - mpris2_controller_set_properties_interface (self, _tmp260_ = free_desktop_properties_dbus_proxy_new (connection, _tmp259_ = g_strconcat (_tmp257_ = g_strconcat (MPRIS2_CONTROLLER_root_interface, ".", NULL), _tmp258_ = g_utf8_strdown (player_controller_get_name (self->priv->_owner), -1), NULL), "/org/mpris/MediaPlayer2")); - _g_object_unref0 (_tmp260_); - _g_free0 (_tmp259_); - _g_free0 (_tmp258_); - _g_free0 (_tmp257_); - _g_free0 (_tmp256_); - _g_free0 (_tmp255_); - _g_free0 (_tmp254_); + mpris2_controller_set_properties_interface (self, _tmp21_ = free_desktop_properties_dbus_proxy_new (connection, _tmp20_ = g_strconcat (_tmp18_ = g_strconcat (MPRIS2_CONTROLLER_root_interface, ".", NULL), _tmp19_ = g_utf8_strdown (player_controller_get_name (self->priv->_owner), -1), NULL), "/org/mpris/MediaPlayer2")); + _g_object_unref0 (_tmp21_); + _g_free0 (_tmp20_); + _g_free0 (_tmp19_); + _g_free0 (_tmp18_); + _g_free0 (_tmp17_); + _g_free0 (_tmp16_); + _g_free0 (_tmp15_); 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); } @@ -5251,7 +5247,7 @@ static GObject * mpris2_controller_constructor (GType type, guint n_construct_pr e = _inner_error_; _inner_error_ = NULL; { - g_error ("mpris2-controller.vala:92: Problems connecting to the session bus - %s", e->message); + g_error ("mpris2-controller.vala:93: Problems connecting to the session bus - %s", e->message); _g_error_free0 (e); } } diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala index 65d881a..df2bbd3 100644 --- a/src/mpris2-controller.vala +++ b/src/mpris2-controller.vala @@ -19,6 +19,7 @@ with this program. If not, see . */ using DBus; + [DBus (name = "org.mpris.MediaPlayer2")] public interface MprisRoot : DBus.Object { // properties @@ -89,7 +90,7 @@ public class Mpris2Controller : GLib.Object this.properties_interface.PropertiesChanged += property_changed_cb; } catch (DBus.Error e) { - error("Problems connecting to the session bus - %s", e.message); + error("Problems connecting to the session bus - %s", e.message); } } @@ -106,33 +107,41 @@ public class Mpris2Controller : GLib.Object debug("new playback state = %s", state); int p = this.determine_play_state(state); (this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(p); - (this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem).update_playstate(p); } Value? pos_v = changed_properties.lookup("Position"); if(pos_v != null){ int64 pos = pos_v.get_int64(); debug("new position = %i", (int)pos); - (this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem).update_position((int32)pos); } Value? meta_v = changed_properties.lookup("Metadata"); if(meta_v != null){ - debug("metadata is not empty"); - debug("artist : %s", this.player.Metadata.lookup("artist").get_string()); - this.owner.custom_items[PlayerController.widget_order.METADATA].reset(MetadataMenuitem.attributes_format()); - this.owner.custom_items[PlayerController.widget_order.METADATA].update(this.player.Metadata, + GLib.HashTable changed_updates = clean_metadata(); + this.owner.custom_items[PlayerController.widget_order.METADATA].reset(MetadataMenuitem.attributes_format()); + this.owner.custom_items[PlayerController.widget_order.METADATA].update(changed_updates, MetadataMenuitem.attributes_format()); - this.owner.custom_items[PlayerController.widget_order.SCRUB].reset(ScrubMenuitem.attributes_format()); - if((int)this.player.Metadata.lookup("artist").get_string().len() > 0 || - (int)this.player.Metadata.lookup("artist").get_string().len() > 0){ - this.owner.custom_items[PlayerController.widget_order.SCRUB].update(this.player.Metadata, - ScrubMenuitem.attributes_format()); - } - (this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem).update_playstate(this.determine_play_state(this.player.PlaybackStatus)); - } } + + private GLib.HashTable clean_metadata() + { + GLib.HashTable changed_updates = this.player.Metadata; + Value? artist_v = this.player.Metadata.lookup("xesam:artist"); + if(artist_v != null){ + string[] artists = (string[])this.player.Metadata.lookup("xesam:artist"); + string display_artists = string.joinv(", ", artists); + changed_updates.replace("xesam:artist", display_artists); + debug("artist : %s", display_artists); + } + Value? length_v = this.player.Metadata.lookup("mpris:length"); + if(length_v != null){ + int64 duration = this.player.Metadata.lookup("mpris:length").get_int64(); + changed_updates.replace("mpris:length", duration/1000000); + } + return changed_updates; + } + private int determine_play_state(string status){ if(status == null) @@ -157,10 +166,9 @@ public class Mpris2Controller : GLib.Object debug("initial update - play state %i", status); (this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(status); - this.owner.custom_items[PlayerController.widget_order.METADATA].update(this.player.Metadata, + GLib.HashTable cleaned_metadata = this.clean_metadata(); + this.owner.custom_items[PlayerController.widget_order.METADATA].update(cleaned_metadata, MetadataMenuitem.attributes_format()); - this.owner.custom_items[PlayerController.widget_order.SCRUB].update(this.player.Metadata, - ScrubMenuitem.attributes_format()); } public void transport_event(TransportMenuitem.action command) @@ -202,25 +210,25 @@ public class Mpris2Controller : GLib.Object public void set_position(double position) { debug("Set position with pos (0-100) %f", position); - HashTable data = this.player.Metadata; - Value? time_value = data.lookup("time"); + Value? time_value = this.player.Metadata.lookup("mpris:length"); if(time_value == null){ warning("Can't fetch the duration of the track therefore cant set the position"); return; } - // work in microseconds (scale up by 10 TTP-of 3) - uint32 total_time = time_value.get_uint() * 1000; + // work in microseconds (scale up by 10 TTP-of 6) + int64 total_time = time_value.get_int64(); debug("total time of track = %i", (int)total_time); - double new_time_position = total_time * position/100.0; + double new_time_position = total_time * (position/100.0); debug("new position = %f", (new_time_position)); - Value? v = this.player.Metadata.lookup("trackid"); + Value? v = this.player.Metadata.lookup("mpris:trackid"); if(v != null){ if(v.holds (typeof (string))){ - debug("the trackid = %s", v.get_string()); DBus.ObjectPath path = new ObjectPath(v.get_string()); try{ - //this.player.SetPosition(path, (int64)(new_time_position)); + this.player.SetPosition(path, (int64)(new_time_position)); + //ScrubMenuitem scrub = this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem; + //scrub.update_position(((int32)new_time_position) / 1000); } catch(DBus.Error e){ error("DBus Error calling the player objects SetPosition method %s", @@ -232,8 +240,8 @@ public class Mpris2Controller : GLib.Object public void onSeeked(int64 position){ debug("Seeked signal callback with pos = %i", (int)position/1000); - ScrubMenuitem scrub = this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem; - scrub.update_position((int32)position/1000); + //ScrubMenuitem scrub = this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem; + //scrub.update_position((int32)position/1000); } public bool connected() diff --git a/src/music-player-bridge.c b/src/music-player-bridge.c index 3e83e7c..1e908a9 100644 --- a/src/music-player-bridge.c +++ b/src/music-player-bridge.c @@ -1,4 +1,4 @@ -/* music-player-bridge.c generated by valac 0.9.5, the Vala compiler +/* music-player-bridge.c generated by valac 0.9.7, the Vala compiler * generated from music-player-bridge.vala, do not modify */ /* @@ -107,6 +107,8 @@ GType familiar_players_db_get_type (void) G_GNUC_CONST; 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_indicator_added (MusicPlayerBridge* self, IndicateListenerServer* object, IndicateListenerIndicator* p0); @@ -121,15 +123,13 @@ void music_player_bridge_on_server_removed (MusicPlayerBridge* self, IndicateLis static void _music_player_bridge_on_server_removed_indicate_listener_server_removed (IndicateListener* _sender, IndicateListenerServer* object, const char* p0, gpointer self); void music_player_bridge_on_server_count_changed (MusicPlayerBridge* self, IndicateListenerServer* object, guint i); static void _music_player_bridge_on_server_count_changed_indicate_listener_server_count_changed (IndicateListener* _sender, IndicateListenerServer* object, guint p0, gpointer self); -MusicPlayerBridge* music_player_bridge_new (void); -MusicPlayerBridge* music_player_bridge_construct (GType object_type); +static void music_player_bridge_try_to_add_inactive_familiar_clients (MusicPlayerBridge* self); GeeSet* familiar_players_db_records (FamiliarPlayersDB* self); 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, gint offset, PlayerControllerstate initial_state); PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, const char* client_name, gint offset, PlayerControllerstate initial_state); -static void music_player_bridge_try_to_add_inactive_familiar_clients (MusicPlayerBridge* self); -#define PLAYER_CONTROLLER_WIDGET_QUANTITY 5 +#define PLAYER_CONTROLLER_WIDGET_QUANTITY 4 static gboolean music_player_bridge_server_is_not_of_interest (MusicPlayerBridge* self, const char* type); void player_controller_update_state (PlayerController* self, PlayerControllerstate new_state); void player_controller_activate (PlayerController* self); @@ -237,10 +237,10 @@ static void music_player_bridge_try_to_add_inactive_familiar_clients (MusicPlaye GDesktopAppInfo* _tmp2_; GAppInfo* app_info; PlayerController* ctrl; - char* _tmp4_; char* _tmp3_; - char* _tmp6_; + char* _tmp4_; char* _tmp5_; + char* _tmp6_; if (app == NULL) { g_warning ("music-player-bridge.vala:52: App string in keyfile is null therefore m" \ "oving on to next player"); @@ -292,9 +292,9 @@ static gint music_player_bridge_calculate_menu_position (MusicPlayerBridge* self void music_player_bridge_on_server_added (MusicPlayerBridge* self, IndicateListenerServer* object, const char* type) { - gint _tmp1__length1; - char** _tmp1_; char** _tmp0_; + char** _tmp1_; + gint _tmp1__length1; char* _tmp2_; char* client_name; gboolean _tmp3_ = FALSE; @@ -344,9 +344,9 @@ void music_player_bridge_on_server_added (MusicPlayerBridge* self, IndicateListe void music_player_bridge_on_server_removed (MusicPlayerBridge* self, IndicateListenerServer* object, const char* type) { - gint _tmp1__length1; - char** _tmp1_; char** _tmp0_; + char** _tmp1_; + gint _tmp1__length1; char* _tmp2_; char* client_name; gboolean _tmp3_ = FALSE; @@ -419,8 +419,8 @@ static void music_player_bridge_desktop_info_callback (MusicPlayerBridge* self, familiar_players_db_insert (bridge->priv->playersDB, path); app_info = music_player_bridge_create_app_info (path); if (app_info != NULL) { - char* _tmp3_; char* _tmp2_; + char* _tmp3_; PlayerController* _tmp4_; PlayerController* ctrl; ctrl = (_tmp4_ = (PlayerController*) gee_abstract_map_get ((GeeAbstractMap*) bridge->priv->registered_clients, _tmp3_ = string_strip (_tmp2_ = g_utf8_strdown (g_app_info_get_name (app_info), -1))), _g_free0 (_tmp3_), _g_free0 (_tmp2_), _tmp4_); diff --git a/src/music-player-bridge.h b/src/music-player-bridge.h index 1670d28..64ccb1c 100644 --- a/src/music-player-bridge.h +++ b/src/music-player-bridge.h @@ -1,4 +1,4 @@ -/* music-player-bridge.h generated by valac 0.9.5, the Vala compiler, do not modify */ +/* music-player-bridge.h generated by valac 0.9.7, the Vala compiler, do not modify */ #ifndef __MUSIC_PLAYER_BRIDGE_H__ @@ -254,7 +254,6 @@ typedef enum { PLAYER_CONTROLLER_WIDGET_ORDER_SEPARATOR, PLAYER_CONTROLLER_WIDGET_ORDER_TITLE, PLAYER_CONTROLLER_WIDGET_ORDER_METADATA, - PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB, PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT } PlayerControllerwidget_order; @@ -374,7 +373,7 @@ GeeHashSet* title_menuitem_attributes_format (void); GType mpris_bridge_get_type (void) G_GNUC_CONST; GType player_controller_widget_order_get_type (void) G_GNUC_CONST; GType player_controller_state_get_type (void) G_GNUC_CONST; -#define PLAYER_CONTROLLER_WIDGET_QUANTITY 5 +#define PLAYER_CONTROLLER_WIDGET_QUANTITY 4 PlayerController* player_controller_new (DbusmenuMenuitem* root, const char* client_name, gint offset, PlayerControllerstate initial_state); PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, const char* client_name, gint offset, PlayerControllerstate initial_state); void player_controller_update_state (PlayerController* self, PlayerControllerstate new_state); diff --git a/src/play-button.c b/src/play-button.c index 2f3a553..a2eaf2e 100644 --- a/src/play-button.c +++ b/src/play-button.c @@ -750,9 +750,9 @@ draw (GtkWidget* button, cairo_t *cr) X, Y + 2, RECT_WIDTH - 4, - INNER_RADIUS, - INNER_START, - INNER_END); + MIDDLE_RADIUS, + MIDDLE_START, + MIDDLE_END); if(priv->current_command == TRANSPORT_PREVIOUS){ draw_gradient (cr, @@ -774,35 +774,35 @@ draw (GtkWidget* button, cairo_t *cr) } // play/pause-background - draw_circle (cr, - X + RECT_WIDTH / 2.0f - 2.0f * OUTER_RADIUS - 5.5f, - Y - ((CIRCLE_RADIUS - OUTER_RADIUS)), - CIRCLE_RADIUS, - OUTER_START, - OUTER_END); - draw_circle (cr, - X + RECT_WIDTH / 2.0f - 2.0f * OUTER_RADIUS - 5.5f + 0.5f, - Y - ((CIRCLE_RADIUS - OUTER_RADIUS)) + 0.5f, - CIRCLE_RADIUS - 0.75f, - MIDDLE_START, - MIDDLE_END); - - if(priv->current_command == TRANSPORT_PLAY_PAUSE){ - draw_circle (cr, - X + RECT_WIDTH / 2.0f - 2.0f * OUTER_RADIUS - 5.5f + 1.5f, - Y - ((CIRCLE_RADIUS - OUTER_RADIUS)) + 1.5f, - CIRCLE_RADIUS - 1.5f, - INNER_COMPRESSED_START, - INNER_COMPRESSED_END); - } - else{ - draw_circle (cr, - X + RECT_WIDTH / 2.0f - 2.0f * OUTER_RADIUS - 5.5f + 1.5f, - Y - ((CIRCLE_RADIUS - OUTER_RADIUS)) + 1.5f, - CIRCLE_RADIUS - 1.5f, - INNER_START, - INNER_END); - } + draw_circle (cr, + X + RECT_WIDTH / 2.0f - 2.0f * OUTER_RADIUS - 5.5f, + Y - ((CIRCLE_RADIUS - OUTER_RADIUS)), + CIRCLE_RADIUS, + OUTER_START, + OUTER_END); + draw_circle (cr, + X + RECT_WIDTH / 2.0f - 2.0f * OUTER_RADIUS - 5.5f + 0.5f, + Y - ((CIRCLE_RADIUS - OUTER_RADIUS)) + 0.5f, + CIRCLE_RADIUS - 0.75f, + MIDDLE_START, + MIDDLE_END); + + if(priv->current_command == TRANSPORT_PLAY_PAUSE){ + draw_circle (cr, + X + RECT_WIDTH / 2.0f - 2.0f * OUTER_RADIUS - 5.5f + 1.5f, + Y - ((CIRCLE_RADIUS - OUTER_RADIUS)) + 1.5f, + CIRCLE_RADIUS - 1.5f, + INNER_COMPRESSED_START, + INNER_COMPRESSED_END); + } + else{ + draw_circle (cr, + X + RECT_WIDTH / 2.0f - 2.0f * OUTER_RADIUS - 5.5f + 1.5f, + Y - ((CIRCLE_RADIUS - OUTER_RADIUS)) + 1.5f, + CIRCLE_RADIUS - 1.5f, + MIDDLE_START, + MIDDLE_END); + } // draw previous-button drop-shadow _setup (&cr_surf, &surf, PREV_WIDTH, PREV_HEIGHT); _mask_prev (cr_surf, diff --git a/src/player-controller.c b/src/player-controller.c index 39189f3..28bb28c 100644 --- a/src/player-controller.c +++ b/src/player-controller.c @@ -1,4 +1,4 @@ -/* player-controller.c generated by valac 0.9.5, the Vala compiler +/* player-controller.c generated by valac 0.9.7, the Vala compiler * generated from player-controller.vala, do not modify */ /* @@ -91,16 +91,6 @@ typedef struct _TitleMenuitemClass TitleMenuitemClass; typedef struct _MetadataMenuitem MetadataMenuitem; typedef struct _MetadataMenuitemClass MetadataMenuitemClass; -#define TYPE_SCRUB_MENUITEM (scrub_menuitem_get_type ()) -#define SCRUB_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SCRUB_MENUITEM, ScrubMenuitem)) -#define SCRUB_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SCRUB_MENUITEM, ScrubMenuitemClass)) -#define IS_SCRUB_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SCRUB_MENUITEM)) -#define IS_SCRUB_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SCRUB_MENUITEM)) -#define SCRUB_MENUITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SCRUB_MENUITEM, ScrubMenuitemClass)) - -typedef struct _ScrubMenuitem ScrubMenuitem; -typedef struct _ScrubMenuitemClass ScrubMenuitemClass; - #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)) @@ -134,7 +124,6 @@ typedef enum { PLAYER_CONTROLLER_WIDGET_ORDER_SEPARATOR, PLAYER_CONTROLLER_WIDGET_ORDER_TITLE, PLAYER_CONTROLLER_WIDGET_ORDER_METADATA, - PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB, PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT } PlayerControllerwidget_order; @@ -161,29 +150,28 @@ enum { }; GType player_controller_widget_order_get_type (void) G_GNUC_CONST; GType player_controller_state_get_type (void) G_GNUC_CONST; -#define PLAYER_CONTROLLER_WIDGET_QUANTITY 5 +#define PLAYER_CONTROLLER_WIDGET_QUANTITY 4 +PlayerController* player_controller_new (DbusmenuMenuitem* root, const char* client_name, gint offset, PlayerControllerstate initial_state); +PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, const char* client_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_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); -PlayerController* player_controller_new (DbusmenuMenuitem* root, const char* client_name, gint offset, PlayerControllerstate initial_state); -PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, const char* client_name, gint offset, PlayerControllerstate initial_state); -const char* player_controller_get_name (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); -GAppInfo* player_controller_get_app_info (PlayerController* self); void player_controller_instantiate (PlayerController* self); +GAppInfo* player_controller_get_app_info (PlayerController* self); MprisBridge* mpris_bridge_new (PlayerController* ctrl); MprisBridge* mpris_bridge_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); -GeeHashSet* scrub_menuitem_attributes_format (void); -void player_controller_hibernate (PlayerController* self); 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); @@ -193,9 +181,6 @@ GType title_menuitem_get_type (void) G_GNUC_CONST; MetadataMenuitem* metadata_menuitem_new (void); MetadataMenuitem* metadata_menuitem_construct (GType object_type); GType metadata_menuitem_get_type (void) G_GNUC_CONST; -ScrubMenuitem* scrub_menuitem_new (PlayerController* parent); -ScrubMenuitem* scrub_menuitem_construct (GType object_type, PlayerController* parent); -GType scrub_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; @@ -211,7 +196,7 @@ static void player_controller_set_property (GObject * object, guint property_id, 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_SCRUB, "PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB", "scrub"}, {PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT, "PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT", "transport"}, {0, NULL, NULL}}; + static const GEnumValue values[] = {{PLAYER_CONTROLLER_WIDGET_ORDER_SEPARATOR, "PLAYER_CONTROLLER_WIDGET_ORDER_SEPARATOR", "separator"}, {PLAYER_CONTROLLER_WIDGET_ORDER_TITLE, "PLAYER_CONTROLLER_WIDGET_ORDER_TITLE", "title"}, {PLAYER_CONTROLLER_WIDGET_ORDER_METADATA, "PLAYER_CONTROLLER_WIDGET_ORDER_METADATA", "metadata"}, {PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT, "PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT", "transport"}, {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); @@ -251,8 +236,8 @@ static char* string_strip (const char* self) { PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, const char* client_name, gint offset, PlayerControllerstate initial_state) { PlayerController * self; DbusmenuMenuitem* _tmp0_; - char* _tmp2_; char* _tmp1_; + char* _tmp2_; GeeArrayList* _tmp3_; g_return_val_if_fail (root != NULL, NULL); g_return_val_if_fail (client_name != NULL, NULL); @@ -278,7 +263,7 @@ PlayerController* player_controller_new (DbusmenuMenuitem* root, const char* cli void player_controller_update_state (PlayerController* self, PlayerControllerstate new_state) { g_return_if_fail (self != NULL); - g_debug ("player-controller.vala:67: update_state - player controller %s : new s" \ + g_debug ("player-controller.vala:66: 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); @@ -292,10 +277,9 @@ void player_controller_activate (PlayerController* self) { void player_controller_instantiate (PlayerController* self) { - GError * _inner_error_; + GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); - _inner_error_ = NULL; - g_debug ("player-controller.vala:85: instantiate in player controller for %s", self->priv->_name); + g_debug ("player-controller.vala:84: 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) { @@ -310,7 +294,7 @@ void player_controller_instantiate (PlayerController* self) { _error_ = _inner_error_; _inner_error_ = NULL; { - g_warning ("player-controller.vala:91: Failed to launch app %s with error message:" \ + g_warning ("player-controller.vala:90: Failed to launch app %s with error message:" \ " %s", self->priv->_name, _error_->message); _g_error_free0 (_error_); } @@ -328,7 +312,7 @@ static void player_controller_establish_mpris_connection (PlayerController* self MprisBridge* _tmp0_; g_return_if_fail (self != NULL); if (self->current_state != PLAYER_CONTROLLER_STATE_READY) { - g_debug ("player-controller.vala:98: establish_mpris_connection - Not ready to c" \ + g_debug ("player-controller.vala:97: establish_mpris_connection - Not ready to c" \ "onnect"); return; } @@ -357,12 +341,10 @@ void player_controller_vanish (PlayerController* self) { void player_controller_hibernate (PlayerController* self) { - GeeHashSet* _tmp1_; PlayerItem* _tmp0_; - GeeHashSet* _tmp3_; + GeeHashSet* _tmp1_; PlayerItem* _tmp2_; - GeeHashSet* _tmp5_; - PlayerItem* _tmp4_; + GeeHashSet* _tmp3_; 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 ()); @@ -371,43 +353,30 @@ void player_controller_hibernate (PlayerController* self) { 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_); - player_item_reset (_tmp4_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), _tmp5_ = scrub_menuitem_attributes_format ()); - _g_object_unref0 (_tmp5_); - _g_object_unref0 (_tmp4_); } void player_controller_update_layout (PlayerController* self) { - GeeHashSet* _tmp5_; - PlayerItem* _tmp4_; + PlayerItem* _tmp2_; PlayerItem* _tmp3_; - GeeHashSet* _tmp8_; - PlayerItem* _tmp7_; - PlayerItem* _tmp6_; - PlayerItem* _tmp9_; + GeeHashSet* _tmp4_; + PlayerItem* _tmp5_; g_return_if_fail (self != NULL); if (self->current_state != PLAYER_CONTROLLER_STATE_CONNECTED) { PlayerItem* _tmp0_; PlayerItem* _tmp1_; - PlayerItem* _tmp2_; 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_SCRUB)), DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE); + 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_); - 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, FALSE); - _g_object_unref0 (_tmp2_); return; } - dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp3_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA)), DBUSMENU_MENUITEM_PROP_VISIBLE, player_item_populated (_tmp4_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), _tmp5_ = metadata_menuitem_attributes_format ())); - _g_object_unref0 (_tmp5_); + 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_); - dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp6_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB)), DBUSMENU_MENUITEM_PROP_VISIBLE, player_item_populated (_tmp7_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), _tmp8_ = scrub_menuitem_attributes_format ())); - _g_object_unref0 (_tmp8_); - _g_object_unref0 (_tmp7_); - _g_object_unref0 (_tmp6_); - dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp9_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT)), DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); - _g_object_unref0 (_tmp9_); + _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_); } @@ -415,7 +384,6 @@ static void player_controller_construct_widgets (PlayerController* self) { PlayerItem* _tmp0_; TitleMenuitem* title_menu_item; MetadataMenuitem* metadata_item; - ScrubMenuitem* scrub_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)); @@ -424,8 +392,6 @@ static void player_controller_construct_widgets (PlayerController* 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); - scrub_item = scrub_menuitem_new (self); - gee_abstract_collection_add ((GeeAbstractCollection*) self->custom_items, (PlayerItem*) scrub_item); transport_item = transport_menuitem_new (self); gee_abstract_collection_add ((GeeAbstractCollection*) self->custom_items, (PlayerItem*) transport_item); { @@ -443,7 +409,6 @@ static void player_controller_construct_widgets (PlayerController* self) { _g_object_unref0 (_item_it); } _g_object_unref0 (transport_item); - _g_object_unref0 (scrub_item); _g_object_unref0 (metadata_item); _g_object_unref0 (title_menu_item); } @@ -488,13 +453,13 @@ static char* player_controller_format_client_name (const char* client_name) { g_return_val_if_fail (client_name != NULL, NULL); formatted = g_strdup (client_name); if (g_utf8_strlen (formatted, -1) > 1) { - char* _tmp2_; - char* _tmp1_; 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, g_utf8_strlen (client_name, -1)), NULL), _g_free0 (formatted), _tmp2_); _g_free0 (_tmp1_); _g_free0 (_tmp0_); - g_debug ("player-controller.vala:171: PlayerController->format_client_name - : %" \ + g_debug ("player-controller.vala:160: PlayerController->format_client_name - : %" \ "s", formatted); } result = formatted; diff --git a/src/player-controller.vala b/src/player-controller.vala index 2aa4382..3e12dce 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -23,13 +23,12 @@ using Gee; public class PlayerController : GLib.Object { - public const int WIDGET_QUANTITY = 5; + public const int WIDGET_QUANTITY = 4; public static enum widget_order{ SEPARATOR, TITLE, METADATA, - SCRUB, TRANSPORT, } @@ -114,25 +113,19 @@ public class PlayerController : GLib.Object update_state(PlayerController.state.OFFLINE); this.custom_items[widget_order.TRANSPORT].reset(TransportMenuitem.attributes_format()); this.custom_items[widget_order.METADATA].reset(MetadataMenuitem.attributes_format()); - this.custom_items[widget_order.SCRUB].reset(ScrubMenuitem.attributes_format()); } public void update_layout() - { - + { if(this.current_state != state.CONNECTED){ this.custom_items[widget_order.TRANSPORT].property_set_bool(MENUITEM_PROP_VISIBLE, false); - this.custom_items[widget_order.SCRUB].property_set_bool(MENUITEM_PROP_VISIBLE, - false); this.custom_items[widget_order.METADATA].property_set_bool(MENUITEM_PROP_VISIBLE, false); return; } this.custom_items[widget_order.METADATA].property_set_bool(MENUITEM_PROP_VISIBLE, this.custom_items[widget_order.METADATA].populated(MetadataMenuitem.attributes_format())); - this.custom_items[widget_order.SCRUB].property_set_bool(MENUITEM_PROP_VISIBLE, - this.custom_items[widget_order.SCRUB].populated(ScrubMenuitem.attributes_format())); this.custom_items[widget_order.TRANSPORT].property_set_bool(MENUITEM_PROP_VISIBLE, true); } @@ -150,10 +143,6 @@ public class PlayerController : GLib.Object MetadataMenuitem metadata_item = new MetadataMenuitem(); this.custom_items.add(metadata_item); - // Scrub item - ScrubMenuitem scrub_item = new ScrubMenuitem(this); - this.custom_items.add(scrub_item); - // Transport item TransportMenuitem transport_item = new TransportMenuitem(this); this.custom_items.add(transport_item); diff --git a/src/player-item.c b/src/player-item.c index 74d3e2f..f70c04c 100644 --- a/src/player-item.c +++ b/src/player-item.c @@ -1,4 +1,4 @@ -/* player-item.c generated by valac 0.9.5, the Vala compiler +/* player-item.c generated by valac 0.9.7, the Vala compiler * generated from player-item.vala, do not modify */ /* @@ -84,8 +84,8 @@ enum { 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); -static GValue* _g_value_dup (GValue* self); void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attributes); +static GValue* _g_value_dup (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); @@ -178,11 +178,10 @@ static char* bool_to_string (gboolean self) { void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attributes) { - GError * _inner_error_; + GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (data != NULL); g_return_if_fail (attributes != NULL); - _inner_error_ = NULL; g_debug ("player-item.vala:47: PlayerItem::update()"); if (data == NULL) { g_debug ("player-item.vala:49: PlayerItem::Update -> The hashtable was null - ju" \ @@ -194,13 +193,13 @@ void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attribu _property_it = gee_abstract_collection_iterator ((GeeAbstractCollection*) attributes); while (TRUE) { char* property; - char** _tmp1_; - gint _input_keys_size_; gint input_keys_length1; + gint _input_keys_size_; + char** _tmp1_; char** _tmp0_; char** input_keys; - char** _tmp3_ = NULL; gint _tmp2_; + char** _tmp3_ = NULL; char* search_key; GValue* v; if (!gee_iterator_next (_property_it)) { @@ -215,7 +214,7 @@ void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attribu char* update; update = string_strip (g_value_get_string (v)); g_debug ("player-item.vala:61: with value : %s", update); - if (string_contains (property, "arturl")) { + if (string_contains (property, "mpris:artUrl")) { { char* _tmp4_; char* _tmp5_; @@ -269,9 +268,9 @@ void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attribu g_debug ("player-item.vala:74: 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_UINT)) { - g_debug ("player-item.vala:78: with value : %i", (gint) g_value_get_uint (v)); - dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, property, (gint) g_value_get_uint (v)); + if (G_VALUE_HOLDS (v, G_TYPE_INT64)) { + g_debug ("player-item.vala:78: 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* _tmp8_; @@ -309,8 +308,9 @@ gboolean player_item_populated (PlayerItem* self, GeeHashSet* attrs) { break; } prop = (char*) gee_iterator_get (_prop_it); + g_debug ("player-item.vala:95: populated ? - prop: %s", prop); value_int = dbusmenu_menuitem_property_get_int ((DbusmenuMenuitem*) self, prop); - g_debug ("player-item.vala:96: populate - prop %s and value %i", prop, value_int); + g_debug ("player-item.vala:97: 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); diff --git a/src/player-item.vala b/src/player-item.vala index e5d8bfc..fbfacbd 100644 --- a/src/player-item.vala +++ b/src/player-item.vala @@ -60,7 +60,7 @@ public class PlayerItem : Dbusmenu.Menuitem string update = v.get_string().strip(); debug("with value : %s", update); // Special case for the arturl URI's. - if(property.contains("arturl")){ + if(property.contains("mpris:artUrl")){ try{ update = Filename.from_uri(update.strip()); } @@ -74,9 +74,9 @@ public class PlayerItem : Dbusmenu.Menuitem debug("with value : %i", v.get_int()); this.property_set_int(property, v.get_int()); } - else if (v.holds (typeof (uint))){ - debug("with value : %i", (int)v.get_uint()); - this.property_set_int(property, (int)v.get_uint()); + else if (v.holds (typeof (int64))){ + debug("with value : %i", (int)v.get_int64()); + this.property_set_int(property, (int)v.get_int64()); } else if(v.holds (typeof (bool))){ debug("with value : %s", v.get_boolean().to_string()); @@ -92,8 +92,9 @@ public class PlayerItem : Dbusmenu.Menuitem public bool populated(HashSet attrs) { foreach(string prop in attrs){ + debug("populated ? - prop: %s", prop); int value_int = property_get_int(prop); - debug("populate - prop %s and value %i", prop, value_int); + debug("populated ? - prop %s and value %i", prop, value_int); if(property_get_int(prop) != EMPTY){ return true; } diff --git a/src/scrub-menu-item.c b/src/scrub-menu-item.c index f31b24e..c4aa807 100644 --- a/src/scrub-menu-item.c +++ b/src/scrub-menu-item.c @@ -1,4 +1,4 @@ -/* scrub-menu-item.c generated by valac 0.9.5, the Vala compiler +/* scrub-menu-item.c generated by valac 0.9.7, the Vala compiler * generated from scrub-menu-item.vala, do not modify */ /* @@ -55,7 +55,6 @@ typedef struct _PlayerItemPrivate PlayerItemPrivate; typedef struct _ScrubMenuitem ScrubMenuitem; typedef struct _ScrubMenuitemClass ScrubMenuitemClass; typedef struct _ScrubMenuitemPrivate ScrubMenuitemPrivate; -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) #define TYPE_PLAYER_CONTROLLER (player_controller_get_type ()) #define PLAYER_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYER_CONTROLLER, PlayerController)) @@ -66,6 +65,7 @@ typedef struct _ScrubMenuitemPrivate ScrubMenuitemPrivate; typedef struct _PlayerController PlayerController; typedef struct _PlayerControllerClass PlayerControllerClass; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) typedef struct _PlayerControllerPrivate PlayerControllerPrivate; #define TYPE_MPRIS_BRIDGE (mpris_bridge_get_type ()) @@ -116,16 +116,16 @@ GType scrub_menuitem_get_type (void) G_GNUC_CONST; enum { SCRUB_MENUITEM_DUMMY_PROPERTY }; -void player_item_reset (PlayerItem* self, GeeHashSet* attrs); -GeeHashSet* scrub_menuitem_attributes_format (void); GType player_controller_get_type (void) G_GNUC_CONST; ScrubMenuitem* scrub_menuitem_new (PlayerController* parent); ScrubMenuitem* scrub_menuitem_construct (GType object_type, PlayerController* parent); +void player_item_reset (PlayerItem* self, GeeHashSet* attrs); +GeeHashSet* scrub_menuitem_attributes_format (void); +static void scrub_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 mpris_bridge_get_type (void) G_GNUC_CONST; void mpris_bridge_set_track_position (MprisBridge* self, double pos); -static void scrub_menuitem_real_handle_event (DbusmenuMenuitem* base, const char* name, GValue* input_value, guint timestamp); void scrub_menuitem_update_position (ScrubMenuitem* self, gint32 new_position); void scrub_menuitem_update_playstate (ScrubMenuitem* self, gint state); diff --git a/src/scrub-menu-item.vala b/src/scrub-menu-item.vala index 7368a0c..d7b60a0 100644 --- a/src/scrub-menu-item.vala +++ b/src/scrub-menu-item.vala @@ -42,7 +42,7 @@ public class ScrubMenuitem : PlayerItem public void update_playstate(int state) { - this.property_set_int(MENUITEM_PLAY_STATE, state); + this.property_set_int(MENUITEM_PLAY_STATE, state); } public static HashSet attributes_format() diff --git a/src/title-menu-item.c b/src/title-menu-item.c index a81e2ce..2733bde 100644 --- a/src/title-menu-item.c +++ b/src/title-menu-item.c @@ -1,4 +1,4 @@ -/* title-menu-item.c generated by valac 0.9.5, the Vala compiler +/* title-menu-item.c generated by valac 0.9.7, the Vala compiler * generated from title-menu-item.vala, do not modify */ /* @@ -125,15 +125,15 @@ enum { TITLE_MENUITEM_DUMMY_PROPERTY }; GType player_controller_get_type (void) G_GNUC_CONST; -const char* player_controller_get_name (PlayerController* self); 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 mpris_bridge_get_type (void) G_GNUC_CONST; GType player_controller_state_get_type (void) G_GNUC_CONST; void player_controller_instantiate (PlayerController* self); void mpris_bridge_expose (MprisBridge* self); -static void title_menuitem_real_handle_event (DbusmenuMenuitem* base, const char* name, GValue* input_value, guint timestamp); GeeHashSet* title_menuitem_attributes_format (void); diff --git a/src/title-widget.c b/src/title-widget.c index 8037eb7..e9f34d6 100644 --- a/src/title-widget.c +++ b/src/title-widget.c @@ -49,10 +49,6 @@ static void title_widget_finalize (GObject *object); // keyevent consumers static gboolean title_widget_button_press_event (GtkWidget *menuitem, GdkEventButton *event); -static gboolean title_widget_button_release_event (GtkWidget *menuitem, - GdkEventButton *event); -static gboolean title_widget_expose_event(GtkWidget* widget, - GdkEventExpose* event); // Dbusmenuitem properties update callback static void title_widget_property_update(DbusmenuMenuitem* item, gchar* property, @@ -72,8 +68,6 @@ title_widget_class_init (TitleWidgetClass *klass) GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); widget_class->button_press_event = title_widget_button_press_event; - widget_class->button_release_event = title_widget_button_release_event; - widget_class->expose_event = title_widget_expose_event; g_type_class_add_private (klass, sizeof (TitleWidgetPrivate)); @@ -124,24 +118,7 @@ title_widget_button_press_event (GtkWidget *menuitem, g_value_set_boolean(&value, TRUE); dbusmenu_menuitem_handle_event (priv->twin_item, "Title menu event", &value, 0); - return TRUE; -} - -static gboolean -title_widget_button_release_event (GtkWidget *menuitem, - GdkEventButton *event) -{ - g_debug("TitleWidget::menu_release_event"); - return TRUE; -} - -static gboolean -title_widget_expose_event(GtkWidget* widget, GdkEventExpose* event) -{ - TitleWidgetPrivate * priv = TITLE_WIDGET_GET_PRIVATE(widget); - - gtk_container_propagate_expose(GTK_CONTAINER(widget), priv->hbox, event); - return TRUE; + return FALSE; } static void @@ -183,12 +160,12 @@ title_widget_style_name_text(TitleWidget* self) TitleWidgetPrivate * priv = TITLE_WIDGET_GET_PRIVATE(self); char* markup; - markup = g_markup_printf_escaped ("%s", + markup = g_markup_printf_escaped ("%s", gtk_label_get_text(GTK_LABEL(priv->name))); gtk_label_set_markup (GTK_LABEL (priv->name), markup); g_free(markup); } - + /** * transport_new: * @returns: a new #TitleWidget. diff --git a/src/transport-menu-item.c b/src/transport-menu-item.c index 7c6b46b..40051f4 100644 --- a/src/transport-menu-item.c +++ b/src/transport-menu-item.c @@ -1,4 +1,4 @@ -/* transport-menu-item.c generated by valac 0.9.5, the Vala compiler +/* transport-menu-item.c generated by valac 0.9.7, the Vala compiler * generated from transport-menu-item.vala, do not modify */ /* @@ -128,11 +128,11 @@ 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, gint state); +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 mpris_bridge_get_type (void) G_GNUC_CONST; void mpris_bridge_transport_update (MprisBridge* self, TransportMenuitemaction update); -static void transport_menuitem_real_handle_event (DbusmenuMenuitem* base, const char* name, GValue* input_value, guint timestamp); GeeHashSet* transport_menuitem_attributes_format (void); -- cgit v1.2.3 From b347212eb1cb41fb9739a9873b0ff8eb8abb4b77 Mon Sep 17 00:00:00 2001 From: Sebastien Bacher Date: Wed, 8 Sep 2010 12:24:23 +0200 Subject: Import upstream version 0.4.2 --- src/Makefile.am | 10 +- src/Makefile.in | 69 ++-- src/familiar-players-db.c | 46 +-- src/familiar-players-db.vala | 2 +- src/fetch-file.c | 480 +++++++++++++++++++++++++++ src/fetch-file.vala | 86 +++++ src/indicator-sound.c | 31 +- src/metadata-menu-item.c | 367 ++++++++++++++++++++- src/metadata-menu-item.vala | 128 +++++++- src/metadata-widget.c | 48 ++- src/mpris-bridge.c | 246 -------------- src/mpris-bridge.vala | 70 ---- src/mpris-controller.c | 748 ------------------------------------------- src/mpris-controller.vala | 130 -------- src/mpris2-controller.c | 150 ++++----- src/mpris2-controller.vala | 10 +- src/music-player-bridge.c | 95 +++--- src/music-player-bridge.h | 116 +++---- src/music-player-bridge.vala | 40 ++- src/play-button.c | 20 +- src/play-button.h | 4 +- src/player-controller.c | 64 ++-- src/player-controller.vala | 9 +- src/player-item.c | 122 ++++--- src/player-item.vala | 26 +- src/scrub-menu-item.c | 26 +- src/sound-service.c | 3 +- src/title-menu-item.c | 26 +- src/transport-menu-item.c | 26 +- src/transport-widget.c | 25 +- src/volume-widget.c | 4 +- 31 files changed, 1538 insertions(+), 1689 deletions(-) create mode 100644 src/fetch-file.c create mode 100644 src/fetch-file.vala delete mode 100644 src/mpris-bridge.c delete mode 100644 src/mpris-bridge.vala delete mode 100644 src/mpris-controller.c delete mode 100644 src/mpris-controller.vala (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index 74e0297..e85ed93 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -65,11 +65,11 @@ music_bridge_VALASOURCES = \ scrub-menu-item.vala \ title-menu-item.vala \ player-controller.vala \ - mpris-bridge.vala \ - mpris-controller.vala \ mpris2-controller.vala \ player-item.vala \ - familiar-players-db.vala + familiar-players-db.vala \ + fetch-file.vala + music_bridge_VALAFLAGS = \ --ccode \ @@ -83,7 +83,9 @@ music_bridge_VALAFLAGS = \ --pkg Dbusmenu-Glib-0.2 \ --pkg common-defs \ --pkg dbus-glib-1 \ - --pkg gio-unix-2.0 + --pkg gio-unix-2.0 \ + --pkg gdk-pixbuf-2.0 + $(MAINTAINER_VALAFLAGS) diff --git a/src/Makefile.in b/src/Makefile.in index fd23190..3393025 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -39,10 +39,7 @@ 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)/m4/intltool.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -97,11 +94,10 @@ am__objects_1 = indicator_sound_service-music-player-bridge.$(OBJEXT) \ indicator_sound_service-scrub-menu-item.$(OBJEXT) \ indicator_sound_service-title-menu-item.$(OBJEXT) \ indicator_sound_service-player-controller.$(OBJEXT) \ - indicator_sound_service-mpris-bridge.$(OBJEXT) \ - indicator_sound_service-mpris-controller.$(OBJEXT) \ indicator_sound_service-mpris2-controller.$(OBJEXT) \ indicator_sound_service-player-item.$(OBJEXT) \ - indicator_sound_service-familiar-players-db.$(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) \ @@ -345,11 +341,10 @@ music_bridge_VALASOURCES = \ scrub-menu-item.vala \ title-menu-item.vala \ player-controller.vala \ - mpris-bridge.vala \ - mpris-controller.vala \ mpris2-controller.vala \ player-item.vala \ - familiar-players-db.vala + familiar-players-db.vala \ + fetch-file.vala music_bridge_VALAFLAGS = \ --ccode \ @@ -363,7 +358,8 @@ music_bridge_VALAFLAGS = \ --pkg Dbusmenu-Glib-0.2 \ --pkg common-defs \ --pkg dbus-glib-1 \ - --pkg gio-unix-2.0 + --pkg gio-unix-2.0 \ + --pkg gdk-pixbuf-2.0 music_bridge_APIFILES = \ music-player-bridge.h @@ -536,9 +532,8 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_sound_service-dbus-menu-manager.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_sound_service-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-mpris-bridge.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_sound_service-mpris-controller.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@ @@ -814,38 +809,6 @@ indicator_sound_service-player-controller.obj: player-controller.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -c -o indicator_sound_service-player-controller.obj `if test -f 'player-controller.c'; then $(CYGPATH_W) 'player-controller.c'; else $(CYGPATH_W) '$(srcdir)/player-controller.c'; fi` -indicator_sound_service-mpris-bridge.o: mpris-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-mpris-bridge.o -MD -MP -MF $(DEPDIR)/indicator_sound_service-mpris-bridge.Tpo -c -o indicator_sound_service-mpris-bridge.o `test -f 'mpris-bridge.c' || echo '$(srcdir)/'`mpris-bridge.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-mpris-bridge.Tpo $(DEPDIR)/indicator_sound_service-mpris-bridge.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mpris-bridge.c' object='indicator_sound_service-mpris-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-mpris-bridge.o `test -f 'mpris-bridge.c' || echo '$(srcdir)/'`mpris-bridge.c - -indicator_sound_service-mpris-bridge.obj: mpris-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-mpris-bridge.obj -MD -MP -MF $(DEPDIR)/indicator_sound_service-mpris-bridge.Tpo -c -o indicator_sound_service-mpris-bridge.obj `if test -f 'mpris-bridge.c'; then $(CYGPATH_W) 'mpris-bridge.c'; else $(CYGPATH_W) '$(srcdir)/mpris-bridge.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-mpris-bridge.Tpo $(DEPDIR)/indicator_sound_service-mpris-bridge.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mpris-bridge.c' object='indicator_sound_service-mpris-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-mpris-bridge.obj `if test -f 'mpris-bridge.c'; then $(CYGPATH_W) 'mpris-bridge.c'; else $(CYGPATH_W) '$(srcdir)/mpris-bridge.c'; fi` - -indicator_sound_service-mpris-controller.o: mpris-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-mpris-controller.o -MD -MP -MF $(DEPDIR)/indicator_sound_service-mpris-controller.Tpo -c -o indicator_sound_service-mpris-controller.o `test -f 'mpris-controller.c' || echo '$(srcdir)/'`mpris-controller.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-mpris-controller.Tpo $(DEPDIR)/indicator_sound_service-mpris-controller.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mpris-controller.c' object='indicator_sound_service-mpris-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-mpris-controller.o `test -f 'mpris-controller.c' || echo '$(srcdir)/'`mpris-controller.c - -indicator_sound_service-mpris-controller.obj: mpris-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-mpris-controller.obj -MD -MP -MF $(DEPDIR)/indicator_sound_service-mpris-controller.Tpo -c -o indicator_sound_service-mpris-controller.obj `if test -f 'mpris-controller.c'; then $(CYGPATH_W) 'mpris-controller.c'; else $(CYGPATH_W) '$(srcdir)/mpris-controller.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-mpris-controller.Tpo $(DEPDIR)/indicator_sound_service-mpris-controller.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mpris-controller.c' object='indicator_sound_service-mpris-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-mpris-controller.obj `if test -f 'mpris-controller.c'; then $(CYGPATH_W) 'mpris-controller.c'; else $(CYGPATH_W) '$(srcdir)/mpris-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 @@ -894,6 +857,22 @@ indicator_sound_service-familiar-players-db.obj: familiar-players-db.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -c -o indicator_sound_service-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 diff --git a/src/familiar-players-db.c b/src/familiar-players-db.c index ec0c16f..6371823 100644 --- a/src/familiar-players-db.c +++ b/src/familiar-players-db.c @@ -1,4 +1,4 @@ -/* familiar-players-db.c generated by valac 0.9.7, the Vala compiler +/* familiar-players-db.c generated by valac 0.9.8, the Vala compiler * generated from familiar-players-db.vala, do not modify */ /* @@ -140,10 +140,10 @@ static gboolean familiar_players_db_create_key_file (FamiliarPlayersDB* self) { _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 __catch9_g_key_file_error; + goto __catch11_g_key_file_error; } if (_inner_error_->domain == G_FILE_ERROR) { - goto __catch9_g_file_error; + goto __catch11_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_); @@ -151,8 +151,8 @@ static gboolean familiar_players_db_create_key_file (FamiliarPlayersDB* self) { } _result_ = _tmp1_; } - goto __finally9; - __catch9_g_key_file_error: + goto __finally11; + __catch11_g_key_file_error: { GError * e; e = _inner_error_; @@ -163,8 +163,8 @@ static gboolean familiar_players_db_create_key_file (FamiliarPlayersDB* self) { _g_error_free0 (e); } } - goto __finally9; - __catch9_g_file_error: + goto __finally11; + __catch11_g_file_error: { GError * e; e = _inner_error_; @@ -175,7 +175,7 @@ static gboolean familiar_players_db_create_key_file (FamiliarPlayersDB* self) { _g_error_free0 (e); } } - __finally9: + __finally11: if (_inner_error_ != NULL) { g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); g_clear_error (&_inner_error_); @@ -196,7 +196,7 @@ static gboolean familiar_players_db_check_for_keys (FamiliarPlayersDB* self) { _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 __catch10_g_key_file_error; + goto __catch12_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_); @@ -207,8 +207,8 @@ static gboolean familiar_players_db_check_for_keys (FamiliarPlayersDB* self) { return result; } } - goto __finally10; - __catch10_g_key_file_error: + goto __finally12; + __catch12_g_key_file_error: { GError * e; e = _inner_error_; @@ -219,7 +219,7 @@ static gboolean familiar_players_db_check_for_keys (FamiliarPlayersDB* self) { return result; } } - __finally10: + __finally12: if (_inner_error_ != NULL) { g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); g_clear_error (&_inner_error_); @@ -245,7 +245,7 @@ static gboolean familiar_players_db_load_data_from_key_file (FamiliarPlayersDB* 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 __catch11_g_key_file_error; + goto __catch13_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_); @@ -270,8 +270,8 @@ static gboolean familiar_players_db_load_data_from_key_file (FamiliarPlayersDB* desktops = (_vala_array_free (desktops, desktops_length1, (GDestroyNotify) g_free), NULL); return result; } - goto __finally11; - __catch11_g_key_file_error: + goto __finally13; + __catch13_g_key_file_error: { GError * _error_; _error_ = _inner_error_; @@ -283,7 +283,7 @@ static gboolean familiar_players_db_load_data_from_key_file (FamiliarPlayersDB* return result; } } - __finally11: + __finally13: { 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_); @@ -338,8 +338,8 @@ static gboolean familiar_players_db_write_db (FamiliarPlayersDB* self) { char* _tmp4_; data = (_tmp4_ = g_key_file_to_data (keyfile, &data_length, NULL), _g_free0 (data), _tmp4_); } - goto __finally12; - __catch12_g_key_file_error: + goto __finally14; + __catch14_g_key_file_error: { GError * e; e = _inner_error_; @@ -354,7 +354,7 @@ static gboolean familiar_players_db_write_db (FamiliarPlayersDB* self) { return result; } } - __finally12: + __finally14: if (_inner_error_ != NULL) { _g_free0 (data); desktops = (_vala_array_free (desktops, desktops_length1, (GDestroyNotify) g_free), NULL); @@ -376,7 +376,7 @@ static gboolean familiar_players_db_write_db (FamiliarPlayersDB* self) { _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 __catch13_g_file_error; + goto __catch15_g_file_error; } _g_free0 (data); desktops = (_vala_array_free (desktops, desktops_length1, (GDestroyNotify) g_free), NULL); @@ -389,8 +389,8 @@ static gboolean familiar_players_db_write_db (FamiliarPlayersDB* self) { g_warning ("familiar-players-db.vala:125: Unable to write out file '%s'", self->priv->file_name); } } - goto __finally13; - __catch13_g_file_error: + goto __finally15; + __catch15_g_file_error: { GError * err; err = _inner_error_; @@ -400,7 +400,7 @@ static gboolean familiar_players_db_write_db (FamiliarPlayersDB* self) { _g_error_free0 (err); } } - __finally13: + __finally15: if (_inner_error_ != NULL) { _g_free0 (data); desktops = (_vala_array_free (desktops, desktops_length1, (GDestroyNotify) g_free), NULL); diff --git a/src/familiar-players-db.vala b/src/familiar-players-db.vala index 2bc0a3c..894447c 100644 --- a/src/familiar-players-db.vala +++ b/src/familiar-players-db.vala @@ -83,7 +83,7 @@ public class FamiliarPlayersDB : GLib.Object private bool load_data_from_key_file(){ try{ string[] desktops = this.key_file.get_string_list(GROUP_NAME, - KEY_NAME); + KEY_NAME); foreach(string s in desktops){ this.players_DB.set(s, true); } diff --git a/src/fetch-file.c b/src/fetch-file.c new file mode 100644 index 0000000..76e987d --- /dev/null +++ b/src/fetch-file.c @@ -0,0 +1,480 @@ +/* fetch-file.c generated by valac 0.9.8, 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 + * . + * + * Authors + * Gordon Allott + * Conor Curran + */ + +#include +#include +#include +#include +#include + + +#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 __catch16_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 __finally16; + __catch16_g_error: + { + data->e = data->_inner_error_; + data->_inner_error_ = NULL; + { + g_signal_emit_by_name (data->self, "failed"); + _g_error_free0 (data->e); + } + } + __finally16: + 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 __catch17_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 __finally17; + __catch17_g_error: + { + data->e = data->_inner_error_; + data->_inner_error_ = NULL; + { + g_signal_emit_by_name (data->self, "failed"); + _g_error_free0 (data->e); + } + } + __finally17: + 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/fetch-file.vala b/src/fetch-file.vala new file mode 100644 index 0000000..1811cc1 --- /dev/null +++ b/src/fetch-file.vala @@ -0,0 +1,86 @@ +/* + * 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 + * . + * + * Authors + * Gordon Allott + * Conor Curran + */ + +public class FetchFile : Object +{ + /* public variables */ + public string uri {get; construct;} + public string intended_property {get; construct;} + + /* private variables */ + private DataInputStream stream; + private File? file; + private ByteArray data; + + /* public signals */ + public signal void failed (); + public signal void completed (ByteArray data, string property); + + public FetchFile (string uri, string prop) + { + Object (uri: uri, intended_property: prop); + } + + construct + { + this.file = File.new_for_uri(this.uri); + this.data = new ByteArray (); + } + + public async void fetch_data () + { + try { + this.stream = new DataInputStream(this.file.read(null)); + this.stream.set_byte_order (DataStreamByteOrder.LITTLE_ENDIAN); + } catch (GLib.Error e) { + this.failed (); + } + this.read_something_async (); + } + + private async void read_something_async () + { + ssize_t size = 1024; + uint8[] buffer = new uint8[size]; + + ssize_t bufsize = 1; + do { + try { + bufsize = yield this.stream.read_async (buffer, size, GLib.Priority.DEFAULT, null); + if (bufsize < 1) { break;} + + if (bufsize != size) + { + uint8[] cpybuf = new uint8[bufsize]; + Memory.copy (cpybuf, buffer, bufsize); + this.data.append (cpybuf); + } + else + { + this.data.append (buffer); + } + } catch (Error e) { + this.failed (); + } + } while (bufsize > 0); + this.completed (this.data, this.intended_property); + } +} diff --git a/src/indicator-sound.c b/src/indicator-sound.c index 63ad72d..b59eb98 100644 --- a/src/indicator-sound.c +++ b/src/indicator-sound.c @@ -67,6 +67,8 @@ G_DEFINE_TYPE (IndicatorSound, indicator_sound, INDICATOR_OBJECT_TYPE); static GtkLabel * get_label (IndicatorObject * io); static GtkImage * get_icon (IndicatorObject * io); static GtkMenu * get_menu (IndicatorObject * io); +static void indicator_sound_scroll (IndicatorObject* io, gint delta, IndicatorScrollDirection direction); + //Slider related static gboolean new_volume_slider_widget(DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client); @@ -135,7 +137,7 @@ indicator_sound_class_init (IndicatorSoundClass *klass) io_class->get_label = get_label; io_class->get_image = get_icon; io_class->get_menu = get_menu; - + io_class->scroll = indicator_sound_scroll; design_team_size = gtk_icon_size_register("design-team-size", 22, 22); return; @@ -493,7 +495,6 @@ start_animation() { blocked_iter = blocked_animation_list; blocked_id = 0; - //g_debug("exit from blocked hold start the animation\n"); animation_id = g_timeout_add(50, fade_back_to_mute_image, NULL); return FALSE; } @@ -502,7 +503,6 @@ static gboolean fade_back_to_mute_image() { if (blocked_iter != NULL) { - g_debug("in animation 'loop'\n"); gtk_image_set_from_pixbuf(speaker_image, blocked_iter->data); blocked_iter = blocked_iter->next; return TRUE; @@ -710,3 +710,28 @@ style_changed_cb(GtkWidget *widget, gpointer user_data) free_the_animation_list(); prepare_blocked_animation(); } + +static void +indicator_sound_scroll (IndicatorObject *io, gint delta, IndicatorScrollDirection direction) +{ + g_debug("indicator-sound-scroll - current slider value"); + + if (device_available == FALSE || current_state == STATE_MUTED) + return; + + IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(INDICATOR_SOUND (io)); + + GtkWidget* slider_widget = volume_widget_get_ido_slider(VOLUME_WIDGET(priv->volume_widget)); + GtkWidget* slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)slider_widget); + GtkRange* range = (GtkRange*)slider; + gdouble value = gtk_range_get_value(range); + GtkAdjustment *adj = gtk_range_get_adjustment (GTK_RANGE (slider)); + g_debug("indicator-sound-scroll - current slider value %f", value); + if (direction == INDICATOR_OBJECT_SCROLL_UP) { + value += adj->step_increment; + } else { + value -= adj->step_increment; + } + g_debug("indicator-sound-scroll - update slider with value %f", value); + volume_widget_update(VOLUME_WIDGET(priv->volume_widget), value); +} \ No newline at end of file diff --git a/src/metadata-menu-item.c b/src/metadata-menu-item.c index 311057e..07f18e5 100644 --- a/src/metadata-menu-item.c +++ b/src/metadata-menu-item.c @@ -1,4 +1,4 @@ -/* metadata-menu-item.c generated by valac 0.9.7, the Vala compiler +/* metadata-menu-item.c generated by valac 0.9.8, the Vala compiler * generated from metadata-menu-item.vala, do not modify */ /* @@ -26,10 +26,13 @@ with this program. If not, see . #include #include #include -#include -#include #include #include +#include +#include +#include +#include +#include #define TYPE_PLAYER_ITEM (player_item_get_type ()) @@ -53,7 +56,19 @@ typedef struct _PlayerItemPrivate PlayerItemPrivate; 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; @@ -73,18 +88,44 @@ 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); @@ -103,6 +144,296 @@ MetadataMenuitem* metadata_menuitem_new (void) { } +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; @@ -116,12 +447,42 @@ GeeHashSet* metadata_menuitem_attributes_format (void) { } +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); } diff --git a/src/metadata-menu-item.vala b/src/metadata-menu-item.vala index 0bb4a85..3f71653 100644 --- a/src/metadata-menu-item.vala +++ b/src/metadata-menu-item.vala @@ -17,18 +17,141 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -using Dbusmenu; using Gee; using DbusmenuMetadata; +using Gdk; public class MetadataMenuitem : PlayerItem { + public const string ALBUM_ART_DIR_SUFFIX = "indicators/sound/album-art-cache"; + + public static string album_art_cache_dir; + private static FetchFile fetcher; + private string previous_temp_album_art_path; + public MetadataMenuitem() { Object(item_type: MENUITEM_TYPE); reset(attributes_format()); } + + construct{ + MetadataMenuitem.clean_album_art_temp_dir(); + this.previous_temp_album_art_path = null; + this.album_art_cache_dir = MetadataMenuitem.create_album_art_temp_dir(); + } + private static void clean_album_art_temp_dir() + { + string path = GLib.Path.build_filename(Environment.get_user_cache_dir(), ALBUM_ART_DIR_SUFFIX); + + GLib.File? album_art_dir = GLib.File.new_for_path(path); + + if(delete_album_art_contents(album_art_dir) == false) + { + warning("could not remove the temp album art files %s", path); + } + } + + private static string? create_album_art_temp_dir() + { + string path = GLib.Path.build_filename(Environment.get_user_cache_dir(), ALBUM_ART_DIR_SUFFIX); + if(DirUtils.create(path, 0700) == -1){ + warning("could not create a temp dir for remote album art, it must have been created already"); + } + return path; + } + + private static bool delete_album_art_contents (GLib.File dir) + { + bool result = true; + try { + var e = dir.enumerate_children (FILE_ATTRIBUTE_STANDARD_NAME, + FileQueryInfoFlags.NOFOLLOW_SYMLINKS, + null); + while (true) + { + var file = e.next_file (null); + + debug("file name = %s", file.get_name()); + + if (file == null) + break; + + var child = dir.get_child (file.get_name ()); + + try { + child.delete (null); + } catch (Error error_) { + warning (@"Unable to delete file '$(child.get_basename ()): $(error_.message)"); + result = false; + } + } + } catch (Error error) { + warning (@"Unable to read files from directory '$(dir.get_basename ())': %s", + error.message); + result = false; + } + return result; + } + + public void fetch_art(string uri, string prop) + { + File art_file = File.new_for_uri(uri); + if(art_file.is_native() == true){ + string path; + try{ + path = Filename.from_uri(uri.strip()); + this.property_set(prop, path); + } + catch(ConvertError e){ + warning("Problem converting URI %s to file path", + uri); + } + // eitherway return, the artwork was local + return; + } + debug("fetch_art -remotely %s", this.album_art_cache_dir); + // If we didn't manage to create the temp dir + // don't bother with remote + if(this.album_art_cache_dir == null){ + return; + } + // green light to go remote + this.fetcher = new FetchFile (uri, prop); + this.fetcher.failed.connect (() => { this.on_fetcher_failed ();}); + this.fetcher.completed.connect (this.on_fetcher_completed); + this.fetcher.fetch_data (); + } + + private void on_fetcher_failed () + { + warning("on_fetcher_failed -> could not fetch artwork"); + } + + private void on_fetcher_completed(ByteArray update, string property) + { + try{ + PixbufLoader loader = new PixbufLoader (); + loader.write (update.data, update.len); + loader.close (); + Pixbuf icon = loader.get_pixbuf (); + string path = this.album_art_cache_dir.concat("/downloaded-coverart-XXXXXX"); + int r = FileUtils.mkstemp(path); + if(r != -1){ + icon.save (path, loader.get_format().get_name()); + this.property_set(property, path); + if(this.previous_temp_album_art_path != null){ + FileUtils.remove(this.previous_temp_album_art_path); + } + this.previous_temp_album_art_path = path; + } + } + catch(GLib.Error e){ + warning("Problem creating file from bytearray fetched from the interweb - error: %s", + e.message); + } + } public static HashSet attributes_format() { @@ -38,6 +161,5 @@ public class MetadataMenuitem : PlayerItem attrs.add(MENUITEM_ALBUM); attrs.add(MENUITEM_ARTURL); return attrs; - } - + } } diff --git a/src/metadata-widget.c b/src/metadata-widget.c index f600238..18ebd38 100644 --- a/src/metadata-widget.c +++ b/src/metadata-widget.c @@ -25,6 +25,7 @@ with this program. If not, see . #include "metadata-widget.h" #include "common-defs.h" #include +#include static DbusmenuMenuitem* twin_item; @@ -69,7 +70,7 @@ static void image_set_from_pixbuf (GtkWidget *widget, MetadataWidget* metadata, GdkPixbuf *source); - +static void draw_album_art_placeholder(GtkWidget *metadata); G_DEFINE_TYPE (MetadataWidget, metadata_widget, GTK_TYPE_MENU_ITEM); @@ -160,7 +161,7 @@ metadata_widget_init (MetadataWidget *self) g_signal_connect(self, "style-set", G_CALLBACK(metadata_widget_set_style), GTK_WIDGET(self)); - gtk_widget_set_size_request(GTK_WIDGET(self), 200, 60); + gtk_widget_set_size_request(GTK_WIDGET(self), 200, 65); gtk_container_add (GTK_CONTAINER (self), hbox); } @@ -178,7 +179,7 @@ metadata_widget_finalize (GObject *object) /** * We override the expose method to enable primitive drawing of the - * empty album art image (and soon rounded rectangles on the album art) + * empty album art image and rounded rectangles on the album art. */ static gboolean metadata_image_expose (GtkWidget *metadata, GdkEventExpose *event, gpointer user_data) @@ -186,24 +187,33 @@ metadata_image_expose (GtkWidget *metadata, GdkEventExpose *event, gpointer user g_return_val_if_fail(IS_METADATA_WIDGET(user_data), FALSE); MetadataWidget* widget = METADATA_WIDGET(user_data); MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(widget); - if(priv->image_path->len > 0){ - - if(g_string_equal(priv->image_path, priv->old_image_path) == FALSE){ + if(g_string_equal(priv->image_path, priv->old_image_path) == FALSE){ GdkPixbuf* pixbuf; pixbuf = gdk_pixbuf_new_from_file(priv->image_path->str, NULL); - g_debug("metadata_widget_expose, album art update -> pixbuf from %s", - priv->image_path->str); + g_debug("metadata_load_new_image -> pixbuf from %s", + priv->image_path->str); + if(GDK_IS_PIXBUF(pixbuf) == FALSE){ + g_debug("problem loading the downloaded image just use the placeholder instead"); + draw_album_art_placeholder(metadata); + return TRUE; + } pixbuf = gdk_pixbuf_scale_simple(pixbuf,60, 60, GDK_INTERP_BILINEAR); image_set_from_pixbuf (metadata, widget, pixbuf); g_string_erase(priv->old_image_path, 0, -1); g_string_overwrite(priv->old_image_path, 0, priv->image_path->str); - g_object_unref(pixbuf); + g_object_unref(pixbuf); } return FALSE; } - + draw_album_art_placeholder(metadata); + return TRUE; +} + +static void draw_album_art_placeholder(GtkWidget *metadata) +{ + cairo_t *cr; cr = gdk_cairo_create (metadata->window); GtkAllocation alloc; @@ -255,8 +265,7 @@ metadata_image_expose (GtkWidget *metadata, GdkEventExpose *event, gpointer user g_object_unref(pcontext); g_string_free (string, TRUE); cairo_destroy (cr); - - return TRUE; + } /* Suppress/consume keyevents */ @@ -314,7 +323,12 @@ metadata_widget_property_update(DbusmenuMenuitem* item, gchar* property, } else if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_ARTURL, property) == 0){ g_string_erase(priv->image_path, 0, -1); - g_string_overwrite(priv->image_path, 0, g_value_get_string (value)); + g_string_overwrite(priv->image_path, 0, g_value_get_string (value)); + // if its a remote image queue a redraw incase the download took too long + if (g_str_has_prefix(g_value_get_string (value), g_get_user_cache_dir())){ + g_debug("the image update is a download so redraw"); + gtk_widget_queue_draw(GTK_WIDGET(mitem)); + } } } @@ -348,10 +362,9 @@ rounded_rectangle (cairo_t *cr, { gdouble radius; gdouble degrees; - + radius = corner_radius / aspect; degrees = G_PI / 180.0; - cairo_new_sub_path (cr); cairo_arc (cr, x + width - radius, @@ -377,6 +390,7 @@ rounded_rectangle (cairo_t *cr, radius, 180 * degrees, 270 * degrees); + cairo_close_path (cr); } @@ -401,12 +415,12 @@ image_set_from_pixbuf (GtkWidget *widget, MetadataWidgetPrivate* priv = METADATA_WIDGET_GET_PRIVATE(metadata); GtkImage* image = GTK_IMAGE(priv->album_art); - frame_width = 5; + frame_width = 3; w = gdk_pixbuf_get_width (source) + frame_width * 2; h = gdk_pixbuf_get_height (source) + frame_width * 2; - radius = w / 10; + radius = 10; pixmap = gdk_pixmap_new (gtk_widget_get_window (widget), w, h, -1); bitmask = gdk_pixmap_new (gtk_widget_get_window (widget), w, h, 1); diff --git a/src/mpris-bridge.c b/src/mpris-bridge.c deleted file mode 100644 index d85ec3d..0000000 --- a/src/mpris-bridge.c +++ /dev/null @@ -1,246 +0,0 @@ -/* mpris-bridge.c generated by valac 0.9.7, the Vala compiler - * generated from mpris-bridge.vala, do not modify */ - - -#include -#include -#include -#include -#include -#include - - -#define TYPE_MPRIS_BRIDGE (mpris_bridge_get_type ()) -#define MPRIS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_BRIDGE, MprisBridge)) -#define MPRIS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS_BRIDGE, MprisBridgeClass)) -#define IS_MPRIS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_BRIDGE)) -#define IS_MPRIS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS_BRIDGE)) -#define MPRIS_BRIDGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS_BRIDGE, MprisBridgeClass)) - -typedef struct _MprisBridge MprisBridge; -typedef struct _MprisBridgeClass MprisBridgeClass; -typedef struct _MprisBridgePrivate MprisBridgePrivate; - -#define TYPE_MPRIS_CONTROLLER (mpris_controller_get_type ()) -#define MPRIS_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_CONTROLLER, MprisController)) -#define MPRIS_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS_CONTROLLER, MprisControllerClass)) -#define IS_MPRIS_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_CONTROLLER)) -#define IS_MPRIS_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS_CONTROLLER)) -#define MPRIS_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS_CONTROLLER, MprisControllerClass)) - -typedef struct _MprisController MprisController; -typedef struct _MprisControllerClass MprisControllerClass; - -#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 MPRIS_BRIDGE_TYPE_MODE (mpris_bridge_mode_get_type ()) -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) - -#define TYPE_PLAYER_CONTROLLER (player_controller_get_type ()) -#define PLAYER_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYER_CONTROLLER, PlayerController)) -#define PLAYER_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYER_CONTROLLER, PlayerControllerClass)) -#define IS_PLAYER_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYER_CONTROLLER)) -#define IS_PLAYER_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYER_CONTROLLER)) -#define PLAYER_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYER_CONTROLLER, PlayerControllerClass)) - -typedef struct _PlayerController PlayerController; -typedef struct _PlayerControllerClass PlayerControllerClass; - -#define TRANSPORT_MENUITEM_TYPE_ACTION (transport_menuitem_action_get_type ()) - -struct _MprisBridge { - GObject parent_instance; - MprisBridgePrivate * priv; -}; - -struct _MprisBridgeClass { - GObjectClass parent_class; -}; - -typedef enum { - MPRIS_BRIDGE_MODE_MPRIS_1, - MPRIS_BRIDGE_MODE_MPRIS_2 -} MprisBridgemode; - -struct _MprisBridgePrivate { - MprisController* mpris1_controller; - Mpris2Controller* mpris2_controller; - MprisBridgemode mode_in_use; -}; - -typedef enum { - TRANSPORT_MENUITEM_ACTION_PREVIOUS, - TRANSPORT_MENUITEM_ACTION_PLAY_PAUSE, - TRANSPORT_MENUITEM_ACTION_NEXT -} TransportMenuitemaction; - - -static gpointer mpris_bridge_parent_class = NULL; - -GType mpris_bridge_get_type (void) G_GNUC_CONST; -GType mpris_controller_get_type (void) G_GNUC_CONST; -GType mpris2_controller_get_type (void) G_GNUC_CONST; -static GType mpris_bridge_mode_get_type (void) G_GNUC_UNUSED; -#define MPRIS_BRIDGE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_MPRIS_BRIDGE, MprisBridgePrivate)) -enum { - MPRIS_BRIDGE_DUMMY_PROPERTY -}; -GType player_controller_get_type (void) G_GNUC_CONST; -MprisBridge* mpris_bridge_new (PlayerController* ctrl); -MprisBridge* mpris_bridge_construct (GType object_type, PlayerController* ctrl); -Mpris2Controller* mpris2_controller_new (PlayerController* ctrl); -Mpris2Controller* mpris2_controller_construct (GType object_type, PlayerController* ctrl); -gboolean mpris2_controller_was_successfull (Mpris2Controller* self); -void mpris2_controller_initial_update (Mpris2Controller* self); -MprisController* mpris_controller_new (PlayerController* ctrl, const char* inter); -MprisController* mpris_controller_construct (GType object_type, PlayerController* ctrl, const char* inter); -gboolean mpris_bridge_connected (MprisBridge* self); -gboolean mpris_controller_connected (MprisController* self); -gboolean mpris2_controller_connected (Mpris2Controller* self); -GType transport_menuitem_action_get_type (void) G_GNUC_CONST; -void mpris_bridge_transport_update (MprisBridge* self, TransportMenuitemaction update); -void mpris_controller_transport_event (MprisController* self, TransportMenuitemaction command); -void mpris2_controller_transport_event (Mpris2Controller* self, TransportMenuitemaction command); -void mpris_bridge_expose (MprisBridge* self); -void mpris2_controller_expose (Mpris2Controller* self); -void mpris_bridge_set_track_position (MprisBridge* self, double pos); -void mpris_controller_set_position (MprisController* self, double position); -void mpris2_controller_set_position (Mpris2Controller* self, double position); -static void mpris_bridge_finalize (GObject* obj); - - - -static GType mpris_bridge_mode_get_type (void) { - static volatile gsize mpris_bridge_mode_type_id__volatile = 0; - if (g_once_init_enter (&mpris_bridge_mode_type_id__volatile)) { - static const GEnumValue values[] = {{MPRIS_BRIDGE_MODE_MPRIS_1, "MPRIS_BRIDGE_MODE_MPRIS_1", "mpris-1"}, {MPRIS_BRIDGE_MODE_MPRIS_2, "MPRIS_BRIDGE_MODE_MPRIS_2", "mpris-2"}, {0, NULL, NULL}}; - GType mpris_bridge_mode_type_id; - mpris_bridge_mode_type_id = g_enum_register_static ("MprisBridgemode", values); - g_once_init_leave (&mpris_bridge_mode_type_id__volatile, mpris_bridge_mode_type_id); - } - return mpris_bridge_mode_type_id__volatile; -} - - -MprisBridge* mpris_bridge_construct (GType object_type, PlayerController* ctrl) { - MprisBridge * self; - Mpris2Controller* _tmp0_; - g_return_val_if_fail (ctrl != NULL, NULL); - self = (MprisBridge*) g_object_new (object_type, NULL); - self->priv->mpris2_controller = (_tmp0_ = mpris2_controller_new (ctrl), _g_object_unref0 (self->priv->mpris2_controller), _tmp0_); - if (mpris2_controller_was_successfull (self->priv->mpris2_controller) == TRUE) { - MprisController* _tmp1_; - self->priv->mode_in_use = MPRIS_BRIDGE_MODE_MPRIS_2; - self->priv->mpris1_controller = (_tmp1_ = NULL, _g_object_unref0 (self->priv->mpris1_controller), _tmp1_); - mpris2_controller_initial_update (self->priv->mpris2_controller); - } else { - Mpris2Controller* _tmp2_; - MprisController* _tmp3_; - self->priv->mpris2_controller = (_tmp2_ = NULL, _g_object_unref0 (self->priv->mpris2_controller), _tmp2_); - self->priv->mode_in_use = MPRIS_BRIDGE_MODE_MPRIS_1; - self->priv->mpris1_controller = (_tmp3_ = mpris_controller_new (ctrl, "org.freedesktop.MediaPlayer"), _g_object_unref0 (self->priv->mpris1_controller), _tmp3_); - } - return self; -} - - -MprisBridge* mpris_bridge_new (PlayerController* ctrl) { - return mpris_bridge_construct (TYPE_MPRIS_BRIDGE, ctrl); -} - - -gboolean mpris_bridge_connected (MprisBridge* self) { - gboolean result = FALSE; - g_return_val_if_fail (self != NULL, FALSE); - if (self->priv->mode_in_use == MPRIS_BRIDGE_MODE_MPRIS_1) { - result = mpris_controller_connected (self->priv->mpris1_controller); - return result; - } else { - if (self->priv->mode_in_use == MPRIS_BRIDGE_MODE_MPRIS_2) { - result = mpris2_controller_connected (self->priv->mpris2_controller); - return result; - } - } - result = FALSE; - return result; -} - - -void mpris_bridge_transport_update (MprisBridge* self, TransportMenuitemaction update) { - g_return_if_fail (self != NULL); - if (self->priv->mode_in_use == MPRIS_BRIDGE_MODE_MPRIS_1) { - mpris_controller_transport_event (self->priv->mpris1_controller, update); - } else { - if (self->priv->mode_in_use == MPRIS_BRIDGE_MODE_MPRIS_2) { - mpris2_controller_transport_event (self->priv->mpris2_controller, update); - } - } -} - - -void mpris_bridge_expose (MprisBridge* self) { - g_return_if_fail (self != NULL); - if (self->priv->mode_in_use == MPRIS_BRIDGE_MODE_MPRIS_2) { - mpris2_controller_expose (self->priv->mpris2_controller); - } else { - g_warning ("mpris-bridge.vala:56: MPRIS1 clients don't have the ability to raise/e" \ -"xpose the client"); - } -} - - -void mpris_bridge_set_track_position (MprisBridge* self, double pos) { - g_return_if_fail (self != NULL); - if (self->priv->mode_in_use == MPRIS_BRIDGE_MODE_MPRIS_1) { - mpris_controller_set_position (self->priv->mpris1_controller, pos); - } else { - if (self->priv->mode_in_use == MPRIS_BRIDGE_MODE_MPRIS_2) { - mpris2_controller_set_position (self->priv->mpris2_controller, pos); - } - } -} - - -static void mpris_bridge_class_init (MprisBridgeClass * klass) { - mpris_bridge_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (MprisBridgePrivate)); - G_OBJECT_CLASS (klass)->finalize = mpris_bridge_finalize; -} - - -static void mpris_bridge_instance_init (MprisBridge * self) { - self->priv = MPRIS_BRIDGE_GET_PRIVATE (self); -} - - -static void mpris_bridge_finalize (GObject* obj) { - MprisBridge * self; - self = MPRIS_BRIDGE (obj); - _g_object_unref0 (self->priv->mpris1_controller); - _g_object_unref0 (self->priv->mpris2_controller); - G_OBJECT_CLASS (mpris_bridge_parent_class)->finalize (obj); -} - - -GType mpris_bridge_get_type (void) { - static volatile gsize mpris_bridge_type_id__volatile = 0; - if (g_once_init_enter (&mpris_bridge_type_id__volatile)) { - static const GTypeInfo g_define_type_info = { sizeof (MprisBridgeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) mpris_bridge_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MprisBridge), 0, (GInstanceInitFunc) mpris_bridge_instance_init, NULL }; - GType mpris_bridge_type_id; - mpris_bridge_type_id = g_type_register_static (G_TYPE_OBJECT, "MprisBridge", &g_define_type_info, 0); - g_once_init_leave (&mpris_bridge_type_id__volatile, mpris_bridge_type_id); - } - return mpris_bridge_type_id__volatile; -} - - - - diff --git a/src/mpris-bridge.vala b/src/mpris-bridge.vala deleted file mode 100644 index bd9d472..0000000 --- a/src/mpris-bridge.vala +++ /dev/null @@ -1,70 +0,0 @@ -public class MprisBridge : GLib.Object -{ - private MprisController mpris1_controller; - private Mpris2Controller mpris2_controller; - private enum mode{ - MPRIS_1, - MPRIS_2 - } - private mode mode_in_use; - - public MprisBridge(PlayerController ctrl) - { - this.mpris2_controller = new Mpris2Controller(ctrl); - if(this.mpris2_controller.was_successfull() == true){ - this.mode_in_use = mode.MPRIS_2; - this.mpris1_controller = null; - this.mpris2_controller.initial_update(); - } - else{ - this.mpris2_controller = null; - this.mode_in_use = mode.MPRIS_1; - this.mpris1_controller = new MprisController(ctrl); - } - } - - // The handling of both mpris controllers can be abstracted further - // once the mpris2 is implemented. This will allow for one instance - // variable to point at the active controller. For now handle both ... - public bool connected() - { - if(this.mode_in_use == mode.MPRIS_1){ - return this.mpris1_controller.connected(); - } - else if(this.mode_in_use == mode.MPRIS_2){ - return this.mpris2_controller.connected(); - } - return false; - } - - public void transport_update(TransportMenuitem.action update) - { - if(this.mode_in_use == mode.MPRIS_1){ - this.mpris1_controller.transport_event(update); - } - else if(this.mode_in_use == mode.MPRIS_2){ - this.mpris2_controller.transport_event(update); - } - } - - public void expose() - { - if(this.mode_in_use == mode.MPRIS_2){ - this.mpris2_controller.expose(); - } - else{ - warning("MPRIS1 clients don't have the ability to raise/expose the client"); - } - } - - - public void set_track_position(double pos) - { - if(this.mode_in_use == mode.MPRIS_1){ - this.mpris1_controller.set_position(pos); - } - else if(this.mode_in_use == mode.MPRIS_2){ - this.mpris2_controller.set_position(pos); - } - } -} \ No newline at end of file diff --git a/src/mpris-controller.c b/src/mpris-controller.c deleted file mode 100644 index 98151e0..0000000 --- a/src/mpris-controller.c +++ /dev/null @@ -1,748 +0,0 @@ -/* mpris-controller.c generated by valac 0.9.7, the Vala compiler - * generated from mpris-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 - -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 . -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#define TYPE_MPRIS_CONTROLLER (mpris_controller_get_type ()) -#define MPRIS_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_CONTROLLER, MprisController)) -#define MPRIS_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS_CONTROLLER, MprisControllerClass)) -#define IS_MPRIS_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_CONTROLLER)) -#define IS_MPRIS_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS_CONTROLLER)) -#define MPRIS_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS_CONTROLLER, MprisControllerClass)) - -typedef struct _MprisController MprisController; -typedef struct _MprisControllerClass MprisControllerClass; -typedef struct _MprisControllerPrivate MprisControllerPrivate; - -#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 _dbus_g_connection_unref0(var) ((var == NULL) ? NULL : (var = (dbus_g_connection_unref (var), NULL))) -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _g_free0(var) (var = (g_free (var), NULL)) - -#define MPRIS_CONTROLLER_TYPE_STATUS (mpris_controller_status_get_type ()) -typedef struct _MprisControllerstatus MprisControllerstatus; -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_MPRIS_BRIDGE (mpris_bridge_get_type ()) -#define MPRIS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_BRIDGE, MprisBridge)) -#define MPRIS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS_BRIDGE, MprisBridgeClass)) -#define IS_MPRIS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_BRIDGE)) -#define IS_MPRIS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS_BRIDGE)) -#define MPRIS_BRIDGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS_BRIDGE, MprisBridgeClass)) - -typedef struct _MprisBridge MprisBridge; -typedef struct _MprisBridgeClass MprisBridgeClass; - -#define PLAYER_CONTROLLER_TYPE_WIDGET_ORDER (player_controller_widget_order_get_type ()) - -#define TYPE_TRANSPORT_MENUITEM (transport_menuitem_get_type ()) -#define TRANSPORT_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TRANSPORT_MENUITEM, TransportMenuitem)) -#define TRANSPORT_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TRANSPORT_MENUITEM, TransportMenuitemClass)) -#define IS_TRANSPORT_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TRANSPORT_MENUITEM)) -#define IS_TRANSPORT_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TRANSPORT_MENUITEM)) -#define TRANSPORT_MENUITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TRANSPORT_MENUITEM, TransportMenuitemClass)) - -typedef struct _TransportMenuitem TransportMenuitem; -typedef struct _TransportMenuitemClass TransportMenuitemClass; -#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL))) - -#define TRANSPORT_MENUITEM_TYPE_ACTION (transport_menuitem_action_get_type ()) -#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) - -struct _MprisController { - GObject parent_instance; - MprisControllerPrivate * priv; -}; - -struct _MprisControllerClass { - GObjectClass parent_class; -}; - -struct _MprisControllerPrivate { - DBusGConnection* connection; - DBusGProxy* _mpris_player; - PlayerController* _owner; - char* _mpris_interface; -}; - -struct _MprisControllerstatus { - gint32 playback; - gint32 shuffle; - gint32 repeat; - gint32 endless; -}; - -struct _PlayerController { - GObject parent_instance; - PlayerControllerPrivate * priv; - gint current_state; - GeeArrayList* custom_items; - MprisBridge* 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 mpris_controller_parent_class = NULL; - -GType mpris_controller_get_type (void) G_GNUC_CONST; -GType player_controller_get_type (void) G_GNUC_CONST; -#define MPRIS_CONTROLLER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_MPRIS_CONTROLLER, MprisControllerPrivate)) -enum { - MPRIS_CONTROLLER_DUMMY_PROPERTY, - MPRIS_CONTROLLER_MPRIS_PLAYER, - MPRIS_CONTROLLER_OWNER, - MPRIS_CONTROLLER_MPRIS_INTERFACE -}; -MprisController* mpris_controller_new (PlayerController* ctrl, const char* inter); -MprisController* mpris_controller_construct (GType object_type, PlayerController* ctrl, const char* inter); -static void mpris_controller_initial_update (MprisController* self); -DBusGProxy* mpris_controller_get_mpris_player (MprisController* self); -static GType mpris_controller_status_get_type (void) G_GNUC_CONST G_GNUC_UNUSED; -static MprisControllerstatus* mpris_controller_status_dup (const MprisControllerstatus* self); -static void mpris_controller_status_free (MprisControllerstatus* self); -static void _dynamic_GetStatus0 (DBusGProxy* self, MprisControllerstatus* result, GError** error); -PlayerController* mpris_controller_get_owner (MprisController* self); -GType player_item_get_type (void) G_GNUC_CONST; -GType mpris_bridge_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, gint state); -static GHashTable* _dynamic_GetMetadata1 (DBusGProxy* self, GError** error); -void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attributes); -GeeHashSet* metadata_menuitem_attributes_format (void); -GType transport_menuitem_action_get_type (void) G_GNUC_CONST; -void mpris_controller_transport_event (MprisController* self, TransportMenuitemaction command); -static void _dynamic_Pause2 (DBusGProxy* self, GError** error); -static void _dynamic_Prev3 (DBusGProxy* self, GError** error); -static void _dynamic_Next4 (DBusGProxy* self, GError** error); -void mpris_controller_set_position (MprisController* self, double position); -static GHashTable* _dynamic_GetMetadata5 (DBusGProxy* self, GError** error); -static GValue* _g_value_dup (GValue* self); -static void _dynamic_PositionSet6 (DBusGProxy* self, gint32 param1, GError** error); -gboolean mpris_controller_connected (MprisController* self); -static void mpris_controller_onStatusChange (MprisController* self, DBusGProxy* mpris_client, MprisControllerstatus* st); -GeeHashSet* transport_menuitem_attributes_format (void); -static void mpris_controller_onTrackChange (MprisController* self, DBusGProxy* mpris_client, GHashTable* ht); -void player_item_reset (PlayerItem* self, GeeHashSet* attrs); -static void _dynamic_GetStatus7 (DBusGProxy* self, MprisControllerstatus* result, GError** error); -static void mpris_controller_set_mpris_player (MprisController* self, DBusGProxy* value); -static void mpris_controller_set_owner (MprisController* self, PlayerController* value); -const char* mpris_controller_get_mpris_interface (MprisController* self); -static void mpris_controller_set_mpris_interface (MprisController* self, const char* value); -const char* player_controller_get_name (PlayerController* self); -static void _mpris_controller_onTrackChange_dynamic_TrackChange0_ (DBusGProxy* _sender, GHashTable* ht, gpointer self); -void _dynamic_TrackChange1_connect (gpointer obj, const char * signal_name, GCallback handler, gpointer data); -static void _mpris_controller_onStatusChange_dynamic_StatusChange2_ (DBusGProxy* _sender, MprisControllerstatus* st, gpointer self); -void _dynamic_StatusChange3_connect (gpointer obj, const char * signal_name, GCallback handler, gpointer data); -static GObject * mpris_controller_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); -static void mpris_controller_finalize (GObject* obj); -static void mpris_controller_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); -static void mpris_controller_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); - - -static void g_cclosure_user_marshal_VOID__BOXED (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data); - -MprisController* mpris_controller_construct (GType object_type, PlayerController* ctrl, const char* inter) { - MprisController * self; - g_return_val_if_fail (ctrl != NULL, NULL); - g_return_val_if_fail (inter != NULL, NULL); - self = (MprisController*) g_object_new (object_type, "owner", ctrl, "mpris-interface", inter, NULL); - return self; -} - - -MprisController* mpris_controller_new (PlayerController* ctrl, const char* inter) { - return mpris_controller_construct (TYPE_MPRIS_CONTROLLER, ctrl, inter); -} - - -static void _dynamic_GetStatus0 (DBusGProxy* self, MprisControllerstatus* result, GError** error) { - GValueArray* dbus_result; - dbus_g_proxy_call (self, "GetStatus", error, G_TYPE_INVALID, dbus_g_type_get_struct ("GValueArray", G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INVALID), &dbus_result, G_TYPE_INVALID); - if (*error) { - return; - } - result->playback = g_value_get_int (&dbus_result->values[0]); - result->shuffle = g_value_get_int (&dbus_result->values[1]); - result->repeat = g_value_get_int (&dbus_result->values[2]); - result->endless = g_value_get_int (&dbus_result->values[3]); -} - - -static GHashTable* _dynamic_GetMetadata1 (DBusGProxy* self, GError** error) { - GHashTable* result; - dbus_g_proxy_call (self, "GetMetadata", error, G_TYPE_INVALID, dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE), &result, G_TYPE_INVALID); - if (*error) { - return NULL; - } - return result; -} - - -static void mpris_controller_initial_update (MprisController* self) { - MprisControllerstatus _tmp0_ = {0}; - MprisControllerstatus st; - gint play_state; - PlayerItem* _tmp1_; - TransportMenuitem* _tmp2_; - GHashTable* _tmp3_; - PlayerItem* _tmp4_; - GHashTable* _tmp5_; - GeeHashSet* _tmp6_; - GError * _inner_error_ = NULL; - g_return_if_fail (self != NULL); - st = (_dynamic_GetStatus0 (self->priv->_mpris_player, &_tmp0_, &_inner_error_), _tmp0_); - 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; - } - play_state = (gint) st.playback; - g_debug ("mpris-controller.vala:60: GetStatusChange - play state %i", play_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), play_state); - _g_object_unref0 (_tmp2_); - _tmp3_ = _dynamic_GetMetadata1 (self->priv->_mpris_player, &_inner_error_); - 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; - } - player_item_update (_tmp4_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), _tmp5_ = _tmp3_, _tmp6_ = metadata_menuitem_attributes_format ()); - _g_object_unref0 (_tmp6_); - _g_hash_table_unref0 (_tmp5_); - _g_object_unref0 (_tmp4_); -} - - -static void _dynamic_Pause2 (DBusGProxy* self, GError** error) { - dbus_g_proxy_call (self, "Pause", error, G_TYPE_INVALID, G_TYPE_INVALID); - if (*error) { - return; - } -} - - -static void _dynamic_Prev3 (DBusGProxy* self, GError** error) { - dbus_g_proxy_call (self, "Prev", error, G_TYPE_INVALID, G_TYPE_INVALID); - if (*error) { - return; - } -} - - -static void _dynamic_Next4 (DBusGProxy* self, GError** error) { - dbus_g_proxy_call (self, "Next", error, G_TYPE_INVALID, G_TYPE_INVALID); - if (*error) { - return; - } -} - - -void mpris_controller_transport_event (MprisController* self, TransportMenuitemaction command) { - GError * _inner_error_ = NULL; - g_return_if_fail (self != NULL); - g_debug ("mpris-controller.vala:68: transport_event input = %i", (gint) command); - if (command == TRANSPORT_MENUITEM_ACTION_PLAY_PAUSE) { - g_debug ("mpris-controller.vala:70: transport_event PLAY_PAUSE"); - _dynamic_Pause2 (self->priv->_mpris_player, &_inner_error_); - 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; - } - } else { - if (command == TRANSPORT_MENUITEM_ACTION_PREVIOUS) { - _dynamic_Prev3 (self->priv->_mpris_player, &_inner_error_); - 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; - } - } else { - if (command == TRANSPORT_MENUITEM_ACTION_NEXT) { - _dynamic_Next4 (self->priv->_mpris_player, &_inner_error_); - 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 GHashTable* _dynamic_GetMetadata5 (DBusGProxy* self, GError** error) { - GHashTable* result; - dbus_g_proxy_call (self, "GetMetadata", error, G_TYPE_INVALID, dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE), &result, G_TYPE_INVALID); - if (*error) { - return NULL; - } - return result; -} - - -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 _dynamic_PositionSet6 (DBusGProxy* self, gint32 param1, GError** error) { - dbus_g_proxy_call (self, "PositionSet", error, G_TYPE_INT, param1, G_TYPE_INVALID, G_TYPE_INVALID); - if (*error) { - return; - } -} - - -void mpris_controller_set_position (MprisController* self, double position) { - GHashTable* data; - GValue* time_value; - guint32 total_time; - double new_time_position; - GError * _inner_error_ = NULL; - g_return_if_fail (self != NULL); - g_debug ("mpris-controller.vala:83: Set position with pos (0-100) %f", position); - data = _dynamic_GetMetadata5 (self->priv->_mpris_player, &_inner_error_); - 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; - } - time_value = __g_value_dup0 ((GValue*) g_hash_table_lookup (data, "time")); - if (time_value == NULL) { - g_warning ("mpris-controller.vala:87: Can't fetch the duration of the track theref" \ -"ore cant set the position"); - _g_free0 (time_value); - _g_hash_table_unref0 (data); - return; - } - total_time = (guint32) g_value_get_uint (time_value); - g_debug ("mpris-controller.vala:91: total time of track = %i", (gint) total_time); - new_time_position = (total_time * position) / 100.0; - g_debug ("mpris-controller.vala:93: new position = %f", new_time_position * 1000); - _dynamic_PositionSet6 (self->priv->_mpris_player, (gint32) new_time_position, &_inner_error_); - if (_inner_error_ != NULL) { - _g_free0 (time_value); - _g_hash_table_unref0 (data); - 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 (time_value); - _g_hash_table_unref0 (data); -} - - -gboolean mpris_controller_connected (MprisController* self) { - gboolean result = FALSE; - g_return_val_if_fail (self != NULL, FALSE); - result = self->priv->_mpris_player != NULL; - return result; -} - - -static void mpris_controller_onStatusChange (MprisController* self, DBusGProxy* mpris_client, MprisControllerstatus* st) { - MprisControllerstatus* status; - GValueArray* ar; - gint play_state; - GHashTable* ht; - GValue v = {0}; - PlayerItem* _tmp0_; - GeeHashSet* _tmp1_; - g_return_if_fail (self != NULL); - g_return_if_fail (mpris_client != NULL); - g_debug ("mpris-controller.vala:104: onStatusChange - signal received"); - status = st; - ar = (GValueArray*) status; - play_state = g_value_get_int (g_value_array_get_nth (ar, (guint) 0)); - g_debug ("mpris-controller.vala:108: onStatusChange - play state %i", play_state); - ht = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); - g_value_init (&v, G_TYPE_INT); - g_value_set_int (&v, play_state); - g_hash_table_insert (ht, g_strdup ("state"), __g_value_dup0 (&v)); - player_item_update (_tmp0_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT), ht, _tmp1_ = transport_menuitem_attributes_format ()); - _g_object_unref0 (_tmp1_); - _g_object_unref0 (_tmp0_); - G_IS_VALUE (&v) ? (g_value_unset (&v), NULL) : NULL; - _g_hash_table_unref0 (ht); -} - - -static void _dynamic_GetStatus7 (DBusGProxy* self, MprisControllerstatus* result, GError** error) { - GValueArray* dbus_result; - dbus_g_proxy_call (self, "GetStatus", error, G_TYPE_INVALID, dbus_g_type_get_struct ("GValueArray", G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INVALID), &dbus_result, G_TYPE_INVALID); - if (*error) { - return; - } - result->playback = g_value_get_int (&dbus_result->values[0]); - result->shuffle = g_value_get_int (&dbus_result->values[1]); - result->repeat = g_value_get_int (&dbus_result->values[2]); - result->endless = g_value_get_int (&dbus_result->values[3]); -} - - -static void mpris_controller_onTrackChange (MprisController* self, DBusGProxy* mpris_client, GHashTable* ht) { - PlayerItem* _tmp0_; - GeeHashSet* _tmp1_; - MprisControllerstatus _tmp2_ = {0}; - MprisControllerstatus st; - gint play_state; - PlayerItem* _tmp3_; - GeeHashSet* _tmp4_; - GError * _inner_error_ = NULL; - g_return_if_fail (self != NULL); - g_return_if_fail (mpris_client != NULL); - g_return_if_fail (ht != NULL); - g_debug ("mpris-controller.vala:118: onTrackChange"); - player_item_reset (_tmp0_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), _tmp1_ = metadata_menuitem_attributes_format ()); - _g_object_unref0 (_tmp1_); - _g_object_unref0 (_tmp0_); - st = (_dynamic_GetStatus7 (self->priv->_mpris_player, &_tmp2_, &_inner_error_), _tmp2_); - if (_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - play_state = (gint) st.playback; - g_debug ("mpris-controller.vala:124: GetStatusChange, about to update scrub with" \ -" play state - %i", play_state); - player_item_update (_tmp3_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), ht, _tmp4_ = metadata_menuitem_attributes_format ()); - _g_object_unref0 (_tmp4_); - _g_object_unref0 (_tmp3_); - g_debug ("mpris-controller.vala:128: about to update the duration on the scrub b" \ -"ar"); -} - - -DBusGProxy* mpris_controller_get_mpris_player (MprisController* self) { - DBusGProxy* result; - g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_mpris_player; - return result; -} - - -static gpointer _g_object_ref0 (gpointer self) { - return self ? g_object_ref (self) : NULL; -} - - -static void mpris_controller_set_mpris_player (MprisController* self, DBusGProxy* value) { - DBusGProxy* _tmp0_; - g_return_if_fail (self != NULL); - self->priv->_mpris_player = (_tmp0_ = _g_object_ref0 (value), _g_object_unref0 (self->priv->_mpris_player), _tmp0_); - g_object_notify ((GObject *) self, "mpris-player"); -} - - -PlayerController* mpris_controller_get_owner (MprisController* self) { - PlayerController* result; - g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_owner; - return result; -} - - -static void mpris_controller_set_owner (MprisController* 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* mpris_controller_get_mpris_interface (MprisController* self) { - const char* result; - g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_mpris_interface; - return result; -} - - -static void mpris_controller_set_mpris_interface (MprisController* self, const char* value) { - char* _tmp0_; - g_return_if_fail (self != NULL); - self->priv->_mpris_interface = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_mpris_interface), _tmp0_); - g_object_notify ((GObject *) self, "mpris-interface"); -} - - -static void _mpris_controller_onTrackChange_dynamic_TrackChange0_ (DBusGProxy* _sender, GHashTable* ht, gpointer self) { - mpris_controller_onTrackChange (self, _sender, ht); -} - - -void _dynamic_TrackChange1_connect (gpointer obj, const char * signal_name, GCallback handler, gpointer data) { - dbus_g_object_register_marshaller (g_cclosure_user_marshal_VOID__BOXED, G_TYPE_NONE, dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE), G_TYPE_INVALID); - dbus_g_proxy_add_signal (obj, "TrackChange", dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE), G_TYPE_INVALID); - dbus_g_proxy_connect_signal (obj, "TrackChange", handler, data, NULL); -} - - -static void _mpris_controller_onStatusChange_dynamic_StatusChange2_ (DBusGProxy* _sender, MprisControllerstatus* st, gpointer self) { - mpris_controller_onStatusChange (self, _sender, st); -} - - -void _dynamic_StatusChange3_connect (gpointer obj, const char * signal_name, GCallback handler, gpointer data) { - dbus_g_object_register_marshaller (g_cclosure_user_marshal_VOID__BOXED, G_TYPE_NONE, dbus_g_type_get_struct ("GValueArray", G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INVALID), G_TYPE_INVALID); - dbus_g_proxy_add_signal (obj, "StatusChange", dbus_g_type_get_struct ("GValueArray", G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INVALID), G_TYPE_INVALID); - dbus_g_proxy_connect_signal (obj, "StatusChange", handler, data, NULL); -} - - -static GObject * mpris_controller_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) { - GObject * obj; - GObjectClass * parent_class; - MprisController * self; - GError * _inner_error_; - parent_class = G_OBJECT_CLASS (mpris_controller_parent_class); - obj = parent_class->constructor (type, n_construct_properties, construct_properties); - self = MPRIS_CONTROLLER (obj); - _inner_error_ = NULL; - { - char* _tmp2_; - char* _tmp3_; - DBusGProxy* _tmp4_; - char* _tmp5_; - char* _tmp6_; - { - DBusGConnection* _tmp0_; - DBusGConnection* _tmp1_; - _tmp0_ = dbus_g_bus_get (DBUS_BUS_SESSION, &_inner_error_); - if (_inner_error_ != NULL) { - goto __catch1_g_error; - } - self->priv->connection = (_tmp1_ = _tmp0_, _dbus_g_connection_unref0 (self->priv->connection), _tmp1_); - } - goto __finally1; - __catch1_g_error: - { - GError * e; - e = _inner_error_; - _inner_error_ = NULL; - { - g_error ("mpris-controller.vala:45: Problems connecting to the session bus - %s", e->message); - _g_error_free0 (e); - } - } - __finally1: - 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_); - } - mpris_controller_set_mpris_player (self, _tmp4_ = dbus_g_proxy_new_for_name (self->priv->connection, _tmp3_ = g_strconcat ("org.mpris.", _tmp2_ = g_utf8_strdown (player_controller_get_name (self->priv->_owner), -1), NULL), "/Player", self->priv->_mpris_interface)); - _g_object_unref0 (_tmp4_); - _g_free0 (_tmp3_); - _g_free0 (_tmp2_); - g_debug ("mpris-controller.vala:49: Attempting to establish an mpris connection " \ -"to %s, %s, %s", _tmp6_ = g_strconcat ("org.mpris.", _tmp5_ = g_utf8_strdown (player_controller_get_name (self->priv->_owner), -1), NULL), "/Player", self->priv->_mpris_interface); - _g_free0 (_tmp6_); - _g_free0 (_tmp5_); - _dynamic_TrackChange1_connect (self->priv->_mpris_player, "TrackChange", (GCallback) _mpris_controller_onTrackChange_dynamic_TrackChange0_, self); - _dynamic_StatusChange3_connect (self->priv->_mpris_player, "StatusChange", (GCallback) _mpris_controller_onStatusChange_dynamic_StatusChange2_, self); - mpris_controller_initial_update (self); - } - return obj; -} - - -static MprisControllerstatus* mpris_controller_status_dup (const MprisControllerstatus* self) { - MprisControllerstatus* dup; - dup = g_new0 (MprisControllerstatus, 1); - memcpy (dup, self, sizeof (MprisControllerstatus)); - return dup; -} - - -static void mpris_controller_status_free (MprisControllerstatus* self) { - g_free (self); -} - - -static GType mpris_controller_status_get_type (void) { - static volatile gsize mpris_controller_status_type_id__volatile = 0; - if (g_once_init_enter (&mpris_controller_status_type_id__volatile)) { - GType mpris_controller_status_type_id; - mpris_controller_status_type_id = g_boxed_type_register_static ("MprisControllerstatus", (GBoxedCopyFunc) mpris_controller_status_dup, (GBoxedFreeFunc) mpris_controller_status_free); - g_once_init_leave (&mpris_controller_status_type_id__volatile, mpris_controller_status_type_id); - } - return mpris_controller_status_type_id__volatile; -} - - -static void mpris_controller_class_init (MprisControllerClass * klass) { - mpris_controller_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (MprisControllerPrivate)); - G_OBJECT_CLASS (klass)->get_property = mpris_controller_get_property; - G_OBJECT_CLASS (klass)->set_property = mpris_controller_set_property; - G_OBJECT_CLASS (klass)->constructor = mpris_controller_constructor; - G_OBJECT_CLASS (klass)->finalize = mpris_controller_finalize; - g_object_class_install_property (G_OBJECT_CLASS (klass), MPRIS_CONTROLLER_MPRIS_PLAYER, g_param_spec_object ("mpris-player", "mpris-player", "mpris-player", DBUS_TYPE_G_PROXY, 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), MPRIS_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), MPRIS_CONTROLLER_MPRIS_INTERFACE, g_param_spec_string ("mpris-interface", "mpris-interface", "mpris-interface", 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 mpris_controller_instance_init (MprisController * self) { - self->priv = MPRIS_CONTROLLER_GET_PRIVATE (self); -} - - -static void mpris_controller_finalize (GObject* obj) { - MprisController * self; - self = MPRIS_CONTROLLER (obj); - _dbus_g_connection_unref0 (self->priv->connection); - _g_object_unref0 (self->priv->_mpris_player); - _g_object_unref0 (self->priv->_owner); - _g_free0 (self->priv->_mpris_interface); - G_OBJECT_CLASS (mpris_controller_parent_class)->finalize (obj); -} - - -GType mpris_controller_get_type (void) { - static volatile gsize mpris_controller_type_id__volatile = 0; - if (g_once_init_enter (&mpris_controller_type_id__volatile)) { - static const GTypeInfo g_define_type_info = { sizeof (MprisControllerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) mpris_controller_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MprisController), 0, (GInstanceInitFunc) mpris_controller_instance_init, NULL }; - GType mpris_controller_type_id; - mpris_controller_type_id = g_type_register_static (G_TYPE_OBJECT, "MprisController", &g_define_type_info, 0); - g_once_init_leave (&mpris_controller_type_id__volatile, mpris_controller_type_id); - } - return mpris_controller_type_id__volatile; -} - - -static void mpris_controller_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - MprisController * self; - self = MPRIS_CONTROLLER (object); - switch (property_id) { - case MPRIS_CONTROLLER_MPRIS_PLAYER: - g_value_set_object (value, mpris_controller_get_mpris_player (self)); - break; - case MPRIS_CONTROLLER_OWNER: - g_value_set_object (value, mpris_controller_get_owner (self)); - break; - case MPRIS_CONTROLLER_MPRIS_INTERFACE: - g_value_set_string (value, mpris_controller_get_mpris_interface (self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -static void mpris_controller_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { - MprisController * self; - self = MPRIS_CONTROLLER (object); - switch (property_id) { - case MPRIS_CONTROLLER_MPRIS_PLAYER: - mpris_controller_set_mpris_player (self, g_value_get_object (value)); - break; - case MPRIS_CONTROLLER_OWNER: - mpris_controller_set_owner (self, g_value_get_object (value)); - break; - case MPRIS_CONTROLLER_MPRIS_INTERFACE: - mpris_controller_set_mpris_interface (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__BOXED (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data) { - typedef void (*GMarshalFunc_VOID__BOXED) (gpointer data1, gpointer arg_1, gpointer data2); - register GMarshalFunc_VOID__BOXED callback; - register GCClosure * cc; - register gpointer data1, data2; - cc = (GCClosure *) closure; - g_return_if_fail (n_param_values == 2); - if (G_CCLOSURE_SWAP_DATA (closure)) { - data1 = closure->data; - data2 = param_values->data[0].v_pointer; - } else { - data1 = param_values->data[0].v_pointer; - data2 = closure->data; - } - callback = (GMarshalFunc_VOID__BOXED) (marshal_data ? marshal_data : cc->callback); - callback (data1, g_value_get_boxed (param_values + 1), data2); -} - - - diff --git a/src/mpris-controller.vala b/src/mpris-controller.vala deleted file mode 100644 index fc9eee0..0000000 --- a/src/mpris-controller.vala +++ /dev/null @@ -1,130 +0,0 @@ -/* -This service primarily controls PulseAudio and is driven by the sound indicator menu on the panel. -Copyright 2010 Canonical Ltd. - -Authors: - Conor Curran - -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 . -*/ - -using Gee; - -public class MprisController : GLib.Object -{ - private DBus.Connection connection; - public dynamic DBus.Object mpris_player{get; construct;} - public PlayerController owner {get; construct;} - public string mpris_interface {get; construct;} - - struct status { - public int32 playback; - public int32 shuffle; - public int32 repeat; - public int32 endless; - } - - public MprisController(PlayerController ctrl, string inter="org.freedesktop.MediaPlayer"){ - Object(owner: ctrl, mpris_interface: inter); - } - - construct{ - try { - this.connection = DBus.Bus.get (DBus.BusType.SESSION); - } catch (Error e) { - error("Problems connecting to the session bus - %s", e.message); - } - this.mpris_player = this.connection.get_object ("org.mpris.".concat(this.owner.name.down()) , "/Player", this.mpris_interface); - - debug("Attempting to establish an mpris connection to %s, %s, %s", "org.mpris.".concat(this.owner.name.down()) , "/Player", this.mpris_interface); - - this.mpris_player.TrackChange += onTrackChange; - this.mpris_player.StatusChange += onStatusChange; - initial_update(); - } - - private void initial_update() - { - status st = this.mpris_player.GetStatus(); - int play_state = st.playback; - debug("GetStatusChange - play state %i", play_state); - (this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(play_state); - this.owner.custom_items[PlayerController.widget_order.METADATA].update(this.mpris_player.GetMetadata(), - MetadataMenuitem.attributes_format()); - } - - public void transport_event(TransportMenuitem.action command) - { - debug("transport_event input = %i", (int)command); - if(command == TransportMenuitem.action.PLAY_PAUSE){ - debug("transport_event PLAY_PAUSE"); - this.mpris_player.Pause(); - } - else if(command == TransportMenuitem.action.PREVIOUS){ - this.mpris_player.Prev(); - } - else if(command == TransportMenuitem.action.NEXT){ - this.mpris_player.Next(); - } - } - - public void set_position(double position) - { - debug("Set position with pos (0-100) %f", position); - HashTable data = this.mpris_player.GetMetadata(); - Value? time_value = data.lookup("time"); - if(time_value == null){ - warning("Can't fetch the duration of the track therefore cant set the position"); - return; - } - uint32 total_time = time_value.get_uint(); - debug("total time of track = %i", (int)total_time); - double new_time_position = total_time * position/100.0; - debug("new position = %f", (new_time_position * 1000)); - this.mpris_player.PositionSet((int32)(new_time_position)); - } - - public bool connected() - { - return (this.mpris_player != null); - } - - private void onStatusChange(dynamic DBus.Object mpris_client, status st) - { - debug("onStatusChange - signal received"); - status* status = &st; - unowned ValueArray ar = (ValueArray)status; - int play_state = ar.get_nth(0).get_int(); - debug("onStatusChange - play state %i", play_state); - HashTable ht = new HashTable(str_hash, str_equal); - Value v = Value(typeof(int)); - v.set_int(play_state); - ht.insert("state", v); - this.owner.custom_items[PlayerController.widget_order.TRANSPORT].update(ht, TransportMenuitem.attributes_format()); - } - - private void onTrackChange(dynamic DBus.Object mpris_client, HashTable ht) - { - debug("onTrackChange"); - - this.owner.custom_items[PlayerController.widget_order.METADATA].reset(MetadataMenuitem.attributes_format()); - - status st = this.mpris_player.GetStatus(); - int play_state = st.playback; - debug("GetStatusChange, about to update scrub with play state - %i", play_state); - - this.owner.custom_items[PlayerController.widget_order.METADATA].update(ht, - MetadataMenuitem.attributes_format()); - debug("about to update the duration on the scrub bar"); - } -} diff --git a/src/mpris2-controller.c b/src/mpris2-controller.c index 87ec14a..6aa2be2 100644 --- a/src/mpris2-controller.c +++ b/src/mpris2-controller.c @@ -1,4 +1,4 @@ -/* mpris2-controller.c generated by valac 0.9.7, the Vala compiler +/* mpris2-controller.c generated by valac 0.9.8, the Vala compiler * generated from mpris2-controller.vala, do not modify */ /* @@ -103,16 +103,6 @@ typedef struct _PlayerControllerPrivate PlayerControllerPrivate; typedef struct _PlayerItem PlayerItem; typedef struct _PlayerItemClass PlayerItemClass; -#define TYPE_MPRIS_BRIDGE (mpris_bridge_get_type ()) -#define MPRIS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_BRIDGE, MprisBridge)) -#define MPRIS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS_BRIDGE, MprisBridgeClass)) -#define IS_MPRIS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_BRIDGE)) -#define IS_MPRIS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS_BRIDGE)) -#define MPRIS_BRIDGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS_BRIDGE, MprisBridgeClass)) - -typedef struct _MprisBridge MprisBridge; -typedef struct _MprisBridgeClass MprisBridgeClass; - #define PLAYER_CONTROLLER_TYPE_WIDGET_ORDER (player_controller_widget_order_get_type ()) #define TYPE_TRANSPORT_MENUITEM (transport_menuitem_get_type ()) @@ -124,6 +114,7 @@ typedef struct _MprisBridgeClass MprisBridgeClass; 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 _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) @@ -204,7 +195,7 @@ struct _PlayerController { PlayerControllerPrivate * priv; gint current_state; GeeArrayList* custom_items; - MprisBridge* mpris_bridge; + Mpris2Controller* mpris_bridge; }; struct _PlayerControllerClass { @@ -357,11 +348,11 @@ enum { 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_name (PlayerController* self); static GValue* _g_value_dup (GValue* self); static gint mpris2_controller_determine_play_state (Mpris2Controller* self, const char* status); -PlayerController* mpris2_controller_get_owner (Mpris2Controller* self); GType player_item_get_type (void) G_GNUC_CONST; -GType mpris_bridge_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, gint state); @@ -369,12 +360,13 @@ 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); +static void _vala_GValue_free (GValue* self); MprisPlayer* mpris2_controller_get_player (Mpris2Controller* 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_event (Mpris2Controller* self, TransportMenuitemaction command); -void mpris2_controller_set_position (Mpris2Controller* self, double position); +void mpris2_controller_transport_update (Mpris2Controller* self, TransportMenuitemaction command); +void mpris2_controller_set_track_position (Mpris2Controller* self, double position); void mpris2_controller_onSeeked (Mpris2Controller* self, gint64 position); gboolean mpris2_controller_connected (Mpris2Controller* self); MprisRoot* mpris2_controller_get_mpris2_root (Mpris2Controller* self); @@ -385,7 +377,6 @@ static void mpris2_controller_set_player (Mpris2Controller* self, MprisPlayer* v 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); -const char* player_controller_get_name (PlayerController* self); static void _mpris2_controller_onSeeked_mpris_player_seeked (MprisPlayer* _sender, gint64 new_position, gpointer self); 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); @@ -4669,21 +4660,30 @@ static gpointer __g_value_dup0 (gpointer self) { } +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; + char* _tmp0_; + gboolean _tmp1_ = FALSE; GValue* play_v; GValue* pos_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:99: properties-changed for interface %s", interface_source); + g_debug ("mpris2-controller.vala:99: properties-changed for interface %s and own" \ +"er %s", interface_source, _tmp0_ = g_utf8_strdown (player_controller_get_name (self->priv->_owner), -1)); + _g_free0 (_tmp0_); if (changed_properties == NULL) { - _tmp0_ = TRUE; + _tmp1_ = TRUE; } else { - _tmp0_ = g_str_has_prefix (interface_source, MPRIS2_CONTROLLER_root_interface) == FALSE; + _tmp1_ = g_str_has_prefix (interface_source, MPRIS2_CONTROLLER_root_interface) == FALSE; } - if (_tmp0_) { + if (_tmp1_) { g_warning ("mpris2-controller.vala:101: Property-changed hash is null or this is a" \ "n interface that concerns us"); return; @@ -4692,13 +4692,13 @@ void mpris2_controller_property_changed_cb (Mpris2Controller* self, const char* if (play_v != NULL) { char* state; gint p; - PlayerItem* _tmp1_; - TransportMenuitem* _tmp2_; + PlayerItem* _tmp2_; + TransportMenuitem* _tmp3_; state = g_strdup (g_value_get_string (play_v)); g_debug ("mpris2-controller.vala:107: new playback state = %s", state); p = 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_); + transport_menuitem_change_play_state (_tmp3_ = (_tmp2_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT), IS_TRANSPORT_MENUITEM (_tmp2_) ? ((TransportMenuitem*) _tmp2_) : NULL), p); + _g_object_unref0 (_tmp3_); _g_free0 (state); } pos_v = __g_value_dup0 ((GValue*) g_hash_table_lookup (changed_properties, "Position")); @@ -4710,22 +4710,22 @@ void mpris2_controller_property_changed_cb (Mpris2Controller* self, const char* meta_v = __g_value_dup0 ((GValue*) g_hash_table_lookup (changed_properties, "Metadata")); if (meta_v != NULL) { GHashTable* changed_updates; - PlayerItem* _tmp3_; - GeeHashSet* _tmp4_; - PlayerItem* _tmp5_; - GeeHashSet* _tmp6_; + PlayerItem* _tmp4_; + GeeHashSet* _tmp5_; + PlayerItem* _tmp6_; + GeeHashSet* _tmp7_; changed_updates = mpris2_controller_clean_metadata (self); - player_item_reset (_tmp3_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), _tmp4_ = metadata_menuitem_attributes_format ()); + player_item_reset (_tmp4_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), _tmp5_ = metadata_menuitem_attributes_format ()); + _g_object_unref0 (_tmp5_); _g_object_unref0 (_tmp4_); - _g_object_unref0 (_tmp3_); - player_item_update (_tmp5_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), changed_updates, _tmp6_ = metadata_menuitem_attributes_format ()); + player_item_update (_tmp6_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), changed_updates, _tmp7_ = metadata_menuitem_attributes_format ()); + _g_object_unref0 (_tmp7_); _g_object_unref0 (_tmp6_); - _g_object_unref0 (_tmp5_); _g_hash_table_unref0 (changed_updates); } - _g_free0 (meta_v); - _g_free0 (pos_v); - _g_free0 (play_v); + __vala_GValue_free0 (meta_v); + __vala_GValue_free0 (pos_v); + __vala_GValue_free0 (play_v); } @@ -4779,8 +4779,8 @@ static GHashTable* mpris2_controller_clean_metadata (Mpris2Controller* self) { 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; - _g_free0 (length_v); - _g_free0 (artist_v); + __vala_GValue_free0 (length_v); + __vala_GValue_free0 (artist_v); return result; } @@ -4837,7 +4837,7 @@ void mpris2_controller_initial_update (Mpris2Controller* self) { } -void mpris2_controller_transport_event (Mpris2Controller* self, TransportMenuitemaction command) { +void mpris2_controller_transport_update (Mpris2Controller* self, TransportMenuitemaction command) { GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); g_debug ("mpris2-controller.vala:176: transport_event input = %i", (gint) command); @@ -4847,15 +4847,15 @@ void mpris2_controller_transport_event (Mpris2Controller* self, TransportMenuite mpris_player_PlayPause (self->priv->_player, &_inner_error_); if (_inner_error_ != NULL) { if (_inner_error_->domain == DBUS_GERROR) { - goto __catch2_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_); return; } } - goto __finally2; - __catch2_dbus_gerror: + goto __finally5; + __catch5_dbus_gerror: { GError * _error_; _error_ = _inner_error_; @@ -4866,7 +4866,7 @@ void mpris2_controller_transport_event (Mpris2Controller* self, TransportMenuite _g_error_free0 (_error_); } } - __finally2: + __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_); @@ -4878,15 +4878,15 @@ void mpris2_controller_transport_event (Mpris2Controller* self, TransportMenuite mpris_player_Previous (self->priv->_player, &_inner_error_); if (_inner_error_ != NULL) { if (_inner_error_->domain == DBUS_GERROR) { - goto __catch3_dbus_gerror; + goto __catch6_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_); return; } } - goto __finally3; - __catch3_dbus_gerror: + goto __finally6; + __catch6_dbus_gerror: { GError * _error_; _error_ = _inner_error_; @@ -4897,7 +4897,7 @@ void mpris2_controller_transport_event (Mpris2Controller* self, TransportMenuite _g_error_free0 (_error_); } } - __finally3: + __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_); @@ -4909,15 +4909,15 @@ void mpris2_controller_transport_event (Mpris2Controller* self, TransportMenuite mpris_player_Next (self->priv->_player, &_inner_error_); if (_inner_error_ != NULL) { if (_inner_error_->domain == DBUS_GERROR) { - goto __catch4_dbus_gerror; + goto __catch7_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_); return; } } - goto __finally4; - __catch4_dbus_gerror: + goto __finally7; + __catch7_dbus_gerror: { GError * _error_; _error_ = _inner_error_; @@ -4928,7 +4928,7 @@ void mpris2_controller_transport_event (Mpris2Controller* self, TransportMenuite _g_error_free0 (_error_); } } - __finally4: + __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_); @@ -4944,7 +4944,7 @@ void mpris2_controller_transport_event (Mpris2Controller* self, TransportMenuite TODO: SetPosition on the player object is not working with rhythmbox, runtime error - "dbus function not supported" */ -void mpris2_controller_set_position (Mpris2Controller* self, double position) { +void mpris2_controller_set_track_position (Mpris2Controller* self, double position) { GHashTable* _tmp0_; GValue* _tmp1_; GValue* time_value; @@ -4960,7 +4960,7 @@ void mpris2_controller_set_position (Mpris2Controller* self, double position) { if (time_value == NULL) { g_warning ("mpris2-controller.vala:215: Can't fetch the duration of the track ther" \ "efore cant set the position"); - _g_free0 (time_value); + __vala_GValue_free0 (time_value); return; } total_time = g_value_get_int64 (time_value); @@ -4976,33 +4976,33 @@ void mpris2_controller_set_position (Mpris2Controller* self, double position) { mpris_player_SetPosition (self->priv->_player, path, (gint64) new_time_position, &_inner_error_); if (_inner_error_ != NULL) { if (_inner_error_->domain == DBUS_GERROR) { - goto __catch5_dbus_gerror; + goto __catch8_dbus_gerror; } _g_free0 (path); - _g_free0 (v); - _g_free0 (time_value); + __vala_GValue_free0 (v); + __vala_GValue_free0 (time_value); 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; } } - goto __finally5; - __catch5_dbus_gerror: + goto __finally8; + __catch8_dbus_gerror: { GError * e; e = _inner_error_; _inner_error_ = NULL; { - g_error ("mpris2-controller.vala:234: DBus Error calling the player objects SetP" \ + g_error ("mpris2-controller.vala:232: DBus Error calling the player objects SetP" \ "osition method %s", e->message); _g_error_free0 (e); } } - __finally5: + __finally8: if (_inner_error_ != NULL) { _g_free0 (path); - _g_free0 (v); - _g_free0 (time_value); + __vala_GValue_free0 (v); + __vala_GValue_free0 (time_value); 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; @@ -5010,14 +5010,14 @@ void mpris2_controller_set_position (Mpris2Controller* self, double position) { _g_free0 (path); } } - _g_free0 (v); - _g_free0 (time_value); + __vala_GValue_free0 (v); + __vala_GValue_free0 (time_value); } void mpris2_controller_onSeeked (Mpris2Controller* self, gint64 position) { g_return_if_fail (self != NULL); - g_debug ("mpris2-controller.vala:242: Seeked signal callback with pos = %i", ((gint) position) / 1000); + g_debug ("mpris2-controller.vala:240: Seeked signal callback with pos = %i", ((gint) position) / 1000); } @@ -5061,26 +5061,26 @@ void mpris2_controller_expose (Mpris2Controller* self) { mpris_root_Raise (self->priv->_mpris2_root, &_inner_error_); if (_inner_error_ != NULL) { if (_inner_error_->domain == DBUS_GERROR) { - goto __catch6_dbus_gerror; + goto __catch9_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_); return; } } - goto __finally6; - __catch6_dbus_gerror: + goto __finally9; + __catch9_dbus_gerror: { GError * e; e = _inner_error_; _inner_error_ = NULL; { - g_error ("mpris2-controller.vala:267: Exception thrown while calling root functi" \ + g_error ("mpris2-controller.vala:263: Exception thrown while calling root functi" \ "on Raise - %s", e->message); _g_error_free0 (e); } } - __finally6: + __finally9: if (_inner_error_ != NULL) { g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); g_clear_error (&_inner_error_); @@ -5206,7 +5206,7 @@ static GObject * mpris2_controller_constructor (GType type, guint n_construct_pr connection = dbus_g_bus_get (DBUS_BUS_SESSION, &_inner_error_); if (_inner_error_ != NULL) { if (_inner_error_->domain == DBUS_GERROR) { - goto __catch7_dbus_gerror; + goto __catch10_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_); @@ -5240,8 +5240,8 @@ static GObject * mpris2_controller_constructor (GType type, guint n_construct_pr 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 __finally7; - __catch7_dbus_gerror: + goto __finally10; + __catch10_dbus_gerror: { GError * e; e = _inner_error_; @@ -5251,7 +5251,7 @@ static GObject * mpris2_controller_constructor (GType type, guint n_construct_pr _g_error_free0 (e); } } - __finally7: + __finally10: if (_inner_error_ != NULL) { g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); g_clear_error (&_inner_error_); diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala index df2bbd3..cf5a39e 100644 --- a/src/mpris2-controller.vala +++ b/src/mpris2-controller.vala @@ -96,7 +96,7 @@ public class Mpris2Controller : GLib.Object public void property_changed_cb(string interface_source, HashTable changed_properties, string[] invalid ) { - debug("properties-changed for interface %s", interface_source); + debug("properties-changed for interface %s and owner %s", interface_source, this.owner.name.down()); if(changed_properties == null || interface_source.has_prefix(this.root_interface) == false){ warning("Property-changed hash is null or this is an interface that concerns us"); return; @@ -171,7 +171,7 @@ public class Mpris2Controller : GLib.Object MetadataMenuitem.attributes_format()); } - public void transport_event(TransportMenuitem.action command) + public void transport_update(TransportMenuitem.action command) { debug("transport_event input = %i", (int)command); if(command == TransportMenuitem.action.PLAY_PAUSE){ @@ -207,7 +207,7 @@ public class Mpris2Controller : GLib.Object TODO: SetPosition on the player object is not working with rhythmbox, runtime error - "dbus function not supported" */ - public void set_position(double position) + public void set_track_position(double position) { debug("Set position with pos (0-100) %f", position); Value? time_value = this.player.Metadata.lookup("mpris:length"); @@ -227,8 +227,6 @@ public class Mpris2Controller : GLib.Object DBus.ObjectPath path = new ObjectPath(v.get_string()); try{ this.player.SetPosition(path, (int64)(new_time_position)); - //ScrubMenuitem scrub = this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem; - //scrub.update_position(((int32)new_time_position) / 1000); } catch(DBus.Error e){ error("DBus Error calling the player objects SetPosition method %s", @@ -240,8 +238,6 @@ public class Mpris2Controller : GLib.Object public void onSeeked(int64 position){ debug("Seeked signal callback with pos = %i", (int)position/1000); - //ScrubMenuitem scrub = this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem; - //scrub.update_position((int32)position/1000); } public bool connected() diff --git a/src/music-player-bridge.c b/src/music-player-bridge.c index 1e908a9..0f513ae 100644 --- a/src/music-player-bridge.c +++ b/src/music-player-bridge.c @@ -1,4 +1,4 @@ -/* music-player-bridge.c generated by valac 0.9.7, the Vala compiler +/* music-player-bridge.c generated by valac 0.9.8, the Vala compiler * generated from music-player-bridge.vala, do not modify */ /* @@ -218,9 +218,7 @@ static char* string_strip (const char* self) { static void music_player_bridge_try_to_add_inactive_familiar_clients (MusicPlayerBridge* self) { - gint count; g_return_if_fail (self != NULL); - count = 0; { GeeSet* _tmp0_; GeeIterator* _tmp1_; @@ -228,50 +226,41 @@ static void music_player_bridge_try_to_add_inactive_familiar_clients (MusicPlaye _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; + PlayerController* ctrl; + char* _tmp3_; + char* _tmp4_; if (!gee_iterator_next (_app_it)) { break; } app = (char*) gee_iterator_get (_app_it); - if (count == 0) { - GDesktopAppInfo* info; - GDesktopAppInfo* _tmp2_; - GAppInfo* app_info; - PlayerController* ctrl; - char* _tmp3_; - char* _tmp4_; - char* _tmp5_; - char* _tmp6_; - if (app == NULL) { - g_warning ("music-player-bridge.vala:52: App string in keyfile is null therefore m" \ + if (app == NULL) { + g_warning ("music-player-bridge.vala:49: App string in keyfile is null therefore m" \ "oving on to next player"); - _g_free0 (app); - continue; - } - info = g_desktop_app_info_new_from_filename (app); - if (info == NULL) { - g_warning ("music-player-bridge.vala:57: Could not create a desktopappinfo instanc" \ + _g_free0 (app); + continue; + } + g_debug ("music-player-bridge.vala:53: 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:57: 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 = player_controller_new (self->priv->root_menu, g_app_info_get_name (app_info), music_player_bridge_calculate_menu_position (self), PLAYER_CONTROLLER_STATE_OFFLINE); - g_object_set ((GObject*) ctrl, "app_info", app_info, NULL); - gee_abstract_map_set ((GeeAbstractMap*) self->priv->registered_clients, _tmp4_ = string_strip (_tmp3_ = g_utf8_strdown (g_app_info_get_name (app_info), -1)), ctrl); - _g_free0 (_tmp4_); - _g_free0 (_tmp3_); - g_debug ("music-player-bridge.vala:67: Created a player controller for %s which " \ -"was found in the cache file", _tmp6_ = string_strip (_tmp5_ = g_utf8_strdown (g_app_info_get_name (app_info), -1))); - _g_free0 (_tmp6_); - _g_free0 (_tmp5_); - count = count + 1; - _g_object_unref0 (ctrl); - _g_object_unref0 (app_info); _g_object_unref0 (info); + _g_free0 (app); + continue; } + app_info = _g_object_ref0 ((_tmp2_ = info, G_IS_APP_INFO (_tmp2_) ? ((GAppInfo*) _tmp2_) : NULL)); + ctrl = player_controller_new (self->priv->root_menu, g_app_info_get_name (app_info), music_player_bridge_calculate_menu_position (self), PLAYER_CONTROLLER_STATE_OFFLINE); + g_object_set ((GObject*) ctrl, "app_info", app_info, NULL); + gee_abstract_map_set ((GeeAbstractMap*) self->priv->registered_clients, _tmp4_ = string_strip (_tmp3_ = g_utf8_strdown (g_app_info_get_name (app_info), -1)), ctrl); + _g_free0 (_tmp4_); + _g_free0 (_tmp3_); + _g_object_unref0 (ctrl); + _g_object_unref0 (app_info); + _g_object_unref0 (info); _g_free0 (app); - break; } _g_object_unref0 (_app_it); } @@ -300,7 +289,7 @@ void music_player_bridge_on_server_added (MusicPlayerBridge* self, IndicateListe gboolean _tmp3_ = FALSE; g_return_if_fail (self != NULL); g_return_if_fail (type != NULL); - g_debug ("music-player-bridge.vala:86: MusicPlayerBridge -> on_server_added with" \ + g_debug ("music-player-bridge.vala:82: MusicPlayerBridge -> on_server_added with" \ " value %s", type); if (music_player_bridge_server_is_not_of_interest (self, type)) { return; @@ -319,7 +308,7 @@ void music_player_bridge_on_server_added (MusicPlayerBridge* self, IndicateListe if ((_tmp5_ = gee_collection_contains ((GeeCollection*) (_tmp4_ = gee_map_get_keys ((GeeMap*) self->priv->registered_clients)), client_name), _g_object_unref0 (_tmp4_), _tmp5_)) { PlayerController* _tmp6_; PlayerController* _tmp7_; - g_debug ("music-player-bridge.vala:92: It figured out that it already has an ins" \ + g_debug ("music-player-bridge.vala:88: It figured out that it already has an ins" \ "tance for this player already"); player_controller_update_state (_tmp6_ = (PlayerController*) gee_abstract_map_get ((GeeAbstractMap*) self->priv->registered_clients, client_name), PLAYER_CONTROLLER_STATE_READY); _g_object_unref0 (_tmp6_); @@ -329,8 +318,8 @@ void music_player_bridge_on_server_added (MusicPlayerBridge* self, IndicateListe PlayerController* ctrl; ctrl = player_controller_new (self->priv->root_menu, client_name, music_player_bridge_calculate_menu_position (self), PLAYER_CONTROLLER_STATE_READY); gee_abstract_map_set ((GeeAbstractMap*) self->priv->registered_clients, client_name, ctrl); - g_debug ("music-player-bridge.vala:103: New Client of name %s has successfully r" \ -"egistered with us", client_name); + g_debug ("music-player-bridge.vala:99: New Client of name %s has successfully re" \ +"gistered with us", client_name); _g_object_unref0 (ctrl); } if ((_tmp9_ = player_controller_get_app_info (_tmp8_ = (PlayerController*) gee_abstract_map_get ((GeeAbstractMap*) self->priv->registered_clients, client_name)) == NULL, _g_object_unref0 (_tmp8_), _tmp9_)) { @@ -352,7 +341,7 @@ void music_player_bridge_on_server_removed (MusicPlayerBridge* self, IndicateLis gboolean _tmp3_ = FALSE; g_return_if_fail (self != NULL); g_return_if_fail (type != NULL); - g_debug ("music-player-bridge.vala:115: MusicPlayerBridge -> on_server_removed w" \ + g_debug ("music-player-bridge.vala:111: MusicPlayerBridge -> on_server_removed w" \ "ith value %s", type); if (music_player_bridge_server_is_not_of_interest (self, type)) { return; @@ -367,7 +356,7 @@ void music_player_bridge_on_server_removed (MusicPlayerBridge* self, IndicateLis PlayerController* _tmp4_; player_controller_hibernate (_tmp4_ = (PlayerController*) gee_abstract_map_get ((GeeAbstractMap*) self->priv->registered_clients, client_name)); _g_object_unref0 (_tmp4_); - g_debug ("music-player-bridge.vala:120: Successively offlined client %s", client_name); + g_debug ("music-player-bridge.vala:116: Successively offlined client %s", client_name); } _g_free0 (client_name); } @@ -391,7 +380,7 @@ static gboolean music_player_bridge_server_is_not_of_interest (MusicPlayerBridge return result; } if (string_contains (type, "music") == FALSE) { - g_debug ("music-player-bridge.vala:127: server is of no interest, it is not an " \ + g_debug ("music-player-bridge.vala:123: server is of no interest, it is not an " \ "music server"); result = TRUE; return result; @@ -415,7 +404,7 @@ static void music_player_bridge_desktop_info_callback (MusicPlayerBridge* self, } if (_tmp1_) { GAppInfo* app_info; - g_debug ("music-player-bridge.vala:138: About to store desktop file path: %s", path); + g_debug ("music-player-bridge.vala:134: About to store desktop file path: %s", path); familiar_players_db_insert (bridge->priv->playersDB, path); app_info = music_player_bridge_create_app_info (path); if (app_info != NULL) { @@ -425,13 +414,13 @@ static void music_player_bridge_desktop_info_callback (MusicPlayerBridge* self, PlayerController* ctrl; ctrl = (_tmp4_ = (PlayerController*) gee_abstract_map_get ((GeeAbstractMap*) bridge->priv->registered_clients, _tmp3_ = string_strip (_tmp2_ = g_utf8_strdown (g_app_info_get_name (app_info), -1))), _g_free0 (_tmp3_), _g_free0 (_tmp2_), _tmp4_); g_object_set ((GObject*) ctrl, "app_info", app_info, NULL); - g_debug ("music-player-bridge.vala:144: successfully created appinfo from path a" \ + g_debug ("music-player-bridge.vala:140: successfully created appinfo from path a" \ "nd set it on the respective instance"); _g_object_unref0 (ctrl); } _g_object_unref0 (app_info); } else { - g_debug ("music-player-bridge.vala:148: Ignoring desktop file path because its e" \ + g_debug ("music-player-bridge.vala:144: Ignoring desktop file path because its e" \ "ither invalid of the db cache file has it already: %s", path); } _g_object_unref0 (bridge); @@ -450,20 +439,20 @@ void music_player_bridge_set_root_menu_item (MusicPlayerBridge* self, DbusmenuMe void music_player_bridge_on_server_count_changed (MusicPlayerBridge* self, IndicateListenerServer* object, guint i) { g_return_if_fail (self != NULL); - g_debug ("music-player-bridge.vala:160: MusicPlayerBridge-> on_server_count_chan" \ + g_debug ("music-player-bridge.vala:156: MusicPlayerBridge-> on_server_count_chan" \ "ged with value %u", i); } void music_player_bridge_on_indicator_added (MusicPlayerBridge* self, IndicateListenerServer* object, IndicateListenerIndicator* p0) { g_return_if_fail (self != NULL); - g_debug ("music-player-bridge.vala:164: MusicPlayerBridge-> on_indicator_added"); + g_debug ("music-player-bridge.vala:160: MusicPlayerBridge-> on_indicator_added"); } void music_player_bridge_on_indicator_removed (MusicPlayerBridge* self, IndicateListenerServer* object, IndicateListenerIndicator* p0) { g_return_if_fail (self != NULL); - g_debug ("music-player-bridge.vala:169: MusicPlayerBridge -> on_indicator_remove" \ + g_debug ("music-player-bridge.vala:165: MusicPlayerBridge -> on_indicator_remove" \ "d"); } @@ -471,7 +460,7 @@ void music_player_bridge_on_indicator_removed (MusicPlayerBridge* self, Indicate void music_player_bridge_on_indicator_modified (MusicPlayerBridge* self, IndicateListenerServer* object, IndicateListenerIndicator* p0, const char* s) { g_return_if_fail (self != NULL); g_return_if_fail (s != NULL); - g_debug ("music-player-bridge.vala:174: MusicPlayerBridge -> indicator_modified " \ + g_debug ("music-player-bridge.vala:170: MusicPlayerBridge -> indicator_modified " \ "with vale %s", s); } @@ -484,7 +473,7 @@ GAppInfo* music_player_bridge_create_app_info (const char* path) { 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:181: Could not create a desktopappinfo instan" \ + g_warning ("music-player-bridge.vala:177: Could not create a desktopappinfo instan" \ "ce from app: %s", path); result = NULL; _g_object_unref0 (info); diff --git a/src/music-player-bridge.h b/src/music-player-bridge.h index 64ccb1c..d1a612f 100644 --- a/src/music-player-bridge.h +++ b/src/music-player-bridge.h @@ -1,4 +1,4 @@ -/* music-player-bridge.h generated by valac 0.9.7, the Vala compiler, do not modify */ +/* music-player-bridge.h generated by valac 0.9.8, the Vala compiler, do not modify */ #ifndef __MUSIC_PLAYER_BRIDGE_H__ @@ -19,10 +19,10 @@ #include #include #include -#include -#include #include #include +#include +#include G_BEGIN_DECLS @@ -106,31 +106,19 @@ typedef struct _TitleMenuitemClass TitleMenuitemClass; typedef struct _TitleMenuitemPrivate TitleMenuitemPrivate; typedef struct _PlayerControllerPrivate PlayerControllerPrivate; -#define TYPE_MPRIS_BRIDGE (mpris_bridge_get_type ()) -#define MPRIS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_BRIDGE, MprisBridge)) -#define MPRIS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS_BRIDGE, MprisBridgeClass)) -#define IS_MPRIS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_BRIDGE)) -#define IS_MPRIS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS_BRIDGE)) -#define MPRIS_BRIDGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS_BRIDGE, MprisBridgeClass)) +#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 _MprisBridge MprisBridge; -typedef struct _MprisBridgeClass MprisBridgeClass; +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 ()) -typedef struct _MprisBridgePrivate MprisBridgePrivate; - -#define TYPE_MPRIS_CONTROLLER (mpris_controller_get_type ()) -#define MPRIS_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_CONTROLLER, MprisController)) -#define MPRIS_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS_CONTROLLER, MprisControllerClass)) -#define IS_MPRIS_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_CONTROLLER)) -#define IS_MPRIS_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS_CONTROLLER)) -#define MPRIS_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS_CONTROLLER, MprisControllerClass)) - -typedef struct _MprisController MprisController; -typedef struct _MprisControllerClass MprisControllerClass; -typedef struct _MprisControllerPrivate MprisControllerPrivate; #define TYPE_MPRIS_ROOT (mpris_root_get_type ()) #define MPRIS_ROOT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_ROOT, MprisRoot)) @@ -155,16 +143,6 @@ typedef struct _MprisPlayerIface MprisPlayerIface; typedef struct _FreeDesktopProperties FreeDesktopProperties; typedef struct _FreeDesktopPropertiesIface FreeDesktopPropertiesIface; - -#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_FAMILIAR_PLAYERS_DB (familiar_players_db_get_type ()) @@ -178,6 +156,17 @@ 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; @@ -243,7 +232,7 @@ struct _PlayerController { PlayerControllerPrivate * priv; gint current_state; GeeArrayList* custom_items; - MprisBridge* mpris_bridge; + Mpris2Controller* mpris_bridge; }; struct _PlayerControllerClass { @@ -265,24 +254,6 @@ typedef enum { PLAYER_CONTROLLER_STATE_DISCONNECTED } PlayerControllerstate; -struct _MprisBridge { - GObject parent_instance; - MprisBridgePrivate * priv; -}; - -struct _MprisBridgeClass { - GObjectClass parent_class; -}; - -struct _MprisController { - GObject parent_instance; - MprisControllerPrivate * priv; -}; - -struct _MprisControllerClass { - GObjectClass parent_class; -}; - struct _MprisRootIface { GTypeInterface parent_iface; void (*Quit) (MprisRoot* self, GError** error); @@ -336,6 +307,15 @@ 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); @@ -357,8 +337,11 @@ TransportMenuitem* transport_menuitem_construct (GType object_type, PlayerContro void transport_menuitem_change_play_state (TransportMenuitem* self, gint state); 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 scrub_menuitem_get_type (void) G_GNUC_CONST; ScrubMenuitem* scrub_menuitem_new (PlayerController* parent); @@ -370,7 +353,7 @@ GType title_menuitem_get_type (void) G_GNUC_CONST; TitleMenuitem* title_menuitem_new (PlayerController* parent); TitleMenuitem* title_menuitem_construct (GType object_type, PlayerController* parent); GeeHashSet* title_menuitem_attributes_format (void); -GType mpris_bridge_get_type (void) G_GNUC_CONST; +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 @@ -389,21 +372,6 @@ 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); -MprisBridge* mpris_bridge_new (PlayerController* ctrl); -MprisBridge* mpris_bridge_construct (GType object_type, PlayerController* ctrl); -gboolean mpris_bridge_connected (MprisBridge* self); -void mpris_bridge_transport_update (MprisBridge* self, TransportMenuitemaction update); -void mpris_bridge_expose (MprisBridge* self); -void mpris_bridge_set_track_position (MprisBridge* self, double pos); -GType mpris_controller_get_type (void) G_GNUC_CONST; -MprisController* mpris_controller_new (PlayerController* ctrl, const char* inter); -MprisController* mpris_controller_construct (GType object_type, PlayerController* ctrl, const char* inter); -void mpris_controller_transport_event (MprisController* self, TransportMenuitemaction command); -void mpris_controller_set_position (MprisController* self, double position); -gboolean mpris_controller_connected (MprisController* self); -DBusGProxy* mpris_controller_get_mpris_player (MprisController* self); -PlayerController* mpris_controller_get_owner (MprisController* self); -const char* mpris_controller_get_mpris_interface (MprisController* self); 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, GError** error); @@ -433,14 +401,13 @@ 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); -GType mpris2_controller_get_type (void) G_GNUC_CONST; #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_event (Mpris2Controller* self, TransportMenuitemaction command); -void mpris2_controller_set_position (Mpris2Controller* self, double position); +void mpris2_controller_transport_update (Mpris2Controller* self, TransportMenuitemaction command); +void mpris2_controller_set_track_position (Mpris2Controller* self, double position); void mpris2_controller_onSeeked (Mpris2Controller* self, gint64 position); gboolean mpris2_controller_connected (Mpris2Controller* self); gboolean mpris2_controller_was_successfull (Mpris2Controller* self); @@ -462,6 +429,13 @@ 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 diff --git a/src/music-player-bridge.vala b/src/music-player-bridge.vala index daad42f..c677d15 100644 --- a/src/music-player-bridge.vala +++ b/src/music-player-bridge.vala @@ -44,30 +44,26 @@ public class MusicPlayerBridge : GLib.Object } private void try_to_add_inactive_familiar_clients(){ - // TODO handle multple players - just working with one right now - int count = 0; foreach(string app in this.playersDB.records()){ - if(count == 0){ - if(app == null){ - warning("App string in keyfile is null therefore moving on to next player"); - continue; - } - DesktopAppInfo info = new DesktopAppInfo.from_filename(app); - if(info == null){ - warning("Could not create a desktopappinfo instance from app: %s", app); - continue; - } - GLib.AppInfo app_info = info as GLib.AppInfo; - PlayerController ctrl = new PlayerController(this.root_menu, - app_info.get_name(), - calculate_menu_position(), - PlayerController.state.OFFLINE); - ctrl.set("app_info", app_info); - this.registered_clients.set(app_info.get_name().down().strip(), ctrl); - debug("Created a player controller for %s which was found in the cache file", app_info.get_name().down().strip()); - count += 1; + if(app == null){ + warning("App string in keyfile is null therefore moving on to next player"); + continue; + } + + debug("attempting to make an app info from %s", app); + + DesktopAppInfo info = new DesktopAppInfo.from_filename(app); + if(info == null){ + warning("Could not create a desktopappinfo instance from app: %s", app); + continue; } - break; + GLib.AppInfo app_info = info as GLib.AppInfo; + PlayerController ctrl = new PlayerController(this.root_menu, + app_info.get_name(), + calculate_menu_position(), + PlayerController.state.OFFLINE); + ctrl.set("app_info", app_info); + this.registered_clients.set(app_info.get_name().down().strip(), ctrl); } } diff --git a/src/play-button.c b/src/play-button.c index a2eaf2e..ccc23cb 100644 --- a/src/play-button.c +++ b/src/play-button.c @@ -409,11 +409,12 @@ play_button_react_to_button_press(GtkWidget* button, PlayButtonEvent command) g_return_if_fail(IS_PLAY_BUTTON(button)); PlayButtonPrivate* priv = PLAY_BUTTON_GET_PRIVATE(button); priv->current_command = command; - + cairo_t *cr; cr = gdk_cairo_create (button->window); - GList* list = g_hash_table_lookup(priv->command_coordinates, GINT_TO_POINTER(command)); + GList* list = g_hash_table_lookup(priv->command_coordinates, + GINT_TO_POINTER(priv->current_command)); cairo_rectangle(cr, GPOINTER_TO_INT(g_list_nth_data(list, 0)), GPOINTER_TO_INT(g_list_nth_data(list, 1)), @@ -426,10 +427,19 @@ play_button_react_to_button_press(GtkWidget* button, PlayButtonEvent command) void -play_button_react_to_button_release(GtkWidget* button) +play_button_react_to_button_release(GtkWidget* button, PlayButtonEvent command) { g_return_if_fail(IS_PLAY_BUTTON(button)); PlayButtonPrivate* priv = PLAY_BUTTON_GET_PRIVATE(button); + if(priv->current_command == TRANSPORT_NADA){ + g_debug("returning from the playbutton release because my previous command was nada"); + return; + } + else if(priv->current_command != TRANSPORT_NADA && + command != TRANSPORT_NADA){ + priv->current_command = command; + } + cairo_t *cr; cr = gdk_cairo_create (button->window); @@ -437,7 +447,7 @@ play_button_react_to_button_release(GtkWidget* button) GINT_TO_POINTER(priv->current_command)); priv->current_command = TRANSPORT_NADA; - + cairo_rectangle(cr, GPOINTER_TO_INT(g_list_nth_data(list, 0)), GPOINTER_TO_INT(g_list_nth_data(list, 1)), @@ -456,6 +466,7 @@ play_button_toggle_play_pause(GtkWidget* button, PlayButtonState update) PlayButtonPrivate* priv = PLAY_BUTTON_GET_PRIVATE(button); priv->current_state = update; g_debug("PlayButton::toggle play state : %i", priv->current_state); + gtk_widget_queue_draw (GTK_WIDGET(button)); } @@ -955,7 +966,6 @@ draw (GtkWidget* button, cairo_t *cr) } - /** * play_button_new: * @returns: a new #PlayButton. diff --git a/src/play-button.h b/src/play-button.h index 727a489..6bacac7 100644 --- a/src/play-button.h +++ b/src/play-button.h @@ -56,8 +56,8 @@ struct _PlayButton { GType play_button_get_type (void); void play_button_set_style(GtkWidget* button, GtkStyle* style); PlayButtonEvent determine_button_event(GtkWidget* button, GdkEventButton* event); -void play_button_react_to_button_press(GtkWidget* button, PlayButtonEvent command); -void play_button_react_to_button_release(GtkWidget* button); +void play_button_react_to_button_press(GtkWidget* button, PlayButtonEvent command); +void play_button_react_to_button_release(GtkWidget* button, PlayButtonEvent command); void play_button_toggle_play_pause(GtkWidget* button, PlayButtonState update); GtkWidget* play_button_new(); diff --git a/src/player-controller.c b/src/player-controller.c index 28bb28c..51eafe8 100644 --- a/src/player-controller.c +++ b/src/player-controller.c @@ -1,4 +1,4 @@ -/* player-controller.c generated by valac 0.9.7, the Vala compiler +/* player-controller.c generated by valac 0.9.8, the Vala compiler * generated from player-controller.vala, do not modify */ /* @@ -54,15 +54,15 @@ typedef struct _PlayerControllerPrivate PlayerControllerPrivate; typedef struct _PlayerItem PlayerItem; typedef struct _PlayerItemClass PlayerItemClass; -#define TYPE_MPRIS_BRIDGE (mpris_bridge_get_type ()) -#define MPRIS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_BRIDGE, MprisBridge)) -#define MPRIS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS_BRIDGE, MprisBridgeClass)) -#define IS_MPRIS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_BRIDGE)) -#define IS_MPRIS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS_BRIDGE)) -#define MPRIS_BRIDGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS_BRIDGE, MprisBridgeClass)) +#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 _MprisBridge MprisBridge; -typedef struct _MprisBridgeClass MprisBridgeClass; +typedef struct _Mpris2Controller Mpris2Controller; +typedef struct _Mpris2ControllerClass Mpris2ControllerClass; #define PLAYER_CONTROLLER_TYPE_WIDGET_ORDER (player_controller_widget_order_get_type ()) @@ -106,7 +106,7 @@ struct _PlayerController { PlayerControllerPrivate * priv; gint current_state; GeeArrayList* custom_items; - MprisBridge* mpris_bridge; + Mpris2Controller* mpris_bridge; }; struct _PlayerControllerClass { @@ -140,7 +140,7 @@ 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 mpris_bridge_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, @@ -164,8 +164,8 @@ 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); -MprisBridge* mpris_bridge_new (PlayerController* ctrl); -MprisBridge* mpris_bridge_construct (GType object_type, PlayerController* ctrl); +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); @@ -185,7 +185,7 @@ 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 mpris_bridge_connected (MprisBridge* self); +gboolean mpris2_controller_connected (Mpris2Controller* 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); @@ -263,7 +263,7 @@ PlayerController* player_controller_new (DbusmenuMenuitem* root, const char* cli void player_controller_update_state (PlayerController* self, PlayerControllerstate new_state) { g_return_if_fail (self != NULL); - g_debug ("player-controller.vala:66: update_state - player controller %s : new s" \ + g_debug ("player-controller.vala:69: 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); @@ -279,27 +279,27 @@ void player_controller_activate (PlayerController* self) { void player_controller_instantiate (PlayerController* self) { GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); - g_debug ("player-controller.vala:84: instantiate in player controller for %s", self->priv->_name); + g_debug ("player-controller.vala:87: 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 __catch0_g_error; + goto __catch4_g_error; } player_controller_update_state (self, PLAYER_CONTROLLER_STATE_INSTANTIATING); } - goto __finally0; - __catch0_g_error: + goto __finally4; + __catch4_g_error: { GError * _error_; _error_ = _inner_error_; _inner_error_ = NULL; { - g_warning ("player-controller.vala:90: Failed to launch app %s with error message:" \ + g_warning ("player-controller.vala:93: Failed to launch app %s with error message:" \ " %s", self->priv->_name, _error_->message); _g_error_free0 (_error_); } } - __finally0: + __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_); @@ -309,14 +309,14 @@ void player_controller_instantiate (PlayerController* self) { static void player_controller_establish_mpris_connection (PlayerController* self) { - MprisBridge* _tmp0_; + Mpris2Controller* _tmp0_; g_return_if_fail (self != NULL); if (self->current_state != PLAYER_CONTROLLER_STATE_READY) { - g_debug ("player-controller.vala:97: establish_mpris_connection - Not ready to c" \ -"onnect"); + g_debug ("player-controller.vala:100: establish_mpris_connection - Not ready to " \ +"connect"); return; } - self->mpris_bridge = (_tmp0_ = mpris_bridge_new (self), _g_object_unref0 (self->mpris_bridge), _tmp0_); + self->mpris_bridge = (_tmp0_ = mpris2_controller_new (self), _g_object_unref0 (self->mpris_bridge), _tmp0_); player_controller_determine_state (self); } @@ -414,6 +414,14 @@ static void player_controller_construct_widgets (PlayerController* self) { } +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; @@ -421,7 +429,7 @@ static char* string_slice (const char* self, glong start, glong end) { gboolean _tmp1_ = FALSE; const char* start_string; g_return_val_if_fail (self != NULL, NULL); - string_length = g_utf8_strlen (self, -1); + string_length = string_get_length (self); if (start < 0) { start = string_length + start; } @@ -459,7 +467,7 @@ static char* player_controller_format_client_name (const char* client_name) { formatted = (_tmp2_ = g_strconcat (_tmp0_ = g_utf8_strup (client_name, (gssize) 1), _tmp1_ = string_slice (client_name, (glong) 1, g_utf8_strlen (client_name, -1)), NULL), _g_free0 (formatted), _tmp2_); _g_free0 (_tmp1_); _g_free0 (_tmp0_); - g_debug ("player-controller.vala:160: PlayerController->format_client_name - : %" \ + g_debug ("player-controller.vala:163: PlayerController->format_client_name - : %" \ "s", formatted); } result = formatted; @@ -469,7 +477,7 @@ static char* player_controller_format_client_name (const char* client_name) { void player_controller_determine_state (PlayerController* self) { g_return_if_fail (self != NULL); - if (mpris_bridge_connected (self->mpris_bridge) == TRUE) { + if (mpris2_controller_connected (self->mpris_bridge) == TRUE) { player_controller_update_state (self, PLAYER_CONTROLLER_STATE_CONNECTED); } else { player_controller_update_state (self, PLAYER_CONTROLLER_STATE_DISCONNECTED); diff --git a/src/player-controller.vala b/src/player-controller.vala index 3e12dce..4d9f054 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -45,11 +45,14 @@ public class PlayerController : GLib.Object private Dbusmenu.Menuitem root_menu; public string name { get; set;} public ArrayList custom_items; - public MprisBridge mpris_bridge; + public Mpris2Controller mpris_bridge; public AppInfo? app_info { get; set;} public int menu_offset { get; set;} - public PlayerController(Dbusmenu.Menuitem root, string client_name, int offset, state initial_state) + public PlayerController(Dbusmenu.Menuitem root, + string client_name, + int offset, + state initial_state) { this.root_menu = root; this.name = format_client_name(client_name.strip()); @@ -97,7 +100,7 @@ public class PlayerController : GLib.Object debug("establish_mpris_connection - Not ready to connect"); return; } - this.mpris_bridge = new MprisBridge(this); + this.mpris_bridge = new Mpris2Controller(this); this.determine_state(); } diff --git a/src/player-item.c b/src/player-item.c index f70c04c..2449bfb 100644 --- a/src/player-item.c +++ b/src/player-item.c @@ -1,4 +1,4 @@ -/* player-item.c generated by valac 0.9.7, the Vala compiler +/* player-item.c generated by valac 0.9.8, the Vala compiler * generated from player-item.vala, do not modify */ /* @@ -53,7 +53,17 @@ 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 _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_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; @@ -86,6 +96,9 @@ 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); @@ -135,6 +148,12 @@ void player_item_reset (PlayerItem* self, GeeHashSet* attrs) { } +/** + * update() + * Base update method for playeritems, takes the attributes and the incoming updates + * and attmepts to update the appropriate props on the object. + * Album art is handled separately to deal with remote and local file paths. + */ static GValue* _g_value_dup (GValue* self) { return g_boxed_copy (G_TYPE_VALUE, self); } @@ -165,6 +184,17 @@ static gboolean string_contains (const char* self, const char* needle) { } +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) { @@ -178,13 +208,12 @@ static char* bool_to_string (gboolean self) { void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attributes) { - GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (data != NULL); g_return_if_fail (attributes != NULL); - g_debug ("player-item.vala:47: PlayerItem::update()"); + g_debug ("player-item.vala:53: PlayerItem::update()"); if (data == NULL) { - g_debug ("player-item.vala:49: PlayerItem::Update -> The hashtable was null - ju" \ + g_debug ("player-item.vala:55: PlayerItem::Update -> The hashtable was null - ju" \ "st leave it!"); return; } @@ -208,80 +237,48 @@ void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attribu 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:56: search key = %s", search_key); + 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:61: with value : %s", update); + g_debug ("player-item.vala:67: with value : %s", update); if (string_contains (property, "mpris:artUrl")) { - { - char* _tmp4_; - char* _tmp5_; - char* _tmp6_; - char* _tmp7_; - _tmp6_ = (_tmp5_ = g_filename_from_uri (_tmp4_ = string_strip (update), NULL, &_inner_error_), _g_free0 (_tmp4_), _tmp5_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == G_CONVERT_ERROR) { - goto __catch8_g_convert_error; - } - _g_free0 (update); - _g_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); - 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; - } - update = (_tmp7_ = _tmp6_, _g_free0 (update), _tmp7_); - } - goto __finally8; - __catch8_g_convert_error: - { - GError * e; - e = _inner_error_; - _inner_error_ = NULL; - { - g_warning ("player-item.vala:68: Problem converting URI %s to file path", update); - _g_error_free0 (e); - } - } - __finally8: - if (_inner_error_ != NULL) { - _g_free0 (update); - _g_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); - 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; - } + 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:74: with value : %i", g_value_get_int (v)); + 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:78: with value : %i", (gint) g_value_get_int64 (v)); + 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* _tmp8_; - g_debug ("player-item.vala:82: with value : %s", _tmp8_ = bool_to_string (g_value_get_boolean (v))); - _g_free0 (_tmp8_); + 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)); } } } } - _g_free0 (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); @@ -308,9 +305,9 @@ gboolean player_item_populated (PlayerItem* self, GeeHashSet* attrs) { break; } prop = (char*) gee_iterator_get (_prop_it); - g_debug ("player-item.vala:95: populated ? - prop: %s", prop); + 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:97: populated ? - prop %s and value %i", prop, value_int); + 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); @@ -334,11 +331,6 @@ PlayerController* player_item_get_owner (PlayerItem* self) { } -static gpointer _g_object_ref0 (gpointer self) { - return self ? g_object_ref (self) : NULL; -} - - static void player_item_set_owner (PlayerItem* self, PlayerController* value) { PlayerController* _tmp0_; g_return_if_fail (self != NULL); diff --git a/src/player-item.vala b/src/player-item.vala index fbfacbd..68ae6ef 100644 --- a/src/player-item.vala +++ b/src/player-item.vala @@ -25,7 +25,7 @@ public class PlayerItem : Dbusmenu.Menuitem public PlayerController owner {get; construct;} public string item_type { get; construct; } private const int EMPTY = -1; - + public PlayerItem(string type) { Object(item_type: type); @@ -42,6 +42,12 @@ public class PlayerItem : Dbusmenu.Menuitem } } + /** + * update() + * Base update method for playeritems, takes the attributes and the incoming updates + * and attmepts to update the appropriate props on the object. + * Album art is handled separately to deal with remote and local file paths. + */ public void update(HashTable data, HashSet attributes) { debug("PlayerItem::update()"); @@ -59,16 +65,14 @@ public class PlayerItem : Dbusmenu.Menuitem if (v.holds (typeof (string))){ string update = v.get_string().strip(); debug("with value : %s", update); - // Special case for the arturl URI's. - if(property.contains("mpris:artUrl")){ - try{ - update = Filename.from_uri(update.strip()); - } - catch(ConvertError e){ - warning("Problem converting URI %s to file path", update); - } + if(property.contains("mpris:artUrl")){ + // We know its a metadata instance because thats the only + // object with the arturl prop + MetadataMenuitem metadata = this as MetadataMenuitem; + metadata.fetch_art(update.strip(), property); + continue; } - this.property_set(property, update); + this.property_set(property, update); } else if (v.holds (typeof (int))){ debug("with value : %i", v.get_int()); @@ -83,7 +87,6 @@ public class PlayerItem : Dbusmenu.Menuitem this.property_set_bool(property, v.get_boolean()); } } - if(this.property_get_bool(MENUITEM_PROP_VISIBLE) == false){ this.property_set_bool(MENUITEM_PROP_VISIBLE, true); } @@ -101,5 +104,6 @@ public class PlayerItem : Dbusmenu.Menuitem } return false; } + } diff --git a/src/scrub-menu-item.c b/src/scrub-menu-item.c index c4aa807..18a8129 100644 --- a/src/scrub-menu-item.c +++ b/src/scrub-menu-item.c @@ -1,4 +1,4 @@ -/* scrub-menu-item.c generated by valac 0.9.7, the Vala compiler +/* scrub-menu-item.c generated by valac 0.9.8, the Vala compiler * generated from scrub-menu-item.vala, do not modify */ /* @@ -68,15 +68,15 @@ typedef struct _PlayerControllerClass PlayerControllerClass; #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) typedef struct _PlayerControllerPrivate PlayerControllerPrivate; -#define TYPE_MPRIS_BRIDGE (mpris_bridge_get_type ()) -#define MPRIS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_BRIDGE, MprisBridge)) -#define MPRIS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS_BRIDGE, MprisBridgeClass)) -#define IS_MPRIS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_BRIDGE)) -#define IS_MPRIS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS_BRIDGE)) -#define MPRIS_BRIDGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS_BRIDGE, MprisBridgeClass)) +#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 _MprisBridge MprisBridge; -typedef struct _MprisBridgeClass MprisBridgeClass; +typedef struct _Mpris2Controller Mpris2Controller; +typedef struct _Mpris2ControllerClass Mpris2ControllerClass; struct _PlayerItem { DbusmenuMenuitem parent_instance; @@ -101,7 +101,7 @@ struct _PlayerController { PlayerControllerPrivate * priv; gint current_state; GeeArrayList* custom_items; - MprisBridge* mpris_bridge; + Mpris2Controller* mpris_bridge; }; struct _PlayerControllerClass { @@ -124,8 +124,8 @@ GeeHashSet* scrub_menuitem_attributes_format (void); static void scrub_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 mpris_bridge_get_type (void) G_GNUC_CONST; -void mpris_bridge_set_track_position (MprisBridge* self, double pos); +GType mpris2_controller_get_type (void) G_GNUC_CONST; +void mpris2_controller_set_track_position (Mpris2Controller* self, double position); void scrub_menuitem_update_position (ScrubMenuitem* self, gint32 new_position); void scrub_menuitem_update_playstate (ScrubMenuitem* self, gint state); @@ -152,7 +152,7 @@ static void scrub_menuitem_real_handle_event (DbusmenuMenuitem* base, const char self = (ScrubMenuitem*) base; g_return_if_fail (name != NULL); g_debug ("scrub-menu-item.vala:34: handle_event for owner %s with value: %f", player_controller_get_name (player_item_get_owner ((PlayerItem*) self)), g_value_get_double (input_value)); - mpris_bridge_set_track_position (player_item_get_owner ((PlayerItem*) self)->mpris_bridge, g_value_get_double (input_value)); + mpris2_controller_set_track_position (player_item_get_owner ((PlayerItem*) self)->mpris_bridge, g_value_get_double (input_value)); } diff --git a/src/sound-service.c b/src/sound-service.c index 12f067e..f19379d 100644 --- a/src/sound-service.c +++ b/src/sound-service.c @@ -40,14 +40,13 @@ service_shutdown (IndicatorService *service, gpointer user_data) { if (mainloop != NULL) { g_debug("Service shutdown !"); - // TODO: uncomment for release !! + //TODO: uncomment for release !! close_pulse_activites(); g_main_loop_quit(mainloop); } return; } - /** main: **/ diff --git a/src/title-menu-item.c b/src/title-menu-item.c index 2733bde..56621ac 100644 --- a/src/title-menu-item.c +++ b/src/title-menu-item.c @@ -1,4 +1,4 @@ -/* title-menu-item.c generated by valac 0.9.7, the Vala compiler +/* title-menu-item.c generated by valac 0.9.8, the Vala compiler * generated from title-menu-item.vala, do not modify */ /* @@ -65,15 +65,15 @@ typedef struct _PlayerController PlayerController; typedef struct _PlayerControllerClass PlayerControllerClass; typedef struct _PlayerControllerPrivate PlayerControllerPrivate; -#define TYPE_MPRIS_BRIDGE (mpris_bridge_get_type ()) -#define MPRIS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_BRIDGE, MprisBridge)) -#define MPRIS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS_BRIDGE, MprisBridgeClass)) -#define IS_MPRIS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_BRIDGE)) -#define IS_MPRIS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS_BRIDGE)) -#define MPRIS_BRIDGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS_BRIDGE, MprisBridgeClass)) +#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 _MprisBridge MprisBridge; -typedef struct _MprisBridgeClass MprisBridgeClass; +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))) @@ -101,7 +101,7 @@ struct _PlayerController { PlayerControllerPrivate * priv; gint current_state; GeeArrayList* custom_items; - MprisBridge* mpris_bridge; + Mpris2Controller* mpris_bridge; }; struct _PlayerControllerClass { @@ -130,10 +130,10 @@ TitleMenuitem* title_menuitem_construct (GType object_type, PlayerController* pa 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 mpris_bridge_get_type (void) G_GNUC_CONST; +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 mpris_bridge_expose (MprisBridge* self); +void mpris2_controller_expose (Mpris2Controller* self); GeeHashSet* title_menuitem_attributes_format (void); @@ -160,7 +160,7 @@ static void title_menuitem_real_handle_event (DbusmenuMenuitem* base, const char player_controller_instantiate (player_item_get_owner ((PlayerItem*) self)); } else { if (player_item_get_owner ((PlayerItem*) self)->current_state == PLAYER_CONTROLLER_STATE_CONNECTED) { - mpris_bridge_expose (player_item_get_owner ((PlayerItem*) self)->mpris_bridge); + mpris2_controller_expose (player_item_get_owner ((PlayerItem*) self)->mpris_bridge); } } } diff --git a/src/transport-menu-item.c b/src/transport-menu-item.c index 40051f4..ff00f5f 100644 --- a/src/transport-menu-item.c +++ b/src/transport-menu-item.c @@ -1,4 +1,4 @@ -/* transport-menu-item.c generated by valac 0.9.7, the Vala compiler +/* transport-menu-item.c generated by valac 0.9.8, the Vala compiler * generated from transport-menu-item.vala, do not modify */ /* @@ -68,15 +68,15 @@ typedef struct _PlayerControllerClass PlayerControllerClass; #define _g_free0(var) (var = (g_free (var), NULL)) typedef struct _PlayerControllerPrivate PlayerControllerPrivate; -#define TYPE_MPRIS_BRIDGE (mpris_bridge_get_type ()) -#define MPRIS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_BRIDGE, MprisBridge)) -#define MPRIS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS_BRIDGE, MprisBridgeClass)) -#define IS_MPRIS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_BRIDGE)) -#define IS_MPRIS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS_BRIDGE)) -#define MPRIS_BRIDGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS_BRIDGE, MprisBridgeClass)) +#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 _MprisBridge MprisBridge; -typedef struct _MprisBridgeClass MprisBridgeClass; +typedef struct _Mpris2Controller Mpris2Controller; +typedef struct _Mpris2ControllerClass Mpris2ControllerClass; #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) struct _PlayerItem { @@ -108,7 +108,7 @@ struct _PlayerController { PlayerControllerPrivate * priv; gint current_state; GeeArrayList* custom_items; - MprisBridge* mpris_bridge; + Mpris2Controller* mpris_bridge; }; struct _PlayerControllerClass { @@ -131,8 +131,8 @@ void transport_menuitem_change_play_state (TransportMenuitem* self, gint state); 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 mpris_bridge_get_type (void) G_GNUC_CONST; -void mpris_bridge_transport_update (MprisBridge* self, TransportMenuitemaction update); +GType mpris2_controller_get_type (void) G_GNUC_CONST; +void mpris2_controller_transport_update (Mpris2Controller* self, TransportMenuitemaction command); GeeHashSet* transport_menuitem_attributes_format (void); @@ -179,7 +179,7 @@ static void transport_menuitem_real_handle_event (DbusmenuMenuitem* base, const g_debug ("transport-menu-item.vala:46: handle_event with value %s", _tmp0_ = g_strdup_printf ("%i", input)); _g_free0 (_tmp0_); g_debug ("transport-menu-item.vala:47: transport owner name = %s", player_controller_get_name (player_item_get_owner ((PlayerItem*) self))); - mpris_bridge_transport_update (player_item_get_owner ((PlayerItem*) self)->mpris_bridge, (TransportMenuitemaction) input); + mpris2_controller_transport_update (player_item_get_owner ((PlayerItem*) self)->mpris_bridge, (TransportMenuitemaction) input); } diff --git a/src/transport-widget.c b/src/transport-widget.c index 702b472..979f6fd 100644 --- a/src/transport-widget.c +++ b/src/transport-widget.c @@ -136,22 +136,12 @@ transport_widget_button_press_event (GtkWidget *menuitem, GdkEventButton *event) { g_return_val_if_fail(IS_TRANSPORT_WIDGET(menuitem), FALSE); - TransportWidgetPrivate * priv = TRANSPORT_WIDGET_GET_PRIVATE(TRANSPORT_WIDGET(menuitem)); - - GtkWidget *parent; - - parent = gtk_widget_get_parent (GTK_WIDGET (menuitem)); - + PlayButtonEvent result = determine_button_event(priv->play_button, event); if(result != TRANSPORT_NADA){ - GValue value = {0}; - g_value_init(&value, G_TYPE_INT); - g_debug("TransportWidget::menu_press_event - going to send value %i", (int)result); - g_value_set_int(&value, (int)result); play_button_react_to_button_press(priv->play_button, result); - dbusmenu_menuitem_handle_event (priv->twin_item, "Transport state change", &value, 0); } return TRUE; } @@ -164,7 +154,17 @@ transport_widget_button_release_event (GtkWidget *menuitem, g_debug("TransportWidget::menu_release_event"); g_return_val_if_fail(IS_TRANSPORT_WIDGET(menuitem), FALSE); TransportWidgetPrivate * priv = TRANSPORT_WIDGET_GET_PRIVATE(TRANSPORT_WIDGET(menuitem)); - play_button_react_to_button_release(priv->play_button); + + PlayButtonEvent result = determine_button_event(priv->play_button, event); + + if(result != TRANSPORT_NADA){ + GValue value = {0}; + g_value_init(&value, G_TYPE_INT); + g_debug("TransportWidget::menu_press_event - going to send value %i", (int)result); + g_value_set_int(&value, (int)result); + dbusmenu_menuitem_handle_event (priv->twin_item, "Transport state change", &value, 0); + } + play_button_react_to_button_release(priv->play_button, result); return TRUE; } @@ -187,6 +187,7 @@ transport_widget_property_update(DbusmenuMenuitem* item, gchar* property, int update_value = g_value_get_int(value); g_debug("transport_widget_update_state - with value %i", update_value); play_button_toggle_play_pause(priv->play_button, (PlayButtonState)update_value); + } } diff --git a/src/volume-widget.c b/src/volume-widget.c index bf1ddb9..5e7cf9f 100644 --- a/src/volume-widget.c +++ b/src/volume-widget.c @@ -1,3 +1,4 @@ + /* Copyright 2010 Canonical Ltd. @@ -48,6 +49,7 @@ static void volume_widget_set_twin_item( VolumeWidget* self, DbusmenuMenuitem* twin_item); static void volume_widget_property_update( DbusmenuMenuitem* item, gchar* property, GValue* value, gpointer userdata); + static gboolean volume_widget_change_value_cb (GtkRange *range, GtkScrollType scroll, gdouble value, @@ -103,7 +105,7 @@ volume_widget_init (VolumeWidget *self) g_object_unref(secondary_gicon); GtkAdjustment *adj = gtk_range_get_adjustment (GTK_RANGE (volume_widget)); - gtk_adjustment_set_step_increment(adj, 3); + gtk_adjustment_set_step_increment(adj, 4); } static void -- cgit v1.2.3