update for beta release
[framework/uifw/e17.git] / src / modules / illume2 / e_mod_config_animation.c
1 #include "e_illume_private.h"
2 #include "e_mod_config_animation.h"
3
4 /* local function prototypes */
5 static void *_e_mod_illume_config_animation_create(E_Config_Dialog *cfd);
6 static void _e_mod_illume_config_animation_free(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
7 static Evas_Object *_e_mod_illume_config_animation_ui(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
8 static void _e_mod_illume_config_animation_change(void *data, Evas_Object *obj, void *event);
9 static Eina_Bool _e_mod_illume_config_animation_timeout(void *data);
10
11 /* local variables */
12 Ecore_Timer *_anim_change_timer = NULL;
13
14 void 
15 e_mod_illume_config_animation_show(E_Container *con, const char *params __UNUSED__) 
16 {
17    E_Config_Dialog *cfd;
18    E_Config_Dialog_View *v;
19
20    if (e_config_dialog_find("E", "illume/animation")) return;
21
22    v = E_NEW(E_Config_Dialog_View, 1);
23    if (!v) return;
24
25    v->create_cfdata = _e_mod_illume_config_animation_create;
26    v->free_cfdata = _e_mod_illume_config_animation_free;
27    v->basic.create_widgets = _e_mod_illume_config_animation_ui;
28    v->basic_only = 1;
29    v->normal_win = 1;
30    v->scroll = 1;
31
32    cfd = e_config_dialog_new(con, _("Animation Settings"), "E", 
33                              "illume/animation", 
34                              "enlightenment/animation_settings", 0, v, NULL);
35    if (!cfd) return;
36
37    e_dialog_resizable_set(cfd->dia, 1);
38 }
39
40 /* local function prototypes */
41 static void *
42 _e_mod_illume_config_animation_create(E_Config_Dialog *cfd __UNUSED__) 
43 {
44    return NULL;
45 }
46
47 static void 
48 _e_mod_illume_config_animation_free(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata __UNUSED__) 
49 {
50    if (_anim_change_timer) ecore_timer_del(_anim_change_timer);
51    _anim_change_timer = NULL;
52 }
53
54 static Evas_Object *
55 _e_mod_illume_config_animation_ui(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data *cfdata __UNUSED__) 
56 {
57    Evas_Object *list, *of, *ow;
58    E_Radio_Group *rg;
59
60    list = e_widget_list_add(evas, 0, 0);
61
62    of = e_widget_framelist_add(evas, _("Keyboard"), 0);
63    rg = e_widget_radio_group_new(&(_e_illume_cfg->animation.vkbd.duration));
64    ow = e_widget_radio_add(evas, _("Slow"), 2000, rg);
65    e_widget_framelist_object_append(of, ow);
66    evas_object_smart_callback_add(ow, "changed", 
67                                   _e_mod_illume_config_animation_change, NULL);
68    ow = e_widget_radio_add(evas, _("Medium"), 1000, rg);
69    e_widget_framelist_object_append(of, ow);
70    evas_object_smart_callback_add(ow, "changed", 
71                                   _e_mod_illume_config_animation_change, NULL);
72    ow = e_widget_radio_add(evas, _("Fast"), 500, rg);
73    e_widget_framelist_object_append(of, ow);
74    evas_object_smart_callback_add(ow, "changed", 
75                                   _e_mod_illume_config_animation_change, NULL);
76    ow = e_widget_radio_add(evas, _("Very Fast"), 250, rg);
77    e_widget_framelist_object_append(of, ow);
78    evas_object_smart_callback_add(ow, "changed", 
79                                   _e_mod_illume_config_animation_change, NULL);
80    ow = e_widget_radio_add(evas, _("Off"), 0, rg);
81    e_widget_framelist_object_append(of, ow);
82    evas_object_smart_callback_add(ow, "changed", 
83                                   _e_mod_illume_config_animation_change, NULL);
84    ow = e_widget_check_add(evas, _("Resize Window before Animation"),
85                            &_e_illume_cfg->animation.vkbd.resize_before); 
86    e_widget_framelist_object_append(of, ow);
87    evas_object_smart_callback_add(ow, "changed", 
88                                   _e_mod_illume_config_animation_change, NULL);
89    e_widget_list_object_append(list, of, 1, 0, 0.0);
90
91    of = e_widget_framelist_add(evas, _("Quickpanel"), 0);
92    rg = e_widget_radio_group_new(&(_e_illume_cfg->animation.quickpanel.duration));
93    ow = e_widget_radio_add(evas, _("Slow"), 2000, rg);
94    e_widget_framelist_object_append(of, ow);
95    evas_object_smart_callback_add(ow, "changed", 
96                                   _e_mod_illume_config_animation_change, NULL);
97    ow = e_widget_radio_add(evas, _("Medium"), 1000, rg);
98    e_widget_framelist_object_append(of, ow);
99    evas_object_smart_callback_add(ow, "changed", 
100                                   _e_mod_illume_config_animation_change, NULL);
101    ow = e_widget_radio_add(evas, _("Fast"), 500, rg);
102    e_widget_framelist_object_append(of, ow);
103    evas_object_smart_callback_add(ow, "changed", 
104                                   _e_mod_illume_config_animation_change, NULL);
105    ow = e_widget_radio_add(evas, _("Very Fast"), 250, rg);
106    e_widget_framelist_object_append(of, ow);
107    evas_object_smart_callback_add(ow, "changed", 
108                                   _e_mod_illume_config_animation_change, NULL);
109    ow = e_widget_radio_add(evas, _("Off"), 0, rg);
110    e_widget_framelist_object_append(of, ow);
111    evas_object_smart_callback_add(ow, "changed", 
112                                   _e_mod_illume_config_animation_change, NULL);
113
114    /* ow = e_widget_check_add(evas, _("Resize Window before Animation"),
115     *                            &_e_illume_cfg->animation.quickpanel.resize_before); 
116     * e_widget_framelist_object_append(of, ow);
117     * evas_object_smart_callback_add(ow, "changed", 
118     *                                _e_mod_illume_config_animation_change, NULL); */
119    e_widget_list_object_append(list, of, 1, 0, 0.0);
120
121    return list;
122 }
123
124 static void 
125 _e_mod_illume_config_animation_change(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__) 
126 {
127    if (_anim_change_timer) ecore_timer_del(_anim_change_timer);
128    _anim_change_timer = 
129      ecore_timer_add(0.5, _e_mod_illume_config_animation_timeout, data);
130 }
131
132 static Eina_Bool
133 _e_mod_illume_config_animation_timeout(void *data __UNUSED__) 
134 {
135    e_config_save_queue();
136    _anim_change_timer = NULL;
137    return ECORE_CALLBACK_CANCEL;
138 }