[evolution/calendar-xfb: 3/9] EMeetingAttendee: added XFB detail storing (breaks build)



commit 8abd89f57d9d233e46521c0086fbe79f8b8ee7f6
Author: Christian Hilberg <chilberg src gnome org>
Date:   Fri Nov 9 10:37:41 2012 +0100

    EMeetingAttendee: added XFB detail storing (breaks build)
    
    * added XFB details (summary, location) to the free/busy
      data
    * the data is stored as part of each EMeetingFreeBusyPeriod,
      which are in turn stored in a GArray for each attendee
    * since this array can get re-sorted while adding more busy
      periods (and thus will the start addresses of the
      EMeetingFreeBusyPeriod data segmets), earlier plans of
      keeping XFB data in a hash table separate from the GArray
      were dropped, since we cannot reliably use GArray indices
      or EMeetingFreeBusyPeriod start addresses as references
      into a separate data structure to get to the XFB data
      (which may not be carried by every EMeetingFreeBusyPeriod,
      but is optional)
    * XFB data is not fixed-length, so EMeetingXfbData (part of
      EMeetingFreeBusyPeriod) just keeps pointers to the XFB data,
      which in turn introduces the need for a GArray clearing
      function (which gets registered with the GArray and takes
      care of freeing XFB strings, if the EMeetingFreeBusyPeriod
      has any)
    * e_meeting_attendee_add_busy_period() now takes XFB data string
      arguments, each of which may be NULL (this follows the scheme
      of the other arguments to this function, i.e. adding each
      busy period detail as a separate argument)

 calendar/gui/e-meeting-attendee.c |   26 +++++++++++++++++++++++++-
 calendar/gui/e-meeting-attendee.h |    4 +++-
 2 files changed, 28 insertions(+), 2 deletions(-)
---
diff --git a/calendar/gui/e-meeting-attendee.c b/calendar/gui/e-meeting-attendee.c
index a7c4fff..1fd19c3 100644
--- a/calendar/gui/e-meeting-attendee.c
+++ b/calendar/gui/e-meeting-attendee.c
@@ -26,6 +26,7 @@
 
 #include <stdlib.h>
 #include <gtk/gtk.h>
+#include "e-meeting-utils.h"
 #include "e-meeting-attendee.h"
 
 #define E_MEETING_ATTENDEE_GET_PRIVATE(obj) \
@@ -92,6 +93,20 @@ string_is_set (gchar *string)
 }
 
 static void
+busy_periods_array_clear_func (gpointer data)
+{
+	EMeetingFreeBusyPeriod *period = (EMeetingFreeBusyPeriod *) data;
+
+	/* We're expected to clear the data segment,
+	 * but not deallocate the segment itself. The
+	 * XFB data possibly attached to the
+	 * EMeetingFreeBusyPeriod requires special
+	 * care when removing elements from the GArray
+	 */
+	e_meeting_xfb_data_clear (&(period->xfb));
+}
+
+static void
 notify_changed (EMeetingAttendee *ia)
 {
 	g_signal_emit_by_name (G_OBJECT (ia), "changed");
@@ -167,6 +182,7 @@ e_meeting_attendee_init (EMeetingAttendee *ia)
 	ia->priv->has_calendar_info = FALSE;
 
 	ia->priv->busy_periods = g_array_new (FALSE, FALSE, sizeof (EMeetingFreeBusyPeriod));
+	g_array_set_clear_func (ia->priv->busy_periods, busy_periods_array_clear_func);
 	ia->priv->busy_periods_sorted = FALSE;
 
 	g_date_clear (&ia->priv->busy_periods_start.date, 1);
@@ -814,7 +830,9 @@ e_meeting_attendee_add_busy_period (EMeetingAttendee *ia,
                                     gint end_day,
                                     gint end_hour,
                                     gint end_minute,
-                                    EMeetingFreeBusyType busy_type)
+                                    EMeetingFreeBusyType busy_type,
+                                    const gchar *summary,
+                                    const gchar *location)
 {
 	EMeetingAttendeePrivate *priv;
 	EMeetingFreeBusyPeriod period;
@@ -823,6 +841,8 @@ e_meeting_attendee_add_busy_period (EMeetingAttendee *ia,
 	g_return_val_if_fail (ia != NULL, FALSE);
 	g_return_val_if_fail (E_IS_MEETING_ATTENDEE (ia), FALSE);
 	g_return_val_if_fail (busy_type < E_MEETING_FREE_BUSY_LAST, FALSE);
+	/* summary may be NULL (optional XFB data)  */
+	/* location may be NULL (optional XFB data) */
 
 	priv = ia->priv;
 
@@ -923,6 +943,10 @@ e_meeting_attendee_add_busy_period (EMeetingAttendee *ia,
 		}
 	}
 
+	/* Setting of extended free/busy (XFB) data, if we have any. */
+	e_meeting_xfb_data_init (&(period.xfb));
+	e_meeting_xfb_data_set (&(period.xfb), summary, location);
+
 	g_array_append_val (priv->busy_periods, period);
 
 	period_in_days =
diff --git a/calendar/gui/e-meeting-attendee.h b/calendar/gui/e-meeting-attendee.h
index 27e3f35..12ab658 100644
--- a/calendar/gui/e-meeting-attendee.h
+++ b/calendar/gui/e-meeting-attendee.h
@@ -142,7 +142,9 @@ gboolean e_meeting_attendee_add_busy_period (EMeetingAttendee *ia,
 					gint end_day,
 					gint end_hour,
 					gint end_minute,
-					EMeetingFreeBusyType busy_type);
+					EMeetingFreeBusyType busy_type,
+					const gchar *summary,
+					const gchar *location);
 
 EMeetingTime e_meeting_attendee_get_start_busy_range (EMeetingAttendee *ia);
 EMeetingTime e_meeting_attendee_get_end_busy_range (EMeetingAttendee *ia);



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