[gnome-control-center] keyboard: replace CcAltCharsKeyDialog with a generic XkbModifierDialog



commit 8b7eac0a7b0619676b2795b63ba4fd6571c37f10
Author: Ian Douglas Scott <idscott system76 com>
Date:   Fri Jul 17 15:11:00 2020 -0700

    keyboard: replace CcAltCharsKeyDialog with a generic XkbModifierDialog
    
    Previously, there were multiple redundant lists of possible values for
    this setting. This uses one struct to define not only all the possible
    values, but also anything specific to the alternate characters key, so
    this can be used for other modifiers.
    
    This also changes the style of the dialog to use a GtkListBox.

 panels/keyboard/cc-alt-chars-key-dialog.c          | 209 ------------
 panels/keyboard/cc-alt-chars-key-dialog.ui         | 155 ---------
 panels/keyboard/cc-keyboard-panel.c                |  77 ++---
 panels/keyboard/cc-keyboard-panel.ui               |   9 +
 panels/keyboard/cc-xkb-modifier-dialog.c           | 366 +++++++++++++++++++++
 ...chars-key-dialog.h => cc-xkb-modifier-dialog.h} |  25 +-
 panels/keyboard/cc-xkb-modifier-dialog.ui          |  82 +++++
 panels/keyboard/keyboard.gresource.xml             |   2 +-
 panels/keyboard/meson.build                        |   2 +-
 po/POTFILES.in                                     |   2 +-
 10 files changed, 502 insertions(+), 427 deletions(-)
---
diff --git a/panels/keyboard/cc-keyboard-panel.c b/panels/keyboard/cc-keyboard-panel.c
index ac3d149d5..eaf1569c4 100644
--- a/panels/keyboard/cc-keyboard-panel.c
+++ b/panels/keyboard/cc-keyboard-panel.c
@@ -22,7 +22,6 @@
 
 #include <glib/gi18n.h>
 
-#include "cc-alt-chars-key-dialog.h"
 #include "cc-keyboard-shortcut-row.h"
 #include "cc-keyboard-item.h"
 #include "cc-keyboard-manager.h"
@@ -30,6 +29,7 @@
 #include "cc-keyboard-panel.h"
 #include "cc-keyboard-resources.h"
 #include "cc-keyboard-shortcut-editor.h"
+#include "cc-xkb-modifier-dialog.h"
 
 #include "keyboard-shortcuts.h"
 
@@ -61,7 +61,7 @@ struct _CcKeyboardPanel
   GtkSizeGroup       *accelerator_sizegroup;
 
   /* Alternate characters key */
-  CcAltCharsKeyDialog *alt_chars_key_dialog;
+  CcXkbModifierDialog *xkb_modifier_dialog;
   GSettings           *input_source_settings;
   GtkWidget           *value_alternate_chars;
 
@@ -85,19 +85,20 @@ static const gchar* custom_css =
 "    padding: 0;"
 "}";
 
