Merge lp:~cjcurran/indicator-sound/unmute-icon-fix into lp:indicator-sound/sound-menu-v2

Proposed by Conor Curran
Status: Merged
Merged at revision: 145
Proposed branch: lp:~cjcurran/indicator-sound/unmute-icon-fix
Merge into: lp:indicator-sound/sound-menu-v2
Diff against target: 105 lines (+8/-34)
2 files modified
src/indicator-sound.c (+8/-4)
src/pulse-manager.c (+0/-30)
To merge this branch: bzr merge lp:~cjcurran/indicator-sound/unmute-icon-fix
Reviewer Review Type Date Requested Status
Ted Gould (community) Approve
Review via email: mp+37632@code.launchpad.net

Description of the change

Fixes silly race condition which causes the bug attached

To post a comment you must log in.
Revision history for this message
Ted Gould (ted) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/indicator-sound.c'
--- src/indicator-sound.c 2010-10-01 16:51:18 +0000
+++ src/indicator-sound.c 2010-10-05 16:20:56 +0000
@@ -68,7 +68,6 @@
68static GtkMenu * get_menu (IndicatorObject * io);68static GtkMenu * get_menu (IndicatorObject * io);
69static void indicator_sound_scroll (IndicatorObject* io, gint delta, IndicatorScrollDirection direction);69static void indicator_sound_scroll (IndicatorObject* io, gint delta, IndicatorScrollDirection direction);
7070
71
72//Slider related71//Slider related
73static gboolean new_volume_slider_widget(DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client);72static gboolean new_volume_slider_widget(DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client);
74static gboolean key_press_cb(GtkWidget* widget, GdkEventKey* event, gpointer data);73static gboolean key_press_cb(GtkWidget* widget, GdkEventKey* event, gpointer data);
@@ -196,12 +195,13 @@
196static GtkImage *195static GtkImage *
197get_icon (IndicatorObject * io)196get_icon (IndicatorObject * io)
198{197{
199 gchar* current_name = g_hash_table_lookup(volume_states,198 gchar* current_name = g_hash_table_lookup(volume_states,
200 GINT_TO_POINTER(current_state));199 GINT_TO_POINTER(current_state));
201 //g_debug("At start-up attempting to set the image to %s",200 //g_debug("At start-up attempting to set the image to %s",
202 // current_name);201 // current_name);
203 speaker_image = indicator_image_helper(current_name);202 speaker_image = indicator_image_helper(current_name);
204 gtk_widget_show(GTK_WIDGET(speaker_image));203 gtk_widget_show(GTK_WIDGET(speaker_image));
204
205 return speaker_image;205 return speaker_image;
206}206}
207207
@@ -324,6 +324,8 @@
324 newitem,324 newitem,
325 menu_volume_item,325 menu_volume_item,
326 parent); 326 parent);
327 fetch_mute_value_from_dbus();
328 fetch_sink_availability_from_dbus(INDICATOR_SOUND (io));
327 return TRUE; 329 return TRUE;
328}330}
329331
@@ -359,6 +361,7 @@
359 dbus_g_proxy_connect_signal(sound_dbus_proxy, SIGNAL_SINK_MUTE_UPDATE, G_CALLBACK(catch_signal_sink_mute_update), user_data, NULL);361 dbus_g_proxy_connect_signal(sound_dbus_proxy, SIGNAL_SINK_MUTE_UPDATE, G_CALLBACK(catch_signal_sink_mute_update), user_data, NULL);
360 dbus_g_proxy_add_signal(sound_dbus_proxy, SIGNAL_SINK_AVAILABLE_UPDATE, G_TYPE_BOOLEAN, G_TYPE_INVALID);362 dbus_g_proxy_add_signal(sound_dbus_proxy, SIGNAL_SINK_AVAILABLE_UPDATE, G_TYPE_BOOLEAN, G_TYPE_INVALID);
361 dbus_g_proxy_connect_signal(sound_dbus_proxy, SIGNAL_SINK_AVAILABLE_UPDATE, G_CALLBACK(catch_signal_sink_availability_update), NULL, NULL); 363 dbus_g_proxy_connect_signal(sound_dbus_proxy, SIGNAL_SINK_AVAILABLE_UPDATE, G_CALLBACK(catch_signal_sink_availability_update), NULL, NULL);
364
362 if( service_restart == TRUE){365 if( service_restart == TRUE){
363 fetch_mute_value_from_dbus();366 fetch_mute_value_from_dbus();
364 // Ensure UI is in sync with service again.367 // Ensure UI is in sync with service again.
@@ -584,10 +587,11 @@
584 return;587 return;
585 }588 }
586 initial_mute = *mute_input;589 initial_mute = *mute_input;
587 if (initial_mute == TRUE)590 if (initial_mute == TRUE){
588 update_state(STATE_MUTED);591 update_state(STATE_MUTED);
592 }
589 g_free(mute_input);593 g_free(mute_input);
590 //g_debug("at the indicator start up and the MUTE returned from dbus method is %i", initial_mute);594 g_debug("at the indicator start up and the MUTE returned from dbus method is %i", initial_mute);
591}595}
592596
593/*******************************************************************/597/*******************************************************************/
594598
=== modified file 'src/pulse-manager.c'
--- src/pulse-manager.c 2010-10-01 18:46:36 +0000
+++ src/pulse-manager.c 2010-10-05 16:20:56 +0000
@@ -43,7 +43,6 @@
43static void update_sink_info(pa_context *c, const pa_sink_info *info, int eol, void *userdata);43static void update_sink_info(pa_context *c, const pa_sink_info *info, int eol, void *userdata);
44static void destroy_sink_info(void *value);44static void destroy_sink_info(void *value);
45static gboolean determine_sink_availability();45static gboolean determine_sink_availability();
46static void reconnect_to_pulse();
4746
48static gboolean has_volume_changed(const pa_sink_info* new_sink, sink_info* cached_sink);47static gboolean has_volume_changed(const pa_sink_info* new_sink, sink_info* cached_sink);
49static pa_cvolume construct_mono_volume(const pa_cvolume* vol);48static pa_cvolume construct_mono_volume(const pa_cvolume* vol);
@@ -100,35 +99,6 @@
100}99}
101100
102/**101/**
103reconnect_to_pulse()
104In the event of Pulseaudio flapping in the wind handle gracefully without
105memory leaks !
106*/
107static void reconnect_to_pulse()
108{
109 // reset
110 if (pulse_context != NULL) {
111 g_debug("freeing the pulse context");
112 pa_context_unref(pulse_context);
113 pulse_context = NULL;
114 }
115
116 if (sink_hash != NULL) {
117 g_hash_table_destroy(sink_hash);
118 sink_hash = NULL;
119 }
120
121 // reconnect
122 pulse_context = pa_context_new(pa_glib_mainloop_get_api(pa_main_loop), "ayatana.indicator.sound");
123 g_assert(pulse_context);
124 sink_hash = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, destroy_sink_info);
125 // Establish event callback registration
126 pa_context_set_state_callback(pulse_context, context_state_callback, NULL);
127 dbus_menu_manager_update_pa_state(FALSE, FALSE, FALSE, 0);
128 pa_context_connect(pulse_context, NULL, PA_CONTEXT_NOFAIL, NULL);
129}
130
131/**
132destroy_sink_info()102destroy_sink_info()
133item destructor method for the sink_info hash103item destructor method for the sink_info hash
134**/104**/

Subscribers

People subscribed via source and target branches

to all changes: