ui: OS specific checks.

OpenBSD does not support listing kernel threads.
This commit is contained in:
Alastair Poole 2021-01-22 09:46:55 +00:00
parent 74dc726e98
commit 5dc1ebce0e
2 changed files with 23 additions and 10 deletions

View File

@ -33,7 +33,7 @@ evisum_ui_config_save(Ui *ui)
(_evisum_config->proc.show_kthreads != ui->proc.show_kthreads) ||
(_evisum_config->proc.show_user != ui->proc.show_user) ||
(_evisum_config->proc.show_scroller != ui->proc.show_scroller)
)
)
{
notify = EINA_TRUE;
}
@ -471,15 +471,18 @@ evisum_ui_main_menu_create(Ui *ui, Evas_Object *parent, Evas_Object *obj)
evas_object_show(sep);
elm_box_pack_end(bx2, sep);
chk = elm_check_add(bx2);
evas_object_size_hint_weight_set(chk, EXPAND, EXPAND);
evas_object_size_hint_align_set(chk, FILL, FILL);
elm_object_text_set(chk, _("Show kernel threads?"));
elm_check_state_set(chk, ui->proc.show_kthreads);
evas_object_show(chk);
evas_object_smart_callback_add(chk, "changed",
_main_menu_show_threads_changed_cb, ui);
elm_box_pack_end(bx2, chk);
if (ui->proc.has_kthreads)
{
chk = elm_check_add(bx2);
evas_object_size_hint_weight_set(chk, EXPAND, EXPAND);
evas_object_size_hint_align_set(chk, FILL, FILL);
elm_object_text_set(chk, _("Show kernel threads?"));
elm_check_state_set(chk, ui->proc.show_kthreads);
evas_object_show(chk);
evas_object_smart_callback_add(chk, "changed",
_main_menu_show_threads_changed_cb, ui);
elm_box_pack_end(bx2, chk);
}
chk = elm_check_add(bx2);
evas_object_size_hint_weight_set(chk, EXPAND, EXPAND);
@ -515,10 +518,18 @@ evisum_ui_main_menu_create(Ui *ui, Evas_Object *parent, Evas_Object *obj)
return o;
}
// Any OS specific feature checks.
static void
_ui_init_system_probe(Ui *ui)
{
#if defined(__OpenBSD__)
ui->proc.has_kthreads = 0;
#else
ui->proc.has_kthreads = 1;
#endif
#if defined(__FreeBSD__) || defined(__DragonFly__)
ui->mem.zfs_mounted = file_system_in_use("ZFS");
#endif
}
void

View File

@ -29,6 +29,8 @@ typedef struct Ui
int x, y;
Eina_Bool restart;
Eina_Bool has_kthreads;
int poll_delay;
int sort_type;
Eina_Bool sort_reverse;