[gnome-calendar/wip/pandusonu/week-view: 57/60] week-header: make event removal more robust
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/wip/pandusonu/week-view: 57/60] week-header: make event removal more robust
- Date: Fri, 2 Dec 2016 01:53:17 +0000 (UTC)
commit 1903474ca64f35df857d20cac7d3457c1aa16d43
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Thu Nov 24 00:49:03 2016 -0200
week-header: make event removal more robust
The current code does not move the remaining events up and,
when changing the week header various times, it ends up
showing completely bogus events at bogus positions.
Fix that by properly moving events up when removing them.
src/views/gcal-week-header.c | 21 +++++++++++++++------
1 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/src/views/gcal-week-header.c b/src/views/gcal-week-header.c
index 333c1ae..74d3a5a 100644
--- a/src/views/gcal-week-header.c
+++ b/src/views/gcal-week-header.c
@@ -1151,19 +1151,28 @@ gcal_week_header_remove_event (GcalWeekHeader *self,
if (!removed_event)
goto out;
+ g_message ("DEL: '%s'", gcal_event_get_summary (removed_event));
+
/* Remove from the weekday's GList */
for (weekday = 0; weekday < 7; weekday++)
{
+ gint event_position;
+
l = self->events[weekday];
- l = g_list_remove (l, removed_event);
+ event_position = g_list_index (self->events[weekday], removed_event);
+
+ if (event_position == -1)
+ continue;
+ g_message (" - Column %d has event at %d (length: %d)", weekday, event_position, g_list_length (l) -
1);
+
+ /* Remove from the current weekday */
+ l = g_list_remove (l, removed_event);
self->events[weekday] = l;
- }
- g_message ("DEL: '%s' (length of %d: %d)",
- gcal_event_get_summary (removed_event),
- weekday,
- g_list_length (l));
+ /* Move remaining events up */
+ move_events_at_column (self, UP, weekday, event_position);
+ }
out:
g_clear_pointer (&children, g_list_free);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]