[libhandy] keypad: Set some default row and column spacing
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libhandy] keypad: Set some default row and column spacing
- Date: Wed, 5 Aug 2020 13:42:43 +0000 (UTC)
commit 6250b29058bd00c4cf661c3d7ebd964dd0aa29b2
Author: Adrien Plazas <kekun plazas laposte net>
Date: Wed Aug 5 13:12:20 2020 +0200
keypad: Set some default row and column spacing
This ensures the keypad will look decent by default.
Fixes https://gitlab.gnome.org/GNOME/libhandy/-/issues/76
examples/hdy-demo-window.ui | 2 --
src/hdy-keypad.c | 6 ++++--
tests/test-keypad.c | 20 ++++++++++----------
3 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/examples/hdy-demo-window.ui b/examples/hdy-demo-window.ui
index 8731cf9a..6f295207 100644
--- a/examples/hdy-demo-window.ui
+++ b/examples/hdy-demo-window.ui
@@ -921,8 +921,6 @@
<object class="HdyKeypad" id="keypad">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="column_spacing">10</property>
- <property name="row_spacing">8</property>
<property name="halign">center</property>
<property name="entry">entry_keypad</property>
<property name="symbols-visible"
bind-source="keypad_symbols_visible" bind-property="state" bind-flags="sync-create | bidirectional"/>
diff --git a/src/hdy-keypad.c b/src/hdy-keypad.c
index a76cdbd5..1714d9a8 100644
--- a/src/hdy-keypad.c
+++ b/src/hdy-keypad.c
@@ -246,7 +246,7 @@ hdy_keypad_class_init (HdyKeypadClass *klass)
g_param_spec_uint ("row-spacing",
_("Row spacing"),
_("The amount of space between two consecutive rows"),
- 0, G_MAXINT16, 0,
+ 0, G_MAXINT16, 6,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
/**
@@ -260,7 +260,7 @@ hdy_keypad_class_init (HdyKeypadClass *klass)
g_param_spec_uint ("column-spacing",
_("Column spacing"),
_("The amount of space between two consecutive columns"),
- 0, G_MAXINT16, 0,
+ 0, G_MAXINT16, 6,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
/**
@@ -360,6 +360,8 @@ hdy_keypad_init (HdyKeypad *self)
{
HdyKeypadPrivate *priv = hdy_keypad_get_instance_private (self);
+ priv->row_spacing = 6;
+ priv->column_spacing = 6;
priv->letters_visible = TRUE;
priv->symbols_visible = TRUE;
diff --git a/tests/test-keypad.c b/tests/test-keypad.c
index 110e3fae..aa936b90 100644
--- a/tests/test-keypad.c
+++ b/tests/test-keypad.c
@@ -29,16 +29,16 @@ test_hdy_keypad_row_spacing (void)
notified = 0;
g_signal_connect (keypad, "notify::row-spacing", G_CALLBACK (notify_cb), NULL);
- g_assert_cmpuint (hdy_keypad_get_row_spacing (keypad), ==, 0);
+ g_assert_cmpuint (hdy_keypad_get_row_spacing (keypad), ==, 6);
g_object_get (keypad, "row-spacing", &row_spacing, NULL);
- g_assert_cmpuint (row_spacing, ==, 0);
+ g_assert_cmpuint (row_spacing, ==, 6);
- hdy_keypad_set_row_spacing (keypad, 6);
+ hdy_keypad_set_row_spacing (keypad, 0);
g_assert_cmpint (notified, ==, 1);
- g_assert_cmpuint (hdy_keypad_get_row_spacing (keypad), ==, 6);
+ g_assert_cmpuint (hdy_keypad_get_row_spacing (keypad), ==, 0);
g_object_get (keypad, "row-spacing", &row_spacing, NULL);
- g_assert_cmpuint (row_spacing, ==, 6);
+ g_assert_cmpuint (row_spacing, ==, 0);
g_object_set (keypad, "row-spacing", 12, NULL);
g_assert_cmpint (notified, ==, 2);
@@ -62,16 +62,16 @@ test_hdy_keypad_column_spacing (void)
notified = 0;
g_signal_connect (keypad, "notify::column-spacing", G_CALLBACK (notify_cb), NULL);
- g_assert_cmpuint (hdy_keypad_get_column_spacing (keypad), ==, 0);
+ g_assert_cmpuint (hdy_keypad_get_column_spacing (keypad), ==, 6);
g_object_get (keypad, "column-spacing", &column_spacing, NULL);
- g_assert_cmpuint (column_spacing, ==, 0);
+ g_assert_cmpuint (column_spacing, ==, 6);
- hdy_keypad_set_column_spacing (keypad, 6);
+ hdy_keypad_set_column_spacing (keypad, 0);
g_assert_cmpint (notified, ==, 1);
- g_assert_cmpuint (hdy_keypad_get_column_spacing (keypad), ==, 6);
+ g_assert_cmpuint (hdy_keypad_get_column_spacing (keypad), ==, 0);
g_object_get (keypad, "column-spacing", &column_spacing, NULL);
- g_assert_cmpuint (column_spacing, ==, 6);
+ g_assert_cmpuint (column_spacing, ==, 0);
g_object_set (keypad, "column-spacing", 12, NULL);
g_assert_cmpint (notified, ==, 2);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]