Fixed: Coding rule issues.
[apps/native/ug-wifi-direct.git] / ug-wifidirect / src / wfd_ug.c
index c97de17..0258c52 100644 (file)
@@ -57,11 +57,11 @@ static void __wfd_main_vconf_change_cb(keynode_t *key, void *data)
 
        char *vconf_name = vconf_keynode_get_name(key);
 
-       if (!g_strcmp0(vconf_name, VCONFKEY_SETAPPL_DEVICE_NAME_STR)){
+       if (!g_strcmp0(vconf_name, VCONFKEY_SETAPPL_DEVICE_NAME_STR)) {
                char *name_value = NULL;
                name_value = vconf_get_str(VCONFKEY_SETAPPL_DEVICE_NAME_STR);
-               WFD_RET_IF (!name_value, "Get string is failed");
-               DBG(LOG_INFO,"name : %s", name_value);
+               WFD_RET_IF(!name_value, "Get string is failed");
+               DBG(LOG_INFO, "name : %s", name_value);
 
                if (ugd->device_name_item && g_strcmp0(ugd->dev_name, name_value))
                        wfd_ug_view_refresh_glitem(ugd->device_name_item);
@@ -95,9 +95,8 @@ static void _wifi_on_state_cb(keynode_t *key, void *data)
                }
                if (ugd->wfd_status <= WIFI_DIRECT_STATE_DEACTIVATING) {
                        DBG(LOG_INFO, "Activate WiFi Direct...");
-                       if (FALSE != wfd_client_switch_on(ugd)) {
+                       if (FALSE != wfd_client_switch_on(ugd))
                                DBG(LOG_ERROR, "Failed to Activate WiFi Direct");
-                       }
                }
        }
 }
