[gnome-system-monitor/wip/cdavis/libhandy: 6/8] preferences: Use HdyPreferencesWindow




commit 3b5f27a6f3d2768e8d75c9154142e64275462000
Author: Christopher Davis <brainblasted disroot org>
Date:   Thu Feb 4 19:32:18 2021 -0800

    preferences: Use HdyPreferencesWindow
    
    HdyPreferencesWindow is a window that provides
    a simple API for a preferences window, and allows
    setting up search and more. Apps should make
    use of HdyPreferencesWindow going forward for
    their settings.

 data/preferences.ui | 1150 +++++++++++++++------------------------------------
 src/prefsdialog.cpp |   37 +-
 2 files changed, 351 insertions(+), 836 deletions(-)
---
diff --git a/data/preferences.ui b/data/preferences.ui
index aeef922c..b40e7942 100644
--- a/data/preferences.ui
+++ b/data/preferences.ui
@@ -1,846 +1,380 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <!-- interface-requires gtk+ 3.0 -->
-  <object class="GtkDialog" id="preferences_dialog">
+  <object class="HdyPreferencesWindow" id="preferences_dialog">
+    <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <property name="use_header_bar">1</property>
-    <property name="border_width">5</property>
     <property name="title" translatable="yes">Preferences</property>
-    <property name="default_width">400</property>
-    <property name="default_height">495</property>
+    <property name="default_width">700</property>
+    <property name="default_height">700</property>
     <property name="destroy_with_parent">True</property>
-    <property name="type_hint">dialog</property>
-    <child internal-child="vbox">
-      <object class="GtkBox" id="dialog_layout">
-        <property name="can_focus">False</property>
-        <property name="orientation">vertical</property>
-        <property name="spacing">2</property>
+    <child>
+      <object class="HdyPreferencesPage">
+        <property name="visible">True</property>
+        <property name="title" translatable="yes">Processes</property>
+        <property name="icon-name">view-list-symbolic</property>
         <child>
-          <object class="GtkGrid" id="content_grid">
+          <object class="HdyPreferencesGroup">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="orientation">vertical</property>
-            <property name="column_spacing">2</property>
+            <property name="title" translatable="yes">Behavior</property>
             <child>
-              <object class="GtkNotebook" id="notebook">
+              <object class="HdyActionRow">
                 <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="hexpand">True</property>
-                <property name="vexpand">True</property>
-                <property name="border_width">5</property>
+                <property name="use-underline">True</property>
+                <property name="title" translatable="yes">_Update interval in seconds:</property>
+                <property name="activatable-widget">processes_interval_spinner</property>
                 <child>
