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-click-to-add.c | |
parent | 97c70105b71adc9b7cb9f4db15bf44f98133a82c (diff) | |
download | gsoc2013-evolution-4a101290fdb546296f7bc0a9a34ba342e741895a.tar.gz 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-click-to-add.c')
-rw-r--r-- | e-util/e-table-click-to-add.c | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/e-util/e-table-click-to-add.c b/e-util/e-table-click-to-add.c index 8d80e197f4..2f36b1899d 100644 --- a/e-util/e-table-click-to-add.c +++ b/e-util/e-table-click-to-add.c @@ -60,7 +60,8 @@ enum { PROP_MODEL, PROP_MESSAGE, PROP_WIDTH, - PROP_HEIGHT + PROP_HEIGHT, + PROP_IS_EDITING }; static void @@ -311,6 +312,9 @@ etcta_get_property (GObject *object, case PROP_HEIGHT: g_value_set_double (value, etcta->height); break; + case PROP_IS_EDITING: + g_value_set_boolean (value, e_table_click_to_add_is_editing (etcta)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; @@ -368,6 +372,16 @@ set_initial_selection (ETableClickToAdd *etcta) } static void +table_click_to_add_row_is_editing_changed_cb (ETableItem *item, + GParamSpec *param, + ETableClickToAdd *etcta) +{ + g_return_if_fail (E_IS_TABLE_CLICK_TO_ADD (etcta)); + + g_object_notify (G_OBJECT (etcta), "is-editing"); +} + +static void finish_editing (ETableClickToAdd *etcta) { if (etcta->row) { @@ -401,7 +415,13 @@ finish_editing (ETableClickToAdd *etcta) etcta->row, "key_press", G_CALLBACK (item_key_press), etcta); + g_signal_connect ( + etcta->row, "notify::is-editing", + G_CALLBACK (table_click_to_add_row_is_editing_changed_cb), etcta); + set_initial_selection (etcta); + + g_object_notify (G_OBJECT (etcta), "is-editing"); } } @@ -452,9 +472,15 @@ etcta_event (GnomeCanvasItem *item, etcta->row, "key_press", G_CALLBACK (item_key_press), etcta); + g_signal_connect ( + etcta->row, "notify::is-editing", + G_CALLBACK (table_click_to_add_row_is_editing_changed_cb), etcta); + e_canvas_item_grab_focus (GNOME_CANVAS_ITEM (etcta->row), TRUE); set_initial_selection (etcta); + + g_object_notify (G_OBJECT (etcta), "is-editing"); } break; @@ -588,6 +614,16 @@ e_table_click_to_add_class_init (ETableClickToAddClass *class) G_PARAM_READABLE | G_PARAM_LAX_VALIDATION)); + 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)); + etcta_signals[CURSOR_CHANGE] = g_signal_new ( "cursor_change", G_OBJECT_CLASS_TYPE (object_class), @@ -665,3 +701,11 @@ e_table_click_to_add_commit (ETableClickToAdd *etcta) create_rect_and_text (etcta); e_canvas_item_move_absolute (etcta->text, 3, 3); } + +gboolean +e_table_click_to_add_is_editing (ETableClickToAdd *etcta) +{ + g_return_val_if_fail (E_IS_TABLE_CLICK_TO_ADD (etcta), FALSE); + + return etcta->row && e_table_item_is_editing (E_TABLE_ITEM (etcta->row)); +} |