File: Cal.custom

package info (click to toggle)
evolution-sharp 0.17.1-2
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 1,892 kB
  • ctags: 875
  • sloc: sh: 8,987; cs: 2,700; ansic: 712; makefile: 183; xml: 28
file content (102 lines) | stat: -rw-r--r-- 2,895 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
	[DllImport("ecal")]
		static extern unsafe bool e_cal_get_object_list_as_comp(IntPtr raw, string query, out IntPtr objects, out IntPtr error);

		public unsafe bool GetObjectListAsComp(string query, out IntPtr objects) {
			IntPtr error = IntPtr.Zero;
			bool raw_ret = e_cal_get_object_list_as_comp(Handle, query, out objects, out error);
			bool ret = raw_ret;
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}
                        
		public Evolution.CalComponent[] GetItems (string query)
      		{
			IntPtr ecal_objects = IntPtr.Zero;
			bool ret;

			if (query != null && query.Length > 0)
				ret = GetObjectListAsComp (query, out ecal_objects);
			else
				ret = GetObjectListAsComp ("#t", out ecal_objects);

			if (!ret)
				return null;

			return CalUtil.ECalToCalComponentArray (ecal_objects, this);
		}

		public Evolution.CalComponent[] GetItems ()
		{
			return GetItems (null);
		}

		public Evolution.CalComponent[] GetItemsOccurInRange (System.DateTime start_date_time, 
								      System.DateTime end_date_time) 
		{

			return (GetItems (CalUtil.GetQueryStringForTimeRange (start_date_time, end_date_time)));
		}

		[DllImport("ecal")]
		static extern unsafe bool e_cal_get_query(IntPtr raw, string sexp, out IntPtr query, out IntPtr error);

		public Evolution.CalView GetCalView (string sexp)
		{
			Evolution.CalView ret;
			IntPtr calviewHandle;
			IntPtr error = IntPtr.Zero;

			bool raw_ret = e_cal_get_query (Handle, 
							sexp, 
							out calviewHandle, 
							out error);
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			if (raw_ret == false || calviewHandle == (IntPtr)0) 
				return null;

			ret = (Evolution.CalView) GLib.Object.GetObject(calviewHandle);
			
			return ret;
		}

		[DllImport("evolutionglue")]
		static extern bool e_cal_glue_ecal_get_changes (IntPtr raw, 
								string change_id,
								out IntPtr newitems, 
								out IntPtr updated,
								out IntPtr removed,
								out IntPtr error);

		public bool GetChanges (string change_id,
					out CalComponent[] newitems,
					out CalComponent[] updated,
					out string[] removed)
		{
			IntPtr error = IntPtr.Zero;
			IntPtr added = IntPtr.Zero;
			IntPtr modified = IntPtr.Zero;
			IntPtr deleted = IntPtr.Zero;

			bool raw_ret = e_cal_glue_ecal_get_changes (Handle,
								    change_id,
								    out added,
								    out modified,
								    out deleted,
								    out error);
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			
			if (raw_ret == false) {
				newitems = new CalComponent [0];
				updated = new CalComponent [0];
				removed = new string [0];

				return raw_ret;
			}
			
			newitems = CalUtil.ECalToCalComponentArray (added, this);
			updated = CalUtil.ECalToCalComponentArray (modified, this);
			removed = CalUtil.GSListToStringArray (deleted, true);
	
			return raw_ret;
		}