aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2010-03-02 00:18:04 +0000
committerConor Curran <conor.curran@canonical.com>2010-03-02 00:18:04 +0000
commita6152fcf5ec57d7252617a7ede36aa53de7f2930 (patch)
treeabce27406eaa2fe29e1705b0b38b81cd947871af /src
parent6468402475d7bfced0ee905bdd56977cc2f4b7da (diff)
parent7a92d249547ff1783725850edb39a952e52ee8c9 (diff)
downloadayatana-indicator-sound-a6152fcf5ec57d7252617a7ede36aa53de7f2930.tar.gz
ayatana-indicator-sound-a6152fcf5ec57d7252617a7ede36aa53de7f2930.tar.bz2
ayatana-indicator-sound-a6152fcf5ec57d7252617a7ede36aa53de7f2930.zip
slow progress on the testing front
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am1
-rw-r--r--src/indicator-sound.c38
-rw-r--r--src/indicator-sound.h29
-rw-r--r--src/sound-service.c1
4 files changed, 53 insertions, 16 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 543ec58..5abacda 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -8,6 +8,7 @@ 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 \
diff --git a/src/indicator-sound.c b/src/indicator-sound.c
index ffe7acb..546f404 100644
--- a/src/indicator-sound.c
+++ b/src/indicator-sound.c
@@ -35,7 +35,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <libindicator/indicator-object.h>
#include <libindicator/indicator-service-manager.h>
-
+#include "indicator-sound.h"
#include "dbus-shared-names.h"
#include "sound-service-client.h"
#include "common-defs.h"
@@ -90,15 +90,13 @@ static gboolean key_press_cb(GtkWidget* widget, GdkEventKey* event, gpointer dat
// DBUS communication
static DBusGProxy *sound_dbus_proxy = NULL;
static void connection_changed (IndicatorServiceManager * sm, gboolean connected, gpointer userdata);
-static void catch_signal_sink_input_while_muted(DBusGProxy * proxy, gboolean value, gpointer userdata);
+/*static void catch_signal_sink_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 fetch_volume_percent_from_dbus();
static void fetch_mute_value_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;
@@ -131,11 +129,11 @@ indicator_sound_class_init (IndicatorSoundClass *klass)
io_class->get_image = get_icon;
io_class->get_menu = get_menu;
- dbus_g_object_register_marshaller (_sound_service_marshal_VOID__INT_BOOLEAN,
- G_TYPE_NONE,
- G_TYPE_INT,
- G_TYPE_BOOLEAN,
- G_TYPE_INVALID);
+/* dbus_g_object_register_marshaller (_sound_service_marshal_VOID__INT_BOOLEAN,*/
+/* G_TYPE_NONE,*/
+/* G_TYPE_INT,*/
+/* G_TYPE_BOOLEAN,*/
+/* G_TYPE_INVALID);*/
return;
}
@@ -259,7 +257,7 @@ connection_changed (IndicatorServiceManager * sm, gboolean connected, gpointer u
g_debug("about to connect to the signals");
dbus_g_proxy_add_signal(sound_dbus_proxy, SIGNAL_SINK_INPUT_WHILE_MUTED, G_TYPE_BOOLEAN, G_TYPE_INVALID);
- dbus_g_proxy_connect_signal(sound_dbus_proxy, SIGNAL_SINK_INPUT_WHILE_MUTED, G_CALLBACK(catch_signal_sink_input_while_muted), NULL, NULL);
+/* dbus_g_proxy_connect_signal(sound_dbus_proxy, SIGNAL_SINK_INPUT_WHILE_MUTED, G_CALLBACK(catch_signal_sink_input_while_muted), NULL, NULL);*/
dbus_g_proxy_add_signal(sound_dbus_proxy, SIGNAL_SINK_VOLUME_UPDATE, G_TYPE_DOUBLE, G_TYPE_INVALID);
dbus_g_proxy_connect_signal(sound_dbus_proxy, SIGNAL_SINK_VOLUME_UPDATE, G_CALLBACK(catch_signal_sink_volume_update), NULL, NULL);
dbus_g_proxy_add_signal(sound_dbus_proxy, SIGNAL_SINK_MUTE_UPDATE, G_TYPE_BOOLEAN, G_TYPE_INVALID);
@@ -284,7 +282,7 @@ connection_changed (IndicatorServiceManager * sm, gboolean connected, gpointer u
/*
Prepare states Array.
*/
-static void prepare_state_machine()
+void prepare_state_machine()
{
// TODO we need three more images
volume_states = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, g_free);
@@ -297,7 +295,15 @@ static void prepare_state_machine()
g_hash_table_insert(volume_states, GINT_TO_POINTER(STATE_SINKS_NONE), g_strdup("audio-output-none-panel"));
}
+gint get_state()
+{
+ return current_state;
+}
+void prepare_for_tests(IndicatorObject *io)
+{
+ get_icon(io);
+}
static void update_state(const gint state)
{
@@ -313,7 +319,7 @@ static void update_state(const gint state)
}
-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);*/
@@ -372,10 +378,10 @@ static void fetch_mute_value_from_dbus()
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_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)
{
diff --git a/src/indicator-sound.h b/src/indicator-sound.h
new file mode 100644
index 0000000..eaf8948
--- /dev/null
+++ b/src/indicator-sound.h
@@ -0,0 +1,29 @@
+/*
+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/>.
+*/
+
+
+void prepare_state_machine();
+void determine_state_from_volume(gdouble volume_percent);
+gint get_state();
+// Not nice
+void prepare_for_tests(IndicatorObject * io);
diff --git a/src/sound-service.c b/src/sound-service.c
index 62f6bc6..61bf702 100644
--- a/src/sound-service.c
+++ b/src/sound-service.c
@@ -127,6 +127,7 @@ service_shutdown (IndicatorService *service, gpointer user_data)
if (mainloop != NULL) {
g_debug("Service shutdown !");
// TODO: uncomment for release !!
+ // TODO free the dbus interface !!
close_pulse_activites();
g_main_loop_quit(mainloop);
}