diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-01-17 02:34:32 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-01-18 01:11:08 +0800 |
commit | 3e7c7808cc65c22bc40a7d1d30ffa0044097a6ff (patch) | |
tree | d74cd0017e310c79b796eba3df7bfb8947a673d7 /mail | |
parent | 2cf0c27e2ece428dd2af1945f6fececbe9dbcc15 (diff) | |
download | gsoc2013-evolution-3e7c7808cc65c22bc40a7d1d30ffa0044097a6ff.tar.gz gsoc2013-evolution-3e7c7808cc65c22bc40a7d1d30ffa0044097a6ff.tar.zst gsoc2013-evolution-3e7c7808cc65c22bc40a7d1d30ffa0044097a6ff.zip |
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.
Diffstat (limited to 'mail')
-rw-r--r-- | mail/message-list.c | 64 | ||||
-rw-r--r-- | mail/message-list.h | 4 |
2 files changed, 68 insertions, 0 deletions
diff --git a/mail/message-list.c b/mail/message-list.c index 288b4a5420..9046b69894 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -117,10 +117,15 @@ struct _MessageListPrivate { gboolean thread_latest; gboolean any_row_changed; /* save state before regen list when this is set to true */ + + GtkTargetList *copy_target_list; + GtkTargetList *paste_target_list; }; enum { PROP_0, + PROP_COPY_TARGET_LIST, + PROP_PASTE_TARGET_LIST, PROP_SHELL_BACKEND }; @@ -2295,6 +2300,7 @@ static void message_list_init (MessageList *message_list) { MessageListPrivate *p; + GtkTargetList *target_list; GdkAtom matom; message_list->priv = MESSAGE_LIST_GET_PRIVATE (message_list); @@ -2336,6 +2342,14 @@ message_list_init (MessageList *message_list) g_signal_connect(p->invisible, "selection_get", G_CALLBACK(ml_selection_get), message_list); g_signal_connect(p->invisible, "selection_clear_event", G_CALLBACK(ml_selection_clear_event), message_list); g_signal_connect(p->invisible, "selection_received", G_CALLBACK(ml_selection_received), message_list); + + /* FIXME This is currently unused. */ + target_list = gtk_target_list_new (NULL, 0); + message_list->priv->copy_target_list = target_list; + + /* FIXME This is currently unused. */ + target_list = gtk_target_list_new (NULL, 0); + message_list->priv->paste_target_list = target_list; } static void @@ -2418,6 +2432,18 @@ message_list_get_property (GObject *object, GParamSpec *pspec) { switch (property_id) { + case PROP_COPY_TARGET_LIST: + g_value_set_boxed ( + value, message_list_get_copy_target_list ( + MESSAGE_LIST (object))); + return; + + case PROP_PASTE_TARGET_LIST: + g_value_set_boxed ( + value, message_list_get_paste_target_list ( + MESSAGE_LIST (object))); + return; + case PROP_SHELL_BACKEND: g_value_set_object ( value, message_list_get_shell_backend ( @@ -2440,6 +2466,16 @@ message_list_dispose (GObject *object) priv->shell_backend = NULL; } + if (priv->copy_target_list != NULL) { + g_object_unref (priv->copy_target_list); + priv->copy_target_list = NULL; + } + + if (priv->paste_target_list != NULL) { + g_object_unref (priv->paste_target_list); + priv->paste_target_list = NULL; + } + /* Chain up to parent's dispose() method. */ G_OBJECT_CLASS (parent_class)->dispose (object); } @@ -2533,6 +2569,18 @@ message_list_class_init (MessageListClass *class) class->message_list_built = message_list_built; + /* Inherited from ESelectableInterface */ + g_object_class_override_property ( + object_class, + PROP_COPY_TARGET_LIST, + "copy-target-list"); + + /* Inherited from ESelectableInterface */ + g_object_class_override_property ( + object_class, + PROP_PASTE_TARGET_LIST, + "paste-target-list"); + g_object_class_install_property ( object_class, PROP_SHELL_BACKEND, @@ -3614,6 +3662,22 @@ message_list_set_folder (MessageList *message_list, CamelFolder *folder, const g } } +GtkTargetList * +message_list_get_copy_target_list (MessageList *message_list) +{ + g_return_val_if_fail (IS_MESSAGE_LIST (message_list), NULL); + + return message_list->priv->copy_target_list; +} + +GtkTargetList * +message_list_get_paste_target_list (MessageList *message_list) +{ + g_return_val_if_fail (IS_MESSAGE_LIST (message_list), NULL); + + return message_list->priv->paste_target_list; +} + static gboolean on_cursor_activated_idle (gpointer data) { diff --git a/mail/message-list.h b/mail/message-list.h index 953a444e11..c7efc5dc14 100644 --- a/mail/message-list.h +++ b/mail/message-list.h @@ -189,6 +189,10 @@ void message_list_set_folder (MessageList *message_list, CamelFolder *camel_folder, const gchar *uri, gboolean outgoing); +GtkTargetList * message_list_get_copy_target_list + (MessageList *message_list); +GtkTargetList * message_list_get_paste_target_list + (MessageList *message_list); void message_list_freeze (MessageList *message_list); void message_list_thaw (MessageList *message_list); GPtrArray * message_list_get_uids (MessageList *message_list); |