tracker r2234 - in branches/indexer-split: . src/tracker-indexer tests/tracker-indexer
- From: pvanhoof svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r2234 - in branches/indexer-split: . src/tracker-indexer tests/tracker-indexer
- Date: Tue, 16 Sep 2008 09:45:46 +0000 (UTC)
Author: pvanhoof
Date: Tue Sep 16 09:45:46 2008
New Revision: 2234
URL: http://svn.gnome.org/viewvc/tracker?rev=2234&view=rev
Log:
2008-09-16 Philip Van Hoof <pvanhoof gnome org>
* src/tracker-indexer/tracker-metadata-utils.c:
* src/tracker-indexer/tracker-dbus.[ch]:
* src/tracker-indexer/Makefile.am:
* tests/tracker-indexer/Makefile.am: Support for thumbnailing using
org.freedeskop.thumbnailer.Generic (DBus names might change as the
specification changes: http://live.gnome.org/ThumbnailerSpec)
Modified:
branches/indexer-split/ChangeLog
branches/indexer-split/src/tracker-indexer/Makefile.am
branches/indexer-split/src/tracker-indexer/tracker-dbus.c
branches/indexer-split/src/tracker-indexer/tracker-dbus.h
branches/indexer-split/src/tracker-indexer/tracker-metadata-utils.c
branches/indexer-split/tests/tracker-indexer/Makefile.am
Modified: branches/indexer-split/src/tracker-indexer/Makefile.am
==============================================================================
--- branches/indexer-split/src/tracker-indexer/Makefile.am (original)
+++ branches/indexer-split/src/tracker-indexer/Makefile.am Tue Sep 16 09:45:46 2008
@@ -10,8 +10,7 @@
-I$(top_srcdir)/src \
$(DBUS_CFLAGS) \
$(PANGO_CFLAGS) \
- $(GMODULE_CFLAGS) \
- $(HILDON_THUMBNAIL_CFLAGS)
+ $(GMODULE_CFLAGS)
libexec_PROGRAMS = tracker-indexer
@@ -43,7 +42,6 @@
$(PANGO_LIBS) \
$(GIO_LIBS) \
$(GLIB2_LIBS) \
- $(HILDON_THUMBNAIL_LIBS) \
-lz \
-lm
Modified: branches/indexer-split/src/tracker-indexer/tracker-dbus.c
==============================================================================
--- branches/indexer-split/src/tracker-indexer/tracker-dbus.c (original)
+++ branches/indexer-split/src/tracker-indexer/tracker-dbus.c Tue Sep 16 09:45:46 2008
@@ -21,16 +21,19 @@
#include <string.h>
-#include <dbus/dbus-glib-bindings.h>
-
#include <libtracker-common/tracker-log.h>
#include "tracker-dbus.h"
#include "tracker-indexer.h"
#include "tracker-indexer-glue.h"
+#define THUMBNAILER_SERVICE "org.freedesktop.thumbnailer"
+#define THUMBNAILER_PATH "/org/freedesktop/thumbnailer/Generic"
+#define THUMBNAILER_INTERFACE "org.freedesktop.thumbnailer.Generic"
+
static DBusGConnection *connection;
static DBusGProxy *proxy;
+static DBusGProxy *thumb_proxy;
static gboolean
dbus_register_service (DBusGProxy *proxy,
@@ -104,6 +107,12 @@
return TRUE;
}
+DBusGProxy*
+tracker_dbus_get_thumbnailer (void)
+{
+ return thumb_proxy;
+}
+
static gboolean
dbus_register_names (void)
{
@@ -141,6 +150,10 @@
return FALSE;
}
+ thumb_proxy = dbus_g_proxy_new_for_name (connection,
+ THUMBNAILER_SERVICE,
+ THUMBNAILER_PATH,
+ THUMBNAILER_INTERFACE);
return TRUE;
}
Modified: branches/indexer-split/src/tracker-indexer/tracker-dbus.h
==============================================================================
--- branches/indexer-split/src/tracker-indexer/tracker-dbus.h (original)
+++ branches/indexer-split/src/tracker-indexer/tracker-dbus.h Tue Sep 16 09:45:46 2008
@@ -23,12 +23,14 @@
#define __TRACKER_DBUS_H__
#include <glib.h>
+#include <dbus/dbus-glib-bindings.h>
G_BEGIN_DECLS
-gboolean tracker_dbus_init (void);
-void tracker_dbus_shutdown (void);
-gboolean tracker_dbus_register_object (GObject *object);
+gboolean tracker_dbus_init (void);
+void tracker_dbus_shutdown (void);
+gboolean tracker_dbus_register_object (GObject *object);
+DBusGProxy* tracker_dbus_get_thumbnailer (void);
G_END_DECLS
Modified: branches/indexer-split/src/tracker-indexer/tracker-metadata-utils.c
==============================================================================
--- branches/indexer-split/src/tracker-indexer/tracker-metadata-utils.c (original)
+++ branches/indexer-split/src/tracker-indexer/tracker-metadata-utils.c Tue Sep 16 09:45:46 2008
@@ -34,8 +34,8 @@
#define THUMBNAIL_RETRIEVAL_ENABLED
-#ifdef HAVE_HILDON_THUMBNAIL
-#include <hildon-thumbnail-factory.h>
+#ifndef TEST
+#include "tracker-dbus.h"
#endif
#include "tracker-metadata-utils.h"
@@ -756,56 +756,60 @@
return text;
}
+#ifndef TEST
static void
-tracker_metadata_utils_get_thumbnail (const gchar *path,
- const gchar *mime)
+have_thumbnail (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
{
-#ifdef THUMBNAIL_RETRIEVAL_ENABLED
-#ifdef HAVE_HILDON_THUMBNAIL
- hildon_thumbnail_factory_load (path, mime, 128, 128, NULL, NULL);
-#else
- ProcessContext *context;
+ GError *error = NULL;
+ guint OUT_handle;
- GString *thumbnail;
- gchar *argv[5];
+ dbus_g_proxy_end_call (proxy, call, &error,
+ G_TYPE_UINT, &OUT_handle,
+ G_TYPE_INVALID);
- argv[0] = g_strdup (LIBEXEC_PATH G_DIR_SEPARATOR_S "tracker-thumbnailer");
- argv[1] = g_filename_from_utf8 (path, -1, NULL, NULL, NULL);
- argv[2] = g_strdup (mime);
- argv[3] = g_strdup ("normal");
- argv[4] = NULL;
+}
+#endif
- context = create_process_context ((const gchar **) argv);
+static void
+tracker_metadata_utils_get_thumbnail (const gchar *path,
+ const gchar *mime)
+{
+#ifndef TEST
+ static gchar *batch[51];
+ static guint count = 0;
+ static gboolean not_available = FALSE;
- if (!context) {
+ if (not_available)
return;
+
+ if (count < 50) {
+ batch[count++] = g_strdup (path);
}
- thumbnail = g_string_new (NULL);
- context->data = thumbnail;
+ if (count == 50) {
+ guint i;
+ GError *error = NULL;
+ DBusGProxy *proxy = tracker_dbus_get_thumbnailer ();
- g_io_add_watch (context->stdout_channel,
- G_IO_IN | G_IO_PRI | G_IO_ERR | G_IO_HUP,
- tracker_text_read,
- context);
+ batch[51] = NULL;
- g_main_loop_run (context->data_incoming_loop);
+ dbus_g_proxy_begin_call (proxy, "Queue",
+ have_thumbnail,
+ NULL, NULL,
+ G_TYPE_STRV, batch,
+ G_TYPE_UINT, 0,
+ G_TYPE_INVALID);
- g_free (argv[0]);
- g_free (argv[1]);
- g_free (argv[2]);
- g_free (argv[3]);
- destroy_process_context (context);
-
- if (!thumbnail->str || !*thumbnail->str) {
- g_string_free (thumbnail, TRUE);
- return;
- }
+ if (error) {
+ not_available = TRUE;
+ g_error_free (error);
+ }
- g_debug ("Got thumbnail '%s' for '%s'", thumbnail->str, path);
+ for (i = 0; i < count; i++)
+ g_free (batch[i]);
- g_string_free (thumbnail, TRUE);
-#endif /* HAVE_HILDON_THUMBNAIL */
-#endif /* THUMBNIAL_RETRIEVAL_ENABLED */
+ count = 0;
+ }
+#endif
}
Modified: branches/indexer-split/tests/tracker-indexer/Makefile.am
==============================================================================
--- branches/indexer-split/tests/tracker-indexer/Makefile.am (original)
+++ branches/indexer-split/tests/tracker-indexer/Makefile.am Tue Sep 16 09:45:46 2008
@@ -5,7 +5,7 @@
TEST_PROGS += tracker-metadata-utils
INCLUDES = \
- -g \
+ -g -DTEST \
-DG_LOG_DOMAIN=\"Tracker\" \
-DLIBDIR=\""$(libdir)"\" \
-DLIBEXEC_PATH=\""$(libexecdir)"\" \
@@ -13,14 +13,13 @@
-I$(top_srcdir)/tests/common \
$(GMODULE_CFLAGS) \
$(GTHREAD_CFLAGS) \
- $(GLIB2_CFLAGS) \
- $(HILDON_THUMBNAIL_CFLAGS)
+ $(GLIB2_CFLAGS)
tracker_metadata_utils_SOURCES = \
tracker-metadata-utils-test.c \
tracker-metadata-utils.c \
- tracker-metadata.c
+ tracker-metadata.c
tracker_metadata_utils_LDADD = \
$(top_builddir)/src/libtracker-db/libtracker-db.la \
@@ -29,6 +28,5 @@
$(GMODULE_LIBS) \
$(GTHREAD_LIBS) \
$(GIO_LIBS) \
- $(GLIB2_LIBS) \
- $(HILDON_THUMBNAIL_LIBS)
+ $(GLIB2_LIBS)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]