File: Cal.custom

package info (click to toggle)
evolution-sharp 0.11.1-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,684 kB
  • ctags: 3,577
  • sloc: ansic: 11,275; sh: 8,735; cs: 1,145; makefile: 222; xml: 46
file content (123 lines) | stat: -rw-r--r-- 3,611 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
	[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;
		}

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

		public unsafe bool GetObjectList(string query, out IntPtr objects) {
			IntPtr error = IntPtr.Zero;
			bool raw_ret = e_cal_get_object_list(Handle, query, out objects, out error);
			bool ret = raw_ret;
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}


		[DllImport("evolutionglue")]
		static extern IntPtr e_cal_glue_free_e_cal_comp_objects (IntPtr ecal_objects);

		public Evolution.CalComponent[] GetItems (string query) {
			IntPtr ecal_objects = IntPtr.Zero;
			bool ret;
			CalComponent[] retval;

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

			if (!ret)
				return null;

			retval = Evolution.CalUtil.CalCompFromECal (ecal_objects, this);
			e_cal_glue_free_e_cal_comp_objects (ecal_objects);

			return retval;
		}

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

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

			return (GetItems (Evolution.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.GLibSListToCalCompArray (added, this);
			updated = CalUtil.GLibSListToCalCompArray (modified, this);
			removed = CalUtil.GLibSListToStringArray (deleted, true);
			
			CalUtil.FreeGlueCompGLibSList (added);
			CalUtil.FreeGlueCompGLibSList (modified);
	
			return raw_ret;
		}