[tracker/clientapi] libtracker-client: Use tracker_client_new() + remove _no_service_start()
- From: Martyn James Russell <mr src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker/clientapi] libtracker-client: Use tracker_client_new() + remove _no_service_start()
- Date: Tue, 12 Jan 2010 20:23:41 +0000 (UTC)
commit 5bf3a42740ad249ec64b252203e396c2d1f50847
Author: Martyn Russell <martyn lanedo com>
Date: Tue Jan 12 20:20:00 2010 +0000
libtracker-client: Use tracker_client_new() + remove _no_service_start()
src/libtracker-client/tracker.c | 39 +++++---------------
src/libtracker-client/tracker.h | 4 +--
src/libtracker-gtk/tracker-keyword-store.c | 2 +-
src/libtracker-gtk/tracker-metadata-tile.c | 2 +-
src/libtracker-gtk/tracker-tag-bar.c | 2 +-
src/libtracker-miner/tracker-miner.c | 2 +-
src/plugins/evolution/tracker-evolution-plugin.c | 6 ++--
src/plugins/nautilus/tracker-tags-extension.c | 2 +-
src/plugins/nautilus/tracker-tags-view.c | 2 +-
src/tracker-search-bar/tracker-results-window.c | 2 +-
src/tracker-utils/tracker-import.c | 2 +-
src/tracker-utils/tracker-info.c | 2 +-
src/tracker-utils/tracker-search.c | 2 +-
src/tracker-utils/tracker-sparql.c | 2 +-
src/tracker-utils/tracker-stats.c | 2 +-
src/tracker-utils/tracker-status.c | 2 +-
src/tracker-utils/tracker-tag.c | 2 +-
src/tracker-writeback/tracker-writeback-consumer.c | 2 +-
18 files changed, 29 insertions(+), 50 deletions(-)
---
diff --git a/src/libtracker-client/tracker.c b/src/libtracker-client/tracker.c
index f7d7dc0..671fec2 100644
--- a/src/libtracker-client/tracker.c
+++ b/src/libtracker-client/tracker.c
@@ -512,6 +512,7 @@ tracker_sparql_escape (const gchar *str)
* tracker_client_new:
* @enable_warnings: a #gboolean to determine if warnings are issued in
* cases where they are found.
+ * @service_start: start the D-Bus service if not running.
* @timeout: a #gint used for D-Bus call timeouts.
*
* Creates a connection over D-Bus to the Tracker store for doing data
@@ -525,19 +526,16 @@ tracker_sparql_escape (const gchar *str)
**/
TrackerClient *
tracker_client_new (gboolean enable_warnings,
+ gboolean service_start,
gint timeout)
{
- TrackerClient *client;
-
g_type_init ();
- client = g_object_new (TRACKER_TYPE_CLIENT,
- "timeout", timeout,
- "enable-warnings", enable_warnings,
- "force-service", TRUE,
- NULL);
-
- return client;
+ return g_object_new (TRACKER_TYPE_CLIENT,
+ "enable-warnings", enable_warnings,
+ "force-service", service_start,
+ "timeout", timeout,
+ NULL);
}
/**
@@ -674,7 +672,7 @@ tracker_resources_load (TrackerClient *client,
* const gchar *query;
*
* /* Create D-Bus connection with no warnings and no timeout. */
- * client = tracker_connect (FALSE, 0);
+ * client = tracker_client_new (FALSE, TRUE, 0);
* query = "SELECT"
* " ?album"
* " ?title"
@@ -693,7 +691,7 @@ tracker_resources_load (TrackerClient *client,
* if (error) {
* g_warning ("Could not query Tracker, %s", error->message);
* g_error_free (error);
- * tracker_disconnect (client);
+ * g_object_unref (client);
* return;
* }
*
@@ -1136,24 +1134,7 @@ TrackerClient *
tracker_connect (gboolean enable_warnings,
gint timeout)
{
- return tracker_client_new (enable_warnings, timeout);
-}
-
-TrackerClient *
-tracker_connect_no_service_start (gboolean enable_warnings,
- gint timeout)
-{
- TrackerClient *client;
-
- g_type_init ();
-
- client = g_object_new (TRACKER_TYPE_CLIENT,
- "timeout", timeout,
- "enable-warnings", enable_warnings,
- "force-service", FALSE,
- NULL);
-
- return client;
+ return tracker_client_new (enable_warnings, TRUE, timeout);
}
/**
diff --git a/src/libtracker-client/tracker.h b/src/libtracker-client/tracker.h
index b2e51e3..0d3b9ca 100644
--- a/src/libtracker-client/tracker.h
+++ b/src/libtracker-client/tracker.h
@@ -73,6 +73,7 @@ typedef void (*TrackerReplyVoid) (GError *error,
GType tracker_client_get_type (void) G_GNUC_CONST;
TrackerClient *tracker_client_new (gboolean enable_warnings,
+ gboolean service_start,
gint timeout);
gboolean tracker_cancel_call (TrackerClient *client,
@@ -153,9 +154,6 @@ typedef void (*TrackerReplyArray) (gchar **result,
gpointer user_data);
TrackerClient *
- tracker_connect_no_service_start (gboolean enable_warnings,
- gint timeout) G_GNUC_DEPRECATED;
-TrackerClient *
tracker_connect (gboolean enable_warnings,
gint timeout) G_GNUC_DEPRECATED;
void tracker_disconnect (TrackerClient *client) G_GNUC_DEPRECATED;
diff --git a/src/libtracker-gtk/tracker-keyword-store.c b/src/libtracker-gtk/tracker-keyword-store.c
index d323cf9..ae0bf25 100644
--- a/src/libtracker-gtk/tracker-keyword-store.c
+++ b/src/libtracker-gtk/tracker-keyword-store.c
@@ -61,7 +61,7 @@ tracker_keyword_store_init (TrackerKeywordStore *store)
//setup private members
store->keywords = g_hash_table_new (g_str_hash, g_str_equal);
- store->tracker_client = tracker_client_new (TRUE, -1);
+ store->tracker_client = tracker_client_new (TRUE, TRUE, -1);
/* TODO: Port to SPARQL */
#if 0
diff --git a/src/libtracker-gtk/tracker-metadata-tile.c b/src/libtracker-gtk/tracker-metadata-tile.c
index c732059..6d2e4d1 100644
--- a/src/libtracker-gtk/tracker-metadata-tile.c
+++ b/src/libtracker-gtk/tracker-metadata-tile.c
@@ -1352,7 +1352,7 @@ tracker_metadata_tile_new (void)
tile = g_object_new (TRACKER_TYPE_METADATA_TILE, NULL);
priv = TRACKER_METADATA_TILE_GET_PRIVATE (tile);
- priv->client = tracker_client_new (TRUE, -1);
+ priv->client = tracker_client_new (TRUE, TRUE, -1);
return tile;
}
diff --git a/src/libtracker-gtk/tracker-tag-bar.c b/src/libtracker-gtk/tracker-tag-bar.c
index cb451ab..f67bd70 100644
--- a/src/libtracker-gtk/tracker-tag-bar.c
+++ b/src/libtracker-gtk/tracker-tag-bar.c
@@ -449,7 +449,7 @@ tracker_tag_bar_new (void)
NULL);
priv = TRACKER_TAG_BAR_GET_PRIVATE (tag_bar);
- priv->client = tracker_client_new (TRUE, -1);
+ priv->client = tracker_client_new (TRUE, TRUE, -1);
return tag_bar;
}
diff --git a/src/libtracker-miner/tracker-miner.c b/src/libtracker-miner/tracker-miner.c
index f317123..208a5ea 100644
--- a/src/libtracker-miner/tracker-miner.c
+++ b/src/libtracker-miner/tracker-miner.c
@@ -302,7 +302,7 @@ tracker_miner_init (TrackerMiner *miner)
miner->private = priv = TRACKER_MINER_GET_PRIVATE (miner);
/* Set the timeout to 0 so we don't have one */
- priv->client = tracker_client_new (TRUE, 0);
+ priv->client = tracker_client_new (TRUE, TRUE, 0);
priv->pauses = g_hash_table_new_full (g_direct_hash,
g_direct_equal,
diff --git a/src/plugins/evolution/tracker-evolution-plugin.c b/src/plugins/evolution/tracker-evolution-plugin.c
index fc418dc..5f56765 100644
--- a/src/plugins/evolution/tracker-evolution-plugin.c
+++ b/src/plugins/evolution/tracker-evolution-plugin.c
@@ -2148,7 +2148,7 @@ name_owner_changed_cb (DBusGProxy *proxy,
if (tracker_is_empty_string (old_owner) && !tracker_is_empty_string (new_owner)) {
if (!priv->client) {
- priv->client = tracker_connect_no_service_start (FALSE, G_MAXINT);
+ priv->client = tracker_client_new (FALSE, FALSE, G_MAXINT);
}
register_client (user_data);
}
@@ -2341,7 +2341,7 @@ miner_started (TrackerMiner *miner)
g_static_rec_mutex_lock (priv->mutex);
if (!priv->client) {
- priv->client = tracker_connect_no_service_start (FALSE, G_MAXINT);
+ priv->client = tracker_client_new (FALSE, FALSE, G_MAXINT);
}
g_static_rec_mutex_unlock (priv->mutex);
@@ -2444,7 +2444,7 @@ miner_resumed (TrackerMiner *miner)
priv->of_total = 0;
if (!priv->client) {
- priv->client = tracker_connect_no_service_start (FALSE, G_MAXINT);
+ priv->client = tracker_client_new (FALSE, FALSE, G_MAXINT);
}
g_static_rec_mutex_unlock (priv->mutex);
diff --git a/src/plugins/nautilus/tracker-tags-extension.c b/src/plugins/nautilus/tracker-tags-extension.c
index bc1a60d..782bb76 100644
--- a/src/plugins/nautilus/tracker-tags-extension.c
+++ b/src/plugins/nautilus/tracker-tags-extension.c
@@ -272,7 +272,7 @@ static void
tracker_tags_extension_init (TrackerTagsExtension *self)
{
self->private = TRACKER_TAGS_EXTENSION_GET_PRIVATE (self);
- self->private->tracker_client = tracker_client_new (TRUE, G_MAXINT);
+ self->private->tracker_client = tracker_client_new (TRUE, TRUE, G_MAXINT);
}
static void
diff --git a/src/plugins/nautilus/tracker-tags-view.c b/src/plugins/nautilus/tracker-tags-view.c
index 46f8e11..d925cba 100644
--- a/src/plugins/nautilus/tracker-tags-view.c
+++ b/src/plugins/nautilus/tracker-tags-view.c
@@ -94,7 +94,7 @@ tracker_tags_view_init (TrackerTagsView *tv)
{
tv->private = TRACKER_TAGS_VIEW_GET_PRIVATE (tv);
- tv->private->tracker_client = tracker_client_new (TRUE, G_MAXINT);
+ tv->private->tracker_client = tracker_client_new (TRUE, TRUE, G_MAXINT);
tv->private->files = NULL;
tv->private->store = gtk_list_store_new (N_COLUMNS,
G_TYPE_INT, /* Selection type */
diff --git a/src/tracker-search-bar/tracker-results-window.c b/src/tracker-search-bar/tracker-results-window.c
index 45c91d3..def3c43 100644
--- a/src/tracker-search-bar/tracker-results-window.c
+++ b/src/tracker-search-bar/tracker-results-window.c
@@ -380,7 +380,7 @@ tracker_results_window_init (TrackerResultsWindow *window)
priv = TRACKER_RESULTS_WINDOW_GET_PRIVATE (window);
- priv->client = tracker_client_new (FALSE, G_MAXINT);
+ priv->client = tracker_client_new (FALSE, TRUE, G_MAXINT);
priv->frame = gtk_frame_new (NULL);
gtk_container_add (GTK_CONTAINER (window), priv->frame);
diff --git a/src/tracker-utils/tracker-import.c b/src/tracker-utils/tracker-import.c
index 2042a24..391e035 100644
--- a/src/tracker-utils/tracker-import.c
+++ b/src/tracker-utils/tracker-import.c
@@ -102,7 +102,7 @@ main (int argc, char **argv)
g_option_context_free (context);
- client = tracker_client_new (FALSE, G_MAXINT);
+ client = tracker_client_new (FALSE, TRUE, G_MAXINT);
if (!client) {
g_printerr ("%s\n",
diff --git a/src/tracker-utils/tracker-info.c b/src/tracker-utils/tracker-info.c
index 70142fe..e008693 100644
--- a/src/tracker-utils/tracker-info.c
+++ b/src/tracker-utils/tracker-info.c
@@ -128,7 +128,7 @@ main (int argc, char **argv)
g_option_context_free (context);
- client = tracker_client_new (FALSE, G_MAXINT);
+ client = tracker_client_new (FALSE, TRUE, G_MAXINT);
if (!client) {
g_printerr ("%s\n",
diff --git a/src/tracker-utils/tracker-search.c b/src/tracker-utils/tracker-search.c
index 2a7d760..0bd15b8 100644
--- a/src/tracker-utils/tracker-search.c
+++ b/src/tracker-utils/tracker-search.c
@@ -835,7 +835,7 @@ main (int argc, char **argv)
g_option_context_free (context);
- client = tracker_client_new (FALSE, G_MAXINT);
+ client = tracker_client_new (FALSE, TRUE, G_MAXINT);
if (!client) {
g_printerr ("%s\n",
diff --git a/src/tracker-utils/tracker-sparql.c b/src/tracker-utils/tracker-sparql.c
index ffdf38a..573e153 100644
--- a/src/tracker-utils/tracker-sparql.c
+++ b/src/tracker-utils/tracker-sparql.c
@@ -199,7 +199,7 @@ main (int argc, char **argv)
g_option_context_free (context);
- client = tracker_client_new (FALSE, G_MAXINT);
+ client = tracker_client_new (FALSE, TRUE, G_MAXINT);
if (!client) {
g_printerr ("%s\n",
diff --git a/src/tracker-utils/tracker-stats.c b/src/tracker-utils/tracker-stats.c
index 9efc709..18e0d7b 100644
--- a/src/tracker-utils/tracker-stats.c
+++ b/src/tracker-utils/tracker-stats.c
@@ -99,7 +99,7 @@ main (int argc, char **argv)
g_option_context_free (context);
- client = tracker_client_new (FALSE, G_MAXINT);
+ client = tracker_client_new (FALSE, TRUE, G_MAXINT);
if (!client) {
g_printerr ("%s\n",
diff --git a/src/tracker-utils/tracker-status.c b/src/tracker-utils/tracker-status.c
index b1821f2..db47afc 100644
--- a/src/tracker-utils/tracker-status.c
+++ b/src/tracker-utils/tracker-status.c
@@ -392,7 +392,7 @@ main (gint argc, gchar *argv[])
g_thread_init (NULL);
}
- client = tracker_client_new (FALSE, G_MAXINT);
+ client = tracker_client_new (FALSE, TRUE, G_MAXINT);
if (!client) {
g_printerr ("%s\n",
diff --git a/src/tracker-utils/tracker-tag.c b/src/tracker-utils/tracker-tag.c
index 9f6c512..af7a2bb 100644
--- a/src/tracker-utils/tracker-tag.c
+++ b/src/tracker-utils/tracker-tag.c
@@ -685,7 +685,7 @@ main (int argc, char **argv)
g_option_context_free (context);
- client = tracker_client_new (FALSE, G_MAXINT);
+ client = tracker_client_new (FALSE, TRUE, G_MAXINT);
if (!client) {
g_printerr ("%s\n",
diff --git a/src/tracker-writeback/tracker-writeback-consumer.c b/src/tracker-writeback/tracker-writeback-consumer.c
index 2b8b919..fee665b 100644
--- a/src/tracker-writeback/tracker-writeback-consumer.c
+++ b/src/tracker-writeback/tracker-writeback-consumer.c
@@ -80,7 +80,7 @@ tracker_writeback_consumer_init (TrackerWritebackConsumer *consumer)
priv = TRACKER_WRITEBACK_CONSUMER_GET_PRIVATE (consumer);
- priv->client = tracker_client_new (TRUE, 0);
+ priv->client = tracker_client_new (TRUE, TRUE, 0);
priv->modules = g_hash_table_new_full (g_str_hash,
g_str_equal,
(GDestroyNotify) g_free,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]