From 43059ed45ac41e1bf6172b3eec236ea086d81cda Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sat, 3 Aug 2013 10:47:23 -0500 Subject: change the 'BluetoothMenu' superclass to 'Profile' --- src/service.vala | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'src/service.vala') diff --git a/src/service.vala b/src/service.vala index 0f3d779..10f7f25 100644 --- a/src/service.vala +++ b/src/service.vala @@ -12,7 +12,7 @@ public class BluetoothIndicator { private MainLoop loop; private SimpleActionGroup actions; - private HashTable menus; + private HashTable profiles; private DBusConnection bus; private Indicator.Service indicator_service; @@ -30,16 +30,13 @@ public class BluetoothIndicator public BluetoothIndicator (Bluetooth bluetooth) { - var phone = new PhoneMenu (bluetooth); - var desktop = new DesktopMenu (bluetooth); + profiles = new HashTable (str_hash, str_equal); + profiles.insert ("phone", new Phone (bluetooth)); + profiles.insert ("desktop", new Desktop (bluetooth)); - this.menus = new HashTable (str_hash, str_equal); - this.menus.insert ("phone", phone); - this.menus.insert ("desktop", desktop); - - this.actions = new SimpleActionGroup (); - phone.add_actions_to_group (this.actions); - desktop.add_actions_to_group (this.actions); + actions = new SimpleActionGroup (); + foreach (Profile profile in profiles.get_values()) + profile.add_actions_to_group (actions); } private void init_for_bus (DBusConnection bus) @@ -178,7 +175,7 @@ public class BluetoothIndicator critical ("%s", e.message); } - this.menus.@foreach ( (profile, menu) => menu.export (connection, @"/com/canonical/indicator/bluetooth/$profile")); + this.profiles.@foreach ((name,profile) => profile.export_menu (connection, @"/com/canonical/indicator/bluetooth/$name")); } void on_name_lost (DBusConnection connection, string name) @@ -358,6 +355,7 @@ private class BluetoothMenuItem : Dbusmenu.Menuitem { for (var i = 0; uuids[i] != null; i++) { +message ("alias %s uuid #%d: %s", alias, i, uuids[i]); if (uuids[i] == "OBEXObjectPush") can_send = true; if (uuids[i] == "OBEXFileTransfer") -- cgit v1.2.3