evolution-sharp r186 - in branches/mono-backends: . evolution evolution/src glue/cal



Author: pchen
Date: Sun Sep  7 20:22:29 2008
New Revision: 186
URL: http://svn.gnome.org/viewvc/evolution-sharp?rev=186&view=rev

Log:
Added the glue for setting Icaltimetype values.



Added:
   branches/mono-backends/evolution/Icaltimetype.custom
Modified:
   branches/mono-backends/ChangeLog
   branches/mono-backends/evolution/Evolution.metadata
   branches/mono-backends/evolution/Makefile.am
   branches/mono-backends/evolution/TestCache.cs
   branches/mono-backends/evolution/src/CalComponent.cs
   branches/mono-backends/glue/cal/e-cal-glue-comp.c

Modified: branches/mono-backends/evolution/Evolution.metadata
==============================================================================
--- branches/mono-backends/evolution/Evolution.metadata	(original)
+++ branches/mono-backends/evolution/Evolution.metadata	Sun Sep  7 20:22:29 2008
@@ -60,6 +60,7 @@
   <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" name="name">Evolution</attr>
 
   <!-- Not sure why this is marked as a virtual method initially -->

Added: branches/mono-backends/evolution/Icaltimetype.custom
==============================================================================
--- (empty file)
+++ branches/mono-backends/evolution/Icaltimetype.custom	Sun Sep  7 20:22:29 2008
@@ -0,0 +1,143 @@
+	[DllImport("evolutionglue")]
+	public static extern IntPtr e_cal_alloc_icaltimetype ();
+
+	public Icaltimetype () 
+	{
+		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);
+		}
+	}
+
+	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);
+
+			return new Icaltimezone (raw);
+		}
+		set {
+			e_cal_glue_set_itt_zone (Raw, value.Handle);
+		}
+	}

Modified: branches/mono-backends/evolution/Makefile.am
==============================================================================
--- branches/mono-backends/evolution/Makefile.am	(original)
+++ branches/mono-backends/evolution/Makefile.am	Sun Sep  7 20:22:29 2008
@@ -34,6 +34,7 @@
 sources = 				\
 	src/CalComponent.cs		\
 	src/CalRecurrence.cs		\
+	src/CalComponentDateTime.cs	\
 	src/CalUtil.cs			\
 	src/GLibUtil.cs			\
 	src/ContactPhoto.cs		\
@@ -51,6 +52,7 @@
 	Source.custom			\
 	VCard.custom			\
 	VCardAttribute.custom		\
+	Icaltimetype.custom		\
 	CalBackend.custom		\
 	CalBackendCache.custom		\
 	CalBackendSExp.custom		

Modified: branches/mono-backends/evolution/TestCache.cs
==============================================================================
--- branches/mono-backends/evolution/TestCache.cs	(original)
+++ branches/mono-backends/evolution/TestCache.cs	Sun Sep  7 20:22:29 2008
@@ -16,6 +16,21 @@
 
 			/* Creating an Event */
 			comp.Summary = "1st event";
+		
+			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");
+			dt.Tzid = zon.Tzid;
+			
+			comp.DtStart = dt;	
+			comp.Commit ();
+
 			cache.PutComponent (comp);
 			uid = comp.Uid;
 

Modified: branches/mono-backends/evolution/src/CalComponent.cs
==============================================================================
--- branches/mono-backends/evolution/src/CalComponent.cs	(original)
+++ branches/mono-backends/evolution/src/CalComponent.cs	Sun Sep  7 20:22:29 2008
@@ -118,7 +118,7 @@
 		public string uid;
 		public string rid;
 	}
-   
+	
 	public class CalComponent {
 
 		bool new_component;
@@ -231,7 +231,7 @@
 
 				id = e_cal_component_get_id (Handle);
 				cid = (CalComponentId) Marshal.PtrToStructure (id, typeof (CalComponentId));
-				e_cal_component_free_id (Handle);
+				e_cal_component_free_id (id);
 
 				return cid;
 			}
@@ -331,14 +331,17 @@
 		}
 
 		[DllImport("ecal")]
-			static extern void e_cal_component_get_dtstart (IntPtr raw, IntPtr dt);
+			static extern void e_cal_component_get_dtstart (IntPtr raw, out IntPtr dt);
 		[DllImport("ecal")]
 			static extern void e_cal_component_set_dtstart (IntPtr raw, IntPtr dt);
       
