2011-08-15 02:21:12 -07:00
|
|
|
/* Extra desktop files setup */
|
2012-11-30 06:38:34 -08:00
|
|
|
#include "e_wizard.h"
|
2008-10-25 22:46:45 -07:00
|
|
|
|
2012-09-27 01:40:24 -07:00
|
|
|
static Ecore_Timer *_next_timer = NULL;
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API int
|
2015-03-18 15:09:09 -07:00
|
|
|
wizard_page_init(E_Wizard_Page *pg EINA_UNUSED, Eina_Bool *need_xdg_desktops, Eina_Bool *need_xdg_icons EINA_UNUSED)
|
2008-10-25 22:46:45 -07:00
|
|
|
{
|
2012-11-26 04:40:31 -08:00
|
|
|
*need_xdg_desktops = EINA_TRUE;
|
2008-10-25 22:46:45 -07:00
|
|
|
return 1;
|
|
|
|
}
|
2012-11-30 02:46:48 -08:00
|
|
|
/*
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API int
|
2015-03-18 15:09:09 -07:00
|
|
|
wizard_page_shutdown(E_Wizard_Page *pg EINA_UNUSED)
|
2008-10-25 22:46:45 -07:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
2012-11-30 02:46:48 -08:00
|
|
|
*/
|
2012-09-27 01:40:24 -07:00
|
|
|
static Eina_Bool
|
2015-03-18 15:09:09 -07:00
|
|
|
_next_page(void *data EINA_UNUSED)
|
2012-09-27 01:40:24 -07:00
|
|
|
{
|
|
|
|
_next_timer = NULL;
|
|
|
|
e_wizard_button_next_enable_set(1);
|
|
|
|
e_wizard_next();
|
|
|
|
return ECORE_CALLBACK_CANCEL;
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API int
|
2015-03-18 15:09:09 -07:00
|
|
|
wizard_page_show(E_Wizard_Page *pg EINA_UNUSED)
|
2008-10-25 22:46:45 -07:00
|
|
|
{
|
2011-08-15 02:21:12 -07:00
|
|
|
Eina_List *extra_desks, *desks;
|
|
|
|
Efreet_Desktop *desk, *extra_desk;
|
|
|
|
char buf[PATH_MAX], *file;
|
2012-11-11 12:27:55 -08:00
|
|
|
int found, copies = 0;
|
2008-10-25 22:46:45 -07:00
|
|
|
|
2012-11-09 19:57:57 -08:00
|
|
|
e_wizard_title_set(_("Adding missing App files"));
|
|
|
|
e_wizard_button_next_enable_set(0);
|
|
|
|
e_wizard_page_show(NULL);
|
|
|
|
|
2011-08-15 02:21:12 -07:00
|
|
|
snprintf(buf, sizeof(buf), "%s/extra_desktops", e_wizard_dir_get());
|
|
|
|
extra_desks = ecore_file_ls(buf);
|
2012-09-27 01:40:24 -07:00
|
|
|
|
2012-11-26 04:40:31 -08:00
|
|
|
/* advance in 1 sec */
|
2017-02-03 13:52:28 -08:00
|
|
|
_next_timer = ecore_timer_loop_add(1.0, _next_page, NULL);
|
2012-09-27 01:40:24 -07:00
|
|
|
|
2011-08-15 02:21:12 -07:00
|
|
|
EINA_LIST_FREE(extra_desks, file)
|
|
|
|
{
|
2012-06-28 06:12:13 -07:00
|
|
|
snprintf(buf, sizeof(buf), "%s/extra_desktops/%s",
|
2011-08-15 02:21:12 -07:00
|
|
|
e_wizard_dir_get(), file);
|
|
|
|
extra_desk = efreet_desktop_uncached_new(buf);
|
|
|
|
if (extra_desk)
|
|
|
|
{
|
|
|
|
if (extra_desk->exec)
|
|
|
|
{
|
|
|
|
char abuf[4096], dbuf[4096];
|
2012-06-28 06:12:13 -07:00
|
|
|
|
2011-08-15 02:21:12 -07:00
|
|
|
found = 0;
|
|
|
|
if (sscanf(extra_desk->exec, "%4000s", abuf) == 1)
|
|
|
|
{
|
|
|
|
if (ecore_file_app_installed(abuf))
|
|
|
|
{
|
|
|
|
desks = efreet_util_desktop_name_glob_list("*");
|
|
|
|
EINA_LIST_FREE(desks, desk)
|
|
|
|
{
|
|
|
|
if ((!found) && (desk->exec))
|
|
|
|
{
|
|
|
|
if (sscanf(desk->exec, "%4000s", dbuf) == 1)
|
|
|
|
{
|
|
|
|
char *p1, *p2;
|
2012-06-28 06:12:13 -07:00
|
|
|
|
2011-08-15 02:21:12 -07:00
|
|
|
p1 = strrchr(dbuf, '/');
|
|
|
|
if (p1) p1++;
|
|
|
|
else p1 = dbuf;
|
|
|
|
p2 = strrchr(abuf, '/');
|
|
|
|
if (p2) p2++;
|
|
|
|
else p2 = abuf;
|
|
|
|
if (!strcmp(p1, p2)) found = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
efreet_desktop_free(desk);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!found)
|
|
|
|
{
|
|
|
|
// copy file
|
2012-06-28 06:12:13 -07:00
|
|
|
snprintf(abuf, sizeof(abuf),
|
2011-08-15 02:21:12 -07:00
|
|
|
"%s/applications",
|
|
|
|
efreet_data_home_get());
|
|
|
|
ecore_file_mkpath(abuf);
|
2012-06-28 06:12:13 -07:00
|
|
|
snprintf(abuf, sizeof(abuf),
|
2011-08-15 02:21:12 -07:00
|
|
|
"%s/applications/%s",
|
|
|
|
efreet_data_home_get(), file);
|
|
|
|
ecore_file_cp(buf, abuf);
|
2012-11-13 12:36:41 -08:00
|
|
|
// trigger cache rebuild
|
|
|
|
efreet_desktop_free(efreet_desktop_get(abuf));
|
2012-11-11 12:27:55 -08:00
|
|
|
copies++;
|
2011-08-15 02:21:12 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
efreet_desktop_free(extra_desk);
|
|
|
|
}
|
|
|
|
free(file);
|
|
|
|
}
|
2012-11-11 12:27:55 -08:00
|
|
|
if (copies == 0)
|
|
|
|
{
|
|
|
|
if (_next_timer) ecore_timer_del(_next_timer);
|
|
|
|
_next_timer = NULL;
|
|
|
|
return 0; /* we didnt copy anything so advance anyway */
|
|
|
|
}
|
|
|
|
return 1; /* 1 == show ui, and wait for user, 0 == just continue */
|
2008-10-25 22:46:45 -07:00
|
|
|
}
|
2011-08-15 02:21:12 -07:00
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API int
|
2015-03-18 15:09:09 -07:00
|
|
|
wizard_page_hide(E_Wizard_Page *pg EINA_UNUSED)
|
2008-10-25 22:46:45 -07:00
|
|
|
{
|
2012-11-30 02:46:48 -08:00
|
|
|
if (_next_timer) ecore_timer_del(_next_timer);
|
|
|
|
_next_timer = NULL;
|
2008-10-25 22:46:45 -07:00
|
|
|
return 1;
|
|
|
|
}
|
2012-11-30 02:46:48 -08:00
|
|
|
/*
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API int
|
2015-03-18 15:09:09 -07:00
|
|
|
wizard_page_apply(E_Wizard_Page *pg EINA_UNUSED)
|
2008-10-25 22:46:45 -07:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
2012-11-30 02:46:48 -08:00
|
|
|
*/
|