[tracker] TrackerMiner: Remove application parameter from tracker_miner_pause().



commit ebff2d69d30c95bfb224a9522737116088812555
Author: Carlos Garnacho <carlos lanedo com>
Date:   Wed Oct 7 17:19:17 2009 +0200

    TrackerMiner: Remove application parameter from tracker_miner_pause().
    
    This is not necessary for internal use, just for the DBus API, it now
    uses internally either g_get_application_name() or TrackerMiner::name.

 src/libtracker-miner/tracker-miner.c |   61 ++++++++++++++++++++-------------
 src/libtracker-miner/tracker-miner.h |    1 -
 2 files changed, 37 insertions(+), 25 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner.c b/src/libtracker-miner/tracker-miner.c
index a85ac9b..6745737 100644
--- a/src/libtracker-miner/tracker-miner.c
+++ b/src/libtracker-miner/tracker-miner.c
@@ -503,7 +503,6 @@ name_owner_changed_cb (DBusGProxy *proxy,
 		gint cookie_id;
 
 		cookie_id = tracker_miner_pause (miner,
-						 g_get_application_name (),
 						 _("Data store is not available"),
 						 &error);
 
@@ -835,33 +834,16 @@ tracker_miner_commit (TrackerMiner *miner)
 	return TRUE;
 }
 
-/**
- * tracker_miner_pause:
- * @miner: a #TrackerMiner
- * @application: application name
- * @reason: reason to pause
- * @error: return location for errors
- *
- * Asks @miner to pause. On success the cookie ID is returned,
- * this is what must be used in tracker_miner_resume() to resume
- * operations. On failure @error will be set and -1 will be returned.
- *
- * Returns: The pause cookie ID.
- **/
-gint
-tracker_miner_pause (TrackerMiner  *miner,
-		     const gchar   *application,
-		     const gchar   *reason,
-		     GError       **error)
+static gint
+tracker_miner_pause_internal (TrackerMiner  *miner,
+			      const gchar   *application,
+			      const gchar   *reason,
+			      GError       **error)
 {
 	PauseData *pd;
 	GHashTableIter iter;
 	gpointer key, value;
 
-	g_return_val_if_fail (TRACKER_IS_MINER (miner), -1);
-	g_return_val_if_fail (application != NULL, -1);
-	g_return_val_if_fail (reason != NULL, -1);
-
 	/* Check this is not a duplicate pause */
 	g_hash_table_iter_init (&iter, miner->private->pauses);
 	while (g_hash_table_iter_next (&iter, &key, &value)) {
@@ -892,6 +874,37 @@ tracker_miner_pause (TrackerMiner  *miner,
 }
 
 /**
+ * tracker_miner_pause:
+ * @miner: a #TrackerMiner
+ * @reason: reason to pause
+ * @error: return location for errors
+ *
+ * Asks @miner to pause. On success the cookie ID is returned,
+ * this is what must be used in tracker_miner_resume() to resume
+ * operations. On failure @error will be set and -1 will be returned.
+ *
+ * Returns: The pause cookie ID.
+ **/
+gint
+tracker_miner_pause (TrackerMiner  *miner,
+		     const gchar   *reason,
+		     GError       **error)
+{
+	const gchar *application;
+
+	g_return_val_if_fail (TRACKER_IS_MINER (miner), -1);
+	g_return_val_if_fail (reason != NULL, -1);
+
+	application = g_get_application_name ();
+
+	if (!application) {
+		application = miner->private->name;
+	}
+
+	return tracker_miner_pause_internal (miner, application, reason, error);
+}
+
+/**
  * tracker_miner_resume:
  * @miner: a #TrackerMiner
  * @cookie: pause cookie
@@ -1029,7 +1042,7 @@ tracker_miner_dbus_pause (TrackerMiner           *miner,
 				  application,
 				  reason);
 
-	cookie = tracker_miner_pause (miner, application, reason, &local_error);
+	cookie = tracker_miner_pause_internal (miner, application, reason, &local_error);
 	if (cookie == -1) {
 		GError *actual_error = NULL;
 
diff --git a/src/libtracker-miner/tracker-miner.h b/src/libtracker-miner/tracker-miner.h
index 937c7be..329d9a1 100644
--- a/src/libtracker-miner/tracker-miner.h
+++ b/src/libtracker-miner/tracker-miner.h
@@ -98,7 +98,6 @@ gboolean       tracker_miner_execute_batch_update
 gboolean       tracker_miner_commit         (TrackerMiner  *miner);
 
 gint           tracker_miner_pause          (TrackerMiner  *miner,
-					     const gchar   *application,
 					     const gchar   *reason,
 					     GError       **error);
 gboolean       tracker_miner_resume         (TrackerMiner  *miner,



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