summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Houston <stephen@localhost.localdomain>2018-02-13 10:46:26 -0600
committerStephen Houston <stephen@localhost.localdomain>2018-02-13 10:46:26 -0600
commit3a9dba4e790913728f3ccccedf0b6dd5a62a17b1 (patch)
tree520e51cfdf6ab700f8e619b8704c9050a0bc52d0
parentda104d9d514660dd110e0cbbb369eb37766d2733 (diff)
Handle orientation for sysinfo gadgets.
-rw-r--r--batman/src/batman.c19
-rw-r--r--cpuclock/src/cpuclock.c18
-rw-r--r--cpumonitor/src/cpumonitor.c70
-rw-r--r--memusage/src/memusage.c23
-rw-r--r--netstatus/src/netstatus.c23
-rw-r--r--thermal/src/thermal.c19
6 files changed, 152 insertions, 20 deletions
diff --git a/batman/src/batman.c b/batman/src/batman.c
index 806ab03..8dff1b8 100644
--- a/batman/src/batman.c
+++ b/batman/src/batman.c
@@ -557,14 +557,29 @@ sysinfo_batman_remove(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNU
557Evas_Object * 557Evas_Object *
558sysinfo_batman_create(Evas_Object *parent, Instance *inst) 558sysinfo_batman_create(Evas_Object *parent, Instance *inst)
559{ 559{
560 const char *orient = NULL;
561
560 inst->cfg->batman.full = -2; 562 inst->cfg->batman.full = -2;
561 inst->cfg->batman.time_left = -2; 563 inst->cfg->batman.time_left = -2;
562 inst->cfg->batman.have_battery = -2; 564 inst->cfg->batman.have_battery = -2;
563 inst->cfg->batman.have_power = -2; 565 inst->cfg->batman.have_power = -2;
564 566
565 inst->cfg->batman.o_gadget = elm_layout_add(parent); 567 inst->cfg->batman.o_gadget = elm_layout_add(parent);
566 elm_layout_file_set(inst->cfg->batman.o_gadget, elm_theme_group_path_find(NULL, "batman/main"), 568 if (inst->gadget)
567 "batman/main"); 569 {
570 orient = getenv("E_GADGET_ORIENTATION");
571 if (!eina_streq(orient, "Vertical"))
572 elm_layout_file_set(inst->cfg->batman.o_gadget, elm_theme_group_path_find(NULL, "batman/main"),
573 "batman/main");
574 else
575 elm_layout_file_set(inst->cfg->batman.o_gadget, elm_theme_group_path_find(NULL, "batman/main_vert"),
576 "batman/main_vert");
577 }
578 else
579 {
580 elm_layout_file_set(inst->cfg->batman.o_gadget, elm_theme_group_path_find(NULL, "batman/main"),
581 "batman/main");
582 }
568 evas_object_size_hint_weight_set(inst->cfg->batman.o_gadget, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 583 evas_object_size_hint_weight_set(inst->cfg->batman.o_gadget, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
569 evas_object_size_hint_align_set(inst->cfg->batman.o_gadget, EVAS_HINT_FILL, EVAS_HINT_FILL); 584 evas_object_size_hint_align_set(inst->cfg->batman.o_gadget, EVAS_HINT_FILL, EVAS_HINT_FILL);
570 evas_object_event_callback_add(inst->cfg->batman.o_gadget, 585 evas_object_event_callback_add(inst->cfg->batman.o_gadget,
diff --git a/cpuclock/src/cpuclock.c b/cpuclock/src/cpuclock.c
index aad6bf9..b71170a 100644
--- a/cpuclock/src/cpuclock.c
+++ b/cpuclock/src/cpuclock.c
@@ -901,6 +901,7 @@ Evas_Object *
901sysinfo_cpuclock_create(Evas_Object *parent, Instance *inst) 901sysinfo_cpuclock_create(Evas_Object *parent, Instance *inst)
902{ 902{
903 Eina_List *l = NULL; 903 Eina_List *l = NULL;
904 const char *orient = NULL;
904 905
905 if (inst->cfg->cpuclock.pstate_min == 0) inst->cfg->cpuclock.pstate_min = 1; 906 if (inst->cfg->cpuclock.pstate_min == 0) inst->cfg->cpuclock.pstate_min = 1;
906 if (inst->cfg->cpuclock.pstate_max == 0) inst->cfg->cpuclock.pstate_max = 101; 907 if (inst->cfg->cpuclock.pstate_max == 0) inst->cfg->cpuclock.pstate_max = 101;
@@ -909,8 +910,21 @@ sysinfo_cpuclock_create(Evas_Object *parent, Instance *inst)
909 inst->cfg->cpuclock.tot_max_frequency = 0; 910 inst->cfg->cpuclock.tot_max_frequency = 0;
910 911
911 inst->cfg->cpuclock.o_gadget = elm_layout_add(parent); 912 inst->cfg->cpuclock.o_gadget = elm_layout_add(parent);
912 elm_layout_file_set(inst->cfg->cpuclock.o_gadget, elm_theme_group_path_find(NULL, "cpuclock/main"), 913 if (inst->gadget)
913 "cpuclock/main"); 914 {
915 orient = getenv("E_GADGET_ORIENTATION");
916 if (!eina_streq(orient, "Vertical"))
917 elm_layout_file_set(inst->cfg->cpuclock.o_gadget, elm_theme_group_path_find(NULL, "cpuclock/main"),
918 "cpuclock/main");
919 else
920 elm_layout_file_set(inst->cfg->cpuclock.o_gadget, elm_theme_group_path_find(NULL, "cpuclock/main_vert"),
921 "cpuclock/main_vert");
922 }
923 else
924 {
925 elm_layout_file_set(inst->cfg->cpuclock.o_gadget, elm_theme_group_path_find(NULL, "cpuclock/main"),
926 "cpuclock/main");
927 }
914 evas_object_size_hint_weight_set(inst->cfg->cpuclock.o_gadget, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 928 evas_object_size_hint_weight_set(inst->cfg->cpuclock.o_gadget, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
915 evas_object_size_hint_align_set(inst->cfg->cpuclock.o_gadget, EVAS_HINT_FILL, EVAS_HINT_FILL); 929 evas_object_size_hint_align_set(inst->cfg->cpuclock.o_gadget, EVAS_HINT_FILL, EVAS_HINT_FILL);
916 evas_object_event_callback_add(inst->cfg->cpuclock.o_gadget, 930 evas_object_event_callback_add(inst->cfg->cpuclock.o_gadget,
diff --git a/cpumonitor/src/cpumonitor.c b/cpumonitor/src/cpumonitor.c
index 1d5a1a4..b2d47e7 100644
--- a/cpumonitor/src/cpumonitor.c
+++ b/cpumonitor/src/cpumonitor.c
@@ -114,10 +114,22 @@ _cpumonitor_resize_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *e
114 Evas_Coord w = 1, h = 1; 114 Evas_Coord w = 1, h = 1;
115 Instance *inst = data; 115 Instance *inst = data;
116 int num_cores = inst->cfg->cpumonitor.cores; 116 int num_cores = inst->cfg->cpumonitor.cores;
117 117 const char *orient = NULL;
118
118 edje_object_parts_extends_calc(elm_layout_edje_get(obj), 0, 0, &w, &h); 119 edje_object_parts_extends_calc(elm_layout_edje_get(obj), 0, 0, &w, &h);
119 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE, _cpumonitor_resize_cb, inst); 120 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE, _cpumonitor_resize_cb, inst);
120 w *= num_cores; 121 if (inst->gadget)
122 {
123 orient = getenv("E_GADGET_ORIENTATION");
124 if (!eina_streq(orient, "Vertical"))
125 w *= num_cores;
126 else
127 h *= num_cores;
128 }
129 else
130 {
131 w *= num_cores;
132 }
121 if (w < 1) w = 1; 133 if (w < 1) w = 1;
122 if (h < 1) h = 1; 134 if (h < 1) h = 1;
123 evas_object_size_hint_aspect_set(inst->cfg->cpumonitor.o_gadget_box, EVAS_ASPECT_CONTROL_BOTH, w, h); 135 evas_object_size_hint_aspect_set(inst->cfg->cpumonitor.o_gadget_box, EVAS_ASPECT_CONTROL_BOTH, w, h);
@@ -153,11 +165,25 @@ Evas_Object *
153_cpumonitor_add_layout(Instance *inst) 165_cpumonitor_add_layout(Instance *inst)
154{ 166{
155 Evas_Object *layout; 167 Evas_Object *layout;
168 const char *orient = NULL;
156 169
157 layout = elm_layout_add(inst->cfg->cpumonitor.o_gadget_box); 170 layout = elm_layout_add(inst->cfg->cpumonitor.o_gadget_box);
158 edje_object_update_hints_set(elm_layout_edje_get(layout), EINA_TRUE); 171 edje_object_update_hints_set(elm_layout_edje_get(layout), EINA_TRUE);
159 elm_layout_file_set(layout, elm_theme_group_path_find(NULL, "cpumonitor/core/main"), 172 if (inst->gadget)
160 "cpumonitor/core/main"); 173 {
174 orient = getenv("E_GADGET_ORIENTATION");
175 if (!eina_streq(orient, "Vertical"))
176 elm_layout_file_set(layout, elm_theme_group_path_find(NULL, "cpumonitor/core/main"),
177 "cpumonitor/core/main");
178 else
179 elm_layout_file_set(layout, elm_theme_group_path_find(NULL, "cpumonitor/core/main_vert"),
180 "cpumonitor/core/main_vert");
181 }
182 else
183 {
184 elm_layout_file_set(layout, elm_theme_group_path_find(NULL, "cpumonitor/core/main"),
185 "cpumonitor/core/main");
186 }
161 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 187 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
162 evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL); 188 evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
163 elm_box_pack_end(inst->cfg->cpumonitor.o_gadget_box, layout); 189 elm_box_pack_end(inst->cfg->cpumonitor.o_gadget_box, layout);
@@ -289,13 +315,31 @@ sysinfo_cpumonitor_remove(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA
289Evas_Object * 315Evas_Object *
290sysinfo_cpumonitor_create(Evas_Object *parent, Instance *inst) 316sysinfo_cpumonitor_create(Evas_Object *parent, Instance *inst)
291{ 317{
318 const char *orient = NULL;
319
320 if (inst->gadget)
321 orient = getenv("E_GADGET_ORIENTATION");
292 inst->cfg->cpumonitor.percent = 0; 322 inst->cfg->cpumonitor.percent = 0;
293 inst->cfg->cpumonitor.popup = NULL; 323 inst->cfg->cpumonitor.popup = NULL;
294 inst->cfg->cpumonitor.configure = NULL; 324 inst->cfg->cpumonitor.configure = NULL;
295 inst->cfg->cpumonitor.o_gadget = elm_layout_add(parent); 325 inst->cfg->cpumonitor.o_gadget = elm_layout_add(parent);
296 elm_layout_file_set(inst->cfg->cpumonitor.o_gadget, 326 if (orient)
297 elm_theme_group_path_find(NULL, "cpumonitor/main"), 327 {
298 "cpumonitor/main"); 328 if (!eina_streq(orient, "Vertical"))
329 elm_layout_file_set(inst->cfg->cpumonitor.o_gadget,
330 elm_theme_group_path_find(NULL, "cpumonitor/main"),
331 "cpumonitor/main");
332 else
333 elm_layout_file_set(inst->cfg->cpumonitor.o_gadget,
334 elm_theme_group_path_find(NULL, "cpumonitor/main_vert"),
335 "cpumonitor/main_vert");
336 }
337 else
338 {
339 elm_layout_file_set(inst->cfg->cpumonitor.o_gadget,
340 elm_theme_group_path_find(NULL, "cpumonitor/main"),
341 "cpumonitor/main");
342 }
299 evas_object_size_hint_weight_set(inst->cfg->cpumonitor.o_gadget, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 343 evas_object_size_hint_weight_set(inst->cfg->cpumonitor.o_gadget, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
300 evas_object_size_hint_align_set(inst->cfg->cpumonitor.o_gadget, EVAS_HINT_FILL, EVAS_HINT_FILL); 344 evas_object_size_hint_align_set(inst->cfg->cpumonitor.o_gadget, EVAS_HINT_FILL, EVAS_HINT_FILL);
301 evas_object_event_callback_add(inst->cfg->cpumonitor.o_gadget, EVAS_CALLBACK_MOUSE_DOWN, 345 evas_object_event_callback_add(inst->cfg->cpumonitor.o_gadget, EVAS_CALLBACK_MOUSE_DOWN,
@@ -304,7 +348,17 @@ sysinfo_cpumonitor_create(Evas_Object *parent, Instance *inst)
304 348
305 inst->cfg->cpumonitor.o_gadget_box = elm_box_add(inst->cfg->cpumonitor.o_gadget); 349 inst->cfg->cpumonitor.o_gadget_box = elm_box_add(inst->cfg->cpumonitor.o_gadget);
306 elm_box_homogeneous_set(inst->cfg->cpumonitor.o_gadget_box, EINA_TRUE); 350 elm_box_homogeneous_set(inst->cfg->cpumonitor.o_gadget_box, EINA_TRUE);
307 elm_box_horizontal_set(inst->cfg->cpumonitor.o_gadget_box, EINA_TRUE); 351 if (orient)
352 {
353 if (!eina_streq(orient, "Vertical"))
354 elm_box_horizontal_set(inst->cfg->cpumonitor.o_gadget_box, EINA_TRUE);
355 else
356 elm_box_horizontal_set(inst->cfg->cpumonitor.o_gadget_box, EINA_FALSE);
357 }
358 else
359 {
360 elm_box_horizontal_set(inst->cfg->cpumonitor.o_gadget_box, EINA_TRUE);
361 }
308 evas_object_size_hint_weight_set(inst->cfg->cpumonitor.o_gadget_box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 362 evas_object_size_hint_weight_set(inst->cfg->cpumonitor.o_gadget_box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
309 evas_object_size_hint_align_set(inst->cfg->cpumonitor.o_gadget_box, EVAS_HINT_FILL, EVAS_HINT_FILL); 363 evas_object_size_hint_align_set(inst->cfg->cpumonitor.o_gadget_box, EVAS_HINT_FILL, EVAS_HINT_FILL);
310 elm_layout_content_set(inst->cfg->cpumonitor.o_gadget, "e.swallow.content", inst->cfg->cpumonitor.o_gadget_box); 364 elm_layout_content_set(inst->cfg->cpumonitor.o_gadget, "e.swallow.content", inst->cfg->cpumonitor.o_gadget_box);
diff --git a/memusage/src/memusage.c b/memusage/src/memusage.c
index 68d8840..6f340fb 100644
--- a/memusage/src/memusage.c
+++ b/memusage/src/memusage.c
@@ -376,6 +376,8 @@ sysinfo_memusage_remove(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_U
376Evas_Object * 376Evas_Object *
377sysinfo_memusage_create(Evas_Object *parent, Instance *inst) 377sysinfo_memusage_create(Evas_Object *parent, Instance *inst)
378{ 378{
379 const char *orient = NULL;
380
379 inst->cfg->memusage.mem_percent = 0; 381 inst->cfg->memusage.mem_percent = 0;
380 inst->cfg->memusage.swp_percent = 0; 382 inst->cfg->memusage.swp_percent = 0;
381 inst->cfg->memusage.mem_total = 0; 383 inst->cfg->memusage.mem_total = 0;
@@ -388,9 +390,24 @@ sysinfo_memusage_create(Evas_Object *parent, Instance *inst)
388 inst->cfg->memusage.popup = NULL; 390 inst->cfg->memusage.popup = NULL;
389 inst->cfg->memusage.configure = NULL; 391 inst->cfg->memusage.configure = NULL;
390 inst->cfg->memusage.o_gadget = elm_layout_add(parent); 392 inst->cfg->memusage.o_gadget = elm_layout_add(parent);
391 elm_layout_file_set(inst->cfg->memusage.o_gadget, 393 if (inst->gadget)
392 elm_theme_group_path_find(NULL, "memusage/main"), 394 {
393 "memusage/main"); 395 orient = getenv("E_GADGET_ORIENTATION");
396 if (!eina_streq(orient, "Vertical"))
397 elm_layout_file_set(inst->cfg->memusage.o_gadget,
398 elm_theme_group_path_find(NULL, "memusage/main"),
399 "memusage/main");
400 else
401 elm_layout_file_set(inst->cfg->memusage.o_gadget,
402 elm_theme_group_path_find(NULL, "memusage/main_vert"),
403 "memusage/main_vert");
404 }
405 else
406 {
407 elm_layout_file_set(inst->cfg->memusage.o_gadget,
408 elm_theme_group_path_find(NULL, "memusage/main"),
409 "memusage/main");
410 }
394 evas_object_size_hint_weight_set(inst->cfg->memusage.o_gadget, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 411 evas_object_size_hint_weight_set(inst->cfg->memusage.o_gadget, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
395 evas_object_size_hint_align_set(inst->cfg->memusage.o_gadget, EVAS_HINT_FILL, EVAS_HINT_FILL); 412 evas_object_size_hint_align_set(inst->cfg->memusage.o_gadget, EVAS_HINT_FILL, EVAS_HINT_FILL);
396 evas_object_event_callback_add(inst->cfg->memusage.o_gadget, 413 evas_object_event_callback_add(inst->cfg->memusage.o_gadget,
diff --git a/netstatus/src/netstatus.c b/netstatus/src/netstatus.c
index c9abc7b..d8c6461 100644
--- a/netstatus/src/netstatus.c
+++ b/netstatus/src/netstatus.c
@@ -316,6 +316,8 @@ sysinfo_netstatus_remove(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_
316Evas_Object * 316Evas_Object *
317sysinfo_netstatus_create(Evas_Object *parent, Instance *inst) 317sysinfo_netstatus_create(Evas_Object *parent, Instance *inst)
318{ 318{
319 const char *orient = NULL;
320
319 inst->cfg->netstatus.popup = NULL; 321 inst->cfg->netstatus.popup = NULL;
320 inst->cfg->netstatus.instring = NULL; 322 inst->cfg->netstatus.instring = NULL;
321 inst->cfg->netstatus.outstring = NULL; 323 inst->cfg->netstatus.outstring = NULL;
@@ -323,9 +325,24 @@ sysinfo_netstatus_create(Evas_Object *parent, Instance *inst)
323 inst->cfg->netstatus.outpercent = 0; 325 inst->cfg->netstatus.outpercent = 0;
324 326
325 inst->cfg->netstatus.o_gadget = elm_layout_add(parent); 327 inst->cfg->netstatus.o_gadget = elm_layout_add(parent);
326 elm_layout_file_set(inst->cfg->netstatus.o_gadget, 328 if (inst->gadget)
327 elm_theme_group_path_find(NULL, "netstatus/main"), 329 {
328 "netstatus/main"); 330 orient = getenv("E_GADGET_ORIENTATION");
331 if (!eina_streq(orient, "Vertical"))
332 elm_layout_file_set(inst->cfg->netstatus.o_gadget,
333 elm_theme_group_path_find(NULL, "netstatus/main"),
334 "netstatus/main");
335 else
336 elm_layout_file_set(inst->cfg->netstatus.o_gadget,
337 elm_theme_group_path_find(NULL, "netstatus/main_vert"),
338 "netstatus/main_vert");
339 }
340 else
341 {
342 elm_layout_file_set(inst->cfg->netstatus.o_gadget,
343 elm_theme_group_path_find(NULL, "netstatus/main"),
344 "netstatus/main");
345 }
329 evas_object_size_hint_weight_set(inst->cfg->netstatus.o_gadget, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 346 evas_object_size_hint_weight_set(inst->cfg->netstatus.o_gadget, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
330 evas_object_size_hint_align_set(inst->cfg->netstatus.o_gadget, EVAS_HINT_FILL, EVAS_HINT_FILL); 347 evas_object_size_hint_align_set(inst->cfg->netstatus.o_gadget, EVAS_HINT_FILL, EVAS_HINT_FILL);
331 evas_object_event_callback_add(inst->cfg->netstatus.o_gadget, EVAS_CALLBACK_MOUSE_DOWN, _netstatus_mouse_down_cb, inst); 348 evas_object_event_callback_add(inst->cfg->netstatus.o_gadget, EVAS_CALLBACK_MOUSE_DOWN, _netstatus_mouse_down_cb, inst);
diff --git a/thermal/src/thermal.c b/thermal/src/thermal.c
index 7bfdb0b..481376a 100644
--- a/thermal/src/thermal.c
+++ b/thermal/src/thermal.c
@@ -292,13 +292,28 @@ sysinfo_thermal_remove(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UN
292Evas_Object * 292Evas_Object *
293sysinfo_thermal_create(Evas_Object *parent, Instance *inst) 293sysinfo_thermal_create(Evas_Object *parent, Instance *inst)
294{ 294{
295 const char *orient = NULL;
296
295 inst->cfg->thermal.temp = 900; 297 inst->cfg->thermal.temp = 900;
296 inst->cfg->thermal.percent = 0; 298 inst->cfg->thermal.percent = 0;
297 inst->cfg->thermal.have_temp = EINA_FALSE; 299 inst->cfg->thermal.have_temp = EINA_FALSE;
298 300
299 inst->cfg->thermal.o_gadget = elm_layout_add(parent); 301 inst->cfg->thermal.o_gadget = elm_layout_add(parent);
300 elm_layout_file_set(inst->cfg->thermal.o_gadget, elm_theme_group_path_find(NULL, "thermal/main"), 302 if (inst->gadget)
301 "thermal/main"); 303 {
304 orient = getenv("E_GADGET_ORIENTATION");
305 if (!eina_streq(orient, "Vertical"))
306 elm_layout_file_set(inst->cfg->thermal.o_gadget, elm_theme_group_path_find(NULL, "thermal/main"),
307 "thermal/main");
308 else
309 elm_layout_file_set(inst->cfg->thermal.o_gadget, elm_theme_group_path_find(NULL, "thermal/main_vert"),
310 "thermal/main_vert");
311 }
312 else
313 {
314 elm_layout_file_set(inst->cfg->thermal.o_gadget, elm_theme_group_path_find(NULL, "thermal/main"),
315 "thermal/main");
316 }
302 evas_object_size_hint_weight_set(inst->cfg->thermal.o_gadget, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 317 evas_object_size_hint_weight_set(inst->cfg->thermal.o_gadget, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
303 evas_object_size_hint_align_set(inst->cfg->thermal.o_gadget, EVAS_HINT_FILL, EVAS_HINT_FILL); 318 evas_object_size_hint_align_set(inst->cfg->thermal.o_gadget, EVAS_HINT_FILL, EVAS_HINT_FILL);
304 evas_object_event_callback_add(inst->cfg->thermal.o_gadget, 319 evas_object_event_callback_add(inst->cfg->thermal.o_gadget,