diagnostics: Use AdwPreferences{Page,Group}, AdwActionRow

This commit is contained in:
Christopher Davis 2022-02-12 13:44:00 -08:00 committed by Georges Basile Stavracas Neto
parent 640295023d
commit 328da2fa14
2 changed files with 16 additions and 76 deletions

View file

@ -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);
}

View file

@ -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>