From 8108e4f724a2956b134f430012fb829657afc4b3 Mon Sep 17 00:00:00 2001 From: Alastair Poole Date: Wed, 30 Dec 2020 02:41:44 +0000 Subject: [PATCH] ui: no need to expose thread ptr --- src/bin/ui/ui.h | 3 --- src/bin/ui/ui_cpu.c | 16 +++++++++------- src/bin/ui/ui_memory.c | 15 ++++++++------- src/bin/ui/ui_sensors.c | 12 ++++++------ 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/bin/ui/ui.h b/src/bin/ui/ui.h index 4fd4ff3..e10c584 100644 --- a/src/bin/ui/ui.h +++ b/src/bin/ui/ui.h @@ -42,7 +42,6 @@ typedef struct Ui struct { Evas_Object *win; - Ecore_Thread *thread; int width; int height; } cpu; @@ -52,7 +51,6 @@ typedef struct Ui Evas_Object *win; int width; int height; - Ecore_Thread *thread; Eina_Bool zfs_mounted; } mem; @@ -68,7 +66,6 @@ typedef struct Ui Evas_Object *win; int width; int height; - Ecore_Thread *thread; } sensors; } Ui; diff --git a/src/bin/ui/ui_cpu.c b/src/bin/ui/ui_cpu.c index ec02eb7..fb94bbc 100644 --- a/src/bin/ui/ui_cpu.c +++ b/src/bin/ui/ui_cpu.c @@ -10,6 +10,8 @@ typedef struct { typedef struct { Ui *ui; + Ecore_Thread *thread; + Evas_Object *bg; Evas_Object *obj; @@ -350,8 +352,8 @@ _win_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void // on deletion of window, cancel thread, free animate data and set cpu // dialog handle to null - ecore_thread_cancel(ui->cpu.thread); - ecore_thread_wait(ui->cpu.thread, 0.5); + ecore_thread_cancel(ad->thread); + ecore_thread_wait(ad->thread, 0.5); EINA_LIST_FREE(ad->explainers, exp) { @@ -679,11 +681,11 @@ _graph(Ui *ui, Evas_Object *parent) evas_object_event_callback_add(ui->cpu.win, EVAS_CALLBACK_DEL, _win_del_cb, ad); // run a feedback thread that sends feedback to the mainloop - ui->cpu.thread = ecore_thread_feedback_run(_core_times_main_cb, - _core_times_feedback_cb, - NULL, - NULL, - ad, EINA_TRUE); + ad->thread = ecore_thread_feedback_run(_core_times_main_cb, + _core_times_feedback_cb, + NULL, + NULL, + ad, EINA_TRUE); } static void diff --git a/src/bin/ui/ui_memory.c b/src/bin/ui/ui_memory.c index 02a4d73..c608051 100644 --- a/src/bin/ui/ui_memory.c +++ b/src/bin/ui/ui_memory.c @@ -4,6 +4,7 @@ #include typedef struct { + Ecore_Thread *thread; Evas_Object *win; Evas_Object *bg; @@ -354,8 +355,8 @@ _win_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, Ui_Data *pd = data; Ui *ui = pd->ui; - ecore_thread_cancel(ui->mem.thread); - ecore_thread_wait(ui->mem.thread, 0.5); + ecore_thread_cancel(pd->thread); + ecore_thread_wait(pd->thread, 0.5); evas_object_del(obj); ui->mem.win = NULL; @@ -505,9 +506,9 @@ ui_win_memory_add(Ui *ui, Evas_Object *parent) evas_object_event_callback_add(win, EVAS_CALLBACK_DEL, _win_del_cb, pd); evas_object_show(win); - ui->mem.thread = ecore_thread_feedback_run(_mem_usage_main_cb, - _mem_usage_feedback_cb, - NULL, - NULL, - pd, EINA_TRUE); + pd->thread = ecore_thread_feedback_run(_mem_usage_main_cb, + _mem_usage_feedback_cb, + NULL, + NULL, + pd, EINA_TRUE); } diff --git a/src/bin/ui/ui_sensors.c b/src/bin/ui/ui_sensors.c index 1ece1b3..0afbb8a 100644 --- a/src/bin/ui/ui_sensors.c +++ b/src/bin/ui/ui_sensors.c @@ -3,6 +3,7 @@ typedef struct { + Ecore_Thread *thread; Eina_List *sensors; Eina_List *batteries; @@ -207,9 +208,8 @@ _win_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, Ui_Data *pd = data; Ui *ui = pd->ui; - ecore_thread_cancel(ui->sensors.thread); - ecore_thread_wait(ui->sensors.thread, 0.5); - ui->sensors.thread = NULL; + ecore_thread_cancel(pd->thread); + ecore_thread_wait(pd->thread, 0.5); evas_object_del(obj); ui->sensors.win = NULL; @@ -341,8 +341,8 @@ ui_win_sensors_add(Ui *ui, Evas_Object *parent) _sensors_refresh(pd); - ui->sensors.thread = ecore_thread_feedback_run(_sensors_update, - _sensors_update_feedback_cb, - NULL, NULL, pd, EINA_TRUE); + pd->thread = ecore_thread_feedback_run(_sensors_update, + _sensors_update_feedback_cb, + NULL, NULL, pd, EINA_TRUE); }