diff options
author | Conor Curran <conor.curran@canonical.com> | 2010-03-22 17:32:57 +0000 |
---|---|---|
committer | Conor Curran <conor.curran@canonical.com> | 2010-03-22 17:32:57 +0000 |
commit | f02377f77f88106ba1c26cb184a14f33cd1a89fe (patch) | |
tree | 2b5edc1549208898d2d843c53f0899fac03af3d8 /src/pulse-manager.c | |
parent | b26c97936312634da3fb30e818a76ce2a5a03992 (diff) | |
download | ayatana-indicator-sound-f02377f77f88106ba1c26cb184a14f33cd1a89fe.tar.gz ayatana-indicator-sound-f02377f77f88106ba1c26cb184a14f33cd1a89fe.tar.bz2 ayatana-indicator-sound-f02377f77f88106ba1c26cb184a14f33cd1a89fe.zip |
first pulse manager test wrote ... finally
Diffstat (limited to 'src/pulse-manager.c')
-rw-r--r-- | src/pulse-manager.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/pulse-manager.c b/src/pulse-manager.c index 2f86a90..a95c887 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"); @@ -115,7 +124,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 +297,9 @@ 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; @@ -363,8 +369,6 @@ 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); @@ -398,14 +402,11 @@ 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; |