month-view: implement GcalView::wil_add_event vfunc
This commit is contained in:
+23
-1
@@ -1304,7 +1304,29 @@ static gboolean
|
|||||||
gcal_month_view_will_add_event (GcalView *view,
|
gcal_month_view_will_add_event (GcalView *view,
|
||||||
GcalEventWidget *event)
|
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 */
|
/* Public API */
|
||||||
|
|||||||
Reference in New Issue
Block a user