yakov pushed a commit to branch master.

http://git.enlightenment.org/tools/erigo.git/commit/?id=2cdeb37d7c2aab3bbe6680397f3d077d06d574fd

commit 2cdeb37d7c2aab3bbe6680397f3d077d06d574fd
Author: Yakov Goldberg <yako...@samsung.com>
Date:   Tue Nov 17 18:49:15 2015 +0200

    Add support for discard button to popup window
---
 src/bin/gui/popup.c | 11 +++++++++--
 src/bin/gui/popup.h |  3 ++-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/bin/gui/popup.c b/src/bin/gui/popup.c
index 072fd70..20e3018 100644
--- a/src/bin/gui/popup.c
+++ b/src/bin/gui/popup.c
@@ -56,13 +56,20 @@ popup_show(void *parent, const char *title, const char 
*text, Popup_Button_Type
         eo_do(popup, elm_obj_container_content_set("button1", btn));
         DATA_SET(btn, popup, cb, data);
      }
-
+   if (button_type & POPUP_DISCARD_BUTTON)
+     {
+        Eo *btn = eo_add(ELM_BUTTON_CLASS, popup);
+        eo_do(btn, elm_obj_widget_part_text_set(NULL, "Discard changes"),
+                   
eo_event_callback_add(EVAS_CLICKABLE_INTERFACE_EVENT_CLICKED, _popup_close_cb, 
(void*)(uintptr_t) POPUP_DISCARD_BUTTON));
+        eo_do(popup, elm_obj_container_content_set("button2", btn));
+        DATA_SET(btn, popup, cb, data);
+     }
    if (button_type & POPUP_CANCEL_BUTTON)
      {
         Eo *btn = eo_add(ELM_BUTTON_CLASS, popup);
         eo_do(btn, elm_obj_widget_part_text_set(NULL, "Cancel"),
                    
eo_event_callback_add(EVAS_CLICKABLE_INTERFACE_EVENT_CLICKED, _popup_close_cb, 
(void*)(uintptr_t) POPUP_CANCEL_BUTTON));
-        eo_do(popup, elm_obj_container_content_set("button2", btn));
+        eo_do(popup, elm_obj_container_content_set("button3", btn));
         DATA_SET(btn, popup, cb, data);
      }
    eo_do(popup, efl_gfx_visible_set(EINA_TRUE));
diff --git a/src/bin/gui/popup.h b/src/bin/gui/popup.h
index c965a5c..c3fa519 100644
--- a/src/bin/gui/popup.h
+++ b/src/bin/gui/popup.h
@@ -4,7 +4,8 @@
 typedef enum
 {
    POPUP_OK_BUTTON = 1 << 0,
-   POPUP_CANCEL_BUTTON = 1 << 1
+   POPUP_CANCEL_BUTTON = 1 << 1,
+   POPUP_DISCARD_BUTTON = 1 << 2
 } Popup_Button_Type;
 
 typedef void (*Popup_Cb)(Popup_Button_Type, void *);

-- 


Reply via email to