purge: remove the crud

This commit is contained in:
Alastair Poole 2020-12-17 11:12:15 +00:00
parent fb09205d51
commit 32a9f55dbe
10 changed files with 40 additions and 218 deletions

View File

@ -39,12 +39,12 @@ evisum_ui_config_save(Ui *ui)
_evisum_config->sort_reverse = ui->settings.sort_reverse;
_evisum_config->width = w;
_evisum_config->height = h;
_evisum_config->effects = evisum_ui_effects_enabled_get();
_evisum_config->effects = 0;
_evisum_config->backgrounds = evisum_ui_backgrounds_enabled_get();
_evisum_config->poll_delay = ui->settings.poll_delay;
_evisum_config->show_kthreads = ui->settings.show_kthreads;
_evisum_config->show_user = ui->settings.show_user;
_evisum_config->show_desktop = ui->settings.show_desktop;
_evisum_config->show_desktop = 0; //ui->settings.show_desktop;
proc_info_kthreads_show_set(ui->settings.show_kthreads);
@ -93,13 +93,12 @@ evisum_ui_config_load(Ui *ui)
ui->settings.sort_reverse = _evisum_config->sort_reverse;
ui->settings.poll_delay = _evisum_config->poll_delay;
evisum_ui_effects_enabled_set(_evisum_config->effects);
evisum_ui_backgrounds_enabled_set(_evisum_config->backgrounds);
ui->settings.show_kthreads = _evisum_config->show_kthreads;
proc_info_kthreads_show_set(ui->settings.show_kthreads);
ui->settings.show_user = _evisum_config->show_user;
ui->settings.show_desktop = _evisum_config->show_desktop;
ui->settings.show_desktop = 0; // _evisum_config->show_desktop;
ui->cpu.width = _evisum_config->cpu.width;
ui->cpu.height = _evisum_config->cpu.height;
@ -171,17 +170,14 @@ static void
_menu_effects_clicked_cb(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
Ui *ui = data;
Ui *ui;
Eina_Bool state;
if ((!evisum_ui_effects_enabled_get()) && (!evisum_ui_backgrounds_enabled_get()))
evisum_ui_backgrounds_enabled_set(1);
else if (evisum_ui_backgrounds_enabled_get() && (!evisum_ui_effects_enabled_get()))
evisum_ui_effects_enabled_set(1);
else
{
evisum_ui_effects_enabled_set(0);
evisum_ui_backgrounds_enabled_set(0);
}
ui = data;
state = !evisum_ui_backgrounds_enabled_get();
evisum_ui_backgrounds_enabled_set(state);
evisum_ui_config_save(ui);
@ -247,6 +243,7 @@ _main_menu_show_threads_changed_cb(void *data EINA_UNUSED, Evas_Object *obj,
evisum_ui_config_save(ui);
}
/*
static void
_main_menu_show_desktop_changed_cb(void *data EINA_UNUSED, Evas_Object *obj,
void *event_info EINA_UNUSED)
@ -256,6 +253,7 @@ _main_menu_show_desktop_changed_cb(void *data EINA_UNUSED, Evas_Object *obj,
ui->settings.show_desktop = elm_check_state_get(obj);
evisum_ui_config_save(ui);
}
*/
static void
_main_menu_show_user_changed_cb(void *data EINA_UNUSED, Evas_Object *obj,
@ -395,6 +393,7 @@ evisum_ui_main_menu_create(Ui *ui, Evas_Object *parent)
_main_menu_show_user_changed_cb, ui);
elm_box_pack_end(bx2, chk);
/*
chk = elm_check_add(bx2);
evas_object_size_hint_weight_set(chk, EXPAND, EXPAND);
evas_object_size_hint_align_set(chk, FILL, FILL);
@ -404,6 +403,7 @@ evisum_ui_main_menu_create(Ui *ui, Evas_Object *parent)
evas_object_smart_callback_add(chk, "changed",
_main_menu_show_desktop_changed_cb, ui);
elm_box_pack_end(bx2, chk);
*/
elm_object_content_set(fr, bx2);
elm_box_pack_end(bx, fr);

View File

@ -25,7 +25,6 @@ typedef struct Ui
Evas_Object *win;
int width;
int height;
Ecore_Animator *animator;
} processes;
Evas_Object *win;

View File

