+ const char* type = bundle_get_val(b, "_SYSPOPUP_TYPE_");
+
+ if (type == NULL) {
+ elm_exit();
+ return 0;
+ }
+
+ log_print(NET_POPUP, "type = %s\n", type);
+
+ if (g_str_equal(type, "wifi_notification")) {
+ const char* mode = bundle_get_val(b, "_SYSPOPUP_CONTENT_");
+ if (mode == NULL) {
+ elm_exit();
+ return 0;
+ }
+
+ if (g_str_equal(mode, "add")) {
+ __net_popup_wifi_add_notification(data);
+ } else if(g_str_equal(mode, "delete")) {
+ __net_popup_wifi_del_notification(data);
+ } else {
+ log_print(NET_POPUP, "error mode = %s\n", mode);
+ }
+
+ elm_exit();
+ } else if (g_str_equal(type, "notification")) {
+ __net_popup_show_tickernoti(b, data);
+ elm_exit();
+ } else if (g_str_equal(type, "popup")) {
+ __net_popup_show_popup(b, data);
+ } else {
+ __net_popup_show_tickernoti(b, data);
+ elm_exit();
+ }
+
+ return 0;
+}
+
+static void _ok_button_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ if (data)
+ evas_object_del(data);
+ elm_exit();
+}
+
+static void __net_popup_wifi_add_notification(void *data)
+{
+ int noti_flags = 0;
+ notification_h noti = NULL;
+ notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
+ bundle *b = NULL;
+
+ noti = notification_new(NOTIFICATION_TYPE_NOTI, NOTIFICATION_GROUP_ID_NONE, NETPOPUP_NOTIFICATION_WIFI_FOUND_PRIV_ID);
+ if (noti == NULL) {
+ log_print(NET_POPUP, "fail to create notification");
+ return;
+ }
+
+ noti_err = notification_set_time(noti, time(NULL));
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "fail to notification_set_time : %d", noti_err);
+ return;
+ }
+
+ noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, NETPOPUP_NOTIFICATION_WIFI_ICON);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "fail to notification_set_image : %d", noti_err);
+ return;
+ }
+
+ noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, NOTIFICATION_STR_WIFI_FOUND_TITLE, NOTIFICATION_STR_WIFI_FOUND_TITLE, NOTIFICATION_VARIABLE_TYPE_NONE);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "fail to notification_set_title : %d", noti_err);
+ return;
+ }
+
+ noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, NOTIFICATION_STR_WIFI_FOUND_CONTENT, NOTIFICATION_STR_WIFI_FOUND_CONTENT, NOTIFICATION_VARIABLE_TYPE_NONE);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "fail to notification_set_content : %d", noti_err);
+ return;
+ }
+
+ noti_flags = NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY;
+ noti_err = notification_set_display_applist(noti, noti_flags);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "fail to notification_set_display_applist : %d", noti_err);
+ return;
+ }
+
+ b = bundle_create();
+ bundle_add(b, "_INTERNAL_SYSPOPUP_NAME_", "wifi-qs");
+ appsvc_set_pkgname(b, "net.wifi-qs");
+ noti_err = notification_set_execute_option(noti, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, "Launch", NULL, b);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "fail to notification_set_execute_option");
+ return;
+ }
+
+ noti_err = notification_insert(noti, NULL);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "fail to notification_insert");
+ return;
+ }
+
+ noti_err = notification_free(noti);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "fail to notification_free");
+ return;
+ }
+
+ log_print(NET_POPUP, "Successfuly added notification");
+}
+
+static void __net_popup_wifi_del_notification(void *data)
+{
+ notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti_err = notification_delete_by_priv_id(NULL, NOTIFICATION_TYPE_NOTI, NETPOPUP_NOTIFICATION_WIFI_FOUND_PRIV_ID);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "fail to notification_delete_by_priv_id");
+ }
+
+ log_print(NET_POPUP, "Successfuly deleted notification");
+}
+
+static int __net_popup_show_tickernoti(bundle *b, void *data)
+{
+ bundle *b_noti = NULL;
+