allow poll time down to 1 min which is default and limit 1min to 1h

master
Carsten Haitzler 1 year ago
parent 1b3ec25152
commit 63303bb1f8
  1. 4
      src/e_mod_config.c
  2. 23
      src/e_mod_main.c

@ -254,8 +254,8 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas,
sl = elm_slider_add(win);
evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_slider_min_max_set(sl, 15.0, 60.0);
elm_slider_step_set(sl, 1.0 /(60.0 - 15.0));
elm_slider_min_max_set(sl, 1.0, 60.0);
elm_slider_step_set(sl, 1.0 / (60.0 - 1.0));
elm_slider_unit_format_set(sl, D_("%2.0f minutes"));
elm_object_text_set(sl, D_("Poll Time"));
elm_object_tooltip_text_set(sl, D_("Poll Time"));

@ -10,7 +10,7 @@ char *strptime(const char *s, const char *format, struct tm *tm);
#define GOLDEN_RATIO 1.618033989
#define ENABLE_DEBUG 0
#define ENABLE_DEBUG 1
#define DEBUG(f, ...) if (ENABLE_DEBUG) \
printf("[forecasts] "f "\n", __VA_ARGS__)
@ -369,6 +369,9 @@ E_API E_Module_Api e_modapi = {
E_API void *
e_modapi_init(E_Module *m)
{
Eina_List *l;
Config_Item *ci;
ecore_con_url_init();
bindtextdomain(PACKAGE, LOCALE_DIR);
bind_textdomain_codeset(PACKAGE, "UTF-8");
@ -398,8 +401,6 @@ e_modapi_init(E_Module *m)
forecasts_config = e_config_domain_load("module.forecasts", conf_edd);
if (!forecasts_config)
{
Config_Item *ci;
forecasts_config = E_NEW(Config, 1);
ci = E_NEW(Config_Item, 1);
@ -412,6 +413,11 @@ e_modapi_init(E_Module *m)
forecasts_config->items = eina_list_append(forecasts_config->items, ci);
}
EINA_LIST_FOREACH(forecasts_config->items, l, ci)
{
if (ci->poll_time < 60.0) ci->poll_time = 60.0;
else if (ci->poll_time > 3600.0) ci->poll_time = 3600.0;
}
forecasts_config->module = m;
e_gadcon_provider_register(&_gadcon_class);
@ -895,13 +901,10 @@ _forecasts_config_updated(Config_Item *ci)
if (area_changed)
_forecasts_cb_check(inst);
if (!inst->check_timer)
inst->check_timer =
ecore_timer_add(inst->ci->poll_time, _forecasts_cb_check,
inst);
else
ecore_timer_interval_set(inst->check_timer,
inst->ci->poll_time);
if (inst->check_timer) ecore_timer_del(inst->check_timer);
inst->check_timer =
ecore_timer_add(inst->ci->poll_time, _forecasts_cb_check,
inst);
}
}

Loading…
Cancel
Save