[evolution] I#250 - [Composer] Edit->Paste always pastes into the message body



commit 134f0fb0088df836967ab515c73bb056b2810eae
Author: Milan Crha <mcrha redhat com>
Date:   Tue Jan 8 18:04:01 2019 +0100

    I#250 - [Composer] Edit->Paste always pastes into the message body
    
    Closes https://gitlab.gnome.org/GNOME/evolution/issues/250

 src/e-util/e-focus-tracker.c       | 12 ++++++++++
 src/e-util/e-html-editor-actions.c | 49 ++++----------------------------------
 2 files changed, 16 insertions(+), 45 deletions(-)
---
diff --git a/src/e-util/e-focus-tracker.c b/src/e-util/e-focus-tracker.c
index c4390e3edc..b960a4bd17 100644
--- a/src/e-util/e-focus-tracker.c
+++ b/src/e-util/e-focus-tracker.c
@@ -1126,6 +1126,9 @@ e_focus_tracker_cut_clipboard (EFocusTracker *focus_tracker)
                is_editable = gtk_text_view_get_editable (text_view);
 
                gtk_text_buffer_cut_clipboard (buffer, clipboard, is_editable);
+
+       } else if (E_IS_CONTENT_EDITOR (focus)) {
+               e_content_editor_cut (E_CONTENT_EDITOR (focus));
        }
 }
 
@@ -1156,6 +1159,9 @@ e_focus_tracker_copy_clipboard (EFocusTracker *focus_tracker)
                buffer = gtk_text_view_get_buffer (text_view);
 
                gtk_text_buffer_copy_clipboard (buffer, clipboard);
+
+       } else if (E_IS_CONTENT_EDITOR (focus)) {
+               e_content_editor_copy (E_CONTENT_EDITOR (focus));
        }
 }
 
@@ -1189,6 +1195,9 @@ e_focus_tracker_paste_clipboard (EFocusTracker *focus_tracker)
 
                gtk_text_buffer_paste_clipboard (
                        buffer, clipboard, NULL, is_editable);
+
+       } else if (E_IS_CONTENT_EDITOR (focus)) {
+               e_content_editor_paste (E_CONTENT_EDITOR (focus));
        }
 }
 
@@ -1245,6 +1254,9 @@ e_focus_tracker_select_all (EFocusTracker *focus_tracker)
 
                gtk_text_buffer_get_bounds (buffer, &start, &end);
                gtk_text_buffer_select_range (buffer, &start, &end);
+
+       } else if (E_IS_CONTENT_EDITOR (focus)) {
+               e_content_editor_select_all (E_CONTENT_EDITOR (focus));
        }
 }
 
diff --git a/src/e-util/e-html-editor-actions.c b/src/e-util/e-html-editor-actions.c
index 7f98500123..a0afa912fb 100644
--- a/src/e-util/e-html-editor-actions.c
+++ b/src/e-util/e-html-editor-actions.c
@@ -263,26 +263,6 @@ action_context_spell_ignore_cb (GtkAction *action,
        g_clear_object (&spell_checker);
 }
 
-static void
-action_copy_cb (GtkAction *action,
-                EHTMLEditor *editor)
-{
-       EContentEditor *cnt_editor;
-
-       cnt_editor = e_html_editor_get_content_editor (editor);
-       e_content_editor_copy (cnt_editor);
-}
-
-static void
-action_cut_cb (GtkAction *action,
-               EHTMLEditor *editor)
-{
-       EContentEditor *cnt_editor;
-
-       cnt_editor = e_html_editor_get_content_editor (editor);
-       e_content_editor_cut (cnt_editor);
-}
-
 static void
 action_indent_cb (GtkAction *action,
                   EHTMLEditor *editor)
@@ -617,16 +597,6 @@ action_mode_cb (GtkRadioAction *action,
        e_action_combo_box_update_model (E_ACTION_COMBO_BOX (style_combo_box));
 }
 
-static void
-action_paste_cb (GtkAction *action,
-                 EHTMLEditor *editor)
-{
-       EContentEditor *cnt_editor;
-
-       cnt_editor = e_html_editor_get_content_editor (editor);
-       e_content_editor_paste (cnt_editor);
-}
-
 static void
 clipboard_text_received_for_paste_as_text (GtkClipboard *clipboard,
                                            const gchar *text,
@@ -846,17 +816,6 @@ action_redo_cb (GtkAction *action,
                e_content_editor_redo (cnt_editor);
 }
 
-static void
-action_select_all_cb (GtkAction *action,
-                      EHTMLEditor *editor)
-{
-       EContentEditor *cnt_editor;
-
-       cnt_editor = e_html_editor_get_content_editor (editor);
-       if (e_html_editor_action_can_run (GTK_WIDGET (cnt_editor)))
-               e_content_editor_select_all (cnt_editor);
-}
-
 static void
 action_show_find_cb (GtkAction *action,
                      EHTMLEditor *editor)
@@ -951,21 +910,21 @@ static GtkActionEntry core_entries[] = {
          N_("_Copy"),
          "<Control>c",
          N_("Copy selected text to the clipboard"),
-         G_CALLBACK (action_copy_cb) },
+         NULL }, /* Handled by focus tracker */
 
        { "cut",
          "edit-cut",
          N_("Cu_t"),
          "<Control>x",
          N_("Cut selected text to the clipboard"),
-         G_CALLBACK (action_cut_cb) },
+         NULL }, /* Handled by focus tracker */
 
        { "paste",
          "edit-paste",
          N_("_Paste"),
          NULL, /* Widgets are treating Ctrl + v shortcut themselves */
          N_("Paste text from the clipboard"),
-         G_CALLBACK (action_paste_cb) },
+         NULL }, /* Handled by focus tracker */
 
        { "redo",
          "edit-redo",
@@ -979,7 +938,7 @@ static GtkActionEntry core_entries[] = {
          N_("Select _All"),
          "<Control>a",
          NULL,
-         G_CALLBACK (action_select_all_cb) },
+         NULL }, /* Handled by focus tracker */
 
        { "undo",
          "edit-undo",


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