Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src


Modified Files:
        ewl_callback.c ewl_callback.h ewl_row.c ewl_row.h 


Log Message:
Filled a whole in the callback API, made the row cleanup after itself
properly.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_callback.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -3 -r1.34 -r1.35
--- ewl_callback.c      19 Nov 2003 20:18:34 -0000      1.34
+++ ewl_callback.c      9 Dec 2003 21:24:03 -0000       1.35
@@ -449,6 +449,47 @@
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
+/**
+ * @param w: the widget to delete the callback
+ * @param t: the type of event associated with the callback
+ * @param f: the function called by the callback
+ * @param d: the data passed to the callback
+ * @brief Delete the specified callback function from the widget
+ *
+ * @return Returns no value.
+ * Delete and frees the callback that calls function @a f when event @a t occurs
+ * to widget @a w.
+ */
+void
+ewl_callback_del_with_data(Ewl_Widget * w, Ewl_Callback_Type t,
+                          Ewl_Callback_Function f, void *d)
+{
+       Ewl_Callback   *cb;
+       Ewd_List       *list;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR("w", w);
+
+       list = EWL_CALLBACK_LIST_POINTER(w, t);
+
+       if (!list || ewd_list_is_empty(list))
+               DRETURN(DLEVEL_STABLE);
+
+       ewd_list_goto_first(list);
+
+       while ((cb = ewd_list_current(list)) != NULL) {
+               if (cb->func == f && cb->user_data == d) {
+                       ewd_list_remove(list);
+                       ewl_callback_unregister(cb);
+                       break;
+               }
+
+               ewd_list_next(list);
+       }
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
 /*
  * Hashes the value of a callback based on it's type, function, and user data.
  */
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_callback.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -3 -r1.28 -r1.29
--- ewl_callback.h      25 Nov 2003 07:47:29 -0000      1.28
+++ ewl_callback.h      9 Dec 2003 21:24:03 -0000       1.29
@@ -108,6 +108,8 @@
 void            ewl_callback_del_type(Ewl_Widget * w, Ewl_Callback_Type t);
 void            ewl_callback_del(Ewl_Widget * w, Ewl_Callback_Type t,
                                 Ewl_Callback_Function f);
+void            ewl_callback_del_with_data(Ewl_Widget * w, Ewl_Callback_Type t,
+                                Ewl_Callback_Function f, void *data);
 
 /**
  * @}
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_row.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -3 -r1.22 -r1.23
--- ewl_row.c   19 Nov 2003 20:18:35 -0000      1.22
+++ ewl_row.c   9 Dec 2003 21:24:03 -0000       1.23
@@ -44,6 +44,9 @@
        ewl_callback_append(EWL_WIDGET(row), EWL_CALLBACK_CONFIGURE,
                        ewl_row_configure_cb, NULL);
 
+       ewl_callback_append(EWL_WIDGET(row), EWL_CALLBACK_DESTROY,
+                       ewl_row_destroy_cb, NULL);
+
        DRETURN_INT(TRUE, DLEVEL_STABLE);
 }
 
@@ -66,10 +69,14 @@
        if (row->header == header)
                DRETURN(DLEVEL_STABLE);
 
-       if (row->header)
-               ewl_callback_del(EWL_WIDGET(row->header),
-                               EWL_CALLBACK_CONFIGURE,
-                               ewl_row_header_configure_cb);
+       if (row->header) {
+               ewl_callback_del_with_data(EWL_WIDGET(row->header),
+                                          EWL_CALLBACK_CONFIGURE,
+                                          ewl_row_header_configure_cb, row);
+               ewl_callback_del_with_data(EWL_WIDGET(row->header),
+                                          EWL_CALLBACK_DESTROY,
+                                          ewl_row_header_destroy_cb, row);
+       }
 
        if (header) {
                ewl_callback_append(EWL_WIDGET(header), EWL_CALLBACK_CONFIGURE,
@@ -191,6 +198,12 @@
        }
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+void
+ewl_row_destroy_cb(Ewl_Widget * w, void *ev_data, void *user_data)
+{
+       ewl_row_set_header(EWL_ROW(w), NULL);
 }
 
 void
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_row.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- ewl_row.h   25 Nov 2003 07:47:29 -0000      1.12
+++ ewl_row.h   9 Dec 2003 21:24:03 -0000       1.13
@@ -23,6 +23,7 @@
  * Internally used callbacks, override at your own risk.
  */
 void ewl_row_configure_cb(Ewl_Widget * w, void *ev_data, void *user_data);
+void ewl_row_destroy_cb(Ewl_Widget * w, void *ev_data, void *user_data);
 void ewl_row_header_configure_cb(Ewl_Widget * w, void *ev_data,
                                 void *user_data);
 void ewl_row_header_destroy_cb(Ewl_Widget * w, void *ev_data,




-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to