summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYosef Or Boczko <yoseforb@gmail.com>2022-03-15 21:46:36 +0200
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2022-05-06 14:17:00 +0000
commit4f5e7287c8853ea6e93eb3aeed7686d54e4491ff (patch)
treed10051e8c0de9609f028fed7d41938d390480592
parentd65511d43d643992eeea64faba985fa9cd15d57c (diff)
downloadgnome-calendar-4f5e7287c8853ea6e93eb3aeed7686d54e4491ff.tar.gz
time-selector: Put the spinbuttons in a box and force it to be LTR
#558 Signed-off-by: Yosef Or Boczko <yoseforb@gmail.com> (cherry picked from commit 301beb25348458faa5e25fa6963559987aeb1f1e)
-rw-r--r--src/gui/event-editor/gcal-time-selector.c5
-rw-r--r--src/gui/event-editor/gcal-time-selector.ui47
2 files changed, 31 insertions, 21 deletions
diff --git a/src/gui/event-editor/gcal-time-selector.c b/src/gui/event-editor/gcal-time-selector.c
index f0c2b8ae..3a2e9cd5 100644
--- a/src/gui/event-editor/gcal-time-selector.c
+++ b/src/gui/event-editor/gcal-time-selector.c
@@ -30,6 +30,7 @@ struct _GcalTimeSelector
GtkAdjustment *hour_adjustment;
GtkAdjustment *minute_adjustment;
+ GtkWidget *time_box;
GtkWidget *hour_spin;
GtkWidget *minute_spin;
GtkWidget *period_combo;
@@ -210,6 +211,7 @@ gcal_time_selector_class_init (GcalTimeSelectorClass *klass)
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/calendar/ui/event-editor/gcal-time-selector.ui");
+ gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (klass), GcalTimeSelector, time_box);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (klass), GcalTimeSelector, hour_adjustment);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (klass), GcalTimeSelector, hour_spin);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (klass), GcalTimeSelector, minute_adjustment);
@@ -226,6 +228,9 @@ gcal_time_selector_init (GcalTimeSelector *self)
self->time = g_date_time_new_now_local ();
gtk_widget_init_template (GTK_WIDGET (self));
+
+ if (gtk_widget_get_direction (GTK_WIDGET (self)) == GTK_TEXT_DIR_RTL)
+ gtk_widget_set_direction (self->time_box, GTK_TEXT_DIR_LTR);
}
/* Public API */
diff --git a/src/gui/event-editor/gcal-time-selector.ui b/src/gui/event-editor/gcal-time-selector.ui
index 51b1d877..d3a32c29 100644
--- a/src/gui/event-editor/gcal-time-selector.ui
+++ b/src/gui/event-editor/gcal-time-selector.ui
@@ -3,33 +3,38 @@
<template class="GcalTimeSelector" parent="GtkBox">
<property name="spacing">6</property>
- <!-- Hour -->
<child>
- <object class="GtkSpinButton" id="hour_spin">
- <property name="xalign">0.5</property>
- <property name="orientation">vertical</property>
- <property name="adjustment">hour_adjustment</property>
- <signal name="output" handler="on_output" object="GcalTimeSelector" swapped="no"/>
- </object>
- </child>
+ <object class="GtkBox" id="time_box">
+ <property name="spacing">6</property>
- <child>
- <object class="GtkLabel" id="label1">
- <property name="label" translatable="yes">:</property>
- </object>
- </child>
+ <!-- Hour -->
+ <child>
+ <object class="GtkSpinButton" id="hour_spin">
+ <property name="xalign">0.5</property>
+ <property name="orientation">vertical</property>
+ <property name="adjustment">hour_adjustment</property>
+ <signal name="output" handler="on_output" object="GcalTimeSelector" swapped="no"/>
+ </object>
+ </child>
- <!-- Minute -->
- <child>
- <object class="GtkSpinButton" id="minute_spin">
- <property name="xalign">0.5</property>
- <property name="orientation">vertical</property>
- <property name="adjustment">minute_adjustment</property>
- <signal name="output" handler="on_output" object="GcalTimeSelector" swapped="no"/>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="label" translatable="yes">:</property>
+ </object>
+ </child>
+
+ <!-- Minute -->
+ <child>
+ <object class="GtkSpinButton" id="minute_spin">
+ <property name="xalign">0.5</property>
+ <property name="orientation">vertical</property>
+ <property name="adjustment">minute_adjustment</property>
+ <signal name="output" handler="on_output" object="GcalTimeSelector" swapped="no"/>
+ </object>
+ </child>
</object>
</child>
-
<!-- AM/PM -->
<child>
<object class="GtkComboBoxText" id="period_combo">