55
66public class Sharing.Widgets.BluetoothPage : Switchboard .SettingsPage {
77 private GLib . Settings daemon_settings;
8- private GLib . Settings panel_settings;
98
109 public BluetoothPage () {
1110 Object (activatable: true );
@@ -37,11 +36,9 @@ public class Sharing.Widgets.BluetoothPage : Switchboard.SettingsPage {
3736 daemon_settings. bind (" sharing" , status_switch, " active" , NO_SENSITIVITY );
3837 daemon_settings. bind (" confirm-accept-files" , accept_switch, " active" , DEFAULT );
3938
40- panel_settings = new GLib .Settings (" io.elementary.desktop.wingpanel.bluetooth" );
41-
4239 set_service_state ();
4340
44- panel_settings . changed [" bluetooth- enabled" ]. connect (() = > {
41+ daemon_settings . changed [" enabled" ]. connect (() = > {
4542 set_service_state ();
4643 });
4744
@@ -56,20 +53,22 @@ public class Sharing.Widgets.BluetoothPage : Switchboard.SettingsPage {
5653 }
5754
5855 private void set_service_state () {
59- if (panel_settings. get_boolean (" bluetooth-enabled" )) {
60- if (daemon_settings. get_boolean (" sharing" )) {
61- description = _(" While enabled, Bluetooth devices can send files to Downloads." );
62- status = _(" Enabled" );
63- status_type = SUCCESS ;
64- } else {
65- description = _(" While disabled, Bluetooth devices can not send files to Downloads." );
66- status = _(" Disabled" );
67- status_type = OFFLINE ;
68- }
69- } else {
56+ if (! daemon_settings. get_boolean (" enabled" )) {
7057 description = _(" The Bluetooth device is either disconnected or disabled. Check Bluetooth settings and try again." );
7158 status_type = ERROR ;
7259 status = _(" Not Available" );
60+
61+ return ;
62+ }
63+
64+ if (daemon_settings. get_boolean (" sharing" )) {
65+ description = _(" While enabled, Bluetooth devices can send files to Downloads." );
66+ status = _(" Enabled" );
67+ status_type = SUCCESS ;
68+ } else {
69+ description = _(" While disabled, Bluetooth devices can not send files to Downloads." );
70+ status = _(" Disabled" );
71+ status_type = OFFLINE ;
7372 }
7473 }
7574}
0 commit comments