-                  <object class="GtkGrid" id="processes_tab_content">
+                  <object class="GtkSpinButton" id="processes_interval_spinner">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="hexpand">True</property>
-                    <property name="vexpand">True</property>
-                    <property name="border_width">12</property>
-                    <property name="orientation">vertical</property>
-                    <property name="row_spacing">18</property>
-                    <child>
-                      <object class="GtkGrid" id="processes_behavior">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="row_spacing">6</property>
-                        <child>
-                          <object class="GtkLabel" id="processes_behavior_label">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="hexpand">True</property>
-                            <property name="halign">start</property>
-                            <property name="label" translatable="yes">Behavior</property>
-                            <property name="justify">fill</property>
-                            <property name="ellipsize">end</property>
-                            <property name="single_line_mode">True</property>
-                            <attributes>
-                              <attribute name="weight" value="bold"/>
-                            </attributes>
-                          </object>
-                          <packing>
-                            <property name="left_attach">0</property>
-                            <property name="top_attach">0</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkGrid" id="processes_behavior_section">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="margin_start">12</property>
-                            <property name="hexpand">True</property>
-                            <property name="row_spacing">6</property>
-                            <child>
-                              <object class="GtkGrid" id="update_interval_grid">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="hexpand">True</property>
-                                <property name="column_spacing">12</property>
-                                <child>
-                                  <object class="GtkLabel" id="processes_interval_label">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <property name="label" translatable="yes">_Update interval in 
seconds:</property>
-                                    <property name="use_underline">True</property>
-                                    <property name="mnemonic_widget">processes_interval_spinner</property>
-                                  </object>
-                                  <packing>
-                                    <property name="left_attach">0</property>
-                                    <property name="top_attach">0</property>
-                                    <property name="width">1</property>
-                                    <property name="height">1</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkSpinButton" id="processes_interval_spinner">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="invisible_char">•</property>
-                                    <property name="climb_rate">1</property>
-                                    <property name="digits">2</property>
-                                  </object>
-                                  <packing>
-                                    <property name="left_attach">1</property>
-                                    <property name="top_attach">0</property>
-                                    <property name="width">1</property>
-                                    <property name="height">1</property>
-                                  </packing>
-                                </child>
-                              </object>
-                              <packing>
-                                <property name="left_attach">0</property>
-                                <property name="top_attach">0</property>
-                                <property name="width">1</property>
-                                <property name="height">1</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkCheckButton" id="smooth_button">
-                                <property name="label" translatable="yes">Enable _smooth refresh</property>
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">False</property>
-                                <property name="hexpand">True</property>
-                                <property name="use_underline">True</property>
-                                <property name="halign">start</property>
-                                <property name="draw_indicator">True</property>
-                              </object>
-                              <packing>
-                                <property name="left_attach">0</property>
-                                <property name="top_attach">1</property>
-                                <property name="width">1</property>
-                                <property name="height">1</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkCheckButton" id="check_button">
-                                <property name="label" translatable="yes">Alert before ending or _killing 
processes</property>
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">False</property>
-                                <property name="hexpand">True</property>
-                                <property name="use_underline">True</property>
-                                <property name="halign">start</property>
-                                <property name="draw_indicator">True</property>
-                              </object>
-                              <packing>
-                                <property name="left_attach">0</property>
-                                <property name="top_attach">2</property>
-                                <property name="width">1</property>
-                                <property name="height">1</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkCheckButton" id="solaris_button">
-                                <property name="label" translatable="yes">_Divide CPU usage by CPU 
count</property>
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">False</property>
-                                <property name="hexpand">True</property>
-                                <property name="use_underline">True</property>
-                                <property name="halign">start</property>
-                                <property name="draw_indicator">True</property>
-                              </object>
-                              <packing>
-                                <property name="left_attach">0</property>
-                                <property name="top_attach">3</property>
-                                <property name="width">1</property>
-                                <property name="height">1</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkCheckButton" id="proc_mem_in_iec_button">
-                                <property name="label" translatable="yes">Show memory in IEC</property>
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">False</property>
-                                <property name="halign">start</property>
-                                <property name="hexpand">True</property>
-                                <property name="use_underline">True</property>
-                                <property name="draw_indicator">True</property>
-                              </object>
-                              <packing>
-                                <property name="left_attach">0</property>
-                                <property name="top_attach">4</property>
-                              </packing>
-                            </child>
-                          </object>
-                          <packing>
-                            <property name="left_attach">0</property>
-                            <property name="top_attach">1</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
-                          </packing>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">0</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkGrid" id="processes_fields">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="hexpand">True</property>
-                        <property name="vexpand">True</property>
-                        <property name="row_spacing">6</property>
-                        <child>
-                          <object class="GtkLabel" id="processes_fields_label">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="hexpand">True</property>
-                            <property name="halign">start</property>
-                            <property name="label" translatable="yes">Information Fields</property>
-                            <property name="justify">fill</property>
-                            <property name="ellipsize">end</property>
-                            <property name="single_line_mode">True</property>
-                            <attributes>
-                              <attribute name="weight" value="bold"/>
-                            </attributes>
-                          </object>
-                          <packing>
-                            <property name="left_attach">0</property>
-                            <property name="top_attach">0</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkGrid" id="processes_fields_grid">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="margin_start">12</property>
-                            <property name="hexpand">True</property>
-                            <property name="vexpand">True</property>
-                            <property name="orientation">vertical</property>
-                            <property name="row_spacing">6</property>
-                            <child>
-                              <object class="GtkLabel" id="processes_fields_table_label">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="halign">start</property>
-                                <property name="label" translatable="yes">Process i_nformation shown in 
list:</property>
-                                <property name="use_underline">True</property>
-                                <property name="mnemonic_widget">proctree_columns</property>
-                              </object>
-                              <packing>
-                                <property name="left_attach">0</property>
-                                <property name="top_attach">0</property>
-                                <property name="width">1</property>
-                                <property name="height">1</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkScrolledWindow" id="processes_scrolled">
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="hexpand">True</property>
-                                <property name="vexpand">True</property>
-                                <property name="shadow_type">in</property>
-                                <child>
-                                  <object class="GtkTreeView" id="proctree_columns">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="headers_visible">False</property>
-                                    <property name="enable_search">False</property>
-                                    <child internal-child="selection">
-                                      <object class="GtkTreeSelection" id="processes-columns-selection"/>
-                                    </child>
-                                  </object>
-                                </child>
-                              </object>
-                              <packing>
-                                <property name="left_attach">0</property>
-                                <property name="top_attach">1</property>
-                                <property name="width">1</property>
-                                <property name="height">1</property>
-                              </packing>
-                            </child>
-                          </object>
-                          <packing>
-                            <property name="left_attach">0</property>
-                            <property name="top_attach">1</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
-                          </packing>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">1</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
-                      </packing>
-                    </child>
+                    <property name="can_focus">True</property>
+                    <property name="valign">center</property>
+                    <property name="invisible_char">•</property>
+                    <property name="climb_rate">1</property>
+                    <property name="digits">2</property>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child>
+              <object class="HdyActionRow">
+                <property name="visible">True</property>
+                <property name="use-underline">True</property>
+                <property name="title" translatable="yes">Enable _smooth refresh</property>
+                <property name="activatable-widget">smooth_button</property>
+                <child type="prefix">
+                  <object class="GtkCheckButton" id="smooth_button">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="halign">start</property>
+                    <property name="draw_indicator">True</property>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child>
+              <object class="HdyActionRow">
+                <property name="visible">True</property>
+                <property name="use-underline">True</property>
+                <property name="title" translatable="yes">Alert before ending or _killing 
processes</property>
+                <property name="activatable-widget">check_button</property>
+                <child type="prefix">
+                  <object class="GtkCheckButton" id="check_button">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="halign">start</property>
+                    <property name="draw_indicator">True</property>
                   </object>
                 </child>
