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



commit 819dd628f6745209dad1f2ffef88d47d5324e18d
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(+), 0 deletions(-)
---
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]