[evolution/webkit-composer: 164/185] EEditor: Make the web view uneditable while busy.



commit c01be749e2bd95b264773b4fde67e4ccc8b3be25
Author: Matthew Barnes <mbarnes redhat com>
Date:   Thu Feb 7 17:10:16 2013 -0500

    EEditor: Make the web view uneditable while busy.

 e-util/e-editor-private.h |  4 ++++
 e-util/e-editor.c         | 15 +++++++++++++++
 2 files changed, 19 insertions(+)
---
diff --git a/e-util/e-editor-private.h b/e-util/e-editor-private.h
index 575c347..981f1d0 100644
--- a/e-util/e-editor-private.h
+++ b/e-util/e-editor-private.h
@@ -96,6 +96,10 @@ struct _EEditorPrivate {
        gint editor_layout_row;
 
        gboolean busy;
+
+       /* The web view is uneditable while the editor is busy.
+        * This is used to restore the previous editable state. */
+       gboolean saved_editable;
 };
 
 void           editor_actions_init             (EEditor *editor);
diff --git a/e-util/e-editor.c b/e-util/e-editor.c
index a19b794..f926674 100644
--- a/e-util/e-editor.c
+++ b/e-util/e-editor.c
@@ -554,6 +554,9 @@ editor_notify_activity_cb (EActivityBar *activity_bar,
                            GParamSpec *pspec,
                            EEditor *editor)
 {
+       EEditorWidget *editor_widget;
+       WebKitWebView *web_view;
+       gboolean editable;
        gboolean busy;
 
        busy = (e_activity_bar_get_activity (activity_bar) != NULL);
@@ -563,6 +566,18 @@ editor_notify_activity_cb (EActivityBar *activity_bar,
 
        editor->priv->busy = busy;
 
+       editor_widget = e_editor_get_editor_widget (editor);
+       web_view = WEBKIT_WEB_VIEW (editor_widget);
+
+       if (busy) {
+               editable = webkit_web_view_get_editable (web_view);
+               webkit_web_view_set_editable (web_view, FALSE);
+               editor->priv->saved_editable = editable;
+       } else {
+               editable = editor->priv->saved_editable;
+               webkit_web_view_set_editable (web_view, editable);
+       }
+
        g_object_notify (G_OBJECT (editor), "busy");
 }
 


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