[tracker/miner-fs-initable-iface: 5/8] tracker-miner-rss: Make TrackerMinerRSS object initable



commit 7ea15b4e20c3cb96898e02de408b9d187bb8cde6
Author: Aleksander Morgado <aleksander lanedo com>
Date:   Mon Jan 31 20:25:38 2011 +0100

    tracker-miner-rss: Make TrackerMinerRSS object initable

 src/miners/rss/tracker-main.c      |    7 ++++++-
 src/miners/rss/tracker-miner-rss.c |   23 +++++++++++++++++++++--
 src/miners/rss/tracker-miner-rss.h |    3 ++-
 3 files changed, 29 insertions(+), 4 deletions(-)
---
diff --git a/src/miners/rss/tracker-main.c b/src/miners/rss/tracker-main.c
index 8411aba..073d092 100644
--- a/src/miners/rss/tracker-main.c
+++ b/src/miners/rss/tracker-main.c
@@ -70,7 +70,12 @@ main (int argc, char **argv)
 	g_print ("Starting log:\n  File:'%s'\n", log_filename);
 	g_free (log_filename);
 
-	miner = g_object_new (TRACKER_TYPE_MINER_RSS, "name", "RSS", NULL);
+	miner = tracker_miner_rss_new ();
+	if (!miner) {
+		g_printerr ("Cannot create new RSS miner, exiting...\n");
+		return -1;
+	}
+
 	tracker_miner_start (TRACKER_MINER (miner));
 
 	loop = g_main_loop_new (NULL, FALSE);
diff --git a/src/miners/rss/tracker-miner-rss.c b/src/miners/rss/tracker-miner-rss.c
index fb297a7..91e3f24 100644
--- a/src/miners/rss/tracker-miner-rss.c
+++ b/src/miners/rss/tracker-miner-rss.c
@@ -223,7 +223,7 @@ change_status (FeedsPool   *pool,
 	if (priv->now_fetching > avail)
 		priv->now_fetching = avail;
 
-	g_message ("Fetching channel '%s' (in progress: %d/%d)", 
+	g_message ("Fetching channel '%s' (in progress: %d/%d)",
 	           feed_channel_get_source (feed),
 	           priv->now_fetching,
 	           avail);
@@ -307,7 +307,7 @@ item_verify_reply_cb (GObject      *source_object,
 	tracker_sparql_builder_insert_open (sparql, url);
 
 	if (has_geopoint) {
-		g_message ("  Geopoint, using longitude:%f, latitude:%f", 
+		g_message ("  Geopoint, using longitude:%f, latitude:%f",
 		           longitude, latitude);
 
 		tracker_sparql_builder_subject (sparql, "_:location");
@@ -608,3 +608,22 @@ miner_resumed (TrackerMiner *miner)
 	/* Resume */
 	g_object_set (miner, "status", priv->last_status ? priv->last_status : "Idle", NULL);
 }
+
+TrackerMinerRSS *
+tracker_miner_rss_new (void)
+{
+	GError *error = NULL;
+	TrackerMinerRSS *miner;
+
+	miner = g_initable_new (TRACKER_TYPE_MINER_RSS,
+	                        NULL,
+	                        &error,
+	                        "name", "RSS",
+	                        NULL);
+	if (!miner) {
+		g_critical ("Couldn't create new TrackerMinerRSS object: '%s'",
+		            error ? error->message : "Unknown error");
+	}
+
+	return miner;
+}
diff --git a/src/miners/rss/tracker-miner-rss.h b/src/miners/rss/tracker-miner-rss.h
index e46f23a..73470b4 100644
--- a/src/miners/rss/tracker-miner-rss.h
+++ b/src/miners/rss/tracker-miner-rss.h
@@ -45,7 +45,8 @@ struct _TrackerMinerRSSClass {
 	TrackerMinerClass parent;
 };
 
-GType    tracker_miner_rss_get_type         (void) G_GNUC_CONST;
+GType            tracker_miner_rss_get_type (void) G_GNUC_CONST;
+TrackerMinerRSS *tracker_miner_rss_new      (void);
 
 G_END_DECLS
 



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