aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/e-week-view.c
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2013-06-21 21:56:34 +0800
committerMilan Crha <mcrha@redhat.com>2013-06-21 21:56:34 +0800
commit4a101290fdb546296f7bc0a9a34ba342e741895a (patch)
tree3a5cecac900e672a87f2865a8288f30dbeea4c34 /calendar/gui/e-week-view.c
parent97c70105b71adc9b7cb9f4db15bf44f98133a82c (diff)
downloadgsoc2013-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 'calendar/gui/e-week-view.c')
-rw-r--r--calendar/gui/e-week-view.c40
1 files changed, 36 insertions, 4 deletions
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index 8d1e8815de..b2bc509dfa 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -199,7 +199,8 @@ G_DEFINE_TYPE (EWeekView, e_week_view, E_TYPE_CALENDAR_VIEW)
enum {
PROP_0,
PROP_COMPRESS_WEEKEND,
- PROP_SHOW_EVENT_END_TIMES
+ PROP_SHOW_EVENT_END_TIMES,
+ PROP_IS_EDITING
};
static gint map_left[] = {0, 1, 2, 0, 1, 2, 2};
@@ -704,6 +705,10 @@ week_view_get_property (GObject *object,
e_week_view_get_show_event_end_times (
E_WEEK_VIEW (object)));
return;
+
+ case PROP_IS_EDITING:
+ g_value_set_boolean (value, e_week_view_is_editing (E_WEEK_VIEW (object)));
+ return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -1192,8 +1197,11 @@ week_view_get_selected_events (ECalendarView *cal_view)
g_return_val_if_fail (E_IS_WEEK_VIEW (week_view), NULL);
if (week_view->editing_event_num != -1) {
- if (!is_array_index_in_bounds (week_view->events, week_view->editing_event_num))
+ if (!is_array_index_in_bounds (week_view->events, week_view->editing_event_num)) {
+ week_view->editing_event_num = -1;
+ g_object_notify (G_OBJECT (week_view), "is-editing");
return NULL;
+ }
event = &g_array_index (week_view->events, EWeekViewEvent,
week_view->editing_event_num);
@@ -1471,6 +1479,11 @@ e_week_view_class_init (EWeekViewClass *class)
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
+ g_object_class_override_property (
+ object_class,
+ PROP_IS_EDITING,
+ "is-editing");
+
/* init the accessibility support for e_week_view */
e_week_view_a11y_init ();
}
@@ -2445,8 +2458,10 @@ e_week_view_remove_event_cb (EWeekView *week_view,
/* If we were editing this event, set editing_event_num to -1 so
* on_editing_stopped doesn't try to update the event. */
- if (week_view->editing_event_num == event_num)
+ if (week_view->editing_event_num == event_num) {
week_view->editing_event_num = -1;
+ g_object_notify (G_OBJECT (week_view), "is-editing");
+ }
if (week_view->popup_event_num == event_num)
week_view->popup_event_num = -1;
@@ -2940,6 +2955,7 @@ e_week_view_free_events (EWeekView *week_view)
EWeekViewEvent *event;
EWeekViewEventSpan *span;
gint event_num, span_num, num_days, day;
+ gboolean did_editing = week_view->editing_event_num != -1;
/* Reset all our indices. */
week_view->pressed_event_num = -1;
@@ -2983,6 +2999,9 @@ e_week_view_free_events (EWeekView *week_view)
for (day = 0; day < E_WEEK_VIEW_MAX_WEEKS * 7; day++) {
gnome_canvas_item_hide (week_view->jump_buttons[day]);
}
+
+ if (did_editing)
+ g_object_notify (G_OBJECT (week_view), "is-editing");
}
/* This adds one event to the view, adding it to the appropriate array. */
@@ -4233,6 +4252,8 @@ e_week_view_on_editing_started (EWeekView *week_view,
}
g_signal_emit_by_name (week_view, "selection_changed");
+
+ g_object_notify (G_OBJECT (week_view), "is-editing");
}
static void
@@ -4278,8 +4299,10 @@ e_week_view_on_editing_stopped (EWeekView *week_view,
/* Check that the event is still valid. */
uid = icalcomponent_get_uid (event->comp_data->icalcomp);
- if (!uid)
+ if (!uid) {
+ g_object_notify (G_OBJECT (week_view), "is-editing");
return;
+ }
text = NULL;
g_object_set (span->text_item, "handle_popup", FALSE, NULL);
@@ -4431,6 +4454,8 @@ e_week_view_on_editing_stopped (EWeekView *week_view,
g_object_unref (comp);
g_signal_emit_by_name (week_view, "selection_changed");
+
+ g_object_notify (G_OBJECT (week_view), "is-editing");
}
gboolean
@@ -4925,3 +4950,10 @@ e_week_view_is_jump_button_visible (EWeekView *week_view,
return FALSE;
}
+gboolean
+e_week_view_is_editing (EWeekView *week_view)
+{
+ g_return_val_if_fail (E_IS_WEEK_VIEW (week_view), FALSE);
+
+ return week_view->editing_event_num != -1;
+}