[gnome-control-center] thunderbolt: Use AdwStatusPage for empty state
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] thunderbolt: Use AdwStatusPage for empty state
- Date: Thu, 10 Feb 2022 22:35:28 +0000 (UTC)
commit 4f2aa07ff5fcafbc7fc600bd604479cf5af316d9
Author: Christopher Davis <christopherdavis gnome org>
Date: Thu Feb 10 14:01:18 2022 -0800
thunderbolt: Use AdwStatusPage for empty state
Make use of libadwaita's provided widget for status pages
instead of rolling our own.
panels/thunderbolt/cc-bolt-panel.c | 10 ++---
panels/thunderbolt/cc-bolt-panel.ui | 75 ++-----------------------------------
2 files changed, 8 insertions(+), 77 deletions(-)
---
diff --git a/panels/thunderbolt/cc-bolt-panel.c b/panels/thunderbolt/cc-bolt-panel.c
index 67a7b431d..fc9986200 100644
--- a/panels/thunderbolt/cc-bolt-panel.c
+++ b/panels/thunderbolt/cc-bolt-panel.c
@@ -48,8 +48,7 @@ struct _CcBoltPanel
GtkStack *container;
/* empty state */
- GtkLabel *notb_caption;
- GtkLabel *notb_details;
+ AdwStatusPage *notb_page;
/* notifications */
GtkLabel *notification_label;
@@ -170,7 +169,7 @@ bolt_client_ready (GObject *source,
text = _("The Thunderbolt subsystem (boltd) is not installed or "
"not set up properly.");
- gtk_label_set_label (panel->notb_details, text);
+ adw_status_page_set_description (panel->notb_page, text);
gtk_stack_set_visible_child_name (panel->container, "no-thunderbolt");
return;
@@ -465,7 +464,7 @@ cc_bolt_panel_set_no_thunderbolt (CcBoltPanel *panel,
"an unsupported security level in the BIOS.");
}
- gtk_label_set_label (panel->notb_details, msg);
+ adw_status_page_set_description (panel->notb_page, msg);
gtk_stack_set_visible_child_name (panel->container, "no-thunderbolt");
}
@@ -918,8 +917,7 @@ cc_bolt_panel_class_init (CcBoltPanelClass *klass)
gtk_widget_class_bind_template_child (widget_class, CcBoltPanel, direct_access_row);
gtk_widget_class_bind_template_child (widget_class, CcBoltPanel, headerbar_box);
gtk_widget_class_bind_template_child (widget_class, CcBoltPanel, lock_button);
- gtk_widget_class_bind_template_child (widget_class, CcBoltPanel, notb_caption);
- gtk_widget_class_bind_template_child (widget_class, CcBoltPanel, notb_details);
+ gtk_widget_class_bind_template_child (widget_class, CcBoltPanel, notb_page);
gtk_widget_class_bind_template_child (widget_class, CcBoltPanel, notification_label);
gtk_widget_class_bind_template_child (widget_class, CcBoltPanel, notification_revealer);
gtk_widget_class_bind_template_child (widget_class, CcBoltPanel, pending_box);
diff --git a/panels/thunderbolt/cc-bolt-panel.ui b/panels/thunderbolt/cc-bolt-panel.ui
index 5b0993e66..bb4694fa3 100644
--- a/panels/thunderbolt/cc-bolt-panel.ui
+++ b/panels/thunderbolt/cc-bolt-panel.ui
@@ -99,77 +99,10 @@
<object class="GtkStackPage">
<property name="name">no-thunderbolt</property>
<property name="child">
- <object class="GtkCenterBox">
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- <property name="halign">center</property>
- <property name="valign">center</property>
- <property name="orientation">vertical</property>
- <property name="margin-top">18</property>
- <property name="margin-bottom">18</property>
- <property name="margin-start">18</property>
- <property name="margin-end">18</property>
- <child type="center" >
- <object class="GtkGrid">
- <property name="margin_start">12</property>
- <property name="margin_end">6</property>
- <property name="margin_top">12</property>
- <property name="margin_bottom">12</property>
- <property name="row_spacing">12</property>
- <property name="column_spacing">24</property>
-
- <child>
- <object class="GtkImage">
- <property name="icon_name">thunderbolt-symbolic</property>
- <property name="pixel_size">96</property>
- <layout>
- <property name="column">0</property>
- <property name="row">0</property>
- <property name="row-span">2</property>
- </layout>
- <style>
- <class name="dim-label" />
- </style>
- </object>
- </child>
-
- <child>
- <object class="GtkLabel" id="notb_caption">
- <property name="wrap">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">No Thunderbolt support</property>
- <layout>
- <property name="column">1</property>
- <property name="row">0</property>
- </layout>
- <attributes>
- <attribute name="scale" value="1.2" />
- </attributes>
- <style>
- <class name="dim-label" />
- </style>
- </object>
- </child>
-
- <child>
- <object class="GtkLabel" id="notb_details">
- <property name="hexpand">True</property>
- <property name="max-width-chars">40</property>
- <property name="use_markup">True</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
- <property name="wrap">True</property>
- <property name="label" translatable="no">Could not connect to the thunderbolt
subsystem.</property>
- <layout>
- <property name="column">1</property>
- <property name="row">1</property>
- </layout>
- </object>
- </child>
-
- </object>
- </child>
-
+ <object class="AdwStatusPage" id="notb_page">
+ <property name="title" translatable="yes">No Thunderbolt Support</property>
+ <property name="description" translatable="yes">Could not connect to the thunderbolt
subsystem.</property>
+ <property name="icon-name">thunderbolt-symbolic</property>
</object>
</property>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]