aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2010-03-24 15:47:37 +0000
committerConor Curran <conor.curran@canonical.com>2010-03-24 15:47:37 +0000
commitd7fbeccff7687eb1e50f6c35355a19e5433246c6 (patch)
tree45a7404fde9e8402c47779e9d5450d36e1680760 /src
parent65fde4c4a871479a5e9b58fb5e1c0e880b71b784 (diff)
parent017109c083b207d4a2bfb1d7d17e09aafc123b55 (diff)
downloadayatana-indicator-sound-d7fbeccff7687eb1e50f6c35355a19e5433246c6.tar.gz
ayatana-indicator-sound-d7fbeccff7687eb1e50f6c35355a19e5433246c6.tar.bz2
ayatana-indicator-sound-d7fbeccff7687eb1e50f6c35355a19e5433246c6.zip
Tests branch finally makes its way into trunk - more testing needed
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am4
-rw-r--r--src/indicator-sound.c4
-rw-r--r--src/pulse-manager.c37
-rw-r--r--src/pulse-manager.h4
-rw-r--r--src/sound-service-dbus.c2
5 files changed, 23 insertions, 28 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 062d993..f472662 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -45,8 +45,8 @@ indicator_sound_service_SOURCES = \
sound-service-server.h \
slider-menu-item.h \
slider-menu-item.c
-indicator_sound_service_CFLAGS = $(SOUNDSERVICE_CFLAGS) $(GCONF_CFLAGS) -DLIBEXECDIR=\"$(libexecdir)\" -Wall -Werror
-indicator_sound_service_LDADD = $(SOUNDSERVICE_LIBS) $(GCONF_LIBS)
+indicator_sound_service_CFLAGS = $(PULSEAUDIO_CFLAGS) $(SOUNDSERVICE_CFLAGS) $(GCONF_CFLAGS) -DLIBEXECDIR=\"$(libexecdir)\" -Wall -Werror
+indicator_sound_service_LDADD = $(PULSEAUDIO_LIBS) $(SOUNDSERVICE_LIBS) $(GCONF_LIBS)
sound-service-server.h: $(srcdir)/sound-service.xml
dbus-binding-tool \
diff --git a/src/indicator-sound.c b/src/indicator-sound.c
index a1a531a..a67a0b0 100644
--- a/src/indicator-sound.c
+++ b/src/indicator-sound.c
@@ -144,9 +144,9 @@ indicator_sound_class_init (IndicatorSoundClass *klass)
io_class->get_label = get_label;
io_class->get_image = get_icon;
io_class->get_menu = get_menu;
- io_class->scroll = scroll;
+ io_class->scroll = scroll;
- design_team_size = gtk_icon_size_register("design-team-size", 22, 22);
+ design_team_size = gtk_icon_size_register("design-team-size", 22, 22);
return;
}
diff --git a/src/pulse-manager.c b/src/pulse-manager.c
index e1634a9..c6fc6ac 100644
--- a/src/pulse-manager.c
+++ b/src/pulse-manager.c
@@ -72,6 +72,11 @@ void establish_pulse_activities(SoundServiceDbus *service)
pa_context_connect(pulse_context, NULL, PA_CONTEXT_NOFAIL, NULL);
}
+pa_context* get_context()
+{
+ return pulse_context;
+}
+
void close_pulse_activites()
{
if (pulse_context != NULL){
@@ -98,7 +103,11 @@ static void reconnect_to_pulse()
pa_context_unref(pulse_context);
pulse_context = NULL;
}
- g_hash_table_destroy(sink_hash);
+
+ if(sink_hash != NULL){
+ g_hash_table_destroy(sink_hash);
+ sink_hash = NULL;
+ }
// reconnect
pulse_context = pa_context_new(pa_glib_mainloop_get_api(pa_main_loop), "ayatana.indicator.sound");
@@ -114,8 +123,6 @@ static void destroy_sink_info(void *value)
{
sink_info *sink = (sink_info*)value;
g_free(sink->name);
- g_free(sink->description);
- g_free(sink->icon_name);
g_free(sink);
}
@@ -289,11 +296,8 @@ static void pulse_sink_info_callback(pa_context *c, const pa_sink_info *sink, in
g_debug("About to add an item to our hash");
sink_info *value;
value = g_new0(sink_info, 1);
- value->index = value->device_index = sink->index;
+ value->index = sink->index;
value->name = g_strdup(sink->name);
- value->description = g_strdup(sink->description);
- value->icon_name = g_strdup(pa_proplist_gets(sink->proplist, PA_PROP_DEVICE_ICON_NAME));
- value->active_port = (sink->active_port != NULL);
value->mute = !!sink->mute;
value->volume = sink->volume;
value->base_volume = sink->base_volume;
@@ -362,15 +366,11 @@ static void update_sink_info(pa_context *c, const pa_sink_info *info, int eol, v
{
sink_info *s = g_hash_table_lookup(sink_hash, GINT_TO_POINTER(info->index));
s->name = g_strdup(info->name);
- s->description = g_strdup(info->description);
- s->icon_name = g_strdup(pa_proplist_gets(info->proplist, PA_PROP_DEVICE_ICON_NAME));
- s->active_port = (info->active_port != NULL);
gboolean mute_changed = s->mute != !!info->mute;
s->mute = !!info->mute;
gboolean volume_changed = (pa_cvolume_equal(&info->volume, &s->volume) == 0);
s->volume = info->volume;
s->base_volume = info->base_volume;
- s->channel_map = info->channel_map;
if(DEFAULT_SINK_INDEX == s->index)
{
//update the UI
@@ -398,18 +398,13 @@ 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;
+ value->index = info->index;
value->name = g_strdup(info->name);
- value->description = g_strdup(info->description);
- value->icon_name = g_strdup(pa_proplist_gets(info->proplist, PA_PROP_DEVICE_ICON_NAME));
- value->active_port = (info->active_port != NULL);
value->mute = !!info->mute;
value->volume = info->volume;
value->base_volume = info->base_volume;
- 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);
@@ -462,9 +457,13 @@ 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)
{
- if(index == DEFAULT_SINK_INDEX)
- g_debug("PA_SUBSCRIPTION_EVENT_SINK REMOVAL event triggered");
+ if(index == DEFAULT_SINK_INDEX){
+ g_debug("PA_SUBSCRIPTION_EVENT_SINK REMOVAL event triggered - default sink has been removed !! \n updating UI to reflect the change");
sound_service_dbus_update_sink_availability(dbus_service, FALSE);
+ }
+ else{
+ g_debug("PA_SUBSCRIPTION_EVENT_SINK REMOVAL - some device other than the default - no panic");
+ }
}
else
{
diff --git a/src/pulse-manager.h b/src/pulse-manager.h
index e1777fb..54978bb 100644
--- a/src/pulse-manager.h
+++ b/src/pulse-manager.h
@@ -30,14 +30,10 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
typedef struct {
gchar* name;
- gchar* description;
- gchar* icon_name;
gint index;
- gint device_index;
pa_cvolume volume;
pa_channel_map channel_map;
gboolean mute;
- gboolean active_port;
pa_volume_t base_volume;
} sink_info;
diff --git a/src/sound-service-dbus.c b/src/sound-service-dbus.c
index 260e064..5c6c487 100644
--- a/src/sound-service-dbus.c
+++ b/src/sound-service-dbus.c
@@ -140,7 +140,7 @@ sound_service_dbus_init (SoundServiceDbus *self)
}
/* register the service on it */
dbus_g_connection_register_g_object(priv->connection,
- "/org/ayatana/indicator/sound/service",
+ INDICATOR_SOUND_SERVICE_DBUS_OBJECT,
G_OBJECT(self));
}