[gnome-bluetooth/fedora-11] 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/fedora-11] Hide unwanted menu items when Bluetooth is disabled
- Date: Wed, 16 Sep 2009 10:43:21 +0000 (UTC)
commit b83c15e7c2ac8c24516fa97bc26a13eb40c40331
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 0060ae4..a4677b0 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]