Delete notification when user press ok on popup 07/49507/1 accepted/tizen/tv/20151014.093647 submit/tizen/20151014.084340 tizen_3.0.m2.a1_tv_release
authorjinwoo.shin <jw0227.shin@samsung.com>
Wed, 14 Oct 2015 06:14:00 +0000 (15:14 +0900)
committerjinwoo.shin <jw0227.shin@samsung.com>
Wed, 14 Oct 2015 06:14:00 +0000 (15:14 +0900)
Change-Id: I0de70bbf90191d3617cd907596b62babb047db90
Signed-off-by: jinwoo.shin <jw0227.shin@samsung.com>
include/util.h
src/notification_view.c
src/square_view.c
src/util.c

index 97dc643..d6053e0 100644 (file)
@@ -19,7 +19,8 @@
 #ifndef __UTIL_H__
 #define __UTIL_H__
 
-Evas_Object *util_show_notification_popup(Evas_Object *base, notification_h noti);
+Evas_Object *util_show_notification_popup(Evas_Object *base,
+               notification_h noti, bool noti_del);
 void util_clear_notification(void);
 Evas_Object *util_add_icon(Evas_Object *parent, const char *file,
                const char *part);
index 3f9e622..c65b2ab 100644 (file)
@@ -563,7 +563,7 @@ static void _update(void *view_data, int type, void *data)
                if (!noti)
                        return;
 
-               util_show_notification_popup(priv->base, noti);
+               util_show_notification_popup(priv->base, noti, false);
                break;
        }
 }
index 4f3a24a..0d36bf2 100644 (file)
@@ -433,7 +433,7 @@ static void _button_clicked_cb(int id, void *data, Evas_Object *obj)
                if (!priv || !noti)
                        return;
 
-               util_show_notification_popup(priv->base, noti);
+               util_show_notification_popup(priv->base, noti, true);
                break;
        }
 }
index 64d7e9e..faf99a4 100644 (file)
@@ -24,6 +24,7 @@
 
 enum _button_id {
        BUTTON_OK,
+       BUTTON_OK_NOTI_DEL,
        BUTTON_CANCEL,
 };
 
@@ -51,19 +52,24 @@ static void _key_up_cb(int id, void *data, Evas *e, Evas_Object *obj,
 
 static void _clicked(int id, void *data, Evas_Object *obj)
 {
+       notification_h noti;
+
        if (!data)
                return;
 
        switch (id) {
+       case BUTTON_OK_NOTI_DEL:
+               noti = evas_object_data_get(data, KEY_NOTI);
+               if (noti)
+                       notification_delete(noti);
        case BUTTON_OK:
-               inputmgr_remove_callback(data, &popup_handler);
                evas_object_del(data);
                break;
        }
 }
 
 Evas_Object *util_show_notification_popup(
-               Evas_Object *base, notification_h noti)
+               Evas_Object *base, notification_h noti, bool noti_del)
 {
        Evas_Object *popup, *btn1;
        char *title = NULL;
@@ -87,8 +93,14 @@ Evas_Object *util_show_notification_popup(
        btn1 = elm_button_add(popup);
        elm_object_text_set(btn1, "OK");
        elm_object_part_content_set(popup, "button1", btn1);
-       inputmgr_add_callback(btn1,
-                       BUTTON_OK, &popup_handler, popup);
+
+       if (noti_del)
+               inputmgr_add_callback(btn1,
+                               BUTTON_OK_NOTI_DEL, &popup_handler, popup);
+       else
+               inputmgr_add_callback(btn1,
+                               BUTTON_OK, &popup_handler, popup);
+
        evas_object_show(btn1);
        elm_object_focus_set(btn1, EINA_TRUE);