ui: power on and off.

This commit is contained in:
Alastair Poole 2020-12-24 12:45:16 +00:00
parent f221609555
commit 6d070aecd2
5 changed files with 33 additions and 15 deletions

View File

@ -11,4 +11,5 @@ install_data('go-up.png', 'go-down.png',
'clo.png', 'bolt.png', 'menu.png',
'lovethisdogharvey.png', 'application.png',
'e.png', 'border.png', 'freebsd.png', 'linux.png',
'on.png', 'off.png',
install_dir: join_paths(dir_data, 'evisum/images'))

BIN
data/images/off.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

BIN
data/images/on.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

View File

@ -17,22 +17,20 @@ static Eina_Lock _lock;
typedef struct
{
Ecore_Thread *thread;
Evisum_Ui_Cache *cache;
Eina_List *cpu_times;
Eina_List *cpu_list;
Ecore_Thread *thread;
Evisum_Ui_Cache *cache;
Eina_List *cpu_times;
Eina_List *cpu_list;
Ecore_Event_Handler *handler[2];
Evas_Object *win;
Evas_Object *menu;
Ui *ui;
pid_t selected_pid;
char search[16];
int search_len;
Evas_Object *win;
Evas_Object *menu;
Ecore_Timer *timer_search;
Evas_Object *entry_pop;
Evas_Object *entry;
@ -196,7 +194,8 @@ _sort_by_state(const void *p1, const void *p2)
return strcmp(inf1->state, inf2->state);
}
typedef struct {
typedef struct
{
pid_t pid;
int64_t cpu_time_prev;
} pid_cpu_time_t;
@ -1527,9 +1526,9 @@ ui_process_list_win_add(Ui *ui)
Ui_Data *pd = _pd = calloc(1, sizeof(Ui_Data));
if (!pd) return;
pd->selected_pid = -1;
pd->ui = ui;
pd->handler[0] = ecore_event_handler_add(ELM_EVENT_CONFIG_ALL_CHANGED,
_elm_config_changed_cb, pd);
pd->handler[1] = ecore_event_handler_add(EVISUM_EVENT_CONFIG_CHANGED,
@ -1546,11 +1545,11 @@ ui_process_list_win_add(Ui *ui)
else
evas_object_resize(win, EVISUM_WIN_WIDTH * elm_config_scale_get(),
EVISUM_WIN_HEIGHT * elm_config_scale_get());
elm_win_center(win, 1, 1);
obj = _ui_content_system_add(pd, win);
pd->cache = evisum_ui_item_cache_new(pd->genlist, _item_create, 50);
elm_win_center(win, EINA_TRUE, EINA_TRUE);
evisum_ui_background_add(win, evisum_ui_backgrounds_enabled_get());
evas_object_show(win);
_search_add(pd);

View File

@ -15,6 +15,7 @@ typedef struct
Evas_Object *thermal_pb;
Evas_Object *power_ic;
Ui *ui;
} Ui_Data;
@ -126,6 +127,15 @@ _sensors_update_feedback_cb(void *data, Ecore_Thread *thread, void *msgdata)
elm_object_tooltip_text_set(pd->thermal_pb, pd->sensor->name);
}
if (pd->power_ic)
{
if (msg->power.have_ac)
elm_icon_standard_set(pd->power_ic, evisum_icon_path_get("on"));
else
elm_icon_standard_set(pd->power_ic, evisum_icon_path_get("off"));
evas_object_show(pd->power_ic);
}
l = eina_list_nth_list(pd->batteries, 0);
while (l && msg->power.battery_count)
{
@ -238,6 +248,7 @@ ui_win_sensors_add(Ui *ui)
{
Evas_Object *win, *content, *bx, *tbl, *fr;
Evas_Object *genlist, *pb, *pad;
Evas_Object *ic;
Elm_Genlist_Item_Class *itc;
power_t power;
Evas_Coord x = 0, y = 0;
@ -303,9 +314,16 @@ ui_win_sensors_add(Ui *ui)
evas_object_show(pb);
bat->pb = pb;
elm_object_content_set(pad, pb);
elm_table_pack(tbl, pad, 0, 0, 1, 1);
elm_box_pack_end(content, tbl);
elm_table_pack(tbl, pb, 1, 0, 1, 1);
if (!i)
{
pd->power_ic = ic = elm_icon_add(win);
evas_object_size_hint_min_set(ic, ELM_SCALE_SIZE(3), ELM_SCALE_SIZE(3));
evas_object_size_hint_align_set(ic, 0.0, 0.5);
elm_table_pack(tbl, ic, 0, 0, 1, 1);
}
elm_object_content_set(pad, tbl);
elm_box_pack_end(content, pad);
pd->batteries = eina_list_append(pd->batteries, bat);
}