[tracker-miners/wip/carlosg/dbus-api-changes: 78/85] tracker-miner-fs: Separate Index.Files interface into its own process
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/wip/carlosg/dbus-api-changes: 78/85] tracker-miner-fs: Separate Index.Files interface into its own process
- Date: Sat, 11 Jul 2020 19:06:22 +0000 (UTC)
commit 040ce0ef3b8885150e4bf1fc6552eba40b6cd16e
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Jun 20 13:31:28 2020 +0200
tracker-miner-fs: Separate Index.Files interface into its own process
Sandboxed applications should not poke holes into the tracker-miner-fs
process (nor its endpoint, implicitly). Separating this into a standalone
process means this can be exposed, while keeping miner-fs workings 100%
isolated.
src/meson.build | 3 +
src/miners/fs/meson.build | 16 +-
src/miners/fs/tracker-main.c | 11 --
src/tracker-index/meson.build | 51 +++++
...eedesktop.Tracker3.Miner.Files.Index.service.in | 5 +
.../org.freedesktop.Tracker3.Miner.Files.Index.xml | 1 +
src/tracker-index/tracker-index.service.in | 11 ++
src/tracker-index/tracker-main.c | 182 ++++++++++++++++++
.../tracker-miner-files-index.c | 208 +++++----------------
.../tracker-miner-files-index.h | 4 +-
.../tracker-miner-files-peer-listener.c | 0
.../tracker-miner-files-peer-listener.h | 0
12 files changed, 298 insertions(+), 194 deletions(-)
---
diff --git a/src/meson.build b/src/meson.build
index 2d3d52e9c..49dd710ff 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -11,6 +11,9 @@ endif
# Public miners
subdir('miners')
+# Proxy
+subdir('tracker-index')
+
# Public metadata writeback tool & modiles
if get_option('writeback')
subdir('tracker-writeback')
diff --git a/src/miners/fs/meson.build b/src/miners/fs/meson.build
index 3ee6a794f..bf73467aa 100644
--- a/src/miners/fs/meson.build
+++ b/src/miners/fs/meson.build
@@ -3,8 +3,6 @@ sources = [
'tracker-extract-watchdog.c',
'tracker-main.c',
'tracker-miner-files.c',
- 'tracker-miner-files-index.c',
- 'tracker-miner-files-peer-listener.c',
'tracker-storage.c',
]
@@ -22,20 +20,8 @@ elif battery_detection_library_name == 'hal'
tracker_miner_fs_deps += hal
endif
-dbus_index_files_interface = files('org.freedesktop.Tracker3.Miner.Files.Index.xml')
-
-index_files_built_sources = gnome.gdbus_codegen('tracker-dbus-files-index',
- dbus_index_files_interface,
- interface_prefix: 'org.freedesktop.Tracker3',
- namespace: 'TrackerDBus',
-)
-
-install_data(dbus_index_files_interface,
- install_dir: join_paths(get_option('prefix'), get_option('datadir'), 'dbus-1', 'interfaces')
-)
-
executable('tracker-miner-fs-@0@'.format(tracker_api_major),
- sources + index_files_built_sources,
+ sources,
dependencies: tracker_miner_fs_deps,
c_args: tracker_c_args,
install: true,
diff --git a/src/miners/fs/tracker-main.c b/src/miners/fs/tracker-main.c
index a01c85b55..3b1a2aa9c 100644
--- a/src/miners/fs/tracker-main.c
+++ b/src/miners/fs/tracker-main.c
@@ -37,7 +37,6 @@
#include "tracker-config.h"
#include "tracker-miner-files.h"
-#include "tracker-miner-files-index.h"
#define ABOUT \
"Tracker " PACKAGE_VERSION "\n"
@@ -817,7 +816,6 @@ main (gint argc, gchar *argv[])
{
TrackerConfig *config;
TrackerMiner *miner_files;
- TrackerMinerFilesIndex *miner_files_index;
GOptionContext *context;
GError *error = NULL;
gboolean do_mtime_checking;
@@ -949,14 +947,6 @@ main (gint argc, gchar *argv[])
return EXIT_FAILURE;
}
- /* Create new TrackerMinerFilesIndex object */
- miner_files_index = tracker_miner_files_index_new (TRACKER_MINER_FILES (miner_files));
- if (!miner_files_index) {
- g_object_unref (miner_files);
- g_object_unref (config);
- return EXIT_FAILURE;
- }
-
/* Request DBus name */
dbus_name = tracker_domain_ontology_get_domain (domain_ontology, DBUS_NAME_SUFFIX);
@@ -1035,7 +1025,6 @@ main (gint argc, gchar *argv[])
g_main_loop_unref (main_loop);
g_object_unref (config);
- g_object_unref (miner_files_index);
g_object_unref (miner_files);
diff --git a/src/tracker-index/meson.build b/src/tracker-index/meson.build
new file mode 100644
index 000000000..50e3b37be
--- /dev/null
+++ b/src/tracker-index/meson.build
@@ -0,0 +1,51 @@
+sources = [
+ 'tracker-main.c',
+ 'tracker-miner-files-index.c',
+ 'tracker-miner-files-peer-listener.c',
+]
+
+tracker_index_deps = [
+ tracker_miner,
+ tracker_miners_common_dep,
+ tracker_extract_dep
+]
+
+dbus_index_files_interface = files('org.freedesktop.Tracker3.Miner.Files.Index.xml')
+
+index_files_built_sources = gnome.gdbus_codegen('tracker-dbus-files-index',
+ dbus_index_files_interface,
+ interface_prefix: 'org.freedesktop.Tracker3',
+ namespace: 'TrackerDBus',
+)
+
+install_data(dbus_index_files_interface,
+ install_dir: join_paths(get_option('prefix'), get_option('datadir'), 'dbus-1', 'interfaces')
+)
+
+executable('tracker-index-@0@'.format(tracker_api_major),
+ sources + index_files_built_sources,
+ dependencies: tracker_index_deps,
+ c_args: tracker_c_args,
+ install: true,
+ install_dir: get_option('libexecdir'),
+ install_rpath: tracker_install_rpath,
+)
+
+# This file allows starting the service with D-Bus autoactivation.
+dbus_service_file = configure_file(
+ input: 'org.freedesktop.Tracker3.Miner.Files.Index.service.in',
+ output: 'org.freedesktop.Tracker3.Miner.Files.Index.service',
+ configuration: conf,
+ install: true,
+ install_dir: dbus_services_dir,
+)
+
+if get_option('systemd_user_services')
+ # This file allows starting the service as a systemd user service.
+ configure_file(
+ input: 'tracker-index.service.in',
+ output: 'tracker-index-@0@.service'.format(tracker_api_major),
+ configuration: conf,
+ install: true,
+ install_dir: systemd_user_services_dir)
+endif
diff --git a/src/tracker-index/org.freedesktop.Tracker3.Miner.Files.Index.service.in
b/src/tracker-index/org.freedesktop.Tracker3.Miner.Files.Index.service.in
new file mode 100644
index 000000000..6ce5107c8
--- /dev/null
+++ b/src/tracker-index/org.freedesktop.Tracker3.Miner.Files.Index.service.in
@@ -0,0 +1,5 @@
+[D-BUS Service]
+Name=org.freedesktop.Tracker3.Miner.Files.Index
+Exec=@libexecdir@/tracker-index-3
+SystemdService=tracker-index-3.service
+
diff --git a/src/miners/fs/org.freedesktop.Tracker3.Miner.Files.Index.xml
b/src/tracker-index/org.freedesktop.Tracker3.Miner.Files.Index.xml
similarity index 83%
rename from src/miners/fs/org.freedesktop.Tracker3.Miner.Files.Index.xml
rename to src/tracker-index/org.freedesktop.Tracker3.Miner.Files.Index.xml
index c0e5ecd37..c2fdb86d8 100644
--- a/src/miners/fs/org.freedesktop.Tracker3.Miner.Files.Index.xml
+++ b/src/tracker-index/org.freedesktop.Tracker3.Miner.Files.Index.xml
@@ -5,5 +5,6 @@
<arg type='as' name='graphs' direction='in' />
</method>
<property name='Graphs' type='as' access='read' />
+ <property name='IndexedFiles' type='as' access='read' />
</interface>
</node>
diff --git a/src/tracker-index/tracker-index.service.in b/src/tracker-index/tracker-index.service.in
new file mode 100644
index 000000000..45f2c9301
--- /dev/null
+++ b/src/tracker-index/tracker-index.service.in
@@ -0,0 +1,11 @@
+[Unit]
+Description=Tracker Filesystem Indexing Proxy
+ConditionUser=!root
+
+[Service]
+Type=dbus
+BusName=org.freedesktop.Tracker3.Miner.Files.Index
+ExecStart=@libexecdir@/tracker-index-3
+Restart=on-failure
+# Don't restart after tracker daemon -k (aka tracker-control -k)
+RestartPreventExitStatus=SIGKILL
diff --git a/src/tracker-index/tracker-main.c b/src/tracker-index/tracker-main.c
new file mode 100644
index 000000000..0004ef447
--- /dev/null
+++ b/src/tracker-index/tracker-main.c
@@ -0,0 +1,182 @@
+/*
+ * Copyright (C) 2020, Red Hat Inc
+
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config-miners.h"
+
+#include <string.h>
+#include <stdlib.h>
+#include <locale.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <gio/gio.h>
+#include <glib-unix.h>
+#include <glib-object.h>
+#include <glib/gi18n.h>
+
+#include <libtracker-miners-common/tracker-common.h>
+
+#include "tracker-miner-files-index.h"
+
+#define ABOUT \
+ "Tracker " PACKAGE_VERSION "\n"
+
+#define LICENSE \
+ "This program is free software and comes without any warranty.\n" \
+ "It is licensed under version 2 or later of the General Public " \
+ "License which can be viewed at:\n" \
+ "\n" \
+ " http://www.gnu.org/licenses/gpl.txt\n"
+
+#define SECONDS_PER_DAY 60 * 60 * 24
+
+#define DBUS_NAME_SUFFIX "Tracker3.Miner.Files"
+#define DBUS_PATH "/org/freedesktop/Tracker3/Miner/Files"
+#define LOCALE_FILENAME "locale-for-miner-apps.txt"
+
+static GMainLoop *main_loop;
+
+static gboolean version;
+
+static GOptionEntry entries[] = {
+ { "version", 'V', 0,
+ G_OPTION_ARG_NONE, &version,
+ N_("Displays version information"),
+ NULL },
+ { NULL }
+};
+
+static gboolean
+signal_handler (gpointer user_data)
+{
+ int signo = GPOINTER_TO_INT (user_data);
+
+ static gboolean in_loop = FALSE;
+
+ /* Die if we get re-entrant signals handler calls */
+ if (in_loop) {
+ _exit (EXIT_FAILURE);
+ }
+
+ switch (signo) {
+ case SIGTERM:
+ case SIGINT:
+ in_loop = TRUE;
+ g_main_loop_quit (main_loop);
+
+ /* Fall through */
+ default:
+ if (g_strsignal (signo)) {
+ g_message ("Received signal:%d->'%s'",
+ signo,
+ g_strsignal (signo));
+ }
+ break;
+ }
+
+ return G_SOURCE_CONTINUE;
+}
+
+static void
+initialize_signal_handler (void)
+{
+#ifndef G_OS_WIN32
+ g_unix_signal_add (SIGTERM, signal_handler, GINT_TO_POINTER (SIGTERM));
+ g_unix_signal_add (SIGINT, signal_handler, GINT_TO_POINTER (SIGINT));
+#endif /* G_OS_WIN32 */
+}
+
+int
+main (gint argc, gchar *argv[])
+{
+ GOptionContext *context;
+ GError *error = NULL;
+ GDBusConnection *connection;
+ TrackerMinerFilesIndex *index;
+
+ main_loop = NULL;
+
+ setlocale (LC_ALL, "");
+
+ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ textdomain (GETTEXT_PACKAGE);
+
+ /* Set timezone info */
+ tzset ();
+
+ /* Translators: this messagge will apper immediately after the
+ * usage string - Usage: COMMAND <THIS_MESSAGE>
+ */
+ context = g_option_context_new (_("— start the tracker index proxy"));
+
+ g_option_context_add_main_entries (context, entries, NULL);
+ g_option_context_parse (context, &argc, &argv, &error);
+ g_option_context_free (context);
+
+ if (error) {
+ g_printerr ("%s\n", error->message);
+ g_error_free (error);
+ return EXIT_FAILURE;
+ }
+
+ if (version) {
+ g_print ("\n" ABOUT "\n" LICENSE "\n");
+ return EXIT_SUCCESS;
+ }
+
+ connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
+ if (error) {
+ g_critical ("Could not create DBus connection: %s\n",
+ error->message);
+ g_error_free (error);
+ return EXIT_FAILURE;
+ }
+
+ main_loop = g_main_loop_new (NULL, FALSE);
+
+ index = tracker_miner_files_index_new ();
+
+ /* Request DBus name */
+ if (!tracker_dbus_request_name (connection,
+ "org.freedesktop.Tracker3.Miner.Files.Index",
+ &error)) {
+ g_critical ("Could not request DBus name: %s",
+ error->message);
+ g_error_free (error);
+ return EXIT_FAILURE;
+ }
+
+ initialize_signal_handler ();
+
+ /* Go, go, go! */
+ g_main_loop_run (main_loop);
+
+ g_debug ("Shutdown started");
+
+ g_main_loop_unref (main_loop);
+
+ g_object_unref (connection);
+ g_object_unref (index);
+
+ g_print ("\nOK\n\n");
+
+ return EXIT_SUCCESS;
+}
diff --git a/src/miners/fs/tracker-miner-files-index.c b/src/tracker-index/tracker-miner-files-index.c
similarity index 54%
rename from src/miners/fs/tracker-miner-files-index.c
rename to src/tracker-index/tracker-miner-files-index.c
index d7ea86f24..44902fa12 100644
--- a/src/miners/fs/tracker-miner-files-index.c
+++ b/src/tracker-index/tracker-miner-files-index.c
@@ -35,10 +35,10 @@
#undef REQUIRE_LOCATION_IN_CONFIG
typedef struct {
- TrackerMinerFiles *files_miner;
TrackerMinerFilesPeerListener *peer_listener;
TrackerDBusMinerFilesIndex *skeleton;
GDBusConnection *d_connection;
+ GArray *indexed_files;
GStrv graphs;
gchar *full_name;
gchar *full_path;
@@ -51,14 +51,6 @@ enum {
#define TRACKER_MINER_FILES_INDEX_GET_PRIVATE(o) (tracker_miner_files_index_get_instance_private
(TRACKER_MINER_FILES_INDEX (o)))
-static void index_set_property (GObject *object,
- guint param_id,
- const GValue *value,
- GParamSpec *pspec);
-static void index_get_property (GObject *object,
- guint param_id,
- GValue *value,
- GParamSpec *pspec);
static void index_finalize (GObject *object);
G_DEFINE_TYPE_WITH_PRIVATE(TrackerMinerFilesIndex, tracker_miner_files_index, G_TYPE_OBJECT)
@@ -102,57 +94,6 @@ tracker_miner_files_index_class_init (TrackerMinerFilesIndexClass *klass)
object_class = G_OBJECT_CLASS (klass);
object_class->finalize = index_finalize;
- object_class->set_property = index_set_property;
- object_class->get_property = index_get_property;
-
- g_object_class_install_property (object_class,
- PROP_FILES_MINER,
- g_param_spec_object ("files-miner",
- "files-miner",
- "The FS Miner",
- TRACKER_TYPE_MINER_FILES,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
-}
-
-static void
-index_set_property (GObject *object,
- guint param_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- TrackerMinerFilesIndexPrivate *priv;
-
- priv = TRACKER_MINER_FILES_INDEX_GET_PRIVATE (object);
-
- switch (param_id) {
- case PROP_FILES_MINER:
- priv->files_miner = g_value_dup_object (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
- break;
- }
-}
-
-
-static void
-index_get_property (GObject *object,
- guint param_id,
- GValue *value,
- GParamSpec *pspec)
-{
- TrackerMinerFilesIndexPrivate *priv;
-
- priv = TRACKER_MINER_FILES_INDEX_GET_PRIVATE (object);
-
- switch (param_id) {
- case PROP_FILES_MINER:
- g_value_set_object (value, priv->files_miner);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
- break;
- }
}
static void
@@ -167,11 +108,20 @@ index_finalize (GObject *object)
}
g_clear_object (&priv->peer_listener);
+ g_array_unref (priv->indexed_files);
g_free (priv->full_name);
g_free (priv->full_path);
g_strfreev (priv->graphs);
+}
+
+static void
+update_indexed_files (TrackerMinerFilesIndex *index)
+{
+ TrackerMinerFilesIndexPrivate *priv;
+
+ priv = TRACKER_MINER_FILES_INDEX_GET_PRIVATE (index);
- g_object_unref (priv->files_miner);
+ tracker_dbus_miner_files_index_set_indexed_files (priv->skeleton, (const gchar * const *)
priv->indexed_files->data);
}
static void
@@ -184,10 +134,6 @@ tracker_miner_files_index_handle_index_file (TrackerDBusMinerFilesIndex *skeleto
TrackerMinerFilesIndexPrivate *priv;
TrackerDBusRequest *request;
GFile *file;
- GFileInfo *file_info;
- gboolean is_dir;
- gboolean do_checks = FALSE;
- GError *internal_error;
priv = TRACKER_MINER_FILES_INDEX_GET_PRIVATE (index);
@@ -197,88 +143,15 @@ tracker_miner_files_index_handle_index_file (TrackerDBusMinerFilesIndex *skeleto
file = g_file_new_for_uri (file_uri);
- file_info = g_file_query_info (file,
- G_FILE_ATTRIBUTE_STANDARD_TYPE,
- G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
- NULL, NULL);
-
- if (!file_info) {
- internal_error = g_error_new_literal (TRACKER_MINER_INDEX_ERROR,
- TRACKER_MINER_INDEX_ERROR_FILE_NOT_FOUND,
- "File does not exist");
- tracker_dbus_request_end (request, internal_error);
- g_dbus_method_invocation_return_gerror (invocation, internal_error);
-
- g_error_free (internal_error);
-
- g_object_unref (file);
-
- return;
+ if (!tracker_miner_files_peer_listener_is_file_watched (priv->peer_listener, file)) {
+ gchar *uri = g_strdup (file_uri);
+ g_array_append_val (priv->indexed_files, uri);
+ update_indexed_files (index);
}
- is_dir = (g_file_info_get_file_type (file_info) == G_FILE_TYPE_DIRECTORY);
- g_object_unref (file_info);
-
-#ifdef REQUIRE_LOCATION_IN_CONFIG
- do_checks = TRUE;
- if (!tracker_miner_files_is_file_eligible (priv->files_miner, file)) {
- internal_error = g_error_new_literal (TRACKER_MINER_INDEX_ERROR,
- TRACKER_MINER_INDEX_ERROR_NOT_ELIGIBLE,
- "File is not eligible to be indexed");
- tracker_dbus_request_end (request, internal_error);
- g_dbus_method_invocation_return_gerror (invocation, internal_error);
-
- g_error_free (internal_error);
-
- g_object_unref (file);
-
- return;
- }
-#endif /* REQUIRE_LOCATION_IN_CONFIG */
-
- if (is_dir) {
- TrackerIndexingTree *indexing_tree;
- TrackerDirectoryFlags flags;
- gboolean is_watched, needs_watch = FALSE;
- GFile *root;
-
- indexing_tree = tracker_miner_fs_get_indexing_tree (TRACKER_MINER_FS (priv->files_miner));
- root = tracker_indexing_tree_get_root (indexing_tree, file, &flags);
-
- /* If the directory had already subscribers, we want to add all
- * further watches, so the directory survives as long as there's
- * watchers.
- */
- is_watched = tracker_miner_files_peer_listener_is_file_watched (priv->peer_listener, file);
-
- /* Check whether the requested dir is not over a (recursively)
- * watched directory already, in that case we don't add the
- * directory (nor add a watch if we're positive it comes from
- * config).
- */
- if (!root ||
- (!(flags & TRACKER_DIRECTORY_FLAG_RECURSE) &&
- !g_file_equal (root, file) &&
- !g_file_has_parent (file, root))) {
- tracker_indexing_tree_add (indexing_tree, file,
- TRACKER_DIRECTORY_FLAG_RECURSE |
- TRACKER_DIRECTORY_FLAG_PRIORITY |
- TRACKER_DIRECTORY_FLAG_CHECK_MTIME |
- TRACKER_DIRECTORY_FLAG_MONITOR);
- needs_watch = TRUE;
- } else {
- tracker_indexing_tree_notify_update (indexing_tree, file, TRUE);
- }
-
- if (is_watched || needs_watch) {
- tracker_miner_files_peer_listener_add_watch (priv->peer_listener,
- g_dbus_method_invocation_get_sender
(invocation),
- file, graphs);
- }
- } else {
- tracker_miner_fs_check_file (TRACKER_MINER_FS (priv->files_miner),
- file, G_PRIORITY_HIGH, do_checks);
- }
+ tracker_miner_files_peer_listener_add_watch (priv->peer_listener,
+ g_dbus_method_invocation_get_sender (invocation),
+ file, graphs);
tracker_dbus_request_end (request, NULL);
g_dbus_method_invocation_return_value (invocation, NULL);
@@ -291,12 +164,25 @@ peer_listener_unwatch_file (TrackerMinerFilesPeerListener *listener,
GFile *file,
gpointer user_data)
{
- TrackerMinerFilesIndexPrivate *priv;
- TrackerIndexingTree *indexing_tree;
+ TrackerMinerFilesIndex *index = user_data;
+ TrackerMinerFilesIndexPrivate *priv = TRACKER_MINER_FILES_INDEX_GET_PRIVATE (index);
+ gchar *uri;
+ gint i;
- priv = TRACKER_MINER_FILES_INDEX_GET_PRIVATE (user_data);
- indexing_tree = tracker_miner_fs_get_indexing_tree (TRACKER_MINER_FS (priv->files_miner));
- tracker_indexing_tree_remove (indexing_tree, file);
+ uri = g_file_get_uri (file);
+
+ for (i = 0; i < priv->indexed_files->len; i++) {
+ const gchar *indexed_uri;
+
+ indexed_uri = g_array_index (priv->indexed_files, gchar*, i);
+
+ if (g_strcmp0 (uri, indexed_uri) == 0) {
+ g_array_remove_index (priv->indexed_files, i);
+ break;
+ }
+ }
+
+ update_indexed_files (index);
}
static void
@@ -314,14 +200,10 @@ peer_listener_graphs_changed (TrackerMinerFilesPeerListener *listener,
}
static void
-indexing_tree_directory_remove (TrackerIndexingTree *indexing_tree,
- GFile *file,
- gpointer user_data)
+string_clear (gpointer data)
{
- TrackerMinerFilesIndexPrivate *priv;
-
- priv = TRACKER_MINER_FILES_INDEX_GET_PRIVATE (user_data);
- tracker_miner_files_peer_listener_remove_file (priv->peer_listener, file);
+ gchar **ptr = data;
+ g_free (*ptr);
}
static void
@@ -335,24 +217,24 @@ tracker_miner_files_index_init (TrackerMinerFilesIndex *object)
g_signal_connect (priv->skeleton, "handle-index-file",
G_CALLBACK (tracker_miner_files_index_handle_index_file),
object);
+ priv->indexed_files = g_array_new (TRUE, TRUE, sizeof (gchar *));
+ g_array_set_clear_func (priv->indexed_files, string_clear);
}
TrackerMinerFilesIndex *
-tracker_miner_files_index_new (TrackerMinerFiles *miner_files)
+tracker_miner_files_index_new (void)
{
GObject *miner;
TrackerMinerFilesIndexPrivate *priv;
gchar *full_path, *full_name;
GError *error = NULL;
- TrackerIndexingTree *indexing_tree;
miner = g_object_new (TRACKER_TYPE_MINER_FILES_INDEX,
- "files-miner", miner_files,
NULL);
priv = TRACKER_MINER_FILES_INDEX_GET_PRIVATE (miner);
- priv->d_connection = g_bus_get_sync (TRACKER_IPC_BUS, NULL, &error);
+ priv->d_connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
if (!priv->d_connection) {
g_critical ("Could not connect to the D-Bus session bus, %s",
@@ -392,9 +274,5 @@ tracker_miner_files_index_new (TrackerMinerFiles *miner_files)
g_signal_connect (priv->peer_listener, "graphs-changed",
G_CALLBACK (peer_listener_graphs_changed), miner);
- indexing_tree = tracker_miner_fs_get_indexing_tree (TRACKER_MINER_FS (miner_files));
- g_signal_connect (indexing_tree, "directory-removed",
- G_CALLBACK (indexing_tree_directory_remove), miner);
-
return (TrackerMinerFilesIndex *) miner;
}
diff --git a/src/miners/fs/tracker-miner-files-index.h b/src/tracker-index/tracker-miner-files-index.h
similarity index 94%
rename from src/miners/fs/tracker-miner-files-index.h
rename to src/tracker-index/tracker-miner-files-index.h
index 447d9e293..7d402d93a 100644
--- a/src/miners/fs/tracker-miner-files-index.h
+++ b/src/tracker-index/tracker-miner-files-index.h
@@ -22,8 +22,6 @@
#include <glib-object.h>
-#include "tracker-miner-files.h"
-
G_BEGIN_DECLS
#define TRACKER_TYPE_MINER_FILES_INDEX (tracker_miner_files_index_get_type ())
@@ -45,7 +43,7 @@ struct TrackerMinerFilesIndexClass {
};
GType tracker_miner_files_index_get_type (void);
-TrackerMinerFilesIndex *tracker_miner_files_index_new (TrackerMinerFiles *miner_files);
+TrackerMinerFilesIndex *tracker_miner_files_index_new (void);
G_END_DECLS
diff --git a/src/miners/fs/tracker-miner-files-peer-listener.c
b/src/tracker-index/tracker-miner-files-peer-listener.c
similarity index 100%
rename from src/miners/fs/tracker-miner-files-peer-listener.c
rename to src/tracker-index/tracker-miner-files-peer-listener.c
diff --git a/src/miners/fs/tracker-miner-files-peer-listener.h
b/src/tracker-index/tracker-miner-files-peer-listener.h
similarity index 100%
rename from src/miners/fs/tracker-miner-files-peer-listener.h
rename to src/tracker-index/tracker-miner-files-peer-listener.h
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]