[gnome-calendar/gbsneto/event-editor: 15/16] edit-dialog: Split recurrency widgets in different rows
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/gbsneto/event-editor: 15/16] edit-dialog: Split recurrency widgets in different rows
- Date: Mon, 25 Nov 2019 14:37:29 +0000 (UTC)
commit 4657615e7f4465113a00b620b6b9c6c8d983377f
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Thu Nov 14 16:01:34 2019 -0300
edit-dialog: Split recurrency widgets in different rows
src/gui/gcal-edit-dialog.c | 43 +++-----------
src/gui/gcal-edit-dialog.ui | 134 +++++++++++++++++++++++---------------------
2 files changed, 78 insertions(+), 99 deletions(-)
---
diff --git a/src/gui/gcal-edit-dialog.c b/src/gui/gcal-edit-dialog.c
index 348e1504..7dd242d1 100644
--- a/src/gui/gcal-edit-dialog.c
+++ b/src/gui/gcal-edit-dialog.c
@@ -85,11 +85,9 @@ struct _GcalEditDialog
GtkWidget *repeat_combo;
GtkWidget *repeat_duration_combo;
- GtkWidget *repeat_limits_box;
/* Recurrence widgets */
GtkWidget *number_of_occurrences_spin;
- GtkWidget *repeat_duration_stack;
GtkWidget *until_date_selector;
/* Add Alarms popover buttons */
@@ -1005,25 +1003,10 @@ static void
on_repeat_duration_changed_cb (GtkComboBox *widget,
GcalEditDialog *self)
{
- switch (gtk_combo_box_get_active (widget))
- {
- case 0:
- gtk_widget_hide (self->repeat_duration_stack);
- break;
-
- case 1:
- gtk_widget_show (self->repeat_duration_stack);
- gtk_stack_set_visible_child (GTK_STACK (self->repeat_duration_stack),
self->number_of_occurrences_spin);
- break;
-
- case 2:
- gtk_widget_show (self->repeat_duration_stack);
- gtk_stack_set_visible_child (GTK_STACK (self->repeat_duration_stack), self->until_date_selector);
- break;
-
- default:
- break;
- }
+ gint active = gtk_combo_box_get_active (widget);
+
+ gtk_widget_set_visible (self->number_of_occurrences_spin, active == 1);
+ gtk_widget_set_visible (self->until_date_selector, active == 2);
}
static void
@@ -1031,19 +1014,11 @@ on_repeat_type_changed_cb (GtkComboBox *combobox,
GcalEditDialog *self)
{
GcalRecurrenceFrequency frequency;
- gboolean has_recurrence;
frequency = gtk_combo_box_get_active (combobox);
- has_recurrence = frequency != GCAL_RECURRENCE_NO_REPEAT;
-
- gtk_widget_set_visible (self->repeat_limits_box, has_recurrence);
- if (has_recurrence)
- {
- gtk_combo_box_set_active (GTK_COMBO_BOX (self->repeat_duration_combo), GCAL_RECURRENCE_FOREVER);
- gtk_widget_show (self->repeat_duration_combo);
- gtk_widget_hide (self->repeat_duration_stack);
- }
+ gtk_combo_box_set_active (GTK_COMBO_BOX (self->repeat_duration_combo), GCAL_RECURRENCE_FOREVER);
+ gtk_widget_set_visible (self->repeat_duration_combo, frequency != GCAL_RECURRENCE_NO_REPEAT);
}
static void
@@ -1422,8 +1397,6 @@ gcal_edit_dialog_class_init (GcalEditDialogClass *klass)
gtk_widget_class_bind_template_child (widget_class, GcalEditDialog, number_of_occurrences_spin);
gtk_widget_class_bind_template_child (widget_class, GcalEditDialog, repeat_combo);
gtk_widget_class_bind_template_child (widget_class, GcalEditDialog, repeat_duration_combo);
- gtk_widget_class_bind_template_child (widget_class, GcalEditDialog, repeat_duration_stack);
- gtk_widget_class_bind_template_child (widget_class, GcalEditDialog, repeat_limits_box);
gtk_widget_class_bind_template_child (widget_class, GcalEditDialog, scrolled_window);
gtk_widget_class_bind_template_child (widget_class, GcalEditDialog, source_image);
gtk_widget_class_bind_template_child (widget_class, GcalEditDialog, sources_popover);
@@ -1552,11 +1525,11 @@ gcal_edit_dialog_set_event (GcalEditDialog *self,
if (frequency == GCAL_RECURRENCE_NO_REPEAT)
{
- gtk_widget_hide (self->repeat_limits_box);
+ gtk_widget_hide (self->repeat_duration_combo);
}
else
{
- gtk_widget_show (self->repeat_limits_box);
+ gtk_widget_show (self->repeat_duration_combo);
gtk_widget_show (self->repeat_duration_combo);
}
diff --git a/src/gui/gcal-edit-dialog.ui b/src/gui/gcal-edit-dialog.ui
index d952acde..11172adf 100644
--- a/src/gui/gcal-edit-dialog.ui
+++ b/src/gui/gcal-edit-dialog.ui
@@ -344,81 +344,87 @@
<property name="activatable-widget">repeat_combo</property>
<child type="action">
- <object class="GtkBox">
+ <object class="GtkComboBoxText" id="repeat_combo">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkComboBoxText" id="repeat_combo">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <signal name="changed" handler="on_repeat_type_changed_cb"
object="GcalEditDialog" swapped="no"/>
- <property name="sensitive" bind-source="GcalEditDialog"
bind-property="writable" bind-flags="default" />
- <items>
- <item translatable="yes" id="no_repeat">No Repeat</item>
- <item translatable="yes" id="daily">Daily</item>
- <item translatable="yes" id="mon_fri">Monday – Friday</item>
- <item translatable="yes" id="weekly">Weekly</item>
- <item translatable="yes" id="monthly">Monthly</item>
- <item translatable="yes" id="yearly">Yearly</item>
- </items>
- <property name="active_id">no_repeat</property>
- </object>
- </child>
- <child>
- <object class="GtkBox" id="repeat_limits_box">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">6</property>
- <property name="hexpand">True</property>
- <property name="orientation">horizontal</property>
- <property name="sensitive" bind-source="GcalEditDialog"
bind-property="writable" bind-flags="default" />
- <child>
- <object class="GtkComboBoxText" id="repeat_duration_combo">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <signal name="changed" handler="on_repeat_duration_changed_cb"
object="GcalEditDialog" swapped="no"/>
- <items>
- <item translatable="yes" id="forever">Forever</item>
- <item translatable="yes" id="number_of_occurrences_spin">No. of
occurrences</item>
- <item translatable="yes" id="until_date">Until Date</item>
- </items>
- <property name="active_id">forever</property>
- </object>
- </child>
- <child>
- <object class="GtkStack" id="repeat_duration_stack">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">end</property>
+ <signal name="changed" handler="on_repeat_type_changed_cb"
object="GcalEditDialog" swapped="no"/>
+ <property name="sensitive" bind-source="GcalEditDialog" bind-property="writable"
bind-flags="default" />
+ <items>
+ <item translatable="yes" id="no_repeat">No Repeat</item>
+ <item translatable="yes" id="daily">Daily</item>
+ <item translatable="yes" id="mon_fri">Monday – Friday</item>
+ <item translatable="yes" id="weekly">Weekly</item>
+ <item translatable="yes" id="monthly">Monthly</item>
+ <item translatable="yes" id="yearly">Yearly</item>
+ </items>
+ <property name="active_id">no_repeat</property>
+ </object>
+ </child>
- <child>
- <object class = "GtkSpinButton" id="number_of_occurrences_spin">
- <property name="visible">True</property>
- <property name="input_purpose">number</property>
- <property name="input-hints">no-emoji</property>
- </object>
- </child>
+ </object>
+ </child>
- <child>
- <object class = "GcalDateSelector" id="until_date_selector">
- <property name="visible">True</property>
- </object>
- </child>
- </object>
- </child>
- </object>
- </child>
+ <!-- End Repeat -->
+ <child>
+ <object class="HdyActionRow">
+ <property name="visible" bind-source="repeat_duration_combo" bind-property="visible"
bind-flags="default" />
+ <property name="title" translatable="yes">End Repeat</property>
+ <property name="activatable-widget">repeat_combo</property>
+
+ <child type="action">
+ <object class="GtkComboBoxText" id="repeat_duration_combo">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="valign">center</property>
+ <signal name="changed" handler="on_repeat_duration_changed_cb"
object="GcalEditDialog" swapped="no"/>
+ <items>
+ <item translatable="yes" id="forever">Forever</item>
+ <item translatable="yes" id="number_of_occurrences_spin">No. of
occurrences</item>
+ <item translatable="yes" id="until_date">Until Date</item>
+ </items>
+ <property name="active_id">forever</property>
+ </object>
+ </child>
+
+ </object>
+ </child>
+
+ <!-- Number of Occurrences -->
+ <child>
+ <object class="HdyActionRow">
+ <property name="visible" bind-source="number_of_occurrences_spin"
bind-property="visible" bind-flags="default" />
+ <property name="title" translatable="yes">Number of Occurrences</property>
+ <property name="activatable-widget">number_of_occurrences_spin</property>
+
+ <child type="action">
+ <object class = "GtkSpinButton" id="number_of_occurrences_spin">
+ <property name="input_purpose">number</property>
+ <property name="input-hints">no-emoji</property>
+ <property name="valign">center</property>
</object>
</child>
</object>
</child>
+ <!-- End Repeat Date -->
+ <child>
+ <object class="HdyActionRow">
+ <property name="visible" bind-source="until_date_selector" bind-property="visible"
bind-flags="default" />
+ <property name="title" translatable="yes">End Repeat Date</property>
+ <property name="activatable-widget">until_date_selector</property>
+
+ <child type="action">
+ <object class = "GcalDateSelector" id="until_date_selector">
+ <property name="valign">center</property>
+ </object>
+ </child>
+
+ </object>
+ </child>
+
+
</object>
</child>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]