[tracker/libtracker-miner] TrackerMinerDiscover: renamed to TrackerMinerManager.
- From: Carlos Garnacho <carlosg src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker/libtracker-miner] TrackerMinerDiscover: renamed to TrackerMinerManager.
- Date: Fri, 4 Sep 2009 11:46:15 +0000 (UTC)
commit faf4ad78f5d98b7d2839851fa1fbbe90228e459e
Author: Carlos Garnacho <carlos lanedo com>
Date: Fri Sep 4 13:19:58 2009 +0200
TrackerMinerDiscover: renamed to TrackerMinerManager.
It will include functions for pausing/resuming, plus signals about its state.
src/libtracker-miner/Makefile.am | 4 +-
src/libtracker-miner/tracker-miner-discover.h | 60 ------------------
...er-miner-discover.c => tracker-miner-manager.c} | 64 ++++++++++----------
src/libtracker-miner/tracker-miner-manager.h | 60 ++++++++++++++++++
src/tracker-applet/tracker-status-icon.c | 32 +++++-----
src/tracker-utils/tracker-status.c | 24 ++++----
6 files changed, 122 insertions(+), 122 deletions(-)
---
diff --git a/src/libtracker-miner/Makefile.am b/src/libtracker-miner/Makefile.am
index df64dca..5a65bab 100644
--- a/src/libtracker-miner/Makefile.am
+++ b/src/libtracker-miner/Makefile.am
@@ -32,10 +32,10 @@ libtracker_miner_la_SOURCES = \
tracker-miner.c \
tracker-miner.h \
tracker-miner-dbus.h \
- tracker-miner-discover.c \
- tracker-miner-discover.h \
tracker-miner-fs.c \
tracker-miner-fs.h \
+ tracker-miner-manager.c \
+ tracker-miner-manager.h \
tracker-monitor.c \
tracker-monitor.h \
tracker-utils.c \
diff --git a/src/libtracker-miner/tracker-miner-discover.c b/src/libtracker-miner/tracker-miner-manager.c
similarity index 75%
rename from src/libtracker-miner/tracker-miner-discover.c
rename to src/libtracker-miner/tracker-miner-manager.c
index a9b0c79..61c0b3f 100644
--- a/src/libtracker-miner/tracker-miner-discover.c
+++ b/src/libtracker-miner/tracker-miner-manager.c
@@ -25,23 +25,23 @@
#include "tracker-crawler.h"
#include "tracker-miner.h"
-#include "tracker-miner-discover.h"
+#include "tracker-miner-manager.h"
#include "tracker-marshal.h"
-#define TRACKER_MINER_DISCOVER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TRACKER_TYPE_MINER_DISCOVER, TrackerMinerDiscoverPrivate))
+#define TRACKER_MINER_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TRACKER_TYPE_MINER_MANAGER, TrackerMinerManagerPrivate))
-typedef struct TrackerMinerDiscoverPrivate TrackerMinerDiscoverPrivate;
+typedef struct TrackerMinerManagerPrivate TrackerMinerManagerPrivate;
-struct TrackerMinerDiscoverPrivate {
+struct TrackerMinerManagerPrivate {
DBusGConnection *connection;
DBusGProxy *proxy;
GHashTable *miner_proxies;
};
-static void miner_discover_finalize (GObject *object);
+static void miner_manager_finalize (GObject *object);
-G_DEFINE_TYPE (TrackerMinerDiscover, tracker_miner_discover, G_TYPE_OBJECT)
+G_DEFINE_TYPE (TrackerMinerManager, tracker_miner_manager, G_TYPE_OBJECT)
enum {
MINER_PROGRESS,
@@ -51,17 +51,17 @@ enum {
static guint signals [LAST_SIGNAL] = { 0 };
static void
-tracker_miner_discover_class_init (TrackerMinerDiscoverClass *klass)
+tracker_miner_manager_class_init (TrackerMinerManagerClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = miner_discover_finalize;
+ object_class->finalize = miner_manager_finalize;
signals [MINER_PROGRESS] =
g_signal_new ("miner-progress",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (TrackerMinerDiscoverClass, miner_progress),
+ G_STRUCT_OFFSET (TrackerMinerManagerClass, miner_progress),
NULL, NULL,
tracker_marshal_VOID__STRING_STRING_DOUBLE,
G_TYPE_NONE, 3,
@@ -69,7 +69,7 @@ tracker_miner_discover_class_init (TrackerMinerDiscoverClass *klass)
G_TYPE_STRING,
G_TYPE_DOUBLE);
- g_type_class_add_private (object_class, sizeof (TrackerMinerDiscoverPrivate));
+ g_type_class_add_private (object_class, sizeof (TrackerMinerManagerPrivate));
}
static void
@@ -78,25 +78,25 @@ miner_progress_changed (DBusGProxy *proxy,
gdouble progress,
gpointer user_data)
{
- TrackerMinerDiscover *discover = user_data;
- TrackerMinerDiscoverPrivate *priv;
+ TrackerMinerManager *manager = user_data;
+ TrackerMinerManagerPrivate *priv;
const gchar *name;
- discover = user_data;
- priv = TRACKER_MINER_DISCOVER_GET_PRIVATE (discover);
+ manager = user_data;
+ priv = TRACKER_MINER_MANAGER_GET_PRIVATE (manager);
name = g_hash_table_lookup (priv->miner_proxies, proxy);
- g_signal_emit (discover, signals[MINER_PROGRESS], 0, name, status, progress);
+ g_signal_emit (manager, signals[MINER_PROGRESS], 0, name, status, progress);
}
static void
-tracker_miner_discover_init (TrackerMinerDiscover *discover)
+tracker_miner_manager_init (TrackerMinerManager *manager)
{
- TrackerMinerDiscoverPrivate *priv;
+ TrackerMinerManagerPrivate *priv;
GError *error = NULL;
GSList *miners, *m;
- priv = TRACKER_MINER_DISCOVER_GET_PRIVATE (discover);
+ priv = TRACKER_MINER_MANAGER_GET_PRIVATE (manager);
priv->connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
@@ -125,7 +125,7 @@ tracker_miner_discover_init (TrackerMinerDiscover *discover)
G_TYPE_DOUBLE,
G_TYPE_INVALID);
- miners = tracker_miner_discover_get_available (discover);
+ miners = tracker_miner_manager_get_available (manager);
for (m = miners; m; m = m->next) {
DBusGProxy *proxy;
@@ -147,18 +147,18 @@ tracker_miner_discover_init (TrackerMinerDiscover *discover)
dbus_g_proxy_connect_signal (proxy,
"Progress",
G_CALLBACK (miner_progress_changed),
- discover, NULL);
+ manager, NULL);
g_hash_table_insert (priv->miner_proxies, proxy, g_strdup (m->data));
}
}
static void
-miner_discover_finalize (GObject *object)
+miner_manager_finalize (GObject *object)
{
- TrackerMinerDiscoverPrivate *priv;
+ TrackerMinerManagerPrivate *priv;
- priv = TRACKER_MINER_DISCOVER_GET_PRIVATE (object);
+ priv = TRACKER_MINER_MANAGER_GET_PRIVATE (object);
if (priv->proxy) {
g_object_unref (priv->proxy);
@@ -168,26 +168,26 @@ miner_discover_finalize (GObject *object)
dbus_g_connection_unref (priv->connection);
}
- G_OBJECT_CLASS (tracker_miner_discover_parent_class)->finalize (object);
+ G_OBJECT_CLASS (tracker_miner_manager_parent_class)->finalize (object);
}
-TrackerMinerDiscover *
-tracker_miner_discover_new (void)
+TrackerMinerManager *
+tracker_miner_manager_new (void)
{
- return g_object_new (TRACKER_TYPE_MINER_DISCOVER, NULL);
+ return g_object_new (TRACKER_TYPE_MINER_MANAGER, NULL);
}
GSList *
-tracker_miner_discover_get_running (TrackerMinerDiscover *discover)
+tracker_miner_manager_get_running (TrackerMinerManager *manager)
{
- TrackerMinerDiscoverPrivate *priv;
+ TrackerMinerManagerPrivate *priv;
GSList *list = NULL;
GError *error = NULL;
gchar **p, **result;
- g_return_val_if_fail (TRACKER_IS_MINER_DISCOVER (discover), NULL);
+ g_return_val_if_fail (TRACKER_IS_MINER_MANAGER (manager), NULL);
- priv = TRACKER_MINER_DISCOVER_GET_PRIVATE (discover);
+ priv = TRACKER_MINER_MANAGER_GET_PRIVATE (manager);
if (!priv->connection || !priv->proxy) {
return NULL;
@@ -263,7 +263,7 @@ crawler_finished_cb (TrackerCrawler *crawler,
}
GSList *
-tracker_miner_discover_get_available (TrackerMinerDiscover *discover)
+tracker_miner_manager_get_available (TrackerMinerManager *manager)
{
GSList *list = NULL;
GMainLoop *main_loop;
diff --git a/src/libtracker-miner/tracker-miner-manager.h b/src/libtracker-miner/tracker-miner-manager.h
new file mode 100644
index 0000000..74bf026
--- /dev/null
+++ b/src/libtracker-miner/tracker-miner-manager.h
@@ -0,0 +1,60 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2009, Nokia (urho konttori nokia com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __LIBTRACKERMINER_MANAGER_H__
+#define __LIBTRACKERMINER_MANAGER_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define TRACKER_TYPE_MINER_MANAGER (tracker_miner_manager_get_type())
+#define TRACKER_MINER_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TRACKER_TYPE_MINER_MANAGER, TrackerMinerManager))
+#define TRACKER_MINER_MANAGER_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), TRACKER_TYPE_MINER_MANAGER, TrackerMinerManagerClass))
+#define TRACKER_IS_MINER_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TRACKER_TYPE_MINER_MANAGER))
+#define TRACKER_IS_MINER_MANAGER_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), TRACKER_TYPE_MINER_MANAGER))
+#define TRACKER_MINER_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TRACKER_TYPE_MINER_MANAGER, TrackerMinerManagerClass))
+
+typedef struct TrackerMinerManager TrackerMinerManager;
+typedef struct TrackerMinerManagerClass TrackerMinerManagerClass;
+
+struct TrackerMinerManager {
+ GObject parent_instance;
+};
+
+struct TrackerMinerManagerClass {
+ GObjectClass parent_class;
+
+ void (* miner_progress) (TrackerMinerManager *manager,
+ const gchar *miner_name,
+ const gchar *status,
+ gdouble progress);
+};
+
+GType tracker_miner_manager_get_type (void) G_GNUC_CONST;
+
+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__ */
diff --git a/src/tracker-applet/tracker-status-icon.c b/src/tracker-applet/tracker-status-icon.c
index f46591a..1854046 100644
--- a/src/tracker-applet/tracker-status-icon.c
+++ b/src/tracker-applet/tracker-status-icon.c
@@ -20,7 +20,7 @@
#include "config.h"
#include "tracker-status-icon.h"
-#include <libtracker-miner/tracker-miner-discover.h>
+#include <libtracker-miner/tracker-miner-manager.h>
#include <string.h>
#include <locale.h>
#include <glib/gi18n.h>
@@ -50,7 +50,7 @@ struct TrackerStatusIconPrivate {
TrackerStatus current_status;
guint animation_id;
- TrackerMinerDiscover *discover;
+ TrackerMinerManager *manager;
GtkWidget *miner_menu;
GtkWidget *context_menu;
GtkSizeGroup *size_group;
@@ -73,11 +73,11 @@ static void status_icon_popup_menu (GtkStatusIcon *icon,
guint button,
guint32 activate_time);
-static void status_icon_miner_progress (TrackerMinerDiscover *discover,
- const gchar *miner_name,
- const gchar *status,
- gdouble progress,
- gpointer user_data);
+static void status_icon_miner_progress (TrackerMinerManager *manager,
+ const gchar *miner_name,
+ const gchar *status,
+ gdouble progress,
+ gpointer user_data);
static void status_icon_initialize_miners_menu (TrackerStatusIcon *icon);
static GtkWidget * status_icon_create_context_menu (TrackerStatusIcon *icon);
@@ -138,8 +138,8 @@ tracker_status_icon_init (TrackerStatusIcon *icon)
priv->context_menu = status_icon_create_context_menu (icon);
priv->size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
- priv->discover = tracker_miner_discover_new ();
- g_signal_connect (priv->discover, "miner-progress",
+ priv->manager = tracker_miner_manager_new ();
+ g_signal_connect (priv->manager, "miner-progress",
G_CALLBACK (status_icon_miner_progress), icon);
status_icon_initialize_miners_menu (icon);
}
@@ -174,7 +174,7 @@ status_icon_finalize (GObject *object)
priv->animation_id = 0;
}
- g_object_unref (priv->discover);
+ g_object_unref (priv->manager);
g_object_unref (priv->size_group);
G_OBJECT_CLASS (tracker_status_icon_parent_class)->finalize (object);
@@ -210,11 +210,11 @@ status_icon_popup_menu (GtkStatusIcon *icon,
}
static void
-status_icon_miner_progress (TrackerMinerDiscover *discover,
- const gchar *miner_name,
- const gchar *status,
- gdouble progress,
- gpointer user_data)
+status_icon_miner_progress (TrackerMinerManager *manager,
+ const gchar *miner_name,
+ const gchar *status,
+ gdouble progress,
+ gpointer user_data)
{
TrackerStatusIconPrivate *priv;
TrackerStatusIcon *icon;
@@ -298,7 +298,7 @@ status_icon_initialize_miners_menu (TrackerStatusIcon *icon)
priv = TRACKER_STATUS_ICON_GET_PRIVATE (icon);
- miners = tracker_miner_discover_get_available (priv->discover);
+ miners = tracker_miner_manager_get_available (priv->manager);
for (m = miners; m; m = m->next) {
miner_menu_entry_add (icon, (const gchar *) m->data);
diff --git a/src/tracker-utils/tracker-status.c b/src/tracker-utils/tracker-status.c
index a92cf42..7fb6b98 100644
--- a/src/tracker-utils/tracker-status.c
+++ b/src/tracker-utils/tracker-status.c
@@ -34,7 +34,7 @@
#include <libtracker-common/tracker-type-utils.h>
#include <libtracker-miner/tracker-miner.h>
-#include <libtracker-miner/tracker-miner-discover.h>
+#include <libtracker-miner/tracker-miner-manager.h>
#include "tracker-miner-client.h"
@@ -401,10 +401,10 @@ miner_get_details (const gchar *miner,
}
static void
-discover_miner_progress_cb (TrackerMinerDiscover *discover,
- const gchar *miner_name,
- const gchar *status,
- gdouble progress)
+miner_manager_progress_cb (TrackerMinerManager *manager,
+ const gchar *miner_name,
+ const gchar *status,
+ gdouble progress)
{
miner_name += strlen (TRACKER_MINER_DBUS_NAME_PREFIX);
progress *= 100;
@@ -418,7 +418,7 @@ discover_miner_progress_cb (TrackerMinerDiscover *discover,
gint
main (gint argc, gchar *argv[])
{
- TrackerMinerDiscover *discover;
+ TrackerMinerManager *manager;
GOptionContext *context;
TrackerClient *client;
GSList *miners_available;
@@ -490,9 +490,9 @@ main (gint argc, gchar *argv[])
return EXIT_SUCCESS;
}
- discover = tracker_miner_discover_new ();
- miners_available = tracker_miner_discover_get_available (discover);
- miners_running = tracker_miner_discover_get_running (discover);
+ manager = tracker_miner_manager_new ();
+ miners_available = tracker_miner_manager_get_available (manager);
+ miners_running = tracker_miner_manager_get_running (manager);
if (list_miners_available) {
gchar *str;
@@ -678,8 +678,8 @@ main (gint argc, gchar *argv[])
g_print ("Press Ctrl+C to end follow of Tracker state\n");
- g_signal_connect (discover, "miner-progress",
- G_CALLBACK (discover_miner_progress_cb), NULL);
+ g_signal_connect (manager, "miner-progress",
+ G_CALLBACK (miner_manager_progress_cb), NULL);
initialize_signal_handler ();
@@ -688,7 +688,7 @@ main (gint argc, gchar *argv[])
g_main_loop_unref (main_loop);
tracker_disconnect (client);
- g_object_unref (discover);
+ g_object_unref (manager);
return EXIT_SUCCESS;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]