From 72c51a5a6a39ed8379a24531ad4a0dacafa3ff53 Mon Sep 17 00:00:00 2001 From: Martyn Russell Date: Fri, 9 Apr 2010 14:21:45 +0100 Subject: [PATCH] tracker-search-engine: Fixed whitespace issues and copyright/authors --- gtk/gtksearchenginetracker.c | 104 +++++++++++++++++++---------------- 1 file changed, 57 insertions(+), 47 deletions(-) diff --git a/gtk/gtksearchenginetracker.c b/gtk/gtksearchenginetracker.c index 18d821cc98..9b8e681f28 100644 --- a/gtk/gtksearchenginetracker.c +++ b/gtk/gtksearchenginetracker.c @@ -1,5 +1,6 @@ /* - * Copyright (C) 2005 Mr Jamie McCracken + * Copyright (C) 2005 Jamie McCracken + * Copyright (C) 2009-2010 Nokia * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -15,7 +16,9 @@ * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * - * Author: Jamie McCracken + * Authors: Jamie McCracken + * Jürg Billeter + * Martyn Russell * * Based on nautilus-search-engine-tracker.c */ @@ -39,22 +42,29 @@ typedef enum /* Tracker 0.6 API */ -typedef void (*TrackerArrayReply) (char **result, GError *error, gpointer user_data); +typedef void (*TrackerArrayReply) (char **result, + GError *error, + gpointer user_data); + +static TrackerClient * + (*tracker_connect) (gboolean enable_warnings, + gint timeout) = NULL; +static void (*tracker_disconnect) (TrackerClient *client) = NULL; +static int (*tracker_get_version) (TrackerClient *client, + GError **error) = NULL; +static void (*tracker_cancel_last_call) (TrackerClient *client) = NULL; + +static void (*tracker_search_metadata_by_text_async) (TrackerClient *client, + const char *query, + TrackerArrayReply callback, + gpointer user_data) = NULL; +static void (*tracker_search_metadata_by_text_and_location_async) (TrackerClient *client, + const char *query, + const char *location, + TrackerArrayReply callback, + gpointer user_data) = NULL; -static TrackerClient * (*tracker_connect) (gboolean enable_warnings, gint timeout) = NULL; -static void (*tracker_disconnect) (TrackerClient *client) = NULL; -static int (*tracker_get_version) (TrackerClient *client, GError **error) = NULL; -static void (*tracker_cancel_last_call) (TrackerClient *client) = NULL; -static void (*tracker_search_metadata_by_text_async) (TrackerClient *client, - const char *query, - TrackerArrayReply callback, - gpointer user_data) = NULL; -static void (*tracker_search_metadata_by_text_and_location_async) (TrackerClient *client, - const char *query, - const char *location, - TrackerArrayReply callback, - gpointer user_data) = NULL; /* Tracker 0.7->0.9 API */ typedef enum { TRACKER_CLIENT_ENABLE_WARNINGS = 1 << 0 @@ -64,13 +74,13 @@ typedef void (*TrackerReplyGPtrArray) (GPtrArray *result, GError *error, gpointer user_data); -static TrackerClient * (*tracker_client_new) (TrackerClientFlags flags, - gint timeout) = NULL; -static gchar * (*tracker_sparql_escape) (const gchar *str) = NULL; -static guint (*tracker_resources_sparql_query_async) (TrackerClient *client, - const gchar *query, - TrackerReplyGPtrArray callback, - gpointer user_data) = NULL; +static TrackerClient * (*tracker_client_new) (TrackerClientFlags flags, + gint timeout) = NULL; +static gchar * (*tracker_sparql_escape) (const gchar *str) = NULL; +static guint (*tracker_resources_sparql_query_async) (TrackerClient *client, + const gchar *query, + TrackerReplyGPtrArray callback, + gpointer user_data) = NULL; static struct TrackerDlMapping @@ -105,7 +115,7 @@ open_libtracker (void) gint i; GModule *tracker; GModuleFlags flags; - + done = TRUE; flags = G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL; @@ -135,7 +145,7 @@ open_libtracker (void) if ((tracker_dl_mapping[i].versions & version) == 0) continue; - if (!g_module_symbol (tracker, + if (!g_module_symbol (tracker, tracker_dl_mapping[i].fn_name, tracker_dl_mapping[i].fn_ptr_ref)) { @@ -154,11 +164,11 @@ open_libtracker (void) return version; } -struct _GtkSearchEngineTrackerPrivate +struct _GtkSearchEngineTrackerPrivate { - GtkQuery *query; + GtkQuery *query; TrackerClient *client; - gboolean query_pending; + gboolean query_pending; TrackerVersion version; }; @@ -169,10 +179,10 @@ static void finalize (GObject *object) { GtkSearchEngineTracker *tracker; - + tracker = GTK_SEARCH_ENGINE_TRACKER (object); - - if (tracker->priv->query) + + if (tracker->priv->query) { g_object_unref (tracker->priv->query); tracker->priv->query = NULL; @@ -207,7 +217,7 @@ sparql_append_string_literal (GString *sparql, static void search_callback (gpointer results, - GError *error, + GError *error, gpointer user_data) { GtkSearchEngineTracker *tracker; @@ -216,13 +226,13 @@ search_callback (gpointer results, GPtrArray *OUT_result; gchar *uri; gint i; - + tracker = GTK_SEARCH_ENGINE_TRACKER (user_data); hit_uris = NULL; - + tracker->priv->query_pending = FALSE; - if (error) + if (error) { _gtk_search_engine_error (GTK_SEARCH_ENGINE (tracker), error->message); g_error_free (error); @@ -284,7 +294,7 @@ gtk_search_engine_tracker_start (GtkSearchEngine *engine) if (tracker->priv->query == NULL) return; - + search_text = _gtk_query_get_text (tracker->priv->query); location_uri = _gtk_query_get_location (tracker->priv->query); @@ -319,7 +329,7 @@ gtk_search_engine_tracker_start (GtkSearchEngine *engine) tracker); g_string_free (sparql, TRUE); } - else + else { if (location) { @@ -347,10 +357,10 @@ static void gtk_search_engine_tracker_stop (GtkSearchEngine *engine) { GtkSearchEngineTracker *tracker; - + tracker = GTK_SEARCH_ENGINE_TRACKER (engine); - - if (tracker->priv->query && tracker->priv->query_pending) + + if (tracker->priv->query && tracker->priv->query_pending) { tracker_cancel_last_call (tracker->priv->client); tracker->priv->query_pending = FALSE; @@ -364,14 +374,14 @@ gtk_search_engine_tracker_is_indexed (GtkSearchEngine *engine) } static void -gtk_search_engine_tracker_set_query (GtkSearchEngine *engine, +gtk_search_engine_tracker_set_query (GtkSearchEngine *engine, GtkQuery *query) { GtkSearchEngineTracker *tracker; - + tracker = GTK_SEARCH_ENGINE_TRACKER (engine); - - if (query) + + if (query) g_object_ref (query); if (tracker->priv->query) @@ -385,10 +395,10 @@ _gtk_search_engine_tracker_class_init (GtkSearchEngineTrackerClass *class) { GObjectClass *gobject_class; GtkSearchEngineClass *engine_class; - + gobject_class = G_OBJECT_CLASS (class); gobject_class->finalize = finalize; - + engine_class = GTK_SEARCH_ENGINE_CLASS (class); engine_class->set_query = gtk_search_engine_tracker_set_query; engine_class->start = gtk_search_engine_tracker_start; @@ -452,6 +462,6 @@ _gtk_search_engine_tracker_new (void) engine->priv->client = tracker_client; engine->priv->query_pending = FALSE; engine->priv->version = version; - + return GTK_SEARCH_ENGINE (engine); }