[gnome-calendar/ui-rewrite] event-widget: add method to test equality
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/ui-rewrite] event-widget: add method to test equality
- Date: Thu, 16 Oct 2014 19:19:25 +0000 (UTC)
commit de5805a3e03165482ec7caae48200e72447c30c3
Author: Erick Pérez Castellanos <erick red gmail com>
Date: Thu Oct 16 15:11:12 2014 -0400
event-widget: add method to test equality
src/gcal-event-widget.c | 38 ++++++++++++++++++++++++++++++++++++++
src/gcal-event-widget.h | 3 +++
2 files changed, 41 insertions(+), 0 deletions(-)
---
diff --git a/src/gcal-event-widget.c b/src/gcal-event-widget.c
index f5d2c16..d946ffa 100644
--- a/src/gcal-event-widget.c
+++ b/src/gcal-event-widget.c
@@ -912,3 +912,41 @@ gcal_event_widget_get_data (GcalEventWidget *event)
return data;
}
+
+/**
+ * gcal_event_widget_equal:
+ * @widget1: an #GcalEventWidget representing an event
+ * @widget2: an #GcalEventWidget representing an event
+ *
+ * Check if two widget represent the same event.
+ *
+ * Returns: %TRUE if both widget represent the same event,
+ * false otherwise
+ **/
+gboolean
+gcal_event_widget_equal (GcalEventWidget *widget1,
+ GcalEventWidget *widget2)
+{
+ GcalEventWidgetPrivate *priv1;
+ GcalEventWidgetPrivate *priv2;
+
+ ECalComponentId *id1;
+ ECalComponentId *id2;
+
+ gboolean same_id = FALSE;
+
+ priv1 = gcal_event_widget_get_instance_private (widget1);
+ priv2 = gcal_event_widget_get_instance_private (widget2);
+
+ if (!e_source_equal (priv1->source, priv2->source))
+ return FALSE;
+
+ id1 = e_cal_component_get_id (priv1->component);
+ id2 = e_cal_component_get_id (priv2->component);
+ same_id = e_cal_component_id_equal (id1, id2);
+
+ e_cal_component_free_id (id1);
+ e_cal_component_free_id (id2);
+
+ return same_id;
+}
diff --git a/src/gcal-event-widget.h b/src/gcal-event-widget.h
index 3afc51f..5d15501 100644
--- a/src/gcal-event-widget.h
+++ b/src/gcal-event-widget.h
@@ -95,6 +95,9 @@ gboolean gcal_event_widget_get_has_reminders (GcalEventWidget *
GcalEventData* gcal_event_widget_get_data (GcalEventWidget *event);
+gboolean gcal_event_widget_equal (GcalEventWidget *widget1,
+ GcalEventWidget *widget2);
+
G_END_DECLS
#endif /* __GCAL_EVENT_WIDGET_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]