event: config changed register.
Generic event on change. For now use for just resetting PID time cache to avoid bogus values when adjusting process polling period.
This commit is contained in:
parent
529710ca15
commit
7d394b2545
|
@ -17,14 +17,19 @@
|
|||
#include <pwd.h>
|
||||
|
||||
Evisum_Config *_evisum_config;
|
||||
int EVISUM_EVENT_CONFIG_CHANGED;
|
||||
|
||||
void
|
||||
evisum_ui_config_save(Ui *ui)
|
||||
{
|
||||
Evas_Coord w, h;
|
||||
Eina_Bool notify = EINA_FALSE;
|
||||
|
||||
if (!_evisum_config) return;
|
||||
|
||||
if (_evisum_config->poll_delay != ui->settings.poll_delay)
|
||||
notify = EINA_TRUE;
|
||||
|
||||
evas_object_geometry_get(ui->win, NULL, NULL, &w, &h);
|
||||
|
||||
_evisum_config->sort_type = ui->settings.sort_type;
|
||||
|
@ -69,6 +74,9 @@ evisum_ui_config_save(Ui *ui)
|
|||
}
|
||||
|
||||
config_save(_evisum_config);
|
||||
|
||||
if (notify)
|
||||
ecore_event_add(EVISUM_EVENT_CONFIG_CHANGED, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -478,6 +486,8 @@ evisum_ui_init(void)
|
|||
ui->settings.sort_type = SORT_BY_PID;
|
||||
ui->program_pid = getpid();
|
||||
|
||||
EVISUM_EVENT_CONFIG_CHANGED = ecore_event_type_new();
|
||||
|
||||
evisum_ui_config_load(ui);
|
||||
|
||||
evisum_icon_cache_init();
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
#include <pwd.h>
|
||||
|
||||
extern Evisum_Config *_evisum_config;
|
||||
extern int EVISUM_EVENT_CONFIG_CHANGED;
|
||||
|
||||
Ui *_ui;
|
||||
Eina_Lock _lock;
|
||||
|
||||
|
@ -1375,6 +1377,7 @@ static void
|
|||
_system_info_all_poll(void *data, Ecore_Thread *thread)
|
||||
{
|
||||
Ui *ui = data;
|
||||
(void) ui;
|
||||
|
||||
while (1)
|
||||
{
|
||||
|
@ -1449,7 +1452,7 @@ out:
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
_elm_config_change_cb(void *data, int type EINA_UNUSED, void *event EINA_UNUSED)
|
||||
_elm_config_changed_cb(void *data, int type EINA_UNUSED, void *event EINA_UNUSED)
|
||||
{
|
||||
Ui *ui = data;
|
||||
|
||||
|
@ -1459,6 +1462,16 @@ _elm_config_change_cb(void *data, int type EINA_UNUSED, void *event EINA_UNUSED)
|
|||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_evisum_config_changed_cb(void *data, int type EINA_UNUSED, void *event EINA_UNUSED)
|
||||
{
|
||||
Ui *ui = data;
|
||||
|
||||
_proc_pid_cpu_times_reset(ui);
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
_win_del_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||
void *event_info EINA_UNUSED)
|
||||
|
@ -1563,7 +1576,10 @@ ui_process_list_win_add(Ui *ui)
|
|||
_evisum_key_down_cb, ui);
|
||||
evas_object_event_callback_add(ui->processes.entry_search, EVAS_CALLBACK_KEY_DOWN,
|
||||
_evisum_search_keypress_cb, ui);
|
||||
|
||||
ecore_event_handler_add(ELM_EVENT_CONFIG_ALL_CHANGED,
|
||||
_elm_config_change_cb, ui);
|
||||
_elm_config_changed_cb, ui);
|
||||
ecore_event_handler_add(EVISUM_EVENT_CONFIG_CHANGED,
|
||||
_evisum_config_changed_cb, ui);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue