[tracker] tracker-store: Changed tracker-daemon to tracker-statistics
- From: Martyn James Russell <mr src gnome org>
- To: svn-commits-list gnome org
- Subject: [tracker] tracker-store: Changed tracker-daemon to tracker-statistics
- Date: Mon, 6 Jul 2009 16:27:35 +0000 (UTC)
commit e2957fa36aaf84492c28a3800201a77823d49bd5
Author: Martyn Russell <martyn imendio com>
Date: Mon Jul 6 15:57:30 2009 +0100
tracker-store: Changed tracker-daemon to tracker-statistics
This also deprecates a lot of the useless daemon DBus API which was
unused or completely pointless.
data/dbus/Makefile.am | 4 +-
.../{tracker-daemon.xml => tracker-statistics.xml} | 6 +-
src/libtracker/Makefile.am | 18 +-
src/libtracker/tracker.c | 435 +++++++++++---------
src/libtracker/tracker.h | 153 ++++----
src/tracker-applet/tracker-applet.c | 162 ++++----
src/tracker-store/Makefile.am | 6 +-
src/tracker-store/tracker-daemon.h | 64 ---
src/tracker-store/tracker-dbus.c | 12 +-
src/tracker-store/tracker-main.c | 7 +-
.../{tracker-daemon.c => tracker-statistics.c} | 142 +++----
src/tracker-store/tracker-statistics.h | 62 +++
src/tracker-utils/tracker-stats.c | 2 +-
src/tracker-utils/tracker-status.c | 2 +-
14 files changed, 563 insertions(+), 512 deletions(-)
---
diff --git a/data/dbus/Makefile.am b/data/dbus/Makefile.am
index 7aabdd2..5712c65 100644
--- a/data/dbus/Makefile.am
+++ b/data/dbus/Makefile.am
@@ -4,12 +4,12 @@ configdir = $(datadir)/tracker
config_DATA = \
tracker-backup.xml \
- tracker-daemon.xml \
tracker-extract.xml \
tracker-miner.xml \
tracker-resources.xml \
tracker-resources-class.xml \
- tracker-search.xml
+ tracker-search.xml \
+ tracker-statistics.xml
# Services
servicedir = $(DBUS_SERVICES_DIR)
diff --git a/data/dbus/tracker-daemon.xml b/data/dbus/tracker-statistics.xml
similarity index 92%
rename from data/dbus/tracker-daemon.xml
rename to data/dbus/tracker-statistics.xml
index 9bc7aea..30f9df8 100644
--- a/data/dbus/tracker-daemon.xml
+++ b/data/dbus/tracker-statistics.xml
@@ -17,12 +17,12 @@
-->
<node name="/">
- <interface name="org.freedesktop.Tracker">
+ <interface name="org.freedesktop.Tracker.Statistics">
<!-- Get statistics for services that have been indexed. Output is
in string array format: [service, no of entities]
-->
- <method name="GetStats">
+ <method name="Get">
<annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
<annotation name="com.trolltech.QtDBus.QtTypeName.Out0"
value="QVector<QStringList>"/>
@@ -32,7 +32,7 @@
<!-- Signal whenever the count of a category changed. Look at GetStats for
the format of service_stats.
-->
- <signal name="StatisticsUpdated">
+ <signal name="Updated">
<arg type="aas" name="statistics"/>
</signal>
</interface>
diff --git a/src/libtracker/Makefile.am b/src/libtracker/Makefile.am
index 2dd1606..e6645b2 100644
--- a/src/libtracker/Makefile.am
+++ b/src/libtracker/Makefile.am
@@ -15,23 +15,23 @@ libtrackerclientincdir = $(includedir)/tracker-$(TRACKER_API_VERSION)
libtrackerclient_ TRACKER_API_VERSION@_la_SOURCES = tracker.c
-libtrackerclient_ TRACKER_API_VERSION@_la_LDFLAGS = \
+libtrackerclient_ TRACKER_API_VERSION@_la_LDFLAGS = \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
-libtrackerclient_ TRACKER_API_VERSION@_la_LIBADD = \
- $(GLIB2_LIBS) \
- $(DBUS_LIBS) \
- $(GCOV_LIBS) \
+libtrackerclient_ TRACKER_API_VERSION@_la_LIBADD = \
+ $(GLIB2_LIBS) \
+ $(DBUS_LIBS) \
+ $(GCOV_LIBS) \
$(GOBJECT_LIBS)
libtrackerclientinc_HEADERS = \
tracker.h
# Generate DBus files from XML data.
-dbus_sources = \
- tracker-daemon-glue.h \
- tracker-resources-glue.h \
- tracker-search-glue.h
+dbus_sources = \
+ tracker-resources-glue.h \
+ tracker-search-glue.h \
+ tracker-statistics-glue.h
%-glue.h: $(top_srcdir)/data/dbus/%.xml
$(DBUSBINDINGTOOL) --mode=glib-client --output=$@ --prefix=$(subst -,_,$*) $^
diff --git a/src/libtracker/tracker.c b/src/libtracker/tracker.c
index 82c5116..bd7d06c 100644
--- a/src/libtracker/tracker.c
+++ b/src/libtracker/tracker.c
@@ -23,90 +23,84 @@
#include "tracker.h"
-#include "tracker-daemon-glue.h"
#include "tracker-resources-glue.h"
#include "tracker-search-glue.h"
+#include "tracker-statistics-glue.h"
#define TRACKER_SERVICE "org.freedesktop.Tracker"
#define TRACKER_OBJECT "/org/freedesktop/Tracker"
-#define TRACKER_INTERFACE "org.freedesktop.Tracker"
#define TRACKER_INTERFACE_RESOURCES "org.freedesktop.Tracker.Resources"
#define TRACKER_INTERFACE_SEARCH "org.freedesktop.Tracker.Search"
+#define TRACKER_INTERFACE_STATISTICS "org.freedesktop.Tracker.Statistics"
typedef struct {
- TrackerArrayReply callback;
- gpointer data;
-} ArrayCallBackStruct;
+ TrackerReplyGPtrArray callback;
+ gpointer data;
+} CallbackGPtrArray;
typedef struct {
- TrackerGPtrArrayReply callback;
- gpointer data;
-} GPtrArrayCallBackStruct;
+ TrackerReplyString callback;
+ gpointer data;
+} CallbackString;
typedef struct {
- TrackerBooleanReply callback;
- gpointer data;
-} BooleanCallBackStruct;
-
-typedef struct {
- TrackerStringReply callback;
- gpointer data;
-} StringCallBackStruct;
-
-typedef struct {
- TrackerIntReply callback;
- gpointer data;
-} IntCallBackStruct;
-
-typedef struct {
- TrackerVoidReply callback;
- gpointer data;
-} VoidCallBackStruct;
-
+ TrackerReplyVoid callback;
+ gpointer data;
+} CallbackVoid;
static void
-tracker_GPtrArray_reply (DBusGProxy *proxy, GPtrArray *OUT_result, GError *error, gpointer user_data)
+tracker_GPtrArray_reply (DBusGProxy *proxy,
+ GPtrArray *OUT_result,
+ GError *error,
+ gpointer user_data)
{
- GPtrArrayCallBackStruct *callback_struct;
+ CallbackGPtrArray *s;
- callback_struct = user_data;
+ s = user_data;
- (*(TrackerGPtrArrayReply) callback_struct->callback ) (OUT_result, error, callback_struct->data);
+ (*(TrackerReplyGPtrArray) s->callback) (OUT_result,
+ error,
+ s->data);
- g_free (callback_struct);
+ g_free (s);
}
-
-
static void
-tracker_string_reply (DBusGProxy *proxy, gchar *OUT_result, GError *error, gpointer user_data)
+tracker_string_reply (DBusGProxy *proxy,
+ gchar *OUT_result,
+ GError *error,
+ gpointer user_data)
{
- StringCallBackStruct *callback_struct;
+ CallbackString *s;
- callback_struct = user_data;
+ s = user_data;
- (*(TrackerStringReply) callback_struct->callback ) (OUT_result, error, callback_struct->data);
+ (*(TrackerReplyString) s->callback) (OUT_result,
+ error,
+ s->data);
- g_free (callback_struct);
+ g_free (s);
}
static void
-tracker_void_reply (DBusGProxy *proxy, GError *error, gpointer user_data)
+tracker_void_reply (DBusGProxy *proxy,
+ GError *error,
+ gpointer user_data)
{
- VoidCallBackStruct *callback_struct;
+ CallbackVoid *s;
- callback_struct = user_data;
+ s = user_data;
- (*(TrackerVoidReply) callback_struct->callback ) (error, callback_struct->data);
+ (*(TrackerReplyVoid) s->callback) (error,
+ s->data);
- g_free (callback_struct);
+ g_free (s);
}
-
-/* copied from tracker-module-metadata.c */
+/* Copied from tracker-module-metadata.c */
gchar *
tracker_sparql_escape (const gchar *str)
{
@@ -159,7 +153,6 @@ tracker_sparql_escape (const gchar *str)
return escaped_string;
}
-
TrackerClient *
tracker_connect (gboolean enable_warnings)
{
@@ -180,11 +173,6 @@ tracker_connect (gboolean enable_warnings)
return NULL;
}
- proxy = dbus_g_proxy_new_for_name (connection,
- TRACKER_SERVICE,
- TRACKER_OBJECT,
- TRACKER_INTERFACE);
-
if (!proxy) {
if (enable_warnings) {
g_warning ("could not create proxy");
@@ -192,242 +180,321 @@ tracker_connect (gboolean enable_warnings)
return NULL;
}
+ client = g_new0 (TrackerClient, 1);
- client = g_new (TrackerClient, 1);
- client->proxy = proxy;
-
- proxy = dbus_g_proxy_new_for_name (connection,
- TRACKER_SERVICE,
- TRACKER_OBJECT "/Search",
- TRACKER_INTERFACE_SEARCH);
-
- client->proxy_search = proxy;
-
- proxy = dbus_g_proxy_new_for_name (connection,
- TRACKER_SERVICE,
- TRACKER_OBJECT "/Resources",
- TRACKER_INTERFACE_RESOURCES);
-
- client->proxy_resources = proxy;
+ client->proxy_search =
+ dbus_g_proxy_new_for_name (connection,
+ TRACKER_SERVICE,
+ TRACKER_OBJECT "/Search",
+ TRACKER_INTERFACE_SEARCH);
+ client->proxy_statistics =
+ dbus_g_proxy_new_for_name (connection,
+ TRACKER_SERVICE,
+ TRACKER_OBJECT "/Statistics",
+ TRACKER_INTERFACE_STATISTICS);
+ client->proxy_resources =
+ dbus_g_proxy_new_for_name (connection,
+ TRACKER_SERVICE,
+ TRACKER_OBJECT "/Resources",
+ TRACKER_INTERFACE_RESOURCES);
return client;
-
}
void
tracker_disconnect (TrackerClient *client)
{
- g_object_unref (client->proxy);
- g_object_unref (client->proxy_search);
- g_object_unref (client->proxy_resources);
- client->proxy = NULL;
- client->proxy_search = NULL;
- client->proxy_resources = NULL;
+ if (client->proxy_search) {
+ g_object_unref (client->proxy_search);
+ }
- g_free (client);
-}
+ if (client->proxy_statistics) {
+ g_object_unref (client->proxy_statistics);
+ }
+ if (client->proxy_resources) {
+ g_object_unref (client->proxy_resources);
+ }
+ g_free (client);
+}
void
tracker_cancel_last_call (TrackerClient *client)
{
- dbus_g_proxy_cancel_call (client->proxy, client->last_pending_call);
+
+ dbus_g_proxy_cancel_call (client->pending_proxy,
+ client->pending_call);
}
-
-
/* dbus synchronous calls */
GPtrArray *
-tracker_get_stats (TrackerClient *client, GError **error)
+tracker_statistics_get (TrackerClient *client,
+ GError **error)
{
GPtrArray *table;
- if (!org_freedesktop_Tracker_get_stats (client->proxy, &table, &*error)) {
+ if (!org_freedesktop_Tracker_Statistics_get (client->proxy_statistics,
+ &table,
+ &*error)) {
return NULL;
}
return table;
-
-
}
void
-tracker_resources_load (TrackerClient *client, const char *uri, GError **error)
+tracker_resources_load (TrackerClient *client,
+ const gchar *uri,
+ GError **error)
{
- org_freedesktop_Tracker_Resources_load (client->proxy_resources, uri, &*error);
+ org_freedesktop_Tracker_Resources_load (client->proxy_resources,
+ uri,
+ &*error);
}
-
GPtrArray *
-tracker_resources_sparql_query (TrackerClient *client, const char *query, GError **error)
+tracker_resources_sparql_query (TrackerClient *client,
+ const gchar *query,
+ GError **error)
{
GPtrArray *table;
- if (!org_freedesktop_Tracker_Resources_sparql_query (client->proxy_resources, query, &table, &*error)) {
+ if (!org_freedesktop_Tracker_Resources_sparql_query (client->proxy_resources,
+ query,
+ &table,
+ &*error)) {
return NULL;
}
return table;
}
-
void
-tracker_resources_sparql_update (TrackerClient *client, const char *query, GError **error)
+tracker_resources_sparql_update (TrackerClient *client,
+ const gchar *query,
+ GError **error)
{
- org_freedesktop_Tracker_Resources_sparql_update (client->proxy_resources, query, &*error);
+ org_freedesktop_Tracker_Resources_sparql_update (client->proxy_resources,
+ query,
+ &*error);
}
-
void
-tracker_resources_batch_sparql_update (TrackerClient *client, const char *query, GError **error)
+tracker_resources_batch_sparql_update (TrackerClient *client,
+ const gchar *query,
+ GError **error)
{
- org_freedesktop_Tracker_Resources_batch_sparql_update (client->proxy_resources, query, &*error);
+ org_freedesktop_Tracker_Resources_batch_sparql_update (client->proxy_resources,
+ query,
+ &*error);
}
-
void
-tracker_resources_batch_commit (TrackerClient *client, GError **error)
+tracker_resources_batch_commit (TrackerClient *client,
+ GError **error)
{
- org_freedesktop_Tracker_Resources_batch_commit (client->proxy_resources, &*error);
+ org_freedesktop_Tracker_Resources_batch_commit (client->proxy_resources,
+ &*error);
}
-char *
-tracker_search_get_snippet (TrackerClient *client, const char *uri, const char *search_text, GError **error)
+gchar *
+tracker_search_get_snippet (TrackerClient *client,
+ const gchar *uri,
+ const gchar *search_text,
+ GError **error)
{
- char *result;
+ gchar *result;
- if (!org_freedesktop_Tracker_Search_get_snippet (client->proxy_search, uri, search_text, &result, &*error)) {
+ if (!org_freedesktop_Tracker_Search_get_snippet (client->proxy_search,
+ uri,
+ search_text,
+ &result,
+ &*error)) {
return NULL;
}
return result;
-
-
}
-
-char *
-tracker_search_suggest (TrackerClient *client, const char *search_term, int maxdist, GError **error)
+gchar *
+tracker_search_suggest (TrackerClient *client,
+ const gchar *search_term,
+ gint maxdist,
+ GError **error)
{
gchar *result;
- if (org_freedesktop_Tracker_Search_suggest (client->proxy_search, search_term, maxdist, &result, &*error)) {
+
+ if (org_freedesktop_Tracker_Search_suggest (client->proxy_search,
+ search_term,
+ maxdist,
+ &result,
+ &*error)) {
return result;
}
+
return NULL;
}
void
-tracker_get_stats_async (TrackerClient *client, TrackerGPtrArrayReply callback, gpointer user_data)
+tracker_statistics_get_async (TrackerClient *client,
+ TrackerReplyGPtrArray callback,
+ gpointer user_data)
{
- GPtrArrayCallBackStruct *callback_struct;
+ CallbackGPtrArray *s;
- callback_struct = g_new (GPtrArrayCallBackStruct, 1);
- callback_struct->callback = callback;
- callback_struct->data = user_data;
-
- client->last_pending_call = org_freedesktop_Tracker_get_stats_async (client->proxy, tracker_GPtrArray_reply, callback_struct);
+ s = g_new0 (CallbackGPtrArray, 1);
+ s->callback = callback;
+ s->data = user_data;
+ client->pending_proxy = client->proxy_statistics;
+ client->pending_call =
+ org_freedesktop_Tracker_Statistics_get_async (client->proxy_statistics,
+ tracker_GPtrArray_reply,
+ s);
}
void
-tracker_resources_load_async (TrackerClient *client, const char *uri, TrackerVoidReply callback, gpointer user_data)
+tracker_resources_load_async (TrackerClient *client,
+ const gchar *uri,
+ TrackerReplyVoid callback,
+ gpointer user_data)
{
- VoidCallBackStruct *callback_struct;
-
- callback_struct = g_new (VoidCallBackStruct, 1);
- callback_struct->callback = callback;
- callback_struct->data = user_data;
-
- client->last_pending_call = org_freedesktop_Tracker_Resources_load_async (client->proxy_resources, uri, tracker_void_reply, callback_struct);
-
+ CallbackVoid *s;
+
+ s = g_new0 (CallbackVoid, 1);
+ s->callback = callback;
+ s->data = user_data;
+
+ client->pending_proxy = client->proxy_resources;
+ client->pending_call =
+ org_freedesktop_Tracker_Resources_load_async (client->proxy_resources,
+ uri,
+ tracker_void_reply,
+ s);
}
-
void
-tracker_resources_sparql_query_async (TrackerClient *client, const char *query, TrackerGPtrArrayReply callback, gpointer user_data)
+tracker_resources_sparql_query_async (TrackerClient *client,
+ const gchar *query,
+ TrackerReplyGPtrArray callback,
+ gpointer user_data)
{
- GPtrArrayCallBackStruct *callback_struct;
-
- callback_struct = g_new (GPtrArrayCallBackStruct, 1);
- callback_struct->callback = callback;
- callback_struct->data = user_data;
-
- client->last_pending_call = org_freedesktop_Tracker_Resources_sparql_query_async (client->proxy_resources, query, tracker_GPtrArray_reply, callback_struct);
-
+ CallbackGPtrArray *s;
+
+ s = g_new0 (CallbackGPtrArray, 1);
+ s->callback = callback;
+ s->data = user_data;
+
+ client->pending_proxy = client->proxy_resources;
+ client->pending_call =
+ org_freedesktop_Tracker_Resources_sparql_query_async (client->proxy_resources,
+ query,
+ tracker_GPtrArray_reply,
+ s);
}
-
void
-tracker_resources_sparql_update_async (TrackerClient *client, const char *query, TrackerVoidReply callback, gpointer user_data)
+tracker_resources_sparql_update_async (TrackerClient *client,
+ const gchar *query,
+ TrackerReplyVoid callback,
+ gpointer user_data)
{
- VoidCallBackStruct *callback_struct;
-
- callback_struct = g_new (VoidCallBackStruct, 1);
- callback_struct->callback = callback;
- callback_struct->data = user_data;
-
- client->last_pending_call = org_freedesktop_Tracker_Resources_sparql_update_async (client->proxy_resources, query, tracker_void_reply, callback_struct);
-
+ CallbackVoid *s;
+
+ s = g_new0 (CallbackVoid, 1);
+ s->callback = callback;
+ s->data = user_data;
+
+ client->pending_proxy = client->proxy_resources;
+ client->pending_call =
+ org_freedesktop_Tracker_Resources_sparql_update_async (client->proxy_resources,
+ query,
+ tracker_void_reply,
+ s);
}
-
void
-tracker_resources_batch_sparql_update_async (TrackerClient *client, const char *query, TrackerVoidReply callback, gpointer user_data)
+tracker_resources_batch_sparql_update_async (TrackerClient *client,
+ const gchar *query,
+ TrackerReplyVoid callback,
+ gpointer user_data)
{
- VoidCallBackStruct *callback_struct;
-
- callback_struct = g_new (VoidCallBackStruct, 1);
- callback_struct->callback = callback;
- callback_struct->data = user_data;
-
- client->last_pending_call = org_freedesktop_Tracker_Resources_batch_sparql_update_async (client->proxy_resources, query, tracker_void_reply, callback_struct);
-
+ CallbackVoid *s;
+
+ s = g_new0 (CallbackVoid, 1);
+ s->callback = callback;
+ s->data = user_data;
+
+ client->pending_proxy = client->proxy_resources;
+ client->pending_call =
+ org_freedesktop_Tracker_Resources_batch_sparql_update_async (client->proxy_resources,
+ query,
+ tracker_void_reply,
+ s);
}
-
void
-tracker_resources_batch_commit_async (TrackerClient *client, TrackerVoidReply callback, gpointer user_data)
+tracker_resources_batch_commit_async (TrackerClient *client,
+ TrackerReplyVoid callback,
+ gpointer user_data)
{
- VoidCallBackStruct *callback_struct;
-
- callback_struct = g_new (VoidCallBackStruct, 1);
- callback_struct->callback = callback;
- callback_struct->data = user_data;
+ CallbackVoid *s;
- client->last_pending_call = org_freedesktop_Tracker_Resources_batch_commit_async (client->proxy_resources, tracker_void_reply, callback_struct);
+ s = g_new0 (CallbackVoid, 1);
+ s->callback = callback;
+ s->data = user_data;
+ client->pending_proxy = client->proxy_resources;
+ client->pending_call =
+ org_freedesktop_Tracker_Resources_batch_commit_async (client->proxy_resources,
+ tracker_void_reply,
+ s);
}
-
void
-tracker_search_get_snippet_async (TrackerClient *client, const char *uri, const char *search_text, TrackerStringReply callback, gpointer user_data)
+tracker_search_get_snippet_async (TrackerClient *client,
+ const gchar *uri,
+ const gchar *search_text,
+ TrackerReplyString callback,
+ gpointer user_data)
{
- StringCallBackStruct *callback_struct;
-
- callback_struct = g_new (StringCallBackStruct, 1);
- callback_struct->callback = callback;
- callback_struct->data = user_data;
-
- client->last_pending_call = org_freedesktop_Tracker_Search_get_snippet_async (client->proxy_search, uri, search_text, tracker_string_reply, callback_struct);
-
+ CallbackString *s;
+
+ s = g_new0 (CallbackString, 1);
+ s->callback = callback;
+ s->data = user_data;
+
+ client->pending_proxy = client->proxy_search;
+ client->pending_call =
+ org_freedesktop_Tracker_Search_get_snippet_async (client->proxy_search,
+ uri,
+ search_text,
+ tracker_string_reply,
+ s);
}
-
void
-tracker_search_suggest_async (TrackerClient *client, const char *search_text, int maxdist, TrackerStringReply callback, gpointer user_data)
+tracker_search_suggest_async (TrackerClient *client,
+ const gchar *search_text,
+ gint maxdist,
+ TrackerReplyString callback,
+ gpointer user_data)
{
-
- StringCallBackStruct *callback_struct;
-
- callback_struct = g_new (StringCallBackStruct, 1);
- callback_struct->callback = callback;
- callback_struct->data = user_data;
-
- client->last_pending_call = org_freedesktop_Tracker_Search_suggest_async (client->proxy_search, search_text, maxdist, tracker_string_reply, callback_struct);
-
+ CallbackString *s;
+
+ s = g_new0 (CallbackString, 1);
+ s->callback = callback;
+ s->data = user_data;
+
+ client->pending_proxy = client->proxy_search;
+ client->pending_call =
+ org_freedesktop_Tracker_Search_suggest_async (client->proxy_search,
+ search_text,
+ maxdist,
+ tracker_string_reply,
+ s);
}
-
diff --git a/src/libtracker/tracker.h b/src/libtracker/tracker.h
index c07c8f7..2092ee3 100644
--- a/src/libtracker/tracker.h
+++ b/src/libtracker/tracker.h
@@ -24,86 +24,89 @@
G_BEGIN_DECLS
-typedef void (*TrackerArrayReply) (gchar **result, GError *error, gpointer user_data);
-typedef void (*TrackerGPtrArrayReply) (GPtrArray *result, GError *error, gpointer user_data);
-typedef void (*TrackerBooleanReply) (gboolean result, GError *error, gpointer user_data);
-typedef void (*TrackerStringReply) (gchar *result, GError *error, gpointer user_data);
-typedef void (*TrackerIntReply) (gint result, GError *error, gpointer user_data);
-typedef void (*TrackerUIntReply) (guint result, GError *error, gpointer user_data);
-typedef void (*TrackerVoidReply) (GError *error, gpointer user_data);
-
-
-
-typedef struct {
- gchar * type;
- gboolean is_embedded;
- gboolean is_writeable;
-
-} MetaDataTypeDetails;
-
-
typedef struct {
- DBusGProxy *proxy;
- DBusGProxy *proxy_metadata;
DBusGProxy *proxy_search;
+ DBusGProxy *proxy_statistics;
DBusGProxy *proxy_resources;
- DBusGProxyCall *last_pending_call;
-} TrackerClient;
-
-
-void tracker_cancel_last_call (TrackerClient *client);
-
-gchar * tracker_sparql_escape (const gchar *str);
-
-/* you can make multiple connections with tracker_connect and free them with tracker_disconnect */
-TrackerClient * tracker_connect (gboolean enable_warnings);
-void tracker_disconnect (TrackerClient *client);
-
-
-/* synchronous calls */
-
-int tracker_get_version (TrackerClient *client, GError **error);
-guint tracker_get_status (TrackerClient *client, GError **error);
-GPtrArray * tracker_get_stats (TrackerClient *client, GError **error);
-
-void tracker_set_bool_option (TrackerClient *client, const char *option, gboolean value, GError **error);
-void tracker_set_int_option (TrackerClient *client, const char *option, int value, GError **error);
-void tracker_shutdown (TrackerClient *client, gboolean reindex, GError **error);
-void tracker_prompt_index_signals (TrackerClient *client, GError **error);
-
-void tracker_resources_load (TrackerClient *client, const char *uri, GError **error);
-GPtrArray * tracker_resources_sparql_query (TrackerClient *client, const char *query, GError **error);
-void tracker_resources_sparql_update (TrackerClient *client, const char *query, GError **error);
-void tracker_resources_batch_sparql_update (TrackerClient *client, const char *query, GError **error);
-void tracker_resources_batch_commit (TrackerClient *client, GError **error);
-
-
-char * tracker_search_get_snippet (TrackerClient *client, const char *uri, const char *search_text, GError **error);
-gchar * tracker_search_suggest (TrackerClient *client, const char *search_text, int maxdist, GError **error);
-
-
-/* asynchronous calls */
-
-
-void tracker_get_version_async (TrackerClient *client, TrackerIntReply callback, gpointer user_data);
-void tracker_get_status_async (TrackerClient *client, TrackerStringReply callback, gpointer user_data);
-void tracker_get_stats_async (TrackerClient *client, TrackerGPtrArrayReply callback, gpointer user_data);
-
-void tracker_set_bool_option_async (TrackerClient *client, const char *option, gboolean value, TrackerVoidReply callback, gpointer user_data);
-void tracker_set_int_option_async (TrackerClient *client, const char *option, int value, TrackerVoidReply callback, gpointer user_data);
-void tracker_shutdown_async (TrackerClient *client, gboolean reindex, TrackerVoidReply callback, gpointer user_data);
-void tracker_prompt_index_signals_async (TrackerClient *client, TrackerVoidReply callback, gpointer user_data);
-
-void tracker_resources_load_async (TrackerClient *client, const char *uri, TrackerVoidReply callback, gpointer user_data);
-void tracker_resources_sparql_query_async (TrackerClient *client, const char *query, TrackerGPtrArrayReply callback, gpointer user_data);
-void tracker_resources_sparql_update_async (TrackerClient *client, const char *query, TrackerVoidReply callback, gpointer user_data);
-void tracker_resources_batch_sparql_update_async (TrackerClient *client, const char *query, TrackerVoidReply callback, gpointer user_data);
-void tracker_resources_batch_commit_async (TrackerClient *client, TrackerVoidReply callback, gpointer user_data);
-
-void tracker_search_get_snippet_async (TrackerClient *client, const char *uri, const char *search_text, TrackerStringReply callback, gpointer user_data);
-void tracker_search_suggest_async (TrackerClient *client, const char *search_text, int maxdist, TrackerStringReply callback, gpointer user_data);
+ DBusGProxy *pending_proxy;
+ DBusGProxyCall *pending_call;
+} TrackerClient;
+typedef void (*TrackerReplyGPtrArray) (GPtrArray *result,
+ GError *error,
+ gpointer user_data);
+typedef void (*TrackerReplyString) (gchar *result,
+ GError *error,
+ gpointer user_data);
+typedef void (*TrackerReplyVoid) (GError *error,
+ gpointer user_data);
+
+void tracker_cancel_last_call (TrackerClient *client);
+
+gchar * tracker_sparql_escape (const gchar *str);
+
+TrackerClient *tracker_connect (gboolean enable_warnings);
+void tracker_disconnect (TrackerClient *client);
+
+/* Synchronous API */
+GPtrArray * tracker_statistics_get (TrackerClient *client,
+ GError **error);
+void tracker_resources_load (TrackerClient *client,
+ const gchar *uri,
+ GError **error);
+GPtrArray * tracker_resources_sparql_query (TrackerClient *client,
+ const gchar *query,
+ GError **error);
+void tracker_resources_sparql_update (TrackerClient *client,
+ const gchar *query,
+ GError **error);
+void tracker_resources_batch_sparql_update (TrackerClient *client,
+ const gchar *query,
+ GError **error);
+void tracker_resources_batch_commit (TrackerClient *client,
+ GError **error);
+gchar * tracker_search_get_snippet (TrackerClient *client,
+ const gchar *uri,
+ const gchar *search_text,
+ GError **error);
+gchar * tracker_search_suggest (TrackerClient *client,
+ const gchar *search_text,
+ gint maxdist,
+ GError **error);
+/* Asynchronous API */
+void tracker_statistics_get_async (TrackerClient *client,
+ TrackerReplyGPtrArray callback,
+ gpointer user_data);
+void tracker_resources_load_async (TrackerClient *client,
+ const gchar *uri,
+ TrackerReplyVoid callback,
+ gpointer user_data);
+void tracker_resources_sparql_query_async (TrackerClient *client,
+ const gchar *query,
+ TrackerReplyGPtrArray callback,
+ gpointer user_data);
+void tracker_resources_sparql_update_async (TrackerClient *client,
+ const gchar *query,
+ TrackerReplyVoid callback,
+ gpointer user_data);
+void tracker_resources_batch_sparql_update_async (TrackerClient *client,
+ const gchar *query,
+ TrackerReplyVoid callback,
+ gpointer user_data);
+void tracker_resources_batch_commit_async (TrackerClient *client,
+ TrackerReplyVoid callback,
+ gpointer user_data);
+void tracker_search_get_snippet_async (TrackerClient *client,
+ const gchar *uri,
+ const gchar *search_text,
+ TrackerReplyString callback,
+ gpointer user_data);
+void tracker_search_suggest_async (TrackerClient *client,
+ const gchar *search_text,
+ gint maxdist,
+ TrackerReplyString callback,
+ gpointer user_data);
G_END_DECLS
diff --git a/src/tracker-applet/tracker-applet.c b/src/tracker-applet/tracker-applet.c
index 3d692ea..9b2a518 100644
--- a/src/tracker-applet/tracker-applet.c
+++ b/src/tracker-applet/tracker-applet.c
@@ -521,12 +521,12 @@ auto_pause_timeout (gpointer data)
return FALSE;
}
- dbus_g_proxy_begin_call (priv->tracker->proxy,
- "PromptIndexSignals",
- NULL,
- NULL,
- NULL,
- G_TYPE_INVALID);
+ /* dbus_g_proxy_begin_call (priv->tracker->proxy, */
+ /* "PromptIndexSignals", */
+ /* NULL, */
+ /* NULL, */
+ /* NULL, */
+ /* G_TYPE_INVALID); */
return TRUE;
}
@@ -1078,13 +1078,13 @@ restart_tracker (GtkDialog *dialog,
priv = TRAY_ICON_GET_PRIVATE (icon);
priv->reindex = TRUE;
- dbus_g_proxy_begin_call (priv->tracker->proxy,
- "Shutdown",
- NULL,
- NULL,
- NULL,
- G_TYPE_BOOLEAN,
- TRUE, G_TYPE_INVALID);
+ /* dbus_g_proxy_begin_call (priv->tracker->proxy, */
+ /* "Shutdown", */
+ /* NULL, */
+ /* NULL, */
+ /* NULL, */
+ /* G_TYPE_BOOLEAN, */
+ /* TRUE, G_TYPE_INVALID); */
}
}
@@ -1218,9 +1218,9 @@ refresh_stats (TrayIcon *icon)
priv->stat_request_pending = TRUE;
- tracker_get_stats_async (priv->tracker,
- (TrackerGPtrArrayReply) update_stats,
- icon);
+ tracker_statistics_get_async (priv->tracker,
+ (TrackerReplyGPtrArray) update_stats,
+ icon);
}
static void
@@ -1887,68 +1887,68 @@ setup_dbus_connection (TrayIcon *icon)
G_TYPE_BOOLEAN,
G_TYPE_INVALID);
- dbus_g_proxy_add_signal (priv->tracker->proxy,
- "IndexStateChange",
- G_TYPE_STRING,
- G_TYPE_BOOLEAN,
- G_TYPE_BOOLEAN,
- G_TYPE_BOOLEAN,
- G_TYPE_BOOLEAN,
- G_TYPE_BOOLEAN,
- G_TYPE_BOOLEAN,
- G_TYPE_INVALID);
-
- dbus_g_proxy_add_signal (priv->tracker->proxy,
- "IndexProgress",
- G_TYPE_STRING,
- G_TYPE_STRING,
- G_TYPE_INT,
- G_TYPE_INT,
- G_TYPE_INT,
- G_TYPE_DOUBLE,
- G_TYPE_INVALID);
-
- dbus_g_proxy_add_signal (priv->tracker->proxy,
- "IndexFinished",
- G_TYPE_DOUBLE,
- G_TYPE_INVALID);
-
- dbus_g_proxy_add_signal (priv->tracker->proxy,
- "ServiceStatisticsUpdated",
+ /* dbus_g_proxy_add_signal (priv->tracker->proxy, */
+ /* "IndexStateChange", */
+ /* G_TYPE_STRING, */
+ /* G_TYPE_BOOLEAN, */
+ /* G_TYPE_BOOLEAN, */
+ /* G_TYPE_BOOLEAN, */
+ /* G_TYPE_BOOLEAN, */
+ /* G_TYPE_BOOLEAN, */
+ /* G_TYPE_BOOLEAN, */
+ /* G_TYPE_INVALID); */
+
+ /* dbus_g_proxy_add_signal (priv->tracker->proxy, */
+ /* "IndexProgress", */
+ /* G_TYPE_STRING, */
+ /* G_TYPE_STRING, */
+ /* G_TYPE_INT, */
+ /* G_TYPE_INT, */
+ /* G_TYPE_INT, */
+ /* G_TYPE_DOUBLE, */
+ /* G_TYPE_INVALID); */
+
+ /* dbus_g_proxy_add_signal (priv->tracker->proxy, */
+ /* "IndexFinished", */
+ /* G_TYPE_DOUBLE, */
+ /* G_TYPE_INVALID); */
+
+ dbus_g_proxy_add_signal (priv->tracker->proxy_statistics,
+ "Updated",
TRACKER_TYPE_G_STRV_ARRAY,
G_TYPE_INVALID);
- dbus_g_proxy_add_signal (priv->tracker->proxy,
- "IndexingError",
- G_TYPE_STRING,
- G_TYPE_BOOLEAN,
- G_TYPE_INVALID);
-
- dbus_g_proxy_connect_signal (priv->tracker->proxy,
- "IndexStateChange",
- G_CALLBACK (index_state_changed),
- icon,
- NULL);
-
- dbus_g_proxy_connect_signal (priv->tracker->proxy,
- "IndexProgress",
- G_CALLBACK (index_progress_changed),
- icon,
- NULL);
-
- dbus_g_proxy_connect_signal (priv->tracker->proxy,
- "IndexFinished",
- G_CALLBACK (index_finished),
- icon,
- NULL);
- dbus_g_proxy_connect_signal (priv->tracker->proxy,
- "IndexingError",
- G_CALLBACK (index_error),
- icon,
- NULL);
-
- dbus_g_proxy_connect_signal (priv->tracker->proxy,
- "ServiceStatisticsUpdated",
+ /* dbus_g_proxy_add_signal (priv->tracker->proxy, */
+ /* "IndexingError", */
+ /* G_TYPE_STRING, */
+ /* G_TYPE_BOOLEAN, */
+ /* G_TYPE_INVALID); */
+
+ /* dbus_g_proxy_connect_signal (priv->tracker->proxy, */
+ /* "IndexStateChange", */
+ /* G_CALLBACK (index_state_changed), */
+ /* icon, */
+ /* NULL); */
+
+ /* dbus_g_proxy_connect_signal (priv->tracker->proxy, */
+ /* "IndexProgress", */
+ /* G_CALLBACK (index_progress_changed), */
+ /* icon, */
+ /* NULL); */
+
+ /* dbus_g_proxy_connect_signal (priv->tracker->proxy, */
+ /* "IndexFinished", */
+ /* G_CALLBACK (index_finished), */
+ /* icon, */
+ /* NULL); */
+ /* dbus_g_proxy_connect_signal (priv->tracker->proxy, */
+ /* "IndexingError", */
+ /* G_CALLBACK (index_error), */
+ /* icon, */
+ /* NULL); */
+
+ dbus_g_proxy_connect_signal (priv->tracker->proxy_statistics,
+ "Updated",
G_CALLBACK (index_service_stats_updated),
icon,
NULL);
@@ -1971,12 +1971,12 @@ setup_dbus_connection (TrayIcon *icon)
icon, NULL);
/* Prompt for updated signals */
- dbus_g_proxy_begin_call (priv->tracker->proxy,
- "PromptIndexSignals",
- NULL,
- NULL,
- NULL,
- G_TYPE_INVALID);
+ /* dbus_g_proxy_begin_call (priv->tracker->proxy, */
+ /* "PromptIndexSignals", */
+ /* NULL, */
+ /* NULL, */
+ /* NULL, */
+ /* G_TYPE_INVALID); */
return FALSE;
}
diff --git a/src/tracker-store/Makefile.am b/src/tracker-store/Makefile.am
index 9c65d19..6b65012 100644
--- a/src/tracker-store/Makefile.am
+++ b/src/tracker-store/Makefile.am
@@ -29,8 +29,6 @@ libexec_PROGRAMS = tracker-store
tracker_store_SOURCES = \
tracker-backup.h \
tracker-backup.c \
- tracker-daemon.c \
- tracker-daemon.h \
tracker-dbus.c \
tracker-dbus.h \
tracker-events.c \
@@ -50,6 +48,8 @@ tracker_store_SOURCES = \
tracker-push-registrar.h \
tracker-resource-class.c \
tracker-resource-class.h \
+ tracker-statistics.c \
+ tracker-statistics.h \
tracker-store.c \
tracker-store.h
@@ -91,9 +91,9 @@ marshal_sources = \
dbus_sources = \
tracker-backup-glue.h \
- tracker-daemon-glue.h \
tracker-resources-glue.h \
tracker-search-glue.h \
+ tracker-statistics-glue.h \
tracker-resources-class-glue.h
%-glue.h: $(top_srcdir)/data/dbus/%.xml
diff --git a/src/tracker-store/tracker-dbus.c b/src/tracker-store/tracker-dbus.c
index 5bd296e..160cf5b 100644
--- a/src/tracker-store/tracker-dbus.c
+++ b/src/tracker-store/tracker-dbus.c
@@ -35,14 +35,14 @@
#include <libtracker-data/tracker-data-query.h>
#include "tracker-dbus.h"
-#include "tracker-daemon.h"
-#include "tracker-daemon-glue.h"
#include "tracker-resources.h"
#include "tracker-resources-glue.h"
#include "tracker-resource-class.h"
#include "tracker-resources-class-glue.h"
#include "tracker-search.h"
#include "tracker-search-glue.h"
+#include "tracker-statistics.h"
+#include "tracker-statistics-glue.h"
#include "tracker-backup.h"
#include "tracker-backup-glue.h"
#include "tracker-marshal.h"
@@ -133,7 +133,7 @@ dbus_register_names (TrackerConfig *config)
DBUS_INTERFACE_DBUS);
/* Register the service name for org.freedesktop.Tracker */
- if (!dbus_register_service (gproxy, TRACKER_DAEMON_SERVICE)) {
+ if (!dbus_register_service (gproxy, TRACKER_STATISTICS_SERVICE)) {
return FALSE;
}
@@ -192,7 +192,7 @@ tracker_dbus_register_objects (TrackerConfig *config,
}
/* Add org.freedesktop.Tracker */
- object = tracker_daemon_new (config);
+ object = tracker_statistics_new ();
if (!object) {
g_critical ("Could not create TrackerDaemon object to register");
return FALSE;
@@ -201,8 +201,8 @@ tracker_dbus_register_objects (TrackerConfig *config,
dbus_register_object (connection,
gproxy,
G_OBJECT (object),
- &dbus_glib_tracker_daemon_object_info,
- TRACKER_DAEMON_PATH);
+ &dbus_glib_tracker_statistics_object_info,
+ TRACKER_STATISTICS_PATH);
objects = g_slist_prepend (objects, object);
/* Add org.freedesktop.Tracker.Resources */
diff --git a/src/tracker-store/tracker-main.c b/src/tracker-store/tracker-main.c
index 825378c..1756070 100644
--- a/src/tracker-store/tracker-main.c
+++ b/src/tracker-store/tracker-main.c
@@ -63,15 +63,14 @@
#include <libtracker-data/tracker-data-backup.h>
#include <libtracker-data/tracker-data-query.h>
-#include <tracker-push.h>
-
#include "tracker-dbus.h"
#include "tracker-events.h"
#include "tracker-main.h"
+#include "tracker-push.h"
#include "tracker-volume-cleanup.h"
#include "tracker-backup.h"
-#include "tracker-daemon.h"
#include "tracker-store.h"
+#include "tracker-statistics.h"
#ifdef G_OS_WIN32
#include <windows.h>
@@ -426,7 +425,7 @@ mount_point_set_and_signal_cb (DBusGProxy *proxy,
* in the volumes table, we have to signal all clients from
* here that the statistics may have changed.
*/
- tracker_daemon_signal_statistics ();
+ tracker_statistics_signal ();
g_free (user_data);
}
diff --git a/src/tracker-store/tracker-daemon.c b/src/tracker-store/tracker-statistics.c
similarity index 66%
rename from src/tracker-store/tracker-daemon.c
rename to src/tracker-store/tracker-statistics.c
index 8642375..6e98473 100644
--- a/src/tracker-store/tracker-daemon.c
+++ b/src/tracker-store/tracker-statistics.c
@@ -36,49 +36,49 @@
#include <libtracker-data/tracker-data-manager.h>
#include "tracker-dbus.h"
-#include "tracker-daemon.h"
#include "tracker-main.h"
#include "tracker-marshal.h"
#include "tracker-store.h"
+#include "tracker-statistics.h"
-#define TRACKER_DAEMON_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TRACKER_TYPE_DAEMON, TrackerDaemonPrivate))
+#define TRACKER_STATISTICS_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TRACKER_TYPE_STATISTICS, TrackerStatisticsPrivate))
#define TRACKER_TYPE_G_STRV_ARRAY (dbus_g_type_get_collection ("GPtrArray", G_TYPE_STRV))
/* In seconds (5 minutes for now) */
-#define STATS_CACHE_LIFETIME 300
+#define CACHE_LIFETIME 300
typedef struct {
TrackerConfig *config;
- GHashTable *stats_cache;
- guint stats_cache_timeout_id;
-} TrackerDaemonPrivate;
+ GHashTable *cache;
+ guint cache_timeout_id;
+} TrackerStatisticsPrivate;
enum {
- STATISTICS_UPDATED,
+ UPDATED,
LAST_SIGNAL
};
-static void tracker_daemon_finalize (GObject *object);
-static gboolean stats_cache_timeout (gpointer user_data);
-static GHashTable *stats_cache_get_latest (void);
+static void tracker_statistics_finalize (GObject *object);
+static gboolean cache_timeout (gpointer user_data);
+static GHashTable *cache_get_latest (void);
static guint signals[LAST_SIGNAL] = {0};
-G_DEFINE_TYPE(TrackerDaemon, tracker_daemon, G_TYPE_OBJECT)
+G_DEFINE_TYPE(TrackerStatistics, tracker_statistics, G_TYPE_OBJECT)
static void
-tracker_daemon_class_init (TrackerDaemonClass *klass)
+tracker_statistics_class_init (TrackerStatisticsClass *klass)
{
GObjectClass *object_class;
object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = tracker_daemon_finalize;
+ object_class->finalize = tracker_statistics_finalize;
- signals[STATISTICS_UPDATED] =
- g_signal_new ("statistics-updated",
+ signals[UPDATED] =
+ g_signal_new ("updated",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
@@ -88,69 +88,56 @@ tracker_daemon_class_init (TrackerDaemonClass *klass)
1,
TRACKER_TYPE_G_STRV_ARRAY);
- g_type_class_add_private (object_class, sizeof (TrackerDaemonPrivate));
+ g_type_class_add_private (object_class, sizeof (TrackerStatisticsPrivate));
}
static void
-tracker_daemon_init (TrackerDaemon *object)
+tracker_statistics_init (TrackerStatistics *object)
{
- TrackerDaemonPrivate *priv;
+ TrackerStatisticsPrivate *priv;
- priv = TRACKER_DAEMON_GET_PRIVATE (object);
+ priv = TRACKER_STATISTICS_GET_PRIVATE (object);
/* Do first time stats lookup */
- priv->stats_cache = stats_cache_get_latest ();
+ priv->cache = cache_get_latest ();
- priv->stats_cache_timeout_id =
- g_timeout_add_seconds (STATS_CACHE_LIFETIME,
- stats_cache_timeout,
+ priv->cache_timeout_id =
+ g_timeout_add_seconds (CACHE_LIFETIME,
+ cache_timeout,
object);
}
static void
-tracker_daemon_finalize (GObject *object)
+tracker_statistics_finalize (GObject *object)
{
- TrackerDaemon *daemon;
- TrackerDaemonPrivate *priv;
+ TrackerStatistics *statistics;
+ TrackerStatisticsPrivate *priv;
- daemon = TRACKER_DAEMON (object);
- priv = TRACKER_DAEMON_GET_PRIVATE (daemon);
+ statistics = TRACKER_STATISTICS (object);
+ priv = TRACKER_STATISTICS_GET_PRIVATE (statistics);
- if (priv->stats_cache_timeout_id != 0) {
- g_source_remove (priv->stats_cache_timeout_id);
+ if (priv->cache_timeout_id != 0) {
+ g_source_remove (priv->cache_timeout_id);
}
- if (priv->stats_cache) {
- g_hash_table_unref (priv->stats_cache);
+ if (priv->cache) {
+ g_hash_table_unref (priv->cache);
}
- g_object_unref (priv->config);
-
- G_OBJECT_CLASS (tracker_daemon_parent_class)->finalize (object);
+ G_OBJECT_CLASS (tracker_statistics_parent_class)->finalize (object);
}
-TrackerDaemon *
-tracker_daemon_new (TrackerConfig *config)
+TrackerStatistics *
+tracker_statistics_new (void)
{
- TrackerDaemon *object;
- TrackerDaemonPrivate *priv;
-
- g_return_val_if_fail (TRACKER_IS_CONFIG (config), NULL);
-
- object = g_object_new (TRACKER_TYPE_DAEMON, NULL);
-
- priv = TRACKER_DAEMON_GET_PRIVATE (object);
-
- priv->config = g_object_ref (config);
-
- return object;
+ return g_object_new (TRACKER_TYPE_STATISTICS, NULL);
}
/*
* Functions
*/
static GHashTable *
-stats_cache_get_latest (void)
+cache_get_latest (void)
{
GHashTable *values;
TrackerClass **classes;
@@ -197,17 +184,17 @@ stats_cache_get_latest (void)
}
static gboolean
-stats_cache_timeout (gpointer user_data)
+cache_timeout (gpointer user_data)
{
g_message ("Statistics cache has expired, updating...");
- tracker_daemon_signal_statistics ();
+ tracker_statistics_signal ();
return TRUE;
}
static gint
-stats_cache_sort_func (gconstpointer a,
+cache_sort_func (gconstpointer a,
gconstpointer b)
{
@@ -221,28 +208,26 @@ stats_cache_sort_func (gconstpointer a,
}
void
-tracker_daemon_get_stats (TrackerDaemon *object,
- DBusGMethodInvocation *context,
- GError **error)
+tracker_statistics_get (TrackerStatistics *object,
+ DBusGMethodInvocation *context,
+ GError **error)
{
- TrackerDaemonPrivate *priv;
- guint request_id;
- GPtrArray *values;
- GHashTableIter iter;
- gpointer key, value;
+ TrackerStatisticsPrivate *priv;
+ guint request_id;
+ GPtrArray *values;
+ GHashTableIter iter;
+ gpointer key, value;
request_id = tracker_dbus_get_next_request_id ();
tracker_dbus_request_block_hooks ();
- tracker_dbus_request_new (request_id,
- "%s",
- __FUNCTION__);
+ tracker_dbus_request_new (request_id, __FUNCTION__);
- priv = TRACKER_DAEMON_GET_PRIVATE (object);
+ priv = TRACKER_STATISTICS_GET_PRIVATE (object);
values = g_ptr_array_new ();
- g_hash_table_iter_init (&iter, priv->stats_cache);
+ g_hash_table_iter_init (&iter, priv->cache);
while (g_hash_table_iter_next (&iter, &key, &value)) {
GStrv strv;
const gchar *service_type;
@@ -260,7 +245,7 @@ tracker_daemon_get_stats (TrackerDaemon *object,
}
/* Sort result so it is alphabetical */
- g_ptr_array_sort (values, stats_cache_sort_func);
+ g_ptr_array_sort (values, cache_sort_func);
dbus_g_method_return (context, values);
@@ -271,22 +256,21 @@ tracker_daemon_get_stats (TrackerDaemon *object,
tracker_dbus_request_unblock_hooks ();
}
-
void
-tracker_daemon_signal_statistics (void)
+tracker_statistics_signal (void)
{
- GObject *daemon;
- TrackerDaemonPrivate *priv;
+ GObject *statistics;
+ TrackerStatisticsPrivate *priv;
GHashTable *stats;
GHashTableIter iter;
gpointer key, value;
GPtrArray *values;
- daemon = tracker_dbus_get_object (TRACKER_TYPE_DAEMON);
- priv = TRACKER_DAEMON_GET_PRIVATE (daemon);
+ statistics = tracker_dbus_get_object (TRACKER_TYPE_STATISTICS);
+ priv = TRACKER_STATISTICS_GET_PRIVATE (statistics);
/* Get latest */
- stats = stats_cache_get_latest ();
+ stats = cache_get_latest ();
/* There are 3 situations here:
* - 1. No new stats
@@ -316,7 +300,7 @@ tracker_daemon_signal_statistics (void)
service_type = key;
new_count = GPOINTER_TO_INT (value);
- data = g_hash_table_lookup (priv->stats_cache, service_type);
+ data = g_hash_table_lookup (priv->cache, service_type);
old_count = GPOINTER_TO_INT (data);
if (old_count != new_count) {
@@ -339,9 +323,9 @@ tracker_daemon_signal_statistics (void)
if (values->len > 0) {
/* Make sure we sort the results first */
- g_ptr_array_sort (values, stats_cache_sort_func);
+ g_ptr_array_sort (values, cache_sort_func);
- g_signal_emit (daemon, signals[STATISTICS_UPDATED], 0, values);
+ g_signal_emit (statistics, signals[UPDATED], 0, values);
} else {
g_message (" No changes in the statistics");
}
@@ -349,6 +333,6 @@ tracker_daemon_signal_statistics (void)
g_ptr_array_foreach (values, (GFunc) g_strfreev, NULL);
g_ptr_array_free (values, TRUE);
- g_hash_table_unref (priv->stats_cache);
- priv->stats_cache = stats;
+ g_hash_table_unref (priv->cache);
+ priv->cache = stats;
}
diff --git a/src/tracker-store/tracker-statistics.h b/src/tracker-store/tracker-statistics.h
new file mode 100644
index 0000000..e435426
--- /dev/null
+++ b/src/tracker-store/tracker-statistics.h
@@ -0,0 +1,62 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2006, Mr Jamie McCracken (jamiemcc gnome org)
+ * Copyright (C) 2008, Nokia
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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 __TRACKERD_DBUS_STATISTICS_H__
+#define __TRACKERD_DBUS_STATISTICS_H__
+
+#include <glib-object.h>
+
+#include <libtracker-common/tracker-config.h>
+
+#define TRACKER_STATISTICS_SERVICE "org.freedesktop.Tracker"
+#define TRACKER_STATISTICS_PATH "/org/freedesktop/Tracker/Statistics"
+#define TRACKER_STATISTICS_INTERFACE "org.freedesktop.Tracker.Statistics"
+
+G_BEGIN_DECLS
+
+#define TRACKER_TYPE_STATISTICS (tracker_statistics_get_type ())
+#define TRACKER_STATISTICS(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), TRACKER_TYPE_STATISTICS, TrackerStatistics))
+#define TRACKER_STATISTICS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TRACKER_TYPE_DBUS_STATISTICS, TrackerStatisticsClass))
+#define TRACKER_IS_STATISTICS(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), TRACKER_TYPE_STATISTICS))
+#define TRACKER_IS_STATISTICS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TRACKER_TYPE_STATISTICS))
+#define TRACKER_STATISTICS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TRACKER_TYPE_STATISTICS, TrackerStatisticsClass))
+
+typedef struct TrackerStatistics TrackerStatistics;
+typedef struct TrackerStatisticsClass TrackerStatisticsClass;
+
+struct TrackerStatistics {
+ GObject parent;
+};
+
+struct TrackerStatisticsClass {
+ GObjectClass parent;
+};
+
+GType tracker_statistics_get_type (void);
+TrackerStatistics *tracker_statistics_new (void);
+void tracker_statistics_get (TrackerStatistics *object,
+ DBusGMethodInvocation *context,
+ GError **error);
+void tracker_statistics_signal (void);
+
+G_END_DECLS
+
+#endif /* __TRACKERD_STATISTICS_H__ */
diff --git a/src/tracker-utils/tracker-stats.c b/src/tracker-utils/tracker-stats.c
index 40540b5..b8f8bdc 100644
--- a/src/tracker-utils/tracker-stats.c
+++ b/src/tracker-utils/tracker-stats.c
@@ -79,7 +79,7 @@ main (int argc, char **argv)
return EXIT_FAILURE;
}
- array = tracker_get_stats (client, &error);
+ array = tracker_statistics_get (client, &error);
if (error) {
g_printerr ("%s, %s\n",
diff --git a/src/tracker-utils/tracker-status.c b/src/tracker-utils/tracker-status.c
index b1e61c9..96b50ad 100644
--- a/src/tracker-utils/tracker-status.c
+++ b/src/tracker-utils/tracker-status.c
@@ -509,7 +509,7 @@ main (gint argc, gchar *argv[])
g_print ("Press Ctrl+C to end follow of Tracker state\n");
- proxy = client->proxy;
+ proxy = client->proxy_statistics;
/* Set signal handlers */
dbus_g_object_register_marshaller (tracker_VOID__STRING_BOOLEAN_BOOLEAN_BOOLEAN_BOOLEAN_BOOLEAN,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]