Merge lp:~mhr3/libzeitgeist/symbols into lp:libzeitgeist

Proposed by Michal Hruby
Status: Merged
Merged at revision: 159
Proposed branch: lp:~mhr3/libzeitgeist/symbols
Merge into: lp:libzeitgeist
Diff against target: 2181 lines (+2043/-1)
14 files modified
bindings/zeitgeist-1.0-custom.vala (+12/-0)
bindings/zeitgeist-1.0.gi (+30/-1)
bindings/zeitgeist-1.0.metadata (+4/-0)
bindings/zeitgeist-1.0.vapi (+11/-0)
doc/reference/zeitgeist-1.0-docs.sgml (+1/-0)
doc/reference/zeitgeist-1.0-sections.txt (+9/-0)
src/Makefile.am (+3/-0)
src/zeitgeist-symbols.c (+1389/-0)
src/zeitgeist-symbols.h (+42/-0)
src/zeitgeist.h (+1/-0)
tests/Makefile.am (+4/-0)
tests/test-symbols.c (+220/-0)
tools/symboltree2c.py (+107/-0)
tools/zeitgeist-symbols.template (+210/-0)
To merge this branch: bzr merge lp:~mhr3/libzeitgeist/symbols
Reviewer Review Type Date Requested Status
Mikkel Kamstrup Erlandsen Approve
Review via email: mp+32040@code.launchpad.net

Description of the change

First stab at a Symbol API, currently exposes only zeitgeist_symbol_is_a function, which can tell that a VECTOR_IMAGE is descendant of MEDIA etc. The C code is generated by the symboltree2c python script extracted from ZG ontology. I wonder if also other methods could be useful for libzg users?

To post a comment you must log in.
Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

Nice! Some comments:

 1) I'd like to see a symbol_info_new() that takes ownership of the arguments since you introduce a lot of memory reallocation when building the symbol tree.

 2) Author in test-symbols.c is you, not me :-)

 3) I'd like to see get_children(), get_all_children(), and get_parents() as well. At least it is my experience that you quickly end up needing those once you start getting into it

 4) API documentation is needed for the public functions

 5) a VAPI update?

 6) Nice and thorough work on the unit tests!

review: Needs Fixing
lp:~mhr3/libzeitgeist/symbols updated
159. By Michal Hruby

Act upon review comments

Revision history for this message
Michal Hruby (mhr3) wrote :

Fixed 2) 3) 4) 5).

As for 1) I'm not inclined to make it take ownership, because it's taking GStrv, and therefore it'd suggest to free the data using g_strfreev(), but I pass static strings, so they don't need freeing. Also the SymbolInfo doesn't directly use the strings, it creates quarks from them.

Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

Ok, I'll accept your choice on 1). One last nitpick :-)

The namespace for the VAPI should be Zeitgeist.Symbol.* that way it's consistent with how we expose the Zeitgeist.Timestamp.* namespace as well as closer to the Python API for zeitgeist.datamodel.Symbol

review: Needs Fixing
lp:~mhr3/libzeitgeist/symbols updated
160. By Michal Hruby

Move the functions to Zeitgeist.Symbol namespace

161. By Michal Hruby

Add new header to zeitgeist.h

Revision history for this message
Michal Hruby (mhr3) wrote :

Moved to Zeitgeist.Symbol namespace. Should be good to go. ;)

Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

