[gnome-control-center/wip/cdavis/40-consistency] thunderbolt: Use HdyStatusPage



commit 88a5aa84e58ef56c53951d975d6b8c9c8cc2b14a
Author: Christopher Davis <christopherdavis gnome org>
Date:   Wed Feb 17 19:12:21 2021 -0800

    thunderbolt: Use HdyStatusPage
    
    Use HdyStatusPage, the pre-made status widget, for the
    empty state.

 panels/thunderbolt/cc-bolt-panel.c  | 11 +++--
 panels/thunderbolt/cc-bolt-panel.ui | 84 +++----------------------------------
 2 files changed, 11 insertions(+), 84 deletions(-)
---
diff --git a/panels/thunderbolt/cc-bolt-panel.c b/panels/thunderbolt/cc-bolt-panel.c
index 9004c3c9b..8b795a669 100644
--- a/panels/thunderbolt/cc-bolt-panel.c
+++ b/panels/thunderbolt/cc-bolt-panel.c
@@ -23,6 +23,7 @@
 #include <list-box-helper.h>
 
 #include <glib/gi18n.h>
+#include <libhandy-1/handy.h>
 #include <polkit/polkit.h>
 
 #include "cc-bolt-device-dialog.h"
@@ -49,8 +50,7 @@ struct _CcBoltPanel
   GtkStack           *container;
 
   /* empty state */
-  GtkLabel           *notb_caption;
-  GtkLabel           *notb_details;
+  HdyStatusPage      *notb_page;
 
   /* notifications */
   GtkLabel           *notification_label;
@@ -175,7 +175,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);
+      hdy_status_page_set_description (panel->notb_page, text);
       gtk_stack_set_visible_child_name (panel->container, "no-thunderbolt");
 
       return;
@@ -471,7 +471,7 @@ cc_bolt_panel_set_no_thunderbolt (CcBoltPanel *panel,
               "an unsupported security level in the BIOS.");
     }
 
-  gtk_label_set_label (panel->notb_details, msg);
+  hdy_status_page_set_description (panel->notb_page, msg);
   gtk_stack_set_visible_child_name (panel->container, "no-thunderbolt");
 }
 
@@ -940,8 +940,7 @@ cc_bolt_panel_class_init (CcBoltPanelClass *klass)
   gtk_widget_class_bind_template_child (widget_class, CcBoltPanel, devices_stack);
   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 226353c64..580f7e5f6 100644
--- a/panels/thunderbolt/cc-bolt-panel.ui
+++ b/panels/thunderbolt/cc-bolt-panel.ui
@@ -96,85 +96,13 @@
             <!-- No tunderbolt -->
 
             <child>
-              <object class="GtkBox">
+              <object class="HdyStatusPage" id="notb_page">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="expand">True</property>
-                <property name="halign">center</property>
-                <property name="valign">center</property>
-                <property name="orientation">vertical</property>
-                <property name="spacing">10</property>
-                <property name="margin">18</property>
-                <child type="center" >
-                  <object class="GtkGrid">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <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="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="icon_name">thunderbolt-symbolic</property>
-                        <property name="pixel_size">96</property>
-                        <property name="yalign">0</property>
-                        <style>
-                          <class name="dim-label" />
-                        </style>
-                      </object>
-                      <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">0</property>
-                        <property name="height">2</property>
-                      </packing>
-                    </child>
-
-                    <child>
-                      <object class="GtkLabel" id="notb_caption">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="wrap">True</property>
-                        <property name="xalign">0</property>
-                        <property name="label" translatable="yes">No Thunderbolt support</property>
-                        <attributes>
-                          <attribute name="scale" value="1.2" />
-                        </attributes>
-                        <style>
-                          <class name="dim-label" />
-                        </style>
-                      </object>
-                      <packing>
-                        <property name="left_attach">1</property>
-                        <property name="top_attach">0</property>
-                      </packing>
-                    </child>
-
-                    <child>
-                      <object class="GtkLabel" id="notb_details">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <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>
-                      </object>
-                      <packing>
-                        <property name="left_attach">1</property>
-                        <property name="top_attach">1</property>
-                      </packing>
-                    </child>
-
-                  </object>
-                </child>
-
+                <property name="hexpand">True</property>
+                <property name="vexpand">True</property>
+                <property name="icon_name">thunderbolt-symbolic</property>
+                <property name="title" translatable="yes">No Thunderbolt support</property>
+                <property name="description" translatable="no">Could not connect to the thunderbolt 
subsystem.</property>
               </object>
               <packing>
                 <property name="name">no-thunderbolt</property>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]