[tracker/libtracker-miner] TrackerMinerManager: Add pause/resume signals.
- From: Carlos Garnacho <carlosg src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker/libtracker-miner] TrackerMinerManager: Add pause/resume signals.
- Date: Fri, 4 Sep 2009 11:46:20 +0000 (UTC)
commit bdedd27790e8bc14335ce1c7d71f9661ed6cb6b4
Author: Carlos Garnacho <carlos lanedo com>
Date: Fri Sep 4 13:41:36 2009 +0200
TrackerMinerManager: Add pause/resume signals.
src/libtracker-miner/tracker-miner-manager.c | 60 ++++++++++++++++++++++++++
src/libtracker-miner/tracker-miner-manager.h | 5 ++
2 files changed, 65 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-manager.c b/src/libtracker-miner/tracker-miner-manager.c
index 61c0b3f..0ffc91c 100644
--- a/src/libtracker-miner/tracker-miner-manager.c
+++ b/src/libtracker-miner/tracker-miner-manager.c
@@ -45,6 +45,8 @@ G_DEFINE_TYPE (TrackerMinerManager, tracker_miner_manager, G_TYPE_OBJECT)
enum {
MINER_PROGRESS,
+ MINER_PAUSED,
+ MINER_RESUMED,
LAST_SIGNAL
};
@@ -68,6 +70,24 @@ tracker_miner_manager_class_init (TrackerMinerManagerClass *klass)
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_DOUBLE);
+ signals [MINER_PAUSED] =
+ g_signal_new ("miner-paused",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (TrackerMinerManagerClass, miner_paused),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__STRING,
+ G_TYPE_NONE, 1,
+ G_TYPE_STRING);
+ signals [MINER_RESUMED] =
+ g_signal_new ("miner-resumed",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (TrackerMinerManagerClass, miner_resumed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__STRING,
+ G_TYPE_NONE, 1,
+ G_TYPE_STRING);
g_type_class_add_private (object_class, sizeof (TrackerMinerManagerPrivate));
}
@@ -90,6 +110,36 @@ miner_progress_changed (DBusGProxy *proxy,
}
static void
+miner_paused (DBusGProxy *proxy,
+ gpointer user_data)
+{
+ TrackerMinerManager *manager = user_data;
+ TrackerMinerManagerPrivate *priv;
+ const gchar *name;
+
+ manager = user_data;
+ priv = TRACKER_MINER_MANAGER_GET_PRIVATE (manager);
+ name = g_hash_table_lookup (priv->miner_proxies, proxy);
+
+ g_signal_emit (manager, signals[MINER_PAUSED], 0, name);
+}
+
+static void
+miner_resumed (DBusGProxy *proxy,
+ gpointer user_data)
+{
+ TrackerMinerManager *manager = user_data;
+ TrackerMinerManagerPrivate *priv;
+ const gchar *name;
+
+ manager = user_data;
+ priv = TRACKER_MINER_MANAGER_GET_PRIVATE (manager);
+ name = g_hash_table_lookup (priv->miner_proxies, proxy);
+
+ g_signal_emit (manager, signals[MINER_RESUMED], 0, name);
+}
+
+static void
tracker_miner_manager_init (TrackerMinerManager *manager)
{
TrackerMinerManagerPrivate *priv;
@@ -143,11 +193,21 @@ tracker_miner_manager_init (TrackerMinerManager *manager)
G_TYPE_STRING,
G_TYPE_DOUBLE,
G_TYPE_INVALID);
+ dbus_g_proxy_add_signal (proxy, "Paused", G_TYPE_INVALID);
+ dbus_g_proxy_add_signal (proxy, "Resumed", G_TYPE_INVALID);
dbus_g_proxy_connect_signal (proxy,
"Progress",
G_CALLBACK (miner_progress_changed),
manager, NULL);
+ dbus_g_proxy_connect_signal (proxy,
+ "Paused",
+ G_CALLBACK (miner_paused),
+ manager, NULL);
+ dbus_g_proxy_connect_signal (proxy,
+ "Resumed",
+ G_CALLBACK (miner_resumed),
+ manager, NULL);
g_hash_table_insert (priv->miner_proxies, proxy, g_strdup (m->data));
}
diff --git a/src/libtracker-miner/tracker-miner-manager.h b/src/libtracker-miner/tracker-miner-manager.h
index 74bf026..2ed533e 100644
--- a/src/libtracker-miner/tracker-miner-manager.h
+++ b/src/libtracker-miner/tracker-miner-manager.h
@@ -46,6 +46,10 @@ struct TrackerMinerManagerClass {
const gchar *miner_name,
const gchar *status,
gdouble progress);
+ void (* miner_paused) (TrackerMinerManager *manager,
+ const gchar *miner_name);
+ void (* miner_resumed) (TrackerMinerManager *manager,
+ const gchar *miner_name);
};
GType tracker_miner_manager_get_type (void) G_GNUC_CONST;
@@ -55,6 +59,7 @@ TrackerMinerManager * tracker_miner_manager_new (void);
GSList *tracker_miner_manager_get_running (TrackerMinerManager *manager);
GSList *tracker_miner_manager_get_available (TrackerMinerManager *manager);
+
G_END_DECLS
#endif /* __LIBTRACKERMINER_MANAGER_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]