From 4a101290fdb546296f7bc0a9a34ba342e741895a Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 21 Jun 2013 15:56:34 +0200 Subject: 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. --- e-util/e-table.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) (limited to 'e-util/e-table.c') diff --git a/e-util/e-table.c b/e-util/e-table.c index 1777474984..a4c809a99c 100644 --- a/e-util/e-table.c +++ b/e-util/e-table.c @@ -105,7 +105,8 @@ enum { PROP_HADJUSTMENT, PROP_VADJUSTMENT, PROP_HSCROLL_POLICY, - PROP_VSCROLL_POLICY + PROP_VSCROLL_POLICY, + PROP_IS_EDITING }; enum { @@ -1066,6 +1067,16 @@ et_table_rows_deleted (ETableModel *table_model, } } +static void +group_is_editing_changed_cb (ETableClickToAdd *etcta, + GParamSpec *param, + ETable *table) +{ + g_return_if_fail (E_IS_TABLE (table)); + + g_object_notify (G_OBJECT (table), "is-editing"); +} + static void et_build_groups (ETable *et) { @@ -1123,6 +1134,9 @@ et_build_groups (ETable *et) g_signal_connect ( et->group, "start_drag", G_CALLBACK (group_start_drag), et); + g_signal_connect ( + et->group, "notify::is-editing", + G_CALLBACK (group_is_editing_changed_cb), et); if (!(et->is_grouped) && was_grouped) et_disconnect_model (et); @@ -1352,6 +1366,16 @@ canvas_vbox_event (ECanvasVbox *vbox, return TRUE; } +static void +click_to_add_is_editing_changed_cb (ETableClickToAdd *etcta, + GParamSpec *param, + ETable *table) +{ + g_return_if_fail (E_IS_TABLE (table)); + + g_object_notify (G_OBJECT (table), "is-editing"); +} + static gboolean click_to_add_event (ETableClickToAdd *etcta, GdkEventKey *key, @@ -1492,6 +1516,9 @@ e_table_setup_table (ETable *e_table, g_signal_connect ( e_table->click_to_add, "cursor_change", G_CALLBACK (click_to_add_cursor_change), e_table); + g_signal_connect ( + e_table->click_to_add, "notify::is-editing", + G_CALLBACK (click_to_add_is_editing_changed_cb), e_table); } } @@ -2254,6 +2281,9 @@ et_get_property (GObject *object, else g_value_set_enum (value, 0); break; + case PROP_IS_EDITING: + g_value_set_boolean (value, e_table_is_editing (etable)); + break; default: break; } @@ -2325,10 +2355,16 @@ et_set_property (GObject *object, E_CANVAS_VBOX (etable->canvas_vbox), etable->click_to_add); + g_signal_connect ( + etable->click_to_add, "event", + G_CALLBACK (click_to_add_event), etable); g_signal_connect ( etable->click_to_add, "cursor_change", G_CALLBACK (click_to_add_cursor_change), etable); + g_signal_connect ( + etable->click_to_add, "notify::is-editing", + G_CALLBACK (click_to_add_is_editing_changed_cb), etable); } else { g_object_run_dispose (G_OBJECT (etable->click_to_add)); etable->click_to_add = NULL; @@ -3562,6 +3598,16 @@ e_table_class_init (ETableClass *class) E_TYPE_TABLE_MODEL, G_PARAM_READABLE)); + 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)); + gtk_widget_class_install_style_property ( widget_class, g_param_spec_int ( @@ -3610,3 +3656,12 @@ e_table_thaw_state_change (ETable *table) e_table_state_change (table); } } + +gboolean +e_table_is_editing (ETable *table) +{ + g_return_val_if_fail (E_IS_TABLE (table), FALSE); + + return (table->click_to_add && e_table_click_to_add_is_editing (E_TABLE_CLICK_TO_ADD (table->click_to_add))) || + (table->group && e_table_group_is_editing (table->group)); +} -- cgit v1.2.3