[Feature] [A01-11.1. Power saving mode] Add flow to check status of all items when...
authorJing Yigang <yigang.jing@samsung.com>
Fri, 14 Sep 2012 07:53:15 +0000 (15:53 +0800)
committerJing Yigang <yigang.jing@samsung.com>
Fri, 14 Sep 2012 07:53:15 +0000 (15:53 +0800)
Change-Id: I87779e6119bf09a1a3090236086a20397d80b2d7

setting-powersaving/include/setting-powersaving.h
setting-powersaving/src/setting-powersaving-main.c

index 617e456..7e1b4d6 100755 (executable)
@@ -80,6 +80,8 @@
 #define KeyStr_SCREEN_VIB      "IDS_ST_BODY_TURN_OFF_HAPTIC_FEEDBACK"
 #define KeyStr_SCREEN_VIB_DSC  "IDS_ST_BODY_TURNING_OFF_HAPTIC_FEEDBACK_CAN_EXTEND_BATTERY_LIFE"
 
+#define SETTING_POWERSAVING_ALL_SUB_ITEMS_OFF "To turn on the Power saving mode. At least one item should be selected"
+
 typedef struct _SettingPowersavingUG SettingPowersavingUG;
 
 /**
index b3c43ce..5aad158 100755 (executable)
@@ -693,21 +693,81 @@ setting_powersaving_main_mouse_up_Gendial_list_cb(void *data, Evas_Object *obj,
        }
 }
 
+static void __setting_powersaving_main_popup_rsp_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       SETTING_TRACE_BEGIN;
+       setting_retm_if(data == NULL, "Data parameter is NULL");
+       SettingPowersavingUG *ad = (SettingPowersavingUG *) data;
+
+       if (obj) {
+               evas_object_del(obj);
+               obj = NULL;
+       }
+       ad->popup = NULL;
+
+       int ret = vconf_set_bool(VCONFKEY_SETAPPL_PWRSV_SYSMODE_STATUS, 0);
+       setting_retm_if(0 != ret, "Failed to set vconf value");
+}
+
 static void
 setting_powersaving_main_click_softkey_back_cb(void *data, Evas_Object *obj,
                                               void *event_info)
 {
        SETTING_TRACE_BEGIN;
        /* error check */
-       setting_retm_if(data == NULL,
-                       "[Setting > Powersaving] Data parameter is NULL");
-
+       setting_retm_if(data == NULL, "[Setting > Powersaving] Data parameter is NULL");
        SettingPowersavingUG *ad = (SettingPowersavingUG *) data;
 
-       /* Send destroy request */
-       ug_destroy_me(ad->ug);
-       SETTING_TRACE_END;
+       int ret = 0;
+       int value = 0;
+       ret = vconf_get_bool(VCONFKEY_SETAPPL_PWRSV_SYSMODE_STATUS, &value);
+       setting_retm_if(0 != ret, "Failed to get vconf value");
+
+       if (value) {
+               int sub_item_value = 0;
+
+               /* check VCONFKEY_SETAPPL_PWRSV_CUSTMODE_CPU */
+               ret = vconf_get_bool(VCONFKEY_SETAPPL_PWRSV_CUSTMODE_CPU, &sub_item_value);
+               setting_retm_if(0 != ret, "Failed to get vconf value");
+               if (sub_item_value) {
+                       ug_destroy_me(ad->ug);
+                       return;
+               }
+
+               /* check VCONFKEY_SETAPPL_PWRSV_CUSTMODE_DISPLAY */
+               ret = vconf_get_bool(VCONFKEY_SETAPPL_PWRSV_CUSTMODE_DISPLAY, &sub_item_value);
+               setting_retm_if(0 != ret, "Failed to get vconf value");
+               if (sub_item_value) {
+                       ug_destroy_me(ad->ug);
+                       return;
+               }
+
+               /* check VCONFKEY_SETAPPL_PWRSV_CUSTMODE_BG_COLOR */
+               ret = vconf_get_bool(VCONFKEY_SETAPPL_PWRSV_CUSTMODE_BG_COLOR, &sub_item_value);
+               setting_retm_if(0 != ret, "Failed to get vconf value");
+               if (sub_item_value) {
+                       ug_destroy_me(ad->ug);
+                       return;
+               }
+
+               /* check VCONFKEY_SETAPPL_PWRSV_CUSTMODE_SCREEN_VIB */
+               ret = vconf_get_bool(VCONFKEY_SETAPPL_PWRSV_CUSTMODE_SCREEN_VIB, &sub_item_value);
+               setting_retm_if(0 != ret, "Failed to get vconf value");
+               if (sub_item_value) {
+                       ug_destroy_me(ad->ug);
+                       return;
+               }
 
+               if (ad->popup) {
+                       evas_object_del(ad->popup);
+                       ad->popup = NULL;
+               }
+               ad->popup = setting_create_popup_without_btn(ad, ad->win_get, NULL, _(SETTING_POWERSAVING_ALL_SUB_ITEMS_OFF),
+                                    __setting_powersaving_main_popup_rsp_cb, POPUP_INTERVAL, TRUE, TRUE);
+       } else {
+               /* Send destroy request */
+               ug_destroy_me(ad->ug);
+       }
 }
 
 static void