char *vconf_mgr_get_string_value(const char *key);
int vconf_mgr_set_string_value(const char *key, const char *value);
-int vconf_mgr_get_int_value(const char *key, int *value);
-int vconf_mgr_set_int_value(const char *key, const int value);
+void vconf_mgr_get_proxy_method(int *value);
+int vconf_mgr_set_proxy_method(const int value);
#endif /* __VCONF_MGR_H__ */
#define IP_VALUE4 "value4"
static const char *VCONF_NETWORK_TYPE = "db/menu/network/network_type";
-static const char *VCONF_PROXY_METHOD = "db/menu/proxy/method";
static const char *VCONF_PROXY_IP = "db/menu/proxy/ip";
static const char *VCONF_PROXY_URL = "db/menu/proxy/url";
static int _get_proxy_method(struct _priv *priv)
{
int value;
- int ret;
char *str;
if (!priv) {
else
priv->net_type = TYPE_WIRELESS;
- value = 0;
- ret = vconf_mgr_get_int_value(VCONF_PROXY_METHOD, &value);
- if (ret != RET_SUCCESS) {
- _ERR("vconf_mgr_get_int_value() failed.");
- return RET_FAILED;
- }
-
- switch (value) {
- case 0:
- priv->method = METHOD_NONE;
- break;
- case 1:
- priv->method = METHOD_MAN;
- break;
- case 2:
- priv->method = METHOD_AUTO;
- break;
- default:
+ vconf_mgr_get_proxy_method(&value);
+ if (value < METHOD_NONE || value > METHOD_AUTO) {
+ _ERR("Unsupported method is returned from vconf");
return RET_FAILED;
}
+ priv->method = value;
_get_man_saved_value(priv->ip, VCONF_PROXY_IP);
*/
static int _save_to_vconf(struct _priv *priv)
{
+ int ret;
+
if (!priv) {
_ERR("The param is invalid.\n");
return RET_SUCCESS;
}
- vconf_mgr_set_int_value(VCONF_PROXY_METHOD, priv->method);
+ ret = vconf_mgr_set_proxy_method(priv->method);
+ if (ret != RET_SUCCESS)
+ return RET_FAILED;
switch (priv->method) {
case METHOD_NONE:
#include "vconf_mgr.h"
#include "i18n.h"
+static const char *VCONF_PROXY_METHOD = "db/menu/proxy/method";
+
/**
* Gets the string value from vconf.
*
}
/**
- * Gets the integer value from vconf.
+ * Gets the current proxy method value from vconf.
*
- * @param[in] key Vconf key
- * @param[out] value The value
- * @return RET_SUCCESS if the operation is successful; RET_FAILED if failed;
+ * @param[out]: value : 0 - none; 1 - manual; 2 - auto.
+ * @return void.
*/
-int vconf_mgr_get_int_value(const char *key, int *value)
+void vconf_mgr_get_proxy_method(int *value)
{
- int ret;
-
- if (!key || !value) {
- _ERR("the param is invalid.");
- return RET_FAILED;
- }
-
- ret = vconf_get_int(key, value);
- if (ret != 0) {
- _ERR("vconf get int failed");
- return RET_FAILED;
+ if (vconf_get_int(VCONF_PROXY_METHOD, value) != 0) {
+ /* failed to get value from vconf, assume none set */
+ *value = METHOD_NONE;
}
-
- return RET_SUCCESS;
}
/**
- * Sets the integer value to vconf.
+ * Sets the user selected proxy method value to vconf.
*
- * @param[in] key Vconf key
* @param[in] value The value
* @return RET_SUCCESS if the operation is successful; RET_FAILED if failed;
*/
-int vconf_mgr_set_int_value(const char *key, const int value)
+int vconf_mgr_set_proxy_method(const int value)
{
- int ret;
-
- if (!key) {
- _ERR("the param is invalid.");
- return RET_FAILED;
- }
-
- ret = vconf_set_int(key, value);
- if (ret != 0) {
- _ERR("vconf set int failed.");
+ if (vconf_set_int(VCONF_PROXY_METHOD, value) != 0) {
+ _ERR("Failed to set user selected proxy method to vconf");
return RET_FAILED;
}