Revert "proclist: summerly"

wtf?

tired. stop

This reverts commit 38a6c470d6.
This commit is contained in:
Alastair Poole 2021-02-07 15:01:58 +00:00
parent 38a6c470d6
commit ae8e75e846
1 changed files with 69 additions and 23 deletions

View File

@ -68,6 +68,15 @@ typedef struct
Evas_Object *btn_state;
Evas_Object *btn_time;
Evas_Object *btn_cpu_usage;
struct
{
Evas_Object *lb;
int total;
int running;
int sleeping;
int stopped;
} summary;
} Ui_Data;
static Ui_Data *_pd = NULL;
@ -152,13 +161,14 @@ _item_create(Evas_Object *obj)
int i = 0;
tb = elm_table_add(obj);
evas_object_size_hint_align_set(tb, FILL, 0);
evas_object_size_hint_weight_set(tb, EXPAND, EXPAND);
evas_object_size_hint_align_set(tb, FILL, FILL);
evas_object_size_hint_weight_set(tb, EXPAND, 0);
hbx = elm_box_add(tb);
elm_box_horizontal_set(hbx, 1);
evas_object_size_hint_align_set(hbx, 0.0, FILL);
evas_object_size_hint_weight_set(hbx, EXPAND, EXPAND);
evas_object_size_hint_weight_set(hbx, EXPAND, 0);
evas_object_show(hbx);
ic = elm_icon_add(tb);
@ -203,7 +213,7 @@ _item_create(Evas_Object *obj)
lb = _item_column_add(tb, "proc_state", i++);
evas_object_size_hint_align_set(lb, 1.0, FILL);
lb = _item_column_add(tb, "proc_time", i++);
evas_object_size_hint_align_set(lb, 1.0, FILL);
evas_object_size_hint_align_set(lb, 0.5, FILL);
pb = elm_progressbar_add(hbx);
evas_object_size_hint_weight_set(pb, EXPAND, EXPAND);
@ -435,6 +445,17 @@ _bring_in(void *data)
return 0;
}
static void
_update_summary(Ui_Data *pd)
{
const char *txt =
eina_slstr_printf("%i processes: %i running, %i sleeping, %i stopped.",
pd->summary.total, pd->summary.running,
pd->summary.sleeping, pd->summary.stopped);
elm_object_text_set(pd->summary.lb, txt);
}
static Eina_List *
_process_list_sort(Eina_List *list, Ui_Data *pd)
{
@ -484,6 +505,9 @@ _process_list_search_trim(Eina_List *list, Ui_Data *pd)
Proc_Info *proc;
Ui *ui = pd->ui;
pd->summary.total = pd->summary.running = pd->summary.sleeping = 0;
pd->summary.stopped = 0;
EINA_LIST_FOREACH_SAFE(list, l, l_next, proc)
{
if ((proc->pid == ui->program_pid) ||
@ -515,6 +539,12 @@ _process_list_search_trim(Eina_List *list, Ui_Data *pd)
eina_hash_add(pd->cpu_times, &id, cpu_time);
}
}
pd->summary.total++;
if ((!strcmp(proc->state, "run")) || (!strcmp(proc->state, "onproc")))
pd->summary.running++;
pd->summary.sleeping += proc->ssleep;
if (!strcmp(proc->state, "stop"))
pd->summary.stopped++;
}
}
@ -585,11 +615,14 @@ _process_list_feedback_cb(void *data, Ecore_Thread *thread EINA_UNUSED,
Eina_List *list;
Proc_Info *proc;
Elm_Object_Item *it;
int n;
pd = data;
list = msg;
_genlist_ensure_n_items(pd->genlist, eina_list_count(list), &pd->itc);
n = eina_list_count(list);
_genlist_ensure_n_items(pd->genlist, n, &pd->itc);
it = elm_genlist_first_item_get(pd->genlist);
EINA_LIST_FREE(list, proc)
@ -610,9 +643,11 @@ _process_list_feedback_cb(void *data, Ecore_Thread *thread EINA_UNUSED,
elm_genlist_realized_items_update(pd->genlist);
_update_summary(pd);
#if DIRTY_GENLIST_HACK
Eina_List *real = elm_genlist_realized_items_get(pd->genlist);
int n = eina_list_count(pd->cache->active);
n = eina_list_count(pd->cache->active);
if (n > eina_list_count(real) * 2)
{
evisum_ui_item_cache_steal(pd->cache, real);
@ -1125,6 +1160,7 @@ static Evas_Object *
_ui_content_system_add(Ui_Data *pd, Evas_Object *parent)
{
Evas_Object *tb, *btn, *list, *rec;
Evas_Object *fr, *lb;
Ui *ui = pd->ui;
int i = 0;
@ -1134,16 +1170,12 @@ _ui_content_system_add(Ui_Data *pd, Evas_Object *parent)
evas_object_show(tb);
rec = evas_object_rectangle_add(evas_object_evas_get(parent));
evas_object_size_hint_min_set(rec, 1, ELM_SCALE_SIZE(24));
evas_object_size_hint_max_set(rec, 1, ELM_SCALE_SIZE(24));
evas_object_size_hint_min_set(rec, 1, ELM_SCALE_SIZE(LIST_BTN_HEIGHT));
evas_object_size_hint_max_set(rec, 1, ELM_SCALE_SIZE(LIST_BTN_HEIGHT));
elm_table_pack(tb, rec, i, 1, 1, 1);
pd->btn_menu = btn = _btn_create(tb, "menu", _("Menu"),
_btn_menu_clicked_cb, pd);
rec = evas_object_rectangle_add(evas_object_evas_get(parent));
evas_object_size_hint_min_set(rec, ELM_SCALE_SIZE(24), ELM_SCALE_SIZE(24));
evas_object_size_hint_max_set(rec, ELM_SCALE_SIZE(24), ELM_SCALE_SIZE(24));
elm_table_pack(tb, rec, i, 1, 1, 1);
elm_table_pack(tb, btn, i++, 1, 1, 1);
pd->btn_cmd = btn = elm_button_add(parent);
@ -1151,7 +1183,7 @@ _ui_content_system_add(Ui_Data *pd, Evas_Object *parent)
(ui->proc.sort_type == SORT_BY_CMD ?
ui->proc.sort_reverse : 0),
ui->proc.sort_type == SORT_BY_CMD);
evas_object_size_hint_weight_set(btn, 1.0, 0);
evas_object_size_hint_weight_set(btn, 1.0, 1.0);
evas_object_size_hint_align_set(btn, FILL, FILL);
elm_object_text_set(btn, _("command"));
evas_object_show(btn);
@ -1164,7 +1196,7 @@ _ui_content_system_add(Ui_Data *pd, Evas_Object *parent)
(ui->proc.sort_type == SORT_BY_UID ?
ui->proc.sort_reverse : 0),
ui->proc.sort_type == SORT_BY_UID);
evas_object_size_hint_weight_set(btn, 1.0, 0);
evas_object_size_hint_weight_set(btn, 1.0, 1.0);
evas_object_size_hint_align_set(btn, FILL, FILL);
elm_object_text_set(btn, _("user"));
evas_object_show(btn);
@ -1180,7 +1212,7 @@ _ui_content_system_add(Ui_Data *pd, Evas_Object *parent)
(ui->proc.sort_type == SORT_BY_PID ?
ui->proc.sort_reverse : 0),
ui->proc.sort_type == SORT_BY_PID);
evas_object_size_hint_weight_set(btn, 1.0, 0);
evas_object_size_hint_weight_set(btn, 1.0, 1.0);
evas_object_size_hint_align_set(btn, FILL, FILL);
elm_object_text_set(btn, _("pid"));
evas_object_show(btn);
@ -1195,7 +1227,7 @@ _ui_content_system_add(Ui_Data *pd, Evas_Object *parent)
(ui->proc.sort_type == SORT_BY_THREADS ?
ui->proc.sort_reverse : 0),
ui->proc.sort_type == SORT_BY_THREADS);
evas_object_size_hint_weight_set(btn, 1.0, 0);
evas_object_size_hint_weight_set(btn, 1.0, 1.0);
evas_object_size_hint_align_set(btn, FILL, FILL);
elm_object_text_set(btn, _("thr"));
evas_object_show(btn);
@ -1210,7 +1242,7 @@ _ui_content_system_add(Ui_Data *pd, Evas_Object *parent)
(ui->proc.sort_type == SORT_BY_PRI ?
ui->proc.sort_reverse : 0),
ui->proc.sort_type == SORT_BY_PRI);
evas_object_size_hint_weight_set(btn, 1.0, 0);
evas_object_size_hint_weight_set(btn, 1.0, 1.0);
evas_object_size_hint_align_set(btn, FILL, FILL);
elm_object_text_set(btn, _("prio"));
evas_object_show(btn);
@ -1225,7 +1257,7 @@ _ui_content_system_add(Ui_Data *pd, Evas_Object *parent)
(ui->proc.sort_type == SORT_BY_NICE ?
ui->proc.sort_reverse : 0),
ui->proc.sort_type == SORT_BY_NICE);
evas_object_size_hint_weight_set(btn, 1.0, 0);
evas_object_size_hint_weight_set(btn, 1.0, 1.0);
evas_object_size_hint_align_set(btn, FILL, FILL);
elm_object_text_set(btn, _("nice"));
evas_object_show(btn);
@ -1240,7 +1272,7 @@ _ui_content_system_add(Ui_Data *pd, Evas_Object *parent)
(ui->proc.sort_type == SORT_BY_SIZE ?
ui->proc.sort_reverse : 0),
ui->proc.sort_type == SORT_BY_SIZE);
evas_object_size_hint_weight_set(btn, 1.0, 0);
evas_object_size_hint_weight_set(btn, 1.0, 1.0);
evas_object_size_hint_align_set(btn, FILL, FILL);
elm_object_text_set(btn, _("size"));
evas_object_show(btn);
@ -1255,7 +1287,7 @@ _ui_content_system_add(Ui_Data *pd, Evas_Object *parent)
(ui->proc.sort_type == SORT_BY_RSS ?
ui->proc.sort_reverse : 0),
ui->proc.sort_type == SORT_BY_RSS);
evas_object_size_hint_weight_set(btn, 1.0, 0);
evas_object_size_hint_weight_set(btn, 1.0, 1.0);
evas_object_size_hint_align_set(btn, FILL, FILL);
elm_object_text_set(btn, _("res"));
evas_object_show(btn);
@ -1270,7 +1302,7 @@ _ui_content_system_add(Ui_Data *pd, Evas_Object *parent)
(ui->proc.sort_type == SORT_BY_STATE ?
ui->proc.sort_reverse : 0),
ui->proc.sort_type == SORT_BY_STATE);
evas_object_size_hint_weight_set(btn, 1.0, 0);
evas_object_size_hint_weight_set(btn, 1.0, 1.0);
evas_object_size_hint_align_set(btn, FILL, FILL);
elm_object_text_set(btn, _("state"));
evas_object_show(btn);
@ -1285,7 +1317,7 @@ _ui_content_system_add(Ui_Data *pd, Evas_Object *parent)
(ui->proc.sort_type == SORT_BY_TIME ?
ui->proc.sort_reverse : 0),
ui->proc.sort_type == SORT_BY_TIME);
evas_object_size_hint_weight_set(btn, 1.0, 0);
evas_object_size_hint_weight_set(btn, 1.0, 1.0);
evas_object_size_hint_align_set(btn, FILL, FILL);
elm_object_text_set(btn, _("time"));
evas_object_show(btn);
@ -1300,7 +1332,7 @@ _ui_content_system_add(Ui_Data *pd, Evas_Object *parent)
(ui->proc.sort_type == SORT_BY_CPU_USAGE ?
ui->proc.sort_reverse : 0),
ui->proc.sort_type == SORT_BY_CPU_USAGE);
evas_object_size_hint_weight_set(btn, 1.0, 0);
evas_object_size_hint_weight_set(btn, 1.0, 1.0);
evas_object_size_hint_align_set(btn, FILL, FILL);
elm_object_text_set(btn, _("cpu %"));
evas_object_show(btn);
@ -1337,6 +1369,20 @@ _ui_content_system_add(Ui_Data *pd, Evas_Object *parent)
evas_object_smart_callback_add(pd->genlist, "unrealized",
_item_unrealized_cb, pd);
fr = elm_frame_add(parent);
elm_object_style_set(fr, "pad_small");
evas_object_size_hint_weight_set(fr, EXPAND, 0);
evas_object_size_hint_align_set(fr, 0, FILL);
evas_object_show(fr);
pd->summary.lb = lb = elm_label_add(fr);
evas_object_size_hint_weight_set(lb, EXPAND, 0);
evas_object_size_hint_align_set(lb, 0.0, FILL);
evas_object_show(lb);
elm_object_content_set(fr, lb);
elm_table_pack(tb, fr, 0, 3, i, 1);
return tb;
}