[gnome-control-center] keyboard: Create CcXkbModifierDialog only when used



commit edffd1b2959bb2ad1e27b441a937a73331f3ba1f
Author: Ian Douglas Scott <idscott system76 com>
Date:   Mon Dec 21 09:19:04 2020 -0800

    keyboard: Create CcXkbModifierDialog only when used
    
    This should avoid issues where this setting is changed just by opening
    Gnome Control Center, as reported in
    https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/918
    
    This should also mean someone can tweak the settings as desired outside
    Gnome Control Center, and not have them clobbered unless they open the
    dialog in g-c-c.

 panels/keyboard/cc-keyboard-panel.c       | 13 +++++--------
 panels/keyboard/cc-xkb-modifier-dialog.ui |  1 -
 2 files changed, 5 insertions(+), 9 deletions(-)
---
diff --git a/panels/keyboard/cc-keyboard-panel.c b/panels/keyboard/cc-keyboard-panel.c
index 0cdd59738..6b203f18f 100644
--- a/panels/keyboard/cc-keyboard-panel.c
+++ b/panels/keyboard/cc-keyboard-panel.c
@@ -45,9 +45,6 @@ struct _CcKeyboardPanel
   GtkRadioButton      *same_source;
   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;
@@ -116,17 +113,20 @@ special_chars_activated (GtkWidget       *button,
                          GtkListBoxRow   *row,
                          CcKeyboardPanel *self)
 {
+  const CcXkbModifier *modifier;
   GtkWindow *window, *dialog;
 
   window = GTK_WINDOW (cc_shell_get_toplevel (cc_panel_get_shell (CC_PANEL (self))));
 
   if (row == self->alt_chars_row)
-    dialog = GTK_WINDOW (self->alt_chars_dialog);
+    modifier = &LV3_MODIFIER;
   else if (row == self->compose_row)
-    dialog = GTK_WINDOW (self->compose_dialog);
+    modifier = &COMPOSE_MODIFIER;
   else
     return;
 
+  dialog = GTK_WINDOW (cc_xkb_modifier_dialog_new (self->input_source_settings, modifier));
+
   gtk_window_set_transient_for (dialog, window);
   gtk_widget_show (GTK_WIDGET (dialog));
 }
@@ -295,7 +295,4 @@ cc_keyboard_panel_init (CcKeyboardPanel *self)
                                 NULL,
                                 (gpointer)&COMPOSE_MODIFIER,
                                 NULL);
-
-  self->alt_chars_dialog = cc_xkb_modifier_dialog_new (self->input_source_settings, &LV3_MODIFIER);
-  self->compose_dialog = cc_xkb_modifier_dialog_new (self->input_source_settings, &COMPOSE_MODIFIER);
 }
diff --git a/panels/keyboard/cc-xkb-modifier-dialog.ui b/panels/keyboard/cc-xkb-modifier-dialog.ui
index 8c2cf8e87..851b92d6b 100644
--- a/panels/keyboard/cc-xkb-modifier-dialog.ui
+++ b/panels/keyboard/cc-xkb-modifier-dialog.ui
@@ -6,7 +6,6 @@
     <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>


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