summaryrefslogtreecommitdiff
path: root/src/modules/wizard/page_080.c
blob: efb9ae2f78db48607b52f4df9f7925dd2b55f8d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/* Ibar setup */
#include "e_wizard.h"

EAPI int
wizard_page_init(E_Wizard_Page *pg __UNUSED__, Eina_Bool *need_xdg_desktops, Eina_Bool *need_xdg_icons __UNUSED__)
{
   *need_xdg_desktops = EINA_TRUE;
   return 1;
}
/*
EAPI int
wizard_page_shutdown(E_Wizard_Page *pg __UNUSED__)
{
   return 1;
}
*/
EAPI int
wizard_page_show(E_Wizard_Page *pg __UNUSED__)
{
   FILE *f, *fin;
   char buf[PATH_MAX];

   snprintf(buf, sizeof(buf), "%s/def-ibar.txt", e_wizard_dir_get());
   fin = fopen(buf, "r");
   if (!fin) return 0;
   e_user_dir_concat_static(buf, "applications/bar/default");
   ecore_file_mkpath(buf);
   e_user_dir_concat_static(buf, "applications/bar/default/.order");
   f = fopen(buf, "w");
   if (f)
     {
        while (fgets(buf, sizeof(buf), fin))
          {
             Efreet_Desktop *desk;
             char name[4096], buf2[PATH_MAX], *p;
             int n;

             if (buf[0] == '#') continue;
             p = buf;
             while (isspace(*p))
               p++;
             for (;; )
               {
                  n = sscanf(p, "%s", name);
                  if (n != 1) break;
                  p += strlen(name);
                  while (isspace(*p))
                    p++;
                  snprintf(buf2, sizeof(buf2), "%s.desktop", name);
                  desk = efreet_util_desktop_file_id_find(buf2);
                  if (desk)
                    {
                       fprintf(f, "%s\n", buf2);
                       efreet_desktop_free(desk);
                       break;
                    }
               }
          }
        fclose(f);
     }
   fclose(fin);
   return 0; /* 1 == show ui, and wait for user, 0 == just continue */
}
/*
EAPI int
wizard_page_hide(E_Wizard_Page *pg __UNUSED__)
{
   return 1;
}

EAPI int
wizard_page_apply(E_Wizard_Page *pg __UNUSED__)
{
   return 1;
}
*/