diff options
author | Yunjin Lee <yunjin-.lee@samsung.com> | 2016-04-18 13:27:50 +0900 |
---|---|---|
committer | Yunjin Lee <yunjin-.lee@samsung.com> | 2016-04-18 13:40:04 +0900 |
commit | fe83a9bfa5b925556577564566854c434f78a036 (patch) | |
tree | ab4b5b459aafa404aee34aaa2c761f1a2833868f | |
parent | 89527040606fc486ee5cfb09d349ea139e680b6d (diff) | |
download | privacy-setting-fe83a9bfa5b925556577564566854c434f78a036.tar.gz privacy-setting-fe83a9bfa5b925556577564566854c434f78a036.tar.bz2 privacy-setting-fe83a9bfa5b925556577564566854c434f78a036.zip |
Fix warning and apply coding rulesubmit/tizen/20160418.054851accepted/tizen/mobile/20160418.124151
Change-Id: I3ce2296d820be4919071dfd76f18e72dd0c79498
Signed-off-by: Yunjin Lee <yunjin-.lee@samsung.com>
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | common/include/common_utils.h | 16 | ||||
-rw-r--r-- | common/src/common_utils.c | 30 | ||||
-rw-r--r-- | ug/src/privacy_list_view.c | 33 | ||||
-rw-r--r-- | ug/src/privacy_package_list_view.c | 155 |
5 files changed, 119 insertions, 117 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b7cc9c..92b3245 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,8 @@ SET(CMAKE_C_FLAGS_RELEASE "-O2 -Wall") SET(CMAKE_C_FLAGS_DEBUG "-O0 -Wall -g -ggdb") SET(CMAKE_C_FLAGS_CCOV "-O2 -Wall --coverage") +ADD_DEFINITIONS("-Werror") + SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(LIBDIR "${PREFIX}/lib") diff --git a/common/include/common_utils.h b/common/include/common_utils.h index 069eb3f..e54cf23 100644 --- a/common/include/common_utils.h +++ b/common/include/common_utils.h @@ -38,18 +38,18 @@ extern "C" { #endif #define return_if(condition, expr, returnValue, ...) \ - if (condition) { \ + if (condition) { \ LOGE(__VA_ARGS__); \ expr; \ return returnValue; \ } #define lreturn_if(condition, expr, returnValue, ...) \ - if (condition) { \ - LOGD(__VA_ARGS__); \ - expr; \ - return returnValue; \ - } + if (condition) { \ + LOGD(__VA_ARGS__); \ + expr; \ + return returnValue; \ + } #define log_if(condition, level, ...) \ if (condition) { \ @@ -62,10 +62,10 @@ extern "C" { Evas_Object *common_genlist_add(Evas_Object *parent); -Evas_Object *common_back_btn(struct ug_data_s *ugd); +Evas_Object *common_back_btn_add(struct ug_data_s *ugd); #ifdef _cplusplus } #endif -#endif // __UG_SETTING_PRIVACY_COMMON_UTILS_H_ +#endif /* __UG_SETTING_PRIVACY_COMMON_UTILS_H_ */ diff --git a/common/src/common_utils.c b/common/src/common_utils.c index b9fe562..7656d41 100644 --- a/common/src/common_utils.c +++ b/common/src/common_utils.c @@ -1,22 +1,22 @@ /** * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ /* - * @file common_utils.c - * @author Yunjin Lee (yunjin-.lee@samsung.com) - * @version 1.0 + * @file common_utils.c + * @author Yunjin Lee (yunjin-.lee@samsung.com) + * @version 1.0 * @brief */ @@ -42,9 +42,9 @@ Evas_Object *common_genlist_add(Evas_Object *parent) static void back_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) { - struct ug_data_s *ugd = (struct ug_data_s *)data; - return_if(!ugd, , , "ugd is null"); - elm_naviframe_item_pop(ugd->nf); + struct ug_data_s *ugd = (struct ug_data_s *)data; + return_if(!ugd, , , "ugd is null"); + elm_naviframe_item_pop(ugd->nf); } Evas_Object *common_back_btn_add(struct ug_data_s *ad) diff --git a/ug/src/privacy_list_view.c b/ug/src/privacy_list_view.c index 3d47885..14efde5 100644 --- a/ug/src/privacy_list_view.c +++ b/ug/src/privacy_list_view.c @@ -1,22 +1,22 @@ /** * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ /* * @file privacy_list_view.c - * @author Yunjin Lee (yunjin-.lee@samsung.com) - * @version 1.0 + * @author Yunjin Lee (yunjin-.lee@samsung.com) + * @version 1.0 * @brief */ @@ -53,15 +53,15 @@ static void gl_del_cb(void *data, Evas_Object *obj) static void privacy_selected_cb(void *data, Evas_Object *obj, void *event_info) { /* Get selected privacy */ - Elm_Object_Item *ei = event_info; - item_data_s *selected_id = elm_object_item_data_get(ei); + Elm_Object_Item *ei = event_info; + item_data_s *selected_id = elm_object_item_data_get(ei); LOGD("%s is selected, index = %d", selected_id->title, selected_id->index); /* Unhighlight selected item */ elm_genlist_item_selected_set(ei, EINA_FALSE); - + struct ug_data_s *ugd = (struct ug_data_s *)data; - return_if(ugd == NULL, , , "ugd is null"); + return_if(ugd == NULL, , , "ugd is null"); create_privacy_package_list_view(ugd, selected_id); } @@ -74,8 +74,6 @@ void create_privacy_list_view(struct ug_data_s *ugd) evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL); - //evas_object_smart_callback_add(genlist, "selected", privacy_selected_cb, NULL); - Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new(); itc->item_style = "default"; itc->func.text_get = gl_text_get_cb; @@ -87,6 +85,7 @@ void create_privacy_list_view(struct ug_data_s *ugd) id->index = i; id->title = (char*)g_list_nth_data(ugd->privacy_list, i); it = elm_genlist_item_append(genlist, itc, id, NULL, ELM_GENLIST_ITEM_NONE, privacy_selected_cb, ugd); + log_if(it == NULL, 1, "Error in elm_genlist_item_append"); } elm_genlist_item_class_free(itc); evas_object_show(genlist); diff --git a/ug/src/privacy_package_list_view.c b/ug/src/privacy_package_list_view.c index 407948b..716714e 100644 --- a/ug/src/privacy_package_list_view.c +++ b/ug/src/privacy_package_list_view.c @@ -1,22 +1,22 @@ /** * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ /* * @file privacy_package_list_view.c - * @author Yunjin Lee (yunjin-.lee@samsung.com) - * @version 1.0 + * @author Yunjin Lee (yunjin-.lee@samsung.com) + * @version 1.0 * @brief */ @@ -28,10 +28,10 @@ static void gl_del_cb(void *data, Evas_Object *obj) { - /* Unrealized callback can be called after this. */ - /* Accessing item_data_s can be dangerous on unrealized callback. */ - item_data_s *id = data; - free(id); + /* Unrealized callback can be called after this. */ + /* Accessing item_data_s can be dangerous on unrealized callback. */ + item_data_s *id = data; + free(id); } static void privacy_package_selected_cb(void *data, Evas_Object *obj, void *event_info) @@ -39,89 +39,90 @@ static void privacy_package_selected_cb(void *data, Evas_Object *obj, void *even Elm_Object_Item *ei = event_info; /* Unhighlight selected item */ elm_genlist_item_selected_set(ei, EINA_FALSE); - /* TBD? Add package's privacy info. - For example, package's selected privacy related privilege list. - Or remove. */ + /* TBD? Add package's privacy info. + For example, package's selected privacy related privilege list. + Or remove. */ } static char* gl_text_get_cb(void *data, Evas_Object *obj, const char *part) { - item_data_s *id = data; - lreturn_if(!strcmp(part, "elm.text"), , strdup(id->title), "privacy-package item = %s", id->title); - return "FAIL"; + item_data_s *id = data; + lreturn_if(!strcmp(part, "elm.text"), , strdup(id->title), "privacy-package item = %s", id->title); + return "FAIL"; } static void privacy_package_check_changed_cb(void *data, Evas_Object *obj, void *event_info) { - /* TBD: Add privacy on&off function */ - item_data_s *id = (item_data_s*)data; - if (id->status) - id->status = false; - else - id->status = true; - Eina_Bool status = id->status; - char* selected = (char*)id->title; - if (status) - LOGD("%s is on", selected); - else if (!status) - LOGD("%s is off", selected); + /* TBD: Add privacy on&off function */ + item_data_s *id = (item_data_s*)data; + if (id->status) + id->status = false; + else + id->status = true; + Eina_Bool status = id->status; + char* selected = (char*)id->title; + if (status) + LOGD("%s is on", selected); + else if (!status) + LOGD("%s is off", selected); } static Evas_Object* gl_content_get_cb(void *data, Evas_Object *obj, const char *part) { - Evas_Object *check; - item_data_s *id = (item_data_s*)data; - Eina_Bool status = id->status; + Evas_Object *check; + item_data_s *id = (item_data_s*)data; + Eina_Bool status = id->status; - if (strcmp(part, "elm.swallow.end")) - return NULL; + if (strcmp(part, "elm.swallow.end")) + return NULL; - check = elm_check_add(obj); + check = elm_check_add(obj); - elm_object_style_set(check, "on&off"); - elm_check_state_set(check, status); - evas_object_repeat_events_set(check, EINA_FALSE); - evas_object_propagate_events_set(check, EINA_FALSE); - evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(check, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_smart_callback_add(check, "changed", privacy_package_check_changed_cb, data); - evas_object_show(check); + elm_object_style_set(check, "on&off"); + elm_check_state_set(check, status); + evas_object_repeat_events_set(check, EINA_FALSE); + evas_object_propagate_events_set(check, EINA_FALSE); + evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(check, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_smart_callback_add(check, "changed", privacy_package_check_changed_cb, data); + evas_object_show(check); - return check; + return check; } void create_privacy_package_list_view(struct ug_data_s* ugd, item_data_s *selected_id) { - Elm_Object_Item *it = NULL; /* Add genlist */ - Evas_Object *genlist = common_genlist_add(ugd->nf); + Evas_Object *genlist = common_genlist_add(ugd->nf); - evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL); - /* Set itc */ - Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new(); - itc->item_style = "default"; - itc->func.content_get = gl_content_get_cb; - itc->func.text_get = gl_text_get_cb; - itc->func.del = gl_del_cb; + /* Set itc */ + Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new(); + itc->item_style = "default"; + itc->func.content_get = gl_content_get_cb; + itc->func.text_get = gl_text_get_cb; + itc->func.del = gl_del_cb; - /* Append privacy related package as genlist item */ - /* TBD : Data should be replaced by privacy related package list */ - const char* items[] = {"one","two","three","four","five","six","seven","eight","nine","ten","eleven"}; - int i = 0; - for (i = 0; i < 10; ++i) { - item_data_s *id = calloc(sizeof(item_data_s), 1); - id->index = i; - char* temp[256]; - snprintf(temp, sizeof(temp), "%s%s", selected_id->title, items[i]); - id->title = strdup(temp); - //id->status = ; - it = elm_genlist_item_append(genlist, itc, id, NULL, ELM_GENLIST_ITEM_NONE, privacy_package_selected_cb, id); - } - elm_genlist_item_class_free(itc); - evas_object_show(genlist); + /* Append privacy related package as genlist item */ + /* TBD : Data should be replaced by privacy related package list */ + const char* items[] = {"one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven"}; + int i = 0; + Elm_Object_Item *it = NULL; + for (i = 0; i < 10; ++i) { + item_data_s *id = calloc(sizeof(item_data_s), 1); + id->index = i; + char temp[256]; + snprintf(temp, sizeof(temp), "%s%s", selected_id->title, items[i]); + id->title = strdup(temp); + /* id->status = ; */ + it = elm_genlist_item_append(genlist, itc, id, NULL, ELM_GENLIST_ITEM_NONE, privacy_package_selected_cb, id); + log_if(it == NULL, 1, "Error in elm_genlist_item_append"); + } + elm_genlist_item_class_free(itc); + evas_object_show(genlist); - /* Push naviframe item */ - /* Change "Package List" to proper DID : use dgettext() */ - Elm_Object_Item *nf_it = elm_naviframe_item_push(ugd->nf, "Package List", common_back_btn_add(ugd), NULL, genlist, NULL); - elm_object_item_domain_text_translatable_set(nf_it, PACKAGE, EINA_TRUE); + /* Push naviframe item */ + /* Change "Package List" to proper DID : use dgettext() */ + Elm_Object_Item *nf_it = elm_naviframe_item_push(ugd->nf, "Package List", common_back_btn_add(ugd), NULL, genlist, NULL); + elm_object_item_domain_text_translatable_set(nf_it, PACKAGE, EINA_TRUE); } |