[gnome-control-center] keyboard: Update panel layout with descriptions for sections



commit 3a50deb43138eb93e7d0b016dcb99eeb200166f2
Author: Ian Douglas Scott <idscott system76 com>
Date:   Tue Jan 26 12:05:27 2021 -0800

    keyboard: Update panel layout with descriptions for sections
    
    Changes based on mockup by @aday:
    https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1222#note_1017128

 panels/keyboard/cc-keyboard-panel.c  |  20 +++---
 panels/keyboard/cc-keyboard-panel.ui | 119 ++++++++++++++++++++++++-----------
 2 files changed, 94 insertions(+), 45 deletions(-)
---
diff --git a/panels/keyboard/cc-keyboard-panel.c b/panels/keyboard/cc-keyboard-panel.c
index 7a3fb419b..dfca7c475 100644
--- a/panels/keyboard/cc-keyboard-panel.c
+++ b/panels/keyboard/cc-keyboard-panel.c
@@ -43,13 +43,13 @@ struct _CcKeyboardPanel
 
   GtkRadioButton      *per_window_source;
   GtkRadioButton      *same_source;
-  GtkLabel            *value_input_switch;
   GSettings           *keybindings_settings;
 
   /* "Type Special Characters" section */
   CcXkbModifierDialog *alt_chars_dialog;
   CcXkbModifierDialog *compose_dialog;
   GSettings           *input_source_settings;
+  GtkLabel            *input_switch_description;
   GtkListBox          *special_chars_list;
   GtkListBoxRow       *alt_chars_row;
   GtkListBoxRow       *compose_row;
@@ -201,6 +201,7 @@ cc_keyboard_panel_class_init (CcKeyboardPanelClass *klass)
   gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/control-center/keyboard/cc-keyboard-panel.ui");
 
   gtk_widget_class_bind_template_child (widget_class, CcKeyboardPanel, input_source_list);
+  gtk_widget_class_bind_template_child (widget_class, CcKeyboardPanel, input_switch_description);
   gtk_widget_class_bind_template_child (widget_class, CcKeyboardPanel, per_window_source);
   gtk_widget_class_bind_template_child (widget_class, CcKeyboardPanel, same_source);
   gtk_widget_class_bind_template_child (widget_class, CcKeyboardPanel, special_chars_list);
@@ -208,7 +209,6 @@ cc_keyboard_panel_class_init (CcKeyboardPanelClass *klass)
   gtk_widget_class_bind_template_child (widget_class, CcKeyboardPanel, compose_row);
   gtk_widget_class_bind_template_child (widget_class, CcKeyboardPanel, value_alternate_chars);
   gtk_widget_class_bind_template_child (widget_class, CcKeyboardPanel, value_compose);
-  gtk_widget_class_bind_template_child (widget_class, CcKeyboardPanel, value_input_switch);
   gtk_widget_class_bind_template_child (widget_class, CcKeyboardPanel, common_shortcuts_row);
 
   gtk_widget_class_bind_template_callback (widget_class, special_chars_activated);
