ui: changes.

WHy not...
Alastair Poole 3 years ago
parent 247bda23c6
commit bd65274c58
  1. BIN
      data/images/menu.png
  2. 2
      src/bin/ui/ui.c
  3. 1
      src/bin/ui/ui.h
  4. 14
      src/bin/ui/ui_memory.c
  5. 383
      src/bin/ui/ui_process_list.c
  6. 262
      src/bin/ui/ui_process_view.c

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

@ -412,7 +412,7 @@ evisum_ui_main_menu_create(Ui *ui, Evas_Object *parent)
ELM_CTXPOPUP_DIRECTION_DOWN,
ELM_CTXPOPUP_DIRECTION_LEFT,
ELM_CTXPOPUP_DIRECTION_RIGHT);
evas_object_move(o, ox + (ow / 2), oy);
evas_object_move(o, ox + (ow / 2), oy + oh);
evas_object_show(o);
ui->main_menu = o;
}

@ -19,7 +19,6 @@
typedef struct Ui
{
pid_t program_pid;
Ecore_Thread *thread_system;
struct
{

@ -306,13 +306,19 @@ _graph_init(Graph *graph, int r, int g, int b, int a)
static Evas_Object *
_graph_guide(Evas_Object *parent, int r, int g, int b, int a)
{
Evas_Object *rec = evas_object_rectangle_add(parent);
Evas_Object *btn, *rec;;
btn = elm_button_add(parent);
evas_object_show(btn);
rec = evas_object_rectangle_add(parent);
evas_object_color_set(rec, r, g, b, a);
evas_object_size_hint_min_set(rec, ELM_SCALE_SIZE(16), ELM_SCALE_SIZE(16));
evas_object_size_hint_max_set(rec, ELM_SCALE_SIZE(16), ELM_SCALE_SIZE(16));
evas_object_show(rec);
elm_object_part_content_set(btn, "elm.swallow.content", rec);
return rec;
return btn;
}
static Eina_Bool
@ -457,8 +463,6 @@ ui_win_memory_add(Ui *ui)
lb = _label_mem(tbl, _("Swapped"));
pd->swap = pb = _progress_add(tbl);
rec = _graph_guide(tbl, COLOR_NONE);
elm_table_pack(tbl, rec, 0, 5, 1, 1);
elm_table_pack(tbl, lb, 1, 5, 1, 1);
elm_table_pack(tbl, pb, 2, 5, 1, 1);
@ -466,8 +470,6 @@ ui_win_memory_add(Ui *ui)
{
lb = _label_mem(tbl, _("Video"));
pd->video[i] = pb = _progress_add(tbl);
rec = _graph_guide(tbl, COLOR_NONE);
elm_table_pack(tbl, rec, 1, 6 + i, 1, 1);
elm_table_pack(tbl, lb, 1, 6 + i, 1, 1);
elm_table_pack(tbl, pb, 2, 6 + i, 1, 1);
}

@ -27,18 +27,14 @@ typedef struct
pid_t selected_pid;
char *search_text;
Evas_Object *summary;
Evas_Object *pb_cpu;
Evas_Object *pb_mem;
Evas_Object *summary_bat;
Evas_Object *pb_bat;
Evas_Object *menu;
Evas_Object *entry;
Evas_Object *scroller;
Evas_Object *genlist;
Evas_Object *btn_menu;
Evas_Object *btn_pid;
Evas_Object *btn_uid;
Evas_Object *btn_cmd;
@ -49,6 +45,8 @@ typedef struct
} Ui_Data;
#define PAD_W 2
static Ui_Data *_private_data = NULL;
// See pb_format_cb.
@ -347,23 +345,23 @@ _item_del(void *data, Evas_Object *obj EINA_UNUSED)
}
static Evas_Object *
_item_column_add(Evas_Object *table, const char *text, int col)
_item_column_add(Evas_Object *tbl, const char *text, int col)
{
Evas_Object *rect, *label;
Evas_Object *rec, *lbl;
label = elm_label_add(table);
evas_object_data_set(table, text, label);
evas_object_size_hint_align_set(label, FILL, FILL);
evas_object_size_hint_weight_set(label, EXPAND, EXPAND);
evas_object_show(label);
lbl = elm_label_add(tbl);
evas_object_data_set(tbl, text, lbl);
evas_object_size_hint_align_set(lbl, FILL, FILL);
evas_object_size_hint_weight_set(lbl, EXPAND, EXPAND);
evas_object_show(lbl);
rect = evas_object_rectangle_add(table);
evas_object_data_set(label, "rect", rect);
rec = evas_object_rectangle_add(tbl);
evas_object_data_set(lbl, "rec", rec);
elm_table_pack(table, rect, col, 0, 1, 1);
elm_table_pack(table, label, col, 0, 1, 1);
elm_table_pack(tbl, rec, col, 0, 1, 1);
elm_table_pack(tbl, lbl, col, 0, 1, 1);
return label;
return lbl;
}
static char *
@ -385,77 +383,77 @@ _pb_format_free_cb(char *str)
static Evas_Object *
_item_create(Evas_Object *parent)
{
Evas_Object *obj, *table, *label, *ic, *rect;
Evas_Object *obj, *tbl, *lbl, *ic, *rec;
Evas_Object *hbx, *pb;
int i = 0;
obj = parent;
table = elm_table_add(obj);
evas_object_size_hint_align_set(table, 1.0, FILL);
evas_object_size_hint_weight_set(table, EXPAND, EXPAND);
tbl = elm_table_add(obj);
evas_object_size_hint_align_set(tbl, 1.0, FILL);
evas_object_size_hint_weight_set(tbl, EXPAND, EXPAND);
hbx = elm_box_add(table);
hbx = elm_box_add(tbl);
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_show(hbx);
ic = elm_icon_add(table);
ic = elm_icon_add(tbl);
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
evas_object_size_hint_align_set(ic, FILL, FILL);
evas_object_size_hint_min_set(ic, ELM_SCALE_SIZE(16), ELM_SCALE_SIZE(16));
evas_object_size_hint_max_set(ic, ELM_SCALE_SIZE(16), ELM_SCALE_SIZE(16));
evas_object_show(ic);
evas_object_data_set(table, "icon", ic);
evas_object_data_set(tbl, "icon", ic);
elm_box_pack_end(hbx, ic);
elm_table_pack(table, hbx, i, 0, 1, 1);
rect = evas_object_rectangle_add(table);
evas_object_size_hint_min_set(rect, 6, 1);
elm_box_pack_end(hbx, rect);
rect = evas_object_rectangle_add(table);
evas_object_data_set(ic, "rect", rect);
elm_table_pack(table, rect, i++, 0, 1, 1);
label = elm_label_add(table);
evas_object_size_hint_weight_set(label, 0, EXPAND);
evas_object_data_set(table, "proc_cmd", label);
evas_object_data_set(label, "hbox", hbx);
evas_object_show(label);
elm_box_pack_end(hbx, label);
rect = evas_object_rectangle_add(table);
evas_object_size_hint_min_set(rect, 4, 1);
elm_box_pack_end(hbx, rect);
label =_item_column_add(table, "proc_uid", i++);
evas_object_size_hint_align_set(label, 0.0, FILL);
label = _item_column_add(table, "proc_pid", i++);
evas_object_size_hint_align_set(label, 0.0, FILL);
label = _item_column_add(table, "proc_size", i++);
evas_object_size_hint_align_set(label, 0.0, FILL);
label = _item_column_add(table, "proc_rss", i++);
evas_object_size_hint_align_set(label, 0.0, FILL);
label = _item_column_add(table, "proc_state", i++);
evas_object_size_hint_align_set(label, 0.5, FILL);
hbx = elm_box_add(table);
elm_table_pack(tbl, hbx, i, 0, 1, 1);
rec = evas_object_rectangle_add(tbl);
evas_object_size_hint_min_set(rec, 6, 1);
elm_box_pack_end(hbx, rec);
rec = evas_object_rectangle_add(tbl);
evas_object_data_set(ic, "rec", rec);
elm_table_pack(tbl, rec, i++, 0, 1, 1);
lbl = elm_label_add(tbl);
evas_object_size_hint_weight_set(lbl, 0, EXPAND);
evas_object_data_set(tbl, "proc_cmd", lbl);
evas_object_data_set(lbl, "hbx", hbx);
evas_object_show(lbl);
elm_box_pack_end(hbx, lbl);
rec = evas_object_rectangle_add(tbl);
evas_object_size_hint_min_set(rec, 4, 1);
elm_box_pack_end(hbx, rec);
lbl =_item_column_add(tbl, "proc_uid", i++);
evas_object_size_hint_align_set(lbl, 0.0, FILL);
lbl = _item_column_add(tbl, "proc_pid", i++);
evas_object_size_hint_align_set(lbl, 0.0, FILL);
lbl = _item_column_add(tbl, "proc_size", i++);
evas_object_size_hint_align_set(lbl, 0.0, FILL);
lbl = _item_column_add(tbl, "proc_rss", i++);
evas_object_size_hint_align_set(lbl, 0.0, FILL);
lbl = _item_column_add(tbl, "proc_state", i++);
evas_object_size_hint_align_set(lbl, 0.5, FILL);
hbx = elm_box_add(tbl);
elm_box_horizontal_set(hbx, 1);
evas_object_size_hint_align_set(hbx, FILL, FILL);
evas_object_size_hint_weight_set(hbx, EXPAND, EXPAND);
evas_object_show(hbx);
elm_table_pack(table, hbx, i++, 0, 1, 1);
elm_table_pack(tbl, hbx, i++, 0, 1, 1);
pb = elm_progressbar_add(hbx);
evas_object_size_hint_weight_set(pb, EXPAND, EXPAND);
evas_object_size_hint_align_set(pb, FILL, FILL);
elm_progressbar_unit_format_function_set(pb, _pb_format_cb, _pb_format_free_cb);
elm_box_pack_end(hbx, pb);
evas_object_data_set(table, "proc_cpu_usage", pb);
evas_object_data_set(tbl, "proc_cpu_usage", pb);
return table;
return tbl;
}
static Evas_Object *
@ -481,15 +479,17 @@ _content_get(void *data, Evas_Object *obj, const char *source)
}
evas_object_geometry_get(pd->btn_pid, NULL, NULL, &w, NULL);
w += PAD_W;
l = evas_object_data_get(it->obj, "proc_pid");
elm_object_text_set(l, eina_slstr_printf("%d", proc->pid));
evas_object_geometry_get(l, NULL, NULL, &ow, NULL);
if (ow > w) evas_object_size_hint_min_set(pd->btn_pid, w, 1);
r = evas_object_data_get(l, "rect");
r = evas_object_data_get(l, "rec");
evas_object_size_hint_min_set(r, w, 1);
evas_object_show(l);
evas_object_geometry_get(pd->btn_uid, NULL, NULL, &w, NULL);
w += PAD_W;
l = evas_object_data_get(it->obj, "proc_uid");
pwd_entry = getpwuid(proc->uid);
if (pwd_entry)
@ -498,41 +498,45 @@ _content_get(void *data, Evas_Object *obj, const char *source)
elm_object_text_set(l, eina_slstr_printf("%d", proc->uid));
evas_object_geometry_get(l, NULL, NULL, &ow, NULL);
if (ow > w) evas_object_size_hint_min_set(pd->btn_uid, w, 1);
r = evas_object_data_get(l, "rect");
r = evas_object_data_get(l, "rec");
evas_object_size_hint_min_set(r, w, 1);
evas_object_show(l);
evas_object_geometry_get(pd->btn_size, NULL, NULL, &w, NULL);
w += PAD_W;
l = evas_object_data_get(it->obj, "proc_size");
elm_object_text_set(l, eina_slstr_printf("%s", evisum_size_format(proc->mem_size)));
evas_object_geometry_get(l, NULL, NULL, &ow, NULL);
if (ow > w) evas_object_size_hint_min_set(pd->btn_size, w, 1);
r = evas_object_data_get(l, "rect");
r = evas_object_data_get(l, "rec");
evas_object_size_hint_min_set(r, w, 1);
evas_object_show(l);
evas_object_geometry_get(pd->btn_rss, NULL, NULL, &w, NULL);
w += PAD_W;
l = evas_object_data_get(it->obj, "proc_rss");
elm_object_text_set(l, eina_slstr_printf("%s", evisum_size_format(proc->mem_rss)));
evas_object_geometry_get(l, NULL, NULL, &ow, NULL);
if (ow > w) evas_object_size_hint_min_set(pd->btn_rss, w, 1);
r = evas_object_data_get(l, "rect");
r = evas_object_data_get(l, "rec");
evas_object_size_hint_min_set(r, w, 1);
evas_object_show(l);
evas_object_geometry_get(pd->btn_menu, NULL, NULL, &ow, NULL);
evas_object_geometry_get(pd->btn_cmd, NULL, NULL, &w, NULL);
w += ow + PAD_W;
l = evas_object_data_get(it->obj, "proc_cmd");
elm_object_text_set(l, eina_slstr_printf("%s", proc->command));
hbx = evas_object_data_get(l, "hbox");
hbx = evas_object_data_get(l, "hbx");
evas_object_geometry_get(hbx, NULL, NULL, &ow, NULL);
if (ow > w) evas_object_size_hint_min_set(pd->btn_cmd, w, 1);
r = evas_object_data_get(l, "rect");
r = evas_object_data_get(l, "rec");
evas_object_size_hint_min_set(r, w, 1);
evas_object_show(l);
o = evas_object_data_get(it->obj, "icon");
elm_icon_standard_set(o, evisum_icon_path_get(evisum_icon_cache_find(proc)));
r = evas_object_data_get(o, "rect");
r = evas_object_data_get(o, "rec");
evas_object_size_hint_min_set(r, w, 1);
evas_object_show(o);
@ -540,8 +544,7 @@ _content_get(void *data, Evas_Object *obj, const char *source)
l = evas_object_data_get(it->obj, "proc_state");
elm_object_text_set(l, eina_slstr_printf("%s", proc->state));
evas_object_geometry_get(l, NULL, NULL, &ow, NULL);
//if (ow > w) evas_object_size_hint_min_set(pd->btn_state, w, 1);
r = evas_object_data_get(l, "rect");
r = evas_object_data_get(l, "rec");
evas_object_size_hint_min_set(r, w, 1);
evas_object_show(l);
@ -619,7 +622,6 @@ _bring_in(void *data)
return EINA_FALSE;
}
static void
_process_list_cancel_cb(void *data, Ecore_Thread *thread)
{
@ -1115,33 +1117,23 @@ static Evas_Object *
_btn_create(Evas_Object *parent, const char *icon, const char *text, void *cb,
void *data)
{
Evas_Object *ot, *or, *btn, *ic;
ot = elm_table_add(parent);
evas_object_show(ot);
or = evas_object_rectangle_add(evas_object_evas_get(parent));
evas_object_size_hint_min_set(or,
24 * elm_config_scale_get(),
24 * elm_config_scale_get());
elm_table_pack(ot, or, 0, 0, 1, 1);
Evas_Object *btn, *ic;
btn = elm_button_add(parent);
evas_object_size_hint_weight_set(btn, EXPAND, EXPAND);
evas_object_size_hint_weight_set(btn, 0, EXPAND);
evas_object_size_hint_align_set(btn, FILL, FILL);
evas_object_show(btn);
ic = elm_icon_add(btn);
elm_icon_standard_set(ic, evisum_icon_path_get(icon));
evas_object_size_hint_min_set(ic, ELM_SCALE_SIZE(16), 1);
elm_object_part_content_set(btn, "icon", ic);
evas_object_show(ic);
elm_object_tooltip_text_set(btn, text);
evas_object_smart_callback_add(btn, "clicked", cb, data);
elm_table_pack(ot, btn, 0, 0, 1, 1);
return ot;
return btn;
}
static void
@ -1197,15 +1189,24 @@ _evisum_search_keypress_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj,
static Evas_Object *
_ui_content_system_add(Ui_Data *pd, Evas_Object *parent)
{
Evas_Object *box, *hbox, *frame, *table;
Evas_Object *entry, *pb, *btn, *plist;
Evas_Object *bx, *fr, *tbl;
Evas_Object *entry, *btn, *plist;
Ui *ui = pd->ui;
int i = 0;
table = elm_table_add(parent);
evas_object_size_hint_weight_set(table, EXPAND, EXPAND);
evas_object_size_hint_align_set(table, FILL, FILL);
evas_object_show(table);
bx = elm_box_add(parent);
evas_object_size_hint_weight_set(bx, EXPAND, 0);
evas_object_size_hint_align_set(bx, FILL, FILL);
evas_object_show(bx);
tbl = elm_table_add(parent);
evas_object_size_hint_weight_set(tbl, EXPAND, EXPAND);
evas_object_size_hint_align_set(tbl, FILL, FILL);
evas_object_show(tbl);
elm_table_padding_set(tbl, PAD_W, 0);
pd->btn_menu = btn = _btn_create(tbl, "menu", NULL, _btn_menu_clicked_cb, ui);
elm_table_pack(tbl, btn, i++, 1, 1, 1);
pd->btn_cmd = btn = elm_button_add(parent);
_btn_icon_state_init(btn,
@ -1215,7 +1216,7 @@ _ui_content_system_add(Ui_Data *pd, Evas_Object *parent)
evas_object_size_hint_align_set(btn, FILL, FILL);
elm_object_text_set(btn, _("Command"));
evas_object_show(btn);
elm_table_pack(table, btn, i++, 1, 1, 1);
elm_table_pack(tbl, btn, i++, 1, 1, 1);
evas_object_smart_callback_add(btn, "clicked",
_btn_cmd_clicked_cb, pd);
@ -1227,7 +1228,7 @@ _ui_content_system_add(Ui_Data *pd, Evas_Object *parent)
evas_object_size_hint_align_set(btn, FILL, FILL);
elm_object_text_set(btn, _("User"));
evas_object_show(btn);
elm_table_pack(table, btn, i++, 1, 1, 1);
elm_table_pack(tbl, btn, i++, 1, 1, 1);
evas_object_smart_callback_add(btn, "clicked",
_btn_uid_clicked_cb, pd);
@ -1239,7 +1240,7 @@ _ui_content_system_add(Ui_Data *pd, Evas_Object *parent)
evas_object_size_hint_align_set(btn, FILL, FILL);
elm_object_text_set(btn, _("PID"));
evas_object_show(btn);
elm_table_pack(table, btn, i++, 1, 1, 1);
elm_table_pack(tbl, btn, i++, 1, 1, 1);
evas_object_smart_callback_add(btn, "clicked",
_btn_pid_clicked_cb, pd);
@ -1251,7 +1252,7 @@ _ui_content_system_add(Ui_Data *pd, Evas_Object *parent)
evas_object_size_hint_align_set(btn, FILL, FILL);
elm_object_text_set(btn, _("Size"));
evas_object_show(btn);
elm_table_pack(table, btn, i++, 1, 1, 1);
elm_table_pack(tbl, btn, i++, 1, 1, 1);
evas_object_smart_callback_add(btn, "clicked",
_btn_size_clicked_cb, pd);
@ -1263,7 +1264,7 @@ _ui_content_system_add(Ui_Data *pd, Evas_Object *parent)
evas_object_size_hint_align_set(btn, FILL, FILL);
elm_object_text_set(btn, _("Res"));
evas_object_show(btn);
elm_table_pack(table, btn, i++, 1, 1, 1);
elm_table_pack(tbl, btn, i++, 1, 1, 1);
evas_object_smart_callback_add(btn, "clicked",
_btn_rss_clicked_cb, pd);
@ -1275,7 +1276,7 @@ _ui_content_system_add(Ui_Data *pd, Evas_Object *parent)
evas_object_size_hint_align_set(btn, FILL, FILL);
elm_object_text_set(btn, _("State"));
evas_object_show(btn);
elm_table_pack(table, btn, i++, 1, 1, 1);
elm_table_pack(tbl, btn, i++, 1, 1, 1);
evas_object_smart_callback_add(btn, "clicked",
_btn_state_clicked_cb, pd);
@ -1287,7 +1288,7 @@ _ui_content_system_add(Ui_Data *pd, Evas_Object *parent)
evas_object_size_hint_align_set(btn, FILL, FILL);
elm_object_text_set(btn, _("CPU %"));
evas_object_show(btn);
elm_table_pack(table, btn, i++, 1, 1, 1);
elm_table_pack(tbl, btn, i++, 1, 1, 1);
evas_object_smart_callback_add(btn, "clicked",
_btn_cpu_usage_clicked_cb, pd);
@ -1302,86 +1303,28 @@ _ui_content_system_add(Ui_Data *pd, Evas_Object *parent)
elm_genlist_multi_select_set(plist, EINA_FALSE);
evas_object_size_hint_weight_set(plist, EXPAND, EXPAND);
evas_object_size_hint_align_set(plist, FILL, FILL);
elm_table_pack(table, plist, 0, 2, i, 1);
hbox = elm_box_add(parent);
evas_object_size_hint_weight_set(hbox, EXPAND, 0);
evas_object_size_hint_align_set(hbox, FILL, 1.0);
elm_box_horizontal_set(hbox, EINA_TRUE);
evas_object_show(hbox);
elm_table_pack(tbl, plist, 0, 2, i, 1);
btn = _btn_create(hbox, "menu", NULL, _btn_menu_clicked_cb, ui);
elm_box_pack_end(hbox, btn);
/*
hbx = elm_box_add(parent);
evas_object_size_hint_weight_set(hbx, EXPAND, 0);
evas_object_size_hint_align_set(hbx, FILL, 1.0);
elm_box_horizontal_set(hbx, EINA_TRUE);
evas_object_show(hbx);
pd->entry = entry = elm_entry_add(parent);
evas_object_size_hint_weight_set(entry, EXPAND, EXPAND);
evas_object_size_hint_align_set(entry, FILL, FILL);
elm_entry_single_line_set(entry, EINA_TRUE);
elm_entry_scrollable_set(entry, EINA_TRUE);
elm_entry_editable_set(entry, EINA_TRUE);
elm_entry_editbl_set(entry, EINA_TRUE);
evas_object_show(entry);
evas_object_event_callback_add(pd->entry, EVAS_CALLBACK_KEY_DOWN,
_evisum_search_keypress_cb, pd);
elm_box_pack_end(hbox, entry);
elm_table_pack(table, hbox, 0, 3, i, 1);
box = elm_box_add(parent);
evas_object_size_hint_weight_set(box, EXPAND, 0);
evas_object_size_hint_align_set(box, FILL, FILL);
evas_object_show(box);
elm_table_pack(table, box, 0, 0, i, 1);
pd->summary = hbox = elm_box_add(box);
evas_object_size_hint_weight_set(hbox, EXPAND, 0);
evas_object_size_hint_align_set(hbox, FILL, 0);
elm_box_horizontal_set(hbox, EINA_TRUE);
evas_object_show(hbox);
elm_box_pack_end(box, hbox);
frame = elm_frame_add(hbox);
evas_object_size_hint_weight_set(frame, EXPAND, EXPAND);
evas_object_size_hint_align_set(frame, FILL, FILL);
elm_object_text_set(frame, _("System CPU"));
elm_object_style_set(frame, "pad_small");
evas_object_show(frame);
elm_box_pack_end(hbox, frame);
pd->pb_cpu = pb = elm_progressbar_add(parent);
elm_progressbar_unit_format_set(pb, "");
evas_object_size_hint_align_set(pb, FILL, FILL);
evas_object_size_hint_weight_set(pb, EXPAND, EXPAND);
elm_object_content_set(frame, pb);
evas_object_show(pb);
frame = elm_frame_add(hbox);
evas_object_size_hint_weight_set(frame, EXPAND, EXPAND);
evas_object_size_hint_align_set(frame, FILL, FILL);
elm_object_text_set(frame, _("System Memory"));
elm_object_style_set(frame, "pad_small");
evas_object_show(frame);
elm_box_pack_end(hbox, frame);
pd->pb_mem = pb = elm_progressbar_add(parent);
evas_object_size_hint_align_set(pb, FILL, FILL);
evas_object_size_hint_weight_set(pb, EXPAND, EXPAND);
evas_object_show(pb);
elm_object_content_set(frame, pb);
pd->summary_bat = frame = elm_frame_add(hbox);
elm_progressbar_unit_format_set(pb, "");
evas_object_size_hint_weight_set(frame, EXPAND, EXPAND);
evas_object_size_hint_align_set(frame, FILL, FILL);
elm_object_style_set(frame, "pad_small");
evas_object_show(frame);
elm_box_pack_end(hbox, frame);
pd->pb_bat = pb = elm_progressbar_add(parent);
elm_progressbar_unit_format_set(pb, "");
evas_object_size_hint_align_set(pb, FILL, FILL);
evas_object_size_hint_weight_set(pb, EXPAND, EXPAND);
evas_object_show(pb);
elm_object_content_set(frame, pb);
elm_box_pack_end(hbx, entry);
elm_table_pack(tbl, hbx, 0, 3, i, 1);
*/
evas_object_smart_callback_add(pd->genlist, "selected",
_item_pid_clicked_cb, pd);
@ -1390,16 +1333,18 @@ _ui_content_system_add(Ui_Data *pd, Evas_Object *parent)
evas_object_smart_callback_add(pd->genlist, "unrealized",
_item_unrealized_cb, pd);
frame = elm_frame_add(parent);
evas_object_size_hint_weight_set(frame, EXPAND, EXPAND);
evas_object_size_hint_align_set(frame, FILL, FILL);
elm_object_style_set(frame, "pad_small");
evas_object_show(frame);
elm_object_content_set(frame, table);
elm_box_pack_end(bx, tbl);
fr = elm_frame_add(parent);
evas_object_size_hint_weight_set(fr, EXPAND, EXPAND);
evas_object_size_hint_align_set(fr, FILL, FILL);
elm_object_style_set(fr, "pad_small");
evas_object_show(fr);
elm_object_content_set(fr, bx);
ecore_timer_add(2.0, _bring_in, pd);
return frame;
return fr;
}
static void
@ -1458,84 +1403,6 @@ _win_resize_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
evisum_ui_config_save(ui);
}
static void
_system_info_all_poll(void *data, Ecore_Thread *thread)
{
Ui *ui = data;
(void) ui;
while (1)
{
Sys_Info *info = system_info_basic_get();
if (!info)
{
ecore_main_loop_quit();
return;
}
if (ecore_thread_check(thread)) return;
ecore_thread_feedback(thread, info);
for (int i = 0; i < 4 * 1; i++)
{
if (ecore_thread_check(thread)) return;
usleep(250000);
}
}
}
static void
_system_info_all_poll_feedback_cb(void *data, Ecore_Thread *thread, void *msg)
{
Ui *ui;
Sys_Info *info;
double ratio, value, usage = 0.0;
Ui_Data *pd = data;
ui = pd->ui;
info = msg;
if (ecore_thread_check(thread))
goto out;
for (int i = 0; i < info->cpu_count; i++)
usage += info->cores[i]->percent;
usage /= system_cpu_online_count_get();
elm_progressbar_unit_format_set(pd->pb_cpu, "%1.2f %%");
elm_progressbar_value_set(pd->pb_cpu, usage / 100);
ui->cpu_usage = usage;
if (ui->mem.zfs_mounted)
info->memory.used += info->memory.zfs_arc_used;
ratio = info->memory.total / 100.0;
value = info->memory.used / ratio;
elm_progressbar_value_set(pd->pb_mem, value / 100);
elm_progressbar_unit_format_set(pd->pb_mem, eina_slstr_printf("%s / %s",
evisum_size_format(info->memory.used),
evisum_size_format(info->memory.total)));
usage = 0.0;
if (info->power.battery_count)
{
for (int i = 0; i < info->power.battery_count; i++)
usage += info->power.batteries[i]->percent;
if (info->power.have_ac)
elm_progressbar_unit_format_set(pd->pb_bat, "%1.0f %% AC ");
else
elm_progressbar_unit_format_set(pd->pb_bat, "%1.0f %% DC ");
elm_progressbar_value_set(pd->pb_bat, (usage / info->power.battery_count) / 100);
}
else if (!info->power.battery_count)
{
elm_box_unpack(pd->summary, pd->summary_bat);
evas_object_hide(pd->summary_bat);
}
out:
system_info_all_free(info);
}
static Eina_Bool
_elm_config_changed_cb(void *data, int type EINA_UNUSED, void *event EINA_UNUSED)
{
@ -1568,19 +1435,13 @@ _win_del_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EINA_U
evas_object_del(obj);
if (ui->thread_system)
ecore_thread_cancel(ui->thread_system);
if (pd->thread)
ecore_thread_cancel(pd->thread);
if (ui->thread_system)
ecore_thread_wait(ui->thread_system, 0.2);
if (pd->thread)
ecore_thread_wait(pd->thread, 0.2);
ui->thread_system = pd->thread = NULL;
pd->thread = NULL;
ui->win = NULL;
if (ui->processes.animator)
@ -1643,10 +1504,6 @@ ui_process_list_win_add(Ui *ui)
if (evisum_ui_effects_enabled_get())
evisum_ui_animate(ui);
ui->thread_system =
ecore_thread_feedback_run(_system_info_all_poll,
_system_info_all_poll_feedback_cb,
NULL, NULL, pd, EINA_FALSE);
pd->thread =
ecore_thread_feedback_run(_process_list,
_process_list_feedback_cb,

@ -144,51 +144,51 @@ _item_del(void *data, Evas_Object *obj EINA_UNUSED)
}
static Evas_Object *
_item_column_add(Evas_Object *table, const char *text, int col)
_item_column_add(Evas_Object *tbl, const char *text, int col)
{
Evas_Object *rect, *label;
Evas_Object *rect, *lb;
label = elm_label_add(table);
evas_object_size_hint_weight_set(label, EXPAND, EXPAND);
evas_object_size_hint_align_set(label, 0.0, FILL);
evas_object_data_set(table, text, label);
evas_object_show(label);
lb = elm_label_add(tbl);
evas_object_size_hint_weight_set(lb, EXPAND, EXPAND);
evas_object_size_hint_align_set(lb, 0.0, FILL);
evas_object_data_set(tbl, text, lb);
evas_object_show(lb);
rect = evas_object_rectangle_add(table);
evas_object_data_set(label, "rect", rect);
rect = evas_object_rectangle_add(tbl);
evas_object_data_set(lb, "rect", rect);
elm_table_pack(table, label, col, 0, 1, 1);
elm_table_pack(table, rect, col, 0, 1, 1);
elm_table_pack(tbl, lb, col, 0, 1, 1);
elm_table_pack(tbl, rect, col, 0, 1, 1);
return label;
return lb;
}
static Evas_Object *
_item_create(Evas_Object *parent)
{
Evas_Object *table, *label, *pb;
Evas_Object *tbl, *lb, *pb;
table = elm_table_add(parent);
evas_object_size_hint_weight_set(table, EXPAND, EXPAND);
evas_object_size_hint_align_set(table, FILL, FILL);
evas_object_show(table);
tbl = elm_table_add(parent);
evas_object_size_hint_weight_set(tbl, EXPAND, EXPAND);
evas_object_size_hint_align_set(tbl, FILL, FILL);
evas_object_show(tbl);
label = _item_column_add(table, "tid", 0);
evas_object_size_hint_align_set(label, 0.5, FILL);
_item_column_add(table, "name", 1);
label = _item_column_add(table, "state", 2);
evas_object_size_hint_align_set(label, 0.5, FILL);
label = _item_column_add(table, "cpu_id", 3);
evas_object_size_hint_align_set(label, 0.5, FILL);
lb = _item_column_add(tbl, "tid", 0);
evas_object_size_hint_align_set(lb, 0.5, FILL);
_item_column_add(tbl, "name", 1);
lb = _item_column_add(tbl, "state", 2);
evas_object_size_hint_align_set(lb, 0.5, FILL);
lb = _item_column_add(tbl, "cpu_id", 3);
evas_object_size_hint_align_set(lb, 0.5, FILL);
pb = elm_progressbar_add(parent);
evas_object_size_hint_align_set(pb, FILL, FILL);
evas_object_size_hint_weight_set(pb, EXPAND, EXPAND);
elm_progressbar_unit_format_set(pb, "%1.1f %%");
evas_object_data_set(table, "cpu_usage", pb);
elm_table_pack(table, pb, 4, 0, 1, 1);
evas_object_data_set(tbl, "cpu_usage", pb);
elm_table_pack(tbl, pb, 4, 0, 1, 1);
return table;
return tbl;
}
static Evas_Object *
@ -696,50 +696,50 @@ _entry_add(Evas_Object *parent)
}
static Evas_Object *
_label_add(Evas_Object *parent, const char *text)
_lb_add(Evas_Object *parent, const char *text)
{
Evas_Object *label = elm_label_add(parent);
elm_object_text_set(label, text);
evas_object_show(label);
Evas_Object *lb = elm_label_add(parent);
elm_object_text_set(lb, text);
evas_object_show(lb);
return label;
return lb;
}
static Evas_Object *
_process_tab_add(Evas_Object *parent, Ui_Data *pd)
{
Evas_Object *frame, *hbox, *table;
Evas_Object *label, *entry, *button, *border, *ic;
Evas_Object *fr, *hbox, *tbl;
Evas_Object *lb, *entry, *button, *border, *ic;
Evas_Object *rec;
Proc_Info *proc;
int i = 0;
int r, g, b, a;
frame = elm_frame_add(parent);
elm_object_style_set(frame, "pad_small");
evas_object_size_hint_weight_set(frame, EXPAND, EXPAND);
evas_object_size_hint_align_set(frame, FILL, FILL);
evas_object_show(frame);
fr = elm_frame_add(parent);
elm_object_style_set(fr, "pad_small");
evas_object_size_hint_weight_set(fr, EXPAND, EXPAND);
evas_object_size_hint_align_set(fr, FILL, FILL);
evas_object_show(fr);
if (evisum_ui_effects_enabled_get())
{
evas_object_color_get(frame, &r, &g, &b, &a);
evas_object_color_set(frame, r * 0.75, g * 0.75, b * 0.75, a * 0.75);
evas_object_color_get(fr, &r, &g, &b, &a);
evas_object_color_set(fr, r * 0.75, g * 0.75, b * 0.75, a * 0.75);
}
table = elm_table_add(parent);
evas_object_size_hint_weight_set(table, EXPAND, EXPAND);
evas_object_size_hint_align_set(table, FILL, FILL);
evas_object_show(table);
elm_object_content_set(frame, table);
tbl = elm_table_add(parent);
evas_object_size_hint_weight_set(tbl, EXPAND, EXPAND);
evas_object_size_hint_align_set(tbl, FILL, FILL);
evas_object_show(tbl);
elm_object_content_set(fr, tbl);
rec = evas_object_rectangle_add(evas_object_evas_get(table));
rec = evas_object_rectangle_add(evas_object_evas_get(tbl));
evas_object_size_hint_min_set(rec, ELM_SCALE_SIZE(64), ELM_SCALE_SIZE(64));
evas_object_size_hint_max_set(rec, ELM_SCALE_SIZE(64), ELM_SCALE_SIZE(64));
evas_object_size_hint_align_set(rec, FILL, 1.0);
elm_table_pack(table, rec, 0, i, 1, 1);
elm_table_pack(tbl, rec, 0, i, 1, 1);
proc = proc_info_by_pid(pd->selected_pid);
ic = elm_icon_add(parent);
@ -750,101 +750,101 @@ _process_tab_add(Evas_Object *parent, Ui_Data *pd)
elm_icon_standard_set(ic, evisum_icon_path_get(evisum_icon_cache_find(proc)));
evas_object_show(ic);
proc_info_free(proc);
elm_table_pack(table, ic, 0, i, 1, 1);
elm_table_pack(tbl, ic, 0, i, 1, 1);
}
label = _label_add(parent, _("Command:"));
elm_table_pack(table, label, 0, i, 1, 1);
lb = _lb_add(parent, _("Command:"));
elm_table_pack(tbl, lb, 0, i, 1, 1);
pd->entry_pid_cmd = entry = elm_label_add(parent);
evas_object_size_hint_weight_set(entry, EXPAND, EXPAND);
evas_object_size_hint_align_set(entry, 0.0, 0.5);
evas_object_show(entry);
evas_object_hide(label);
elm_table_pack(table, entry, 1, i++, 1, 1);
evas_object_hide(lb);
elm_table_pack(tbl, entry, 1, i++, 1, 1);
label = _label_add(parent, _("Command line:"));
elm_table_pack(table, label, 0, i, 1, 1);
lb = _lb_add(parent, _("Command line:"));
elm_table_pack(tbl, lb, 0, i, 1, 1);
pd->entry_pid_cmd_args = entry = _entry_add(parent);
elm_table_pack(table, entry, 1, i++, 1, 1);
elm_table_pack(tbl, entry, 1, i++, 1, 1);
label = _label_add(parent, _("PID:"));
elm_table_pack(table, label, 0, i, 1, 1);
lb = _lb_add(parent, _("PID:"));
elm_table_pack(tbl, lb, 0, i, 1, 1);
pd->entry_pid_pid = entry = _entry_add(parent);
elm_table_pack(table, entry, 1, i++, 1, 1);
elm_table_pack(tbl, entry, 1, i++, 1, 1);
label = _label_add(parent, _("Username:"));
elm_table_pack(table, label, 0, i, 1, 1);
lb = _lb_add(parent, _("Username:"));
elm_table_pack(tbl, lb, 0, i, 1, 1);
pd->entry_pid_user = entry = _entry_add(parent);
elm_table_pack(table, entry, 1, i++, 1, 1);
elm_table_pack(tbl, entry, 1, i++, 1, 1);
label = _label_add(parent, _("UID:"));
elm_table_pack(table, label, 0, i, 1, 1);
lb = _lb_add(parent, _("UID:"));
elm_table_pack(tbl, lb, 0, i, 1, 1);
pd->entry_pid_uid = entry = _entry_add(parent);
elm_table_pack(table, entry, 1, i++, 1, 1);
elm_table_pack(tbl, entry, 1, i++, 1, 1);
label = _label_add(parent, _("PPID:"));
elm_table_pack(table, label, 0, i, 1, 1);
lb = _lb_add(parent, _("PPID:"));
elm_table_pack(tbl, lb, 0, i, 1, 1);
pd->entry_pid_ppid = entry = _entry_add(parent);
elm_table_pack(table, entry, 1, i++, 1, 1);
elm_table_pack(tbl, entry, 1, i++, 1, 1);
#if defined(__MacOS__)
label = _label_add(parent, _("WQ #:"));
lb = _lb_add(parent, _("WQ #:"));
#else
label = _label_add(parent, _("CPU #:"));
lb = _lb_add(parent, _("CPU #:"));
#endif
elm_table_pack(table, label, 0, i, 1, 1);
elm_table_pack(tbl, lb, 0, i, 1, 1);
pd->entry_pid_cpu = entry = _entry_add(parent);
elm_table_pack(table, entry, 1, i++, 1, 1);
elm_table_pack(tbl, entry, 1, i++, 1, 1);
label = _label_add(parent, _("Threads:"));
elm_table_pack(table, label, 0, i, 1, 1);
lb = _lb_add(parent, _("Threads:"));
elm_table_pack(tbl, lb, 0, i, 1, 1);
pd->entry_pid_threads = entry = _entry_add(parent);
elm_table_pack(table, entry, 1, i++, 1, 1);
elm_table_pack(tbl, entry, 1, i++, 1, 1);
label = _label_add(parent, _(" Memory :"));
elm_table_pack(table, label, 0, i, 1, 1);
lb = _lb_add(parent, _(" Memory :"));
elm_table_pack(tbl, lb, 0, i, 1, 1);
pd->entry_pid_size = entry = _entry_add(parent);
elm_table_pack(table, entry, 1, i++, 1, 1);
elm_table_pack(tbl, entry, 1, i++, 1, 1);
label = _label_add(parent, _(" Shared memory:"));
elm_table_pack(table, label, 0, i, 1, 1);
lb = _lb_add(parent, _(" Shared memory:"));
elm_table_pack(tbl, lb, 0, i, 1, 1);
pd->entry_pid_shared = entry = _entry_add(parent);
elm_table_pack(table, entry, 1, i++, 1, 1);
elm_table_pack(tbl, entry, 1, i++, 1, 1);
label = _label_add(parent, _(" Resident memory:"));
elm_table_pack(table, label, 0, i, 1, 1);
lb = _lb_add(parent, _(" Resident memory:"));
elm_table_pack(tbl, lb, 0, i, 1, 1);
pd->entry_pid_rss = entry = _entry_add(parent);
elm_table_pack(table, entry, 1, i++, 1, 1);
elm_table_pack(tbl, entry, 1, i++, 1, 1);
label = _label_add(parent, _(" Virtual memory:"));
elm_table_pack(table, label, 0, i, 1, 1);
lb = _lb_add(parent, _(" Virtual memory:"));
elm_table_pack(tbl, lb, 0, i, 1, 1);
pd->entry_pid_virt = entry = _entry_add(parent);
elm_table_pack(table, entry, 1, i++, 1, 1);
elm_table_pack(tbl, entry, 1, i++, 1, 1);
label = _label_add(parent, _(" Start time:"));
elm_table_pack(table, label, 0, i, 1, 1);
lb = _lb_add(parent, _(" Start time:"));
elm_table_pack(tbl, lb, 0, i, 1, 1);
pd->entry_pid_started = entry = _entry_add(parent);
elm_table_pack(table, entry, 1, i++, 1, 1);
elm_table_pack(tbl, entry, 1, i++, 1, 1);
label = _label_add(parent, _("Nice:"));
elm_table_pack(table, label, 0, i, 1, 1);
lb = _lb_add(parent, _("Nice:"));
elm_table_pack(tbl, lb, 0, i, 1, 1);
pd->entry_pid_nice = entry = _entry_add(parent);
elm_table_pack(table, entry, 1, i++, 1, 1);
elm_table_pack(tbl, entry, 1, i++, 1, 1);
label = _label_add(parent, _("Priority:"));
elm_table_pack(table, label, 0, i, 1, 1);
lb = _lb_add(parent, _("Priority:"));
elm_table_pack(tbl, lb, 0, i, 1, 1);
pd->entry_pid_pri = entry = _entry_add(parent);
elm_table_pack(table, entry, 1, i++, 1, 1);
elm_table_pack(tbl, entry, 1, i++, 1, 1);
label = _label_add(parent, _("State:"));
elm_table_pack(table, label, 0, i, 1, 1);
lb = _lb_add(parent, _("State:"));
elm_table_pack(tbl, lb, 0, i, 1, 1);
pd->entry_pid_state = entry = _entry_add(parent);
elm_table_pack(table, entry, 1, i++, 1, 1);
elm_table_pack(tbl, entry, 1, i++, 1, 1);
label = _label_add(parent, _("CPU %:"));
elm_table_pack(table, label, 0, i, 1, 1);
lb = _lb_add(parent, _("CPU %:"));
elm_table_pack(tbl, lb, 0, i, 1, 1);
pd->entry_pid_cpu_usage = entry = _entry_add(parent);
elm_table_pack(table, entry, 1, i++, 1, 1);
elm_table_pack(tbl, entry, 1, i++, 1, 1);
hbox = elm_box_add(parent);
evas_object_size_hint_weight_set(hbox, EXPAND, 0);
@ -852,7 +852,7 @@ _process_tab_add(Evas_Object *parent, Ui_Data *pd)
elm_box_horizontal_set(hbox, EINA_TRUE);
elm_box_homogeneous_set(hbox, EINA_TRUE);
evas_object_show(hbox);
elm_table_pack(table, hbox, 1, i, 2, 1);
elm_table_pack(tbl, hbox, 1, i, 2, 1);
border = elm_frame_add(parent);
evas_object_size_hint_weight_set(border, EXPAND, EXPAND);
@ -907,7 +907,7 @@ _process_tab_add(Evas_Object *parent, Ui_Data *pd)
evas_object_show(ic);
elm_box_pack_end(hbox, button);
return frame;
return fr;
}
static void
@ -994,25 +994,25 @@ _btn_cpu_usage_clicked_cb(void *data, Evas_Object *obj EINA_UNUSED,
static Evas_Object *
_threads_tab_add(Evas_Object *parent, Ui_Data *pd)
{
Evas_Object *frame, *box, *hbox, *btn, *genlist;
Evas_Object *fr, *box, *hbox, *btn, *genlist;
int r, g, b, a;
frame = elm_frame_add(parent);
evas_object_size_hint_weight_set(frame, EXPAND, EXPAND);
evas_object_size_hint_align_set(frame, FILL, FILL);
elm_object_style_set(frame, "pad_small");
fr = elm_frame_add(parent);
evas_object_size_hint_weight_set(fr, EXPAND, EXPAND);
evas_object_size_hint_align_set(fr, FILL, FILL);
elm_object_style_set(fr, "pad_small");
if (evisum_ui_effects_enabled_get())
{
evas_object_color_get(frame, &r, &g, &b, &a);
evas_object_color_set(frame, r * 0.75, g * 0.75, b * 0.75, a * 0.75);
evas_object_color_get(fr, &r, &g, &b, &a);
evas_object_color_set(fr, r * 0.75, g * 0.75, b * 0.75, a * 0.75);
}
box = elm_box_add(parent);
evas_object_size_hint_weight_set(box, EXPAND, EXPAND);
evas_object_size_hint_align_set(box, FILL, FILL);
evas_object_show(box);
elm_object_content_set(frame, box);
elm_object_content_set(fr, box);
hbox = elm_box_add(box);
evas_object_size_hint_weight_set(hbox, EXPAND, 0);
@ -1081,31 +1081,31 @@ _threads_tab_add(Evas_Object *parent, Ui_Data *pd)
elm_box_pack_end(box, hbox);
elm_box_pack_end(box, genlist);
return frame;
return fr;
}
static Evas_Object *
_tree_tab_add(Evas_Object *parent, Ui_Data *pd)
{
Evas_Object *frame, *box, *genlist;
Evas_Object *fr, *box, *genlist;
int r, g, b, a;
frame = elm_frame_add(parent);
evas_object_size_hint_weight_set(frame, EXPAND, EXPAND);
evas_object_size_hint_align_set(frame, FILL, FILL);
elm_object_style_set(frame, "pad_small");
fr = elm_frame_add(parent);
evas_object_size_hint_weight_set(fr, EXPAND, EXPAND);
evas_object_size_hint_align_set(fr, FILL, FILL);
elm_object_style_set(fr, "pad_small");
if (evisum_ui_effects_enabled_get())
{
evas_object_color_get(frame, &r, &g, &b, &a);
evas_object_color_set(frame, r * 0.75, g * 0.75, b * 0.75, a * 0.75);
evas_object_color_get(fr, &r, &g, &b, &a);
evas_object_color_set(fr, r * 0.75, g * 0.75, b * 0.75, a * 0.75);
}
box = elm_box_add(parent);
evas_object_size_hint_weight_set(box, EXPAND, EXPAND);
evas_object_size_hint_align_set(box, FILL, FILL);
evas_object_show(box);
elm_object_content_set(frame, box);
elm_object_content_set(fr, box);
pd->genlist_tree = genlist = elm_genlist_add(parent);
evas_object_data_set(genlist, "ui", pd);
@ -1120,31 +1120,31 @@ _tree_tab_add(Evas_Object *parent, Ui_Data *pd)
elm_box_pack_end(box, genlist);
return frame;
return fr;
}
static Evas_Object *
_info_tab_add(Evas_Object *parent, Ui_Data *pd)
{
Evas_Object *frame, *box, *entry;
Evas_Object *fr, *box, *entry;
int r, g, b, a;
frame = elm_frame_add(parent);
evas_object_size_hint_weight_set(frame, EXPAND, EXPAND);
evas_object_size_hint_align_set(frame, FILL, FILL);
elm_object_style_set(frame, "pad_small");
fr = elm_frame_add(parent);
evas_object_size_hint_weight_set(fr, EXPAND, EXPAND);
evas_object_size_hint_align_set(fr, FILL, FILL);
elm_object_style_set(fr, "pad_small");
if (evisum_ui_effects_enabled_get())
{
evas_object_color_get(frame, &r, &g, &b, &a);
evas_object_color_set(frame, r * 0.75, g * 0.75, b * 0.75, a * 0.75);
evas_object_color_get(fr, &r, &g, &b, &a);
evas_object_color_set(fr, r * 0.75, g * 0.75, b * 0.75, a * 0.75);
}
box = elm_box_add(parent);
evas_object_size_hint_weight_set(box, EXPAND, EXPAND);
evas_object_size_hint_align_set(box, FILL, FILL);
evas_object_show(box);
elm_object_content_set(frame, box);
elm_object_content_set(fr, box);
pd->entry_info = entry = elm_entry_add(box);
evas_object_size_hint_weight_set(entry, EXPAND, EXPAND);
@ -1156,7 +1156,7 @@ _info_tab_add(Evas_Object *parent, Ui_Data *pd)
evas_object_show(entry);
elm_box_pack_end(box, entry);
return frame;
return fr;
}
static void

Loading…
Cancel
Save