time-selector: Put the spinbuttons in a box and force it to be LTR

#558

Signed-off-by: Yosef Or Boczko <yoseforb@gmail.com>
This commit is contained in:
Yosef Or Boczko
2022-05-06 14:09:45 +00:00
committed by Georges Basile Stavracas Neto
parent 6b389005e0
commit 301beb2534
2 changed files with 33 additions and 23 deletions
@@ -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 */
+28 -23
View File
@@ -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 class="GtkBox" id="time_box">
<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>
<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>
<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>
<!-- AM/PM -->
<child>
<object class="GtkComboBoxText" id="period_combo">