From a4637ac0f922a3df3e31c19a0a86eebb6a8b4994 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 19 Jan 2011 15:25:18 -0600 Subject: further consolidation on the service side --- src/pulse-manager.h | 3 --- src/sound-service-dbus.c | 31 ++++++++++++++++++++++++++----- src/sound-service-dbus.h | 4 +++- src/sound-service.c | 10 ++++++---- src/sound-service.h | 3 --- src/sound-service.xml | 9 +++++++++ 6 files changed, 44 insertions(+), 16 deletions(-) (limited to 'src') 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 #include +#include +#include + +#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 - * Cody Russell * * 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 #include +#include + 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 . */ #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 - Ted Gould - Cody Russell 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 @@ + + + + + + + + + -- cgit v1.2.3