[tracker] Show the notification flag in the HTML documentation of the classes



commit 9740d3729614e4b37fbaf538d93b7046332d6e7a
Author: Ivan Frade <ivan frade nokia com>
Date:   Tue Dec 1 18:50:07 2009 +0200

    Show the notification flag in the HTML documentation of the classes

 utils/services/ttl_html.c   |    7 +++++++
 utils/services/ttl_loader.c |   20 ++++++++++++++++++++
 utils/services/ttl_model.c  |    1 +
 utils/services/ttl_model.h  |    1 +
 4 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/utils/services/ttl_html.c b/utils/services/ttl_html.c
index 9039182..a6b8b78 100644
--- a/utils/services/ttl_html.c
+++ b/utils/services/ttl_html.c
@@ -3,6 +3,7 @@
 #include "qname.h"
 
 #define DEFAULT_COPYRIGHT "Copyright &copy; 2009 <a href=\"http://www.nokia.com/\";>Nokia</a>"
+#define SIGNALS_DOC "http://live.gnome.org/Tracker/Documentation/SignalsOnChanges";
 
 typedef struct {
         Ontology *ontology;
@@ -191,6 +192,12 @@ print_ontology_class (gpointer key, gpointer value, gpointer user_data)
         g_fprintf (f,"<td>%s</td>\n", (def->description ? def->description : "--"));
         g_fprintf (f,"</tr>\n");
 
+        if (def->notify) {
+                g_fprintf (f,"<tr>");
+                g_fprintf (f,"<td colspan=\"2\">This class <a href=\"%s\">notifies changes</a></td>\n", SIGNALS_DOC);
+                g_fprintf (f,"</tr>\n");
+        }
+
         if (def->instances) {
                 g_fprintf (f,"<tr>");
                 g_fprintf (f,"<td class=\"rowheader\">Predefined instances</td>");
diff --git a/utils/services/ttl_loader.c b/utils/services/ttl_loader.c
index eef6478..58429bf 100644
--- a/utils/services/ttl_loader.c
+++ b/utils/services/ttl_loader.c
@@ -17,6 +17,8 @@
 #define NRL_MAX_CARDINALITY "http://www.semanticdesktop.org/ontologies/2007/08/15/nrl#maxCardinality";
 
 /* #define TRACKER_NAMESPACE "http://www.tracker-project.org/ontologies/tracker#Namespace"; */
+#define TRACKER_NS "http://www.tracker-project.org/ontologies/tracker#";
+#define TRACKER_NOTIFY TRACKER_NS "notify"
 
 /* Ontology description */
 #define DSC_PREFIX "http://www.tracker-project.org/temp/dsc#";
@@ -88,6 +90,24 @@ load_in_memory (Ontology    *ontology,
                         def->subclasses = g_list_prepend (def->subclasses, 
                                                           g_strdup (turtle_subject));
                 }
+        } else if (!g_strcmp0 (turtle_predicate, TRACKER_NOTIFY)) {
+                /*
+                 * A tracker:notify TRUE
+                 */
+                OntologyClass *def;
+
+                def = g_hash_table_lookup (ontology->classes, turtle_subject);
+                if (!def) {
+                        g_error ("Something wrong");
+                }
+
+                if (!g_strcmp0 (turtle_object, "true")) {
+                        def->notify = TRUE;
+                } else if (!g_strcmp0 (turtle_object, "false")) {
+                        def->notify = FALSE;
+                } else {
+                        g_error ("Unable to map '%s' into boolean", turtle_object);
+                }
         } else if (!g_strcmp0 (turtle_predicate, RDFS_COMMENT)) {
                 OntologyClass *klass;
                 OntologyProperty *prop;
diff --git a/utils/services/ttl_model.c b/utils/services/ttl_model.c
index 31b1666..ccf4c29 100644
--- a/utils/services/ttl_model.c
+++ b/utils/services/ttl_model.c
@@ -14,6 +14,7 @@ ttl_model_class_new (const gchar *classname)
         def->in_range_of = NULL;
         def->description = NULL;
         def->instances = NULL;
+        def->notify = FALSE;
         return def;
 }
 
diff --git a/utils/services/ttl_model.h b/utils/services/ttl_model.h
index c5c6424..733e4af 100644
--- a/utils/services/ttl_model.h
+++ b/utils/services/ttl_model.h
@@ -13,6 +13,7 @@ typedef struct {
         GList *in_range_of;
         gchar *description;
         GList *instances;
+        gboolean notify;
 } OntologyClass;
 
 typedef struct {



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