store startup id in exehist as e restart was not self-exec as of e17

devs/sachiel/e19
Carsten Haitzler 10 years ago
parent ba7bc6dba2
commit 02a71ca145
  1. 13
      src/bin/e_exec.c
  2. 23
      src/bin/e_exehist.c
  3. 2
      src/bin/e_exehist.h

@ -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 */

@ -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();
@ -80,6 +82,27 @@ e_exehist_shutdown(void)
return 1;
}
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)
{

@ -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);

Loading…
Cancel
Save