[evolution] I#1981 - ECompEditor: Cannot save changes



commit c928c5c0b50fc32cc6f6f4e38c32efa2ed1ecd1a
Author: Milan Crha <mcrha redhat com>
Date:   Wed Aug 3 08:10:20 2022 +0200

    I#1981 - ECompEditor: Cannot save changes
    
    Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/1981

 src/calendar/gui/e-comp-editor.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/src/calendar/gui/e-comp-editor.c b/src/calendar/gui/e-comp-editor.c
index 8fc040b6f2..b4ed425059 100644
--- a/src/calendar/gui/e-comp-editor.c
+++ b/src/calendar/gui/e-comp-editor.c
@@ -1737,6 +1737,20 @@ ece_fill_component (ECompEditor *comp_editor,
        return TRUE;
 }
 
+static gboolean
+comp_editor_signal_accumulator_false_returned (GSignalInvocationHint *ihint,
+                                              GValue *return_accu,
+                                              const GValue *handler_return,
+                                              gpointer dummy)
+{
+       gboolean returned;
+
+       returned = g_value_get_boolean (handler_return);
+       g_value_set_boolean (return_accu, returned);
+
+       return returned;
+}
+
 static void
 comp_editor_realize_cb (ECompEditor *comp_editor)
 {
@@ -2763,7 +2777,8 @@ e_comp_editor_class_init (ECompEditorClass *klass)
                G_TYPE_FROM_CLASS (klass),
                G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
                0,
-               NULL, NULL, NULL,
+               comp_editor_signal_accumulator_false_returned, NULL,
+               NULL,
                G_TYPE_BOOLEAN, 1,
                I_CAL_TYPE_COMPONENT);
 }
@@ -2876,7 +2891,8 @@ e_comp_editor_fill_component (ECompEditor *comp_editor,
 
        is_valid = comp_editor_class->fill_component (comp_editor, component);
 
-       if (is_valid)
+       /* Need to check whether there's any signal handler, otherwise glib sets the 'is_valid' to FALSE */
+       if (is_valid && g_signal_has_handler_pending (comp_editor, signals[FILL_COMPONENT], 0, FALSE))
                g_signal_emit (comp_editor, signals[FILL_COMPONENT], 0, component, &is_valid);
 
        if (focused_widget) {


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