1 #include <Elementary.h>
3 # include "elementary_config.h"
5 #ifndef ELM_LIB_QUICKLAUNCH
7 typedef struct _Theme Theme;
8 typedef struct _Fonts_Data Fonts_Data;
9 typedef struct _Elm_Text_Class_Data Elm_Text_Class_Data;
10 typedef struct _Elm_Font_Size_Data Elm_Font_Size_Data;
17 Eina_Bool in_search_path;
20 static const Eina_List *tsel = NULL;
21 static Eina_List *themes = NULL;
23 struct _Elm_Text_Class_Data
32 struct _Elm_Font_Size_Data
40 Eina_List *text_classes;
43 Eina_List *font_px_list;
44 Eina_List *font_scale_list;
47 const char *cur_style;
51 #define ELM_LIST_DISABLE(list) \
54 const Eina_List *_l = elm_list_items_get(list); \
57 elm_list_item_show(eina_list_data_get(_l));\
58 elm_object_disabled_set(list, EINA_TRUE); \
63 #define ELM_LIST_ENABLE(list) \
66 elm_object_disabled_set(list, EINA_FALSE); \
70 #define LABEL_FRAME_ADD(label) \
73 pd = elm_frame_add(win); \
74 evas_object_size_hint_weight_set(pd, EVAS_HINT_EXPAND, 0.0); \
75 evas_object_size_hint_align_set(pd, EVAS_HINT_FILL, 0.5); \
76 elm_object_style_set(pd, "pad_medium"); \
77 elm_box_pack_end(bx, pd); \
78 evas_object_show(pd); \
80 lb = elm_label_add(win); \
81 evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, 0.0); \
82 evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, 0.5); \
83 elm_object_text_set(lb, label); \
84 elm_object_content_set(pd, lb); \
85 evas_object_show(lb); \
90 static int interactive = 1;
92 static const char *theme_set = NULL;
93 static const char *finger_size_set = NULL;
94 static const char *scale_set = NULL;
95 static Fonts_Data fndata = {NULL, NULL, NULL, NULL, NULL, NULL, 0.0};
98 _font_styles_list_sel(void *data __UNUSED__,
103 config_exit(void *data __UNUSED__,
104 Evas_Object *obj __UNUSED__,
105 void *event_info __UNUSED__)
107 Elm_Text_Class_Data *tc_data;
108 Elm_Font_Size_Data *sd;
110 EINA_LIST_FREE(fndata.text_classes, tc_data)
112 eina_stringshare_del(tc_data->name);
113 eina_stringshare_del(tc_data->desc);
114 eina_stringshare_del(tc_data->font);
115 eina_stringshare_del(tc_data->style);
119 elm_font_available_hash_del(fndata.font_hash);
120 fndata.font_hash = NULL;
122 EINA_LIST_FREE(fndata.font_px_list, sd)
124 eina_stringshare_del(sd->size_str);
128 EINA_LIST_FREE(fndata.font_scale_list, sd)
130 eina_stringshare_del(sd->size_str);
134 if (fndata.cur_font) eina_stringshare_del(fndata.cur_font);
135 fndata.cur_font = NULL;
137 if (fndata.cur_style) eina_stringshare_del(fndata.cur_style);
138 fndata.cur_style = NULL;
141 elm_exit(); /* exit the program's main loop that runs in elm_run() */
145 sb_change(void *data __UNUSED__,
147 void *event_info __UNUSED__)
149 Eina_Bool val = elm_check_state_get(obj);
150 Eina_Bool sb = elm_config_scroll_bounce_enabled_get();
152 if (val == sb) return;
153 elm_config_scroll_bounce_enabled_set(val);
154 elm_config_all_flush();
156 /*TODO: enable/disable subordinate sliders (make 'em support it 1st)*/
160 bf_round(void *data __UNUSED__,
162 void *event_info __UNUSED__)
164 double val = elm_slider_value_get(obj);
167 v = ((double)((int)(val * 10.0))) / 10.0;
168 if (v != val) elm_slider_value_set(obj, v);
172 bf_change(void *data __UNUSED__,
174 void *event_info __UNUSED__)
176 double bf = elm_config_scroll_bounce_friction_get();
177 double val = elm_slider_value_get(obj);
179 if (bf == val) return;
180 elm_config_scroll_bounce_friction_set(val);
181 elm_config_all_flush();
185 ps_round(void *data __UNUSED__,
187 void *event_info __UNUSED__)
189 double val = elm_slider_value_get(obj);
192 v = ((double)((int)(val * 10.0))) / 10.0;
193 if (v != val) elm_slider_value_set(obj, v);
197 ps_change(void *data __UNUSED__,
199 void *event_info __UNUSED__)
201 double ps = elm_config_scroll_page_scroll_friction_get();
202 double val = elm_slider_value_get(obj);
204 if (ps == val) return;
205 elm_config_scroll_page_scroll_friction_set(val);
206 elm_config_all_flush();
210 bis_round(void *data __UNUSED__,
212 void *event_info __UNUSED__)
214 double val = elm_slider_value_get(obj);
217 v = ((double)((int)(val * 10.0))) / 10.0;
218 if (v != val) elm_slider_value_set(obj, v);
222 bis_change(void *data __UNUSED__,
224 void *event_info __UNUSED__)
226 double bis = elm_config_scroll_bring_in_scroll_friction_get();
227 double val = elm_slider_value_get(obj);
229 if (bis == val) return;
230 elm_config_scroll_bring_in_scroll_friction_set(val);
231 elm_config_all_flush();
235 zf_round(void *data __UNUSED__,
237 void *event_info __UNUSED__)
239 double val = elm_slider_value_get(obj);
242 v = ((double)((int)(val * 10.0))) / 10.0;
243 if (v != val) elm_slider_value_set(obj, v);
247 zf_change(void *data __UNUSED__,
249 void *event_info __UNUSED__)
251 double zf = elm_config_scroll_zoom_friction_get();
252 double val = elm_slider_value_get(obj);
254 if (zf == val) return;
255 elm_config_scroll_zoom_friction_set(val);
256 elm_config_all_flush();
260 ts_change(void *data __UNUSED__,
262 void *event_info __UNUSED__)
264 Eina_Bool val = elm_check_state_get(obj);
265 Eina_Bool sb = elm_config_scroll_thumbscroll_enabled_get();
267 if (val == sb) return;
268 elm_config_scroll_thumbscroll_enabled_set(val);
269 elm_config_all_flush();
271 /*TODO: enable/disable subordinate sliders (make 'em support it 1st)*/
275 tst_round(void *data __UNUSED__,
277 void *event_info __UNUSED__)
279 double val = elm_slider_value_get(obj);
282 v = ((double)((int)(val * 10.0))) / 10.0;
283 if (v != val) elm_slider_value_set(obj, v);
287 tst_change(void *data __UNUSED__,
289 void *event_info __UNUSED__)
291 double tst = elm_config_scroll_thumbscroll_threshold_get();
292 double val = elm_slider_value_get(obj);
294 if (tst == val) return;
295 elm_config_scroll_thumbscroll_threshold_set(val);
296 elm_config_all_flush();
300 tsht_round(void *data __UNUSED__,
302 void *event_info __UNUSED__)
304 double val = elm_slider_value_get(obj);
307 v = ((double)((int)(val * 10.0))) / 10.0;
308 if (v != val) elm_slider_value_set(obj, v);
312 tsht_change(void *data __UNUSED__,
314 void *event_info __UNUSED__)
316 double tst = elm_config_scroll_thumbscroll_hold_threshold_get();
317 double val = elm_slider_value_get(obj);
319 if (tst == val) return;
320 elm_config_scroll_thumbscroll_hold_threshold_set(val);
321 elm_config_all_flush();
325 tsmt_round(void *data __UNUSED__,
327 void *event_info __UNUSED__)
329 double val = elm_slider_value_get(obj);
332 v = ((double)((int)(val * 10.0))) / 10.0;
333 if (v != val) elm_slider_value_set(obj, v);
337 tsmt_change(void *data __UNUSED__,
339 void *event_info __UNUSED__)
341 double tsmt = elm_config_scroll_thumbscroll_momentum_threshold_get();
342 double val = elm_slider_value_get(obj);
344 if (tsmt == val) return;
345 elm_config_scroll_thumbscroll_momentum_threshold_set(val);
346 elm_config_all_flush();
350 tsf_round(void *data __UNUSED__,
352 void *event_info __UNUSED__)
354 double val = elm_slider_value_get(obj);
357 v = ((double)((int)(val * 10.0))) / 10.0;
358 if (v != val) elm_slider_value_set(obj, v);
362 tsf_change(void *data __UNUSED__,
364 void *event_info __UNUSED__)
366 double tsf = elm_config_scroll_thumbscroll_friction_get();
367 double val = elm_slider_value_get(obj);
369 if (tsf == val) return;
370 elm_config_scroll_thumbscroll_friction_set(val);
371 elm_config_all_flush();
375 tsbf_round(void *data __UNUSED__,
377 void *event_info __UNUSED__)
379 double val = elm_slider_value_get(obj);
382 v = ((double)((int)(val * 10.0))) / 10.0;
383 if (v != val) elm_slider_value_set(obj, v);
387 tsbf_change(void *data __UNUSED__,
389 void *event_info __UNUSED__)
391 double tsbf = elm_config_scroll_thumbscroll_border_friction_get();
392 double val = elm_slider_value_get(obj);
394 if (tsbf == val) return;
395 elm_config_scroll_thumbscroll_border_friction_set(val);
396 elm_config_all_flush();
400 tssf_round(void *data __UNUSED__,
402 void *event_info __UNUSED__)
404 double val = elm_slider_value_get(obj);
407 v = ((double)((int)(val * 20.0))) / 20.0;
408 if (v != val) elm_slider_value_set(obj, v);
412 tssf_change(void *data __UNUSED__,
414 void *event_info __UNUSED__)
416 double tssf = elm_config_scroll_thumbscroll_sensitivity_friction_get();
417 double val = elm_slider_value_get(obj);
419 if (tssf == val) return;
420 elm_config_scroll_thumbscroll_sensitivity_friction_set(val);
421 elm_config_all_flush();
425 cf_enable(void *data,
427 void *event_info __UNUSED__)
429 Eina_Bool cf = elm_config_cache_flush_enabled_get();
430 Eina_Bool val = elm_check_state_get(obj);
432 if (cf == val) return;
433 elm_object_disabled_set((Evas_Object *)data, !val);
434 elm_config_cache_flush_enabled_set(val);
435 elm_config_all_flush();
439 cf_round(void *data __UNUSED__,
441 void *event_info __UNUSED__)
443 double val = elm_slider_value_get(obj);
446 v = ((double)((int)(val * 5.0))) / 5.0;
447 if (v != val) elm_slider_value_set(obj, v);
451 cf_change(void *data __UNUSED__,
453 void *event_info __UNUSED__)
455 double cf = elm_config_cache_flush_interval_get();
456 double val = elm_slider_value_get(obj);
458 if (cf == val) return;
459 elm_config_cache_flush_interval_set(val);
460 elm_config_all_flush();
464 fc_round(void *data __UNUSED__,
466 void *event_info __UNUSED__)
468 double val = elm_slider_value_get(obj);
471 v = ((double)((int)(val * 10.0))) / 10.0;
472 if (v != val) elm_slider_value_set(obj, v);
476 fc_change(void *data __UNUSED__,
478 void *event_info __UNUSED__)
480 double font_cache = elm_config_cache_font_cache_size_get();
481 double val = elm_slider_value_get(obj);
483 if (font_cache == val) return;
484 elm_config_cache_font_cache_size_set(val * 1024);
485 elm_config_all_flush();
489 ic_round(void *data __UNUSED__,
491 void *event_info __UNUSED__)
493 double val = elm_slider_value_get(obj);
496 v = ((double)((int)(val * 10.0))) / 10.0;
497 if (v != val) elm_slider_value_set(obj, v);
501 ic_change(void *data __UNUSED__,
503 void *event_info __UNUSED__)
505 double image_cache = elm_config_cache_image_cache_size_get();
506 double val = elm_slider_value_get(obj);
508 if (image_cache == val) return;
509 elm_config_cache_image_cache_size_set(val * 1024);
510 elm_config_all_flush();
514 sc_round(void *data __UNUSED__,
516 void *event_info __UNUSED__)
518 double val = elm_slider_value_get(obj);
521 v = ((double)((int)(val * 10.0))) / 10.0;
522 if (v != val) elm_slider_value_set(obj, v);
526 sc_change(void *data __UNUSED__,
528 void *event_info __UNUSED__)
530 double scale = elm_config_scale_get();
531 double val = elm_slider_value_get(obj);
533 if (scale == val) return;
534 elm_config_scale_set(val);
535 elm_config_all_flush();
539 fs_round(void *data __UNUSED__,
541 void *event_info __UNUSED__)
543 double val = elm_slider_value_get(obj);
546 v = ((double)((int)(val * 5.0))) / 5.0;
547 if (v != val) elm_slider_value_set(obj, v);
551 fs_change(void *data __UNUSED__,
553 void *event_info __UNUSED__)
555 double fs = elm_config_finger_size_get();
556 double val = elm_slider_value_get(obj);
558 if (fs == val) return;
559 elm_config_finger_size_set(val);
560 elm_config_all_flush();
564 efc_round(void *data __UNUSED__,
566 void *event_info __UNUSED__)
568 double val = elm_slider_value_get(obj);
571 v = ((double)((int)(val * 5.0))) / 5.0;
572 if (v != val) elm_slider_value_set(obj, v);
576 efc_change(void *data __UNUSED__,
578 void *event_info __UNUSED__)
580 double efc = elm_config_cache_edje_file_cache_size_get();
581 double val = elm_slider_value_get(obj);
583 if (efc == val) return;
584 elm_config_cache_edje_file_cache_size_set(val);
585 elm_config_all_flush();
589 ecc_round(void *data __UNUSED__,
591 void *event_info __UNUSED__)
593 double val = elm_slider_value_get(obj);
596 v = ((double)((int)(val * 5.0))) / 5.0;
597 if (v != val) elm_slider_value_set(obj, v);
601 ecc_change(void *data __UNUSED__,
603 void *event_info __UNUSED__)
605 double ecc = elm_config_cache_edje_collection_cache_size_get();
606 double val = elm_slider_value_get(obj);
608 if (ecc == val) return;
609 elm_config_cache_edje_collection_cache_size_set(val);
610 elm_config_all_flush();
614 ac_change(void *data __UNUSED__,
616 void *event_info __UNUSED__)
618 Eina_Bool val = elm_check_state_get(obj);
619 Eina_Bool ac = elm_config_access_get();
621 if (val == ac) return;
622 elm_config_access_set(val);
623 elm_config_all_flush();
627 sel_change(void *data __UNUSED__,
629 void *event_info __UNUSED__)
631 Eina_Bool val = elm_check_state_get(obj);
632 Eina_Bool sel = elm_config_selection_unfocused_clear_get();
634 if (val == sel) return;
635 elm_config_selection_unfocused_clear_set(val);
636 elm_config_all_flush();
641 _status_basic(Evas_Object *win,
644 Evas_Object *lb, *fr;
646 fr = elm_frame_add(win);
647 evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
648 elm_object_text_set(fr, "Information");
649 elm_box_pack_end(bx0, fr);
650 evas_object_show(fr);
652 lb = elm_label_add(win);
653 elm_object_text_set(lb,
654 "Applying configuration change"
656 elm_object_content_set(fr, lb);
657 evas_object_show(lb);
661 _status_config(Evas_Object *win,
664 Evas_Object *lb, *pd, *bx, *fr, *sl, *sp;
666 fr = elm_frame_add(win);
667 evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
668 evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
669 elm_object_text_set(fr, "Sizing");
670 elm_box_pack_end(bx0, fr);
671 evas_object_show(fr);
673 bx = elm_box_add(win);
674 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0);
675 evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, 0.5);
677 LABEL_FRAME_ADD("<hilight>Scale</>");
679 sl = elm_slider_add(win);
680 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
681 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
682 elm_slider_span_size_set(sl, 120);
683 elm_slider_unit_format_set(sl, "%1.2f");
684 elm_slider_indicator_format_set(sl, "%1.2f");
685 elm_slider_min_max_set(sl, 0.25, 5.0);
686 elm_slider_value_set(sl, elm_config_scale_get());
687 elm_box_pack_end(bx, sl);
688 evas_object_show(sl);
690 evas_object_smart_callback_add(sl, "changed", sc_round, NULL);
691 evas_object_smart_callback_add(sl, "delay,changed", sc_change, NULL);
693 sp = elm_separator_add(win);
694 elm_separator_horizontal_set(sp, EINA_TRUE);
695 evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0);
696 evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5);
697 elm_box_pack_end(bx, sp);
698 evas_object_show(sp);
700 LABEL_FRAME_ADD("<hilight>Finger Size</><br/>");
702 sl = elm_slider_add(win);
703 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
704 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
705 elm_slider_span_size_set(sl, 120);
706 elm_slider_unit_format_set(sl, "%1.0f");
707 elm_slider_indicator_format_set(sl, "%1.0f");
708 elm_slider_min_max_set(sl, 5, 200);
709 elm_slider_value_set(sl, elm_config_finger_size_get());
710 elm_box_pack_end(bx, sl);
711 evas_object_show(sl);
713 evas_object_smart_callback_add(sl, "changed", fs_round, NULL);
714 evas_object_smart_callback_add(sl, "delay,changed", fs_change, NULL);
716 // FIXME: add theme selector (basic mode and advanced for fallbacks)
717 // FIXME: save config
718 // FIXME: profile selector / creator etc.
719 elm_object_content_set(fr, bx);
720 evas_object_show(bx);
724 _flip_to(Evas_Object *win,
727 Evas_Object *wid, *naviframe;
728 wid = evas_object_data_get(win, name);
729 naviframe = evas_object_data_get(win, "naviframe");
730 elm_naviframe_item_simple_promote(naviframe, wid);
734 _cf_sizing(void *data,
735 Evas_Object *obj __UNUSED__,
736 void *event_info __UNUSED__)
738 _flip_to(data, "sizing");
742 _cf_themes(void *data,
743 Evas_Object *obj __UNUSED__,
744 void *event_info __UNUSED__)
746 _flip_to(data, "themes");
750 _cf_fonts(void *data,
751 Evas_Object *obj __UNUSED__,
752 void *event_info __UNUSED__)
754 _flip_to(data, "fonts");
758 _cf_profiles(void *data,
759 Evas_Object *obj __UNUSED__,
760 void *event_info __UNUSED__)
762 _flip_to(data, "profiles");
766 _cf_scrolling(void *data,
767 Evas_Object *obj __UNUSED__,
768 void *event_info __UNUSED__)
770 _flip_to(data, "scrolling");
774 _cf_rendering(void *data,
775 Evas_Object *obj __UNUSED__,
776 void *event_info __UNUSED__)
778 _flip_to(data, "rendering");
782 _cf_caches(void *data,
783 Evas_Object *obj __UNUSED__,
784 void *event_info __UNUSED__)
786 _flip_to(data, "caches");
790 _cf_access(void *data,
791 Evas_Object *obj __UNUSED__,
792 void *event_info __UNUSED__)
794 _flip_to(data, "access");
798 _cf_selection(void *data,
799 Evas_Object *obj __UNUSED__,
800 void *event_info __UNUSED__)
802 _flip_to(data, "selection");
806 _elm_theme_current_get(const char *theme_search_order)
811 if (!theme_search_order)
814 for (p = theme_search_order;; p++)
816 if ((*p == ':') || (!*p))
818 if (p > theme_search_order)
820 char *n = malloc(p - theme_search_order + 1);
824 strncpy(n, theme_search_order, p - theme_search_order);
825 n[p - theme_search_order] = 0;
826 ret = eina_stringshare_add(n);
837 _font_overlay_set_all(void *data,
838 Evas_Object *obj __UNUSED__,
839 void *event_info __UNUSED__)
841 Evas_Object *win, *fclasses;
842 Elm_Text_Class_Data *tc_data, *tc;
843 Elm_Object_Item *list_it;
848 fclasses = evas_object_data_get(win, "font_classes_list");
849 list_it = elm_list_selected_item_get(fclasses);
850 if (!list_it) return;
851 tc_data = elm_object_item_data_get(list_it);
853 EINA_LIST_FOREACH(fndata.text_classes, l, tc)
855 eina_stringshare_replace(&tc->font, tc_data->font);
856 eina_stringshare_replace(&tc->style, tc_data->style);
857 tc->size = tc_data->size;
860 elm_config_all_flush();
865 _font_overlay_reset(void *data,
866 Evas_Object *obj __UNUSED__,
867 void *event_info __UNUSED__)
869 Evas_Object *win, *fclasses, *fnames, *fstyles, *fsizes;
870 Elm_Text_Class_Data *tc_data;
871 Elm_Object_Item *list_it;
875 fclasses = evas_object_data_get(win, "font_classes_list");
876 list_it = elm_list_selected_item_get(fclasses);
877 if (!list_it) return;
878 tc_data = elm_object_item_data_get(list_it);
880 fnames = evas_object_data_get(win, "font_names_list");
881 fstyles = evas_object_data_get(win, "font_styles_list");
882 fsizes = evas_object_data_get(win, "font_sizes_list");
884 elm_config_font_overlay_unset(tc_data->name);
886 eina_stringshare_replace(&fndata.cur_font, NULL);
887 eina_stringshare_replace(&tc_data->font, NULL);
888 eina_stringshare_replace(&fndata.cur_style, NULL);
889 eina_stringshare_replace(&tc_data->style, NULL);
890 fndata.cur_size = 0.0;
893 ELM_LIST_DISABLE(fnames);
894 ELM_LIST_DISABLE(fstyles);
895 ELM_LIST_DISABLE(fsizes);
897 elm_config_all_flush();
902 _font_overlay_reset_all(void *data,
903 Evas_Object *obj __UNUSED__,
904 void *event_info __UNUSED__)
906 Evas_Object *win, *fclasses, *fnames, *fstyles, *fsizes;
907 Elm_Text_Class_Data *tc_data;
908 Elm_Object_Item *list_it;
912 eina_stringshare_replace(&fndata.cur_font, NULL);
913 eina_stringshare_replace(&fndata.cur_style, NULL);
914 fndata.cur_size = 0.0;
916 EINA_LIST_FOREACH(fndata.text_classes, l, tc_data)
918 elm_config_font_overlay_unset(tc_data->name);
920 eina_stringshare_replace(&tc_data->font, NULL);
921 eina_stringshare_replace(&tc_data->style, NULL);
925 fclasses = evas_object_data_get(win, "font_classes_list");
926 fnames = evas_object_data_get(win, "font_names_list");
927 fstyles = evas_object_data_get(win, "font_styles_list");
928 fsizes = evas_object_data_get(win, "font_sizes_list");
930 list_it = elm_list_selected_item_get(fclasses);
931 if (list_it) elm_list_item_selected_set(list_it, EINA_FALSE);
933 ELM_LIST_DISABLE(fnames);
934 ELM_LIST_DISABLE(fstyles);
935 ELM_LIST_DISABLE(fsizes);
937 elm_config_all_flush();
942 _font_overlay_change(void *data __UNUSED__,
943 Evas_Object *obj __UNUSED__,
944 void *event_info __UNUSED__)
946 Elm_Text_Class_Data *tc_data;
949 EINA_LIST_FOREACH(fndata.text_classes, l, tc_data)
955 name = elm_font_fontconfig_name_get(tc_data->font,
957 elm_config_font_overlay_set(tc_data->name, name,
958 tc_data->size ? tc_data->size : -100);
959 elm_font_fontconfig_name_free(name);
962 elm_config_font_overlay_unset(tc_data->name);
965 elm_config_font_overlay_apply();
966 elm_config_all_flush();
969 /* TODO: apply hinting */
973 _config_display_update(Evas_Object *win)
975 int flush_interval, font_c, image_c, edje_file_c, edje_col_c, ts_threshould, ts_hold_threshold;
976 double scale, s_bounce_friction, ts_momentum_threshold, ts_friction,
977 ts_border_friction, ts_sensitivity_friction, page_friction, bring_in_friction, zoom_friction;
978 const char *curr_theme, *curr_engine;
979 const Eina_List *l_items, *l;
980 Eina_Bool s_bounce, ts;
981 Elm_Object_Item *list_it;
985 scale = elm_config_scale_get();
986 fs = elm_config_finger_size_get();
987 flush_interval = elm_config_cache_flush_interval_get();
988 font_c = elm_config_cache_font_cache_size_get();
989 image_c = elm_config_cache_image_cache_size_get();
990 edje_file_c = elm_config_cache_edje_file_cache_size_get();
991 edje_col_c = elm_config_cache_edje_collection_cache_size_get();
993 s_bounce = elm_config_scroll_bounce_enabled_get();
994 s_bounce_friction = elm_config_scroll_bounce_friction_get();
995 ts = elm_config_scroll_thumbscroll_enabled_get();
996 ts_threshould = elm_config_scroll_thumbscroll_threshold_get();
997 ts_hold_threshold = elm_config_scroll_thumbscroll_hold_threshold_get();
998 ts_momentum_threshold = elm_config_scroll_thumbscroll_momentum_threshold_get();
999 ts_friction = elm_config_scroll_thumbscroll_friction_get();
1000 ts_border_friction = elm_config_scroll_thumbscroll_border_friction_get();
1001 ts_sensitivity_friction = elm_config_scroll_thumbscroll_sensitivity_friction_get();
1002 page_friction = elm_config_scroll_page_scroll_friction_get();
1003 bring_in_friction = elm_config_scroll_bring_in_scroll_friction_get();
1004 zoom_friction = elm_config_scroll_zoom_friction_get();
1006 /* gotta update root windows' atoms */
1007 elm_slider_value_set(evas_object_data_get(win, "scale_slider"), scale);
1008 elm_slider_value_set(evas_object_data_get(win, "fs_slider"), fs);
1010 elm_slider_value_set(evas_object_data_get(win,
1011 "cache_flush_interval_slider"),
1013 elm_slider_value_set(evas_object_data_get(win, "font_cache_slider"),
1015 elm_slider_value_set(evas_object_data_get(win, "image_cache_slider"),
1017 elm_slider_value_set(evas_object_data_get(win, "edje_file_cache_slider"),
1019 elm_slider_value_set(evas_object_data_get(win,
1020 "edje_collection_cache_slider"),
1023 elm_check_state_set(evas_object_data_get(win, "scroll_bounce_check"),
1025 elm_slider_value_set(evas_object_data_get(win, "bounce_friction_slider"),
1027 elm_check_state_set(evas_object_data_get(win, "thumbscroll_check"), ts);
1028 elm_slider_value_set(evas_object_data_get(win,
1029 "thumbscroll_threshold_slider"),
1031 elm_slider_value_set(evas_object_data_get(win,
1032 "ts_hold_threshold_slider"),
1034 elm_slider_value_set(evas_object_data_get(win,
1035 "ts_momentum_threshold_slider"),
1036 ts_momentum_threshold);
1037 elm_slider_value_set(evas_object_data_get(win,
1038 "thumbscroll_friction_slider"),
1040 elm_slider_value_set(evas_object_data_get(win, "ts_border_friction_slider"),
1041 ts_border_friction);
1042 elm_slider_value_set(evas_object_data_get(win, "ts_sensitivity_friction_slider"),
1043 ts_sensitivity_friction);
1044 elm_slider_value_set(evas_object_data_get(win,
1045 "page_scroll_friction_slider"),
1047 elm_slider_value_set(evas_object_data_get(win,
1048 "bring_in_scroll_friction_slider"),
1050 elm_slider_value_set(evas_object_data_get(win,
1051 "zoom_scroll_friction_slider"),
1054 curr_theme = _elm_theme_current_get(elm_theme_get(NULL));
1056 th = elm_theme_new();
1057 elm_theme_set(th, curr_theme);
1058 elm_object_theme_set(evas_object_data_get(win, "theme_preview"), th);
1060 eina_stringshare_del(curr_theme);
1062 curr_engine = elm_config_engine_get();
1063 l_items = elm_list_items_get(evas_object_data_get(win, "engines_list"));
1064 EINA_LIST_FOREACH(l_items, l, list_it)
1066 if (!strcmp(elm_object_item_data_get(list_it), curr_engine))
1068 elm_list_item_selected_set(list_it, EINA_TRUE);
1075 _profile_change_do(Evas_Object *win,
1076 const char *profile)
1078 elm_config_profile_set(profile);
1079 elm_config_all_flush();
1080 _config_display_update(win);
1084 _config_all_changed(void *data,
1085 int ev_type __UNUSED__,
1086 void *ev __UNUSED__)
1088 Evas_Object *win = data;
1089 _config_display_update(win);
1090 return ECORE_CALLBACK_PASS_ON;
1094 _engine_use(void *data,
1095 Evas_Object *obj __UNUSED__,
1096 void *event_info __UNUSED__)
1099 const char *selection;
1102 selection = elm_object_item_data_get(elm_list_selected_item_get(li));
1104 if (!strcmp(elm_config_engine_get(), selection))
1107 elm_config_engine_set(selection);
1108 elm_config_all_flush();
1109 elm_config_save(); /* make sure new engine has its data dir */
1113 _profile_use(void *data,
1114 Evas_Object *obj __UNUSED__,
1115 void *event_info __UNUSED__)
1118 const char *selection;
1119 const char *profile;
1122 selection = elm_object_item_data_get(elm_list_selected_item_get(li));
1123 profile = elm_config_profile_get();
1127 fprintf(stderr, "No profile currently set!\n"); /* FIXME: log domain */
1131 if (!strcmp(profile, selection))
1134 elm_config_profile_set(selection); /* just here to update info for getters below */
1136 _profile_change_do(elm_object_top_widget_get(li), selection);
1137 elm_config_all_flush();
1138 elm_config_save(); /* make sure new profile has its data dir */
1142 _btn_todo(void *data __UNUSED__,
1143 Evas_Object *obj __UNUSED__,
1144 void *event_info __UNUSED__)
1146 printf("To be done!\n");
1150 _profile_reset(void *data,
1151 Evas_Object *obj __UNUSED__,
1152 void *event_info __UNUSED__)
1154 const char *selection, *curr;
1159 selection = elm_object_item_data_get(elm_list_selected_item_get(li));
1160 curr = elm_config_profile_get();
1162 elm_config_all_flush();
1163 elm_config_save(); /* dump config into old profile's data dir */
1165 pdir = elm_config_profile_dir_get(selection, EINA_TRUE);
1169 ecore_file_recursive_rm(pdir);
1170 elm_config_profile_dir_free(pdir);
1172 elm_config_reload();
1174 _profile_change_do(elm_object_top_widget_get(li), curr);
1175 elm_config_all_flush();
1176 elm_config_save(); /* make sure new profile has its data dir */
1180 _theme_use(void *data __UNUSED__,
1181 Evas_Object *obj __UNUSED__,
1182 void *event_info __UNUSED__)
1186 Evas_Object *win = elm_object_top_widget_get(obj);
1187 Evas_Object *sample = evas_object_data_get(win, "theme_preview");
1189 th = elm_object_theme_get(sample);
1190 defth = elm_theme_get(th);
1191 elm_theme_set(NULL, defth);
1192 elm_config_all_flush();
1197 _theme_sel(void *data __UNUSED__,
1199 void *event_info __UNUSED__)
1201 Evas_Object *win = elm_object_top_widget_get(obj);
1202 Evas_Object *sample = evas_object_data_get(win, "theme_preview");
1204 Elm_Object_Item *list_it;
1208 if (!sample) return;
1209 tsel = elm_list_selected_items_get(obj);
1210 newth = eina_strbuf_new();
1211 EINA_SAFETY_ON_NULL_RETURN(newth);
1212 th = elm_theme_new();
1215 eina_strbuf_free(newth);
1218 EINA_LIST_REVERSE_FOREACH((Eina_List*)tsel, l, list_it)
1220 Theme *t = elm_object_item_data_get(list_it);
1221 eina_strbuf_append_printf(newth, "%s:", t->name);
1222 if ((!l->prev) && strcmp(t->name, "default"))
1223 /* ensure default theme is always there for fallback */
1224 eina_strbuf_append(newth, "default");
1226 elm_theme_set(th, eina_strbuf_string_get(newth));
1227 eina_strbuf_free(newth);
1228 elm_object_theme_set(sample, th);
1233 _theme_browse(void *data, Evas_Object *obj, void *event_info)
1235 printf("not implemented\n");
1239 _status_config_sizing(Evas_Object *win,
1240 Evas_Object *naviframe)
1242 Evas_Object *lb, *pd, *bx, *sl, *sp;
1244 bx = elm_box_add(win);
1245 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0);
1246 evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, 0.5);
1248 LABEL_FRAME_ADD("<hilight>Scale</>");
1250 sl = elm_slider_add(win);
1251 evas_object_data_set(win, "scale_slider", sl);
1252 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
1253 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
1254 elm_slider_span_size_set(sl, 120);
1255 elm_slider_unit_format_set(sl, "%1.2f");
1256 elm_slider_indicator_format_set(sl, "%1.2f");
1257 elm_slider_min_max_set(sl, 0.25, 5.0);
1258 elm_slider_value_set(sl, elm_config_scale_get());
1259 elm_box_pack_end(bx, sl);
1260 evas_object_show(sl);
1262 evas_object_smart_callback_add(sl, "changed", sc_round, NULL);
1263 evas_object_smart_callback_add(sl, "delay,changed", sc_change, NULL);
1265 sp = elm_separator_add(win);
1266 elm_separator_horizontal_set(sp, EINA_TRUE);
1267 evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0);
1268 evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5);
1269 elm_box_pack_end(bx, sp);
1270 evas_object_show(sp);
1272 LABEL_FRAME_ADD("<hilight>Finger Size</><br/>");
1274 sl = elm_slider_add(win);
1275 evas_object_data_set(win, "fs_slider", sl);
1276 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
1277 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
1278 elm_slider_span_size_set(sl, 120);
1279 elm_slider_unit_format_set(sl, "%1.0f");
1280 elm_slider_indicator_format_set(sl, "%1.0f");
1281 elm_slider_min_max_set(sl, 5, 200);
1282 elm_slider_value_set(sl, elm_config_finger_size_get());
1283 elm_box_pack_end(bx, sl);
1284 evas_object_show(sl);
1286 evas_object_smart_callback_add(sl, "changed", fs_round, NULL);
1287 evas_object_smart_callback_add(sl, "delay,changed", fs_change, NULL);
1289 evas_object_data_set(win, "sizing", bx);
1291 elm_naviframe_item_simple_push(naviframe, bx);
1295 _status_config_access(Evas_Object *win,
1296 Evas_Object *naviframe)
1298 Evas_Object *bx, *ck;
1300 bx = elm_box_add(win);
1301 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0);
1302 evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, 0.5);
1304 ck = elm_check_add(win);
1305 elm_object_tooltip_text_set(ck, "Set access mode");
1306 elm_object_text_set(ck, "Enable Access Mode");
1307 evas_object_data_set(win, "access_check", ck);
1308 evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, 0.0);
1309 evas_object_size_hint_align_set(ck, EVAS_HINT_FILL, 0.5);
1310 elm_check_state_set(ck, elm_config_access_get());
1311 elm_box_pack_end(bx, ck);
1312 evas_object_show(ck);
1314 evas_object_smart_callback_add(ck, "changed", ac_change, NULL);
1316 evas_object_data_set(win, "access", bx);
1318 elm_naviframe_item_simple_push(naviframe, bx);
1322 _status_config_selection(Evas_Object *win,
1323 Evas_Object *naviframe)
1325 Evas_Object *bx, *ck;
1327 bx = elm_box_add(win);
1328 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0);
1329 evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, 0.5);
1331 ck = elm_check_add(win);
1332 elm_object_tooltip_text_set(ck, "Set selection mode");
1333 elm_object_text_set(ck, "Enable clear selection when unfocus");
1334 evas_object_data_set(win, "selection_check", ck);
1335 evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, 0.0);
1336 evas_object_size_hint_align_set(ck, EVAS_HINT_FILL, 0.5);
1337 elm_check_state_set(ck, elm_config_selection_unfocused_clear_get());
1338 elm_box_pack_end(bx, ck);
1339 evas_object_show(ck);
1341 evas_object_smart_callback_add(ck, "changed", sel_change, NULL);
1343 evas_object_data_set(win, "selection", bx);
1345 elm_naviframe_item_simple_push(naviframe, bx);
1348 static Evas_Object *
1349 _sample_theme_new(Evas_Object *win)
1351 Evas_Object *base, *bg, *bt, *ck, *rd, *rdg, *sl, *fr, *li, *rc, *sp;
1353 base = elm_table_add(win);
1354 evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1355 evas_object_size_hint_align_set(base, EVAS_HINT_FILL, EVAS_HINT_FILL);
1357 bg = elm_bg_add(win);
1358 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1359 evas_object_size_hint_align_set(bg, EVAS_HINT_FILL, EVAS_HINT_FILL);
1360 elm_table_pack(base, bg, 0, 0, 2, 5);
1361 evas_object_show(bg);
1363 bt = elm_button_add(win);
1364 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1365 elm_object_text_set(bt, "Button");
1366 elm_table_pack(base, bt, 0, 0, 1, 1);
1367 evas_object_show(bt);
1369 ck = elm_check_add(win);
1370 evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, 0.0);
1371 elm_object_text_set(ck, "Check");
1372 elm_table_pack(base, ck, 0, 1, 1, 1);
1373 evas_object_show(ck);
1375 rd = elm_radio_add(win);
1376 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, 0.0);
1377 elm_radio_state_value_set(rd, 0);
1378 elm_object_text_set(rd, "Radio 1");
1379 elm_table_pack(base, rd, 1, 0, 1, 1);
1380 evas_object_show(rd);
1383 rd = elm_radio_add(win);
1384 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, 0.0);
1385 elm_radio_state_value_set(rd, 1);
1386 elm_object_text_set(rd, "Radio 2");
1387 elm_radio_group_add(rd, rdg);
1388 elm_table_pack(base, rd, 1, 1, 1, 1);
1389 evas_object_show(rd);
1391 sp = elm_separator_add(win);
1392 elm_separator_horizontal_set(sp, EINA_TRUE);
1393 evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0);
1394 evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5);
1395 elm_table_pack(base, sp, 0, 2, 2, 1);
1396 evas_object_show(sp);
1398 sl = elm_slider_add(win);
1399 elm_object_text_set(sl, "Slider");
1400 elm_slider_span_size_set(sl, 120);
1401 elm_slider_min_max_set(sl, 1, 10);
1402 elm_slider_value_set(sl, 4);
1403 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
1404 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, EVAS_HINT_FILL);
1405 elm_table_pack(base, sl, 0, 3, 2, 1);
1406 evas_object_show(sl);
1408 fr = elm_frame_add(win);
1409 elm_object_text_set(fr, "Frame");
1410 elm_table_pack(base, fr, 0, 4, 2, 1);
1411 evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1412 evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
1413 evas_object_show(fr);
1415 li = elm_list_add(win);
1416 evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1417 evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL);
1418 elm_object_content_set(fr, li);
1419 evas_object_show(li);
1421 elm_list_item_append(li, "List Item 1", NULL, NULL, NULL, NULL);
1422 elm_list_item_append(li, "Second Item", NULL, NULL, NULL, NULL);
1423 elm_list_item_append(li, "Third Item", NULL, NULL, NULL, NULL);
1426 rc = evas_object_rectangle_add(evas_object_evas_get(win));
1427 evas_object_size_hint_weight_set(rc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1428 evas_object_size_hint_min_set(rc, 160, 120);
1429 elm_table_pack(base, rc, 0, 4, 2, 1);
1435 _status_config_themes(Evas_Object *win,
1436 Evas_Object *naviframe)
1438 Evas_Object *tb, *rc, *sc, *sp, *li, *pd, *fr, *bt, *sample;
1439 Eina_List *list, *l;
1442 Elm_Object_Item *list_it, *def_it = NULL;
1443 const char *theme_name, *sep[20];
1446 tb = elm_table_add(win);
1447 evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1448 evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
1450 rc = evas_object_rectangle_add(evas_object_evas_get(win));
1451 evas_object_size_hint_weight_set(rc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1452 evas_object_size_hint_min_set(rc, 0, 130);
1453 elm_table_pack(tb, rc, 0, 0, 1, 1);
1455 rc = evas_object_rectangle_add(evas_object_evas_get(win));
1456 evas_object_size_hint_weight_set(rc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1457 evas_object_size_hint_min_set(rc, 0, 200);
1458 elm_table_pack(tb, rc, 0, 1, 1, 1);
1460 /////////////////////////////////////////////
1462 pd = elm_frame_add(win);
1463 elm_object_style_set(pd, "pad_medium");
1464 evas_object_size_hint_weight_set(pd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1465 evas_object_size_hint_align_set(pd, EVAS_HINT_FILL, EVAS_HINT_FILL);
1466 elm_table_pack(tb, pd, 0, 0, 1, 1);
1467 evas_object_show(pd);
1469 li = elm_list_add(win);
1470 elm_list_multi_select_set(li, EINA_TRUE);
1471 evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1472 evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL);
1473 elm_object_content_set(pd, li);
1474 evas_object_show(li);
1476 list = elm_theme_name_available_list_new();
1477 d = elm_theme_default_get();
1478 theme_name = elm_theme_get(d);
1479 for (x = 1, sep[0] = theme_name; x < sizeof(sep) / sizeof(sep[0]); x++)
1481 sep[x] = strchr(sep[x - 1] + 1, ':');
1484 EINA_LIST_FOREACH(list, l, th)
1489 t = calloc(1, sizeof(Theme));
1490 t->name = eina_stringshare_add(th);
1491 s = elm_theme_list_item_path_get(th, &(t->in_search_path));
1494 t->path = eina_stringshare_add(s);
1497 if (t->in_search_path)
1502 s[0] = toupper(s[0]);
1503 t->label = eina_stringshare_add(s);
1507 t->label = eina_stringshare_add(s);
1511 s = strdup(ecore_file_file_get(th));
1514 s[0] = toupper(s[0]);
1515 ext = strrchr(s, '.');
1517 t->label = eina_stringshare_add(s);
1521 t->label = eina_stringshare_add(s);
1523 themes = eina_list_append(themes, t);
1524 list_it = elm_list_item_append(li, t->label, NULL, NULL, NULL, t);
1525 if (!strcmp(t->name, "default")) def_it = list_it;
1526 for (y = x - 1 /* ignore default e theme */; y > 0; y--)
1528 const char *start = (sep[y - 1][0] == ':') ? sep[y - 1] + 1 : sep[y - 1];
1529 unsigned int len = (unsigned int)(sep[y] - start);
1530 if (strncmp(start , t->name, len) || (strlen(t->name) != len)) continue;
1532 if (!elm_list_item_selected_get(list_it))
1533 elm_list_item_selected_set(list_it, EINA_TRUE);
1537 if (!elm_list_selected_items_get(li))
1538 elm_list_item_selected_set(def_it, EINA_TRUE);
1539 evas_object_smart_callback_add(li, "selected", _theme_sel, NULL);
1540 evas_object_smart_callback_add(li, "unselected", _theme_sel, NULL);
1541 elm_theme_name_available_list_free(list);
1545 pd = elm_frame_add(win);
1546 elm_object_style_set(pd, "pad_medium");
1547 evas_object_size_hint_weight_set(pd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1548 evas_object_size_hint_align_set(pd, 0.9, 0.9);
1549 elm_table_pack(tb, pd, 0, 0, 1, 1);
1550 evas_object_show(pd);
1552 /* FIXME: not implemented yet
1553 bt = elm_button_add(win);
1554 evas_object_smart_callback_add(bt, "clicked", _theme_browse, win);
1555 elm_object_text_set(bt, "Browse...");
1556 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1557 evas_object_size_hint_align_set(bt, 0.9, 0.9);
1558 elm_object_content_set(pd, bt);
1559 evas_object_show(bt);
1561 pd = elm_frame_add(win);
1562 elm_object_style_set(pd, "pad_medium");
1563 evas_object_size_hint_weight_set(pd, EVAS_HINT_EXPAND, 0.0);
1564 evas_object_size_hint_align_set(pd, EVAS_HINT_FILL, EVAS_HINT_FILL);
1565 elm_table_pack(tb, pd, 0, 1, 1, 1);
1566 evas_object_show(pd);
1568 fr = elm_frame_add(win);
1569 elm_object_text_set(fr, "Preview");
1570 evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1571 evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
1572 elm_object_content_set(pd, fr);
1573 evas_object_show(fr);
1575 sc = elm_scroller_add(win);
1576 elm_scroller_bounce_set(sc, EINA_FALSE, EINA_FALSE);
1577 evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1578 evas_object_size_hint_align_set(sc, EVAS_HINT_FILL, EVAS_HINT_FILL);
1579 elm_object_content_set(fr, sc);
1580 evas_object_show(sc);
1582 sample = _sample_theme_new(win);
1583 elm_object_content_set(sc, sample);
1584 evas_object_show(sample);
1585 evas_object_data_set(win, "theme_preview", sample);
1587 /////////////////////////////////////////////
1588 sp = elm_separator_add(win);
1589 elm_separator_horizontal_set(sp, EINA_TRUE);
1590 evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0);
1591 evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5);
1592 elm_table_pack(tb, sp, 0, 2, 1, 1);
1593 evas_object_show(sp);
1595 pd = elm_frame_add(win);
1596 elm_object_style_set(pd, "pad_medium");
1597 evas_object_size_hint_weight_set(pd, EVAS_HINT_EXPAND, 0.0);
1598 evas_object_size_hint_align_set(pd, 0.5, 0.5);
1599 elm_table_pack(tb, pd, 0, 3, 1, 1);
1600 evas_object_show(pd);
1602 bt = elm_button_add(win);
1603 evas_object_smart_callback_add(bt, "clicked", _theme_use, win);
1604 elm_object_text_set(bt, "Use Theme");
1605 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
1606 evas_object_size_hint_align_set(bt, 0.5, 0.5);
1607 elm_object_content_set(pd, bt);
1608 evas_object_show(bt);
1610 evas_object_data_set(win, "themes", tb);
1611 elm_naviframe_item_simple_push(naviframe, tb);
1615 _font_preview_update(Evas_Object *win)
1620 if (!fndata.cur_font)
1623 name = elm_font_fontconfig_name_get(fndata.cur_font, fndata.cur_style);
1624 sz = fndata.cur_size;
1627 sz = (-sz * 10) / 100;
1631 edje_object_text_class_set(evas_object_data_get(win, "font_preview"),
1632 "font_preview", name, sz);
1634 elm_font_fontconfig_name_free(name);
1638 _font_classes_list_sel(void *data __UNUSED__,
1642 const Eina_List *f_names_items, *l;
1643 Elm_Text_Class_Data *tc_data;
1644 Evas_Object *f_names_list;
1645 Elm_Object_Item *list_it;
1647 tc_data = elm_object_item_data_get(event_info);
1649 f_names_list = evas_object_data_get(elm_object_top_widget_get(obj),
1651 ELM_LIST_ENABLE(f_names_list);
1653 f_names_items = elm_list_items_get(f_names_list);
1655 EINA_LIST_FOREACH(f_names_items, l, list_it)
1659 s = elm_object_item_text_get(list_it);
1661 if (tc_data->font && !strcmp(s, tc_data->font))
1663 elm_list_item_selected_set(list_it, EINA_TRUE);
1664 elm_list_item_show(list_it);
1671 _font_names_list_sel(void *data __UNUSED__,
1675 Evas_Object *style_list, *cls_list, *win;
1676 const char *style, *sel_font;
1677 Elm_Text_Class_Data *tc_data;
1678 Elm_Object_Item *list_it, *fc_list_it;
1679 Elm_Font_Properties *efp;
1682 list_it = event_info;
1683 sel_font = elm_object_item_text_get(list_it);
1685 win = elm_object_top_widget_get(obj);
1686 style_list = evas_object_data_get(win, "font_styles_list");
1687 cls_list = evas_object_data_get(win, "font_classes_list");
1689 fc_list_it = elm_list_selected_item_get(cls_list);
1690 if (!fc_list_it) return; /* should not happen, fonts list disabled in
1693 eina_stringshare_replace(&fndata.cur_font, sel_font);
1695 tc_data = elm_object_item_data_get(fc_list_it);
1696 if (tc_data->font) eina_stringshare_del(tc_data->font);
1697 if (fndata.cur_font) tc_data->font = eina_stringshare_ref(fndata.cur_font);
1699 /* load styles list */
1700 efp = eina_hash_find(fndata.font_hash, sel_font);
1702 ELM_LIST_ENABLE(style_list);
1703 elm_list_clear(style_list);
1705 evas_event_freeze(evas_object_evas_get(style_list));
1710 EINA_LIST_FOREACH(efp->styles, l, style)
1714 i = elm_list_item_append(style_list, style, NULL, NULL,
1715 _font_styles_list_sel, NULL);
1717 if (tc_data->style && (!strcmp(style, tc_data->style)))
1721 elm_list_go(style_list);
1724 evas_event_thaw(evas_object_evas_get(style_list));
1727 elm_list_item_selected_set(list_it, EINA_TRUE);
1729 _font_preview_update(win);
1733 _font_styles_list_sel(void *data __UNUSED__,
1737 Evas_Object *fc_list, *fs_list, *win;
1738 Elm_Text_Class_Data *tc_data;
1740 Elm_Object_Item *list_it;
1742 win = elm_object_top_widget_get(obj);
1743 fc_list = evas_object_data_get(win, "font_classes_list");
1744 fs_list = evas_object_data_get(win, "font_sizes_list");
1746 list_it = elm_list_selected_item_get(fc_list);
1747 if (!list_it) return; /* should not happen */
1749 eina_stringshare_replace(&fndata.cur_style,
1750 elm_object_item_text_get(event_info));
1751 ELM_LIST_ENABLE(fs_list);
1753 tc_data = elm_object_item_data_get(list_it);
1754 eina_stringshare_del(tc_data->style);
1755 tc_data->style = eina_stringshare_ref(fndata.cur_style);
1757 evas_event_freeze(evas_object_evas_get(fs_list));
1760 EINA_LIST_FOREACH(elm_list_items_get(fs_list), l, list_it)
1762 Elm_Font_Size_Data *sdata;
1764 sdata = elm_object_item_data_get(list_it);
1765 elm_list_item_selected_set(l->data, EINA_FALSE);
1767 if (tc_data->size == sdata->size)
1769 elm_list_item_selected_set(list_it, EINA_TRUE);
1770 elm_list_item_show(list_it);
1776 evas_event_thaw(evas_object_evas_get(fs_list));
1778 _font_preview_update(win);
1782 _font_sizes_list_sel(void *data __UNUSED__,
1783 Evas_Object *obj __UNUSED__,
1784 void *event_info __UNUSED__)
1786 Elm_Text_Class_Data *tc_data;
1787 Evas_Object *fc_list, *win;
1788 Elm_Font_Size_Data *sd;
1789 Elm_Object_Item *list_it;
1791 win = elm_object_top_widget_get(obj);
1792 fc_list = evas_object_data_get(win, "font_classes_list");
1794 list_it = elm_list_selected_item_get(fc_list);
1795 if (!list_it) return; /* should not happen */
1797 sd = elm_object_item_data_get(event_info);
1798 fndata.cur_size = sd->size;
1800 tc_data = elm_object_item_data_get(list_it);
1801 tc_data->size = fndata.cur_size;
1803 _font_preview_update(win);
1807 _fstyle_list_unselect_cb(void *data __UNUSED__,
1809 void *event_info __UNUSED__)
1811 Evas_Object *sizes_list, *win;
1813 if (elm_list_selected_item_get(obj)) return;
1815 win = elm_object_top_widget_get(obj);
1817 sizes_list = evas_object_data_get(win, "font_sizes_list");
1818 ELM_LIST_DISABLE(sizes_list);
1822 _fc_list_unselect_cb(void *data __UNUSED__,
1824 void *event_info __UNUSED__)
1826 Evas_Object *font_names_list, *styles_list, *sizes_list, *win;
1828 if (elm_list_selected_item_get(obj)) return;
1830 win = elm_object_top_widget_get(obj);
1832 font_names_list = evas_object_data_get(win, "font_names_list");
1833 ELM_LIST_DISABLE(font_names_list);
1835 styles_list = evas_object_data_get(win, "font_styles_list");
1836 ELM_LIST_DISABLE(styles_list);
1838 sizes_list = evas_object_data_get(win, "font_sizes_list");
1839 ELM_LIST_DISABLE(sizes_list);
1843 _font_classes_list_load(Evas_Object *li)
1845 Elm_Text_Class_Data *tc_data;
1849 evas = evas_object_evas_get(li);
1850 evas_event_freeze(evas);
1853 EINA_LIST_FOREACH(fndata.text_classes, l, tc_data)
1854 elm_list_item_append(li, tc_data->desc, NULL, NULL,
1855 _font_classes_list_sel, tc_data);
1857 evas_object_smart_callback_add(li, "unselected", _fc_list_unselect_cb,
1862 evas_event_thaw(evas);
1866 _fonts_data_fill(Evas *evas)
1868 const Eina_List *fo_list, *l;
1869 Eina_List *text_classes;
1870 Elm_Text_Class_Data *tc_data;
1871 Elm_Font_Size_Data *sd;
1872 Elm_Font_Overlay *efo;
1873 Eina_List *evas_fonts;
1874 Elm_Text_Class *etc;
1877 evas_fonts = evas_font_available_list(evas);
1878 fndata.font_hash = elm_font_available_hash_add(evas_fonts);
1879 evas_font_available_list_free(evas, evas_fonts);
1881 text_classes = elm_config_text_classes_list_get();
1882 fo_list = elm_config_font_overlay_list_get();
1884 EINA_LIST_FOREACH(text_classes, l, etc)
1886 const Eina_List *ll;
1888 tc_data = calloc(1, sizeof(*tc_data));
1889 if (!tc_data) continue;
1891 tc_data->name = eina_stringshare_add(etc->name);
1892 tc_data->desc = eina_stringshare_add(etc->desc);
1894 EINA_LIST_FOREACH(fo_list, ll, efo)
1896 if (strcmp(tc_data->name, efo->text_class))
1901 Elm_Font_Properties *efp;
1903 efp = elm_font_properties_get(efo->font);
1906 tc_data->font = eina_stringshare_add(efp->name);
1907 /* we're sure we recorded with only 1 style selected */
1908 tc_data->style = eina_stringshare_add(efp->styles->data);
1909 elm_font_properties_free(efp);
1912 tc_data->size = efo->size;
1915 fndata.text_classes = eina_list_append(fndata.text_classes, tc_data);
1918 elm_config_text_classes_list_free(text_classes);
1920 /* FIXME: hinting later */
1921 /* fndata.hinting = e_config->font_hinting; */
1923 sd = calloc(1, sizeof(Elm_Font_Size_Data));
1924 sd->size_str = eina_stringshare_add("Tiny");
1926 fndata.font_scale_list = eina_list_append(fndata.font_scale_list, sd);
1928 sd = calloc(1, sizeof(Elm_Font_Size_Data));
1929 sd->size_str = eina_stringshare_add("Small");
1931 fndata.font_scale_list = eina_list_append(fndata.font_scale_list, sd);
1933 sd = calloc(1, sizeof(Elm_Font_Size_Data));
1934 sd->size_str = eina_stringshare_add("Normal");
1936 fndata.font_scale_list = eina_list_append(fndata.font_scale_list, sd);
1938 sd = calloc(1, sizeof(Elm_Font_Size_Data));
1939 sd->size_str = eina_stringshare_add("Big");
1941 fndata.font_scale_list = eina_list_append(fndata.font_scale_list, sd);
1943 sd = calloc(1, sizeof(Elm_Font_Size_Data));
1944 sd->size_str = eina_stringshare_add("Really Big");
1946 fndata.font_scale_list = eina_list_append(fndata.font_scale_list, sd);
1948 sd = calloc(1, sizeof(Elm_Font_Size_Data));
1949 sd->size_str = eina_stringshare_add("Huge");
1951 fndata.font_scale_list = eina_list_append(fndata.font_scale_list, sd);
1953 for (i = 5; i < 51; i++)
1958 snprintf(str, sizeof(str), "%d pixels", i);
1960 sd = calloc(1, sizeof(Elm_Font_Size_Data));
1961 sd->size_str = eina_stringshare_add(str);
1963 fndata.font_px_list = eina_list_append(fndata.font_px_list, sd);
1968 _font_sort_cb(const void *data1,
1971 if (!data1) return 1;
1972 if (!data2) return -1;
1973 return strcmp(data1, data2);
1977 _font_sizes_list_load(Evas_Object *size_list)
1979 Elm_Font_Size_Data *size_data;
1983 evas = evas_object_evas_get(size_list);
1984 evas_event_freeze(evas);
1987 EINA_LIST_FOREACH(fndata.font_scale_list, l, size_data)
1988 elm_list_item_append(size_list, size_data->size_str, NULL, NULL,
1989 _font_sizes_list_sel, size_data);
1991 EINA_LIST_FOREACH(fndata.font_px_list, l, size_data)
1992 elm_list_item_append(size_list, size_data->size_str, NULL, NULL,
1993 _font_sizes_list_sel, size_data);
1995 elm_list_go(size_list);
1997 evas_event_thaw(evas);
2001 _fnames_list_unselect_cb(void *data __UNUSED__,
2003 void *event_info __UNUSED__)
2005 Evas_Object *styles_list, *sizes_list, *win;
2007 if (elm_list_selected_item_get(obj)) return;
2009 win = elm_object_top_widget_get(obj);
2011 styles_list = evas_object_data_get(win, "font_styles_list");
2012 ELM_LIST_DISABLE(styles_list);
2014 sizes_list = evas_object_data_get(win, "font_sizes_list");
2015 ELM_LIST_DISABLE(sizes_list);
2019 _font_list_fill(const Eina_Hash *hash __UNUSED__,
2020 const void *key __UNUSED__,
2024 Elm_Font_Properties *efp;
2030 *flist = eina_list_append(*flist, efp->name);
2036 _font_names_list_load(Evas_Object *flist)
2038 Eina_List *l, *names_list = NULL;
2042 evas = evas_object_evas_get(flist);
2043 evas_event_freeze(evas);
2046 eina_hash_foreach(fndata.font_hash, _font_list_fill, &names_list);
2047 names_list = eina_list_sort(names_list, eina_list_count(names_list),
2050 EINA_LIST_FOREACH(names_list, l, font)
2051 elm_list_item_append(flist, font, NULL, NULL, _font_names_list_sel, NULL);
2053 EINA_LIST_FREE(names_list, font) ;
2055 evas_object_smart_callback_add(flist, "unselected",
2056 _fnames_list_unselect_cb, NULL);
2061 evas_event_thaw(evas);
2065 _status_config_fonts(Evas_Object *win,
2066 Evas_Object *naviframe)
2068 Evas_Object *base, *fr, *li, *rc, *preview, *sp, *pd, *bt, *bx;
2071 _fonts_data_fill(evas_object_evas_get(win));
2073 base = elm_table_add(win);
2074 evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2075 evas_object_size_hint_align_set(base, EVAS_HINT_FILL, EVAS_HINT_FILL);
2077 /* yeah, dummy rectangles are ugly as hell, but no good way yet of
2079 rc = evas_object_rectangle_add(evas_object_evas_get(win));
2080 evas_object_size_hint_weight_set(rc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2081 evas_object_size_hint_align_set(rc, EVAS_HINT_FILL, EVAS_HINT_FILL);
2082 evas_object_size_hint_min_set(rc, 70, 170);
2083 elm_table_pack(base, rc, 1, 0, 1, 1);
2085 fr = elm_frame_add(win);
2086 elm_object_text_set(fr, "Font Class");
2087 elm_table_pack(base, fr, 0, 0, 1, 2);
2088 evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2089 evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
2090 evas_object_show(fr);
2092 /* FIXME: no multiselection for this list, for now */
2093 li = elm_list_add(win);
2094 evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2095 evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL);
2096 elm_object_content_set(fr, li);
2097 evas_object_show(li);
2099 evas_object_data_set(win, "font_classes_list", li);
2100 _font_classes_list_load(li);
2102 fr = elm_frame_add(win);
2103 elm_object_text_set(fr, "Font");
2104 elm_table_pack(base, fr, 1, 0, 1, 2);
2105 evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2106 evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
2107 evas_object_show(fr);
2109 li = elm_list_add(win);
2110 evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2111 evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL);
2112 elm_object_content_set(fr, li);
2113 evas_object_show(li);
2115 evas_object_data_set(win, "font_names_list", li);
2116 _font_names_list_load(li);
2117 ELM_LIST_DISABLE(li);
2119 rc = evas_object_rectangle_add(evas_object_evas_get(win));
2120 evas_object_size_hint_weight_set(rc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2121 evas_object_size_hint_align_set(rc, EVAS_HINT_FILL, EVAS_HINT_FILL);
2122 evas_object_size_hint_min_set(rc, 70, 130);
2123 elm_table_pack(base, rc, 1, 2, 1, 1);
2125 fr = elm_frame_add(win);
2126 elm_object_text_set(fr, "Style");
2127 elm_table_pack(base, fr, 0, 2, 1, 1);
2128 evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2129 evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
2130 evas_object_show(fr);
2131 ELM_LIST_DISABLE(li);
2133 li = elm_list_add(win);
2134 evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2135 evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL);
2136 elm_object_content_set(fr, li);
2137 evas_object_show(li);
2139 evas_object_data_set(win, "font_styles_list", li);
2140 evas_object_smart_callback_add(li, "unselected", _fstyle_list_unselect_cb,
2143 fr = elm_frame_add(win);
2144 elm_object_text_set(fr, "Size");
2145 elm_table_pack(base, fr, 1, 2, 1, 1);
2146 evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2147 evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
2148 evas_object_show(fr);
2150 li = elm_list_add(win);
2151 evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2152 evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL);
2153 elm_object_content_set(fr, li);
2154 evas_object_show(li);
2156 evas_object_data_set(win, "font_sizes_list", li);
2157 _font_sizes_list_load(li);
2158 ELM_LIST_DISABLE(li);
2160 bx = elm_box_add(win);
2161 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2162 evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
2163 elm_table_pack(base, bx, 0, 3, 2, 1);
2164 evas_object_show(bx);
2166 /* FIXME: what to do here? dedicated widget? some new entry API set? */
2167 snprintf(buf, sizeof(buf), "%s/objects/font_preview.edj", elm_app_data_dir_get());
2168 preview = elm_layout_add(win);
2169 elm_layout_file_set(preview, buf, "font_preview");
2170 elm_object_part_text_set(preview, "elm.text", "Preview Text — 我真的会写ä¸æ–‡");
2171 evas_object_size_hint_weight_set(preview, EVAS_HINT_EXPAND, 0.0);
2172 evas_object_size_hint_align_set(preview, EVAS_HINT_FILL, EVAS_HINT_FILL);
2173 evas_object_show(preview);
2175 elm_box_pack_end(bx, preview);
2176 evas_object_data_set(win, "font_preview", elm_layout_edje_get(preview));
2178 /////////////////////////////////////////////
2179 sp = elm_separator_add(win);
2180 elm_separator_horizontal_set(sp, EINA_TRUE);
2181 evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0);
2182 evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5);
2183 elm_table_pack(base, sp, 0, 4, 2, 1);
2184 evas_object_show(sp);
2186 pd = elm_frame_add(win);
2187 elm_object_style_set(pd, "pad_medium");
2188 evas_object_size_hint_weight_set(pd, EVAS_HINT_EXPAND, 0.0);
2189 evas_object_size_hint_align_set(pd, 0.5, 0.5);
2190 elm_table_pack(base, pd, 0, 5, 2, 1);
2191 evas_object_show(pd);
2193 bx = elm_box_add(win);
2194 elm_box_horizontal_set(bx, EINA_TRUE);
2195 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2196 evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
2197 evas_object_show(bx);
2199 bt = elm_button_add(win);
2200 evas_object_smart_callback_add(bt, "clicked", _font_overlay_set_all, win);
2201 elm_object_text_set(bt, "Set to All");
2202 evas_object_size_hint_weight_set(bt, 0.0, 0.0);
2203 evas_object_size_hint_align_set(bt, 0.5, 0.5);
2204 elm_box_pack_end(bx, bt);
2205 evas_object_show(bt);
2207 bt = elm_button_add(win);
2208 evas_object_smart_callback_add(bt, "clicked", _font_overlay_reset, win);
2209 elm_object_text_set(bt, "Reset");
2210 evas_object_size_hint_weight_set(bt, 0.0, 0.0);
2211 evas_object_size_hint_align_set(bt, 0.5, 0.5);
2212 elm_box_pack_end(bx, bt);
2213 evas_object_show(bt);
2215 bt = elm_button_add(win);
2216 evas_object_smart_callback_add(bt, "clicked", _font_overlay_reset_all, win);
2217 elm_object_text_set(bt, "Reset All");
2218 evas_object_size_hint_weight_set(bt, 0.0, 0.0);
2219 evas_object_size_hint_align_set(bt, 0.5, 0.5);
2220 elm_box_pack_end(bx, bt);
2221 evas_object_show(bt);
2223 bt = elm_button_add(win);
2224 evas_object_smart_callback_add(bt, "clicked", _font_overlay_change, win);
2225 elm_object_text_set(bt, "Apply");
2226 evas_object_size_hint_weight_set(bt, 0.0, 0.0);
2227 evas_object_size_hint_align_set(bt, 0.5, 0.5);
2228 elm_box_pack_end(bx, bt);
2229 evas_object_show(bt);
2231 elm_object_content_set(pd, bx);
2233 evas_object_data_set(win, "fonts", base);
2235 elm_naviframe_item_simple_push(naviframe, base);
2239 _engines_list_item_del_cb(void *data,
2240 Evas_Object *obj __UNUSED__,
2241 void *event_info __UNUSED__)
2247 _profiles_list_item_del_cb(void *data,
2248 Evas_Object *obj __UNUSED__,
2249 void *event_info __UNUSED__)
2255 _profiles_list_selected_cb(void *data,
2257 void *event_info __UNUSED__)
2259 const char *cur_profile = NULL;
2260 const char *sel_profile, *pdir;
2261 const char *prof_name;
2265 Efreet_Desktop *desk = NULL;
2272 cur_profile = elm_config_profile_get();
2274 pdir = elm_config_profile_dir_get(sel_profile, EINA_TRUE);
2275 if (!pdir) pdir = elm_config_profile_dir_get(sel_profile, EINA_FALSE);
2277 snprintf(buf, sizeof(buf), "%s/profile.desktop", pdir);
2278 desk = efreet_desktop_new(buf);
2279 if ((desk) && (desk->name)) prof_name = desk->name;
2282 if (desk) efreet_desktop_free(desk);
2283 pdir = elm_config_profile_dir_get(sel_profile, EINA_FALSE);
2284 snprintf(buf, sizeof(buf), "%s/profile.desktop", pdir);
2285 desk = efreet_desktop_new(buf);
2286 if ((desk) && (desk->name)) prof_name = desk->name;
2287 else prof_name = cur_profile;
2290 prof_name = cur_profile;
2293 elm_object_disabled_set(evas_object_data_get(obj, "prof_reset_btn"),
2297 elm_object_disabled_set(evas_object_data_get(obj, "prof_del_btn"),
2299 elm_object_disabled_set(evas_object_data_get(obj, "prof_reset_btn"),
2301 elm_object_disabled_set(evas_object_data_get(obj, "prof_use_btn"),
2303 elm_config_profile_dir_free(pdir);
2306 snprintf(buf, sizeof(buf), "<hilight>Selected profile: %s</><br/>",
2308 elm_object_text_set(evas_object_data_get(obj, "prof_name_lbl"), buf);
2310 en = evas_object_data_get(obj, "prof_desc_entry");
2312 if (desk) elm_object_text_set(en, desk->comment);
2315 elm_object_text_set(en, "Unknown");
2318 if (desk) efreet_desktop_free(desk);
2323 _profiles_list_fill(Evas_Object *l_widget,
2326 const char *cur_profile = NULL;
2327 const char *profile;
2328 void *sel_it = NULL;
2334 elm_list_clear(l_widget);
2336 cur_profile = elm_config_profile_get();
2338 EINA_LIST_FOREACH(p_names, l, profile)
2341 Efreet_Desktop *desk = NULL;
2343 const char *label, *ext, *pdir;
2345 Elm_Object_Item *list_it;
2348 pdir = elm_config_profile_dir_get(profile, EINA_TRUE);
2349 if (!pdir) pdir = elm_config_profile_dir_get(profile, EINA_FALSE);
2353 snprintf(buf, sizeof(buf), "%s/profile.desktop", pdir);
2354 desk = efreet_desktop_new(buf);
2355 if ((desk) && (desk->name)) label = desk->name;
2358 if (desk) efreet_desktop_free(desk);
2359 pdir = elm_config_profile_dir_get(profile, EINA_FALSE);
2360 snprintf(buf, sizeof(buf), "%s/profile.desktop", pdir);
2361 desk = efreet_desktop_new(buf);
2362 if ((desk) && (desk->name)) label = desk->name;
2363 else label = profile;
2368 if (pdir) snprintf(buf, sizeof(buf), "%s/icon.edj", pdir);
2370 if ((desk) && (desk->icon) && (pdir))
2371 snprintf(buf, sizeof(buf), "%s/%s", pdir, desk->icon);
2373 ic = elm_icon_add(l_widget);
2374 ext = strrchr(buf, '.');
2377 if (!strcmp(ext, ".edj")) elm_image_file_set(ic, buf, "icon");
2378 else elm_image_file_set(ic, buf, NULL);
2381 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL,
2383 evas_object_show(ic);
2385 list_it = elm_list_item_append(l_widget, label, ic, NULL,
2386 _profiles_list_selected_cb,
2388 elm_object_item_del_cb_set(list_it, _profiles_list_item_del_cb);
2389 if (cur_profile && !strcmp(profile, cur_profile))
2392 elm_config_profile_dir_free(pdir);
2395 if (desk) efreet_desktop_free(desk);
2399 if (sel_it) elm_list_item_selected_set(sel_it, EINA_TRUE);
2400 elm_list_go(l_widget);
2404 _profiles_list_unselect_cb(void *data __UNUSED__,
2406 void *event_info __UNUSED__)
2408 if (elm_list_selected_item_get(obj)) return;
2409 elm_object_disabled_set(evas_object_data_get(obj, "prof_del_btn"),
2411 elm_object_disabled_set(evas_object_data_get(obj, "prof_reset_btn"),
2413 elm_object_disabled_set(evas_object_data_get(obj, "prof_use_btn"),
2418 _status_config_profiles(Evas_Object *win,
2419 Evas_Object *naviframe)
2421 Evas_Object *li, *bx, *fr_bx1, *fr_bx2, *btn_bx, *fr, *lb, *en, *sp, *pd,
2426 bx = elm_box_add(win);
2427 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2428 evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
2430 fr_bx1 = elm_box_add(win);
2431 evas_object_size_hint_weight_set(fr_bx1, EVAS_HINT_EXPAND,
2433 evas_object_size_hint_align_set(fr_bx1, EVAS_HINT_FILL, EVAS_HINT_FILL);
2434 elm_box_homogeneous_set(fr_bx1, EINA_TRUE);
2435 evas_object_show(fr_bx1);
2437 fr_bx2 = elm_box_add(win);
2438 evas_object_size_hint_weight_set(fr_bx2, EVAS_HINT_EXPAND,
2440 evas_object_size_hint_align_set(fr_bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2441 evas_object_show(fr_bx2);
2443 fr = elm_frame_add(win);
2444 elm_object_text_set(fr, "Available Profiles");
2445 evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2446 evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
2447 elm_object_content_set(fr, fr_bx1);
2448 elm_box_pack_end(bx, fr);
2449 evas_object_show(fr);
2451 li = elm_list_add(win);
2452 evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2453 evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL);
2454 evas_object_smart_callback_add(li, "unselected", _profiles_list_unselect_cb,
2457 profs = elm_config_profile_list_get();
2459 evas_object_show(li);
2460 elm_box_pack_end(fr_bx2, li);
2462 lb = elm_label_add(win);
2463 evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, 0.0);
2464 evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, 0.5);
2466 evas_object_show(lb);
2468 en = elm_entry_add(win);
2469 elm_entry_scrollable_set(en, EINA_TRUE);
2470 elm_entry_editable_set(en, EINA_FALSE);
2471 evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2472 evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);
2473 evas_object_show(en);
2475 evas_object_data_set(li, "prof_name_lbl", lb);
2476 evas_object_data_set(li, "prof_desc_entry", en);
2478 elm_box_pack_end(fr_bx2, lb);
2479 elm_box_pack_end(fr_bx1, fr_bx2);
2480 elm_box_pack_end(fr_bx1, en);
2482 /////////////////////////////////////////////
2483 sp = elm_separator_add(win);
2484 elm_separator_horizontal_set(sp, EINA_TRUE);
2485 evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0);
2486 evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5);
2487 elm_box_pack_end(bx, sp);
2488 evas_object_show(sp);
2490 pd = elm_frame_add(win);
2491 elm_object_style_set(pd, "pad_medium");
2492 evas_object_size_hint_weight_set(pd, 0.0, 0.0);
2493 evas_object_size_hint_align_set(pd, 0.5, 0.5);
2494 elm_box_pack_end(bx, pd);
2495 evas_object_show(pd);
2497 btn_bx = elm_box_add(win);
2498 elm_box_horizontal_set(btn_bx, EINA_TRUE);
2499 evas_object_size_hint_weight_set(btn_bx, EVAS_HINT_EXPAND,
2501 evas_object_size_hint_align_set(btn_bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
2502 evas_object_show(btn_bx);
2504 bt = elm_button_add(win);
2505 evas_object_smart_callback_add(bt, "clicked", _profile_use, li);
2506 elm_object_text_set(bt, "Use");
2507 evas_object_size_hint_weight_set(bt, 0.0, 0.0);
2508 evas_object_size_hint_align_set(bt, 0.5, 0.5);
2509 elm_box_pack_end(btn_bx, bt);
2510 evas_object_show(bt);
2512 evas_object_data_set(li, "prof_use_btn", bt);
2514 bt = elm_button_add(win);
2515 evas_object_smart_callback_add(bt, "clicked", _btn_todo, NULL); /* TODO */
2516 elm_object_text_set(bt, "Delete");
2517 evas_object_size_hint_weight_set(bt, 0.0, 0.0);
2518 evas_object_size_hint_align_set(bt, 0.5, 0.5);
2519 elm_box_pack_end(btn_bx, bt);
2520 evas_object_show(bt);
2522 evas_object_data_set(li, "prof_del_btn", bt);
2524 bt = elm_button_add(win);
2525 evas_object_smart_callback_add(bt, "clicked", _profile_reset, li);
2526 elm_object_text_set(bt, "Reset");
2527 evas_object_size_hint_weight_set(bt, 0.0, 0.0);
2528 evas_object_size_hint_align_set(bt, 0.5, 0.5);
2529 elm_box_pack_end(btn_bx, bt);
2530 evas_object_show(bt);
2532 evas_object_data_set(li, "prof_reset_btn", bt);
2534 bt = elm_button_add(win);
2535 evas_object_smart_callback_add(bt, "clicked", _btn_todo, NULL); /* TODO */
2536 elm_object_text_set(bt, "Add new");
2537 evas_object_size_hint_weight_set(bt, 0.0, 0.0);
2538 evas_object_size_hint_align_set(bt, 0.5, 0.5);
2539 elm_box_pack_end(btn_bx, bt);
2540 evas_object_show(bt);
2542 elm_object_content_set(pd, btn_bx);
2544 evas = evas_object_evas_get(li);
2545 evas_event_freeze(evas);
2548 _profiles_list_fill(li, profs);
2550 elm_config_profile_list_free(profs);
2553 evas_event_thaw(evas);
2555 evas_object_data_set(win, "profiles", bx);
2556 elm_naviframe_item_simple_push(naviframe, bx);
2560 _status_config_scrolling(Evas_Object *win,
2561 Evas_Object *naviframe)
2563 Evas_Object *lb, *pd, *bx, *sl, *sp, *ck, *sc;
2565 bx = elm_box_add(win);
2566 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0);
2567 evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, 0.5);
2569 sc = elm_scroller_add(win);
2570 evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2571 evas_object_size_hint_align_set(sc, EVAS_HINT_FILL, EVAS_HINT_FILL);
2572 elm_scroller_bounce_set(sc, EINA_FALSE, EINA_TRUE);
2573 evas_object_show(sc);
2574 elm_object_content_set(sc, bx);
2576 ck = elm_check_add(win);
2577 elm_object_tooltip_text_set(ck, "Set whether scrollers should bounce<br/>"
2578 "when they reach their viewport's edge<br/>"
2580 elm_object_text_set(ck, "Enable scroll bounce");
2581 evas_object_data_set(win, "scroll_bounce_check", ck);
2582 evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, 0.0);
2583 evas_object_size_hint_align_set(ck, EVAS_HINT_FILL, 0.5);
2584 elm_check_state_set(ck, elm_config_scroll_bounce_enabled_get());
2585 elm_box_pack_end(bx, ck);
2586 evas_object_show(ck);
2588 evas_object_smart_callback_add(ck, "changed", sb_change, NULL);
2590 LABEL_FRAME_ADD("<hilight>Scroll bounce friction</>");
2592 sl = elm_slider_add(win);
2593 elm_object_tooltip_text_set(sl, "This is the amount of inertia a <br/>"
2594 "scroller will impose at bounce animations");
2595 evas_object_data_set(win, "bounce_friction_slider", sl);
2596 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
2597 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
2598 elm_slider_span_size_set(sl, 120);
2599 elm_slider_unit_format_set(sl, "%1.2f");
2600 elm_slider_indicator_format_set(sl, "%1.2f");
2601 elm_slider_min_max_set(sl, 0.0, 4.0);
2602 elm_slider_value_set(sl, elm_config_scroll_bounce_friction_get());
2603 elm_box_pack_end(bx, sl);
2604 evas_object_show(sl);
2606 evas_object_smart_callback_add(sl, "changed", bf_round, NULL);
2607 evas_object_smart_callback_add(sl, "delay,changed", bf_change, NULL);
2609 sp = elm_separator_add(win);
2610 elm_separator_horizontal_set(sp, EINA_TRUE);
2611 evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0);
2612 evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5);
2613 elm_box_pack_end(bx, sp);
2614 evas_object_show(sp);
2616 ck = elm_check_add(win);
2617 elm_object_tooltip_text_set(ck, "Set whether scrollers should be<br/>"
2618 "draggable from any point in their views");
2619 elm_object_text_set(ck, "Enable thumb scroll");
2620 evas_object_data_set(win, "thumbscroll_check", ck);
2621 evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, 0.0);
2622 evas_object_size_hint_align_set(ck, EVAS_HINT_FILL, 0.5);
2623 elm_check_state_set(ck, elm_config_scroll_thumbscroll_enabled_get());
2624 elm_box_pack_end(bx, ck);
2625 evas_object_show(ck);
2627 evas_object_smart_callback_add(ck, "changed", ts_change, NULL);
2629 LABEL_FRAME_ADD("<hilight>Thumb scroll threshold</>");
2631 sl = elm_slider_add(win);
2632 elm_object_tooltip_text_set(sl, "This is the number of pixels one should<br/>"
2633 "travel while dragging a scroller's view<br/>"
2634 "to actually trigger scrolling");
2635 evas_object_data_set(win, "thumbscroll_threshold_slider", sl);
2636 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
2637 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
2638 elm_slider_span_size_set(sl, 120);
2639 elm_slider_unit_format_set(sl, "%1.0f pixels");
2640 elm_slider_indicator_format_set(sl, "%1.0f");
2641 elm_slider_min_max_set(sl, 8.0, 50.0);
2642 elm_slider_value_set(sl, elm_config_scroll_thumbscroll_threshold_get());
2643 elm_box_pack_end(bx, sl);
2644 evas_object_show(sl);
2646 evas_object_smart_callback_add(sl, "changed", tst_round, NULL);
2647 evas_object_smart_callback_add(sl, "delay,changed", tst_change, NULL);
2649 LABEL_FRAME_ADD("<hilight>Thumb scroll hold threshold</>");
2651 sl = elm_slider_add(win);
2652 elm_object_tooltip_text_set(sl, "This is the number of pixels the range<br/>"
2653 "which can be scrolled, while the scroller<br/>"
2655 evas_object_data_set(win, "thumbscroll_hold_threshold_slider", sl);
2656 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
2657 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
2658 elm_slider_span_size_set(sl, 120);
2659 elm_slider_unit_format_set(sl, "%1.0f pixels");
2660 elm_slider_indicator_format_set(sl, "%1.0f");
2661 elm_slider_min_max_set(sl, 4.0, 500.0);
2662 elm_slider_value_set(sl, elm_config_scroll_thumbscroll_threshold_get());
2663 elm_box_pack_end(bx, sl);
2664 evas_object_show(sl);
2666 evas_object_smart_callback_add(sl, "changed", tsht_round, NULL);
2667 evas_object_smart_callback_add(sl, "delay,changed", tsht_change, NULL);
2669 LABEL_FRAME_ADD("<hilight>Thumb scroll momentum threshold</>");
2671 sl = elm_slider_add(win);
2672 elm_object_tooltip_text_set(sl, "This is the minimum speed of mouse <br/>"
2673 "cursor movement which will trigger<br/>"
2674 "list self scrolling animation after a<br/>"
2675 "mouse up event (pixels/second)");
2676 evas_object_data_set(win, "ts_momentum_threshold_slider", sl);
2677 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
2678 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
2679 elm_slider_span_size_set(sl, 120);
2680 elm_slider_unit_format_set(sl, "%1.0f pixels/s");
2681 elm_slider_indicator_format_set(sl, "%1.0f");
2682 elm_slider_min_max_set(sl, 10.0, 200.0);
2683 elm_slider_value_set(sl, elm_config_scroll_thumbscroll_momentum_threshold_get());
2684 elm_box_pack_end(bx, sl);
2685 evas_object_show(sl);
2687 evas_object_smart_callback_add(sl, "changed", tsmt_round, NULL);
2688 evas_object_smart_callback_add(sl, "delay,changed", tsmt_change,
2691 LABEL_FRAME_ADD("<hilight>Thumb scroll friction</>");
2693 sl = elm_slider_add(win);
2694 elm_object_tooltip_text_set(sl, "This is the amount of inertia a<br/>"
2695 "scroller will impose at self scrolling<br/>"
2697 evas_object_data_set(win, "thumbscroll_friction_slider", sl);
2698 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
2699 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
2700 elm_slider_span_size_set(sl, 120);
2701 elm_slider_unit_format_set(sl, "%1.1f");
2702 elm_slider_indicator_format_set(sl, "%1.1f");
2703 elm_slider_min_max_set(sl, 0.0, 15.0);
2704 elm_slider_value_set(sl, elm_config_scroll_thumbscroll_friction_get());
2705 elm_box_pack_end(bx, sl);
2706 evas_object_show(sl);
2708 evas_object_smart_callback_add(sl, "changed", tsf_round, NULL);
2709 evas_object_smart_callback_add(sl, "delay,changed", tsf_change, NULL);
2711 LABEL_FRAME_ADD("<hilight>Thumb scroll border friction</>");
2713 sl = elm_slider_add(win);
2714 elm_object_tooltip_text_set(sl, "This is the amount of lag between your<br/>"
2715 "actual mouse cursor dragging movement<br/>"
2716 "and a scroller's view movement itself,<br/>"
2717 "while pushing it into bounce state<br/>"
2719 evas_object_data_set(win, "ts_border_friction_slider", sl);
2720 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
2721 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
2722 elm_slider_span_size_set(sl, 120);
2723 elm_slider_unit_format_set(sl, "%1.2f");
2724 elm_slider_indicator_format_set(sl, "%1.2f");
2725 elm_slider_min_max_set(sl, 0.0, 1.0);
2726 elm_slider_value_set(sl, elm_config_scroll_thumbscroll_border_friction_get());
2727 elm_box_pack_end(bx, sl);
2728 evas_object_show(sl);
2730 evas_object_smart_callback_add(sl, "changed", tsbf_round, NULL);
2731 evas_object_smart_callback_add(sl, "delay,changed", tsbf_change, NULL);
2733 LABEL_FRAME_ADD("<hilight>Thumb scroll sensitivity friction</>");
2735 sl = elm_slider_add(win);
2736 elm_object_tooltip_text_set(sl, "This is the sensitivity amount which<br/>"
2737 "is be multiplied by the length of mouse<br/>"
2739 evas_object_data_set(win, "ts_sensitivity_friction_slider", sl);
2740 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
2741 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
2742 elm_slider_span_size_set(sl, 120);
2743 elm_slider_unit_format_set(sl, "%1.2f");
2744 elm_slider_indicator_format_set(sl, "%1.2f");
2745 elm_slider_min_max_set(sl, 0.1, 1.0);
2746 elm_slider_value_set(sl, elm_config_scroll_thumbscroll_sensitivity_friction_get());
2747 elm_box_pack_end(bx, sl);
2748 evas_object_show(sl);
2750 evas_object_smart_callback_add(sl, "changed", tssf_round, NULL);
2751 evas_object_smart_callback_add(sl, "delay,changed", tssf_change, NULL);
2753 sp = elm_separator_add(win);
2754 elm_separator_horizontal_set(sp, EINA_TRUE);
2755 evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0);
2756 evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5);
2757 elm_box_pack_end(bx, sp);
2758 evas_object_show(sp);
2760 LABEL_FRAME_ADD("<hilight>Page scroll friction</>");
2762 sl = elm_slider_add(win);
2763 elm_object_tooltip_text_set(sl, "This is the amount of inertia a<br/>"
2764 "paged scroller will impose at<br/>"
2765 "page fitting animations");
2766 evas_object_data_set(win, "page_scroll_friction_slider", sl);
2767 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
2768 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
2769 elm_slider_span_size_set(sl, 120);
2770 elm_slider_unit_format_set(sl, "%1.1f");
2771 elm_slider_indicator_format_set(sl, "%1.1f");
2772 elm_slider_min_max_set(sl, 0.0, 5.0);
2773 elm_slider_value_set(sl, elm_config_scroll_page_scroll_friction_get());
2774 elm_box_pack_end(bx, sl);
2775 evas_object_show(sl);
2777 evas_object_smart_callback_add(sl, "changed", ps_round, NULL);
2778 evas_object_smart_callback_add(sl, "delay,changed", ps_change, NULL);
2780 LABEL_FRAME_ADD("<hilight>Bring in scroll friction</>");
2782 sl = elm_slider_add(win);
2783 elm_object_tooltip_text_set(sl, "This is the amount of inertia a<br/>"
2784 "scroller will impose at region bring<br/>"
2786 evas_object_data_set(win, "bring_in_scroll_friction_slider", sl);
2787 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
2788 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
2789 elm_slider_span_size_set(sl, 120);
2790 elm_slider_unit_format_set(sl, "%1.1f");
2791 elm_slider_indicator_format_set(sl, "%1.1f");
2792 elm_slider_min_max_set(sl, 0.0, 5.0);
2793 elm_slider_value_set(sl, elm_config_scroll_bring_in_scroll_friction_get());
2794 elm_box_pack_end(bx, sl);
2795 evas_object_show(sl);
2797 evas_object_smart_callback_add(sl, "changed", bis_round, NULL);
2798 evas_object_smart_callback_add(sl, "delay,changed", bis_change, NULL);
2800 LABEL_FRAME_ADD("<hilight>Zoom scroll friction</>");
2802 sl = elm_slider_add(win);
2803 elm_object_tooltip_text_set(sl, "This is the amount of inertia<br/>"
2804 "scrollers will impose at animations<br/>"
2805 "triggered by Elementary widgets'<br/>"
2807 evas_object_data_set(win, "zoom_scroll_friction_slider", sl);
2808 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
2809 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
2810 elm_slider_span_size_set(sl, 120);
2811 elm_slider_unit_format_set(sl, "%1.1f");
2812 elm_slider_indicator_format_set(sl, "%1.1f");
2813 elm_slider_min_max_set(sl, 0.0, 5.0);
2814 elm_slider_value_set(sl, elm_config_scroll_zoom_friction_get());
2815 elm_box_pack_end(bx, sl);
2816 evas_object_show(sl);
2818 evas_object_smart_callback_add(sl, "changed", zf_round, NULL);
2819 evas_object_smart_callback_add(sl, "delay,changed", zf_change, NULL);
2821 evas_object_data_set(win, "scrolling", sc);
2823 elm_naviframe_item_simple_push(naviframe, sc);
2827 _engine_name_prettify(const char *engine)
2831 ret = strdup(engine);
2834 while ((ptr = strpbrk(ret, "_")))
2842 /* FIXME! ideally, we would trim elm_config.c's _elm_engines list at
2843 build time, making a getter for is as in ecore-evas. */
2845 _elm_engine_supported(const char *engine)
2847 const char *engines[] = {
2856 "software_16_wince_gdi",
2870 for (i = 0; engines[i]; i++)
2872 #define ENGINE_COMPARE(name) (!strcmp(engines[i], name))
2873 if (ENGINE_COMPARE(engine))
2875 #undef ENGINE_COMPARE
2882 _engines_list_fill(Evas_Object *l_widget,
2885 const char *engine, *cur_engine;
2886 void *sel_it = NULL;
2892 cur_engine = elm_config_engine_get();
2894 EINA_LIST_FOREACH(e_names, l, engine)
2897 Elm_Object_Item *list_it;
2899 if (!_elm_engine_supported(engine))
2902 label = _engine_name_prettify(engine);
2904 list_it = elm_list_item_append(l_widget, label, NULL, NULL, NULL,
2906 elm_object_item_del_cb_set(list_it, _engines_list_item_del_cb);
2907 free((void *)label);
2909 if (!strcmp(cur_engine, engine))
2913 if (sel_it) elm_list_item_selected_set(sel_it, EINA_TRUE);
2914 elm_list_go(l_widget);
2918 _status_config_rendering(Evas_Object *win,
2919 Evas_Object *naviframe)
2921 Evas_Object *li, *bx, *fr, *sp, *pd, *bt;
2924 bx = elm_box_add(win);
2925 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2926 evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
2928 fr = elm_frame_add(win);
2929 elm_object_text_set(fr, "Available Engines");
2930 evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2931 evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
2932 elm_box_pack_end(bx, fr);
2933 evas_object_show(fr);
2935 li = elm_list_add(win);
2936 elm_object_content_set(fr, li);
2937 evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2938 evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL);
2940 engines = ecore_evas_engines_get();
2941 _engines_list_fill(li, engines);
2942 ecore_evas_engines_free(engines);
2944 evas_object_show(li);
2945 evas_object_data_set(win, "engines_list", li);
2947 /////////////////////////////////////////////
2948 sp = elm_separator_add(win);
2949 elm_separator_horizontal_set(sp, EINA_TRUE);
2950 evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0);
2951 evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5);
2952 elm_box_pack_end(bx, sp);
2953 evas_object_show(sp);
2955 pd = elm_frame_add(win);
2956 elm_object_style_set(pd, "pad_medium");
2957 evas_object_size_hint_weight_set(pd, 0.0, 0.0);
2958 evas_object_size_hint_align_set(pd, 0.5, 0.5);
2959 elm_box_pack_end(bx, pd);
2960 evas_object_show(pd);
2962 bt = elm_button_add(win);
2963 evas_object_smart_callback_add(bt, "clicked", _engine_use, li);
2964 elm_object_text_set(bt, "Use Engine");
2965 evas_object_size_hint_weight_set(bt, 0.0, 0.0);
2966 evas_object_size_hint_align_set(bt, 0.5, 0.5);
2967 elm_object_content_set(pd, bt);
2968 evas_object_show(bt);
2970 evas_object_data_set(win, "rendering", bx);
2971 elm_naviframe_item_simple_push(naviframe, bx);
2975 _status_config_caches(Evas_Object *win,
2976 Evas_Object *naviframe)
2978 Evas_Object *lb, *pd, *bx, *sl, *sp, *ck;
2980 bx = elm_box_add(win);
2981 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0);
2982 evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, 0.5);
2984 LABEL_FRAME_ADD("<hilight>Cache Flush Interval (8 ticks per second)</>");
2986 sl = elm_slider_add(win);
2987 evas_object_data_set(win, "cache_flush_interval_slider", sl);
2988 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
2989 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
2990 elm_slider_span_size_set(sl, 120);
2991 elm_slider_unit_format_set(sl, "%1.0f ticks");
2992 elm_slider_indicator_format_set(sl, "%1.0f");
2993 elm_slider_min_max_set(sl, 8.0, 4096.0);
2994 elm_slider_value_set(sl, elm_config_cache_flush_interval_get());
2995 elm_object_disabled_set(sl, !elm_config_cache_flush_enabled_get());
2997 ck = elm_check_add(win);
2998 evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, 0.0);
2999 evas_object_size_hint_align_set(ck, EVAS_HINT_FILL, 0.5);
3000 elm_object_text_set(ck, "Enable Flushing");
3001 elm_check_state_set(ck, elm_config_cache_flush_enabled_get());
3002 evas_object_smart_callback_add(ck, "changed", cf_enable, sl);
3003 elm_box_pack_end(bx, ck);
3004 evas_object_show(ck);
3006 elm_box_pack_end(bx, sl);
3007 evas_object_show(sl);
3009 evas_object_smart_callback_add(sl, "changed", cf_round, NULL);
3010 evas_object_smart_callback_add(sl, "delay,changed", cf_change, NULL);
3012 sp = elm_separator_add(win);
3013 elm_separator_horizontal_set(sp, EINA_TRUE);
3014 evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0);
3015 evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5);
3016 elm_box_pack_end(bx, sp);
3017 evas_object_show(sp);
3019 LABEL_FRAME_ADD("<hilight>Font Cache Size</>");
3021 sl = elm_slider_add(win);
3022 evas_object_data_set(win, "font_cache_slider", sl);
3023 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
3024 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
3025 elm_slider_span_size_set(sl, 120);
3026 elm_slider_unit_format_set(sl, "%1.1f MB");
3027 elm_slider_indicator_format_set(sl, "%1.1f");
3028 elm_slider_min_max_set(sl, 0.0, 4.0);
3029 elm_slider_value_set(sl, (double)elm_config_cache_font_cache_size_get() / 1024.0);
3030 elm_box_pack_end(bx, sl);
3031 evas_object_show(sl);
3033 evas_object_smart_callback_add(sl, "changed", fc_round, NULL);
3034 evas_object_smart_callback_add(sl, "delay,changed", fc_change, NULL);
3036 sp = elm_separator_add(win);
3037 elm_separator_horizontal_set(sp, EINA_TRUE);
3038 evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0);
3039 evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5);
3040 elm_box_pack_end(bx, sp);
3041 evas_object_show(sp);
3043 LABEL_FRAME_ADD("<hilight>Image Cache Size</>");
3045 sl = elm_slider_add(win);
3046 evas_object_data_set(win, "image_cache_slider", sl);
3047 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
3048 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
3049 elm_slider_span_size_set(sl, 120);
3050 elm_slider_unit_format_set(sl, "%1.0f MB");
3051 elm_slider_indicator_format_set(sl, "%1.0f");
3052 elm_slider_min_max_set(sl, 0, 32);
3053 elm_slider_value_set(sl, (double)elm_config_cache_image_cache_size_get() / 1024.0);
3054 elm_box_pack_end(bx, sl);
3055 evas_object_show(sl);
3057 evas_object_smart_callback_add(sl, "changed", ic_round, NULL);
3058 evas_object_smart_callback_add(sl, "delay,changed", ic_change, NULL);
3060 sp = elm_separator_add(win);
3061 elm_separator_horizontal_set(sp, EINA_TRUE);
3062 evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0);
3063 evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5);
3064 elm_box_pack_end(bx, sp);
3065 evas_object_show(sp);
3067 LABEL_FRAME_ADD("<hilight>Number of Edje Files to Cache</>");
3069 sl = elm_slider_add(win);
3070 evas_object_data_set(win, "edje_file_cache_slider", sl);
3071 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
3072 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
3073 elm_slider_span_size_set(sl, 120);
3074 elm_slider_unit_format_set(sl, "%1.0f files");
3075 elm_slider_indicator_format_set(sl, "%1.0f");
3076 elm_slider_min_max_set(sl, 0, 32);
3077 elm_slider_value_set(sl, elm_config_cache_edje_file_cache_size_get());
3078 elm_box_pack_end(bx, sl);
3079 evas_object_show(sl);
3081 evas_object_smart_callback_add(sl, "changed", efc_round, NULL);
3082 evas_object_smart_callback_add(sl, "delay,changed", efc_change, NULL);
3084 sp = elm_separator_add(win);
3085 elm_separator_horizontal_set(sp, EINA_TRUE);
3086 evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0);
3087 evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5);
3088 elm_box_pack_end(bx, sp);
3089 evas_object_show(sp);
3091 LABEL_FRAME_ADD("<hilight>Number of Edje Collections to Cache</>");
3093 sl = elm_slider_add(win);
3094 evas_object_data_set(win, "edje_collection_cache_slider", sl);
3095 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
3096 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
3097 elm_slider_span_size_set(sl, 120);
3098 elm_slider_unit_format_set(sl, "%1.0f collections");
3099 elm_slider_indicator_format_set(sl, "%1.0f");
3100 elm_slider_min_max_set(sl, 0, 128);
3101 elm_slider_value_set(sl, elm_config_cache_edje_collection_cache_size_get());
3102 elm_box_pack_end(bx, sl);
3103 evas_object_show(sl);
3105 evas_object_smart_callback_add(sl, "changed", ecc_round, NULL);
3106 evas_object_smart_callback_add(sl, "delay,changed", ecc_change, NULL);
3108 evas_object_data_set(win, "caches", bx);
3110 elm_naviframe_item_simple_push(naviframe, bx);
3114 _status_config_full(Evas_Object *win,
3117 Evas_Object *tb, *naviframe;
3118 Elm_Object_Item *tb_sizing, *tb_it;
3120 tb = elm_toolbar_add(win);
3121 elm_toolbar_select_mode_set(tb, ELM_OBJECT_SELECT_MODE_ALWAYS);
3122 elm_toolbar_menu_parent_set(tb, win);
3123 elm_toolbar_homogeneous_set(tb, EINA_FALSE);
3124 evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, 0.0);
3125 evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
3127 tb_sizing = elm_toolbar_item_append(tb, "zoom-fit-best", "Sizing",
3129 elm_toolbar_item_priority_set(tb_sizing, 100);
3131 tb_it = elm_toolbar_item_append(tb, "preferences-desktop-theme", "Theme",
3133 elm_toolbar_item_priority_set(tb_it, 90);
3135 elm_toolbar_item_append(tb, "preferences-desktop-font", "Fonts",
3138 tb_it = elm_toolbar_item_append(tb, "system-users", "Profiles",
3140 elm_toolbar_item_priority_set(tb_it, 90);
3142 elm_toolbar_item_append(tb, "system-run", "Scrolling", _cf_scrolling, win);
3143 elm_toolbar_item_append(tb, "video-display", "Rendering",
3144 _cf_rendering, win);
3145 elm_toolbar_item_append(tb, "appointment-new", "Caches", _cf_caches, win);
3146 elm_toolbar_item_append(tb, "stock_spellcheck", "Access", _cf_access, win);
3147 elm_toolbar_item_append(tb, "clear-selection-check", "Selection", _cf_selection, win);
3149 elm_box_pack_end(bx0, tb);
3150 evas_object_show(tb);
3152 naviframe = elm_naviframe_add(win);
3153 evas_object_size_hint_align_set(naviframe, EVAS_HINT_FILL, EVAS_HINT_FILL);
3154 evas_object_size_hint_weight_set(naviframe, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
3155 evas_object_data_set(win, "naviframe", naviframe);
3157 _status_config_themes(win, naviframe);
3158 _status_config_fonts(win, naviframe);
3159 _status_config_profiles(win, naviframe);
3160 _status_config_rendering(win, naviframe);
3161 _status_config_scrolling(win, naviframe);
3162 _status_config_caches(win, naviframe);
3163 _status_config_access(win, naviframe);
3164 _status_config_selection(win, naviframe);
3165 _status_config_sizing(win, naviframe); // Note: call this at the end.
3167 // FIXME uncomment after flip style fix, please
3168 //elm_object_style_set(naviframe, "flip");
3169 elm_toolbar_item_selected_set(tb_sizing, EINA_TRUE);
3170 elm_box_pack_end(bx0, naviframe);
3171 evas_object_show(naviframe);
3177 Evas_Object *win, *bx0;
3179 win = elm_win_util_standard_add("main", "Elementary Config");
3180 ecore_event_handler_add(ELM_EVENT_CONFIG_ALL_CHANGED, _config_all_changed,
3182 evas_object_smart_callback_add(win, "delete,request", config_exit, NULL);
3184 bx0 = elm_box_add(win);
3185 evas_object_size_hint_weight_set(bx0, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
3186 elm_win_resize_object_add(win, bx0);
3187 evas_object_show(bx0);
3189 if (!interactive) _status_basic(win, bx0);
3191 _status_config(win, bx0);
3192 else _status_config_full(win, bx0);
3194 evas_object_resize(win, 320, 480);
3195 evas_object_show(win);
3199 _exit_timer(void *data __UNUSED__)
3202 return ECORE_CALLBACK_CANCEL;
3205 /* this is your elementary main function - it MUST be called IMMEDIATELY
3206 * after elm_init() and MUST be passed argc and argv, and MUST be called
3207 * elm_main and not be static - must be a visible symbol with EAPI infront */
3214 elm_app_info_set(elm_main, "elementary", "images/logo.png");
3215 elm_app_compile_bin_dir_set(PACKAGE_BIN_DIR);
3216 elm_app_compile_data_dir_set(PACKAGE_DATA_DIR);
3218 for (i = 1; i < argc; i++)
3220 if (!strcmp(argv[i], "-h"))
3224 " -q Quiet mode (dont show window)\n"
3225 " -t THEME Set theme to THEME (ELM_THEME spec)\n"
3226 " -f SIZE Set finger size to SIZE pixels\n"
3227 " -s SCALE Set scale factor to SCALE\n"
3230 else if (!strcmp(argv[i], "-q"))
3235 else if ((!strcmp(argv[i], "-t")) && (i < argc - 1))
3238 theme_set = argv[i];
3241 else if ((!strcmp(argv[i], "-f")) && (i < argc - 1))
3244 finger_size_set = argv[i];
3247 else if ((!strcmp(argv[i], "-s")) && (i < argc - 1))
3250 scale_set = argv[i];
3254 /* put here any init code specific to this app like parsing args, etc. */
3260 win_create(); /* create main window */
3262 ecore_timer_add(2.0, _exit_timer, NULL);
3266 if (theme_set) elm_theme_set(NULL, theme_set);
3267 if (finger_size_set) elm_config_finger_size_set(atoi(finger_size_set));
3268 if (scale_set) elm_config_scale_set(atof(scale_set));
3270 elm_config_all_flush();
3272 if (quiet) elm_exit();
3274 elm_run(); /* and run the program now and handle all events, etc. */
3275 /* if the mainloop that elm_run() runs exists, we exit the app */
3276 elm_shutdown(); /* clean up and shut down */
3282 /* All emelentary apps should use this. Put it right after elm_main() */