From 41559b3cc70cffacc023a6a21cca41b5b1070447 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 15 Jan 2010 19:54:42 -0600 Subject: Getting a multiplier, and providing a way to override it using an environment variable. --- libindicator/indicator-service-manager.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libindicator/indicator-service-manager.c b/libindicator/indicator-service-manager.c index 69b1343..ee29767 100644 --- a/libindicator/indicator-service-manager.c +++ b/libindicator/indicator-service-manager.c @@ -25,6 +25,8 @@ License along with this library. If not, see #include "config.h" #endif +#include + #include #include @@ -60,6 +62,10 @@ 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" /* Properties */ /* Enum for the properties so that they can be quickly @@ -136,6 +142,15 @@ 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; } -- cgit v1.2.3