rimmed pushed a commit to branch master.

http://git.enlightenment.org/tools/eflete.git/commit/?id=495857d93973884483967ffad9a676add4894732

commit 495857d93973884483967ffad9a676add4894732
Author: Vitalii Vorobiov <[email protected]>
Date:   Thu Aug 4 19:21:04 2016 +0300

    popup: hide popup when invoked object of property is deleted in genlist
    
    @fix
---
 src/bin/ui/main_window.h                      | 20 ++++++++++++++++++++
 src/bin/ui/popup.c                            | 21 +++++++++++++++++++++
 src/bin/ui/property/property_color_control.c  |  6 ++++++
 src/bin/ui/property/property_common_image.c   |  6 ++++++
 src/bin/ui/property/property_common_tween.c   |  5 +++++
 src/bin/ui/property/property_image_selector.c |  6 ++++++
 6 files changed, 64 insertions(+)

diff --git a/src/bin/ui/main_window.h b/src/bin/ui/main_window.h
index 7f1cb4e..3112c7b 100644
--- a/src/bin/ui/main_window.h
+++ b/src/bin/ui/main_window.h
@@ -148,6 +148,19 @@ typedef enum _Popup_Button
    BTN_APPEND     = (1 << 5)
 } Popup_Button;
 
+typedef enum _Popup_Current
+{
+   POPUP_NONE = 0,
+   POPUP_FILESELECTOR_SOUND_HELPER,
+   POPUP_FILESELECTOR_FOLDER_HELPER,
+   POPUP_FILESELECTOR_EDJ_HELPER,
+   POPUP_FILESELECTOR_EDC_HELPER,
+   POPUP_FILESELECTOR_IMAGE_HELPER,
+   POPUP_LOG_MESSAGE_HELPER,
+   POPUP_GENGRID_IMAGE_HELPER,
+   POPUP_COLORSELECTOR_HELPER
+} Popup_Current;
+
 /**
  * Adds toolbar with menu and buttons to the given Elementary layout.
  *
@@ -335,6 +348,13 @@ popup_want_action(const char *title,
                   Popup_Button p_btns,
                   Popup_Validator_Func func,
                   void *data);
+
+void
+popup_active_helper_close(void *data,
+                          Evas *e,
+                          Evas_Object *obj,
+                          void *event_info);
+
 /**
  * Disable the popup buttons.
  *
diff --git a/src/bin/ui/popup.c b/src/bin/ui/popup.c
index 39188d2..1f0bab4 100644
--- a/src/bin/ui/popup.c
+++ b/src/bin/ui/popup.c
@@ -37,6 +37,7 @@ static const Popup_Button _btn_dont_save  = BTN_DONT_SAVE;
 static const Popup_Button _btn_cancel     = BTN_CANCEL;
 static Popup_Validator_Func validator     = NULL;
 static void *user_data                    = NULL;
+static Popup_Current current;
 
 struct _Search_Data
 {
@@ -66,6 +67,7 @@ static void
 _delete_object_job(void *data)
 {
    evas_object_del(data);
+   current = POPUP_NONE;
 }
 
 static void
@@ -472,6 +474,7 @@ popup_fileselector_folder_helper(const char *title, 
Evas_Object *follow_up, cons
                                  Eina_Bool multi, Eina_Bool is_save)
 {
    _fileselector_helper(title, follow_up, path, multi, is_save, func, data, 
NULL);
+   current = POPUP_FILESELECTOR_FOLDER_HELPER;
 }
 
 static Eina_Bool
@@ -492,6 +495,7 @@ popup_fileselector_edj_helper(const char *title, 
Evas_Object *follow_up, const c
                               Eina_Bool multi, Eina_Bool is_save)
 {
    _fileselector_helper(title, follow_up, path, multi, is_save, func, data, 
_edj_filter);
+   current = POPUP_FILESELECTOR_EDJ_HELPER;
 }
 
 static Eina_Bool
@@ -512,6 +516,7 @@ popup_fileselector_edc_helper(const char *title, 
Evas_Object *follow_up, const c
                               Eina_Bool multi, Eina_Bool is_save)
 {
    _fileselector_helper(title, follow_up, path, multi, is_save, func, data, 
_edc_filter);
+   current = POPUP_FILESELECTOR_EDC_HELPER;
 }
 
 static Eina_Bool
@@ -541,6 +546,7 @@ popup_fileselector_image_helper(const char *title, 
Evas_Object *follow_up, const
                                 Eina_Bool multi, Eina_Bool is_save)
 {
    _fileselector_helper(title, follow_up, path, multi, is_save, func, data, 
_images_filter);
+   current = POPUP_FILESELECTOR_IMAGE_HELPER;
 }
 
 static Eina_Bool
@@ -569,6 +575,7 @@ popup_fileselector_sound_helper(const char *title, 
Evas_Object *follow_up, const
                                 Eina_Bool multi, Eina_Bool is_save)
 {
    _fileselector_helper(title, follow_up, path, multi, is_save, func, data, 
_sounds_filter);
+   current = POPUP_FILESELECTOR_SOUND_HELPER;
 }
 
 void
@@ -783,6 +790,7 @@ popup_gengrid_image_helper(const char *title, Evas_Object 
*follow_up,
 
    evas_object_del(helper);
    helper = elm_layout_add(ap.win);
+   current = POPUP_GENGRID_IMAGE_HELPER;
    elm_layout_theme_set(helper, "layout", "popup", title ? "hint_title" : 
"hint");
    evas_object_data_set(helper, "STRUCT", helper_data);
    elm_layout_signal_callback_add(helper, "hint,dismiss", "eflete", 
_helper_dismiss, follow_up);
@@ -890,6 +898,7 @@ popup_colorselector_helper(Evas_Object *follow_up,
    evas_object_del(helper);
    helper = elm_layout_add(ap.win);
 
+   current = POPUP_COLORSELECTOR_HELPER;
 #if HAVE_TIZEN
    elm_layout_theme_set(helper, "layout", "popup", "colorselector");
 #else
@@ -958,6 +967,7 @@ popup_log_message_helper(const char *msg)
    Evas_Object *box, *en, *lab;
 
    helper = elm_layout_add(ap.win);
+   current = POPUP_LOG_MESSAGE_HELPER;
    elm_layout_theme_set(helper, "layout", "popup", "hint");
    elm_layout_signal_callback_add(helper, "hint,dismiss", "eflete", 
_helper_dismiss, ap.win);
    evas_object_size_hint_min_set(helper, FS_W, FS_H);
@@ -980,6 +990,17 @@ popup_log_message_helper(const char *msg)
    evas_object_show(helper);
 }
 
+void
+popup_active_helper_close(void *data,
+                          Evas *e __UNUSED__,
+                          Evas_Object *obj __UNUSED__,
+                          void *event_info __UNUSED__)
+{
+   Popup_Current request = ((Popup_Current)(uintptr_t)data);
+   if (request == current)
+     elm_layout_signal_emit(helper, "hint,dismiss", "eflete");
+}
+
 #undef FS_W
 #undef FS_H
 
diff --git a/src/bin/ui/property/property_color_control.c 
b/src/bin/ui/property/property_color_control.c
index fb5cd57..de30212 100644
--- a/src/bin/ui/property/property_color_control.c
+++ b/src/bin/ui/property/property_color_control.c
@@ -85,6 +85,12 @@ property_color_control_add(Evas_Object *parent)
    elm_layout_theme_set(color, "image", "color", "color_set");
    elm_layout_signal_callback_add(control, "clicked", "eflete", 
_on_color_clicked, NULL);
    elm_layout_content_set(control, NULL, color);
+
+   evas_object_event_callback_add(control,
+                                  EVAS_CALLBACK_FREE,
+                                  popup_active_helper_close,
+                                  
(void*)(uintptr_t)POPUP_COLORSELECTOR_HELPER);
+
    return control;
 }
 
diff --git a/src/bin/ui/property/property_common_image.c 
b/src/bin/ui/property/property_common_image.c
index 3e82879..fdb6e9f 100644
--- a/src/bin/ui/property/property_common_image.c
+++ b/src/bin/ui/property/property_common_image.c
@@ -77,5 +77,11 @@ property_image_normal_control_add(Evas_Object *parent)
    elm_entry_editable_set(content, false);
    evas_object_show(btn);
    evas_object_show(content);
+
+   evas_object_event_callback_add(content,
+                                  EVAS_CALLBACK_FREE,
+                                  popup_active_helper_close,
+                                  
(void*)(uintptr_t)POPUP_GENGRID_IMAGE_HELPER);
+
    return content;
 }
diff --git a/src/bin/ui/property/property_common_tween.c 
b/src/bin/ui/property/property_common_tween.c
index ef68979..48aab2a 100644
--- a/src/bin/ui/property/property_common_tween.c
+++ b/src/bin/ui/property/property_common_tween.c
@@ -229,6 +229,11 @@ property_image_tween_control_add(Evas_Object *parent)
                                   item);
    elm_layout_content_set(item, "elm.swallow.del", button);
 
+   evas_object_event_callback_add(item,
+                                  EVAS_CALLBACK_FREE,
+                                  popup_active_helper_close,
+                                  
(void*)(uintptr_t)POPUP_GENGRID_IMAGE_HELPER);
+
    evas_object_show(tween_list);
 
    return item;
diff --git a/src/bin/ui/property/property_image_selector.c 
b/src/bin/ui/property/property_image_selector.c
index 80f70fd..11180b9 100644
--- a/src/bin/ui/property/property_image_selector.c
+++ b/src/bin/ui/property/property_image_selector.c
@@ -73,5 +73,11 @@ property_image_selector_get(Evas_Object *parent)
    elm_entry_editable_set(content, false);
    evas_object_show(btn);
    evas_object_show(content);
+
+   evas_object_event_callback_add(content,
+                                  EVAS_CALLBACK_FREE,
+                                  popup_active_helper_close,
+                                  
(void*)(uintptr_t)POPUP_FILESELECTOR_IMAGE_HELPER);
+
    return content;
 }

-- 


Reply via email to