[evolution] I#1072 - EDateEdit: Doesn't signal date change when set to None



commit 2da680b79974eb893b0be52e5b104ff72ac4b7d0
Author: Milan Crha <mcrha redhat com>
Date:   Fri Sep 11 08:53:25 2020 +0200

    I#1072 - EDateEdit: Doesn't signal date change when set to None
    
    Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/1072

 src/e-util/e-dateedit.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/src/e-util/e-dateedit.c b/src/e-util/e-dateedit.c
index 2b933fc2d6..d01b3d7828 100644
--- a/src/e-util/e-dateedit.c
+++ b/src/e-util/e-dateedit.c
@@ -2011,7 +2011,7 @@ on_date_entry_focus_out (GtkEntry *entry,
                          GdkEventFocus *event,
                          EDateEdit *dedit)
 {
-       gboolean did_change;
+       gboolean did_change, success = TRUE;
        struct tm tmp_tm;
 
        tmp_tm.tm_year = 0;
@@ -2024,12 +2024,20 @@ on_date_entry_focus_out (GtkEntry *entry,
                gtk_entry_set_icon_from_icon_name (entry, GTK_ENTRY_ICON_SECONDARY, "dialog-warning");
                gtk_entry_set_icon_tooltip_text (entry, GTK_ENTRY_ICON_SECONDARY, _("Invalid Date Value"));
                gtk_entry_grab_focus_without_selecting (entry);
-               return FALSE;
+               success = FALSE;
        } else if (e_date_edit_get_date (
                dedit, &tmp_tm.tm_year, &tmp_tm.tm_mon, &tmp_tm.tm_mday)) {
 
                e_date_edit_set_date (
                        dedit,tmp_tm.tm_year,tmp_tm.tm_mon,tmp_tm.tm_mday);
+       } else {
+               dedit->priv->date_set_to_none = TRUE;
+               e_date_edit_update_date_entry (dedit);
+       }
+
+       if (success) {
+               gtk_entry_set_icon_from_icon_name (entry, GTK_ENTRY_ICON_SECONDARY, NULL);
+               gtk_entry_set_icon_tooltip_text (entry, GTK_ENTRY_ICON_SECONDARY, NULL);
 
                if (!did_change && dedit->priv->date_been_changed) {
                        /* The previous one didn't emit changed signal,
@@ -2038,14 +2046,8 @@ on_date_entry_focus_out (GtkEntry *entry,
                }
 
                dedit->priv->date_been_changed = FALSE;
-       } else {
-               dedit->priv->date_set_to_none = TRUE;
-               e_date_edit_update_date_entry (dedit);
        }
 
-       gtk_entry_set_icon_from_icon_name (entry, GTK_ENTRY_ICON_SECONDARY, NULL);
-       gtk_entry_set_icon_tooltip_text (entry, GTK_ENTRY_ICON_SECONDARY, NULL);
-
        return FALSE;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]