diff options
author | Conor Curran <conor.curran@canonical.com> | 2010-03-24 15:47:37 +0000 |
---|---|---|
committer | Conor Curran <conor.curran@canonical.com> | 2010-03-24 15:47:37 +0000 |
commit | d7fbeccff7687eb1e50f6c35355a19e5433246c6 (patch) | |
tree | 45a7404fde9e8402c47779e9d5450d36e1680760 /src/pulse-manager.c | |
parent | 65fde4c4a871479a5e9b58fb5e1c0e880b71b784 (diff) | |
parent | 017109c083b207d4a2bfb1d7d17e09aafc123b55 (diff) | |
download | ayatana-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/pulse-manager.c')
-rw-r--r-- | src/pulse-manager.c | 37 |
1 files changed, 18 insertions, 19 deletions
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 { |