install: a slightly more reliable install callback

This commit is contained in:
Andy Williams 2016-12-02 22:48:33 +00:00
parent 34deff51f9
commit 4d16ac9a83
2 changed files with 16 additions and 10 deletions

View File

@ -125,7 +125,6 @@ _url_complete_cb(void *data, int type EINA_UNUSED, void *event_info EINA_UNUSED)
if (progress->done_cb)
progress->done_cb();
ecore_con_url_free(progress->url);
return EINA_TRUE;
}
@ -137,7 +136,6 @@ extra_sync(Extra_Progress *progress)
url = ecore_con_url_custom_new("http://" HOSTNAME "/v1/themes/", "GET");
ecore_con_url_additional_header_add(url, "Accept", "text/csv");
progress->url = url;
ecore_event_handler_add(ECORE_CON_EVENT_URL_DATA, _url_data_cb, NULL);
ecore_event_handler_add(ECORE_CON_EVENT_URL_COMPLETE, _url_complete_cb, progress);
@ -217,13 +215,22 @@ extra_theme_download_url_get(Extra_Theme *theme)
}
static Eina_Bool
_install_complete_cb(void *data, int type EINA_UNUSED, void *event_info EINA_UNUSED)
_enlightenment_restart(void *data)
{
Extra_Progress *progress = data;
char *cmd = "enlightenment_remote -restart";
if (progress->done_cb)
progress->done_cb();
ecore_exe_run(cmd, NULL);
return EINA_FALSE;
}
static Eina_Bool
_install_complete_cb(void *data, int type EINA_UNUSED, void *event_info EINA_UNUSED)
{
Extra_Progress *progress = data;
if (progress->is_theme)
{
@ -231,13 +238,14 @@ _install_complete_cb(void *data, int type EINA_UNUSED, void *event_info EINA_UNU
elm_config_all_flush();
elm_config_save();
sleep(5);
ecore_exe_run(cmd, NULL);
ecore_timer_add(3, _enlightenment_restart, data);
}
else
{
if (progress->done_cb)
progress->done_cb();
}
ecore_con_url_free(progress->url);
progress->done_cb();
return EINA_TRUE;
}
@ -263,7 +271,6 @@ extra_theme_install(Extra_Progress *progress)
fd = creat(path, 0644);
ecore_con_url_fd_set(url, fd);
progress->url = url;
ecore_con_url_get(url);
free(path);

View File

@ -48,7 +48,6 @@ typedef struct _Extra_Theme
typedef struct _Extra_Progress
{
Ecore_Con_Url *url;
const char *id;
Eina_Bool is_theme;