ui: show/hide status bar.
On or off. I don't really like it.
This commit is contained in:
parent
99eb28c2bc
commit
ef82eb7b9f
|
@ -62,6 +62,7 @@ _config_init()
|
|||
cfg->proc.poll_delay = 3;
|
||||
cfg->proc.show_kthreads = 0;
|
||||
cfg->proc.show_scroller = 1;
|
||||
cfg->proc.show_statusbar = 0;
|
||||
cfg->proc.transparent = 0;
|
||||
cfg->proc.fields = 0xffffe24f;
|
||||
cfg->proc.alpha = 100;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "ui/evisum_ui.h"
|
||||
|
||||
#define CONFIG_VERSION 0x0011
|
||||
#define CONFIG_VERSION 0x0012
|
||||
|
||||
typedef struct _Evisum_Config
|
||||
{
|
||||
|
@ -27,6 +27,7 @@ typedef struct _Evisum_Config
|
|||
unsigned char poll_delay;
|
||||
unsigned int fields;
|
||||
|
||||
Eina_Bool show_statusbar;
|
||||
Eina_Bool show_scroller;
|
||||
Eina_Bool transparent;
|
||||
unsigned char alpha;
|
||||
|
|
|
@ -34,6 +34,7 @@ evisum_ui_config_save(Evisum_Ui *ui)
|
|||
(config()->proc.show_kthreads != ui->proc.show_kthreads) ||
|
||||
(config()->proc.show_user != ui->proc.show_user) ||
|
||||
(config()->proc.show_scroller != ui->proc.show_scroller) ||
|
||||
(config()->proc.show_statusbar != ui->proc.show_statusbar) ||
|
||||
(config()->proc.transparent != ui->proc.transparent) ||
|
||||
(config()->proc.alpha != ui->proc.alpha)
|
||||
)
|
||||
|
@ -52,6 +53,7 @@ evisum_ui_config_save(Evisum_Ui *ui)
|
|||
config()->proc.show_kthreads = ui->proc.show_kthreads;
|
||||
config()->proc.show_user = ui->proc.show_user;
|
||||
config()->proc.show_scroller = ui->proc.show_scroller;
|
||||
config()->proc.show_statusbar = ui->proc.show_statusbar;
|
||||
config()->proc.transparent = ui->proc.transparent;
|
||||
config()->proc.alpha = ui->proc.alpha;
|
||||
config()->proc.fields = ui->proc.fields;
|
||||
|
@ -136,6 +138,7 @@ evisum_ui_config_load(Evisum_Ui *ui)
|
|||
proc_info_kthreads_show_set(ui->proc.show_kthreads);
|
||||
ui->proc.show_user = config()->proc.show_user;
|
||||
ui->proc.show_scroller = config()->proc.show_scroller;
|
||||
ui->proc.show_statusbar = config()->proc.show_statusbar;
|
||||
ui->proc.transparent = config()->proc.transparent;
|
||||
ui->proc.alpha = config()->proc.alpha;
|
||||
|
||||
|
@ -354,6 +357,17 @@ _main_menu_show_scroller_changed_cb(void *data EINA_UNUSED, Evas_Object *obj,
|
|||
evisum_ui_config_save(ui);
|
||||
}
|
||||
|
||||
static void
|
||||
_main_menu_show_statusbar_changed_cb(void *data EINA_UNUSED, Evas_Object *obj,
|
||||
void *event_info EINA_UNUSED)
|
||||
{
|
||||
Evisum_Ui *ui = data;
|
||||
|
||||
ui->proc.show_statusbar = 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,
|
||||
void *event_info EINA_UNUSED)
|
||||
|
@ -601,6 +615,17 @@ evisum_ui_main_menu_create(Evisum_Ui *ui, Evas_Object *parent, Evas_Object *obj)
|
|||
_main_menu_show_scroller_changed_cb, ui);
|
||||
elm_box_pack_end(bx, chk);
|
||||
|
||||
chk = elm_check_add(bx);
|
||||
evas_object_size_hint_weight_set(chk, EXPAND, EXPAND);
|
||||
evas_object_size_hint_align_set(chk, FILL, FILL);
|
||||
elm_object_text_set(chk, _("Display status bar?"));
|
||||
elm_check_state_set(chk, ui->proc.show_statusbar);
|
||||
evas_object_show(chk);
|
||||
evas_object_smart_callback_add(chk, "changed",
|
||||
_main_menu_show_statusbar_changed_cb, ui);
|
||||
elm_box_pack_end(bx, chk);
|
||||
|
||||
|
||||
hbx = elm_box_add(o);
|
||||
evas_object_size_hint_weight_set(hbx, EXPAND, 0);
|
||||
evas_object_size_hint_align_set(hbx, FILL, FILL);
|
||||
|
|
|
@ -53,6 +53,7 @@ typedef struct _Evisum_Ui
|
|||
unsigned char alpha;
|
||||
Eina_Bool transparent;
|
||||
Eina_Bool show_scroller;
|
||||
Eina_Bool show_statusbar;
|
||||
} proc;
|
||||
|
||||
Evas_Object *win_about;
|
||||
|
|
|
@ -978,9 +978,12 @@ _summary_update(Win_Data *wd)
|
|||
Battery *bat;
|
||||
Eina_List *l;
|
||||
|
||||
ui = wd->ui;
|
||||
|
||||
if (!ui->proc.show_statusbar) return;
|
||||
|
||||
buf = eina_strbuf_new();
|
||||
|
||||
ui = wd->ui;
|
||||
|
||||
eina_strbuf_append_printf(buf, _("%i processes: "), wd->summary.total);
|
||||
if (wd->summary.running)
|
||||
|
@ -1011,7 +1014,8 @@ _summary_update(Win_Data *wd)
|
|||
elm_object_part_text_set(wd->summary.pb_mem, "elm.text.status", eina_strbuf_string_get(buf));
|
||||
|
||||
EINA_LIST_FOREACH(ui->batteries, l, bat)
|
||||
elm_progressbar_value_set(bat->pb, bat->usage / 100.0);
|
||||
elm_progressbar_value_set(bat->pb, bat->usage / 100.0);
|
||||
|
||||
eina_strbuf_free(buf);
|
||||
}
|
||||
|
||||
|
@ -1036,15 +1040,47 @@ _summary_total(Win_Data *wd, Proc_Info *proc)
|
|||
}
|
||||
|
||||
static void
|
||||
_first_run_tasks(Win_Data *wd)
|
||||
summary_add(Win_Data *wd)
|
||||
{
|
||||
Evisum_Ui *ui = wd->ui;
|
||||
Battery *bat;
|
||||
Eina_List *l;
|
||||
Evas_Object *hbx, *ic, *pb, *bx;
|
||||
Evas_Object *hbx, *ic, *pb, *bx, *lb;
|
||||
|
||||
if (!ui->proc.show_statusbar) return;
|
||||
|
||||
hbx = wd->summary.hbx;
|
||||
|
||||
ic = elm_icon_add(hbx);
|
||||
elm_icon_standard_set(ic, evisum_icon_path_get("cpu"));
|
||||
evas_object_size_hint_min_set(ic, ELM_SCALE_SIZE(16), ELM_SCALE_SIZE(16));
|
||||
evas_object_size_hint_weight_set(ic, 0, EXPAND);
|
||||
elm_box_pack_end(hbx, ic);
|
||||
evas_object_show(ic);
|
||||
|
||||
wd->summary.pb_cpu = pb = elm_progressbar_add(hbx);
|
||||
elm_progressbar_unit_format_set(pb, "%1.2f %%");
|
||||
elm_progressbar_span_size_set(pb, 120);
|
||||
elm_box_pack_end(hbx, pb);
|
||||
evas_object_show(pb);
|
||||
|
||||
ic = elm_icon_add(hbx);
|
||||
elm_icon_standard_set(ic, evisum_icon_path_get("memory"));
|
||||
evas_object_size_hint_min_set(ic, ELM_SCALE_SIZE(16), ELM_SCALE_SIZE(16));
|
||||
evas_object_size_hint_weight_set(ic, 0, EXPAND);
|
||||
elm_box_pack_end(hbx, ic);
|
||||
evas_object_show(ic);
|
||||
|
||||
wd->summary.pb_mem = pb= elm_progressbar_add(hbx);
|
||||
elm_progressbar_span_size_set(pb, 120);
|
||||
evas_object_show(pb);
|
||||
elm_box_pack_end(hbx, pb);
|
||||
|
||||
wd->summary.lb = lb = elm_label_add(hbx);
|
||||
evas_object_size_hint_weight_set(lb, EXPAND, 0);
|
||||
evas_object_size_hint_align_set(lb, 1.0, FILL);
|
||||
evas_object_show(lb);
|
||||
|
||||
EINA_LIST_FOREACH(ui->batteries, l, bat)
|
||||
{
|
||||
ic = elm_icon_add(wd->win);
|
||||
|
@ -1055,6 +1091,7 @@ _first_run_tasks(Win_Data *wd)
|
|||
evas_object_show(ic);
|
||||
|
||||
bat->pb = pb = elm_progressbar_add(wd->win);
|
||||
evas_object_data_set(pb, "icon", ic);
|
||||
elm_object_tooltip_text_set(pb, eina_slstr_printf("%s (%s)", bat->vendor, bat->model));
|
||||
elm_progressbar_span_size_set(pb, 120);
|
||||
elm_progressbar_value_set(pb, bat->usage / 100.0);
|
||||
|
@ -1286,7 +1323,7 @@ _process_list_feedback_cb(void *data, Ecore_Thread *thread EINA_UNUSED,
|
|||
#endif
|
||||
|
||||
if (wd->first_run)
|
||||
_first_run_tasks(wd);
|
||||
summary_add(wd);
|
||||
|
||||
wd->poll_count++;
|
||||
|
||||
|
@ -1697,7 +1734,7 @@ static Evas_Object *
|
|||
_content_add(Win_Data *wd, Evas_Object *parent)
|
||||
{
|
||||
Evas_Object *tb, *btn, *glist;
|
||||
Evas_Object *fr, *hbx, *ic, *pb, *lb;
|
||||
Evas_Object *fr, *hbx;
|
||||
Evisum_Ui *ui = wd->ui;
|
||||
|
||||
tb = elm_table_add(parent);
|
||||
|
@ -1962,36 +1999,6 @@ _content_add(Win_Data *wd, Evas_Object *parent)
|
|||
evas_object_size_hint_align_set(hbx, FILL, FILL);
|
||||
evas_object_show(hbx);
|
||||
|
||||
ic = elm_icon_add(parent);
|
||||
elm_icon_standard_set(ic, evisum_icon_path_get("cpu"));
|
||||
evas_object_size_hint_min_set(ic, ELM_SCALE_SIZE(16), ELM_SCALE_SIZE(16));
|
||||
evas_object_size_hint_weight_set(ic, 0, EXPAND);
|
||||
elm_box_pack_end(hbx, ic);
|
||||
evas_object_show(ic);
|
||||
|
||||
wd->summary.pb_cpu = pb = elm_progressbar_add(parent);
|
||||
elm_progressbar_unit_format_set(pb, "%1.2f %%");
|
||||
elm_progressbar_span_size_set(pb, 120);
|
||||
elm_box_pack_end(hbx, pb);
|
||||
evas_object_show(pb);
|
||||
|
||||
ic = elm_icon_add(parent);
|
||||
elm_icon_standard_set(ic, evisum_icon_path_get("memory"));
|
||||
evas_object_size_hint_min_set(ic, ELM_SCALE_SIZE(16), ELM_SCALE_SIZE(16));
|
||||
evas_object_size_hint_weight_set(ic, 0, EXPAND);
|
||||
elm_box_pack_end(hbx, ic);
|
||||
evas_object_show(ic);
|
||||
|
||||
wd->summary.pb_mem = pb= elm_progressbar_add(parent);
|
||||
elm_progressbar_span_size_set(pb, 120);
|
||||
evas_object_show(pb);
|
||||
elm_box_pack_end(hbx, pb);
|
||||
|
||||
wd->summary.lb = lb = elm_label_add(parent);
|
||||
evas_object_size_hint_weight_set(lb, EXPAND, 0);
|
||||
evas_object_size_hint_align_set(lb, 1.0, FILL);
|
||||
evas_object_show(lb);
|
||||
|
||||
elm_object_content_set(fr, hbx);
|
||||
|
||||
_fields_init(wd);
|
||||
|
@ -2270,6 +2277,11 @@ _evisum_config_changed_cb(void *data, int type EINA_UNUSED,
|
|||
ELM_SCROLLER_POLICY_OFF));
|
||||
wd->skip_wait = 1;
|
||||
|
||||
if (ui->proc.show_statusbar)
|
||||
summary_add(wd);
|
||||
else
|
||||
elm_box_clear(wd->summary.hbx);
|
||||
|
||||
_win_alpha_set(wd);
|
||||
|
||||
return 1;
|
||||
|
|
Loading…
Reference in New Issue