[gnome-bluetooth/gnome-2-28] Add KILLSWITCH_STATE_NO_ADAPTER killswich state
- From: Bastien Nocera <hadess src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth/gnome-2-28] Add KILLSWITCH_STATE_NO_ADAPTER killswich state
- Date: Tue, 20 Oct 2009 13:36:22 +0000 (UTC)
commit 186fe455c072e5a6cd0465b0f42ed3f77000a148
Author: Bastien Nocera <hadess hadess net>
Date: Tue Oct 20 14:32:21 2009 +0100
Add KILLSWITCH_STATE_NO_ADAPTER killswich state
As killswitches for adapters can come and go, make sure that
we tell the front-ends when an adapter goes away, so they can
update their UI.
lib/bluetooth-killswitch.c | 6 ++++++
lib/bluetooth-killswitch.h | 1 +
2 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/lib/bluetooth-killswitch.c b/lib/bluetooth-killswitch.c
index e700871..36f74e8 100644
--- a/lib/bluetooth-killswitch.c
+++ b/lib/bluetooth-killswitch.c
@@ -146,6 +146,9 @@ bluetooth_killswitch_get_state (BluetoothKillswitch *killswitch)
priv = BLUETOOTH_KILLSWITCH_GET_PRIVATE (killswitch);
+ if (priv->killswitches == NULL)
+ return KILLSWITCH_STATE_NO_ADAPTER;
+
for (l = priv->killswitches ; l ; l = l->next) {
BluetoothIndKillswitch *ind = l->data;
@@ -192,6 +195,9 @@ remove_killswitch (BluetoothKillswitch *killswitch,
if (ind->index == index) {
priv->killswitches = g_list_remove (priv->killswitches, ind);
g_message ("removing killswitch idx %d", index);
+ g_signal_emit (G_OBJECT (killswitch),
+ signals[STATE_CHANGED],
+ 0, bluetooth_killswitch_get_state (killswitch));
return;
}
}
diff --git a/lib/bluetooth-killswitch.h b/lib/bluetooth-killswitch.h
index a8927c9..e97e011 100644
--- a/lib/bluetooth-killswitch.h
+++ b/lib/bluetooth-killswitch.h
@@ -30,6 +30,7 @@
G_BEGIN_DECLS
typedef enum {
+ KILLSWITCH_STATE_NO_ADAPTER = -1,
KILLSWITCH_STATE_SOFT_BLOCKED = 0,
KILLSWITCH_STATE_UNBLOCKED,
KILLSWITCH_STATE_HARD_BLOCKED
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]