cedric pushed a commit to branch enlightenment-0.17.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=4c594998d175dd09094630a1eabe213d07258b82

commit 4c594998d175dd09094630a1eabe213d07258b82
Author: Sebastian Dransfeld <s...@tango.flipp.net>
Date:   Mon Mar 24 13:13:53 2014 +0100

    dialog: allow setting of NULL icon
    
    If NULL is passed as icon, icon should be disabled.
    
    CID 1039951
---
 src/bin/e_dialog.c | 36 ++++++++++++++++++++++++------------
 1 file changed, 24 insertions(+), 12 deletions(-)

diff --git a/src/bin/e_dialog.c b/src/bin/e_dialog.c
index b923d04..5291d28 100644
--- a/src/bin/e_dialog.c
+++ b/src/bin/e_dialog.c
@@ -163,19 +163,31 @@ e_dialog_text_set(E_Dialog *dia, const char *text)
 EAPI void
 e_dialog_icon_set(E_Dialog *dia, const char *icon, Evas_Coord size)
 {
-   if (!icon) return;
-
-   dia->icon_object = e_icon_add(e_win_evas_get(dia->win));
-   if (!e_util_icon_theme_set(dia->icon_object, icon))
-     e_icon_file_edje_set(dia->icon_object, icon, "icon");
-   edje_extern_object_min_size_set(dia->icon_object, size * e_scale, size * 
e_scale);
-   edje_object_part_swallow(dia->bg_object, "e.swallow.icon", 
dia->icon_object);
-   edje_object_signal_emit(dia->bg_object, "e,state,icon", "e");
-   evas_object_show(dia->icon_object);
-   if (icon)
-     edje_object_signal_emit(dia->bg_object, "e,icon,enabled", "e");
+   if (!icon)
+     {
+        if (dia->icon_object)
+          {
+             edje_object_part_unswallow(dia->bg_object, dia->icon_object);
+             evas_object_del(dia->icon_object);
+             dia->icon_object = NULL;
+          }
+        edje_object_signal_emit(dia->bg_object, "e,state,icon", "e");
+        edje_object_signal_emit(dia->bg_object, "e,icon,disabled", "e");
+     }
    else
-     edje_object_signal_emit(dia->bg_object, "e,icon,disabled", "e");
+     {
+        if (!dia->icon_object)
+          {
+             dia->icon_object = e_icon_add(e_win_evas_get(dia->win));
+             edje_object_part_swallow(dia->bg_object, "e.swallow.icon", 
dia->icon_object);
+             evas_object_show(dia->icon_object);
+          }
+        if (!e_util_icon_theme_set(dia->icon_object, icon))
+          e_icon_file_edje_set(dia->icon_object, icon, "icon");
+        edje_extern_object_min_size_set(dia->icon_object, size * e_scale, size 
* e_scale);
+        edje_object_signal_emit(dia->bg_object, "e,state,icon", "e");
+        edje_object_signal_emit(dia->bg_object, "e,icon,enabled", "e");
+     }
    edje_object_message_signal_process(dia->bg_object);
 }
 

-- 


Reply via email to