From 3e7c7808cc65c22bc40a7d1d30ffa0044097a6ff Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 16 Jan 2010 13:34:32 -0500 Subject: Improve clipboard behavior. Add "copy-target-list" and "paste-target-list" to the ESelectable interface. These are underutilized for the moment, but will eventually be used to help integrate drag-and-drop support into ESelectable. Add cut and paste support to EWebView, along with a new "editable" property and new clipboard signals "copy-clipboard", "cut-clipboard" and "paste-clipboard". In EFocusTracker, listen for "owner-changed" signals from the default clipboard as another trigger to update actions, particularly the Paste action. (Unfortunately this doesn't work for EWebView since GtkHtml implements its own clipboard.) In EMsgComposer, convert GtkhtmlEditor's clipboard methods to empty stubs, since EFocusTracker will now trigger EWebView's clipboard actions. Also, intercept EWebView::paste-clipboard signals and improve the interaction between the HTML editor and the attachment bar based on use cases in bug #603715. --- widgets/misc/e-focus-tracker.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'widgets/misc/e-focus-tracker.c') diff --git a/widgets/misc/e-focus-tracker.c b/widgets/misc/e-focus-tracker.c index d1cb32adde..8eb1b25d56 100644 --- a/widgets/misc/e-focus-tracker.c +++ b/widgets/misc/e-focus-tracker.c @@ -360,6 +360,10 @@ focus_tracker_dispose (GObject *object) gtk_clipboard_get (GDK_SELECTION_PRIMARY), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, object); + g_signal_handlers_disconnect_matched ( + gtk_clipboard_get (GDK_SELECTION_CLIPBOARD), + G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, object); + if (priv->window != NULL) { g_signal_handlers_disconnect_matched ( priv->window, G_SIGNAL_MATCH_DATA, @@ -424,6 +428,16 @@ focus_tracker_constructed (GObject *object) clipboard = gtk_clipboard_get (GDK_SELECTION_PRIMARY); + g_signal_connect_swapped ( + clipboard, "owner-change", + G_CALLBACK (e_focus_tracker_update_actions), object); + + /* Listen for "owner-change" signals from the default clipboard + * so we can update the paste action when the user cuts or copies + * something. This is how GEdit does it. */ + + clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD); + g_signal_connect_swapped ( clipboard, "owner-change", G_CALLBACK (e_focus_tracker_update_actions), object); -- cgit v1.2.3