[tracker/gdbus: 21/92] libtracker-miner: Emit on D-Bus using GDBus in tracker-miner-object.c



commit 93dbf8af5e064d74495d53e8bc2e1a8a8450b551
Author: Philip Van Hoof <philip codeminded be>
Date:   Thu Dec 30 12:33:51 2010 +0100

    libtracker-miner: Emit on D-Bus using GDBus in tracker-miner-object.c

 src/libtracker-miner/tracker-miner-object.c |   56 ++++++++++++++++++++++++---
 1 files changed, 50 insertions(+), 6 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-object.c b/src/libtracker-miner/tracker-miner-object.c
index 4ccfe8c..66c5bec 100644
--- a/src/libtracker-miner/tracker-miner-object.c
+++ b/src/libtracker-miner/tracker-miner-object.c
@@ -85,9 +85,7 @@ static const gchar introspection_xml[] =
   "      <arg type='as' name='urls' direction='in' />"
   "    </method>"
   "    <signal name='Started' />"
-  "    <signal name='Stopped'>"
-  "      <arg type='b' name='interrupted' />"
-  "    </signal>"
+  "    <signal name='Stopped' />"
   "    <signal name='Paused' />"
   "    <signal name='Resumed' />"
   "    <signal name='Progress'>"
@@ -110,6 +108,8 @@ struct _TrackerMinerPrivate {
 	guint watch_name_id;
 	guint registration_id;
 	guint own_id;
+	gchar *full_name;
+	gchar *full_path;
 };
 
 typedef struct {
@@ -326,6 +326,16 @@ miner_update_progress (TrackerMiner *miner)
 	g_signal_emit (miner, signals[PROGRESS], 0,
 	               miner->private->status,
 	               miner->private->progress);
+
+	g_dbus_connection_emit_signal (miner->private->d_connection,
+	                               NULL,
+	                               miner->private->full_path,
+	                               TRACKER_MINER_DBUS_INTERFACE,
+	                               "Progress",
+	                               g_variant_new ("(sd)",
+	                                              miner->private->status,
+	                                              miner->private->progress),
+	                               NULL);
 }
 
 static void
@@ -463,6 +473,14 @@ tracker_miner_start (TrackerMiner *miner)
 	miner->private->started = TRUE;
 
 	g_signal_emit (miner, signals[STARTED], 0);
+
+	g_dbus_connection_emit_signal (miner->private->d_connection,
+	                               NULL,
+	                               miner->private->full_path,
+	                               TRACKER_MINER_DBUS_INTERFACE,
+	                               "Started",
+	                               NULL,
+	                               NULL);
 }
 
 /**
@@ -480,6 +498,14 @@ tracker_miner_stop (TrackerMiner *miner)
 	miner->private->started = FALSE;
 
 	g_signal_emit (miner, signals[STOPPED], 0);
+
+	g_dbus_connection_emit_signal (miner->private->d_connection,
+	                               NULL,
+	                               miner->private->full_path,
+	                               TRACKER_MINER_DBUS_INTERFACE,
+	                               "Stopped",
+	                               NULL,
+	                               NULL);
 }
 
 /**
@@ -548,6 +574,14 @@ tracker_miner_pause_internal (TrackerMiner  *miner,
 		/* Pause */
 		g_message ("Miner:'%s' is pausing", miner->private->name);
 		g_signal_emit (miner, signals[PAUSED], 0);
+
+		g_dbus_connection_emit_signal (miner->private->d_connection,
+		                               NULL,
+		                               miner->private->full_path,
+		                               TRACKER_MINER_DBUS_INTERFACE,
+		                               "Paused",
+		                               NULL,
+		                               NULL);
 	}
 
 	return pd->cookie;
@@ -613,6 +647,14 @@ tracker_miner_resume (TrackerMiner  *miner,
 		/* Resume */
 		g_message ("Miner:'%s' is resuming", miner->private->name);
 		g_signal_emit (miner, signals[RESUMED], 0);
+
+		g_dbus_connection_emit_signal (miner->private->d_connection,
+		                               NULL,
+		                               miner->private->full_path,
+		                               TRACKER_MINER_DBUS_INTERFACE,
+		                               "Resumed",
+		                               NULL,
+		                               NULL);
 	}
 
 	return TRUE;
@@ -652,6 +694,8 @@ miner_finalize (GObject *object)
 
 	g_free (miner->private->status);
 	g_free (miner->private->name);
+	g_free (miner->private->full_name);
+	g_free (miner->private->full_path);
 
 	if (miner->private->connection) {
 		g_object_unref (miner->private->connection);
@@ -972,8 +1016,7 @@ miner_constructed (GObject *object)
 	                                                       full_name,
 	                                                       G_BUS_NAME_OWNER_FLAGS_NONE,
 	                                                       NULL, NULL, NULL, NULL);
-
-	g_free (full_name);
+	miner->private->full_name = full_name;
 
 	/* Register the service name for the miner */
 	full_path = g_strconcat (TRACKER_MINER_DBUS_PATH_PREFIX, name, NULL);
@@ -1000,7 +1043,8 @@ miner_constructed (GObject *object)
 	}
 
 	g_free (name);
-	g_free (full_path);
+
+	miner->private->full_path = full_path;
 
 	miner->private->watch_name_id = g_bus_watch_name (G_BUS_TYPE_SESSION,
 	                                                  TRACKER_SERVICE,



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