davemds pushed a commit to branch master. http://git.enlightenment.org/core/enlightenment.git/commit/?id=a2644259b2928bcb89906f8a146cfb2e185a3029
commit a2644259b2928bcb89906f8a146cfb2e185a3029 Author: Dave Andreoli <[email protected]> Date: Fri Feb 10 21:23:55 2017 +0100 sysinfo gadget: remove frames in popups --- src/modules/sysinfo/batman/batman.c | 41 ++++++++++----------- src/modules/sysinfo/cpumonitor/cpumonitor.c | 34 +++++++++--------- src/modules/sysinfo/memusage/memusage.c | 55 +++++++++++++---------------- src/modules/sysinfo/sysinfo.h | 1 - 4 files changed, 63 insertions(+), 68 deletions(-) diff --git a/src/modules/sysinfo/batman/batman.c b/src/modules/sysinfo/batman/batman.c index 2d9e095..dd1e170 100644 --- a/src/modules/sysinfo/batman/batman.c +++ b/src/modules/sysinfo/batman/batman.c @@ -70,10 +70,10 @@ _batman_popup_deleted(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNU static Evas_Object * _batman_popup_create(Instance *inst) { - Evas_Object *popup, *box, *frame, *pbar; + Evas_Object *popup, *box, *pbar, *label; Battery *bat; Eina_List *l; - char buf[4096]; + char buf[128], buf2[128]; int hrs = 0, mins = 0; hrs = (inst->cfg->batman.time_left / 3600); @@ -87,33 +87,34 @@ _batman_popup_create(Instance *inst) evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, _batman_popup_deleted, inst); - frame = elm_frame_add(popup); - E_EXPAND(frame); E_FILL(frame); - if (inst->cfg->batman.have_power && (inst->cfg->batman.full < 99)) - elm_object_text_set(frame, _("Battery Charging")); - else if (inst->cfg->batman.full >= 99) - elm_object_text_set(frame, _("Battery Fully Charged")); - else - { - snprintf(buf, sizeof(buf), _("Time Remaining: %i:%02i"), hrs, mins); - elm_object_text_set(frame, buf); - } - elm_object_content_set(popup, frame); - evas_object_show(frame); - - box = elm_box_add(frame); + box = elm_box_add(popup); elm_box_horizontal_set(box, EINA_FALSE); E_EXPAND(box); E_FILL(box); - elm_object_content_set(frame, box); + elm_object_content_set(popup, box); evas_object_show(box); + label = elm_label_add(box); + E_EXPAND(label); E_ALIGN(label, 0.5, 0.5); + elm_object_text_set(label, buf); + elm_box_pack_end(box, label); + evas_object_show(label); + + if (inst->cfg->batman.have_power && (inst->cfg->batman.full < 99)) + snprintf(buf, sizeof(buf), _("Battery Charging")); + else if (inst->cfg->batman.full >= 99) + snprintf(buf, sizeof(buf), _("Battery Fully Charged")); + else + snprintf(buf, sizeof(buf), _("Time Remaining: %i:%02i"), hrs, mins); + snprintf(buf2, sizeof(buf2), "<big><b>%s</b></big>", buf); + elm_object_text_set(label, buf2); + EINA_LIST_FOREACH(batman_device_batteries, l, bat) { - pbar = elm_progressbar_add(frame); + pbar = elm_progressbar_add(box); E_EXPAND(pbar); E_FILL(pbar); elm_progressbar_span_size_set(pbar, 200 * e_scale); elm_progressbar_value_set(pbar, bat->percent / 100); - elm_object_content_set(frame, pbar); + elm_box_pack_end(box, pbar); evas_object_show(pbar); } e_gadget_util_ctxpopup_place(inst->o_main, popup, diff --git a/src/modules/sysinfo/cpumonitor/cpumonitor.c b/src/modules/sysinfo/cpumonitor/cpumonitor.c index 3bda7f9..cf25435 100644 --- a/src/modules/sysinfo/cpumonitor/cpumonitor.c +++ b/src/modules/sysinfo/cpumonitor/cpumonitor.c @@ -28,10 +28,8 @@ _cpumonitor_face_update(Instance *inst) } if (inst->cfg->cpumonitor.popup) { - char text[4096]; - snprintf(text, sizeof(text), "%s (%d%%)", _("Total CPU Usage"), inst->cfg->cpumonitor.percent); - elm_object_text_set(inst->cfg->cpumonitor.popup_frame, text); - elm_progressbar_value_set(inst->cfg->cpumonitor.popup_pbar, (float)inst->cfg->cpumonitor.percent / 100); + elm_progressbar_value_set(inst->cfg->cpumonitor.popup_pbar, + (float)inst->cfg->cpumonitor.percent / 100); } } @@ -63,10 +61,10 @@ _cpumonitor_popup_deleted(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA static void _cpumonitor_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_data) { - Evas_Object *popup, *frame, *pbar; + Evas_Object *popup, *box, *pbar, *label; Evas_Event_Mouse_Down *ev = event_data; Instance *inst = data; - char text[4096]; + char text[256]; if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; if (ev->button != 3) @@ -81,19 +79,23 @@ _cpumonitor_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA evas_object_smart_callback_add(popup, "dismissed", _cpumonitor_popup_dismissed, inst); evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, _cpumonitor_popup_deleted, inst); - frame = elm_frame_add(popup); - E_EXPAND(frame); E_FILL(frame); - snprintf(text, sizeof(text), "%s (%d%%)", _("Total CPU Usage"), inst->cfg->cpumonitor.percent); - elm_object_text_set(frame, text); - elm_object_content_set(popup, frame); - evas_object_show(frame); - inst->cfg->cpumonitor.popup_frame = frame; - - pbar = elm_progressbar_add(frame); + box = elm_box_add(popup); + E_EXPAND(box); E_FILL(box); + elm_object_content_set(popup, box); + evas_object_show(box); + + snprintf(text, sizeof(text), "<big><b>%s</b></big>", _("Total CPU Usage")); + label = elm_label_add(box); + E_EXPAND(label); E_ALIGN(label, 0.5, 0.5); + elm_object_text_set(label, text); + elm_box_pack_end(box, label); + evas_object_show(label); + + pbar = elm_progressbar_add(box); E_EXPAND(pbar); E_FILL(pbar); elm_progressbar_span_size_set(pbar, 200 * e_scale); elm_progressbar_value_set(pbar, (float)inst->cfg->cpumonitor.percent / 100); - elm_object_content_set(frame, pbar); + elm_box_pack_end(box, pbar); evas_object_show(pbar); inst->cfg->cpumonitor.popup_pbar = pbar; diff --git a/src/modules/sysinfo/memusage/memusage.c b/src/modules/sysinfo/memusage/memusage.c index 1298757..0260d4d 100644 --- a/src/modules/sysinfo/memusage/memusage.c +++ b/src/modules/sysinfo/memusage/memusage.c @@ -127,10 +127,9 @@ _memusage_popup_deleted(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_U static Evas_Object * _memusage_popup_create(Instance *inst) { - Evas_Object *popup, *box, *table, *frame, *label, *pbar; - char buf[128]; + Evas_Object *popup, *table, *label, *pbar; + char buf[128], buf2[128]; - // popup + vert box popup = elm_ctxpopup_add(e_comp->elm); elm_object_style_set(popup, "noblock"); evas_object_smart_callback_add(popup, "dismissed", @@ -138,28 +137,22 @@ _memusage_popup_create(Instance *inst) evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, _memusage_popup_deleted, inst); - box = elm_box_add(popup); - elm_box_horizontal_set(box, EINA_FALSE); - E_EXPAND(box); E_FILL(box); - elm_object_content_set(popup, box); - evas_object_show(box); + table = elm_table_add(popup); + E_EXPAND(table); E_FILL(table); + elm_object_content_set(popup, table); + evas_object_show(table); - // mem frame + table - frame = elm_frame_add(popup); - E_EXPAND(frame); E_FILL(frame); snprintf(buf, sizeof(buf), _("Memory usage (available %ld MB)"), inst->cfg->memusage.mem_total / 1024); - elm_object_text_set(frame, buf); - elm_box_pack_end(box, frame); - evas_object_show(frame); - - table = elm_table_add(frame); - E_EXPAND(table); E_FILL(table); - elm_object_content_set(frame, table); - evas_object_show(table); + snprintf(buf2, sizeof(buf2), "<big><b>%s</b></big>", buf); + label = elm_label_add(table); + E_EXPAND(label); E_ALIGN(label, 0.5, 0.5); + elm_object_text_set(label, buf2); + elm_table_pack(table, label, 0, 0, 2, 1); + evas_object_show(label); label = elm_label_add(table); - E_EXPAND(label); E_ALIGN(label, 0.0, 0.5); + E_ALIGN(label, 0.0, 0.5); elm_object_text_set(label, _("Used")); elm_table_pack(table, label, 0, 1, 1, 1); evas_object_show(label); @@ -171,7 +164,7 @@ _memusage_popup_create(Instance *inst) evas_object_data_set(popup, "mem_used_pbar", pbar); label = elm_label_add(table); - E_EXPAND(label); E_ALIGN(label, 0.0, 0.5); + E_ALIGN(label, 0.0, 0.5); elm_object_text_set(label, _("Buffers")); elm_table_pack(table, label, 0, 2, 1, 1); evas_object_show(label); @@ -183,7 +176,7 @@ _memusage_popup_create(Instance *inst) evas_object_data_set(popup, "mem_buffers_pbar", pbar); label = elm_label_add(table); - E_EXPAND(label); E_ALIGN(label, 0.0, 0.5); + E_ALIGN(label, 0.0, 0.5); elm_object_text_set(label, _("Cached")); elm_table_pack(table, label, 0, 3, 1, 1); evas_object_show(label); @@ -195,7 +188,7 @@ _memusage_popup_create(Instance *inst) evas_object_data_set(popup, "mem_cached_pbar", pbar); label = elm_label_add(table); - E_EXPAND(label); E_ALIGN(label, 0.0, 0.5); + E_ALIGN(label, 0.0, 0.5); elm_object_text_set(label, _("Shared")); elm_table_pack(table, label, 0, 4, 1, 1); evas_object_show(label); @@ -206,18 +199,18 @@ _memusage_popup_create(Instance *inst) evas_object_show(pbar); evas_object_data_set(popup, "mem_shared_pbar", pbar); - // swp frame - frame = elm_frame_add(popup); - E_EXPAND(frame); E_FILL(frame); snprintf(buf, sizeof(buf), _("Swap usage (available %ld MB)"), inst->cfg->memusage.swp_total / 1024); - elm_object_text_set(frame, buf); - elm_box_pack_end(box, frame); - evas_object_show(frame); + snprintf(buf2, sizeof(buf2), "<big><b>%s</b></big>", buf); + label = elm_label_add(table); + E_EXPAND(label); E_ALIGN(label, 0.5, 0.5); + elm_object_text_set(label, buf2); + elm_table_pack(table, label, 0, 5, 2, 1); + evas_object_show(label); - pbar = elm_progressbar_add(frame); + pbar = elm_progressbar_add(table); E_EXPAND(pbar); E_FILL(pbar); - elm_object_content_set(frame, pbar); + elm_table_pack(table, pbar, 0, 6, 2, 1); evas_object_show(pbar); evas_object_data_set(popup, "swap_pbar", pbar); diff --git a/src/modules/sysinfo/sysinfo.h b/src/modules/sysinfo/sysinfo.h index 70da7cf..7286b76 100644 --- a/src/modules/sysinfo/sysinfo.h +++ b/src/modules/sysinfo/sysinfo.h @@ -187,7 +187,6 @@ struct _Config_Item { Evas_Object *o_gadget; Evas_Object *popup; - Evas_Object *popup_frame; Evas_Object *popup_pbar; Evas_Object *configure; int poll_interval; --
