[gnome-bluetooth/fedora-11] Update the Powered column on adapter changes



commit e0f2fbece374182b30e6375eee04b76cb6ddf87b
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Jul 30 18:26:05 2009 +0100

    Update the Powered column on adapter changes
    
    Otherwise we miss the adapter going down on soft block rfkill.

 lib/bluetooth-client.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/lib/bluetooth-client.c b/lib/bluetooth-client.c
index 52a7481..c56cc8e 100644
--- a/lib/bluetooth-client.c
+++ b/lib/bluetooth-client.c
@@ -825,6 +825,18 @@ static void adapter_changed(DBusGProxy *adapter, const char *property,
 		gtk_tree_store_set(priv->store, &iter,
 				BLUETOOTH_COLUMN_DISCOVERING, discovering, -1);
 		notify = TRUE;
+	} else if (g_str_equal(property, "Powered") == TRUE) {
+		gboolean powered = g_value_get_boolean(value);
+		gboolean is_default;
+
+		gtk_tree_store_set(priv->store, &iter,
+				   BLUETOOTH_COLUMN_POWERED, powered, -1);
+		gtk_tree_model_get(GTK_TREE_MODEL(priv->store), &iter,
+				   BLUETOOTH_COLUMN_DEFAULT, &is_default, -1);
+		if (is_default != FALSE && powered != priv->default_adapter_powered) {
+			priv->default_adapter_powered = powered;
+			g_object_notify (G_OBJECT (client), "default-adapter-powered");
+		}
 	}
 
 	if (notify != FALSE) {



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