diff options
author | Conor Curran <conor.curran@canonical.com> | 2011-01-19 15:25:18 -0600 |
---|---|---|
committer | Conor Curran <conor.curran@canonical.com> | 2011-01-19 15:25:18 -0600 |
commit | a4637ac0f922a3df3e31c19a0a86eebb6a8b4994 (patch) | |
tree | cabf6d00a45e7e6bf1e46e4ac97f5e0cef318d1d | |
parent | 6db28ce9134db40a0808a3c67df5f9dd223303b5 (diff) | |
download | ayatana-indicator-sound-a4637ac0f922a3df3e31c19a0a86eebb6a8b4994.tar.gz ayatana-indicator-sound-a4637ac0f922a3df3e31c19a0a86eebb6a8b4994.tar.bz2 ayatana-indicator-sound-a4637ac0f922a3df3e31c19a0a86eebb6a8b4994.zip |
further consolidation on the service side
-rw-r--r-- | src/pulse-manager.h | 3 | ||||
-rw-r--r-- | src/sound-service-dbus.c | 31 | ||||
-rw-r--r-- | src/sound-service-dbus.h | 4 | ||||
-rw-r--r-- | src/sound-service.c | 10 | ||||
-rw-r--r-- | src/sound-service.h | 3 | ||||
-rw-r--r-- | src/sound-service.xml | 9 |
6 files changed, 44 insertions, 16 deletions
diff --git a/src/pulse-manager.h b/src/pulse-manager.h index fc01f1c..dfe1256 100644 --- a/src/pulse-manager.h +++ b/src/pulse-manager.h @@ -1,9 +1,6 @@ #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. - Copyright 2010 Canonical Ltd. Authors: diff --git a/src/sound-service-dbus.c b/src/sound-service-dbus.c index 6057a29..f14e7c6 100644 --- a/src/sound-service-dbus.c +++ b/src/sound-service-dbus.c @@ -24,11 +24,18 @@ #include <gio/gio.h> #include <libindicator/indicator-service.h> +#include <libdbusmenu-glib/server.h> +#include <libdbusmenu-glib/client.h> + +#include "sound-service-dbus.h" + #include "gen-sound-service.xml.h" #include "dbus-shared-names.h" -#include "sound-service-dbus.h" #include "common-defs.h" #include "pulse-manager.h" +#include "slider-menu-item.h" +#include "mute-menu-item.h" + // DBUS methods static void bus_method_call (GDBusConnection * connection, @@ -50,9 +57,12 @@ static GDBusInterfaceVTable interface_table = { typedef struct _SoundServiceDbusPrivate SoundServiceDbusPrivate; struct _SoundServiceDbusPrivate { - GDBusConnection *connection; - gboolean mute; - gboolean sink_availability; + GDBusConnection* connection; + gboolean mute; + gboolean sink_availability; + DbusmenuMenuitem* root_menuitem; + SliderMenuItem* volume_slider_menuitem; + MuteMenuItem* mute_menuitem; }; static GDBusNodeInfo * node_info = NULL; @@ -65,7 +75,6 @@ static void sound_service_dbus_init (SoundServiceDbus *self); static void sound_service_dbus_dispose (GObject *object); static void sound_service_dbus_finalize (GObject *object); -/* GObject Boilerplate */ G_DEFINE_TYPE (SoundServiceDbus, sound_service_dbus, G_TYPE_OBJECT); static void @@ -108,6 +117,7 @@ sound_service_dbus_init (SoundServiceDbus *self) SoundServiceDbusPrivate * priv = SOUND_SERVICE_DBUS_GET_PRIVATE(self); priv->connection = NULL; + priv->mute = FALSE; priv->sink_availability = FALSE; @@ -134,6 +144,17 @@ sound_service_dbus_init (SoundServiceDbus *self) } } +DbusmenuMenuitem* sound_service_dbus_construct_menu (SoundServiceDbus* self) +{ + SoundServiceDbusPrivate * priv = SOUND_SERVICE_DBUS_GET_PRIVATE(self); + priv->root_menuitem = dbusmenu_menuitem_new(); + g_debug("Root ID: %d", dbusmenu_menuitem_get_id(priv->root_menuitem)); + DbusmenuServer *server = dbusmenu_server_new(INDICATOR_SOUND_MENU_DBUS_OBJECT_PATH); + dbusmenu_server_set_root(server, priv->root_menuitem); + establish_pulse_activities(self); + return priv->root_menuitem; +} + static void sound_service_dbus_dispose (GObject *object) { diff --git a/src/sound-service-dbus.h b/src/sound-service-dbus.h index 0d1573b..b0e6dd3 100644 --- a/src/sound-service-dbus.h +++ b/src/sound-service-dbus.h @@ -3,7 +3,6 @@ * * Authors: * Conor Curran <conor.curran@canonical.com> - * Cody Russell <crussell@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 @@ -23,6 +22,8 @@ #include <glib.h> #include <glib-object.h> +#include <libdbusmenu-glib/menuitem.h> + G_BEGIN_DECLS @@ -55,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_mute(SoundServiceDbus* obj, gboolean sink_mute); void sound_service_dbus_update_sink_availability(SoundServiceDbus* obj, gboolean sink_availibity); +DbusmenuMenuitem* sound_service_dbus_construct_menu (SoundServiceDbus* self); G_END_DECLS diff --git a/src/sound-service.c b/src/sound-service.c index defcb94..73b03b6 100644 --- a/src/sound-service.c +++ b/src/sound-service.c @@ -1,5 +1,4 @@ /* -This service primarily controls PulseAudio and is driven by the sound indicator menu on the panel. Copyright 2010 Canonical Ltd. Authors: @@ -19,8 +18,9 @@ with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "sound-service.h" -#include "dbus-menu-manager.h" -#include "pulse-manager.h" +//#include "dbus-menu-manager.h" +//#include "pulse-manager.h" +#include "sound-service-dbus.h" #include "music-player-bridge.h" static GMainLoop *mainloop = NULL; @@ -64,7 +64,9 @@ main (int argc, char ** argv) INDICATOR_SERVICE_SIGNAL_SHUTDOWN, G_CALLBACK(service_shutdown), NULL); - DbusmenuMenuitem* root_menuitem = dbus_menu_manager_setup(); + SoundServiceDbus* sound_service = g_object_new(SOUND_SERVICE_DBUS_TYPE, NULL); + + DbusmenuMenuitem* root_menuitem = sound_service_dbus_construct_menu(sound_service); MusicPlayerBridge* server = music_player_bridge_new(); music_player_bridge_set_root_menu_item(server, root_menuitem); diff --git a/src/sound-service.h b/src/sound-service.h index e95d4c7..7c5d0c3 100644 --- a/src/sound-service.h +++ b/src/sound-service.h @@ -2,13 +2,10 @@ #define __INCLUDE_SOUND_SERVICE_H__ /* -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> - Ted Gould <ted@canonical.com> - Cody Russell <crussell@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 diff --git a/src/sound-service.xml b/src/sound-service.xml index da3ac18..44ecc2b 100644 --- a/src/sound-service.xml +++ b/src/sound-service.xml @@ -16,12 +16,21 @@ <arg type='b' name='availability_input' direction="out"/> </method> + <method name = "GetSinkState"> + <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="sound_service_dbus_get_sink_state"/> + <arg type='i' name='current_state' 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 --> <signal name="SinkInputWhileMuted"> <arg name="block_value" type="b" direction="out"/> </signal> + + <signal name="SinkStateUpdate"> + <arg name="new_state" type="i" direction="out"/> + </signal> <signal name="SinkMuteUpdate"> <arg name="mute_value" type="b" direction="out"/> |