[evolution] ECompEditor: Add signals for core virtual methods



commit 5226cea777ff3b4553b467d866831a2dfd4ce05f
Author: Milan Crha <mcrha redhat com>
Date:   Thu Jul 14 18:17:40 2022 +0200

    ECompEditor: Add signals for core virtual methods
    
    These are meant to be used by extensions, which can listen to the signals
    and modify widgets/component accordingly, without a need to subclass
    the ECompEditor.

 src/calendar/gui/e-comp-editor.c | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
---
diff --git a/src/calendar/gui/e-comp-editor.c b/src/calendar/gui/e-comp-editor.c
index aefa7d14ac..883e4f24d0 100644
--- a/src/calendar/gui/e-comp-editor.c
+++ b/src/calendar/gui/e-comp-editor.c
@@ -95,6 +95,9 @@ enum {
        TIMES_CHANGED,
        OBJECT_CREATED,
        EDITOR_CLOSED,
+       SANITIZE_WIDGETS,
+       FILL_WIDGETS,
+       FILL_COMPONENT,
        LAST_SIGNAL
 };
 
@@ -2670,6 +2673,34 @@ e_comp_editor_class_init (ECompEditorClass *klass)
                NULL, NULL,
                g_cclosure_marshal_VOID__BOOLEAN,
                G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
+
+       signals[SANITIZE_WIDGETS] = g_signal_new (
+               "sanitize-widgets",
+               G_TYPE_FROM_CLASS (klass),
+               G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+               0,
+               NULL, NULL,
+               g_cclosure_marshal_VOID__BOOLEAN,
+               G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
+
+       signals[FILL_WIDGETS] = g_signal_new (
+               "fill-widgets",
+               G_TYPE_FROM_CLASS (klass),
+               G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+               0,
+               NULL, NULL,
+               g_cclosure_marshal_VOID__OBJECT,
+               G_TYPE_NONE, 1,
+               I_CAL_TYPE_COMPONENT);
+
+       signals[FILL_COMPONENT] = g_signal_new (
+               "fill-component",
+               G_TYPE_FROM_CLASS (klass),
+               G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+               0,
+               NULL, NULL, NULL,
+               G_TYPE_BOOLEAN, 1,
+               I_CAL_TYPE_COMPONENT);
 }
 
 void
@@ -2714,6 +2745,8 @@ e_comp_editor_sensitize_widgets (ECompEditor *comp_editor)
 
        comp_editor_class->sensitize_widgets (comp_editor, force_insensitive);
 
+       g_signal_emit (comp_editor, signals[SANITIZE_WIDGETS], 0, force_insensitive, NULL);
+
        if (force_insensitive)
                comp_editor->priv->restore_focus = current_focus;
        else
@@ -2737,6 +2770,8 @@ e_comp_editor_fill_widgets (ECompEditor *comp_editor,
 
        comp_editor_class->fill_widgets (comp_editor, component);
 
+       g_signal_emit (comp_editor, signals[FILL_WIDGETS], 0, component, NULL);
+
        e_comp_editor_set_updating (comp_editor, FALSE);
 }
 
@@ -2776,6 +2811,9 @@ e_comp_editor_fill_component (ECompEditor *comp_editor,
 
        is_valid = comp_editor_class->fill_component (comp_editor, component);
 
+       if (is_valid)
+               g_signal_emit (comp_editor, signals[FILL_COMPONENT], 0, component, &is_valid);
+
        if (focused_widget) {
                if (GTK_IS_ENTRY (focused_widget))
                        gtk_entry_grab_focus_without_selecting (GTK_ENTRY (focused_widget));


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