[gnome-control-center] diagnostics: Use AdwPreferences{Page, Group}, AdwActionRow



commit 328da2fa14fb60167e63a706f6dce4cb4ab7fac8
Author: Christopher Davis <christopherdavis gnome org>
Date:   Sat Feb 12 13:44:00 2022 -0800

    diagnostics: Use AdwPreferences{Page,Group}, AdwActionRow

 panels/diagnostics/cc-diagnostics-panel.c  | 14 +++---
 panels/diagnostics/cc-diagnostics-panel.ui | 78 ++++--------------------------
 2 files changed, 16 insertions(+), 76 deletions(-)
---
diff --git a/panels/diagnostics/cc-diagnostics-panel.c b/panels/diagnostics/cc-diagnostics-panel.c
index 4ef0ae982..9aeca6ecd 100644
--- a/panels/diagnostics/cc-diagnostics-panel.c
+++ b/panels/diagnostics/cc-diagnostics-panel.c
@@ -28,13 +28,12 @@
 
 struct _CcDiagnosticsPanel
 {
-  CcPanel     parent_instance;
+  CcPanel              parent_instance;
 
-  GtkLabel   *diagnostics_explanation_label;
-  GtkListBox *diagnostics_list_box;
-  GtkSwitch   *abrt_switch;
+  AdwPreferencesGroup *diagnostics_group;
+  GtkSwitch           *abrt_switch;
 
-  GSettings  *privacy_settings;
+  GSettings           *privacy_settings;
 };
 
 CC_PANEL_REGISTER (CcDiagnosticsPanel, cc_diagnostics_panel)
@@ -106,8 +105,7 @@ cc_diagnostics_panel_class_init (CcDiagnosticsPanelClass *klass)
 
   gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/control-center/diagnostics/cc-diagnostics-panel.ui");
 
-  gtk_widget_class_bind_template_child (widget_class, CcDiagnosticsPanel, diagnostics_explanation_label);
-  gtk_widget_class_bind_template_child (widget_class, CcDiagnosticsPanel, diagnostics_list_box);
+  gtk_widget_class_bind_template_child (widget_class, CcDiagnosticsPanel, diagnostics_group);
   gtk_widget_class_bind_template_child (widget_class, CcDiagnosticsPanel, abrt_switch);
 }
 
@@ -141,5 +139,5 @@ cc_diagnostics_panel_init (CcDiagnosticsPanel *self)
   msg = g_strdup_printf (_("Sending reports of technical problems helps us improve %s. Reports "
                            "are sent anonymously and are scrubbed of personal data. %s"),
                          os_name, link);
-  gtk_label_set_markup (self->diagnostics_explanation_label, msg);
+  adw_preferences_group_set_description (self->diagnostics_group, msg);
 }
diff --git a/panels/diagnostics/cc-diagnostics-panel.ui b/panels/diagnostics/cc-diagnostics-panel.ui
index 97b6c27a4..13cf4c0bd 100644
--- a/panels/diagnostics/cc-diagnostics-panel.ui
+++ b/panels/diagnostics/cc-diagnostics-panel.ui
@@ -2,80 +2,22 @@
 <interface>
   <template class="CcDiagnosticsPanel" parent="CcPanel">
     <child type="content">
-      <object class="GtkScrolledWindow">
-        <property name="hscrollbar-policy">never</property>
+      <object class="AdwPreferencesPage">
         <child>
-          <object class="AdwClamp">
-            <property name="margin_top">32</property>
-            <property name="margin_bottom">32</property>
-            <property name="margin_start">12</property>
-            <property name="margin_end">12</property>
-
+          <object class="AdwPreferencesGroup" id="diagnostics_group">
+            <property name="title" translatable="yes">Problem Reporting</property>
             <child>
-              <object class="GtkBox">
-                <property name="orientation">vertical</property>
-                <property name="hexpand">1</property>
-                <child>
-                  <object class="GtkLabel">
-                    <property name="margin-bottom">12</property>
-                    <property name="label" translatable="yes">Problem Reporting</property>
-                    <property name="wrap">1</property>
-                    <property name="max-width-chars">50</property>
-                    <property name="xalign">0</property>
-                    <attributes>
-                      <attribute name="weight" value="bold"/>
-                    </attributes>
-                  </object>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="diagnostics_explanation_label">
-                    <property name="margin-bottom">12</property>
-                    <property name="use-markup">1</property>
-                    <property name="wrap">1</property>
-                    <property name="max-width-chars">50</property>
-                    <property name="xalign">0</property>
-                  </object>
-                </child>
-                <child>
-                  <object class="GtkListBox" id="diagnostics_list_box">
-                    <property name="selection-mode">none</property>
-                    <style>
-                      <class name="boxed-list"/>
-                    </style>
-                    <child>
-                      <object class="GtkListBoxRow">
-                        <child>
-                          <object class="GtkBox">
-                        <property name="margin_start">12</property>
-                        <property name="margin_end">12</property>
-                        <property name="margin_top">12</property>
-                        <property name="margin_bottom">12</property>
-                            <child>
-                              <object class="GtkLabel">
-                                <property name="label" translatable="yes">_Automatic Problem 
Reporting</property>
-                                <property name="hexpand">True</property>
-                                <property name="vexpand">True</property>
-                                <property name="use_underline">1</property>
-                                <property name="mnemonic_widget">abrt_switch</property>
-                                <property name="xalign">0</property>
-                                <property name="valign">center</property>
-                              </object>
-                            </child>
-                            <child>
-                              <object class="GtkSwitch" id="abrt_switch">
-                                <property name="halign">end</property>
-                                <property name="valign">center</property>
-                              </object>
-                            </child>
-                          </object>
-                        </child>
-                      </object>
-                    </child>
+              <object class="AdwActionRow">
+                <property name="title" translatable="yes">_Automatic Problem Reporting</property>
+                <property name="use-underline">True</property>
+                <property name="activatable-widget">abrt_switch</property>
+                <child type="suffix">
+                  <object class="GtkSwitch" id="abrt_switch">
+                    <property name="valign">center</property>
                   </object>
                 </child>
               </object>
             </child>
-
           </object>
         </child>
       </object>


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