[tracker/libtracker-miner] TrackerCrawler: Use GFile in the API.



commit 04d01b42f6b9e57df40555d9264ef135a70d3777
Author: Carlos Garnacho <carlos lanedo com>
Date:   Wed Aug 26 17:57:54 2009 +0200

    TrackerCrawler: Use GFile in the API.

 src/libtracker-miner/tracker-crawler.c  |   10 ++--------
 src/libtracker-miner/tracker-crawler.h  |    2 +-
 src/libtracker-miner/tracker-miner-fs.c |    6 +++---
 3 files changed, 6 insertions(+), 12 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-crawler.c b/src/libtracker-miner/tracker-crawler.c
index 82fefd8..b94a28b 100644
--- a/src/libtracker-miner/tracker-crawler.c
+++ b/src/libtracker-miner/tracker-crawler.c
@@ -602,14 +602,13 @@ file_enumerate_children (TrackerCrawler *crawler,
 
 gboolean
 tracker_crawler_start (TrackerCrawler *crawler,
-		       const gchar    *path, 
+		       GFile          *file,
 		       gboolean        recurse)
 {
 	TrackerCrawlerPrivate *priv;
-	GFile *file;
 
 	g_return_val_if_fail (TRACKER_IS_CRAWLER (crawler), FALSE);
-	g_return_val_if_fail (path != NULL, FALSE);
+	g_return_val_if_fail (G_IS_FILE (file), FALSE);
 
 	priv = crawler->private;
 
@@ -620,11 +619,7 @@ tracker_crawler_start (TrackerCrawler *crawler,
 		g_cancellable_reset (priv->cancellable);
 	}
 
-	file = g_file_new_for_path (path);
-
 	if (!g_file_query_exists (file, NULL)) {
-		g_object_unref (file);
-
 		/* We return TRUE because this is likely a config
 		 * option and we only return FALSE when we expect to
 		 * not fail.
@@ -654,7 +649,6 @@ tracker_crawler_start (TrackerCrawler *crawler,
 
 	/* Start things off */
 	add_directory (crawler, file, TRUE);
-	g_object_unref (file);
 
 	return TRUE;
 }
diff --git a/src/libtracker-miner/tracker-crawler.h b/src/libtracker-miner/tracker-crawler.h
index e6ec460..1e64382 100644
--- a/src/libtracker-miner/tracker-crawler.h
+++ b/src/libtracker-miner/tracker-crawler.h
@@ -59,7 +59,7 @@ struct TrackerCrawlerClass {
 GType           tracker_crawler_get_type (void);
 TrackerCrawler *tracker_crawler_new      (void);
 gboolean        tracker_crawler_start    (TrackerCrawler *crawler,
-					  const gchar    *path,
+					  GFile          *file,
 					  gboolean        recurse);
 void            tracker_crawler_stop     (TrackerCrawler *crawler);
 
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index 1d0593d..f6aee3a 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -1273,13 +1273,13 @@ crawl_directories_cb (gpointer user_data)
 
 	g_object_set (fs, "status", str, NULL);
 	g_free (str);
+	g_free (path);
 
-	if (tracker_crawler_start (fs->private->crawler, path,
+	if (tracker_crawler_start (fs->private->crawler,
+				   fs->private->current_directory->file,
 				   fs->private->current_directory->recurse)) {
 		/* Crawler when restart the idle function when done */
 		fs->private->crawl_directories_id = 0;
-		g_free (path);
-
 		return FALSE;
 	}
 



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