[gnome-online-miners/sam/help-and-debug: 2/4] Add a helpful warning for users who start a miner from the commandline
- From: Sam Thursfield <sthursfield src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-online-miners/sam/help-and-debug: 2/4] Add a helpful warning for users who start a miner from the commandline
- Date: Sun, 4 Sep 2016 00:16:39 +0000 (UTC)
commit d7ee1e9df01700866cecd8cfe0af958265feb829
Author: Sam Thursfield <ssssam gmail com>
Date: Sun Sep 4 01:15:35 2016 +0100
Add a helpful warning for users who start a miner from the commandline
It's not clear from any documentation how developers should test a Gnome
Online Miner process. Starting it from the commandline just causes it to
exit again 5 seconds later. Miners now print a message explaining the
correct way to invoke them on stderr if they were not invoked over
D-Bus.
The message looks like this:
org.gnome.OnlineMiners.Facebook: Miner process was executed but the
RefreshDB D-Bus method was never called. You must call the
org.gnome.OnlineMiners.Miner.RefreshDB method to cause an online miner
to start mining.
src/gom-application.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/src/gom-application.c b/src/gom-application.c
index c10479a..02418ce 100644
--- a/src/gom-application.c
+++ b/src/gom-application.c
@@ -38,6 +38,7 @@ struct _GomApplication
GQueue *queue;
GType miner_type;
gboolean refreshing;
+ gboolean refresh_db_called;
};
struct _GomApplicationClass
@@ -117,6 +118,8 @@ gom_application_refresh_db (GomApplication *self,
{
gchar **index_types;
+ self->refresh_db_called = TRUE;
+
index_types = g_strdupv ((gchar **) arg_index_types);
g_object_set_data_full (G_OBJECT (invocation), "index-types", index_types, (GDestroyNotify) g_strfreev);
g_queue_push_tail (self->queue, g_object_ref (invocation));
@@ -196,6 +199,15 @@ gom_application_dispose (GObject *object)
{
GomApplication *self = GOM_APPLICATION (object);
+ if (! self->refresh_db_called)
+ {
+ g_printerr ("%s: Miner process was executed but the RefreshDB D-Bus "
+ "method was never called. You must call the "
+ "org.gnome.OnlineMiners.Miner.RefreshDB method to cause "
+ "an online miner to start mining.\n",
+ g_application_get_application_id (G_APPLICATION (self)));
+ }
+
g_clear_object (&self->cancellable);
g_clear_object (&self->miner);
g_clear_object (&self->skeleton);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]