From 30627f779ad813745ddb523daed095cf9392bb63 Mon Sep 17 00:00:00 2001 From: Radoslaw Czerski Date: Wed, 10 Feb 2016 13:53:37 +0100 Subject: [PATCH] icon: vconf removed. Global variable used as a flag. Change-Id: I9956d923fcc595dda25c134837d886ea54377106 Signed-off-by: Radoslaw Czerski --- inc/indicator.h | 2 ++ src/icon.c | 26 +++++--------------------- src/modules/information/more_notify.c | 31 ++++++++++++++----------------- 3 files changed, 21 insertions(+), 38 deletions(-) diff --git a/inc/indicator.h b/inc/indicator.h index be8f9be..642bc5a 100644 --- a/inc/indicator.h +++ b/inc/indicator.h @@ -39,6 +39,8 @@ #define DATA_KEY_BASE_RECT "dkbr" #define DATA_KEY_TICKER_TEXT "dktt" +#define INDICATOR_MORE_NOTI "indicator_more_noti" + enum indicator_win_mode{ INDICATOR_WIN_PORT = 0, }; diff --git a/src/icon.c b/src/icon.c index 4d54d63..51e21f5 100644 --- a/src/icon.c +++ b/src/icon.c @@ -19,7 +19,6 @@ #include -#include #include #include "common.h" @@ -41,8 +40,6 @@ extern int current_angle; static unsigned int update_icon_flag = 1; // For battery problem - - static void _reset_on_timer_icon_animation(icon_s *icon) { ret_if(!icon); @@ -755,25 +752,12 @@ void icon_reset_list(void) -static void _show_hide_more_noti(win_info* win,int val) +static void _show_hide_more_noti(win_info* win, bool show) { - static int bShow = 0; - - if (bShow == val) { - return; - } - - bShow = val; - - if (val == 1) { - preference_set_int(VCONFKEY_INDICATOR_SHOW_MORE_NOTI, 1); - } else { - preference_set_int(VCONFKEY_INDICATOR_SHOW_MORE_NOTI, 0); - } + int err = preference_set_boolean(INDICATOR_MORE_NOTI, show); + retm_if(err != PREFERENCE_ERROR_NONE, "preference_set_boolean failed: %s", get_error_message(err)); } - - void icon_handle_more_notify_icon(win_info* win) { retif(win == NULL, , "Invalid parameter!"); @@ -788,12 +772,12 @@ void icon_handle_more_notify_icon(win_info* win) DBG("PORT :: %d", (system_cnt + minictrl_cnt + noti_cnt)); if((system_cnt + minictrl_cnt + noti_cnt) > MAX_NOTI_ICONS_PORT) { - _show_hide_more_noti(win,1); + _show_hide_more_noti(win, true); DBG("PORT :: handle_more_notify_show"); } else {*/ - _show_hide_more_noti(win,0); + _show_hide_more_noti(win, false); DBG("PORT :: handle_more_notify_hide"); /*} }*/ diff --git a/src/modules/information/more_notify.c b/src/modules/information/more_notify.c index 99c5298..5495459 100644 --- a/src/modules/information/more_notify.c +++ b/src/modules/information/more_notify.c @@ -21,7 +21,6 @@ #include #include -#include #include #include "common.h" @@ -29,6 +28,7 @@ #include "icon.h" #include "modules.h" #include "main.h" +#include "log.h" #define ICON_PRIORITY INDICATOR_PRIORITY_NOTI_MIN #define MODULE_NAME "more_notify" @@ -39,7 +39,7 @@ static int wake_up_cb(void *data); static int updated_while_lcd_off = 0; -static int bShow = 0; +static bool bShow = 0; icon_s more_notify = { .name = MODULE_NAME, @@ -88,12 +88,11 @@ static void hide_image_icon_by_win(win_info* win) -static void _handle_more_notify_icon(win_info* win,int val) +static void _handle_more_notify_icon(win_info* win, bool val) { retif(win == NULL, , "Invalid parameter!"); - if(bShow == val) - { + if(bShow == val) { return; } @@ -101,13 +100,10 @@ static void _handle_more_notify_icon(win_info* win,int val) DBG("val %d", val); - if(val==1) - { + if (val) { show_image_icon_by_win(win); DBG("_handle_more_notify_show"); - } - else - { + } else { hide_image_icon_by_win(win); DBG("_handle_more_notify_hide"); } @@ -118,23 +114,24 @@ static void _handle_more_notify_icon(win_info* win,int val) static void indicator_more_notify_change_cb(const char *key, void *data) { struct appdata *ad = (struct appdata *)(more_notify.ad); - int val = 0; + bool val = 0; retif(data == NULL, , "Invalid parameter!"); DBG("indicator_more_notify_change_cb"); win_info* win = NULL; - preference_get_int(key, &val); - - if (strcmp(key, VCONFKEY_INDICATOR_SHOW_MORE_NOTI) == 0) { + if (strcmp(key, INDICATOR_MORE_NOTI) == 0) { win = &(ad->win); } else { SECURE_ERR("invalid val %s",key); return; } - _handle_more_notify_icon(win,val); + int err = preference_get_boolean(key, &val); + retm_if(err != PREFERENCE_ERROR_NONE, "preference_get_boolean failed: %s", get_error_message(err)); + + _handle_more_notify_icon(win, val); return; } @@ -161,7 +158,7 @@ static int register_more_notify_module(void *data) set_app_state(data); - preference_set_changed_cb(VCONFKEY_INDICATOR_SHOW_MORE_NOTI, indicator_more_notify_change_cb, data); + preference_set_changed_cb(INDICATOR_MORE_NOTI, indicator_more_notify_change_cb, data); return OK; } @@ -170,7 +167,7 @@ static int register_more_notify_module(void *data) static int unregister_more_notify_module(void) { - preference_unset_changed_cb(VCONFKEY_INDICATOR_SHOW_MORE_NOTI); + preference_unset_changed_cb(INDICATOR_MORE_NOTI); return OK; } -- 2.7.4