diff --git a/panels/bluetooth/cc-bluetooth-panel.c b/panels/bluetooth/cc-bluetooth-panel.c index 175e36550bb767e40f269212f2903deff310075c..c38e8362189c8802fcaa161a1283469fdd91c6da 100644 --- a/panels/bluetooth/cc-bluetooth-panel.c +++ b/panels/bluetooth/cc-bluetooth-panel.c @@ -80,20 +80,24 @@ airplane_mode_changed_cb (GObject *source_object, { g_autoptr(GVariant) ret = NULL; g_autoptr(GError) error = NULL; - gboolean state = GPOINTER_TO_UINT (user_data); if (!g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), res, &error)) { - if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) + if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + CcBluetoothPanel *self = user_data; + gboolean state = gtk_switch_get_active (self->enable_switch); + g_warning ("Failed to change Bluetooth killswitch state to %s: %s", state ? "on" : "off", error->message); + } } else { CcBluetoothPanel *self = user_data; + gboolean state = gtk_switch_get_active (self->enable_switch); g_debug ("Changed Bluetooth killswitch state to %s", state ? "on" : "off"); - if (!bluetooth_settings_widget_get_default_adapter_powered (self->settings_widget)) + if (state && !bluetooth_settings_widget_get_default_adapter_powered (self->settings_widget)) bluetooth_settings_widget_set_default_adapter_powered(self->settings_widget, TRUE); } } @@ -177,7 +181,6 @@ airplane_mode_changed (CcBluetoothPanel *self) self->bt_airplane_mode = g_variant_get_boolean (bluetooth_airplane_mode); bluetooth_hardware_airplane_mode = g_dbus_proxy_get_cached_property (self->rfkill, "BluetoothHardwareAirplaneMode"); - g_message ("BluetoothHardwareAirplaneMode: %d", self->hardware_airplane_mode); self->hardware_airplane_mode = g_variant_get_boolean (bluetooth_hardware_airplane_mode); bluetooth_has_airplane_mode = g_dbus_proxy_get_cached_property (self->rfkill, "BluetoothHasAirplaneMode");