diff --git a/data/gschema.xml b/data/gschema.xml deleted file mode 100644 index 495cdc33..00000000 --- a/data/gschema.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - true - Sets the last bluetooth state to re-apply on reboot - - - - diff --git a/data/meson.build b/data/meson.build index af8e63ca..eda08257 100644 --- a/data/meson.build +++ b/data/meson.build @@ -6,9 +6,3 @@ i18n.merge_file( install: true, install_dir: datadir / 'metainfo' ) - -install_data( - 'gschema.xml', - rename: 'io.elementary.desktop.wingpanel.bluetooth.gschema.xml', - install_dir: datadir / 'glib-2.0' / 'schemas' -) diff --git a/src/Services/Manager.vala b/src/Services/Manager.vala index 15f3c32b..3ac9f873 100644 --- a/src/Services/Manager.vala +++ b/src/Services/Manager.vala @@ -28,7 +28,7 @@ public class BluetoothIndicator.Services.ObjectManager : Object { public bool is_connected {get; private set; default = false; } construct { - settings = new Settings ("io.elementary.desktop.wingpanel.bluetooth"); + settings = new Settings ("io.elementary.desktop.bluetooth"); create_manager.begin (); } @@ -53,13 +53,6 @@ public class BluetoothIndicator.Services.ObjectManager : Object { object_manager.object_removed.connect ((object) => { object.get_interfaces ().foreach ((iface) => on_interface_removed (object, iface)); }); - - settings.changed["bluetooth-enabled"].connect (() => { - var enabled = settings.get_boolean ("bluetooth-enabled"); - if (enabled != this.is_powered) { - set_state_from_settings.begin (); - } - }); } catch (Error e) { critical (e.message); } @@ -230,7 +223,7 @@ public class BluetoothIndicator.Services.ObjectManager : Object { } public async void set_state_from_settings () { - yield set_global_state (settings.get_boolean ("bluetooth-enabled")); + yield set_global_state (settings.get_boolean ("enabled")); } public static bool compare_devices (Device device, Device other) { diff --git a/src/Widgets/DisplayWidget.vala b/src/Widgets/DisplayWidget.vala index 479ec1a9..21ad3156 100644 --- a/src/Widgets/DisplayWidget.vala +++ b/src/Widgets/DisplayWidget.vala @@ -44,8 +44,8 @@ public class BluetoothIndicator.Widgets.DisplayWidget : Granite.Bin { }; gesture_click.pressed.connect (() => { object_manager.settings.set_boolean ( - "bluetooth-enabled", - !object_manager.settings.get_boolean ("bluetooth-enabled") + "enabled", + !object_manager.settings.get_boolean ("enabled") ); }); diff --git a/src/Widgets/PopoverWidget.vala b/src/Widgets/PopoverWidget.vala index 46080b80..d78c9097 100644 --- a/src/Widgets/PopoverWidget.vala +++ b/src/Widgets/PopoverWidget.vala @@ -29,9 +29,7 @@ public class BluetoothIndicator.Widgets.PopoverWidget : Gtk.Box { construct { orientation = VERTICAL; - main_switch = new Granite.SwitchModelButton (_("Bluetooth")) { - active = object_manager.get_global_state () - }; + main_switch = new Granite.SwitchModelButton (_("Bluetooth")); main_switch.add_css_class (Granite.STYLE_CLASS_H4_LABEL); devices_list = new Gtk.ListBox (); @@ -73,18 +71,13 @@ public class BluetoothIndicator.Widgets.PopoverWidget : Gtk.Box { append (show_settings_button); } - main_switch.active = object_manager.get_global_state (); - update_ui_state (object_manager.get_global_state ()); devices_list.row_activated.connect ((row) => { ((Widgets.Device) row).toggle_device.begin (); }); - main_switch.notify["active"].connect (() => { - warning ("main switch toggle - active %s", main_switch.active.to_string ()); - object_manager.settings.set_boolean ("bluetooth-enabled", main_switch.active); - }); + object_manager.settings.bind ("enabled", main_switch, "active", DEFAULT); show_settings_button.clicked.connect (() => { try {