@@ -221,13 +221,19 @@ translate_switch_input_source (GValue *value,
                                gpointer user_data)
 {
   g_autofree const gchar **strv = NULL;
+  g_autofree gchar *accel_text = NULL;
   g_autofree gchar *label = NULL;
   CcKeyCombo combo = { 0 };
 
   strv = g_variant_get_strv (variant, NULL);
 
   gtk_accelerator_parse (strv[0] ? strv[0] : "", &combo.keyval, &combo.mask);
-  label = convert_keysym_state_to_string (&combo);
+  accel_text = convert_keysym_state_to_string (&combo);
+
+  label = g_strdup_printf (_("Input sources can be switched using the %s "
+                             "keyboard shortcut.\nThis can be changed in "
+                             "the keyboard shortcut settings."),
+                           accel_text);
 
   g_value_set_string (value, label);
 
@@ -265,10 +271,10 @@ cc_keyboard_panel_init (CcKeyboardPanel *self)
                    G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_INVERT_BOOLEAN);
   self->keybindings_settings = g_settings_new ("org.gnome.desktop.wm.keybindings");
   g_settings_bind_with_mapping (self->keybindings_settings, "switch-input-source",
-                               self->value_input_switch, "label",
-                               G_SETTINGS_BIND_GET,
-                               translate_switch_input_source,
-                               NULL, NULL, NULL);
+                                self->input_switch_description, "label",
+                                G_SETTINGS_BIND_GET,
+                                translate_switch_input_source,
+                                NULL, NULL, NULL);
 
   /* "Type Special Characters" section */
   g_settings_bind_with_mapping (self->input_source_settings,
diff --git a/panels/keyboard/cc-keyboard-panel.ui b/panels/keyboard/cc-keyboard-panel.ui
index 532b53a01..9bc7f105d 100644
--- a/panels/keyboard/cc-keyboard-panel.ui
+++ b/panels/keyboard/cc-keyboard-panel.ui
@@ -36,14 +36,34 @@
                 <property name="spacing">12</property>
                 <property name="hexpand">True</property>
                 <child>
-                  <object class="GtkLabel">
+                  <object class="GtkBox">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">Input Sources</property>
-                    <attributes>
-                      <attribute name="weight" value="bold"/>
-                    </attributes>
+                    <property name="orientation">vertical</property>
+                    <property name="spacing">6</property>
+                    <child>
+                      <object class="GtkLabel">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">Input Sources</property>
+                        <attributes>
+                          <attribute name="weight" value="bold"/>
+                        </attributes>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkLabel">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">Includes keyboard layouts and input 
methods.</property>
+                        <property name="wrap">True</property>
+                        <property name="max-width-chars">50</property>
+                        <style>
+                          <class name="dim-label" />
+                        </style>
+                      </object>
+                    </child>
                   </object>
                 </child>
                 <child>
@@ -59,14 +79,33 @@
                   </object>
                 </child>
                 <child>
-                  <object class="GtkLabel">
+                  <object class="GtkBox">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">Input Source Switching</property>
-                    <attributes>
-                      <attribute name="weight" value="bold"/>
-                    </attributes>
+                    <property name="orientation">vertical</property>
+                    <property name="spacing">6</property>
+                    <child>
+                      <object class="GtkLabel">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">Input Source Switching</property>
+                        <attributes>
+                          <attribute name="weight" value="bold"/>
+                        </attributes>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="input_switch_description">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">0</property>
+                        <property name="wrap">True</property>
+                        <property name="max-width-chars">50</property>
+                        <style>
+                          <class name="dim-label" />
+                        </style>
+                      </object>
+                    </child>
                   </object>
                 </child>
                 <child>
@@ -130,34 +169,39 @@
                             </child>
                           </object>
                         </child>
-                        <child>
-                          <object class="HdyActionRow">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="selectable">False</property>
-                            <property name="title" translatable="yes">Keyboard Shortcut</property>
-                            <property name="subtitle" translatable="yes">This can be changed in Customize 
Shortcuts</property>
-                            <child>
-                              <object class="GtkLabel" id="value_input_switch">
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                              </object>
-                            </child>
-                         </object>
-                       </child>
                       </object>
                     </child>
                   </object>
                 </child>
                 <child>
-                  <object class="GtkLabel">
+                  <object class="GtkBox">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">Type Special Characters</property>
-                    <attributes>
-                      <attribute name="weight" value="bold"/>
-                    </attributes>
+                    <property name="orientation">vertical</property>
+                    <property name="spacing">6</property>
+                    <child>
+                      <object class="GtkLabel">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">Special Character Entry</property>
+                        <attributes>
+                          <attribute name="weight" value="bold"/>
+                        </attributes>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkLabel">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">Methods for entering symbols and letter 
variants using the keyboard.</property>
+                        <property name="wrap">True</property>
+                        <property name="max-width-chars">50</property>
+                        <style>
+                          <class name="dim-label" />
+                        </style>
+                      </object>
+                    </child>
                   </object>
                 </child>
                 <child>
@@ -177,7 +221,6 @@
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="title" translatable="yes">Alternate Characters Key</property>
-                            <property name="subtitle" translatable="yes">Hold down and type to enter 
different characters</property>
                             <property name="activatable">True</property>
                             <child>
                               <object class="GtkLabel" id="value_alternate_chars">
@@ -250,7 +293,7 @@
                           <object class="HdyActionRow" id="common_shortcuts_row">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
-                            <property name="title" translatable="yes">Customize Shortcuts</property>
+                            <property name="title" translatable="yes">View and Customize Shortcuts</property>
                             <property name="activatable">True</property>
                             <child>
                               <object class="GtkImage">


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