summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen 'Okra' Houston <smhouston88@gmail.com>2017-02-17 17:06:39 -0600
committerStephen 'Okra' Houston <smhouston88@gmail.com>2017-02-17 17:06:39 -0600
commit27d047f4bdb7891e1ab66a7efda1a4ddfbe5152c (patch)
tree0451b6c4c4bb07f04a177895c4d0fc96c54ad357
parent37e84e1b40d1ca0ce4098b7930f1368411109c13 (diff)
Batman: Only show unique batteries.
-rw-r--r--src/modules/sysinfo/batman/batman.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/modules/sysinfo/batman/batman.c b/src/modules/sysinfo/batman/batman.c
index dd1e170bc..e992f2570 100644
--- a/src/modules/sysinfo/batman/batman.c
+++ b/src/modules/sysinfo/batman/batman.c
@@ -75,6 +75,7 @@ _batman_popup_create(Instance *inst)
75 Eina_List *l; 75 Eina_List *l;
76 char buf[128], buf2[128]; 76 char buf[128], buf2[128];
77 int hrs = 0, mins = 0; 77 int hrs = 0, mins = 0;
78 Eina_List *udis = NULL;
78 79
79 hrs = (inst->cfg->batman.time_left / 3600); 80 hrs = (inst->cfg->batman.time_left / 3600);
80 mins = ((inst->cfg->batman.time_left) / 60 - (hrs * 60)); 81 mins = ((inst->cfg->batman.time_left) / 60 - (hrs * 60));
@@ -110,13 +111,19 @@ _batman_popup_create(Instance *inst)
110 111
111 EINA_LIST_FOREACH(batman_device_batteries, l, bat) 112 EINA_LIST_FOREACH(batman_device_batteries, l, bat)
112 { 113 {
113 pbar = elm_progressbar_add(box); 114 if (!eina_list_count(udis) || !eina_list_data_find(udis, bat->udi))
114 E_EXPAND(pbar); E_FILL(pbar); 115 {
115 elm_progressbar_span_size_set(pbar, 200 * e_scale); 116 udis = eina_list_append(udis, bat->udi);
116 elm_progressbar_value_set(pbar, bat->percent / 100); 117 pbar = elm_progressbar_add(box);
117 elm_box_pack_end(box, pbar); 118 E_EXPAND(pbar); E_FILL(pbar);
118 evas_object_show(pbar); 119 elm_progressbar_span_size_set(pbar, 200 * e_scale);
120 elm_progressbar_value_set(pbar, bat->percent / 100);
121 elm_box_pack_end(box, pbar);
122 evas_object_show(pbar);
123 }
119 } 124 }
125 if (eina_list_count(udis))
126 eina_list_free(udis);
120 e_gadget_util_ctxpopup_place(inst->o_main, popup, 127 e_gadget_util_ctxpopup_place(inst->o_main, popup,
121 inst->cfg->batman.o_gadget); 128 inst->cfg->batman.o_gadget);
122 evas_object_show(popup); 129 evas_object_show(popup);