[gnome-control-center/wip/hadess/remove-wireless-power-switches: 2/2] power: Remove Bluetooth power switch button
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/wip/hadess/remove-wireless-power-switches: 2/2] power: Remove Bluetooth power switch button
- Date: Thu, 22 Jul 2021 16:34:20 +0000 (UTC)
commit d4cf9699bb5aea3b29725e874342597f2a8caa89
Author: Bastien Nocera <hadess hadess net>
Date: Thu Jul 22 18:33:41 2021 +0200
power: Remove Bluetooth power switch button
See previous commit.
panels/power/cc-power-panel.c | 82 ------------------------------------------
panels/power/cc-power-panel.ui | 16 ---------
panels/power/meson.build | 4 ---
3 files changed, 102 deletions(-)
---
diff --git a/panels/power/cc-power-panel.c b/panels/power/cc-power-panel.c
index 1b456af2c..0b3147700 100644
--- a/panels/power/cc-power-panel.c
+++ b/panels/power/cc-power-panel.c
@@ -669,61 +669,6 @@ set_ac_battery_ui_mode (CcPowerPanel *self)
}
}
-static void
-bt_set_powered (CcPowerPanel *self,
- gboolean powered)
-{
- g_dbus_proxy_call (self->bt_properties,
- "Set",
- g_variant_new_parsed ("('org.gnome.SettingsDaemon.Rfkill', 'BluetoothAirplaneMode', %v)",
- g_variant_new_boolean (!powered)),
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- cc_panel_get_cancellable (CC_PANEL (self)),
- NULL, NULL);
-}
-
-static void
-bt_switch_changed_cb (CcPowerPanel *self)
-{
- gboolean powered;
-
- powered = gtk_switch_get_active (self->bt_switch);
-
- g_debug ("Setting bt power %s", powered ? "on" : "off");
-
- bt_set_powered (self, powered);
-}
-
-static void
-bt_powered_state_changed (CcPowerPanel *self)
-{
- gboolean powered, has_airplane_mode;
- g_autoptr(GVariant) v1 = NULL;
- g_autoptr(GVariant) v2 = NULL;
-
- v1 = g_dbus_proxy_get_cached_property (self->bt_rfkill, "BluetoothHasAirplaneMode");
- has_airplane_mode = g_variant_get_boolean (v1);
-
- if (!has_airplane_mode)
- {
- g_debug ("BluetoothHasAirplaneMode is false, hiding Bluetooth power row");
- gtk_widget_hide (GTK_WIDGET (self->bt_row));
- return;
- }
-
- v2 = g_dbus_proxy_get_cached_property (self->bt_rfkill, "BluetoothAirplaneMode");
- powered = !g_variant_get_boolean (v2);
-
- g_debug ("bt powered state changed to %s", powered ? "on" : "off");
-
- gtk_widget_show (GTK_WIDGET (self->bt_row));
-
- g_signal_handlers_block_by_func (self->bt_switch, bt_switch_changed_cb, self);
- gtk_switch_set_active (self->bt_switch, powered);
- g_signal_handlers_unblock_by_func (self->bt_switch, bt_switch_changed_cb, self);
-}
-
static gboolean
keynav_failed_cb (CcPowerPanel *self, GtkDirectionType direction, GtkWidget *list)
{
@@ -1142,32 +1087,6 @@ setup_power_saving (CcPowerPanel *self)
set_ac_battery_ui_mode (self);
update_automatic_suspend_label (self);
}
-
-#ifdef HAVE_BLUETOOTH
- self->bt_rfkill = cc_object_storage_create_dbus_proxy_sync (G_BUS_TYPE_SESSION,
- G_DBUS_PROXY_FLAGS_NONE,
- "org.gnome.SettingsDaemon.Rfkill",
- "/org/gnome/SettingsDaemon/Rfkill",
- "org.gnome.SettingsDaemon.Rfkill",
- NULL,
- NULL);
-
- if (self->bt_rfkill)
- {
- self->bt_properties = cc_object_storage_create_dbus_proxy_sync (G_BUS_TYPE_SESSION,
- G_DBUS_PROXY_FLAGS_NONE,
- "org.gnome.SettingsDaemon.Rfkill",
- "/org/gnome/SettingsDaemon/Rfkill",
- "org.freedesktop.DBus.Properties",
- NULL,
- NULL);
- }
-
- g_signal_connect_object (self->bt_rfkill, "g-properties-changed",
- G_CALLBACK (bt_powered_state_changed), self, G_CONNECT_SWAPPED);
-
- bt_powered_state_changed (self);
-#endif
}
static const char *
@@ -1681,7 +1600,6 @@ cc_power_panel_class_init (CcPowerPanelClass *klass)
gtk_widget_class_bind_template_callback (widget_class, als_switch_changed_cb);
gtk_widget_class_bind_template_callback (widget_class, automatic_suspend_label_mnemonic_activate_cb);
- gtk_widget_class_bind_template_callback (widget_class, bt_switch_changed_cb);
gtk_widget_class_bind_template_callback (widget_class, has_brightness_cb);
gtk_widget_class_bind_template_callback (widget_class, has_kbd_brightness_cb);
gtk_widget_class_bind_template_callback (widget_class, blank_screen_row_changed_cb);
diff --git a/panels/power/cc-power-panel.ui b/panels/power/cc-power-panel.ui
index 59ffa9571..ef203b707 100644
--- a/panels/power/cc-power-panel.ui
+++ b/panels/power/cc-power-panel.ui
@@ -237,22 +237,6 @@
</child>
</object>
</child>
- <child>
- <object class="HdyActionRow" id="bt_row">
- <property name="visible">False</property>
- <property name="title" translatable="yes">_Bluetooth</property>
- <property name="subtitle" translatable="yes">Bluetooth can be turned off to save
power.</property>
- <property name="use_underline">True</property>
- <property name="activatable_widget">bt_switch</property>
- <child>
- <object class="GtkSwitch" id="bt_switch">
- <property name="visible">True</property>
- <property name="valign">center</property>
- <signal name="notify::active" handler="bt_switch_changed_cb" object="CcPowerPanel"
swapped="yes"/>
- </object>
- </child>
- </object>
- </child>
</object>
</child>
<child>
diff --git a/panels/power/meson.build b/panels/power/meson.build
index b1380f4e6..9066d24bd 100644
--- a/panels/power/meson.build
+++ b/panels/power/meson.build
@@ -47,10 +47,6 @@ deps = common_deps + [
upower_glib_dep
]
-if host_is_linux_not_s390
- deps += gnome_bluetooth_dep
-endif
-
panels_libs += static_library(
cappletname,
sources: sources,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]