[tracker/follow-symlinks: 2/7] libtracker-miner: Remove TrackerDataProvider's _{get|set}_dir_flags() API



commit dfcaff2beaff0aebf814af9f61fa470c4b949105
Author: Martyn Russell <martyn lanedo com>
Date:   Thu Sep 4 15:27:35 2014 +0100

    libtracker-miner: Remove TrackerDataProvider's _{get|set}_dir_flags() API
    
    It is no longer required

 src/libtracker-miner/tracker-crawler.c            |    9 ++--
 src/libtracker-miner/tracker-crawler.h            |    1 +
 src/libtracker-miner/tracker-data-provider.c      |   49 ---------------------
 src/libtracker-miner/tracker-data-provider.h      |   11 -----
 src/libtracker-miner/tracker-file-data-provider.c |   25 -----------
 src/libtracker-miner/tracker-file-notifier.c      |   19 ++++++--
 6 files changed, 19 insertions(+), 95 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-crawler.c b/src/libtracker-miner/tracker-crawler.c
index 1d84aca..94f7126 100644
--- a/src/libtracker-miner/tracker-crawler.c
+++ b/src/libtracker-miner/tracker-crawler.c
@@ -1029,12 +1029,12 @@ data_provider_begin (TrackerCrawler          *crawler,
 }
 
 gboolean
