From 0166a12eefbd48e40ffe3354994462eea45461f0 Mon Sep 17 00:00:00 2001 From: Robert Ancell Date: Fri, 8 Feb 2013 11:20:53 +1300 Subject: Add "Set Up New Device" menu item --- src/indicator-bluetooth-service.vala | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/indicator-bluetooth-service.vala b/src/indicator-bluetooth-service.vala index 63e634d..0348876 100644 --- a/src/indicator-bluetooth-service.vala +++ b/src/indicator-bluetooth-service.vala @@ -22,7 +22,6 @@ public class BluetoothIndicator private bool updating_visible = false; private Dbusmenu.Menuitem devices_separator; private List device_items; - private Dbusmenu.Menuitem settings_item; private Dbusmenu.Menuitem menu; public BluetoothIndicator () throws Error @@ -106,10 +105,15 @@ public class BluetoothIndicator sep.property_set (Dbusmenu.MENUITEM_PROP_TYPE, Dbusmenu.CLIENT_TYPES_SEPARATOR); menu.child_append (sep); - settings_item = new Dbusmenu.Menuitem (); - settings_item.property_set (Dbusmenu.MENUITEM_PROP_LABEL, _("Bluetooth Settings…")); - settings_item.item_activated.connect (() => { show_control_center ("bluetooth"); }); - menu.child_append (settings_item); + var item = new Dbusmenu.Menuitem (); + item.property_set (Dbusmenu.MENUITEM_PROP_LABEL, _("Set Up New Device…")); + item.item_activated.connect (() => { set_up_new_device (); }); + menu.child_append (item); + + item = new Dbusmenu.Menuitem (); + item.property_set (Dbusmenu.MENUITEM_PROP_LABEL, _("Bluetooth Settings…")); + item.item_activated.connect (() => { show_control_center ("bluetooth"); }); + menu.child_append (item); killswitch_state_changed_cb (killswitch.state); } @@ -334,6 +338,18 @@ private class BluetoothMenuItem : Dbusmenu.Menuitem } } +private void set_up_new_device () +{ + try + { + Process.spawn_command_line_async ("bluetooth-wizard"); + } + catch (GLib.SpawnError e) + { + warning ("Failed to open bluetooth-wizard: %s", e.message); + } +} + private void show_control_center (string panel) { try -- cgit v1.2.3