From 6f2b01018f9dcd6c268ac50af39ea49f57bac055 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erick=20P=C3=A9rez=20Castellanos?= Date: Tue, 21 Oct 2014 00:45:04 -0400 Subject: [PATCH] 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. --- src/gcal-month-view.c | 34 ---------------------------------- src/gcal-view.c | 22 ---------------------- src/gcal-view.h | 6 ------ src/gcal-week-view.c | 12 ------------ src/gcal-year-view.c | 13 ------------- 5 files changed, 87 deletions(-) diff --git a/src/gcal-month-view.c b/src/gcal-month-view.c index 00dda35c..f731e950 100644 --- a/src/gcal-month-view.c +++ b/src/gcal-month-view.c @@ -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: diff --git a/src/gcal-view.c b/src/gcal-view.c index 4331a873..09b431f7 100644 --- a/src/gcal-view.c +++ b/src/gcal-view.c @@ -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); -} diff --git a/src/gcal-view.h b/src/gcal-view.h index 56bb6b0a..f9558d10 100644 --- a/src/gcal-view.h +++ b/src/gcal-view.h @@ -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__ */ diff --git a/src/gcal-week-view.c b/src/gcal-week-view.c index a6f2ace4..0f35d392 100644 --- a/src/gcal-week-view.c +++ b/src/gcal-week-view.c @@ -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: diff --git a/src/gcal-year-view.c b/src/gcal-year-view.c index 7acc0449..2926683e 100644 --- a/src/gcal-year-view.c +++ b/src/gcal-year-view.c @@ -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: