← Back to team overview

ayatana-commits team mailing list archive

[Merge] lp:~cjcurran/indicator-sound/unmute-icon-fix into lp:indicator-sound

 

Conor Curran has proposed merging lp:~cjcurran/indicator-sound/unmute-icon-fix into lp:indicator-sound.

Requested reviews:
  Indicator Applet Developers (indicator-applet-developers)
Related bugs:
  #648238 always show unmuted at startup
  https://bugs.launchpad.net/bugs/648238


Fixes silly race condition which causes the bug attached
-- 
https://code.launchpad.net/~cjcurran/indicator-sound/unmute-icon-fix/+merge/37632
Your team ayatana-commits is subscribed to branch lp:indicator-sound.
=== 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 @@
 static GtkMenu *  get_menu (IndicatorObject * io);
 static void				indicator_sound_scroll (IndicatorObject* io, gint delta, IndicatorScrollDirection direction);
 
-
 //Slider related
 static gboolean new_volume_slider_widget(DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client);
 static gboolean key_press_cb(GtkWidget* widget, GdkEventKey* event, gpointer data);
@@ -196,12 +195,13 @@
 static GtkImage *
 get_icon (IndicatorObject * io)
 {
-	gchar* current_name = g_hash_table_lookup(volume_states,
+  gchar* current_name = g_hash_table_lookup(volume_states,
 	                                          GINT_TO_POINTER(current_state));
   //g_debug("At start-up attempting to set the image to %s",
   //        current_name);
   speaker_image = indicator_image_helper(current_name);
   gtk_widget_show(GTK_WIDGET(speaker_image));
+    
   return speaker_image;
 }
 
@@ -324,6 +324,8 @@
 	                                newitem,
 	                                menu_volume_item,
 	                                parent);		
+  fetch_mute_value_from_dbus();
+  fetch_sink_availability_from_dbus(INDICATOR_SOUND (io));      
   return TRUE;	
 }
 
@@ -359,6 +361,7 @@
     dbus_g_proxy_connect_signal(sound_dbus_proxy, SIGNAL_SINK_MUTE_UPDATE, G_CALLBACK(catch_signal_sink_mute_update), user_data, NULL);
     dbus_g_proxy_add_signal(sound_dbus_proxy, SIGNAL_SINK_AVAILABLE_UPDATE, G_TYPE_BOOLEAN, G_TYPE_INVALID);
     dbus_g_proxy_connect_signal(sound_dbus_proxy, SIGNAL_SINK_AVAILABLE_UPDATE, G_CALLBACK(catch_signal_sink_availability_update), NULL, NULL);	
+
     if( service_restart == TRUE){
       fetch_mute_value_from_dbus();
       // Ensure UI is in sync with service again.
@@ -584,10 +587,11 @@
     return;
   }
   initial_mute = *mute_input;
-  if (initial_mute == TRUE)
+  if (initial_mute == TRUE){
     update_state(STATE_MUTED);
+  }
   g_free(mute_input);
-  //g_debug("at the indicator start up and the MUTE returned from dbus method is %i", initial_mute);
+  g_debug("at the indicator start up and the MUTE returned from dbus method is %i", initial_mute);
 }
 
 /*******************************************************************/

=== 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 @@
 static void update_sink_info(pa_context *c, const pa_sink_info *info, int eol, void *userdata);
 static void destroy_sink_info(void *value);
 static gboolean determine_sink_availability();
-static void reconnect_to_pulse();
 
 static gboolean has_volume_changed(const pa_sink_info* new_sink, sink_info* cached_sink);
 static pa_cvolume construct_mono_volume(const pa_cvolume* vol);
@@ -100,35 +99,6 @@
 }
 
 /**
-reconnect_to_pulse()
-In the event of Pulseaudio flapping in the wind handle gracefully without
-memory leaks !
-*/
-static void reconnect_to_pulse()
-{
-  // reset
-  if (pulse_context != NULL) {
-    g_debug("freeing the pulse context");
-    pa_context_unref(pulse_context);
-    pulse_context = NULL;
-  }
-
-  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");
-  g_assert(pulse_context);
-  sink_hash = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, destroy_sink_info);
-  // Establish event callback registration
-  pa_context_set_state_callback(pulse_context, context_state_callback, NULL);
-  dbus_menu_manager_update_pa_state(FALSE, FALSE, FALSE, 0);
-  pa_context_connect(pulse_context, NULL, PA_CONTEXT_NOFAIL, NULL);
-}
-
-/**
 destroy_sink_info()
 item destructor method for the sink_info hash
 **/


Follow ups