rimmed pushed a commit to branch master.

http://git.enlightenment.org/tools/eflete.git/commit/?id=46c5f2d78ce2387c7238d18d619e6f0565c199f6

commit 46c5f2d78ce2387c7238d18d619e6f0565c199f6
Author: Vitalii Vorobiov <vi.vorob...@samsung.com>
Date:   Thu Jan 14 18:06:54 2016 +0000

    live_notify: swallow set work
---
 src/bin/ui/live_view/elementary/live_notify.c | 83 ++++++++++++++++-----------
 1 file changed, 49 insertions(+), 34 deletions(-)

diff --git a/src/bin/ui/live_view/elementary/live_notify.c 
b/src/bin/ui/live_view/elementary/live_notify.c
index 6f43320..8fd9702 100644
--- a/src/bin/ui/live_view/elementary/live_notify.c
+++ b/src/bin/ui/live_view/elementary/live_notify.c
@@ -20,44 +20,62 @@
 #include "live_elementary_widgets.h"
 
 static void
-_on_notify_swallow_check(void *data __UNUSED__,
+_on_notify_swallow_check(void *data,
                          Evas_Object *obj __UNUSED__,
                          void *ei __UNUSED__)
 {
-   TODO("Remake on_swallow_check, so that would be used everywhere.")
-   ERR(N_("Complex widgets are not implemented yet."))
-}
+   Demo_Part *part = (Demo_Part *)ei;
+   Evas_Object *object = (Evas_Object *) data;
 
-static void
-_on_notify_text_check(void *data __UNUSED__,
-                         Evas_Object *obj __UNUSED__,
-                         void *ei __UNUSED__)
-{
-   TODO("Remake on_text_check, so that would be used everywhere.")
-   ERR(N_("Complex widgets are not implemented yet."))
+   int content_type = part->swallow_content;
+
+   if (part->change)
+     {
+        /* if NONE - delete object */
+        if ((content_type == CONTENT_NONE) && (part->object))
+          {
+             elm_box_unpack_all(object);
+             evas_object_del(part->object);
+             part->object = NULL;
+          }
+
+        elm_box_unpack(object, part->object);
+        part->object = object_generate(part, object);
+        evas_object_show(part->object);
+        part->change = false;
+        elm_box_pack_end(object, part->object);
+     }
+
+   if (part->object)
+     {
+        evas_object_color_set(part->object,
+                              part->r,
+                              part->g,
+                              part->b,
+                              part->a);
+
+        evas_object_size_hint_min_set(part->object,
+                                      part->min_w,
+                                      part->min_h);
+        evas_object_size_hint_max_set(part->object,
+                                      part->max_w,
+                                      part->max_h);
+     }
 }
 
 static void
 _notify_send_signal(void *data,
-                    Evas_Object *obj,
-                    void *ei __UNUSED__)
+                    Evas_Object *obj __UNUSED__,
+                    void *ei)
 {
-   Evas_Object *notify_obj = NULL;
-
-   assert(data != NULL);
+   Demo_Signal *sig = (Demo_Signal *)ei;
+   Evas_Object *object = (Evas_Object *)data;
 
-   Eina_List *notify_list = elm_box_children_get(data);
-   notify_obj = eina_list_nth(notify_list, 1);
+   assert(sig != NULL);
+   assert(sig->sig_name != NULL);
+   assert(sig->source_name != NULL);
 
-   const char *name = evas_object_data_get(obj, SIGNAL_NAME);
-   const char *source = evas_object_data_get(obj, SIGNAL_SOURCE);
-
-   assert(name != NULL);
-   assert(source != NULL);
-
-   elm_layout_signal_emit(notify_obj, name, source);
-
-   eina_list_free(notify_list);
+   elm_layout_signal_emit(object, sig->sig_name, sig->source_name);
 }
 
 static void
@@ -139,7 +157,7 @@ widget_notify_create(Evas_Object *parent, const Group 
*group)
    assert(group->class != NULL);
    assert(group->style != NULL);
 
-   Evas_Object *content, *noti, *bx, *btn, *object = NULL;
+   Evas_Object *noti, *bx, *btn, *object = NULL;
    double horizontal, vertical;
 
    assert(group->class != NULL);
@@ -153,18 +171,15 @@ widget_notify_create(Evas_Object *parent, const Group 
*group)
    elm_notify_timeout_set(noti, 3);
    BOX_ADD(parent, bx, false, false);
    elm_object_content_set(noti, bx);
-   LABEL_ADD(parent, content, _("Text example. Timeout 3 sec"));
-   elm_box_pack_end(bx, content);
 
    evas_object_smart_callback_add(btn, "clicked", _on_click, noti);
 
    object = elm_box_add(parent);
    elm_box_pack_end(object, btn);
 
-   evas_object_data_set(object, SWALLOW_FUNC, _on_notify_swallow_check);
-   evas_object_data_set(object, TEXT_FUNC, _on_notify_text_check);
-   evas_object_data_set(object, SIGNAL_FUNC, _notify_send_signal);
-
+   evas_object_smart_callback_add(ap.win, SIGNAL_DEMO_SWALLOW_SET, 
_on_notify_swallow_check, bx);
+   evas_object_smart_callback_add(ap.win, SIGNAL_DEMO_TEXT_SET, on_text_check, 
noti);
+   evas_object_smart_callback_add(ap.win, SIGNAL_DEMO_SIGNAL_SEND, 
_notify_send_signal, noti);
    elm_object_style_set(noti, group->style);
    return object;
 }

-- 


Reply via email to