aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2012-12-04 17:00:48 +1300
committerRobert Ancell <robert.ancell@canonical.com>2012-12-04 17:00:48 +1300
commit904619da1ec381880e2ecef21d67d07cda3b3e5c (patch)
tree292336113125baa6b34dce4e661e99221bb1bcfa /src
parent5f2959342debe557d1ec9627c936c557fc10b455 (diff)
downloadayatana-indicator-bluetooth-904619da1ec381880e2ecef21d67d07cda3b3e5c.tar.gz
ayatana-indicator-bluetooth-904619da1ec381880e2ecef21d67d07cda3b3e5c.tar.bz2
ayatana-indicator-bluetooth-904619da1ec381880e2ecef21d67d07cda3b3e5c.zip
Fix visible toggle
Diffstat (limited to 'src')
-rw-r--r--src/indicator-bluetooth.vala10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/indicator-bluetooth.vala b/src/indicator-bluetooth.vala
index 55a41a6..b944975 100644
--- a/src/indicator-bluetooth.vala
+++ b/src/indicator-bluetooth.vala
@@ -18,6 +18,7 @@ public class BluetoothIndicator : AppIndicator.Indicator
private Gtk.MenuItem enable_item;
private bool enable_value = false;
private Gtk.CheckMenuItem visible_item;
+ private bool updating_visible = false;
private Gtk.SeparatorMenuItem devices_separator;
private Gtk.MenuItem devices_item;
private List<BluetoothMenuItem> device_items;
@@ -61,11 +62,18 @@ public class BluetoothIndicator : AppIndicator.Indicator
visible_item.active = discoverable;
client.notify["default-adapter-discoverable"].connect (() =>
{
+ updating_visible = true;
bool is_discoverable;
client.get ("default-adapter-discoverable", out is_discoverable);
visible_item.active = is_discoverable;
+ updating_visible = false;
+ });
+ visible_item.activate.connect (() =>
+ {
+ if (updating_visible)
+ return;
+ client.set ("default-adapter-discoverable", visible_item.active);
});
- visible_item.activate.connect (() => { client.set ("default-adapter-discoverable", visible_item.active); });
menu.append (visible_item);
devices_separator = new Gtk.SeparatorMenuItem ();