[epiphany] prefs-dialog: Port the Language prefs page to list boxes



commit 83045b4c3ffb4f0061d09167cf4cf04748531318
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Tue Dec 18 10:15:02 2018 +0100

    prefs-dialog: Port the Language prefs page to list boxes

 src/prefs-dialog.c                |   6 +-
 src/resources/gtk/prefs-dialog.ui | 197 +++++++++++++++++++++++++-------------
 2 files changed, 133 insertions(+), 70 deletions(-)
---
diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c
index 35b4bc238..5cd58da3c 100644
--- a/src/prefs-dialog.c
+++ b/src/prefs-dialog.c
@@ -128,7 +128,7 @@ struct _PrefsDialog {
   GtkWidget *lang_remove_button;
   GtkWidget *lang_up_button;
   GtkWidget *lang_down_button;
-  GtkWidget *enable_spell_checking_checkbutton;
+  GtkWidget *enable_spell_checking_switch;
 
   GtkDialog *add_lang_dialog;
   GtkTreeView *add_lang_treeview;
@@ -1028,7 +1028,7 @@ prefs_dialog_class_init (PrefsDialogClass *klass)
   gtk_widget_class_bind_template_child (widget_class, PrefsDialog, lang_remove_button);
   gtk_widget_class_bind_template_child (widget_class, PrefsDialog, lang_up_button);
   gtk_widget_class_bind_template_child (widget_class, PrefsDialog, lang_down_button);
-  gtk_widget_class_bind_template_child (widget_class, PrefsDialog, enable_spell_checking_checkbutton);
+  gtk_widget_class_bind_template_child (widget_class, PrefsDialog, enable_spell_checking_switch);
 
   /* sync */
   gtk_widget_class_bind_template_child (widget_class, PrefsDialog, sync_page_box);
@@ -2279,7 +2279,7 @@ setup_language_page (PrefsDialog *dialog)
 
   g_settings_bind (web_settings,
                    EPHY_PREFS_WEB_ENABLE_SPELL_CHECKING,
-                   dialog->enable_spell_checking_checkbutton,
+                   dialog->enable_spell_checking_switch,
                    "active",
                    G_SETTINGS_BIND_DEFAULT);
 
diff --git a/src/resources/gtk/prefs-dialog.ui b/src/resources/gtk/prefs-dialog.ui
index e5ac0a5a7..f35d236ae 100644
--- a/src/resources/gtk/prefs-dialog.ui
+++ b/src/resources/gtk/prefs-dialog.ui
@@ -729,40 +729,22 @@
               </packing>
             </child>
             <child>
-              <object class="GtkBox">
+              <object class="HdyPreferencesPage">
+                <property name="icon_name">emoji-flags-symbolic</property>
+                <property name="title" translatable="yes">Language</property>
                 <property name="visible">True</property>
-                <property name="border-width">12</property>
-                <property name="orientation">vertical</property>
-                <property name="spacing">18</property>
                 <child>
-                  <object class="GtkBox">
+                  <object class="HdyPreferencesGroup">
+                    <property name="title" translatable="yes">Languages</property>
                     <property name="visible">True</property>
-                    <property name="orientation">vertical</property>
-                    <property name="spacing">6</property>
-                    <child>
-                      <object class="GtkLabel">
-                        <property name="visible">True</property>
-                        <property name="halign">start</property>
-                        <property name="label" translatable="yes">Languages</property>
-                        <attributes>
-                          <attribute name="weight" value="bold"/>
-                        </attributes>
-                      </object>
-                    </child>
                     <child>
-                      <object class="GtkGrid">
+                      <object class="GtkBox">
+                        <property name="orientation">vertical</property>
                         <property name="visible">True</property>
-                        <property name="vexpand">True</property>
-                        <property name="row-spacing">6</property>
-                        <property name="column-spacing">6</property>
-                        <property name="margin-start">12</property>
                         <child>
-                          <object class="GtkScrolledWindow">
+                          <object class="GtkFrame">
                             <property name="visible">True</property>
                             <property name="hexpand">True</property>
-                            <property name="vexpand">True</property>
-                            <property name="hscrollbar-policy">never</property>
-                            <property name="shadow-type">in</property>
                             <child>
                               <object class="GtkTreeView" id="lang_treeview">
                                 <property name="visible">True</property>
@@ -776,70 +758,151 @@
                           </object>
                         </child>
                         <child>
-                          <object class="GtkGrid">
+                          <object class="GtkToolbar">
                             <property name="visible">True</property>
-                            <property name="row-spacing">6</property>
-                            <property name="orientation">vertical</property>
-                            <child>
-                              <object class="GtkButton" id="lang_add_button">
-                                <property name="label" translatable="yes">_Add…</property>
-                                <property name="visible">True</property>
-                                <property name="use-underline">True</property>
-                              </object>
-                            </child>
+                            <property name="can_focus">False</property>
+                            <property name="toolbar_style">icons</property>
+                            <property name="show_arrow">False</property>
+                            <property name="icon_size">1</property>
+                            <style>
+                              <class name="inline-toolbar"/>
+                            </style>
                             <child>
-                              <object class="GtkButton" id="lang_remove_button">
-                                <property name="label" translatable="yes">_Remove</property>
+                              <object class="GtkToolItem">
                                 <property name="visible">True</property>
-                                <property name="use-underline">True</property>
+                                <property name="can_focus">False</property>
+                                <child>
+                                  <object class="GtkBox">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <child>
+                                      <object class="GtkButton" id="lang_add_button">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="receives_default">True</property>
+                                        <child internal-child="accessible">
+                                          <object class="AtkObject">
+                                            <property name="accessible-name" translatable="yes">Add 
language</property>
+                                          </object>
+                                        </child>
+                                        <child>
+                                          <object class="GtkImage">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="icon_name">list-add-symbolic</property>
+                                            <property name="icon-size">1</property>
+                                          </object>
+                                        </child>
+                                      </object>
+                                    </child>
+                                    <child>
+                                      <object class="GtkButton" id="lang_remove_button">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="receives_default">True</property>
+                                        <child internal-child="accessible">
+                                          <object class="AtkObject">
+                                            <property name="accessible-name" translatable="yes">Remove 
language</property>
+                                          </object>
+                                        </child>
+                                        <child>
+                                          <object class="GtkImage">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="icon_name">list-remove-symbolic</property>
+                                            <property name="icon-size">1</property>
+                                          </object>
+                                        </child>
+                                      </object>
+                                    </child>
+                                  </object>
+                                </child>
                               </object>
                             </child>
                             <child>
-                              <object class="GtkButton" id="lang_up_button">
-                                <property name="label" translatable="yes">_Up</property>
+                              <object class="GtkSeparatorToolItem">
                                 <property name="visible">True</property>
-                                <property name="use-underline">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="draw">False</property>
                               </object>
+                              <packing>
+                                <property name="expand">True</property>
+                              </packing>
                             </child>
                             <child>
-                              <object class="GtkButton" id="lang_down_button">
-                                <property name="label" translatable="yes">_Down</property>
+                              <object class="GtkToolItem">
                                 <property name="visible">True</property>
-                                <property name="use-underline">True</property>
+                                <property name="can_focus">False</property>
+                                <child>
+                                  <object class="GtkBox">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <child>
+                                      <object class="GtkButton" id="lang_up_button">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="receives_default">True</property>
+                                        <child internal-child="accessible">
+                                          <object class="AtkObject">
+                                            <property name="accessible-name" translatable="yes">Move 
language up</property>
+                                          </object>
+                                        </child>
+                                        <child>
+                                          <object class="GtkImage">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="icon_name">go-up-symbolic</property>
+                                            <property name="icon-size">1</property>
+                                          </object>
+                                        </child>
+                                      </object>
+                                    </child>
+                                    <child>
+                                      <object class="GtkButton" id="lang_down_button">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="receives_default">True</property>
+                                        <child internal-child="accessible">
+                                          <object class="AtkObject">
+                                            <property name="accessible-name" translatable="yes">Move 
language down</property>
+                                          </object>
+                                        </child>
+                                        <child>
+                                          <object class="GtkImage">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="icon_name">go-down-symbolic</property>
+                                            <property name="icon-size">1</property>
+                                          </object>
+                                        </child>
+                                      </object>
+                                    </child>
+                                  </object>
+                                </child>
                               </object>
                             </child>
                           </object>
                         </child>
                       </object>
-                      <packing>
-                        <property name="expand">True</property>
-                      </packing>
                     </child>
                   </object>
                 </child>
                 <child>
-                  <object class="GtkBox">
+                  <object class="HdyPreferencesGroup">
+                    <property name="title" translatable="yes">Spell Checking</property>
                     <property name="visible">True</property>
-                    <property name="orientation">vertical</property>
-                    <property name="spacing">6</property>
-                    <child>
-                      <object class="GtkLabel">
-                        <property name="visible">True</property>
-                        <property name="halign">start</property>
-                        <property name="label" translatable="yes">Spell Checking</property>
-                        <property name="use-underline">True</property>
-                        <attributes>
-                          <attribute name="weight" value="bold"/>
-                        </attributes>
-                      </object>
-                    </child>
                     <child>
-                      <object class="GtkCheckButton" id="enable_spell_checking_checkbutton">
-                        <property name="label" translatable="yes">_Enable spell checking</property>
+                      <object class="HdyActionRow">
+                        <property name="activatable_widget">enable_spell_checking_switch</property>
+                        <property name="title" translatable="yes">_Enable spell checking</property>
+                        <property name="use_underline">True</property>
                         <property name="visible">True</property>
-                        <property name="use-underline">True</property>
-                        <property name="halign">start</property>
-                        <property name="margin-start">12</property>
+                        <child type="action">
+                          <object class="GtkSwitch" id="enable_spell_checking_switch">
+                            <property name="valign">center</property>
+                            <property name="visible">True</property>
+                          </object>
+                        </child>
                       </object>
                     </child>
                   </object>


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