summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRadoslaw Czerski <r.czerski@samsung.com>2016-04-01 16:08:31 +0200
committerLukasz Stanislawski <l.stanislaws@samsung.com>2016-04-04 02:39:34 -0700
commit1f029e95cf989b1273d06793f25d5dacc26d8924 (patch)
tree6d99ff55a82d6f1a3e5632776e5fc261d495325a
parent74e49435c5e52c4c4a98dfce030f1b010b92cf74 (diff)
downloadindicator-win-1f029e95cf989b1273d06793f25d5dacc26d8924.tar.gz
indicator-win-1f029e95cf989b1273d06793f25d5dacc26d8924.tar.bz2
indicator-win-1f029e95cf989b1273d06793f25d5dacc26d8924.zip
modules/power/battery: Fixes.
Percentage visibility restored. Warning fix. Change-Id: Ibe80c1b4ff1f793d2a8c85413587951f9acba64d Signed-off-by: Radoslaw Czerski <r.czerski@samsung.com>
-rw-r--r--src/modules/power/battery.c40
1 files changed, 32 insertions, 8 deletions
diff --git a/src/modules/power/battery.c b/src/modules/power/battery.c
index 2c7c023..e182579 100644
--- a/src/modules/power/battery.c
+++ b/src/modules/power/battery.c
@@ -34,6 +34,7 @@
#include "util.h"
#include "box.h"
#include "log.h"
+#include <vconf.h>
#define ICON_PRIORITY INDICATOR_PRIORITY_FIXED9
#define MODULE_NAME "battery"
@@ -432,9 +433,19 @@ static void show_battery_icon(int mode, int level)
if (batt_full == 1) {
battery.img_obj.data = percentage_battery_icon_path[LEVEL_PERCENTAGE_MAX];
} else if (battery_charging==EINA_TRUE) {
- battery.img_obj.data = percentage_battery_charging_icon_path[level];
+ if (level == 0)
+ battery.img_obj.data = percentage_battery_charging_icon_path[0];
+ else {
+ int percentage_level = (level / 2) + 1;
+ battery.img_obj.data = percentage_battery_charging_icon_path[percentage_level];
+ }
} else {
- battery.img_obj.data = percentage_battery_icon_path[level];
+ if (level == 0)
+ battery.img_obj.data = percentage_battery_icon_path[0];
+ else {
+ int percentage_level = (level / 2) + 1;
+ battery.img_obj.data = percentage_battery_icon_path[percentage_level];
+ }
}
icon_show(&battery);
} else {
@@ -693,16 +704,29 @@ static void indicator_battery_batt_percentage_cb(device_callback_e type, void *v
{
struct appdata* ad = NULL;
+ int status = 0;
+
ret_if(!data);
ad = (struct appdata*)data;
- //remove battery percentage
- is_battery_percentage_shown = EINA_FALSE;
- _level.max_level = LEVEL_MAX;
- indicator_battery_update_display(data);
- hide_digits();
- box_update_display(&(ad->win));
+ vconf_get_bool(VCONFKEY_SETAPPL_BATTERY_PERCENTAGE_BOOL, &status);
+
+ if(status == 1) {
+ is_battery_percentage_shown = EINA_TRUE;
+ _level.max_level = LEVEL_PERCENTAGE_MAX;
+ indicator_battery_update_display(data);
+ show_digits();
+ box_update_display(&(ad->win));
+ }
+ else {
+ //remove battery percentage
+ is_battery_percentage_shown = EINA_FALSE;
+ _level.max_level = LEVEL_MAX;
+ indicator_battery_update_display(data);
+ hide_digits();
+ box_update_display(&(ad->win));
+ }
}
static int wake_up_cb(void *data)