month-view: implement GcalView::wil_add_event vfunc

This commit is contained in:
Erick Pérez Castellanos
2014-12-04 17:10:39 -05:00
parent 714e2c93f3
commit d8cc980a1d
+23 -1
View File
@@ -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 */