[gnome-bluetooth] Hide unwanted menu items when Bluetooth is disabled
- From: Bastien Nocera <hadess src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth] Hide unwanted menu items when Bluetooth is disabled
- Date: Thu, 30 Jul 2009 17:45:17 +0000 (UTC)
commit acc1a393176695d2df443fd00086e315dfbd4fbd
Author: Bastien Nocera <hadess hadess net>
Date: Thu Jul 30 18:30:00 2009 +0100
Hide unwanted menu items when Bluetooth is disabled
We don't care about much of the menu items when there's no
adapters enabled.
applet/main.c | 15 +++++++++------
applet/popup-menu.ui | 8 ++++++++
2 files changed, 17 insertions(+), 6 deletions(-)
---
diff --git a/applet/main.c b/applet/main.c
index c849e17..e9b077d 100644
--- a/applet/main.c
+++ b/applet/main.c
@@ -365,18 +365,21 @@ update_menu_items (void)
else
enabled = (num_adapters_present - num_adapters_powered) <= 0;
+ object = gtk_builder_get_object (xml, "adapter-action-group");
+ gtk_action_group_set_visible (GTK_ACTION_GROUP (object), enabled);
+ gtk_action_group_set_visible (devices_action_group, enabled);
+
+ if (enabled == FALSE)
+ return;
+
object = gtk_builder_get_object (xml, "send-file");
gtk_action_set_sensitive (GTK_ACTION (object),
- enabled &&
- (program_available ("obex-data-server")
- || program_available ("obexd")));
+ program_available ("obexd"));
object = gtk_builder_get_object (xml, "browse-device");
gtk_action_set_sensitive (GTK_ACTION (object),
- enabled && program_available ("nautilus"));
+ program_available ("nautilus"));
- object = gtk_builder_get_object (xml, "setup-new");
- gtk_action_set_sensitive (GTK_ACTION (object), enabled);
}
static void
diff --git a/applet/popup-menu.ui b/applet/popup-menu.ui
index 82e25d8..1ced8a1 100644
--- a/applet/popup-menu.ui
+++ b/applet/popup-menu.ui
@@ -20,6 +20,10 @@
<signal name="activate" handler="bluetooth_status_callback"/>
</object>
</child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkActionGroup" id="adapter-action-group">
<child>
<object class="GtkAction" id="send-file">
<property name="label" translatable="yes">Send files to device...</property>
@@ -46,6 +50,10 @@
<signal name="activate" handler="wizard_callback"/>
</object>
</child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkActionGroup" id="preferences-action-group">
<child>
<object class="GtkAction" id="preferences">
<property name="label" translatable="yes">Preferences</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]