summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlastair Poole <netstar@gmail.com>2021-10-12 09:57:20 +0100
committerAlastair Poole <netstar@gmail.com>2021-10-12 09:57:20 +0100
commitef82eb7b9f937cfd700124afaab59b15d433eac5 (patch)
tree2bed587eeab5d930013cbe621fd6651f4acd9ded
parent99eb28c2bc94240a286d88a2651f183aa7db3d14 (diff)
ui: show/hide status bar.
On or off. I don't really like it.
-rw-r--r--src/bin/evisum_config.c1
-rw-r--r--src/bin/evisum_config.h3
-rw-r--r--src/bin/ui/evisum_ui.c25
-rw-r--r--src/bin/ui/evisum_ui.h1
-rw-r--r--src/bin/ui/ui_process_list.c84
5 files changed, 77 insertions, 37 deletions
diff --git a/src/bin/evisum_config.c b/src/bin/evisum_config.c
index 06b9461..abb63f0 100644
--- a/src/bin/evisum_config.c
+++ b/src/bin/evisum_config.c
@@ -62,6 +62,7 @@ _config_init()
62 cfg->proc.poll_delay = 3; 62 cfg->proc.poll_delay = 3;
63 cfg->proc.show_kthreads = 0; 63 cfg->proc.show_kthreads = 0;
64 cfg->proc.show_scroller = 1; 64 cfg->proc.show_scroller = 1;
65 cfg->proc.show_statusbar = 0;
65 cfg->proc.transparent = 0; 66 cfg->proc.transparent = 0;
66 cfg->proc.fields = 0xffffe24f; 67 cfg->proc.fields = 0xffffe24f;
67 cfg->proc.alpha = 100; 68 cfg->proc.alpha = 100;
diff --git a/src/bin/evisum_config.h b/src/bin/evisum_config.h
index ebc9411..0d54096 100644
--- a/src/bin/evisum_config.h
+++ b/src/bin/evisum_config.h
@@ -3,7 +3,7 @@
3 3
4#include "ui/evisum_ui.h" 4#include "ui/evisum_ui.h"
5 5
6#define CONFIG_VERSION 0x0011 6#define CONFIG_VERSION 0x0012
7 7
8typedef struct _Evisum_Config 8typedef struct _Evisum_Config
9{ 9{
@@ -27,6 +27,7 @@ typedef struct _Evisum_Config
27 unsigned char poll_delay; 27 unsigned char poll_delay;
28 unsigned int fields; 28 unsigned int fields;
29 29
30 Eina_Bool show_statusbar;
30 Eina_Bool show_scroller; 31 Eina_Bool show_scroller;
31 Eina_Bool transparent; 32 Eina_Bool transparent;
32 unsigned char alpha; 33 unsigned char alpha;
diff --git a/src/bin/ui/evisum_ui.c b/src/bin/ui/evisum_ui.c
index b0b6d41..d183a60 100644
--- a/src/bin/ui/evisum_ui.c
+++ b/src/bin/ui/evisum_ui.c
@@ -34,6 +34,7 @@ evisum_ui_config_save(Evisum_Ui *ui)
34 (config()->proc.show_kthreads != ui->proc.show_kthreads) || 34 (config()->proc.show_kthreads != ui->proc.show_kthreads) ||
35 (config()->proc.show_user != ui->proc.show_user) || 35 (config()->proc.show_user != ui->proc.show_user) ||
36 (config()->proc.show_scroller != ui->proc.show_scroller) || 36 (config()->proc.show_scroller != ui->proc.show_scroller) ||
37 (config()->proc.show_statusbar != ui->proc.show_statusbar) ||
37 (config()->proc.transparent != ui->proc.transparent) || 38 (config()->proc.transparent != ui->proc.transparent) ||
38 (config()->proc.alpha != ui->proc.alpha) 39 (config()->proc.alpha != ui->proc.alpha)
39 ) 40 )
@@ -52,6 +53,7 @@ evisum_ui_config_save(Evisum_Ui *ui)
52 config()->proc.show_kthreads = ui->proc.show_kthreads; 53 config()->proc.show_kthreads = ui->proc.show_kthreads;
53 config()->proc.show_user = ui->proc.show_user; 54 config()->proc.show_user = ui->proc.show_user;
54 config()->proc.show_scroller = ui->proc.show_scroller; 55 config()->proc.show_scroller = ui->proc.show_scroller;
56 config()->proc.show_statusbar = ui->proc.show_statusbar;
55 config()->proc.transparent = ui->proc.transparent; 57 config()->proc.transparent = ui->proc.transparent;
56 config()->proc.alpha = ui->proc.alpha; 58 config()->proc.alpha = ui->proc.alpha;
57 config()->proc.fields = ui->proc.fields; 59 config()->proc.fields = ui->proc.fields;
@@ -136,6 +138,7 @@ evisum_ui_config_load(Evisum_Ui *ui)
136 proc_info_kthreads_show_set(ui->proc.show_kthreads); 138 proc_info_kthreads_show_set(ui->proc.show_kthreads);
137 ui->proc.show_user = config()->proc.show_user; 139 ui->proc.show_user = config()->proc.show_user;
138 ui->proc.show_scroller = config()->proc.show_scroller; 140 ui->proc.show_scroller = config()->proc.show_scroller;
141 ui->proc.show_statusbar = config()->proc.show_statusbar;
139 ui->proc.transparent = config()->proc.transparent; 142 ui->proc.transparent = config()->proc.transparent;
140 ui->proc.alpha = config()->proc.alpha; 143 ui->proc.alpha = config()->proc.alpha;
141 144
@@ -355,6 +358,17 @@ _main_menu_show_scroller_changed_cb(void *data EINA_UNUSED, Evas_Object *obj,
355} 358}
356 359
357static void 360static void
361_main_menu_show_statusbar_changed_cb(void *data EINA_UNUSED, Evas_Object *obj,
362 void *event_info EINA_UNUSED)
363{
364 Evisum_Ui *ui = data;
365
366 ui->proc.show_statusbar = elm_check_state_get(obj);
367 evisum_ui_config_save(ui);
368}
369
370
371static void
358_main_menu_show_user_changed_cb(void *data EINA_UNUSED, Evas_Object *obj, 372_main_menu_show_user_changed_cb(void *data EINA_UNUSED, Evas_Object *obj,
359 void *event_info EINA_UNUSED) 373 void *event_info EINA_UNUSED)
360{ 374{
@@ -601,6 +615,17 @@ evisum_ui_main_menu_create(Evisum_Ui *ui, Evas_Object *parent, Evas_Object *obj)
601 _main_menu_show_scroller_changed_cb, ui); 615 _main_menu_show_scroller_changed_cb, ui);
602 elm_box_pack_end(bx, chk); 616 elm_box_pack_end(bx, chk);
603 617
618 chk = elm_check_add(bx);
619 evas_object_size_hint_weight_set(chk, EXPAND, EXPAND);
620 evas_object_size_hint_align_set(chk, FILL, FILL);
621 elm_object_text_set(chk, _("Display status bar?"));
622 elm_check_state_set(chk, ui->proc.show_statusbar);
623 evas_object_show(chk);
624 evas_object_smart_callback_add(chk, "changed",
625 _main_menu_show_statusbar_changed_cb, ui);
626 elm_box_pack_end(bx, chk);
627
628
604 hbx = elm_box_add(o); 629 hbx = elm_box_add(o);
605 evas_object_size_hint_weight_set(hbx, EXPAND, 0); 630 evas_object_size_hint_weight_set(hbx, EXPAND, 0);
606 evas_object_size_hint_align_set(hbx, FILL, FILL); 631 evas_object_size_hint_align_set(hbx, FILL, FILL);
diff --git a/src/bin/ui/evisum_ui.h b/src/bin/ui/evisum_ui.h
index 332ad16..2a73fc1 100644
--- a/src/bin/ui/evisum_ui.h
+++ b/src/bin/ui/evisum_ui.h
@@ -53,6 +53,7 @@ typedef struct _Evisum_Ui
53 unsigned char alpha; 53 unsigned char alpha;
54 Eina_Bool transparent; 54 Eina_Bool transparent;
55 Eina_Bool show_scroller; 55 Eina_Bool show_scroller;
56 Eina_Bool show_statusbar;
56 } proc; 57 } proc;
57 58
58 Evas_Object *win_about; 59 Evas_Object *win_about;
diff --git a/src/bin/ui/ui_process_list.c b/src/bin/ui/ui_process_list.c
index eaa0fd7..6a3e17d 100644
--- a/src/bin/ui/ui_process_list.c
+++ b/src/bin/ui/ui_process_list.c
@@ -978,9 +978,12 @@ _summary_update(Win_Data *wd)
978 Battery *bat; 978 Battery *bat;
979 Eina_List *l; 979 Eina_List *l;
980 980
981 ui = wd->ui;
982
983 if (!ui->proc.show_statusbar) return;
984
981 buf = eina_strbuf_new(); 985 buf = eina_strbuf_new();
982 986
983 ui = wd->ui;
984 987
985 eina_strbuf_append_printf(buf, _("%i processes: "), wd->summary.total); 988 eina_strbuf_append_printf(buf, _("%i processes: "), wd->summary.total);
986 if (wd->summary.running) 989 if (wd->summary.running)
@@ -1011,7 +1014,8 @@ _summary_update(Win_Data *wd)
1011 elm_object_part_text_set(wd->summary.pb_mem, "elm.text.status", eina_strbuf_string_get(buf)); 1014 elm_object_part_text_set(wd->summary.pb_mem, "elm.text.status", eina_strbuf_string_get(buf));
1012 1015
1013 EINA_LIST_FOREACH(ui->batteries, l, bat) 1016 EINA_LIST_FOREACH(ui->batteries, l, bat)
1014 elm_progressbar_value_set(bat->pb, bat->usage / 100.0); 1017 elm_progressbar_value_set(bat->pb, bat->usage / 100.0);
1018
1015 eina_strbuf_free(buf); 1019 eina_strbuf_free(buf);
1016} 1020}
1017 1021
@@ -1036,15 +1040,47 @@ _summary_total(Win_Data *wd, Proc_Info *proc)
1036} 1040}
1037 1041
1038static void 1042static void
1039_first_run_tasks(Win_Data *wd) 1043summary_add(Win_Data *wd)
1040{ 1044{
1041 Evisum_Ui *ui = wd->ui; 1045 Evisum_Ui *ui = wd->ui;
1042 Battery *bat; 1046 Battery *bat;
1043 Eina_List *l; 1047 Eina_List *l;
1044 Evas_Object *hbx, *ic, *pb, *bx; 1048 Evas_Object *hbx, *ic, *pb, *bx, *lb;
1049
1050 if (!ui->proc.show_statusbar) return;
1045 1051
1046 hbx = wd->summary.hbx; 1052 hbx = wd->summary.hbx;
1047 1053
1054 ic = elm_icon_add(hbx);
1055 elm_icon_standard_set(ic, evisum_icon_path_get("cpu"));
1056 evas_object_size_hint_min_set(ic, ELM_SCALE_SIZE(16), ELM_SCALE_SIZE(16));
1057 evas_object_size_hint_weight_set(ic, 0, EXPAND);
1058 elm_box_pack_end(hbx, ic);
1059 evas_object_show(ic);
1060
1061 wd->summary.pb_cpu = pb = elm_progressbar_add(hbx);
1062 elm_progressbar_unit_format_set(pb, "%1.2f %%");
1063 elm_progressbar_span_size_set(pb, 120);
1064 elm_box_pack_end(hbx, pb);
1065 evas_object_show(pb);
1066
1067 ic = elm_icon_add(hbx);
1068 elm_icon_standard_set(ic, evisum_icon_path_get("memory"));
1069 evas_object_size_hint_min_set(ic, ELM_SCALE_SIZE(16), ELM_SCALE_SIZE(16));
1070 evas_object_size_hint_weight_set(ic, 0, EXPAND);
1071 elm_box_pack_end(hbx, ic);
1072 evas_object_show(ic);
1073
1074 wd->summary.pb_mem = pb= elm_progressbar_add(hbx);
1075 elm_progressbar_span_size_set(pb, 120);
1076 evas_object_show(pb);
1077 elm_box_pack_end(hbx, pb);
1078
1079 wd->summary.lb = lb = elm_label_add(hbx);
1080 evas_object_size_hint_weight_set(lb, EXPAND, 0);
1081 evas_object_size_hint_align_set(lb, 1.0, FILL);
1082 evas_object_show(lb);
1083
1048 EINA_LIST_FOREACH(ui->batteries, l, bat) 1084 EINA_LIST_FOREACH(ui->batteries, l, bat)
1049 { 1085 {
1050 ic = elm_icon_add(wd->win); 1086 ic = elm_icon_add(wd->win);
@@ -1055,6 +1091,7 @@ _first_run_tasks(Win_Data *wd)
1055 evas_object_show(ic); 1091 evas_object_show(ic);
1056 1092
1057 bat->pb = pb = elm_progressbar_add(wd->win); 1093 bat->pb = pb = elm_progressbar_add(wd->win);
1094 evas_object_data_set(pb, "icon", ic);
1058 elm_object_tooltip_text_set(pb, eina_slstr_printf("%s (%s)", bat->vendor, bat->model)); 1095 elm_object_tooltip_text_set(pb, eina_slstr_printf("%s (%s)", bat->vendor, bat->model));
1059 elm_progressbar_span_size_set(pb, 120); 1096 elm_progressbar_span_size_set(pb, 120);
1060 elm_progressbar_value_set(pb, bat->usage / 100.0); 1097 elm_progressbar_value_set(pb, bat->usage / 100.0);
@@ -1286,7 +1323,7 @@ _process_list_feedback_cb(void *data, Ecore_Thread *thread EINA_UNUSED,
1286#endif 1323#endif
1287 1324
1288 if (wd->first_run) 1325 if (wd->first_run)
1289 _first_run_tasks(wd); 1326 summary_add(wd);
1290 1327
1291 wd->poll_count++; 1328 wd->poll_count++;
1292 1329
@@ -1697,7 +1734,7 @@ static Evas_Object *
1697_content_add(Win_Data *wd, Evas_Object *parent) 1734_content_add(Win_Data *wd, Evas_Object *parent)
1698{ 1735{
1699 Evas_Object *tb, *btn, *glist; 1736 Evas_Object *tb, *btn, *glist;
1700 Evas_Object *fr, *hbx, *ic, *pb, *lb; 1737 Evas_Object *fr, *hbx;
1701 Evisum_Ui *ui = wd->ui; 1738 Evisum_Ui *ui = wd->ui;
1702 1739
1703 tb = elm_table_add(parent); 1740 tb = elm_table_add(parent);
@@ -1962,36 +1999,6 @@ _content_add(Win_Data *wd, Evas_Object *parent)
1962 evas_object_size_hint_align_set(hbx, FILL, FILL); 1999 evas_object_size_hint_align_set(hbx, FILL, FILL);
1963 evas_object_show(hbx); 2000 evas_object_show(hbx);
1964 2001
1965 ic = elm_icon_add(parent);
1966 elm_icon_standard_set(ic, evisum_icon_path_get("cpu"));
1967 evas_object_size_hint_min_set(ic, ELM_SCALE_SIZE(16), ELM_SCALE_SIZE(16));
1968 evas_object_size_hint_weight_set(ic, 0, EXPAND);
1969 elm_box_pack_end(hbx, ic);
1970 evas_object_show(ic);
1971
1972 wd->summary.pb_cpu = pb = elm_progressbar_add(parent);
1973 elm_progressbar_unit_format_set(pb, "%1.2f %%");
1974 elm_progressbar_span_size_set(pb, 120);
1975 elm_box_pack_end(hbx, pb);
1976 evas_object_show(pb);
1977
1978 ic = elm_icon_add(parent);
1979 elm_icon_standard_set(ic, evisum_icon_path_get("memory"));
1980 evas_object_size_hint_min_set(ic, ELM_SCALE_SIZE(16), ELM_SCALE_SIZE(16));
1981 evas_object_size_hint_weight_set(ic, 0, EXPAND);
1982 elm_box_pack_end(hbx, ic);
1983 evas_object_show(ic);
1984
1985 wd->summary.pb_mem = pb= elm_progressbar_add(parent);
1986 elm_progressbar_span_size_set(pb, 120);
1987 evas_object_show(pb);
1988 elm_box_pack_end(hbx, pb);
1989
1990 wd->summary.lb = lb = elm_label_add(parent);
1991 evas_object_size_hint_weight_set(lb, EXPAND, 0);
1992 evas_object_size_hint_align_set(lb, 1.0, FILL);
1993 evas_object_show(lb);
1994
1995 elm_object_content_set(fr, hbx); 2002 elm_object_content_set(fr, hbx);
1996 2003
1997 _fields_init(wd); 2004 _fields_init(wd);
@@ -2270,6 +2277,11 @@ _evisum_config_changed_cb(void *data, int type EINA_UNUSED,
2270 ELM_SCROLLER_POLICY_OFF)); 2277 ELM_SCROLLER_POLICY_OFF));
2271 wd->skip_wait = 1; 2278 wd->skip_wait = 1;
2272 2279
2280 if (ui->proc.show_statusbar)
2281 summary_add(wd);
2282 else
2283 elm_box_clear(wd->summary.hbx);
2284
2273 _win_alpha_set(wd); 2285 _win_alpha_set(wd);
2274 2286
2275 return 1; 2287 return 1;