1 #include <Elementary.h>
3 # include "elementary_config.h"
5 #ifndef ELM_LIB_QUICKLAUNCH
7 #ifdef HAVE_ELEMENTARY_EWEATHER
8 # include "EWeather_Smart.h"
11 #ifdef HAVE_ELEMENTARY_EWEATHER
12 static Evas_Object *en, *hv, *fl;
13 static Evas_Object *weather[2];
14 static int current = 0;
15 static Eina_Module *module[2];
18 _first_city_cb(void *data __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
22 elm_flip_go(fl, ELM_FLIP_ROTATE_YZ_CENTER_AXIS);
26 _second_city_cb(void *dat __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
30 elm_flip_go(fl, ELM_FLIP_ROTATE_XZ_CENTER_AXIS);
33 static void _apply_cb(void *data __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
35 EWeather *eweather = eweather_object_eweather_get(weather[current]);
38 eweather_plugin_set(eweather, module[current]);
39 eweather_code_set(eweather, elm_entry_entry_get(en));
40 printf("CURRENT %d %p %p\n", current, module[current], eweather);
44 _hover_select_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
46 EWeather *eweather = eweather_object_eweather_get(weather[0]);
47 module[0] = eweather_plugin_search(eweather, elm_hoversel_item_label_get(event_info));
49 eweather = eweather_object_eweather_get(weather[1]);
50 module[1] = eweather_plugin_search(eweather, elm_hoversel_item_label_get(event_info));
51 printf("%p %p\n", module[0], module[1]);
56 test_weather(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
58 Evas_Object *win, *bg;
59 #ifdef HAVE_ELEMENTARY_EWEATHER
60 Evas_Object *bx, *bx0, *bt;
62 Eina_Array_Iterator it;
68 win = elm_win_add(NULL, "weather", ELM_WIN_BASIC);
69 elm_win_title_set(win, "Weather");
70 elm_win_autodel_set(win, EINA_TRUE);
73 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
74 elm_win_resize_object_add(win, bg);
77 #ifdef HAVE_ELEMENTARY_EWEATHER
78 bx = elm_box_add(win);
79 elm_win_resize_object_add(win, bx);
80 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
83 fl = elm_flip_add(win);
84 evas_object_size_hint_align_set(fl, EVAS_HINT_FILL, EVAS_HINT_FILL);
85 evas_object_size_hint_weight_set(fl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
86 elm_box_pack_end(bx, fl);
91 weather[0] = eweather_object_add(evas_object_evas_get(win));
92 evas_object_size_hint_weight_set(weather[0], EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
93 evas_object_size_hint_align_set(weather[0], -1.0, -1.0);
94 elm_flip_content_front_set(fl, weather[0]);
95 evas_object_show(weather[0]);
98 weather[1] = eweather_object_add(evas_object_evas_get(win));
99 eweather = eweather_object_eweather_get(weather[1]);
100 evas_object_size_hint_weight_set(weather[1], EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
101 evas_object_size_hint_align_set(weather[1], -1.0, -1.0);
102 elm_flip_content_back_set(fl, weather[1]);
103 evas_object_show(weather[1]);
105 evas_object_show(fl);
108 bx0 = elm_box_add(win);
109 elm_box_horizontal_set(bx0, EINA_TRUE);
110 evas_object_size_hint_weight_set(bx0, 1.0, 0.0);
111 elm_box_pack_end(bx, bx0);
112 evas_object_show(bx0);
114 bt = elm_button_add(win);
115 elm_object_text_set(bt, "First city");
116 evas_object_show(bt);
117 elm_box_pack_end(bx0, bt);
118 evas_object_smart_callback_add(bt, "clicked", _first_city_cb, NULL);
120 bt = elm_button_add(win);
121 elm_object_text_set(bt, "Second city");
122 evas_object_show(bt);
123 elm_box_pack_end(bx0, bt);
124 evas_object_smart_callback_add(bt, "clicked", _second_city_cb, NULL);
128 bx0 = elm_box_add(win);
129 elm_box_horizontal_set(bx0, EINA_TRUE);
130 evas_object_size_hint_weight_set(bx0, 1.0, 0.0);
131 elm_box_pack_end(bx, bx0);
132 evas_object_show(bx0);
134 hv = elm_hoversel_add(win);
135 elm_hoversel_hover_parent_set(hv, win);
136 elm_object_text_set(hv, "data source");
137 evas_object_size_hint_weight_set(hv, 0.0, 0.0);
138 evas_object_size_hint_align_set(hv, 0.5, 0.5);
139 elm_box_pack_end(bx0, hv);
140 evas_object_show(hv);
142 array = eweather_plugins_list_get(eweather);
144 EINA_ARRAY_ITER_NEXT(array, i, m, it)
145 elm_hoversel_item_add(hv, eweather_plugin_name_get(eweather, i), NULL, ELM_ICON_NONE, _hover_select_cb, NULL);
147 en = elm_entry_add(win);
148 elm_entry_line_wrap_set(en, ELM_WRAP_NONE);
149 elm_entry_single_line_set(en, EINA_TRUE);
150 elm_entry_entry_set(en, "Paris");
151 evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
152 evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);
153 elm_box_pack_end(bx0, en);
154 evas_object_show(en);
156 bt = elm_button_add(win);
157 elm_object_text_set(bt, "Apply");
158 evas_object_show(bt);
159 elm_box_pack_end(bx0, bt);
160 evas_object_smart_callback_add(bt, "clicked", _apply_cb, NULL);
167 lbl = elm_label_add(win);
168 elm_win_resize_object_add(win, lbl);
169 elm_object_text_set(lbl, "libeweather is required to display the forecast.");
170 evas_object_show(lbl);
173 evas_object_resize(win, 244, 388);
174 evas_object_show(win);