[gnome-calendar] event: add recurrence property & has-recurrence function
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] event: add recurrence property & has-recurrence function
- Date: Thu, 18 May 2017 17:52:05 +0000 (UTC)
commit 6dd234296e4d36fbe02262058877b7ef722936cb
Author: Yash Singh <yashdev10p gmail com>
Date: Thu May 18 01:07:21 2017 +0530
event: add recurrence property & has-recurrence function
Recurrence property of the event enables us to add recurrences
to it in the future. It is the first step in that direction.
https://bugzilla.gnome.org/show_bug.cgi?id=782755
src/gcal-event.c | 41 +++++++++++++++++++++++++++++++++++++++++
src/gcal-event.h | 2 ++
2 files changed, 43 insertions(+), 0 deletions(-)
---
diff --git a/src/gcal-event.c b/src/gcal-event.c
index d3e632c..b0fe2e8 100644
--- a/src/gcal-event.c
+++ b/src/gcal-event.c
@@ -80,6 +80,7 @@ struct _GcalEvent
GObject parent;
gchar *uid;
+ gboolean has_recurrence;
/*
* The description is cached in the class because it
@@ -125,6 +126,7 @@ enum {
PROP_SUMMARY,
PROP_TIMEZONE,
PROP_UID,
+ PROP_HAS_RECURRENCE,
N_PROPS
};
@@ -363,9 +365,13 @@ gcal_event_set_component_internal (GcalEvent *self,
/* Setup UID */
gcal_event_update_uid_internal (self);
+ /* Set has-recurrence to check if the component has recurrence or not */
+ self->has_recurrence = e_cal_component_has_recurrences(component);
+
/* Load and setup the alarms */
load_alarms (self);
+ g_object_notify (G_OBJECT (self), "has-recurrence");
g_object_notify (G_OBJECT (self), "component");
g_object_notify (G_OBJECT (self), "location");
g_object_notify (G_OBJECT (self), "summary");
@@ -481,6 +487,10 @@ gcal_event_get_property (GObject *object,
g_value_set_string (value, self->uid);
break;
+ case PROP_HAS_RECURRENCE:
+ g_value_set_boolean (value, self->has_recurrence);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -692,6 +702,21 @@ gcal_event_class_init (GcalEventClass *klass)
"The unique identifier of the event",
"",
G_PARAM_READABLE));
+
+ /**
+ * GcalEvent::has-recurrence:
+ *
+ * The recurrence property of the event.
+ */
+ g_object_class_install_property (object_class,
+ PROP_HAS_RECURRENCE,
+ g_param_spec_boolean ("has-recurrence",
+ "If event has recurrence",
+ "Whether the event has recurrence or not",
+ FALSE,
+ G_PARAM_READABLE));
+
+
}
static void
@@ -1001,6 +1026,22 @@ gcal_event_set_description (GcalEvent *self,
}
/**
+ * gcal_event_has_recurrence:
+ * @self: a #GcalEvent
+ *
+ * Returns whether the event has recurrences or not.
+ *
+ * Returns: %TRUE if @self has recurrences, %FALSE otherwise
+ */
+gboolean
+gcal_event_has_recurrence (GcalEvent *self)
+{
+ g_return_val_if_fail (GCAL_IS_EVENT (self), FALSE);
+
+ return e_cal_component_has_recurrences (self->component);
+}
+
+/**
* gcal_event_has_alarms:
* @self: a #GcalEvent
*
diff --git a/src/gcal-event.h b/src/gcal-event.h
index 3fe6d96..f2b9d3b 100644
--- a/src/gcal-event.h
+++ b/src/gcal-event.h
@@ -76,6 +76,8 @@ const gchar* gcal_event_get_description (GcalEvent
void gcal_event_set_description (GcalEvent *self,
const gchar *description);
+gboolean gcal_event_has_recurrence (GcalEvent *self);
+
gboolean gcal_event_has_alarms (GcalEvent *self);
GList* gcal_event_get_alarms (GcalEvent *self);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]