-
-#define DEFAULT_LV3_OPTION 5
-static struct {
-  const char *xkb_option;
-  const char *label;
-  const char *widget_name;
-} lv3_xkb_options[] = {
-  { "lv3:switch", NC_("keyboard key", "Right Ctrl"), "radiobutton_rightctrl" },
-  { "lv3:menu_switch", NC_("keyboard key", "Menu Key"), "radiobutton_menukey" },
-  { "lv3:lwin_switch", NC_("keyboard key", "Left Super"), "radiobutton_leftsuper" },
-  { "lv3:rwin_switch", NC_("keyboard key", "Right Super"), "radiobutton_rightsuper" },
-  { "lv3:lalt_switch", NC_("keyboard key", "Left Alt"), "radiobutton_leftalt" },
-  { "lv3:ralt_switch", NC_("keyboard key", "Right Alt"), "radiobutton_rightalt" },
+static const XkbModifier LV3_MODIFIER = {
+  "lv3:",
+  N_("Alternate Characters Key"),
+  N_("The alternate characters key can be used to enter additional characters. These are sometimes printed 
as a third-option on your keyboard."),
+  (XkbOption[]){
+    { NC_("keyboard key", "Left Alt"),    "lv3:lalt_switch" },
+    { NC_("keyboard key", "Right Alt"),   "lv3:ralt_switch" },
+    { NC_("keyboard key", "Left Super"),  "lv3:lwin_switch" },
+    { NC_("keyboard key", "Right Super"), "lv3:rwin_switch" },
+    { NC_("keyboard key", "Menu key"),    "lv3:menu_switch" },
+    { NC_("keyboard key", "Right Ctrl"),  "lv3:switch" },
+    { NULL,                               NULL }
+  },
+  "lv3:ralt_switch",
 };
 
 /* RowData functions */
@@ -514,44 +515,8 @@ alternate_chars_activated (GtkWidget       *button,
 
   window = GTK_WINDOW (cc_shell_get_toplevel (cc_panel_get_shell (CC_PANEL (self))));
 
-  gtk_window_set_transient_for (GTK_WINDOW (self->alt_chars_key_dialog), window);
-  gtk_widget_show (GTK_WIDGET (self->alt_chars_key_dialog));
-}
-
-static gboolean
-transform_binding_to_alt_chars (GValue   *value,
-                                GVariant *variant,
-                                gpointer  user_data)
-{
-  const char **items;
-  guint i;
-
-  items = g_variant_get_strv (variant, NULL);
-  if (!items)
-    goto bail;
-
-  for (i = 0; items[i] != NULL; i++)
-    {
-      guint j;
-
-      if (!g_str_has_prefix (items[i], "lv3:"))
-        continue;
-
-      for (j = 0; j < G_N_ELEMENTS (lv3_xkb_options); j++)
-        {
-          if (!g_str_equal (items[i], lv3_xkb_options[j].xkb_option))
-            continue;
-
-          g_value_set_string (value,
-                              g_dpgettext2 (NULL, "keyboard key", lv3_xkb_options[j].label));
-          return TRUE;
-        }
-    }
-
-bail:
-  g_value_set_string (value,
-                      g_dpgettext2 (NULL, "keyboard key", lv3_xkb_options[DEFAULT_LV3_OPTION].label));
-  return TRUE;
+  gtk_window_set_transient_for (GTK_WINDOW (self->xkb_modifier_dialog), window);
+  gtk_widget_show (GTK_WIDGET (self->xkb_modifier_dialog));
 }
 
 static void
@@ -678,12 +643,12 @@ cc_keyboard_panel_init (CcKeyboardPanel *self)
                                 self->value_alternate_chars,
                                 "label",
                                 G_SETTINGS_BIND_GET,
-                                transform_binding_to_alt_chars,
+                                xcb_modifier_transform_binding_to_label,
                                 NULL,
-                                self->value_alternate_chars,
+                                (gpointer)&LV3_MODIFIER,
                                 NULL);
 
-  self->alt_chars_key_dialog = cc_alt_chars_key_dialog_new (self->input_source_settings);
+  self->xkb_modifier_dialog = cc_xkb_modifier_dialog_new (self->input_source_settings, &LV3_MODIFIER);
 
   /* Shortcut manager */
   self->manager = cc_keyboard_manager_new ();
diff --git a/panels/keyboard/cc-keyboard-panel.ui b/panels/keyboard/cc-keyboard-panel.ui
index 16e522c59..7c5073e33 100644
--- a/panels/keyboard/cc-keyboard-panel.ui
+++ b/panels/keyboard/cc-keyboard-panel.ui
@@ -79,6 +79,15 @@
                                 <property name="label" translatable="no">Right Alt</property>
                               </object>
                             </child>
+                            <child>
+                              <object class="GtkImage">
+                                <property name="visible">True</property>
+                                <property name="icon_name">go-next-symbolic</property>
+                                <style>
+                                  <class name="dim-label"/>
+                                </style>
+                              </object>
+                            </child>
                           </object>
                         </child>
                       </object>
diff --git a/panels/keyboard/cc-xkb-modifier-dialog.c b/panels/keyboard/cc-xkb-modifier-dialog.c
new file mode 100644
index 000000000..78ddb48ff
--- /dev/null
+++ b/panels/keyboard/cc-xkb-modifier-dialog.c
@@ -0,0 +1,366 @@
+/* cc-xkb-modifier-dialog.c
+ *
+ * Copyright 2019 Bastien Nocera <hadess hadess net>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include <glib/gi18n.h>
+#define HANDY_USE_UNSTABLE_API
+#include <handy.h>
+
+#include "cc-xkb-modifier-dialog.h"
+#include "list-box-helper.h"
+
+struct _CcXkbModifierDialog
+{
+  GtkDialog       parent_instance;
+
+  GtkLabel       *description_label;
+  GtkSwitch      *enabled_switch;
+  GtkListBox     *listbox;
+  GtkListBox     *switch_listbox;
+  HdyActionRow   *switch_row;
+
+  GSettings      *input_source_settings;
+  const XkbModifier *modifier;
+  GSList         *radio_group;
+};
+
+G_DEFINE_TYPE (CcXkbModifierDialog, cc_xkb_modifier_dialog, GTK_TYPE_DIALOG)
+
+static const gchar *custom_css =
+".xkb-option-button {"
+"    padding: 12px"
+"}";
+
+static const XkbOption*
+get_xkb_option_from_name (const XkbModifier *modifier, const gchar* name)
+{
+  const XkbOption *options = modifier->options;
+  int i;
+
+  for (i = 0; options[i].label && options[i].xkb_option; i++)
+    {
+      if (g_str_equal (name, options[i].xkb_option))
+        return &options[i];
+    }
+
+  return NULL;
+}
+
+static GtkRadioButton *
+get_radio_button_from_xkb_option_name (CcXkbModifierDialog *self,
+                                       const gchar         *name)
+{
+  gchar *xkb_option;
+  GSList *l;
+
+  for (l = self->radio_group; l != NULL; l = l->next)
+    {
+      xkb_option = g_object_get_data (l->data, "xkb-option");
+      if (g_strcmp0 (xkb_option, name) == 0)
+        return l->data;
+    }
+
+  return NULL;
+}
+
+static void
+update_active_radio (CcXkbModifierDialog *self)
+{
+  g_auto(GStrv) options = NULL;
+  GtkRadioButton *rightalt_radio;
+  const XkbOption *default_option;
+  guint i;
+
+  options = g_settings_get_strv (self->input_source_settings, "xkb-options");
+
+  for (i = 0; options != NULL && options[i] != NULL; i++)
+    {
+      GtkRadioButton *radio;
+
+      if (!g_str_has_prefix (options[i], self->modifier->prefix))
+        continue;
+
+      radio = get_radio_button_from_xkb_option_name (self, options[i]);
+
+      if (!radio)
+        continue;
+
+      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), TRUE);
+      gtk_switch_set_active (self->enabled_switch, TRUE);
+      return;
+    }
+
+  if (self->modifier->default_option != NULL)
+    {
+      default_option = get_xkb_option_from_name(self->modifier, self->modifier->default_option);
+      rightalt_radio = get_radio_button_from_xkb_option_name (self, default_option->xkb_option);
+      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rightalt_radio), TRUE);
+      gtk_switch_set_active (self->enabled_switch, TRUE);
+    }
+  else
+    {
+      gtk_switch_set_active (self->enabled_switch, FALSE);
+    }
+}
+
+static void
+set_xkb_option (CcXkbModifierDialog *self,
+                gchar               *xkb_option)
+{
+  g_autoptr(GPtrArray) array = NULL;
+  g_auto(GStrv) options = NULL;
+  gboolean found;
+  guint i;
+
+  /* Either replace the existing "<modifier>:" option in the string
+   * array, or add the option at the end
+   */
+  array = g_ptr_array_new ();
+  options = g_settings_get_strv (self->input_source_settings, "xkb-options");
+  found = FALSE;
+
+  for (i = 0; options != NULL && options[i] != NULL; i++)
+    {
+      if (g_str_has_prefix (options[i], self->modifier->prefix))
+        {
+          if (!found && xkb_option != NULL)
+            g_ptr_array_add (array, xkb_option);
+          found = TRUE;
+        }
+      else
+        {
+          g_ptr_array_add (array, options[i]);
+        }
+    }
+
+  if (!found && xkb_option != NULL)
+    g_ptr_array_add (array, xkb_option);
+
+  g_ptr_array_add (array, NULL);
+
+  g_settings_set_strv (self->input_source_settings,
+                       "xkb-options",
+                       (const gchar * const *) array->pdata);
+}
+
+static void
+on_active_radio_changed_cb (CcXkbModifierDialog *self,
+                            GtkRadioButton      *radio)
+{
+  gchar *xkb_option;
+
+  if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio)))
+    return;
+
+  if (!gtk_switch_get_state (self->enabled_switch))
+    return;
+
+  xkb_option = (gchar *)g_object_get_data (G_OBJECT (radio), "xkb-option");
+  set_xkb_option (self, xkb_option);
+}
+
+static void
+on_xkb_options_changed_cb (CcXkbModifierDialog *self)
+{
+  if (self->modifier == NULL)
+    update_active_radio (self);
+}
+
+static gboolean
+enable_switch_changed_cb (GtkSwitch *widget,
+                          gboolean   state,
+                          gpointer   user_data)
+{
+  CcXkbModifierDialog *self = user_data;
+  gchar *xkb_option;
+  GSList *l;
+
+  gtk_widget_set_sensitive (GTK_WIDGET (self->listbox), state);
+
+  if (state)
+    {
+      for (l = self->radio_group; l != NULL; l = l->next)
+        {
+          if (gtk_toggle_button_get_active (l->data))
+            {
+              xkb_option = (gchar *)g_object_get_data (l->data, "xkb-option");
+              set_xkb_option (self, xkb_option);
+              break;
+            }
+        }
+    }
+  else
+    {
+      set_xkb_option (self, NULL);
+    }
+
+  return FALSE;
+}
+
+static void
+cc_xkb_modifier_dialog_finalize (GObject *object)
+{
+  CcXkbModifierDialog *self = (CcXkbModifierDialog *)object;
+
+  g_clear_object (&self->input_source_settings);
+
+  G_OBJECT_CLASS (cc_xkb_modifier_dialog_parent_class)->finalize (object);
+}
+
+static void
+cc_xkb_modifier_dialog_class_init (CcXkbModifierDialogClass *klass)
+{
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->finalize = cc_xkb_modifier_dialog_finalize;
+
+  gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/control-center/keyboard/cc-xkb-modifier-dialog.ui");
+
+  gtk_widget_class_bind_template_child (widget_class, CcXkbModifierDialog, description_label);
+  gtk_widget_class_bind_template_child (widget_class, CcXkbModifierDialog, enabled_switch);
+  gtk_widget_class_bind_template_child (widget_class, CcXkbModifierDialog, listbox);
+  gtk_widget_class_bind_template_child (widget_class, CcXkbModifierDialog, switch_listbox);
+  gtk_widget_class_bind_template_child (widget_class, CcXkbModifierDialog, switch_row);
+
+  gtk_widget_class_bind_template_callback (widget_class, enable_switch_changed_cb);
+}
+
+static void
+add_radio_buttons (CcXkbModifierDialog *self)
+{
+  GtkWidget *row, *radio_button, *label, *last_button = NULL;
+  XkbOption *options = self->modifier->options;
+  int i;
+
+  for (i = 0; options[i].label && options[i].xkb_option; i++)
+    {
+      row = g_object_new (GTK_TYPE_LIST_BOX_ROW,
+                          "visible", TRUE,
+                          "selectable", FALSE,
+                          NULL);
+      gtk_container_add (GTK_CONTAINER (self->listbox), row);
+
+      radio_button = g_object_new (GTK_TYPE_RADIO_BUTTON,
+                                   "visible", TRUE,
+                                   "can_focus", TRUE,
+                                   "receives_default", FALSE,
+                                   "draw_indicator", TRUE,
+                                   NULL);
+      label = g_object_new (GTK_TYPE_LABEL,
+                            "visible", TRUE,
+                            "margin_left", 6,
+                            "label", g_dpgettext2 (NULL, "keyboard key", options[i].label),
+                            NULL);
+      gtk_container_add (GTK_CONTAINER (radio_button), label);
+      gtk_style_context_add_class (gtk_widget_get_style_context (radio_button), "xkb-option-button");
+      gtk_radio_button_join_group (GTK_RADIO_BUTTON (radio_button), GTK_RADIO_BUTTON (last_button));
+      g_object_set_data (G_OBJECT (radio_button), "xkb-option", options[i].xkb_option);
+      g_signal_connect_object (radio_button, "toggled", (GCallback)on_active_radio_changed_cb, self, 
G_CONNECT_SWAPPED);
+      gtk_container_add (GTK_CONTAINER (row), radio_button);
+
+      last_button = radio_button;
+    }
+
+  self->radio_group = NULL;
+  if (last_button != NULL)
+    self->radio_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (last_button));
+}
+
+static void
+cc_xkb_modifier_dialog_init (CcXkbModifierDialog *self)
+{
+  g_autoptr(GtkCssProvider) provider = NULL;
+
+  gtk_widget_init_template (GTK_WIDGET (self));
+
+  provider = gtk_css_provider_new ();
+  gtk_css_provider_load_from_data (provider, custom_css, -1, NULL);
+
+  gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
+                                             GTK_STYLE_PROVIDER (provider),
+                                             GTK_STYLE_PROVIDER_PRIORITY_APPLICATION + 1);
+
+  self->modifier = NULL;
+
+  gtk_list_box_set_header_func (self->listbox, cc_list_box_update_header_func, NULL, NULL);
+
+  self->input_source_settings = g_settings_new ("org.gnome.desktop.input-sources");
+  g_signal_connect_object (self->input_source_settings,
+                           "changed::xkb-options",
+                           G_CALLBACK (on_xkb_options_changed_cb),
+                           self, G_CONNECT_SWAPPED);
+}
+
+CcXkbModifierDialog *
+cc_xkb_modifier_dialog_new (GSettings *input_settings,
+                            const XkbModifier *modifier)
+{
+  CcXkbModifierDialog *self;
+
+  self = g_object_new (CC_TYPE_XKB_MODIFIER_DIALOG,
+                       "use-header-bar", TRUE,
+                       NULL);
+  self->input_source_settings = g_object_ref (input_settings);
+
+  self->modifier = modifier;
+  gtk_window_set_title (GTK_WINDOW (self), gettext (modifier->title));
+  hdy_preferences_row_set_title (HDY_PREFERENCES_ROW (self->switch_row), gettext (modifier->title));
+  gtk_label_set_markup (self->description_label, gettext (modifier->description));
+  gtk_widget_set_visible (GTK_WIDGET (self->switch_listbox), modifier->default_option == NULL);
+  add_radio_buttons (self);
+  update_active_radio (self);
+  gtk_widget_set_sensitive (GTK_WIDGET (self->listbox), gtk_switch_get_state (self->enabled_switch));
+
+  return self;
+}
+
+gboolean
+xcb_modifier_transform_binding_to_label (GValue   *value,
+                                         GVariant *variant,
+                                         gpointer  user_data)
+{
+  const XkbModifier *modifier = user_data;
+  const XkbOption *entry = NULL;
+  const char **items;
+  guint i;
+
+  items = g_variant_get_strv (variant, NULL);
+
+  for (i = 0; items != NULL && items[i] != NULL; i++)
+    {
+      entry = get_xkb_option_from_name (modifier, items[i]);
+      if (entry != NULL)
+        break;
+    }
+
+  if (entry == NULL && modifier->default_option == NULL)
+    {
+      g_value_set_string (value, _("Disabled"));
+      return TRUE;
+    }
+  else if (entry == NULL)
+    {
+      entry = get_xkb_option_from_name(modifier, modifier->default_option);
+    }
+
+  g_value_set_string (value,
+                      g_dpgettext2 (NULL, "keyboard key", entry->label));
+  return TRUE;
+}
diff --git a/panels/keyboard/cc-alt-chars-key-dialog.h b/panels/keyboard/cc-xkb-modifier-dialog.h
similarity index 58%
rename from panels/keyboard/cc-alt-chars-key-dialog.h
rename to panels/keyboard/cc-xkb-modifier-dialog.h
index fb0c85357..1b2d180a4 100644
--- a/panels/keyboard/cc-alt-chars-key-dialog.h
+++ b/panels/keyboard/cc-xkb-modifier-dialog.h
@@ -1,4 +1,4 @@
-/* cc-alt-chars-key-dialog.h
+/* cc-xkb-modifier-dialog.h
  *
  * Copyright 2019 Bastien Nocera <hadess hadess net>
  *
@@ -24,9 +24,26 @@
 
 G_BEGIN_DECLS
 
-#define CC_TYPE_ALT_CHARS_KEY_DIALOG (cc_alt_chars_key_dialog_get_type())
-G_DECLARE_FINAL_TYPE (CcAltCharsKeyDialog, cc_alt_chars_key_dialog, CC, ALT_CHARS_KEY_DIALOG, GtkDialog)
+typedef struct
+{
+  gchar *label;
+  gchar *xkb_option;
+} XkbOption;
 
-CcAltCharsKeyDialog *cc_alt_chars_key_dialog_new (GSettings *input_settings);
+typedef struct
+{
+  gchar *prefix;
+  gchar *title;
+  gchar *description;
+  XkbOption *options;
+  gchar *default_option;
+} XkbModifier;
+
+#define CC_TYPE_XKB_MODIFIER_DIALOG (cc_xkb_modifier_dialog_get_type())
+G_DECLARE_FINAL_TYPE (CcXkbModifierDialog, cc_xkb_modifier_dialog, CC, XKB_MODIFIER_DIALOG, GtkDialog)
+
+CcXkbModifierDialog *cc_xkb_modifier_dialog_new (GSettings *input_settings, const XkbModifier*);
+
+gboolean xcb_modifier_transform_binding_to_label (GValue*, GVariant*, gpointer);
 
 G_END_DECLS
diff --git a/panels/keyboard/cc-xkb-modifier-dialog.ui b/panels/keyboard/cc-xkb-modifier-dialog.ui
new file mode 100644
index 000000000..8c2cf8e87
--- /dev/null
+++ b/panels/keyboard/cc-xkb-modifier-dialog.ui
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <template class="CcXkbModifierDialog" parent="GtkDialog">
+    <property name="modal">True</property>
+    <property name="can_focus">False</property>
+    <property name="resizable">False</property>
+    <property name="default_width">500</property>
+    <property name="type_hint">dialog</property>
+    <signal name="delete-event" handler="gtk_widget_hide_on_delete" />
+    <child internal-child="vbox">
+      <object class="GtkBox">
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+
+        <child>
+          <object class="GtkBox">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="margin">18</property>
+            <property name="spacing">18</property>
+            <property name="orientation">vertical</property>
+
+            <child>
+              <object class="GtkLabel" id="description_label">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="margin_top">6</property>
+                <property name="wrap">True</property>
+                <property name="width_chars">40</property>
+                <property name="max_width_chars">40</property>
+                <property name="xalign">0</property>
+              </object>
+            </child>
+
+            <child>
+              <object class="GtkListBox" id="switch_listbox">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <style>
+                  <class name="frame"/>
+                </style>
+                <child>
+                  <object class="HdyActionRow" id="switch_row">
+                    <property name="visible">True</property>
+                    <property name="activatable">False</property>
+                    <property name="selectable">False</property>
+                    <child>
+                      <object class="GtkSwitch" id="enabled_switch">
+                        <property name="visible">True</property>
+                        <property name="valign">center</property>
+                        <signal name="state-set" handler="enable_switch_changed_cb" 
object="CcXkbModifierDialog" swapped="no"/>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+
+            <child>
+              <object class="GtkListBox" id="listbox">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <style>
+                  <class name="frame"/>
+                </style>
+              </object>
+            </child>
+
+          </object>
+        </child>
+
+      </object>
+    </child>
+
+    <child internal-child="headerbar">
+      <object class="GtkHeaderBar">
+        <property name="can_focus">False</property>
+        <property name="show_close_button">True</property>
+      </object>
+    </child>
+  </template>
+</interface>
diff --git a/panels/keyboard/keyboard.gresource.xml b/panels/keyboard/keyboard.gresource.xml
index 7fe8bf8dc..fc210ce75 100644
--- a/panels/keyboard/keyboard.gresource.xml
+++ b/panels/keyboard/keyboard.gresource.xml
@@ -2,7 +2,7 @@
 <gresources>
   <gresource prefix="/org/gnome/control-center/keyboard">
     <file preprocess="xml-stripblanks">enter-keyboard-shortcut.svg</file>
-    <file preprocess="xml-stripblanks">cc-alt-chars-key-dialog.ui</file>
+    <file preprocess="xml-stripblanks">cc-xkb-modifier-dialog.ui</file>
     <file preprocess="xml-stripblanks">cc-keyboard-shortcut-row.ui</file>
     <file preprocess="xml-stripblanks">cc-keyboard-panel.ui</file>
     <file preprocess="xml-stripblanks">cc-keyboard-shortcut-editor.ui</file>
diff --git a/panels/keyboard/meson.build b/panels/keyboard/meson.build
index 63729f57c..91ef954f0 100644
--- a/panels/keyboard/meson.build
+++ b/panels/keyboard/meson.build
@@ -56,7 +56,7 @@ foreach file: xml_files
 endforeach
 
 sources = files(
-  'cc-alt-chars-key-dialog.c',
+  'cc-xkb-modifier-dialog.c',
   'cc-keyboard-shortcut-row.c',
   'cc-keyboard-panel.c',
   'cc-keyboard-item.c',
diff --git a/po/POTFILES.in b/po/POTFILES.in
index bfe941869..ad2892009 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -56,7 +56,6 @@ panels/keyboard/01-launchers.xml.in
 panels/keyboard/01-screenshot.xml.in
 panels/keyboard/01-system.xml.in
 panels/keyboard/50-accessibility.xml.in
-panels/keyboard/cc-alt-chars-key-dialog.ui
 panels/keyboard/cc-keyboard-manager.c
 panels/keyboard/cc-keyboard-option.c
 panels/keyboard/cc-keyboard-panel.c
@@ -64,6 +63,7 @@ panels/keyboard/cc-keyboard-panel.ui
 panels/keyboard/cc-keyboard-shortcut-editor.c
 panels/keyboard/cc-keyboard-shortcut-editor.ui
 panels/keyboard/cc-keyboard-shortcut-row.ui
+panels/keyboard/cc-xkb-modifier-dialog.c
 panels/keyboard/gnome-keyboard-panel.desktop.in.in
 panels/keyboard/keyboard-shortcuts.c
 panels/location/cc-location-panel.ui


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