diff options
author | Milan Crha <mcrha@redhat.com> | 2013-06-21 21:56:34 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2013-06-21 21:56:34 +0800 |
commit | 4a101290fdb546296f7bc0a9a34ba342e741895a (patch) | |
tree | 3a5cecac900e672a87f2865a8288f30dbeea4c34 /e-util/e-table-group.c | |
parent | 97c70105b71adc9b7cb9f4db15bf44f98133a82c (diff) | |
download | gsoc2013-evolution-4a101290fdb546296f7bc0a9a34ba342e741895a.tar gsoc2013-evolution-4a101290fdb546296f7bc0a9a34ba342e741895a.tar.gz gsoc2013-evolution-4a101290fdb546296f7bc0a9a34ba342e741895a.tar.bz2 gsoc2013-evolution-4a101290fdb546296f7bc0a9a34ba342e741895a.tar.lz gsoc2013-evolution-4a101290fdb546296f7bc0a9a34ba342e741895a.tar.xz gsoc2013-evolution-4a101290fdb546296f7bc0a9a34ba342e741895a.tar.zst gsoc2013-evolution-4a101290fdb546296f7bc0a9a34ba342e741895a.zip |
Calendar views inline text edit with Ctrl+C/V/X does not work
The shortcuts Ctrl+C/V/X are used for whole calendar items
copy/paste/cut, not for text when editing event details inline, either
in a day/week view or in a list view. By tracking the is-editing property
of respective cell editor and using it when enabling/disabling clipboard
actions makes the respective text operations work as expected.
Diffstat (limited to 'e-util/e-table-group.c')
-rw-r--r-- | e-util/e-table-group.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/e-util/e-table-group.c b/e-util/e-table-group.c index a4a23bef67..1c9ed2c39b 100644 --- a/e-util/e-table-group.c +++ b/e-util/e-table-group.c @@ -50,6 +50,11 @@ enum { LAST_SIGNAL }; +enum { + PROP_0, + PROP_IS_EDITING +}; + static guint etg_signals[LAST_SIGNAL] = { 0, }; static gboolean etg_get_focus (ETableGroup *table_group); @@ -78,6 +83,24 @@ etg_dispose (GObject *object) G_OBJECT_CLASS (e_table_group_parent_class)->dispose (object); } +static void +etg_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + ETableGroup *etg = E_TABLE_GROUP (object); + + switch (property_id) { + case PROP_IS_EDITING: + g_value_set_boolean (value, e_table_group_is_editing (etg)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + /** * e_table_group_new * @parent: The %GnomeCanvasGroup to create a child of. @@ -640,6 +663,7 @@ e_table_group_class_init (ETableGroupClass *class) GObjectClass *object_class = G_OBJECT_CLASS (class); object_class->dispose = etg_dispose; + object_class->get_property = etg_get_property; item_class->event = etg_event; @@ -665,6 +689,16 @@ e_table_group_class_init (ETableGroupClass *class) class->get_mouse_over = NULL; class->get_cell_geometry = NULL; + g_object_class_install_property ( + object_class, + PROP_IS_EDITING, + g_param_spec_boolean ( + "is-editing", + "Whether is in an editing mode", + "Whether is in an editing mode", + FALSE, + G_PARAM_READABLE)); + etg_signals[CURSOR_CHANGE] = g_signal_new ( "cursor_change", G_OBJECT_CLASS_TYPE (object_class), @@ -751,3 +785,28 @@ e_table_group_init (ETableGroup *table_group) { /* nothing to do */ } + +gboolean +e_table_group_is_editing (ETableGroup *table_group) +{ + static gboolean in = FALSE; + gboolean is_editing = FALSE; + + g_return_val_if_fail (E_IS_TABLE_GROUP (table_group), FALSE); + + /* this should be called from the main thread only, + and each descendant overrides the property, + thus might cause no call recursion */ + if (in) { + g_warn_if_reached (); + return FALSE; + } + + in = TRUE; + + g_object_get (G_OBJECT (table_group), "is-editing", &is_editing, NULL); + + in = FALSE; + + return is_editing; +} |