[tracker: 10/30] tracker-extract: Turn into a full-blown miner



commit 814de784c9aa875163003ddf255d30b45ddf8233
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Jan 7 22:21:25 2014 +0100

    tracker-extract: Turn into a full-blown miner
    
    TrackerExtractDecorator is put in use, replacing TrackerController as
    the master of TrackerExtract. .service and .desktop files are added as
    appropriate so tracker-extract is recognized as a miner, handled by
    tracker-control, etc...

 data/dbus/Makefile.am                              |    4 +-
 ....freedesktop.Tracker1.Miner.Extract.service.in} |    2 +-
 data/miners/Makefile.am                            |    3 ++
 data/miners/tracker-miner-extract.desktop.in.in    |    6 +++
 src/tracker-extract/tracker-main.c                 |   39 ++++++++------------
 5 files changed, 27 insertions(+), 27 deletions(-)
---
diff --git a/data/dbus/Makefile.am b/data/dbus/Makefile.am
index 193f799..a1717eb 100644
--- a/data/dbus/Makefile.am
+++ b/data/dbus/Makefile.am
@@ -23,7 +23,7 @@ service_in_files = \
        org.freedesktop.Tracker1.Miner.Files.service.in \
        org.freedesktop.Tracker1.Miner.Userguides.service.in \
        org.freedesktop.Tracker1.Miner.RSS.service.in  \
-       org.freedesktop.Tracker1.Extract.service.in \
+       org.freedesktop.Tracker1.Miner.Extract.service.in \
        org.freedesktop.Tracker1.Writeback.service.in
 
 %.service: %.service.in
@@ -33,11 +33,11 @@ service_in_files = \
 servicedir = $(DBUS_SERVICES_DIR)
 service_DATA = \
        org.freedesktop.Tracker1.service \
-       org.freedesktop.Tracker1.Extract.service \
        org.freedesktop.Tracker1.Writeback.service
 
 if HAVE_TRACKER_MINER_FS
 service_DATA += \
+       org.freedesktop.Tracker1.Miner.Extract.service \
        org.freedesktop.Tracker1.Miner.Files.service \
        org.freedesktop.Tracker1.Miner.Applications.service
 
diff --git a/data/dbus/org.freedesktop.Tracker1.Extract.service.in 
b/data/dbus/org.freedesktop.Tracker1.Miner.Extract.service.in
similarity index 53%
rename from data/dbus/org.freedesktop.Tracker1.Extract.service.in
rename to data/dbus/org.freedesktop.Tracker1.Miner.Extract.service.in
index a9e906f..1df29c6 100644
--- a/data/dbus/org.freedesktop.Tracker1.Extract.service.in
+++ b/data/dbus/org.freedesktop.Tracker1.Miner.Extract.service.in
@@ -1,3 +1,3 @@
 [D-BUS Service]
-Name=org.freedesktop.Tracker1.Extract
+Name=org.freedesktop.Tracker1.Miner.Extract
 Exec= libexecdir@/tracker-extract
diff --git a/data/miners/Makefile.am b/data/miners/Makefile.am
index 272cef0..9dbef64 100644
--- a/data/miners/Makefile.am
+++ b/data/miners/Makefile.am
@@ -1,6 +1,7 @@
 include $(top_srcdir)/Makefile.decl
 
 desktop_in_in_files =                                  \
+       tracker-miner-extract.desktop.in.in            \
        tracker-miner-userguides.desktop.in.in         \
        tracker-miner-applications.desktop.in.in       \
        tracker-miner-evolution.desktop.in.in          \
@@ -8,6 +9,7 @@ desktop_in_in_files =                                  \
        tracker-miner-rss.desktop.in.in
 
 desktop_in_files =                                     \
+       tracker-miner-extract.desktop.in               \
        tracker-miner-userguides.desktop.in            \
        tracker-miner-applications.desktop.in          \
        tracker-miner-evolution.desktop.in             \
@@ -20,6 +22,7 @@ tracker_miners_DATA =
 
 if HAVE_TRACKER_MINER_FS
 tracker_miners_DATA +=                                 \