@ -711,8 +711,8 @@ ui_win_cpu_add(Ui *ui)
elm_win_autodel_set(win, EINA_TRUE);
evas_object_size_hint_weight_set(win, EXPAND, EXPAND);
evas_object_size_hint_align_set(win, FILL, FILL);
evisum_ui_background_random_add(win, (evisum_ui_effects_enabled_get() ||
evisum_ui_backgrounds_enabled_get()));
evisum_ui_background_random_add(win,
evisum_ui_backgrounds_enabled_get());
evas_object_event_callback_add(win, EVAS_CALLBACK_RESIZE,
_win_resize_cb, ui);

View File

@ -515,8 +515,8 @@ ui_win_disk_add(Ui *ui)
elm_win_autodel_set(win, EINA_TRUE);
evas_object_size_hint_weight_set(win, EXPAND, EXPAND);
evas_object_size_hint_align_set(win, FILL, FILL);
evisum_ui_background_random_add(win, (evisum_ui_effects_enabled_get() ||
evisum_ui_backgrounds_enabled_get()));
evisum_ui_background_random_add(win,
evisum_ui_backgrounds_enabled_get());
Ui_Data *pd = calloc(1, sizeof(Ui_Data));
pd->ui = ui;

View File

@ -394,8 +394,8 @@ ui_win_memory_add(Ui *ui)
elm_win_autodel_set(win, EINA_TRUE);
evas_object_size_hint_weight_set(win, EXPAND, EXPAND);
evas_object_size_hint_align_set(win, FILL, FILL);
evisum_ui_background_random_add(win, (evisum_ui_effects_enabled_get() ||
evisum_ui_backgrounds_enabled_get()));
evisum_ui_background_random_add(win,
evisum_ui_backgrounds_enabled_get());
_graph_init(&graphs[GR_USED], COLOR_USED);
_graph_init(&graphs[GR_CACHED], COLOR_CACHED);

View File

@ -652,20 +652,6 @@ _process_list_feedback_cb(void *data, Ecore_Thread *thread EINA_UNUSED,
if (!eina_lock_take_try(&_lock))
return;
if (ui->settings.show_desktop)
{
int pid = 0;
list = proc_info_all_get();
EINA_LIST_FREE(list, proc)
{
if (!strcmp(proc->command, "enlightenment"))
pid = proc->pid;
proc_info_free(proc);
}
if (pid != -1)
list = proc_info_pid_children_get(pid);
}
if (!list)
list = proc_info_all_get();
@ -702,12 +688,12 @@ _process_list_feedback_cb(void *data, Ecore_Thread *thread EINA_UNUSED,
}
}
list = _list_sort(ui, list);
_genlist_ensure_n_items(pd->genlist, eina_list_count(list));
it = elm_genlist_first_item_get(pd->genlist);
list = _list_sort(ui, list);
EINA_LIST_FREE(list, proc)
{
if (!it)
@ -1376,7 +1362,6 @@ _ui_content_system_add(Ui_Data *pd, Evas_Object *parent)
evas_object_size_hint_align_set(plist, FILL, FILL);
elm_table_pack(tbl, plist, 0, 2, i, 1);
_evisum_search_add(pd);
evas_object_smart_callback_add(pd->genlist, "selected",
@ -1401,7 +1386,7 @@ _ui_content_system_add(Ui_Data *pd, Evas_Object *parent)
}
static void
_evisum_key_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
_win_key_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Evas_Event_Key_Down *ev;
Ui *ui;
@ -1487,9 +1472,6 @@ _win_del_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EINA_U
pd->thread = NULL;
ui->win = NULL;
if (ui->processes.animator)
ecore_animator_del(ui->processes.animator);
if (pd->cache)
evisum_ui_item_cache_free(pd->cache);
@ -1527,23 +1509,33 @@ ui_process_list_win_add(Ui *ui)
icon = elm_icon_add(win);
elm_icon_standard_set(icon, "evisum");
elm_win_icon_object_set(win, icon);
evas_object_event_callback_add(win, EVAS_CALLBACK_DEL, _win_del_cb, pd);
if (_evisum_config->width > 1 && _evisum_config->height > 1)
evas_object_resize(win, _evisum_config->width, _evisum_config->height);
else
evas_object_resize(win, EVISUM_WIN_WIDTH * elm_config_scale_get(),
EVISUM_WIN_HEIGHT * elm_config_scale_get());
elm_win_center(win, EINA_TRUE, EINA_TRUE);
evas_object_show(win);
if (evisum_ui_effects_enabled_get() || evisum_ui_backgrounds_enabled_get())
if (evisum_ui_backgrounds_enabled_get())
evisum_ui_background_add(ui->win, EINA_TRUE);
o = _ui_content_system_add(pd, win);
elm_object_content_set(win, o);
pd->cache = evisum_ui_item_cache_new(pd->genlist, _item_create, 50);
if (evisum_ui_effects_enabled_get()) evisum_ui_animate(ui);
evas_object_event_callback_add(win, EVAS_CALLBACK_DEL,
_win_del_cb, pd);
evas_object_event_callback_add(ui->win, EVAS_CALLBACK_RESIZE,
_win_resize_cb, pd);
evas_object_event_callback_add(o, EVAS_CALLBACK_KEY_DOWN,
_win_key_down_cb, pd);
ecore_event_handler_add(ELM_EVENT_CONFIG_ALL_CHANGED,
_elm_config_changed_cb, pd);
ecore_event_handler_add(EVISUM_EVENT_CONFIG_CHANGED,
_evisum_config_changed_cb, pd);
pd->thread = ecore_thread_feedback_run(_process_list,
_process_list_feedback_cb,
@ -1551,15 +1543,5 @@ ui_process_list_win_add(Ui *ui)
NULL, pd, EINA_FALSE);
_process_list_update(pd);
evas_object_event_callback_add(ui->win, EVAS_CALLBACK_RESIZE,
_win_resize_cb, pd);
evas_object_event_callback_add(o, EVAS_CALLBACK_KEY_DOWN,
_evisum_key_down_cb, pd);
ecore_event_handler_add(ELM_EVENT_CONFIG_ALL_CHANGED,
_elm_config_changed_cb, pd);
ecore_event_handler_add(EVISUM_EVENT_CONFIG_CHANGED,
_evisum_config_changed_cb, pd);
evas_object_show(win);
}

