summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen 'Okra' Houston <smhouston88@gmail.com>2017-01-27 13:48:02 -0600
committerStephen 'Okra' Houston <smhouston88@gmail.com>2017-01-27 13:49:04 -0600
commit1547ac080cc4d56b89279dd61418139e34fffb0d (patch)
treed956f209091aa03fa74e1c88780bf837c93bc574
parent1861f474e4c783fee9f9a3d50764891a67bfc3a5 (diff)
Enlightenment: Sysinfo Gadget - Base size on edje extends calcs.
-rw-r--r--src/modules/sysinfo/cpumonitor/cpumonitor.c17
-rw-r--r--src/modules/sysinfo/memusage/memusage.c6
-rw-r--r--src/modules/sysinfo/thermal/thermal.c11
3 files changed, 27 insertions, 7 deletions
diff --git a/src/modules/sysinfo/cpumonitor/cpumonitor.c b/src/modules/sysinfo/cpumonitor/cpumonitor.c
index 4fb54320d..ff96f5c52 100644
--- a/src/modules/sysinfo/cpumonitor/cpumonitor.c
+++ b/src/modules/sysinfo/cpumonitor/cpumonitor.c
@@ -113,10 +113,19 @@ _cpumonitor_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA
113static void 113static void
114_cpumonitor_resize_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_data EINA_UNUSED) 114_cpumonitor_resize_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_data EINA_UNUSED)
115{ 115{
116 Evas_Coord w, h; 116 Evas_Coord w = 1, h = 1;
117 Instance *inst = data; 117 Instance *inst = data;
118 CPU_Core *first_core;
119 int num_cores = eina_list_count(inst->cfg->cpumonitor.cores);
118 120
119 evas_object_geometry_get(inst->cfg->cpumonitor.o_gadget, 0, 0, &w, &h); 121 if (!num_cores || !inst->o_main) return;
122
123 first_core = eina_list_nth(inst->cfg->cpumonitor.cores, 0);
124 edje_object_parts_extends_calc(elm_layout_edje_get(first_core->layout), 0, 0, &w, &h);
125 if (e_gadget_site_orient_get(e_gadget_site_get(inst->o_main)) == E_GADGET_SITE_ORIENT_VERTICAL)
126 h *= num_cores;
127 else
128 w *= num_cores;
120 evas_object_size_hint_aspect_set(inst->o_main, EVAS_ASPECT_CONTROL_BOTH, w, h); 129 evas_object_size_hint_aspect_set(inst->o_main, EVAS_ASPECT_CONTROL_BOTH, w, h);
121} 130}
122 131
@@ -156,6 +165,7 @@ _cpumonitor_add_layout(Instance *inst)
156 int orient = e_gadget_site_orient_get(e_gadget_site_get(inst->o_main)); 165 int orient = e_gadget_site_orient_get(e_gadget_site_get(inst->o_main));
157 166
158 layout = elm_layout_add(inst->cfg->cpumonitor.o_gadget); 167 layout = elm_layout_add(inst->cfg->cpumonitor.o_gadget);
168 edje_object_update_hints_set(elm_layout_edje_get(layout), EINA_TRUE);
159 if (orient == E_GADGET_SITE_ORIENT_VERTICAL) 169 if (orient == E_GADGET_SITE_ORIENT_VERTICAL)
160 e_theme_edje_object_set(layout, "base/theme/modules/cpumonitor", 170 e_theme_edje_object_set(layout, "base/theme/modules/cpumonitor",
161 "e/modules/cpumonitor/main_vert"); 171 "e/modules/cpumonitor/main_vert");
@@ -289,8 +299,9 @@ Evas_Object *
289sysinfo_cpumonitor_create(Evas_Object *parent, Instance *inst) 299sysinfo_cpumonitor_create(Evas_Object *parent, Instance *inst)
290{ 300{
291 inst->cfg->cpumonitor.o_gadget = elm_box_add(parent); 301 inst->cfg->cpumonitor.o_gadget = elm_box_add(parent);
292 elm_box_horizontal_set(inst->cfg->cpumonitor.o_gadget, EINA_TRUE); 302 elm_box_padding_set(inst->cfg->cpumonitor.o_gadget, 0, 0);
293 elm_box_homogeneous_set(inst->cfg->cpumonitor.o_gadget, EINA_TRUE); 303 elm_box_homogeneous_set(inst->cfg->cpumonitor.o_gadget, EINA_TRUE);
304 elm_box_horizontal_set(inst->cfg->cpumonitor.o_gadget, EINA_TRUE);
294 E_EXPAND(inst->cfg->cpumonitor.o_gadget); 305 E_EXPAND(inst->cfg->cpumonitor.o_gadget);
295 E_FILL(inst->cfg->cpumonitor.o_gadget); 306 E_FILL(inst->cfg->cpumonitor.o_gadget);
296 evas_object_event_callback_add(inst->cfg->cpumonitor.o_gadget, EVAS_CALLBACK_MOUSE_DOWN, _cpumonitor_mouse_down_cb, inst); 307 evas_object_event_callback_add(inst->cfg->cpumonitor.o_gadget, EVAS_CALLBACK_MOUSE_DOWN, _cpumonitor_mouse_down_cb, inst);
diff --git a/src/modules/sysinfo/memusage/memusage.c b/src/modules/sysinfo/memusage/memusage.c
index 895cfbbcd..3451dfced 100644
--- a/src/modules/sysinfo/memusage/memusage.c
+++ b/src/modules/sysinfo/memusage/memusage.c
@@ -116,9 +116,8 @@ _memusage_resize_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSE
116 Evas_Coord w, h; 116 Evas_Coord w, h;
117 Instance *inst = data; 117 Instance *inst = data;
118 118
119 evas_object_geometry_get(inst->cfg->memusage.o_gadget, 0, 0, &w, &h); 119 edje_object_parts_extends_calc(elm_layout_edje_get(inst->cfg->memusage.o_gadget), 0, 0, &w, &h);
120 if (inst->cfg->esm == E_SYSINFO_MODULE_MEMUSAGE) 120 evas_object_size_hint_aspect_set(inst->o_main, EVAS_ASPECT_CONTROL_BOTH, w, h);
121 evas_object_size_hint_aspect_set(inst->o_main, EVAS_ASPECT_CONTROL_BOTH, w, h);
122} 121}
123 122
124static void 123static void
@@ -253,7 +252,6 @@ sysinfo_memusage_create(Evas_Object *parent, Instance *inst)
253 E_EXPAND(inst->cfg->memusage.o_gadget); 252 E_EXPAND(inst->cfg->memusage.o_gadget);
254 E_FILL(inst->cfg->memusage.o_gadget); 253 E_FILL(inst->cfg->memusage.o_gadget);
255 evas_object_event_callback_add(inst->cfg->memusage.o_gadget, EVAS_CALLBACK_MOUSE_DOWN, _memusage_mouse_down_cb, inst); 254 evas_object_event_callback_add(inst->cfg->memusage.o_gadget, EVAS_CALLBACK_MOUSE_DOWN, _memusage_mouse_down_cb, inst);
256 evas_object_event_callback_add(inst->cfg->memusage.o_gadget, EVAS_CALLBACK_RESIZE, _memusage_resize_cb, inst);
257 evas_object_show(inst->cfg->memusage.o_gadget); 255 evas_object_show(inst->cfg->memusage.o_gadget);
258 _memusage_config_updated(inst); 256 _memusage_config_updated(inst);
259 257
diff --git a/src/modules/sysinfo/thermal/thermal.c b/src/modules/sysinfo/thermal/thermal.c
index c9ed6554a..f5749eddf 100644
--- a/src/modules/sysinfo/thermal/thermal.c
+++ b/src/modules/sysinfo/thermal/thermal.c
@@ -183,6 +183,16 @@ _thermal_face_shutdown(Instance *inst)
183} 183}
184 184
185static void 185static void
186_thermal_resize_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_data EINA_UNUSED)
187{
188 Evas_Coord w, h;
189 Instance *inst = data;
190
191 edje_object_parts_extends_calc(elm_layout_edje_get(inst->cfg->thermal.o_gadget), 0, 0, &w, &h);
192 evas_object_size_hint_aspect_set(inst->o_main, EVAS_ASPECT_CONTROL_BOTH, w, h);
193}
194
195static void
186_thermal_removed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_data) 196_thermal_removed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_data)
187{ 197{
188 Instance *inst = data; 198 Instance *inst = data;
@@ -227,6 +237,7 @@ _thermal_created_cb(void *data, Evas_Object *obj, void *event_data EINA_UNUSED)
227 E_EXPAND(inst->cfg->thermal.o_gadget); 237 E_EXPAND(inst->cfg->thermal.o_gadget);
228 E_FILL(inst->cfg->thermal.o_gadget); 238 E_FILL(inst->cfg->thermal.o_gadget);
229 elm_box_pack_end(inst->o_main, inst->cfg->thermal.o_gadget); 239 elm_box_pack_end(inst->o_main, inst->cfg->thermal.o_gadget);
240 evas_object_event_callback_add(inst->cfg->thermal.o_gadget, EVAS_CALLBACK_RESIZE, _thermal_resize_cb, inst);
230 evas_object_show(inst->cfg->thermal.o_gadget); 241 evas_object_show(inst->cfg->thermal.o_gadget);
231 evas_object_smart_callback_del_full(obj, "gadget_created", _thermal_created_cb, data); 242 evas_object_smart_callback_del_full(obj, "gadget_created", _thermal_created_cb, data);
232 _thermal_config_updated(inst); 243 _thermal_config_updated(inst);