Enlightenment CVS committal Author : dj2 Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/lib Modified Files: ewl_notebook2.c Log Message: - make notebook2 delete work correctly =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_notebook2.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- ewl_notebook2.c 3 Feb 2006 18:14:30 -0000 1.5 +++ ewl_notebook2.c 3 Feb 2006 18:57:48 -0000 1.6 @@ -479,6 +479,7 @@ { Ewl_Widget *t; Ewl_Notebook2 *n; + int idx = 0; DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR("c", c); @@ -487,8 +488,44 @@ DCHECK_TYPE("w", w, EWL_WIDGET_TYPE); n = EWL_NOTEBOOK2(EWL_WIDGET(c)->parent); + + /* do nothing if the notebook is being destroyed */ + if ((ewl_object_flags_has(EWL_OBJECT(n), EWL_FLAG_QUEUED_DPROCESS, + EWL_FLAGS_QUEUED_MASK)) + || (ewl_object_flags_has(EWL_OBJECT(n), + EWL_FLAG_QUEUED_DSCHEDULED, + EWL_FLAGS_QUEUED_MASK))) + DRETURN(DLEVEL_STABLE); + + /* we still have a tab, delete it */ t = ewl_attach_notebook_data_get(w); - if (t) ewl_container_child_remove(EWL_CONTAINER(n->body.tabbar), t); + if (t) + { + idx = ewl_container_child_index_get( + EWL_CONTAINER(n->body.tabbar), t); + + ewl_widget_destroy(t); + } + + /* change visible pages if needed */ + if (w == n->cur_page) + { + Ewl_Widget *page, *new_tab; + + /* if we are before the beginning, subtract one from the index */ + if (idx > 0) idx--; + + new_tab = ewl_container_child_get( + EWL_CONTAINER(n->body.tabbar), idx); + + if (new_tab) + { + page = ewl_attach_notebook_data_get(new_tab); + if (page) + ewl_notebook2_visible_page_set( + EWL_NOTEBOOK2(n), page); + } + } DLEAVE_FUNCTION(DLEVEL_STABLE); } ------------------------------------------------------- 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