Timer: new implementation (merge finished, tests failing)

This commit is contained in:
o9000
2017-12-28 22:45:20 +01:00
parent 0911dcaed1
commit f64cf199e4
18 changed files with 112 additions and 118 deletions

View File

@@ -41,7 +41,7 @@ struct BatteryState battery_state;
gboolean battery_enabled;
gboolean battery_tooltip_enabled;
int percentage_hide;
static timeout *battery_timeout;
static Timer battery_timeout;
#define BATTERY_BUF_SIZE 256
static char buf_bat_line1[BATTERY_BUF_SIZE];
@@ -76,7 +76,7 @@ void default_battery()
percentage_hide = 101;
battery_low_cmd_sent = FALSE;
battery_full_cmd_sent = FALSE;
battery_timeout = NULL;
INIT_TIMER(battery_timeout);
bat1_has_font = FALSE;
bat1_font_desc = NULL;
bat1_format = NULL;
@@ -127,8 +127,7 @@ void cleanup_battery()
ac_connected_cmd = NULL;
free(ac_disconnected_cmd);
ac_disconnected_cmd = NULL;
stop_timeout(battery_timeout);
battery_timeout = NULL;
stop_timer(&battery_timeout);
battery_found = FALSE;
battery_os_free();
@@ -226,7 +225,7 @@ void init_battery()
battery_found = battery_os_init();
battery_timeout = add_timeout(10, 30000, update_battery_tick, 0, &battery_timeout);
change_timer(&battery_timeout, true, 10, 30000, update_battery_tick, 0);
update_battery();
}