Enlightenment CVS committal

Author  : dj2
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        ewl_radiobutton.c ewl_radiobutton.h 


Log Message:
- formatting/type checking

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_radiobutton.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- ewl_radiobutton.c   3 Oct 2005 06:43:07 -0000       1.4
+++ ewl_radiobutton.c   25 Oct 2005 02:14:01 -0000      1.5
@@ -7,17 +7,21 @@
  * @return Returns a pointer to new radio button on success, NULL on failure.
  * @brief Allocate and initialize a new radio button
  */
-Ewl_Widget     *ewl_radiobutton_new(void)
+Ewl_Widget *
+ewl_radiobutton_new(void)
 {
-       Ewl_RadioButton *b;
+       Ewl_Radiobutton *b;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
 
-       b = NEW(Ewl_RadioButton, 1);
+       b = NEW(Ewl_Radiobutton, 1);
        if (!b)
                DRETURN_PTR(NULL, DLEVEL_STABLE);
 
-       ewl_radiobutton_init(b);
+       if (!ewl_radiobutton_init(b)) {
+               ewl_widget_destroy(EWL_WIDGET(b));
+               b = NULL;
+       }
 
        DRETURN_PTR(EWL_WIDGET(b), DLEVEL_STABLE);
 }
@@ -31,12 +35,14 @@
  * Sets internal fields of the radio button to default
  * values and sets the label to the specified @a label.
  */
