Commit 09dcfcf3 authored by Martyn James Russell's avatar Martyn James Russell

Removed the "Reason" from the Paused signal since we don't have a reason

	* data/dbus/tracker-indexer.xml: 
	* src/tracker-indexer/tracker-indexer.c: Removed the "Reason" from
	the Paused signal since we don't have a reason any more. We are
	paused when we are told. All battery monitoring and disk space
	monitoring has been moved to the daemon status module and removed
	from the indexer so state is more centrally observed.

	* src/tracker-utils/tracker-status.c: Added a couple of command
	line options to "follow" the status of Tracker using --follow
	(instead of just returning to the command line after the initial
	query) and also to get more details using --detailed.

	* src/trackerd/tracker-dbus.c: 
	* src/trackerd/tracker-status.[ch]:  Added APIs to deal with
	pausing during DBus calls. Fixed a bunch of issues found here
	where we just weren't returning to the correct state after being
	paused due to DBus requests from apps or pausing manually from the
	user.

svn path=/trunk/; revision=2937
parent 2eda5f21
2009-02-17 Martyn Russell <martyn@imendio.com>
* data/dbus/tracker-indexer.xml:
* src/tracker-indexer/tracker-indexer.c: Removed the "Reason" from
the Paused signal since we don't have a reason any more. We are
paused when we are told. All battery monitoring and disk space
monitoring has been moved to the daemon status module and removed
from the indexer so state is more centrally observed.
* src/tracker-utils/tracker-status.c: Added a couple of command
line options to "follow" the status of Tracker using --follow
(instead of just returning to the command line after the initial
query) and also to get more details using --detailed.
* src/trackerd/tracker-main.[ch]: Added API to get data dir for
the disk space monitoring which uses the database directory
location for disk space checking.
* src/trackerd/tracker-dbus.c:
* src/trackerd/tracker-status.[ch]: Added APIs to deal with
pausing during DBus calls. Fixed a bunch of issues found here
where we just weren't returning to the correct state after being
paused due to DBus requests from apps or pausing manually from the
user.
2009-02-17 Martyn Russell <martyn@imendio.com>
* src/tracker-utils/tracker-status.c: Handle Ctrl+C more
......
......@@ -88,9 +88,7 @@
<arg type="u" name="items_remaining" />
</signal>
<signal name="Started" />
<signal name="Paused">
<arg type="s" name="reason" />
</signal>
<signal name="Paused" />
<signal name="Continued" />
<signal name="Finished">
<arg type="d" name="elapsed_time" />
......
......@@ -48,7 +48,6 @@
#include <stdlib.h>
#include <string.h>
#include <sys/statvfs.h>
#include <glib/gstdio.h>
#include <gio/gio.h>
......@@ -85,14 +84,13 @@
/* Flush every 'x' seconds */
#define FLUSH_FREQUENCY 60
#define LOW_DISK_CHECK_FREQUENCY 10
#define SIGNAL_STATUS_FREQUENCY 10
/* Throttle defaults */
#define THROTTLE_DEFAULT 0
#define THROTTLE_DEFAULT_ON_BATTERY 5
#define TRACKER_INDEXER_ERROR "tracker-indexer-error-domain"
#define TRACKER_INDEXER_ERROR "tracker-indexer-error-domain"
#define TRACKER_INDEXER_ERROR_CODE 0
/* Properties that change in move event */
......@@ -137,7 +135,6 @@ struct TrackerIndexerPrivate {
guint idle_id;
guint pause_for_duration_id;
guint disk_space_check_id;
guint signal_status_id;
guint flush_id;
......@@ -176,9 +173,7 @@ struct UpdateWordsForeachData {
enum TrackerIndexerState {
TRACKER_INDEXER_STATE_FLUSHING = 1 << 0,
TRACKER_INDEXER_STATE_PAUSED = 1 << 1,
TRACKER_INDEXER_STATE_DISK_FULL = 1 << 2,
TRACKER_INDEXER_STATE_STOPPED = 1 << 3,
TRACKER_INDEXER_STATE_LOW_BATT = 1 << 4
TRACKER_INDEXER_STATE_STOPPED = 1 << 2,
};
enum {
......@@ -198,7 +193,6 @@ enum {
};
static gboolean process_func (gpointer data);
static void check_disk_space_start (TrackerIndexer *indexer);
static void state_set_flags (TrackerIndexer *indexer,
TrackerIndexerState state);
static void state_unset_flags (TrackerIndexer *indexer,
......@@ -457,8 +451,6 @@ set_up_throttle (TrackerIndexer *indexer)
g_message ("Not setting throttle, it is currently set to %d",
throttle);
}
state_unset_flags (indexer, TRACKER_INDEXER_STATE_LOW_BATT);
}
}
......@@ -470,31 +462,6 @@ notify_battery_in_use_cb (GObject *gobject,
set_up_throttle (TRACKER_INDEXER (user_data));
}
static void
notify_battery_percentage_cb (GObject *object,
GParamSpec *pspec,
gpointer user_data)
{
TrackerIndexer *indexer;
gdouble percentage;
gboolean battery_in_use;
indexer = user_data;
percentage = tracker_hal_get_battery_percentage (TRACKER_HAL (object));
battery_in_use = tracker_hal_get_battery_in_use (TRACKER_HAL (object));
/* FIXME: This could be a configuration option */
if (battery_in_use && percentage <= 0.05) {
/* Running on low batteries, stop indexing for now */
state_set_flags (indexer, TRACKER_INDEXER_STATE_LOW_BATT);
} else {
state_unset_flags (indexer, TRACKER_INDEXER_STATE_LOW_BATT);
}
set_up_throttle (TRACKER_INDEXER (user_data));
}
#endif /* HAVE_HAL */
static void
......@@ -517,10 +484,6 @@ tracker_indexer_finalize (GObject *object)
g_source_remove (priv->idle_id);
}
if (priv->disk_space_check_id) {
g_source_remove (priv->disk_space_check_id);
}
if (priv->signal_status_id) {
g_source_remove (priv->signal_status_id);
}
......@@ -533,9 +496,6 @@ tracker_indexer_finalize (GObject *object)
g_signal_handlers_disconnect_by_func (priv->hal,
notify_battery_in_use_cb,
TRACKER_INDEXER (object));
g_signal_handlers_disconnect_by_func (priv->hal,
notify_battery_percentage_cb,
TRACKER_INDEXER (object));
g_object_unref (priv->hal);
#endif /* HAVE_HAL */
......@@ -624,7 +584,7 @@ tracker_indexer_class_init (TrackerIndexerClass *class)
NULL, NULL,
g_cclosure_marshal_VOID__STRING,
G_TYPE_NONE,
1, G_TYPE_STRING);
0);
signals[CONTINUED] =
g_signal_new ("continued",
G_OBJECT_CLASS_TYPE (object_class),
......@@ -739,83 +699,6 @@ check_stopped (TrackerIndexer *indexer,
interrupted);
}
static gboolean
check_is_disk_space_low (TrackerIndexer *indexer)
{
const gchar *path;
struct statvfs st;
gint limit;
limit = tracker_config_get_low_disk_space_limit (indexer->private->config);
path = indexer->private->db_dir;
if (limit < 1) {
return FALSE;
}
if (statvfs (path, &st) == -1) {
g_warning ("Could not statvfs '%s'", path);
return FALSE;
}
if (((long long) st.f_bavail * 100 / st.f_blocks) <= limit) {
g_message ("Disk space is low");
return TRUE;
}
return FALSE;
}
static gboolean
check_disk_space_cb (TrackerIndexer *indexer)
{
gboolean disk_space_low;
disk_space_low = check_is_disk_space_low (indexer);
if (disk_space_low) {
state_set_flags (indexer, TRACKER_INDEXER_STATE_DISK_FULL);
} else {
state_unset_flags (indexer, TRACKER_INDEXER_STATE_DISK_FULL);
}
return TRUE;
}
static void
check_disk_space_start (TrackerIndexer *indexer)
{
TrackerIndexerPrivate *priv;
gint low_disk_space_limit;
priv = indexer->private;
if (priv->disk_space_check_id != 0) {
return;
}
low_disk_space_limit = tracker_config_get_low_disk_space_limit (priv->config);
if (low_disk_space_limit != -1) {
priv->disk_space_check_id = g_timeout_add_seconds (LOW_DISK_CHECK_FREQUENCY,
(GSourceFunc) check_disk_space_cb,
indexer);
}
}
static void
check_disk_space_stop (TrackerIndexer *indexer)
{
TrackerIndexerPrivate *priv;
priv = indexer->private;
if (priv->disk_space_check_id != 0) {
g_source_remove (priv->disk_space_check_id);
priv->disk_space_check_id = 0;
}
}
static gboolean
signal_status_cb (TrackerIndexer *indexer)
{
......@@ -920,9 +803,6 @@ tracker_indexer_init (TrackerIndexer *indexer)
g_signal_connect (priv->hal, "notify::battery-in-use",
G_CALLBACK (notify_battery_in_use_cb),
indexer);
g_signal_connect (priv->hal, "notify::battery-percentage",
G_CALLBACK (notify_battery_percentage_cb),
indexer);
set_up_throttle (indexer);
#endif /* HAVE_HAL */
......@@ -2543,7 +2423,6 @@ process_func (gpointer data)
/* Signal stopped and clean up */
check_stopped (indexer, FALSE);
check_disk_space_stop (indexer);
return FALSE;
}
......@@ -2610,7 +2489,6 @@ state_check (TrackerIndexer *indexer)
indexer->private->idle_id = 0;
}
} else {
check_disk_space_start (indexer);
signal_status_timeout_start (indexer);
if (indexer->private->idle_id == 0) {
......@@ -2632,15 +2510,9 @@ state_to_string (TrackerIndexerState state)
if (state & TRACKER_INDEXER_STATE_PAUSED) {
s = g_string_append (s, "PAUSED | ");
}
if (state & TRACKER_INDEXER_STATE_DISK_FULL) {
s = g_string_append (s, "DISK FULL | ");
}
if (state & TRACKER_INDEXER_STATE_STOPPED) {
s = g_string_append (s, "STOPPED | ");
}
if (state & TRACKER_INDEXER_STATE_LOW_BATT) {
s = g_string_append (s, "LOW BATTERY | ");
}
s->str[s->len - 3] = '\0';
......@@ -2661,35 +2533,21 @@ state_set_flags (TrackerIndexer *indexer,
* could be relevant outside the indexer
*/
if ((! (old_state & TRACKER_INDEXER_STATE_PAUSED)) &&
(! (old_state & TRACKER_INDEXER_STATE_DISK_FULL)) &&
(! (old_state & TRACKER_INDEXER_STATE_LOW_BATT)) &&
(state & TRACKER_INDEXER_STATE_PAUSED ||
state & TRACKER_INDEXER_STATE_DISK_FULL ||
state & TRACKER_INDEXER_STATE_LOW_BATT)) {
const gchar *reason;
(state & TRACKER_INDEXER_STATE_PAUSED)) {
gchar *old_state_str;
gchar *state_str;
if (state & TRACKER_INDEXER_STATE_DISK_FULL) {
reason = "Disk full";
} else if (state & TRACKER_INDEXER_STATE_LOW_BATT) {
reason = "Battery low";
} else {
reason = NULL;
}
old_state_str = state_to_string (old_state);
state_str = state_to_string (indexer->private->state);
g_message ("State change from '%s' --> '%s' (reason:'%s')",
g_message ("State change from '%s' --> '%s'",
old_state_str,
state_str,
reason ? reason : "None");
state_str);
g_free (state_str);
g_free (old_state_str);
g_signal_emit (indexer, signals[PAUSED], 0, reason);
g_signal_emit (indexer, signals[PAUSED], 0);
}
}
......@@ -2704,12 +2562,8 @@ state_unset_flags (TrackerIndexer *indexer,
new_state = indexer->private->state;
state_check (indexer);
if ((old_state & TRACKER_INDEXER_STATE_PAUSED ||
old_state & TRACKER_INDEXER_STATE_DISK_FULL ||
old_state & TRACKER_INDEXER_STATE_LOW_BATT) &&
(! (new_state & TRACKER_INDEXER_STATE_PAUSED)) &&
(! (new_state & TRACKER_INDEXER_STATE_DISK_FULL)) &&
(! (new_state & TRACKER_INDEXER_STATE_LOW_BATT))) {
if ((old_state & TRACKER_INDEXER_STATE_PAUSED) &&
(! (new_state & TRACKER_INDEXER_STATE_PAUSED))) {
gchar *old_state_str;
gchar *state_str;
......
......@@ -38,6 +38,12 @@
static GMainLoop *main_loop;
static gchar *last_state;
static gboolean last_initial_index;
static gboolean last_in_merge;
static gboolean last_is_paused_manually;
static gboolean last_is_paused_for_bat;
static gboolean last_is_paused_for_io;
static gboolean last_is_indexing_enabled;
static gboolean follow;
static gboolean detailed;
......@@ -59,14 +65,15 @@ index_state_changed (DBusGProxy *proxy,
const gchar *state,
gboolean initial_index,
gboolean in_merge,
gboolean is_manual_paused,
gboolean is_battery_paused,
gboolean is_io_paused,
gboolean is_paused_manually,
gboolean is_paused_for_bat,
gboolean is_paused_for_io,
gboolean is_indexing_enabled,
gpointer user_data)
{
static gboolean first_change = TRUE;
gchar *str;
str = g_strdup_printf (_( "Tracker status changed from '%s' --> '%s'"),
last_state ? last_state : _("None"),
state);
......@@ -74,36 +81,63 @@ index_state_changed (DBusGProxy *proxy,
g_free (str);
if (detailed) {
g_print (" %-*.*s: %s\n"
" %-*.*s: %s\n"
" %-*.*s: %s\n"
" %-*.*s: %s\n"
" %-*.*s: %s\n"
" %-*.*s: %s\n"
"\n",
DETAIL_MAX_WIDTH, DETAIL_MAX_WIDTH,
_("Initial index"),
initial_index ? _("yes") : _("no"),
DETAIL_MAX_WIDTH, DETAIL_MAX_WIDTH,
_("In merge"),
in_merge ? _("yes") : _("no"),
DETAIL_MAX_WIDTH, DETAIL_MAX_WIDTH,
_("Is paused manually"),
is_manual_paused ? _("yes") : _("no"),
DETAIL_MAX_WIDTH, DETAIL_MAX_WIDTH,
_("Is paused for low battery"),
is_battery_paused ? _("yes") : _("no"),
DETAIL_MAX_WIDTH, DETAIL_MAX_WIDTH,
_("Is paused for IO"),
is_io_paused ? _("yes") : _("no"),
DETAIL_MAX_WIDTH, DETAIL_MAX_WIDTH,
_("Is indexing enabled"),
is_indexing_enabled ? _("yes") : _("no"));
if (first_change || last_initial_index != initial_index) {
g_print (" %-*.*s: %s\n",
DETAIL_MAX_WIDTH, DETAIL_MAX_WIDTH,
_("Initial index"),
initial_index ? _("yes") : _("no"));
}
if (first_change || last_in_merge != in_merge) {
g_print (" %-*.*s: %s\n",
DETAIL_MAX_WIDTH, DETAIL_MAX_WIDTH,
_("In merge"),
in_merge ? _("yes") : _("no"));
}
if (first_change || last_is_paused_manually != is_paused_manually) {
g_print (" %-*.*s: %s\n",
DETAIL_MAX_WIDTH, DETAIL_MAX_WIDTH,
_("Is paused manually"),
is_paused_manually ? _("yes") : _("no"));
}
if (first_change || last_is_paused_for_bat != is_paused_for_bat) {
g_print (" %-*.*s: %s\n",
DETAIL_MAX_WIDTH, DETAIL_MAX_WIDTH,
_("Is paused for low battery"),
is_paused_for_bat ? _("yes") : _("no"));
}
if (first_change || last_is_paused_for_io != is_paused_for_io) {
g_print (" %-*.*s: %s\n",
DETAIL_MAX_WIDTH, DETAIL_MAX_WIDTH,
_("Is paused for IO"),
is_paused_for_io ? _("yes") : _("no"));
}
if (first_change || last_is_indexing_enabled != is_indexing_enabled) {
g_print (" %-*.*s: %s\n",
DETAIL_MAX_WIDTH, DETAIL_MAX_WIDTH,
_("Is indexing enabled"),
is_indexing_enabled ? _("yes") : _("no"));
}
}
/* Remember last state */
/* Remember last details so we don't spam the same crap each
* time to console, only updates.
*/
g_free (last_state);
last_state = g_strdup (state);
last_initial_index = initial_index;
last_in_merge = in_merge;
last_is_paused_manually = is_paused_manually;
last_is_paused_for_bat = is_paused_for_bat;
last_is_paused_for_io = is_paused_for_io;
last_is_indexing_enabled = is_indexing_enabled;
first_change = FALSE;
}
/* Taken from tracker-applet */
......
......@@ -175,18 +175,7 @@ indexer_continue_async_cb (DBusGProxy *proxy,
static gboolean
indexer_resume_cb (gpointer user_data)
{
DBusGProxy *proxy;
proxy = user_data;
if (!tracker_status_get_is_paused_manually () &&
!tracker_status_get_is_paused_for_batt () &&
!tracker_status_get_is_paused_for_io () &&
!tracker_status_get_is_paused_for_space ()) {
org_freedesktop_Tracker_Indexer_continue_async (g_object_ref (proxy),
indexer_continue_async_cb,
NULL);
}
tracker_status_set_is_paused_for_dbus (FALSE);
return FALSE;
}
......@@ -208,31 +197,42 @@ dbus_request_new_cb (guint request_id,
TrackerStatus status;
status = tracker_status_get ();
proxy = tracker_dbus_indexer_get_proxy ();
/* Don't pause if already paused */
if (status == TRACKER_STATUS_PAUSED) {
g_message ("New DBus request, not pausing indexer, already in paused state");
/* Just check if we already have a timeout, to reset it */
if (indexer_resume_timeout_id != 0) {
g_source_remove (indexer_resume_timeout_id);
indexer_resume_timeout_id =
g_timeout_add_seconds_full (G_PRIORITY_DEFAULT,
INDEXER_PAUSE_TIME_FOR_REQUESTS,
indexer_resume_cb,
g_object_ref (proxy),
indexer_resume_destroy_notify_cb);
}
return;
}
/* Don't try to pause unless we are in particular states */
if (status != TRACKER_STATUS_INDEXING) {
g_message ("New DBus request, not pausing indexer, not in indexing state");
return;
}
g_message ("New DBus request, checking indexer is paused...");
/* First remove the timeout */
if (indexer_resume_timeout_id != 0) {
set_paused = FALSE;
g_source_remove (indexer_resume_timeout_id);
indexer_resume_timeout_id = 0;
}
/* Second reset it so we have another 10 seconds before
* continuing.
*/
proxy = tracker_dbus_indexer_get_proxy ();
indexer_resume_timeout_id =
g_timeout_add_seconds_full (G_PRIORITY_DEFAULT,
INDEXER_PAUSE_TIME_FOR_REQUESTS,
......@@ -246,21 +246,12 @@ dbus_request_new_cb (guint request_id,
* tracker_get_is_paused_manually() returns TRUE.
*/
if (!set_paused) {
g_message ("New DBus request, not pausing indexer, already requested a pause");
return;
}
/* We use the blocking call here because this function
* proceeds a call which needs the database to be available.
* Therefore the indexer must reply to tell us it has paused
* so we can actually use the database.
*/
org_freedesktop_Tracker_Indexer_pause (proxy, &error);
if (error) {
g_message ("Couldn't pause the indexer, "
"we may have to wait for it to finish");
g_error_free (error);
}
g_message ("New DBus request, pausing indexer");
tracker_status_set_is_paused_for_dbus (TRUE);
}
gboolean
......
......@@ -846,56 +846,6 @@ set_up_mount_points (TrackerHal *hal)
hal);
}
static void
set_up_throttle (TrackerHal *hal,
TrackerConfig *config)
{
gint throttle;
/* If on a laptop battery and the throttling is default (i.e.
* 0), then set the throttle to be higher so we don't kill
* the laptop battery.
*/
throttle = tracker_config_get_throttle (config);
if (tracker_hal_get_battery_in_use (hal)) {
g_message ("We are running on battery");
if (throttle == THROTTLE_DEFAULT) {
tracker_config_set_throttle (config,
THROTTLE_DEFAULT_ON_BATTERY);
g_message ("Setting throttle from %d to %d",
throttle,
THROTTLE_DEFAULT_ON_BATTERY);
} else {
g_message ("Not setting throttle, it is currently set to %d",
throttle);
}
} else {
g_message ("We are not running on battery");
if (throttle == THROTTLE_DEFAULT_ON_BATTERY) {
tracker_config_set_throttle (config,
THROTTLE_DEFAULT);
g_message ("Setting throttle from %d to %d",
throttle,
THROTTLE_DEFAULT);
} else {
g_message ("Not setting throttle, it is currently set to %d",
throttle);
}
}
}
static void
notify_battery_in_use_cb (GObject *gobject,
GParamSpec *arg1,
gpointer user_data)
{
set_up_throttle (TRACKER_HAL (gobject),
TRACKER_CONFIG (user_data));
}
#endif /* HAVE_HAL */
static gboolean
......@@ -1067,7 +1017,18 @@ main (gint argc, gchar *argv[])
return EXIT_FAILURE;
}
tracker_status_init (config);
#ifdef HAVE_HAL
hal = tracker_hal_new ();
g_signal_connect (hal, "mount-point-added",
G_CALLBACK (mount_point_added_cb),
NULL);
g_signal_connect (hal, "mount-point-removed",
G_CALLBACK (mount_point_removed_cb),
NULL);
#endif /* HAVE_HAL */
tracker_status_init (config, hal);
tracker_module_config_init ();
......@@ -1097,20 +1058,6 @@ main (gint argc, gchar *argv[])
return EXIT_FAILURE;
}
#ifdef HAVE_HAL
hal = tracker_hal_new ();
g_signal_connect (hal, "notify::battery-in-use",
G_CALLBACK (notify_battery_in_use_cb),
config);
g_signal_connect (hal, "mount-point-added",
G_CALLBACK (mount_point_added_cb),
NULL);
g_signal_connect (hal, "mount-point-removed",
G_CALLBACK (mount_point_removed_cb),
NULL);
#endif /* HAVE_HAL */
/*
* Check instances running
*/
......@@ -1156,7 +1103,6 @@ main (gint argc, gchar *argv[])
* we have to have already initialised the databases if we
* are going to do that.
*/
set_up_throttle (hal, config);
set_up_mount_points (hal);
#endif /* HAVE_HAL */
......@@ -1260,9 +1206,6 @@ main (gint argc, gchar *argv[])
tracker_log_shutdown ();
#ifdef HAVE_HAL
g_signal_handlers_disconnect_by_func (hal,
notify_battery_in_use_cb,
config);
g_signal_handlers_disconnect_by_func (hal,
mount_point_added_cb,
NULL);
......@@ -1297,6 +1240,16 @@ tracker_shutdown (void)
g_main_loop_quit (private->main_loop);
}
const gchar *
tracker_get_data_dir (void)
{
TrackerMainPrivate *private;
private = g_static_private_get (&private_key);
return private->data_dir;
}
const gchar *
tracker_get_sys_tmp_dir (void)
{
......
......@@ -29,6 +29,7 @@ G_BEGIN_DECLS
void tracker_shutdown (void);
const gchar *tracker_get_data_dir (void);
const gchar *tracker_get_sys_tmp_dir (void);
void tracker_set_reindex_on_shutdown (gboolean value);
......
......@@ -21,18 +21,28 @@
#include "config.h"
#include <sys/statvfs.h>
#include "tracker-status.h"
#include "tracker-dbus.h"
#include "tracker-daemon.h"
#include "tracker-main.h"
#include "tracker-indexer-client.h"
#define DISK_SPACE_CHECK_FREQUENCY 10
#define THROTTLE_DEFAULT 0
#define THROTTLE_DEFAULT_ON_BATTERY 5
typedef struct {
TrackerStatus status;
TrackerStatus status_before_paused;
gpointer type_class;
guint disk_space_check_id;
TrackerConfig *config;
TrackerHal *hal;
DBusGProxy *indexer_proxy;
......@@ -44,17 +54,24 @@ typedef struct {
gboolean is_paused_for_batt;
gboolean is_paused_for_io;
gboolean is_paused_for_space;
gboolean is_paused_for_dbus;
gboolean is_paused_for_unknown;
gboolean in_merge;
} TrackerStatusPrivate;
static void indexer_continued_cb (DBusGProxy *proxy,
gpointer user_data);
static void indexer_paused_cb (DBusGProxy *proxy,
const gchar *reason,
gpointer user_data);
static void indexer_continue (guint seconds);
static void indexer_pause (void);
static void indexer_continued_cb (DBusGProxy *proxy,
gpointer user_data);
static void indexer_paused_cb (DBusGProxy *proxy,
const gchar *reason,
gpointer user_data);
static void indexer_continue (gboolean should_block);
static void indexer_pause (gboolean should_block);
static void battery_in_use_cb (GObject *gobject,
GParamSpec *arg1,
gpointer user_data);
static void battery_percentage_cb (GObject *object,
GParamSpec *pspec,
gpointer user_data);