[gnome-calendar/wip/pandusonu/week-view] week-grid: add stub add_event() and remove_event()
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/wip/pandusonu/week-view] week-grid: add stub add_event() and remove_event()
- Date: Wed, 7 Dec 2016 23:32:39 +0000 (UTC)
commit 8a9a58419a009123d1b5424ea2dfe0a638f99964
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Wed Dec 7 17:02:14 2016 -0200
week-grid: add stub add_event() and remove_event()
src/views/gcal-week-grid.c | 67 ++++++++++++++++++++++++++++++++++++++++++-
src/views/gcal-week-grid.h | 6 ++++
2 files changed, 71 insertions(+), 2 deletions(-)
---
diff --git a/src/views/gcal-week-grid.c b/src/views/gcal-week-grid.c
index 7b3682f..af4fd05 100644
--- a/src/views/gcal-week-grid.c
+++ b/src/views/gcal-week-grid.c
@@ -52,6 +52,15 @@ struct _GcalWeekGrid
G_DEFINE_TYPE (GcalWeekGrid, gcal_week_grid, GTK_TYPE_CONTAINER);
+enum
+{
+ PROP_0,
+ PROP_ACTIVE_DATE,
+ LAST_PROP
+};
+
+static GParamSpec* properties[LAST_PROP] = { NULL, };
+
static void
gcal_week_grid_finalize (GObject *object)
{
@@ -87,7 +96,17 @@ gcal_week_grid_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ GcalWeekGrid *self = GCAL_WEEK_GRID (object);
+
+ switch (prop_id)
+ {
+ case PROP_ACTIVE_DATE:
+ g_value_set_boxed (value, self->active_date);
+ return;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
}
static void
@@ -96,7 +115,26 @@ gcal_week_grid_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ GcalWeekGrid *self = GCAL_WEEK_GRID (object);
+ icaltimetype *old_date;
+
+ switch (prop_id)
+ {
+ case PROP_ACTIVE_DATE:
+ old_date = self->active_date;
+ self->active_date = g_value_dup_boxed (value);
+
+ //if (old_date)
+ // update_unchanged_events (self, old_date, self->active_date);
+
+ gtk_widget_queue_resize (GTK_WIDGET (self));
+
+ g_clear_pointer (&old_date, g_free);
+ return;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
}
static void
@@ -347,6 +385,14 @@ gcal_week_grid_class_init (GcalWeekGridClass *klass)
widget_class->unmap = gcal_week_grid_unmap;
widget_class->get_preferred_height = gcal_week_grid_get_preferred_height;
+ properties[PROP_ACTIVE_DATE] = g_param_spec_boxed ("active-date",
+ "Date",
+ "The active selected date",
+ ICAL_TIME_TYPE,
+ G_PARAM_CONSTRUCT | G_PARAM_READWRITE);
+
+ g_object_class_install_properties (object_class, G_N_ELEMENTS (properties), properties);
+
gtk_widget_class_set_css_name (widget_class, "calendar-view");
}
@@ -394,3 +440,20 @@ gcal_week_grid_set_current_date (GcalWeekGrid *self,
gtk_widget_queue_draw (GTK_WIDGET (self));
}
+
+void
+gcal_week_grid_add_event (GcalWeekGrid *self,
+ GcalEvent *event)
+{
+ g_return_if_fail (GCAL_IS_WEEK_GRID (self));
+
+ g_message ("Adding event '%s'", gcal_event_get_summary (event));
+}
+
+void
+gcal_week_grid_remove_event (GcalWeekGrid *self,
+ const gchar *uid)
+{
+ g_return_if_fail (GCAL_IS_WEEK_GRID (self));
+ g_message ("Removing event '%s'", uid);
+}
diff --git a/src/views/gcal-week-grid.h b/src/views/gcal-week-grid.h
index 24c764e..65738ea 100644
--- a/src/views/gcal-week-grid.h
+++ b/src/views/gcal-week-grid.h
@@ -43,6 +43,12 @@ void gcal_week_grid_set_use_24h_format (GcalWeekGrid
void gcal_week_grid_set_current_date (GcalWeekGrid *week_grid,
icaltimetype *current_date);
+void gcal_week_grid_add_event (GcalWeekGrid *self,
+ GcalEvent *event);
+
+void gcal_week_grid_remove_event (GcalWeekGrid *self,
+ const gchar *uid);
+
G_END_DECLS
#endif /* GCAL_WEEK_GRID_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]