keyboard: Use AdwActionRow for input switch rows

This commit is contained in:
Christopher Davis 2022-02-12 15:00:05 -08:00 committed by Georges Basile Stavracas Neto
parent 84becfbd80
commit 485dd456bb
2 changed files with 19 additions and 62 deletions

View file

@ -38,8 +38,6 @@ struct _CcKeyboardPanel
{
CcPanel parent_instance;
GtkListBox *input_source_list;
GtkCheckButton *per_window_source;
GtkCheckButton *same_source;
GSettings *keybindings_settings;
@ -51,7 +49,7 @@ struct _CcKeyboardPanel
GtkWidget *value_alternate_chars;
GtkWidget *value_compose;
GtkListBoxRow *common_shortcuts_row;
AdwActionRow *common_shortcuts_row;
};
CC_PANEL_REGISTER (CcKeyboardPanel, cc_keyboard_panel)
@ -98,14 +96,6 @@ static const CcXkbModifier COMPOSE_MODIFIER = {
NULL,
};
static const gchar *custom_css =
".keyboard-panel-radio-button {"
" padding-left: 6px;"
" padding-right: 12px;"
" padding-top: 12px;"
" padding-bottom: 12px;"
"}";
static void
special_chars_activated (AdwActionRow *row,
CcKeyboardPanel *self)
@ -196,7 +186,6 @@ 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_group);
gtk_widget_class_bind_template_child (widget_class, CcKeyboardPanel, per_window_source);
gtk_widget_class_bind_template_child (widget_class, CcKeyboardPanel, same_source);
@ -238,20 +227,10 @@ translate_switch_input_source (GValue *value,
static void
cc_keyboard_panel_init (CcKeyboardPanel *self)
{
GtkCssProvider *provider;
g_resources_register (cc_keyboard_get_resource ());
gtk_widget_init_template (GTK_WIDGET (self));
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, custom_css, -1);
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION + 1);
g_object_unref (provider);
self->input_source_settings = g_settings_new ("org.gnome.desktop.input-sources");
/* "Input Source Switching" section */

View file

@ -27,48 +27,26 @@
<object class="AdwPreferencesGroup" id="input_switch_group">
<property name="title" translatable="yes">Input Source Switching</property>
<child>
<object class="GtkListBox" id="input_source_list">
<property name="margin-bottom">20</property>
<style>
<class name="boxed-list"/>
</style>
<child>
<object class="GtkListBoxRow">
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Use the _same source for all windows</property>
<property name="use-underline">True</property>
<property name="activatable-widget">same_source</property>
<child type="prefix">
<object class="GtkCheckButton" id="same_source">
<property name="active">True</property>
<style>
<class name="keyboard-panel-radio-button" />
</style>
<child>
<object class="GtkLabel">
<property name="margin_start">6</property>
<property name="use_underline">True</property>
<property name="label" translatable="yes">Use the _same source for all windows</property>
</object>
</child>
<property name="valign">center</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow">
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Switch input sources _individually for each window</property>
<property name="use-underline">True</property>
<property name="activatable-widget">per_window_source</property>
<child type="prefix">
<object class="GtkCheckButton" id="per_window_source">
<property name="active">True</property>
<property name="valign">center</property>
<property name="group">same_source</property>
<style>
<class name="keyboard-panel-radio-button" />
</style>
<child>
<object class="GtkLabel">
<property name="margin_start">6</property>
<property name="use_underline">True</property>
<property name="label" translatable="yes">Switch input sources _individually for each window</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>