+       tracker-miner-extract.desktop                  \
        tracker-miner-applications.desktop             \
        tracker-miner-files.desktop
 
diff --git a/data/miners/tracker-miner-extract.desktop.in.in b/data/miners/tracker-miner-extract.desktop.in.in
new file mode 100644
index 0000000..1cf6302
--- /dev/null
+++ b/data/miners/tracker-miner-extract.desktop.in.in
@@ -0,0 +1,6 @@
+[Desktop Entry]
+_Name=Extractor
+_Comment=Metadata extractor
+Icon=folder
+DBusName=org.freedesktop.Tracker1.Miner.Extract
+DBusPath=/org/freedesktop/Tracker1/Miner/Extract
diff --git a/src/tracker-extract/tracker-main.c b/src/tracker-extract/tracker-main.c
index f38fac7..e065207 100644
--- a/src/tracker-extract/tracker-main.c
+++ b/src/tracker-extract/tracker-main.c
@@ -52,6 +52,7 @@
 #include "tracker-main.h"
 #include "tracker-extract.h"
 #include "tracker-controller.h"
+#include "tracker-extract-decorator.h"
 
 #ifdef THREAD_ENABLE_TRACE
 #warning Main thread traces enabled
@@ -318,11 +319,10 @@ main (int argc, char *argv[])
 {
        GOptionContext *context;
        GError *error = NULL;
-       TrackerExtract *object;
-       TrackerController *controller;
+       TrackerExtract *extract;
+       TrackerDecorator *decorator;
        gchar *log_filename = NULL;
        GMainLoop *my_main_loop;
-       guint shutdown_timeout;
 
        bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
        bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
@@ -397,9 +397,6 @@ main (int argc, char *argv[])
                g_free (log_filename);
        }
 
-       g_message ("Shutdown after 30 seconds of inactivity is %s",
-                  disable_shutdown ? "disabled" : "enabled");
-
        sanity_check_option_values (config);
 
        /* This makes sure we don't steal all the system's resources */
@@ -407,29 +404,21 @@ main (int argc, char *argv[])
                                            tracker_db_manager_get_first_index_done () == FALSE);
        tracker_memory_setrlimits ();
 
-       if (disable_shutdown) {
-               shutdown_timeout = 0;
-       } else {
-               shutdown_timeout = QUIT_TIMEOUT;
-       }
-
-       object = tracker_extract_new (disable_shutdown,
-                                     force_internal_extractors,
-                                     force_module);
+       extract = tracker_extract_new (TRUE,
+                                      force_internal_extractors,
+                                      force_module);
 
-       if (!object) {
+       if (!extract) {
                g_object_unref (config);
                tracker_log_shutdown ();
                return EXIT_FAILURE;
        }
 
-       controller = tracker_controller_new (object, shutdown_timeout, &error);
+       decorator = tracker_extract_decorator_new (extract, NULL, &error);
 
-       if (!controller) {
-               g_critical ("Controller thread failed to initialize: %s\n", error->message);
-               g_error_free (error);
+       if (error) {
+               g_critical ("Could not start decorator: %s\n", error->message);
                g_object_unref (config);
-               g_object_unref (object);
                tracker_log_shutdown ();
                return EXIT_FAILURE;
        }
@@ -442,6 +431,8 @@ main (int argc, char *argv[])
        tracker_locale_init ();
        tracker_media_art_init ();
 
+       tracker_miner_start (TRACKER_MINER (decorator));
+
        /* Main loop */
        main_loop = g_main_loop_new (NULL, FALSE);
        g_main_loop_run (main_loop);
@@ -450,14 +441,14 @@ main (int argc, char *argv[])
        main_loop = NULL;
        g_main_loop_unref (my_main_loop);
 
-       g_message ("Shutdown started");
+       tracker_miner_stop (TRACKER_MINER (decorator));
 
        /* Shutdown subsystems */
        tracker_media_art_shutdown ();
        tracker_locale_shutdown ();
 
-       g_object_unref (object);
-       g_object_unref (controller);
+       g_object_unref (extract);
+       g_object_unref (decorator);
 
        tracker_log_shutdown ();
 


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