-                <child type="tab">
-                  <object class="GtkLabel" id="processes_tab_label">
+              </object>
+            </child>
+            <child>
+              <object class="HdyActionRow">
+                <property name="visible">True</property>
+                <property name="use-underline">True</property>
+                <property name="title" translatable="yes">_Divide CPU usage by CPU count</property>
+                <property name="activatable-widget">solaris_button</property>
+                <child type="prefix">
+                  <object class="GtkCheckButton" id="solaris_button">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="label" translatable="yes">Processes</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="halign">start</property>
+                    <property name="draw_indicator">True</property>
                   </object>
-                  <packing>
-                    <property name="tab_fill">False</property>
-                  </packing>
                 </child>
+              </object>
+            </child>
+            <child>
+              <object class="HdyActionRow">
+                <property name="visible">True</property>
+                <property name="use-underline">True</property>
+                <property name="title" translatable="yes">Show memory in IEC</property>
+                <property name="activatable-widget">proc_mem_in_iec_button</property>
+                <child type="prefix">
+                  <object class="GtkCheckButton" id="proc_mem_in_iec_button">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="halign">start</property>
+                    <property name="use_underline">True</property>
+                    <property name="draw_indicator">True</property>
+                  </object>
+                </child>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="HdyPreferencesGroup">
+            <property name="visible">True</property>
+            <property name="title" translatable="yes">Information Fields</property>
+            <property name="description" translatable="yes">Process information shown in list:</property>
+            <child>
+              <object class="GtkFrame">
+                <property name="visible">True</property>
                 <child>
