[evolution/webkit-composer: 187/231] Bug #689796 - [webkit-composer] Paste of Image from clipboard does nothing Also fixes other copy/cut



commit c44b1749f91856f8e21f08d18131257db9b00958
Author: Tomas Popela <tpopela redhat com>
Date:   Thu Apr 18 11:38:20 2013 +0200

    Bug #689796 - [webkit-composer] Paste of Image from clipboard does nothing
    Also fixes other copy/cut/paste actions in composer

 e-util/e-focus-tracker.c |   45 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 45 insertions(+), 0 deletions(-)
---
diff --git a/e-util/e-focus-tracker.c b/e-util/e-focus-tracker.c
index a610605..71de1b5 100644
--- a/e-util/e-focus-tracker.c
+++ b/e-util/e-focus-tracker.c
@@ -28,6 +28,7 @@
 #include <glib/gi18n-lib.h>
 
 #include "e-selectable.h"
+#include "e-editor-widget.h"
 
 #define E_FOCUS_TRACKER_GET_PRIVATE(obj) \
        (G_TYPE_INSTANCE_GET_PRIVATE \
@@ -144,6 +145,42 @@ focus_tracker_editable_update_actions (EFocusTracker *focus_tracker,
 }
 
 static void
+focus_tracker_editor_update_actions (EFocusTracker *focus_tracker,
+                                       EEditorWidget *editor,
+                                       GdkAtom *targets,
+                                       gint n_targets)
+{
+       GtkAction *action;
+       gboolean can_copy;
+       gboolean can_cut;
+       gboolean can_paste;
+
+       g_object_get (editor,
+                     "can-copy", &can_copy,
+                     "can-cut", &can_cut,
+                     "can-paste", &can_paste,
+                     NULL);
+
+       action = e_focus_tracker_get_cut_clipboard_action (focus_tracker);
+       if (action != NULL) {
+               gtk_action_set_sensitive (action, can_cut);
+               gtk_action_set_tooltip (action, _("Cut the selection"));
+       }
+
+       action = e_focus_tracker_get_copy_clipboard_action (focus_tracker);
+       if (action != NULL) {
+               gtk_action_set_sensitive (action, can_copy);
+               gtk_action_set_tooltip (action, _("Copy the selection"));
+       }
+
+       action = e_focus_tracker_get_paste_clipboard_action (focus_tracker);
+       if (action != NULL) {
+               gtk_action_set_sensitive (action, can_paste);
+               gtk_action_set_tooltip (action, _("Paste the clipboard"));
+       }
+}
+
+static void
 focus_tracker_selectable_update_actions (EFocusTracker *focus_tracker,
                                          ESelectable *selectable,
                                          GdkAtom *targets,
@@ -207,6 +244,11 @@ focus_tracker_targets_received_cb (GtkClipboard *clipboard,
                        focus_tracker, E_SELECTABLE (focus),
                        targets, n_targets);
 
+       else if (E_IS_EDITOR_WIDGET (focus))
+               focus_tracker_editor_update_actions (
+                       focus_tracker, E_EDITOR_WIDGET (focus),
+                       targets, n_targets);
+
        g_object_unref (focus_tracker);
 }
 
@@ -222,6 +264,9 @@ focus_tracker_set_focus_cb (GtkWindow *window,
                if (E_IS_SELECTABLE (focus))
                        break;
 
+               if (E_IS_EDITOR_WIDGET (focus))
+                       break;
+
                focus = gtk_widget_get_parent (focus);
        }
 


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