I#2449 - Calendar: Remember "Send my reminders with this event" value

Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/2449
This commit is contained in:
Milan Crha
2024-06-21 12:46:41 +02:00
parent fc2af6c295
commit ecb5a91ff0
2 changed files with 27 additions and 6 deletions

View File

@ -529,6 +529,11 @@
<_summary>Allow drag and drop of events in the Calendar.</_summary>
<_description>This influences the Day view, the Work Week view, the Week view and the Month view.</_description>
</key>
<key name="send-reminder-with-event" type="b">
<default>false</default>
<_summary>Value to preselect when sending an event with attendees with reminders set.</_summary>
<_description>This remembers the last value of "Send my reminders with this event" option and uses it the next time.</_description>
</key>
<!-- The following keys are deprecated. -->

View File

@ -1364,6 +1364,7 @@ e_cal_dialogs_send_component (GtkWindow *parent,
gboolean *only_new_attendees)
{
ECalComponentVType vtype;
GSettings *settings = NULL;
const gchar *id;
GtkWidget *dialog, *sa_checkbox = NULL, *ona_checkbox = NULL;
GtkWidget *content_area;
@ -1424,19 +1425,26 @@ e_cal_dialogs_send_component (GtkWindow *parent,
dialog = e_alert_dialog_new_for_args (parent, id, NULL);
content_area = e_alert_dialog_get_content_area (E_ALERT_DIALOG (dialog));
if (strip_alarms)
if (strip_alarms) {
sa_checkbox = add_checkbox (GTK_BOX (content_area), _("Send my reminders with this event"));
settings = e_util_ref_settings ("org.gnome.evolution.calendar");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sa_checkbox), g_settings_get_boolean (settings, "send-reminder-with-event"));
}
if (only_new_attendees)
ona_checkbox = add_checkbox (GTK_BOX (content_area), _("Notify new attendees _only"));
res = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES;
if (res && strip_alarms)
*strip_alarms = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (sa_checkbox));
if (res && strip_alarms) {
gboolean send_alarms = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (sa_checkbox));
g_settings_set_boolean (settings, "send-reminder-with-event", send_alarms);
*strip_alarms = !send_alarms;
}
if (only_new_attendees)
*only_new_attendees = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ona_checkbox));
gtk_widget_destroy (GTK_WIDGET (dialog));
g_clear_object (&settings);
return res;
}
@ -1459,6 +1467,7 @@ e_cal_dialogs_send_dragged_or_resized_component (GtkWindow *parent,
gboolean *only_new_attendees)
{
ECalComponentVType vtype;
GSettings *settings = NULL;
const gchar *id;
GtkWidget *dialog, *sa_checkbox = NULL, *ona_checkbox = NULL;
GtkWidget *content_area;
@ -1506,8 +1515,11 @@ e_cal_dialogs_send_dragged_or_resized_component (GtkWindow *parent,
dialog = e_alert_dialog_new_for_args (parent, id, NULL);
content_area = e_alert_dialog_get_content_area (E_ALERT_DIALOG (dialog));
if (strip_alarms)
if (strip_alarms) {
sa_checkbox = add_checkbox (GTK_BOX (content_area), _("Send my reminders with this event"));
settings = e_util_ref_settings ("org.gnome.evolution.calendar");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sa_checkbox), g_settings_get_boolean (settings, "send-reminder-with-event"));
}
if (only_new_attendees)
ona_checkbox = add_checkbox (GTK_BOX (content_area), _("Notify new attendees _only"));
@ -1520,12 +1532,16 @@ e_cal_dialogs_send_dragged_or_resized_component (GtkWindow *parent,
if (res == GTK_RESPONSE_DELETE_EVENT)
res = GTK_RESPONSE_CANCEL;
if (res == GTK_RESPONSE_YES && strip_alarms)
*strip_alarms = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (sa_checkbox));
if (res == GTK_RESPONSE_YES && strip_alarms) {
gboolean send_alarms = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (sa_checkbox));
g_settings_set_boolean (settings, "send-reminder-with-event", send_alarms);
*strip_alarms = !send_alarms;
}
if (only_new_attendees)
*only_new_attendees = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ona_checkbox));
gtk_widget_destroy (GTK_WIDGET (dialog));
g_clear_object (&settings);
return res;
}