-int ewl_radiobutton_init(Ewl_RadioButton * rb)
+int
+ewl_radiobutton_init(Ewl_Radiobutton *rb)
 {
        Ewl_CheckButton *cb;
-       Ewl_Widget     *w;
+       Ewl_Widget *w;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR_RET("rb", rb, FALSE);
 
        cb = EWL_CHECKBUTTON(rb);
        w = EWL_WIDGET(rb);
@@ -47,7 +53,7 @@
        ewl_widget_appearance_set(cb->check, "radio");
        ewl_callback_append(w, EWL_CALLBACK_CLICKED, ewl_radiobutton_clicked_cb,
                            NULL);
-       ewl_callback_append(w, EWL_CALLBACK_DESTROY, ewl_radiobutton_destroy_cb,
+       ewl_callback_prepend(w, EWL_CALLBACK_DESTROY, 
ewl_radiobutton_destroy_cb,
                            NULL);
 
        DRETURN_INT(TRUE, DLEVEL_STABLE);
@@ -62,11 +68,14 @@
  * Associates @a w with the same chain as @a c, in order to
  * ensure that only one radio button of that group is checked at any time.
  */
-void ewl_radiobutton_chain_set(Ewl_RadioButton *rb, Ewl_RadioButton *crb)
+void
+ewl_radiobutton_chain_set(Ewl_Radiobutton *rb, Ewl_Radiobutton *crb)
 {
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("rb", rb);
        DCHECK_PARAM_PTR("crb", crb);
+       DCHECK_TYPE("rb", rb, "radiobutton");
+       DCHECK_TYPE("crb", crb, "radiobutton");
 
        /*
         * If a chain doesnt exist, create one 
@@ -87,15 +96,17 @@
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
-void ewl_radiobutton_clicked_cb(Ewl_Widget * w, void *ev_data __UNUSED__,
-                                               void *user_data __UNUSED__)
+void
+ewl_radiobutton_clicked_cb(Ewl_Widget *w, void *ev_data __UNUSED__,
+                                       void *user_data __UNUSED__)
 {
        Ewl_CheckButton *cb;
-       Ewl_RadioButton *rb;
-       int             oc;
+       Ewl_Radiobutton *rb;
+       int oc;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("w", w);
+       DCHECK_TYPE("w", w, "widget");
 
        cb = EWL_CHECKBUTTON(w);
        rb = EWL_RADIOBUTTON(w);
@@ -105,12 +116,10 @@
                Ewl_CheckButton *c;
 
                ecore_list_goto_first(rb->chain);
-
                while ((c = ecore_list_next(rb->chain)) != NULL) {
                        ewl_checkbutton_checked_set(c, 0);
                }
        }
-
        ewl_checkbutton_checked_set(cb, 1);
 
        if (oc != ewl_checkbutton_is_checked(cb))
@@ -119,12 +128,15 @@
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
-void ewl_radiobutton_destroy_cb(Ewl_Widget * w, void *ev_data __UNUSED__,
-                                               void *user_data __UNUSED__)
+void
+ewl_radiobutton_destroy_cb(Ewl_Widget *w, void *ev_data __UNUSED__,
+                                       void *user_data __UNUSED__)
 {
-       Ewl_RadioButton *rb;
+       Ewl_Radiobutton *rb;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR("w", w);
+       DCHECK_TYPE("w", w, "widget");
 
        rb = EWL_RADIOBUTTON(w);
 
@@ -141,3 +153,4 @@
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
+
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_radiobutton.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- ewl_radiobutton.h   3 Oct 2005 06:43:07 -0000       1.3
+++ ewl_radiobutton.h   25 Oct 2005 02:14:01 -0000      1.4
@@ -3,7 +3,7 @@
 
 /**
  * @file ewl_radiobutton.h
- * @defgroup Ewl_RadioButton RadioButton: A Radio Button Widget and Grouping 
System
+ * @defgroup Ewl_Radiobutton Radiobutton: A Radio Button Widget and Grouping 
System
  * Provides for a simple radiobutton with label, and to group radio buttons
  * for selecting a single option.
  *
@@ -19,26 +19,28 @@
  * The radio button provides a means for selecting a single item from a group
  * of options.
  */
-typedef struct Ewl_RadioButton Ewl_RadioButton;
+typedef struct Ewl_Radiobutton Ewl_Radiobutton;
 
 /**
  * @def EWL_RADIOBUTTON(button)
- * Typecasts a pointer to an Ewl_RadioButton pointer.
+ * Typecasts a pointer to an Ewl_Radiobutton pointer.
  */
-#define EWL_RADIOBUTTON(button) ((Ewl_RadioButton *) button)
+#define EWL_RADIOBUTTON(button) ((Ewl_Radiobutton *) button)
 
 /**
  * Inherits from  Ewl_CheckButton and extends it to provide grouping buttons
  * to limit to a single selection in a group at a given time.
  */
-struct Ewl_RadioButton
+struct Ewl_Radiobutton
 {
-       Ewl_CheckButton button; /**< Inherit from Ewl_CheckButton */
+       Ewl_CheckButton   button; /**< Inherit from Ewl_CheckButton */
        Ecore_List       *chain; /**< List of members of the group */
 };
 
 Ewl_Widget     *ewl_radiobutton_new(void);
-int             ewl_radiobutton_init(Ewl_RadioButton * cb);
+int             ewl_radiobutton_init(Ewl_Radiobutton *cb);
+
+void            ewl_radiobutton_chain_set(Ewl_Radiobutton *w, Ewl_Radiobutton 
*c);
 
 /**
  * @def ewl_radiobutton_checked_set(r, c)
@@ -55,15 +57,12 @@
  */
 #define ewl_radiobutton_is_checked(r) \
        ewl_checkbutton_is_checked(EWL_CHECKBUTTON(r))
-void            ewl_radiobutton_chain_set(Ewl_RadioButton * w, Ewl_RadioButton 
* c);
 
 /*
  * Internally used callbacks, override at your own risk.
  */
-void            ewl_radiobutton_clicked_cb(Ewl_Widget * w, void *ev_data,
-                                          void *user_data);
-void            ewl_radiobutton_destroy_cb(Ewl_Widget * w, void *ev_data,
-                                          void *user_data);
+void ewl_radiobutton_clicked_cb(Ewl_Widget *w, void *ev_data, void *user_data);
+void ewl_radiobutton_destroy_cb(Ewl_Widget *w, void *ev_data, void *user_data);
 
 /**
  * @}




-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to