diff options
author | Shuhrat Dehkanov <sh.dehkanov@samsung.com> | 2015-05-29 00:46:42 +0900 |
---|---|---|
committer | Shuhrat Dehkanov <sh.dehkanov@samsung.com> | 2015-06-01 13:58:54 +0900 |
commit | 589806e80055f29891b56aaae57ae51d2f1cabb1 (patch) | |
tree | 1f7b31fa9bcde2e8e1f738274e38d4af3e2ca769 /src | |
parent | 16e3eac24aa71aec221edf5d630bdae58d0581fe (diff) | |
download | settings-589806e80055f29891b56aaae57ae51d2f1cabb1.tar.gz settings-589806e80055f29891b56aaae57ae51d2f1cabb1.tar.bz2 settings-589806e80055f29891b56aaae57ae51d2f1cabb1.zip |
Disable channel lock menu if passcode has not been setup yet
Change-Id: Iaea5a3dbddeddc5cbb697df44731345503fe641d
Diffstat (limited to 'src')
-rw-r--r-- | src/settings_provider.c | 2 | ||||
-rw-r--r-- | src/view_maincatalog.c | 15 | ||||
-rw-r--r-- | src/view_need_pwd.c | 5 |
3 files changed, 19 insertions, 3 deletions
diff --git a/src/settings_provider.c b/src/settings_provider.c index e28a064..b61d070 100644 --- a/src/settings_provider.c +++ b/src/settings_provider.c @@ -578,6 +578,8 @@ static int _get_string(const char *key, char **val) break; case SYSTEM_PASSCODE: *val = vconf_get_str(KEY_CHANGE_PASSCODE); + if (*val == NULL) + r = -1; break; default: break; diff --git a/src/view_maincatalog.c b/src/view_maincatalog.c index b2cfe58..4112ba6 100644 --- a/src/view_maincatalog.c +++ b/src/view_maincatalog.c @@ -45,6 +45,9 @@ #define ENABLED "enabled" #define SIG_CLICKED "clicked" +#define KEY_PASSCODE "settings/system/change_passcode" +#define ITEM_CHANNEL_LOCK_ID "channel-lock" + enum focused_state { FOCUS_MAIN_ITEM = 1, FOCUS_SUB_ITEM @@ -1096,7 +1099,7 @@ static int _draw_subitems(struct _view_data *data, const char *name) int cnt; Eina_Array_Iterator a; unsigned int i; - const char *style, *status; + const char *id, *passcode, *style, *status; Eina_Array *enabled; if (!data || !name || !data->base) { @@ -1173,7 +1176,15 @@ static int _draw_subitems(struct _view_data *data, const char *name) evas_object_data_set(btn, SUBITEM_DATA_ID, item); - status = settingitem_get_status(item); + id = settingitem_get_id(item); + if (id && !strncmp(id, ITEM_CHANNEL_LOCK_ID, strlen(id)) + && (provider_get_passcode(KEY_PASSCODE, &passcode) == -1)) { + /*Disable channel lock menu if passcode has not been setup yet*/ + status = DISABLED; + } else { + status = settingitem_get_status(item); + } + if (status && !strncmp(status, DISABLED, strlen(status))) { elm_object_disabled_set(btn, EINA_TRUE); evas_object_freeze_events_set(btn, EINA_TRUE); diff --git a/src/view_need_pwd.c b/src/view_need_pwd.c index b1357ac..633bf61 100644 --- a/src/view_need_pwd.c +++ b/src/view_need_pwd.c @@ -221,7 +221,10 @@ static int _check_passcode(struct _chnllock_data *data) return 0; passcode = NULL; - provider_get_passcode(KEY_PASSCODE, &passcode); + if (provider_get_passcode(KEY_PASSCODE, &passcode) == -1) { + _DBG("Passcode has not been setup yet"); + return 1; + } if (strncmp(data->passcode, passcode, strlen(passcode))) { free(passcode); |