summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Davis <christopherdavis@gnome.org>2022-01-04 17:51:13 -0800
committerBastien Nocera <hadess@hadess.net>2022-01-17 19:21:49 +0000
commitfdda3e77f6b979eb335e87f9a5e3bb19e3b646cf (patch)
tree69a7867634524aab08621ef4eddd1237a408eb69
parent85c3ca6adae8fdeaaca3fe977b2ed73c5da1d2fd (diff)
downloadgnome-control-center-fdda3e77f6b979eb335e87f9a5e3bb19e3b646cf.tar.gz
bluetooth: Use AdwStatusPage
libadwaita provides a widget for empty pages that we should use in all previous places where we rolled our own.
-rw-r--r--panels/bluetooth/cc-bluetooth-panel.c26
-rw-r--r--panels/bluetooth/cc-bluetooth-panel.ui147
2 files changed, 35 insertions, 138 deletions
diff --git a/panels/bluetooth/cc-bluetooth-panel.c b/panels/bluetooth/cc-bluetooth-panel.c
index f346d36dc..971ac7ce8 100644
--- a/panels/bluetooth/cc-bluetooth-panel.c
+++ b/panels/bluetooth/cc-bluetooth-panel.c
@@ -22,6 +22,8 @@
#include <config.h>
#endif
+#include <adwaita.h>
+
#include <shell/cc-shell.h>
#include <shell/cc-object-storage.h>
#include <bluetooth-settings-widget.h>
@@ -32,12 +34,12 @@
struct _CcBluetoothPanel {
CcPanel parent_instance;
- GtkBox *airplane_box;
- GtkBox *disabled_box;
+ AdwStatusPage *airplane_page;
+ AdwStatusPage *disabled_page;
GtkSwitch *enable_switch;
GtkBox *header_box;
- GtkBox *hw_airplane_box;
- GtkBox *no_devices_box;
+ AdwStatusPage *hw_airplane_page;
+ AdwStatusPage *no_devices_page;
BluetoothSettingsWidget *settings_widget;
GtkStack *stack;
@@ -133,23 +135,23 @@ adapter_status_changed_cb (CcBluetoothPanel *self)
g_debug ("No Bluetooth available");
sensitive = FALSE;
powered = FALSE;
- page = GTK_WIDGET (self->no_devices_box);
+ page = GTK_WIDGET (self->no_devices_page);
} else if (self->hardware_airplane_mode) {
g_debug ("Bluetooth is Hard blocked");
sensitive = FALSE;
powered = FALSE;
- page = GTK_WIDGET (self->hw_airplane_box);
+ page = GTK_WIDGET (self->hw_airplane_page);
} else if (self->airplane_mode) {
g_debug ("Airplane mode is on, Wi-Fi and Bluetooth are disabled");
sensitive = FALSE;
powered = FALSE;
- page = GTK_WIDGET (self->airplane_box);
+ page = GTK_WIDGET (self->airplane_page);
} else if (self->bt_airplane_mode ||
!bluetooth_settings_widget_get_default_adapter_powered (self->settings_widget)) {
g_debug ("Default adapter is unpowered");
sensitive = TRUE;
powered = FALSE;
- page = GTK_WIDGET (self->disabled_box);
+ page = GTK_WIDGET (self->disabled_page);
} else {
g_debug ("Bluetooth is available and powered");
sensitive = TRUE;
@@ -231,12 +233,12 @@ cc_bluetooth_panel_class_init (CcBluetoothPanelClass *klass)
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/bluetooth/cc-bluetooth-panel.ui");
- gtk_widget_class_bind_template_child (widget_class, CcBluetoothPanel, airplane_box);
- gtk_widget_class_bind_template_child (widget_class, CcBluetoothPanel, disabled_box);
+ gtk_widget_class_bind_template_child (widget_class, CcBluetoothPanel, airplane_page);
+ gtk_widget_class_bind_template_child (widget_class, CcBluetoothPanel, disabled_page);
gtk_widget_class_bind_template_child (widget_class, CcBluetoothPanel, enable_switch);
gtk_widget_class_bind_template_child (widget_class, CcBluetoothPanel, header_box);
- gtk_widget_class_bind_template_child (widget_class, CcBluetoothPanel, no_devices_box);
- gtk_widget_class_bind_template_child (widget_class, CcBluetoothPanel, hw_airplane_box);
+ gtk_widget_class_bind_template_child (widget_class, CcBluetoothPanel, no_devices_page);
+ gtk_widget_class_bind_template_child (widget_class, CcBluetoothPanel, hw_airplane_page);
gtk_widget_class_bind_template_child (widget_class, CcBluetoothPanel, settings_widget);
gtk_widget_class_bind_template_child (widget_class, CcBluetoothPanel, stack);
diff --git a/panels/bluetooth/cc-bluetooth-panel.ui b/panels/bluetooth/cc-bluetooth-panel.ui
index ce1ff965c..98648e63a 100644
--- a/panels/bluetooth/cc-bluetooth-panel.ui
+++ b/panels/bluetooth/cc-bluetooth-panel.ui
@@ -5,147 +5,42 @@
<child>
<object class="GtkStack" id="stack">
<child>
- <object class="GtkBox" id="no_devices_box">
- <property name="orientation">vertical</property>
- <property name="margin_top">64</property>
- <property name="margin_bottom">64</property>
- <property name="margin_start">12</property>
- <property name="margin_end">12</property>
- <property name="spacing">24</property>
- <child>
- <object class="GtkImage">
- <property name="icon_name">bluetooth-active-symbolic</property>
- <property name="pixel_size">192</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="label" translatable="yes">No Bluetooth Found</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- <attribute name="scale" value="1.2"/>
- </attributes>
- </object>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="wrap">True</property>
- <property name="label" translatable="yes">Plug in a dongle to use Bluetooth.</property>
- </object>
- </child>
+ <object class="AdwStatusPage" id="no_devices_page">
+ <property name="icon-name">bluetooth-active-symbolic</property>
+ <property name="title" translatable="yes">No Bluetooth Found</property>
+ <property name="description" translatable="yes">Plug in a dongle to use Bluetooth.</property>
</object>
</child>
<child>
- <object class="GtkBox" id="disabled_box">
- <property name="orientation">vertical</property>
- <property name="margin_top">64</property>
- <property name="margin_bottom">64</property>
- <property name="margin_start">12</property>
- <property name="margin_end">12</property>
- <property name="spacing">24</property>
- <child>
- <object class="GtkImage">
- <property name="icon_name">bluetooth-active-symbolic</property>
- <property name="pixel_size">192</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="label" translatable="yes">Bluetooth Turned Off</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- <attribute name="scale" value="1.2"/>
- </attributes>
- </object>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="wrap">True</property>
- <property name="label" translatable="yes">Turn on to connect devices and receive file transfers.</property>
- </object>
- </child>
+ <object class="AdwStatusPage" id="disabled_page">
+ <property name="icon-name">bluetooth-active-symbolic</property>
+ <property name="title" translatable="yes">Bluetooth Turned Off</property>
+ <property name="description" translatable="yes">Turn on to connect devices and receive file transfers.</property>
</object>
</child>
<child>
- <object class="GtkBox" id="airplane_box">
- <property name="orientation">vertical</property>
- <property name="margin_top">64</property>
- <property name="margin_bottom">64</property>
- <property name="margin_start">12</property>
- <property name="margin_end">12</property>
- <property name="spacing">24</property>
- <child>
- <object class="GtkImage">
- <property name="icon_name">airplane-mode-symbolic</property>
- <property name="pixel_size">192</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="label" translatable="yes">Airplane Mode is on</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- <attribute name="scale" value="1.2"/>
- </attributes>
- </object>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="wrap">True</property>
- <property name="label" translatable="yes">Bluetooth is disabled when airplane mode is on.</property>
- </object>
- </child>
- <child>
+ <object class="AdwStatusPage" id="airplane_page">
+ <property name="icon-name">airplane-mode-symbolic</property>
+ <property name="title" translatable="yes">Airplane Mode is On</property>
+ <property name="description" translatable="yes">Bluetooth is disabled when airplane mode is on.</property>
+ <property name="child">
<object class="GtkButton">
<property name="label" translatable="yes">Turn Off Airplane Mode</property>
<property name="halign">center</property>
<property name="valign">center</property>
<signal name="clicked" handler="airplane_mode_off_button_clicked_cb" object="CcBluetoothPanel" swapped="yes"/>
+ <style>
+ <class name="pill"/>
+ </style>
</object>
- </child>
+ </property>
</object>
</child>
<child>
- <object class="GtkBox" id="hw_airplane_box">
- <property name="orientation">vertical</property>
- <property name="margin_top">64</property>
- <property name="margin_bottom">64</property>
- <property name="margin_start">12</property>
- <property name="margin_end">12</property>
- <property name="spacing">24</property>
- <child>
- <object class="GtkImage">
- <property name="icon_name">airplane-mode-symbolic</property>
- <property name="pixel_size">192</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="label" translatable="yes">Hardware Airplane Mode is on</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- <attribute name="scale" value="1.2"/>
- </attributes>
- </object>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="wrap">True</property>
- <property name="label" translatable="yes">Turn off the Airplane mode switch to enable Bluetooth.</property>
- </object>
- </child>
+ <object class="AdwStatusPage" id="hw_airplane_page">
+ <property name="icon-name">airplane-mode-symbolic</property>
+ <property name="title" translatable="yes">Hardware Airplane Mode is On</property>
+ <property name="description" translatable="yes">Turn off the Airplane mode switch to enable Bluetooth.</property>
</object>
</child>
<child>