-                  <object class="GtkGrid" id="resources_tab_content">
+                  <object class="GtkTreeView" id="proctree_columns">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="hexpand">True</property>
-                    <property name="vexpand">True</property>
-                    <property name="border_width">12</property>
-                    <property name="orientation">vertical</property>
-                    <property name="row_spacing">18</property>
-                    <child>
-                      <object class="GtkGrid" id="resources_graphs">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="hexpand">True</property>
-                        <property name="row_spacing">6</property>
-                        <child>
-                          <object class="GtkLabel" id="resources_graphs_label">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="hexpand">True</property>
-                            <property name="halign">start</property>
-                            <property name="label" translatable="yes">Graphs</property>
-                            <property name="justify">fill</property>
-                            <property name="ellipsize">end</property>
-                            <property name="single_line_mode">True</property>
-                            <attributes>
-                              <attribute name="weight" value="bold"/>
-                            </attributes>
-                          </object>
-                          <packing>
-                            <property name="left_attach">0</property>
-                            <property name="top_attach">0</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkGrid" id="resources_graphs_section">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="margin_start">12</property>
-                            <property name="hexpand">True</property>
-                            <property name="vexpand">True</property>
-                            <property name="row_spacing">6</property>
-                            <child>
-                              <object class="GtkGrid" id="resources_update_interval">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="hexpand">True</property>
-                                <property name="column_spacing">12</property>
-                                <child>
-                                  <object class="GtkLabel" id="resources_interval_label">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <property name="label" translatable="yes">_Update interval in 
seconds:</property>
-                                    <property name="use_underline">True</property>
-                                    <property name="mnemonic_widget">resources_interval_spinner</property>
-                                  </object>
-                                  <packing>
-                                    <property name="left_attach">0</property>
-                                    <property name="top_attach">0</property>
-                                    <property name="width">1</property>
-                                    <property name="height">1</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkSpinButton" id="resources_interval_spinner">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="invisible_char">•</property>
-                                    <property name="climb_rate">1</property>
-                                    <property name="digits">2</property>
-                                  </object>
-                                  <packing>
-                                    <property name="left_attach">1</property>
-                                    <property name="top_attach">0</property>
-                                    <property name="width">1</property>
-                                    <property name="height">1</property>
-                                  </packing>
-                                </child>
-                              </object>
-                              <packing>
-                                <property name="left_attach">0</property>
-                                <property name="top_attach">0</property>
-                                <property name="width">1</property>
-                                <property name="height">1</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkGrid" id="graph_data_points">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="hexpand">True</property>
-                                <property name="column_spacing">12</property>
-                                <child>
-                                  <object class="GtkLabel" id="graph_data_points_label">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <property name="label" translatable="yes">_Chart data points:</property>
-                                    <property name="use_underline">True</property>
-                                    <property name="mnemonic_widget">graph_data_points_scale</property>
-                                  </object>
-                                  <packing>
-                                    <property name="left_attach">0</property>
-                                    <property name="top_attach">0</property>
-                                    <property name="width">1</property>
-                                    <property name="height">1</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkScale" id="graph_data_points_scale">
-                                    <property name="orientation">horizontal</property>
-                                    <property name="visible">True</property>
-                                    <property name="draw-value">True</property>
-                                    <property name="value-pos">right</property>
-                                    <property name="digits">0</property>
-                                  </object>
-                                  <packing>
-                                    <property name="left_attach">1</property>
-                                    <property name="top_attach">0</property>
-                                    <property name="width">18</property>
-                                    <property name="height">1</property>
-                                  </packing>
-                                </child>
-                              </object>
-                              <packing>
-                                <property name="left_attach">0</property>
-                                <property name="top_attach">1</property>
-                                <property name="width">1</property>
-                                <property name="height">1</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkCheckButton" id="draw_stacked_button">
-                                <property name="label" translatable="yes">_Draw CPU chart as stacked area 
chart</property>
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">False</property>
-                                <property name="hexpand">True</property>
-                                <property name="use_underline">True</property>
-                                <property name="halign">start</property>
-                                <property name="draw_indicator">True</property>
-                              </object>
-                              <packing>
-                                <property name="left_attach">0</property>
-                                <property name="top_attach">2</property>
-                                <property name="width">1</property>
-                                <property name="height">1</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkCheckButton" id="draw_smooth_button">
-                                <property name="label" translatable="yes">Draw charts as s_mooth 
graphs</property>
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">False</property>
-                                <property name="hexpand">True</property>
-                                <property name="use_underline">True</property>
-                                <property name="halign">start</property>
-                                <property name="draw_indicator">True</property>
-                              </object>
-                              <packing>
-                                <property name="left_attach">0</property>
-                                <property name="top_attach">3</property>
-                                <property name="width">1</property>
-                                <property name="height">1</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkCheckButton" id="res_mem_in_iec_button">
-                                <property name="label" translatable="yes">Show memory and swap in 
IEC</property>
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">False</property>
-                                <property name="halign">start</property>
-                                <property name="hexpand">True</property>
-                                <property name="use_underline">True</property>
-                                <property name="draw_indicator">True</property>
-                              </object>
-                              <packing>
-                                <property name="left_attach">0</property>
-                                <property name="top_attach">4</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkCheckButton" id="logarithmic_scale_button">
-                                <property name="label" translatable="yes">Show memory in logarithmic 
scale</property>
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">False</property>
-                                <property name="hexpand">True</property>
-                                <property name="use_underline">True</property>
-                                <property name="halign">start</property>
-                                <property name="draw_indicator">True</property>
-                              </object>
-                              <packing>
-                                <property name="left_attach">0</property>
-                                <property name="top_attach">5</property>
-                                <property name="width">1</property>
-                                <property name="height">1</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkCheckButton" id="bits_button">
-                                <property name="label" translatable="yes">_Show network speed in 
bits</property>
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">False</property>
-                                <property name="hexpand">True</property>
-                                <property name="use_underline">True</property>
-                                <property name="halign">start</property>
-                                <property name="draw_indicator">True</property>
-                              </object>
-                              <packing>
-                                <property name="left_attach">0</property>
-                                <property name="top_attach">6</property>
-                                <property name="width">1</property>
-                                <property name="height">1</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkCheckButton" id="bits_unit_button">
-                                <property name="label" translatable="yes">Set network totals _unit 
separately</property>
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">False</property>
-                                <property name="hexpand">True</property>
-                                <property name="use_underline">True</property>
-                                <property name="halign">start</property>
-                                <property name="draw_indicator">True</property>
-                                <signal name="toggled" handler="on_bits_unit_button_toggled" 
object="bits_total_button" swapped="no"/>
-                              </object>
-                              <packing>
-                                <property name="left_attach">0</property>
-                                <property name="top_attach">7</property>
-                                <property name="width">1</property>
-                                <property name="height">1</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkCheckButton" id="bits_total_button">
-                                <property name="label" translatable="yes">Show network _totals in 
bits</property>
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">False</property>
-                                <property name="hexpand">True</property>
-                                <property name="use_underline">True</property>
-                                <property name="halign">start</property>
-                                <property name="draw_indicator">True</property>
-                              </object>
-                              <packing>
-                                <property name="left_attach">0</property>
-                                <property name="top_attach">8</property>
-                                <property name="width">1</property>
-                                <property name="height">1</property>
-                              </packing>
-                            </child>
-                          </object>
-                          <packing>
-                            <property name="left_attach">0</property>
-                            <property name="top_attach">1</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
-                          </packing>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">0</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
-                      </packing>
+                    <property name="can_focus">True</property>
+                    <property name="headers_visible">False</property>
+                    <property name="enable_search">False</property>
+                    <child internal-child="selection">
+                      <object class="GtkTreeSelection" id="processes-columns-selection"/>
                     </child>
                   </object>
