diff options
author | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2018-04-03 16:43:47 +0900 |
---|---|---|
committer | Chris Michael <cp.michael@samsung.com> | 2018-06-12 08:12:47 -0400 |
commit | 150a4012fc8cc1291a561ff30705438d2185248c (patch) | |
tree | 93483bdb338137f14201d6bfc744fc61a8ca278a | |
parent | 143d10b5e622ded676b34138d07c663756561b6c (diff) | |
download | enlightenment-150a4012fc8cc1291a561ff30705438d2185248c.tar.gz |
e startup - support gnome autostart delay
support autostart delay - fixes T6785
-rw-r--r-- | src/bin/e_startup.c | 54 |
1 files changed, 52 insertions, 2 deletions
diff --git a/src/bin/e_startup.c b/src/bin/e_startup.c index be9e9e5952..bb2d38136b 100644 --- a/src/bin/e_startup.c +++ b/src/bin/e_startup.c @@ -57,11 +57,46 @@ e_startup(void) } /* local subsystem functions */ +static Eina_Bool +_e_startup_delay(void *data) +{ + Efreet_Desktop *desktop = data; + e_exec(NULL, desktop, NULL, NULL, NULL); + efreet_desktop_unref(desktop); + return EINA_FALSE; +} + +// custom float parser for N.nnnn, or N,nnnn or N to avoid locale issues +static double +_atof(const char *s) +{ + const char *p; + double v = 0, dec; + + for (p = s; isdigit(*p); p++) + { + v *= 10.0; + v += (double)(*p - '0'); + } + if ((*p == '.') || (*p == ',')) + { + dec = 0.1; + for (p++; isdigit(*p); p++) + { + v += ((double)(*p - '0')) * dec; + dec /= 10.0; + } + } + return v; +} + static void _e_startup(void) { Efreet_Desktop *desktop; - char buf[8192]; + char buf[1024]; + const char *s; + double delay = 0.0; if (!startup_apps) { @@ -78,7 +113,22 @@ _e_startup(void) e_init_done(); return; } - e_exec(NULL, desktop, NULL, NULL, NULL); + if (desktop->x) + { + s = eina_hash_find(desktop->x, "X-GNOME-Autostart-Delay"); + if (s) + { + const char *prev = setlocale(LC_NUMERIC, "C"); + delay = _atof(s); + setlocale(LC_NUMERIC, prev); + } + } + if (delay > 0.0) + { + efreet_desktop_ref(desktop); + ecore_timer_add(delay, _e_startup_delay, desktop); + } + else e_exec(NULL, desktop, NULL, NULL, NULL); snprintf(buf, sizeof(buf), _("Starting %s"), desktop->name); e_init_status_set(buf); ecore_job_add(_e_startup_next_cb, NULL); |