summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2021-03-17 23:37:05 +0000
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2021-03-17 23:37:05 +0000
commit63303bb1f863254c1fa37c952c92f882740d5c25 (patch)
tree35a28615e17ccad3317bafe2272ccf718947f383
parent1b3ec251525b8ff57ca858bdd5256099b23bd06e (diff)
allow poll time down to 1 min which is default and limit 1min to 1h
-rw-r--r--src/e_mod_config.c4
-rw-r--r--src/e_mod_main.c23
2 files changed, 15 insertions, 12 deletions
diff --git a/src/e_mod_config.c b/src/e_mod_config.c
index e13db6f..e810355 100644
--- a/src/e_mod_config.c
+++ b/src/e_mod_config.c
@@ -254,8 +254,8 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas,
254 sl = elm_slider_add(win); 254 sl = elm_slider_add(win);
255 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, EVAS_HINT_FILL); 255 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, EVAS_HINT_FILL);
256 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 256 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
257 elm_slider_min_max_set(sl, 15.0, 60.0); 257 elm_slider_min_max_set(sl, 1.0, 60.0);
258 elm_slider_step_set(sl, 1.0 /(60.0 - 15.0)); 258 elm_slider_step_set(sl, 1.0 / (60.0 - 1.0));
259 elm_slider_unit_format_set(sl, D_("%2.0f minutes")); 259 elm_slider_unit_format_set(sl, D_("%2.0f minutes"));
260 elm_object_text_set(sl, D_("Poll Time")); 260 elm_object_text_set(sl, D_("Poll Time"));
261 elm_object_tooltip_text_set(sl, D_("Poll Time")); 261 elm_object_tooltip_text_set(sl, D_("Poll Time"));
diff --git a/src/e_mod_main.c b/src/e_mod_main.c
index 90433e1..e847d7a 100644
--- a/src/e_mod_main.c
+++ b/src/e_mod_main.c
@@ -10,7 +10,7 @@ char *strptime(const char *s, const char *format, struct tm *tm);
10 10
11#define GOLDEN_RATIO 1.618033989 11#define GOLDEN_RATIO 1.618033989
12 12
13#define ENABLE_DEBUG 0 13#define ENABLE_DEBUG 1
14#define DEBUG(f, ...) if (ENABLE_DEBUG) \ 14#define DEBUG(f, ...) if (ENABLE_DEBUG) \
15 printf("[forecasts] "f "\n", __VA_ARGS__) 15 printf("[forecasts] "f "\n", __VA_ARGS__)
16 16
@@ -369,6 +369,9 @@ E_API E_Module_Api e_modapi = {
369E_API void * 369E_API void *
370e_modapi_init(E_Module *m) 370e_modapi_init(E_Module *m)
371{ 371{
372 Eina_List *l;
373 Config_Item *ci;
374
372 ecore_con_url_init(); 375 ecore_con_url_init();
373 bindtextdomain(PACKAGE, LOCALE_DIR); 376 bindtextdomain(PACKAGE, LOCALE_DIR);
374 bind_textdomain_codeset(PACKAGE, "UTF-8"); 377 bind_textdomain_codeset(PACKAGE, "UTF-8");
@@ -398,8 +401,6 @@ e_modapi_init(E_Module *m)
398 forecasts_config = e_config_domain_load("module.forecasts", conf_edd); 401 forecasts_config = e_config_domain_load("module.forecasts", conf_edd);
399 if (!forecasts_config) 402 if (!forecasts_config)
400 { 403 {
401 Config_Item *ci;
402
403 forecasts_config = E_NEW(Config, 1); 404 forecasts_config = E_NEW(Config, 1);
404 405
405 ci = E_NEW(Config_Item, 1); 406 ci = E_NEW(Config_Item, 1);
@@ -412,6 +413,11 @@ e_modapi_init(E_Module *m)
412 413
413 forecasts_config->items = eina_list_append(forecasts_config->items, ci); 414 forecasts_config->items = eina_list_append(forecasts_config->items, ci);
414 } 415 }
416 EINA_LIST_FOREACH(forecasts_config->items, l, ci)
417 {
418 if (ci->poll_time < 60.0) ci->poll_time = 60.0;
419 else if (ci->poll_time > 3600.0) ci->poll_time = 3600.0;
420 }
415 421
416 forecasts_config->module = m; 422 forecasts_config->module = m;
417 e_gadcon_provider_register(&_gadcon_class); 423 e_gadcon_provider_register(&_gadcon_class);
@@ -895,13 +901,10 @@ _forecasts_config_updated(Config_Item *ci)
895 901
896 if (area_changed) 902 if (area_changed)
897 _forecasts_cb_check(inst); 903 _forecasts_cb_check(inst);
898 if (!inst->check_timer) 904 if (inst->check_timer) ecore_timer_del(inst->check_timer);
899 inst->check_timer = 905 inst->check_timer =
900 ecore_timer_add(inst->ci->poll_time, _forecasts_cb_check, 906 ecore_timer_add(inst->ci->poll_time, _forecasts_cb_check,
901 inst); 907 inst);
902 else
903 ecore_timer_interval_set(inst->check_timer,
904 inst->ci->poll_time);
905 } 908 }
906} 909}
907 910