[gnome-control-center] keyboard: Right align shortcut
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] keyboard: Right align shortcut
- Date: Sat, 19 Dec 2020 09:48:34 +0000 (UTC)
commit 5e8e9c3236eaef76a741fbb7610c458081cc7761
Author: Ian Douglas Scott <idscott system76 com>
Date: Fri Dec 18 08:11:24 2020 -0800
keyboard: Right align shortcut
Reset button is in a `GtkRevealer` to not take up space when hidden.
panels/keyboard/cc-keyboard-shortcut-row.c | 6 +++--
panels/keyboard/cc-keyboard-shortcut-row.ui | 34 +++++++++++++++++------------
2 files changed, 24 insertions(+), 16 deletions(-)
---
diff --git a/panels/keyboard/cc-keyboard-shortcut-row.c b/panels/keyboard/cc-keyboard-shortcut-row.c
index f8b901890..0bf336947 100644
--- a/panels/keyboard/cc-keyboard-shortcut-row.c
+++ b/panels/keyboard/cc-keyboard-shortcut-row.c
@@ -28,6 +28,7 @@ struct _CcKeyboardShortcutRow
GtkLabel *accelerator_label;
GtkButton *reset_button;
+ GtkRevealer *reset_revealer;
CcKeyboardItem *item;
CcKeyboardManager *manager;
@@ -51,6 +52,7 @@ cc_keyboard_shortcut_row_class_init (CcKeyboardShortcutRowClass *klass)
gtk_widget_class_bind_template_child (widget_class, CcKeyboardShortcutRow, accelerator_label);
gtk_widget_class_bind_template_child (widget_class, CcKeyboardShortcutRow, reset_button);
+ gtk_widget_class_bind_template_child (widget_class, CcKeyboardShortcutRow, reset_revealer);
gtk_widget_class_bind_template_callback (widget_class, reset_shortcut_cb);
}
@@ -64,7 +66,7 @@ cc_keyboard_shortcut_row_init (CcKeyboardShortcutRow *self)
static void
shortcut_modified_changed_cb (CcKeyboardShortcutRow *self)
{
- gtk_widget_set_child_visible (GTK_WIDGET (self->reset_button),
+ gtk_revealer_set_reveal_child (self->reset_revealer,
!cc_keyboard_item_is_value_default (self->item));
}
@@ -123,7 +125,7 @@ cc_keyboard_shortcut_row_new (CcKeyboardItem *item,
transform_binding_to_accel,
NULL, NULL, NULL);
- gtk_widget_set_child_visible (GTK_WIDGET (self->reset_button),
+ gtk_revealer_set_reveal_child (self->reset_revealer,
!cc_keyboard_item_is_value_default (item));
g_signal_connect_object (item,
"notify::key-combos",
diff --git a/panels/keyboard/cc-keyboard-shortcut-row.ui b/panels/keyboard/cc-keyboard-shortcut-row.ui
index 7a79db6d7..f2b1d0398 100644
--- a/panels/keyboard/cc-keyboard-shortcut-row.ui
+++ b/panels/keyboard/cc-keyboard-shortcut-row.ui
@@ -8,7 +8,7 @@
<child>
<object class="GtkLabel" id="accelerator_label">
<property name="visible">True</property>
- <property name="xalign">0.0</property>
+ <property name="xalign">1.0</property>
<property name="use-markup">True</property>
<style>
<class name="dim-label" />
@@ -16,22 +16,28 @@
</object>
</child>
<child>
- <object class="GtkButton" id="reset_button">
+ <object class="GtkRevealer" id = "reset_revealer">
<property name="visible">True</property>
- <property name="valign">center</property>
- <property name="relief">none</property>
- <property name="tooltip-text" translatable="yes">Reset the shortcut to its default value</property>
- <signal name="clicked" handler="reset_shortcut_cb" swapped="true"/>
+ <property name="transition-type">slide-right</property>
<child>
- <object class="GtkImage">
+ <object class="GtkButton" id="reset_button">
<property name="visible">True</property>
- <property name="icon-name">edit-clear-symbolic</property>
- <property name="icon-size">1</property>
- <style>
- <class name="flat" />
- <class name="circular" />
- <class name="reset-shortcut-button" />
- </style>
+ <property name="valign">center</property>
+ <property name="relief">none</property>
+ <property name="tooltip-text" translatable="yes">Reset the shortcut to its default
value</property>
+ <signal name="clicked" handler="reset_shortcut_cb" swapped="true"/>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="icon-name">edit-clear-symbolic</property>
+ <property name="icon-size">1</property>
+ <style>
+ <class name="flat" />
+ <class name="circular" />
+ <class name="reset-shortcut-button" />
+ </style>
+ </object>
+ </child>
</object>
</child>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]