aboutsummaryrefslogtreecommitdiff
path: root/src/sound-service-dbus.c
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2010-06-18 11:20:47 +0100
committerConor Curran <conor.curran@canonical.com>2010-06-18 11:20:47 +0100
commit9bba58ee4dae536ce92f396854e2c0e671d9b7f0 (patch)
tree26a4f5aa6f3c8f39ee83b56f7093d14387af28ec /src/sound-service-dbus.c
parent9d081fd7a4c36606854008ae72c960d419399e9a (diff)
parentc8b2631eb77064a3f828aaeb9f2e7a09b257b332 (diff)
downloadayatana-indicator-sound-9bba58ee4dae536ce92f396854e2c0e671d9b7f0.tar.gz
ayatana-indicator-sound-9bba58ee4dae536ce92f396854e2c0e671d9b7f0.tar.bz2
ayatana-indicator-sound-9bba58ee4dae536ce92f396854e2c0e671d9b7f0.zip
fixed spacing issues
Diffstat (limited to 'src/sound-service-dbus.c')
-rw-r--r--src/sound-service-dbus.c201
1 files changed, 100 insertions, 101 deletions
diff --git a/src/sound-service-dbus.c b/src/sound-service-dbus.c
index d1ddfc4..85945d0 100644
--- a/src/sound-service-dbus.c
+++ b/src/sound-service-dbus.c
@@ -28,7 +28,7 @@
#include "common-defs.h"
#include "pulse-manager.h"
-// DBUS methods
+// 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);
@@ -38,12 +38,11 @@ static void sound_service_dbus_set_sink_volume(SoundServiceDbus* service, const
typedef struct _SoundServiceDbusPrivate SoundServiceDbusPrivate;
-struct _SoundServiceDbusPrivate
-{
- DBusGConnection *connection;
- gdouble volume_percent;
- gboolean mute;
- gboolean sink_availability;
+struct _SoundServiceDbusPrivate {
+ DBusGConnection *connection;
+ gdouble volume_percent;
+ gboolean mute;
+ gboolean sink_availability;
};
@@ -73,47 +72,47 @@ G_DEFINE_TYPE (SoundServiceDbus, sound_service_dbus, G_TYPE_OBJECT);
static void
sound_service_dbus_class_init (SoundServiceDbusClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- g_type_class_add_private (object_class, sizeof(SoundServiceDbusPrivate));
-
- object_class->dispose = sound_service_dbus_dispose;
- object_class->finalize = sound_service_dbus_finalize;
-
- g_assert(klass != NULL);
- dbus_g_object_type_install_info(SOUND_SERVICE_DBUS_TYPE,
- &dbus_glib__sound_service_server_object_info);
-
- signals[SINK_INPUT_WHILE_MUTED] = g_signal_new("sink-input-while-muted",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- g_cclosure_marshal_VOID__BOOLEAN,
- G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
-
- signals[SINK_VOLUME_UPDATE] = g_signal_new("sink-volume-update",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- g_cclosure_marshal_VOID__DOUBLE,
- G_TYPE_NONE, 1, G_TYPE_DOUBLE);
-
- signals[SINK_MUTE_UPDATE] = g_signal_new("sink-mute-update",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- 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);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (object_class, sizeof(SoundServiceDbusPrivate));
+
+ object_class->dispose = sound_service_dbus_dispose;
+ object_class->finalize = sound_service_dbus_finalize;
+
+ g_assert(klass != NULL);
+ dbus_g_object_type_install_info(SOUND_SERVICE_DBUS_TYPE,
+ &dbus_glib__sound_service_server_object_info);
+
+ signals[SINK_INPUT_WHILE_MUTED] = g_signal_new("sink-input-while-muted",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__BOOLEAN,
+ G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
+
+ signals[SINK_VOLUME_UPDATE] = g_signal_new("sink-volume-update",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__DOUBLE,
+ G_TYPE_NONE, 1, G_TYPE_DOUBLE);
+
+ signals[SINK_MUTE_UPDATE] = g_signal_new("sink-mute-update",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ 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);
@@ -122,41 +121,41 @@ sound_service_dbus_class_init (SoundServiceDbusClass *klass)
static void
sound_service_dbus_init (SoundServiceDbus *self)
{
- GError *error = NULL;
- SoundServiceDbusPrivate * priv = SOUND_SERVICE_DBUS_GET_PRIVATE(self);
-
- priv->connection = NULL;
- priv->volume_percent = 0;
- priv->mute = FALSE;
- priv->sink_availability = FALSE;
-
- /* Fetch the session bus */
- priv->connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
-
- if (error != NULL) {
- 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,
- INDICATOR_SOUND_SERVICE_DBUS_OBJECT,
- G_OBJECT(self));
+ GError *error = NULL;
+ SoundServiceDbusPrivate * priv = SOUND_SERVICE_DBUS_GET_PRIVATE(self);
+
+ priv->connection = NULL;
+ priv->volume_percent = 0;
+ priv->mute = FALSE;
+ priv->sink_availability = FALSE;
+
+ /* Fetch the session bus */
+ priv->connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
+
+ if (error != NULL) {
+ 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,
+ INDICATOR_SOUND_SERVICE_DBUS_OBJECT,
+ G_OBJECT(self));
}
static void
sound_service_dbus_dispose (GObject *object)
{
- G_OBJECT_CLASS (sound_service_dbus_parent_class)->dispose (object);
- return;
+ G_OBJECT_CLASS (sound_service_dbus_parent_class)->dispose (object);
+ return;
}
static void
sound_service_dbus_finalize (GObject *object)
{
- G_OBJECT_CLASS (sound_service_dbus_parent_class)->finalize (object);
- return;
+ G_OBJECT_CLASS (sound_service_dbus_parent_class)->finalize (object);
+ return;
}
@@ -165,32 +164,32 @@ DBUS Method Callbacks
**/
static void sound_service_dbus_set_sink_volume(SoundServiceDbus* service, const guint volume_percent, GError** gerror)
{
- g_debug("in the set sink volume method in the sound service dbus!, with volume_percent of %i", volume_percent);
- set_sink_volume(volume_percent);
+ g_debug("in the set sink volume method in the sound service dbus!, with volume_percent of %i", volume_percent);
+ set_sink_volume(volume_percent);
}
static gboolean sound_service_dbus_get_sink_volume (SoundServiceDbus *self, gdouble *volume_percent_input, GError** gerror)
{
- SoundServiceDbusPrivate *priv = SOUND_SERVICE_DBUS_GET_PRIVATE (self);
- g_debug("Get sink volume method in the sound service dbus!, about to send over volume percent of %f", priv->volume_percent);
- *volume_percent_input = priv->volume_percent;
- return TRUE;
+ SoundServiceDbusPrivate *priv = SOUND_SERVICE_DBUS_GET_PRIVATE (self);
+ g_debug("Get sink volume method in the sound service dbus!, about to send over volume percent of %f", priv->volume_percent);
+ *volume_percent_input = priv->volume_percent;
+ return TRUE;
}
static gboolean sound_service_dbus_get_sink_mute (SoundServiceDbus *self, gboolean *mute_input, GError** gerror)
{
- SoundServiceDbusPrivate *priv = SOUND_SERVICE_DBUS_GET_PRIVATE (self);
- g_debug("Get sink mute - sound service dbus!, about to send over mute_value of %i", priv->mute);
- *mute_input = priv->mute;
- return TRUE;
+ SoundServiceDbusPrivate *priv = SOUND_SERVICE_DBUS_GET_PRIVATE (self);
+ g_debug("Get sink mute - sound service dbus!, about to send over mute_value of %i", priv->mute);
+ *mute_input = priv->mute;
+ 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;
+ 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;
}
/**
@@ -199,8 +198,8 @@ Utility methods to emit signals from the service into the ether.
**/
void sound_service_dbus_sink_input_while_muted(SoundServiceDbus* obj, gboolean block_value)
{
-/* g_debug("Emitting signal: SINK_INPUT_WHILE_MUTED, with block_value: %i", block_value);*/
- g_signal_emit(obj,
+ /* g_debug("Emitting signal: SINK_INPUT_WHILE_MUTED, with block_value: %i", block_value);*/
+ g_signal_emit(obj,
signals[SINK_INPUT_WHILE_MUTED],
0,
block_value);
@@ -208,11 +207,11 @@ void sound_service_dbus_sink_input_while_muted(SoundServiceDbus* obj, gboolean
void sound_service_dbus_update_sink_volume(SoundServiceDbus* obj, gdouble sink_volume)
{
- SoundServiceDbusPrivate *priv = SOUND_SERVICE_DBUS_GET_PRIVATE (obj);
- priv->volume_percent = sink_volume;
+ SoundServiceDbusPrivate *priv = SOUND_SERVICE_DBUS_GET_PRIVATE (obj);
+ priv->volume_percent = sink_volume;
-/* g_debug("Emitting signal: SINK_VOLUME_UPDATE, with sink_volme %f", priv->volume_percent);*/
- g_signal_emit(obj,
+ /* g_debug("Emitting signal: SINK_VOLUME_UPDATE, with sink_volme %f", priv->volume_percent);*/
+ g_signal_emit(obj,
signals[SINK_VOLUME_UPDATE],
0,
priv->volume_percent);
@@ -220,12 +219,12 @@ void sound_service_dbus_update_sink_volume(SoundServiceDbus* obj, gdouble sink_v
void sound_service_dbus_update_sink_mute(SoundServiceDbus* obj, gboolean sink_mute)
{
-/* g_debug("Emitting signal: SINK_MUTE_UPDATE, with sink mute %i", sink_mute);*/
+ /* g_debug("Emitting signal: SINK_MUTE_UPDATE, with sink mute %i", sink_mute);*/
- SoundServiceDbusPrivate *priv = SOUND_SERVICE_DBUS_GET_PRIVATE (obj);
- priv->mute = sink_mute;
+ SoundServiceDbusPrivate *priv = SOUND_SERVICE_DBUS_GET_PRIVATE (obj);
+ priv->mute = sink_mute;
- g_signal_emit(obj,
+ g_signal_emit(obj,
signals[SINK_MUTE_UPDATE],
0,
priv->mute);
@@ -233,16 +232,16 @@ void sound_service_dbus_update_sink_mute(SoundServiceDbus* obj, gboolean sink_mu
void sound_service_dbus_update_sink_availability(SoundServiceDbus* obj, gboolean sink_availability)
{
-/* g_debug("Emitting signal: SINK_AVAILABILITY_UPDATE, with value %i", 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;
+ SoundServiceDbusPrivate *priv = SOUND_SERVICE_DBUS_GET_PRIVATE (obj);
+ priv->sink_availability = sink_availability;
- g_signal_emit(obj,
+ g_signal_emit(obj,
signals[SINK_AVAILABLE_UPDATE],
0,
priv->sink_availability);
}
-
+