diff options
author | Sebastien Bacher <seb128@ubuntu.com> | 2010-03-11 19:00:38 +0100 |
---|---|---|
committer | Sebastien Bacher <seb128@ubuntu.com> | 2010-03-11 19:00:38 +0100 |
commit | 6df1024fe1a7cbfb9f6ba38cfe33a04889c2d40f (patch) | |
tree | 6c9e280e2289b7340981dbdcf21ee3b4982d832e | |
parent | 39cc953dc802c485d690fbbac77eaa6364818680 (diff) | |
parent | b4dfb37242eb867798f778a80d5ece48a568630b (diff) | |
download | ayatana-indicator-sound-6df1024fe1a7cbfb9f6ba38cfe33a04889c2d40f.tar.gz ayatana-indicator-sound-6df1024fe1a7cbfb9f6ba38cfe33a04889c2d40f.tar.bz2 ayatana-indicator-sound-6df1024fe1a7cbfb9f6ba38cfe33a04889c2d40f.zip |
Import upstream version 0.1.3
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | Makefile.in | 1 | ||||
-rwxr-xr-x | configure | 89 | ||||
-rw-r--r-- | configure.ac | 5 | ||||
-rw-r--r-- | src/Makefile.am | 21 | ||||
-rw-r--r-- | src/Makefile.in | 51 | ||||
-rw-r--r-- | src/common-defs.h | 1 | ||||
-rw-r--r-- | src/dbus-menu-manager.c | 241 | ||||
-rw-r--r-- | src/dbus-menu-manager.h | 31 | ||||
-rw-r--r-- | src/indicator-sound.c | 529 | ||||
-rw-r--r-- | src/indicator-sound.h | 35 | ||||
-rw-r--r-- | src/pulse-manager.c | 34 | ||||
-rw-r--r-- | src/pulse-manager.h | 4 | ||||
-rw-r--r-- | src/slider-menu-item.c | 1 | ||||
-rw-r--r-- | src/sound-service-client.h | 38 | ||||
-rw-r--r-- | src/sound-service-dbus.c | 51 | ||||
-rw-r--r-- | src/sound-service-dbus.h | 5 | ||||
-rw-r--r-- | src/sound-service-server.h | 7 | ||||
-rw-r--r-- | src/sound-service.c | 175 | ||||
-rw-r--r-- | src/sound-service.h | 11 | ||||
-rw-r--r-- | src/sound-service.xml | 10 | ||||
-rw-r--r-- | tests/Makefile.am | 95 | ||||
-rw-r--r-- | tests/Makefile.in | 870 | ||||
-rw-r--r-- | tests/test-defines.h | 24 | ||||
-rw-r--r-- | tests/test-indicator-sound-dbus-client.c | 112 | ||||
-rw-r--r-- | tests/test-indicator-sound-dbus-server.c | 63 | ||||
-rw-r--r-- | tests/test-indicator-sound.c | 101 |
27 files changed, 2128 insertions, 478 deletions
diff --git a/Makefile.am b/Makefile.am index 141bb71..357fa33 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,6 +2,7 @@ SUBDIRS = \ src \ data \ + tests \ po EXTRA_DIST = autogen.sh diff --git a/Makefile.in b/Makefile.in index 8470a61..f06eeb4 100644 --- a/Makefile.in +++ b/Makefile.in @@ -265,6 +265,7 @@ top_srcdir = @top_srcdir@ SUBDIRS = \ src \ data \ + tests \ po EXTRA_DIST = autogen.sh @@ -1,6 +1,8 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.65. +# Generated by GNU Autoconf 2.65 for indicator-sound 0.1.3. +# +# Report bugs to <conor.curran@canonical.com>. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -228,10 +230,11 @@ fi $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else - $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, -$0: including any error possibly output before this -$0: message. Then install a modern shell, or manually run -$0: the script under such a shell if you do have one." + $as_echo "$0: Please tell bug-autoconf@gnu.org and +$0: conor.curran@canonical.com about your system, including +$0: any error possibly output before this message. Then +$0: install a modern shell, or manually run the script +$0: under such a shell if you do have one." fi exit 1 fi @@ -696,14 +699,13 @@ MFLAGS= MAKEFLAGS= # Identity of this package. -PACKAGE_NAME= -PACKAGE_TARNAME= -PACKAGE_VERSION= -PACKAGE_STRING= -PACKAGE_BUGREPORT= -PACKAGE_URL= - -ac_unique_file="src/indicator-sound.c" +PACKAGE_NAME='indicator-sound' +PACKAGE_TARNAME='indicator-sound' +PACKAGE_VERSION='0.1.3' +PACKAGE_STRING='indicator-sound 0.1.3' +PACKAGE_BUGREPORT='conor.curran@canonical.com' +PACKAGE_URL='' + # Factoring default headers for most tests. ac_includes_default="\ #include <stdio.h> @@ -987,7 +989,7 @@ sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' -docdir='${datarootdir}/doc/${PACKAGE}' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' @@ -1488,7 +1490,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures this package to adapt to many kinds of systems. +\`configure' configures indicator-sound 0.1.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1536,7 +1538,7 @@ Fine tuning of the installation directories: --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] + --docdir=DIR documentation root [DATAROOTDIR/doc/indicator-sound] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] @@ -1557,7 +1559,9 @@ _ACEOF fi if test -n "$ac_init_help"; then - + case $ac_init_help in + short | recursive ) echo "Configuration of indicator-sound 0.1.3:";; + esac cat <<\_ACEOF Optional Features: @@ -1616,7 +1620,7 @@ Some influential environment variables: Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. -Report bugs to the package provider. +Report bugs to <conor.curran@canonical.com>. _ACEOF ac_status=$? fi @@ -1679,7 +1683,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -configure +indicator-sound configure 0.1.3 generated by GNU Autoconf 2.65 Copyright (C) 2009 Free Software Foundation, Inc. @@ -2024,6 +2028,12 @@ $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} +( cat <<\_ASBOX +## ----------------------------------------- ## +## Report this to conor.curran@canonical.com ## +## ----------------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 @@ -2044,7 +2054,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by $as_me, which was +It was created by indicator-sound $as_me 0.1.3, which was generated by GNU Autoconf 2.65. Invocation command line was $ $0 $@ @@ -2857,7 +2867,7 @@ fi # Define the identity of the package. PACKAGE=indicator-sound - VERSION=0.1.2 + VERSION=0.1.3 cat >>confdefs.h <<_ACEOF @@ -6241,13 +6251,13 @@ if test "${lt_cv_nm_interface+set}" = set; then : else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:6244: $ac_compile\"" >&5) + (eval echo "\"\$as_me:6254: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:6247: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:6257: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:6250: output\"" >&5) + (eval echo "\"\$as_me:6260: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -7452,7 +7462,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 7455 "configure"' > conftest.$ac_ext + echo '#line 7465 "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -8732,11 +8742,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8735: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8745: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:8739: \$? = $ac_status" >&5 + echo "$as_me:8749: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -9071,11 +9081,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:9074: $lt_compile\"" >&5) + (eval echo "\"\$as_me:9084: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:9078: \$? = $ac_status" >&5 + echo "$as_me:9088: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -9176,11 +9186,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:9179: $lt_compile\"" >&5) + (eval echo "\"\$as_me:9189: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:9183: \$? = $ac_status" >&5 + echo "$as_me:9193: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -9231,11 +9241,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:9234: $lt_compile\"" >&5) + (eval echo "\"\$as_me:9244: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:9238: \$? = $ac_status" >&5 + echo "$as_me:9248: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -11615,7 +11625,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11618 "configure" +#line 11628 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11711,7 +11721,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11714 "configure" +#line 11724 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -13289,7 +13299,7 @@ $as_echo "$LINGUAS" >&6; } # Files ########################### -ac_config_files="$ac_config_files Makefile src/Makefile data/Makefile po/Makefile.in" +ac_config_files="$ac_config_files Makefile src/Makefile data/Makefile tests/Makefile po/Makefile.in" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -13828,7 +13838,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by $as_me, which was +This file was extended by indicator-sound $as_me 0.1.3, which was generated by GNU Autoconf 2.65. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -13888,13 +13898,13 @@ $config_headers Configuration commands: $config_commands -Report bugs to the package provider." +Report bugs to <conor.curran@canonical.com>." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -config.status +indicator-sound config.status 0.1.3 configured by $0, generated by GNU Autoconf 2.65, with options \\"\$ac_cs_config\\" @@ -14280,6 +14290,7 @@ do "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "data/Makefile") CONFIG_FILES="$CONFIG_FILES data/Makefile" ;; + "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; "po/Makefile.in") CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;; "po/stamp-it") CONFIG_COMMANDS="$CONFIG_COMMANDS po/stamp-it" ;; diff --git a/configure.ac b/configure.ac index 157e650..080303c 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,10 @@ -AC_INIT(src/indicator-sound.c) +AC_INIT(indicator-sound, 0.1.3, conor.curran@canonical.com) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(indicator-sound, 0.1.2) +AM_INIT_AUTOMAKE(indicator-sound, 0.1.3) AM_MAINTAINER_MODE @@ -127,6 +127,7 @@ AC_OUTPUT([ Makefile src/Makefile data/Makefile +tests/Makefile po/Makefile.in ]) diff --git a/src/Makefile.am b/src/Makefile.am index 543ec58..73bb259 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -8,11 +8,10 @@ soundmenulibdir = $(INDICATORDIR) soundmenulib_LTLIBRARIES = libsoundmenu.la libsoundmenu_la_SOURCES = \ common-defs.h \ + indicator-sound.h \ indicator-sound.c \ dbus-shared-names.h \ - sound-service-client.h \ - sound-service-marshal.c \ - sound-service-marshal.h + sound-service-client.h libsoundmenu_la_CFLAGS = $(APPLET_CFLAGS) -Wall -Werror libsoundmenu_la_LIBADD = $(APPLET_LIBS) @@ -29,16 +28,6 @@ sound-service-client.h: $(srcdir)/sound-service.xml --output=sound-service-client.h \ $(srcdir)/sound-service.xml -sound-service-marshal.h: $(srcdir)/sound-service.list - glib-genmarshal --header \ - --prefix=_sound_service_marshal $(srcdir)/sound-service.list \ - > sound-service-marshal.h - -sound-service-marshal.c: $(srcdir)/sound-service.list - glib-genmarshal --body \ - --prefix=_sound_service_marshal $(srcdir)/sound-service.list \ - > sound-service-marshal.c - ################# # Session Stuff @@ -47,6 +36,8 @@ indicator_sound_service_SOURCES = \ common-defs.h \ sound-service.h \ sound-service.c \ + dbus-menu-manager.c \ + dbus-menu-manager.h \ pulse-manager.h \ pulse-manager.c \ sound-service-dbus.h \ @@ -71,9 +62,7 @@ sound-service-server.h: $(srcdir)/sound-service.xml ############### BUILT_SOURCES = \ sound-service-client.h \ - sound-service-server.h \ - sound-service-marshal.h \ - sound-service-marshal.c + sound-service-server.h EXTRA_DIST = \ sound-service.xml \ diff --git a/src/Makefile.in b/src/Makefile.in index ada23f9..37b1e9c 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -75,8 +75,7 @@ am__installdirs = "$(DESTDIR)$(soundmenulibdir)" \ LTLIBRARIES = $(soundmenulib_LTLIBRARIES) am__DEPENDENCIES_1 = libsoundmenu_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am_libsoundmenu_la_OBJECTS = libsoundmenu_la-indicator-sound.lo \ - libsoundmenu_la-sound-service-marshal.lo +am_libsoundmenu_la_OBJECTS = libsoundmenu_la-indicator-sound.lo libsoundmenu_la_OBJECTS = $(am_libsoundmenu_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) @@ -88,6 +87,7 @@ libsoundmenu_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ PROGRAMS = $(libexec_PROGRAMS) am_indicator_sound_service_OBJECTS = \ indicator_sound_service-sound-service.$(OBJEXT) \ + indicator_sound_service-dbus-menu-manager.$(OBJEXT) \ indicator_sound_service-pulse-manager.$(OBJEXT) \ indicator_sound_service-sound-service-dbus.$(OBJEXT) \ indicator_sound_service-sound-service-marshal.$(OBJEXT) \ @@ -292,11 +292,10 @@ soundmenulibdir = $(INDICATORDIR) soundmenulib_LTLIBRARIES = libsoundmenu.la libsoundmenu_la_SOURCES = \ common-defs.h \ + indicator-sound.h \ indicator-sound.c \ dbus-shared-names.h \ - sound-service-client.h \ - sound-service-marshal.c \ - sound-service-marshal.h + sound-service-client.h libsoundmenu_la_CFLAGS = $(APPLET_CFLAGS) -Wall -Werror libsoundmenu_la_LIBADD = $(APPLET_LIBS) @@ -309,6 +308,8 @@ indicator_sound_service_SOURCES = \ common-defs.h \ sound-service.h \ sound-service.c \ + dbus-menu-manager.c \ + dbus-menu-manager.h \ pulse-manager.h \ pulse-manager.c \ sound-service-dbus.h \ @@ -327,9 +328,7 @@ indicator_sound_service_LDADD = $(SOUNDSERVICE_LIBS) $(GCONF_LIBS) ############### BUILT_SOURCES = \ sound-service-client.h \ - sound-service-server.h \ - sound-service-marshal.h \ - sound-service-marshal.c + sound-service-server.h EXTRA_DIST = \ sound-service.xml \ @@ -459,13 +458,13 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_sound_service-dbus-menu-manager.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_sound_service-pulse-manager.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_sound_service-slider-menu-item.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_sound_service-sound-service-dbus.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_sound_service-sound-service-marshal.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_sound_service-sound-service.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsoundmenu_la-indicator-sound.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsoundmenu_la-sound-service-marshal.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -499,14 +498,6 @@ libsoundmenu_la-indicator-sound.lo: indicator-sound.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-indicator-sound.lo `test -f 'indicator-sound.c' || echo '$(srcdir)/'`indicator-sound.c -libsoundmenu_la-sound-service-marshal.lo: sound-service-marshal.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-sound-service-marshal.lo -MD -MP -MF $(DEPDIR)/libsoundmenu_la-sound-service-marshal.Tpo -c -o libsoundmenu_la-sound-service-marshal.lo `test -f 'sound-service-marshal.c' || echo '$(srcdir)/'`sound-service-marshal.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsoundmenu_la-sound-service-marshal.Tpo $(DEPDIR)/libsoundmenu_la-sound-service-marshal.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sound-service-marshal.c' object='libsoundmenu_la-sound-service-marshal.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-sound-service-marshal.lo `test -f 'sound-service-marshal.c' || echo '$(srcdir)/'`sound-service-marshal.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 @@ -523,6 +514,22 @@ indicator_sound_service-sound-service.obj: sound-service.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-sound-service.obj `if test -f 'sound-service.c'; then $(CYGPATH_W) 'sound-service.c'; else $(CYGPATH_W) '$(srcdir)/sound-service.c'; fi` +indicator_sound_service-dbus-menu-manager.o: dbus-menu-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -MT indicator_sound_service-dbus-menu-manager.o -MD -MP -MF $(DEPDIR)/indicator_sound_service-dbus-menu-manager.Tpo -c -o indicator_sound_service-dbus-menu-manager.o `test -f 'dbus-menu-manager.c' || echo '$(srcdir)/'`dbus-menu-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-dbus-menu-manager.Tpo $(DEPDIR)/indicator_sound_service-dbus-menu-manager.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dbus-menu-manager.c' object='indicator_sound_service-dbus-menu-manager.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -c -o indicator_sound_service-dbus-menu-manager.o `test -f 'dbus-menu-manager.c' || echo '$(srcdir)/'`dbus-menu-manager.c + +indicator_sound_service-dbus-menu-manager.obj: dbus-menu-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -MT indicator_sound_service-dbus-menu-manager.obj -MD -MP -MF $(DEPDIR)/indicator_sound_service-dbus-menu-manager.Tpo -c -o indicator_sound_service-dbus-menu-manager.obj `if test -f 'dbus-menu-manager.c'; then $(CYGPATH_W) 'dbus-menu-manager.c'; else $(CYGPATH_W) '$(srcdir)/dbus-menu-manager.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-dbus-menu-manager.Tpo $(DEPDIR)/indicator_sound_service-dbus-menu-manager.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dbus-menu-manager.c' object='indicator_sound_service-dbus-menu-manager.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -c -o indicator_sound_service-dbus-menu-manager.obj `if test -f 'dbus-menu-manager.c'; then $(CYGPATH_W) 'dbus-menu-manager.c'; else $(CYGPATH_W) '$(srcdir)/dbus-menu-manager.c'; fi` + indicator_sound_service-pulse-manager.o: pulse-manager.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_sound_service_CFLAGS) $(CFLAGS) -MT indicator_sound_service-pulse-manager.o -MD -MP -MF $(DEPDIR)/indicator_sound_service-pulse-manager.Tpo -c -o indicator_sound_service-pulse-manager.o `test -f 'pulse-manager.c' || echo '$(srcdir)/'`pulse-manager.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_sound_service-pulse-manager.Tpo $(DEPDIR)/indicator_sound_service-pulse-manager.Po @@ -813,16 +820,6 @@ sound-service-client.h: $(srcdir)/sound-service.xml --output=sound-service-client.h \ $(srcdir)/sound-service.xml -sound-service-marshal.h: $(srcdir)/sound-service.list - glib-genmarshal --header \ - --prefix=_sound_service_marshal $(srcdir)/sound-service.list \ - > sound-service-marshal.h - -sound-service-marshal.c: $(srcdir)/sound-service.list - glib-genmarshal --body \ - --prefix=_sound_service_marshal $(srcdir)/sound-service.list \ - > sound-service-marshal.c - sound-service-server.h: $(srcdir)/sound-service.xml dbus-binding-tool \ --prefix=_sound_service_server \ diff --git a/src/common-defs.h b/src/common-defs.h index 942e269..9be1da5 100644 --- a/src/common-defs.h +++ b/src/common-defs.h @@ -22,6 +22,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #define SIGNAL_SINK_INPUT_WHILE_MUTED "SinkInputWhileMuted" #define SIGNAL_SINK_VOLUME_UPDATE "SinkVolumeUpdate" #define SIGNAL_SINK_MUTE_UPDATE "SinkMuteUpdate" +#define SIGNAL_SINK_AVAILABLE_UPDATE "SinkAvailableUpdate" // DBUS items #define DBUSMENU_SLIDER_MENUITEM_TYPE "x-canonical-ido-slider-item" diff --git a/src/dbus-menu-manager.c b/src/dbus-menu-manager.c new file mode 100644 index 0000000..64f7108 --- /dev/null +++ b/src/dbus-menu-manager.c @@ -0,0 +1,241 @@ +/* +This service primarily controls PulseAudio and is driven by the sound indicator menu on the panel. +Copyright 2010 Canonical Ltd. + +Authors: + Conor Curran <conor.curran@canonical.com> + +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published +by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include <unistd.h> +#include <glib/gi18n.h> + +#include <dbus/dbus-glib.h> +#include <dbus/dbus-glib-bindings.h> + +#include <libdbusmenu-glib/server.h> +#include <libdbusmenu-glib/menuitem.h> +#include <libdbusmenu-glib/client.h> + +#include "dbus-menu-manager.h" +#include "sound-service-dbus.h" +#include "pulse-manager.h" +#include "slider-menu-item.h" + +#include "dbus-shared-names.h" + +// DBUS items +static DbusmenuMenuitem *root_menuitem = NULL; +static DbusmenuMenuitem *mute_all_menuitem = NULL; +static SliderMenuItem *volume_slider_menuitem = NULL; +static SoundServiceDbus *dbus_interface = NULL; + +// PULSEAUDIO +static gboolean b_sink_available = FALSE; +static gboolean b_all_muted = FALSE; +static gboolean b_pulse_ready = FALSE; +static gboolean b_startup = TRUE; +static gdouble volume_percent = 0.0; + +static void set_global_mute_from_ui(); +static gboolean idle_routine (gpointer data); +static void rebuild_sound_menu(DbusmenuMenuitem *root, SoundServiceDbus *service); +static void refresh_menu(); + +/*-------------------------------------------------------------------------*/ +// Public Methods +/*-------------------------------------------------------------------------*/ + +/** +setup: +**/ +void dbus_menu_manager_setup() +{ + root_menuitem = dbusmenu_menuitem_new(); + g_debug("Root ID: %d", dbusmenu_menuitem_get_id(root_menuitem)); + + g_idle_add(idle_routine, root_menuitem); + + dbus_interface = g_object_new(SOUND_SERVICE_DBUS_TYPE, NULL); + + DbusmenuServer *server = dbusmenu_server_new(INDICATOR_SOUND_DBUS_OBJECT); + dbusmenu_server_set_root(server, root_menuitem); + establish_pulse_activities(dbus_interface); +} + +/** +teardown: +**/ +void dbus_menu_manager_teardown() +{ + //TODO tidy up dbus_interface and items! +} + +/** +update_pa_state: +**/ +void dbus_menu_manager_update_pa_state(gboolean pa_state, gboolean sink_available, gboolean sink_muted, gdouble percent) +{ + b_sink_available = sink_available; + b_all_muted = sink_muted; + b_pulse_ready = pa_state; + volume_percent = percent; + g_debug("update pa state with state %i, availability of %i, mute value of %i and a volume percent is %f", pa_state, sink_available, sink_muted, volume_percent); + // Only rebuild the menu on start up... + if(b_startup == TRUE){ + rebuild_sound_menu(root_menuitem, dbus_interface); + b_startup = FALSE; + } + else{ + refresh_menu(); + } + // 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); + sound_service_dbus_update_sink_mute(dbus_interface, sink_muted); + dbus_menu_manager_update_mute_ui(b_all_muted); +} + +/** +update_mute_ui: +'public' method allowing the pa manager to update the mute menu item. +**/ +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")); +} + + +/*-------------------------------------------------------------------------*/ +// Private Methods +/*-------------------------------------------------------------------------*/ + +static void refresh_menu() +{ + g_debug("in the refresh menu method"); + if(b_sink_available == FALSE || b_pulse_ready == FALSE) + { + + dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(volume_slider_menuitem), + DBUSMENU_MENUITEM_PROP_ENABLED, + FALSE); + dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(volume_slider_menuitem), + DBUSMENU_MENUITEM_PROP_VISIBLE, + FALSE); + dbusmenu_menuitem_property_set_bool(mute_all_menuitem, + DBUSMENU_MENUITEM_PROP_ENABLED, + FALSE); + + } + else if(b_sink_available == TRUE && b_pulse_ready == TRUE){ + + dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(volume_slider_menuitem), + DBUSMENU_MENUITEM_PROP_ENABLED, + TRUE); + dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(volume_slider_menuitem), + DBUSMENU_MENUITEM_PROP_VISIBLE, + TRUE); + dbusmenu_menuitem_property_set_bool(mute_all_menuitem, + DBUSMENU_MENUITEM_PROP_ENABLED, + TRUE); + } +/* if(b_all_muted == TRUE){*/ +/* dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(volume_slider_menuitem), */ +/* DBUSMENU_MENUITEM_PROP_ENABLED,*/ +/* FALSE); */ +/* }*/ +} + + + +/** +idle_routine: +Something for glip mainloop to do when idle +**/ +static gboolean idle_routine (gpointer data) +{ + return FALSE; +} + + + +/** +show_sound_settings_dialog: +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)) + { + g_warning("Unable to show dialog: %s", error->message); + g_error_free(error); + } +} + +/** +rebuild_sound_menu: +Build the DBus menu items, mute/unmute, slider, separator and sound preferences 'link' +**/ +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")); + 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); + + // Slider + volume_slider_menuitem = slider_menu_item_new(b_sink_available, volume_percent); + dbusmenu_menuitem_child_append(root, mute_all_menuitem); + dbusmenu_menuitem_child_append(root, DBUSMENU_MENUITEM(volume_slider_menuitem)); + dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(volume_slider_menuitem), + DBUSMENU_MENUITEM_PROP_ENABLED, + b_sink_available && !b_all_muted); + g_debug("!!!!!!**in the rebuild sound menu - slider active = %i", b_sink_available && !b_all_muted); + dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(volume_slider_menuitem), + DBUSMENU_MENUITEM_PROP_VISIBLE, + b_sink_available); + // Separator + DbusmenuMenuitem *separator = dbusmenu_menuitem_new(); + dbusmenu_menuitem_property_set(separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR); + dbusmenu_menuitem_child_append(root, separator); + + // Sound preferences dialog + DbusmenuMenuitem *settings_mi = dbusmenu_menuitem_new(); + dbusmenu_menuitem_property_set(settings_mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Sound Preferences...")); +//_("Sound Preferences...")); + dbusmenu_menuitem_child_append(root, settings_mi); + g_signal_connect(G_OBJECT(settings_mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, + G_CALLBACK(show_sound_settings_dialog), NULL); +} + +/** +set_global_mute_from_ui: +Callback for the dbusmenuitem button +**/ +static void set_global_mute_from_ui() +{ + b_all_muted = !b_all_muted; + toggle_global_mute(b_all_muted); + dbusmenu_menuitem_property_set(mute_all_menuitem, + DBUSMENU_MENUITEM_PROP_LABEL, + _(b_all_muted == FALSE ? "Mute All" : "Unmute")); +} + + diff --git a/src/dbus-menu-manager.h b/src/dbus-menu-manager.h new file mode 100644 index 0000000..5f49e5f --- /dev/null +++ b/src/dbus-menu-manager.h @@ -0,0 +1,31 @@ +#ifndef __INCLUDE_DBUS_MENU_MANAGER_H__ +#define __INCLUDE_DBUS_MENU_MANAGER_H__ + +/* +This handles the management of the dbusmeneu items. +Copyright 2010 Canonical Ltd. + +Authors: + Conor Curran <conor.curran@canonical.com> + +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published +by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +void dbus_menu_manager_setup(); +void dbus_menu_manager_teardown(); +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); + +#endif + diff --git a/src/indicator-sound.c b/src/indicator-sound.c index 1301916..aecbe7a 100644 --- a/src/indicator-sound.c +++ b/src/indicator-sound.c @@ -5,7 +5,7 @@ into the gnome-panel using it's applet interface. Copyright 2010 Canonical Ltd. Authors: - Conor Curran <conor.curra@canonical.com> + Conor Curran <conor.curran@canonical.com> Ted Gould <ted@canonical.com> This program is free software: you can redistribute it and/or modify it @@ -34,8 +34,9 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <libindicator/indicator.h> #include <libindicator/indicator-object.h> #include <libindicator/indicator-service-manager.h> +#include <libindicator/indicator-image-helper.h> - +#include "indicator-sound.h" #include "dbus-shared-names.h" #include "sound-service-client.h" #include "common-defs.h" @@ -78,14 +79,16 @@ 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); + //Slider related static GtkWidget *volume_slider = NULL; static gboolean new_slider_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client); -static void slider_prop_change_cb (DbusmenuMenuitem * mi, gchar * prop, GValue * value, GtkWidget *widget); -// Alternative callback mechanism, may use this again once ido is updated. -/*static gboolean user_change_value_event_cb(GtkRange *range, GtkScrollType scroll_type, gdouble input_value, gpointer user_data);*/ +/*static void slider_prop_change_cb (DbusmenuMenuitem * mi, gchar * prop, GValue * value, GtkWidget *widget);*/ static gboolean value_changed_event_cb(GtkRange *range, gpointer user_data); static gboolean key_press_cb(GtkWidget* widget, GdkEventKey* event, gpointer data); +/*static void slider_size_allocate(GtkWidget *widget, GtkAllocation *allocation, gpointer user_data);*/ +static void slider_grabbed(GtkWidget *widget, gpointer user_data); +static void slider_released(GtkWidget *widget, gpointer user_data); // DBUS communication static DBusGProxy *sound_dbus_proxy = NULL; @@ -93,28 +96,41 @@ static void connection_changed (IndicatorServiceManager * sm, gboolean connected 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(); /****Volume States 'members' ***/ -static void prepare_state_machine(); -static void determine_state_from_volume(gdouble volume_percent); static void update_state(const gint state); + static const gint STATE_MUTED = 0; static const gint STATE_ZERO = 1; static const gint STATE_LOW = 2; 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 = 5; +static const gint STATE_SINKS_NONE = 6; + static GHashTable *volume_states = NULL; static GtkImage *speaker_image = NULL; -static GtkWidget* primary_image = NULL; static gint current_state = 0; static gint previous_state = 0; + static gdouble initial_volume_percent = 0; static gboolean initial_mute = FALSE; - +static gboolean device_available = TRUE; +static gboolean slider_in_direct_use = FALSE; + +#define DESIGN_TEAM_SIZE design_team_size +static GtkIconSize design_team_size; +static gint animation_id; +static GList * blocked_animation_list = NULL; +static GList * blocked_iter = NULL; +static void prepare_blocked_animation(); +static gboolean fade_back_to_mute_image(); + +// Construction static void indicator_sound_class_init (IndicatorSoundClass *klass) { @@ -127,46 +143,123 @@ indicator_sound_class_init (IndicatorSoundClass *klass) io_class->get_label = get_label; io_class->get_image = get_icon; io_class->get_menu = get_menu; + + design_team_size = gtk_icon_size_register("design-team-size", 22, 22); - dbus_g_object_register_marshaller (_sound_service_marshal_VOID__INT_BOOLEAN, - G_TYPE_NONE, - G_TYPE_INT, - G_TYPE_BOOLEAN, - G_TYPE_INVALID); return; } static void indicator_sound_init (IndicatorSound *self) { - /* Set good defaults */ self->service = NULL; - /* Now let's fire these guys up. */ self->service = indicator_service_manager_new_version(INDICATOR_SOUND_DBUS_NAME, INDICATOR_SOUND_DBUS_VERSION); g_signal_connect(G_OBJECT(self->service), INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE, G_CALLBACK(connection_changed), self); prepare_state_machine(); + prepare_blocked_animation(); + animation_id = 0; return; } +static void +indicator_sound_dispose (GObject *object) +{ + IndicatorSound * self = INDICATOR_SOUND(object); -/* -Prepare states Array. -*/ -static void prepare_state_machine() + if (self->service != NULL) { + g_object_unref(G_OBJECT(self->service)); + self->service = NULL; + } + g_hash_table_destroy(volume_states); + g_list_foreach (blocked_animation_list, (GFunc)g_object_unref, NULL); + g_list_free(blocked_animation_list); + G_OBJECT_CLASS (indicator_sound_parent_class)->dispose (object); + return; +} + +static void +indicator_sound_finalize (GObject *object) { - // TODO we need three more images - volume_states = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, g_free); - g_hash_table_insert(volume_states, GINT_TO_POINTER(STATE_MUTED), g_strdup("audio-volume-muted-panel")); - g_hash_table_insert(volume_states, GINT_TO_POINTER(STATE_ZERO), g_strdup("audio-volume-zero-panel")); - g_hash_table_insert(volume_states, GINT_TO_POINTER(STATE_LOW), g_strdup("audio-volume-low-panel")); - g_hash_table_insert(volume_states, GINT_TO_POINTER(STATE_MEDIUM), g_strdup("audio-volume-medium-panel")); - g_hash_table_insert(volume_states, GINT_TO_POINTER(STATE_HIGH), g_strdup("audio-volume-high-panel")); - g_hash_table_insert(volume_states, GINT_TO_POINTER(STATE_MUTED_WHILE_INPUT), g_strdup("audio-volume-muted-blocking-panel")); - g_hash_table_insert(volume_states, GINT_TO_POINTER(STATE_SINKS_NONE), g_strdup("audio-output-none-panel")); + G_OBJECT_CLASS (indicator_sound_parent_class)->finalize (object); + return; +} + +static GtkLabel * +get_label (IndicatorObject * io) +{ + return NULL; +} + +static GtkImage * +get_icon (IndicatorObject * io) +{ + gchar* current_name = g_hash_table_lookup(volume_states, GINT_TO_POINTER(current_state)); + //g_debug("At start-up attempting to set the image to %s", current_name); + speaker_image = indicator_image_helper(current_name); + gtk_widget_show(GTK_WIDGET(speaker_image)); + return speaker_image; +} + +/* Indicator based function to get the menu for the whole + applet. This starts up asking for the parts of the menu + from the various services. */ +static GtkMenu * +get_menu (IndicatorObject * io) +{ + DbusmenuGtkMenu *menu = dbusmenu_gtkmenu_new(INDICATOR_SOUND_DBUS_NAME, INDICATOR_SOUND_DBUS_OBJECT); + DbusmenuGtkClient *client = dbusmenu_gtkmenu_get_client(menu); + dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_SLIDER_MENUITEM_TYPE, new_slider_item); + + // 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); + return GTK_MENU(menu); +} + + +/** +new_slider_item: +Create a new dBusMenu Slider item. +**/ +static gboolean new_slider_item(DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client) +{ + g_return_val_if_fail(DBUSMENU_IS_MENUITEM(newitem), FALSE); + g_return_val_if_fail(DBUSMENU_IS_GTKCLIENT(client), FALSE); + + volume_slider = ido_scale_menu_item_new_with_range ("Volume", initial_volume_percent, 0, 100, 0.5); + g_object_set(volume_slider, "reverse-scroll-events", TRUE, 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); + + 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, "size-allocate", G_CALLBACK(slider_size_allocate), 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); + gtk_widget_show_all(volume_slider); + + return TRUE; } static void connection_changed (IndicatorServiceManager * sm, gboolean connected, gpointer userdata) { + // TODO: This could be safer. if (connected) { if (sound_dbus_proxy == NULL) { GError * error = NULL; @@ -191,11 +284,14 @@ connection_changed (IndicatorServiceManager * sm, gboolean connected, gpointer u 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_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); // 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 { @@ -205,108 +301,86 @@ connection_changed (IndicatorServiceManager * sm, gboolean connected, gpointer u return; } -static void fetch_volume_percent_from_dbus() +/* +Prepare states Array. +*/ +void prepare_state_machine() { - 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); + volume_states = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, g_free); + g_hash_table_insert(volume_states, GINT_TO_POINTER(STATE_MUTED), g_strdup("audio-volume-muted-panel")); + g_hash_table_insert(volume_states, GINT_TO_POINTER(STATE_ZERO), g_strdup("audio-volume-low-zero-panel")); + g_hash_table_insert(volume_states, GINT_TO_POINTER(STATE_LOW), g_strdup("audio-volume-low-panel")); + g_hash_table_insert(volume_states, GINT_TO_POINTER(STATE_MEDIUM), g_strdup("audio-volume-medium-panel")); + g_hash_table_insert(volume_states, GINT_TO_POINTER(STATE_HIGH), g_strdup("audio-volume-high-panel")); + g_hash_table_insert(volume_states, GINT_TO_POINTER(STATE_MUTED_WHILE_INPUT), g_strdup("audio-volume-muted-blocking-panel")); + g_hash_table_insert(volume_states, GINT_TO_POINTER(STATE_SINKS_NONE), g_strdup("audio-output-none-panel")); } -static void fetch_mute_value_from_dbus() +/* +prepare_blocked_animation: +Prepares the array of images to be used in the blocked animation. +Only called at startup. +*/ +static void prepare_blocked_animation() { - GError * error = NULL; - gboolean *mute_input; - mute_input = g_new0(gboolean, 1); - org_ayatana_indicator_sound_get_sink_mute(sound_dbus_proxy, mute_input, &error); - if (error != NULL) { - g_warning("Unable to fetch MUTE at indicator start up: %s", error->message); + GError* error= NULL; + int i; + + gchar* blocked_name = g_hash_table_lookup(volume_states, GINT_TO_POINTER(STATE_MUTED_WHILE_INPUT)); + gchar* muted_name = g_hash_table_lookup(volume_states, GINT_TO_POINTER(STATE_MUTED)); + GtkIconTheme* theme = gtk_icon_theme_get_default(); + GdkPixbuf* mute_buf = gtk_icon_theme_load_icon(theme, + muted_name, + 22, + GTK_ICON_LOOKUP_GENERIC_FALLBACK, + &error); + if(error != NULL){ + g_error("indicator-sound : prepare_blocked_animation - %s", error->message); g_error_free(error); - g_free(mute_input); - return; - } - initial_mute = *mute_input; - if (initial_mute == TRUE) - update_state(STATE_MUTED); - g_free(mute_input); - g_debug("at the indicator start up and the MUTE returned from dbus method is %i", initial_mute); -} - -static void catch_signal_sink_input_while_muted(DBusGProxy * proxy, gboolean block_value, gpointer userdata) -{ - g_debug("signal caught - sink input while muted with value %i", block_value); -} - -static void catch_signal_sink_volume_update(DBusGProxy *proxy, gdouble volume_percent, gpointer userdata) -{ - 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); - gtk_range_set_value(range, volume_percent); - determine_state_from_volume(volume_percent); -} - -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) - { - update_state(STATE_MUTED); - } - g_debug("signal caught - sink mute update with mute value: %i", mute_value); - gtk_widget_set_sensitive(volume_slider, !mute_value); + return; + } + + GdkPixbuf* blocked_buf = gtk_icon_theme_load_icon(theme, blocked_name, + 22, + GTK_ICON_LOOKUP_GENERIC_FALLBACK, + &error); + if(error != NULL){ + g_error("indicator-sound : prepare_blocked_animation - %s", error->message); + g_error_free(error); + return; + } + // sample 22 snapshots - range : 0-256 + for(i = 0; i < 23; i++) + { + gdk_pixbuf_composite(mute_buf, blocked_buf, 0, 0, + gdk_pixbuf_get_width(mute_buf), + gdk_pixbuf_get_height(mute_buf), + 0, 0, 1, 1, GDK_INTERP_BILINEAR, MIN(255, i * 11)); + g_debug("creating blocking animation - alpha value = %i", MIN(255, i * 11)); + blocked_animation_list = g_list_append(blocked_animation_list, gdk_pixbuf_copy(blocked_buf)); + } } -static void -indicator_sound_dispose (GObject *object) +gint get_state() { - IndicatorSound * self = INDICATOR_SOUND(object); - - if (self->service != NULL) { - g_object_unref(G_OBJECT(self->service)); - self->service = NULL; - } - g_hash_table_destroy(volume_states); - G_OBJECT_CLASS (indicator_sound_parent_class)->dispose (object); - return; + return current_state; } -static void -indicator_sound_finalize (GObject *object) +gchar* get_state_image_name(gint state) { - G_OBJECT_CLASS (indicator_sound_parent_class)->finalize (object); - return; + return g_hash_table_lookup(volume_states, GINT_TO_POINTER(state)); } -static GtkLabel * -get_label (IndicatorObject * io) +void prepare_for_tests(IndicatorObject *io) { - return NULL; + prepare_state_machine(); + get_icon(io); } -static GtkImage * -get_icon (IndicatorObject * io) +void tidy_up_hash() { - gchar* current_name = g_hash_table_lookup(volume_states, GINT_TO_POINTER(current_state)); - g_debug("At start-up attempting to set the image to %s", current_name); - speaker_image = GTK_IMAGE(gtk_image_new_from_icon_name(current_name, GTK_ICON_SIZE_MENU)); - gtk_widget_show(GTK_WIDGET(speaker_image)); - return speaker_image; + g_hash_table_destroy(volume_states); } static void update_state(const gint state) @@ -319,22 +393,25 @@ static void update_state(const gint state) current_state = state; gchar* image_name = g_hash_table_lookup(volume_states, GINT_TO_POINTER(current_state)); - gtk_image_set_from_icon_name(speaker_image, image_name, GTK_ICON_SIZE_MENU); + GtkImage * tempimage = indicator_image_helper(image_name); + gtk_image_set_from_pixbuf(speaker_image, gtk_image_get_pixbuf(tempimage)); + g_object_ref_sink(tempimage); } -static void determine_state_from_volume(gdouble volume_percent) +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; if (volume_percent < 30.0 && volume_percent > 0){ state = STATE_LOW; } - else if(volume_percent < 70.0 && volume_percent > 30.0){ + else if(volume_percent < 70.0 && volume_percent >= 30.0){ state = STATE_MEDIUM; } - else if(volume_percent > 70.0){ + else if(volume_percent >= 70.0){ state = STATE_HIGH; } else if(volume_percent == 0.0){ @@ -344,70 +421,137 @@ static void determine_state_from_volume(gdouble volume_percent) } -/* Indicator based function to get the menu for the whole - applet. This starts up asking for the parts of the menu - from the various services. */ -static GtkMenu * -get_menu (IndicatorObject * io) +static void fetch_sink_availability_from_dbus() { - DbusmenuGtkMenu *menu = dbusmenu_gtkmenu_new(INDICATOR_SOUND_DBUS_NAME, INDICATOR_SOUND_DBUS_OBJECT); - DbusmenuGtkClient *client = dbusmenu_gtkmenu_get_client(menu); - dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_SLIDER_MENUITEM_TYPE, new_slider_item); - - // 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); + GError * error = NULL; + gboolean * available_input; + available_input = g_new0(gboolean, 1); + org_ayatana_indicator_sound_get_sink_availability(sound_dbus_proxy, available_input, &error); + if (error != NULL) { + g_warning("Unable to fetch AVAILABILITY at indicator start up: %s", error->message); + g_error_free(error); + g_free(available_input); + return; + } + device_available = *available_input; + if (device_available == FALSE) + update_state(STATE_SINKS_NONE); + g_free(available_input); + g_debug("IndicatorSound::fetch_sink_availability_from_dbus -> AVAILABILTY returned from dbus method is %i", device_available); - return GTK_MENU(menu); } -/** -new_slider_item: -Create a new dBusMenu Slider item, register the -**/ -static gboolean new_slider_item(DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client) +static void fetch_volume_percent_from_dbus() { - g_return_val_if_fail(DBUSMENU_IS_MENUITEM(newitem), FALSE); - g_return_val_if_fail(DBUSMENU_IS_GTKCLIENT(client), FALSE); - - volume_slider = ido_scale_menu_item_new_with_range ("Volume", initial_volume_percent, 0, 100, 0.5); - g_object_set(volume_slider, "reverse-scroll-events", TRUE, NULL); + 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); +} - GtkMenuItem *menu_volume_slider = GTK_MENU_ITEM(volume_slider); +static void fetch_mute_value_from_dbus() +{ + GError * error = NULL; + gboolean *mute_input; + mute_input = g_new0(gboolean, 1); + org_ayatana_indicator_sound_get_sink_mute(sound_dbus_proxy, mute_input, &error); + if (error != NULL) { + g_warning("Unable to fetch MUTE at indicator start up: %s", error->message); + g_error_free(error); + g_free(mute_input); + return; + } + initial_mute = *mute_input; + if (initial_mute == TRUE) + update_state(STATE_MUTED); + g_free(mute_input); + g_debug("at the indicator start up and the MUTE returned from dbus method is %i", initial_mute); +} - dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, menu_volume_slider, parent); - g_signal_connect(G_OBJECT(newitem), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK(slider_prop_change_cb), volume_slider); - - // register slider changes listening on the range - GtkWidget* slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)volume_slider); - g_signal_connect(slider, "value-changed", G_CALLBACK(value_changed_event_cb), newitem); - // alternative callback mechanism which i could use again at some point. -/* g_signal_connect(slider, "change-value", G_CALLBACK(user_change_value_event_cb), newitem); */ - - // Set images on the ido - primary_image = ido_scale_menu_item_get_primary_image((IdoScaleMenuItem*)volume_slider); - gtk_image_set_from_icon_name(GTK_IMAGE(primary_image), g_hash_table_lookup(volume_states, GINT_TO_POINTER(STATE_ZERO)), GTK_ICON_SIZE_MENU); - GtkWidget* secondary_image = ido_scale_menu_item_get_secondary_image((IdoScaleMenuItem*)volume_slider); - gtk_image_set_from_icon_name(GTK_IMAGE(secondary_image), g_hash_table_lookup(volume_states, GINT_TO_POINTER(STATE_HIGH)), GTK_ICON_SIZE_MENU); +static void catch_signal_sink_input_while_muted(DBusGProxy * proxy, gboolean block_value, gpointer userdata) +{ + g_debug("signal caught - sink input while muted with value %i", block_value); + if (block_value == 1 && animation_id == 0 ) { + // We can assume we are in the muted state ! + gchar* image_name = g_hash_table_lookup(volume_states, GINT_TO_POINTER(STATE_MUTED_WHILE_INPUT)); + GtkImage * tempimage = indicator_image_helper(image_name); + gtk_image_set_from_pixbuf(speaker_image, gtk_image_get_pixbuf(tempimage)); + g_object_ref_sink(tempimage); + + blocked_iter = blocked_animation_list; + animation_id = g_timeout_add_seconds(1, fade_back_to_mute_image, NULL); + } +} + +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; + } + else{ + animation_id = 0; + g_debug("exit from animation\n"); + return FALSE; + } +} - gtk_widget_show_all(volume_slider); +static void catch_signal_sink_volume_update(DBusGProxy *proxy, gdouble volume_percent, gpointer userdata) +{ + if (slider_in_direct_use != TRUE){ + 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); + gtk_range_set_value(range, volume_percent); + determine_state_from_volume(volume_percent); + } +} - return TRUE; +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 != FALSE) + { + update_state(STATE_MUTED); + } + else{ + if(animation_id != 0){ + g_debug("about to remove the animation_id callback from the mainloop!!**"); + g_source_remove(animation_id); + animation_id = 0; + } + } + g_debug("signal caught - sink mute update with mute value: %i", mute_value); + gtk_widget_set_sensitive(volume_slider, !mute_value); } -/** -slider_prop_change_cb: -Whenever we have a property change on a DbusmenuMenuitem this will be called. -**/ -static void slider_prop_change_cb (DbusmenuMenuitem * mi, gchar * prop, GValue * value, GtkWidget *widget) +static void catch_signal_sink_availability_update(DBusGProxy *proxy, gboolean available_value, gpointer userdata) { - g_debug("slider_prop_change_cb - dodgy updater "); - g_debug("about to set the slider to %f", g_value_get_double(value)); - GtkWidget* slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)volume_slider); - GtkRange* range = (GtkRange*)slider; - gtk_range_set_value(range, g_value_get_double(value)); - return; + device_available = available_value; + if (device_available == FALSE){ + update_state(STATE_SINKS_NONE); + } + g_debug("signal caught - sink availability update with value: %i", available_value); } + /** value_changed_event_cb: This callback will get triggered irregardless of whether its a user change or a programmatic change. @@ -427,6 +571,35 @@ static gboolean value_changed_event_cb(GtkRange *range, gpointer user_data) 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"); +} + + +/** +slider_size_allocate: +Callback on the size-allocate event on the slider item. +**/ +/*static void slider_size_allocate(GtkWidget *widget,*/ +/* GtkAllocation *allocation, */ +/* gpointer user_data)*/ +/*{*/ +/* g_print("Size allocate on slider (%dx%d)\n", allocation->width, allocation->height);*/ +/* if(allocation->width < 200){*/ +/* g_print("Attempting to resize the slider");*/ +/* gtk_widget_set_size_request(widget, 200, -1); */ +/* }*/ +/*}*/ + /** key_press_cb: **/ @@ -490,22 +663,4 @@ static gboolean key_press_cb(GtkWidget* widget, GdkEventKey* event, gpointer dat return digested; } -/** -This callback should only be called when the user actually drags the slider. -Turned off for now in favour of the non descriminating value-changed call back. -Once the grabbing listener is implemented on the slider may revert to using this. -Its another tool for filtering unwanted volume change updates. -**/ -/*static gboolean user_change_value_event_cb(GtkRange *range, GtkScrollType scroll_type, gdouble input_value, gpointer user_data)*/ -/*{*/ -/* DbusmenuMenuitem *item = (DbusmenuMenuitem*)user_data;*/ -/* gdouble clamped_input = CLAMP(input_value, 0, 100);*/ -/* GValue value = {0};*/ -/* g_debug("User input on SLIDER - = %f", clamped_input);*/ -/* g_value_init(&value, G_TYPE_DOUBLE);*/ -/* g_value_set_double(&value, clamped_input);*/ -/* dbusmenu_menuitem_handle_event (item, "slider_change", &value, 0);*/ -/* return FALSE; */ -/*} */ - diff --git a/src/indicator-sound.h b/src/indicator-sound.h new file mode 100644 index 0000000..e508390 --- /dev/null +++ b/src/indicator-sound.h @@ -0,0 +1,35 @@ +#ifndef __INCLUDE_INDICATOR_SOUND_H__ +#define __INCLUDE_INDICATOR_SOUND_H__ + +/* +A small wrapper utility to load indicators and put them as menu items +into the gnome-panel using it's applet interface. + +Copyright 2010 Canonical Ltd. + +Authors: + Conor Curran <conor.curra@canonical.com> + Ted Gould <ted@canonical.com> + +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published +by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +// Essentially these are all exported to faciltiate testing +void prepare_state_machine(); +void determine_state_from_volume(gdouble volume_percent); +gint get_state(); +gchar* get_state_image_name(gint state); +void prepare_for_tests(IndicatorObject * io); +void tidy_up_hash(); + +#endif diff --git a/src/pulse-manager.c b/src/pulse-manager.c index d5377bf..40add4e 100644 --- a/src/pulse-manager.c +++ b/src/pulse-manager.c @@ -26,8 +26,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <pulse/gccmacro.h> #include "pulse-manager.h" -#include "sound-service.h" - +#include "dbus-menu-manager.h" static GHashTable *sink_hash = NULL; static SoundServiceDbus *dbus_service = NULL; @@ -69,8 +68,7 @@ void establish_pulse_activities(SoundServiceDbus *service) // Establish event callback registration pa_context_set_state_callback(pulse_context, context_state_callback, NULL); // BUILD MENU ANYWHO - it will be updated - update_pa_state(FALSE, FALSE, FALSE, 0); - + dbus_menu_manager_update_pa_state(FALSE, FALSE, FALSE, 0); pa_context_connect(pulse_context, NULL, PA_CONTEXT_NOFAIL, NULL); } @@ -108,7 +106,7 @@ static void reconnect_to_pulse() sink_hash = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, destroy_sink_info); // Establish event callback registration pa_context_set_state_callback(pulse_context, context_state_callback, NULL); - update_pa_state(FALSE, FALSE, FALSE, 0); + dbus_menu_manager_update_pa_state(FALSE, FALSE, FALSE, 0); pa_context_connect(pulse_context, NULL, PA_CONTEXT_NOFAIL, NULL); } @@ -276,12 +274,15 @@ static void pulse_sink_info_callback(pa_context *c, const pa_sink_info *sink, in gboolean device_available = determine_sink_availability(); if(device_available == TRUE) { - update_pa_state(TRUE, device_available, default_sink_is_muted(), get_default_sink_volume()); + dbus_menu_manager_update_pa_state(TRUE, + device_available, + default_sink_is_muted(), + get_default_sink_volume()); } else{ //Update the indicator to show PA either is not ready or has no available sink g_warning("Cannot find a suitable default sink ..."); - update_pa_state(FALSE, device_available, TRUE, 0); + dbus_menu_manager_update_pa_state(FALSE, device_available, default_sink_is_muted(), get_default_sink_volume()); } } else{ @@ -322,7 +323,7 @@ static void pulse_default_sink_info_callback(pa_context *c, const pa_sink_info * } else { - update_pa_state(TRUE, determine_sink_availability(), default_sink_is_muted(), get_default_sink_volume()); + dbus_menu_manager_update_pa_state(TRUE, determine_sink_availability(), default_sink_is_muted(), get_default_sink_volume()); } } } @@ -385,7 +386,7 @@ static void update_sink_info(pa_context *c, const pa_sink_info *info, int eol, v { g_debug("Updating Mute from PA manager with mute = %i", s->mute); sound_service_dbus_update_sink_mute(dbus_service, s->mute); - update_mute_ui(s->mute); + dbus_menu_manager_update_mute_ui(s->mute); if(s->mute == FALSE){ pa_volume_t vol = pa_cvolume_avg(&s->volume); gdouble volume_percent = ((gdouble) vol * 100) / PA_VOLUME_NORM; @@ -397,6 +398,7 @@ static void update_sink_info(pa_context *c, const pa_sink_info *info, int eol, v } else { + sink_info *value; value = g_new0(sink_info, 1); value->index = value->device_index = info->index; @@ -410,7 +412,8 @@ static void update_sink_info(pa_context *c, const pa_sink_info *info, int eol, v value->channel_map = info->channel_map; g_hash_table_insert(sink_hash, GINT_TO_POINTER(value->index), value); g_debug("pulse-manager:update_sink_info -> After adding a new sink to our hash"); - } + sound_service_dbus_update_sink_availability(dbus_service, TRUE); + } } @@ -421,7 +424,7 @@ static void pulse_server_info_callback(pa_context *c, const pa_server_info *info if (info == NULL) { g_warning("No server - get the hell out of here"); - update_pa_state(FALSE, FALSE, TRUE, 0); + dbus_menu_manager_update_pa_state(FALSE, FALSE, TRUE, 0); pa_server_available = FALSE; return; } @@ -459,8 +462,11 @@ static void subscribed_events_callback(pa_context *c, enum pa_subscription_event g_debug("PA_SUBSCRIPTION_EVENT_SINK event triggered"); if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) { - //TODO handle the remove event => if its our default sink - update date pa state - } else + if(index == DEFAULT_SINK_INDEX) + g_debug("PA_SUBSCRIPTION_EVENT_SINK REMOVAL event triggered"); + sound_service_dbus_update_sink_availability(dbus_service, FALSE); + } + else { pa_operation_unref(pa_context_get_sink_info_by_index(c, index, update_sink_info, userdata)); } @@ -469,7 +475,7 @@ static void subscribed_events_callback(pa_context *c, enum pa_subscription_event g_debug("PA_SUBSCRIPTION_EVENT_SINK_INPUT event triggered!!"); if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) { - //TODO handle the remove event + //handle the remove event - not relevant for current design } else { diff --git a/src/pulse-manager.h b/src/pulse-manager.h index 1be5e44..e1777fb 100644 --- a/src/pulse-manager.h +++ b/src/pulse-manager.h @@ -1,3 +1,5 @@ +#ifndef __INCLUDE_PULSE_MANAGER_H__ +#define __INCLUDE_PULSE_MANAGER_H__ /* A small wrapper utility to load indicators and put them as menu items into the gnome-panel using it's applet interface. @@ -21,7 +23,6 @@ with this program. If not, see <http://www.gnu.org/licenses/>. */ - #include <pulse/pulseaudio.h> #include <glib.h> #include "sound-service-dbus.h" @@ -47,4 +48,5 @@ void set_sink_volume(gdouble percent); void toggle_global_mute(gboolean mute_value); void close_pulse_activites(); +#endif diff --git a/src/slider-menu-item.c b/src/slider-menu-item.c index ef3b1fa..a14f4f9 100644 --- a/src/slider-menu-item.c +++ b/src/slider-menu-item.c @@ -92,6 +92,7 @@ SliderMenuItem* slider_menu_item_new(gboolean sinks_available, gdouble start_vol 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_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 19a3b81..b3d50da 100644 --- a/src/sound-service-client.h +++ b/src/sound-service-client.h @@ -134,6 +134,44 @@ org_ayatana_indicator_sound_get_sink_mute_async (DBusGProxy *proxy, org_ayatana_ stuff->userdata = userdata; return dbus_g_proxy_begin_call (proxy, "GetSinkMute", org_ayatana_indicator_sound_get_sink_mute_async_callback, stuff, _dbus_glib_async_data_free, G_TYPE_INVALID); } +static +#ifdef G_HAVE_INLINE +inline +#endif +gboolean +org_ayatana_indicator_sound_get_sink_availability (DBusGProxy *proxy, gboolean* OUT_availability_input, GError **error) + +{ + return dbus_g_proxy_call (proxy, "GetSinkAvailability", error, G_TYPE_INVALID, G_TYPE_BOOLEAN, OUT_availability_input, G_TYPE_INVALID); +} + +typedef void (*org_ayatana_indicator_sound_get_sink_availability_reply) (DBusGProxy *proxy, gboolean OUT_availability_input, GError *error, gpointer userdata); + +static void +org_ayatana_indicator_sound_get_sink_availability_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) +{ + DBusGAsyncData *data = (DBusGAsyncData*) user_data; + GError *error = NULL; + gboolean OUT_availability_input; + dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_BOOLEAN, &OUT_availability_input, G_TYPE_INVALID); + (*(org_ayatana_indicator_sound_get_sink_availability_reply)data->cb) (proxy, OUT_availability_input, error, data->userdata); + return; +} + +static +#ifdef G_HAVE_INLINE +inline +#endif +DBusGProxyCall* +org_ayatana_indicator_sound_get_sink_availability_async (DBusGProxy *proxy, org_ayatana_indicator_sound_get_sink_availability_reply callback, gpointer userdata) + +{ + DBusGAsyncData *stuff; + stuff = g_slice_new (DBusGAsyncData); + stuff->cb = G_CALLBACK (callback); + stuff->userdata = userdata; + return dbus_g_proxy_begin_call (proxy, "GetSinkAvailability", org_ayatana_indicator_sound_get_sink_availability_async_callback, stuff, _dbus_glib_async_data_free, G_TYPE_INVALID); +} #endif /* defined DBUS_GLIB_CLIENT_WRAPPERS_org_ayatana_indicator_sound */ G_END_DECLS diff --git a/src/sound-service-dbus.c b/src/sound-service-dbus.c index 99a9d34..1cc5f0d 100644 --- a/src/sound-service-dbus.c +++ b/src/sound-service-dbus.c @@ -29,10 +29,10 @@ #include "sound-service-marshal.h" #include "pulse-manager.h" -// DBUS methods - -// TODO - other should be static and moved from the header to here +// 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" @@ -41,18 +41,19 @@ typedef struct _SoundServiceDbusPrivate SoundServiceDbusPrivate; struct _SoundServiceDbusPrivate { - DBusGConnection *system_bus; DBusGConnection *connection; gdouble volume_percent; gboolean mute; + gboolean sink_availability; }; /* Signals */ enum { - SINK_INPUT_WHILE_MUTED, + SINK_INPUT_WHILE_MUTED, SINK_VOLUME_UPDATE, SINK_MUTE_UPDATE, + SINK_AVAILABLE_UPDATE, LAST_SIGNAL }; @@ -107,6 +108,15 @@ sound_service_dbus_class_init (SoundServiceDbusClass *klass) NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN); + signals[SINK_AVAILABLE_UPDATE] = g_signal_new("sink-available-update", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + 0, + NULL, NULL, + g_cclosure_marshal_VOID__BOOLEAN, + G_TYPE_NONE, 1, G_TYPE_BOOLEAN); + + } @@ -116,25 +126,23 @@ sound_service_dbus_init (SoundServiceDbus *self) GError *error = NULL; SoundServiceDbusPrivate * priv = SOUND_SERVICE_DBUS_GET_PRIVATE(self); - priv->system_bus = NULL; priv->connection = NULL; priv->volume_percent = 0; + priv->mute = FALSE; + priv->sink_availability = FALSE; - /* Get the system bus */ - priv->system_bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error); - /* Put the object on DBus */ + /* Fetch the session bus */ priv->connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error); if (error != NULL) { - g_error("Unable to connect to the session bus when creating application indicator: %s", error->message); + g_error("sound-service-dbus:Unable to connect to the session bus when creating indicator sound service : %s", error->message); g_error_free(error); return; } + /* register the service on it */ dbus_g_connection_register_g_object(priv->connection, "/org/ayatana/indicator/sound/service", G_OBJECT(self)); - - return; } @@ -178,6 +186,14 @@ static gboolean sound_service_dbus_get_sink_mute (SoundServiceDbus *self, gboole return TRUE; } +static gboolean sound_service_dbus_get_sink_availability (SoundServiceDbus *self, gboolean *availability_input, GError** gerror) +{ + SoundServiceDbusPrivate *priv = SOUND_SERVICE_DBUS_GET_PRIVATE (self); + g_debug("Get sink availability - sound service dbus!, about to send over availability_value of %i", priv->sink_availability); + *availability_input = priv->sink_availability; + return TRUE; +} + /** SIGNALS Utility methods to emit signals from the service into the ether. @@ -216,5 +232,18 @@ void sound_service_dbus_update_sink_mute(SoundServiceDbus* obj, gboolean sink_mu priv->mute); } +void sound_service_dbus_update_sink_availability(SoundServiceDbus* obj, gboolean sink_availability) +{ + g_debug("Emitting signal: SINK_AVAILABILITY_UPDATE, with value %i", sink_availability); + + SoundServiceDbusPrivate *priv = SOUND_SERVICE_DBUS_GET_PRIVATE (obj); + priv->sink_availability = sink_availability; + + g_signal_emit(obj, + signals[SINK_AVAILABLE_UPDATE], + 0, + priv->sink_availability); +} + diff --git a/src/sound-service-dbus.h b/src/sound-service-dbus.h index ef0d7dd..ae4953e 100644 --- a/src/sound-service-dbus.h +++ b/src/sound-service-dbus.h @@ -49,10 +49,6 @@ struct _SoundServiceDbus { struct _SoundServiceDbusClass { GObjectClass parent_class; - /* Signals -> outward messages to the DBUS and beyond*/ - // TODO - ARE THESE NECESSARY ? - //void (* sink_input_while_muted) (SoundServiceDbus *self, gboolean block_value, gpointer sound_data); - //void (* sink_volume_update) (SoundServiceDbus *self, gdouble sink_volume, gpointer sound_data); }; GType sound_service_dbus_get_type (void) G_GNUC_CONST; @@ -60,6 +56,7 @@ GType sound_service_dbus_get_type (void) G_GNUC_CONST; 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); G_END_DECLS diff --git a/src/sound-service-server.h b/src/sound-service-server.h index f2bcdb2..2773619 100644 --- a/src/sound-service-server.h +++ b/src/sound-service-server.h @@ -156,14 +156,15 @@ 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 }, }; const DBusGObjectInfo dbus_glib__sound_service_server_object_info = { 0, dbus_glib__sound_service_server_methods, - 3, -"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\0\0", -"org.ayatana.indicator.sound\0SinkInputWhileMuted\0org.ayatana.indicator.sound\0SinkVolumeUpdate\0org.ayatana.indicator.sound\0SinkMuteUpdate\0\0", + 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", "\0" }; diff --git a/src/sound-service.c b/src/sound-service.c index 91b5af3..403b2b0 100644 --- a/src/sound-service.c +++ b/src/sound-service.c @@ -19,117 +19,24 @@ PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ + #include "sound-service.h" -#include "sound-service-dbus.h" +#include "dbus-menu-manager.h" #include "pulse-manager.h" -#include "slider-menu-item.h" -#include "common-defs.h" - -// GTK + DBUS static GMainLoop *mainloop = NULL; -static DbusmenuMenuitem *root_menuitem = NULL; -static DbusmenuMenuitem *mute_all_menuitem = NULL; -static SliderMenuItem *volume_slider_menuitem = NULL; -static SoundServiceDbus *dbus_interface = NULL; - -// PULSEAUDIO -static gboolean b_sink_available = FALSE; -static gboolean b_all_muted = FALSE; -static gboolean b_pulse_ready = FALSE; -static gboolean b_startup = TRUE; -static gdouble volume_percent = 0.0; - -static void set_global_mute_from_ui(); -static gboolean idle_routine (gpointer data); -static void rebuild_sound_menu(DbusmenuMenuitem *root, SoundServiceDbus *service); -static void refresh_menu(); + /**********************************************************************************************************************/ -// Init functions (GTK and DBUS) +// Init and exit functions /**********************************************************************************************************************/ -/** -Pass to the g_idle_add method - returning False will ensure that this method is never called again as it is removed as an event source. -**/ -static gboolean idle_routine (gpointer data) -{ - return FALSE; -} - -static void show_sound_settings_dialog (DbusmenuMenuitem *mi, gpointer user_data) -{ - GError * error = NULL; - if (!g_spawn_command_line_async("gnome-volume-control", &error)) - { - g_warning("Unable to show dialog: %s", error->message); - g_error_free(error); - } -} /** -rebuild_sound_menu: -Build the DBus menu items, mute/unmute, slider, separator and sound preferences 'link' +service_shutdown: +When the service interface starts to shutdown, we +should follow it. **/ -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")); - 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); - - // Slider - volume_slider_menuitem = slider_menu_item_new(b_sink_available, volume_percent); - dbusmenu_menuitem_child_append(root, mute_all_menuitem); - dbusmenu_menuitem_child_append(root, DBUSMENU_MENUITEM(volume_slider_menuitem)); - dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(volume_slider_menuitem), - DBUSMENU_MENUITEM_PROP_ENABLED, - b_sink_available); - dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(volume_slider_menuitem), - DBUSMENU_MENUITEM_PROP_VISIBLE, - b_sink_available); - // Separator - DbusmenuMenuitem *separator = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set(separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR); - dbusmenu_menuitem_child_append(root, separator); - - // Sound preferences dialog - DbusmenuMenuitem *settings_mi = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set(settings_mi, DBUSMENU_MENUITEM_PROP_LABEL, - _("Sound Preferences...")); - dbusmenu_menuitem_child_append(root, settings_mi); - g_signal_connect(G_OBJECT(settings_mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, - G_CALLBACK(show_sound_settings_dialog), NULL); -} -/** -update_mute_ui: -'public' method allowing the server to update the mute UI -**/ -void 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")); -} -/** -set_global_mute_from_ui: -Callback for the dbusmenuitem button -**/ -static void set_global_mute_from_ui() -{ - b_all_muted = !b_all_muted; - toggle_global_mute(b_all_muted); - dbusmenu_menuitem_property_set(mute_all_menuitem, - DBUSMENU_MENUITEM_PROP_LABEL, - _(b_all_muted == FALSE ? "Mute All" : "Unmute")); -} - - -/* When the service interface starts to shutdown, we - should follow it. - -*/ void service_shutdown (IndicatorService *service, gpointer user_data) { @@ -143,61 +50,10 @@ service_shutdown (IndicatorService *service, gpointer user_data) return; } -void update_pa_state(gboolean pa_state, gboolean sink_available, gboolean sink_muted, gdouble percent) -{ - b_sink_available = sink_available; - b_all_muted = sink_muted; - b_pulse_ready = pa_state; - volume_percent = percent; - g_debug("update pa state with state %i, availability of %i, mute value of %i and a volume percent is %f", pa_state, sink_available, sink_muted, volume_percent); - // Only rebuild the menu on start up... - if(b_startup == TRUE){ - rebuild_sound_menu(root_menuitem, dbus_interface); - b_startup = FALSE; - } - else{ - refresh_menu(); - } - // Emit the signals after the menus are setup/torn down - sound_service_dbus_update_sink_volume(dbus_interface, percent); - sound_service_dbus_update_sink_mute(dbus_interface, sink_muted); - -} - -static void refresh_menu() -{ - g_debug("in the refresh menu method"); - if(b_sink_available == FALSE || b_pulse_ready == FALSE) - { - - dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(volume_slider_menuitem), - DBUSMENU_MENUITEM_PROP_ENABLED, - FALSE); - dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(volume_slider_menuitem), - DBUSMENU_MENUITEM_PROP_VISIBLE, - FALSE); - dbusmenu_menuitem_property_set_bool(mute_all_menuitem, - DBUSMENU_MENUITEM_PROP_ENABLED, - FALSE); - - } - else if(b_sink_available == TRUE && b_pulse_ready == TRUE){ - - dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(volume_slider_menuitem), - DBUSMENU_MENUITEM_PROP_ENABLED, - TRUE); - dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(volume_slider_menuitem), - DBUSMENU_MENUITEM_PROP_VISIBLE, - TRUE); - dbusmenu_menuitem_property_set_bool(mute_all_menuitem, - DBUSMENU_MENUITEM_PROP_ENABLED, - TRUE); - } -} - -/* Main, is well, main. It brings everything up and throws - us into the mainloop of no return. Some refactoring needed.*/ +/** +main: +**/ int main (int argc, char ** argv) { @@ -213,16 +69,7 @@ main (int argc, char ** argv) INDICATOR_SERVICE_SIGNAL_SHUTDOWN, G_CALLBACK(service_shutdown), NULL); - root_menuitem = dbusmenu_menuitem_new(); - g_debug("Root ID: %d", dbusmenu_menuitem_get_id(root_menuitem)); - - g_idle_add(idle_routine, root_menuitem); - - dbus_interface = g_object_new(SOUND_SERVICE_DBUS_TYPE, NULL); - - DbusmenuServer *server = dbusmenu_server_new(INDICATOR_SOUND_DBUS_OBJECT); - dbusmenu_server_set_root(server, root_menuitem); - establish_pulse_activities(dbus_interface); + dbus_menu_manager_setup(); // Run the loop mainloop = g_main_loop_new(NULL, FALSE); diff --git a/src/sound-service.h b/src/sound-service.h index d36ea41..cefbf45 100644 --- a/src/sound-service.h +++ b/src/sound-service.h @@ -27,13 +27,6 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <unistd.h> #include <glib/gi18n.h> -#include <dbus/dbus-glib.h> -#include <dbus/dbus-glib-bindings.h> - -#include <libdbusmenu-glib/server.h> -#include <libdbusmenu-glib/menuitem.h> -#include <libdbusmenu-glib/client.h> - #include <libindicator/indicator-service.h> #include "dbus-shared-names.h" @@ -41,7 +34,5 @@ with this program. If not, see <http://www.gnu.org/licenses/>. // ENTRY AND EXIT POINTS void service_shutdown(IndicatorService * service, gpointer user_data); int main (int argc, char ** argv); -void update_pa_state(gboolean pa_state, gboolean sink_available, gboolean sink_muted, gdouble current_vol); -void update_mute_ui(gboolean incoming_mute_value); -#endif +#endif diff --git a/src/sound-service.xml b/src/sound-service.xml index 580f0e1..12ed03e 100644 --- a/src/sound-service.xml +++ b/src/sound-service.xml @@ -5,6 +5,7 @@ <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="sound_service_dbus_set_sink_volume"/> <arg type='u' name='volume_percent' direction="in"/> </method> + <method name = "GetSinkVolume"> <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="sound_service_dbus_get_sink_volume"/> <arg type='d' name='volume_percent_input' direction="out"/> @@ -15,6 +16,11 @@ <arg type='b' name='mute_input' direction="out"/> </method> + <method name = "GetSinkAvailability"> + <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="sound_service_dbus_get_sink_availability"/> + <arg type='b' name='availability_input' direction="out"/> + </method> + <!-- Will need to hook up another signal which monitors for volume change Our respective UI element should listen to this and therefore will be updated with accurate setting--> <!-- Triggered when a sink is muted but the input has been sent to that sink --> @@ -30,6 +36,10 @@ Our respective UI element should listen to this and therefore will be updated wi <arg name="mute_value" type="b" direction="out"/> </signal> + <signal name="SinkAvailableUpdate"> + <arg name="available_value" type="b" direction="out"/> + </signal> + </interface> </node> diff --git a/tests/Makefile.am b/tests/Makefile.am new file mode 100644 index 0000000..a0b990b --- /dev/null +++ b/tests/Makefile.am @@ -0,0 +1,95 @@ + +check_PROGRAMS = \ + test-indicator-sound \ + test-indicator-sound-dbus-client \ + test-indicator-sound-dbus-server + +TESTS = +DISTCLEANFILES = $(TESTS) + +######################################### +## test-indicator-sound +######################################### +test_indicator_sound_SOURCES = \ + test-indicator-sound.c \ + $(top_builddir)/src/indicator-sound.c + +test_indicator_sound_CFLAGS = \ + $(APPLET_CFLAGS) \ + -Wall -Werror \ + -I$(srcdir) \ + -DTOP_BUILD_DIR="\"${abs_top_builddir}\"" + +test_indicator_sound_LDADD = \ + $(APPLET_LIBS) + + +######################################### +## test-indicator-sound-dbus-client +######################################### +test_indicator_sound_dbus_client_SOURCES = \ + test-defines.h \ + test-indicator-sound-dbus-client.c + +test_indicator_sound_dbus_client_CFLAGS = \ + $(SOUNDSERVICE_CFLAGS) \ + -Wall -Werror \ + -I$(srcdir) + +test_indicator_sound_dbus_client_LDADD = \ + $(SOUNDSERVICE_LIBS) + +######################################## +# test-indicator-sound-dbus-server +######################################## +test_indicator_sound_dbus_server_SOURCES = \ + test-defines.h \ + test-indicator-sound-dbus-server.c \ + $(top_builddir)/src/sound-service-dbus.c \ + $(top_builddir)/src/pulse-manager.c \ + $(top_builddir)/src/slider-menu-item.c \ + $(top_builddir)/src/dbus-menu-manager.c + +test_indicator_sound_dbus_server_CFLAGS = \ + $(SOUNDSERVICE_CFLAGS) \ + -Wall -Werror \ + -I$(srcdir) + +test_indicator_sound_dbus_server_LDADD = \ + $(SOUNDSERVICE_LIBS) + + +######################################### +## Actual tests +######################################### + +XML_REPORT = indicator-sound-check-results.xml +HTML_REPORT = indicator-sound-check-results.html + +indicator-sound-tests: indicator-sound-tests-gtester Makefile.am + @echo "#!/bin/sh" > $@ + @echo $(DBUS_RUNNER) --task ./indicator-sound-tests-gtester >> $@ + @chmod +x $@ + +indicator-sound-tests-gtester: test-indicator-sound Makefile.am + @echo "#!/bin/sh" > $@ + @echo gtester -k --verbose -o=$(XML_REPORT) ./test-indicator-sound >> $@ + @chmod +x $@ + +TESTS += indicator-sound-tests + +DISTCLEANFILES += $(XML_REPORT) $(HTML_REPORT) indicator-sound-tests-gtester + +DBUS_RUNNER=dbus-test-runner --dbus-config /usr/share/dbus-test-runner/session.conf + +test-indicator-sound-dbus: test-indicator-sound-dbus-client test-indicator-sound-dbus-server Makefile.am + @echo "#!/bin/sh" > test-indicator-sound-dbus + @echo $(DBUS_RUNNER) --task ./test-indicator-sound-dbus-client --task-name Client --task ./test-indicator-sound-dbus-server --task-name Server --ignore-return >> test-indicator-sound-dbus + @chmod +x test-indicator-sound-dbus + +TESTS += test-indicator-sound-dbus + + + + + diff --git a/tests/Makefile.in b/tests/Makefile.in new file mode 100644 index 0000000..8b173b2 --- /dev/null +++ b/tests/Makefile.in @@ -0,0 +1,870 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +check_PROGRAMS = test-indicator-sound$(EXEEXT) \ + test-indicator-sound-dbus-client$(EXEEXT) \ + test-indicator-sound-dbus-server$(EXEEXT) +subdir = tests +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__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am_test_indicator_sound_OBJECTS = \ + test_indicator_sound-test-indicator-sound.$(OBJEXT) \ + test_indicator_sound-indicator-sound.$(OBJEXT) +test_indicator_sound_OBJECTS = $(am_test_indicator_sound_OBJECTS) +am__DEPENDENCIES_1 = +test_indicator_sound_DEPENDENCIES = $(am__DEPENDENCIES_1) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +test_indicator_sound_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_indicator_sound_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_test_indicator_sound_dbus_client_OBJECTS = test_indicator_sound_dbus_client-test-indicator-sound-dbus-client.$(OBJEXT) +test_indicator_sound_dbus_client_OBJECTS = \ + $(am_test_indicator_sound_dbus_client_OBJECTS) +test_indicator_sound_dbus_client_DEPENDENCIES = $(am__DEPENDENCIES_1) +test_indicator_sound_dbus_client_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_indicator_sound_dbus_client_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +am_test_indicator_sound_dbus_server_OBJECTS = test_indicator_sound_dbus_server-test-indicator-sound-dbus-server.$(OBJEXT) \ + test_indicator_sound_dbus_server-sound-service-dbus.$(OBJEXT) \ + test_indicator_sound_dbus_server-pulse-manager.$(OBJEXT) \ + test_indicator_sound_dbus_server-slider-menu-item.$(OBJEXT) \ + test_indicator_sound_dbus_server-dbus-menu-manager.$(OBJEXT) +test_indicator_sound_dbus_server_OBJECTS = \ + $(am_test_indicator_sound_dbus_server_OBJECTS) +test_indicator_sound_dbus_server_DEPENDENCIES = $(am__DEPENDENCIES_1) +test_indicator_sound_dbus_server_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_indicator_sound_dbus_server_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(test_indicator_sound_SOURCES) \ + $(test_indicator_sound_dbus_client_SOURCES) \ + $(test_indicator_sound_dbus_server_SOURCES) +DIST_SOURCES = $(test_indicator_sound_SOURCES) \ + $(test_indicator_sound_dbus_client_SOURCES) \ + $(test_indicator_sound_dbus_server_SOURCES) +ETAGS = etags +CTAGS = ctags +am__tty_colors = \ +red=; grn=; lgn=; blu=; std= +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +APPLET_CFLAGS = @APPLET_CFLAGS@ +APPLET_LIBS = @APPLET_LIBS@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DBUSSERVICEDIR = @DBUSSERVICEDIR@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GCONFTOOL = @GCONFTOOL@ +GCONF_CFLAGS = @GCONF_CFLAGS@ +GCONF_LIBS = @GCONF_LIBS@ +GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ +GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOMELOCALEDIR = @GNOMELOCALEDIR@ +GREP = @GREP@ +INDICATORDIR = @INDICATORDIR@ +INDICATORICONSDIR = @INDICATORICONSDIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +POFILES = @POFILES@ +POSUB = @POSUB@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOUNDERVICE_LIBS = @SOUNDERVICE_LIBS@ +SOUNDSERVICE_CFLAGS = @SOUNDSERVICE_CFLAGS@ +SOUNDSERVICE_LIBS = @SOUNDSERVICE_LIBS@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +TESTS = indicator-sound-tests test-indicator-sound-dbus +DISTCLEANFILES = $(TESTS) $(XML_REPORT) $(HTML_REPORT) \ + indicator-sound-tests-gtester + +######################################### +######################################### +test_indicator_sound_SOURCES = \ + test-indicator-sound.c \ + $(top_builddir)/src/indicator-sound.c + +test_indicator_sound_CFLAGS = \ + $(APPLET_CFLAGS) \ + -Wall -Werror \ + -I$(srcdir) \ + -DTOP_BUILD_DIR="\"${abs_top_builddir}\"" + +test_indicator_sound_LDADD = \ + $(APPLET_LIBS) + + +######################################### +######################################### +test_indicator_sound_dbus_client_SOURCES = \ + test-defines.h \ + test-indicator-sound-dbus-client.c + +test_indicator_sound_dbus_client_CFLAGS = \ + $(SOUNDSERVICE_CFLAGS) \ + -Wall -Werror \ + -I$(srcdir) + +test_indicator_sound_dbus_client_LDADD = \ + $(SOUNDSERVICE_LIBS) + + +######################################## +# test-indicator-sound-dbus-server +######################################## +test_indicator_sound_dbus_server_SOURCES = \ + test-defines.h \ + test-indicator-sound-dbus-server.c \ + $(top_builddir)/src/sound-service-dbus.c \ + $(top_builddir)/src/pulse-manager.c \ + $(top_builddir)/src/slider-menu-item.c \ + $(top_builddir)/src/dbus-menu-manager.c + +test_indicator_sound_dbus_server_CFLAGS = \ + $(SOUNDSERVICE_CFLAGS) \ + -Wall -Werror \ + -I$(srcdir) + +test_indicator_sound_dbus_server_LDADD = \ + $(SOUNDSERVICE_LIBS) + + +######################################### +######################################### +XML_REPORT = indicator-sound-check-results.xml +HTML_REPORT = indicator-sound-check-results.html +DBUS_RUNNER = dbus-test-runner --dbus-config /usr/share/dbus-test-runner/session.conf +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu tests/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +test-indicator-sound$(EXEEXT): $(test_indicator_sound_OBJECTS) $(test_indicator_sound_DEPENDENCIES) + @rm -f test-indicator-sound$(EXEEXT) + $(AM_V_CCLD)$(test_indicator_sound_LINK) $(test_indicator_sound_OBJECTS) $(test_indicator_sound_LDADD) $(LIBS) +test-indicator-sound-dbus-client$(EXEEXT): $(test_indicator_sound_dbus_client_OBJECTS) $(test_indicator_sound_dbus_client_DEPENDENCIES) + @rm -f test-indicator-sound-dbus-client$(EXEEXT) + $(AM_V_CCLD)$(test_indicator_sound_dbus_client_LINK) $(test_indicator_sound_dbus_client_OBJECTS) $(test_indicator_sound_dbus_client_LDADD) $(LIBS) +test-indicator-sound-dbus-server$(EXEEXT): $(test_indicator_sound_dbus_server_OBJECTS) $(test_indicator_sound_dbus_server_DEPENDENCIES) + @rm -f test-indicator-sound-dbus-server$(EXEEXT) + $(AM_V_CCLD)$(test_indicator_sound_dbus_server_LINK) $(test_indicator_sound_dbus_server_OBJECTS) $(test_indicator_sound_dbus_server_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_indicator_sound-indicator-sound.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_indicator_sound-test-indicator-sound.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_indicator_sound_dbus_client-test-indicator-sound-dbus-client.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_indicator_sound_dbus_server-dbus-menu-manager.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_indicator_sound_dbus_server-pulse-manager.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_indicator_sound_dbus_server-slider-menu-item.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_indicator_sound_dbus_server-sound-service-dbus.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_indicator_sound_dbus_server-test-indicator-sound-dbus-server.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +test_indicator_sound-test-indicator-sound.o: test-indicator-sound.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_indicator_sound_CFLAGS) $(CFLAGS) -MT test_indicator_sound-test-indicator-sound.o -MD -MP -MF $(DEPDIR)/test_indicator_sound-test-indicator-sound.Tpo -c -o test_indicator_sound-test-indicator-sound.o `test -f 'test-indicator-sound.c' || echo '$(srcdir)/'`test-indicator-sound.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_indicator_sound-test-indicator-sound.Tpo $(DEPDIR)/test_indicator_sound-test-indicator-sound.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test-indicator-sound.c' object='test_indicator_sound-test-indicator-sound.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) $(test_indicator_sound_CFLAGS) $(CFLAGS) -c -o test_indicator_sound-test-indicator-sound.o `test -f 'test-indicator-sound.c' || echo '$(srcdir)/'`test-indicator-sound.c + +test_indicator_sound-test-indicator-sound.obj: test-indicator-sound.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_indicator_sound_CFLAGS) $(CFLAGS) -MT test_indicator_sound-test-indicator-sound.obj -MD -MP -MF $(DEPDIR)/test_indicator_sound-test-indicator-sound.Tpo -c -o test_indicator_sound-test-indicator-sound.obj `if test -f 'test-indicator-sound.c'; then $(CYGPATH_W) 'test-indicator-sound.c'; else $(CYGPATH_W) '$(srcdir)/test-indicator-sound.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_indicator_sound-test-indicator-sound.Tpo $(DEPDIR)/test_indicator_sound-test-indicator-sound.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test-indicator-sound.c' object='test_indicator_sound-test-indicator-sound.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) $(test_indicator_sound_CFLAGS) $(CFLAGS) -c -o test_indicator_sound-test-indicator-sound.obj `if test -f 'test-indicator-sound.c'; then $(CYGPATH_W) 'test-indicator-sound.c'; else $(CYGPATH_W) '$(srcdir)/test-indicator-sound.c'; fi` + +test_indicator_sound-indicator-sound.o: $(top_builddir)/src/indicator-sound.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_indicator_sound_CFLAGS) $(CFLAGS) -MT test_indicator_sound-indicator-sound.o -MD -MP -MF $(DEPDIR)/test_indicator_sound-indicator-sound.Tpo -c -o test_indicator_sound-indicator-sound.o `test -f '$(top_builddir)/src/indicator-sound.c' || echo '$(srcdir)/'`$(top_builddir)/src/indicator-sound.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_indicator_sound-indicator-sound.Tpo $(DEPDIR)/test_indicator_sound-indicator-sound.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_builddir)/src/indicator-sound.c' object='test_indicator_sound-indicator-sound.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) $(test_indicator_sound_CFLAGS) $(CFLAGS) -c -o test_indicator_sound-indicator-sound.o `test -f '$(top_builddir)/src/indicator-sound.c' || echo '$(srcdir)/'`$(top_builddir)/src/indicator-sound.c + +test_indicator_sound-indicator-sound.obj: $(top_builddir)/src/indicator-sound.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_indicator_sound_CFLAGS) $(CFLAGS) -MT test_indicator_sound-indicator-sound.obj -MD -MP -MF $(DEPDIR)/test_indicator_sound-indicator-sound.Tpo -c -o test_indicator_sound-indicator-sound.obj `if test -f '$(top_builddir)/src/indicator-sound.c'; then $(CYGPATH_W) '$(top_builddir)/src/indicator-sound.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/src/indicator-sound.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_indicator_sound-indicator-sound.Tpo $(DEPDIR)/test_indicator_sound-indicator-sound.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_builddir)/src/indicator-sound.c' object='test_indicator_sound-indicator-sound.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) $(test_indicator_sound_CFLAGS) $(CFLAGS) -c -o test_indicator_sound-indicator-sound.obj `if test -f '$(top_builddir)/src/indicator-sound.c'; then $(CYGPATH_W) '$(top_builddir)/src/indicator-sound.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/src/indicator-sound.c'; fi` + +test_indicator_sound_dbus_client-test-indicator-sound-dbus-client.o: test-indicator-sound-dbus-client.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_indicator_sound_dbus_client_CFLAGS) $(CFLAGS) -MT test_indicator_sound_dbus_client-test-indicator-sound-dbus-client.o -MD -MP -MF $(DEPDIR)/test_indicator_sound_dbus_client-test-indicator-sound-dbus-client.Tpo -c -o test_indicator_sound_dbus_client-test-indicator-sound-dbus-client.o `test -f 'test-indicator-sound-dbus-client.c' || echo '$(srcdir)/'`test-indicator-sound-dbus-client.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_indicator_sound_dbus_client-test-indicator-sound-dbus-client.Tpo $(DEPDIR)/test_indicator_sound_dbus_client-test-indicator-sound-dbus-client.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test-indicator-sound-dbus-client.c' object='test_indicator_sound_dbus_client-test-indicator-sound-dbus-client.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) $(test_indicator_sound_dbus_client_CFLAGS) $(CFLAGS) -c -o test_indicator_sound_dbus_client-test-indicator-sound-dbus-client.o `test -f 'test-indicator-sound-dbus-client.c' || echo '$(srcdir)/'`test-indicator-sound-dbus-client.c + +test_indicator_sound_dbus_client-test-indicator-sound-dbus-client.obj: test-indicator-sound-dbus-client.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_indicator_sound_dbus_client_CFLAGS) $(CFLAGS) -MT test_indicator_sound_dbus_client-test-indicator-sound-dbus-client.obj -MD -MP -MF $(DEPDIR)/test_indicator_sound_dbus_client-test-indicator-sound-dbus-client.Tpo -c -o test_indicator_sound_dbus_client-test-indicator-sound-dbus-client.obj `if test -f 'test-indicator-sound-dbus-client.c'; then $(CYGPATH_W) 'test-indicator-sound-dbus-client.c'; else $(CYGPATH_W) '$(srcdir)/test-indicator-sound-dbus-client.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_indicator_sound_dbus_client-test-indicator-sound-dbus-client.Tpo $(DEPDIR)/test_indicator_sound_dbus_client-test-indicator-sound-dbus-client.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test-indicator-sound-dbus-client.c' object='test_indicator_sound_dbus_client-test-indicator-sound-dbus-client.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) $(test_indicator_sound_dbus_client_CFLAGS) $(CFLAGS) -c -o test_indicator_sound_dbus_client-test-indicator-sound-dbus-client.obj `if test -f 'test-indicator-sound-dbus-client.c'; then $(CYGPATH_W) 'test-indicator-sound-dbus-client.c'; else $(CYGPATH_W) '$(srcdir)/test-indicator-sound-dbus-client.c'; fi` + +test_indicator_sound_dbus_server-test-indicator-sound-dbus-server.o: test-indicator-sound-dbus-server.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_indicator_sound_dbus_server_CFLAGS) $(CFLAGS) -MT test_indicator_sound_dbus_server-test-indicator-sound-dbus-server.o -MD -MP -MF $(DEPDIR)/test_indicator_sound_dbus_server-test-indicator-sound-dbus-server.Tpo -c -o test_indicator_sound_dbus_server-test-indicator-sound-dbus-server.o `test -f 'test-indicator-sound-dbus-server.c' || echo '$(srcdir)/'`test-indicator-sound-dbus-server.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_indicator_sound_dbus_server-test-indicator-sound-dbus-server.Tpo $(DEPDIR)/test_indicator_sound_dbus_server-test-indicator-sound-dbus-server.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test-indicator-sound-dbus-server.c' object='test_indicator_sound_dbus_server-test-indicator-sound-dbus-server.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) $(test_indicator_sound_dbus_server_CFLAGS) $(CFLAGS) -c -o test_indicator_sound_dbus_server-test-indicator-sound-dbus-server.o `test -f 'test-indicator-sound-dbus-server.c' || echo '$(srcdir)/'`test-indicator-sound-dbus-server.c + +test_indicator_sound_dbus_server-test-indicator-sound-dbus-server.obj: test-indicator-sound-dbus-server.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_indicator_sound_dbus_server_CFLAGS) $(CFLAGS) -MT test_indicator_sound_dbus_server-test-indicator-sound-dbus-server.obj -MD -MP -MF $(DEPDIR)/test_indicator_sound_dbus_server-test-indicator-sound-dbus-server.Tpo -c -o test_indicator_sound_dbus_server-test-indicator-sound-dbus-server.obj `if test -f 'test-indicator-sound-dbus-server.c'; then $(CYGPATH_W) 'test-indicator-sound-dbus-server.c'; else $(CYGPATH_W) '$(srcdir)/test-indicator-sound-dbus-server.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_indicator_sound_dbus_server-test-indicator-sound-dbus-server.Tpo $(DEPDIR)/test_indicator_sound_dbus_server-test-indicator-sound-dbus-server.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test-indicator-sound-dbus-server.c' object='test_indicator_sound_dbus_server-test-indicator-sound-dbus-server.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) $(test_indicator_sound_dbus_server_CFLAGS) $(CFLAGS) -c -o test_indicator_sound_dbus_server-test-indicator-sound-dbus-server.obj `if test -f 'test-indicator-sound-dbus-server.c'; then $(CYGPATH_W) 'test-indicator-sound-dbus-server.c'; else $(CYGPATH_W) '$(srcdir)/test-indicator-sound-dbus-server.c'; fi` + +test_indicator_sound_dbus_server-sound-service-dbus.o: $(top_builddir)/src/sound-service-dbus.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_indicator_sound_dbus_server_CFLAGS) $(CFLAGS) -MT test_indicator_sound_dbus_server-sound-service-dbus.o -MD -MP -MF $(DEPDIR)/test_indicator_sound_dbus_server-sound-service-dbus.Tpo -c -o test_indicator_sound_dbus_server-sound-service-dbus.o `test -f '$(top_builddir)/src/sound-service-dbus.c' || echo '$(srcdir)/'`$(top_builddir)/src/sound-service-dbus.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_indicator_sound_dbus_server-sound-service-dbus.Tpo $(DEPDIR)/test_indicator_sound_dbus_server-sound-service-dbus.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_builddir)/src/sound-service-dbus.c' object='test_indicator_sound_dbus_server-sound-service-dbus.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_indicator_sound_dbus_server_CFLAGS) $(CFLAGS) -c -o test_indicator_sound_dbus_server-sound-service-dbus.o `test -f '$(top_builddir)/src/sound-service-dbus.c' || echo '$(srcdir)/'`$(top_builddir)/src/sound-service-dbus.c + +test_indicator_sound_dbus_server-sound-service-dbus.obj: $(top_builddir)/src/sound-service-dbus.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_indicator_sound_dbus_server_CFLAGS) $(CFLAGS) -MT test_indicator_sound_dbus_server-sound-service-dbus.obj -MD -MP -MF $(DEPDIR)/test_indicator_sound_dbus_server-sound-service-dbus.Tpo -c -o test_indicator_sound_dbus_server-sound-service-dbus.obj `if test -f '$(top_builddir)/src/sound-service-dbus.c'; then $(CYGPATH_W) '$(top_builddir)/src/sound-service-dbus.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/src/sound-service-dbus.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_indicator_sound_dbus_server-sound-service-dbus.Tpo $(DEPDIR)/test_indicator_sound_dbus_server-sound-service-dbus.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_builddir)/src/sound-service-dbus.c' object='test_indicator_sound_dbus_server-sound-service-dbus.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_indicator_sound_dbus_server_CFLAGS) $(CFLAGS) -c -o test_indicator_sound_dbus_server-sound-service-dbus.obj `if test -f '$(top_builddir)/src/sound-service-dbus.c'; then $(CYGPATH_W) '$(top_builddir)/src/sound-service-dbus.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/src/sound-service-dbus.c'; fi` + +test_indicator_sound_dbus_server-pulse-manager.o: $(top_builddir)/src/pulse-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_indicator_sound_dbus_server_CFLAGS) $(CFLAGS) -MT test_indicator_sound_dbus_server-pulse-manager.o -MD -MP -MF $(DEPDIR)/test_indicator_sound_dbus_server-pulse-manager.Tpo -c -o test_indicator_sound_dbus_server-pulse-manager.o `test -f '$(top_builddir)/src/pulse-manager.c' || echo '$(srcdir)/'`$(top_builddir)/src/pulse-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_indicator_sound_dbus_server-pulse-manager.Tpo $(DEPDIR)/test_indicator_sound_dbus_server-pulse-manager.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_builddir)/src/pulse-manager.c' object='test_indicator_sound_dbus_server-pulse-manager.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_indicator_sound_dbus_server_CFLAGS) $(CFLAGS) -c -o test_indicator_sound_dbus_server-pulse-manager.o `test -f '$(top_builddir)/src/pulse-manager.c' || echo '$(srcdir)/'`$(top_builddir)/src/pulse-manager.c + +test_indicator_sound_dbus_server-pulse-manager.obj: $(top_builddir)/src/pulse-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_indicator_sound_dbus_server_CFLAGS) $(CFLAGS) -MT test_indicator_sound_dbus_server-pulse-manager.obj -MD -MP -MF $(DEPDIR)/test_indicator_sound_dbus_server-pulse-manager.Tpo -c -o test_indicator_sound_dbus_server-pulse-manager.obj `if test -f '$(top_builddir)/src/pulse-manager.c'; then $(CYGPATH_W) '$(top_builddir)/src/pulse-manager.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/src/pulse-manager.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_indicator_sound_dbus_server-pulse-manager.Tpo $(DEPDIR)/test_indicator_sound_dbus_server-pulse-manager.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_builddir)/src/pulse-manager.c' object='test_indicator_sound_dbus_server-pulse-manager.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_indicator_sound_dbus_server_CFLAGS) $(CFLAGS) -c -o test_indicator_sound_dbus_server-pulse-manager.obj `if test -f '$(top_builddir)/src/pulse-manager.c'; then $(CYGPATH_W) '$(top_builddir)/src/pulse-manager.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/src/pulse-manager.c'; fi` + +test_indicator_sound_dbus_server-slider-menu-item.o: $(top_builddir)/src/slider-menu-item.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_indicator_sound_dbus_server_CFLAGS) $(CFLAGS) -MT test_indicator_sound_dbus_server-slider-menu-item.o -MD -MP -MF $(DEPDIR)/test_indicator_sound_dbus_server-slider-menu-item.Tpo -c -o test_indicator_sound_dbus_server-slider-menu-item.o `test -f '$(top_builddir)/src/slider-menu-item.c' || echo '$(srcdir)/'`$(top_builddir)/src/slider-menu-item.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_indicator_sound_dbus_server-slider-menu-item.Tpo $(DEPDIR)/test_indicator_sound_dbus_server-slider-menu-item.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_builddir)/src/slider-menu-item.c' object='test_indicator_sound_dbus_server-slider-menu-item.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_indicator_sound_dbus_server_CFLAGS) $(CFLAGS) -c -o test_indicator_sound_dbus_server-slider-menu-item.o `test -f '$(top_builddir)/src/slider-menu-item.c' || echo '$(srcdir)/'`$(top_builddir)/src/slider-menu-item.c + +test_indicator_sound_dbus_server-slider-menu-item.obj: $(top_builddir)/src/slider-menu-item.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_indicator_sound_dbus_server_CFLAGS) $(CFLAGS) -MT test_indicator_sound_dbus_server-slider-menu-item.obj -MD -MP -MF $(DEPDIR)/test_indicator_sound_dbus_server-slider-menu-item.Tpo -c -o test_indicator_sound_dbus_server-slider-menu-item.obj `if test -f '$(top_builddir)/src/slider-menu-item.c'; then $(CYGPATH_W) '$(top_builddir)/src/slider-menu-item.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/src/slider-menu-item.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_indicator_sound_dbus_server-slider-menu-item.Tpo $(DEPDIR)/test_indicator_sound_dbus_server-slider-menu-item.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_builddir)/src/slider-menu-item.c' object='test_indicator_sound_dbus_server-slider-menu-item.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_indicator_sound_dbus_server_CFLAGS) $(CFLAGS) -c -o test_indicator_sound_dbus_server-slider-menu-item.obj `if test -f '$(top_builddir)/src/slider-menu-item.c'; then $(CYGPATH_W) '$(top_builddir)/src/slider-menu-item.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/src/slider-menu-item.c'; fi` + +test_indicator_sound_dbus_server-dbus-menu-manager.o: $(top_builddir)/src/dbus-menu-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_indicator_sound_dbus_server_CFLAGS) $(CFLAGS) -MT test_indicator_sound_dbus_server-dbus-menu-manager.o -MD -MP -MF $(DEPDIR)/test_indicator_sound_dbus_server-dbus-menu-manager.Tpo -c -o test_indicator_sound_dbus_server-dbus-menu-manager.o `test -f '$(top_builddir)/src/dbus-menu-manager.c' || echo '$(srcdir)/'`$(top_builddir)/src/dbus-menu-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_indicator_sound_dbus_server-dbus-menu-manager.Tpo $(DEPDIR)/test_indicator_sound_dbus_server-dbus-menu-manager.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_builddir)/src/dbus-menu-manager.c' object='test_indicator_sound_dbus_server-dbus-menu-manager.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_indicator_sound_dbus_server_CFLAGS) $(CFLAGS) -c -o test_indicator_sound_dbus_server-dbus-menu-manager.o `test -f '$(top_builddir)/src/dbus-menu-manager.c' || echo '$(srcdir)/'`$(top_builddir)/src/dbus-menu-manager.c + +test_indicator_sound_dbus_server-dbus-menu-manager.obj: $(top_builddir)/src/dbus-menu-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_indicator_sound_dbus_server_CFLAGS) $(CFLAGS) -MT test_indicator_sound_dbus_server-dbus-menu-manager.obj -MD -MP -MF $(DEPDIR)/test_indicator_sound_dbus_server-dbus-menu-manager.Tpo -c -o test_indicator_sound_dbus_server-dbus-menu-manager.obj `if test -f '$(top_builddir)/src/dbus-menu-manager.c'; then $(CYGPATH_W) '$(top_builddir)/src/dbus-menu-manager.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/src/dbus-menu-manager.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_indicator_sound_dbus_server-dbus-menu-manager.Tpo $(DEPDIR)/test_indicator_sound_dbus_server-dbus-menu-manager.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_builddir)/src/dbus-menu-manager.c' object='test_indicator_sound_dbus_server-dbus-menu-manager.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_indicator_sound_dbus_server_CFLAGS) $(CFLAGS) -c -o test_indicator_sound_dbus_server-dbus-menu-manager.obj `if test -f '$(top_builddir)/src/dbus-menu-manager.c'; then $(CYGPATH_W) '$(top_builddir)/src/dbus-menu-manager.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/src/dbus-menu-manager.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + $(am__tty_colors); \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + col=$$red; res=XPASS; \ + ;; \ + *) \ + col=$$grn; res=PASS; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xfail=`expr $$xfail + 1`; \ + col=$$lgn; res=XFAIL; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + col=$$red; res=FAIL; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + col=$$blu; res=SKIP; \ + fi; \ + echo "$${col}$$res$${std}: $$tst"; \ + done; \ + if test "$$all" -eq 1; then \ + tests="test"; \ + All=""; \ + else \ + tests="tests"; \ + All="All "; \ + fi; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="$$All$$all $$tests passed"; \ + else \ + if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ + banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all $$tests failed"; \ + else \ + if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ + banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + if test "$$skip" -eq 1; then \ + skipped="($$skip test was not run)"; \ + else \ + skipped="($$skip tests were not run)"; \ + fi; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + if test "$$failed" -eq 0; then \ + echo "$$grn$$dashes"; \ + else \ + echo "$$red$$dashes"; \ + fi; \ + echo "$$banner"; \ + test -z "$$skipped" || echo "$$skipped"; \ + test -z "$$report" || echo "$$report"; \ + echo "$$dashes$$std"; \ + test "$$failed" -eq 0; \ + else :; fi + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ + clean-checkPROGRAMS clean-generic clean-libtool ctags \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am + + +indicator-sound-tests: indicator-sound-tests-gtester Makefile.am + @echo "#!/bin/sh" > $@ + @echo $(DBUS_RUNNER) --task ./indicator-sound-tests-gtester >> $@ + @chmod +x $@ + +indicator-sound-tests-gtester: test-indicator-sound Makefile.am + @echo "#!/bin/sh" > $@ + @echo gtester -k --verbose -o=$(XML_REPORT) ./test-indicator-sound >> $@ + @chmod +x $@ + +test-indicator-sound-dbus: test-indicator-sound-dbus-client test-indicator-sound-dbus-server Makefile.am + @echo "#!/bin/sh" > test-indicator-sound-dbus + @echo $(DBUS_RUNNER) --task ./test-indicator-sound-dbus-client --task-name Client --task ./test-indicator-sound-dbus-server --task-name Server --ignore-return >> test-indicator-sound-dbus + @chmod +x test-indicator-sound-dbus + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/tests/test-defines.h b/tests/test-defines.h new file mode 100644 index 0000000..68064fc --- /dev/null +++ b/tests/test-defines.h @@ -0,0 +1,24 @@ +/* +Testing defines to be shared between various tests. + +Copyright 2010 Canonical Ltd. + +Authors: + Conor Curran <conor.curran@canonical.com> + Ted Gould <ted@canonical.com> + +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published +by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#define TEST_MUTE FALSE + diff --git a/tests/test-indicator-sound-dbus-client.c b/tests/test-indicator-sound-dbus-client.c new file mode 100644 index 0000000..08ce93e --- /dev/null +++ b/tests/test-indicator-sound-dbus-client.c @@ -0,0 +1,112 @@ +/* +Tests for the libappindicator library that are over DBus. This is +the client side of those tests. + +Copyright 2010 Canonical Ltd. + +Authors: + Conor Curran <conor.curran@canonical.com> + Ted Gould <ted@canonical.com> + +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published +by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + + +#include <glib.h> +#include <dbus/dbus-glib.h> +#include "../src/dbus-shared-names.h" +#include "test-defines.h" + +static GMainLoop * mainloop = NULL; +static gboolean passed = TRUE; + +static void +fetch_mute_cb (DBusGProxy * proxy, DBusGProxyCall * call, void * data) +{ + GError * error = NULL; + GValue value = {0}; + + if (!dbus_g_proxy_end_call(proxy, call, &error, G_TYPE_VALUE, &value, G_TYPE_INVALID)) { + g_warning("Getting mute failed: %s", error->message); + g_error_free(error); + passed = FALSE; + return; + } + + if (TEST_MUTE != g_value_get_boolean(&value)) { + g_debug("Mute vale Returned: FAILED"); + passed = FALSE; + } else { + g_debug("Property ID Returned: PASSED"); + } + return; +} + + +gboolean +kill_func (gpointer userdata) +{ + g_main_loop_quit(mainloop); + g_warning("Forced to Kill"); + passed = FALSE; + return FALSE; +} + +gint +main (gint argc, gchar * argv[]) +{ + g_type_init(); + + g_usleep(500000); + + GError * error = NULL; + DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error); + if (error != NULL) { + g_error("Unable to get session bus: %s", error->message); + return 1; + } + + DBusGProxy * props = dbus_g_proxy_new_for_name_owner(session_bus, + INDICATOR_SOUND_DBUS_NAME, + INDICATOR_SOUND_SERVICE_DBUS_OBJECT, + INDICATOR_SOUND_SERVICE_DBUS_INTERFACE, + &error); +/* ":1.0",*/ +/* "/need/a/path",*/ +/* DBUS_INTERFACE_PROPERTIES,*/ +/* &error);*/ + if (error != NULL) { + g_error("Unable to get property proxy: %s", error->message); + return 1; + } + + dbus_g_proxy_begin_call (props, + "GetSinkMute", + fetch_mute_cb, + NULL, NULL, + G_TYPE_INVALID); + + g_timeout_add_seconds(2, kill_func, NULL); + + mainloop = g_main_loop_new(NULL, FALSE); + g_main_loop_run(mainloop); + + if (passed) { + g_debug("Quiting"); + return 0; + } else { + g_debug("Quiting as we're a failure"); + return 1; + } + return 0; +} diff --git a/tests/test-indicator-sound-dbus-server.c b/tests/test-indicator-sound-dbus-server.c new file mode 100644 index 0000000..21d7dfe --- /dev/null +++ b/tests/test-indicator-sound-dbus-server.c @@ -0,0 +1,63 @@ +/* +Tests for the libappindicator library that are over DBus. This is +the server side of those tests. + +Copyright 2009 Canonical Ltd. + +Authors: + Conor Curran <conor.curran@canonical.com> + Ted Gould <ted@canonical.com> + +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published +by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + + +#include <dbus/dbus-glib.h> +#include <dbus/dbus-glib-lowlevel.h> +#include <glib.h> +#include "../src/sound-service-dbus.h" +#include "test-defines.h" + +static GMainLoop * mainloop = NULL; +static SoundServiceDbus *dbus_interface = NULL; + +gboolean +kill_func (gpointer userdata) +{ + g_main_loop_quit(mainloop); + // TODO free the dbus interface !! + return FALSE; +} + +gint +main (gint argc, gchar * argv[]) +{ + g_type_init(); + g_debug("DBus ID: %s", dbus_connection_get_server_id(dbus_g_connection_get_connection(dbus_g_bus_get(DBUS_BUS_SESSION, NULL)))); + + dbus_interface = g_object_new(SOUND_SERVICE_DBUS_TYPE, NULL); + + // Set the mute value + sound_service_dbus_update_sink_mute(dbus_interface, TEST_MUTE); + g_timeout_add_seconds(2, kill_func, NULL); + + // Run the loop + mainloop = g_main_loop_new(NULL, FALSE); + g_main_loop_run(mainloop); + + g_debug("Quiting"); + + return 0; +} + + diff --git a/tests/test-indicator-sound.c b/tests/test-indicator-sound.c new file mode 100644 index 0000000..eb68b17 --- /dev/null +++ b/tests/test-indicator-sound.c @@ -0,0 +1,101 @@ +/* +Copyright 2010 Canonical Ltd. + +Authors: + Conor Curran <conor.curran@canonical.com> + +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published +by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include <string.h> +#include <gtk/gtk.h> +#include <libindicator/indicator-object.h> +#include "../src/indicator-sound.h" + +static const gint STATE_MUTED = 0; +static const gint STATE_ZERO = 1; +static const gint STATE_LOW = 2; +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; + +void test_libindicator_sound_init() +{ + IndicatorObject * sound_menu = indicator_object_new_from_file(TOP_BUILD_DIR "/src/.libs/libsoundmenu.so"); + g_assert(sound_menu != NULL); + g_object_unref(G_OBJECT(sound_menu)); +} + +void test_libindicator_determine_state() +{ + IndicatorObject * sound_menu = indicator_object_new_from_file(TOP_BUILD_DIR "/src/.libs/libsoundmenu.so"); + prepare_for_tests(sound_menu); + + determine_state_from_volume(40); + g_assert(get_state() == STATE_MEDIUM); + + determine_state_from_volume(0); + g_assert(get_state() == STATE_ZERO); + + determine_state_from_volume(15); + g_assert(get_state() == STATE_LOW); + + determine_state_from_volume(70); + g_assert(get_state() == STATE_HIGH); + + g_object_unref(G_OBJECT(sound_menu)); +} + +void test_libindicator_image_names() +{ + prepare_state_machine(); + + gchar* muted_name = get_state_image_name(STATE_MUTED); + g_assert(g_ascii_strncasecmp("audio-volume-muted-panel", muted_name, strlen("audio-volume-muted-panel")) == 0); + + gchar* zero_name = get_state_image_name(STATE_ZERO); + g_assert(g_ascii_strncasecmp("audio-volume-low-zero-panel", zero_name, strlen("audio-volume-low-zero-panel")) == 0); + + gchar* low_name = get_state_image_name(STATE_LOW); + g_assert(g_ascii_strncasecmp("audio-volume-low-panel", low_name, strlen("audio-volume-low-panel")) == 0); + + gchar* medium_name = get_state_image_name(STATE_MEDIUM); + g_assert(g_ascii_strncasecmp("audio-volume-medium-panel", medium_name, strlen("audio-volume-medium-panel")) == 0); + + gchar* high_name = get_state_image_name(STATE_HIGH); + g_assert(g_ascii_strncasecmp("audio-volume-high-panel", high_name, strlen("audio-volume-high-panel")) == 0); + + gchar* blocked_name = get_state_image_name(STATE_MUTED_WHILE_INPUT); + g_assert(g_ascii_strncasecmp("audio-volume-muted-blocking-panel", blocked_name, strlen("audio-volume-muted-blocking-panel")) == 0); + + gchar* none_name = get_state_image_name(STATE_SINKS_NONE); + g_assert(g_ascii_strncasecmp("audio-output-none-panel", none_name, strlen("audio-output-none-panel")) == 0); + + tidy_up_hash(); +} + + + +gint main (gint argc, gchar * argv[]) +{ + g_type_init(); + g_test_init(&argc, &argv, NULL); + + g_test_add_func("/indicator-sound/indicator-sound/init", test_libindicator_sound_init); + g_test_add_func("/indicator-sound/indicator-sound/state_machine", test_libindicator_determine_state); + g_test_add_func("/indicator-sound/indicator-sound/image_names", test_libindicator_image_names); + + return g_test_run (); +} + |