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
1=== modified file 'src/indicator-sound.c'
2--- src/indicator-sound.c 2010-10-01 16:51:18 +0000
3+++ src/indicator-sound.c 2010-10-05 16:20:56 +0000
4@@ -68,7 +68,6 @@
5 static GtkMenu * get_menu (IndicatorObject * io);
6 static void indicator_sound_scroll (IndicatorObject* io, gint delta, IndicatorScrollDirection direction);
7
8-
9 //Slider related
10 static gboolean new_volume_slider_widget(DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client);
11 static gboolean key_press_cb(GtkWidget* widget, GdkEventKey* event, gpointer data);
12@@ -196,12 +195,13 @@
13 static GtkImage *
14 get_icon (IndicatorObject * io)
15 {
16- gchar* current_name = g_hash_table_lookup(volume_states,
17+ gchar* current_name = g_hash_table_lookup(volume_states,
18 GINT_TO_POINTER(current_state));
19 //g_debug("At start-up attempting to set the image to %s",
20 // current_name);
21 speaker_image = indicator_image_helper(current_name);
22 gtk_widget_show(GTK_WIDGET(speaker_image));
23+
24 return speaker_image;
25 }
26
27@@ -324,6 +324,8 @@
28 newitem,
29 menu_volume_item,
30 parent);
31+ fetch_mute_value_from_dbus();
32+ fetch_sink_availability_from_dbus(INDICATOR_SOUND (io));
33 return TRUE;
34 }
35
36@@ -359,6 +361,7 @@
37 dbus_g_proxy_connect_signal(sound_dbus_proxy, SIGNAL_SINK_MUTE_UPDATE, G_CALLBACK(catch_signal_sink_mute_update), user_data, NULL);
38 dbus_g_proxy_add_signal(sound_dbus_proxy, SIGNAL_SINK_AVAILABLE_UPDATE, G_TYPE_BOOLEAN, G_TYPE_INVALID);
39 dbus_g_proxy_connect_signal(sound_dbus_proxy, SIGNAL_SINK_AVAILABLE_UPDATE, G_CALLBACK(catch_signal_sink_availability_update), NULL, NULL);
40+
41 if( service_restart == TRUE){
42 fetch_mute_value_from_dbus();
43 // Ensure UI is in sync with service again.
44@@ -584,10 +587,11 @@
45 return;
46 }
47 initial_mute = *mute_input;
48- if (initial_mute == TRUE)
49+ if (initial_mute == TRUE){
50 update_state(STATE_MUTED);
51+ }
52 g_free(mute_input);
53- //g_debug("at the indicator start up and the MUTE returned from dbus method is %i", initial_mute);
54+ g_debug("at the indicator start up and the MUTE returned from dbus method is %i", initial_mute);
55 }
56
57 /*******************************************************************/
58
59=== modified file 'src/pulse-manager.c'
60--- src/pulse-manager.c 2010-10-01 18:46:36 +0000
61+++ src/pulse-manager.c 2010-10-05 16:20:56 +0000
62@@ -43,7 +43,6 @@
63 static void update_sink_info(pa_context *c, const pa_sink_info *info, int eol, void *userdata);
64 static void destroy_sink_info(void *value);
65 static gboolean determine_sink_availability();
66-static void reconnect_to_pulse();
67
68 static gboolean has_volume_changed(const pa_sink_info* new_sink, sink_info* cached_sink);
69 static pa_cvolume construct_mono_volume(const pa_cvolume* vol);
70@@ -100,35 +99,6 @@
71 }
72
73 /**
74-reconnect_to_pulse()
75-In the event of Pulseaudio flapping in the wind handle gracefully without
76-memory leaks !
77-*/
78-static void reconnect_to_pulse()
79-{
80- // reset
81- if (pulse_context != NULL) {
82- g_debug("freeing the pulse context");
83- pa_context_unref(pulse_context);
84- pulse_context = NULL;
85- }
86-
87- if (sink_hash != NULL) {
88- g_hash_table_destroy(sink_hash);
89- sink_hash = NULL;
90- }
91-
92- // reconnect
93- pulse_context = pa_context_new(pa_glib_mainloop_get_api(pa_main_loop), "ayatana.indicator.sound");
94- g_assert(pulse_context);
95- sink_hash = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, destroy_sink_info);
96- // Establish event callback registration
97- pa_context_set_state_callback(pulse_context, context_state_callback, NULL);
98- dbus_menu_manager_update_pa_state(FALSE, FALSE, FALSE, 0);
99- pa_context_connect(pulse_context, NULL, PA_CONTEXT_NOFAIL, NULL);
100-}
101-
102-/**
103 destroy_sink_info()
104 item destructor method for the sink_info hash
105 **/

Subscribers

People subscribed via source and target branches

to all changes: