background: init before main loop.

This commit is contained in:
Alastair Poole 2021-10-12 09:03:01 +01:00
parent fca5360b16
commit 99eb28c2bc
3 changed files with 16 additions and 4 deletions

View File

@ -1,17 +1,14 @@
#include "evisum_background.h"
#include "../system/filesystems.h"
#include "../ui/evisum_ui.h"
#include <Eina.h>
void
background_poller_cb(void *data, Ecore_Thread *thread)
background_init(Evisum_Ui *ui)
{
meminfo_t memory;
power_t power;
int32_t poll_count = 0;
Battery *bat;
Evisum_Ui *ui = data;
system_memory_usage_get(&memory);
ui->mem_total = memory.total;
@ -33,6 +30,16 @@ background_poller_cb(void *data, Ecore_Thread *thread)
}
}
system_power_state_free(&power);
}
void
background_poller_cb(void *data, Ecore_Thread *thread)
{
meminfo_t memory;
power_t power;
int32_t poll_count = 0;
Battery *bat;
Evisum_Ui *ui = data;
while (!ecore_thread_check(thread))
{

View File

@ -1,9 +1,13 @@
#ifndef EVISUM_BACKGROUND_H
#define EVISUM_BACKGROUND_H
#include "../ui/evisum_ui.h"
#include <Ecore.h>
void
background_poller_cb(void *data, Ecore_Thread *thread);
void
background_init(Evisum_Ui *ui);
#endif

View File

@ -109,6 +109,7 @@ elm_main(int argc, char **argv)
evisum_server_init(ui);
evisum_ui_activate(ui, action, pid);
background_init(ui);
ui->background_poll_thread = ecore_thread_run(background_poller_cb, NULL, NULL, ui);
ecore_main_loop_begin();