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



commit e285ab0f1f9188797836f9271881a770c86f9280
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 |   44 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 44 insertions(+), 0 deletions(-)
---
diff --git a/e-util/e-focus-tracker.c b/e-util/e-focus-tracker.c
index 36d2421..21d1fcc 100644
--- a/e-util/e-focus-tracker.c
+++ b/e-util/e-focus-tracker.c
@@ -28,6 +28,7 @@
 
 #include "e-selectable.h"
 #include "e-widget-undo.h"
+#include "e-editor-widget.h"
 
 #define E_FOCUS_TRACKER_GET_PRIVATE(obj) \
        (G_TYPE_INSTANCE_GET_PRIVATE \
@@ -256,6 +257,42 @@ focus_tracker_text_view_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,
@@ -332,6 +369,10 @@ focus_tracker_targets_received_cb (GtkClipboard *clipboard,
                        focus_tracker, GTK_TEXT_VIEW (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);
 }
@@ -351,6 +392,9 @@ focus_tracker_set_focus_cb (GtkWindow *window,
                if (GTK_IS_TEXT_VIEW (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]