* Enlightenment SVN <no-re...@enlightenment.org> [2012-05-09 22:37:38 -0700]:
> Log: > edje: preserve user box and table items during call of edje_object_file_set. > > NOTE: now you can change theme dynamically in elementary apps more reliably. > This doesn't handle the case where the swallow was done in a parent object > and > the reswallow should happen in a another group. I don't how to fix that use > case. > don't see yet how to handle that Really nice that you've done that :) I don't think that's the cited case above, so here's a bug: try elm "layout 2" test and go back and forth b&w and detorious-elm -- the table section is not maintained as the box one. > > > Author: cedric > Date: 2012-05-09 22:37:38 -0700 (Wed, 09 May 2012) > New Revision: 70901 > Trac: http://trac.enlightenment.org/e/changeset/70901 > > Modified: > trunk/edje/ChangeLog trunk/edje/NEWS trunk/edje/src/lib/edje_load.c > > Modified: trunk/edje/ChangeLog > =================================================================== > --- trunk/edje/ChangeLog 2012-05-10 05:06:51 UTC (rev 70900) > +++ trunk/edje/ChangeLog 2012-05-10 05:37:38 UTC (rev 70901) > @@ -434,3 +434,7 @@ > * Check that the file changed on disk when trying to reopen it. > * Emit ['edje,change,file', 'edje'] when the file change on disk. > * Automatically reload edje file when it change in edje_player. > + > +2012-05-10 Cedric Bail > + > + * Preserve user box and table items during call of edje_object_file_set. > > Modified: trunk/edje/NEWS > =================================================================== > --- trunk/edje/NEWS 2012-05-10 05:06:51 UTC (rev 70900) > +++ trunk/edje/NEWS 2012-05-10 05:37:38 UTC (rev 70901) > @@ -15,6 +15,7 @@ > * Add missing files in the tarballs. > * Prevent crash when running nested edje_object_signal_emit with > edje_object_signal_callback_{add,del}. > * Do actually verify that the file on disk is different from the file we > have loaded. > + * Preserve user bix and table items during call of edje_object_file_set. > > Edje 1.2.0 > > > Modified: trunk/edje/src/lib/edje_load.c > =================================================================== > --- trunk/edje/src/lib/edje_load.c 2012-05-10 05:06:51 UTC (rev 70900) > +++ trunk/edje/src/lib/edje_load.c 2012-05-10 05:37:38 UTC (rev 70901) > @@ -1,5 +1,16 @@ > #include "edje_private.h" > > +typedef struct _Edje_Table_Items Edje_Table_Items; > +struct _Edje_Table_Items > +{ > + Evas_Object *child; > + const char *part; > + unsigned short col; > + unsigned short row; > + unsigned short colspan; > + unsigned short rowspan; > +}; > + > #ifdef EDJE_PROGRAM_CACHE > static Eina_Bool _edje_collection_free_prog_cache_matches_free_cb(const > Eina_Hash *hash, const void *key, void *data, void *fdata); > #endif > @@ -7,6 +18,8 @@ > static void _cb_signal_repeat(void *data, Evas_Object *obj, const char > *signal, const char *source); > > static Eina_List *_edje_swallows_collect(Edje *ed); > +static Eina_List *_edje_box_items_collect(Edje *ed); > +static Eina_List *_edje_table_items_collect(Edje *ed); > > /************************** API Routines **************************/ > > @@ -281,6 +294,8 @@ > Eina_List *sources = NULL; > Eina_List *externals = NULL; > Eina_List *old_swallows; > + Eina_List *old_table_items; > + Eina_List *old_box_items; > unsigned int n; > Eina_List *parts = NULL; > int group_path_started = 0; > @@ -304,6 +319,8 @@ > tev = evas_object_evas_get(obj); > evas_event_freeze(tev); > old_swallows = _edje_swallows_collect(ed); > + old_table_items = _edje_table_items_collect(ed); > + old_box_items = _edje_box_items_collect(ed); > > if (_edje_script_only(ed)) _edje_script_only_shutdown(ed); > if (_edje_lua_script_only(ed)) _edje_lua_script_only_shutdown(ed); > @@ -844,6 +861,39 @@ > } > } > > + if (old_box_items) > + { > + while (old_box_items) > + { > + const char *name; > + Evas_Object *child; > + > + name = eina_list_data_get(old_box_items); > + old_box_items = eina_list_remove_list(old_box_items, > old_box_items); > + > + child = eina_list_data_get(old_box_items); > + old_box_items = eina_list_remove_list(old_box_items, > old_box_items); > + > + edje_object_part_box_append(obj, name, child); > + eina_stringshare_del(name); > + } > + } > + > + if (old_table_items) > + { > + Edje_Table_Items *item; > + > + EINA_LIST_FREE(old_table_items, item) > + { > + edje_object_part_table_pack(obj, > + item->part, item->child, > + item->col, item->row, > + item->colspan, > item->rowspan); > + eina_stringshare_del(item->part); > + free(item); > + } > + } > + > _edje_recalc(ed); > _edje_thaw(ed); > _edje_unblock(ed); > @@ -934,6 +984,77 @@ > return swallows; > } > > +static Eina_List * > +_edje_table_items_collect(Edje *ed) > +{ > + Eina_List *items = NULL; > + unsigned int i; > + > + if (!ed->file || !ed->table_parts) return NULL; > + for (i = 0; i < ed->table_parts_size; i++) > + { > + Edje_Real_Part *rp; > + Eina_List *children; > + Evas_Object *child; > + > + rp = ed->table_parts[i]; > + if (rp->part->type != EDJE_PART_TYPE_TABLE) continue ; > + > + children = evas_object_table_children_get(rp->object); > + EINA_LIST_FREE(children, child) > + if (!evas_object_data_get(child, "\377 edje.table_item")) > + { > + Edje_Table_Items *n; > + > + n = malloc(sizeof (Edje_Table_Items)); > + if (!n) continue ; > + > + evas_object_table_pack_get(rp->object, child, > + &n->col, &n->row, > + &n->colspan, &n->rowspan); > + n->child = child; > + n->part = eina_stringshare_add(rp->part->name); > + > + _edje_real_part_table_unpack(rp, child); > + > + items = eina_list_append(items, n); > + } > + } > + > + return items; > +} > + > +static Eina_List * > +_edje_box_items_collect(Edje *ed) > +{ > + Eina_List *items = NULL; > + unsigned int i; > + > + if (!ed->file || !ed->table_parts) return NULL; > + for (i = 0; i < ed->table_parts_size; i++) > + { > + Edje_Real_Part *rp; > + Eina_List *children; > + Evas_Object *child; > + > + rp = ed->table_parts[i]; > + if (rp->part->type != EDJE_PART_TYPE_BOX) continue ; > + > + children = evas_object_box_children_get(rp->object); > + EINA_LIST_FREE(children, child) > + if (!evas_object_data_get(child, "\377 edje.box_item")) > + { > + items = eina_list_append(items, > + > eina_stringshare_add(rp->part->name)); > + items = eina_list_append(items, > + child); > + _edje_real_part_box_remove(rp, child); > + } > + } > + > + return items; > +} > + > void > _edje_file_del(Edje *ed) > { > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > enlightenment-svn mailing list > enlightenment-...@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/enlightenment-svn -- Gustavo Lima Chaves Computer Engineer @ ProFUSION Embedded Systems ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel