[gnome-calendar/ui-rewrite] gcal-event-widget: added :date-end property



commit a83591da93ff89664191b7e57d1659b0250d98c7
Author: Erick Pérez Castellanos <erick red gmail com>
Date:   Wed Jun 12 11:57:29 2013 -0400

    gcal-event-widget: added :date-end property
    
    Added get/set accesors methods.

 src/gcal-event-widget.c |   62 +++++++++++++++++++++++++++++++++++++++++-----
 src/gcal-event-widget.h |    5 ++++
 2 files changed, 60 insertions(+), 7 deletions(-)
---
diff --git a/src/gcal-event-widget.c b/src/gcal-event-widget.c
index 18ad2a8..e9ad2be 100644
--- a/src/gcal-event-widget.c
+++ b/src/gcal-event-widget.c
@@ -22,14 +22,16 @@
 
 struct _GcalEventWidgetPrivate
 {
-  GdkWindow    *event_window;
-
+  /* properties */
   gchar        *uuid;
   gchar        *summary;
   GdkRGBA      *color;
   icaltimetype *dt_start;
+  icaltimetype *dt_end;
   gboolean      all_day;
   gboolean      has_reminders;
+
+  GdkWindow    *event_window;
 };
 
 enum
@@ -39,6 +41,7 @@ enum
   PROP_SUMMARY,
   PROP_COLOR,
   PROP_DTSTART,
+  PROP_DTEND,
   PROP_ALL_DAY,
   PROP_HAS_REMINDERS
 };
@@ -149,6 +152,15 @@ gcal_event_widget_class_init(GcalEventWidgetClass *klass)
                                                        G_PARAM_READWRITE));
 
   g_object_class_install_property (object_class,
+                                   PROP_DTEND,
+                                   g_param_spec_boxed ("date-end",
+                                                       "Date End",
+                                                       "The end date of the event",
+                                                       ICAL_TIME_TYPE,
+                                                       G_PARAM_CONSTRUCT |
+                                                       G_PARAM_READWRITE));
+
+  g_object_class_install_property (object_class,
                                    PROP_ALL_DAY,
                                    g_param_spec_boolean ("all-day",
                                                          "All day",
@@ -247,6 +259,12 @@ gcal_event_widget_set_property (GObject      *object,
 
       priv->dt_start = g_value_dup_boxed (value);
       return;
+    case PROP_DTEND:
+      if (priv->dt_end != NULL)
+        g_free (priv->dt_end);
+
+      priv->dt_end = g_value_dup_boxed (value);
+      return;
     case PROP_ALL_DAY:
       priv->all_day = g_value_get_boolean (value);
       return;
@@ -282,6 +300,9 @@ gcal_event_widget_get_property (GObject      *object,
     case PROP_DTSTART:
       g_value_set_boxed (value, priv->dt_start);
       return;
+    case PROP_DTEND:
+      g_value_set_boxed (value, priv->dt_end);
+      return;
     case PROP_ALL_DAY:
       g_value_set_boolean (value, priv->all_day);
       return;
@@ -588,8 +609,6 @@ void
 gcal_event_widget_set_date (GcalEventWidget    *event,
                             const icaltimetype *date)
 {
-  g_return_if_fail (GCAL_IS_EVENT_WIDGET (event));
-
   g_object_set (event, "date-start", date, NULL);
 }
 
@@ -599,19 +618,48 @@ gcal_event_widget_set_date (GcalEventWidget    *event,
  *
  * Return the starting date of the event
  *
- * Returns: (transfer full): Release with g_free
+ * Returns: (transfer full): Release with g_free()
  **/
 icaltimetype*
 gcal_event_widget_get_date (GcalEventWidget *event)
 {
   icaltimetype *dt;
 
-  g_return_val_if_fail (GCAL_IS_EVENT_WIDGET (event), NULL);
-
   g_object_get (event, "date-start", &dt, NULL);
   return dt;
 }
 
+/**
+ * gcal_event_widget_set_end_date:
+ * @event: a #GcalEventWidget
+ * @date: a #icaltimetype object with the date
+ *
+ * Set the end date of the event
+ **/
+void
+gcal_event_widget_set_end_date (GcalEventWidget    *event,
+                                const icaltimetype *date)
+{
+  g_object_set (event, "date-end", date, NULL);
+}
+
+/**
+ * gcal_event_widget_get_end_date:
+ * @event: a #GcalEventWidget
+ *
+ * Return the end date of the event
+ *
+ * Returns: (transfer full): Release with g_free()
+ **/
+icaltimetype*
+gcal_event_widget_get_end_date (GcalEventWidget *event)
+{
+  icaltimetype *dt;
+
+  g_object_get (event, "date-end", &dt, NULL);
+  return dt;
+}
+
 void
 gcal_event_widget_set_summary (GcalEventWidget *event,
                                gchar           *summary)
diff --git a/src/gcal-event-widget.h b/src/gcal-event-widget.h
index 5ce3154..fb39aa7 100644
--- a/src/gcal-event-widget.h
+++ b/src/gcal-event-widget.h
@@ -67,6 +67,11 @@ void          gcal_event_widget_set_date                   (GcalEventWidget    *
 
 icaltimetype* gcal_event_widget_get_date                   (GcalEventWidget    *event);
 
+void          gcal_event_widget_set_end_date               (GcalEventWidget    *event,
+                                                            const icaltimetype *date);
+
+icaltimetype* gcal_event_widget_get_end_date               (GcalEventWidget    *event);
+
 void          gcal_event_widget_set_summary                (GcalEventWidget    *event,
                                                             gchar              *summary);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]