view iface: remove unused will_add_event
ECalDataModelSubscriber interface notify each view only about the events beloging to the subscribed range so there's no need of checking if the event widget will be added. The safety check of not adding the same widget twice its stil being made on each GtkContainer::add implementation.
This commit is contained in:
@@ -136,9 +136,6 @@ static GtkWidget* gcal_month_view_get_by_uuid (GcalView *vie
|
||||
|
||||
static void gcal_month_view_clear (GcalView *view);
|
||||
|
||||
static gboolean gcal_month_view_will_add_event (GcalView *view,
|
||||
GcalEventWidget *event);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GcalMonthView,
|
||||
gcal_month_view,
|
||||
GCAL_TYPE_SUBSCRIBER,
|
||||
@@ -228,8 +225,6 @@ gcal_view_interface_init (GcalViewIface *iface)
|
||||
iface->draw_event = gcal_month_view_draw_event;
|
||||
iface->get_by_uuid = gcal_month_view_get_by_uuid;
|
||||
iface->clear = gcal_month_view_clear;
|
||||
|
||||
iface->will_add_event = gcal_month_view_will_add_event;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1338,35 +1333,6 @@ gcal_month_view_clear (GcalView *view)
|
||||
(GtkCallback) gtk_widget_destroy, NULL);
|
||||
}
|
||||
|
||||
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 */
|
||||
/**
|
||||
* gcal_month_view_new:
|
||||
|
||||
@@ -307,25 +307,3 @@ gcal_view_clear (GcalView *view)
|
||||
|
||||
GCAL_VIEW_GET_INTERFACE (view)->clear (view);
|
||||
}
|
||||
|
||||
/**
|
||||
* gcal_view_will_add_event:
|
||||
* @view: a #GcalView
|
||||
* @event: a #GcalEventWidget
|
||||
*
|
||||
* Check the ranges of dates and the existence of the widget in
|
||||
* in the view already
|
||||
*
|
||||
* Returns: %TRUE if the date of the widget fall inside the range and
|
||||
* the widget isn't already on the view, %FALSE otherwise
|
||||
**/
|
||||
gboolean
|
||||
gcal_view_will_add_event (GcalView *view,
|
||||
GcalEventWidget *event)
|
||||
{
|
||||
g_return_val_if_fail (GCAL_IS_VIEW (view), FALSE);
|
||||
g_return_if_fail (GCAL_VIEW_GET_INTERFACE (view)->will_add_event);
|
||||
|
||||
return GCAL_VIEW_GET_INTERFACE (view)->will_add_event (view,
|
||||
event);
|
||||
}
|
||||
|
||||
@@ -71,9 +71,6 @@ struct _GcalViewIface
|
||||
gboolean (*draw_event) (GcalView *view, icaltimetype *start_date, icaltimetype *end_date);
|
||||
GtkWidget* (*get_by_uuid) (GcalView *view, const gchar *uuid);
|
||||
void (*clear) (GcalView *view);
|
||||
|
||||
/* Newer API */
|
||||
gboolean (*will_add_event) (GcalView *view, GcalEventWidget *event);
|
||||
};
|
||||
|
||||
GType gcal_view_get_type (void);
|
||||
@@ -114,9 +111,6 @@ GtkWidget* gcal_view_get_by_uuid (GcalView *view,
|
||||
|
||||
void gcal_view_clear (GcalView *view);
|
||||
|
||||
gboolean gcal_view_will_add_event (GcalView *view,
|
||||
GcalEventWidget *event);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GCAL_MONTH_VIEW_H__ */
|
||||
|
||||
@@ -156,9 +156,6 @@ static gboolean gcal_week_view_draw_event (GcalView *view
|
||||
static GtkWidget* gcal_week_view_get_by_uuid (GcalView *view,
|
||||
const gchar *uuid);
|
||||
|
||||
static gboolean gcal_week_view_will_add_event (GcalView *view,
|
||||
GcalEventWidget *event);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GcalWeekView,
|
||||
gcal_week_view,
|
||||
GTK_TYPE_CONTAINER,
|
||||
@@ -236,8 +233,6 @@ gcal_view_interface_init (GcalViewIface *iface)
|
||||
iface->draw_event = gcal_week_view_draw_event;
|
||||
iface->get_by_uuid = gcal_week_view_get_by_uuid;
|
||||
/* iface->clear = gcal_week_view_clear; */
|
||||
|
||||
iface->will_add_event = gcal_week_view_will_add_event;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1418,13 +1413,6 @@ gcal_week_view_get_by_uuid (GcalView *view,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gcal_week_view_will_add_event (GcalView *view,
|
||||
GcalEventWidget *event)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
/**
|
||||
* gcal_week_view_new:
|
||||
|
||||
@@ -131,9 +131,6 @@ static GtkWidget* gcal_year_view_get_by_uuid (GcalView
|
||||
|
||||
static void gcal_year_view_clear (GcalView *view);
|
||||
|
||||
static gboolean gcal_year_view_will_add_event (GcalView *view,
|
||||
GcalEventWidget *event);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GcalYearView,
|
||||
gcal_year_view,
|
||||
GCAL_TYPE_SUBSCRIBER,
|
||||
@@ -215,8 +212,6 @@ gcal_view_interface_init (GcalViewIface *iface)
|
||||
iface->draw_event = gcal_year_view_draw_event;
|
||||
iface->get_by_uuid = gcal_year_view_get_by_uuid;
|
||||
iface->clear = gcal_year_view_clear;
|
||||
|
||||
iface->will_add_event = gcal_year_view_will_add_event;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1055,14 +1050,6 @@ gcal_year_view_clear (GcalView *view)
|
||||
(GtkCallback) gtk_widget_destroy, NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gcal_year_view_will_add_event (GcalView *view,
|
||||
GcalEventWidget *event)
|
||||
{
|
||||
/* FIXME: implement me !!! */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
/**
|
||||
* gcal_year_view_new:
|
||||
|
||||
Reference in New Issue
Block a user