aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2013-01-31 11:10:38 +1300
committerRobert Ancell <robert.ancell@canonical.com>2013-01-31 11:10:38 +1300
commit748795c6725fc00de67d4f2b54052c62d7f5b51e (patch)
tree0b65a3556178dd50b25e109811853a73177dddab
parent842e5786a4b78fc48686d6439e512a2d7d843c07 (diff)
downloadayatana-indicator-bluetooth-748795c6725fc00de67d4f2b54052c62d7f5b51e.tar.gz
ayatana-indicator-bluetooth-748795c6725fc00de67d4f2b54052c62d7f5b51e.tar.bz2
ayatana-indicator-bluetooth-748795c6725fc00de67d4f2b54052c62d7f5b51e.zip
Stop items being duplicated on resume from suspend
-rw-r--r--NEWS4
-rw-r--r--configure.ac2
-rw-r--r--src/indicator-bluetooth-service.vala26
3 files changed, 18 insertions, 14 deletions
diff --git a/NEWS b/NEWS
index 9e0158d..197fd06 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+Overview of changes in indicator-bluetooth 0.0.4
+
+ * Stop items being duplicated on resume from suspend
+
Overview of changes in indicator-bluetooth 0.0.3
* Fix service file having incorrect path
diff --git a/configure.ac b/configure.ac
index 7c8b569..5f5f64a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT(indicator-bluetooth, 0.0.3)
+AC_INIT(indicator-bluetooth, 0.0.4)
AM_INIT_AUTOMAKE([1.11 no-dist-gzip dist-xz foreign])
AM_SILENT_RULES([yes])
AM_MAINTAINER_MODE
diff --git a/src/indicator-bluetooth-service.vala b/src/indicator-bluetooth-service.vala
index 14dc090..00aaa23 100644
--- a/src/indicator-bluetooth-service.vala
+++ b/src/indicator-bluetooth-service.vala
@@ -115,10 +115,10 @@ public class BluetoothIndicator
killswitch_state_changed_cb (killswitch.state);
}
- private BluetoothMenuItem? find_menu_item (DBusProxy proxy)
+ private BluetoothMenuItem? find_menu_item (string address)
{
foreach (var item in device_items)
- if (item.proxy == proxy)
+ if (item.address == address)
return item;
return null;
@@ -152,12 +152,12 @@ public class BluetoothIndicator
/* Skip if haven't actually got any information yet */
if (proxy == null)
return;
-
+
/* Find or create menu item */
- var item = find_menu_item (proxy);
+ var item = find_menu_item (address);
if (item == null)
{
- item = new BluetoothMenuItem (client, proxy);
+ item = new BluetoothMenuItem (client, address);
item.property_set_bool (Dbusmenu.MENUITEM_PROP_VISIBLE, killswitch.state == GnomeBluetooth.KillswitchState.UNBLOCKED);
var last_item = devices_separator as Dbusmenu.Menuitem;
if (device_items != null)
@@ -166,7 +166,7 @@ public class BluetoothIndicator
menu.child_add_position (item, last_item.get_position (menu) + 1);
}
- item.update (type, address, alias, icon, connected, services, uuids);
+ item.update (type, proxy, alias, icon, connected, services, uuids);
}
private void device_removed_cb (Gtk.TreePath path)
@@ -175,10 +175,10 @@ public class BluetoothIndicator
if (!client.model.get_iter (out iter, path))
return;
- DBusProxy proxy;
- client.model.get (iter, GnomeBluetooth.Column.PROXY, out proxy);
+ string address;
+ client.model.get (iter, GnomeBluetooth.Column.ADDRESS, out address);
- var item = find_menu_item (proxy);
+ var item = find_menu_item (address);
if (item == null)
return;
@@ -227,17 +227,17 @@ public class BluetoothIndicator
private class BluetoothMenuItem : Dbusmenu.Menuitem
{
private GnomeBluetooth.Client client;
- public DBusProxy proxy;
+ public string address;
private Dbusmenu.Menuitem? connect_item = null;
private bool make_submenu = false;
- public BluetoothMenuItem (GnomeBluetooth.Client client, DBusProxy proxy)
+ public BluetoothMenuItem (GnomeBluetooth.Client client, string address)
{
this.client = client;
- this.proxy = proxy;
+ this.address = address;
}
- public void update (GnomeBluetooth.Type type, string address, string alias, string icon, bool connected, HashTable? services, string[] uuids)
+ public void update (GnomeBluetooth.Type type, DBusProxy proxy, string alias, string icon, bool connected, HashTable? services, string[] uuids)
{
property_set (Dbusmenu.MENUITEM_PROP_LABEL, alias);
property_set (Dbusmenu.MENUITEM_PROP_ICON_NAME, icon);