*/
if (sep)
{
- Edje_Real_Part *rp;
+ Edje_Real_Part *rp = NULL;
+ Edje *ed2;
char *newsig;
size_t length;
char *part;
*newsig = '\0';
newsig++;
- rp = _edje_real_part_recursive_get(ed, part);
- if (rp && rp->part)
+ ed2 = _edje_recursive_get(ed, part, &rp);
+ if (ed2)
+ {
+ if (ed2) _edje_emit(ed2, newsig, src);
+ return; /* stop processing.
+ * XXX maybe let signal be processed anyway?
+ * XXX in this case, just comment this line
+ */
+ }
+
+ if (rp)
{
switch (rp->part->type)
{
- case EDJE_PART_TYPE_GROUP:
- {
- Edje *ed2;
-
- if (!rp->swallowed_object) break ;
-
- ed2 = _edje_fetch(rp->swallowed_object);
- if (ed2) _edje_emit(ed2, newsig, src);
- return; /* stop processing.
- * XXX maybe let signal be processed anyway?
- * XXX in this case, just comment this line
- */
- }
case EDJE_PART_TYPE_EXTERNAL:
{
if (!rp->swallowed_object) break ;
_edje_emit(rp->edje, newsig, src);
return;
}
+ default:
+ fprintf(stderr, "SPANK SPANK SPANK !!!\nYou should never be here !\n");
+ break;
}
}
+
+ *(newsig - 1) = EDJE_PART_PATH_SEPARATOR;
+ fprintf(stderr, "Not handle: '%s', '%s' !\n", sig, src);
}
emsg.sig = sig;
static void _edje_object_image_preload_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _edje_object_signal_preload_cb(void *data, Evas_Object *obj, const char *emission, const char *source);
-Edje_Real_Part *_edje_real_part_recursive_get_helper(Edje *ed, char **path);
+Edje_Real_Part *_edje_real_part_recursive_get_helper(const Edje *ed, char **path);
+static Edje *_edje_recursive_get_helper(Edje *ed, char **path, Edje_Real_Part **orp);
/************************** API Routines **************************/
}
Edje_Real_Part *
-_edje_real_part_recursive_get(Edje *ed, const char *part)
+_edje_real_part_recursive_get(const Edje *ed, const char *part)
{
Edje_Real_Part *rp;
char **path;
return rp;
}
+Edje *
+_edje_recursive_get(Edje *ed, const char *part, Edje_Real_Part **orp)
+{
+ Edje *oed;
+ char **path;
+
+ path = eina_str_split(part, EDJE_PART_PATH_SEPARATOR_STRING, 0);
+ if (!path) return NULL;
+
+ //printf("recursive get: %s\n", part);
+ oed = _edje_recursive_get_helper(ed, path, orp);
+
+ free(*path);
+ free(path);
+ return oed;
+}
+
Evas_Object *
_edje_children_get(Edje_Real_Part *rp, const char *partid)
{
}
Edje_Real_Part *
-_edje_real_part_recursive_get_helper(Edje *ed, char **path)
+_edje_real_part_recursive_get_helper(const Edje *ed, char **path)
{
Edje_Real_Part *rp;
Evas_Object *child;
const char *alias = NULL;
char *idx = NULL;
+ if (ed->collection && ed->collection->alias)
+ alias = eina_hash_find(ed->collection->alias, path[0]);
+
+ if (!alias)
+ alias = path[0];
+
//printf(" lookup: %s on %s\n", path[0], ed->parent ? ed->parent : "-");
- if (path[0])
- idx = strchr(path[0], EDJE_PART_PATH_SEPARATOR_INDEXL);
+ if (alias)
+ idx = strchr(alias, EDJE_PART_PATH_SEPARATOR_INDEXL);
if (idx)
{
char *end;
}
}
- if (ed->collection && ed->collection->alias)
- alias = eina_hash_find(ed->collection->alias, path[0]);
- if (alias)
+ if (alias != path[0])
{
rp = _edje_real_part_recursive_get(ed, alias);
- if (!path[1]) return rp;
+ if (!path[1] && !idx) return rp;
if (!rp) return NULL;
}
else
{
rp = _edje_real_part_get(ed, path[0]);
- if (!path[1]) return rp;
+ if (!path[1] && !idx) return rp;
if (!rp) return NULL;
}
ed = _edje_fetch(child);
if (!ed) return NULL;
- if ((rp = _edje_real_part_recursive_get_helper(ed, path)))
- return rp;
-
- return NULL;
+ return _edje_real_part_recursive_get_helper(ed, path);
default:
return NULL;
}
}
-
/* Private Routines */
+static Edje *
+_edje_recursive_get_helper(Edje *ed, char **path, Edje_Real_Part **orp)
+{
+ Evas_Object *child;
+ Edje_Real_Part *rp;
+ const char *alias = NULL;
+ char *idx = NULL;
+
+ if (ed->collection && ed->collection->alias)
+ alias = eina_hash_find(ed->collection->alias, path[0]);
+
+ if (!alias)
+ alias = path[0];
+
+ //printf(" lookup: %s on %s\n", path[0], ed->parent ? ed->parent : "-");
+ if (alias)
+ idx = strchr(alias, EDJE_PART_PATH_SEPARATOR_INDEXL);
+ if (idx)
+ {
+ char *end;
+
+ end = strchr(idx + 1, EDJE_PART_PATH_SEPARATOR_INDEXR);
+ if (end)
+ {
+ *end = '\0';
+ *idx = '\0';
+ idx++;
+ }
+ }
+
+ if (alias != path[0])
+ {
+ rp = _edje_real_part_recursive_get(ed, alias);
+ if (!rp) return NULL;
+ if (!path[1] && !idx) return rp->edje;
+ }
+ else
+ {
+ rp = _edje_real_part_get(ed, path[0]);
+ if (!rp) return NULL;
+ if (!path[1] && !idx) return rp->edje;
+ }
+
+ switch (rp->part->type)
+ {
+ case EDJE_PART_TYPE_GROUP:
+ if (!rp->swallowed_object) return NULL;
+ ed = _edje_fetch(rp->swallowed_object);
+ if (!ed) return NULL;
+ path++;
+
+ if (!path[0]) return ed;
+ return _edje_recursive_get_helper(ed, path, orp);
+ case EDJE_PART_TYPE_BOX:
+ case EDJE_PART_TYPE_TABLE:
+ case EDJE_PART_TYPE_EXTERNAL:
+ if (!idx)
+ {
+ *orp = rp;
+ return NULL;
+ }
+ path++;
+
+ child = _edje_children_get(rp, idx);
+
+ ed = _edje_fetch(child);
+ if (!ed) return NULL;
+ if (!path[0]) return ed;
+ return _edje_recursive_get_helper(ed, path, orp);
+ default:
+ return NULL;
+ }
+}
Edje_Real_Part *
-_edje_real_part_get(Edje *ed, const char *part)
+_edje_real_part_get(const Edje *ed, const char *part)
{
unsigned int i;