[gnome-bluetooth/gnome-2-28] Avoid getting killswitch page when hard blocked
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth/gnome-2-28] Avoid getting killswitch page when hard blocked
- Date: Fri, 18 Jun 2010 15:59:11 +0000 (UTC)
commit 7d561ff3803a566bc367bee4cb32ce781379825b
Author: Bastien Nocera <hadess hadess net>
Date: Fri Jun 18 16:56:50 2010 +0100
Avoid getting killswitch page when hard blocked
We shouldn't get the killswitch page when the killswitches
are hard-blocked, otherwise we'll offer a "turn on" switch
that can't possibly work.
properties/adapter.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/properties/adapter.c b/properties/adapter.c
index 92d5181..5556c4a 100644
--- a/properties/adapter.c
+++ b/properties/adapter.c
@@ -43,6 +43,7 @@
static BluetoothClient *client;
static GtkTreeModel *adapter_model;
static BluetoothKillswitch *killswitch;
+static GtkNotebook *notebook;
#define KILLSWITCH_PAGE_NUM(n) (gtk_notebook_get_n_pages (n) - 2)
#define NO_ADAPTERS_PAGE_NUM(n) (-1)
@@ -268,7 +269,8 @@ static void
set_current_page (GtkNotebook *notebook)
{
if (gtk_tree_model_iter_n_children (adapter_model, NULL) == 0) {
- if (bluetooth_killswitch_has_killswitches (killswitch) != FALSE) {
+ if (bluetooth_killswitch_has_killswitches (killswitch) != FALSE &&
+ bluetooth_killswitch_get_state (killswitch) != KILLSWITCH_STATE_HARD_BLOCKED) {
gtk_notebook_set_current_page (notebook,
KILLSWITCH_PAGE_NUM(notebook));
} else {
@@ -703,6 +705,7 @@ killswitch_state_changed (BluetoothKillswitch *killswitch,
{
if (state != KILLSWITCH_STATE_UNBLOCKED)
g_timeout_add_seconds (3, set_sensitive_now, user_data);
+ set_current_page (GTK_NOTEBOOK (notebook));
}
static void
@@ -774,9 +777,10 @@ create_no_adapter_page (GtkNotebook *notebook)
gtk_notebook_append_page(notebook, mainbox, NULL);
}
-void setup_adapter(GtkNotebook *notebook)
+void setup_adapter(GtkNotebook *_notebook)
{
killswitch = bluetooth_killswitch_new ();
+ notebook = _notebook;
/* Create our static pages first */
create_killswitch_page (notebook);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]