f27d0dbba8da49d735f07d9f81b5c01942ea48cc
[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", "_config_illume_animation_settings")) 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                              "_config_illume_animation_settings", 
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    e_widget_list_object_append(list, of, 1, 0, 0.0);
85
86    of = e_widget_framelist_add(evas, _("Quickpanel"), 0);
87    rg = e_widget_radio_group_new(&(_e_illume_cfg->animation.quickpanel.duration));
88    ow = e_widget_radio_add(evas, _("Slow"), 2000, rg);
89    e_widget_framelist_object_append(of, ow);
90    evas_object_smart_callback_add(ow, "changed", 
91                                   _e_mod_illume_config_animation_change, NULL);
92    ow = e_widget_radio_add(evas, _("Medium"), 1000, rg);
93    e_widget_framelist_object_append(of, ow);
94    evas_object_smart_callback_add(ow, "changed", 
95                                   _e_mod_illume_config_animation_change, NULL);
96    ow = e_widget_radio_add(evas, _("Fast"), 500, rg);
97    e_widget_framelist_object_append(of, ow);
98    evas_object_smart_callback_add(ow, "changed", 
99                                   _e_mod_illume_config_animation_change, NULL);
100    ow = e_widget_radio_add(evas, _("Very Fast"), 250, rg);
101    e_widget_framelist_object_append(of, ow);
102    evas_object_smart_callback_add(ow, "changed", 
103                                   _e_mod_illume_config_animation_change, NULL);
104    ow = e_widget_radio_add(evas, _("Off"), 0, rg);
105    e_widget_framelist_object_append(of, ow);
106    evas_object_smart_callback_add(ow, "changed", 
107                                   _e_mod_illume_config_animation_change, NULL);
108    e_widget_list_object_append(list, of, 1, 0, 0.0);
109
110    return list;
111 }
112
113 static void 
114 _e_mod_illume_config_animation_change(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__) 
115 {
116    if (_anim_change_timer) ecore_timer_del(_anim_change_timer);
117    _anim_change_timer = 
118      ecore_timer_add(0.5, _e_mod_illume_config_animation_timeout, data);
119 }
120
121 static Eina_Bool
122 _e_mod_illume_config_animation_timeout(void *data __UNUSED__) 
123 {
124    e_config_save_queue();
125    _anim_change_timer = NULL;
126    return ECORE_CALLBACK_CANCEL;
127 }