Merge lp:~mhr3/libzeitgeist/data-source-registry into lp:libzeitgeist
- data-source-registry
- Merge into trunk
Proposed by
Michal Hruby
Status: | Merged |
---|---|
Approved by: | Mikkel Kamstrup Erlandsen |
Approved revision: | 151 |
Merged at revision: | 149 |
Proposed branch: | lp:~mhr3/libzeitgeist/data-source-registry |
Merge into: | lp:libzeitgeist |
Diff against target: |
2120 lines (+1715/-118) 18 files modified
bindings/zeitgeist-1.0.gi (+186/-0) bindings/zeitgeist-1.0.metadata (+8/-0) bindings/zeitgeist-1.0.vapi (+32/-0) doc/reference/zeitgeist-1.0-docs.sgml (+3/-1) doc/reference/zeitgeist-1.0-sections.txt (+163/-107) doc/reference/zeitgeist-1.0.types (+8/-6) src/Makefile.am (+12/-0) src/marshal.list (+4/-0) src/org.gnome.zeitgeist.Log.xml (+73/-0) src/zeitgeist-data-source-registry.c (+527/-0) src/zeitgeist-data-source-registry.h (+108/-0) src/zeitgeist-data-source.c (+349/-0) src/zeitgeist-data-source.h (+101/-0) src/zeitgeist-eggdbusconversions.c (+51/-0) src/zeitgeist-eggdbusconversions.h (+8/-2) src/zeitgeist.h (+3/-1) tests/Makefile.am (+2/-0) tests/test-eggdbusconversions.c (+77/-1) |
To merge this branch: | bzr merge lp:~mhr3/libzeitgeist/data-source-registry |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mikkel Kamstrup Erlandsen | Approve | ||
Review via email:
|
This proposal supersedes a proposal from 2010-07-22.
Commit message
Description of the change
Adds API which talks to the DataSourceRegistry extension.
To post a comment you must log in.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mikkel Kamstrup Erlandsen (kamstrup) wrote : Posted in a previous version of this proposal | # |
review:
Needs Fixing
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mikkel Kamstrup Erlandsen (kamstrup) wrote : | # |
Top notch work Michal. Approved!
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'bindings/zeitgeist-1.0.gi' | |||
2 | --- bindings/zeitgeist-1.0.gi 2010-06-17 14:11:59 +0000 | |||
3 | +++ bindings/zeitgeist-1.0.gi 2010-07-23 10:53:43 +0000 | |||
4 | @@ -101,6 +101,192 @@ | |||
5 | 101 | <member name="ZEITGEIST_STORAGE_STATE_AVAILABLE" value="1"/> | 101 | <member name="ZEITGEIST_STORAGE_STATE_AVAILABLE" value="1"/> |
6 | 102 | <member name="ZEITGEIST_STORAGE_STATE_ANY" value="2"/> | 102 | <member name="ZEITGEIST_STORAGE_STATE_ANY" value="2"/> |
7 | 103 | </enum> | 103 | </enum> |
8 | 104 | <object name="ZeitgeistDataSource" parent="GInitiallyUnowned" type-name="ZeitgeistDataSource" get-type="zeitgeist_data_source_get_type"> | ||
9 | 105 | <method name="get_description" symbol="zeitgeist_data_source_get_description"> | ||
10 | 106 | <return-type type="gchar*"/> | ||
11 | 107 | <parameters> | ||
12 | 108 | <parameter name="src" type="ZeitgeistDataSource*"/> | ||
13 | 109 | </parameters> | ||
14 | 110 | </method> | ||
15 | 111 | <method name="get_enabled" symbol="zeitgeist_data_source_get_enabled"> | ||
16 | 112 | <return-type type="gboolean"/> | ||
17 | 113 | <parameters> | ||
18 | 114 | <parameter name="src" type="ZeitgeistDataSource*"/> | ||
19 | 115 | </parameters> | ||
20 | 116 | </method> | ||
21 | 117 | <method name="get_event_templates" symbol="zeitgeist_data_source_get_event_templates"> | ||
22 | 118 | <return-type type="GPtrArray*"/> | ||
23 | 119 | <parameters> | ||
24 | 120 | <parameter name="src" type="ZeitgeistDataSource*"/> | ||
25 | 121 | </parameters> | ||
26 | 122 | </method> | ||
27 | 123 | <method name="get_name" symbol="zeitgeist_data_source_get_name"> | ||
28 | 124 | <return-type type="gchar*"/> | ||
29 | 125 | <parameters> | ||
30 | 126 | <parameter name="src" type="ZeitgeistDataSource*"/> | ||
31 | 127 | </parameters> | ||
32 | 128 | </method> | ||
33 | 129 | <method name="get_running" symbol="zeitgeist_data_source_get_running"> | ||
34 | 130 | <return-type type="gboolean"/> | ||
35 | 131 | <parameters> | ||
36 | 132 | <parameter name="src" type="ZeitgeistDataSource*"/> | ||
37 | 133 | </parameters> | ||
38 | 134 | </method> | ||
39 | 135 | <method name="get_timestamp" symbol="zeitgeist_data_source_get_timestamp"> | ||
40 | 136 | <return-type type="gint64"/> | ||
41 | 137 | <parameters> | ||
42 | 138 | <parameter name="src" type="ZeitgeistDataSource*"/> | ||
43 | 139 | </parameters> | ||
44 | 140 | </method> | ||
45 | 141 | <method name="get_unique_id" symbol="zeitgeist_data_source_get_unique_id"> | ||
46 | 142 | <return-type type="gchar*"/> | ||
47 | 143 | <parameters> | ||
48 | 144 | <parameter name="src" type="ZeitgeistDataSource*"/> | ||
49 | 145 | </parameters> | ||
50 | 146 | </method> | ||
51 | 147 | <constructor name="new" symbol="zeitgeist_data_source_new"> | ||
52 | 148 | <return-type type="ZeitgeistDataSource*"/> | ||
53 | 149 | </constructor> | ||
54 | 150 | <constructor name="new_full" symbol="zeitgeist_data_source_new_full"> | ||
55 | 151 | <return-type type="ZeitgeistDataSource*"/> | ||
56 | 152 | <parameters> | ||
57 | 153 | <parameter name="id" type="gchar*"/> | ||
58 | 154 | <parameter name="name" type="gchar*"/> | ||
59 | 155 | <parameter name="desc" type="gchar*"/> | ||
60 | 156 | <parameter name="event_templates" type="GPtrArray*"/> | ||
61 | 157 | </parameters> | ||
62 | 158 | </constructor> | ||
63 | 159 | <method name="set_description" symbol="zeitgeist_data_source_set_description"> | ||
64 | 160 | <return-type type="void"/> | ||
65 | 161 | <parameters> | ||
66 | 162 | <parameter name="src" type="ZeitgeistDataSource*"/> | ||
67 | 163 | <parameter name="description" type="gchar*"/> | ||
68 | 164 | </parameters> | ||
69 | 165 | </method> | ||
70 | 166 | <method name="set_enabled" symbol="zeitgeist_data_source_set_enabled"> | ||
71 | 167 | <return-type type="void"/> | ||
72 | 168 | <parameters> | ||
73 | 169 | <parameter name="src" type="ZeitgeistDataSource*"/> | ||
74 | 170 | <parameter name="enabled" type="gboolean"/> | ||
75 | 171 | </parameters> | ||
76 | 172 | </method> | ||
77 | 173 | <method name="set_event_templates" symbol="zeitgeist_data_source_set_event_templates"> | ||
78 | 174 | <return-type type="void"/> | ||
79 | 175 | <parameters> | ||
80 | 176 | <parameter name="src" type="ZeitgeistDataSource*"/> | ||
81 | 177 | <parameter name="event_templates" type="GPtrArray*"/> | ||
82 | 178 | </parameters> | ||
83 | 179 | </method> | ||
84 | 180 | <method name="set_name" symbol="zeitgeist_data_source_set_name"> | ||
85 | 181 | <return-type type="void"/> | ||
86 | 182 | <parameters> | ||
87 | 183 | <parameter name="src" type="ZeitgeistDataSource*"/> | ||
88 | 184 | <parameter name="name" type="gchar*"/> | ||
89 | 185 | </parameters> | ||
90 | 186 | </method> | ||
91 | 187 | <method name="set_running" symbol="zeitgeist_data_source_set_running"> | ||
92 | 188 | <return-type type="void"/> | ||
93 | 189 | <parameters> | ||
94 | 190 | <parameter name="src" type="ZeitgeistDataSource*"/> | ||
95 | 191 | <parameter name="running" type="gboolean"/> | ||
96 | 192 | </parameters> | ||
97 | 193 | </method> | ||
98 | 194 | <method name="set_timestamp" symbol="zeitgeist_data_source_set_timestamp"> | ||
99 | 195 | <return-type type="void"/> | ||
100 | 196 | <parameters> | ||
101 | 197 | <parameter name="src" type="ZeitgeistDataSource*"/> | ||
102 | 198 | <parameter name="timestamp" type="gint64"/> | ||
103 | 199 | </parameters> | ||
104 | 200 | </method> | ||
105 | 201 | <method name="set_unique_id" symbol="zeitgeist_data_source_set_unique_id"> | ||
106 | 202 | <return-type type="void"/> | ||
107 | 203 | <parameters> | ||
108 | 204 | <parameter name="src" type="ZeitgeistDataSource*"/> | ||
109 | 205 | <parameter name="unique_id" type="gchar*"/> | ||
110 | 206 | </parameters> | ||
111 | 207 | </method> | ||
112 | 208 | </object> | ||
113 | 209 | <object name="ZeitgeistDataSourceRegistry" parent="GObject" type-name="ZeitgeistDataSourceRegistry" get-type="zeitgeist_data_source_registry_get_type"> | ||
114 | 210 | <method name="get_data_sources" symbol="zeitgeist_data_source_registry_get_data_sources"> | ||
115 | 211 | <return-type type="void"/> | ||
116 | 212 | <parameters> | ||
117 | 213 | <parameter name="self" type="ZeitgeistDataSourceRegistry*"/> | ||
118 | 214 | <parameter name="cancellable" type="GCancellable*"/> | ||
119 | 215 | <parameter name="callback" type="GAsyncReadyCallback"/> | ||
120 | 216 | <parameter name="user_data" type="gpointer"/> | ||
121 | 217 | </parameters> | ||
122 | 218 | </method> | ||
123 | 219 | <method name="get_data_sources_finish" symbol="zeitgeist_data_source_registry_get_data_sources_finish"> | ||
124 | 220 | <return-type type="GPtrArray*"/> | ||
125 | 221 | <parameters> | ||
126 | 222 | <parameter name="self" type="ZeitgeistDataSourceRegistry*"/> | ||
127 | 223 | <parameter name="res" type="GAsyncResult*"/> | ||
128 | 224 | <parameter name="error" type="GError**"/> | ||
129 | 225 | </parameters> | ||
130 | 226 | </method> | ||
131 | 227 | <constructor name="new" symbol="zeitgeist_data_source_registry_new"> | ||
132 | 228 | <return-type type="ZeitgeistDataSourceRegistry*"/> | ||
133 | 229 | </constructor> | ||
134 | 230 | <method name="register_data_source" symbol="zeitgeist_data_source_registry_register_data_source"> | ||
135 | 231 | <return-type type="void"/> | ||
136 | 232 | <parameters> | ||
137 | 233 | <parameter name="self" type="ZeitgeistDataSourceRegistry*"/> | ||
138 | 234 | <parameter name="source" type="ZeitgeistDataSource*"/> | ||
139 | 235 | <parameter name="cancellable" type="GCancellable*"/> | ||
140 | 236 | <parameter name="callback" type="GAsyncReadyCallback"/> | ||
141 | 237 | <parameter name="user_data" type="gpointer"/> | ||
142 | 238 | </parameters> | ||
143 | 239 | </method> | ||
144 | 240 | <method name="register_data_source_finish" symbol="zeitgeist_data_source_registry_register_data_source_finish"> | ||
145 | 241 | <return-type type="gboolean"/> | ||
146 | 242 | <parameters> | ||
147 | 243 | <parameter name="self" type="ZeitgeistDataSourceRegistry*"/> | ||
148 | 244 | <parameter name="res" type="GAsyncResult*"/> | ||
149 | 245 | <parameter name="error" type="GError**"/> | ||
150 | 246 | </parameters> | ||
151 | 247 | </method> | ||
152 | 248 | <method name="set_data_source_enabled" symbol="zeitgeist_data_source_registry_set_data_source_enabled"> | ||
153 | 249 | <return-type type="void"/> | ||
154 | 250 | <parameters> | ||
155 | 251 | <parameter name="self" type="ZeitgeistDataSourceRegistry*"/> | ||
156 | 252 | <parameter name="unique_id" type="gchar*"/> | ||
157 | 253 | <parameter name="enabled" type="gboolean"/> | ||
158 | 254 | <parameter name="cancellable" type="GCancellable*"/> | ||
159 | 255 | <parameter name="callback" type="GAsyncReadyCallback"/> | ||
160 | 256 | <parameter name="user_data" type="gpointer"/> | ||
161 | 257 | </parameters> | ||
162 | 258 | </method> | ||
163 | 259 | <method name="set_data_source_enabled_finish" symbol="zeitgeist_data_source_registry_set_data_source_enabled_finish"> | ||
164 | 260 | <return-type type="void"/> | ||
165 | 261 | <parameters> | ||
166 | 262 | <parameter name="self" type="ZeitgeistDataSourceRegistry*"/> | ||
167 | 263 | <parameter name="res" type="GAsyncResult*"/> | ||
168 | 264 | <parameter name="error" type="GError**"/> | ||
169 | 265 | </parameters> | ||
170 | 266 | </method> | ||
171 | 267 | <signal name="source-disconnected" when="FIRST"> | ||
172 | 268 | <return-type type="void"/> | ||
173 | 269 | <parameters> | ||
174 | 270 | <parameter name="registry" type="ZeitgeistDataSourceRegistry*"/> | ||
175 | 271 | <parameter name="source" type="ZeitgeistDataSource*"/> | ||
176 | 272 | </parameters> | ||
177 | 273 | </signal> | ||
178 | 274 | <signal name="source-enabled" when="FIRST"> | ||
179 | 275 | <return-type type="void"/> | ||
180 | 276 | <parameters> | ||
181 | 277 | <parameter name="registry" type="ZeitgeistDataSourceRegistry*"/> | ||
182 | 278 | <parameter name="unique_id" type="char*"/> | ||
183 | 279 | <parameter name="enabled" type="gboolean"/> | ||
184 | 280 | </parameters> | ||
185 | 281 | </signal> | ||
186 | 282 | <signal name="source-registered" when="FIRST"> | ||
187 | 283 | <return-type type="void"/> | ||
188 | 284 | <parameters> | ||
189 | 285 | <parameter name="registry" type="ZeitgeistDataSourceRegistry*"/> | ||
190 | 286 | <parameter name="source" type="ZeitgeistDataSource*"/> | ||
191 | 287 | </parameters> | ||
192 | 288 | </signal> | ||
193 | 289 | </object> | ||
194 | 104 | <object name="ZeitgeistEvent" parent="GInitiallyUnowned" type-name="ZeitgeistEvent" get-type="zeitgeist_event_get_type"> | 290 | <object name="ZeitgeistEvent" parent="GInitiallyUnowned" type-name="ZeitgeistEvent" get-type="zeitgeist_event_get_type"> |
195 | 105 | <method name="add_subject" symbol="zeitgeist_event_add_subject"> | 291 | <method name="add_subject" symbol="zeitgeist_event_add_subject"> |
196 | 106 | <return-type type="void"/> | 292 | <return-type type="void"/> |
197 | 107 | 293 | ||
198 | === modified file 'bindings/zeitgeist-1.0.metadata' | |||
199 | --- bindings/zeitgeist-1.0.metadata 2010-06-17 14:11:59 +0000 | |||
200 | +++ bindings/zeitgeist-1.0.metadata 2010-07-23 10:53:43 +0000 | |||
201 | @@ -1,5 +1,12 @@ | |||
202 | 1 | Zeitgeist cheader_filename="zeitgeist.h" | 1 | Zeitgeist cheader_filename="zeitgeist.h" |
203 | 2 | Zeitgeist.Timestamp cheader_filename="zeitgeist.h" | 2 | Zeitgeist.Timestamp cheader_filename="zeitgeist.h" |
204 | 3 | zeitgeist_data_source_new_full.event_templates transfer_ownership="1" | ||
205 | 4 | zeitgeist_data_source_set_event_templates.event_templates transfer_ownership="1" | ||
206 | 5 | zeitgeist_data_source_registry_get_data_sources async="1" | ||
207 | 6 | zeitgeist_data_source_registry_get_data_sources_finish transfer_ownership="1" | ||
208 | 7 | zeitgeist_data_source_registry_register_data_source async="1" | ||
209 | 8 | zeitgeist_data_source_registry_register_data_source.source transfer_ownership="1" | ||
210 | 9 | zeitgeist_data_source_registry_set_data_source_enabled async="1" | ||
211 | 3 | zeitgeist_index_search async="1" | 10 | zeitgeist_index_search async="1" |
212 | 4 | zeitgeist_index_search.event_templates transfer_ownership="1" | 11 | zeitgeist_index_search.event_templates transfer_ownership="1" |
213 | 5 | zeitgeist_index_search_finish transfer_ownership="1" | 12 | zeitgeist_index_search_finish transfer_ownership="1" |
214 | @@ -33,6 +40,7 @@ | |||
215 | 33 | zeitgeist_event_set_payload.payload transfer_ownership="1" | 40 | zeitgeist_event_set_payload.payload transfer_ownership="1" |
216 | 34 | zeitgeist_monitor_new.event_templates transfer_ownership="1" | 41 | zeitgeist_monitor_new.event_templates transfer_ownership="1" |
217 | 35 | 42 | ||
218 | 43 | zeitgeist_data_source_registry_*.cancellable nullable="1" | ||
219 | 36 | zeitgeist_log_*.cancellable nullable="1" | 44 | zeitgeist_log_*.cancellable nullable="1" |
220 | 37 | zeitgeist_index_*.cancellable nullable="1" | 45 | zeitgeist_index_*.cancellable nullable="1" |
221 | 38 | 46 | ||
222 | 39 | 47 | ||
223 | === modified file 'bindings/zeitgeist-1.0.vapi' | |||
224 | --- bindings/zeitgeist-1.0.vapi 2010-06-23 09:43:18 +0000 | |||
225 | +++ bindings/zeitgeist-1.0.vapi 2010-07-23 10:53:43 +0000 | |||
226 | @@ -38,6 +38,38 @@ | |||
227 | 38 | public static int64 prev_midnight (int64 timestamp); | 38 | public static int64 prev_midnight (int64 timestamp); |
228 | 39 | } | 39 | } |
229 | 40 | [CCode (cheader_filename = "zeitgeist.h")] | 40 | [CCode (cheader_filename = "zeitgeist.h")] |
230 | 41 | public class DataSource : GLib.InitiallyUnowned { | ||
231 | 42 | [CCode (has_construct_function = false)] | ||
232 | 43 | public DataSource (); | ||
233 | 44 | [CCode (has_construct_function = false)] | ||
234 | 45 | public DataSource.full (string id, string name, string desc, owned GLib.PtrArray event_templates); | ||
235 | 46 | public unowned string get_description (); | ||
236 | 47 | public bool get_enabled (); | ||
237 | 48 | public unowned GLib.PtrArray get_event_templates (); | ||
238 | 49 | public unowned string get_name (); | ||
239 | 50 | public bool get_running (); | ||
240 | 51 | public int64 get_timestamp (); | ||
241 | 52 | public unowned string get_unique_id (); | ||
242 | 53 | public void set_description (string description); | ||
243 | 54 | public void set_enabled (bool enabled); | ||
244 | 55 | public void set_event_templates (owned GLib.PtrArray event_templates); | ||
245 | 56 | public void set_name (string name); | ||
246 | 57 | public void set_running (bool running); | ||
247 | 58 | public void set_timestamp (int64 timestamp); | ||
248 | 59 | public void set_unique_id (string unique_id); | ||
249 | 60 | } | ||
250 | 61 | [CCode (cheader_filename = "zeitgeist.h")] | ||
251 | 62 | public class DataSourceRegistry : GLib.Object { | ||
252 | 63 | [CCode (has_construct_function = false)] | ||
253 | 64 | public DataSourceRegistry (); | ||
254 | 65 | public async GLib.PtrArray get_data_sources (GLib.Cancellable? cancellable) throws GLib.Error; | ||
255 | 66 | public async bool register_data_source (owned Zeitgeist.DataSource source, GLib.Cancellable? cancellable) throws GLib.Error; | ||
256 | 67 | public async void set_data_source_enabled (string unique_id, bool enabled, GLib.Cancellable? cancellable) throws GLib.Error; | ||
257 | 68 | public virtual signal void source_disconnected (Zeitgeist.DataSource source); | ||
258 | 69 | public virtual signal void source_enabled (string unique_id, bool enabled); | ||
259 | 70 | public virtual signal void source_registered (Zeitgeist.DataSource source); | ||
260 | 71 | } | ||
261 | 72 | [CCode (cheader_filename = "zeitgeist.h")] | ||
262 | 41 | public class Event : GLib.InitiallyUnowned { | 73 | public class Event : GLib.InitiallyUnowned { |
263 | 42 | [CCode (has_construct_function = false)] | 74 | [CCode (has_construct_function = false)] |
264 | 43 | public Event (); | 75 | public Event (); |
265 | 44 | 76 | ||
266 | === modified file 'doc/reference/zeitgeist-1.0-docs.sgml' | |||
267 | --- doc/reference/zeitgeist-1.0-docs.sgml 2010-06-17 09:22:18 +0000 | |||
268 | +++ doc/reference/zeitgeist-1.0-docs.sgml 2010-07-23 10:53:43 +0000 | |||
269 | @@ -34,7 +34,9 @@ | |||
270 | 34 | 34 | ||
271 | 35 | <chapter> | 35 | <chapter> |
272 | 36 | <title>API for Zeitgeist Extensions</title> | 36 | <title>API for Zeitgeist Extensions</title> |
274 | 37 | <xi:include href="xml/zeitgeist-index.xml"/> | 37 | <xi:include href="xml/zeitgeist-index.xml"/> |
275 | 38 | <xi:include href="xml/zeitgeist-data-source.xml"/> | ||
276 | 39 | <xi:include href="xml/zeitgeist-data-source-registry.xml"/> | ||
277 | 38 | </chapter> | 40 | </chapter> |
278 | 39 | 41 | ||
279 | 40 | <chapter id="object-tree"> | 42 | <chapter id="object-tree"> |
280 | 41 | 43 | ||
281 | === modified file 'doc/reference/zeitgeist-1.0-sections.txt' | |||
282 | --- doc/reference/zeitgeist-1.0-sections.txt 2010-06-23 09:43:18 +0000 | |||
283 | +++ doc/reference/zeitgeist-1.0-sections.txt 2010-07-23 10:53:43 +0000 | |||
284 | @@ -1,63 +1,32 @@ | |||
285 | 1 | <SECTION> | 1 | <SECTION> |
345 | 2 | <FILE>zeitgeist-timerange</FILE> | 2 | <FILE>zeitgeist-data-source</FILE> |
346 | 3 | <TITLE>ZeitgeistTimeRange</TITLE> | 3 | <TITLE>ZeitgeistDataSource</TITLE> |
347 | 4 | ZeitgeistTimeRange | 4 | ZeitgeistDataSource |
348 | 5 | ZeitgeistTimeRangeClass | 5 | ZeitgeistDataSourceClass |
349 | 6 | zeitgeist_time_range_new | 6 | zeitgeist_data_source_new |
350 | 7 | zeitgeist_time_range_new_from_now | 7 | zeitgeist_data_source_new_full |
351 | 8 | zeitgeist_time_range_new_to_now | 8 | zeitgeist_data_source_get_unique_id |
352 | 9 | zeitgeist_time_range_new_anytime | 9 | zeitgeist_data_source_set_unique_id |
353 | 10 | zeitgeist_time_range_get_start | 10 | zeitgeist_data_source_get_name |
354 | 11 | zeitgeist_time_range_get_end | 11 | zeitgeist_data_source_set_name |
355 | 12 | zeitgeist_time_range_get_start_iso8601 | 12 | zeitgeist_data_source_get_description |
356 | 13 | zeitgeist_time_range_get_end_iso8601 | 13 | zeitgeist_data_source_set_description |
357 | 14 | <SUBSECTION Standard> | 14 | zeitgeist_data_source_get_event_templates |
358 | 15 | ZEITGEIST_TIME_RANGE | 15 | zeitgeist_data_source_set_event_templates |
359 | 16 | ZEITGEIST_IS_TIME_RANGE | 16 | zeitgeist_data_source_is_running |
360 | 17 | ZEITGEIST_TYPE_TIME_RANGE | 17 | zeitgeist_data_source_set_running |
361 | 18 | zeitgeist_time_range_get_type | 18 | zeitgeist_data_source_get_timestamp |
362 | 19 | ZEITGEIST_TIME_RANGE_CLASS | 19 | zeitgeist_data_source_set_timestamp |
363 | 20 | ZEITGEIST_IS_TIME_RANGE_CLASS | 20 | zeitgeist_data_source_is_enabled |
364 | 21 | ZEITGEIST_TIME_RANGE_GET_CLASS | 21 | zeitgeist_data_source_set_enabled |
365 | 22 | </SECTION> | 22 | <SUBSECTION Standard> |
366 | 23 | 23 | ZEITGEIST_DATA_SOURCE | |
367 | 24 | <SECTION> | 24 | ZEITGEIST_IS_DATA_SOURCE |
368 | 25 | <FILE>zeitgeist-log</FILE> | 25 | ZEITGEIST_TYPE_DATA_SOURCE |
369 | 26 | <TITLE>ZeitgeistLog</TITLE> | 26 | zeitgeist_data_source_get_type |
370 | 27 | ZeitgeistLog | 27 | ZEITGEIST_DATA_SOURCE_CLASS |
371 | 28 | ZeitgeistLogClass | 28 | ZEITGEIST_IS_DATA_SOURCE_CLASS |
372 | 29 | zeitgeist_log_new | 29 | ZEITGEIST_DATA_SOURCE_GET_CLASS |
314 | 30 | zeitgeist_log_insert_events | ||
315 | 31 | zeitgeist_log_insert_events_no_reply | ||
316 | 32 | zeitgeist_log_insert_events_valist | ||
317 | 33 | zeitgeist_log_insert_events_from_ptrarray | ||
318 | 34 | zeitgeist_log_insert_events_finish | ||
319 | 35 | zeitgeist_log_find_events | ||
320 | 36 | zeitgeist_log_find_events_finish | ||
321 | 37 | zeitgeist_log_find_event_ids | ||
322 | 38 | zeitgeist_log_find_event_ids_finish | ||
323 | 39 | zeitgeist_log_get_events | ||
324 | 40 | zeitgeist_log_get_events_finish | ||
325 | 41 | zeitgeist_log_find_related_uris | ||
326 | 42 | zeitgeist_log_find_related_uris_finish | ||
327 | 43 | zeitgeist_log_delete_events | ||
328 | 44 | zeitgeist_log_delete_events_finish | ||
329 | 45 | zeitgeist_log_delete_log | ||
330 | 46 | zeitgeist_log_delete_log_finish | ||
331 | 47 | zeitgeist_log_quit | ||
332 | 48 | zeitgeist_log_quit_finish | ||
333 | 49 | zeitgeist_log_install_monitor | ||
334 | 50 | zeitgeist_log_install_monitor_finish | ||
335 | 51 | zeitgeist_log_remove_monitor | ||
336 | 52 | zeitgeist_log_remove_monitor_finish | ||
337 | 53 | <SUBSECTION Standard> | ||
338 | 54 | ZEITGEIST_LOG | ||
339 | 55 | ZEITGEIST_IS_LOG | ||
340 | 56 | ZEITGEIST_TYPE_LOG | ||
341 | 57 | zeitgeist_log_get_type | ||
342 | 58 | ZEITGEIST_LOG_CLASS | ||
343 | 59 | ZEITGEIST_IS_LOG_CLASS | ||
344 | 60 | ZEITGEIST_LOG_GET_CLASS | ||
373 | 61 | </SECTION> | 30 | </SECTION> |
374 | 62 | 31 | ||
375 | 63 | <SECTION> | 32 | <SECTION> |
376 | @@ -92,6 +61,67 @@ | |||
377 | 92 | </SECTION> | 61 | </SECTION> |
378 | 93 | 62 | ||
379 | 94 | <SECTION> | 63 | <SECTION> |
380 | 64 | <FILE>zeitgeist-timerange</FILE> | ||
381 | 65 | <TITLE>ZeitgeistTimeRange</TITLE> | ||
382 | 66 | ZeitgeistTimeRange | ||
383 | 67 | ZeitgeistTimeRangeClass | ||
384 | 68 | zeitgeist_time_range_new | ||
385 | 69 | zeitgeist_time_range_new_from_now | ||
386 | 70 | zeitgeist_time_range_new_to_now | ||
387 | 71 | zeitgeist_time_range_new_anytime | ||
388 | 72 | zeitgeist_time_range_get_start | ||
389 | 73 | zeitgeist_time_range_get_end | ||
390 | 74 | zeitgeist_time_range_get_start_iso8601 | ||
391 | 75 | zeitgeist_time_range_get_end_iso8601 | ||
392 | 76 | <SUBSECTION Standard> | ||
393 | 77 | ZEITGEIST_TIME_RANGE | ||
394 | 78 | ZEITGEIST_IS_TIME_RANGE | ||
395 | 79 | ZEITGEIST_TYPE_TIME_RANGE | ||
396 | 80 | zeitgeist_time_range_get_type | ||
397 | 81 | ZEITGEIST_TIME_RANGE_CLASS | ||
398 | 82 | ZEITGEIST_IS_TIME_RANGE_CLASS | ||
399 | 83 | ZEITGEIST_TIME_RANGE_GET_CLASS | ||
400 | 84 | </SECTION> | ||
401 | 85 | |||
402 | 86 | <SECTION> | ||
403 | 87 | <FILE>zeitgeist-index</FILE> | ||
404 | 88 | <TITLE>ZeitgeistIndex</TITLE> | ||
405 | 89 | ZeitgeistIndex | ||
406 | 90 | ZeitgeistIndexClass | ||
407 | 91 | zeitgeist_index_new | ||
408 | 92 | zeitgeist_index_search | ||
409 | 93 | zeitgeist_index_search_finish | ||
410 | 94 | <SUBSECTION Standard> | ||
411 | 95 | ZEITGEIST_INDEX | ||
412 | 96 | ZEITGEIST_IS_INDEX | ||
413 | 97 | ZEITGEIST_TYPE_INDEX | ||
414 | 98 | zeitgeist_index_get_type | ||
415 | 99 | ZEITGEIST_INDEX_CLASS | ||
416 | 100 | ZEITGEIST_IS_INDEX_CLASS | ||
417 | 101 | ZEITGEIST_INDEX_GET_CLASS | ||
418 | 102 | </SECTION> | ||
419 | 103 | |||
420 | 104 | <SECTION> | ||
421 | 105 | <FILE>zeitgeist-result-set</FILE> | ||
422 | 106 | <TITLE>ZeitgeistResultSet</TITLE> | ||
423 | 107 | ZeitgeistResultSetIface | ||
424 | 108 | ZeitgeistResultSet | ||
425 | 109 | zeitgeist_result_set_size | ||
426 | 110 | zeitgeist_result_set_estimated_matches | ||
427 | 111 | zeitgeist_result_set_next | ||
428 | 112 | zeitgeist_result_set_has_next | ||
429 | 113 | zeitgeist_result_set_peek | ||
430 | 114 | zeitgeist_result_set_seek | ||
431 | 115 | zeitgeist_result_set_tell | ||
432 | 116 | <SUBSECTION Standard> | ||
433 | 117 | ZEITGEIST_RESULT_SET | ||
434 | 118 | ZEITGEIST_IS_RESULT_SET | ||
435 | 119 | ZEITGEIST_TYPE_RESULT_SET | ||
436 | 120 | zeitgeist_result_set_get_type | ||
437 | 121 | ZEITGEIST_RESULT_SET_GET_IFACE | ||
438 | 122 | </SECTION> | ||
439 | 123 | |||
440 | 124 | <SECTION> | ||
441 | 95 | <FILE>zeitgeist-event</FILE> | 125 | <FILE>zeitgeist-event</FILE> |
442 | 96 | <TITLE>ZeitgeistEvent</TITLE> | 126 | <TITLE>ZeitgeistEvent</TITLE> |
443 | 97 | ZeitgeistEvent | 127 | ZeitgeistEvent |
444 | @@ -109,6 +139,7 @@ | |||
445 | 109 | zeitgeist_event_set_manifestation | 139 | zeitgeist_event_set_manifestation |
446 | 110 | zeitgeist_event_get_actor | 140 | zeitgeist_event_get_actor |
447 | 111 | zeitgeist_event_set_actor | 141 | zeitgeist_event_set_actor |
448 | 142 | zeitgeist_event_set_actor_from_app_info | ||
449 | 112 | zeitgeist_event_get_subject | 143 | zeitgeist_event_get_subject |
450 | 113 | zeitgeist_event_num_subjects | 144 | zeitgeist_event_num_subjects |
451 | 114 | zeitgeist_event_add_subject | 145 | zeitgeist_event_add_subject |
452 | @@ -125,6 +156,28 @@ | |||
453 | 125 | </SECTION> | 156 | </SECTION> |
454 | 126 | 157 | ||
455 | 127 | <SECTION> | 158 | <SECTION> |
456 | 159 | <FILE>zeitgeist-data-source-registry</FILE> | ||
457 | 160 | <TITLE>ZeitgeistDataSourceRegistry</TITLE> | ||
458 | 161 | ZeitgeistDataSourceRegistry | ||
459 | 162 | ZeitgeistDataSourceRegistryClass | ||
460 | 163 | zeitgeist_data_source_registry_new | ||
461 | 164 | zeitgeist_data_source_registry_get_data_sources | ||
462 | 165 | zeitgeist_data_source_registry_get_data_sources_finish | ||
463 | 166 | zeitgeist_data_source_registry_register_data_source | ||
464 | 167 | zeitgeist_data_source_registry_register_data_source_finish | ||
465 | 168 | zeitgeist_data_source_registry_set_data_source_enabled | ||
466 | 169 | zeitgeist_data_source_registry_set_data_source_enabled_finish | ||
467 | 170 | <SUBSECTION Standard> | ||
468 | 171 | ZEITGEIST_DATA_SOURCE_REGISTRY | ||
469 | 172 | ZEITGEIST_IS_DATA_SOURCE_REGISTRY | ||
470 | 173 | ZEITGEIST_TYPE_DATA_SOURCE_REGISTRY | ||
471 | 174 | zeitgeist_data_source_registry_get_type | ||
472 | 175 | ZEITGEIST_DATA_SOURCE_REGISTRY_CLASS | ||
473 | 176 | ZEITGEIST_IS_DATA_SOURCE_REGISTRY_CLASS | ||
474 | 177 | ZEITGEIST_DATA_SOURCE_REGISTRY_GET_CLASS | ||
475 | 178 | </SECTION> | ||
476 | 179 | |||
477 | 180 | <SECTION> | ||
478 | 128 | <FILE>zeitgeist-monitor</FILE> | 181 | <FILE>zeitgeist-monitor</FILE> |
479 | 129 | <TITLE>ZeitgeistMonitor</TITLE> | 182 | <TITLE>ZeitgeistMonitor</TITLE> |
480 | 130 | ZeitgeistMonitor | 183 | ZeitgeistMonitor |
481 | @@ -137,12 +190,52 @@ | |||
482 | 137 | ZEITGEIST_MONITOR | 190 | ZEITGEIST_MONITOR |
483 | 138 | ZEITGEIST_IS_MONITOR | 191 | ZEITGEIST_IS_MONITOR |
484 | 139 | ZEITGEIST_TYPE_MONITOR | 192 | ZEITGEIST_TYPE_MONITOR |
485 | 193 | zeitgeist_monitor_get_type | ||
486 | 140 | ZEITGEIST_MONITOR_CLASS | 194 | ZEITGEIST_MONITOR_CLASS |
487 | 141 | ZEITGEIST_IS_MONITOR_CLASS | 195 | ZEITGEIST_IS_MONITOR_CLASS |
488 | 142 | ZEITGEIST_MONITOR_GET_CLASS | 196 | ZEITGEIST_MONITOR_GET_CLASS |
489 | 143 | </SECTION> | 197 | </SECTION> |
490 | 144 | 198 | ||
491 | 145 | <SECTION> | 199 | <SECTION> |
492 | 200 | <FILE>zeitgeist-log</FILE> | ||
493 | 201 | <TITLE>ZeitgeistLog</TITLE> | ||
494 | 202 | ZeitgeistLog | ||
495 | 203 | ZeitgeistLogClass | ||
496 | 204 | zeitgeist_log_new | ||
497 | 205 | zeitgeist_log_insert_events | ||
498 | 206 | zeitgeist_log_insert_events_no_reply | ||
499 | 207 | zeitgeist_log_insert_events_valist | ||
500 | 208 | zeitgeist_log_insert_events_from_ptrarray | ||
501 | 209 | zeitgeist_log_insert_events_finish | ||
502 | 210 | zeitgeist_log_find_events | ||
503 | 211 | zeitgeist_log_find_events_finish | ||
504 | 212 | zeitgeist_log_find_event_ids | ||
505 | 213 | zeitgeist_log_find_event_ids_finish | ||
506 | 214 | zeitgeist_log_get_events | ||
507 | 215 | zeitgeist_log_get_events_finish | ||
508 | 216 | zeitgeist_log_find_related_uris | ||
509 | 217 | zeitgeist_log_find_related_uris_finish | ||
510 | 218 | zeitgeist_log_delete_events | ||
511 | 219 | zeitgeist_log_delete_events_finish | ||
512 | 220 | zeitgeist_log_delete_log | ||
513 | 221 | zeitgeist_log_delete_log_finish | ||
514 | 222 | zeitgeist_log_quit | ||
515 | 223 | zeitgeist_log_quit_finish | ||
516 | 224 | zeitgeist_log_install_monitor | ||
517 | 225 | zeitgeist_log_install_monitor_finish | ||
518 | 226 | zeitgeist_log_remove_monitor | ||
519 | 227 | zeitgeist_log_remove_monitor_finish | ||
520 | 228 | <SUBSECTION Standard> | ||
521 | 229 | ZEITGEIST_LOG | ||
522 | 230 | ZEITGEIST_IS_LOG | ||
523 | 231 | ZEITGEIST_TYPE_LOG | ||
524 | 232 | zeitgeist_log_get_type | ||
525 | 233 | ZEITGEIST_LOG_CLASS | ||
526 | 234 | ZEITGEIST_IS_LOG_CLASS | ||
527 | 235 | ZEITGEIST_LOG_GET_CLASS | ||
528 | 236 | </SECTION> | ||
529 | 237 | |||
530 | 238 | <SECTION> | ||
531 | 146 | <FILE>zeitgeist-enumtypes</FILE> | 239 | <FILE>zeitgeist-enumtypes</FILE> |
532 | 147 | zeitgeist_result_type_get_type | 240 | zeitgeist_result_type_get_type |
533 | 148 | ZEITGEIST_TYPE_RESULT_TYPE | 241 | ZEITGEIST_TYPE_RESULT_TYPE |
534 | @@ -162,6 +255,16 @@ | |||
535 | 162 | </SECTION> | 255 | </SECTION> |
536 | 163 | 256 | ||
537 | 164 | <SECTION> | 257 | <SECTION> |
538 | 258 | <FILE>zeitgeist-mimetypes</FILE> | ||
539 | 259 | <TITLE>Mimetype mapping and URI comprehension</TITLE> | ||
540 | 260 | zeitgeist_register_mimetype | ||
541 | 261 | zeitgeist_register_mimetype_regex | ||
542 | 262 | zeitgeist_interpretation_for_mimetype | ||
543 | 263 | zeitgeist_register_uri_scheme | ||
544 | 264 | zeitgeist_manifestation_for_uri | ||
545 | 265 | </SECTION> | ||
546 | 266 | |||
547 | 267 | <SECTION> | ||
548 | 165 | <FILE>zeitgeist-ontology-interpretations</FILE> | 268 | <FILE>zeitgeist-ontology-interpretations</FILE> |
549 | 166 | <TITLE>Interpretation Ontology</TITLE> | 269 | <TITLE>Interpretation Ontology</TITLE> |
550 | 167 | ZEITGEIST_NCAL_ALARM | 270 | ZEITGEIST_NCAL_ALARM |
551 | @@ -250,54 +353,6 @@ | |||
552 | 250 | </SECTION> | 353 | </SECTION> |
553 | 251 | 354 | ||
554 | 252 | <SECTION> | 355 | <SECTION> |
555 | 253 | <FILE>zeitgeist-mimetypes</FILE> | ||
556 | 254 | <TITLE>Mimetype mapping and URI comprehension</TITLE> | ||
557 | 255 | zeitgeist_register_mimetype | ||
558 | 256 | zeitgeist_register_mimetype_regex | ||
559 | 257 | zeitgeist_interpretation_for_mimetype | ||
560 | 258 | zeitgeist_register_uri_scheme | ||
561 | 259 | zeitgeist_manifestation_for_uri | ||
562 | 260 | </SECTION> | ||
563 | 261 | |||
564 | 262 | <SECTION> | ||
565 | 263 | <FILE>zeitgeist-index</FILE> | ||
566 | 264 | <TITLE>ZeitgeistIndex</TITLE> | ||
567 | 265 | ZeitgeistIndex | ||
568 | 266 | ZeitgeistIndexClass | ||
569 | 267 | zeitgeist_index_new | ||
570 | 268 | zeitgeist_index_search | ||
571 | 269 | zeitgeist_index_search_finish | ||
572 | 270 | <SUBSECTION Standard> | ||
573 | 271 | ZEITGEIST_INDEX | ||
574 | 272 | ZEITGEIST_IS_INDEX | ||
575 | 273 | ZEITGEIST_TYPE_INDEX | ||
576 | 274 | zeitgeist_index_get_type | ||
577 | 275 | ZEITGEIST_INDEX_CLASS | ||
578 | 276 | ZEITGEIST_IS_INDEX_CLASS | ||
579 | 277 | ZEITGEIST_INDEX_GET_CLASS | ||
580 | 278 | </SECTION> | ||
581 | 279 | |||
582 | 280 | <SECTION> | ||
583 | 281 | <FILE>zeitgeist-result-set</FILE> | ||
584 | 282 | <TITLE>ZeitgeistResultSet</TITLE> | ||
585 | 283 | ZeitgeistResultSet | ||
586 | 284 | ZeitgeistResultSetIface | ||
587 | 285 | zeitgeist_result_set_size | ||
588 | 286 | zeitgeist_result_set_estimated_matches | ||
589 | 287 | zeitgeist_result_set_next | ||
590 | 288 | zeitgeist_result_set_has_next | ||
591 | 289 | zeitgeist_result_set_peek | ||
592 | 290 | zeitgeist_result_set_seek | ||
593 | 291 | zeitgeist_result_set_tell | ||
594 | 292 | <SUBSECTION Standard> | ||
595 | 293 | ZEITGEIST_RESULT_SET | ||
596 | 294 | ZEITGEIST_IS_RESULT_SET | ||
597 | 295 | ZEITGEIST_TYPE_RESULT_SET | ||
598 | 296 | ZEITGEIST_RESULT_SET_GET_IFACE | ||
599 | 297 | zeitgeist_result_set_get_type | ||
600 | 298 | </SECTION> | ||
601 | 299 | |||
602 | 300 | <SECTION> | ||
603 | 301 | <FILE>zeitgeist-timestamp</FILE> | 356 | <FILE>zeitgeist-timestamp</FILE> |
604 | 302 | <TITLE>Timestamp handling</TITLE> | 357 | <TITLE>Timestamp handling</TITLE> |
605 | 303 | ZEITGEIST_TIMESTAMP_SECOND | 358 | ZEITGEIST_TIMESTAMP_SECOND |
606 | @@ -317,3 +372,4 @@ | |||
607 | 317 | zeitgeist_timestamp_next_midnight | 372 | zeitgeist_timestamp_next_midnight |
608 | 318 | zeitgeist_timestamp_prev_midnight | 373 | zeitgeist_timestamp_prev_midnight |
609 | 319 | </SECTION> | 374 | </SECTION> |
610 | 375 | |||
611 | 320 | 376 | ||
612 | === modified file 'doc/reference/zeitgeist-1.0.types' | |||
613 | --- doc/reference/zeitgeist-1.0.types 2010-06-09 14:36:16 +0000 | |||
614 | +++ doc/reference/zeitgeist-1.0.types 2010-07-23 10:53:43 +0000 | |||
615 | @@ -1,9 +1,11 @@ | |||
616 | 1 | zeitgeist_data_source_get_type | ||
617 | 2 | zeitgeist_data_source_registry_get_type | ||
618 | 3 | zeitgeist_event_get_type | ||
619 | 4 | zeitgeist_index_get_type | ||
620 | 1 | zeitgeist_log_get_type | 5 | zeitgeist_log_get_type |
622 | 2 | zeitgeist_event_get_type | 6 | zeitgeist_monitor_get_type |
623 | 7 | zeitgeist_result_set_get_type | ||
624 | 8 | zeitgeist_result_type_get_type | ||
625 | 9 | zeitgeist_storage_state_get_type | ||
626 | 3 | zeitgeist_subject_get_type | 10 | zeitgeist_subject_get_type |
627 | 4 | zeitgeist_time_range_get_type | 11 | zeitgeist_time_range_get_type |
628 | 5 | zeitgeist_monitor_get_type | ||
629 | 6 | zeitgeist_storage_state_get_type | ||
630 | 7 | zeitgeist_result_type_get_type | ||
631 | 8 | zeitgeist_index_get_type | ||
632 | 9 | |||
633 | 10 | 12 | ||
634 | === modified file 'src/Makefile.am' | |||
635 | --- src/Makefile.am 2010-06-28 13:50:12 +0000 | |||
636 | +++ src/Makefile.am 2010-07-23 10:53:43 +0000 | |||
637 | @@ -40,6 +40,10 @@ | |||
638 | 40 | eggzeitgeistbindingstypes.h \ | 40 | eggzeitgeistbindingstypes.h \ |
639 | 41 | eggzeitgeistblacklist.h \ | 41 | eggzeitgeistblacklist.h \ |
640 | 42 | eggzeitgeistblacklist.c \ | 42 | eggzeitgeistblacklist.c \ |
641 | 43 | eggzeitgeistdatasource.h \ | ||
642 | 44 | eggzeitgeistdatasource.c \ | ||
643 | 45 | eggzeitgeistdatasourceregistry.h \ | ||
644 | 46 | eggzeitgeistdatasourceregistry.c \ | ||
645 | 43 | eggzeitgeistevent.c \ | 47 | eggzeitgeistevent.c \ |
646 | 44 | eggzeitgeistevent.h \ | 48 | eggzeitgeistevent.h \ |
647 | 45 | eggzeitgeisteventdataoffset.c \ | 49 | eggzeitgeisteventdataoffset.c \ |
648 | @@ -66,9 +70,11 @@ | |||
649 | 66 | docbook-enum-StorageState.xml \ | 70 | docbook-enum-StorageState.xml \ |
650 | 67 | docbook-enum-SubjectDataOffset.xml \ | 71 | docbook-enum-SubjectDataOffset.xml \ |
651 | 68 | docbook-interface-org.gnome.zeitgeist.Blacklist.xml \ | 72 | docbook-interface-org.gnome.zeitgeist.Blacklist.xml \ |
652 | 73 | docbook-interface-org.gnome.zeitgeist.DataSourceRegistry.xml \ | ||
653 | 69 | docbook-interface-org.gnome.zeitgeist.Index.xml \ | 74 | docbook-interface-org.gnome.zeitgeist.Index.xml \ |
654 | 70 | docbook-interface-org.gnome.zeitgeist.Log.xml \ | 75 | docbook-interface-org.gnome.zeitgeist.Log.xml \ |
655 | 71 | docbook-interface-org.gnome.zeitgeist.Monitor.xml \ | 76 | docbook-interface-org.gnome.zeitgeist.Monitor.xml \ |
656 | 77 | docbook-struct-DataSource.xml \ | ||
657 | 72 | docbook-struct-Event.xml \ | 78 | docbook-struct-Event.xml \ |
658 | 73 | docbook-struct-TimeRange.xml \ | 79 | docbook-struct-TimeRange.xml \ |
659 | 74 | $(NULL) | 80 | $(NULL) |
660 | @@ -99,6 +105,10 @@ | |||
661 | 99 | lib_LTLIBRARIES = libzeitgeist-1.0.la | 105 | lib_LTLIBRARIES = libzeitgeist-1.0.la |
662 | 100 | 106 | ||
663 | 101 | libzeitgeist_1_0_la_SOURCES = \ | 107 | libzeitgeist_1_0_la_SOURCES = \ |
664 | 108 | zeitgeist-data-source.h \ | ||
665 | 109 | zeitgeist-data-source.c \ | ||
666 | 110 | zeitgeist-data-source-registry.h \ | ||
667 | 111 | zeitgeist-data-source-registry.c \ | ||
668 | 102 | zeitgeist-eggdbusconversions.h \ | 112 | zeitgeist-eggdbusconversions.h \ |
669 | 103 | zeitgeist-eggdbusconversions.c \ | 113 | zeitgeist-eggdbusconversions.c \ |
670 | 104 | zeitgeist-enums.h \ | 114 | zeitgeist-enums.h \ |
671 | @@ -142,6 +152,8 @@ | |||
672 | 142 | devel_headersdir = $(includedir)/zeitgeist-1.0 | 152 | devel_headersdir = $(includedir)/zeitgeist-1.0 |
673 | 143 | 153 | ||
674 | 144 | devel_headers = \ | 154 | devel_headers = \ |
675 | 155 | zeitgeist-data-source.h \ | ||
676 | 156 | zeitgeist-data-source-registry.h \ | ||
677 | 145 | zeitgeist-enums.h \ | 157 | zeitgeist-enums.h \ |
678 | 146 | zeitgeist-enumtypes.h \ | 158 | zeitgeist-enumtypes.h \ |
679 | 147 | zeitgeist-event.h \ | 159 | zeitgeist-event.h \ |
680 | 148 | 160 | ||
681 | === modified file 'src/marshal.list' | |||
682 | --- src/marshal.list 2010-06-10 09:14:22 +0000 | |||
683 | +++ src/marshal.list 2010-07-23 10:53:43 +0000 | |||
684 | @@ -3,3 +3,7 @@ | |||
685 | 3 | 3 | ||
686 | 4 | # ZeitgeistMonitor::events-deleted | 4 | # ZeitgeistMonitor::events-deleted |
687 | 5 | VOID:OBJECT,BOXED | 5 | VOID:OBJECT,BOXED |
688 | 6 | |||
689 | 7 | # ZeitgeistDataSourceRegistry::source-enabled | ||
690 | 8 | VOID:STRING,BOOLEAN | ||
691 | 9 | |||
692 | 6 | 10 | ||
693 | === modified file 'src/org.gnome.zeitgeist.Log.xml' | |||
694 | --- src/org.gnome.zeitgeist.Log.xml 2010-06-09 13:22:12 +0000 | |||
695 | +++ src/org.gnome.zeitgeist.Log.xml 2010-07-23 10:53:43 +0000 | |||
696 | @@ -37,6 +37,41 @@ | |||
697 | 37 | </annotation> | 37 | </annotation> |
698 | 38 | </annotation> | 38 | </annotation> |
699 | 39 | 39 | ||
700 | 40 | <annotation name="org.gtk.EggDBus.DeclareStruct" value="DataSource"> | ||
701 | 41 | <annotation name="org.gtk.EggDBus.DocString" | ||
702 | 42 | value="The #DataSource type is used to represent registered data sources"/> | ||
703 | 43 | <annotation name="org.gtk.EggDBus.DocString.Summary" value="DataSource"/> | ||
704 | 44 | |||
705 | 45 | <annotation name="org.gtk.EggDBus.Struct.Member" | ||
706 | 46 | value="String:unique_id"> | ||
707 | 47 | <annotation name="org.gtk.EggDBus.DocString" value="Unique ID of the data source"/> | ||
708 | 48 | </annotation> | ||
709 | 49 | <annotation name="org.gtk.EggDBus.Struct.Member" value="String:name"> | ||
710 | 50 | <annotation name="org.gtk.EggDBus.DocString" | ||
711 | 51 | value="Name of the data source"/> | ||
712 | 52 | </annotation> | ||
713 | 53 | <annotation name="org.gtk.EggDBus.Struct.Member" value="String:description"> | ||
714 | 54 | <annotation name="org.gtk.EggDBus.DocString" | ||
715 | 55 | value="Description of the data source"/> | ||
716 | 56 | </annotation> | ||
717 | 57 | <annotation name="org.gtk.EggDBus.Struct.Member" value="Array<Event>:event_templates"> | ||
718 | 58 | <annotation name="org.gtk.EggDBus.DocString" | ||
719 | 59 | value="Event templates for this data source"/> | ||
720 | 60 | </annotation> | ||
721 | 61 | <annotation name="org.gtk.EggDBus.Struct.Member" value="Boolean:running"> | ||
722 | 62 | <annotation name="org.gtk.EggDBus.DocString" | ||
723 | 63 | value="Whether data source is currently running"/> | ||
724 | 64 | </annotation> | ||
725 | 65 | <annotation name="org.gtk.EggDBus.Struct.Member" value="Int64:last_seen"> | ||
726 | 66 | <annotation name="org.gtk.EggDBus.DocString" | ||
727 | 67 | value="Timestamp of last action of this data source"/> | ||
728 | 68 | </annotation> | ||
729 | 69 | <annotation name="org.gtk.EggDBus.Struct.Member" value="Boolean:enabled"> | ||
730 | 70 | <annotation name="org.gtk.EggDBus.DocString" | ||
731 | 71 | value="Whether data source is enabled"/> | ||
732 | 72 | </annotation> | ||
733 | 73 | </annotation> | ||
734 | 74 | |||
735 | 40 | <annotation name="org.gtk.EggDBus.DeclareEnum" value="EventDataOffset"> | 75 | <annotation name="org.gtk.EggDBus.DeclareEnum" value="EventDataOffset"> |
736 | 41 | <annotation name="org.gtk.EggDBus.DocString" | 76 | <annotation name="org.gtk.EggDBus.DocString" |
737 | 42 | value="Offsets into the event data array on which to find particular fields"/> | 77 | value="Offsets into the event data array on which to find particular fields"/> |
738 | @@ -349,4 +384,42 @@ | |||
739 | 349 | <arg direction="out" type="u" name="hit_count"/> | 384 | <arg direction="out" type="u" name="hit_count"/> |
740 | 350 | </method> | 385 | </method> |
741 | 351 | </interface> | 386 | </interface> |
742 | 387 | |||
743 | 388 | <interface name="org.gnome.zeitgeist.DataSourceRegistry"> | ||
744 | 389 | <annotation name="org.gtk.EggDBus.DocString" value="An extension which allows you to registers data sources in a central repository. This allows for example to disable some data sources."/> | ||
745 | 390 | <method name="RegisterDataSource"> | ||
746 | 391 | <arg direction="in" type="s" name="unique_id"/> | ||
747 | 392 | <arg direction="in" type="s" name="name"/> | ||
748 | 393 | <arg direction="in" type="s" name="description"/> | ||
749 | 394 | <arg direction="in" type="a(asaasay)" name="event_templates"> | ||
750 | 395 | <annotation name="org.gtk.EggDBus.Type" value="Array<Event>"/> | ||
751 | 396 | </arg> | ||
752 | 397 | <arg direction="out" type="b" name="result"/> | ||
753 | 398 | </method> | ||
754 | 399 | <method name="SetDataSourceEnabled"> | ||
755 | 400 | <arg direction="in" type="s" name="unique_id"/> | ||
756 | 401 | <arg direction="in" type="b" name="enabled"/> | ||
757 | 402 | </method> | ||
758 | 403 | <method name="GetDataSources"> | ||
759 | 404 | <arg direction="out" type="a(sssa(asaasay)bxb)"> | ||
760 | 405 | <annotation name="org.gtk.EggDBus.Type" value="Array<DataSource>"/> | ||
761 | 406 | </arg> | ||
762 | 407 | </method> | ||
763 | 408 | |||
764 | 409 | <signal name="DataSourceRegistered"> | ||
765 | 410 | <arg type="(sssa(asaasay)bxb)"> | ||
766 | 411 | <annotation name="org.gtk.EggDBus.Type" value="DataSource"/> | ||
767 | 412 | </arg> | ||
768 | 413 | </signal> | ||
769 | 414 | <signal name="DataSourceDisconnected"> | ||
770 | 415 | <arg type="(sssa(asaasay)bxb)"> | ||
771 | 416 | <annotation name="org.gtk.EggDBus.Type" value="DataSource"/> | ||
772 | 417 | </arg> | ||
773 | 418 | </signal> | ||
774 | 419 | <signal name="DataSourceEnabled"> | ||
775 | 420 | <arg type="s" name="unique_id"/> | ||
776 | 421 | <arg type="b" name="enabled"/> | ||
777 | 422 | </signal> | ||
778 | 423 | </interface> | ||
779 | 424 | |||
780 | 352 | </node> | 425 | </node> |
781 | 353 | 426 | ||
782 | === added file 'src/zeitgeist-data-source-registry.c' | |||
783 | --- src/zeitgeist-data-source-registry.c 1970-01-01 00:00:00 +0000 | |||
784 | +++ src/zeitgeist-data-source-registry.c 2010-07-23 10:53:43 +0000 | |||
785 | @@ -0,0 +1,527 @@ | |||
786 | 1 | /* | ||
787 | 2 | * Copyright (C) 2010 Canonical, Ltd. | ||
788 | 3 | * | ||
789 | 4 | * This library is free software; you can redistribute it and/or modify | ||
790 | 5 | * it under the terms of the GNU Lesser General Public License | ||
791 | 6 | * version 3.0 as published by the Free Software Foundation. | ||
792 | 7 | * | ||
793 | 8 | * This library is distributed in the hope that it will be useful, | ||
794 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
795 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
796 | 11 | * GNU Lesser General Public License version 3.0 for more details. | ||
797 | 12 | * | ||
798 | 13 | * You should have received a copy of the GNU Lesser General Public | ||
799 | 14 | * License along with this library. If not, see | ||
800 | 15 | * <http://www.gnu.org/licenses/>. | ||
801 | 16 | * | ||
802 | 17 | * Authored by: Michal Hruby <michal.mhr@gmail.com> | ||
803 | 18 | */ | ||
804 | 19 | |||
805 | 20 | #if HAVE_CONFIG_H | ||
806 | 21 | #include <config.h> | ||
807 | 22 | #endif | ||
808 | 23 | |||
809 | 24 | #include "zeitgeist-data-source-registry.h" | ||
810 | 25 | #include "zeitgeist-eggdbusconversions.h" | ||
811 | 26 | #include "zeitgeist-marshal.h" | ||
812 | 27 | #include "eggzeitgeistbindings.h" | ||
813 | 28 | |||
814 | 29 | /** | ||
815 | 30 | * SECTION:zeitgeist-data-source-registry | ||
816 | 31 | * @short_description: Query the Zeitgeist Data Source Registry extension | ||
817 | 32 | * @include: zeitgeist.h | ||
818 | 33 | * | ||
819 | 34 | * The Zeitgeist engine maintains a publicly available list of recognized | ||
820 | 35 | * data-sources (components inserting information into Zeitgeist). | ||
821 | 36 | * #ZeitgeistDataSourceRegistry is used to register new data sources, | ||
822 | 37 | * get information about them and gives the ability to enable or disable | ||
823 | 38 | * the data sources. | ||
824 | 39 | */ | ||
825 | 40 | |||
826 | 41 | G_DEFINE_TYPE (ZeitgeistDataSourceRegistry, | ||
827 | 42 | zeitgeist_data_source_registry, | ||
828 | 43 | G_TYPE_OBJECT); | ||
829 | 44 | #define ZEITGEIST_DATA_SOURCE_REGISTRY_GET_PRIVATE(obj) \ | ||
830 | 45 | (G_TYPE_INSTANCE_GET_PRIVATE(obj, ZEITGEIST_TYPE_DATA_SOURCE_REGISTRY, \ | ||
831 | 46 | ZeitgeistDataSourceRegistryPrivate)) | ||
832 | 47 | |||
833 | 48 | typedef struct | ||
834 | 49 | { | ||
835 | 50 | /* The connection to the ZG daemon | ||
836 | 51 | * Note: The EggZeitgeistDataSourceRegistry is owned by | ||
837 | 52 | * the EggDBusObjectProxy! | ||
838 | 53 | */ | ||
839 | 54 | EggDBusObjectProxy *registry_proxy; | ||
840 | 55 | EggZeitgeistDataSourceRegistry *registry; | ||
841 | 56 | |||
842 | 57 | gulong src_registered_id; | ||
843 | 58 | gulong src_disconnected_id; | ||
844 | 59 | gulong src_enabled_id; | ||
845 | 60 | |||
846 | 61 | } ZeitgeistDataSourceRegistryPrivate; | ||
847 | 62 | |||
848 | 63 | /* Property ids */ | ||
849 | 64 | enum | ||
850 | 65 | { | ||
851 | 66 | PROP_0, | ||
852 | 67 | |||
853 | 68 | LAST_PROPERTY | ||
854 | 69 | }; | ||
855 | 70 | |||
856 | 71 | enum | ||
857 | 72 | { | ||
858 | 73 | SOURCE_REGISTERED, | ||
859 | 74 | SOURCE_ENABLED, | ||
860 | 75 | SOURCE_DISCONNECTED, | ||
861 | 76 | |||
862 | 77 | LAST_SIGNAL | ||
863 | 78 | }; | ||
864 | 79 | static guint _registry_signals[LAST_SIGNAL] = { 0 }; | ||
865 | 80 | |||
866 | 81 | static void | ||
867 | 82 | zeitgeist_data_source_registry_init (ZeitgeistDataSourceRegistry *self) | ||
868 | 83 | { | ||
869 | 84 | ZeitgeistDataSourceRegistryPrivate *priv; | ||
870 | 85 | EggDBusConnection *conn; | ||
871 | 86 | |||
872 | 87 | priv = ZEITGEIST_DATA_SOURCE_REGISTRY_GET_PRIVATE (self); | ||
873 | 88 | |||
874 | 89 | /* Set up the connection to the ZG daemon */ | ||
875 | 90 | conn = egg_dbus_connection_get_for_bus (EGG_DBUS_BUS_TYPE_SESSION); | ||
876 | 91 | priv->registry_proxy = | ||
877 | 92 | egg_dbus_connection_get_object_proxy (conn, | ||
878 | 93 | "org.gnome.zeitgeist.Engine", | ||
879 | 94 | "/org/gnome/zeitgeist/data_source_registry"); | ||
880 | 95 | |||
881 | 96 | priv->registry = | ||
882 | 97 | EGG_ZEITGEIST_QUERY_INTERFACE_DATA_SOURCE_REGISTRY (priv->registry_proxy); | ||
883 | 98 | g_object_unref (conn); | ||
884 | 99 | } | ||
885 | 100 | |||
886 | 101 | static void | ||
887 | 102 | zeitgeist_data_source_registry_finalize (GObject *object) | ||
888 | 103 | { | ||
889 | 104 | ZeitgeistDataSourceRegistry *registry; | ||
890 | 105 | ZeitgeistDataSourceRegistryPrivate *priv; | ||
891 | 106 | |||
892 | 107 | registry = ZEITGEIST_DATA_SOURCE_REGISTRY (object); | ||
893 | 108 | priv = ZEITGEIST_DATA_SOURCE_REGISTRY_GET_PRIVATE (registry); | ||
894 | 109 | |||
895 | 110 | if (priv->src_registered_id) | ||
896 | 111 | { | ||
897 | 112 | g_signal_handler_disconnect (priv->registry, priv->src_registered_id); | ||
898 | 113 | } | ||
899 | 114 | |||
900 | 115 | if (priv->src_disconnected_id) | ||
901 | 116 | { | ||
902 | 117 | g_signal_handler_disconnect (priv->registry, priv->src_disconnected_id); | ||
903 | 118 | } | ||
904 | 119 | |||
905 | 120 | if (priv->src_enabled_id) | ||
906 | 121 | { | ||
907 | 122 | g_signal_handler_disconnect (priv->registry, priv->src_enabled_id); | ||
908 | 123 | } | ||
909 | 124 | |||
910 | 125 | /* Note: priv->registry is owned by priv->registry_proxy */ | ||
911 | 126 | if (priv->registry_proxy) | ||
912 | 127 | { | ||
913 | 128 | g_object_unref (priv->registry_proxy); | ||
914 | 129 | } | ||
915 | 130 | |||
916 | 131 | G_OBJECT_CLASS (zeitgeist_data_source_registry_parent_class)->finalize (object); | ||
917 | 132 | } | ||
918 | 133 | |||
919 | 134 | static void | ||
920 | 135 | zeitgeist_data_source_registry_get_property (GObject *object, | ||
921 | 136 | guint prop_id, | ||
922 | 137 | GValue *value, | ||
923 | 138 | GParamSpec *pspec) | ||
924 | 139 | { | ||
925 | 140 | ZeitgeistDataSourceRegistryPrivate *priv; | ||
926 | 141 | |||
927 | 142 | priv = ZEITGEIST_DATA_SOURCE_REGISTRY_GET_PRIVATE (object); | ||
928 | 143 | |||
929 | 144 | switch (prop_id) | ||
930 | 145 | { | ||
931 | 146 | default: | ||
932 | 147 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | ||
933 | 148 | return; | ||
934 | 149 | break; | ||
935 | 150 | } | ||
936 | 151 | } | ||
937 | 152 | |||
938 | 153 | static void | ||
939 | 154 | zeitgeist_data_source_registry_set_property (GObject *object, | ||
940 | 155 | guint prop_id, | ||
941 | 156 | const GValue *value, | ||
942 | 157 | GParamSpec *pspec) | ||
943 | 158 | { | ||
944 | 159 | ZeitgeistDataSourceRegistryPrivate *priv; | ||
945 | 160 | |||
946 | 161 | priv = ZEITGEIST_DATA_SOURCE_REGISTRY_GET_PRIVATE (object); | ||
947 | 162 | |||
948 | 163 | switch (prop_id) | ||
949 | 164 | { | ||
950 | 165 | default: | ||
951 | 166 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | ||
952 | 167 | return; | ||
953 | 168 | break; | ||
954 | 169 | } | ||
955 | 170 | } | ||
956 | 171 | |||
957 | 172 | static void | ||
958 | 173 | zeitgeist_data_source_registry_src_registered ( | ||
959 | 174 | ZeitgeistDataSourceRegistry *registry, | ||
960 | 175 | EggZeitgeistDataSource *source) | ||
961 | 176 | { | ||
962 | 177 | ZeitgeistDataSource *data_source; | ||
963 | 178 | |||
964 | 179 | data_source = _egg_zeitgeist_data_source_to_zeitgeist_data_source (source); | ||
965 | 180 | |||
966 | 181 | g_signal_emit (registry, _registry_signals[SOURCE_REGISTERED], | ||
967 | 182 | 0, data_source); | ||
968 | 183 | |||
969 | 184 | g_object_unref (data_source); | ||
970 | 185 | } | ||
971 | 186 | |||
972 | 187 | static void | ||
973 | 188 | zeitgeist_data_source_registry_src_disconnected ( | ||
974 | 189 | ZeitgeistDataSourceRegistry *registry, | ||
975 | 190 | EggZeitgeistDataSource *source) | ||
976 | 191 | { | ||
977 | 192 | ZeitgeistDataSource *data_source; | ||
978 | 193 | |||
979 | 194 | data_source = _egg_zeitgeist_data_source_to_zeitgeist_data_source (source); | ||
980 | 195 | |||
981 | 196 | g_signal_emit (registry, _registry_signals[SOURCE_DISCONNECTED], | ||
982 | 197 | 0, data_source); | ||
983 | 198 | |||
984 | 199 | g_object_unref (data_source); | ||
985 | 200 | } | ||
986 | 201 | |||
987 | 202 | static void | ||
988 | 203 | zeitgeist_data_source_registry_src_enabled ( | ||
989 | 204 | ZeitgeistDataSourceRegistry *registry, | ||
990 | 205 | gchar *unique_id, | ||
991 | 206 | gboolean enabled) | ||
992 | 207 | { | ||
993 | 208 | g_signal_emit (registry, _registry_signals[SOURCE_ENABLED], | ||
994 | 209 | 0, unique_id, enabled); | ||
995 | 210 | } | ||
996 | 211 | |||
997 | 212 | static void | ||
998 | 213 | zeitgeist_data_source_registry_constructed (GObject *object) | ||
999 | 214 | { | ||
1000 | 215 | ZeitgeistDataSourceRegistryPrivate *priv; | ||
1001 | 216 | |||
1002 | 217 | priv = ZEITGEIST_DATA_SOURCE_REGISTRY_GET_PRIVATE (object); | ||
1003 | 218 | |||
1004 | 219 | priv->src_registered_id = g_signal_connect_swapped ( | ||
1005 | 220 | priv->registry, "data-source-registered", | ||
1006 | 221 | G_CALLBACK (zeitgeist_data_source_registry_src_registered), | ||
1007 | 222 | object); | ||
1008 | 223 | priv->src_disconnected_id = g_signal_connect_swapped ( | ||
1009 | 224 | priv->registry, "data-source-disconnected", | ||
1010 | 225 | G_CALLBACK (zeitgeist_data_source_registry_src_disconnected), | ||
1011 | 226 | object); | ||
1012 | 227 | priv->src_enabled_id = g_signal_connect_swapped ( | ||
1013 | 228 | priv->registry, "data-source-enabled", | ||
1014 | 229 | G_CALLBACK (zeitgeist_data_source_registry_src_enabled), | ||
1015 | 230 | object); | ||
1016 | 231 | } | ||
1017 | 232 | |||
1018 | 233 | static void | ||
1019 | 234 | zeitgeist_data_source_registry_class_init (ZeitgeistDataSourceRegistryClass *klass) | ||
1020 | 235 | { | ||
1021 | 236 | GObjectClass *object_class = G_OBJECT_CLASS (klass); | ||
1022 | 237 | GParamSpec *pspec; | ||
1023 | 238 | |||
1024 | 239 | object_class->finalize = zeitgeist_data_source_registry_finalize; | ||
1025 | 240 | object_class->get_property = zeitgeist_data_source_registry_get_property; | ||
1026 | 241 | object_class->set_property = zeitgeist_data_source_registry_set_property; | ||
1027 | 242 | object_class->constructed = zeitgeist_data_source_registry_constructed; | ||
1028 | 243 | |||
1029 | 244 | _registry_signals[SOURCE_REGISTERED] = | ||
1030 | 245 | g_signal_new ("source-registered", | ||
1031 | 246 | G_OBJECT_CLASS_TYPE (object_class), | ||
1032 | 247 | G_SIGNAL_RUN_FIRST, | ||
1033 | 248 | G_STRUCT_OFFSET (ZeitgeistDataSourceRegistryClass, source_registered), | ||
1034 | 249 | NULL, NULL, | ||
1035 | 250 | g_cclosure_marshal_VOID__OBJECT, | ||
1036 | 251 | G_TYPE_NONE, 1, ZEITGEIST_TYPE_DATA_SOURCE); | ||
1037 | 252 | |||
1038 | 253 | _registry_signals[SOURCE_DISCONNECTED] = | ||
1039 | 254 | g_signal_new ("source-disconnected", | ||
1040 | 255 | G_OBJECT_CLASS_TYPE (object_class), | ||
1041 | 256 | G_SIGNAL_RUN_FIRST, | ||
1042 | 257 | G_STRUCT_OFFSET (ZeitgeistDataSourceRegistryClass, source_disconnected), | ||
1043 | 258 | NULL, NULL, | ||
1044 | 259 | g_cclosure_marshal_VOID__OBJECT, | ||
1045 | 260 | G_TYPE_NONE, 1, ZEITGEIST_TYPE_DATA_SOURCE); | ||
1046 | 261 | |||
1047 | 262 | _registry_signals[SOURCE_ENABLED] = | ||
1048 | 263 | g_signal_new ("source-enabled", | ||
1049 | 264 | G_OBJECT_CLASS_TYPE (object_class), | ||
1050 | 265 | G_SIGNAL_RUN_FIRST, | ||
1051 | 266 | G_STRUCT_OFFSET (ZeitgeistDataSourceRegistryClass, source_enabled), | ||
1052 | 267 | NULL, NULL, | ||
1053 | 268 | _zeitgeist_cclosure_marshal_VOID__STRING_BOOLEAN, | ||
1054 | 269 | G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_BOOLEAN); | ||
1055 | 270 | |||
1056 | 271 | g_type_class_add_private (object_class, | ||
1057 | 272 | sizeof (ZeitgeistDataSourceRegistryPrivate)); | ||
1058 | 273 | } | ||
1059 | 274 | |||
1060 | 275 | /* Used to marshal the async callbacks from EggDBus into ones | ||
1061 | 276 | * coming from this DataSourceRegistry instance */ | ||
1062 | 277 | static void | ||
1063 | 278 | dispatch_async_callback (GObject *source_object, | ||
1064 | 279 | GAsyncResult *res, | ||
1065 | 280 | gpointer user_data) | ||
1066 | 281 | { | ||
1067 | 282 | gpointer *data = (gpointer*) user_data; | ||
1068 | 283 | ZeitgeistDataSourceRegistry *self = ZEITGEIST_DATA_SOURCE_REGISTRY (data[0]); | ||
1069 | 284 | GAsyncReadyCallback callback = (GAsyncReadyCallback) data[1]; | ||
1070 | 285 | gpointer _user_data = data[2]; | ||
1071 | 286 | |||
1072 | 287 | if (callback != NULL) | ||
1073 | 288 | { | ||
1074 | 289 | callback (G_OBJECT (self), res, _user_data); | ||
1075 | 290 | } | ||
1076 | 291 | |||
1077 | 292 | g_object_unref (self); | ||
1078 | 293 | g_free (user_data); | ||
1079 | 294 | } | ||
1080 | 295 | |||
1081 | 296 | /* | ||
1082 | 297 | * API BELOW HERE | ||
1083 | 298 | */ | ||
1084 | 299 | |||
1085 | 300 | /** | ||
1086 | 301 | * zeitgeist_data_source_registry_new: | ||
1087 | 302 | * | ||
1088 | 303 | * Create a new data source registry instance. | ||
1089 | 304 | * | ||
1090 | 305 | * DataSourceRegistry instances are not overly expensive for neither | ||
1091 | 306 | * client or the Zeitgeist daemon so there's no need to go to lengths | ||
1092 | 307 | * to keep singleton instances around. | ||
1093 | 308 | * | ||
1094 | 309 | * Returns: A reference to a newly allocated registry. | ||
1095 | 310 | */ | ||
1096 | 311 | ZeitgeistDataSourceRegistry* | ||
1097 | 312 | zeitgeist_data_source_registry_new (void) | ||
1098 | 313 | { | ||
1099 | 314 | ZeitgeistDataSourceRegistry *registry; | ||
1100 | 315 | |||
1101 | 316 | registry = (ZeitgeistDataSourceRegistry*) | ||
1102 | 317 | g_object_new (ZEITGEIST_TYPE_DATA_SOURCE_REGISTRY, NULL); | ||
1103 | 318 | |||
1104 | 319 | return registry; | ||
1105 | 320 | } | ||
1106 | 321 | |||
1107 | 322 | void | ||
1108 | 323 | zeitgeist_data_source_registry_get_data_sources ( | ||
1109 | 324 | ZeitgeistDataSourceRegistry *self, | ||
1110 | 325 | GCancellable *cancellable, | ||
1111 | 326 | GAsyncReadyCallback callback, | ||
1112 | 327 | gpointer user_data) | ||
1113 | 328 | { | ||
1114 | 329 | ZeitgeistDataSourceRegistryPrivate *priv; | ||
1115 | 330 | gpointer *dispatch_data; | ||
1116 | 331 | |||
1117 | 332 | g_return_if_fail (ZEITGEIST_IS_DATA_SOURCE_REGISTRY (self)); | ||
1118 | 333 | g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); | ||
1119 | 334 | |||
1120 | 335 | priv = ZEITGEIST_DATA_SOURCE_REGISTRY_GET_PRIVATE (self); | ||
1121 | 336 | |||
1122 | 337 | dispatch_data = g_new (gpointer, 3); | ||
1123 | 338 | dispatch_data[0] = g_object_ref (self); | ||
1124 | 339 | dispatch_data[1] = callback; | ||
1125 | 340 | dispatch_data[2] = user_data; | ||
1126 | 341 | |||
1127 | 342 | egg_zeitgeist_data_source_registry_get_data_sources ( | ||
1128 | 343 | priv->registry, | ||
1129 | 344 | EGG_DBUS_CALL_FLAGS_NONE, | ||
1130 | 345 | cancellable, | ||
1131 | 346 | dispatch_async_callback, | ||
1132 | 347 | dispatch_data); | ||
1133 | 348 | } | ||
1134 | 349 | |||
1135 | 350 | /** | ||
1136 | 351 | * zeitgeist_data_source_registry_get_data_sources_finish: | ||
1137 | 352 | * @self: Instance of #ZeitgeistDataSourceRegistry. | ||
1138 | 353 | * @res: a #GAsyncResult. | ||
1139 | 354 | * @error: a #GError or #NULL. | ||
1140 | 355 | * | ||
1141 | 356 | * Returns: Newly created #GPtrArray containing #ZeitgeistDataSource<!-- -->(s) | ||
1142 | 357 | * registered in Zeitgeist. Free using g_ptr_array_unref() once | ||
1143 | 358 | * you're done using it. | ||
1144 | 359 | */ | ||
1145 | 360 | GPtrArray* | ||
1146 | 361 | zeitgeist_data_source_registry_get_data_sources_finish ( | ||
1147 | 362 | ZeitgeistDataSourceRegistry *self, | ||
1148 | 363 | GAsyncResult *res, | ||
1149 | 364 | GError **error) | ||
1150 | 365 | { | ||
1151 | 366 | ZeitgeistDataSourceRegistryPrivate *priv; | ||
1152 | 367 | EggDBusArraySeq *array_seq; | ||
1153 | 368 | gboolean call_result; | ||
1154 | 369 | GPtrArray *data_sources = NULL; | ||
1155 | 370 | |||
1156 | 371 | g_return_val_if_fail (ZEITGEIST_IS_DATA_SOURCE_REGISTRY (self), NULL); | ||
1157 | 372 | |||
1158 | 373 | priv = ZEITGEIST_DATA_SOURCE_REGISTRY_GET_PRIVATE (self); | ||
1159 | 374 | |||
1160 | 375 | call_result = egg_zeitgeist_data_source_registry_get_data_sources_finish ( | ||
1161 | 376 | priv->registry, | ||
1162 | 377 | &array_seq, | ||
1163 | 378 | res, | ||
1164 | 379 | error); | ||
1165 | 380 | |||
1166 | 381 | data_sources = | ||
1167 | 382 | _egg_zeitgeist_data_sources_to_zeitgeist_data_sources (array_seq); | ||
1168 | 383 | g_ptr_array_set_free_func (data_sources, g_object_unref); | ||
1169 | 384 | |||
1170 | 385 | g_object_unref (array_seq); | ||
1171 | 386 | |||
1172 | 387 | return data_sources; | ||
1173 | 388 | } | ||
1174 | 389 | |||
1175 | 390 | /** | ||
1176 | 391 | * zeitgeist_data_source_registry_register_data_source: | ||
1177 | 392 | * @self: Instance of #ZeitgeistDataSourceRegistry. | ||
1178 | 393 | * @source: Data source to register. | ||
1179 | 394 | * @cancellable: a #GCancellable or #NULL. | ||
1180 | 395 | * @callback: a GAsyncReadyCallback to call when the request is finished. | ||
1181 | 396 | * @user_data: the data to pass to callback function. | ||
1182 | 397 | * | ||
1183 | 398 | * Registers new data source in the registry, the @source parameter needs to | ||
1184 | 399 | * have unique-id, name, description and optionally event_templates set, | ||
1185 | 400 | * therefore it is useful to pass #ZeitgeistDataSource instance created using | ||
1186 | 401 | * zeitgeist_data_source_new_full(). The registry will assume its ownership. | ||
1187 | 402 | */ | ||
1188 | 403 | void | ||
1189 | 404 | zeitgeist_data_source_registry_register_data_source ( | ||
1190 | 405 | ZeitgeistDataSourceRegistry *self, | ||
1191 | 406 | ZeitgeistDataSource *source, | ||
1192 | 407 | GCancellable *cancellable, | ||
1193 | 408 | GAsyncReadyCallback callback, | ||
1194 | 409 | gpointer user_data) | ||
1195 | 410 | { | ||
1196 | 411 | ZeitgeistDataSourceRegistryPrivate *priv; | ||
1197 | 412 | gpointer *dispatch_data; | ||
1198 | 413 | EggDBusArraySeq *templates; | ||
1199 | 414 | |||
1200 | 415 | g_return_if_fail (ZEITGEIST_IS_DATA_SOURCE_REGISTRY (self)); | ||
1201 | 416 | g_return_if_fail (ZEITGEIST_IS_DATA_SOURCE (source)); | ||
1202 | 417 | g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); | ||
1203 | 418 | |||
1204 | 419 | priv = ZEITGEIST_DATA_SOURCE_REGISTRY_GET_PRIVATE (self); | ||
1205 | 420 | |||
1206 | 421 | g_object_ref_sink (G_OBJECT (source)); | ||
1207 | 422 | |||
1208 | 423 | dispatch_data = g_new (gpointer, 3); | ||
1209 | 424 | dispatch_data[0] = g_object_ref (self); | ||
1210 | 425 | dispatch_data[1] = callback; | ||
1211 | 426 | dispatch_data[2] = user_data; | ||
1212 | 427 | |||
1213 | 428 | templates = _zeitgeist_events_to_egg_zeitgeist_events ( | ||
1214 | 429 | zeitgeist_data_source_get_event_templates (source) | ||
1215 | 430 | ); | ||
1216 | 431 | |||
1217 | 432 | egg_zeitgeist_data_source_registry_register_data_source ( | ||
1218 | 433 | priv->registry, | ||
1219 | 434 | EGG_DBUS_CALL_FLAGS_NONE, | ||
1220 | 435 | zeitgeist_data_source_get_unique_id (source), | ||
1221 | 436 | zeitgeist_data_source_get_name (source), | ||
1222 | 437 | zeitgeist_data_source_get_description (source), | ||
1223 | 438 | templates, | ||
1224 | 439 | cancellable, | ||
1225 | 440 | dispatch_async_callback, | ||
1226 | 441 | dispatch_data); | ||
1227 | 442 | |||
1228 | 443 | g_object_unref (templates); | ||
1229 | 444 | g_object_unref (source); | ||
1230 | 445 | } | ||
1231 | 446 | |||
1232 | 447 | /** | ||
1233 | 448 | * zeitgeist_data_source_registry_register_data_source_finish: | ||
1234 | 449 | * @self: Instance of #ZeitgeistDataSourceRegistry. | ||
1235 | 450 | * @res: Result of the asynchronous operation. | ||
1236 | 451 | * @error: a #GError or NULL. | ||
1237 | 452 | * | ||
1238 | 453 | * Returns: If error is unset, returns whether this data source is enabled. | ||
1239 | 454 | */ | ||
1240 | 455 | gboolean | ||
1241 | 456 | zeitgeist_data_source_registry_register_data_source_finish ( | ||
1242 | 457 | ZeitgeistDataSourceRegistry *self, | ||
1243 | 458 | GAsyncResult *res, | ||
1244 | 459 | GError **error) | ||
1245 | 460 | { | ||
1246 | 461 | ZeitgeistDataSourceRegistryPrivate *priv; | ||
1247 | 462 | gboolean result = FALSE; | ||
1248 | 463 | |||
1249 | 464 | g_return_val_if_fail (ZEITGEIST_IS_DATA_SOURCE_REGISTRY (self), FALSE); | ||
1250 | 465 | |||
1251 | 466 | priv = ZEITGEIST_DATA_SOURCE_REGISTRY_GET_PRIVATE (self); | ||
1252 | 467 | |||
1253 | 468 | egg_zeitgeist_data_source_registry_register_data_source_finish ( | ||
1254 | 469 | priv->registry, | ||
1255 | 470 | &result, | ||
1256 | 471 | res, | ||
1257 | 472 | error); | ||
1258 | 473 | |||
1259 | 474 | return result; | ||
1260 | 475 | } | ||
1261 | 476 | |||
1262 | 477 | void | ||
1263 | 478 | zeitgeist_data_source_registry_set_data_source_enabled ( | ||
1264 | 479 | ZeitgeistDataSourceRegistry *self, | ||
1265 | 480 | const gchar *unique_id, | ||
1266 | 481 | gboolean enabled, | ||
1267 | 482 | GCancellable *cancellable, | ||
1268 | 483 | GAsyncReadyCallback callback, | ||
1269 | 484 | gpointer user_data) | ||
1270 | 485 | { | ||
1271 | 486 | ZeitgeistDataSourceRegistryPrivate *priv; | ||
1272 | 487 | gpointer *dispatch_data; | ||
1273 | 488 | |||
1274 | 489 | g_return_if_fail (ZEITGEIST_IS_DATA_SOURCE_REGISTRY (self)); | ||
1275 | 490 | g_return_if_fail (unique_id != NULL); | ||
1276 | 491 | g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); | ||
1277 | 492 | |||
1278 | 493 | priv = ZEITGEIST_DATA_SOURCE_REGISTRY_GET_PRIVATE (self); | ||
1279 | 494 | |||
1280 | 495 | dispatch_data = g_new (gpointer, 3); | ||
1281 | 496 | dispatch_data[0] = g_object_ref (self); | ||
1282 | 497 | dispatch_data[1] = callback; | ||
1283 | 498 | dispatch_data[2] = user_data; | ||
1284 | 499 | |||
1285 | 500 | egg_zeitgeist_data_source_registry_set_data_source_enabled ( | ||
1286 | 501 | priv->registry, | ||
1287 | 502 | EGG_DBUS_CALL_FLAGS_NONE, | ||
1288 | 503 | unique_id, | ||
1289 | 504 | enabled, | ||
1290 | 505 | cancellable, | ||
1291 | 506 | dispatch_async_callback, | ||
1292 | 507 | dispatch_data); | ||
1293 | 508 | } | ||
1294 | 509 | |||
1295 | 510 | void | ||
1296 | 511 | zeitgeist_data_source_registry_set_data_source_enabled_finish ( | ||
1297 | 512 | ZeitgeistDataSourceRegistry *self, | ||
1298 | 513 | GAsyncResult *res, | ||
1299 | 514 | GError **error) | ||
1300 | 515 | { | ||
1301 | 516 | ZeitgeistDataSourceRegistryPrivate *priv; | ||
1302 | 517 | |||
1303 | 518 | g_return_if_fail (ZEITGEIST_IS_DATA_SOURCE_REGISTRY (self)); | ||
1304 | 519 | |||
1305 | 520 | priv = ZEITGEIST_DATA_SOURCE_REGISTRY_GET_PRIVATE (self); | ||
1306 | 521 | |||
1307 | 522 | egg_zeitgeist_data_source_registry_set_data_source_enabled_finish ( | ||
1308 | 523 | priv->registry, | ||
1309 | 524 | res, | ||
1310 | 525 | error); | ||
1311 | 526 | } | ||
1312 | 527 | |||
1313 | 0 | 528 | ||
1314 | === added file 'src/zeitgeist-data-source-registry.h' | |||
1315 | --- src/zeitgeist-data-source-registry.h 1970-01-01 00:00:00 +0000 | |||
1316 | +++ src/zeitgeist-data-source-registry.h 2010-07-23 10:53:43 +0000 | |||
1317 | @@ -0,0 +1,108 @@ | |||
1318 | 1 | /* | ||
1319 | 2 | * Copyright (C) 2010 Canonical, Ltd. | ||
1320 | 3 | * | ||
1321 | 4 | * This library is free software; you can redistribute it and/or modify | ||
1322 | 5 | * it under the terms of the GNU Lesser General Public License | ||
1323 | 6 | * version 3.0 as published by the Free Software Foundation. | ||
1324 | 7 | * | ||
1325 | 8 | * This library is distributed in the hope that it will be useful, | ||
1326 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1327 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1328 | 11 | * GNU Lesser General Public License version 3.0 for more details. | ||
1329 | 12 | * | ||
1330 | 13 | * You should have received a copy of the GNU Lesser General Public | ||
1331 | 14 | * License along with this library. If not, see | ||
1332 | 15 | * <http://www.gnu.org/licenses/>. | ||
1333 | 16 | * | ||
1334 | 17 | * Authored by: Michal Hruby <michal.mhr@gmail.com> | ||
1335 | 18 | */ | ||
1336 | 19 | |||
1337 | 20 | #if !defined (_ZEITGEIST_H_INSIDE_) && !defined (ZEITGEIST_COMPILATION) | ||
1338 | 21 | #error "Only <zeitgeist.h> can be included directly." | ||
1339 | 22 | #endif | ||
1340 | 23 | |||
1341 | 24 | #ifndef _ZEITGEIST_DATA_SOURCE_REGISTRY_H_ | ||
1342 | 25 | #define _ZEITGEIST_DATA_SOURCE_REGISTRY_H_ | ||
1343 | 26 | |||
1344 | 27 | #include <glib.h> | ||
1345 | 28 | #include <glib-object.h> | ||
1346 | 29 | #include <gio/gio.h> | ||
1347 | 30 | #include <zeitgeist-event.h> | ||
1348 | 31 | #include <zeitgeist-enums.h> | ||
1349 | 32 | #include <zeitgeist-data-source.h> | ||
1350 | 33 | |||
1351 | 34 | G_BEGIN_DECLS | ||
1352 | 35 | |||
1353 | 36 | #define ZEITGEIST_TYPE_DATA_SOURCE_REGISTRY (zeitgeist_data_source_registry_get_type()) | ||
1354 | 37 | #define ZEITGEIST_DATA_SOURCE_REGISTRY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), ZEITGEIST_TYPE_DATA_SOURCE_REGISTRY, ZeitgeistDataSourceRegistry)) | ||
1355 | 38 | #define ZEITGEIST_DATA_SOURCE_REGISTRY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), ZEITGEIST_TYPE_DATA_SOURCE_REGISTRY, ZeitgeistDataSourceRegistryClass)) | ||
1356 | 39 | #define ZEITGEIST_DATA_SOURCE_REGISTRY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), ZEITGEIST_TYPE_DATA_SOURCE_REGISTRY, ZeitgeistDataSourceRegistryClass)) | ||
1357 | 40 | #define ZEITGEIST_IS_DATA_SOURCE_REGISTRY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), ZEITGEIST_TYPE_DATA_SOURCE_REGISTRY)) | ||
1358 | 41 | #define ZEITGEIST_IS_DATA_SOURCE_REGISTRY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), ZEITGEIST_TYPE_DATA_SOURCE_REGISTRY)) | ||
1359 | 42 | |||
1360 | 43 | typedef struct _ZeitgeistDataSourceRegistry ZeitgeistDataSourceRegistry; | ||
1361 | 44 | typedef struct _ZeitgeistDataSourceRegistryClass ZeitgeistDataSourceRegistryClass; | ||
1362 | 45 | |||
1363 | 46 | struct _ZeitgeistDataSourceRegistryClass | ||
1364 | 47 | { | ||
1365 | 48 | GObjectClass parent_class; | ||
1366 | 49 | |||
1367 | 50 | void (*source_registered) (ZeitgeistDataSourceRegistry *registry, | ||
1368 | 51 | ZeitgeistDataSource *source); | ||
1369 | 52 | void (*source_disconnected) (ZeitgeistDataSourceRegistry *registry, | ||
1370 | 53 | ZeitgeistDataSource *source); | ||
1371 | 54 | void (*source_enabled) (ZeitgeistDataSourceRegistry *registry, | ||
1372 | 55 | gchar *unique_id, | ||
1373 | 56 | gboolean enabled); | ||
1374 | 57 | }; | ||
1375 | 58 | |||
1376 | 59 | |||
1377 | 60 | struct _ZeitgeistDataSourceRegistry | ||
1378 | 61 | { | ||
1379 | 62 | GObject parent_instance; | ||
1380 | 63 | }; | ||
1381 | 64 | |||
1382 | 65 | GType zeitgeist_data_source_registry_get_type (void); | ||
1383 | 66 | |||
1384 | 67 | ZeitgeistDataSourceRegistry* zeitgeist_data_source_registry_new (void); | ||
1385 | 68 | |||
1386 | 69 | void zeitgeist_data_source_registry_get_data_sources ( | ||
1387 | 70 | ZeitgeistDataSourceRegistry *self, | ||
1388 | 71 | GCancellable *cancellable, | ||
1389 | 72 | GAsyncReadyCallback callback, | ||
1390 | 73 | gpointer user_data); | ||
1391 | 74 | |||
1392 | 75 | GPtrArray* zeitgeist_data_source_registry_get_data_sources_finish ( | ||
1393 | 76 | ZeitgeistDataSourceRegistry *self, | ||
1394 | 77 | GAsyncResult *res, | ||
1395 | 78 | GError **error); | ||
1396 | 79 | |||
1397 | 80 | void zeitgeist_data_source_registry_register_data_source ( | ||
1398 | 81 | ZeitgeistDataSourceRegistry *self, | ||
1399 | 82 | ZeitgeistDataSource *source, | ||
1400 | 83 | GCancellable *cancellable, | ||
1401 | 84 | GAsyncReadyCallback callback, | ||
1402 | 85 | gpointer user_data); | ||
1403 | 86 | |||
1404 | 87 | gboolean zeitgeist_data_source_registry_register_data_source_finish ( | ||
1405 | 88 | ZeitgeistDataSourceRegistry *self, | ||
1406 | 89 | GAsyncResult *res, | ||
1407 | 90 | GError **error); | ||
1408 | 91 | |||
1409 | 92 | void zeitgeist_data_source_registry_set_data_source_enabled ( | ||
1410 | 93 | ZeitgeistDataSourceRegistry *self, | ||
1411 | 94 | const gchar *unique_id, | ||
1412 | 95 | gboolean enabled, | ||
1413 | 96 | GCancellable *cancellable, | ||
1414 | 97 | GAsyncReadyCallback callback, | ||
1415 | 98 | gpointer user_data); | ||
1416 | 99 | |||
1417 | 100 | void zeitgeist_data_source_registry_set_data_source_enabled_finish ( | ||
1418 | 101 | ZeitgeistDataSourceRegistry *self, | ||
1419 | 102 | GAsyncResult *res, | ||
1420 | 103 | GError **error); | ||
1421 | 104 | |||
1422 | 105 | G_END_DECLS | ||
1423 | 106 | |||
1424 | 107 | #endif /* _ZEITGEIST_DATA_SOURCE_REGISTRY_H_ */ | ||
1425 | 108 | |||
1426 | 0 | 109 | ||
1427 | === added file 'src/zeitgeist-data-source.c' | |||
1428 | --- src/zeitgeist-data-source.c 1970-01-01 00:00:00 +0000 | |||
1429 | +++ src/zeitgeist-data-source.c 2010-07-23 10:53:43 +0000 | |||
1430 | @@ -0,0 +1,349 @@ | |||
1431 | 1 | /* | ||
1432 | 2 | * Copyright (C) 2010 Canonical, Ltd. | ||
1433 | 3 | * | ||
1434 | 4 | * This library is free software; you can redistribute it and/or modify | ||
1435 | 5 | * it under the terms of the GNU Lesser General Public License | ||
1436 | 6 | * version 3.0 as published by the Free Software Foundation. | ||
1437 | 7 | * | ||
1438 | 8 | * This library is distributed in the hope that it will be useful, | ||
1439 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1440 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1441 | 11 | * GNU Lesser General Public License version 3.0 for more details. | ||
1442 | 12 | * | ||
1443 | 13 | * You should have received a copy of the GNU Lesser General Public | ||
1444 | 14 | * License along with this library. If not, see | ||
1445 | 15 | * <http://www.gnu.org/licenses/>. | ||
1446 | 16 | * | ||
1447 | 17 | * Authored by: Michal Hruby <michal.mhr@gmail.com> | ||
1448 | 18 | */ | ||
1449 | 19 | |||
1450 | 20 | /** | ||
1451 | 21 | * SECTION:zeitgeist-data-source | ||
1452 | 22 | * @short_description: Abstracts data sources used by | ||
1453 | 23 | * the #ZeitgeistDataSourceRegistry extension | ||
1454 | 24 | * @include: zeitgeist.h | ||
1455 | 25 | * | ||
1456 | 26 | * #ZeitgeistDataSource represents a data source used to insert events into | ||
1457 | 27 | * Zeitgeist. The data sources are identified using the unique_id property, | ||
1458 | 28 | * and when querying the data source registry you get other interesting | ||
1459 | 29 | * information like timestamp of the last action of the data source, flag | ||
1460 | 30 | * whether it is currently running etc. | ||
1461 | 31 | */ | ||
1462 | 32 | #if HAVE_CONFIG_H | ||
1463 | 33 | #include <config.h> | ||
1464 | 34 | #endif | ||
1465 | 35 | |||
1466 | 36 | #include "zeitgeist-data-source.h" | ||
1467 | 37 | |||
1468 | 38 | G_DEFINE_TYPE (ZeitgeistDataSource, zeitgeist_data_source, G_TYPE_INITIALLY_UNOWNED); | ||
1469 | 39 | #define ZEITGEIST_DATA_SOURCE_GET_PRIVATE(obj) \ | ||
1470 | 40 | (G_TYPE_INSTANCE_GET_PRIVATE(obj, ZEITGEIST_TYPE_DATA_SOURCE, ZeitgeistDataSourcePrivate)) | ||
1471 | 41 | |||
1472 | 42 | typedef struct | ||
1473 | 43 | { | ||
1474 | 44 | gchar *unique_id; | ||
1475 | 45 | gchar *name; | ||
1476 | 46 | gchar *description; | ||
1477 | 47 | GPtrArray *templates; | ||
1478 | 48 | gboolean running; | ||
1479 | 49 | gint64 timestamp; | ||
1480 | 50 | gboolean enabled; | ||
1481 | 51 | } ZeitgeistDataSourcePrivate; | ||
1482 | 52 | |||
1483 | 53 | /** | ||
1484 | 54 | * zeitgeist_data_source_new: | ||
1485 | 55 | * | ||
1486 | 56 | * Create a new empty data source structure. | ||
1487 | 57 | * | ||
1488 | 58 | * Returns: A new instance of #ZeitgeistDataSource. The returned src will | ||
1489 | 59 | * have a floating reference which will be consumed if you pass the | ||
1490 | 60 | * data source to any of the methods provided by this library (like | ||
1491 | 61 | * registering the data source). If you do not do that then you | ||
1492 | 62 | * must free the data source youself with g_object_unref(). | ||
1493 | 63 | */ | ||
1494 | 64 | ZeitgeistDataSource* | ||
1495 | 65 | zeitgeist_data_source_new (void) | ||
1496 | 66 | { | ||
1497 | 67 | return g_object_new (ZEITGEIST_TYPE_DATA_SOURCE, NULL); | ||
1498 | 68 | } | ||
1499 | 69 | /** | ||
1500 | 70 | * zeitgeist_data_source_new_full: | ||
1501 | 71 | * @id: Unique ID for the data source. | ||
1502 | 72 | * @name: Name of the data source (may be translated). | ||
1503 | 73 | * @desc: Data source description. | ||
1504 | 74 | * @event_templates: A #GPtrArray of #ZeitgeistEvent<!-- -->s. This parameter | ||
1505 | 75 | * is optional and purely informational to let data-source | ||
1506 | 76 | * management applications and other data-sources know what | ||
1507 | 77 | * sort of information the data source logs. | ||
1508 | 78 | * The data source will assume ownership of the events and | ||
1509 | 79 | * the pointer array. | ||
1510 | 80 | * If you want to keep a reference for yourself you must do a | ||
1511 | 81 | * g_ptr_array_ref() on @event_templates as well as reffing | ||
1512 | 82 | * the events held by it before calling this method. | ||
1513 | 83 | * | ||
1514 | 84 | * Creates a new instance of DataSource with the given ID, name and | ||
1515 | 85 | * description. | ||
1516 | 86 | * | ||
1517 | 87 | * Returns: New instance of #ZeitgeistDataSource with floating reference, | ||
1518 | 88 | * if you do not pass the instance to method like | ||
1519 | 89 | * zeitgeist_data_source_registry_register_data_source(), then you | ||
1520 | 90 | * have to free the data source yourself using g_object_unref(). | ||
1521 | 91 | */ | ||
1522 | 92 | ZeitgeistDataSource* | ||
1523 | 93 | zeitgeist_data_source_new_full (const gchar *id, | ||
1524 | 94 | const gchar *name, | ||
1525 | 95 | const gchar *desc, | ||
1526 | 96 | GPtrArray *templates) | ||
1527 | 97 | { | ||
1528 | 98 | ZeitgeistDataSource* src = zeitgeist_data_source_new (); | ||
1529 | 99 | |||
1530 | 100 | zeitgeist_data_source_set_unique_id (src, id); | ||
1531 | 101 | zeitgeist_data_source_set_name (src, name); | ||
1532 | 102 | zeitgeist_data_source_set_description (src, desc); | ||
1533 | 103 | zeitgeist_data_source_set_event_templates (src, templates); | ||
1534 | 104 | |||
1535 | 105 | return src; | ||
1536 | 106 | } | ||
1537 | 107 | |||
1538 | 108 | const gchar* | ||
1539 | 109 | zeitgeist_data_source_get_unique_id (ZeitgeistDataSource *src) | ||
1540 | 110 | { | ||
1541 | 111 | ZeitgeistDataSourcePrivate *priv; | ||
1542 | 112 | g_return_val_if_fail (ZEITGEIST_IS_DATA_SOURCE (src), NULL); | ||
1543 | 113 | |||
1544 | 114 | priv = ZEITGEIST_DATA_SOURCE_GET_PRIVATE (src); | ||
1545 | 115 | |||
1546 | 116 | return priv->unique_id; | ||
1547 | 117 | } | ||
1548 | 118 | |||
1549 | 119 | void | ||
1550 | 120 | zeitgeist_data_source_set_unique_id (ZeitgeistDataSource *src, | ||
1551 | 121 | const gchar* unique_id) | ||
1552 | 122 | { | ||
1553 | 123 | ZeitgeistDataSourcePrivate *priv; | ||
1554 | 124 | g_return_if_fail (ZEITGEIST_IS_DATA_SOURCE (src)); | ||
1555 | 125 | |||
1556 | 126 | priv = ZEITGEIST_DATA_SOURCE_GET_PRIVATE (src); | ||
1557 | 127 | |||
1558 | 128 | if (priv->unique_id) | ||
1559 | 129 | { | ||
1560 | 130 | g_free (priv->unique_id); | ||
1561 | 131 | } | ||
1562 | 132 | |||
1563 | 133 | priv->unique_id = g_strdup (unique_id); | ||
1564 | 134 | } | ||
1565 | 135 | |||
1566 | 136 | const gchar* | ||
1567 | 137 | zeitgeist_data_source_get_name (ZeitgeistDataSource *src) | ||
1568 | 138 | { | ||
1569 | 139 | ZeitgeistDataSourcePrivate *priv; | ||
1570 | 140 | g_return_val_if_fail (ZEITGEIST_IS_DATA_SOURCE (src), NULL); | ||
1571 | 141 | |||
1572 | 142 | priv = ZEITGEIST_DATA_SOURCE_GET_PRIVATE (src); | ||
1573 | 143 | |||
1574 | 144 | return priv->name; | ||
1575 | 145 | } | ||
1576 | 146 | |||
1577 | 147 | void | ||
1578 | 148 | zeitgeist_data_source_set_name (ZeitgeistDataSource *src, | ||
1579 | 149 | const gchar *name) | ||
1580 | 150 | { | ||
1581 | 151 | ZeitgeistDataSourcePrivate *priv; | ||
1582 | 152 | g_return_if_fail (ZEITGEIST_IS_DATA_SOURCE (src)); | ||
1583 | 153 | |||
1584 | 154 | priv = ZEITGEIST_DATA_SOURCE_GET_PRIVATE (src); | ||
1585 | 155 | |||
1586 | 156 | if (priv->name) | ||
1587 | 157 | { | ||
1588 | 158 | g_free (priv->name); | ||
1589 | 159 | } | ||
1590 | 160 | |||
1591 | 161 | priv->name = g_strdup (name); | ||
1592 | 162 | } | ||
1593 | 163 | |||
1594 | 164 | const gchar* | ||
1595 | 165 | zeitgeist_data_source_get_description (ZeitgeistDataSource *src) | ||
1596 | 166 | { | ||
1597 | 167 | ZeitgeistDataSourcePrivate *priv; | ||
1598 | 168 | g_return_val_if_fail (ZEITGEIST_IS_DATA_SOURCE (src), NULL); | ||
1599 | 169 | |||
1600 | 170 | priv = ZEITGEIST_DATA_SOURCE_GET_PRIVATE (src); | ||
1601 | 171 | |||
1602 | 172 | return priv->description; | ||
1603 | 173 | } | ||
1604 | 174 | |||
1605 | 175 | void | ||
1606 | 176 | zeitgeist_data_source_set_description (ZeitgeistDataSource *src, | ||
1607 | 177 | const gchar *description) | ||
1608 | 178 | { | ||
1609 | 179 | ZeitgeistDataSourcePrivate *priv; | ||
1610 | 180 | g_return_if_fail (ZEITGEIST_IS_DATA_SOURCE (src)); | ||
1611 | 181 | |||
1612 | 182 | priv = ZEITGEIST_DATA_SOURCE_GET_PRIVATE (src); | ||
1613 | 183 | |||
1614 | 184 | if (priv->description) | ||
1615 | 185 | { | ||
1616 | 186 | g_free (priv->description); | ||
1617 | 187 | } | ||
1618 | 188 | |||
1619 | 189 | priv->description = g_strdup (description); | ||
1620 | 190 | } | ||
1621 | 191 | |||
1622 | 192 | GPtrArray* | ||
1623 | 193 | zeitgeist_data_source_get_event_templates (ZeitgeistDataSource *src) | ||
1624 | 194 | { | ||
1625 | 195 | ZeitgeistDataSourcePrivate *priv; | ||
1626 | 196 | g_return_val_if_fail (ZEITGEIST_IS_DATA_SOURCE (src), NULL); | ||
1627 | 197 | |||
1628 | 198 | priv = ZEITGEIST_DATA_SOURCE_GET_PRIVATE (src); | ||
1629 | 199 | |||
1630 | 200 | return priv->templates; | ||
1631 | 201 | } | ||
1632 | 202 | |||
1633 | 203 | /** | ||
1634 | 204 | * zeitgeist_data_source_set_event_templates: | ||
1635 | 205 | * @src: Instance of #ZeitgeistDataSource. | ||
1636 | 206 | * @event_templates: A #GPtrArray which contains elements of type | ||
1637 | 207 | * #ZeitgeistEvent. | ||
1638 | 208 | * The data source will assume ownership of the events and | ||
1639 | 209 | * the pointer array. | ||
1640 | 210 | * If you want to keep a reference for yourself you must do a | ||
1641 | 211 | * g_ptr_array_ref() on @templates as well as reffing | ||
1642 | 212 | * the events held by it before calling this method. | ||
1643 | 213 | * | ||
1644 | 214 | * Sets event templates which are logged by this #ZeitgeistDataSource | ||
1645 | 215 | * instance. | ||
1646 | 216 | */ | ||
1647 | 217 | void | ||
1648 | 218 | zeitgeist_data_source_set_event_templates (ZeitgeistDataSource *src, | ||
1649 | 219 | GPtrArray *event_templates) | ||
1650 | 220 | { | ||
1651 | 221 | ZeitgeistDataSourcePrivate *priv; | ||
1652 | 222 | g_return_if_fail (ZEITGEIST_IS_DATA_SOURCE (src)); | ||
1653 | 223 | |||
1654 | 224 | priv = ZEITGEIST_DATA_SOURCE_GET_PRIVATE (src); | ||
1655 | 225 | |||
1656 | 226 | if (priv->templates) | ||
1657 | 227 | { | ||
1658 | 228 | g_ptr_array_unref (priv->templates); | ||
1659 | 229 | } | ||
1660 | 230 | |||
1661 | 231 | if (event_templates) | ||
1662 | 232 | { | ||
1663 | 233 | g_ptr_array_foreach (event_templates, (GFunc) g_object_ref_sink, NULL); | ||
1664 | 234 | g_ptr_array_set_free_func (event_templates, g_object_unref); | ||
1665 | 235 | } | ||
1666 | 236 | |||
1667 | 237 | priv->templates = event_templates; | ||
1668 | 238 | } | ||
1669 | 239 | |||
1670 | 240 | gboolean | ||
1671 | 241 | zeitgeist_data_source_is_running (ZeitgeistDataSource *src) | ||
1672 | 242 | { | ||
1673 | 243 | ZeitgeistDataSourcePrivate *priv; | ||
1674 | 244 | g_return_val_if_fail (ZEITGEIST_IS_DATA_SOURCE (src), FALSE); | ||
1675 | 245 | |||
1676 | 246 | priv = ZEITGEIST_DATA_SOURCE_GET_PRIVATE (src); | ||
1677 | 247 | |||
1678 | 248 | return priv->running; | ||
1679 | 249 | } | ||
1680 | 250 | |||
1681 | 251 | void | ||
1682 | 252 | zeitgeist_data_source_set_running (ZeitgeistDataSource *src, | ||
1683 | 253 | gboolean running) | ||
1684 | 254 | { | ||
1685 | 255 | ZeitgeistDataSourcePrivate *priv; | ||
1686 | 256 | g_return_if_fail (ZEITGEIST_IS_DATA_SOURCE (src)); | ||
1687 | 257 | |||
1688 | 258 | priv = ZEITGEIST_DATA_SOURCE_GET_PRIVATE (src); | ||
1689 | 259 | |||
1690 | 260 | priv->running = running; | ||
1691 | 261 | } | ||
1692 | 262 | |||
1693 | 263 | gint64 | ||
1694 | 264 | zeitgeist_data_source_get_timestamp (ZeitgeistDataSource *src) | ||
1695 | 265 | { | ||
1696 | 266 | ZeitgeistDataSourcePrivate *priv; | ||
1697 | 267 | g_return_val_if_fail (ZEITGEIST_IS_DATA_SOURCE (src), 0); | ||
1698 | 268 | |||
1699 | 269 | priv = ZEITGEIST_DATA_SOURCE_GET_PRIVATE (src); | ||
1700 | 270 | |||
1701 | 271 | return priv->timestamp; | ||
1702 | 272 | } | ||
1703 | 273 | |||
1704 | 274 | void | ||
1705 | 275 | zeitgeist_data_source_set_timestamp (ZeitgeistDataSource *src, | ||
1706 | 276 | gint64 timestamp) | ||
1707 | 277 | { | ||
1708 | 278 | ZeitgeistDataSourcePrivate *priv; | ||
1709 | 279 | g_return_if_fail (ZEITGEIST_IS_DATA_SOURCE (src)); | ||
1710 | 280 | |||
1711 | 281 | priv = ZEITGEIST_DATA_SOURCE_GET_PRIVATE (src); | ||
1712 | 282 | |||
1713 | 283 | priv->timestamp = timestamp; | ||
1714 | 284 | } | ||
1715 | 285 | |||
1716 | 286 | gboolean | ||
1717 | 287 | zeitgeist_data_source_is_enabled (ZeitgeistDataSource *src) | ||
1718 | 288 | { | ||
1719 | 289 | ZeitgeistDataSourcePrivate *priv; | ||
1720 | 290 | g_return_val_if_fail (ZEITGEIST_IS_DATA_SOURCE (src), FALSE); | ||
1721 | 291 | |||
1722 | 292 | priv = ZEITGEIST_DATA_SOURCE_GET_PRIVATE (src); | ||
1723 | 293 | |||
1724 | 294 | return priv->enabled; | ||
1725 | 295 | } | ||
1726 | 296 | |||
1727 | 297 | void | ||
1728 | 298 | zeitgeist_data_source_set_enabled (ZeitgeistDataSource *src, | ||
1729 | 299 | gboolean enabled) | ||
1730 | 300 | { | ||
1731 | 301 | ZeitgeistDataSourcePrivate *priv; | ||
1732 | 302 | g_return_if_fail (ZEITGEIST_IS_DATA_SOURCE (src)); | ||
1733 | 303 | |||
1734 | 304 | priv = ZEITGEIST_DATA_SOURCE_GET_PRIVATE (src); | ||
1735 | 305 | |||
1736 | 306 | priv->enabled = enabled; | ||
1737 | 307 | } | ||
1738 | 308 | |||
1739 | 309 | static void | ||
1740 | 310 | zeitgeist_data_source_init (ZeitgeistDataSource *object) | ||
1741 | 311 | { | ||
1742 | 312 | ZeitgeistDataSourcePrivate *priv; | ||
1743 | 313 | |||
1744 | 314 | priv = ZEITGEIST_DATA_SOURCE_GET_PRIVATE (object); | ||
1745 | 315 | priv->unique_id = NULL; | ||
1746 | 316 | priv->name = NULL; | ||
1747 | 317 | priv->description = NULL; | ||
1748 | 318 | priv->templates = NULL; | ||
1749 | 319 | priv->running = FALSE; | ||
1750 | 320 | priv->timestamp = 0; | ||
1751 | 321 | priv->enabled = TRUE; | ||
1752 | 322 | } | ||
1753 | 323 | |||
1754 | 324 | static void | ||
1755 | 325 | zeitgeist_data_source_finalize (GObject *object) | ||
1756 | 326 | { | ||
1757 | 327 | ZeitgeistDataSource *src = ZEITGEIST_DATA_SOURCE (object); | ||
1758 | 328 | ZeitgeistDataSourcePrivate *priv; | ||
1759 | 329 | |||
1760 | 330 | priv = ZEITGEIST_DATA_SOURCE_GET_PRIVATE (src); | ||
1761 | 331 | |||
1762 | 332 | zeitgeist_data_source_set_unique_id (src, NULL); | ||
1763 | 333 | zeitgeist_data_source_set_name (src, NULL); | ||
1764 | 334 | zeitgeist_data_source_set_description (src, NULL); | ||
1765 | 335 | zeitgeist_data_source_set_event_templates (src, NULL); | ||
1766 | 336 | |||
1767 | 337 | G_OBJECT_CLASS (zeitgeist_data_source_parent_class)->finalize (object); | ||
1768 | 338 | } | ||
1769 | 339 | |||
1770 | 340 | static void | ||
1771 | 341 | zeitgeist_data_source_class_init (ZeitgeistDataSourceClass *klass) | ||
1772 | 342 | { | ||
1773 | 343 | GObjectClass* object_class = G_OBJECT_CLASS (klass); | ||
1774 | 344 | |||
1775 | 345 | object_class->finalize = zeitgeist_data_source_finalize; | ||
1776 | 346 | |||
1777 | 347 | g_type_class_add_private (object_class, sizeof (ZeitgeistDataSourcePrivate)); | ||
1778 | 348 | } | ||
1779 | 349 | |||
1780 | 0 | 350 | ||
1781 | === added file 'src/zeitgeist-data-source.h' | |||
1782 | --- src/zeitgeist-data-source.h 1970-01-01 00:00:00 +0000 | |||
1783 | +++ src/zeitgeist-data-source.h 2010-07-23 10:53:43 +0000 | |||
1784 | @@ -0,0 +1,101 @@ | |||
1785 | 1 | /* | ||
1786 | 2 | * Copyright (C) 2010 Canonical, Ltd. | ||
1787 | 3 | * | ||
1788 | 4 | * This library is free software; you can redistribute it and/or modify | ||
1789 | 5 | * it under the terms of the GNU Lesser General Public License | ||
1790 | 6 | * version 3.0 as published by the Free Software Foundation. | ||
1791 | 7 | * | ||
1792 | 8 | * This library is distributed in the hope that it will be useful, | ||
1793 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1794 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1795 | 11 | * GNU Lesser General Public License version 3.0 for more details. | ||
1796 | 12 | * | ||
1797 | 13 | * You should have received a copy of the GNU Lesser General Public | ||
1798 | 14 | * License along with this library. If not, see | ||
1799 | 15 | * <http://www.gnu.org/licenses/>. | ||
1800 | 16 | * | ||
1801 | 17 | * Authored by: Michal Hruby <michal.mhr@gmail.com> | ||
1802 | 18 | */ | ||
1803 | 19 | |||
1804 | 20 | #if !defined (_ZEITGEIST_H_INSIDE_) && !defined (ZEITGEIST_COMPILATION) | ||
1805 | 21 | #error "Only <zeitgeist.h> can be included directly." | ||
1806 | 22 | #endif | ||
1807 | 23 | |||
1808 | 24 | #ifndef _ZEITGEIST_DATA_SOURCE_H_ | ||
1809 | 25 | #define _ZEITGEIST_DATA_SOURCE_H_ | ||
1810 | 26 | |||
1811 | 27 | #include <glib.h> | ||
1812 | 28 | #include <glib-object.h> | ||
1813 | 29 | |||
1814 | 30 | G_BEGIN_DECLS | ||
1815 | 31 | |||
1816 | 32 | #define ZEITGEIST_TYPE_DATA_SOURCE (zeitgeist_data_source_get_type ()) | ||
1817 | 33 | |||
1818 | 34 | #define ZEITGEIST_DATA_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ | ||
1819 | 35 | ZEITGEIST_TYPE_DATA_SOURCE, ZeitgeistDataSource)) | ||
1820 | 36 | |||
1821 | 37 | #define ZEITGEIST_DATA_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \ | ||
1822 | 38 | ZEITGEIST_TYPE_DATA_SOURCE, ZeitgeistDataSourceClass)) | ||
1823 | 39 | |||
1824 | 40 | #define ZEITGEIST_IS_DATA_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ | ||
1825 | 41 | ZEITGEIST_TYPE_DATA_SOURCE)) | ||
1826 | 42 | |||
1827 | 43 | #define ZEITGEIST_IS_DATA_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \ | ||
1828 | 44 | ZEITGEIST_TYPE_DATA_SOURCE)) | ||
1829 | 45 | |||
1830 | 46 | #define ZEITGEIST_DATA_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \ | ||
1831 | 47 | ZEITGEIST_TYPE_DATA_SOURCE, ZeitgeistDataSourceClass)) | ||
1832 | 48 | |||
1833 | 49 | typedef struct _ZeitgeistDataSource ZeitgeistDataSource; | ||
1834 | 50 | typedef struct _ZeitgeistDataSourceClass ZeitgeistDataSourceClass; | ||
1835 | 51 | |||
1836 | 52 | struct _ZeitgeistDataSourceClass | ||
1837 | 53 | { | ||
1838 | 54 | GInitiallyUnownedClass parent_class; | ||
1839 | 55 | }; | ||
1840 | 56 | |||
1841 | 57 | |||
1842 | 58 | struct _ZeitgeistDataSource | ||
1843 | 59 | { | ||
1844 | 60 | GInitiallyUnowned parent_instance; | ||
1845 | 61 | }; | ||
1846 | 62 | |||
1847 | 63 | GType zeitgeist_data_source_get_type (void); | ||
1848 | 64 | |||
1849 | 65 | ZeitgeistDataSource* zeitgeist_data_source_new (void); | ||
1850 | 66 | ZeitgeistDataSource* zeitgeist_data_source_new_full (const gchar *id, | ||
1851 | 67 | const gchar *name, | ||
1852 | 68 | const gchar *desc, | ||
1853 | 69 | GPtrArray *event_templates); | ||
1854 | 70 | |||
1855 | 71 | const gchar* zeitgeist_data_source_get_unique_id (ZeitgeistDataSource *src); | ||
1856 | 72 | void zeitgeist_data_source_set_unique_id (ZeitgeistDataSource *src, | ||
1857 | 73 | const gchar* unique_id); | ||
1858 | 74 | |||
1859 | 75 | const gchar* zeitgeist_data_source_get_name (ZeitgeistDataSource *src); | ||
1860 | 76 | void zeitgeist_data_source_set_name (ZeitgeistDataSource *src, | ||
1861 | 77 | const gchar *name); | ||
1862 | 78 | |||
1863 | 79 | const gchar* zeitgeist_data_source_get_description (ZeitgeistDataSource *src); | ||
1864 | 80 | void zeitgeist_data_source_set_description (ZeitgeistDataSource *src, | ||
1865 | 81 | const gchar *description); | ||
1866 | 82 | |||
1867 | 83 | GPtrArray* zeitgeist_data_source_get_event_templates (ZeitgeistDataSource *src); | ||
1868 | 84 | void zeitgeist_data_source_set_event_templates (ZeitgeistDataSource *src, | ||
1869 | 85 | GPtrArray *event_templates); | ||
1870 | 86 | |||
1871 | 87 | gboolean zeitgeist_data_source_is_running (ZeitgeistDataSource *src); | ||
1872 | 88 | void zeitgeist_data_source_set_running (ZeitgeistDataSource *src, | ||
1873 | 89 | gboolean running); | ||
1874 | 90 | |||
1875 | 91 | gint64 zeitgeist_data_source_get_timestamp (ZeitgeistDataSource *src); | ||
1876 | 92 | void zeitgeist_data_source_set_timestamp (ZeitgeistDataSource *src, | ||
1877 | 93 | gint64 timestamp); | ||
1878 | 94 | |||
1879 | 95 | gboolean zeitgeist_data_source_is_enabled (ZeitgeistDataSource *src); | ||
1880 | 96 | void zeitgeist_data_source_set_enabled (ZeitgeistDataSource *src, | ||
1881 | 97 | gboolean enabled); | ||
1882 | 98 | |||
1883 | 99 | G_END_DECLS | ||
1884 | 100 | |||
1885 | 101 | #endif /* _ZEITGEIST_DATA_SOURCE_H_ */ | ||
1886 | 0 | 102 | ||
1887 | === modified file 'src/zeitgeist-eggdbusconversions.c' | |||
1888 | --- src/zeitgeist-eggdbusconversions.c 2010-05-09 00:13:04 +0000 | |||
1889 | +++ src/zeitgeist-eggdbusconversions.c 2010-07-23 10:53:43 +0000 | |||
1890 | @@ -298,3 +298,54 @@ | |||
1891 | 298 | 298 | ||
1892 | 299 | return result; | 299 | return result; |
1893 | 300 | } | 300 | } |
1894 | 301 | |||
1895 | 302 | ZeitgeistDataSource* | ||
1896 | 303 | _egg_zeitgeist_data_source_to_zeitgeist_data_source (EggZeitgeistDataSource *data_source) | ||
1897 | 304 | { | ||
1898 | 305 | ZeitgeistDataSource *result; | ||
1899 | 306 | GPtrArray *templates; | ||
1900 | 307 | gboolean running; | ||
1901 | 308 | gboolean enabled; | ||
1902 | 309 | gint64 timestamp; | ||
1903 | 310 | |||
1904 | 311 | g_return_val_if_fail (EGG_ZEITGEIST_IS_DATA_SOURCE (data_source), NULL); | ||
1905 | 312 | |||
1906 | 313 | templates = _egg_zeitgeist_events_to_zeitgeist_events (egg_zeitgeist_data_source_get_event_templates (data_source)); | ||
1907 | 314 | |||
1908 | 315 | result = zeitgeist_data_source_new_full ( | ||
1909 | 316 | egg_zeitgeist_data_source_get_unique_id (data_source), | ||
1910 | 317 | egg_zeitgeist_data_source_get_name (data_source), | ||
1911 | 318 | egg_zeitgeist_data_source_get_description (data_source), | ||
1912 | 319 | templates); | ||
1913 | 320 | |||
1914 | 321 | running = egg_zeitgeist_data_source_get_running (data_source); | ||
1915 | 322 | enabled = egg_zeitgeist_data_source_get_enabled (data_source); | ||
1916 | 323 | timestamp = egg_zeitgeist_data_source_get_last_seen (data_source); | ||
1917 | 324 | |||
1918 | 325 | zeitgeist_data_source_set_running (result, running); | ||
1919 | 326 | zeitgeist_data_source_set_timestamp (result, timestamp); | ||
1920 | 327 | zeitgeist_data_source_set_enabled (result, enabled); | ||
1921 | 328 | |||
1922 | 329 | return result; | ||
1923 | 330 | } | ||
1924 | 331 | |||
1925 | 332 | GPtrArray* | ||
1926 | 333 | _egg_zeitgeist_data_sources_to_zeitgeist_data_sources (EggDBusArraySeq *data_sources) | ||
1927 | 334 | { | ||
1928 | 335 | GPtrArray *result; | ||
1929 | 336 | EggZeitgeistDataSource *source; | ||
1930 | 337 | gint i, num_sources; | ||
1931 | 338 | |||
1932 | 339 | g_return_val_if_fail (EGG_DBUS_IS_ARRAY_SEQ (data_sources), NULL); | ||
1933 | 340 | |||
1934 | 341 | num_sources = egg_dbus_array_seq_get_size (data_sources); | ||
1935 | 342 | result = g_ptr_array_sized_new (num_sources); | ||
1936 | 343 | for (i = 0; i < num_sources; i++) | ||
1937 | 344 | { | ||
1938 | 345 | source = EGG_ZEITGEIST_DATA_SOURCE (egg_dbus_array_seq_get (data_sources, i)); | ||
1939 | 346 | g_ptr_array_add (result, _egg_zeitgeist_data_source_to_zeitgeist_data_source (source)); | ||
1940 | 347 | } | ||
1941 | 348 | |||
1942 | 349 | return result; | ||
1943 | 350 | } | ||
1944 | 351 | |||
1945 | 301 | 352 | ||
1946 | === modified file 'src/zeitgeist-eggdbusconversions.h' | |||
1947 | --- src/zeitgeist-eggdbusconversions.h 2010-04-19 14:58:18 +0000 | |||
1948 | +++ src/zeitgeist-eggdbusconversions.h 2010-07-23 10:53:43 +0000 | |||
1949 | @@ -22,8 +22,10 @@ | |||
1950 | 22 | #define _ZEITGEIST_EGGDBUSCONVERSIONS_H_ | 22 | #define _ZEITGEIST_EGGDBUSCONVERSIONS_H_ |
1951 | 23 | 23 | ||
1952 | 24 | #include <glib-object.h> | 24 | #include <glib-object.h> |
1953 | 25 | #include "zeitgeist-data-source.h" | ||
1954 | 25 | #include "zeitgeist-event.h" | 26 | #include "zeitgeist-event.h" |
1955 | 26 | #include "zeitgeist-timerange.h" | 27 | #include "zeitgeist-timerange.h" |
1956 | 28 | #include "eggzeitgeistdatasource.h" | ||
1957 | 27 | #include "eggzeitgeistevent.h" | 29 | #include "eggzeitgeistevent.h" |
1958 | 28 | #include "eggzeitgeisttimerange.h" | 30 | #include "eggzeitgeisttimerange.h" |
1959 | 29 | #include "eggzeitgeisteventdataoffset.h" | 31 | #include "eggzeitgeisteventdataoffset.h" |
1960 | @@ -40,12 +42,16 @@ | |||
1961 | 40 | 42 | ||
1962 | 41 | EggDBusArraySeq* _zeitgeist_events_to_egg_zeitgeist_events (GPtrArray *events); | 43 | EggDBusArraySeq* _zeitgeist_events_to_egg_zeitgeist_events (GPtrArray *events); |
1963 | 42 | 44 | ||
1965 | 43 | GPtrArray* _zeitgeist_events_from_valist (va_list events); | 45 | GPtrArray* _zeitgeist_events_from_valist (va_list events); |
1966 | 44 | 46 | ||
1967 | 45 | EggZeitgeistTimeRange* _zeitgeist_time_range_to_egg_zeitgeist_time_range (ZeitgeistTimeRange *time_range); | 47 | EggZeitgeistTimeRange* _zeitgeist_time_range_to_egg_zeitgeist_time_range (ZeitgeistTimeRange *time_range); |
1968 | 46 | 48 | ||
1969 | 47 | ZeitgeistTimeRange* _egg_zeitgeist_time_range_to_zeitgeist_time_range (EggZeitgeistTimeRange *time_range); | 49 | ZeitgeistTimeRange* _egg_zeitgeist_time_range_to_zeitgeist_time_range (EggZeitgeistTimeRange *time_range); |
1970 | 48 | 50 | ||
1971 | 51 | ZeitgeistDataSource* _egg_zeitgeist_data_source_to_zeitgeist_data_source (EggZeitgeistDataSource *data_source); | ||
1972 | 52 | |||
1973 | 53 | GPtrArray* _egg_zeitgeist_data_sources_to_zeitgeist_data_sources (EggDBusArraySeq *data_sources); | ||
1974 | 54 | |||
1975 | 49 | G_END_DECLS | 55 | G_END_DECLS |
1976 | 50 | 56 | ||
1977 | 51 | #endif /* _ZEITGEIST_EGGDBUSCONVERSIONS_H_ */ | ||
1978 | 52 | \ No newline at end of file | 57 | \ No newline at end of file |
1979 | 58 | #endif /* _ZEITGEIST_EGGDBUSCONVERSIONS_H_ */ | ||
1980 | 53 | 59 | ||
1981 | === modified file 'src/zeitgeist.h' | |||
1982 | --- src/zeitgeist.h 2010-06-16 13:32:40 +0000 | |||
1983 | +++ src/zeitgeist.h 2010-07-23 10:53:43 +0000 | |||
1984 | @@ -23,6 +23,8 @@ | |||
1985 | 23 | 23 | ||
1986 | 24 | #define _ZEITGEIST_H_INSIDE_ | 24 | #define _ZEITGEIST_H_INSIDE_ |
1987 | 25 | 25 | ||
1988 | 26 | #include <zeitgeist-data-source.h> | ||
1989 | 27 | #include <zeitgeist-data-source-registry.h> | ||
1990 | 26 | #include <zeitgeist-enums.h> | 28 | #include <zeitgeist-enums.h> |
1991 | 27 | #include <zeitgeist-enumtypes.h> | 29 | #include <zeitgeist-enumtypes.h> |
1992 | 28 | #include <zeitgeist-event.h> | 30 | #include <zeitgeist-event.h> |
1993 | @@ -39,4 +41,4 @@ | |||
1994 | 39 | 41 | ||
1995 | 40 | #undef _ZEITGEIST_H_INSIDE_ | 42 | #undef _ZEITGEIST_H_INSIDE_ |
1996 | 41 | 43 | ||
1997 | 42 | #endif /* _ZEITGEIST_H_ */ | ||
1998 | 43 | \ No newline at end of file | 44 | \ No newline at end of file |
1999 | 45 | #endif /* _ZEITGEIST_H_ */ | ||
2000 | 44 | 46 | ||
2001 | === modified file 'tests/Makefile.am' | |||
2002 | --- tests/Makefile.am 2010-06-17 11:26:15 +0000 | |||
2003 | +++ tests/Makefile.am 2010-07-23 10:53:43 +0000 | |||
2004 | @@ -18,6 +18,8 @@ | |||
2005 | 18 | test.desktop | 18 | test.desktop |
2006 | 19 | 19 | ||
2007 | 20 | helper_sources = \ | 20 | helper_sources = \ |
2008 | 21 | $(top_srcdir)/src/eggzeitgeistdatasource.c \ | ||
2009 | 22 | $(top_srcdir)/src/eggzeitgeistdatasource.h \ | ||
2010 | 21 | $(top_srcdir)/src/eggzeitgeistevent.c \ | 23 | $(top_srcdir)/src/eggzeitgeistevent.c \ |
2011 | 22 | $(top_srcdir)/src/eggzeitgeistevent.h \ | 24 | $(top_srcdir)/src/eggzeitgeistevent.h \ |
2012 | 23 | $(top_srcdir)/src/eggzeitgeisttimerange.c \ | 25 | $(top_srcdir)/src/eggzeitgeisttimerange.c \ |
2013 | 24 | 26 | ||
2014 | === modified file 'tests/test-eggdbusconversions.c' | |||
2015 | --- tests/test-eggdbusconversions.c 2010-05-04 16:55:56 +0000 | |||
2016 | +++ tests/test-eggdbusconversions.c 2010-07-23 10:53:43 +0000 | |||
2017 | @@ -19,9 +19,11 @@ | |||
2018 | 19 | 19 | ||
2019 | 20 | #include <glib.h> | 20 | #include <glib.h> |
2020 | 21 | #include <glib-object.h> | 21 | #include <glib-object.h> |
2021 | 22 | #include "zeitgeist-data-source.h" | ||
2022 | 22 | #include "zeitgeist-event.h" | 23 | #include "zeitgeist-event.h" |
2023 | 23 | #include "zeitgeist-subject.h" | 24 | #include "zeitgeist-subject.h" |
2024 | 24 | #include "zeitgeist-eggdbusconversions.h" | 25 | #include "zeitgeist-eggdbusconversions.h" |
2025 | 26 | #include "zeitgeist-timestamp.h" | ||
2026 | 25 | 27 | ||
2027 | 26 | typedef struct | 28 | typedef struct |
2028 | 27 | { | 29 | { |
2029 | @@ -410,6 +412,74 @@ | |||
2030 | 410 | } | 412 | } |
2031 | 411 | 413 | ||
2032 | 412 | static void | 414 | static void |
2033 | 415 | test_egg_to_z_ds_empty (Fixture *fix, gconstpointer data) | ||
2034 | 416 | { | ||
2035 | 417 | ZeitgeistDataSource *zds; | ||
2036 | 418 | EggZeitgeistDataSource *eggds; | ||
2037 | 419 | EggDBusArraySeq *templates; | ||
2038 | 420 | |||
2039 | 421 | templates = egg_dbus_array_seq_new (EGG_ZEITGEIST_TYPE_DATA_SOURCE, | ||
2040 | 422 | g_object_unref, | ||
2041 | 423 | NULL, | ||
2042 | 424 | NULL); | ||
2043 | 425 | |||
2044 | 426 | eggds = egg_zeitgeist_data_source_new ("", "", "", templates, | ||
2045 | 427 | FALSE, 0, FALSE); | ||
2046 | 428 | |||
2047 | 429 | zds = _egg_zeitgeist_data_source_to_zeitgeist_data_source (eggds); | ||
2048 | 430 | |||
2049 | 431 | /* We unref the eggds here to assert that we have completely separated | ||
2050 | 432 | * the memory of the converted data source */ | ||
2051 | 433 | g_object_unref (eggds); | ||
2052 | 434 | g_object_unref (templates); | ||
2053 | 435 | |||
2054 | 436 | g_assert_cmpstr ("", ==, zeitgeist_data_source_get_unique_id (zds)); | ||
2055 | 437 | g_assert_cmpstr ("", ==, zeitgeist_data_source_get_name (zds)); | ||
2056 | 438 | g_assert_cmpstr ("", ==, zeitgeist_data_source_get_description (zds)); | ||
2057 | 439 | g_assert_cmpint (0, ==, zeitgeist_data_source_is_running (zds)); | ||
2058 | 440 | g_assert_cmpint (0, ==, zeitgeist_data_source_is_enabled (zds)); | ||
2059 | 441 | g_assert_cmpint (0, ==, zeitgeist_data_source_get_timestamp (zds)); | ||
2060 | 442 | |||
2061 | 443 | g_object_unref (zds); | ||
2062 | 444 | } | ||
2063 | 445 | |||
2064 | 446 | static void | ||
2065 | 447 | test_egg_to_z_ds_full (Fixture *fix, gconstpointer data) | ||
2066 | 448 | { | ||
2067 | 449 | ZeitgeistDataSource *zds; | ||
2068 | 450 | EggZeitgeistDataSource *eggds; | ||
2069 | 451 | EggDBusArraySeq *templates; | ||
2070 | 452 | gint64 timestamp; | ||
2071 | 453 | |||
2072 | 454 | templates = egg_dbus_array_seq_new (EGG_ZEITGEIST_TYPE_DATA_SOURCE, | ||
2073 | 455 | g_object_unref, | ||
2074 | 456 | NULL, | ||
2075 | 457 | NULL); | ||
2076 | 458 | timestamp = zeitgeist_timestamp_for_now (); | ||
2077 | 459 | |||
2078 | 460 | eggds = egg_zeitgeist_data_source_new ("id", "name", "desc", templates, | ||
2079 | 461 | FALSE, | ||
2080 | 462 | timestamp, | ||
2081 | 463 | TRUE); | ||
2082 | 464 | |||
2083 | 465 | zds = _egg_zeitgeist_data_source_to_zeitgeist_data_source (eggds); | ||
2084 | 466 | |||
2085 | 467 | /* We unref the eggds here to assert that we have completely separated | ||
2086 | 468 | * the memory of the converted data source */ | ||
2087 | 469 | g_object_unref (eggds); | ||
2088 | 470 | g_object_unref (templates); | ||
2089 | 471 | |||
2090 | 472 | g_assert_cmpstr ("id", ==, zeitgeist_data_source_get_unique_id (zds)); | ||
2091 | 473 | g_assert_cmpstr ("name", ==, zeitgeist_data_source_get_name (zds)); | ||
2092 | 474 | g_assert_cmpstr ("desc", ==, zeitgeist_data_source_get_description (zds)); | ||
2093 | 475 | g_assert_cmpint (0, ==, zeitgeist_data_source_is_running (zds)); | ||
2094 | 476 | g_assert_cmpint (0, !=, zeitgeist_data_source_is_enabled (zds)); | ||
2095 | 477 | g_assert_cmpint (timestamp, ==, zeitgeist_data_source_get_timestamp (zds)); | ||
2096 | 478 | |||
2097 | 479 | g_object_unref (zds); | ||
2098 | 480 | } | ||
2099 | 481 | |||
2100 | 482 | static void | ||
2101 | 413 | test_timestamp (Fixture *fix, gconstpointer data) | 483 | test_timestamp (Fixture *fix, gconstpointer data) |
2102 | 414 | { | 484 | { |
2103 | 415 | ZeitgeistEvent *zev; | 485 | ZeitgeistEvent *zev; |
2104 | @@ -469,8 +539,14 @@ | |||
2105 | 469 | g_test_add ("/Zeitgeist/EggDBusConversions/EggToZEmpty", Fixture, NULL, | 539 | g_test_add ("/Zeitgeist/EggDBusConversions/EggToZEmpty", Fixture, NULL, |
2106 | 470 | setup, test_egg_to_z_empty, teardown); | 540 | setup, test_egg_to_z_empty, teardown); |
2107 | 471 | 541 | ||
2108 | 542 | g_test_add ("/Zeitgeist/EggDBusConversions/EggToZDSFull", Fixture, NULL, | ||
2109 | 543 | setup, test_egg_to_z_ds_full, teardown); | ||
2110 | 544 | |||
2111 | 545 | g_test_add ("/Zeitgeist/EggDBusConversions/EggToZDSEmpty", Fixture, NULL, | ||
2112 | 546 | setup, test_egg_to_z_ds_empty, teardown); | ||
2113 | 547 | |||
2114 | 472 | g_test_add ("/Zeitgeist/EggDBusConversions/Timestamp", Fixture, NULL, | 548 | g_test_add ("/Zeitgeist/EggDBusConversions/Timestamp", Fixture, NULL, |
2115 | 473 | setup, test_timestamp, teardown); | 549 | setup, test_timestamp, teardown); |
2116 | 474 | 550 | ||
2117 | 475 | return g_test_run(); | 551 | return g_test_run(); |
2118 | 476 | } | ||
2119 | 477 | \ No newline at end of file | 552 | \ No newline at end of file |
2120 | 553 | } |
Outstanding work Michal! A few comments, but nothing critical:
1) There is a comment "... coming from this Index instance ..." which should probably be s/Index/data source registry/
2) You need a line break after the symbol name in the docstring for zeitgeist_ data_source_ registry_ new()
3) Can you add a bit of documentation to the ZeitgeistDataSource section?
4) Can you document that you are stealing the ref to the GPtrArray in zeitgeist_ data_source_ set_templates( )
5) I prefer that getters returning booleans are named as foo_is_*(). This affects zeitgeist_ data_source_ get_{running, enabled} ()
6) Please add some unit tests for the conversion between the eggdbus stuff and the native types
7) Integrate the two new types into the gtk-doc
If you fix this I'd be delighted to merge you branch :-)
And as a bonus you could perhaps add some more doc strings, but it's ok if you don't...