-                  <packing>
-                    <property name="position">1</property>
-                  </packing>
                 </child>
-                <child type="tab">
-                  <object class="GtkLabel" id="resources_tab_label">
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
+    <child>
+      <object class="HdyPreferencesPage">
+        <property name="visible">True</property>
+        <property name="title" translatable="yes">Resources</property>
+        <property name="icon-name">speedometer-symbolic</property>
+        <child>
+          <object class="HdyPreferencesGroup">
+            <property name="visible">True</property>
+            <property name="title" translatable="yes">Graphs</property>
+            <child>
+              <object class="HdyActionRow">
+                <property name="visible">True</property>
+                <property name="use-underline">True</property>
+                <property name="title" translatable="yes">_Update interval in seconds:</property>
+                <property name="activatable-widget">resources_interval_spinner</property>
+                <child>
+                  <object class="GtkSpinButton" id="resources_interval_spinner">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="label" translatable="yes">Resources</property>
+                    <property name="can_focus">True</property>
+                    <property name="valign">center</property>
+                    <property name="invisible_char">•</property>
+                    <property name="climb_rate">1</property>
+                    <property name="digits">2</property>
                   </object>
-                  <packing>
-                    <property name="position">1</property>
-                    <property name="tab_fill">False</property>
-                  </packing>
                 </child>
+              </object>
+            </child>
+            <child>
+              <object class="HdyActionRow">
+                <property name="visible">True</property>
+                <property name="use-underline">True</property>
+                <property name="title" translatable="yes">_Chart data points:</property>
                 <child>
-                  <object class="GtkGrid" id="devices_tab_content">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
+                  <object class="GtkScale" id="graph_data_points_scale">
                     <property name="hexpand">True</property>