+		[DllImport("ecalglue")]
+			static extern void e_cal_set_icaltimetype_to_ecalcomponentdatetime (IntPtr raw, IntPtr type);
+
 		public DateTime Dtstart {
 			get {
 				IntPtr dt = CalUtil.e_cal_alloc_ecalcomponentdatetime ();
-				e_cal_component_get_dtstart (Handle, dt);
+				e_cal_component_get_dtstart (Handle, out dt);
 				DateTime ret = CalUtil.ecalcomponentdatetime_to_datetime (dt);
 				CalUtil.e_cal_free_ecalcomponentdatetime (dt);
 				return ret;
@@ -348,6 +351,23 @@
 				e_cal_component_set_dtstart (Handle, dt);
 				CalUtil.e_cal_glue_free_ecalcomponentdatetime (dt);
 			}
+		} 
+
+		public CalComponentDateTime DtStart {
+			get {
+				CalComponentDateTime dt = new CalComponentDateTime ();
+				IntPtr native_dt = GLib.Marshaller.StructureToPtrAlloc (dt);
+				e_cal_component_get_dtstart(Handle, out 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_dtstart(Handle, native_dt);
+				Marshal.FreeHGlobal (native_dt);
+			}
 		}
 
 		[DllImport("ecal")]
@@ -605,6 +625,10 @@
 			bool commited = false;
 
 			e_cal_component_commit_sequence (Handle);
+
+			if (ecal == null)
+				return;
+
 			string str = e_cal_component_get_as_string (Handle);
          
 			if (str != null)

Modified: branches/mono-backends/glue/cal/e-cal-glue-comp.c
==============================================================================
--- branches/mono-backends/glue/cal/e-cal-glue-comp.c	(original)
+++ branches/mono-backends/glue/cal/e-cal-glue-comp.c	Sun Sep  7 20:22:29 2008
@@ -52,7 +52,7 @@
 ECalComponentDateTime*
 e_cal_alloc_ecalcomponentdatetime ()
 {
-   return g_new (ECalComponentDateTime, 1);
+   return g_new0 (ECalComponentDateTime, 1);
 }
 
 void
@@ -66,7 +66,7 @@
 struct icaltimetype*
 e_cal_alloc_icaltimetype ()
 {
-   return g_new (struct icaltimetype, 1);
+   return g_new0 (struct icaltimetype, 1);
 }
 
 void
@@ -77,6 +77,147 @@
    g_free (dt);
 }
 
+void
+e_cal_glue_set_itt_month (struct icaltimetype* dt, int month)
+{
+   g_return_if_fail (dt != NULL);
+
+   dt->month = month; 
+}
+
+int
+e_cal_glue_get_itt_month (struct icaltimetype* dt)
+{
+   return dt->month; 
+}
+
+void
+e_cal_glue_set_itt_year (struct icaltimetype* dt, int year)
+{
+   g_return_if_fail (dt != NULL);
+
+   dt->year = year; 
+}
+
+int
+e_cal_glue_get_itt_year (struct icaltimetype* dt)
+{
+   return dt->year; 
+}
+
+
+void
+e_cal_glue_set_itt_day (struct icaltimetype* dt, int day)
+{
+   g_return_if_fail (dt != NULL);
+
+   dt->day = day; 
+}
+
+int
+e_cal_glue_get_itt_day (struct icaltimetype* dt)
+{
+   return dt->day; 
+}
+
+void
+e_cal_glue_set_itt_hour (struct icaltimetype* dt, int hour)
+{
+   g_return_if_fail (dt != NULL);
+
+   dt->hour = hour; 
+}
+
+int
+e_cal_glue_get_itt_hour (struct icaltimetype* dt)
+{
+   return dt->hour; 
+}
+
+void
+e_cal_glue_set_itt_minute (struct icaltimetype* dt, int minute)
+{
+   g_return_if_fail (dt != NULL);
+
+   dt->minute = minute; 
+}
+
+int
+e_cal_glue_get_itt_minute (struct icaltimetype* dt)
+{
+   return dt->minute; 
+}
+
+void
+e_cal_glue_set_itt_second (struct icaltimetype* dt, int second)
+{
+   g_return_if_fail (dt != NULL);
+
+   dt->second = second; 
+}
+
+int
+e_cal_glue_get_itt_second (struct icaltimetype* dt)
+{
+   return dt->second; 
+}
+
+void
+e_cal_glue_set_itt_is_utc (struct icaltimetype* dt, int is_utc)
+{
+   g_return_if_fail (dt != NULL);
+
+   dt->is_utc = is_utc; 
+}
+
+int
+e_cal_glue_get_itt_is_utc (struct icaltimetype* dt)
+{
+   return dt->is_utc; 
+}
+
+void
+e_cal_glue_set_itt_is_date (struct icaltimetype* dt, int is_date)
+{
+   g_return_if_fail (dt != NULL);
+
+   dt->is_date = is_date; 
+}
+
+int
+e_cal_glue_get_itt_is_date (struct icaltimetype* dt)
+{
+   return dt->is_date; 
+}
+
+void
+e_cal_glue_set_itt_is_daylight (struct icaltimetype* dt, int is_daylight)
+{
+   g_return_if_fail (dt != NULL);
+
+   dt->is_daylight = is_daylight; 
+}
+
+int
+e_cal_glue_get_itt_is_daylight (struct icaltimetype* dt)
+{
+   return dt->is_daylight; 
+}
+
+void
+e_cal_glue_set_itt_zone (struct icaltimetype* dt, icaltimezone *zone)
+{
+   g_return_if_fail (dt != NULL);
+
+   dt->zone = zone; 
+}
+
+icaltimetype *
+e_cal_glue_get_itt_zone (struct icaltimetype* dt)
+{
+   return dt->zone; 
+}
+
 struct icaltimetype*
 e_cal_timet_to_icaltimetype (int timet)
 {
@@ -97,6 +238,13 @@
 }
 
 void
+e_cal_set_icaltimetype_to_ecalcomponentdatetime (ECalComponentDateTime *dt, icaltimetype *p)
+{
+	dt->value = p;	
+	g_print ("The value is %d %d \n", p->month, p->year);
+}
+
+void
 e_cal_glue_free_icaltimetype (struct icaltimetype* ical)
 {
    g_return_if_fail (ical != NULL);



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