From 2be799d78d979e47ce43941730a72fe00fffc993 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Fri, 6 Dec 2019 16:33:43 -0300 Subject: [PATCH] edit-dialog: Make the new alarm row have a label With the introduction of the new event editor, Calendar saw it receive sections of editable properties of the events. One of these sections is the "Reminders" section, that contains the reminders (also called alarms) of an event. However, this section's row to add a new alarm does not match the proposed mockups for it. It currently has a combo box that shows the popover with selectable reminder times, instead of being a clickable row. Make it a clickable listbox row, and show the alarms popover when clicked. https://gitlab.gnome.org/GNOME/gnome-calendar/issues/502 --- src/gui/gcal-edit-dialog.c | 12 +++++++++++ src/gui/gcal-edit-dialog.ui | 40 +++++++++---------------------------- 2 files changed, 21 insertions(+), 31 deletions(-) diff --git a/src/gui/gcal-edit-dialog.c b/src/gui/gcal-edit-dialog.c index 3c5e032d..993f868b 100644 --- a/src/gui/gcal-edit-dialog.c +++ b/src/gui/gcal-edit-dialog.c @@ -83,6 +83,7 @@ struct _GcalEditDialog GtkWidget *notes_text; GtkWidget *alarms_listbox; + GtkPopover *alarms_popover; GtkListBoxRow *new_alarm_row; GtkWidget *repeat_combo; @@ -1123,6 +1124,15 @@ on_add_alarm_button_clicked_cb (GtkWidget *button, gtk_widget_set_sensitive (button, FALSE); } +static void +on_alarms_listbox_row_activated_cb (GtkListBox *alarms_listbox, + GtkListBoxRow *row, + GcalEditDialog *self) +{ + if (row == self->new_alarm_row) + gtk_popover_popup (self->alarms_popover); +} + /* * Gobject overrides @@ -1302,6 +1312,7 @@ gcal_edit_dialog_class_init (GcalEditDialogClass *klass) gtk_widget_class_bind_template_child (widget_class, GcalEditDialog, two_days_button); gtk_widget_class_bind_template_child (widget_class, GcalEditDialog, three_days_button); gtk_widget_class_bind_template_child (widget_class, GcalEditDialog, one_week_button); + gtk_widget_class_bind_template_child (widget_class, GcalEditDialog, alarms_popover); gtk_widget_class_bind_template_child (widget_class, GcalEditDialog, new_alarm_row); /* Buttons */ gtk_widget_class_bind_template_child (widget_class, GcalEditDialog, done_button); @@ -1339,6 +1350,7 @@ gcal_edit_dialog_class_init (GcalEditDialogClass *klass) gtk_widget_class_bind_template_callback (widget_class, sync_datetimes); gtk_widget_class_bind_template_callback (widget_class, on_action_button_clicked_cb); gtk_widget_class_bind_template_callback (widget_class, on_add_alarm_button_clicked_cb); + gtk_widget_class_bind_template_callback (widget_class, on_alarms_listbox_row_activated_cb); gtk_widget_class_bind_template_callback (widget_class, on_all_day_switch_active_changed_cb); gtk_widget_class_bind_template_callback (widget_class, on_repeat_duration_changed_cb); gtk_widget_class_bind_template_callback (widget_class, on_repeat_type_changed_cb); diff --git a/src/gui/gcal-edit-dialog.ui b/src/gui/gcal-edit-dialog.ui index 17e32600..a36d8ae6 100644 --- a/src/gui/gcal-edit-dialog.ui +++ b/src/gui/gcal-edit-dialog.ui @@ -457,44 +457,21 @@ True False none + - + True - Reminder - alarms_button + - - + + True True - center - alarms_popover - - - - True - False - horizontal - - - True - False - True - 0.0 - Add reminder… - - - - - True - False - pan-down-symbolic - - - - + True + 12 + Add a Reminder… @@ -581,6 +558,7 @@ False 175 + new_alarm_row True