-                    <property name="vexpand">True</property>
-                    <property name="border_width">12</property>
-                    <property name="orientation">vertical</property>
-                    <property name="row_spacing">18</property>
-                    <child>
-                      <object class="GtkGrid" id="devices_behavior">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="row_spacing">6</property>
-                        <child>
-                          <object class="GtkLabel" id="devices_behavior_label">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="hexpand">True</property>
-                            <property name="halign">start</property>
-                            <property name="label" translatable="yes">Behavior</property>
-                            <property name="justify">fill</property>
-                            <property name="ellipsize">end</property>
-                            <property name="single_line_mode">True</property>
-                            <attributes>
-                              <attribute name="weight" value="bold"/>
-                            </attributes>
-                          </object>
-                          <packing>
-                            <property name="left_attach">0</property>
-                            <property name="top_attach">0</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkGrid" id="devices_behavior_section">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="margin_start">12</property>
-                            <property name="hexpand">True</property>
-                            <property name="row_spacing">6</property>
-                            <child>
-                              <object class="GtkGrid" id="devices_interval_grid">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="hexpand">True</property>
-                                <property name="column_spacing">12</property>
-                                <child>
-                                  <object class="GtkLabel" id="devices_interval_label">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <property name="label" translatable="yes">_Update interval in 
seconds:</property>
-                                    <property name="use_underline">True</property>
-                                    <property name="mnemonic_widget">devices_interval_spinner</property>
-                                  </object>
-                                  <packing>
-                                    <property name="left_attach">0</property>
-                                    <property name="top_attach">0</property>
-                                    <property name="width">1</property>
-                                    <property name="height">1</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkSpinButton" id="devices_interval_spinner">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="invisible_char">•</property>
-                                    <property name="climb_rate">1</property>
-                                    <property name="digits">2</property>
-                                  </object>
-                                  <packing>
-                                    <property name="left_attach">1</property>
-                                    <property name="top_attach">0</property>
-                                    <property name="width">1</property>
-                                    <property name="height">1</property>
-                                  </packing>
-                                </child>
-                              </object>
-                              <packing>
-                                <property name="left_attach">0</property>
-                                <property name="top_attach">0</property>
-                                <property name="width">1</property>
-                                <property name="height">1</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkCheckButton" id="all_devices_check">
-                                <property name="label" translatable="yes">Show _all file systems</property>
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">False</property>
-                                <property name="hexpand">True</property>
-                                <property name="use_underline">True</property>
-                                <property name="halign">start</property>
-                                <property name="draw_indicator">True</property>
-                              </object>
-                              <packing>
-                                <property name="left_attach">0</property>
-                                <property name="top_attach">1</property>
-                                <property name="width">1</property>
-                                <property name="height">1</property>
-                              </packing>
-                            </child>
-                          </object>
-                          <packing>
-                            <property name="left_attach">0</property>
-                            <property name="top_attach">1</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
-                          </packing>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">0</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkGrid" id="devices_fields">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="hexpand">True</property>
-                        <property name="vexpand">True</property>
-                        <property name="row_spacing">6</property>
-                        <child>
-                          <object class="GtkLabel" id="devices_fields_label">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="hexpand">True</property>
-                            <property name="halign">start</property>
-                            <property name="label" translatable="yes">Information Fields</property>
-                            <property name="justify">fill</property>
-                            <property name="ellipsize">end</property>
-                            <property name="single_line_mode">True</property>
-                            <attributes>
-                              <attribute name="weight" value="bold"/>
-                            </attributes>
-                          </object>
-                          <packing>
-                            <property name="left_attach">0</property>
-                            <property name="top_attach">0</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkGrid" id="devices_fields_grid">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="margin_start">12</property>
-                            <property name="hexpand">True</property>
-                            <property name="vexpand">True</property>
-                            <property name="orientation">vertical</property>
-                            <property name="row_spacing">6</property>
-                            <child>
-                              <object class="GtkLabel" id="devices_fields_table_label">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="halign">start</property>
-                                <property name="label" translatable="yes">File system i_nformation shown in 
list:</property>
-                                <property name="use_underline">True</property>
-                                <property name="mnemonic_widget">disktreenew_columns</property>
-                              </object>
-                              <packing>
-                                <property name="left_attach">0</property>
-                                <property name="top_attach">0</property>
-                                <property name="width">1</property>
-                                <property name="height">1</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkScrolledWindow" id="devices_scrolled">
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="hexpand">True</property>
-                                <property name="vexpand">True</property>
-                                <property name="shadow_type">in</property>
-                                <child>
-                                  <object class="GtkTreeView" id="disktreenew_columns">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="headers_visible">False</property>
-                                    <property name="enable_search">False</property>
-                                    <child internal-child="selection">
-                                      <object class="GtkTreeSelection" id="devices-treeview-selection"/>
-                                    </child>
-                                  </object>
-                                </child>
-                              </object>
-                              <packing>
-                                <property name="left_attach">0</property>
-                                <property name="top_attach">1</property>
-                                <property name="width">1</property>
-                                <property name="height">1</property>
-                              </packing>
-                            </child>
-                          </object>
-                          <packing>
-                            <property name="left_attach">0</property>
-                            <property name="top_attach">1</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
-                          </packing>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">1</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
-                      </packing>
-                    </child>
+                    <property name="orientation">horizontal</property>
+                    <property name="visible">True</property>
+                    <property name="draw-value">True</property>
+                    <property name="value-pos">right</property>
+                    <property name="digits">0</property>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child>
+              <object class="HdyActionRow">
+                <property name="visible">True</property>
+                <property name="use-underline">True</property>
+                <property name="title" translatable="yes">_Draw CPU chart as stacked area chart</property>
+                <property name="activatable-widget">draw_stacked_button</property>
+                <child type="prefix">
+                  <object class="GtkCheckButton" id="draw_stacked_button">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="use_underline">True</property>
+                    <property name="halign">start</property>
+                    <property name="draw_indicator">True</property>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child>
+              <object class="HdyActionRow">
+                <property name="visible">True</property>
+                <property name="use-underline">True</property>
+                <property name="title" translatable="yes">Draw charts as s_mooth graphs</property>
+                <property name="activatable-widget">draw_smooth_button</property>
+                <child type="prefix">
+                  <object class="GtkCheckButton" id="draw_smooth_button">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="use_underline">True</property>
+                    <property name="halign">start</property>
+                    <property name="draw_indicator">True</property>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child>
+              <object class="HdyActionRow">
+                <property name="visible">True</property>
+                <property name="use-underline">True</property>
+                <property name="title" translatable="yes">Show memory and swap in IEC</property>
+                <property name="activatable-widget">res_mem_in_iec_button</property>
+                <child type="prefix">
+                  <object class="GtkCheckButton" id="res_mem_in_iec_button">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="halign">start</property>
+                    <property name="use_underline">True</property>
+                    <property name="draw_indicator">True</property>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child>
+              <object class="HdyActionRow">
+                <property name="visible">True</property>
+                <property name="use-underline">True</property>
+                <property name="title" translatable="yes">Show memory in logarithmic scale</property>
+                <property name="activatable-widget">logarithmic_scale_button</property>
+                <child type="prefix">
+                  <object class="GtkCheckButton" id="logarithmic_scale_button">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="halign">start</property>
+                    <property name="use_underline">True</property>
+                    <property name="draw_indicator">True</property>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child>
+              <object class="HdyActionRow">
+                <property name="visible">True</property>
+                <property name="use-underline">True</property>
+                <property name="title" translatable="yes">_Show network speed in bits</property>
+                <property name="activatable-widget">bits_button</property>
+                <child type="prefix">
+                  <object class="GtkCheckButton" id="bits_button">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="use_underline">True</property>
+                    <property name="halign">start</property>
+                    <property name="draw_indicator">True</property>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child>
+              <object class="HdyActionRow">
+                <property name="visible">True</property>
+                <property name="use-underline">True</property>
+                <property name="title" translatable="yes">Set network totals _unit separately</property>
+                <property name="activatable-widget">bits_unit_button</property>
+                <child type="prefix">
+                  <object class="GtkCheckButton" id="bits_unit_button">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="use_underline">True</property>
+                    <property name="halign">start</property>
+                    <property name="draw_indicator">True</property>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child>
+              <object class="HdyActionRow">
+                <property name="visible">True</property>
+                <property name="use-underline">True</property>
+                <property name="title" translatable="yes">Show network _totals in bits</property>
+                <property name="activatable-widget">bits_total_button</property>
+                <property name="sensitive" bind-source="bits_unit_button" bind-property="active" 
bind-flags="sync-create"/>
+                <child type="prefix">
+                  <object class="GtkCheckButton" id="bits_total_button">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="use_underline">True</property>
+                    <property name="halign">start</property>
+                    <property name="draw_indicator">True</property>
+                  </object>
+                </child>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
+    <child>
+      <object class="HdyPreferencesPage">
+        <property name="visible">True</property>
+        <property name="title" translatable="yes">File Systems</property>
+        <property name="icon-name">drive-harddisk-symbolic</property>
+        <child>
+          <object class="HdyPreferencesGroup">
+            <property name="visible">True</property>
+            <property name="title" translatable="yes">Behavior</property>
+            <child>
+              <object class="HdyActionRow">
+                <property name="visible">True</property>
+                <property name="use-underline">True</property>
+                <property name="title" translatable="yes">_Update interval in seconds:</property>
+                <property name="activatable-widget">devices_interval_spinner</property>
+                <child>
+                  <object class="GtkSpinButton" id="devices_interval_spinner">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="valign">center</property>
+                    <property name="invisible_char">•</property>
+                    <property name="climb_rate">1</property>
+                    <property name="digits">2</property>
                   </object>
