[gnome-calendar/ui-rewrite] month-view: implement GcalView::wil_add_event vfunc
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/ui-rewrite] month-view: implement GcalView::wil_add_event vfunc
- Date: Mon, 6 Oct 2014 16:27:21 +0000 (UTC)
commit 0fe2a5f7ff1dbf3eb18981db30b6ced8bced1cbd
Author: Erick Pérez Castellanos <erick red gmail com>
Date: Sun Oct 5 19:57:30 2014 -0400
month-view: implement GcalView::wil_add_event vfunc
src/gcal-month-view.c | 24 +++++++++++++++++++++++-
1 files changed, 23 insertions(+), 1 deletions(-)
---
diff --git a/src/gcal-month-view.c b/src/gcal-month-view.c
index 79f9000..f80e785 100644
--- a/src/gcal-month-view.c
+++ b/src/gcal-month-view.c
@@ -1304,7 +1304,29 @@ static gboolean
gcal_month_view_will_add_event (GcalView *view,
GcalEventWidget *event)
{
- ;
+ GcalMonthViewPrivate *priv;
+
+ icaltimetype *start_date;
+ gboolean is_in_range;
+
+ const gchar* event_uuid;
+
+ g_return_val_if_fail (GCAL_IS_MONTH_VIEW (view), FALSE);
+ priv = gcal_month_view_get_instance_private (GCAL_MONTH_VIEW (view));
+
+ if (priv->date == NULL)
+ return FALSE;
+
+ start_date = gcal_event_widget_get_date (event);
+ is_in_range = (priv->date->month == start_date->month &&
+ priv->date->year == start_date->year);
+ g_free (start_date);
+
+ if (!is_in_range)
+ return FALSE;
+
+ event_uuid = gcal_event_widget_peek_uuid (event);
+ return !(gcal_month_view_get_by_uuid (view, event_uuid) != NULL);
}
/* Public API */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]