@@ -123,9 +122,9 @@ static void __wfd_hotspot_mode_vconf_change_cb(keynode_t *key, void *data)
        DBG(LOG_INFO, "__wfd_hotspot_mode_vconf_change_cb mode %d", hotspot_mode);
 
        if (VCONFKEY_MOBILE_HOTSPOT_MODE_NONE == hotspot_mode) {
-               if (NULL != ugd->act_popup) {
+               if (NULL != ugd->act_popup)
                        evas_object_del(ugd->act_popup);
-               }
+
 #ifdef WFD_ON_OFF_GENLIST
                wfd_ug_refresh_on_off_check(ugd);
 #endif
@@ -289,9 +288,8 @@ static void _wfd_init_cb(void *data, Evas *evas, Evas_Object *obj, void *event_i
        evas_object_event_callback_del(ugd->base, EVAS_CALLBACK_SHOW, _wfd_init_cb);
 
        res = launch_wifi_direct_manager(ugd);
-       if (res != 0) {
+       if (res != 0)
                DBG(LOG_ERROR, "Failed to launch wifi direct manager\n");
-       }
 
        __FUNC_EXIT__;
        return;
@@ -305,9 +303,8 @@ static void *on_create(ui_gadget_h ug, enum ug_mode mode, app_control_h control,
        int wfd_status = -1;
        int ret;
 
-       if (!ug || !priv) {
+       if (!ug || !priv)
                return NULL;
-       }
 
        ugd = priv;
        ugd->ug = ug;
@@ -315,9 +312,8 @@ static void *on_create(ui_gadget_h ug, enum ug_mode mode, app_control_h control,
        bindtextdomain(PACKAGE, LOCALEDIR);
 
        ugd->win = ug_get_window();
-       if (!ugd->win) {
+       if (!ugd->win)
                return NULL;
-       }
 
        /* set rotation */
        if (elm_win_wm_rotation_supported_get(ugd->win)) {
@@ -353,7 +349,7 @@ static void *on_create(ui_gadget_h ug, enum ug_mode mode, app_control_h control,
                }
 
                ret = app_control_get_extra_data(control, "viewtype", &viewtype);
-               if(ret == APP_CONTROL_ERROR_NONE && viewtype) {
+               if (ret == APP_CONTROL_ERROR_NONE && viewtype) {
                        DBG(LOG_INFO, "viewtype: %s\n", viewtype);
                        ugd->view_type = strdup(viewtype);
                        WFD_IF_FREE_MEM(viewtype);
@@ -366,31 +362,31 @@ static void *on_create(ui_gadget_h ug, enum ug_mode mode, app_control_h control,
                ret = app_control_get_extra_data(control, "device_filter", &device_filter);
                if (ret == APP_CONTROL_ERROR_NONE && device_filter) {
                        DBG(LOG_INFO, "Device filter: %s", device_filter);
-                       if (0 == strncmp(device_filter, "computer", 8)) {
+                       if (0 == strncmp(device_filter, "computer", 8))
                                ugd->device_filter = WFD_DEVICE_TYPE_COMPUTER;
-                       } else if (0 == strncmp(device_filter, "input_device", 12)) {
+                       else if (0 == strncmp(device_filter, "input_device", 12))
                                ugd->device_filter = WFD_DEVICE_TYPE_INPUT_DEVICE;
-                       } else if (0 == strncmp(device_filter, "printer", 6)) {
+                       else if (0 == strncmp(device_filter, "printer", 6))
                                ugd->device_filter = WFD_DEVICE_TYPE_PRINTER;
-                       } else if (0 == strncmp(device_filter, "camera", 6)) {
+                       else if (0 == strncmp(device_filter, "camera", 6))
                                ugd->device_filter = WFD_DEVICE_TYPE_CAMERA;
-                       } else if (0 == strncmp(device_filter, "storage", 7)) {
+                       else if (0 == strncmp(device_filter, "storage", 7))
                                ugd->device_filter = WFD_DEVICE_TYPE_STORAGE;
-                       } else if (0 == strncmp(device_filter, "network_infra", 13)) {
+                       else if (0 == strncmp(device_filter, "network_infra", 13))
                                ugd->device_filter = WFD_DEVICE_TYPE_NW_INFRA;
-                       } else if (0 == strncmp(device_filter, "display", 7)) {
+                       else if (0 == strncmp(device_filter, "display", 7))
                                ugd->device_filter = WFD_DEVICE_TYPE_DISPLAYS;
-                       } else if (0 == strncmp(device_filter, "multimedia_device", 17)) {
+                       else if (0 == strncmp(device_filter, "multimedia_device", 17))
                                ugd->device_filter = WFD_DEVICE_TYPE_MM_DEVICES;
-                       } else if (0 == strncmp(device_filter, "game_device", 11)) {
+                       else if (0 == strncmp(device_filter, "game_device", 11))
                                ugd->device_filter = WFD_DEVICE_TYPE_GAME_DEVICES;
-                       } else if (0 == strncmp(device_filter, "telephone", 9)) {
+                       else if (0 == strncmp(device_filter, "telephone", 9))
                                ugd->device_filter = WFD_DEVICE_TYPE_TELEPHONE;
-                       } else if (0 == strncmp(device_filter, "audio", 5)) {
+                       else if (0 == strncmp(device_filter, "audio", 5))
                                ugd->device_filter = WFD_DEVICE_TYPE_AUDIO;
-                       } else {
+                       else
                                ugd->device_filter = WFD_DEVICE_TYPE_OTHER;
-                       }
+
                        WFD_IF_FREE_MEM(device_filter);
                }
 
@@ -401,11 +397,11 @@ static void *on_create(ui_gadget_h ug, enum ug_mode mode, app_control_h control,
                ret = app_control_get_extra_data(control, "auto_exit", &auto_exit);
                if (ret == APP_CONTROL_ERROR_NONE && auto_exit) {
                        DBG(LOG_INFO, "Auto exit: %s", auto_exit);
-                       if (0 == strncmp(auto_exit, "on", 2)) {
+                       if (0 == strncmp(auto_exit, "on", 2))
                                ugd->is_auto_exit = true;
-                       } else {
+                       else
                                ugd->is_auto_exit = false;
-                       }
+
                        WFD_IF_FREE_MEM(auto_exit);
                }
 
@@ -416,11 +412,11 @@ static void *on_create(ui_gadget_h ug, enum ug_mode mode, app_control_h control,
                ret = app_control_get_extra_data(control, "multi_connect", &multi_connect);
                if (ret == APP_CONTROL_ERROR_NONE && multi_connect) {
                        DBG(LOG_INFO, "Multi connection: %s", multi_connect);
-                       if (0 == strncmp(multi_connect, "off", 2)) {
+                       if (0 == strncmp(multi_connect, "off", 2))
                                ugd->is_multi_connect = false;
-                       } else {
+                       else
                                ugd->is_multi_connect = true;
-                       }
+
                        WFD_IF_FREE_MEM(multi_connect);
                }
 
@@ -437,11 +433,10 @@ static void *on_create(ui_gadget_h ug, enum ug_mode mode, app_control_h control,
                }
        }
 
-       if (mode == UG_MODE_FULLVIEW) {
+       if (mode == UG_MODE_FULLVIEW)
                ugd->base = _create_fullview(ugd->win, ugd);
-       } else {
+       else
                ugd->base = _create_frameview(ugd->win, ugd);
-       }
 
        if (ugd->base) {
                evas_object_event_callback_add(ugd->base, EVAS_CALLBACK_DEL, wfd_ug_layout_del_cb, ugd);
@@ -454,9 +449,8 @@ static void *on_create(ui_gadget_h ug, enum ug_mode mode, app_control_h control,
 
        /* check status of wifi-direct from vconf */
        wfd_status = wfd_get_vconf_status();
-       if (wfd_status < 0) {
+       if (wfd_status < 0)
                return NULL;
-       }
 
        /* draw UI */
        initialize_gen_item_class();
@@ -491,23 +485,19 @@ static void *on_create(ui_gadget_h ug, enum ug_mode mode, app_control_h control,
        }
        ret = vconf_notify_key_changed(VCONFKEY_SETAPPL_DEVICE_NAME_STR,
                        __wfd_main_vconf_change_cb, ugd);
-       if (ret) {
+       if (ret)
                DBG(LOG_ERROR, "Failed to set vconf notification callback(VCONFKEY_SETAPPL_DEVICE_NAME_STR)");
-       }
 
 #ifdef WIFI_STATE_CB
        ret = vconf_notify_key_changed(VCONFKEY_WIFI_STATE, _wifi_on_state_cb, ugd);
-       if (ret) {
+       if (ret)
                DBG(LOG_ERROR, "Failed to set vconf notification callback(VCONFKEY_WIFI_STATE)");
-
-       }
 #endif
 
        ret = vconf_notify_key_changed(VCONFKEY_MOBILE_HOTSPOT_MODE,
                __wfd_hotspot_mode_vconf_change_cb, ugd);
-       if (ret) {
+       if (ret)
                DBG(LOG_ERROR, "Failed to set vconf notification callback(MOBILE_HOTSPOT_MODE)");
-       }
 
        __FUNC_EXIT__;
        return ugd->base;
@@ -519,9 +509,8 @@ static void on_start(ui_gadget_h ug, app_control_h control, void *priv)
        struct ug_data *ugd;
        int res;
 
-       if (!ug || !priv) {
+       if (!ug || !priv)
                return;
-       }
 
        ugd = priv;
 
@@ -551,7 +540,7 @@ static void on_pause(ui_gadget_h ug, app_control_h control, void *priv)
        wfd_refresh_wifi_direct_state(ugd);
        DBG(LOG_INFO, "on pause, wfd status: %d\n", ugd->wfd_status);
 
-       if ((WIFI_DIRECT_STATE_DISCOVERING == ugd->wfd_status) &&
+       if ((WIFI_DIRECT_STATE_DISCOVERING == ugd->wfd_status) &&
                (WIFI_DIRECT_ERROR_NONE != wifi_direct_cancel_discovery())) {
                DBG(LOG_ERROR, "Failed to send cancel discovery state [%d]\n", ugd->wfd_status);
                __FUNC_EXIT__;
@@ -607,9 +596,8 @@ static void on_destroy(ui_gadget_h ug, app_control_h control, void *priv)
 
        /* DeInit WiFi Direct */
        ret = deinit_wfd_client(ugd);
-       if (ret) {
-               DBG(LOG_ERROR,"Failed to DeInit WiFi Direct");
-       }
+       if (ret)
+               DBG(LOG_ERROR, "Failed to DeInit WiFi Direct");
 
        if (ugd->scan_toolbar) {
                wfd_ug_view_refresh_button(ugd->scan_toolbar,
@@ -618,22 +606,19 @@ static void on_destroy(ui_gadget_h ug, app_control_h control, void *priv)
 
        ret = vconf_ignore_key_changed(VCONFKEY_SETAPPL_DEVICE_NAME_STR,
                        __wfd_main_vconf_change_cb);
-       if (ret == -1) {
-               DBG(LOG_ERROR,"Failed to ignore vconf key callback\n");
-       }
+       if (ret == -1)
+               DBG(LOG_ERROR, "Failed to ignore vconf key callback\n");
 
 #ifdef WIFI_STATE_CB
        ret = vconf_ignore_key_changed(VCONFKEY_WIFI_STATE, _wifi_on_state_cb);
-       if (ret == -1) {
-               DBG(LOG_ERROR,"Failed to ignore vconf key callback\n");
-       }
+       if (ret == -1)
+               DBG(LOG_ERROR, "Failed to ignore vconf key callback\n");
 #endif
 
        ret = vconf_ignore_key_changed(VCONFKEY_MOBILE_HOTSPOT_MODE,
                        __wfd_hotspot_mode_vconf_change_cb);
-       if (ret == -1) {
-               DBG(LOG_ERROR,"Failed to ignore vconf key callback MOBILE_HOTSPOT_MODE\n");
-       }
+       if (ret == -1)
+               DBG(LOG_ERROR, "Failed to ignore vconf key callback MOBILE_HOTSPOT_MODE\n");
 
        wfd_ug_view_free_peers(ugd);
        WFD_IF_FREE_MEM(ugd->title);
@@ -669,7 +654,7 @@ static void on_message(ui_gadget_h ug, app_control_h msg, app_control_h control,
                DBG(LOG_DEBUG, "Msg from app: %s", app_msg);
 
                if (!strcmp(app_msg, "destroy")) {
-                       if(!ugd->rename_popup) {
+                       if (!ugd->rename_popup) {
                                DBG(LOG_INFO, "Destroying UG.");
                                wfd_ug_view_free_peers(ugd);
                                wfd_destroy_ug(ugd);