[gnome-calendar/ui-rewrite] view: add :will_add_event vfunc and stub methods
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/ui-rewrite] view: add :will_add_event vfunc and stub methods
- Date: Mon, 6 Oct 2014 16:27:01 +0000 (UTC)
commit 6107986739e9a7456baec03a21fe0fd6d72f1a0d
Author: Erick Pérez Castellanos <erick red gmail com>
Date: Sun Oct 5 19:08:07 2014 -0400
view: add :will_add_event vfunc and stub methods
Note: this commit probably won't build, but this is the right order of
keeping history.
src/gcal-month-view.c | 12 ++++++++++++
src/gcal-view.c | 22 ++++++++++++++++++++++
src/gcal-view.h | 11 +++++++----
src/gcal-week-view.c | 12 ++++++++++++
src/gcal-year-view.c | 12 ++++++++++++
5 files changed, 65 insertions(+), 4 deletions(-)
---
diff --git a/src/gcal-month-view.c b/src/gcal-month-view.c
index 530a2ad..79f9000 100644
--- a/src/gcal-month-view.c
+++ b/src/gcal-month-view.c
@@ -133,6 +133,9 @@ 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,
GTK_TYPE_CONTAINER,
@@ -214,6 +217,8 @@ 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
@@ -1295,6 +1300,13 @@ gcal_month_view_clear (GcalView *view)
(GtkCallback) gtk_widget_destroy, NULL);
}
+static gboolean
+gcal_month_view_will_add_event (GcalView *view,
+ GcalEventWidget *event)
+{
+ ;
+}
+
/* Public API */
/**
* gcal_month_view_new:
diff --git a/src/gcal-view.c b/src/gcal-view.c
index 819f4a0..321c297 100644
--- a/src/gcal-view.c
+++ b/src/gcal-view.c
@@ -289,3 +289,25 @@ 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 888a50d..aeb4b69 100644
--- a/src/gcal-view.h
+++ b/src/gcal-view.h
@@ -20,10 +20,7 @@
#ifndef __GCAL_VIEW_H__
#define __GCAL_VIEW_H__
-#include <glib-object.h>
-#include <gtk/gtk.h>
-
-#include <libical/icaltime.h>
+#include "gcal-event-widget.h"
G_BEGIN_DECLS
@@ -73,6 +70,9 @@ 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);
@@ -113,6 +113,9 @@ 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 9aa5d43..716b47c 100644
--- a/src/gcal-week-view.c
+++ b/src/gcal-week-view.c
@@ -156,6 +156,9 @@ 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,
@@ -234,6 +237,8 @@ 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
@@ -1410,6 +1415,13 @@ 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 90358b3..10ad04e 100644
--- a/src/gcal-year-view.c
+++ b/src/gcal-year-view.c
@@ -131,6 +131,9 @@ 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,
GTK_TYPE_CONTAINER,
@@ -213,6 +216,8 @@ 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
@@ -1026,6 +1031,13 @@ gcal_year_view_clear (GcalView *view)
(GtkCallback) gtk_widget_destroy, NULL);
}
+static gboolean
+gcal_year_view_will_add_event (GcalView *view,
+ GcalEventWidget *event)
+{
+ ;
+}
+
/* Public API */
/**
* gcal_year_view_new:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]