void poweroff_response_yes_cb_min(void *data, Evas_Object * obj, void *event_info)
{
	system_print("System-popup : Switching off phone !! Bye Bye \n");

	/* This will cleanup the memory */
	poweroff_cleanup(data);

	/* Sysman API to poweroff */
	if (sysman_call_predef_action(PREDEF_POWEROFF, 0) == -1) {
		system_print("System-popup : failed to request poweroff to system_server \n");
		system("poweroff");
	}
	exit(0);
}
void poweroff_response_no_cb_min(void *data, Evas_Object * obj, void *event_info)
{
	system_print("\nSystem-popup: Option is Wrong");
	if(data != NULL)
		poweroff_cleanup(data);
	exit(0);
}
/**
 * Initialize the middlebox firewall application.
 * This sets up the firewall's policies.
 *
 * @param policy_file   the configuration file (in libconfig format) that specifies
 *                      the firewall's policy. If NULL, a default policy is used.
 *
 * @return              0 on success, negative on error
 */
int signaling_hipfw_feedback_init(const char *key_file, const char *cert_file)
{
    int err = 0;

    /* Load the host identity */
    if (HIP_DEFAULT_HIPFW_ALGO == HIP_HI_ECDSA) {
        load_ecdsa_private_key(key_file, &ecdsa_key);
        hip_any_key_to_hit(ecdsa_key, &our_hit, 0, HIP_HI_ECDSA);
    } else if (HIP_DEFAULT_HIPFW_ALGO == HIP_HI_RSA) {
        load_rsa_private_key(key_file, &rsa_key);
        hip_any_key_to_hit(rsa_key, &our_hit, 0, HIP_HI_RSA);
    }
    HIP_DEBUG("Successfully Loaded the MiddleBox key.\n");
    HIP_INFO_HIT("Our hit: ", &our_hit);

    mb_cert = load_x509_certificate(cert_file);


    /* Sockets */
    hipfw_nat_sock_output_udp = init_raw_sock_v4(IPPROTO_UDP);
    if (hipfw_nat_sock_output_udp > 0) {
        HIP_DEBUG("Successfully initialized nat output socket. \n");
    } else {
        HIP_DEBUG("Failed to bind output socket. \n");
    }

    if (rtnl_open_byproto(&hipfw_nl_route,
                          RTMGRP_LINK | RTMGRP_IPV6_IFADDR | IPPROTO_IPV6
                          | RTMGRP_IPV4_IFADDR | IPPROTO_IP,
                          NETLINK_ROUTE) < 0) {
        err = 1;
        HIP_ERROR("Routing socket error: %s\n", strerror(errno));
        goto out_err;
    } else {
        HIP_DEBUG("Successfully opened netlink socket \n");
    }

    /* flush ip table rules to not catch our own notify... */
    system_print("iptables -D HIPFW-OUTPUT 1");
    system_print("iptables -D HIPFW-OUTPUT 1");

out_err:
    return err;
}
void ok_clicked_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
{
	system_print("\n system-popup : Yes Noti \n");

	struct appdata *ad = data;
	vconf_set_str(VCONFKEY_REMOVED_USB_STORAGE, ad->device_name);
	free(ad->device_name);

	fflush(stdout);
	exit(0);
}
/* Start UI */
int poweroff_start(void *data)
{
	struct appdata *ad = data;
	int ret_val = 0;

	/* Create and show popup */
	ret_val = create_and_show_basic_popup_min(ad);
	if (ret_val != 0)
		return -1;

	/* Change LCD brightness */
	ret_val = pm_change_state(LCD_NORMAL);
	if (ret_val != 0)
		return -1;

	/* Play a vibration for 1 sec */
	ret_val = poweroff_play_vibration();
	if (ret_val == -1)
		system_print("\n Poweroff : Play vibration Failed \n");

	return 0;
}
int create_and_show_basic_popup_min(struct appdata *ad)
{
	Evas_Object *btn1;
	Evas_Object *btn2;

	ad->popup_poweroff = elm_popup_add(ad->win_main);
	if (ad->popup_poweroff == NULL) {
		system_print("\n System-popup : Add popup failed \n");
		return -1;
	}

	evas_object_size_hint_weight_set(ad->popup_poweroff, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	elm_object_text_set(ad->popup_poweroff, _("IDS_ST_BODY_POWER_OFF"));
	elm_object_part_text_set(ad->popup_poweroff, "title,text", _("IDS_COM_BODY_SYSTEM_INFO_ABB"));

	btn1 = elm_button_add(ad->popup_poweroff);
	elm_object_text_set(btn1, _("IDS_COM_SK_OK"));
	elm_object_part_content_set(ad->popup_poweroff, "button1", btn1);
	elm_object_style_set (btn1,"popup_button/default");
	evas_object_smart_callback_add(btn1, "clicked", poweroff_response_yes_cb_min, ad);
	btn2 = elm_button_add(ad->popup_poweroff);
	elm_object_text_set(btn2, _("IDS_COM_SK_CANCEL"));
	elm_object_part_content_set(ad->popup_poweroff, "button2", btn2);
	elm_object_style_set (btn2,"popup_button/default");
	evas_object_smart_callback_add(btn2, "clicked", poweroff_response_no_cb_min, ad);

	Ecore_X_Window xwin;
	xwin = elm_win_xwindow_get(ad->popup_poweroff);
	ecore_x_netwm_window_type_set(xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
	utilx_grab_key(ecore_x_display_get(), xwin, KEY_SELECT, SHARED_GRAB);
	ecore_event_handler_add(ECORE_EVENT_KEY_UP, poweroff_response_no_cb_min, NULL);
	evas_object_show(ad->popup_poweroff);
	
	return 0;
	
}
/* Background clicked noti */
void bg_clicked_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
{
	system_print("\n system-popup : In BG Noti \n");
	fflush(stdout);
	exit(0);
}