2 # include "elementary_config.h"
4 #include <Elementary.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_object_text_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_object_item_text_get(event_info));
49 eweather = eweather_object_eweather_get(weather[1]);
50 module[1] = eweather_plugin_search(eweather, elm_object_item_text_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__)
59 #ifdef HAVE_ELEMENTARY_EWEATHER
60 Evas_Object *bx, *bx0, *bt;
62 Eina_Array_Iterator it;
68 win = elm_win_util_standard_add("weather", "Weather");
69 elm_win_autodel_set(win, EINA_TRUE);
71 #ifdef HAVE_ELEMENTARY_EWEATHER
72 bx = elm_box_add(win);
73 elm_win_resize_object_add(win, bx);
74 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
77 fl = elm_flip_add(win);
78 evas_object_size_hint_align_set(fl, EVAS_HINT_FILL, EVAS_HINT_FILL);
79 evas_object_size_hint_weight_set(fl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
80 elm_box_pack_end(bx, fl);
85 weather[0] = eweather_object_add(evas_object_evas_get(win));
86 evas_object_size_hint_weight_set(weather[0], EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
87 evas_object_size_hint_align_set(weather[0], -1.0, -1.0);
88 elm_object_part_content_set(fl, "front", weather[0]);
89 evas_object_show(weather[0]);
92 weather[1] = eweather_object_add(evas_object_evas_get(win));
93 eweather = eweather_object_eweather_get(weather[1]);
94 evas_object_size_hint_weight_set(weather[1], EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
95 evas_object_size_hint_align_set(weather[1], -1.0, -1.0);
96 elm_object_part_content_set(fl, "back", weather[1]);
97 evas_object_show(weather[1]);
102 bx0 = elm_box_add(win);
103 elm_box_horizontal_set(bx0, EINA_TRUE);
104 evas_object_size_hint_weight_set(bx0, 1.0, 0.0);
105 elm_box_pack_end(bx, bx0);
106 evas_object_show(bx0);
108 bt = elm_button_add(win);
109 elm_object_text_set(bt, "First city");
110 evas_object_show(bt);
111 elm_box_pack_end(bx0, bt);
112 evas_object_smart_callback_add(bt, "clicked", _first_city_cb, NULL);
114 bt = elm_button_add(win);
115 elm_object_text_set(bt, "Second city");
116 evas_object_show(bt);
117 elm_box_pack_end(bx0, bt);
118 evas_object_smart_callback_add(bt, "clicked", _second_city_cb, NULL);
122 bx0 = elm_box_add(win);
123 elm_box_horizontal_set(bx0, EINA_TRUE);
124 evas_object_size_hint_weight_set(bx0, 1.0, 0.0);
125 elm_box_pack_end(bx, bx0);
126 evas_object_show(bx0);
128 hv = elm_hoversel_add(win);
129 elm_hoversel_hover_parent_set(hv, win);
130 elm_object_text_set(hv, "data source");
131 evas_object_size_hint_weight_set(hv, 0.0, 0.0);
132 evas_object_size_hint_align_set(hv, 0.5, 0.5);
133 elm_box_pack_end(bx0, hv);
134 evas_object_show(hv);
136 array = eweather_plugins_list_get(eweather);
138 EINA_ARRAY_ITER_NEXT(array, i, m, it)
139 elm_hoversel_item_add(hv, eweather_plugin_name_get(eweather, i), NULL, ELM_ICON_NONE, _hover_select_cb, NULL);
141 en = elm_entry_add(win);
142 elm_entry_line_wrap_set(en, ELM_WRAP_NONE);
143 elm_entry_single_line_set(en, EINA_TRUE);
144 elm_object_text_set(en, "Paris");
145 evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
146 evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);
147 elm_box_pack_end(bx0, en);
148 evas_object_show(en);
150 bt = elm_button_add(win);
151 elm_object_text_set(bt, "Apply");
152 evas_object_show(bt);
153 elm_box_pack_end(bx0, bt);
154 evas_object_smart_callback_add(bt, "clicked", _apply_cb, NULL);
161 lbl = elm_label_add(win);
162 elm_win_resize_object_add(win, lbl);
163 elm_object_text_set(lbl, "libeweather is required to display the forecast.");
164 evas_object_show(lbl);
167 evas_object_resize(win, 244, 388);
168 evas_object_show(win);