diff options
author | Seonah Moon <seonah1.moon@samsung.com> | 2020-12-22 17:46:01 +0900 |
---|---|---|
committer | Seonah Moon <seonah1.moon@samsung.com> | 2020-12-22 17:46:06 +0900 |
commit | a0fd7d8e8ac997780dd50d9c8b777cbe3c2b4053 (patch) | |
tree | d2a46a28fda37599d28525f37140b84a7e7a447d | |
parent | 142fb57749ad71b9a2742d27a9b5707e92752c4d (diff) | |
download | net-popup-accepted/tizen_8.0_unified.tar.gz net-popup-accepted/tizen_8.0_unified.tar.bz2 net-popup-accepted/tizen_8.0_unified.zip |
Use ui_app_exit() instead of elm_exit()tizen_8.0_m2_releasetizen_7.0_m2_releasetizen_6.5.m2_releasesubmit/tizen_6.5/20211028.162201submit/tizen/20210107.033643accepted/tizen/unified/20210107.123348accepted/tizen/8.0/unified/20231005.093231accepted/tizen/7.0/unified/hotfix/20221116.105211accepted/tizen/7.0/unified/20221110.062842accepted/tizen/6.5/unified/20211028.100623tizen_8.0tizen_7.0_hotfixtizen_6.5accepted/tizen_unifiedaccepted/tizen_8.0_unifiedaccepted/tizen_7.0_unified_hotfixaccepted/tizen_6.5_unified
elm_exit() doesn't stop the main loop instantly.
So, ecore callbacks can be called even after elm_exit().
Change-Id: I98f3f5025da7179102a76174dbba2cc042e69452
-rwxr-xr-x | src/net-popup.c | 180 |
1 files changed, 87 insertions, 93 deletions
diff --git a/src/net-popup.c b/src/net-popup.c index 70cf075..ad6f8fa 100755 --- a/src/net-popup.c +++ b/src/net-popup.c @@ -105,7 +105,6 @@ #define CAPTIVE_PORTAL_LOGIN_ERROR "Login not completed. Disconnected active Wifi" static Ecore_Event_Handler *ecore_event_evas_handler; -static Ecore_Event_Handler *ecore_event_evas_quick_panel_handler; #define BUF_SIZE 1024 long sizes[] = {1073741824, 1048576, 1024, 0}; @@ -114,7 +113,6 @@ char *units[] = {"GB", "MB", "KB", "B"}; static tizen_profile_t g_profile = TIZEN_PROFILE_UNKNOWN; static app_control_h g_req_handle = NULL; -static char *resp_popup_mode = NULL; static GDBusConnection *conn = NULL; static GDBusProxy *proxy = NULL; @@ -298,21 +296,11 @@ static void __net_popup_terminate(void *data) ecore_event_evas_handler = NULL; } - if (ecore_event_evas_quick_panel_handler) { - ecore_event_handler_del(ecore_event_evas_quick_panel_handler); - ecore_event_evas_quick_panel_handler = NULL; - } - if (g_req_handle) { app_control_destroy(g_req_handle); g_req_handle = NULL; } - if (resp_popup_mode) { - free(resp_popup_mode); - resp_popup_mode = NULL; - } - if (iface_name) { free(iface_name); iface_name = NULL; @@ -347,7 +335,7 @@ static Eina_Bool __key_release_event_cb(void *data, int type, log_print(NET_POPUP, "key_release : %s", ev->keyname); if (g_strcmp0(ev->keyname, "XF86Phone") == 0 || g_strcmp0(ev->keyname, "XF86Stop") == 0) { - elm_exit(); + ui_app_exit(); } return ECORE_CALLBACK_DONE; @@ -405,7 +393,7 @@ static void __net_popup_service_cb(app_control_h request, void *data) if (APP_CONTROL_ERROR_NONE != ret) { log_print(NET_POPUP, "Failed to get _SYSPOPUP_TYPE_ ret = %d", ret); g_free(type); - elm_exit(); + ui_app_exit(); return; } @@ -413,34 +401,34 @@ static void __net_popup_service_cb(app_control_h request, void *data) if (g_str_equal(type, "notification")) { __net_popup_show_notification(request, data); - elm_exit(); + ui_app_exit(); } else if (g_str_equal(type, "toast_popup")) { __toast_popup_show(request, data); } else if (g_str_equal(type, "popup")) { __net_popup_show_popup(request, data); } else if (g_str_equal(type, "warning_noti")) { __net_popup_show_warning_noti(request, data); - elm_exit(); + ui_app_exit(); } else if (g_str_equal(type, "restriction_noti")) { __net_popup_show_restriction_noti(request, data); } else if (g_str_equal(type, "add_found_ap_noti")) { __net_popup_add_found_ap_noti(); - elm_exit(); + ui_app_exit(); } else if (g_str_equal(type, "del_found_ap_noti")) { __net_popup_del_found_ap_noti(); - elm_exit(); + ui_app_exit(); } else if (g_str_equal(type, "add_portal_noti")) { __net_popup_add_portal_noti(request); - elm_exit(); + ui_app_exit(); } else if (g_str_equal(type, "del_portal_noti")) { __net_popup_del_portal_noti(); - elm_exit(); + ui_app_exit(); } else if (g_str_equal(type, "add_ip_conflict_noti")) { __net_popup_add_ip_conflict_noti(request); - elm_exit(); + ui_app_exit(); } else if (g_str_equal(type, "del_ip_conflict_noti")) { __net_popup_del_ip_conflict_noti(); - elm_exit(); + ui_app_exit(); } else if (g_str_equal(type, "popup_user_resp")) { app_control_clone(&g_req_handle, request); __net_popup_show_popup_with_user_resp(request, data); @@ -448,7 +436,7 @@ static void __net_popup_service_cb(app_control_h request, void *data) __net_popup_show_network_error_popup(request, data); } else { __net_popup_show_notification(request, data); - elm_exit(); + ui_app_exit(); } g_free(type); @@ -537,7 +525,7 @@ static void _ok_button_clicked_cb(void *data, Evas_Object *obj, void *event_info if (data) evas_object_del(data); - elm_exit(); + ui_app_exit(); } static void _cancel_button_clicked_cb(void *data, Evas_Object *obj, void *event_info) @@ -547,7 +535,7 @@ static void _cancel_button_clicked_cb(void *data, Evas_Object *obj, void *event_ if (data) evas_object_del(data); - elm_exit(); + ui_app_exit(); } static void _wifi_button_clicked_cb(void *data, Evas_Object *obj, void *event_info) @@ -559,7 +547,7 @@ static void _wifi_button_clicked_cb(void *data, Evas_Object *obj, void *event_in if (data) evas_object_del(data); - elm_exit(); + ui_app_exit(); } static void _settings_button_clicked_cb(void *data, Evas_Object *obj, void *event_info) @@ -571,7 +559,7 @@ static void _settings_button_clicked_cb(void *data, Evas_Object *obj, void *even if (data) evas_object_del(data); - elm_exit(); + ui_app_exit(); } static void _retry_button_clicked_cb(void *data, Evas_Object *obj, void *event_info) @@ -585,7 +573,7 @@ static void _retry_button_clicked_cb(void *data, Evas_Object *obj, void *event_i if (data) evas_object_del(data); - elm_exit(); + ui_app_exit(); } static void _data_raoming_button_clicked_cb(void *data, Evas_Object *obj, void *event_info) @@ -599,7 +587,7 @@ static void _data_raoming_button_clicked_cb(void *data, Evas_Object *obj, void * if (data) evas_object_del(data); - elm_exit(); + ui_app_exit(); } static void _connect_button_clicked_cb(void *data, Evas_Object *obj, void *event_info) @@ -613,7 +601,7 @@ static void _connect_button_clicked_cb(void *data, Evas_Object *obj, void *event if (data) evas_object_del(data); - elm_exit(); + ui_app_exit(); } static void _timeout_cb(void *data, Evas_Object *obj, void *event_info) @@ -622,7 +610,7 @@ static void _timeout_cb(void *data, Evas_Object *obj, void *event_info) evas_object_del(obj); - elm_exit(); + ui_app_exit(); } static int __toast_popup_show(app_control_h request, void *data) @@ -641,7 +629,7 @@ static int __toast_popup_show(app_control_h request, void *data) if (ret != APP_CONTROL_ERROR_NONE) { log_print(NET_POPUP, "Failed to get _SYSPOPUP_CONTENT_ ret = %d", ret); g_free(mode); - elm_exit(); + ui_app_exit(); return 0; } @@ -994,7 +982,7 @@ static int __net_popup_show_network_error_popup(app_control_h request, void *dat if (APP_CONTROL_ERROR_NONE != ret) { log_print(NET_POPUP, "Failed to get _SYSPOPUP_CONTENT_ ret = %d", ret); g_free(mode); - elm_exit(); + ui_app_exit(); return 0; } @@ -1091,7 +1079,7 @@ void _tethering_wifi_btn_yes_cb(void *data, Evas_Object *obj, void *event_info) if (popup) evas_object_del(popup); - elm_exit(); + ui_app_exit(); } void _tethering_wifi_ap_btn_yes_cb(void *data, Evas_Object *obj, void *event_info) @@ -1108,7 +1096,7 @@ void _tethering_wifi_ap_btn_yes_cb(void *data, Evas_Object *obj, void *event_inf if (popup) evas_object_del(popup); - elm_exit(); + ui_app_exit(); } static void _vpn_send_result(int result) @@ -1170,7 +1158,7 @@ void _vpn_btn_connect_cb(void *data, Evas_Object *obj, void *event_info) if (obj) evas_object_del(obj); - elm_exit(); + ui_app_exit(); } void _vpn_btn_disconnect_cb(void *data, Evas_Object *obj, void *event_info) @@ -1191,7 +1179,7 @@ void _vpn_btn_disconnect_cb(void *data, Evas_Object *obj, void *event_info) if (obj) evas_object_del(obj); - elm_exit(); + ui_app_exit(); } void _vpn_btn_no_cb(void *data, Evas_Object *obj, void *event_info) @@ -1210,7 +1198,7 @@ void _vpn_btn_no_cb(void *data, Evas_Object *obj, void *event_info) if (obj) evas_object_del(obj); - elm_exit(); + ui_app_exit(); } void _btn_no_cb(void *data, Evas_Object *obj, void *event_info) @@ -1227,7 +1215,7 @@ void _btn_no_cb(void *data, Evas_Object *obj, void *event_info) if (popup) evas_object_del(popup); - elm_exit(); + ui_app_exit(); } static void __data_usage_notification(notification_type_e type, @@ -1364,7 +1352,7 @@ static void __data_usage_btn_on_cb(void *data, Evas_Object *obj, void *event_inf g_free(data_usage_app_id); g_free(data_usage_iftype); - elm_exit(); + ui_app_exit(); } static void __data_usage_btn_ok_cb(void *data, Evas_Object *obj, void *event_info) @@ -1388,7 +1376,7 @@ static void __data_usage_btn_ok_cb(void *data, Evas_Object *obj, void *event_inf g_free(data_usage_app_id); g_free(data_usage_iftype); - elm_exit(); + ui_app_exit(); } static void __net_popup_show_popup_with_user_resp(app_control_h request, @@ -1402,12 +1390,21 @@ static void __net_popup_show_popup_with_user_resp(app_control_h request, Evas_Object *label; Evas_Object *btn1; Evas_Object *btn2; + char *resp_popup_mode = NULL; int ret = 0; ret = app_control_get_extra_data(request, "_SYSPOPUP_CONTENT_", &resp_popup_mode); if (APP_CONTROL_ERROR_NONE != ret) log_print(NET_POPUP, "Failed to get _SYSPOPUP_CONTENT_ ret = %d", ret); + if (g_strcmp0(resp_popup_mode, "TETHERING_TYPE_WIFI") != 0 && + g_strcmp0(resp_popup_mode, "TETHERING_TYPE_WIFI_AP") != 0) { + log_print(NET_POPUP, "Invalid popup mode [%s]", resp_popup_mode); + g_free(resp_popup_mode); + ui_app_exit(); + return; + } + secure_log_print(NET_POPUP, "_SYSPOPUP_CONTENT_ = %s\n", resp_popup_mode); win = __net_popup_create_win(); @@ -1417,55 +1414,52 @@ static void __net_popup_show_popup_with_user_resp(app_control_h request, evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - if (g_strcmp0(resp_popup_mode, "TETHERING_TYPE_WIFI") == 0 || - g_strcmp0(resp_popup_mode, "TETHERING_TYPE_WIFI_AP") == 0) { - log_print(NET_POPUP, "Drawing Wi-Fi Tethering OFF popup"); - - __net_popup_init_dbus(); - elm_object_part_text_set(popup, "title,text", ALERT_STR_WIFI); - - layout = elm_layout_add(popup); - elm_layout_file_set(layout, NETPOPUP_EDJ, "popup"); - evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); + log_print(NET_POPUP, "Drawing Wi-Fi Tethering OFF popup"); - label = elm_label_add(popup); - elm_label_line_wrap_set(label, ELM_WRAP_MIXED); - elm_object_text_set(label, ALERT_STR_WIFI_MOBILE_AP_ON); - evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_show(label); + __net_popup_init_dbus(); + elm_object_part_text_set(popup, "title,text", ALERT_STR_WIFI); - elm_object_part_content_set(layout, "elm.swallow.content", label); - evas_object_show(layout); - elm_object_style_set(label, "popup/default"); - eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, _btn_no_cb, popup); - elm_object_content_set(popup, label); - - btn1 = elm_button_add(popup); - elm_object_style_set(btn1, "popup"); - elm_object_text_set(btn1, ALERT_STR_CANCEL); - elm_object_part_content_set(popup, "button1", btn1); - evas_object_smart_callback_add(btn1, "clicked", - _btn_no_cb, popup); + layout = elm_layout_add(popup); + elm_layout_file_set(layout, NETPOPUP_EDJ, "popup"); + evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); - btn2 = elm_button_add(popup); - elm_object_style_set(btn2, "popup"); - elm_object_text_set(btn2, ALERT_STR_OK); - elm_object_part_content_set(popup, "button2", btn2); + label = elm_label_add(popup); + elm_label_line_wrap_set(label, ELM_WRAP_MIXED); + elm_object_text_set(label, ALERT_STR_WIFI_MOBILE_AP_ON); + evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(label); - if (g_strcmp0(resp_popup_mode, "TETHERING_TYPE_WIFI") == 0) - evas_object_smart_callback_add(btn2, "clicked", + elm_object_part_content_set(layout, "elm.swallow.content", label); + evas_object_show(layout); + elm_object_style_set(label, "popup/default"); + eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, _btn_no_cb, popup); + elm_object_content_set(popup, label); + + btn1 = elm_button_add(popup); + elm_object_style_set(btn1, "popup"); + elm_object_text_set(btn1, ALERT_STR_CANCEL); + elm_object_part_content_set(popup, "button1", btn1); + evas_object_smart_callback_add(btn1, "clicked", + _btn_no_cb, popup); + + btn2 = elm_button_add(popup); + elm_object_style_set(btn2, "popup"); + elm_object_text_set(btn2, ALERT_STR_OK); + elm_object_part_content_set(popup, "button2", btn2); + + if (g_strcmp0(resp_popup_mode, "TETHERING_TYPE_WIFI") == 0) + evas_object_smart_callback_add(btn2, "clicked", _tethering_wifi_btn_yes_cb, popup); - else if (g_strcmp0(resp_popup_mode, "TETHERING_TYPE_WIFI_AP") == 0) - evas_object_smart_callback_add(btn2, "clicked", + else if (g_strcmp0(resp_popup_mode, "TETHERING_TYPE_WIFI_AP") == 0) + evas_object_smart_callback_add(btn2, "clicked", _tethering_wifi_ap_btn_yes_cb, popup); - evas_object_show(popup); - evas_object_show(win); - __net_popup_deinit_dbus(); - } + evas_object_show(popup); + evas_object_show(win); + __net_popup_deinit_dbus(); } static void __net_popup_show_vpn_popup(app_control_h request, void *data) @@ -1485,7 +1479,7 @@ static void __net_popup_show_vpn_popup(app_control_h request, void *data) int ret = app_control_get_extra_data(request, APP_CONTROL_DATA_TYPE, &type); if (APP_CONTROL_ERROR_NONE != ret) { log_print(NET_POPUP, "Failed to get APP_CONTROL_DATA_TYPE ret = %d", ret); - elm_exit(); + ui_app_exit(); return; } @@ -1493,7 +1487,7 @@ static void __net_popup_show_vpn_popup(app_control_h request, void *data) if (APP_CONTROL_ERROR_NONE != ret) { log_print(NET_POPUP, "Failed to get APP_CONTROL_DATA_NAME ret = %d", ret); free(type); - elm_exit(); + ui_app_exit(); return; } log_print(NET_POPUP, "type(%s) name(%s)", type, iface_name); @@ -1511,7 +1505,7 @@ static void __net_popup_show_vpn_popup(app_control_h request, void *data) } else { log_print(NET_POPUP, "Invalid appcontrol value"); free(type); - elm_exit(); + ui_app_exit(); return; } @@ -1554,7 +1548,7 @@ static void __net_popup_show_warning_noti(app_control_h request, void *data) int ret = app_control_get_extra_data(request, "_APP_ID_", &data_usage_app_id); if (APP_CONTROL_ERROR_NONE != ret) { log_print(NET_POPUP, "Failed to get _APP_ID_ ret = %d", ret); - elm_exit(); + ui_app_exit(); return; } @@ -1563,7 +1557,7 @@ static void __net_popup_show_warning_noti(app_control_h request, void *data) strcmp(data_usage_app_id, STC_TOTAL_BLUETOOTH)) { log_print(NET_POPUP, "It's not total data usage [%s]", data_usage_app_id); g_free(data_usage_app_id); - elm_exit(); + ui_app_exit(); return; } @@ -1594,7 +1588,7 @@ static void __net_popup_show_restriction_noti(app_control_h request, void *data) int ret = app_control_get_extra_data(request, "_APP_ID_", &data_usage_app_id); if (APP_CONTROL_ERROR_NONE != ret) { log_print(NET_POPUP, "Failed to get _APP_ID_ ret = %d", ret); - elm_exit(); + ui_app_exit(); return; } @@ -1603,7 +1597,7 @@ static void __net_popup_show_restriction_noti(app_control_h request, void *data) strcmp(data_usage_app_id, STC_TOTAL_BLUETOOTH)) { log_print(NET_POPUP, "It's not total data usage [%s]", data_usage_app_id); g_free(data_usage_app_id); - elm_exit(); + ui_app_exit(); return; } @@ -1611,7 +1605,7 @@ static void __net_popup_show_restriction_noti(app_control_h request, void *data) if (APP_CONTROL_ERROR_NONE != ret) { log_print(NET_POPUP, "Failed to get _IF_TYPE_ ret = %d", ret); g_free(data_usage_app_id); - elm_exit(); + ui_app_exit(); return; } @@ -1620,7 +1614,7 @@ static void __net_popup_show_restriction_noti(app_control_h request, void *data) log_print(NET_POPUP, "Failed to get _RESTRICTION_LIMIT_ ret = %d", ret); g_free(data_usage_app_id); g_free(data_usage_iftype); - elm_exit(); + ui_app_exit(); return; } @@ -1675,7 +1669,7 @@ static int __net_popup_show_popup(app_control_h request, void *data) if (APP_CONTROL_ERROR_NONE != ret) { log_print(NET_POPUP, "Failed to get _SYSPOPUP_CONTENT_ ret = %d", ret); g_free(mode); - elm_exit(); + ui_app_exit(); return 0; } |