searchengine: Prepare for apps linking to Tracker 2.x
Given it does seem likely Tracker is going to miss the goal to get all applications ported to Tracker 3, the scenario where there's applications linking to Tracker 2.x while GTK was built with Tracker 3 support becomes more likely. Avoid the upcoming GType clashes if that were the case, and resort to the good (I lie) old Tracker 2 search engine.
This commit is contained in:
parent
4efd805110
commit
e2d05f0625
@ -28,7 +28,8 @@
|
||||
|
||||
#if defined(HAVE_TRACKER3)
|
||||
#include "gtksearchenginetracker3.h"
|
||||
#elif !defined G_OS_WIN32 /* No tracker on windows */
|
||||
#endif
|
||||
#if !defined G_OS_WIN32 /* No tracker on windows */
|
||||
#include "gtksearchenginetracker.h"
|
||||
#define HAVE_TRACKER 1
|
||||
#endif
|
||||
@ -385,16 +386,21 @@ _gtk_search_engine_new (void)
|
||||
g_object_ref (engine->priv->native),
|
||||
g_object_unref);
|
||||
}
|
||||
#elif defined(HAVE_TRACKER)
|
||||
engine->priv->native = _gtk_search_engine_tracker_new ();
|
||||
if (engine->priv->native)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_TRACKER
|
||||
if (!engine->priv->native)
|
||||
{
|
||||
g_debug ("Using Tracker search engine");
|
||||
connect_engine_signals (engine->priv->native, engine);
|
||||
_gtk_search_engine_simple_set_indexed_cb (GTK_SEARCH_ENGINE_SIMPLE (engine->priv->simple),
|
||||
_gtk_search_engine_tracker_is_indexed,
|
||||
g_object_ref (engine->priv->native),
|
||||
g_object_unref);
|
||||
engine->priv->native = _gtk_search_engine_tracker_new ();
|
||||
if (engine->priv->native)
|
||||
{
|
||||
g_debug ("Using Tracker search engine");
|
||||
connect_engine_signals (engine->priv->native, engine);
|
||||
_gtk_search_engine_simple_set_indexed_cb (GTK_SEARCH_ENGINE_SIMPLE (engine->priv->simple),
|
||||
_gtk_search_engine_tracker_is_indexed,
|
||||
g_object_ref (engine->priv->native),
|
||||
g_object_unref);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -368,6 +368,22 @@ gtk_search_engine_tracker3_new (void)
|
||||
{
|
||||
GtkSearchEngineTracker3 *engine;
|
||||
GError *error = NULL;
|
||||
GModule *self;
|
||||
|
||||
self = g_module_open (NULL, G_MODULE_BIND_LAZY);
|
||||
|
||||
/* Avoid hell from breaking loose if the application links to Tracker 2.x */
|
||||
if (self)
|
||||
{
|
||||
gpointer symbol;
|
||||
gboolean found;
|
||||
|
||||
found = g_module_symbol (self, "tracker_sparql_builder_new", &symbol);
|
||||
g_module_close (self);
|
||||
|
||||
if (found)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
g_debug ("Creating GtkSearchEngineTracker3...");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user