[tracker/miner-web: 24/26] libtracker-miner: Make TrackerMiner use standard gio callbacks and port TrackerMinerFS
- From: Adrien Bustany <abustany src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker/miner-web: 24/26] libtracker-miner: Make TrackerMiner use standard gio callbacks and port TrackerMinerFS
- Date: Wed, 11 Nov 2009 20:37:17 +0000 (UTC)
commit c05a3f9975b67bff7eb6d6fd9bea32dde18cb56e
Author: Adrien Bustany <madcat mymadcat com>
Date: Tue Nov 10 12:59:48 2009 -0300
libtracker-miner: Make TrackerMiner use standard gio callbacks and port TrackerMinerFS
TrackerMiner previously used custom callbacks for its async calls
tracker_miner_execute_sparql, tracker_miner_execute_update etc. This commit
changes the API to make them use the standard GLib callback pattern
my_callback (GObject *source, GAsyncResult *result, gpointer user_data) .
The API of TrackerMinerFS is not changed, but it's internaly ported to the
new functions.
src/libtracker-miner/tracker-miner-fs.c | 105 ++++++++------
src/libtracker-miner/tracker-miner.c | 251 ++++++++++++++++++++++++-------
src/libtracker-miner/tracker-miner.h | 66 +++++----
3 files changed, 291 insertions(+), 131 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index d59a6cb..9d7dabc 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -590,7 +590,7 @@ fs_get_property (GObject *object,
}
}
-static gboolean
+static gboolean
fs_defaults (TrackerMinerFS *fs,
GFile *file)
{
@@ -614,8 +614,8 @@ miner_started (TrackerMiner *miner)
fs->private->been_started = TRUE;
- g_object_set (miner,
- "progress", 0.0,
+ g_object_set (miner,
+ "progress", 0.0,
"status", _("Initializing"),
NULL);
@@ -625,8 +625,8 @@ miner_started (TrackerMiner *miner)
static void
miner_stopped (TrackerMiner *miner)
{
- g_object_set (miner,
- "progress", 1.0,
+ g_object_set (miner,
+ "progress", 1.0,
"status", _("Idle"),
NULL);
}
@@ -719,17 +719,22 @@ process_print_stats (TrackerMinerFS *fs)
}
static void
-commit_cb (TrackerMiner *miner,
- const GError *error,
- gpointer user_data)
+commit_cb (GObject *object,
+ GAsyncResult *result,
+ gpointer user_data)
{
+ TrackerMiner *miner = TRACKER_MINER (object);
+ GError *error = NULL;
+
+ tracker_miner_commit_finish (miner, result, &error);
+
if (error) {
g_critical ("Could not commit: %s", error->message);
}
}
static void
-process_stop (TrackerMinerFS *fs)
+process_stop (TrackerMinerFS *fs)
{
/* Now we have finished crawling, print stats and enable monitor events */
process_print_stats (fs);
@@ -738,8 +743,8 @@ process_stop (TrackerMinerFS *fs)
g_message ("Idle");
- g_object_set (fs,
- "progress", 1.0,
+ g_object_set (fs,
+ "progress", 1.0,
"status", _("Idle"),
NULL);
@@ -785,15 +790,19 @@ item_moved_data_free (ItemMovedData *data)
}
static void
-sparql_update_cb (TrackerMiner *miner,
- const GError *error,
- gpointer user_data)
+sparql_update_cb (GObject *object,
+ GAsyncResult *result,
+ gpointer user_data)
{
TrackerMinerFS *fs;
TrackerMinerFSPrivate *priv;
ProcessData *data;
- fs = TRACKER_MINER_FS (miner);
+ GError *error = NULL;
+
+ tracker_miner_execute_update_finish (TRACKER_MINER (object), result, &error);
+
+ fs = TRACKER_MINER_FS (object);
priv = fs->private;
data = user_data;
@@ -815,14 +824,18 @@ sparql_update_cb (TrackerMiner *miner,
}
static void
-sparql_query_cb (TrackerMiner *miner,
- GPtrArray *result,
- const GError *error,
- gpointer user_data)
+sparql_query_cb (GObject *object,
+ GAsyncResult *result,
+ gpointer user_data)
{
SparqlQueryData *data = user_data;
+ TrackerMiner *miner = TRACKER_MINER (object);
+
+ GError *error = NULL;
+
+ GPtrArray *query_results = tracker_miner_execute_sparql_finish (miner, result, &error);
- data->value = result && result->len == 1;
+ data->value = query_results && query_results->len == 1;
g_main_loop_quit (data->main_loop);
}
@@ -1008,24 +1021,26 @@ item_remove (TrackerMinerFS *fs,
}
static void
-item_update_uri_recursively_cb (TrackerMiner *miner,
- GPtrArray *result,
- const GError *error,
- gpointer user_data)
+item_update_uri_recursively_cb (GObject *object,
+ GAsyncResult *result,
+ gpointer user_data)
{
- TrackerMinerFS *fs = TRACKER_MINER_FS (miner);
+ TrackerMinerFS *fs = TRACKER_MINER_FS (object);
RecursiveMoveData *data = user_data;
+ GError *error = NULL;
+
+ GPtrArray *query_results = tracker_miner_execute_sparql_finish (TRACKER_MINER (object), result, &error);
if (error) {
g_critical ("Could not query children: %s", error->message);
} else {
- if (result) {
+ if (query_results) {
gint i;
for (i = 0; i < result->len; i++) {
gchar **child_source_uri, *child_uri;
- child_source_uri = g_ptr_array_index (result, i);
+ child_source_uri = g_ptr_array_index (query_results, i);
if (!g_str_has_prefix (*child_source_uri, data->source_uri)) {
g_warning ("Child URI '%s' does not start with parent URI '%s'",
@@ -1218,7 +1233,7 @@ item_queue_get_progress (TrackerMinerFS *fs)
{
guint items_to_process = 0;
guint items_total = 0;
-
+
items_to_process += g_queue_get_length (fs->private->items_deleted);
items_to_process += g_queue_get_length (fs->private->items_created);
items_to_process += g_queue_get_length (fs->private->items_updated);
@@ -1374,10 +1389,10 @@ should_change_index_for_file (TrackerMinerFS *fs,
gchar *query, *uri;
SparqlQueryData data;
- file_info = g_file_query_info (file,
- G_FILE_ATTRIBUTE_TIME_MODIFIED,
- G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
- NULL,
+ file_info = g_file_query_info (file,
+ G_FILE_ATTRIBUTE_TIME_MODIFIED,
+ G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+ NULL,
NULL);
if (!file_info) {
/* NOTE: We return TRUE here because we want to update the DB
@@ -1485,7 +1500,7 @@ monitor_item_created_cb (TrackerMonitor *monitor,
} else {
g_queue_push_tail (fs->private->items_created,
g_object_ref (file));
-
+
item_queue_handlers_set_up (fs);
}
}
@@ -1555,17 +1570,17 @@ monitor_item_deleted_cb (TrackerMonitor *monitor,
/* Remove directory from list of directories we are going to
* iterate if it is in there.
*/
- l = g_list_find_custom (fs->private->directories,
- path,
+ l = g_list_find_custom (fs->private->directories,
+ path,
(GCompareFunc) g_strcmp0);
/* Make sure we don't remove the current device we are
* processing, this is because we do this same clean up later
- * in process_device_next()
+ * in process_device_next()
*/
if (l && l != fs->private->current_directory) {
directory_data_free (l->data);
- fs->private->directories =
+ fs->private->directories =
g_list_delete_link (fs->private->directories, l);
}
#endif
@@ -1591,7 +1606,7 @@ monitor_item_moved_cb (TrackerMonitor *monitor,
path = g_file_get_path (other_file);
- g_debug ("Not in store:'?'->'%s' (DIR) (move monitor event, source unknown)",
+ g_debug ("Not in store:'?'->'%s' (DIR) (move monitor event, source unknown)",
path);
/* If the source is not monitored, we need to crawl it. */
@@ -1628,12 +1643,12 @@ monitor_item_moved_cb (TrackerMonitor *monitor,
} else if (!source_stored) {
/* Source file was not stored, check dest file as new */
if (!is_directory) {
- g_queue_push_tail (fs->private->items_created,
+ g_queue_push_tail (fs->private->items_created,
g_object_ref (other_file));
-
+
item_queue_handlers_set_up (fs);
} else {
- g_debug ("Not in store:'?'->'%s' (DIR) (move monitor event, source monitored)",
+ g_debug ("Not in store:'?'->'%s' (DIR) (move monitor event, source monitored)",
path);
tracker_miner_fs_add_directory (fs, other_file, TRUE);
@@ -1641,7 +1656,7 @@ monitor_item_moved_cb (TrackerMonitor *monitor,
} else if (!should_process_other) {
/* Delete old file */
g_queue_push_tail (fs->private->items_deleted, g_object_ref (file));
-
+
item_queue_handlers_set_up (fs);
} else {
/* Move old file to new file */
@@ -1650,7 +1665,7 @@ monitor_item_moved_cb (TrackerMonitor *monitor,
item_queue_handlers_set_up (fs);
}
-
+
g_free (other_path);
g_free (path);
}
@@ -1691,7 +1706,7 @@ crawler_check_directory_cb (TrackerCrawler *crawler,
g_signal_emit (fs, signals[MONITOR_DIRECTORY], 0, file, &add_monitor);
/* FIXME: Should we add here or when we process the queue in
- * the finished sig?
+ * the finished sig?
*/
if (add_monitor) {
tracker_monitor_add (fs->private->monitor, file);
@@ -1703,7 +1718,7 @@ crawler_check_directory_cb (TrackerCrawler *crawler,
* is not done recursively.
*
* As such, we only use the "check" rules here, we don't do
- * any database comparison with mtime.
+ * any database comparison with mtime.
*/
return should_check;
}
diff --git a/src/libtracker-miner/tracker-miner.c b/src/libtracker-miner/tracker-miner.c
index c807cd8..45bced9 100644
--- a/src/libtracker-miner/tracker-miner.c
+++ b/src/libtracker-miner/tracker-miner.c
@@ -47,11 +47,11 @@ static GQuark miner_error_quark = 0;
struct TrackerMinerPrivate {
TrackerClient *client;
-
+
GHashTable *pauses;
gboolean started;
-
+
gchar *name;
gchar *status;
gdouble progress;
@@ -64,7 +64,7 @@ struct TrackerMinerPrivate {
typedef struct {
gint cookie;
gchar *application;
- gchar *reason;
+ gchar *reason;
} PauseData;
typedef struct {
@@ -72,10 +72,10 @@ typedef struct {
GCancellable *cancellable;
gpointer callback;
gpointer user_data;
+ gpointer source_function;
guint id;
guint signal_id;
- gboolean update;
} AsyncCallData;
enum {
@@ -475,7 +475,7 @@ static void
pause_data_destroy (gpointer data)
{
PauseData *pd;
-
+
pd = data;
g_free (pd->reason);
@@ -564,27 +564,55 @@ static void
run_update_callback (AsyncCallData *data,
const GError *error)
{
- TrackerMinerUpdateCallback callback;
-
+ GAsyncReadyCallback callback;
callback = data->callback;
+ GSimpleAsyncResult *result = NULL;
- if (callback) {
- (callback) (data->miner, error, data->user_data);
+ if (error) {
+ GError *local_error = g_error_copy (error);
+ result = g_simple_async_result_new_from_error (G_OBJECT (data->miner),
+ callback,
+ data->user_data,
+ local_error);
+ } else {
+ result = g_simple_async_result_new (G_OBJECT (data->miner),
+ callback,
+ data->user_data,
+ data->source_function);
}
+
+ g_simple_async_result_complete (result);
+ g_object_unref (result);
}
static void
run_query_callback (AsyncCallData *data,
- GPtrArray *result,
+ GPtrArray *query_results,
const GError *error)
{
- TrackerMinerQueryCallback callback;
+ GAsyncReadyCallback callback;
callback = data->callback;
- if (callback) {
- (callback) (data->miner, result, error, data->user_data);
+ GSimpleAsyncResult *result = NULL;
+
+ if (error) {
+ GError *local_error = g_error_copy (error);
+ result = g_simple_async_result_new_from_error (G_OBJECT (data->miner),
+ callback,
+ data->user_data,
+ local_error);
+ } else {
+ result = g_simple_async_result_new (G_OBJECT (data->miner),
+ callback,
+ data->user_data,
+ data->source_function);
}
+
+ // FIXME : Not sure the destroy function should be null here
+ g_simple_async_result_set_op_res_gpointer (result, query_results, NULL);
+ g_simple_async_result_complete (result);
+ g_object_unref (result);
}
static void
@@ -640,7 +668,7 @@ async_call_data_new (TrackerMiner *miner,
GCancellable *cancellable,
gpointer callback,
gpointer user_data,
- gboolean update)
+ gpointer source_function)
{
AsyncCallData *data;
@@ -648,7 +676,7 @@ async_call_data_new (TrackerMiner *miner,
data->miner = miner;
data->callback = callback;
data->user_data = user_data;
- data->update = update;
+ data->source_function = source_function;
if (cancellable) {
data->cancellable = g_object_ref (cancellable);
@@ -680,7 +708,9 @@ async_call_notify_error (AsyncCallData *data,
if (data->callback) {
error = g_error_new_literal (miner_error_quark, code, message);
- if (data->update) {
+ if (data->source_function == tracker_miner_execute_update ||
+ data->source_function == tracker_miner_execute_batch_update ||
+ data->source_function == tracker_miner_commit) {
run_update_callback (data, error);
} else {
run_query_callback (data, NULL, error);
@@ -695,21 +725,25 @@ async_call_notify_error (AsyncCallData *data,
* @miner: a #TrackerMiner
* @sparql: a SPARQL query
* @cancellable: a #GCancellable to control the operation
- * @callback: a #TrackerMinerUpdateCallback to call when the operation is finished
+ * @callback: a #GAsyncReadyCallback to call when the operation is finished
* @user_data: data to pass to @callback
*
* Executes an update SPARQL query on tracker-store, use this
* whenever you want to perform data insertions or modifications.
*
- * When the operation is finished, @callback will be called, providing the error, if any.
- * If the operation is cancelled, @callback will be called anyways, with error filled in.
+ * When the operation is finished, @callback will be called, providing a #GAsyncResult
+ * object. Call tracker_miner_execute_sparql_finish on it to get the returned #GError,
+ * if there is one.
+ *
+ * If the operation is cancelled, @callback will be called anyway, with the #GAsyncResult
+ * object containing an error.
**/
void
-tracker_miner_execute_update (TrackerMiner *miner,
- const gchar *sparql,
- GCancellable *cancellable,
- TrackerMinerUpdateCallback callback,
- gpointer user_data)
+tracker_miner_execute_update (TrackerMiner *miner,
+ const gchar *sparql,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
TrackerMinerPrivate *priv;
AsyncCallData *data;
@@ -719,11 +753,36 @@ tracker_miner_execute_update (TrackerMiner *miner,
g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));
priv = TRACKER_MINER_GET_PRIVATE (miner);
- data = async_call_data_new (miner, cancellable, callback, user_data, TRUE);
+ data = async_call_data_new (miner,
+ cancellable,
+ callback,
+ user_data,
+ tracker_miner_execute_sparql);
data->id = tracker_resources_sparql_update_async (miner->private->client,
- sparql, sparql_update_cb,
- data);
+ sparql,
+ sparql_update_cb,
+ data);
+}
+
+/**
+ * tracker_miner_execute_update_finish:
+ * @miner: a #TrackerMiner
+ * @result: a #GAsyncResult
+ * @error: a #GError
+ *
+ * Finishes the async update operation. If an error occured during the update,
+ * @error will be set.
+ *
+ **/
+void
+tracker_miner_execute_update_finish (TrackerMiner *miner,
+ GAsyncResult *result,
+ GError **error)
+{
+ GSimpleAsyncResult *r = G_SIMPLE_ASYNC_RESULT (result);
+
+ g_simple_async_result_propagate_error (r, error);
}
/**
@@ -731,23 +790,26 @@ tracker_miner_execute_update (TrackerMiner *miner,
* @miner: a #TrackerMiner
* @sparql: a SPARQL query
* @cancellable: a #GCancellable to control the operation
- * @callback: a #TrackerMinerQueryCallback to call when the operation is finished
+ * @callback: a #GAsyncReadyCallback to call when the operation is finished
* @user_data: data to pass to @callback
*
* Executes the SPARQL query on tracker-store and returns asynchronously
* the queried data. Use this whenever you need to get data from
* already stored information.
*
- * When the operation is finished, @callback will be called, providing the queried data,
- * or the error, if any. If the operation is cancelled, @callback will be called with the
- * error parameter filled in.
+ * When the operation is finished, @callback will be called, providing a #GAsyncResult
+ * object. Call tracker_miner_execute_sparql_finish on it to get the query results, or
+ * the GError object if an error occured.
+ *
+ * If the operation is cancelled, @callback will be called anyway, with the #GAsyncResult
+ * object containing an error.
**/
void
tracker_miner_execute_sparql (TrackerMiner *miner,
- const gchar *sparql,
- GCancellable *cancellable,
- TrackerMinerQueryCallback callback,
- gpointer user_data)
+ const gchar *sparql,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
TrackerMinerPrivate *priv;
AsyncCallData *data;
@@ -758,7 +820,7 @@ tracker_miner_execute_sparql (TrackerMiner *miner,
g_return_if_fail (callback != NULL);
priv = TRACKER_MINER_GET_PRIVATE (miner);
- data = async_call_data_new (miner, cancellable, callback, user_data, FALSE);
+ data = async_call_data_new (miner, cancellable, callback, user_data, tracker_miner_execute_sparql);
data->id = tracker_resources_sparql_query_async (miner->private->client,
sparql, sparql_query_cb,
@@ -766,26 +828,54 @@ tracker_miner_execute_sparql (TrackerMiner *miner,
}
/**
+ * tracker_miner_execute_sparql_finish:
+ * @miner: a #TrackerMiner
+ * @result: a #GAsyncResult object holding the result of the query
+ * @error: a #GError
+ *
+ * Finishes the async operation and returns the query results. If an error
+ * occured during the query, @error will be set.
+ *
+ **/
+GPtrArray*
+tracker_miner_execute_sparql_finish (TrackerMiner *miner,
+ GAsyncResult *result,
+ GError **error)
+{
+ GSimpleAsyncResult *r = G_SIMPLE_ASYNC_RESULT (result);
+
+ if (g_simple_async_result_propagate_error (r, error)) {
+ return NULL;
+ }
+
+ return (GPtrArray*)g_simple_async_result_get_op_res_gpointer (r);
+}
+
+/**
* tracker_miner_execute_batch_update:
* @miner: a #TrackerMiner
* @sparql: a set of SPARQL updates
* @cancellable: a #GCancellable to control the operation
- * @callback: a #TrackerMinerUpdateCallback to call when the operation is finished
+ * @callback: a #GAsyncReadyCallback to call when the operation is finished
* @user_data: data to pass to @callback
*
* Executes a batch of update SPARQL queries on tracker-store, use this
* whenever you want to perform data insertions or modifications in
* batches.
*
- * When the operation is finished, @callback will be called, providing the error, if any.
- * If the operation is cancelled, @callback will be called anyways, with error filled in.
+ * When the operation is finished, @callback will be called, providing a #GAsyncResult
+ * object. Call tracker_miner_execute_batch_update_finish on it to get the returned #GError,
+ * if there is one.
+ *
+ * If the operation is cancelled, @callback will be called anyway, with the #GAsyncResult
+ * object containing an error.
**/
void
tracker_miner_execute_batch_update (TrackerMiner *miner,
- const gchar *sparql,
- GCancellable *cancellable,
- TrackerMinerUpdateCallback callback,
- gpointer user_data)
+ const gchar *sparql,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
TrackerMinerPrivate *priv;
AsyncCallData *data;
@@ -795,7 +885,7 @@ tracker_miner_execute_batch_update (TrackerMiner *miner,
g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));
priv = TRACKER_MINER_GET_PRIVATE (miner);
- data = async_call_data_new (miner, cancellable, callback, user_data, TRUE);
+ data = async_call_data_new (miner, cancellable, callback, user_data, tracker_miner_execute_batch_update);
data->id = tracker_resources_batch_sparql_update_async (miner->private->client,
sparql, sparql_update_cb,
@@ -803,22 +893,47 @@ tracker_miner_execute_batch_update (TrackerMiner *miner,
}
/**
+ * tracker_miner_execute_batch_update_finish:
+ * @miner: a #TrackerMiner
+ * @result: a #GAsyncResult
+ * @error: a #GError
+ *
+ * Finishes the async batch update operation. If an error occured during the update,
+ * @error will be set.
+ *
+ **/
+void
+tracker_miner_execute_batch_update_finish (TrackerMiner *miner,
+ GAsyncResult *result,
+ GError **error)
+{
+ GSimpleAsyncResult *r = G_SIMPLE_ASYNC_RESULT (result);
+
+ g_simple_async_result_propagate_error (r, error);
+}
+
+/**
* tracker_miner_commit:
* @miner: a #TrackerMiner
* @cancellable: a #GCancellable to control the operation
- * @callback: a #TrackerMinerUpdateCallback to call when the operation is finished
+ * @callback: a #GAsyncReadyCallback to call when the operation is finished
* @user_data: data to pass to @callback
*
- * Commits all pending batch updates. see tracker_miner_execute_batch_update(). When
- * the operation is finished, @callback will be called, with the error parameter filled
- * in, if any. If the operation is cancelled through @cancellable, the callback will be
- * called anyways with error filled in.
+ * Commits all pending batch updates. See tracker_miner_execute_batch_update().
+ *
+ * When the operation is finished, @callback will be called, providing a #GAsyncResult
+ * object. Call tracker_miner_commit_finish on it to get the returned #GError,
+ * if there is one.
+ *
+ * If the operation is cancelled, @callback will be called anyway, with the #GAsyncResult
+ * object containing an error.
**/
+
void
tracker_miner_commit (TrackerMiner *miner,
- GCancellable *cancellable,
- TrackerMinerUpdateCallback callback,
- gpointer user_data)
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
TrackerMinerPrivate *priv;
@@ -828,13 +943,33 @@ tracker_miner_commit (TrackerMiner *miner,
g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));
priv = TRACKER_MINER_GET_PRIVATE (miner);
- data = async_call_data_new (miner, cancellable, callback, user_data, TRUE);
+ data = async_call_data_new (miner, cancellable, callback, user_data, tracker_miner_commit);
data->id = tracker_resources_batch_commit_async (miner->private->client,
sparql_update_cb,
data);
}
+/**
+ * tracker_miner_commit_finish:
+ * @miner: a #TrackerMiner
+ * @result: a #GAsyncResult
+ * @error: a #GError
+ *
+ * Finishes the async comit operation. If an error occured during the commit,
+ * @error will be set.
+ *
+ **/
+void
+tracker_miner_commit_finish (TrackerMiner *miner,
+ GAsyncResult *result,
+ GError **error)
+{
+ GSimpleAsyncResult *r = G_SIMPLE_ASYNC_RESULT (result);
+
+ g_simple_async_result_propagate_error (r, error);
+}
+
static gint
tracker_miner_pause_internal (TrackerMiner *miner,
const gchar *application,
@@ -850,7 +985,7 @@ tracker_miner_pause_internal (TrackerMiner *miner,
while (g_hash_table_iter_next (&iter, &key, &value)) {
PauseData *pd = value;
- if (g_strcmp0 (application, pd->application) == 0 &&
+ if (g_strcmp0 (application, pd->application) == 0 &&
g_strcmp0 (reason, pd->reason) == 0) {
/* Can't use duplicate pauses */
g_set_error_literal (error, TRACKER_MINER_ERROR, 0,
@@ -861,7 +996,7 @@ tracker_miner_pause_internal (TrackerMiner *miner,
pd = pause_data_new (application, reason);
- g_hash_table_insert (miner->private->pauses,
+ g_hash_table_insert (miner->private->pauses,
GINT_TO_POINTER (pd->cookie),
pd);
@@ -917,7 +1052,7 @@ tracker_miner_pause (TrackerMiner *miner,
*
* Returns: #TRUE if the cookie was valid.
**/
-gboolean
+gboolean
tracker_miner_resume (TrackerMiner *miner,
gint cookie,
GError **error)
@@ -1016,7 +1151,7 @@ tracker_miner_dbus_get_pause_details (TrackerMiner *miner,
g_strfreev (applications_strv);
g_strfreev (reasons_strv);
-
+
g_slist_free (applications);
g_slist_free (reasons);
}
@@ -1075,7 +1210,7 @@ tracker_miner_dbus_resume (TrackerMiner *miner,
tracker_dbus_async_return_if_fail (miner != NULL, context);
- tracker_dbus_request_new (request_id, "%s(cookie:%d)",
+ tracker_dbus_request_new (request_id, "%s(cookie:%d)",
__PRETTY_FUNCTION__,
cookie);
diff --git a/src/libtracker-miner/tracker-miner.h b/src/libtracker-miner/tracker-miner.h
index af046e4..648663e 100644
--- a/src/libtracker-miner/tracker-miner.h
+++ b/src/libtracker-miner/tracker-miner.h
@@ -83,14 +83,6 @@ typedef struct {
GError *error);
} TrackerMinerClass;
-typedef void (* TrackerMinerUpdateCallback) (TrackerMiner *miner,
- const GError *error,
- gpointer user_data);
-typedef void (* TrackerMinerQueryCallback) (TrackerMiner *miner,
- GPtrArray *result,
- const GError *error,
- gpointer user_data);
-
GType tracker_miner_get_type (void) G_GNUC_CONST;
GQuark tracker_miner_error_quark (void);
@@ -106,26 +98,44 @@ gboolean tracker_miner_resume (TrackerMiner *miner,
gint cookie,
GError **error);
-void tracker_miner_execute_update (TrackerMiner *miner,
- const gchar *sparql,
- GCancellable *cancellable,
- TrackerMinerUpdateCallback callback,
- gpointer user_data);
-void tracker_miner_execute_sparql (TrackerMiner *miner,
- const gchar *sparql,
- GCancellable *cancellable,
- TrackerMinerQueryCallback callback,
- gpointer user_data);
-void tracker_miner_execute_batch_update (TrackerMiner *miner,
- const gchar *sparql,
- GCancellable *cancellable,
- TrackerMinerUpdateCallback callback,
- gpointer user_data);
-void tracker_miner_commit (TrackerMiner *miner,
- GCancellable *cancellable,
- TrackerMinerUpdateCallback callback,
- gpointer user_data);
-
+void tracker_miner_execute_update (TrackerMiner *miner,
+ const gchar *sparql,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+void tracker_miner_execute_update_finish (TrackerMiner *miner,
+ GAsyncResult *result,
+ GError **error);
+
+void tracker_miner_execute_sparql (TrackerMiner *miner,
+ const gchar *sparql,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+GPtrArray* tracker_miner_execute_sparql_finish (TrackerMiner *miner,
+ GAsyncResult *result,
+ GError **error);
+
+void tracker_miner_execute_batch_update (TrackerMiner *miner,
+ const gchar *sparql,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+void tracker_miner_execute_batch_update_finish (TrackerMiner *miner,
+ GAsyncResult *result,
+ GError **error);
+
+void tracker_miner_commit (TrackerMiner *miner,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+void tracker_miner_commit_finish (TrackerMiner *miner,
+ GAsyncResult *result,
+ GError **error);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]