From 02a71ca145c3a85d2ea8d8b4f707ff070d067051 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Mon, 15 Jul 2013 11:25:14 +0900 Subject: [PATCH] store startup id in exehist as e restart was not self-exec as of e17 --- src/bin/e_exec.c | 13 +++---------- src/bin/e_exehist.c | 23 +++++++++++++++++++++++ src/bin/e_exehist.h | 2 ++ 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/src/bin/e_exec.c b/src/bin/e_exec.c index 721e0ba..25f9eab 100644 --- a/src/bin/e_exec.c +++ b/src/bin/e_exec.c @@ -100,11 +100,7 @@ e_exec_init(void) EINTERN int e_exec_shutdown(void) { - char buf[256]; - - snprintf(buf, sizeof(buf), "%i", startup_id); - e_util_env_set("E_STARTUP_ID", buf); - + e_exehist_startup_id_set(startup_id); if (_e_exec_exit_handler) ecore_event_handler_del(_e_exec_exit_handler); if (_e_exec_border_add_handler) ecore_event_handler_del(_e_exec_border_add_handler); @@ -400,11 +396,8 @@ _e_exec_cb_exec(void *data, Efreet_Desktop *desktop, char *exec, int remaining) if (startup_id == 0) { - const char *p; - - p = getenv("E_STARTUP_ID"); - if (p) startup_id = atoi(p); - e_util_env_set("E_STARTUP_ID", NULL); + startup_id = e_exehist_startup_id_get(); + if (startup_id < 0) startup_id = 0; } if (++startup_id < 1) startup_id = 1; /* save previous env vars we need to save */ diff --git a/src/bin/e_exehist.c b/src/bin/e_exehist.c index 7c31782..b37114f 100644 --- a/src/bin/e_exehist.c +++ b/src/bin/e_exehist.c @@ -11,6 +11,7 @@ struct _E_Exehist { Eina_List *history; Eina_List *mimes; + int startup_id; }; struct _E_Exehist_Item @@ -60,6 +61,7 @@ e_exehist_init(void) #define D _e_exehist_config_edd E_CONFIG_LIST(D, T, history, _e_exehist_config_item_edd); E_CONFIG_LIST(D, T, mimes, _e_exehist_config_item_edd); + E_CONFIG_VAL(D, T, startup_id, INT); E_EVENT_EXEHIST_UPDATE = ecore_event_type_new(); @@ -81,6 +83,27 @@ e_exehist_shutdown(void) } EAPI void +e_exehist_startup_id_set(int id) +{ + _e_exehist_load(); + if (!_e_exehist) return; + _e_exehist->startup_id = id; + _e_exehist_changes++; + _e_exehist_unload_queue(); +} + +EAPI int +e_exehist_startup_id_get(void) +{ + int id; + _e_exehist_load(); + if (!_e_exehist) return 0; + id = _e_exehist->startup_id; + _e_exehist_unload_queue(); + return id; +} + +EAPI void e_exehist_add(const char *launch_method, const char *exe) { E_Exehist_Item *ei; diff --git a/src/bin/e_exehist.h b/src/bin/e_exehist.h index 2775837..2ca9f97 100644 --- a/src/bin/e_exehist.h +++ b/src/bin/e_exehist.h @@ -14,6 +14,8 @@ typedef enum _E_Exehist_Sort EINTERN int e_exehist_init(void); EINTERN int e_exehist_shutdown(void); +EAPI void e_exehist_startup_id_set(int id); +EAPI int e_exehist_startup_id_get(void); EAPI void e_exehist_add(const char *launch_method, const char *exe); EAPI void e_exehist_del(const char *exe); EAPI void e_exehist_clear(void); -- 2.7.4