Enlightenment CVS committal Author : dj2 Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/lib Modified Files: ewl_container.c ewl_notebook2.c Log Message: - fixup the insert_helper in the container. it had an issue when inserting at the beginning. - fixup notebook2 so _insert and _prepend work =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_container.c,v retrieving revision 1.29 retrieving revision 1.30 diff -u -3 -r1.29 -r1.30 --- ewl_container.c 3 Feb 2006 19:17:52 -0000 1.29 +++ ewl_container.c 4 Feb 2006 04:19:38 -0000 1.30 @@ -245,6 +245,7 @@ DCHECK_TYPE("pc", pc, EWL_CONTAINER_TYPE); DCHECK_TYPE("child", child, EWL_WIDGET_TYPE); + /* already inserted */ if (pc == EWL_CONTAINER(child->parent)) DRETURN(DLEVEL_STABLE); @@ -253,17 +254,26 @@ DRETURN(DLEVEL_STABLE); } + /* find the real container */ while (pc->redirect) pc = pc->redirect; + /* find our insertion point */ ecore_list_goto_first(pc->children); - while ((cur = ecore_list_next(pc->children))) + while ((cur = ecore_list_current(pc->children))) { - if (skip_internal && ewl_widget_internal_is(cur)) continue; + if (skip_internal && ewl_widget_internal_is(cur)) + { + ecore_list_next(pc->children); + continue; + } - idx++; if (idx == index) break; + + idx++; + ecore_list_next(pc->children); } + ecore_list_insert(pc->children, child); ewl_widget_parent_set(child, EWL_WIDGET(pc)); ewl_container_child_add_call(pc, child); =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_notebook2.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -3 -r1.10 -r1.11 --- ewl_notebook2.c 3 Feb 2006 22:27:59 -0000 1.10 +++ ewl_notebook2.c 4 Feb 2006 04:19:38 -0000 1.11 @@ -364,6 +364,8 @@ t = ewl_attach_notebook_data_get(page); if (!t) { + int idx = 0; + t = ewl_hbox_new(); ewl_widget_appearance_set(t, "tab"); ewl_attach_notebook_data_set(page, t); @@ -373,9 +375,8 @@ ewl_callback_append(t, EWL_CALLBACK_CLICKED, ewl_notebook2_cb_tab_clicked, n); - /* XXX This has to insert into the position that the page is - * in, not onto the end */ - ewl_container_child_append(EWL_CONTAINER(n->body.tabbar), t); + idx = ewl_container_child_index_get(EWL_CONTAINER(n), page); + ewl_container_child_insert(EWL_CONTAINER(n->body.tabbar), t, idx); } /* if this is the current page set it's tab to selected */ @@ -517,9 +518,11 @@ if (w == n->cur_page) { Ewl_Widget *page, *new_tab; + int count; - /* if we are before the beginning, subtract one from the index */ - if (idx > 0) idx--; + /* make sure we aren't off the end of the list */ + count = ewl_container_child_count_get(EWL_CONTAINER(n->body.tabbar)); + if (idx >= count) idx = count - 1; new_tab = ewl_container_child_get( EWL_CONTAINER(n->body.tabbar), idx); ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs