evolution-sharp r197 - in branches/0_18: . evolution evolution/src
- From: jjohnny svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution-sharp r197 - in branches/0_18: . evolution evolution/src
- Date: Fri, 7 Nov 2008 11:37:10 +0000 (UTC)
Author: jjohnny
Date: Fri Nov 7 11:37:09 2008
New Revision: 197
URL: http://svn.gnome.org/viewvc/evolution-sharp?rev=197&view=rev
Log:
Fixes and Recurrence support from Chenthill <pchenthill novell com> .
Modified:
branches/0_18/ChangeLog
branches/0_18/evolution/Cal.custom
branches/0_18/evolution/CalBackend.custom
branches/0_18/evolution/CalBackendCache.custom
branches/0_18/evolution/Evolution.metadata
branches/0_18/evolution/Icaltimetype.custom
branches/0_18/evolution/Makefile.am
branches/0_18/evolution/TestCache.cs
branches/0_18/evolution/TestCal.cs
branches/0_18/evolution/evolution-api.raw
branches/0_18/evolution/src/CalComponent.cs
branches/0_18/evolution/src/CalComponentDateTime.cs
branches/0_18/evolution/src/CalRecurrence.cs
branches/0_18/evolution/src/CalUtil.cs
Modified: branches/0_18/evolution/Cal.custom
==============================================================================
--- branches/0_18/evolution/Cal.custom (original)
+++ branches/0_18/evolution/Cal.custom Fri Nov 7 11:37:09 2008
@@ -9,6 +9,17 @@
return ret;
}
+ [DllImport("ecal")]
+ static extern unsafe bool e_cal_set_mode (IntPtr raw, CalMode mode);
+
+ public unsafe bool SetMode (CalMode mode)
+ {
+ bool raw_ret = e_cal_set_mode (Handle, mode);
+ bool ret = raw_ret;
+
+ return ret;
+ }
+
public Evolution.CalComponent[] GetItems (string query)
{
IntPtr ecal_objects = IntPtr.Zero;
Modified: branches/0_18/evolution/CalBackend.custom
==============================================================================
--- branches/0_18/evolution/CalBackend.custom (original)
+++ branches/0_18/evolution/CalBackend.custom Fri Nov 7 11:37:09 2008
@@ -20,14 +20,12 @@
}
[DllImport("edatacal")]
- static extern void e_cal_backend_notify_object_removed (IntPtr backend, IntPtr id, IntPtr old_object, IntPtr objekt);
+ static extern void e_cal_backend_notify_object_removed (IntPtr backend, IntPtr id, string old_object, string objekt);
- public void NotifyObjectRemoved (IntPtr id, string old_object, string objekt) {
- IntPtr native_old_object = GLib.Marshaller.StringToPtrGStrdup (old_object);
- IntPtr native_objekt = GLib.Marshaller.StringToPtrGStrdup (objekt);
- e_cal_backend_notify_object_removed (Handle, id, native_old_object, native_objekt);
- GLib.Marshaller.Free (native_old_object);
- GLib.Marshaller.Free (native_objekt);
+ public void NotifyObjectRemoved (CalComponentId id, string oldObject, string newObject) {
+ IntPtr native_id = GLib.Marshaller.StructureToPtrAlloc (id);
+ e_cal_backend_notify_object_removed (Handle, native_id, oldObject, newObject);
+ GLib.Marshaller.Free (native_id);
}
[GLib.CDeclCallback]
Modified: branches/0_18/evolution/CalBackendCache.custom
==============================================================================
--- branches/0_18/evolution/CalBackendCache.custom (original)
+++ branches/0_18/evolution/CalBackendCache.custom Fri Nov 7 11:37:09 2008
@@ -3,18 +3,80 @@
public CalComponent GetComponent (string uid, string rid) {
IntPtr obj;
- CalComponent comp;
+ CalComponent comp = null;
IntPtr native_uid = GLib.Marshaller.StringToPtrGStrdup (uid);
IntPtr native_rid = GLib.Marshaller.StringToPtrGStrdup (rid);
obj = e_cal_backend_cache_get_component (Handle, native_uid, native_rid);
- comp = new CalComponent (obj);
+ if (obj != IntPtr.Zero)
+ comp = new CalComponent (obj);
GLib.Marshaller.Free (native_uid);
GLib.Marshaller.Free (native_rid);
return comp;
}
+
+ [DllImport("libglib-2.0.so.0")]
+ static extern int g_list_length (IntPtr slist);
+
+ [DllImport("glibsharpglue-2")]
+ static extern IntPtr gtksharp_list_get_data (IntPtr slist);
+
+ [DllImport("glibsharpglue-2")]
+ static extern IntPtr gtksharp_list_get_next (IntPtr slist);
+
+ [DllImport("libglib-2.0.so.0")]
+ static extern void g_list_free (IntPtr slist);
+
+
+ [DllImport("edatacal")]
+ static extern IntPtr e_cal_backend_cache_get_components (IntPtr cache);
+
+ public CalComponent [] Components
+ {
+ get
+ {
+ IntPtr list = e_cal_backend_cache_get_components (Handle);
+ int i = 0;
+ IntPtr iter = IntPtr.Zero;
+
+ int len = g_list_length (list);
+ CalComponent[] compArray = new CalComponent [len];
+
+ for (i = 0, iter=list; iter != IntPtr.Zero; iter = gtksharp_list_get_next (iter), i++)
+ {
+ IntPtr comp = gtksharp_list_get_data (iter);
+ compArray[i] = new CalComponent (comp);
+ }
+ g_list_free (list);
+
+ return compArray;
+
+ }
+ }
+
+ [DllImport("edatacal")]
+ static extern IntPtr e_cal_backend_cache_get_components_by_uid (IntPtr cache, string uid);
+
+ public CalComponent [] ComponentsByUid (string uid)
+ {
+ IntPtr list = e_cal_backend_cache_get_components_by_uid (Handle, uid);
+ int i = 0;
+ IntPtr iter = IntPtr.Zero;
+
+ int len = g_list_length (list);
+ CalComponent[] compArray = new CalComponent [len];
+
+ for (i = 0, iter=list; iter != IntPtr.Zero; iter = gtksharp_list_get_next (iter), i++)
+ {
+ IntPtr comp = gtksharp_list_get_data (iter);
+ compArray[i] = new CalComponent (comp);
+ }
+ g_list_free (list);
+
+ return compArray;
+ }
[DllImport("edatacal")]
static extern bool e_cal_backend_cache_put_component (IntPtr cache, IntPtr comp);
Modified: branches/0_18/evolution/Evolution.metadata
==============================================================================
--- branches/0_18/evolution/Evolution.metadata (original)
+++ branches/0_18/evolution/Evolution.metadata Fri Nov 7 11:37:09 2008
@@ -60,7 +60,8 @@
<attr path="/api/namespace/struct[ cname='EDataCal']" name="hidden">1</attr>
<attr path="/api/namespace/struct[ cname='EDataCalClass']" name="hidden">1</attr>
<attr path="/api/namespace/object[ name='']" name="hidden">1</attr>
- <attr path="/api/namespace/struct[ name='Icaltimetype']" name="opaque">true</attr>
+ <attr path="/api/namespace/object[ name='CalBackendCache']/method[ name='GetComponents']" name="hidden">1</attr>
+ <attr path="/api/namespace/object[ name='CalBackendCache']/method[ name='GetComponentsByUid']" name="hidden">1</attr>
<attr path="/api/namespace" name="name">Evolution</attr>
<!-- Using custom for these signals because of BGO#555242 -->
Modified: branches/0_18/evolution/Icaltimetype.custom
==============================================================================
--- branches/0_18/evolution/Icaltimetype.custom (original)
+++ branches/0_18/evolution/Icaltimetype.custom Fri Nov 7 11:37:09 2008
@@ -1,143 +1,28 @@
- [DllImport("evolutionglue")]
- public static extern IntPtr e_cal_alloc_icaltimetype ();
-
- public Icaltimetype ()
+ public DateTime AsDateTimeUtc
{
- Raw = e_cal_alloc_icaltimetype ();
- }
-
- [DllImport("evolutionglue")]
- public static extern void e_cal_glue_set_itt_month (IntPtr dt, int month);
-
- [DllImport("evolutionglue")]
- public static extern void e_cal_glue_set_itt_day (IntPtr dt, int day);
- [DllImport("evolutionglue")]
- public static extern void e_cal_glue_set_itt_year (IntPtr dt, int year);
- [DllImport("evolutionglue")]
- public static extern void e_cal_glue_set_itt_minute (IntPtr dt, int minute);
- [DllImport("evolutionglue")]
- public static extern void e_cal_glue_set_itt_second (IntPtr dt, int second);
- [DllImport("evolutionglue")]
- public static extern void e_cal_glue_set_itt_hour (IntPtr dt, int hour);
- [DllImport("evolutionglue")]
- public static extern void e_cal_glue_set_itt_is_utc (IntPtr dt, int is_utc);
- [DllImport("evolutionglue")]
- public static extern void e_cal_glue_set_itt_is_day (IntPtr dt, int is_day);
- [DllImport("evolutionglue")]
- public static extern void e_cal_glue_set_itt_is_daylight (IntPtr dt, int is_daylight);
- [DllImport("evolutionglue")]
- public static extern void e_cal_glue_set_itt_zone (IntPtr dt, IntPtr zone);
-
- [DllImport("evolutionglue")]
- public static extern int e_cal_glue_get_itt_month (IntPtr dt);
- [DllImport("evolutionglue")]
- public static extern int e_cal_glue_get_itt_day (IntPtr dt);
- [DllImport("evolutionglue")]
- public static extern int e_cal_glue_get_itt_year (IntPtr dt);
- [DllImport("evolutionglue")]
- public static extern int e_cal_glue_get_itt_hour (IntPtr dt);
- [DllImport("evolutionglue")]
- public static extern int e_cal_glue_get_itt_minute (IntPtr dt);
- [DllImport("evolutionglue")]
- public static extern int e_cal_glue_get_itt_second (IntPtr dt);
- [DllImport("evolutionglue")]
- public static extern int e_cal_glue_get_itt_is_utc (IntPtr dt);
- [DllImport("evolutionglue")]
- public static extern int e_cal_glue_get_itt_is_daylight (IntPtr dt);
- [DllImport("evolutionglue")]
- public static extern int e_cal_glue_get_itt_is_day (IntPtr dt);
- [DllImport("evolutionglue")]
- public static extern IntPtr e_cal_glue_get_itt_zone (IntPtr dt);
-
- public int Month {
- get {
- return e_cal_glue_get_itt_month (Raw);
- }
- set {
- e_cal_glue_set_itt_month (Raw, value);
- }
- }
-
- public int Year {
- get {
- return e_cal_glue_get_itt_year (Raw);
- }
- set {
- e_cal_glue_set_itt_year (Raw, value);
- }
- }
-
- public int Day {
- get {
- return e_cal_glue_get_itt_day (Raw);
- }
- set {
- e_cal_glue_set_itt_day (Raw, value);
- }
- }
-
- public int Hour {
- get {
- return e_cal_glue_get_itt_hour (Raw);
- }
- set {
- e_cal_glue_set_itt_hour (Raw, value);
- }
- }
-
-
- public int Minute {
- get {
- return e_cal_glue_get_itt_minute (Raw);
- }
- set {
- e_cal_glue_set_itt_minute (Raw, value);
- }
- }
-
- public int Second {
- get {
- return e_cal_glue_get_itt_second (Raw);
- }
- set {
- e_cal_glue_set_itt_second (Raw, value);
- }
- }
-
- public int Isutc {
- get {
- return e_cal_glue_get_itt_is_utc (Raw);
- }
- set {
- e_cal_glue_set_itt_is_utc (Raw, value);
+ get
+ {
+ IntPtr raw = GLib.Marshaller.StructureToPtrAlloc (this);
+ DateTime dt = CalUtil.icaltimetype_to_datetime (raw, false);
+ Marshal.FreeHGlobal (raw);
+ return dt;
}
}
- public int IsDay {
- get {
- return e_cal_glue_get_itt_is_day (Raw);
- }
- set {
- e_cal_glue_set_itt_is_day (Raw, value);
- }
- }
-
- public int IsDayLight {
- get {
- return e_cal_glue_get_itt_is_daylight (Raw);
- }
- set {
- e_cal_glue_set_itt_is_daylight (Raw, value);
- }
- }
-
- public Icaltimezone Zone {
- get {
- IntPtr raw = e_cal_glue_get_itt_zone (Raw);
+ public DateTime SetDateTime
+ {
+ set
+ {
+ Year = value.Year;
+ Month = value.Month;
+ Day = value.Day;
+ Hour = value.Hour;
+ Second = value.Second;
+ Minute = value.Minute;
+ /*Fixme : Needs Mono 2.0*/
+ //IsDayLight = Convert.ToInt32 (TimeZone.CurrentTimeZone.IsDaylightSavingTime (value));
- return new Icaltimezone (raw);
+ //if (value.Kind == DateTimeKind.Utc)
+ IsUtc = 1;
}
- set {
- e_cal_glue_set_itt_zone (Raw, value.Handle);
- }
- }
+ }
Modified: branches/0_18/evolution/Makefile.am
==============================================================================
--- branches/0_18/evolution/Makefile.am (original)
+++ branches/0_18/evolution/Makefile.am Fri Nov 7 11:37:09 2008
@@ -21,7 +21,7 @@
if USE_EDS_2_24
RAW_API = evolution-api.raw
CUSTOMS_2_24 = Icaltimetype.custom CalBackend.custom CalBackendCache.custom CalBackendSExp.custom
-SOURCES_2_24 = src/CalComponentDateTime.cs
+SOURCES_2_24 = src/CalComponentDateTime.cs src/CalCompChanges.cs
CSFLAGS = -define:USE_EDS_2_24
endif
Modified: branches/0_18/evolution/TestCache.cs
==============================================================================
--- branches/0_18/evolution/TestCache.cs (original)
+++ branches/0_18/evolution/TestCache.cs Fri Nov 7 11:37:09 2008
@@ -17,15 +17,16 @@
/* Creating an Event */
comp.Summary = "1st event";
+ Icaltimezone zon = Icaltimezone.GetBuiltinTimezone ("America/New_York");
CalComponentDateTime dt = new CalComponentDateTime ();
- DateTime n = DateTime.Now;
- Icaltimetype t = dt.value;
- t.Year = n.Year;
- t.Month = n.Month;
- t.Day = n.Day;
- t.Hour = n.Hour;
- t.Second = n.Second;
- Icaltimezone zon = Icaltimezone.GetBuiltinTimezone ("Asia/Kolkata");
+ Icaltimetype icalt= new Icaltimetype ();
+ DateTime n = DateTime.Now.ToUniversalTime ();
+ icalt.SetDateTime = n;
+ icalt.IsUtc = 1;
+ Console.WriteLine ("Before " + icalt.Hour + icalt.Minute);
+ Icaltimezone.ConvertTime (icalt, Icaltimezone.UtcTimezone, zon);
+ Console.WriteLine ("After " + icalt.Hour + icalt.Minute);
+ dt.IcalTime = icalt;
dt.Tzid = zon.Tzid;
comp.DtStart = dt;
@@ -35,20 +36,26 @@
uid = comp.Uid;
/* Inserting a default zone */
- Icaltimezone zone = Icaltimezone.GetBuiltinTimezone ("Asia/Kolkata");
- cache.PutDefaultTimezone (zone);
+ cache.PutDefaultTimezone (zon);
/* Printing the default zone */
Icaltimezone dzone = cache.DefaultTimezone;
string dStr = "Default zone is cache is " + dzone.Location + "\n";
Console.WriteLine (dStr);
+ Console.WriteLine ("Get all components ");
+ CalComponent[] comps = cache.Components;
+ Console.WriteLine (comps.Length);
+ foreach (CalComponent c in comps)
+ {
+ Console.WriteLine (c.GetAsString ());
+ }
+
/* Printing the component */
CalComponent cacheComp = cache.GetComponent (uid, null);
- Console.WriteLine(cacheComp.GetAsString ());
dt = cacheComp.DtStart;
Console.WriteLine("The value of DateTime from Cache \n");
- string dts = "\n" + dt.value.Year + dt.value.Month + dt.value.Day + dt.value.Hour + " " + dt.Tzid;
+ string dts = "\n" + dt.IcalTime.Year + dt.IcalTime.Month + dt.IcalTime.Day + dt.IcalTime.Hour + " " + dt.Tzid;
Console.WriteLine(dts);
Console.WriteLine("Removing the cache!");
Modified: branches/0_18/evolution/TestCal.cs
==============================================================================
--- branches/0_18/evolution/TestCal.cs (original)
+++ branches/0_18/evolution/TestCal.cs Fri Nov 7 11:37:09 2008
@@ -45,22 +45,49 @@
Console.WriteLine ("Location: {0}", comp.Location);
Console.WriteLine ("summary: {0}", comp.Summary);
- Console.WriteLine( "Attendee:" );
- foreach (CalComponentAttendee att in comp.Attendees) {
- Console.WriteLine ("value: \"{0}\"", att.value);
- Console.WriteLine ("member: \"{0}\"", att.member);
- Console.WriteLine ("cutype: \"{0}\"", att.cutype);
- Console.WriteLine ("role: \"{0}\"", att.role);
- Console.WriteLine ("status: \"{0}\"", att.status);
- Console.WriteLine ("rsvp: \"{0}\"", att.rsvp);
- Console.WriteLine ("delto: \"{0}\"", att.delto);
- Console.WriteLine ("delfrom: \"{0}\"", att.delfrom);
- Console.WriteLine ("sentby: \"{0}\"", att.sentby);
- Console.WriteLine ("cn: \"{0}\"", att.cn);
- Console.WriteLine ("language: \"{0}\"", att.language);
- Console.WriteLine ("-----------");
- }
- }
+ Console.WriteLine( "Attendee:" );
+ foreach (CalComponentAttendee att in comp.Attendees) {
+ Console.WriteLine ("value: \"{0}\"", att.value);
+ Console.WriteLine ("member: \"{0}\"", att.member);
+ Console.WriteLine ("cutype: \"{0}\"", att.cutype);
+ Console.WriteLine ("role: \"{0}\"", att.role);
+ Console.WriteLine ("status: \"{0}\"", att.status);
+ Console.WriteLine ("rsvp: \"{0}\"", att.rsvp);
+ Console.WriteLine ("delto: \"{0}\"", att.delto);
+ Console.WriteLine ("delfrom: \"{0}\"", att.delfrom);
+ Console.WriteLine ("sentby: \"{0}\"", att.sentby);
+ Console.WriteLine ("cn: \"{0}\"", att.cn);
+ Console.WriteLine ("language: \"{0}\"", att.language);
+ Console.WriteLine ("-----------");
+ }
+ if (comp.RRules == null) {
+ Console.WriteLine ("No recurrence data found");
+ return;
+ }
+ foreach (CalRecurrence recur in comp.RRules) {
+ Console.WriteLine ("--- Recurrence data starts ---");
+
+ Console.WriteLine ("Frequeny:- {0}", recur.freq);
+ Console.WriteLine ("Count:- {0}", recur.count);
+ Console.WriteLine ("Interval:- {0}", recur.interval);
+// Console.WriteLine ("Enddate:- {0}", recur.Until.DateTime);
+ Console.WriteLine ("BySecond:- {0}", recur.bySecond);
+ Console.WriteLine ("ByMinute:- {0}", recur.byMinute);
+ Console.WriteLine ("ByHour:- {0}", recur.byHour);
+ Console.WriteLine ("ByDay:- {0}", recur.byDay);
+ Console.WriteLine ("ByMonthDay:- {0}", recur.byMonthDay);
+ Console.WriteLine ("ByYearDay:- {0}", recur.byYearDay);
+ Console.WriteLine ("ByWeekNumber:- {0}", recur.byWeekNumber);
+ Console.WriteLine ("ByMonth:- {0}", recur.byMonth);
+ Console.WriteLine ("BySetPos:- {0}", recur.bySetPos);
+
+ Console.WriteLine ("--- Recurrence Data ends ---");
+ Console.WriteLine ("Recur string: \"{0}\"", recur.ToString());
+ }
+
+ }
+
+
Console.WriteLine ("Returning from addedComp");
}
@@ -233,32 +260,31 @@
Console.WriteLine ("language: \"{0}\"", att.language);
Console.WriteLine ("-----------");
}
-#if false
- if (comp.RecurrenceRules == null) {
- Console.WriteLine ("No recurrence data found");
- return;
- }
- foreach (CalRecurrence recur in comp.RecurrenceRules) {
- Console.WriteLine ("--- Recurrence data starts ---");
-
- Console.WriteLine ("Frequeny:- {0}", recur.Frequency);
- Console.WriteLine ("Count:- {0}", recur.Count);
- Console.WriteLine ("Interval:- {0}", recur.Interval);
- Console.WriteLine ("Enddate:- {0}", recur.Enddate);
- Console.WriteLine ("BySecond:- {0}", recur.BySecond);
- Console.WriteLine ("ByMinute:- {0}", recur.BySecond);
- Console.WriteLine ("ByHour:- {0}", recur.ByHour);
- Console.WriteLine ("ByDay:- {0}", recur.ByDay);
- Console.WriteLine ("ByMonthDay:- {0}", recur.ByMonthDay);
- Console.WriteLine ("ByYearDay:- {0}", recur.ByYearDay);
- Console.WriteLine ("ByWeekNumber:- {0}", recur.ByWeekNumber);
- Console.WriteLine ("ByMonth:- {0}", recur.ByMonth);
- Console.WriteLine ("BySetPos:- {0}", recur.BySetPos);
-
- Console.WriteLine ("--- Recurrence Data ends ---");
- Console.WriteLine ("Recur string: \"{0}\"", recur.ToString());
- }
-#endif
+
+ if (comp.RRules == null) {
+ Console.WriteLine ("No recurrence data found");
+ return;
+ }
+ foreach (CalRecurrence recur in comp.RRules) {
+ Console.WriteLine ("--- Recurrence data starts ---");
+
+ Console.WriteLine ("Frequeny:- {0}", recur.Frequency);
+ Console.WriteLine ("Count:- {0}", recur.Count);
+ Console.WriteLine ("Interval:- {0}", recur.Interval);
+ Console.WriteLine ("Enddate:- {0}", recur.Enddate);
+ Console.WriteLine ("BySecond:- {0}", recur.BySecond);
+ Console.WriteLine ("ByMinute:- {0}", recur.BySecond);
+ Console.WriteLine ("ByHour:- {0}", recur.ByHour);
+ Console.WriteLine ("ByDay:- {0}", recur.ByDay);
+ Console.WriteLine ("ByMonthDay:- {0}", recur.ByMonthDay);
+ Console.WriteLine ("ByYearDay:- {0}", recur.ByYearDay);
+ Console.WriteLine ("ByWeekNumber:- {0}", recur.ByWeekNumber);
+ Console.WriteLine ("ByMonth:- {0}", recur.ByMonth);
+ Console.WriteLine ("BySetPos:- {0}", recur.BySetPos);
+
+ Console.WriteLine ("--- Recurrence Data ends ---");
+ Console.WriteLine ("Recur string: \"{0}\"", recur.ToString());
+ }
#if false
if (comp.ExceptionRules != null) {
Console.WriteLine ("No exception rules present");
Modified: branches/0_18/evolution/evolution-api.raw
==============================================================================
--- branches/0_18/evolution/evolution-api.raw (original)
+++ branches/0_18/evolution/evolution-api.raw Fri Nov 7 11:37:09 2008
@@ -3601,22 +3601,22 @@
<return-type type="icalcomponent*" />
</method>
<method name="GetDisplayName" cname="icaltimezone_get_display_name">
- <return-type type="char*" />
+ <return-type type="const-char*" />
</method>
<method name="GetLatitude" cname="icaltimezone_get_latitude">
<return-type type="double" />
</method>
<method name="GetLocation" cname="icaltimezone_get_location">
- <return-type type="char*" />
+ <return-type type="const-char*" />
</method>
<method name="GetLongitude" cname="icaltimezone_get_longitude">
<return-type type="double" />
</method>
<method name="GetTzid" cname="icaltimezone_get_tzid">
- <return-type type="char*" />
+ <return-type type="const-char*" />
</method>
<method name="GetTznames" cname="icaltimezone_get_tznames">
- <return-type type="char*" />
+ <return-type type="const-char*" />
</method>
<method name="GetUtcOffset" cname="icaltimezone_get_utc_offset">
<return-type type="int" />
Modified: branches/0_18/evolution/src/CalComponent.cs
==============================================================================
--- branches/0_18/evolution/src/CalComponent.cs (original)
+++ branches/0_18/evolution/src/CalComponent.cs Fri Nov 7 11:37:09 2008
@@ -10,7 +10,16 @@
Private,
Confidental,
}
-
+
+#if USE_EDS_2_24
+ public enum CalTransparency : int {
+ None,
+ Transparent,
+ Opaque,
+ Unknown,
+ }
+#endif
+
public enum CalPriority : int {
Undefined = 0,
High = 3,
@@ -47,6 +56,20 @@
FreeBusy,
TimeZone
}
+
+#if USE_EDS_2_24
+ public enum CalComponentRangeType {
+ Single,
+ ThisPrior,
+ ThisFuture
+ }
+
+ public struct CalComponentRange {
+ public CalComponentRangeType rangeType;
+ public CalComponentDateTime dt;
+ }
+
+#endif
public struct CalComponentText {
public string value;
@@ -129,6 +152,8 @@
static extern IntPtr e_cal_component_new ();
[DllImport("ecal")]
static extern void e_cal_component_set_new_vtype (IntPtr handle, CalComponentVType type);
+ [DllImport("ecal")]
+ static extern IntPtr e_cal_component_new_from_string (string calobj);
public CalComponent ()
{
@@ -136,6 +161,13 @@
handle = e_cal_component_new ();
ecal = null;
}
+
+ public CalComponent (string calobj)
+ {
+ new_component = true;
+ handle = e_cal_component_new_from_string (calobj);
+ ecal = null;
+ }
public CalComponent (Cal _ecal)
{
@@ -247,6 +279,50 @@
}
}
+#if USE_EDS_2_24
+ [DllImport("ecal")]
+ static extern void e_cal_component_get_recurid (IntPtr handle, out IntPtr recurid);
+ [DllImport("ecal")]
+ static extern void e_cal_component_set_recurid (IntPtr handle, IntPtr recurid);
+
+ public DateTime Rid {
+ get
+ {
+ IntPtr native_r = IntPtr.Zero;
+ e_cal_component_get_recurid (Handle, out native_r);
+ CalComponentRange range = (CalComponentRange) Marshal.PtrToStructure (native_r,
+ typeof (CalComponentRange));
+
+ CalComponentDateTime cdt = range.dt;
+ Icaltimetype icalt = cdt.IcalTime;
+ DateTime dt = icalt.AsDateTimeUtc;
+
+ Marshal.FreeHGlobal (native_r);
+ return dt;
+ }
+
+ set
+ {
+ Icaltimetype icalt = new Icaltimetype ();
+ icalt.SetDateTime = value;
+
+ CalComponentDateTime cdt = new CalComponentDateTime ();
+ cdt.IcalTime = icalt;
+ cdt.Tzid = "UTC";
+
+ CalComponentRange range = new CalComponentRange ();
+ range.rangeType = CalComponentRangeType.Single;
+ range.dt = cdt;
+
+ IntPtr raw = Marshal.AllocHGlobal (Marshal.SizeOf (range));
+ Marshal.StructureToPtr (range, raw, false);
+
+ e_cal_component_set_recurid (Handle, raw);
+ Marshal.FreeHGlobal (raw);
+ }
+ }
+#endif
+
[DllImport("ecal")]
static extern void e_cal_component_get_summary (IntPtr raw, ref CalComponentText text);
[DllImport("ecal")]
@@ -312,6 +388,26 @@
}
}
+#if USE_EDS_2_24
+ [DllImport("ecal")]
+ static extern void e_cal_component_get_transparency (IntPtr raw, ref CalTransparency trans);
+ [DllImport("ecal")]
+ static extern void e_cal_component_set_transparency (IntPtr raw, CalTransparency trans);
+
+ public CalTransparency Transparency {
+ get
+ {
+ CalTransparency tr = CalTransparency.None;
+ e_cal_component_get_transparency (Handle, ref tr);
+ return tr;
+ }
+ set
+ {
+ e_cal_component_set_transparency (Handle, value);
+ }
+ }
+#endif
+
[DllImport("ecal")]
static extern void e_cal_component_get_location (IntPtr raw, out IntPtr location);
[DllImport("ecal")]
@@ -330,6 +426,21 @@
}
}
+#if USE_EDS_2_24
+ [DllImport("ecal")]
+ static extern bool e_cal_component_is_allday (IntPtr raw);
+
+ public bool IsAllDay
+ {
+ get
+ {
+ bool ret = e_cal_component_is_allday (Handle);
+
+ return ret;
+ }
+ }
+#endif
+
[DllImport("ecal")]
static extern void e_cal_component_get_dtstart (IntPtr raw, IntPtr dt);
[DllImport("ecal")]
@@ -370,6 +481,24 @@
Marshal.FreeHGlobal (native_dt);
}
}
+
+ public CalComponentDateTime DtEnd {
+ get {
+ CalComponentDateTime dt = new CalComponentDateTime ();
+ IntPtr native_dt = GLib.Marshaller.StructureToPtrAlloc (dt);
+ e_cal_component_get_dtend(Handle, native_dt);
+ dt = (CalComponentDateTime) Marshal.PtrToStructure (native_dt, typeof (CalComponentDateTime));
+ Marshal.FreeHGlobal (native_dt);
+
+ return dt;
+ }
+ set {
+ IntPtr native_dt = GLib.Marshaller.StructureToPtrAlloc (value);
+ e_cal_component_set_dtend(Handle, native_dt);
+ Marshal.FreeHGlobal (native_dt);
+ }
+ }
+
#endif
[DllImport("ecal")]
@@ -434,6 +563,8 @@
[DllImport("ecal")]
static extern void e_cal_component_get_last_modified (IntPtr raw, out IntPtr dt);
+ [DllImport("ecal")]
+ static extern void e_cal_component_set_last_modified (IntPtr raw, IntPtr dt);
public DateTime LastModified {
get {
@@ -441,6 +572,12 @@
e_cal_component_get_last_modified (Handle, out dt);
return CalUtil.icaltimetype_to_datetime (dt, true);
}
+ set
+ {
+ IntPtr dt = CalUtil.datetime_to_icaltimetype (value);
+ e_cal_component_set_last_modified (Handle, dt);
+ CalUtil.e_cal_glue_free_icaltimetype (dt);
+ }
}
[DllImport("ecal")]
@@ -506,8 +643,7 @@
for (i = 0, iter=raw_ret; iter != IntPtr.Zero;
iter = GLibUtil.gtksharp_slist_get_next (iter), i++) {
IntPtr data = GLibUtil.gtksharp_slist_get_data (iter);
- CalComponentAttendee a = (CalComponentAttendee) Marshal.PtrToStructure (data,
- typeof (CalComponentAttendee));
+ CalComponentAttendee a = (CalComponentAttendee) Marshal.PtrToStructure (data, typeof (CalComponentAttendee));
att_ret [i] = a;
}
}
@@ -526,6 +662,25 @@
}
[DllImport("ecal")]
+ static extern void e_cal_component_get_organizer (IntPtr raw, ref CalComponentOrganizer org);
+ [DllImport("ecal")]
+ static extern void e_cal_component_set_organizer (IntPtr raw, ref CalComponentOrganizer org);
+
+ public CalComponentOrganizer Organizer {
+ get
+ {
+ CalComponentOrganizer org = new CalComponentOrganizer ();
+ e_cal_component_get_organizer (Handle, ref org);
+ return org;
+ }
+ set
+ {
+ e_cal_component_set_organizer (Handle, ref value);
+ }
+ }
+
+
+ [DllImport("ecal")]
static extern void e_cal_component_get_description_list (IntPtr raw, out IntPtr list);
[DllImport("ecal")]
static extern void e_cal_component_set_description_list (IntPtr raw, IntPtr list);
@@ -590,7 +745,8 @@
e_cal_component_get_categories_list(Handle, out raw_ret);
return CalUtil.GSListToStringArray (raw_ret, true);
}
- set {
+ set
+ {
IntPtr list = GLibUtil.StringArrayToGSList (value);
e_cal_component_set_categories_list (Handle, list);
GLibUtil.FreeGSList (list);
@@ -605,9 +761,31 @@
return ical;
}
+
+#if USE_EDS_2_24
+ [DllImport("ecal")]
+ static extern int e_cal_component_get_sequence_as_int (IntPtr handle);
+ [DllImport("ecal")]
+ static extern void e_cal_component_set_sequence (IntPtr handle, ref int set);
+ public int Sequence {
+ get
+ {
+ int ret;
+ int raw = e_cal_component_get_sequence_as_int (Handle);
+ ret = raw;
+ return ret;
+
+ }
+ set
+ {
+ e_cal_component_set_sequence (Handle, ref value);
+ }
+ }
+#endif
+
[DllImport("ecal")]
- static extern int e_cal_component_commit_sequence (IntPtr handle);
+ static extern void e_cal_component_commit_sequence (IntPtr handle);
[DllImport("ecal")]
static extern int e_cal_component_abort_sequence (IntPtr handle);
[DllImport("ecal")]
@@ -659,6 +837,163 @@
{
e_cal_glue_free_cal_component (handle);
}
+
+#if USE_EDS_2_24
+ [DllImport("ecal")]
+ static extern void e_cal_component_get_rrule_list (IntPtr handle, out IntPtr list);
+ [DllImport("ecal")]
+ static extern void e_cal_component_set_rrule_list (IntPtr handle, IntPtr list);
+
+ public CalRecurrence [] RRules
+ {
+ get
+ {
+ IntPtr raw_ret = IntPtr.Zero;
+ IntPtr iter = IntPtr.Zero;
+ int i = 0;
+ int len = 0;
+ CalRecurrence[] ret = null;
+
+ e_cal_component_get_rrule_list (Handle, out raw_ret);
+
+ if (raw_ret != IntPtr.Zero) {
+ if ((len = GLibUtil.g_slist_length (raw_ret)) > 0 ) {
+ ret = new CalRecurrence [len];
+
+ for (i = 0, iter=raw_ret; iter != IntPtr.Zero;
+ iter = GLibUtil.gtksharp_slist_get_next (iter), i++) {
+ IntPtr data = GLibUtil.gtksharp_slist_get_data (iter);
+ CalRecurrence r = (CalRecurrence) Marshal.PtrToStructure (data, typeof (CalRecurrence));
+
+ ret [i] = r;
+ }
+ }
+ GLibUtil.g_slist_free (raw_ret);
+ }
+ return ret == null ? new CalRecurrence [0] : ret;
+ }
+ set
+ {
+ IntPtr ptr = IntPtr.Zero;
+ IntPtr raw = IntPtr.Zero;
+
+ foreach (CalRecurrence r in value) {
+ ptr = Marshal.AllocHGlobal (Marshal.SizeOf (r));
+ Marshal.StructureToPtr (r, ptr, false);
+ raw = GLibUtil.g_slist_append (raw, ptr);
+ }
+
+ e_cal_component_set_rrule_list (Handle, raw);
+ GLibUtil.g_slist_free (raw);
+ }
+ }
+
+ [DllImport("ecal")]
+ static extern bool e_cal_component_has_rrules (IntPtr handle);
+ [DllImport("ecal")]
+ static extern bool e_cal_component_has_exdates (IntPtr handle);
+ [DllImport("ecal")]
+ static extern bool e_cal_component_is_instance (IntPtr handle);
+
+ public bool HasRRules
+ {
+ get {
+ bool ret = e_cal_component_has_rrules (Handle);
+ return ret;
+ }
+ }
+
+ public bool HasExDates
+ {
+ get {
+ bool ret = e_cal_component_has_exdates (Handle);
+ return ret;
+ }
+ }
+
+ public bool IsInstance
+ {
+ get
+ {
+ bool ret = e_cal_component_is_instance (Handle);
+ return ret;
+ }
+ }
+
+ [DllImport("ecal")]
+ static extern void e_cal_component_get_exdate_list (IntPtr handle, out IntPtr list);
+ [DllImport("ecal")]
+ static extern void e_cal_component_set_exdate_list (IntPtr handle, IntPtr list);
+
+ public CalComponentDateTime[] ExDates
+ {
+ get
+ {
+ IntPtr raw_ret = IntPtr.Zero;
+ IntPtr iter = IntPtr.Zero;
+ int i = 0;
+ int len = 0;
+ CalComponentDateTime [] ret = null;
+
+ e_cal_component_get_exdate_list (Handle, out raw_ret);
+ if (raw_ret != IntPtr.Zero) {
+ if ((len = GLibUtil.g_slist_length (raw_ret)) > 0 ) {
+ ret = new CalComponentDateTime [len];
+
+ for (i = 0, iter=raw_ret; iter != IntPtr.Zero;
+ iter = GLibUtil.gtksharp_slist_get_next (iter), i++) {
+ IntPtr data = GLibUtil.gtksharp_slist_get_data (iter);
+ CalComponentDateTime d = (CalComponentDateTime) Marshal.PtrToStructure (data, typeof (CalComponentDateTime));
+
+ ret [i] = d;
+ }
+ }
+ GLibUtil.g_slist_free (raw_ret);
+ }
+ return ret == null ? new CalComponentDateTime [0] : ret;
+
+ }
+ set
+ {
+ IntPtr ptr = IntPtr.Zero;
+ IntPtr raw = IntPtr.Zero;
+ foreach (CalComponentDateTime d in value) {
+ ptr = Marshal.AllocHGlobal (Marshal.SizeOf (d));
+ Marshal.StructureToPtr (d, ptr, false);
+ raw = GLibUtil.g_slist_append (raw, ptr);
+ }
+
+ e_cal_component_set_exdate_list (Handle, raw);
+ GLibUtil.g_slist_free (raw);
+ }
+ }
+
+ [DllImport("ecal")]
+ static extern void e_cal_component_set_x_prop (IntPtr handle, string name, string val);
+ [DllImport("ecal")]
+ static extern string e_cal_component_get_x_prop (IntPtr handle, string name);
+ [DllImport("ecal")]
+ static extern int e_cal_component_get_x_prop_as_int (IntPtr handle, string name);
+
+ public void SetXProp (string name, string val)
+ {
+ e_cal_component_set_x_prop (Handle, name, val);
+ }
+
+ public string GetXProp (string name)
+ {
+ string ret = e_cal_component_get_x_prop (Handle, name);
+
+ return ret;
+ }
+
+ public int GetXPropAsInt (string name)
+ {
+ int ret = e_cal_component_get_x_prop_as_int (Handle, name);
+
+ return ret;
+ }
}
+#endif
}
Modified: branches/0_18/evolution/src/CalComponentDateTime.cs
==============================================================================
--- branches/0_18/evolution/src/CalComponentDateTime.cs (original)
+++ branches/0_18/evolution/src/CalComponentDateTime.cs Fri Nov 7 11:37:09 2008
@@ -10,23 +10,22 @@
private IntPtr _value;
- public Icaltimetype value {
- get {
- return new Icaltimetype (_value); }
- set {
- _value = value.Handle;
+ public Icaltimetype IcalTime {
+ get
+ {
+ return Icaltimetype.New (_value);
+ }
+ set
+ {
+ _value = GLib.Marshaller.StructureToPtrAlloc (value);
}
}
public string Tzid;
public static CalComponentDateTime Zero = new CalComponentDateTime ();
- public CalComponentDateTime () {
- _value = CalUtil.e_cal_alloc_icaltimetype ();
- }
-
- ~CalComponentDateTime () {
- CalUtil.e_cal_free_icaltimetype (_value);
+ public CalComponentDateTime ()
+ {
}
public static CalComponentDateTime New(IntPtr raw) {
Modified: branches/0_18/evolution/src/CalRecurrence.cs
==============================================================================
--- branches/0_18/evolution/src/CalRecurrence.cs (original)
+++ branches/0_18/evolution/src/CalRecurrence.cs Fri Nov 7 11:37:09 2008
@@ -1,5 +1,6 @@
using System;
using System.Collections;
+using System.Runtime.InteropServices;
// TODO: (Also, we need exception-rules support.
// As of now, this provides a very basic support, (ie),
@@ -50,255 +51,119 @@
SET_POS
};
+ [StructLayout(LayoutKind.Sequential)]
public class CalRecurrence {
-
- static short recurrence_array_max = 0x7f7f;
- static short recurrence_array_max_byte = 0x7f;
+ public FrequencyType freq;
- IntPtr handle;
- FrequencyType freq;
- DateTime until;
- int count;
- int week_start_day;
- short interval;
- short[] by_second;
- short[] by_minute;
- short[] by_hour;
- short[] by_day;
- short[] by_month_day;
- short[] by_year_day;
- short[] by_week_no;
- short[] by_month;
- short[] by_set_pos;
-
- public CalRecurrence ()
- {
- freq = FrequencyType.FREQUENCY_NO;
- count = -1;
- week_start_day = -1;
- interval = -1;
- by_second = null;
- by_minute = null;
- by_hour = null;
- by_day = null;
- by_month_day = null;
- by_year_day = null;
- by_week_no = null;
- by_month = null;
- by_set_pos = null;
- }
+ Icaltimetype until;
+ public int count;
- public IntPtr Handle {
- get {
- return handle;
- }
- }
+ public short interval;
+
+ public WeekDayType week_start_day;
+ [MarshalAs (UnmanagedType.ByValArray, SizeConst=61)]
+ public short[] bySecond;
+
+ [MarshalAs (UnmanagedType.ByValArray, SizeConst=61)]
+ public short[] byMinute;
- public FrequencyType Frequency {
- get {
- return freq;
- }
+ [MarshalAs (UnmanagedType.ByValArray, SizeConst=25)]
+ public short[] byHour;
- set {
- freq = value;
- }
- }
+ [MarshalAs (UnmanagedType.ByValArray, SizeConst=364)]
+ public short[] byDay;
- public int Count {
- get {
- return count;
- }
+ [MarshalAs (UnmanagedType.ByValArray, SizeConst=32)]
+ public short[] byMonthDay;
- set {
- count = value;
- }
- }
+ [MarshalAs (UnmanagedType.ByValArray, SizeConst=367)]
+ public short[] byYearDay;
- public DateTime Enddate {
- get {
- return until;
- }
+ [MarshalAs (UnmanagedType.ByValArray, SizeConst=54)]
+ public short[] byWeekNumber;
+
+ [MarshalAs (UnmanagedType.ByValArray, SizeConst=13)]
+ public short[] byMonth;
- set {
- until = value;
- }
- }
+ [MarshalAs (UnmanagedType.ByValArray, SizeConst=367)]
+ public short[] bySetPos;
- public int WeekStartDay {
- get {
- return week_start_day;
- }
+ private short[] GetInitializedArray (int len)
+ {
+ short [] ret = new short [len];
- set {
- week_start_day = value;
+ for (int i = 0; i < len; i++)
+ {
+ ret [i] = 0x7f;
}
+ ret [0] = 0x7f7f;
+ return ret;
}
- public short Interval {
- get {
- return interval;
- }
-
- set {
- interval = value;
- }
- }
-
- public short[] BySecond {
- get {
- return by_second;
- }
-
- set {
- by_second = value;
- }
- }
-
- public short[] ByMinute {
- get {
- return by_minute;
- }
-
- set {
- by_minute = value;
- }
- }
-
- public short[] ByHour {
- get {
- return by_hour;
- }
-
- set {
- by_hour = value;
- }
- }
- public short[] ByDay {
- get {
- return by_day;
- }
-
- set {
- by_day = value;
- }
- }
- public short[] ByMonthDay {
- get {
- return by_month_day;
- }
-
- set {
- by_month_day = value;
- }
- }
- public short[] ByYearDay {
- get {
- return by_year_day;
- }
-
- set {
- by_year_day = value;
- }
- }
- public short[] ByWeekNumber {
- get {
- return by_week_no;
- }
-
- set {
- by_week_no = value;
- }
- }
-
- public short[] ByMonth {
- get {
- return by_month;
- }
-
- set {
- by_month = value;
- }
- }
-
- public short[] BySetPos {
- get {
- return by_set_pos;
- }
-
- set {
- by_set_pos = value;
- }
- }
-
- public string FrequencyToString (FrequencyType f)
+ public CalRecurrence ()
{
- switch (f) {
- case FrequencyType.SECONDLY: return "second(s)";
- case FrequencyType.MINUTELY: return "minute(s)";
- case FrequencyType.HOURLY: return "hour(s)";
- case FrequencyType.DAILY: return "day(s)";
- case FrequencyType.WEEKLY: return "week(s)";
- case FrequencyType.MONTHLY: return "month(s)";
- case FrequencyType.YEARLY: return "year(s)";
+ freq = FrequencyType.FREQUENCY_NO;
+ count = 0;
+ //week_start_day = -1;
+ interval = 1;
+ week_start_day = WeekDayType.NO_WEEKDAY;
+ until = new Icaltimetype ();
+ bySecond = GetInitializedArray (61);
+ byMinute = GetInitializedArray (61);
+ byHour = GetInitializedArray (25);
+ byDay = GetInitializedArray (364);
+ byMonthDay = GetInitializedArray (32);
+ byYearDay = GetInitializedArray (367);
+ byWeekNumber = GetInitializedArray (54);
+ byMonth = GetInitializedArray (13);
+ bySetPos = GetInitializedArray (367);
+ }
+
+ public DateTime Until
+ {
+ get
+ {
+ return until.AsDateTimeUtc;
+ }
+ set
+ {
+ until.SetDateTime = value;
}
- return "";
}
+
+ public static CalRecurrence Zero = new CalRecurrence ();
- public string WeekDayToString (WeekDayType d)
- {
- switch (d) {
- case WeekDayType.SUNDAY: return "sunday";
- case WeekDayType.MONDAY: return "monday";
- case WeekDayType.TUESDAY: return "tuesday";
- case WeekDayType.WEDNESDAY: return "wednesday";
- case WeekDayType.THURSDAY: return "thursday";
- case WeekDayType.FRIDAY: return "friday";
- case WeekDayType.SATURDAY: return "saturday";
- }
- return "";
- }
+ [DllImport("ecal")]
+ static extern IntPtr icalrecurrencetype_from_string (string str);
- private string DecodeSeconds (short[] by_value)
+ public static CalRecurrence New(string recur)
{
- int i;
- string retval;
+ IntPtr raw = icalrecurrencetype_from_string (recur);
- for (i = 0; i < by_value.Length; i++) {
- if (by_value [i] != recurrence_array_max) {
- ;//retval
- }
- }
- return "";
+ return (CalRecurrence) Marshal.PtrToStructure (raw, typeof (CalRecurrence));
}
- private string DecodeByValues (short[] by_value, ByValuesType which_by)
+
+ ~CalRecurrence ()
{
- switch (which_by) {
- case ByValuesType.SECOND: return DecodeSeconds (by_value);
- /*
- case ByValuesType.MINUTE: return DecodeMinutes (by_value);
- case ByValuesType.HOUR: return DecodeHours (by_value);
- case ByValuesType.DAY: return DecodeDayOfWeek (by_value);
- case ByValuesType.MONTH_DAY: return DecodeDayOfMonth (by_value);
- case ByValuesType.YEAR_DAY: return DecodeDayOfYear (by_value);
- case ByValuesType.WEEK_NUMBER: return DecodeWeekNumber (by_value);
- case ByValuesType.MONTH: return DecodeMonth (by_value);
- case ByValuesType.SET_POS: return DecodeSetPos (by_value);
- */
- }
- return "";
}
- override public string ToString ()
+ [DllImport("ecal")]
+ static extern string icalrecurrencetype_as_string(IntPtr recur);
+
+
+ public string ToString ()
{
- string strFreq;
- string strRecur;
-
- strFreq = String.Format ("every {0} {1}", interval, FrequencyToString (Frequency));
- strRecur = String.Format ("Meeting occurs {0}", strFreq);
-
- return strRecur;
+ IntPtr native_dt = GLib.Marshaller.StructureToPtrAlloc (this);
+ string ret = icalrecurrencetype_as_string (native_dt);
+ Marshal.FreeHGlobal (native_dt);
+
+ return ret;
+ }
+
+ private static GLib.GType GType {
+ get { return GLib.GType.Pointer; }
}
}
}
Modified: branches/0_18/evolution/src/CalUtil.cs
==============================================================================
--- branches/0_18/evolution/src/CalUtil.cs (original)
+++ branches/0_18/evolution/src/CalUtil.cs Fri Nov 7 11:37:09 2008
@@ -135,6 +135,14 @@
}
[DllImport("ecal")]
+ static extern int icaltime_days_in_month (int month, int year);
+
+ public static int DaysInMonth (int month, int year)
+ {
+ return icaltime_days_in_month (month, year);
+ }
+
+ [DllImport("ecal")]
static extern void icalcomponent_free (IntPtr handle);
[DllImport("ecal")]
static extern IntPtr e_cal_component_new ();
@@ -186,7 +194,7 @@
[DllImport("evolutionglue")]
public static extern void e_cal_free_icaltimetype (IntPtr dt);
-
+
public static DateTime icaltimetype_to_datetime (IntPtr ptr, bool free_mem)
{
int d = 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]