[tracker/libtracker-miner] Added miner_stopped() API and miner defines for dbus path/name prefixes
- From: Martyn James Russell <mr src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker/libtracker-miner] Added miner_stopped() API and miner defines for dbus path/name prefixes
- Date: Wed, 19 Aug 2009 12:19:07 +0000 (UTC)
commit 9183b85054c278b105823e31ab0d9edd0b4c4499
Author: Martyn Russell <martyn imendio com>
Date: Wed Aug 19 12:33:41 2009 +0100
Added miner_stopped() API and miner defines for dbus path/name prefixes
src/libtracker-miner/tracker-miner.c | 93 ++++++++++++++++++++--------------
src/libtracker-miner/tracker-miner.h | 4 ++
2 files changed, 58 insertions(+), 39 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner.c b/src/libtracker-miner/tracker-miner.c
index 99d66a5..7db755c 100644
--- a/src/libtracker-miner/tracker-miner.c
+++ b/src/libtracker-miner/tracker-miner.c
@@ -1,4 +1,4 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+./* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Copyright (C) 2009, Nokia
@@ -29,7 +29,9 @@
struct TrackerMinerPrivate {
TrackerClient *client;
-
+
+ gboolean started;
+
gchar *name;
gchar *status;
gdouble progress;
@@ -37,8 +39,8 @@ struct TrackerMinerPrivate {
typedef struct {
DBusGConnection *connection;
- DBusGProxy *gproxy;
- GHashTable *name_monitors;
+ DBusGProxy *gproxy;
+ GHashTable *name_monitors;
} DBusData;
enum {
@@ -63,20 +65,19 @@ static GQuark dbus_data = 0;
static guint signals[LAST_SIGNAL] = { 0 };
-
-static void miner_set_property (GObject *object,
- guint param_id,
- const GValue *value,
- GParamSpec *pspec);
-static void miner_get_property (GObject *object,
- guint param_id,
- GValue *value,
- GParamSpec *pspec);
-static void miner_finalize (GObject *object);
-static void miner_constructed (GObject *object);
+static void miner_set_property (GObject *object,
+ guint param_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void miner_get_property (GObject *object,
+ guint param_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void miner_finalize (GObject *object);
+static void miner_constructed (GObject *object);
static gboolean terminate_miner_cb (TrackerMiner *miner);
-static gboolean dbus_init (TrackerMiner *miner);
-static void dbus_shutdown (TrackerMiner *miner);
+static gboolean dbus_init (TrackerMiner *miner);
+static void dbus_shutdown (TrackerMiner *miner);
G_DEFINE_ABSTRACT_TYPE (TrackerMiner, tracker_miner, G_TYPE_OBJECT)
@@ -373,7 +374,7 @@ dbus_data_create (TrackerMiner *miner,
DBUS_INTERFACE_DBUS);
/* Register the service name for the miner */
- full_name = g_strconcat ("org.freedesktop.Tracker.Miner.", name, NULL);
+ full_name = g_strconcat (TRACKER_MINER_DBUS_NAME_PREFIX, name, NULL);
if (!dbus_register_service (gproxy, full_name)) {
g_object_unref (gproxy);
@@ -383,7 +384,7 @@ dbus_data_create (TrackerMiner *miner,
g_free (full_name);
- full_path = g_strconcat ("/org/freedesktop/Tracker/Miner/", name, NULL);
+ full_path = g_strconcat (TRACKER_MINER_DBUS_PATH_PREFIX, name, NULL);
if (!dbus_register_object (G_OBJECT (miner),
connection, gproxy,
@@ -458,10 +459,24 @@ void
tracker_miner_start (TrackerMiner *miner)
{
g_return_if_fail (TRACKER_IS_MINER (miner));
+ g_return_if_fail (miner->private->started == FALSE);
+
+ miner->private->started = TRUE;
g_signal_emit (miner, signals[STARTED], 0);
}
+void
+tracker_miner_stop (TrackerMiner *miner)
+{
+ g_return_if_fail (TRACKER_IS_MINER (miner));
+ g_return_if_fail (miner->private->started == TRUE);
+
+ miner->private->started = FALSE;
+
+ g_signal_emit (miner, signals[STOPPED], 0);
+}
+
gchar *
tracker_miner_get_status (TrackerMiner *miner)
{
@@ -478,24 +493,6 @@ tracker_miner_get_progress (TrackerMiner *miner)
return miner->private->progress;
}
-/* DBus methods */
-void
-tracker_miner_pause (TrackerMiner *miner,
- DBusGMethodInvocation *context,
- GError **error)
-{
- g_return_if_fail (TRACKER_IS_MINER (miner));
-
-}
-
-void
-tracker_miner_resume (TrackerMiner *miner,
- DBusGMethodInvocation *context,
- GError **error)
-{
- g_return_if_fail (TRACKER_IS_MINER (miner));
-}
-
TrackerClient *
tracker_miner_get_client (TrackerMiner *miner)
{
@@ -514,7 +511,8 @@ tracker_miner_execute_sparql (TrackerMiner *miner,
g_return_val_if_fail (TRACKER_IS_MINER (miner), FALSE);
tracker_resources_batch_sparql_update (miner->private->client,
- sparql, &internal_error);
+ sparql,
+ &internal_error);
if (!internal_error) {
return TRUE;
@@ -523,9 +521,26 @@ tracker_miner_execute_sparql (TrackerMiner *miner,
if (error) {
g_propagate_error (error, internal_error);
} else {
- g_warning ("Error running sparql queries: %s\n", internal_error->message);
+ g_warning ("Error running sparql queries: %s", internal_error->message);
g_error_free (internal_error);
}
return FALSE;
}
+
+/* DBus methods */
+void
+tracker_miner_pause (TrackerMiner *miner,
+ DBusGMethodInvocation *context,
+ GError **error)
+{
+ g_return_if_fail (TRACKER_IS_MINER (miner));
+}
+
+void
+tracker_miner_resume (TrackerMiner *miner,
+ DBusGMethodInvocation *context,
+ GError **error)
+{
+ g_return_if_fail (TRACKER_IS_MINER (miner));
+}
diff --git a/src/libtracker-miner/tracker-miner.h b/src/libtracker-miner/tracker-miner.h
index 66ac75f..3e3fe50 100644
--- a/src/libtracker-miner/tracker-miner.h
+++ b/src/libtracker-miner/tracker-miner.h
@@ -33,6 +33,9 @@ G_BEGIN_DECLS
#define TRACKER_IS_MINER_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), TRACKER_TYPE_MINER))
#define TRACKER_MINER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TRACKER_TYPE_MINER, TrackerMinerClass))
+#define TRACKER_MINER_DBUS_NAME_PREFIX "org.freedesktop.Tracker.Miner."
+#define TRACKER_MINER_DBUS_PATH_PREFIX "/org/freedesktop/Tracker/Miner/"
+
typedef struct TrackerMiner TrackerMiner;
typedef struct TrackerMinerClass TrackerMinerClass;
typedef struct TrackerMinerPrivate TrackerMinerPrivate;
@@ -66,6 +69,7 @@ struct TrackerMinerClass {
GType tracker_miner_get_type (void) G_GNUC_CONST;
void tracker_miner_start (TrackerMiner *miner);
+void tracker_miner_stop (TrackerMiner *miner);
G_CONST_RETURN gchar *tracker_miner_get_name (TrackerMiner *miner);
gchar *tracker_miner_get_status (TrackerMiner *miner);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]