-                  <packing>
-                    <property name="position">2</property>
-                  </packing>
                 </child>
-                <child type="tab">
-                  <object class="GtkLabel" id="file_systems_tab_label">
+              </object>
+            </child>
+            <child>
+              <object class="HdyActionRow">
+                <property name="visible">True</property>
+                <property name="use-underline">True</property>
+                <property name="title" translatable="yes">Show _all file systems</property>
+                <property name="activatable-widget">all_devices_check</property>
+                <child type="prefix">
+                  <object class="GtkCheckButton" id="all_devices_check">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="label" translatable="yes">File Systems</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="use_underline">True</property>
+                    <property name="halign">start</property>
+                    <property name="draw_indicator">True</property>
+                  </object>
+                </child>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="HdyPreferencesGroup">
+            <property name="visible">True</property>
+            <property name="title" translatable="yes">Information Fields</property>
+            <property name="description" translatable="yes">File system information shown in list:</property>
+            <child>
+              <object class="GtkFrame">
+                <property name="visible">True</property>
+                <child>
+                  <object class="GtkTreeView" id="disktreenew_columns">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="headers_visible">False</property>
+                    <property name="enable_search">False</property>
+                    <child internal-child="selection">
+                      <object class="GtkTreeSelection" id="devices-treeview-selection"/>
+                    </child>
                   </object>
-                  <packing>
-                    <property name="position">2</property>
-                    <property name="tab_fill">False</property>
-                  </packing>
                 </child>
               </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">0</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
-              </packing>
             </child>
           </object>
-          <packing>
-            <property name="expand">True</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
         </child>
       </object>
     </child>
