[tracker/miner-fs-dbus-api: 12/13] TrackerMinerManager: Add method to reindex certain mimetypes.



commit f9c11cc19b60c9d2655f97e746ed7cb2cc4e8ae2
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Aug 23 15:21:15 2010 +0200

    TrackerMinerManager: Add method to reindex certain mimetypes.

 src/libtracker-miner/tracker-miner-manager.c |   42 ++++++++++++++++++++++++++
 src/libtracker-miner/tracker-miner-manager.h |    3 ++
 2 files changed, 45 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-manager.c b/src/libtracker-miner/tracker-miner-manager.c
index 596f2ca..f91aa4e 100644
--- a/src/libtracker-miner/tracker-miner-manager.c
+++ b/src/libtracker-miner/tracker-miner-manager.c
@@ -995,6 +995,48 @@ tracker_miner_manager_error_quark (void)
 }
 
 gboolean
+tracker_miner_manager_reindex_by_mimetype (TrackerMinerManager  *manager,
+                                           const GStrv           mimetypes,
+                                           GError              **error)
+{
+	static DBusGProxy *proxy = NULL;
+	TrackerMinerManagerPrivate *priv;
+	GError *internal_error = NULL;
+
+	g_return_val_if_fail (TRACKER_IS_MINER_MANAGER (manager), FALSE);
+	g_return_val_if_fail (mimetypes != NULL, FALSE);
+
+	if (!tracker_miner_manager_is_active (manager,
+	                                      "org.freedesktop.Tracker1.Miner.Files")) {
+		g_set_error_literal (error,
+		                     TRACKER_MINER_MANAGER_ERROR,
+		                     TRACKER_MINER_MANAGER_ERROR_NOT_AVAILABLE,
+		                     "Filesystem miner is not active");
+		return FALSE;
+	}
+
+	priv = TRACKER_MINER_MANAGER_GET_PRIVATE (manager);
+
+	if (G_UNLIKELY (!proxy)) {
+		proxy = dbus_g_proxy_new_for_name (priv->connection,
+		                                   "org.freedesktop.Tracker1.Miner.Files.Index",
+		                                   "/org/freedesktop/Tracker1/Miner/Files/Index",
+		                                   "org.freedesktop.Tracker1.Miner.Files.Index");
+	}
+
+	org_freedesktop_Tracker1_Miner_Files_Index_reindex_mime_types (proxy,
+	                                                               (const gchar **) mimetypes,
+	                                                               &internal_error);
+
+	if (internal_error) {
+		g_propagate_error (error, internal_error);
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+gboolean
 tracker_miner_manager_index_file (TrackerMinerManager  *manager,
                                   GFile                *file,
                                   GError              **error)
diff --git a/src/libtracker-miner/tracker-miner-manager.h b/src/libtracker-miner/tracker-miner-manager.h
index 82b8d5f..98f4655 100644
--- a/src/libtracker-miner/tracker-miner-manager.h
+++ b/src/libtracker-miner/tracker-miner-manager.h
@@ -108,6 +108,9 @@ const gchar *        tracker_miner_manager_get_display_name   (TrackerMinerManag
 const gchar *        tracker_miner_manager_get_description    (TrackerMinerManager  *manager,
                                                                const gchar          *miner);
 
+gboolean             tracker_miner_manager_reindex_by_mimetype (TrackerMinerManager  *manager,
+                                                                const GStrv           mimetypes,
+                                                                GError              **error);
 gboolean             tracker_miner_manager_index_file          (TrackerMinerManager  *manager,
                                                                 GFile                *file,
                                                                 GError              **error);



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