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 /widgets/misc/e-selectable.c | |
parent | 2cf0c27e2ece428dd2af1945f6fececbe9dbcc15 (diff) | |
download | gsoc2013-evolution-3e7c7808cc65c22bc40a7d1d30ffa0044097a6ff.tar gsoc2013-evolution-3e7c7808cc65c22bc40a7d1d30ffa0044097a6ff.tar.gz gsoc2013-evolution-3e7c7808cc65c22bc40a7d1d30ffa0044097a6ff.tar.bz2 gsoc2013-evolution-3e7c7808cc65c22bc40a7d1d30ffa0044097a6ff.tar.lz gsoc2013-evolution-3e7c7808cc65c22bc40a7d1d30ffa0044097a6ff.tar.xz 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 'widgets/misc/e-selectable.c')
-rw-r--r-- | widgets/misc/e-selectable.c | 58 |
1 files changed, 56 insertions, 2 deletions
diff --git a/widgets/misc/e-selectable.c b/widgets/misc/e-selectable.c index bb5948cc13..da998d320d 100644 --- a/widgets/misc/e-selectable.c +++ b/widgets/misc/e-selectable.c @@ -21,6 +21,28 @@ #include "e-selectable.h" +static void +selectable_class_init (ESelectableInterface *interface) +{ + g_object_interface_install_property ( + interface, + g_param_spec_boxed ( + "copy-target-list", + "Copy Target List", + NULL, + GTK_TYPE_TARGET_LIST, + G_PARAM_READABLE)); + + g_object_interface_install_property ( + interface, + g_param_spec_boxed ( + "paste-target-list", + "Paste Target List", + NULL, + GTK_TYPE_TARGET_LIST, + G_PARAM_READABLE)); +} + GType e_selectable_get_type (void) { @@ -31,7 +53,7 @@ e_selectable_get_type (void) sizeof (ESelectableInterface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, - (GClassInitFunc) NULL, + (GClassInitFunc) selectable_class_init, (GClassFinalizeFunc) NULL, NULL, /* class_data */ 0, /* instance_size */ @@ -43,7 +65,7 @@ e_selectable_get_type (void) type = g_type_register_static ( G_TYPE_INTERFACE, "ESelectable", &type_info, 0); - g_type_interface_add_prerequisite (type, G_TYPE_OBJECT); + g_type_interface_add_prerequisite (type, GTK_TYPE_WIDGET); } return type; @@ -131,3 +153,35 @@ e_selectable_select_all (ESelectable *selectable) if (interface->select_all != NULL) interface->select_all (selectable); } + +GtkTargetList * +e_selectable_get_copy_target_list (ESelectable *selectable) +{ + GtkTargetList *target_list; + + g_return_val_if_fail (E_IS_SELECTABLE (selectable), NULL); + + g_object_get (selectable, "copy-target-list", &target_list, NULL); + + /* We want to return a borrowed reference to the target + * list, so undo the reference that g_object_get() added. */ + gtk_target_list_unref (target_list); + + return target_list; +} + +GtkTargetList * +e_selectable_get_paste_target_list (ESelectable *selectable) +{ + GtkTargetList *target_list; + + g_return_val_if_fail (E_IS_SELECTABLE (selectable), NULL); + + g_object_get (selectable, "paste-target-list", &target_list, NULL); + + /* We want to return a borrowed reference to the target + * list, so undo the reference that g_object_get() added. */ + gtk_target_list_unref (target_list); + + return target_list; +} |