[evolution] EHTMLEditorActions - Actions from context menu don't work



commit 2e83f78fd05db0e44a0174780dd7bdd906afcd3a
Author: Tomas Popela <tpopela redhat com>
Date:   Mon Mar 2 09:10:03 2015 +0100

    EHTMLEditorActions - Actions from context menu don't work
    
    When the context menu is activated the view itself loses the focus, so
    we can't check if the view is focused before doing the action

 e-util/e-html-editor-actions.c |   17 +++++++----------
 1 files changed, 7 insertions(+), 10 deletions(-)
---
diff --git a/e-util/e-html-editor-actions.c b/e-util/e-html-editor-actions.c
index d29213a..a199eab 100644
--- a/e-util/e-html-editor-actions.c
+++ b/e-util/e-html-editor-actions.c
@@ -428,8 +428,7 @@ action_copy_cb (GtkAction *action,
 {
        EHTMLEditorView *view = e_html_editor_get_view (editor);
 
-       if (gtk_widget_has_focus (GTK_WIDGET (view)))
-               webkit_web_view_copy_clipboard (WEBKIT_WEB_VIEW (view));
+       webkit_web_view_copy_clipboard (WEBKIT_WEB_VIEW (view));
 }
 
 static void
@@ -438,8 +437,10 @@ action_cut_cb (GtkAction *action,
 {
        EHTMLEditorView *view = e_html_editor_get_view (editor);
 
-       if (gtk_widget_has_focus (GTK_WIDGET (view)))
-               webkit_web_view_cut_clipboard (WEBKIT_WEB_VIEW (view));
+       if (!gtk_widget_has_focus (GTK_WIDGET (view)))
+               gtk_widget_grab_focus (GTK_WIDGET (view));
+
+       webkit_web_view_cut_clipboard (WEBKIT_WEB_VIEW (view));
 }
 
 static void
@@ -704,12 +705,8 @@ action_paste_cb (GtkAction *action,
 {
        EHTMLEditorView *view = e_html_editor_get_view (editor);
 
-       /* If WebView doesn't have focus, focus it */
-       if (gtk_widget_has_focus (GTK_WIDGET (view))) {
-               webkit_web_view_paste_clipboard (WEBKIT_WEB_VIEW (view));
-
-               e_html_editor_view_force_spell_check (view);
-       }
+       webkit_web_view_paste_clipboard (WEBKIT_WEB_VIEW (view));
+       e_html_editor_view_force_spell_check (view);
 }
 
 static void


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