aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-01-15 21:40:03 -0600
committerTed Gould <ted@gould.cx>2010-01-15 21:40:03 -0600
commitdeabfe64bf3b306c1c068665c4d8324dee7f5435 (patch)
tree065f549b70e8b0495064a04e45d5bc9b265d92e1
parent9bccc146b8f1ee955d713fec30d7f5faf2ce88c1 (diff)
downloadlibayatana-indicator-deabfe64bf3b306c1c068665c4d8324dee7f5435.tar.gz
libayatana-indicator-deabfe64bf3b306c1c068665c4d8324dee7f5435.tar.bz2
libayatana-indicator-deabfe64bf3b306c1c068665c4d8324dee7f5435.zip
Switching what our enviroment variable is for, let's just stop the whole thing instead of playing with it.
-rw-r--r--libindicator/indicator-service-manager.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/libindicator/indicator-service-manager.c b/libindicator/indicator-service-manager.c
index 1a8db07..42160ee 100644
--- a/libindicator/indicator-service-manager.c
+++ b/libindicator/indicator-service-manager.c
@@ -64,10 +64,9 @@ enum {
static guint signals[LAST_SIGNAL] = { 0 };
-/* We multiply our timeouts by in ms. This can be overriden by
- the environment variable INDICATOR_SERVICE_RESTART_TIMEOUT. */
-static guint timeout_multiplier = 100;
-#define TIMEOUT_ENV_NAME "INDICATOR_SERVICE_RESTART_TIMEOUT"
+/* If this env variable is set, we don't restart */
+#define TIMEOUT_ENV_NAME "INDICATOR_SERVICE_RESTART_DISABLE"
+#define TIMEOUT_MULTIPLIER 100 /* In ms */
/* Properties */
/* Enum for the properties so that they can be quickly
@@ -146,15 +145,6 @@ indicator_service_manager_class_init (IndicatorServiceManagerClass *klass)
0, G_MAXUINT, 0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- /* Look to see if there is an environment variable effecting
- the restart interval. This is in the class init as it should
- only happen once. */
- const gchar * restart_env = g_getenv(TIMEOUT_ENV_NAME);
- if (restart_env != NULL) {
- timeout_multiplier = atoi(restart_env);
- g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "Time out multipler set to: %d", timeout_multiplier);
- }
-
return;
}
@@ -465,6 +455,11 @@ start_service_again_cb (gpointer data)
static void
start_service_again (IndicatorServiceManager * manager)
{
+ /* Allow the restarting to be disabled */
+ if (g_getenv(TIMEOUT_ENV_NAME)) {
+ return;
+ }
+
IndicatorServiceManagerPrivate * priv = INDICATOR_SERVICE_MANAGER_GET_PRIVATE(manager);
if (priv->restart_count == 0) {
@@ -474,7 +469,7 @@ start_service_again (IndicatorServiceManager * manager)
/* Not our first time 'round the block. Let's slow this down. */
if (priv->restart_count > 16)
priv->restart_count = 16; /* Not more than 1024x */
- g_timeout_add((1 << priv->restart_count) * timeout_multiplier, start_service_again_cb, manager);
+ g_timeout_add((1 << priv->restart_count) * TIMEOUT_MULTIPLIER, start_service_again_cb, manager);
}
return;