[gnome-bluetooth] Handle killswitch appearing after program start



commit e33a670d30374c47cb65efb64dc29c9bc6e0925f
Author: Joshua Lock <josh linux intel com>
Date:   Tue Oct 13 21:40:16 2009 +0100

    Handle killswitch appearing after program start
    
    It's quite possible for a killswitch to appear once the program is already
    running. Handle this by connecting to the "state-changed" signal regardless
    of whether we have killswitches on instantiation.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=598331

 moblin/moblin-panel.c |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)
---
diff --git a/moblin/moblin-panel.c b/moblin/moblin-panel.c
index 1eaaac9..b039f78 100644
--- a/moblin/moblin-panel.c
+++ b/moblin/moblin-panel.c
@@ -875,8 +875,6 @@ create_devices_page (MoblinPanel *self)
 	priv->power_switch = nbtk_gtk_light_switch_new ();
 	if (priv->killswitch != NULL) {
 		if (bluetooth_killswitch_has_killswitches (priv->killswitch) == FALSE) {
-			g_object_unref (priv->killswitch);
-			priv->killswitch = NULL;
 			gtk_widget_set_sensitive (priv->power_switch, FALSE);
 		} else {
 			switch_state = bluetooth_killswitch_get_state (priv->killswitch);
@@ -897,15 +895,14 @@ create_devices_page (MoblinPanel *self)
 					gtk_widget_set_sensitive (priv->power_switch, FALSE);
 				break;
 			}
-
-			g_signal_connect  (priv->killswitch, "state-changed",
-				G_CALLBACK (killswitch_state_changed_cb), self);
-			g_signal_connect (priv->power_switch, "switch-flipped",
-				G_CALLBACK (power_switch_toggled_cb), self);
 		}
 	} else {
 		gtk_widget_set_sensitive (priv->power_switch, FALSE);
 	}
+	g_signal_connect  (priv->killswitch, "state-changed",
+			G_CALLBACK (killswitch_state_changed_cb), self);
+	g_signal_connect (priv->power_switch, "switch-flipped",
+			G_CALLBACK (power_switch_toggled_cb), self);
 	gtk_widget_show (priv->power_switch);
 	gtk_box_pack_start (GTK_BOX (hbox), priv->power_switch, FALSE, FALSE, 4);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]