1 /* Quick launch chooser */
3 #include "e_mod_main.h"
5 static Eina_List *desktops = NULL;
6 static int *desktops_add = NULL;
7 static int desktops_num = 0;
10 _cb_sort_desks(Efreet_Desktop *d1, Efreet_Desktop *d2)
12 if (!d1->name) return 1;
13 if (!d2->name) return -1;
14 return strcmp(d1->name, d2->name);
18 wizard_page_init(E_Wizard_Page *pg __UNUSED__)
20 Eina_List *desks = NULL;
23 desks = efreet_util_desktop_name_glob_list("*");
24 desks = eina_list_sort(desks, 0, (Eina_Compare_Cb)_cb_sort_desks);
25 EINA_LIST_FREE(desks, desk)
29 efreet_desktop_free(desk);
32 desktops = eina_list_append(desktops, desk);
36 desktops_num = eina_list_count(desktops);
37 desktops_add = calloc(sizeof(int), desktops_num);
43 wizard_page_shutdown(E_Wizard_Page *pg __UNUSED__)
49 wizard_page_show(E_Wizard_Page *pg __UNUSED__)
51 Evas_Object *o, *of, *ob, *li, *ck;
56 if (!desktops) return 0;
58 o = e_widget_list_add(pg->evas, 1, 0);
59 e_wizard_title_set(_("Quick Launch"));
61 of = e_widget_framelist_add(pg->evas, _("Select Applications"), 0);
63 li = e_widget_list_add(pg->evas, 1, 0);
64 ob = e_widget_scrollframe_simple_add(pg->evas, li);
65 e_widget_size_min_set(ob, 140 * e_scale, 140 * e_scale);
67 for (i = 0, l = desktops; l ; l = l->next, i++)
75 icon = efreet_icon_path_find(e_config->icon_theme,
77 ck = e_widget_check_icon_add(pg->evas, desk->name,
78 icon, 32 * e_scale, 32 * e_scale,
80 e_widget_list_object_append(li, ck, 1, 1, 0.0);
84 e_widget_size_min_get(li, &mw, &mh);
85 evas_object_resize(li, mw, mh);
87 e_widget_framelist_object_append(of, ob);
88 e_widget_list_object_append(o, of, 1, 1, 0.5);
93 e_wizard_page_show(o);
95 return 1; /* 1 == show ui, and wait for user, 0 == just continue */
99 wizard_page_hide(E_Wizard_Page *pg)
101 evas_object_del(pg->data);
106 wizard_page_apply(E_Wizard_Page *pg __UNUSED__)
108 Efreet_Desktop *desk;
114 e_user_dir_concat_static(buf, "applications/bar/default");
115 ecore_file_mkpath(buf);
116 e_user_dir_concat_static(buf, "applications/bar/default/.order");
120 for (i = 0, l = desktops; l ; l = l->next, i++)
127 p = strrchr(desk->orig_path, '/');
128 if (!p) p = desk->orig_path;
130 fprintf(f, "%s\n", p);
135 EINA_LIST_FREE(desktops, desk)
136 efreet_desktop_free(desk);