Cool. Nice work!

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-custom.vala'
2--- bindings/zeitgeist-1.0-custom.vala 2010-06-23 09:43:18 +0000
3+++ bindings/zeitgeist-1.0-custom.vala 2010-08-09 22:06:44 +0000
4@@ -32,6 +32,18 @@
5 }
6 }
7
8+namespace Zeitgeist.Symbol
9+{
10+ [CCode (cheader_filename = "zeitgeist.h")]
11+ public static GLib.List<weak string> get_all_children (string symbol);
12+ [CCode (cheader_filename = "zeitgeist.h")]
13+ public static GLib.List<weak string> get_children (string symbol);
14+ [CCode (cheader_filename = "zeitgeist.h")]
15+ public static GLib.List<weak string> get_parents (string symbol);
16+ [CCode (cheader_filename = "zeitgeist.h")]
17+ public static bool is_a (string symbol, string parent);
18+}
19+
20 namespace Zeitgeist.Timestamp
21 {
22 [CCode (cname = "ZEITGEIST_TIMESTAMP_SECOND", cheader_filename = "zeitgeist.h")]
23
24=== modified file 'bindings/zeitgeist-1.0.gi'
25--- bindings/zeitgeist-1.0.gi 2010-07-23 13:21:14 +0000
26+++ bindings/zeitgeist-1.0.gi 2010-08-09 22:06:44 +0000
27@@ -34,6 +34,31 @@
28 <parameter name="manifestation_type" type="gchar*"/>
29 </parameters>
30 </function>
31+ <function name="symbol_get_all_children" symbol="zeitgeist_symbol_get_all_children">
32+ <return-type type="GList*"/>
33+ <parameters>
34+ <parameter name="symbol" type="gchar*"/>
35+ </parameters>
36+ </function>
37+ <function name="symbol_get_children" symbol="zeitgeist_symbol_get_children">
38+ <return-type type="GList*"/>
39+ <parameters>
40+ <parameter name="symbol" type="gchar*"/>
41+ </parameters>
42+ </function>
43+ <function name="symbol_get_parents" symbol="zeitgeist_symbol_get_parents">
44+ <return-type type="GList*"/>
45+ <parameters>
46+ <parameter name="symbol" type="gchar*"/>
47+ </parameters>
48+ </function>
49+ <function name="symbol_is_a" symbol="zeitgeist_symbol_is_a">
50+ <return-type type="gboolean"/>
51+ <parameters>
52+ <parameter name="symbol" type="gchar*"/>
53+ <parameter name="parent" type="gchar*"/>
54+ </parameters>
55+ </function>
56 <function name="timestamp_for_now" symbol="zeitgeist_timestamp_for_now">
57 <return-type type="gint64"/>
58 </function>
59@@ -105,7 +130,11 @@
60 <member name="ZEITGEIST_RESULT_TYPE_MOST_POPULAR_ACTOR" value="6"/>
61 <member name="ZEITGEIST_RESULT_TYPE_LEAST_POPULAR_ACTOR" value="7"/>
62 <member name="ZEITGEIST_RESULT_TYPE_MOST_RECENT_ACTOR" value="8"/>
63- <member name="ZEITGEIST_RESULT_TYPE_LEAST_RECENT_ACTOR" value="6"/>
64+ <member name="ZEITGEIST_RESULT_TYPE_LEAST_RECENT_ACTOR" value="9"/>
65+ <member name="ZEITGEIST_RESULT_TYPE_MOST_RECENT_ORIGIN" value="10"/>
66+ <member name="ZEITGEIST_RESULT_TYPE_LEAST_RECENT_ORIGIN" value="11"/>
67+ <member name="ZEITGEIST_RESULT_TYPE_MOST_POPULAR_ORIGIN" value="12"/>
68+ <member name="ZEITGEIST_RESULT_TYPE_LEAST_POPULAR_ORIGIN" value="13"/>
69 <member name="ZEITGEIST_RESULT_TYPE_RELEVANCY" value="100"/>
70 </enum>
71 <enum name="ZeitgeistStorageState" type-name="ZeitgeistStorageState" get-type="zeitgeist_storage_state_get_type">
72
73=== modified file 'bindings/zeitgeist-1.0.metadata'
74--- bindings/zeitgeist-1.0.metadata 2010-07-22 09:21:47 +0000
75+++ bindings/zeitgeist-1.0.metadata 2010-08-09 22:06:44 +0000
76@@ -40,6 +40,10 @@
77 zeitgeist_event_set_payload.payload transfer_ownership="1"
78 zeitgeist_monitor_new.event_templates transfer_ownership="1"
79
80+Zeitgeist.Symbol cheader_filename="zeitgeist.h"
81+zeitgeist_symbol_get* hidden="1" #transfer_ownership="1" type_arguments="unowned string"
82+zeitgeist_symbol_is_a hidden="1"
83+
84 zeitgeist_data_source_registry_*.cancellable nullable="1"
85 zeitgeist_log_*.cancellable nullable="1"
86 zeitgeist_index_*.cancellable nullable="1"
87
88=== modified file 'bindings/zeitgeist-1.0.vapi'
89--- bindings/zeitgeist-1.0.vapi 2010-08-05 13:08:34 +0000
90+++ bindings/zeitgeist-1.0.vapi 2010-08-09 22:06:44 +0000
91@@ -2,6 +2,17 @@
92
93 [CCode (cprefix = "Zeitgeist", lower_case_cprefix = "zeitgeist_")]
94 namespace Zeitgeist {
95+ [CCode (cprefix = "ZeitgeistSymbol", lower_case_cprefix = "zeitgeist_symbol_")]
96+ namespace Symbol {
97+ [CCode (cheader_filename = "zeitgeist.h")]
98+ public static GLib.List<weak string> get_all_children (string symbol);
99+ [CCode (cheader_filename = "zeitgeist.h")]
100+ public static GLib.List<weak string> get_children (string symbol);
101+ [CCode (cheader_filename = "zeitgeist.h")]
102+ public static GLib.List<weak string> get_parents (string symbol);
103+ [CCode (cheader_filename = "zeitgeist.h")]
104+ public static bool is_a (string symbol, string parent);
105+ }
106 [CCode (cprefix = "ZeitgeistTimestamp", lower_case_cprefix = "zeitgeist_timestamp_")]
107 namespace Timestamp {
108 [CCode (cname = "ZEITGEIST_TIMESTAMP_DAY", cheader_filename = "zeitgeist.h")]
109
110=== modified file 'doc/reference/zeitgeist-1.0-docs.sgml'
111--- doc/reference/zeitgeist-1.0-docs.sgml 2010-07-22 18:08:43 +0000
112+++ doc/reference/zeitgeist-1.0-docs.sgml 2010-08-09 22:06:44 +0000
113@@ -23,6 +23,7 @@
114 <title>Utility Functions</title>
115 <xi:include href="xml/zeitgeist-mimetypes.xml"/>
116 <xi:include href="xml/zeitgeist-timestamp.xml"/>
117+ <xi:include href="xml/zeitgeist-symbols.xml"/>
118 </chapter>
119
120 <chapter>
121
122=== modified file 'doc/reference/zeitgeist-1.0-sections.txt'
123--- doc/reference/zeitgeist-1.0-sections.txt 2010-07-22 18:08:43 +0000
124+++ doc/reference/zeitgeist-1.0-sections.txt 2010-08-09 22:06:44 +0000
125@@ -265,6 +265,15 @@
126 </SECTION>
127
128 <SECTION>
129+<FILE>zeitgeist-symbols</FILE>
130+<TITLE>Symbol comprehension</TITLE>
131+zeitgeist_symbol_get_parents
132+zeitgeist_symbol_get_children
133+zeitgeist_symbol_get_all_children
134+zeitgeist_symbol_is_a
135+</SECTION>
136+
137+<SECTION>
138 <FILE>zeitgeist-ontology-interpretations</FILE>
139 <TITLE>Interpretation Ontology</TITLE>
140 ZEITGEIST_NCAL_ALARM
141
142=== modified file 'src/Makefile.am'
143--- src/Makefile.am 2010-07-22 09:21:47 +0000
144+++ src/Makefile.am 2010-08-09 22:06:44 +0000
145@@ -134,6 +134,8 @@
146 zeitgeist-result-set.c \
147 zeitgeist-subject.c \
148 zeitgeist-subject.h \
149+ zeitgeist-symbols.c \
150+ zeitgeist-symbols.h \
151 zeitgeist-timerange.c \
152 zeitgeist-timerange.h \
153 zeitgeist-timestamp.c \
154@@ -165,6 +167,7 @@
155 zeitgeist-ontology-manifestations.h \
156 zeitgeist-result-set.h \
157 zeitgeist-subject.h \
158+ zeitgeist-symbols.h \
159 zeitgeist-timerange.h \
160 zeitgeist-timestamp.h \
161 zeitgeist.h
162
163=== added file 'src/zeitgeist-symbols.c'
164--- src/zeitgeist-symbols.c 1970-01-01 00:00:00 +0000
165+++ src/zeitgeist-symbols.c 2010-08-09 22:06:44 +0000
166@@ -0,0 +1,1389 @@
167+/*
168+ * Copyright (C) 2010 Canonical, Ltd.
169+ *
170+ * This library is free software; you can redistribute it and/or modify
171+ * it under the terms of the GNU Lesser General Public License
172+ * version 3.0 as published by the Free Software Foundation.
173+ *
174+ * This library is distributed in the hope that it will be useful,
175+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
176+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
177+ * GNU Lesser General Public License version 3.0 for more details.
178+ *
179+ * You should have received a copy of the GNU Lesser General Public
180+ * License along with this library. If not, see
181+ * <http://www.gnu.org/licenses/>.
182+ *
183+ * Authored by: Michal Hruby <michal.mhr@gmail.com>
184+ */
185+
186+/**
187+ * SECTION:zeitgeist-symbols
188+ * @short_description: Used to get information about Interpretation and/or
189+ * Manifestation symbols
190+ * @include: zeitgeist.h
191+ */
192+
193+#include "zeitgeist-ontology-interpretations.h"
194+#include "zeitgeist-ontology-manifestations.h"
195+#include "zeitgeist-symbols.h"
196+
197+static void _ensure_symbols_loaded (void);
198+
199+static gboolean symbols_loaded = FALSE;
200+static GHashTable *symbol_uris = NULL;
201+
202+typedef struct
203+{
204+ gchar *uri;
205+ GSList *parents;
206+ GSList *children;
207+ GSList *all_children;
208+} SymbolInfo;
209+
210+static SymbolInfo*
211+symbol_info_new (gchar *uri,
212+ GStrv parents,
213+ GStrv children,
214+ GStrv all_children)
215+{
216+ gchar *iter;
217+ SymbolInfo *i = g_slice_new0 (SymbolInfo);
218+ i->uri = g_strdup (uri);
219+
220+ while (*parents)
221+ {
222+ i->parents = g_slist_append (i->parents,
223+ GINT_TO_POINTER (g_quark_from_string (*parents)));
224+ parents++;
225+ }
226+
227+ while (*children)
228+ {
229+ i->children = g_slist_append (i->children,
230+ GINT_TO_POINTER (g_quark_from_string (*children)));
231+ children++;
232+ }
233+
234+ while (*all_children)
235+ {
236+ i->all_children = g_slist_append (i->all_children,
237+ GINT_TO_POINTER (g_quark_from_string (*all_children)));
238+ all_children++;
239+ }
240+
241+ return i;
242+}
243+
244+static void
245+zeitgeist_register_symbol (SymbolInfo *i)
246+{
247+ if (symbol_uris == NULL)
248+ symbol_uris = g_hash_table_new (g_str_hash, g_str_equal);
249+
250+ g_hash_table_insert (symbol_uris, i->uri, i);
251+}
252+
253+/**
254+ * zeitgeist_symbol_get_parents:
255+ * @symbol: A symbol.
256+ *
257+ * Gets list of parents of the specified symbol.
258+ *
259+ * Returns: A newly allocated list of parents of this symbol.
260+ * The data elements of the list contain strings which you
261+ * do not own, use g_strdup() if you intend to work with them.
262+ * Free the list with a call to g_list_free().
263+ */
264+GList*
265+zeitgeist_symbol_get_parents (const gchar *symbol)
266+{
267+ GSList *iter;
268+ GList *result = NULL;
269+ g_return_val_if_fail (symbol != NULL, NULL);
270+
271+ _ensure_symbols_loaded ();
272+
273+ SymbolInfo *info = (SymbolInfo*) g_hash_table_lookup (symbol_uris, symbol);
274+ g_return_val_if_fail (info != NULL, NULL);
275+
276+ for (iter = info->parents; iter; iter = iter->next)
277+ {
278+ result = g_list_prepend (result,
279+ g_quark_to_string (GPOINTER_TO_INT (iter->data)));
280+ }
281+
282+ return g_list_reverse (result);
283+}
284+
285+/**
286+ * zeitgeist_symbol_get_children:
287+ * @symbol: A symbol.
288+ *
289+ * Gets list of direct children of the specified symbol.
290+ *
291+ * Returns: A newly allocated list of direct children of this symbol.
292+ * The data elements of the list contain strings which you
293+ * do not own, use g_strdup() if you intend to work with them.
294+ * Free the list with a call to g_list_free().
295+ */
296+GList*
297+zeitgeist_symbol_get_children (const gchar *symbol)
298+{
299+ GSList *iter;
300+ GList *result = NULL;
301+ g_return_val_if_fail (symbol != NULL, NULL);
302+
303+ _ensure_symbols_loaded ();
304+
305+ SymbolInfo *info = (SymbolInfo*) g_hash_table_lookup (symbol_uris, symbol);
306+ g_return_val_if_fail (info != NULL, NULL);
307+
308+ for (iter = info->children; iter; iter = iter->next)
309+ {
310+ result = g_list_prepend (result,
311+ g_quark_to_string (GPOINTER_TO_INT (iter->data)));
312+ }
313+
314+ return g_list_reverse (result);
315+}
316+
317+/**
318+ * zeitgeist_symbol_get_all_children:
319+ * @symbol: A symbol.
320+ *
321+ * Gets list of all children of the specified symbol.
322+ *
323+ * Returns: A newly allocated list of all children of this symbol (includes
324+ * also children of children).
325+ * The data elements of the list contain strings which you
326+ * do not own, use g_strdup() if you intend to work with them.
327+ * Free the list with a call to g_list_free().
328+ */
329+GList*
330+zeitgeist_symbol_get_all_children (const gchar *symbol)
331+{
332+ GSList *iter;
333+ GList *result = NULL;
334+ g_return_val_if_fail (symbol != NULL, NULL);
335+
336+ _ensure_symbols_loaded ();
337+
338+ SymbolInfo *info = (SymbolInfo*) g_hash_table_lookup (symbol_uris, symbol);
339+ g_return_val_if_fail (info != NULL, NULL);
340+
341+ for (iter = info->all_children; iter; iter = iter->next)
342+ {
343+ result = g_list_prepend (result,
344+ g_quark_to_string (GPOINTER_TO_INT (iter->data)));
345+ }
346+
347+ return g_list_reverse (result);
348+}
349+
350+/**
351+ * zeitgeist_symbol_is_a:
352+ * @symbol: A symbol.
353+ * @parent: Parent symbol.
354+ *
355+ * Determines if @symbol is child of @parent.
356+ *
357+ * Returns: True if @symbol is child of @parent (or equal to @parent),
358+ * FALSE otherwise.
359+ */
360+gboolean
361+zeitgeist_symbol_is_a (const gchar *symbol, const gchar *parent)
362+{
363+ if (parent == NULL || symbol == NULL) return FALSE;
364+
365+ _ensure_symbols_loaded ();
366+
367+ SymbolInfo *info = (SymbolInfo*) g_hash_table_lookup (symbol_uris, parent);
368+ if (info == NULL) return FALSE;
369+
370+ GQuark symbol_quark = g_quark_try_string (symbol);
371+ if (symbol_quark == 0) return FALSE;
372+ // catch equal symbols
373+ if (symbol_quark == g_quark_try_string (parent)) return TRUE;
374+
375+ return g_slist_find (info->all_children, GINT_TO_POINTER (symbol_quark)) != NULL;
376+}
377+
378+static void
379+_ensure_symbols_loaded (void)
380+{
381+ gchar **parents;
382+ gchar **children;
383+ gchar **all_children;
384+ gchar *uri;
385+ SymbolInfo *info;
386+
387+ if (symbols_loaded) return;
388+
389+ uri = ZEITGEIST_NFO_EXECUTABLE;
390+ parents = g_new (char*, 1);
391+ parents[0] = NULL;
392+ children = g_new (char*, 1);
393+ children[0] = NULL;
394+ all_children = g_new (char*, 1);
395+ all_children[0] = NULL;
396+ info = symbol_info_new (uri, parents, children, all_children);
397+ zeitgeist_register_symbol (info);
398+ g_free (parents);
399+ g_free (children);
400+ g_free (all_children);
401+
402+ uri = ZEITGEIST_NFO_SPREADSHEET;
403+ parents = g_new (char*, 2);
404+ parents[0] = ZEITGEIST_NFO_DOCUMENT;
405+ parents[1] = NULL;
406+ children = g_new (char*, 1);
407+ children[0] = NULL;
408+ all_children = g_new (char*, 1);
409+ all_children[0] = NULL;
410+ info = symbol_info_new (uri, parents, children, all_children);
411+ zeitgeist_register_symbol (info);
412+ g_free (parents);
413+ g_free (children);
414+ g_free (all_children);
415+
416+ uri = ZEITGEIST_ZG_MODIFY_EVENT;
417+ parents = g_new (char*, 2);
418+ parents[0] = ZEITGEIST_ZG_EVENT_INTERPRETATION;
419+ parents[1] = NULL;
420+ children = g_new (char*, 1);
421+ children[0] = NULL;
422+ all_children = g_new (char*, 1);
423+ all_children[0] = NULL;
424+ info = symbol_info_new (uri, parents, children, all_children);
425+ zeitgeist_register_symbol (info);
426+ g_free (parents);
427+ g_free (children);
428+ g_free (all_children);
429+
430+ uri = ZEITGEIST_NFO_TRASH;
431+ parents = g_new (char*, 2);
432+ parents[0] = ZEITGEIST_NFO_DATA_CONTAINER;
433+ parents[1] = NULL;
434+ children = g_new (char*, 1);
435+ children[0] = NULL;
436+ all_children = g_new (char*, 1);
437+ all_children[0] = NULL;
438+ info = symbol_info_new (uri, parents, children, all_children);
439+ zeitgeist_register_symbol (info);
440+ g_free (parents);
441+ g_free (children);
442+ g_free (all_children);
443+
444+ uri = ZEITGEIST_NMO_MESSAGE;
445+ parents = g_new (char*, 1);
446+ parents[0] = NULL;
447+ children = g_new (char*, 3);
448+ children[0] = ZEITGEIST_NMO_EMAIL;
449+ children[1] = ZEITGEIST_NMO_IMMESSAGE;
450+ children[2] = NULL;
451+ all_children = g_new (char*, 3);
452+ all_children[0] = ZEITGEIST_NMO_EMAIL;
453+ all_children[1] = ZEITGEIST_NMO_IMMESSAGE;
454+ all_children[2] = NULL;
455+ info = symbol_info_new (uri, parents, children, all_children);
456+ zeitgeist_register_symbol (info);
457+ g_free (parents);
458+ g_free (children);
459+ g_free (all_children);
460+
461+ uri = ZEITGEIST_NFO_WEBSITE;
462+ parents = g_new (char*, 1);
463+ parents[0] = NULL;
464+ children = g_new (char*, 1);
465+ children[0] = NULL;
466+ all_children = g_new (char*, 1);
467+ all_children[0] = NULL;
468+ info = symbol_info_new (uri, parents, children, all_children);
469+ zeitgeist_register_symbol (info);
470+ g_free (parents);
471+ g_free (children);
472+ g_free (all_children);
473+
474+ uri = ZEITGEIST_NCAL_TODO;
475+ parents = g_new (char*, 1);
476+ parents[0] = NULL;
477+ children = g_new (char*, 1);
478+ children[0] = NULL;
479+ all_children = g_new (char*, 1);
480+ all_children[0] = NULL;
481+ info = symbol_info_new (uri, parents, children, all_children);
482+ zeitgeist_register_symbol (info);
483+ g_free (parents);
484+ g_free (children);
485+ g_free (all_children);
486+
487+ uri = ZEITGEIST_ZG_CREATE_EVENT;
488+ parents = g_new (char*, 2);
489+ parents[0] = ZEITGEIST_ZG_EVENT_INTERPRETATION;
490+ parents[1] = NULL;
491+ children = g_new (char*, 1);
492+ children[0] = NULL;
493+ all_children = g_new (char*, 1);
494+ all_children[0] = NULL;
495+ info = symbol_info_new (uri, parents, children, all_children);
496+ zeitgeist_register_symbol (info);
497+ g_free (parents);
498+ g_free (children);
499+ g_free (all_children);
500+
501+ uri = ZEITGEIST_NFO_MEDIA_LIST;
502+ parents = g_new (char*, 1);
503+ parents[0] = NULL;
504+ children = g_new (char*, 2);
505+ children[0] = ZEITGEIST_NMM_MUSIC_ALBUM;
506+ children[1] = NULL;
507+ all_children = g_new (char*, 2);
508+ all_children[0] = ZEITGEIST_NMM_MUSIC_ALBUM;
509+ all_children[1] = NULL;
510+ info = symbol_info_new (uri, parents, children, all_children);
511+ zeitgeist_register_symbol (info);
512+ g_free (parents);
513+ g_free (children);
514+ g_free (all_children);
515+
516+ uri = ZEITGEIST_NFO_FILESYSTEM;
517+ parents = g_new (char*, 2);
518+ parents[0] = ZEITGEIST_NFO_DATA_CONTAINER;
519+ parents[1] = NULL;
520+ children = g_new (char*, 2);
521+ children[0] = ZEITGEIST_NFO_FILESYSTEM_IMAGE;
522+ children[1] = NULL;
523+ all_children = g_new (char*, 2);
524+ all_children[0] = ZEITGEIST_NFO_FILESYSTEM_IMAGE;
525+ all_children[1] = NULL;
526+ info = symbol_info_new (uri, parents, children, all_children);
527+ zeitgeist_register_symbol (info);
528+ g_free (parents);
529+ g_free (children);
530+ g_free (all_children);
531+
532+ uri = ZEITGEIST_NFO_MIND_MAP;
533+ parents = g_new (char*, 2);
534+ parents[0] = ZEITGEIST_NFO_DOCUMENT;
535+ parents[1] = NULL;
536+ children = g_new (char*, 1);
537+ children[0] = NULL;
538+ all_children = g_new (char*, 1);
539+ all_children[0] = NULL;
540+ info = symbol_info_new (uri, parents, children, all_children);
541+ zeitgeist_register_symbol (info);
542+ g_free (parents);
543+ g_free (children);
544+ g_free (all_children);
545+
546+ uri = ZEITGEIST_NCAL_CALENDAR;
547+ parents = g_new (char*, 1);
548+ parents[0] = NULL;
549+ children = g_new (char*, 1);
550+ children[0] = NULL;
551+ all_children = g_new (char*, 1);
552+ all_children[0] = NULL;
553+ info = symbol_info_new (uri, parents, children, all_children);
554+ zeitgeist_register_symbol (info);
555+ g_free (parents);
556+ g_free (children);
557+ g_free (all_children);
558+
559+ uri = ZEITGEIST_NFO_BOOKMARK;
560+ parents = g_new (char*, 1);
561+ parents[0] = NULL;
562+ children = g_new (char*, 1);
563+ children[0] = NULL;
564+ all_children = g_new (char*, 1);
565+ all_children[0] = NULL;
566+ info = symbol_info_new (uri, parents, children, all_children);
567+ zeitgeist_register_symbol (info);
568+ g_free (parents);
569+ g_free (children);
570+ g_free (all_children);
571+
572+ uri = ZEITGEIST_NMO_IMMESSAGE;
573+ parents = g_new (char*, 2);
574+ parents[0] = ZEITGEIST_NMO_MESSAGE;
575+ parents[1] = NULL;
576+ children = g_new (char*, 1);
577+ children[0] = NULL;
578+ all_children = g_new (char*, 1);
579+ all_children[0] = NULL;
580+ info = symbol_info_new (uri, parents, children, all_children);
581+ zeitgeist_register_symbol (info);
582+ g_free (parents);
583+ g_free (children);
584+ g_free (all_children);
585+
586+ uri = ZEITGEIST_NCAL_EVENT;
587+ parents = g_new (char*, 1);
588+ parents[0] = NULL;
589+ children = g_new (char*, 1);
590+ children[0] = NULL;
591+ all_children = g_new (char*, 1);
592+ all_children[0] = NULL;
593+ info = symbol_info_new (uri, parents, children, all_children);
594+ zeitgeist_register_symbol (info);
595+ g_free (parents);
596+ g_free (children);
597+ g_free (all_children);
598+
599+ uri = ZEITGEIST_ZG_LEAVE_EVENT;
600+ parents = g_new (char*, 2);
601+ parents[0] = ZEITGEIST_ZG_EVENT_INTERPRETATION;
602+ parents[1] = NULL;
603+ children = g_new (char*, 1);
604+ children[0] = NULL;
605+ all_children = g_new (char*, 1);
606+ all_children[0] = NULL;
607+ info = symbol_info_new (uri, parents, children, all_children);
608+ zeitgeist_register_symbol (info);
609+ g_free (parents);
610+ g_free (children);
611+ g_free (all_children);
612+
613+ uri = ZEITGEIST_NFO_ARCHIVE;
614+ parents = g_new (char*, 2);
615+ parents[0] = ZEITGEIST_NFO_DATA_CONTAINER;
616+ parents[1] = NULL;
617+ children = g_new (char*, 1);
618+ children[0] = NULL;
619+ all_children = g_new (char*, 1);
620+ all_children[0] = NULL;
621+ info = symbol_info_new (uri, parents, children, all_children);
622+ zeitgeist_register_symbol (info);
623+ g_free (parents);
624+ g_free (children);
625+ g_free (all_children);
626+
627+ uri = ZEITGEIST_ZG_ACCESS_EVENT;
628+ parents = g_new (char*, 2);
629+ parents[0] = ZEITGEIST_ZG_EVENT_INTERPRETATION;
630+ parents[1] = NULL;
631+ children = g_new (char*, 1);
632+ children[0] = NULL;
633+ all_children = g_new (char*, 1);
634+ all_children[0] = NULL;
635+ info = symbol_info_new (uri, parents, children, all_children);
636+ zeitgeist_register_symbol (info);
637+ g_free (parents);
638+ g_free (children);
639+ g_free (all_children);
640+
641+ uri = ZEITGEIST_NFO_VECTOR_IMAGE;
642+ parents = g_new (char*, 2);
643+ parents[0] = ZEITGEIST_NFO_IMAGE;
644+ parents[1] = NULL;
645+ children = g_new (char*, 1);
646+ children[0] = NULL;
647+ all_children = g_new (char*, 1);
648+ all_children[0] = NULL;
649+ info = symbol_info_new (uri, parents, children, all_children);
650+ zeitgeist_register_symbol (info);
651+ g_free (parents);
652+ g_free (children);
653+ g_free (all_children);
654+
655+ uri = ZEITGEIST_NFO_CURSOR;
656+ parents = g_new (char*, 2);
657+ parents[0] = ZEITGEIST_NFO_RASTER_IMAGE;
658+ parents[1] = NULL;
659+ children = g_new (char*, 1);
660+ children[0] = NULL;
661+ all_children = g_new (char*, 1);
662+ all_children[0] = NULL;
663+ info = symbol_info_new (uri, parents, children, all_children);
664+ zeitgeist_register_symbol (info);
665+ g_free (parents);
666+ g_free (children);
667+ g_free (all_children);
668+
669+ uri = ZEITGEIST_NFO_VIDEO;
670+ parents = g_new (char*, 2);
671+ parents[0] = ZEITGEIST_NFO_VISUAL;
672+ parents[1] = NULL;
673+ children = g_new (char*, 3);
674+ children[0] = ZEITGEIST_NMM_TVSHOW;
675+ children[1] = ZEITGEIST_NMM_MOVIE;
676+ children[2] = NULL;
677+ all_children = g_new (char*, 3);
678+ all_children[0] = ZEITGEIST_NMM_TVSHOW;
679+ all_children[1] = ZEITGEIST_NMM_MOVIE;
680+ all_children[2] = NULL;
681+ info = symbol_info_new (uri, parents, children, all_children);
682+ zeitgeist_register_symbol (info);
683+ g_free (parents);
684+ g_free (children);
685+ g_free (all_children);
686+
687+ uri = ZEITGEIST_NFO_BOOKMARK_FOLDER;
688+ parents = g_new (char*, 1);
689+ parents[0] = NULL;
690+ children = g_new (char*, 1);
691+ children[0] = NULL;
692+ all_children = g_new (char*, 1);
693+ all_children[0] = NULL;
694+ info = symbol_info_new (uri, parents, children, all_children);
695+ zeitgeist_register_symbol (info);
696+ g_free (parents);
697+ g_free (children);
698+ g_free (all_children);
699+
700+ uri = ZEITGEIST_NFO_HTML_DOCUMENT;
701+ parents = g_new (char*, 2);
702+ parents[0] = ZEITGEIST_NFO_PLAIN_TEXT_DOCUMENT;
703+ parents[1] = NULL;
704+ children = g_new (char*, 1);
705+ children[0] = NULL;
706+ all_children = g_new (char*, 1);
707+ all_children[0] = NULL;
708+ info = symbol_info_new (uri, parents, children, all_children);
709+ zeitgeist_register_symbol (info);
710+ g_free (parents);
711+ g_free (children);
712+ g_free (all_children);
713+
714+ uri = ZEITGEIST_NFO_PLAIN_TEXT_DOCUMENT;
715+ parents = g_new (char*, 2);
716+ parents[0] = ZEITGEIST_NFO_TEXT_DOCUMENT;
717+ parents[1] = NULL;
718+ children = g_new (char*, 3);
719+ children[0] = ZEITGEIST_NFO_SOURCE_CODE;
720+ children[1] = ZEITGEIST_NFO_HTML_DOCUMENT;
721+ children[2] = NULL;
722+ all_children = g_new (char*, 3);
723+ all_children[0] = ZEITGEIST_NFO_SOURCE_CODE;
724+ all_children[1] = ZEITGEIST_NFO_HTML_DOCUMENT;
725+ all_children[2] = NULL;
726+ info = symbol_info_new (uri, parents, children, all_children);
727+ zeitgeist_register_symbol (info);
728+ g_free (parents);
729+ g_free (children);
730+ g_free (all_children);
731+
732+ uri = ZEITGEIST_NFO_FONT;
733+ parents = g_new (char*, 1);
734+ parents[0] = NULL;
735+ children = g_new (char*, 1);
736+ children[0] = NULL;
737+ all_children = g_new (char*, 1);
738+ all_children[0] = NULL;
739+ info = symbol_info_new (uri, parents, children, all_children);
740+ zeitgeist_register_symbol (info);
741+ g_free (parents);
742+ g_free (children);
743+ g_free (all_children);
744+
745+ uri = ZEITGEIST_NFO_DATA_CONTAINER;
746+ parents = g_new (char*, 1);
747+ parents[0] = NULL;
748+ children = g_new (char*, 5);
749+ children[0] = ZEITGEIST_NFO_FILESYSTEM;
750+ children[1] = ZEITGEIST_NFO_ARCHIVE;
751+ children[2] = ZEITGEIST_NFO_FOLDER;
752+ children[3] = ZEITGEIST_NFO_TRASH;
753+ children[4] = NULL;
754+ all_children = g_new (char*, 6);
755+ all_children[0] = ZEITGEIST_NFO_FILESYSTEM_IMAGE;
756+ all_children[1] = ZEITGEIST_NFO_ARCHIVE;
757+ all_children[2] = ZEITGEIST_NFO_FOLDER;
758+ all_children[3] = ZEITGEIST_NFO_TRASH;
759+ all_children[4] = ZEITGEIST_NFO_FILESYSTEM;
760+ all_children[5] = NULL;
761+ info = symbol_info_new (uri, parents, children, all_children);
762+ zeitgeist_register_symbol (info);
763+ g_free (parents);
764+ g_free (children);
765+ g_free (all_children);
766+
767+ uri = ZEITGEIST_NFO_RASTER_IMAGE;
768+ parents = g_new (char*, 2);
769+ parents[0] = ZEITGEIST_NFO_IMAGE;
770+ parents[1] = NULL;
771+ children = g_new (char*, 2);
772+ children[0] = ZEITGEIST_NFO_CURSOR;
773+ children[1] = NULL;
774+ all_children = g_new (char*, 2);
775+ all_children[0] = ZEITGEIST_NFO_CURSOR;
776+ all_children[1] = NULL;
777+ info = symbol_info_new (uri, parents, children, all_children);
778+ zeitgeist_register_symbol (info);
779+ g_free (parents);
780+ g_free (children);
781+ g_free (all_children);
782+
783+ uri = ZEITGEIST_NFO_IMAGE;
784+ parents = g_new (char*, 2);
785+ parents[0] = ZEITGEIST_NFO_VISUAL;
786+ parents[1] = NULL;
787+ children = g_new (char*, 4);
788+ children[0] = ZEITGEIST_NFO_ICON;
789+ children[1] = ZEITGEIST_NFO_VECTOR_IMAGE;
790+ children[2] = ZEITGEIST_NFO_RASTER_IMAGE;
791+ children[3] = NULL;
792+ all_children = g_new (char*, 5);
793+ all_children[0] = ZEITGEIST_NFO_ICON;
794+ all_children[1] = ZEITGEIST_NFO_VECTOR_IMAGE;
795+ all_children[2] = ZEITGEIST_NFO_CURSOR;
796+ all_children[3] = ZEITGEIST_NFO_RASTER_IMAGE;
797+ all_children[4] = NULL;
798+ info = symbol_info_new (uri, parents, children, all_children);
799+ zeitgeist_register_symbol (info);
800+ g_free (parents);
801+ g_free (children);
802+ g_free (all_children);
803+
804+ uri = ZEITGEIST_ZG_EVENT_INTERPRETATION;
805+ parents = g_new (char*, 1);
806+ parents[0] = NULL;
807+ children = g_new (char*, 8);
808+ children[0] = ZEITGEIST_ZG_LEAVE_EVENT;
809+ children[1] = ZEITGEIST_ZG_MODIFY_EVENT;
810+ children[2] = ZEITGEIST_ZG_CREATE_EVENT;
811+ children[3] = ZEITGEIST_ZG_SEND_EVENT;
812+ children[4] = ZEITGEIST_ZG_ACCESS_EVENT;
813+ children[5] = ZEITGEIST_ZG_DELETE_EVENT;
814+ children[6] = ZEITGEIST_ZG_RECEIVE_EVENT;
815+ children[7] = NULL;
816+ all_children = g_new (char*, 8);
817+ all_children[0] = ZEITGEIST_ZG_LEAVE_EVENT;
818+ all_children[1] = ZEITGEIST_ZG_MODIFY_EVENT;
819+ all_children[2] = ZEITGEIST_ZG_CREATE_EVENT;
820+ all_children[3] = ZEITGEIST_ZG_SEND_EVENT;
821+ all_children[4] = ZEITGEIST_ZG_ACCESS_EVENT;
822+ all_children[5] = ZEITGEIST_ZG_DELETE_EVENT;
823+ all_children[6] = ZEITGEIST_ZG_RECEIVE_EVENT;
824+ all_children[7] = NULL;
825+ info = symbol_info_new (uri, parents, children, all_children);
826+ zeitgeist_register_symbol (info);
827+ g_free (parents);
828+ g_free (children);
829+ g_free (all_children);
830+
831+ uri = ZEITGEIST_ZG_SEND_EVENT;
832+ parents = g_new (char*, 2);
833+ parents[0] = ZEITGEIST_ZG_EVENT_INTERPRETATION;
834+ parents[1] = NULL;
835+ children = g_new (char*, 1);
836+ children[0] = NULL;
837+ all_children = g_new (char*, 1);
838+ all_children[0] = NULL;
839+ info = symbol_info_new (uri, parents, children, all_children);
840+ zeitgeist_register_symbol (info);
841+ g_free (parents);
842+ g_free (children);
843+ g_free (all_children);
844+
845+ uri = ZEITGEIST_NFO_APPLICATION;
846+ parents = g_new (char*, 2);
847+ parents[0] = ZEITGEIST_NFO_SOFTWARE;
848+ parents[1] = NULL;
849+ children = g_new (char*, 1);
850+ children[0] = NULL;
851+ all_children = g_new (char*, 1);
852+ all_children[0] = NULL;
853+ info = symbol_info_new (uri, parents, children, all_children);
854+ zeitgeist_register_symbol (info);
855+ g_free (parents);
856+ g_free (children);
857+ g_free (all_children);
858+
859+ uri = ZEITGEIST_NFO_DOCUMENT;
860+ parents = g_new (char*, 1);
861+ parents[0] = NULL;
862+ children = g_new (char*, 5);
863+ children[0] = ZEITGEIST_NFO_TEXT_DOCUMENT;
864+ children[1] = ZEITGEIST_NFO_PRESENTATION;
865+ children[2] = ZEITGEIST_NFO_MIND_MAP;
866+ children[3] = ZEITGEIST_NFO_SPREADSHEET;
867+ children[4] = NULL;
868+ all_children = g_new (char*, 9);
869+ all_children[0] = ZEITGEIST_NFO_SOURCE_CODE;
870+ all_children[1] = ZEITGEIST_NFO_SPREADSHEET;
871+ all_children[2] = ZEITGEIST_NFO_PAGINATED_TEXT_DOCUMENT;
872+ all_children[3] = ZEITGEIST_NFO_TEXT_DOCUMENT;
873+ all_children[4] = ZEITGEIST_NFO_HTML_DOCUMENT;
874+ all_children[5] = ZEITGEIST_NFO_MIND_MAP;
875+ all_children[6] = ZEITGEIST_NFO_PLAIN_TEXT_DOCUMENT;
876+ all_children[7] = ZEITGEIST_NFO_PRESENTATION;
877+ all_children[8] = NULL;
878+ info = symbol_info_new (uri, parents, children, all_children);
879+ zeitgeist_register_symbol (info);
880+ g_free (parents);
881+ g_free (children);
882+ g_free (all_children);
883+
884+ uri = ZEITGEIST_NMM_MUSIC_PIECE;
885+ parents = g_new (char*, 2);
886+ parents[0] = ZEITGEIST_NFO_MEDIA;
887+ parents[1] = NULL;
888+ children = g_new (char*, 1);
889+ children[0] = NULL;
890+ all_children = g_new (char*, 1);
891+ all_children[0] = NULL;
892+ info = symbol_info_new (uri, parents, children, all_children);
893+ zeitgeist_register_symbol (info);
894+ g_free (parents);
895+ g_free (children);
896+ g_free (all_children);
897+
898+ uri = ZEITGEIST_NMO_MAILBOX;
899+ parents = g_new (char*, 1);
900+ parents[0] = NULL;
901+ children = g_new (char*, 1);
902+ children[0] = NULL;
903+ all_children = g_new (char*, 1);
904+ all_children[0] = NULL;
905+ info = symbol_info_new (uri, parents, children, all_children);
906+ zeitgeist_register_symbol (info);
907+ g_free (parents);
908+ g_free (children);
909+ g_free (all_children);
910+
911+ uri = ZEITGEIST_NFO_TEXT_DOCUMENT;
912+ parents = g_new (char*, 2);
913+ parents[0] = ZEITGEIST_NFO_DOCUMENT;
914+ parents[1] = NULL;
915+ children = g_new (char*, 3);
916+ children[0] = ZEITGEIST_NFO_PAGINATED_TEXT_DOCUMENT;
917+ children[1] = ZEITGEIST_NFO_PLAIN_TEXT_DOCUMENT;
918+ children[2] = NULL;
919+ all_children = g_new (char*, 5);
920+ all_children[0] = ZEITGEIST_NFO_SOURCE_CODE;
921+ all_children[1] = ZEITGEIST_NFO_HTML_DOCUMENT;
922+ all_children[2] = ZEITGEIST_NFO_PAGINATED_TEXT_DOCUMENT;
923+ all_children[3] = ZEITGEIST_NFO_PLAIN_TEXT_DOCUMENT;
924+ all_children[4] = NULL;
925+ info = symbol_info_new (uri, parents, children, all_children);
926+ zeitgeist_register_symbol (info);
927+ g_free (parents);
928+ g_free (children);
929+ g_free (all_children);
930+
931+ uri = ZEITGEIST_NFO_FILESYSTEM_IMAGE;
932+ parents = g_new (char*, 2);
933+ parents[0] = ZEITGEIST_NFO_FILESYSTEM;
934+ parents[1] = NULL;
935+ children = g_new (char*, 1);
936+ children[0] = NULL;
937+ all_children = g_new (char*, 1);
938+ all_children[0] = NULL;
939+ info = symbol_info_new (uri, parents, children, all_children);
940+ zeitgeist_register_symbol (info);
941+ g_free (parents);
942+ g_free (children);
943+ g_free (all_children);
944+
945+ uri = ZEITGEIST_NCAL_JOURNAL;
946+ parents = g_new (char*, 1);
947+ parents[0] = NULL;
948+ children = g_new (char*, 1);
949+ children[0] = NULL;
950+ all_children = g_new (char*, 1);
951+ all_children[0] = NULL;
952+ info = symbol_info_new (uri, parents, children, all_children);
953+ zeitgeist_register_symbol (info);
954+ g_free (parents);
955+ g_free (children);
956+ g_free (all_children);
957+
958+ uri = ZEITGEIST_NFO_ICON;
959+ parents = g_new (char*, 2);
960+ parents[0] = ZEITGEIST_NFO_IMAGE;
961+ parents[1] = NULL;
962+ children = g_new (char*, 1);
963+ children[0] = NULL;
964+ all_children = g_new (char*, 1);
965+ all_children[0] = NULL;
966+ info = symbol_info_new (uri, parents, children, all_children);
967+ zeitgeist_register_symbol (info);
968+ g_free (parents);
969+ g_free (children);
970+ g_free (all_children);
971+
972+ uri = ZEITGEIST_NFO_PRESENTATION;
973+ parents = g_new (char*, 2);
974+ parents[0] = ZEITGEIST_NFO_DOCUMENT;
975+ parents[1] = NULL;
976+ children = g_new (char*, 1);
977+ children[0] = NULL;
978+ all_children = g_new (char*, 1);
979+ all_children[0] = NULL;
980+ info = symbol_info_new (uri, parents, children, all_children);
981+ zeitgeist_register_symbol (info);
982+ g_free (parents);
983+ g_free (children);
984+ g_free (all_children);
985+
986+ uri = ZEITGEIST_NMM_MUSIC_ALBUM;
987+ parents = g_new (char*, 2);
988+ parents[0] = ZEITGEIST_NFO_MEDIA_LIST;
989+ parents[1] = NULL;
990+ children = g_new (char*, 1);
991+ children[0] = NULL;
992+ all_children = g_new (char*, 1);
993+ all_children[0] = NULL;
994+ info = symbol_info_new (uri, parents, children, all_children);
995+ zeitgeist_register_symbol (info);
996+ g_free (parents);
997+ g_free (children);
998+ g_free (all_children);
999+
1000+ uri = ZEITGEIST_NFO_SOURCE_CODE;
1001+ parents = g_new (char*, 2);
1002+ parents[0] = ZEITGEIST_NFO_PLAIN_TEXT_DOCUMENT;
1003+ parents[1] = NULL;
1004+ children = g_new (char*, 1);
1005+ children[0] = NULL;
1006+ all_children = g_new (char*, 1);
1007+ all_children[0] = NULL;
1008+ info = symbol_info_new (uri, parents, children, all_children);
1009+ zeitgeist_register_symbol (info);
1010+ g_free (parents);
1011+ g_free (children);
1012+ g_free (all_children);
1013+
1014+ uri = ZEITGEIST_NFO_VISUAL;
1015+ parents = g_new (char*, 2);
1016+ parents[0] = ZEITGEIST_NFO_MEDIA;
1017+ parents[1] = NULL;
1018+ children = g_new (char*, 3);
1019+ children[0] = ZEITGEIST_NFO_IMAGE;
1020+ children[1] = ZEITGEIST_NFO_VIDEO;
1021+ children[2] = NULL;
1022+ all_children = g_new (char*, 9);
1023+ all_children[0] = ZEITGEIST_NMM_TVSHOW;
1024+ all_children[1] = ZEITGEIST_NFO_VECTOR_IMAGE;
1025+ all_children[2] = ZEITGEIST_NFO_VIDEO;
1026+ all_children[3] = ZEITGEIST_NMM_MOVIE;
1027+ all_children[4] = ZEITGEIST_NFO_CURSOR;
1028+ all_children[5] = ZEITGEIST_NFO_ICON;
1029+ all_children[6] = ZEITGEIST_NFO_IMAGE;
1030+ all_children[7] = ZEITGEIST_NFO_RASTER_IMAGE;
1031+ all_children[8] = NULL;
1032+ info = symbol_info_new (uri, parents, children, all_children);
1033+ zeitgeist_register_symbol (info);
1034+ g_free (parents);
1035+ g_free (children);
1036+ g_free (all_children);
1037+
1038+ uri = ZEITGEIST_NMO_EMAIL;
1039+ parents = g_new (char*, 2);
1040+ parents[0] = ZEITGEIST_NMO_MESSAGE;
1041+ parents[1] = NULL;
1042+ children = g_new (char*, 1);
1043+ children[0] = NULL;
1044+ all_children = g_new (char*, 1);
1045+ all_children[0] = NULL;
1046+ info = symbol_info_new (uri, parents, children, all_children);
1047+ zeitgeist_register_symbol (info);
1048+ g_free (parents);
1049+ g_free (children);
1050+ g_free (all_children);
1051+
1052+ uri = ZEITGEIST_NFO_PAGINATED_TEXT_DOCUMENT;
1053+ parents = g_new (char*, 2);
1054+ parents[0] = ZEITGEIST_NFO_TEXT_DOCUMENT;
1055+ parents[1] = NULL;
1056+ children = g_new (char*, 1);
1057+ children[0] = NULL;
1058+ all_children = g_new (char*, 1);
1059+ all_children[0] = NULL;
1060+ info = symbol_info_new (uri, parents, children, all_children);
1061+ zeitgeist_register_symbol (info);
1062+ g_free (parents);
1063+ g_free (children);
1064+ g_free (all_children);
1065+
1066+ uri = ZEITGEIST_NMM_TVSHOW;
1067+ parents = g_new (char*, 2);
1068+ parents[0] = ZEITGEIST_NFO_VIDEO;
1069+ parents[1] = NULL;
1070+ children = g_new (char*, 1);
1071+ children[0] = NULL;
1072+ all_children = g_new (char*, 1);
1073+ all_children[0] = NULL;
1074+ info = symbol_info_new (uri, parents, children, all_children);
1075+ zeitgeist_register_symbol (info);
1076+ g_free (parents);
1077+ g_free (children);
1078+ g_free (all_children);
1079+
1080+ uri = ZEITGEIST_NMM_TVSERIES;
1081+ parents = g_new (char*, 1);
1082+ parents[0] = NULL;
1083+ children = g_new (char*, 1);
1084+ children[0] = NULL;
1085+ all_children = g_new (char*, 1);
1086+ all_children[0] = NULL;
1087+ info = symbol_info_new (uri, parents, children, all_children);
1088+ zeitgeist_register_symbol (info);
1089+ g_free (parents);
1090+ g_free (children);
1091+ g_free (all_children);
1092+
1093+ uri = ZEITGEIST_NFO_AUDIO;
1094+ parents = g_new (char*, 2);
1095+ parents[0] = ZEITGEIST_NFO_MEDIA;
1096+ parents[1] = NULL;
1097+ children = g_new (char*, 1);
1098+ children[0] = NULL;
1099+ all_children = g_new (char*, 1);
1100+ all_children[0] = NULL;
1101+ info = symbol_info_new (uri, parents, children, all_children);
1102+ zeitgeist_register_symbol (info);
1103+ g_free (parents);
1104+ g_free (children);
1105+ g_free (all_children);
1106+
1107+ uri = ZEITGEIST_NFO_OPERATING_SYSTEM;
1108+ parents = g_new (char*, 2);
1109+ parents[0] = ZEITGEIST_NFO_SOFTWARE;
1110+ parents[1] = NULL;
1111+ children = g_new (char*, 1);
1112+ children[0] = NULL;
1113+ all_children = g_new (char*, 1);
1114+ all_children[0] = NULL;
1115+ info = symbol_info_new (uri, parents, children, all_children);
1116+ zeitgeist_register_symbol (info);
1117+ g_free (parents);
1118+ g_free (children);
1119+ g_free (all_children);
1120+
1121+ uri = ZEITGEIST_NFO_SOFTWARE;
1122+ parents = g_new (char*, 1);
1123+ parents[0] = NULL;
1124+ children = g_new (char*, 3);
1125+ children[0] = ZEITGEIST_NFO_APPLICATION;
1126+ children[1] = ZEITGEIST_NFO_OPERATING_SYSTEM;
1127+ children[2] = NULL;
1128+ all_children = g_new (char*, 3);
1129+ all_children[0] = ZEITGEIST_NFO_OPERATING_SYSTEM;
1130+ all_children[1] = ZEITGEIST_NFO_APPLICATION;
1131+ all_children[2] = NULL;
1132+ info = symbol_info_new (uri, parents, children, all_children);
1133+ zeitgeist_register_symbol (info);
1134+ g_free (parents);
1135+ g_free (children);
1136+ g_free (all_children);
1137+
1138+ uri = ZEITGEIST_NMM_MOVIE;
1139+ parents = g_new (char*, 2);
1140+ parents[0] = ZEITGEIST_NFO_VIDEO;
1141+ parents[1] = NULL;
1142+ children = g_new (char*, 1);
1143+ children[0] = NULL;
1144+ all_children = g_new (char*, 1);
1145+ all_children[0] = NULL;
1146+ info = symbol_info_new (uri, parents, children, all_children);
1147+ zeitgeist_register_symbol (info);
1148+ g_free (parents);
1149+ g_free (children);
1150+ g_free (all_children);
1151+
1152+ uri = ZEITGEIST_NCAL_TIMEZONE;
1153+ parents = g_new (char*, 1);
1154+ parents[0] = NULL;
1155+ children = g_new (char*, 1);
1156+ children[0] = NULL;
1157+ all_children = g_new (char*, 1);
1158+ all_children[0] = NULL;
1159+ info = symbol_info_new (uri, parents, children, all_children);
1160+ zeitgeist_register_symbol (info);
1161+ g_free (parents);
1162+ g_free (children);
1163+ g_free (all_children);
1164+
1165+ uri = ZEITGEIST_NCAL_ALARM;
1166+ parents = g_new (char*, 1);
1167+ parents[0] = NULL;
1168+ children = g_new (char*, 1);
1169+ children[0] = NULL;
1170+ all_children = g_new (char*, 1);
1171+ all_children[0] = NULL;
1172+ info = symbol_info_new (uri, parents, children, all_children);
1173+ zeitgeist_register_symbol (info);
1174+ g_free (parents);
1175+ g_free (children);
1176+ g_free (all_children);
1177+
1178+ uri = ZEITGEIST_NFO_FOLDER;
1179+ parents = g_new (char*, 2);
1180+ parents[0] = ZEITGEIST_NFO_DATA_CONTAINER;
1181+ parents[1] = NULL;
1182+ children = g_new (char*, 1);
1183+ children[0] = NULL;
1184+ all_children = g_new (char*, 1);
1185+ all_children[0] = NULL;
1186+ info = symbol_info_new (uri, parents, children, all_children);
1187+ zeitgeist_register_symbol (info);
1188+ g_free (parents);
1189+ g_free (children);
1190+ g_free (all_children);
1191+
1192+ uri = ZEITGEIST_NMO_MIME_ENTITY;
1193+ parents = g_new (char*, 1);
1194+ parents[0] = NULL;
1195+ children = g_new (char*, 1);
1196+ children[0] = NULL;
1197+ all_children = g_new (char*, 1);
1198+ all_children[0] = NULL;
1199+ info = symbol_info_new (uri, parents, children, all_children);
1200+ zeitgeist_register_symbol (info);
1201+ g_free (parents);
1202+ g_free (children);
1203+ g_free (all_children);
1204+
1205+ uri = ZEITGEIST_NCAL_FREEBUSY;
1206+ parents = g_new (char*, 1);
1207+ parents[0] = NULL;
1208+ children = g_new (char*, 1);
1209+ children[0] = NULL;
1210+ all_children = g_new (char*, 1);
1211+ all_children[0] = NULL;
1212+ info = symbol_info_new (uri, parents, children, all_children);
1213+ zeitgeist_register_symbol (info);
1214+ g_free (parents);
1215+ g_free (children);
1216+ g_free (all_children);
1217+
1218+ uri = ZEITGEIST_NFO_MEDIA;
1219+ parents = g_new (char*, 1);
1220+ parents[0] = NULL;
1221+ children = g_new (char*, 4);
1222+ children[0] = ZEITGEIST_NFO_VISUAL;
1223+ children[1] = ZEITGEIST_NFO_AUDIO;
1224+ children[2] = ZEITGEIST_NMM_MUSIC_PIECE;
1225+ children[3] = NULL;
1226+ all_children = g_new (char*, 12);
1227+ all_children[0] = ZEITGEIST_NMM_TVSHOW;
1228+ all_children[1] = ZEITGEIST_NMM_MUSIC_PIECE;
1229+ all_children[2] = ZEITGEIST_NFO_AUDIO;
1230+ all_children[3] = ZEITGEIST_NFO_VECTOR_IMAGE;
1231+ all_children[4] = ZEITGEIST_NFO_VIDEO;
1232+ all_children[5] = ZEITGEIST_NMM_MOVIE;
1233+ all_children[6] = ZEITGEIST_NFO_VISUAL;
1234+ all_children[7] = ZEITGEIST_NFO_CURSOR;
1235+ all_children[8] = ZEITGEIST_NFO_ICON;
1236+ all_children[9] = ZEITGEIST_NFO_IMAGE;
1237+ all_children[10] = ZEITGEIST_NFO_RASTER_IMAGE;
1238+ all_children[11] = NULL;
1239+ info = symbol_info_new (uri, parents, children, all_children);
1240+ zeitgeist_register_symbol (info);
1241+ g_free (parents);
1242+ g_free (children);
1243+ g_free (all_children);
1244+
1245+ uri = ZEITGEIST_ZG_DELETE_EVENT;
1246+ parents = g_new (char*, 2);
1247+ parents[0] = ZEITGEIST_ZG_EVENT_INTERPRETATION;
1248+ parents[1] = NULL;
1249+ children = g_new (char*, 1);
1250+ children[0] = NULL;
1251+ all_children = g_new (char*, 1);
1252+ all_children[0] = NULL;
1253+ info = symbol_info_new (uri, parents, children, all_children);
1254+ zeitgeist_register_symbol (info);
1255+ g_free (parents);
1256+ g_free (children);
1257+ g_free (all_children);
1258+
1259+ uri = ZEITGEIST_ZG_RECEIVE_EVENT;
1260+ parents = g_new (char*, 2);
1261+ parents[0] = ZEITGEIST_ZG_EVENT_INTERPRETATION;
1262+ parents[1] = NULL;
1263+ children = g_new (char*, 1);
1264+ children[0] = NULL;
1265+ all_children = g_new (char*, 1);
1266+ all_children[0] = NULL;
1267+ info = symbol_info_new (uri, parents, children, all_children);
1268+ zeitgeist_register_symbol (info);
1269+ g_free (parents);
1270+ g_free (children);
1271+ g_free (all_children);
1272+
1273+ uri = ZEITGEIST_NFO_HARD_DISK_PARTITION;
1274+ parents = g_new (char*, 1);
1275+ parents[0] = NULL;
1276+ children = g_new (char*, 1);
1277+ children[0] = NULL;
1278+ all_children = g_new (char*, 1);
1279+ all_children[0] = NULL;
1280+ info = symbol_info_new (uri, parents, children, all_children);
1281+ zeitgeist_register_symbol (info);
1282+ g_free (parents);
1283+ g_free (children);
1284+ g_free (all_children);
1285+
1286+ uri = ZEITGEIST_NFO_ARCHIVE_ITEM;
1287+ parents = g_new (char*, 2);
1288+ parents[0] = ZEITGEIST_NFO_EMBEDDED_FILE_DATA_OBJECT;
1289+ parents[1] = NULL;
1290+ children = g_new (char*, 1);
1291+ children[0] = NULL;
1292+ all_children = g_new (char*, 1);
1293+ all_children[0] = NULL;
1294+ info = symbol_info_new (uri, parents, children, all_children);
1295+ zeitgeist_register_symbol (info);
1296+ g_free (parents);
1297+ g_free (children);
1298+ g_free (all_children);
1299+
1300+ uri = ZEITGEIST_NFO_FILE_DATA_OBJECT;
1301+ parents = g_new (char*, 1);
1302+ parents[0] = NULL;
1303+ children = g_new (char*, 4);
1304+ children[0] = ZEITGEIST_NFO_EMBEDDED_FILE_DATA_OBJECT;
1305+ children[1] = ZEITGEIST_NFO_DELETED_RESOURCE;
1306+ children[2] = ZEITGEIST_NFO_REMOTE_DATA_OBJECT;
1307+ children[3] = NULL;
1308+ all_children = g_new (char*, 6);
1309+ all_children[0] = ZEITGEIST_NFO_EMBEDDED_FILE_DATA_OBJECT;
1310+ all_children[1] = ZEITGEIST_NFO_ARCHIVE_ITEM;
1311+ all_children[2] = ZEITGEIST_NFO_DELETED_RESOURCE;
1312+ all_children[3] = ZEITGEIST_NCAL_ATTACHMENT;
1313+ all_children[4] = ZEITGEIST_NFO_REMOTE_DATA_OBJECT;
1314+ all_children[5] = NULL;
1315+ info = symbol_info_new (uri, parents, children, all_children);
1316+ zeitgeist_register_symbol (info);
1317+ g_free (parents);
1318+ g_free (children);
1319+ g_free (all_children);
1320+
1321+ uri = ZEITGEIST_NFO_SOFTWARE_SERVICE;
1322+ parents = g_new (char*, 1);
1323+ parents[0] = NULL;
1324+ children = g_new (char*, 1);
1325+ children[0] = NULL;
1326+ all_children = g_new (char*, 1);
1327+ all_children[0] = NULL;
1328+ info = symbol_info_new (uri, parents, children, all_children);
1329+ zeitgeist_register_symbol (info);
1330+ g_free (parents);
1331+ g_free (children);
1332+ g_free (all_children);
1333+
1334+ uri = ZEITGEIST_ZG_SCHEDULED_ACTIVITY;
1335+ parents = g_new (char*, 2);
1336+ parents[0] = ZEITGEIST_ZG_EVENT_MANIFESTATION;
1337+ parents[1] = NULL;
1338+ children = g_new (char*, 1);
1339+ children[0] = NULL;
1340+ all_children = g_new (char*, 1);
1341+ all_children[0] = NULL;
1342+ info = symbol_info_new (uri, parents, children, all_children);
1343+ zeitgeist_register_symbol (info);
1344+ g_free (parents);
1345+ g_free (children);
1346+ g_free (all_children);
1347+
1348+ uri = ZEITGEIST_NFO_MEDIA_STREAM;
1349+ parents = g_new (char*, 1);
1350+ parents[0] = NULL;
1351+ children = g_new (char*, 1);
1352+ children[0] = NULL;
1353+ all_children = g_new (char*, 1);
1354+ all_children[0] = NULL;
1355+ info = symbol_info_new (uri, parents, children, all_children);
1356+ zeitgeist_register_symbol (info);
1357+ g_free (parents);
1358+ g_free (children);
1359+ g_free (all_children);
1360+
1361+ uri = ZEITGEIST_NFO_EMBEDDED_FILE_DATA_OBJECT;
1362+ parents = g_new (char*, 2);
1363+ parents[0] = ZEITGEIST_NFO_FILE_DATA_OBJECT;
1364+ parents[1] = NULL;
1365+ children = g_new (char*, 3);
1366+ children[0] = ZEITGEIST_NFO_ARCHIVE_ITEM;
1367+ children[1] = ZEITGEIST_NFO_ATTACHMENT;
1368+ children[2] = NULL;
1369+ all_children = g_new (char*, 3);
1370+ all_children[0] = ZEITGEIST_NFO_ARCHIVE_ITEM;
1371+ all_children[1] = ZEITGEIST_NCAL_ATTACHMENT;
1372+ all_children[2] = NULL;
1373+ info = symbol_info_new (uri, parents, children, all_children);
1374+ zeitgeist_register_symbol (info);
1375+ g_free (parents);
1376+ g_free (children);
1377+ g_free (all_children);
1378+
1379+ uri = ZEITGEIST_NCAL_ATTACHMENT;
1380+ parents = g_new (char*, 2);
1381+ parents[0] = ZEITGEIST_NFO_ATTACHMENT;
1382+ parents[1] = NULL;
1383+ children = g_new (char*, 1);
1384+ children[0] = NULL;
1385+ all_children = g_new (char*, 1);
1386+ all_children[0] = NULL;
1387+ info = symbol_info_new (uri, parents, children, all_children);
1388+ zeitgeist_register_symbol (info);
1389+ g_free (parents);
1390+ g_free (children);
1391+ g_free (all_children);
1392+
1393+ uri = ZEITGEIST_ZG_HEURISTIC_ACTIVITY;
1394+ parents = g_new (char*, 2);
1395+ parents[0] = ZEITGEIST_ZG_EVENT_MANIFESTATION;
1396+ parents[1] = NULL;
1397+ children = g_new (char*, 1);
1398+ children[0] = NULL;
1399+ all_children = g_new (char*, 1);
1400+ all_children[0] = NULL;
1401+ info = symbol_info_new (uri, parents, children, all_children);
1402+ zeitgeist_register_symbol (info);
1403+ g_free (parents);
1404+ g_free (children);
1405+ g_free (all_children);
1406+
1407+ uri = ZEITGEIST_NFO_REMOTE_DATA_OBJECT;
1408+ parents = g_new (char*, 2);
1409+ parents[0] = ZEITGEIST_NFO_FILE_DATA_OBJECT;
1410+ parents[1] = NULL;
1411+ children = g_new (char*, 1);
1412+ children[0] = NULL;
1413+ all_children = g_new (char*, 1);
1414+ all_children[0] = NULL;
1415+ info = symbol_info_new (uri, parents, children, all_children);
1416+ zeitgeist_register_symbol (info);
1417+ g_free (parents);
1418+ g_free (children);
1419+ g_free (all_children);
1420+
1421+ uri = ZEITGEIST_ZG_EVENT_MANIFESTATION;
1422+ parents = g_new (char*, 1);
1423+ parents[0] = NULL;
1424+ children = g_new (char*, 6);
1425+ children[0] = ZEITGEIST_ZG_USER_ACTIVITY;
1426+ children[1] = ZEITGEIST_ZG_SYSTEM_NOTIFICATION;
1427+ children[2] = ZEITGEIST_ZG_HEURISTIC_ACTIVITY;
1428+ children[3] = ZEITGEIST_ZG_SCHEDULED_ACTIVITY;
1429+ children[4] = ZEITGEIST_ZG_WORLD_ACTIVITY;
1430+ children[5] = NULL;
1431+ all_children = g_new (char*, 6);
1432+ all_children[0] = ZEITGEIST_ZG_USER_ACTIVITY;
1433+ all_children[1] = ZEITGEIST_ZG_WORLD_ACTIVITY;
1434+ all_children[2] = ZEITGEIST_ZG_HEURISTIC_ACTIVITY;
1435+ all_children[3] = ZEITGEIST_ZG_SCHEDULED_ACTIVITY;
1436+ all_children[4] = ZEITGEIST_ZG_SYSTEM_NOTIFICATION;
1437+ all_children[5] = NULL;
1438+ info = symbol_info_new (uri, parents, children, all_children);
1439+ zeitgeist_register_symbol (info);
1440+ g_free (parents);
1441+ g_free (children);
1442+ g_free (all_children);
1443+
1444+ uri = ZEITGEIST_NMO_MAILBOX_DATA_OBJECT;
1445+ parents = g_new (char*, 1);
1446+ parents[0] = NULL;
1447+ children = g_new (char*, 1);
1448+ children[0] = NULL;
1449+ all_children = g_new (char*, 1);
1450+ all_children[0] = NULL;
1451+ info = symbol_info_new (uri, parents, children, all_children);
1452+ zeitgeist_register_symbol (info);
1453+ g_free (parents);
1454+ g_free (children);
1455+ g_free (all_children);
1456+
1457+ uri = ZEITGEIST_NCAL_CALENDAR_DATA_OBJECT;
1458+ parents = g_new (char*, 1);
1459+ parents[0] = NULL;
1460+ children = g_new (char*, 1);
1461+ children[0] = NULL;
1462+ all_children = g_new (char*, 1);
1463+ all_children[0] = NULL;
1464+ info = symbol_info_new (uri, parents, children, all_children);
1465+ zeitgeist_register_symbol (info);
1466+ g_free (parents);
1467+ g_free (children);
1468+ g_free (all_children);
1469+
1470+ uri = ZEITGEIST_ZG_USER_ACTIVITY;
1471+ parents = g_new (char*, 2);
1472+ parents[0] = ZEITGEIST_ZG_EVENT_MANIFESTATION;
1473+ parents[1] = NULL;
1474+ children = g_new (char*, 1);
1475+ children[0] = NULL;
1476+ all_children = g_new (char*, 1);
1477+ all_children[0] = NULL;
1478+ info = symbol_info_new (uri, parents, children, all_children);
1479+ zeitgeist_register_symbol (info);
1480+ g_free (parents);
1481+ g_free (children);
1482+ g_free (all_children);
1483+
1484+ uri = ZEITGEIST_NFO_REMOTE_PORT_ADDRESS;
1485+ parents = g_new (char*, 1);
1486+ parents[0] = NULL;
1487+ children = g_new (char*, 1);
1488+ children[0] = NULL;
1489+ all_children = g_new (char*, 1);
1490+ all_children[0] = NULL;
1491+ info = symbol_info_new (uri, parents, children, all_children);
1492+ zeitgeist_register_symbol (info);
1493+ g_free (parents);
1494+ g_free (children);
1495+ g_free (all_children);
1496+
1497+ uri = ZEITGEIST_ZG_WORLD_ACTIVITY;
1498+ parents = g_new (char*, 2);
1499+ parents[0] = ZEITGEIST_ZG_EVENT_MANIFESTATION;
1500+ parents[1] = NULL;
1501+ children = g_new (char*, 1);
1502+ children[0] = NULL;
1503+ all_children = g_new (char*, 1);
1504+ all_children[0] = NULL;
1505+ info = symbol_info_new (uri, parents, children, all_children);
1506+ zeitgeist_register_symbol (info);
1507+ g_free (parents);
1508+ g_free (children);
1509+ g_free (all_children);
1510+
1511+ uri = ZEITGEIST_NFO_SOFTWARE_ITEM;
1512+ parents = g_new (char*, 1);
1513+ parents[0] = NULL;
1514+ children = g_new (char*, 1);
1515+ children[0] = NULL;
1516+ all_children = g_new (char*, 1);
1517+ all_children[0] = NULL;
1518+ info = symbol_info_new (uri, parents, children, all_children);
1519+ zeitgeist_register_symbol (info);
1520+ g_free (parents);
1521+ g_free (children);
1522+ g_free (all_children);
1523+
1524+ uri = ZEITGEIST_NFO_DELETED_RESOURCE;
1525+ parents = g_new (char*, 2);
1526+ parents[0] = ZEITGEIST_NFO_FILE_DATA_OBJECT;
1527+ parents[1] = NULL;
1528+ children = g_new (char*, 1);
1529+ children[0] = NULL;
1530+ all_children = g_new (char*, 1);
1531+ all_children[0] = NULL;
1532+ info = symbol_info_new (uri, parents, children, all_children);
1533+ zeitgeist_register_symbol (info);
1534+ g_free (parents);
1535+ g_free (children);
1536+ g_free (all_children);
1537+
1538+ uri = ZEITGEIST_ZG_SYSTEM_NOTIFICATION;
1539+ parents = g_new (char*, 2);
1540+ parents[0] = ZEITGEIST_ZG_EVENT_MANIFESTATION;
1541+ parents[1] = NULL;
1542+ children = g_new (char*, 1);
1543+ children[0] = NULL;
1544+ all_children = g_new (char*, 1);
1545+ all_children[0] = NULL;
1546+ info = symbol_info_new (uri, parents, children, all_children);
1547+ zeitgeist_register_symbol (info);
1548+ g_free (parents);
1549+ g_free (children);
1550+ g_free (all_children);
1551+
1552+
1553+ symbols_loaded = TRUE;
1554+}
1555+
1556
1557=== added file 'src/zeitgeist-symbols.h'
1558--- src/zeitgeist-symbols.h 1970-01-01 00:00:00 +0000
1559+++ src/zeitgeist-symbols.h 2010-08-09 22:06:44 +0000
1560@@ -0,0 +1,42 @@
1561+/*
1562+ * Copyright (C) 2010 Canonical, Ltd.
1563+ *
1564+ * This library is free software; you can redistribute it and/or modify
1565+ * it under the terms of the GNU Lesser General Public License
1566+ * version 3.0 as published by the Free Software Foundation.
1567+ *
1568+ * This library is distributed in the hope that it will be useful,
1569+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1570+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1571+ * GNU Lesser General Public License version 3.0 for more details.
1572+ *
1573+ * You should have received a copy of the GNU Lesser General Public
1574+ * License along with this library. If not, see
1575+ * <http://www.gnu.org/licenses/>.
1576+ *
1577+ * Authored by: Michal Hruby <michal.mhr@gmail.com>
1578+ */
1579+
1580+#if !defined (_ZEITGEIST_H_INSIDE_) && !defined (ZEITGEIST_COMPILATION)
1581+#error "Only <zeitgeist.h> can be included directly."
1582+#endif
1583+
1584+#ifndef _ZEITGEIST_SYMBOLS_H_
1585+#define _ZEITGEIST_SYMBOLS_H_
1586+
1587+#include <glib.h>
1588+#include <glib-object.h>
1589+
1590+G_BEGIN_DECLS
1591+
1592+GList* zeitgeist_symbol_get_parents (const gchar *symbol);
1593+
1594+GList* zeitgeist_symbol_get_children (const gchar *symbol);
1595+
1596+GList* zeitgeist_symbol_get_all_children (const gchar *symbol);
1597+
1598+gboolean zeitgeist_symbol_is_a (const gchar *symbol, const gchar *parent);
1599+
1600+G_END_DECLS
1601+
1602+#endif /* _ZEITGEIST_SYMBOLS_H_ */
1603
1604=== modified file 'src/zeitgeist.h'
1605--- src/zeitgeist.h 2010-07-22 09:21:47 +0000
1606+++ src/zeitgeist.h 2010-08-09 22:06:44 +0000
1607@@ -36,6 +36,7 @@
1608 #include <zeitgeist-ontology-manifestations.h>
1609 #include <zeitgeist-result-set.h>
1610 #include <zeitgeist-subject.h>
1611+#include <zeitgeist-symbols.h>
1612 #include <zeitgeist-timerange.h>
1613 #include <zeitgeist-timestamp.h>
1614
1615
1616=== modified file 'tests/Makefile.am'
1617--- tests/Makefile.am 2010-07-22 09:21:47 +0000
1618+++ tests/Makefile.am 2010-08-09 22:06:44 +0000
1619@@ -40,6 +40,10 @@
1620 test_timestamp_SOURCES = test-timestamp.c $(helper_sources)
1621 test_timestamp_LDADD = $(zeitgeist_libs)
1622
1623+TEST_PROGS += test-symbols
1624+test_symbols_SOURCES = test-symbols.c $(helper_sources)
1625+test_symbols_LDADD = $(zeitgeist_libs)
1626+
1627 TEST_PROGS += test-monitor
1628 test_monitor_SOURCES = test-monitor.c $(helper_sources)
1629 test_monitor_LDADD = $(zeitgeist_libs)
1630
1631=== added file 'tests/test-symbols.c'
1632--- tests/test-symbols.c 1970-01-01 00:00:00 +0000
1633+++ tests/test-symbols.c 2010-08-09 22:06:44 +0000
1634@@ -0,0 +1,220 @@
1635+/*
1636+ * Copyright (C) 2010 Canonical Ltd
1637+ *
1638+ * This program is free software: you can redistribute it and/or modify
1639+ * it under the terms of the GNU General Public License version 3 as
1640+ * published by the Free Software Foundation.
1641+ *
1642+ * This program is distributed in the hope that it will be useful,
1643+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1644+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1645+ * GNU General Public License for more details.
1646+ *
1647+ * You should have received a copy of the GNU General Public License
1648+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1649+ *
1650+ * Authored by Michal Hruby <michal.mhr@gmail.com>
1651+ *
1652+ */
1653+
1654+#include <glib.h>
1655+#include <glib-object.h>
1656+#include <string.h>
1657+#include "zeitgeist-symbols.h"
1658+#include "zeitgeist-ontology-interpretations.h"
1659+
1660+typedef struct
1661+{
1662+
1663+} Fixture;
1664+
1665+static void setup (Fixture *fix, gconstpointer data);
1666+static void teardown (Fixture *fix, gconstpointer data);
1667+
1668+static void
1669+setup (Fixture *fix, gconstpointer data)
1670+{
1671+
1672+}
1673+
1674+static void
1675+teardown (Fixture *fix, gconstpointer data)
1676+{
1677+
1678+}
1679+
1680+static void
1681+test_null_symbols (Fixture *fix, gconstpointer data)
1682+{
1683+ // shouldn't crash
1684+ zeitgeist_symbol_is_a (NULL, NULL);
1685+}
1686+
1687+static void
1688+test_null_first (Fixture *fix, gconstpointer data)
1689+{
1690+ gboolean res = zeitgeist_symbol_is_a (NULL, ZEITGEIST_NFO_MEDIA);
1691+
1692+ g_assert_cmpint (res, ==, FALSE);
1693+}
1694+
1695+static void
1696+test_null_second (Fixture *fix, gconstpointer data)
1697+{
1698+ gboolean res = zeitgeist_symbol_is_a (ZEITGEIST_NFO_MEDIA, NULL);
1699+
1700+ g_assert_cmpint (res, ==, FALSE);
1701+}
1702+
1703+static void
1704+test_not_uri (Fixture *fix, gconstpointer data)
1705+{
1706+ gboolean res = zeitgeist_symbol_is_a ("first", "second");
1707+
1708+ g_assert_cmpint (res, ==, FALSE);
1709+}
1710+
1711+static void
1712+test_not_uri_equal (Fixture *fix, gconstpointer data)
1713+{
1714+ gboolean res = zeitgeist_symbol_is_a ("something", "something");
1715+
1716+ g_assert_cmpint (res, ==, FALSE);
1717+}
1718+
1719+static void
1720+test_uris_equal (Fixture *fix, gconstpointer data)
1721+{
1722+ gboolean res = zeitgeist_symbol_is_a (ZEITGEIST_NFO_AUDIO,
1723+ ZEITGEIST_NFO_AUDIO);
1724+
1725+ g_assert_cmpint (res, ==, TRUE);
1726+}
1727+
1728+static void
1729+test_vector_image_media (Fixture *fix, gconstpointer data)
1730+{
1731+ gboolean res = zeitgeist_symbol_is_a (ZEITGEIST_NFO_VECTOR_IMAGE,
1732+ ZEITGEIST_NFO_MEDIA);
1733+
1734+ g_assert_cmpint (res, ==, TRUE);
1735+}
1736+
1737+static void
1738+test_media_vector_image (Fixture *fix, gconstpointer data)
1739+{
1740+ gboolean res = zeitgeist_symbol_is_a (ZEITGEIST_NFO_MEDIA,
1741+ ZEITGEIST_NFO_VECTOR_IMAGE);
1742+
1743+ g_assert_cmpint (res, ==, FALSE);
1744+}
1745+
1746+static void
1747+test_media_software (Fixture *fix, gconstpointer data)
1748+{
1749+ gboolean res = zeitgeist_symbol_is_a (ZEITGEIST_NFO_MEDIA,
1750+ ZEITGEIST_NFO_SOFTWARE);
1751+
1752+ g_assert_cmpint (res, ==, FALSE);
1753+}
1754+
1755+static void
1756+is_uri_valid (gpointer data, gpointer unused)
1757+{
1758+ const gchar SEM_D_URI[] = "http://www.semanticdesktop.org/ontologies";
1759+ gchar *uri = (gchar*) data;
1760+ g_assert (uri != NULL && g_str_has_prefix (uri, SEM_D_URI));
1761+ gchar *str = g_strdup_printf ("%s", uri);
1762+
1763+ g_free (str);
1764+}
1765+
1766+static void
1767+test_media_children (Fixture *fix, gconstpointer data)
1768+{
1769+ GList* children = zeitgeist_symbol_get_children (ZEITGEIST_NFO_MEDIA);
1770+
1771+ g_assert_cmpint (g_list_length (children), >, 0);
1772+ g_list_foreach (children, is_uri_valid, NULL);
1773+
1774+ g_list_free (children);
1775+}
1776+
1777+static void
1778+test_media_all_children (Fixture *fix, gconstpointer data)
1779+{
1780+ GList* children = zeitgeist_symbol_get_all_children (ZEITGEIST_NFO_MEDIA);
1781+
1782+ g_assert_cmpint (g_list_length (children), >, 0);
1783+ g_list_foreach (children, is_uri_valid, NULL);
1784+
1785+ g_list_free (children);
1786+}
1787+
1788+static void
1789+test_vector_image_parents (Fixture *fix, gconstpointer data)
1790+{
1791+ GList* parents = zeitgeist_symbol_get_parents (ZEITGEIST_NFO_VECTOR_IMAGE);
1792+
1793+ g_assert_cmpint (g_list_length (parents), >, 0);
1794+ g_list_foreach (parents, is_uri_valid, NULL);
1795+
1796+ g_list_free (parents);
1797+}
1798+
1799+static void
1800+test_media_complex (Fixture *fix, gconstpointer data)
1801+{
1802+ GList* iter;
1803+ GList* children = zeitgeist_symbol_get_children (ZEITGEIST_NFO_MEDIA);
1804+ GList* all_ch = zeitgeist_symbol_get_all_children (ZEITGEIST_NFO_MEDIA);
1805+
1806+ g_assert_cmpint (g_list_length (children), >, 0);
1807+ g_assert_cmpint (g_list_length (all_ch), >, g_list_length (children));
1808+
1809+ for (iter = children; iter; iter = iter->next)
1810+ {
1811+ // check that it's also in all_children
1812+ g_assert (g_list_find_custom (all_ch, iter->data, (GCompareFunc) strcmp));
1813+ }
1814+
1815+ g_list_free (all_ch);
1816+ g_list_free (children);
1817+}
1818+
1819+int
1820+main (int argc,
1821+ char *argv[])
1822+{
1823+ g_type_init ();
1824+ g_test_init (&argc, &argv, NULL);
1825+
1826+ g_test_add ("/Zeitgeist/Symbols/NullNull", Fixture, NULL,
1827+ setup, test_null_symbols, teardown);
1828+ g_test_add ("/Zeitgeist/Symbols/FirstNull", Fixture, NULL,
1829+ setup, test_null_first, teardown);
1830+ g_test_add ("/Zeitgeist/Symbols/SecondNull", Fixture, NULL,
1831+ setup, test_null_second, teardown);
1832+ g_test_add ("/Zeitgeist/Symbols/NotUris", Fixture, NULL,
1833+ setup, test_not_uri, teardown);
1834+ g_test_add ("/Zeitgeist/Symbols/NotUrisEqual", Fixture, NULL,
1835+ setup, test_not_uri_equal, teardown);
1836+ g_test_add ("/Zeitgeist/Symbols/EqualUris", Fixture, NULL,
1837+ setup, test_uris_equal, teardown);
1838+ g_test_add ("/Zeitgeist/Symbols/ValidParent", Fixture, NULL,
1839+ setup, test_vector_image_media, teardown);
1840+ g_test_add ("/Zeitgeist/Symbols/ValidChild", Fixture, NULL,
1841+ setup, test_media_vector_image, teardown);
1842+ g_test_add ("/Zeitgeist/Symbols/Unrelated", Fixture, NULL,
1843+ setup, test_media_software, teardown);
1844+ g_test_add ("/Zeitgeist/Symbols/GetChildren", Fixture, NULL,
1845+ setup, test_media_children, teardown);
1846+ g_test_add ("/Zeitgeist/Symbols/GetAllChildren", Fixture, NULL,
1847+ setup, test_media_all_children, teardown);
1848+ g_test_add ("/Zeitgeist/Symbols/GetParents", Fixture, NULL,
1849+ setup, test_vector_image_parents, teardown);
1850+ g_test_add ("/Zeitgeist/Symbols/SymbolInfo", Fixture, NULL,
1851+ setup, test_media_complex, teardown);
1852+
1853+ return g_test_run();
1854+}
1855
1856=== added file 'tools/symboltree2c.py'
1857--- tools/symboltree2c.py 1970-01-01 00:00:00 +0000
1858+++ tools/symboltree2c.py 2010-08-09 22:06:44 +0000
1859@@ -0,0 +1,107 @@
1860+#
1861+# Utility to transcode the Zeitgeist ontology from Python code
1862+# to a C header file defining a collection of macros for the
1863+# members of the ontology
1864+#
1865+
1866+import sys
1867+import re
1868+import zeitgeist.datamodel as dm
1869+
1870+def caseconv(name):
1871+ """
1872+ Converts CamelCase to CAMEL_CASE
1873+ """
1874+ result = ""
1875+ for i in range(len(name) - 1) :
1876+ if name[i].islower() and name[i+1].isupper():
1877+ result += name[i].upper() + "_"
1878+ else:
1879+ result += name[i].upper()
1880+ result += name[-1].upper()
1881+ return result
1882+
1883+def symbolname (symbol):
1884+ try:
1885+ ns, name = symbol[symbol.rfind("/")+1:].split("#")
1886+ return "ZEITGEIST_%s_%s" % (ns.upper(), caseconv(name))
1887+ except Exception, e:
1888+ return symbol.uri.rpartition("#")[2].upper()
1889+
1890+def output_symbol_func (body):
1891+ header = """
1892+static void
1893+_ensure_symbols_loaded (void)
1894+{
1895+ gchar **parents;
1896+ gchar **children;
1897+ gchar **all_children;
1898+ gchar *uri;
1899+ SymbolInfo *info;
1900+
1901+ if (symbols_loaded) return;
1902+
1903+%s
1904+
1905+ symbols_loaded = TRUE;
1906+}
1907+"""
1908+
1909+ # indent
1910+ symbols_func = header[1:] % re.sub(r'(?m)^(.+)$', r' \1', body)
1911+ return symbols_func
1912+
1913+def get_symbols (l):
1914+ s = filter(lambda x: x not in [dm.Interpretation, dm.Manifestation], l)
1915+ s = map(symbolname, s)
1916+ s.append("NULL")
1917+
1918+ return s
1919+
1920+def alloc_array (name, symbols):
1921+ num_elems = len(symbols)
1922+ alloc_call = '%s = g_new (char*, %d);' % (name, num_elems)
1923+ elems = ['%s[%d] = %s;' % (name,i,symbols[i]) for i in xrange(0, num_elems)]
1924+ elems.insert(0, alloc_call)
1925+ return '\n'.join(elems)
1926+
1927+def register_symbol (symbol):
1928+ uri = 'uri = %s;' % symbolname(symbol)
1929+ arrays = ['parents', 'children', 'all_children']
1930+ parents = alloc_array(arrays[0], get_symbols(symbol.get_parents()))
1931+ children = alloc_array(arrays[1], get_symbols(symbol.get_children()))
1932+ all_ch = alloc_array(arrays[2], get_symbols(symbol.get_all_children()))
1933+
1934+ si_call = 'info = symbol_info_new (uri, parents, children, all_children);'
1935+ register_call = 'zeitgeist_register_symbol (info);'
1936+
1937+ calls = [uri, parents, children, all_ch, si_call, register_call]
1938+ calls.extend(['g_free (%s);' % var for var in arrays])
1939+
1940+ return '\n'.join(calls) + '\n'
1941+
1942+if __name__ == "__main__":
1943+ interpretations = []
1944+ manifestations = []
1945+ for interp in dm.Interpretation.get_all_children():
1946+ try:
1947+ stmt = register_symbol (interp)
1948+ interpretations.append(stmt)
1949+ except Exception, e:
1950+ print >> sys.stderr, "Failed to convert %s: %s" % (interp, e)
1951+
1952+ for manif in dm.Manifestation.get_all_children():
1953+ try:
1954+ stmt = register_symbol (manif)
1955+ manifestations.append(stmt)
1956+ except Exception, e:
1957+ print >> sys.stderr, "Failed to convert %s: %s" % (manif, e)
1958+
1959+
1960+ all_symbols = []
1961+ all_symbols.extend(interpretations)
1962+ all_symbols.extend(manifestations)
1963+
1964+ f = open('zeitgeist-symbols.template', 'r')
1965+ print f.read()
1966+ print output_symbol_func('\n'.join(all_symbols))
1967
1968=== added file 'tools/zeitgeist-symbols.template'
1969--- tools/zeitgeist-symbols.template 1970-01-01 00:00:00 +0000
1970+++ tools/zeitgeist-symbols.template 2010-08-09 22:06:44 +0000
1971@@ -0,0 +1,210 @@
1972+/*
1973+ * Copyright (C) 2010 Canonical, Ltd.
1974+ *
1975+ * This library is free software; you can redistribute it and/or modify
1976+ * it under the terms of the GNU Lesser General Public License
1977+ * version 3.0 as published by the Free Software Foundation.
1978+ *
1979+ * This library is distributed in the hope that it will be useful,
1980+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1981+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1982+ * GNU Lesser General Public License version 3.0 for more details.
1983+ *
1984+ * You should have received a copy of the GNU Lesser General Public
1985+ * License along with this library. If not, see
1986+ * <http://www.gnu.org/licenses/>.
1987+ *
1988+ * Authored by: Michal Hruby <michal.mhr@gmail.com>
1989+ */
1990+
1991+/**
1992+ * SECTION:zeitgeist-symbols
1993+ * @short_description: Used to get information about Interpretation and/or
1994+ * Manifestation symbols
1995+ * @include: zeitgeist.h
1996+ */
1997+
1998+#include "zeitgeist-ontology-interpretations.h"
1999+#include "zeitgeist-ontology-manifestations.h"
2000+#include "zeitgeist-symbols.h"
2001+
2002+static void _ensure_symbols_loaded (void);
2003+
2004+static gboolean symbols_loaded = FALSE;
2005+static GHashTable *symbol_uris = NULL;
2006+
2007+typedef struct
2008+{
2009+ gchar *uri;
2010+ GSList *parents;
2011+ GSList *children;
2012+ GSList *all_children;
2013+} SymbolInfo;
2014+
2015+static SymbolInfo*
2016+symbol_info_new (gchar *uri,
2017+ GStrv parents,
2018+ GStrv children,
2019+ GStrv all_children)
2020+{
2021+ gchar *iter;
2022+ SymbolInfo *i = g_slice_new0 (SymbolInfo);
2023+ i->uri = g_strdup (uri);
2024+
2025+ while (*parents)
2026+ {
2027+ i->parents = g_slist_append (i->parents,
2028+ GINT_TO_POINTER (g_quark_from_string (*parents)));
2029+ parents++;
2030+ }
2031+
2032+ while (*children)
2033+ {
2034+ i->children = g_slist_append (i->children,
2035+ GINT_TO_POINTER (g_quark_from_string (*children)));
2036+ children++;
2037+ }
2038+
2039+ while (*all_children)
2040+ {
2041+ i->all_children = g_slist_append (i->all_children,
2042+ GINT_TO_POINTER (g_quark_from_string (*all_children)));
2043+ all_children++;
2044+ }
2045+
2046+ return i;
2047+}
2048+
2049+static void
2050+zeitgeist_register_symbol (SymbolInfo *i)
2051+{
2052+ if (symbol_uris == NULL)
2053+ symbol_uris = g_hash_table_new (g_str_hash, g_str_equal);
2054+
2055+ g_hash_table_insert (symbol_uris, i->uri, i);
2056+}
2057+
2058+/**
2059+ * zeitgeist_symbol_get_parents:
2060+ * @symbol: A symbol.
2061+ *
2062+ * Gets list of parents of the specified symbol.
2063+ *
2064+ * Returns: A newly allocated list of parents of this symbol.
2065+ * The data elements of the list contain strings which you
2066+ * do not own, use g_strdup() if you intend to work with them.
2067+ * Free the list with a call to g_list_free().
2068+ */
2069+GList*
2070+zeitgeist_symbol_get_parents (const gchar *symbol)
2071+{
2072+ GSList *iter;
2073+ GList *result = NULL;
2074+ g_return_val_if_fail (symbol != NULL, NULL);
2075+
2076+ _ensure_symbols_loaded ();
2077+
2078+ SymbolInfo *info = (SymbolInfo*) g_hash_table_lookup (symbol_uris, symbol);
2079+ g_return_val_if_fail (info != NULL, NULL);
2080+
2081+ for (iter = info->parents; iter; iter = iter->next)
2082+ {
2083+ result = g_list_prepend (result,
2084+ g_quark_to_string (GPOINTER_TO_INT (iter->data)));
2085+ }
2086+
2087+ return g_list_reverse (result);
2088+}
2089+
2090+/**
2091+ * zeitgeist_symbol_get_children:
2092+ * @symbol: A symbol.
2093+ *
2094+ * Gets list of direct children of the specified symbol.
2095+ *
2096+ * Returns: A newly allocated list of direct children of this symbol.
2097+ * The data elements of the list contain strings which you
2098+ * do not own, use g_strdup() if you intend to work with them.
2099+ * Free the list with a call to g_list_free().
2100+ */
2101+GList*
2102+zeitgeist_symbol_get_children (const gchar *symbol)
2103+{
2104+ GSList *iter;
2105+ GList *result = NULL;
2106+ g_return_val_if_fail (symbol != NULL, NULL);
2107+
2108+ _ensure_symbols_loaded ();
2109+
2110+ SymbolInfo *info = (SymbolInfo*) g_hash_table_lookup (symbol_uris, symbol);
2111+ g_return_val_if_fail (info != NULL, NULL);
2112+
2113+ for (iter = info->children; iter; iter = iter->next)
2114+ {
2115+ result = g_list_prepend (result,
2116+ g_quark_to_string (GPOINTER_TO_INT (iter->data)));
2117+ }
2118+
2119+ return g_list_reverse (result);
2120+}
2121+
2122+/**
2123+ * zeitgeist_symbol_get_all_children:
2124+ * @symbol: A symbol.
2125+ *
2126+ * Gets list of all children of the specified symbol.
2127+ *
2128+ * Returns: A newly allocated list of all children of this symbol (includes
2129+ * also children of children).
2130+ * The data elements of the list contain strings which you
2131+ * do not own, use g_strdup() if you intend to work with them.
2132+ * Free the list with a call to g_list_free().
2133+ */
2134+GList*
2135+zeitgeist_symbol_get_all_children (const gchar *symbol)
2136+{
2137+ GSList *iter;
2138+ GList *result = NULL;
2139+ g_return_val_if_fail (symbol != NULL, NULL);
2140+
2141+ _ensure_symbols_loaded ();
2142+
2143+ SymbolInfo *info = (SymbolInfo*) g_hash_table_lookup (symbol_uris, symbol);
2144+ g_return_val_if_fail (info != NULL, NULL);
2145+
2146+ for (iter = info->all_children; iter; iter = iter->next)
2147+ {
2148+ result = g_list_prepend (result,
2149+ g_quark_to_string (GPOINTER_TO_INT (iter->data)));
2150+ }
2151+
2152+ return g_list_reverse (result);
2153+}
2154+
2155+/**
2156+ * zeitgeist_symbol_is_a:
2157+ * @symbol: A symbol.
2158+ * @parent: Parent symbol.
2159+ *
2160+ * Determines if @symbol is child of @parent.
2161+ *
2162+ * Returns: True if @symbol is child of @parent (or equal to @parent),
2163+ * FALSE otherwise.
2164+ */
2165+gboolean
2166+zeitgeist_symbol_is_a (const gchar *symbol, const gchar *parent)
2167+{
2168+ if (parent == NULL || symbol == NULL) return FALSE;
2169+
2170+ _ensure_symbols_loaded ();
2171+
2172+ SymbolInfo *info = (SymbolInfo*) g_hash_table_lookup (symbol_uris, parent);
2173+ if (info == NULL) return FALSE;
2174+
2175+ GQuark symbol_quark = g_quark_try_string (symbol);
2176+ if (symbol_quark == 0) return FALSE;
2177+ // catch equal symbols
2178+ if (symbol_quark == g_quark_try_string (parent)) return TRUE;
2179+
2180+ return g_slist_find (info->all_children, GINT_TO_POINTER (symbol_quark)) != NULL;
2181+}

Subscribers

People subscribed via source and target branches