[tracker] TrackerExtractDecorator: Add ClearRdfTypes DBus method



commit 72ec134c1da3b6098f65288934ca6986a19edeb3
Author: Xavier Claessens <xavier claessens collabora co uk>
Date:   Fri Jan 31 15:52:06 2014 -0500

    TrackerExtractDecorator: Add ClearRdfTypes DBus method
    
    Also handle SetRdfTypes with empty strv the same as ClearRdfTypes.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=719802

 data/dbus/tracker-extract-priority.xml          |    1 +
 src/tracker-extract/tracker-extract-decorator.c |   29 +++++++++++++++++++++++
 2 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/data/dbus/tracker-extract-priority.xml b/data/dbus/tracker-extract-priority.xml
index 729c454..2220177 100644
--- a/data/dbus/tracker-extract-priority.xml
+++ b/data/dbus/tracker-extract-priority.xml
@@ -5,6 +5,7 @@
     <method name="SetRdfTypes">
       <arg type="as" name="rdf_types" direction="in" />
     </method>
+    <method name="ClearRdfTypes" />
     <property name="SupportedRdfTypes" type="as" access="read" />
   </interface>
 </node>
diff --git a/src/tracker-extract/tracker-extract-decorator.c b/src/tracker-extract/tracker-extract-decorator.c
index 163c9af..f711e1a 100644
--- a/src/tracker-extract/tracker-extract-decorator.c
+++ b/src/tracker-extract/tracker-extract-decorator.c
@@ -429,6 +429,11 @@ handle_set_rdf_types_cb (TrackerExtractDBusPriority *iface,
        sender = g_dbus_method_invocation_get_sender (invocation);
        conn = g_dbus_method_invocation_get_connection (invocation);
 
+       if (rdf_types[0] == NULL) {
+               g_hash_table_remove (priv->apps, sender);
+               goto out;
+       }
+
        /* Verify all types are supported */
        for (i = 0; rdf_types[i] != NULL; i++) {
                if (!strv_contains (supported_classes, rdf_types[i])) {
@@ -458,6 +463,8 @@ handle_set_rdf_types_cb (TrackerExtractDBusPriority *iface,
        }
 
        data->rdf_types = g_strdupv ((GStrv) rdf_types);
+
+out:
        priority_changed (decorator);
 
        tracker_extract_dbus_priority_complete_set_rdf_types (iface, invocation);
@@ -465,6 +472,25 @@ handle_set_rdf_types_cb (TrackerExtractDBusPriority *iface,
        return TRUE;
 }
 
+static gboolean
+handle_clear_rdf_types_cb (TrackerExtractDBusPriority *iface,
+                           GDBusMethodInvocation      *invocation,
+                           TrackerExtractDecorator    *decorator)
+{
+       TrackerExtractDecoratorPrivate *priv;
+       const gchar *sender;
+
+       priv = TRACKER_EXTRACT_DECORATOR (decorator)->priv;
+       sender = g_dbus_method_invocation_get_sender (invocation);
+
+       g_hash_table_remove (priv->apps, sender);
+       priority_changed (decorator);
+
+       tracker_extract_dbus_priority_complete_clear_rdf_types (iface, invocation);
+
+       return TRUE;
+}
+
 static void
 tracker_extract_decorator_class_init (TrackerExtractDecoratorClass *klass)
 {
@@ -523,6 +549,9 @@ tracker_extract_decorator_initable_init (GInitable     *initable,
        g_signal_connect (priv->iface, "handle-set-rdf-types",
                          G_CALLBACK (handle_set_rdf_types_cb),
                          decorator);
+       g_signal_connect (priv->iface, "handle-clear-rdf-types",
+                         G_CALLBACK (handle_clear_rdf_types_cb),
+                         decorator);
 
        tracker_extract_dbus_priority_set_supported_rdf_types (priv->iface,
                                                               supported_classes);


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