View File

@ -713,7 +713,6 @@ _process_tab_add(Evas_Object *parent, Ui_Data *pd)
Evas_Object *rec;
Proc_Info *proc;
int i = 0;
int r, g, b, a;
fr = elm_frame_add(parent);
elm_object_style_set(fr, "pad_small");
@ -721,12 +720,6 @@ _process_tab_add(Evas_Object *parent, Ui_Data *pd)
evas_object_size_hint_align_set(fr, FILL, FILL);
evas_object_show(fr);
if (evisum_ui_effects_enabled_get())
{
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);
}
tbl = elm_table_add(parent);
evas_object_size_hint_weight_set(tbl, EXPAND, EXPAND);
evas_object_size_hint_align_set(tbl, FILL, FILL);
@ -995,19 +988,12 @@ static Evas_Object *
_threads_tab_add(Evas_Object *parent, Ui_Data *pd)
{
Evas_Object *fr, *box, *hbox, *btn, *genlist;
int r, g, b, a;
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(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);
@ -1088,19 +1074,12 @@ static Evas_Object *
_tree_tab_add(Evas_Object *parent, Ui_Data *pd)
{
Evas_Object *fr, *box, *genlist;
int r, g, b, a;
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(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);
@ -1127,19 +1106,12 @@ static Evas_Object *
_info_tab_add(Evas_Object *parent, Ui_Data *pd)
{
Evas_Object *fr, *box, *entry;
int r, g, b, a;
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(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);
@ -1389,7 +1361,7 @@ ui_process_win_add(Evas_Object *parent_win, int pid, const char *cmd, int poll_d
elm_win_icon_object_set(win, ic);
tabs = _tabs_add(win, pd);
evisum_ui_background_random_add(win, evisum_ui_effects_enabled_get());
evisum_ui_background_random_add(win, evisum_ui_backgrounds_enabled_get());
box = elm_box_add(win);
evas_object_size_hint_weight_set(box, EXPAND, EXPAND);

View File

@ -268,8 +268,8 @@ ui_win_sensors_add(Ui *ui)
elm_win_autodel_set(win, EINA_TRUE);
evas_object_size_hint_weight_set(win, EXPAND, EXPAND);
evas_object_size_hint_align_set(win, FILL, FILL);
evisum_ui_background_random_add(win, (evisum_ui_effects_enabled_get() ||
evisum_ui_backgrounds_enabled_get()));
evisum_ui_background_random_add(win,
evisum_ui_backgrounds_enabled_get());
evas_object_event_callback_add(win, EVAS_CALLBACK_RESIZE,
_win_resize_cb, ui);

View File

@ -5,7 +5,6 @@
#define ARRAY_SIZE(n) sizeof(n) / sizeof(n[0])
static Eina_Bool _effects_enabled = EINA_FALSE;
static Eina_Bool _backgrounds_enabled = EINA_FALSE;
static Eina_Hash *_icon_cache = NULL;
@ -602,124 +601,3 @@ evisum_ui_backgrounds_enabled_set(Eina_Bool enabled)
_backgrounds_enabled = enabled;
}
Eina_Bool
evisum_ui_effects_enabled_get(void)
{
return _effects_enabled;
}
void
evisum_ui_effects_enabled_set(Eina_Bool enabled)
{
_effects_enabled = enabled;
}
typedef struct
{
Ui *ui;
int pos;
Evas_Object *im;
Evas_Object *bolt;
} Animation;
static Eina_Bool
_anim_clouds(void *data)
{
Ui *ui;
Animation *anim;
Evas_Coord ww, wh, iw, ih;
int cpu;
time_t t;
static int bolt = 0;
anim = data;
ui = anim->ui;
evas_object_geometry_get(ui->win, NULL, NULL, &ww, &wh);
if (ww <= 0 || wh <= 0) return EINA_TRUE;
evas_object_image_size_get(anim->im, &iw, &ih);
if (ww > iw) iw = ww;
cpu = (ui->cpu_usage / 10) > 0 ? ui->cpu_usage / 10 : 1;
evas_object_resize(anim->im, iw, wh);
evas_object_image_fill_set(anim->im, anim->pos, -50, iw, ih);
anim->pos += cpu;
t = time(NULL);
if (cpu >= 6 && !bolt)
{
if (cpu == 6 && !(t % 16)) bolt++;
else if (cpu == 7 && !(t % 8)) bolt++;
else if (cpu == 8 && !(t % 4)) bolt++;
else if (cpu == 9 && !(t % 2)) bolt++;
else if (cpu == 10) bolt++;
}
if (bolt)
{
struct timespec ts;
if (bolt++ == 1)
{
clock_gettime(CLOCK_REALTIME, &ts);
srand(ts.tv_nsec);
evas_object_image_size_get(anim->bolt, &iw, &ih);
evas_object_move(anim->bolt, -(rand() % iw), -(rand() % (ih / 4)));
}
if (bolt > 20)
{
evas_object_hide(anim->bolt);
bolt = 0;
}
else if (!(bolt % 2))
evas_object_show(anim->bolt);
else
evas_object_hide(anim->bolt);
}
if (anim->pos >= iw)
anim->pos = 0;
return ECORE_CALLBACK_RENEW;
}
void
evisum_ui_animate(void *data)
{
Animation *anim;
Ui *ui;
Evas_Object *im;
Evas_Coord iw, ih, ww, wh;
ui = data;
anim = calloc(1, sizeof(Animation));
if (!anim) return;
anim->ui = ui;
evas_object_geometry_get(ui->win, NULL, NULL, &ww, &wh);
anim->bolt = im = evas_object_image_filled_add(evas_object_evas_get(ui->win));
evas_object_pass_events_set(im, 1);
evas_object_image_file_set(im, evisum_icon_path_get("bolt"), NULL);
evas_object_image_size_get(im, &iw, &ih);
evas_object_size_hint_min_set(im, iw, ih);
evas_object_resize(im, iw, ih);
anim->im = im = evas_object_image_add(evas_object_evas_get(ui->win));
evas_object_image_file_set(im, evisum_icon_path_get("clo"), NULL);
evas_object_image_size_get(im, &iw, &ih);
evas_object_image_fill_set(im, 0, -50, iw, wh);
evas_object_resize(im, iw, wh);
evas_object_move(im, 0, 0);
evas_object_pass_events_set(im, 1);
evas_object_show(im);
ui->processes.animator = ecore_animator_add(_anim_clouds, anim);
}

View File

@ -55,15 +55,6 @@ evisum_ui_backgrounds_enabled_set(Eina_Bool enabled);
Eina_Bool
evisum_ui_backgrounds_enabled_get(void);
void
evisum_ui_effects_enabled_set(Eina_Bool enabled);
Eina_Bool
evisum_ui_effects_enabled_get(void);
void
evisum_ui_animate(void *data);
int
evisum_ui_textblock_font_size_get(Evas_Object *tb);