diff --git a/src/prefsdialog.cpp b/src/prefsdialog.cpp
index 5cb9dc0e..a0ac65f7 100644
--- a/src/prefsdialog.cpp
+++ b/src/prefsdialog.cpp
@@ -14,16 +14,15 @@
 #include "systemd.h"
 #include "util.h"
 
-static GtkDialog *prefs_dialog = NULL;
+static HdyPreferencesWindow *prefs_dialog = NULL;
 
-static void
-prefs_dialog_button_pressed (GtkDialog *dialog, gint id, gpointer data)
+static gboolean
+prefs_dialog_delete_event (GtkWidget *widget, GdkEvent *event, gpointer data)
 {
-    gtk_widget_destroy (GTK_WIDGET (dialog));
     prefs_dialog = NULL;
+    return FALSE;
 }
 
-
 class SpinButtonUpdater
 {
 public:
@@ -229,7 +228,6 @@ create_preferences_dialog (GsmApplication *app)
     static SBU disks_interval_updater("disks-interval");
     static ScaleUpdater graph_points_updater("graph-data-points");
 
-    GtkNotebook *notebook;
     GtkAdjustment *adjustment;
     GtkSpinButton *spin_button;
     GtkCheckButton *check_button;
@@ -243,9 +241,7 @@ create_preferences_dialog (GsmApplication *app)
     builder = gtk_builder_new();
     gtk_builder_add_from_resource (builder, "/org/gnome/gnome-system-monitor/data/preferences.ui", NULL);
 
-    prefs_dialog = GTK_DIALOG (gtk_builder_get_object (builder, "preferences_dialog"));
-
-    notebook = GTK_NOTEBOOK (gtk_builder_get_object (builder, "notebook"));
+    prefs_dialog = HDY_PREFERENCES_WINDOW (gtk_builder_get_object (builder, "preferences_dialog"));
 
     spin_button = GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "processes_interval_spinner"));
 
@@ -328,16 +324,12 @@ create_preferences_dialog (GsmApplication *app)
     g_settings_bind(app->settings->gobj (), GSM_SETTING_NETWORK_TOTAL_UNIT,
                     bits_unit_button, "active",
                     G_SETTINGS_BIND_DEFAULT);
-    gtk_builder_add_callback_symbol (builder, "on_bits_unit_button_toggled",
-                    G_CALLBACK (on_bits_unit_button_toggled));
 
     GtkCheckButton *bits_total_button = GTK_CHECK_BUTTON (gtk_builder_get_object (builder, 
"bits_total_button"));
     g_settings_bind(app->settings->gobj (), GSM_SETTING_NETWORK_TOTAL_IN_BITS,
                     bits_total_button, "active",
                     G_SETTINGS_BIND_DEFAULT);
 
-    gtk_widget_set_sensitive((GtkWidget *)bits_total_button, gtk_toggle_button_get_active ((GtkToggleButton 
*)bits_unit_button));
-
     update = (gfloat) app->config.disks_update_interval;
     spin_button = GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "devices_interval_spinner"));
     adjustment = gtk_spin_button_get_adjustment (spin_button);
@@ -356,25 +348,14 @@ create_preferences_dialog (GsmApplication *app)
     create_field_page (builder, GTK_TREE_VIEW (app->disk_list), "disktreenew");
 
     gtk_window_set_transient_for (GTK_WINDOW (prefs_dialog), GTK_WINDOW 
(GsmApplication::get()->main_window));
+    gtk_window_set_modal (GTK_WINDOW (prefs_dialog), TRUE);
 
     gtk_widget_show_all (GTK_WIDGET (prefs_dialog));
-    g_signal_connect (G_OBJECT (prefs_dialog), "response",
-                      G_CALLBACK (prefs_dialog_button_pressed), app);
+    g_signal_connect (G_OBJECT (prefs_dialog), "delete-event",
+                      G_CALLBACK (prefs_dialog_delete_event), NULL);
 
-    auto current_tab = app->settings->get_string(GSM_SETTING_CURRENT_TAB);
-    if (current_tab == "processes")
-        gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), 0);
-    else if (current_tab == "resources")
-        gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), 1);
-    else if (current_tab == "disks")
-        gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), 2);
+    gtk_window_present (GTK_WINDOW (prefs_dialog));
 
     gtk_builder_connect_signals (builder, NULL);
     g_object_unref (G_OBJECT (builder));
 }
-
-void
-on_bits_unit_button_toggled (GtkToggleButton *togglebutton, gpointer bits_total_button)
-{
-    gtk_widget_set_sensitive((GtkWidget *)bits_total_button, gtk_toggle_button_get_active ((GtkToggleButton 
*)togglebutton));
-}


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