[gnome-bluetooth/gnome-2-28] Make menu invisible when there's no adapters
- From: Bastien Nocera <hadess src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth/gnome-2-28] Make menu invisible when there's no adapters
- Date: Tue, 20 Oct 2009 13:36:27 +0000 (UTC)
commit 4dd699f18339878bb672b3e211225ef0a11927ad
Author: Bastien Nocera <hadess hadess net>
Date: Tue Oct 20 14:34:23 2009 +0100
Make menu invisible when there's no adapters
So we can be sure that the UI is up-to-date when that happens.
applet/main.c | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/applet/main.c b/applet/main.c
index 63d4e06..9bee2b0 100644
--- a/applet/main.c
+++ b/applet/main.c
@@ -274,6 +274,12 @@ killswitch_state_changed (BluetoothKillswitch *killswitch, KillswitchState state
gboolean bstate = FALSE;
const char *label, *status_label;
+ if (state == KILLSWITCH_STATE_NO_ADAPTER) {
+ object = gtk_builder_get_object (xml, "bluetooth-applet-popup");
+ gtk_menu_popdown (GTK_MENU (object));
+ return;
+ }
+
if (state == KILLSWITCH_STATE_SOFT_BLOCKED) {
label = N_("Turn On Bluetooth");
status_label = N_("Bluetooth: Off");
@@ -290,15 +296,9 @@ killswitch_state_changed (BluetoothKillswitch *killswitch, KillswitchState state
g_assert_not_reached ();
}
- if (bluetooth_killswitch_has_killswitches (killswitch) != FALSE) {
- GObject *object;
-
- object = gtk_builder_get_object (xml, "killswitch-label");
- gtk_action_set_visible (GTK_ACTION (object), TRUE);
- }
-
object = gtk_builder_get_object (xml, "killswitch-label");
gtk_action_set_label (GTK_ACTION (object), _(status_label));
+ gtk_action_set_visible (GTK_ACTION (object), TRUE);
object = gtk_builder_get_object (xml, "killswitch");
gtk_action_set_visible (GTK_ACTION (object), sensitive);
@@ -342,6 +342,7 @@ static GtkWidget *create_popupmenu(void)
object = gtk_builder_get_object (xml, "killswitch-label");
gtk_action_set_visible (GTK_ACTION (object), TRUE);
}
+
if (option_debug != FALSE) {
GObject *object;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]