337fefde0059c3fe4b35a9cc504ddae259889f35
[framework/uifw/e17.git] / src / modules / wizard / page_200.c
1 #include "e.h"
2 #include "e_mod_main.h"
3
4 EAPI int
5 wizard_page_init(E_Wizard_Page *pg __UNUSED__)
6 {
7    return 1;
8 }
9
10 EAPI int
11 wizard_page_shutdown(E_Wizard_Page *pg __UNUSED__)
12 {
13    return 1;
14 }
15
16 EAPI int
17 wizard_page_show(E_Wizard_Page *pg __UNUSED__)
18 {
19    char buf[PATH_MAX];
20
21    if ((e_config_profile_get()) && (strlen(e_config_profile_get()) > 0))
22      {
23         if (e_user_dir_snprintf(buf, sizeof(buf), "config/%s", e_config_profile_get()) >= sizeof(buf))
24           return 0;
25         if (ecore_file_is_dir(buf)) ecore_file_recursive_rm(buf);
26      }
27    // load profile as e_config
28    e_config_load();
29    return 0; /* 1 == show ui, and wait for user, 0 == just continue */
30 }
31 EAPI int
32 wizard_page_hide(E_Wizard_Page *pg)
33 {
34    evas_object_del(pg->data);
35    return 1;
36 }
37 EAPI int
38 wizard_page_apply(E_Wizard_Page *pg __UNUSED__)
39 {
40    char buf[PATH_MAX];
41    // setup ~/Desktop and ~/.e/e/fileman/favorites and 
42    // ~/.e/e/applications/bar/default, maybe ~/.e/e/applications/startup/.order
43
44    // FIXME: should become a wizard page on its own
45    // setup fileman favorites
46    snprintf(buf, sizeof(buf),
47             "gzip -d -c < %s/data/other/efm_favorites.tar.gz | "
48             "(cd %s/.e/e/ ; tar -xkf -)",
49             e_prefix_data_get(), e_user_homedir_get());
50    system(buf);
51    // FIXME: efm favorites linked to desktop should be an option in another
52    // wizard page
53    // ~/Desktop
54    e_user_homedir_concat(buf, sizeof(buf), _("Desktop"));
55    ecore_file_mkpath(buf);
56    e_user_homedir_snprintf(buf, sizeof(buf), "%s/%s", _("Desktop"), "home.desktop");
57    ecore_file_symlink("../.e/e/fileman/favorites/home.desktop", buf);
58    e_user_homedir_snprintf(buf, sizeof(buf), "%s/%s", _("Desktop"), "root.desktop");
59    ecore_file_symlink("../.e/e/fileman/favorites/root.desktop", buf);
60    e_user_homedir_snprintf(buf, sizeof(buf), "%s/%s", _("Desktop"), "tmp.desktop");
61    ecore_file_symlink("../.e/e/fileman/favorites/tmp.desktop", buf);
62    
63    // save the config now everyone has modified it
64    e_config_save();
65    // restart e
66    e_sys_action_do(E_SYS_RESTART, NULL);
67    return 1;
68 }