cedric pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=f5b3d50b8801d4ec450d4dfbc5e64ecebba8265e

commit f5b3d50b8801d4ec450d4dfbc5e64ecebba8265e
Author: SungTaek Hong <sth253.h...@samsung.com>
Date:   Fri Feb 12 20:59:44 2016 +0100

    layout: send signal when content is set to bg
    
    Summary:
     - elm.swallow.background is a part reserved for customized bg.
     - When default bg image is already set, default bg has to be hidden when 
customized bg is set.
     - Emitting signal when a content is set to this part makes this hiding 
process a lot easier.
    
    Reviewers: kimcinoo, cedric
    
    Subscribers: cedric, kimcinoo
    
    Differential Revision: https://phab.enlightenment.org/D3653
    
    Signed-off-by: Cedric BAIL <ced...@osg.samsung.com>
---
 src/lib/elm_layout.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/lib/elm_layout.c b/src/lib/elm_layout.c
index bc99d75..86d020c 100644
--- a/src/lib/elm_layout.c
+++ b/src/lib/elm_layout.c
@@ -40,6 +40,13 @@ static const Elm_Layout_Part_Alias_Description 
_content_aliases[] =
    {NULL, NULL}
 };
 
+static const char *_elm_layout_swallow_parts[] = {
+   "elm.swallow.icon",
+   "elm.swallow.end",
+   "elm.swallow.background",
+   NULL
+};
+
 /* these are data operated by layout's class functions internally, and
  * should not be messed up by inhering classes */
 typedef struct _Elm_Layout_Sub_Object_Data   Elm_Layout_Sub_Object_Data;
@@ -133,12 +140,16 @@ _icon_signal_emit(Elm_Layout_Smart_Data *sd,
 {
    char buf[1024];
    const char *type;
+   int i;
 
    //FIXME: Don't limit to the icon and end here.
    // send signals for all contents after elm 2.0
-   if (sub_d->type != SWALLOW ||
-       (strcmp("elm.swallow.icon", sub_d->part) &&
-        (strcmp("elm.swallow.end", sub_d->part)))) return;
+   if (sub_d->type != SWALLOW) return;
+   for (i = 0;; i++)
+     {
+        if (!_elm_layout_swallow_parts[i]) return;
+        if (!strcmp(sub_d->part, _elm_layout_swallow_parts[i])) break;
+     }
 
    if (!strncmp(sub_d->part, "elm.swallow.", strlen("elm.swallow.")))
      type = sub_d->part + strlen("elm.swallow.");

-- 


Reply via email to