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
This commit is contained in:
committed by
Georges Basile Stavracas Neto
parent
4e262f6d5d
commit
6dd234296e
@@ -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
|
||||
@@ -1000,6 +1025,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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user