Enlightenment CVS committal

Author  : dj2
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        ewl_highlight.c ewl_mvc.c 


Log Message:
- with the highlight parent is destroyed the highlight will be destroyed in
  a callback. this callback would then trigger the highlight destroy
  callback which would try to do stuff but the highlight is already
  destroyed. remove callback before calling _destroy()

- make sure the mvc catches the fact that a highlight has been destroyed and
  correctly cleans up it's internal lists

===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_highlight.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- ewl_highlight.c     1 Apr 2007 21:48:06 -0000       1.6
+++ ewl_highlight.c     25 Apr 2007 21:29:08 -0000      1.7
@@ -127,6 +127,8 @@
        DCHECK_TYPE("data", data, EWL_HIGHLIGHT_TYPE);
 
        ewl_floater_follow_set(EWL_FLOATER(data), NULL);
+       ewl_callback_del(EWL_WIDGET(data), EWL_CALLBACK_DESTROY,
+                                       ewl_highlight_cb_destroy);
        ewl_widget_destroy(EWL_WIDGET(data));
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
@@ -138,7 +140,7 @@
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("w", w);
        DCHECK_PARAM_PTR("data", data);
-       DCHECK_TYPE("w", w, EWL_FLOATER_TYPE);
+       DCHECK_TYPE("w", w, EWL_HIGHLIGHT_TYPE);
        DCHECK_TYPE("data", data, EWL_WIDGET_TYPE);
 
        ewl_floater_follow_set(EWL_FLOATER(w), NULL);
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_mvc.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -3 -r1.22 -r1.23
--- ewl_mvc.c   24 Apr 2007 21:03:19 -0000      1.22
+++ ewl_mvc.c   25 Apr 2007 21:29:08 -0000      1.23
@@ -27,6 +27,8 @@
                                        unsigned int row, unsigned int column);
 static void ewl_mvc_cb_sel_free(void *data);
 
+static void ewl_mvc_cb_highlight_destroy(Ewl_Widget *w, void *ev, void *data);
+
 /**
  * @param mvc: The MVC to initialize
  * @return Returns TRUE on success or FALSE if unsuccessful
@@ -1144,6 +1146,8 @@
        h = ewl_highlight_new();
        ewl_highlight_follow_set(EWL_HIGHLIGHT(h), w);
        ewl_container_child_append(EWL_CONTAINER(c), h);
+       ewl_callback_prepend(h, EWL_CALLBACK_DESTROY, 
+                       ewl_mvc_cb_highlight_destroy, sel);
        ewl_widget_show(h);
 
        if (sel->type == EWL_SELECTION_TYPE_INDEX)
@@ -1187,5 +1191,29 @@
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
+
+static void
+ewl_mvc_cb_highlight_destroy(Ewl_Widget *w, void *ev, void *data)
+{
+       Ewl_Selection *sel;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       sel = data;
+       if (sel->type == EWL_SELECTION_TYPE_INDEX)
+               sel->highlight = NULL;
+       
+       else
+       {
+               Ewl_Widget *cur;
+
+               ecore_list_goto(sel->highlight, w);
+               cur = ecore_list_current(sel->highlight);
+               if (cur == w) ecore_list_remove(sel->highlight);
+       }
+       
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
 
 



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to