[evolution/gnome-3-24] Bug 785127 - Change in composer body doesn't trigger autosave timeout



commit 9ad42a8528a26b91c0833272103b6d2a09f34c09
Author: Milan Crha <mcrha redhat com>
Date:   Thu Jul 20 10:58:47 2017 +0200

    Bug 785127 - Change in composer body doesn't trigger autosave timeout

 src/e-util/e-content-editor.c                      |   28 ++++++++++++++++++++
 src/e-util/e-content-editor.h                      |    2 +
 .../composer-autosave/e-composer-autosave.c        |    4 +++
 src/modules/webkit-editor/e-webkit-editor.c        |    3 ++
 4 files changed, 37 insertions(+), 0 deletions(-)
---
diff --git a/src/e-util/e-content-editor.c b/src/e-util/e-content-editor.c
index d70492d..8004a97 100644
--- a/src/e-util/e-content-editor.c
+++ b/src/e-util/e-content-editor.c
@@ -35,6 +35,7 @@ enum {
        FIND_DONE,
        REPLACE_ALL_DONE,
        DROP_HANDLED,
+       CONTENT_CHANGED,
        LAST_SIGNAL
 };
 
@@ -522,6 +523,25 @@ e_content_editor_default_init (EContentEditorInterface *iface)
                NULL, NULL,
                NULL,
                G_TYPE_NONE, 0);
+
+       /**
+        * EContentEditor:content-changed
+        *
+        * Emitted when the content of the editor changes. It can be used in connection
+        * to the #EContentEditor::changed property, except this signal is emitted
+        * whenever the inner content changes, which the 'changed' property notifies
+        * about its change only when the value truly changes.
+        *
+        * Since: 3.24.5
+        */
+       signals[CONTENT_CHANGED] = g_signal_new (
+               "content-changed",
+               E_TYPE_CONTENT_EDITOR,
+               G_SIGNAL_RUN_LAST,
+               0 /*G_STRUCT_OFFSET (EContentEditorInterface, content_changed)*/,
+               NULL, NULL,
+               NULL,
+               G_TYPE_NONE, 0);
 }
 
 ESpellChecker *
@@ -3602,3 +3622,11 @@ e_content_editor_emit_drop_handled (EContentEditor *editor)
 
        g_signal_emit (editor, signals[DROP_HANDLED], 0);
 }
+
+void
+e_content_editor_emit_content_changed (EContentEditor *editor)
+{
+       g_return_if_fail (E_IS_CONTENT_EDITOR (editor));
+
+       g_signal_emit (editor, signals[CONTENT_CHANGED], 0);
+}
diff --git a/src/e-util/e-content-editor.h b/src/e-util/e-content-editor.h
index 8db2a6f..ec99ea3 100644
--- a/src/e-util/e-content-editor.h
+++ b/src/e-util/e-content-editor.h
@@ -1018,6 +1018,8 @@ void              e_content_editor_emit_replace_all_done
                                                 guint replaced_count);
 void           e_content_editor_emit_drop_handled
                                                (EContentEditor *editor);
+void           e_content_editor_emit_content_changed
+                                               (EContentEditor *editor);
 
 G_END_DECLS
 
diff --git a/src/modules/composer-autosave/e-composer-autosave.c 
b/src/modules/composer-autosave/e-composer-autosave.c
index efab816..0e5705f 100644
--- a/src/modules/composer-autosave/e-composer-autosave.c
+++ b/src/modules/composer-autosave/e-composer-autosave.c
@@ -173,6 +173,10 @@ composer_autosave_constructed (GObject *object)
        g_signal_connect_swapped (
                cnt_editor, "notify::changed",
                G_CALLBACK (composer_autosave_changed_cb), object);
+
+       g_signal_connect_swapped (
+               cnt_editor, "content-changed",
+               G_CALLBACK (composer_autosave_changed_cb), object);
 }
 
 static void
diff --git a/src/modules/webkit-editor/e-webkit-editor.c b/src/modules/webkit-editor/e-webkit-editor.c
index 8a6c35c..876b4f2 100644
--- a/src/modules/webkit-editor/e-webkit-editor.c
+++ b/src/modules/webkit-editor/e-webkit-editor.c
@@ -257,6 +257,9 @@ webkit_editor_set_changed (EWebKitEditor *wk_editor,
 {
        g_return_if_fail (E_IS_WEBKIT_EDITOR (wk_editor));
 
+       if (changed)
+               e_content_editor_emit_content_changed (E_CONTENT_EDITOR (wk_editor));
+
        if (wk_editor->priv->changed == changed)
                return;
 


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