From: Jiwoong Im Date: Wed, 9 Dec 2015 05:45:09 +0000 (+0900) Subject: Apply tizen coding rules X-Git-Tag: accepted/tizen/mobile/20151217.023654~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F45%2F53745%2F1;p=platform%2Fcore%2Fappfw%2Fui-gadget-1.git Apply tizen coding rules Change-Id: I2169875f3d6252c2b992194fd2ed1ad20079a601 Signed-off-by: Jiwoong Im --- diff --git a/client/ug-client.c b/client/ug-client.c index 3e7f36d..9081c51 100644 --- a/client/ug-client.c +++ b/client/ug-client.c @@ -40,7 +40,7 @@ #undef LOG_TAG #endif -#define PATH_UG_LAUNCHER tzplatform_mkpath(TZ_SYS_BIN,"ug-launcher") +#define PATH_UG_LAUNCHER tzplatform_mkpath(TZ_SYS_BIN, "ug-launcher") #define LOG_TAG "UI_GADGET_CLIENT" @@ -79,22 +79,22 @@ static int ug_send_rotate_event(int angle) { int ret = -1; LOGD("ug_send_rotate_event angle : %d", angle); - switch(angle) { - case 0 : - ret = ug_send_event(UG_EVENT_ROTATE_PORTRAIT); - break; - case 90 : - ret = ug_send_event(UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN); - break; - case 180 : - ret = ug_send_event(UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN); - break; - case 270 : - ret = ug_send_event(UG_EVENT_ROTATE_LANDSCAPE); - break; - default : - LOGW("wrong angle(%d) for send rotate event",angle); - break; + switch (angle) { + case 0: + ret = ug_send_event(UG_EVENT_ROTATE_PORTRAIT); + break; + case 90: + ret = ug_send_event(UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN); + break; + case 180: + ret = ug_send_event(UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN); + break; + case 270: + ret = ug_send_event(UG_EVENT_ROTATE_LANDSCAPE); + break; + default: + LOGW("wrong angle(%d) for send rotate event", angle); + break; } return ret; @@ -106,7 +106,7 @@ static void rotate(void *data, Evas_Object *obj, void *event) struct appdata *ad = data; changed_angle = elm_win_rotation_get((const Evas_Object *)obj); - if(changed_angle == -1) { + if (changed_angle == -1) { LOGE("elm_win_rotation_get error"); return; } @@ -114,9 +114,8 @@ static void rotate(void *data, Evas_Object *obj, void *event) LOGD("rotate call back : changed angle(%d) / current angle(%d)", changed_angle, ad->rotate); - if(ad->rotate != changed_angle) { + if (ad->rotate != changed_angle) ug_send_rotate_event(changed_angle); - } ad->rotate = changed_angle; @@ -165,8 +164,8 @@ void _ug_client_result_cb(ui_gadget_h ug, app_control_h reply, void *priv) if (!ug || !priv) return; - ret = app_control_get_extra_data (reply, UG_SERVICE_DATA_RESULT, &value); - if((ret == APP_CONTROL_ERROR_NONE) && (value)) { + ret = app_control_get_extra_data(reply, UG_SERVICE_DATA_RESULT, &value); + if ((ret == APP_CONTROL_ERROR_NONE) && (value)) { result = atoi(value); LOGD("reply result is %d", result); } else { @@ -223,7 +222,7 @@ static Evas_Object *create_win(const char *name) elm_win_conformant_set(eo, EINA_TRUE); evas_object_smart_callback_add(eo, "delete,request", win_del, NULL); - elm_win_indicator_mode_set(eo,ELM_WIN_INDICATOR_SHOW); + elm_win_indicator_mode_set(eo, ELM_WIN_INDICATOR_SHOW); } return eo; @@ -263,7 +262,7 @@ static int lang_changed(void *event_info, void *data) char* lang = NULL; lang = vconf_get_str(VCONFKEY_LANGSET); - if(lang) { + if (lang) { LOGD("lang : %s", lang); elm_language_set((const char*)lang); free(lang); @@ -321,14 +320,14 @@ static int app_create(void *data) int angle = -1; angle = elm_win_rotation_get((const Evas_Object *)win); LOGE("rotate : %d", angle); - if(angle != -1) { + if (angle != -1) { ug_send_rotate_event(angle); ad->rotate = angle; } else { LOGE("elm win rotation get error"); } /* - if(elm_win_wm_rotation_supported_get(win)) { + if (elm_win_wm_rotation_supported_get(win)) { int rots[4] = { 0, 90, 180, 270 }; elm_win_wm_rotation_available_rotations_set(win, (const int*)&rots, 4); } else { @@ -349,7 +348,7 @@ static void _ug_client_home_screen_top_cb(void *data) { struct appdata *ad = data; - if((!ad->is_transient) && (home_screen_pid)) { + if ((!ad->is_transient) && (home_screen_pid)) { LOGW("home key pressed. window is not transient. ug client will be terminated"); elm_exit(); } @@ -400,7 +399,7 @@ _ug_client_dbus_signal_filter(DBusConnection *conn, DBusMessage *message, home_screen_pid = home_pid_by_dbus; - if(is_app_pause) { + if (is_app_pause) { LOGD("home_launch signal under app_pause.\ if home screen is top, app will be terminated"); _ug_client_home_screen_top_cb(user_data); @@ -461,7 +460,7 @@ static void _ug_client_dbus_signal_handler_fini(void *data) if (!ug_dbus_signal_handler_initialized) return; - if(!dbus_connection_get_is_connected(bus)) { + if (!dbus_connection_get_is_connected(bus)) { LOGD("dbus connection(%p) is not connected", bus); goto func_out; } @@ -484,7 +483,7 @@ static void _ug_client_dbus_signal_handler_fini(void *data) LOGD("ug dbus signal finialized"); -func_out : +func_out: ug_dbus_signal_handler_initialized = 0; bus = NULL; @@ -515,9 +514,8 @@ static int app_terminate(void *data) app_control_destroy(ad->request); - if (ad->name) { + if (ad->name) free(ad->name); - } LOGD("app_terminate end"); @@ -561,9 +559,8 @@ static int app_reset(bundle *b, void *data) if (ret) { LOGD("fail to request transient app: return value(%d)", ret); - if(_ug_client_dbus_listen_signal(data) < 0) { + if (_ug_client_dbus_listen_signal(data) < 0) LOGW("home screen dbus register error"); - } } else { /* check home screen raise */ ad->is_transient = 1; @@ -579,7 +576,7 @@ static int app_reset(bundle *b, void *data) else app_control_create_event(b, &app_control); - if(app_control) { + if (app_control) { app_control_clone(&ad->request, app_control); app_control_destroy(app_control); } @@ -668,7 +665,7 @@ int main(int argc, char *argv[]) prt_usage(argv[0]); return -1; } - argc = 1; // remove appsvc bundle + argc = 1; /* remove appsvc bundle */ } else { /* ug-client */ char *name = NULL; name = strrchr(argv[0], '/'); diff --git a/src/manager.c b/src/manager.c index 150a6c6..409082d 100644 --- a/src/manager.c +++ b/src/manager.c @@ -95,9 +95,8 @@ static int ug_relation_del(ui_gadget_h ug) return -1; } - if(p->children) { + if (p->children) p->children = g_slist_remove(p->children, ug); - } if (ug->children) { g_slist_free(ug->children); @@ -156,9 +155,8 @@ static int __ug_x_get_window_property(Display *dpy, Window win, Atom atom, else { if (num_ret < len) len = num_ret; - for (i = 0; i < len; i++) { + for (i = 0; i < len; i++) val[i] = ((unsigned long *)prop_ret)[i]; - } num = len; } @@ -204,21 +202,21 @@ static enum ug_event __ug_x_rotation_get(Display *dpy, Window win) func_ret = UG_EVENT_ROTATE_PORTRAIT; else { switch (rotation) { - case 0: - func_ret = UG_EVENT_ROTATE_PORTRAIT; - break; - case 90: - func_ret = UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN; - break; - case 180: - func_ret = UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN; - break; - case 270: - func_ret = UG_EVENT_ROTATE_LANDSCAPE; - break; - default: - func_ret = UG_EVENT_ROTATE_PORTRAIT; - break; + case 0: + func_ret = UG_EVENT_ROTATE_PORTRAIT; + break; + case 90: + func_ret = UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN; + break; + case 180: + func_ret = UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN; + break; + case 270: + func_ret = UG_EVENT_ROTATE_LANDSCAPE; + break; + default: + func_ret = UG_EVENT_ROTATE_PORTRAIT; + break; } } @@ -258,7 +256,7 @@ static void ugman_tree_dump(ui_gadget_h ug) _DBG("[%d] %s [%c] (mem : %s) (ug : %p) (PARENT: %s)", lv, c && c->name ? c->name : "NO CHILD INFO FIXIT!!!", - c && c->mode == UG_MODE_FULLVIEW ? 'F' : 'f', + c && c->mode == UG_MODE_FULLVIEW ? 'F' : 'f', c->module->addr, c, name); ugman_tree_dump(c); child = g_slist_next(child); @@ -393,7 +391,7 @@ static int ugman_indicator_overlap_update(enum ug_option opt) return -1; } - if(GET_OPT_OVERLAP_VAL(opt)) { + if (GET_OPT_OVERLAP_VAL(opt)) { _DBG("update overlap indicator / opt(%d)", opt); elm_object_signal_emit(ug_man.conform, "elm,state,indicator,overlap", ""); } else { @@ -466,20 +464,20 @@ static int ugman_ug_destroy(void *data) _DBG("ug(%p) state(%d)", ug, ug->state); switch (ug->state) { - case UG_STATE_CREATED: - case UG_STATE_RUNNING: - case UG_STATE_STOPPED: - case UG_STATE_DESTROYING: - case UG_STATE_PENDING_DESTROY: - break; - default: - _WRN("ug(%p) state is already destroyed", ug); - goto end; + case UG_STATE_CREATED: + case UG_STATE_RUNNING: + case UG_STATE_STOPPED: + case UG_STATE_DESTROYING: + case UG_STATE_PENDING_DESTROY: + break; + default: + _WRN("ug(%p) state is already destroyed", ug); + goto end; } ug->state = UG_STATE_DESTROYED; - if((ug != ug_man.root) && (ug->layout) && + if ((ug != ug_man.root) && (ug->layout) && (ug->mode == UG_MODE_FULLVIEW) && (ug->layout_state != UG_LAYOUT_DESTROY)) { /* ug_destroy_all case */ @@ -506,8 +504,8 @@ static int ugman_ug_destroy(void *data) cbs->end_cb(ug, cbs->priv); } - if((ug->parent) && (ug->parent->state == UG_STATE_PENDING_DESTROY)) { - if((ug->parent->children) && (g_slist_length(ug->parent->children) == 1)) { + if ((ug->parent) && (ug->parent->state == UG_STATE_PENDING_DESTROY)) { + if ((ug->parent->children) && (g_slist_length(ug->parent->children) == 1)) { _WRN("pended parent ug(%p) destroy job is added to loop", ug->parent); ugman_idler_add((Idle_Cb)ugman_ug_destroy, ug->parent); } else { @@ -521,7 +519,7 @@ static int ugman_ug_destroy(void *data) if (ug->mode == UG_MODE_FULLVIEW) { if (ug_man.fv_top == ug) { ug_fvlist_del(ug); - if(!ug_man.destroy_all) + if (!ug_man.destroy_all) ugman_ug_getopt(ug_man.fv_top); } else { ug_fvlist_del(ug); @@ -582,7 +580,7 @@ static int ugman_ug_create(void *data) if (ug->mode == UG_MODE_FULLVIEW) { if (eng_ops && eng_ops->create) { ug_man.conform = eng_ops->create(ug_man.win, ug, ugman_ug_start); - if(!ug_man.conform) + if (!ug_man.conform) return -1; } } @@ -595,14 +593,14 @@ static int ugman_ug_create(void *data) ugman_indicator_update(ug->opt, UG_EVENT_NONE); } - if(ug_man.last_rotate_evt == UG_EVENT_NONE) { + if (ug_man.last_rotate_evt == UG_EVENT_NONE) { #ifndef UG_WAYLAND ug_man.last_rotate_evt = __ug_x_rotation_get(ug_man.disp, ug_man.win_id); #endif } ugman_ug_event(ug, ug_man.last_rotate_evt); - if(ug->mode == UG_MODE_FRAMEVIEW) + if (ug->mode == UG_MODE_FRAMEVIEW) ugman_ug_start(ug); ugman_tree_dump(ug_man.root); @@ -638,12 +636,12 @@ int ugman_ug_add(ui_gadget_h parent, ui_gadget_h ug) parent = ug_man.root; } else { switch (parent->state) { - case UG_STATE_DESTROYING: - case UG_STATE_PENDING_DESTROY: - case UG_STATE_DESTROYED: - _WRN("parent(%p) state(%d) error", parent, parent->state); - return -1; - default:; + case UG_STATE_DESTROYING: + case UG_STATE_PENDING_DESTROY: + case UG_STATE_DESTROYED: + _WRN("parent(%p) state(%d) error", parent, parent->state); + return -1; + default:; } } @@ -775,17 +773,16 @@ int ugman_ug_del(ui_gadget_h ug) if (ug->children) { GSList *child; child = g_slist_last(ug->children); - if(ug_man.fv_top == (ui_gadget_h)child->data) { + if (ug_man.fv_top == (ui_gadget_h)child->data) { is_update = true; t = g_slist_nth_data(ug_man.fv_list, - g_slist_index(ug_man.fv_list,(gconstpointer)ug)+1); + g_slist_index(ug_man.fv_list, (gconstpointer)ug) + 1); } } } - if((is_update)&&(t)) { + if ((is_update) && (t)) ugman_ug_getopt(t); - } if (ug_man.engine) eng_ops = &ug_man.engine->ops; @@ -840,11 +837,10 @@ int ugman_ug_del_all(void) _DBG("ug_del_all. root(%p) walking(%d) ", ug_man.root, ug_man.walking); - if (ug_man.walking > 0) { + if (ug_man.walking > 0) ug_man.destroy_all = 1; - } else { + else ugman_ug_del_child(ug_man.root); - } return 0; } @@ -858,9 +854,8 @@ int ugman_init(Display *disp, Window xid, void *win, enum ug_option opt) ug_man.base_opt = opt; ug_man.last_rotate_evt = UG_EVENT_NONE; - if (!ug_man.is_initted) { + if (!ug_man.is_initted) ug_man.engine = ug_engine_load(); - } ug_man.is_initted = 1; @@ -873,9 +868,8 @@ int ugman_init(void *win, enum ug_option opt) ug_man.base_opt = opt; ug_man.last_rotate_evt = UG_EVENT_NONE; - if (!ug_man.is_initted) { + if (!ug_man.is_initted) ug_man.engine = ug_engine_load(); - } ug_man.is_initted = 1; @@ -886,13 +880,13 @@ int ugman_init(void *win, enum ug_option opt) int ugman_init_efl(Evas_Object *win, enum ug_option opt) { #ifndef UG_WAYLAND - Ecore_X_Window xwin = elm_win_xwindow_get(win); - if (xwin) - return ugman_init((Display *)ecore_x_display_get(), xwin, win, opt); + Ecore_X_Window xwin = elm_win_xwindow_get(win); + if (xwin) + return ugman_init((Display *)ecore_x_display_get(), xwin, win, opt); #else - return ugman_init(win, opt); + return ugman_init(win, opt); #endif - return -1; + return -1; } int ugman_resume(void) @@ -993,17 +987,15 @@ static int ugman_send_key_event_to_ug(ui_gadget_h ug, if (!ug) return -1; - if (ug->module) { + if (ug->module) ops = &ug->module->ops; - } else { + else return -1; - } - if (ops && ops->key_event) { + if (ops && ops->key_event) ops->key_event(ug, event, ug->app_control, ops->priv); - } else { + else return -1; - } return 0; } @@ -1058,7 +1050,7 @@ void *ugman_get_conformant(void) struct ug_engine_ops *eng_ops = NULL; void* ret = NULL; - if(ug_man.conform) { + if (ug_man.conform) { _DBG("return cached conform(%p) info", ug_man.conform); return ug_man.conform; } diff --git a/src/module.c b/src/module.c index c61f720..0a2dd41 100644 --- a/src/module.c +++ b/src/module.c @@ -69,17 +69,16 @@ static char *__ug_module_get_addr(const char *ug_name) snprintf(buf, sizeof(buf), "/proc/%d/maps", getpid()); file = fopen(buf, "r"); - if (file == NULL) { + if (file == NULL) { _WRN("proc open fail(%d)", errno); goto func_out; } memset(buf, 0x00, PATH_MAX); - while(fgets(buf, PATH_MAX, file) != NULL) - { + while (fgets(buf, PATH_MAX, file) != NULL) { if (strstr(buf, ug_name)) { - token_param = strtok_r(buf," ", &saveptr); + token_param = strtok_r(buf, " ", &saveptr); if ((token_param == NULL) || (strlen(token_param) > MEM_ADDR_TOT_LEN)) { _ERR("proc token param(%s) error", token_param); goto close_out; @@ -180,9 +179,9 @@ static int __get_ug_info(const char* name, char** ug_file_path) out_func: ret = 0; - if ((strlen(ug_file) > 0) && (ug_file_path)) { + if ((strlen(ug_file) > 0) && (ug_file_path)) *ug_file_path = strdup(ug_file); - } + return ret; err_func: diff --git a/src/ug.c b/src/ug.c index 91d284c..0ae3416 100644 --- a/src/ug.c +++ b/src/ug.c @@ -58,9 +58,8 @@ int ug_free(ui_gadget_h ug) return -1; } - if (ug->module) { + if (ug->module) ug_module_unload(ug->module); - } if (ug->name) { free((void *)ug->name); ug->name = NULL; @@ -347,7 +346,7 @@ UG_API int ug_disable_effect(ui_gadget_h ug) UG_API int ug_is_installed(const char *name) { - if(name == NULL){ + if (name == NULL) { _ERR("name is null"); return -1; } diff --git a/ug-efl-engine/ug-efl-engine.c b/ug-efl-engine/ug-efl-engine.c index 88ff163..c60e48e 100755 --- a/ug-efl-engine/ug-efl-engine.c +++ b/ug-efl-engine/ug-efl-engine.c @@ -104,7 +104,7 @@ static void __del_finished(void *data, Evas_Object *obj, void *event_info) evas_object_smart_callback_del(obj, "transition,finished", __del_finished); - if(ug->layout_state == UG_LAYOUT_HIDEEFFECT) + if (ug->layout_state == UG_LAYOUT_HIDEEFFECT) __del_effect_end(ug); else _ERR("wrong ug(%p) state(%d)", ug, ug->layout_state); @@ -146,9 +146,8 @@ static void __hide_end(ui_gadget_h ug) } } - if (ug->layout) { + if (ug->layout) evas_object_hide(ug->layout); - } } static void __hide_effect_end(ui_gadget_h ug) @@ -169,7 +168,7 @@ static void __hide_finished(void *data, Evas_Object *obj, void *event_info) evas_object_smart_callback_del(obj, "transition,finished", __hide_finished); - if(ug->layout_state == UG_LAYOUT_HIDEEFFECT) + if (ug->layout_state == UG_LAYOUT_HIDEEFFECT) __hide_effect_end(ug); else _ERR("wrong ug(%p) state(%d)", ug, ug->layout_state); @@ -196,7 +195,7 @@ static void __on_hideonly_cb(void *data, Evas_Object *obj) return; } - if ((elm_naviframe_top_item_get(navi) == ug->effect_layout) + if ((elm_naviframe_top_item_get(navi) == ug->effect_layout) && (ug->layout_state != UG_LAYOUT_NOEFFECT)) { _DBG("\t cb transition add ug=%p", ug); evas_object_smart_callback_add(navi, "transition,finished", @@ -221,14 +220,14 @@ static void on_destroy(ui_gadget_h ug, ui_gadget_h t_ug, evas_object_intercept_hide_callback_del(ug->layout, __on_hideonly_cb); - if(hide_cb == NULL) { + if (hide_cb == NULL) { /* ug_destroy_all case */ evas_object_event_callback_del(ug->layout, EVAS_CALLBACK_DEL, (Evas_Object_Event_Cb)_layout_del_cb); return; } - if(!hide_end_cb) + if (!hide_end_cb) hide_end_cb = hide_cb; if (ug != t_ug) { @@ -237,7 +236,7 @@ static void on_destroy(ui_gadget_h ug, ui_gadget_h t_ug, return; } - if(ug->layout_state == UG_LAYOUT_SHOW) { + if (ug->layout_state == UG_LAYOUT_SHOW) { __del_effect_top_layout(ug); } else if (ug->layout_state == UG_LAYOUT_SHOWEFFECT) { evas_object_smart_callback_del(navi, "transition,finished", @@ -269,7 +268,7 @@ static void __show_finished(void *data, Evas_Object *obj, void *event_info) _DBG("ug(%p) already destroyed", ug); } else if (ug->layout_state == UG_LAYOUT_SHOWEFFECT) { ug->layout_state = UG_LAYOUT_SHOW; - if((show_end_cb)&&(ug->state == UG_STATE_CREATED)) + if ((show_end_cb) && (ug->state == UG_STATE_CREATED)) show_end_cb(ug); } else { _ERR("wrong state(%d)", ug->layout_state); @@ -291,7 +290,9 @@ static void on_show_cb(void *data, Evas *e, Evas_Object *obj, evas_object_intercept_hide_callback_add(ug->layout, __on_hideonly_cb, ug); - //if 'elm.swallow.ug' string is changed, msg team have to apply this changes. + /* + * if 'elm.swallow.ug' string is changed, msg team have to apply this changes. + */ elm_object_part_content_set(conform, "elm.swallow.ug", navi); if (ug->layout_state == UG_LAYOUT_HIDEEFFECT @@ -309,8 +310,8 @@ static void on_show_cb(void *data, Evas *e, Evas_Object *obj, Elm_Object_Item *navi_top = elm_naviframe_top_item_get(navi); ug->effect_layout = elm_naviframe_item_insert_after(navi, navi_top, NULL, NULL, NULL, ug->layout, NULL); - //ug start cb - if(show_end_cb) + + if (show_end_cb) show_end_cb(ug); } else { _ERR("\tlayout state error!! state=%d\n", ug->layout_state); @@ -353,7 +354,7 @@ static void *on_create(void *win, ui_gadget_h ug, elm_naviframe_item_push(navi, NULL, NULL, NULL, navi_bg, NULL); } - if(!show_end_cb) + if (!show_end_cb) show_end_cb = show_cb; evas_object_hide(ug->layout); @@ -372,14 +373,13 @@ static void *on_request(void *data, ui_gadget_h ug, int req) _DBG("on_request ug(%p) req(%d)", ug, req); - switch(req) - { - case UG_UI_REQ_GET_CONFORMANT : - ret = (void *)_get_win_conformant((Evas_Object *)data); - break; - default : - _WRN("wrong req id(%d)", req); - return NULL; + switch (req) { + case UG_UI_REQ_GET_CONFORMANT: + ret = (void *)_get_win_conformant((Evas_Object *)data); + break; + default: + _WRN("wrong req id(%d)", req); + return NULL; } return ret;