-tracker_crawler_start (TrackerCrawler *crawler,
-                       GFile          *file,
-                       gint            max_depth)
+tracker_crawler_start (TrackerCrawler        *crawler,
+                       GFile                 *file,
+                       TrackerDirectoryFlags  flags,
+                       gint                   max_depth)
 {
        TrackerCrawlerPrivate *priv;
-       TrackerDirectoryFlags flags;
        DirectoryRootInfo *info;
        gboolean enable_stat;
 
@@ -1043,7 +1043,6 @@ tracker_crawler_start (TrackerCrawler *crawler,
 
        priv = crawler->priv;
 
-       flags = tracker_data_provider_get_dir_flags (priv->data_provider);
        enable_stat = (flags & TRACKER_DIRECTORY_FLAG_NO_STAT) == 0;
 
        if (enable_stat && !g_file_query_exists (file, NULL)) {
diff --git a/src/libtracker-miner/tracker-crawler.h b/src/libtracker-miner/tracker-crawler.h
index 74123df..3f4a7b8 100644
--- a/src/libtracker-miner/tracker-crawler.h
+++ b/src/libtracker-miner/tracker-crawler.h
@@ -75,6 +75,7 @@ GType           tracker_crawler_get_type     (void);
 TrackerCrawler *tracker_crawler_new          (TrackerDataProvider *data_provider);
 gboolean        tracker_crawler_start        (TrackerCrawler *crawler,
                                               GFile          *file,
+                                              TrackerDirectoryFlags flags,
                                              gint            max_depth);
 void            tracker_crawler_stop         (TrackerCrawler *crawler);
 void            tracker_crawler_pause        (TrackerCrawler *crawler);
diff --git a/src/libtracker-miner/tracker-data-provider.c b/src/libtracker-miner/tracker-data-provider.c
index 5045548..f101f1b 100644
--- a/src/libtracker-miner/tracker-data-provider.c
+++ b/src/libtracker-miner/tracker-data-provider.c
@@ -58,55 +58,6 @@ tracker_data_provider_default_init (TrackerDataProviderInterface *iface)
 }
 
 /**
- * tracker_data_provider_get_dir_flags:
- * @data_provider: a #TrackerDataProvider
- *
- * Get the conditions used to provide data, for example, following symlinks.
- *
- * Returns: the #TrackerDirectoryFlags used with this @data_provider.
- *
- * Since: 1.2
- **/
-TrackerDirectoryFlags
-tracker_data_provider_get_dir_flags (TrackerDataProvider *data_provider)
-{
-       TrackerDataProviderIface *iface;
-
-       g_return_val_if_fail (TRACKER_IS_DATA_PROVIDER (data_provider), TRACKER_DIRECTORY_FLAG_NONE);
-
-       iface = TRACKER_DATA_PROVIDER_GET_IFACE (data_provider);
-
-       g_return_val_if_fail (iface->get_dir_flags != NULL, TRACKER_DIRECTORY_FLAG_NONE);
-
-       return (* iface->get_dir_flags) (data_provider);
-}
-
-/**
- * tracker_data_provider_set_dir_flags:
- * @data_provider: a #TrackerDataProvider
- * @flags: the #TrackerDirectoryFlags to use
- *
- * Sets the #TrackerDirectoryFlags used with this @data_provider. Each
- * time tracker_data_provider_begin() is called, these flags are used.
- *
- * Since: 1.2
- **/
-void
-tracker_data_provider_set_dir_flags (TrackerDataProvider   *data_provider,
-                                     TrackerDirectoryFlags  flags)
-{
-       TrackerDataProviderIface *iface;
-
-       g_return_if_fail (TRACKER_IS_DATA_PROVIDER (data_provider));
-
-       iface = TRACKER_DATA_PROVIDER_GET_IFACE (data_provider);
-
-       g_return_if_fail (iface->set_dir_flags != NULL);
-
-       (* iface->set_dir_flags) (data_provider, flags);
-}
-
-/**
  * tracker_data_provider_begin:
  * @data_provider: a #TrackerDataProvider
  * @url: a #GFile to enumerate
diff --git a/src/libtracker-miner/tracker-data-provider.h b/src/libtracker-miner/tracker-data-provider.h
index 18b9905..4b7a308 100644
--- a/src/libtracker-miner/tracker-data-provider.h
+++ b/src/libtracker-miner/tracker-data-provider.h
@@ -49,10 +49,6 @@ typedef struct _TrackerDataProviderIface TrackerDataProviderIface;
 /**
  * TrackerDataProviderIface:
  * @g_iface: Parent interface type.
- * @get_crawl_flags: Called when before data_provider starts to know how
- * to enumerate.
- * @set_crawl_flags: Called when setting the flags an data_provider
- * should use.
  * @begin: Called when the data_provider is synchronously
  * opening and starting the iteration of a given location.
  * @begin_async: Called when the data_provider is synchronously
@@ -74,9 +70,6 @@ struct _TrackerDataProviderIface {
        GTypeInterface g_iface;
 
        /* Virtual Table */
-       TrackerDirectoryFlags (* get_dir_flags)      (TrackerDataProvider    *data_provider);
-       void                  (* set_dir_flags)      (TrackerDataProvider    *data_provider,
-                                                     TrackerDirectoryFlags   flags);
 
        /* Start the data_provider for a given location, attributes and flags */
        TrackerEnumerator *   (* begin)              (TrackerDataProvider    *data_provider,
@@ -125,10 +118,6 @@ struct _TrackerDataProviderIface {
 };
 
 GType              tracker_data_provider_get_type        (void) G_GNUC_CONST;
-TrackerDirectoryFlags
-                   tracker_data_provider_get_dir_flags   (TrackerDataProvider   *data_provider);
-void               tracker_data_provider_set_dir_flags   (TrackerDataProvider   *data_provider,
-                                                          TrackerDirectoryFlags  flags);
 TrackerEnumerator *tracker_data_provider_begin           (TrackerDataProvider   *data_provider,
                                                           GFile                 *url,
                                                           const gchar           *attributes,
diff --git a/src/libtracker-miner/tracker-file-data-provider.c 
b/src/libtracker-miner/tracker-file-data-provider.c
index 0cebc0a..de73267 100644
--- a/src/libtracker-miner/tracker-file-data-provider.c
+++ b/src/libtracker-miner/tracker-file-data-provider.c
@@ -28,7 +28,6 @@ static void tracker_file_data_provider_file_iface_init (TrackerDataProviderIface
 
 struct _TrackerFileDataProvider {
        GObject parent_instance;
-       TrackerDirectoryFlags dir_flags;
 };
 
 typedef struct {
@@ -72,28 +71,6 @@ tracker_file_data_provider_class_init (TrackerFileDataProviderClass *klass)
 static void
 tracker_file_data_provider_init (TrackerFileDataProvider *fe)
 {
-       fe->dir_flags = TRACKER_DIRECTORY_FLAG_NONE;
-}
-
-static TrackerDirectoryFlags
-file_data_provider_get_dir_flags (TrackerDataProvider *data_provider)
-{
-       TrackerFileDataProvider *fe;
-
-       fe = TRACKER_FILE_DATA_PROVIDER (data_provider);
-
-       return fe->dir_flags;
-}
-
-static void
-file_data_provider_set_dir_flags (TrackerDataProvider   *data_provider,
-                                  TrackerDirectoryFlags  flags)
-{
-       TrackerFileDataProvider *fe;
-
-       fe = TRACKER_FILE_DATA_PROVIDER (data_provider);
-
-       fe->dir_flags = flags;
 }
 
 static BeginData *
@@ -299,8 +276,6 @@ file_data_provider_end_finish (TrackerDataProvider  *data_provider,
 static void
 tracker_file_data_provider_file_iface_init (TrackerDataProviderIface *iface)
 {
-       iface->get_dir_flags = file_data_provider_get_dir_flags;
-       iface->set_dir_flags = file_data_provider_set_dir_flags;
        iface->begin = file_data_provider_begin;
        iface->begin_async = file_data_provider_begin_async;
        iface->begin_finish = file_data_provider_begin_finish;
diff --git a/src/libtracker-miner/tracker-file-notifier.c b/src/libtracker-miner/tracker-file-notifier.c
index 42165c9..77b21f7 100644
--- a/src/libtracker-miner/tracker-file-notifier.c
+++ b/src/libtracker-miner/tracker-file-notifier.c
@@ -562,7 +562,7 @@ static gboolean
 crawl_directory_in_current_root (TrackerFileNotifier *notifier)
 {
        TrackerFileNotifierPrivate *priv = notifier->priv;
-       gboolean recurse, retval = FALSE;
+       gint depth;
        GFile *directory;
 
        if (!priv->current_index_root)
@@ -574,10 +574,19 @@ crawl_directory_in_current_root (TrackerFileNotifier *notifier)
                return FALSE;
 
        g_cancellable_reset (priv->cancellable);
-       recurse = (priv->current_index_root->flags & TRACKER_DIRECTORY_FLAG_RECURSE) != 0;
-       retval = tracker_crawler_start (priv->crawler, directory,
-                                       (recurse) ? MAX_DEPTH : 1);
-       return retval;
+
+       if ((priv->current_index_root->flags & TRACKER_DIRECTORY_FLAG_RECURSE) == 0) {
+               /* Don't recurse */
+               depth = 1;
+       } else {
+               /* Recurse */
+               depth = MAX_DEPTH;
+       }
+
+       return tracker_crawler_start (priv->crawler,
+                                     directory,
+                                     priv->current_index_root->flags,
+                                     depth);
 }
 
 static void


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