diff options
author | Bastien Nocera <hadess@hadess.net> | 2009-10-20 14:32:21 +0100 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2009-10-20 14:32:21 +0100 |
commit | 186fe455c072e5a6cd0465b0f42ed3f77000a148 (patch) | |
tree | c4a713c8e710804ceb53ae8195f737ea0a7a3bcc | |
parent | 2b92bb904b16bf4bf580730094345a17068ffe59 (diff) | |
download | gnome-bluetooth-186fe455c072e5a6cd0465b0f42ed3f77000a148.tar.gz |
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.
-rw-r--r-- | lib/bluetooth-killswitch.c | 6 | ||||
-rw-r--r-- | 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 e7008711..36f74e8e 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 a8927c96..e97e0110 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 |