Enlightenment CVS committal

Author  : dj2
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        ewl_combo.c ewl_combo.h ewl_menu_base.c ewl_menu_base.h 


Log Message:
- type check/clean combo
- make menubase return on init

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_combo.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- ewl_combo.c 17 Oct 2005 14:45:38 -0000      1.9
+++ ewl_combo.c 23 Oct 2005 17:20:18 -0000      1.10
@@ -20,7 +20,10 @@
                DRETURN_PTR(NULL, DLEVEL_STABLE);
        }
 
-       ewl_combo_init(combo, title);
+       if (!ewl_combo_init(combo, title)) {
+               ewl_widget_destroy(EWL_WIDGET(combo));
+               combo = NULL;
+       }
 
        DRETURN_PTR(EWL_WIDGET(combo), DLEVEL_STABLE);
 }
@@ -28,21 +31,23 @@
 /**
  * @param combo: the combo to initialize
  * @param title: the string displayed in the title
- * @return Returns no value.
+ * @return Returns TRUE on success or FALSE on failure
  * @brief Initialize an internal combo to starting values
  */
-void 
-ewl_combo_init(Ewl_Combo * combo, char *title)
+int 
+ewl_combo_init(Ewl_Combo *combo, char *title)
 {
        Ewl_Container *redirect;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
-       DCHECK_PARAM_PTR("combo", combo);
+       DCHECK_PARAM_PTR_RET("combo", combo, FALSE);
 
        /*
         * Initialize the defaults of the inherited fields.
         */
-       ewl_menu_base_init(EWL_MENU_BASE(combo));
+       if (!ewl_menu_base_init(EWL_MENU_BASE(combo)))
+               DRETURN_INT(FALSE, DLEVEL_STABLE);
+
        ewl_menu_item_text_set(EWL_MENU_ITEM(combo), title);
        ewl_object_fill_policy_set(EWL_OBJECT(combo), EWL_FLAG_FILL_HFILL |
                        EWL_FLAG_FILL_HSHRINK);
@@ -118,7 +123,7 @@
        ewl_object_alignment_set(EWL_OBJECT(combo->base.popup),
                                 EWL_FLAG_ALIGN_LEFT | EWL_FLAG_ALIGN_TOP);
 
-       DLEAVE_FUNCTION(DLEVEL_STABLE);
+       DRETURN_INT(TRUE, DLEVEL_STABLE);
 }
 
 /**
@@ -133,6 +138,8 @@
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("combo", combo);
        DCHECK_PARAM_PTR("item", item);
+       DCHECK_TYPE("combo", combo, "combo");
+       DCHECK_TYPE("item", item, "widget");
 
        combo->selected = item;
        ewl_callback_call_with_event_data(EWL_WIDGET(combo),
@@ -146,10 +153,11 @@
  * @brief Gets the currently selected item
  */
 Ewl_Widget *
-ewl_combo_selected_get(Ewl_Combo * combo)
+ewl_combo_selected_get(Ewl_Combo *combo)
 {
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET("combo", combo, NULL);
+       DCHECK_TYPE_RET("combo", combo, "combo", NULL);
 
        DRETURN_PTR(combo->selected, DLEVEL_STABLE);
 }
@@ -161,6 +169,9 @@
        Ewl_Combo *combo;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR("w", w);
+       DCHECK_PARAM_PTR("user_data", user_data);
+       DCHECK_TYPE("w", w, "widget");
 
        combo = EWL_COMBO(user_data);
 
@@ -185,6 +196,8 @@
        Ewl_Combo *combo;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR("w", w);
+       DCHECK_TYPE("w", w, "widget");
 
        combo = EWL_COMBO(w);
        /*
@@ -210,6 +223,7 @@
        Ewl_Combo *combo;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR("user_data", user_data);
 
        cw = EWL_WIDGET(user_data);
        combo = EWL_COMBO(user_data);
@@ -221,14 +235,17 @@
 }
 
 void
-ewl_combo_expand_cb(Ewl_Widget * w, void *ev_data, void *user_data)
+ewl_combo_expand_cb(Ewl_Widget *w, void *ev_data, void *user_data)
 {
-       Ewl_Combo      *combo;
-       Ewl_Embed      *emb;
-       Ewl_Container    *pb;
-       Ewl_Widget               *child;
+       Ewl_Combo *combo;
+       Ewl_Embed *emb;
+       Ewl_Container *pb;
+       Ewl_Widget *child;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR("w", w);
+       DCHECK_PARAM_PTR("user_data", user_data);
+       DCHECK_TYPE("w", w, "widget");
        
        combo = EWL_COMBO(user_data);
        ewl_widget_appearance_set(combo->button, "increment");
@@ -272,6 +289,7 @@
        Ewl_Combo *combo;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR("user_data", user_data);
 
        combo = EWL_COMBO(user_data);
        ewl_widget_hide(EWL_MENU_BASE(combo)->popup);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_combo.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- ewl_combo.h 21 Jun 2005 02:15:51 -0000      1.4
+++ ewl_combo.h 23 Oct 2005 17:20:18 -0000      1.5
@@ -39,10 +39,10 @@
        Ewl_Widget *selected; /**< An entry that contains the current 
selection. */
 };
 
-Ewl_Widget     *ewl_combo_new(char *title);
-void            ewl_combo_init(Ewl_Combo * combo, char *title);
-Ewl_Widget     *ewl_combo_selected_get(Ewl_Combo * combo);
-void            ewl_combo_selected_set(Ewl_Combo * combo, Ewl_Widget *item);
+Ewl_Widget     *ewl_combo_new(char *title);
+int             ewl_combo_init(Ewl_Combo *combo, char *title);
+Ewl_Widget     *ewl_combo_selected_get(Ewl_Combo *combo);
+void            ewl_combo_selected_set(Ewl_Combo *combo, Ewl_Widget *item);
 
 /*
  * Internally used callbacks, override at your own risk.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_menu_base.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- ewl_menu_base.c     23 Oct 2005 16:05:37 -0000      1.10
+++ ewl_menu_base.c     23 Oct 2005 17:20:18 -0000      1.11
@@ -5,17 +5,17 @@
 
 /**
  * @param menu: the menu item to initialize
- * @return Returns nothing.
+ * @return Returns TRUE on success, FALSE otherwise.
  * @brief Initialize a menu item to default values
  *
  * Sets up the internal variables for the menu item and places the icon from
  * @a image and label from @a title in the menu item.
  */
-void ewl_menu_base_init(Ewl_Menu_Base * menu)
+int ewl_menu_base_init(Ewl_Menu_Base * menu)
 {
        DENTER_FUNCTION(DLEVEL_STABLE);
 
-       DCHECK_PARAM_PTR("menu", menu);
+       DCHECK_PARAM_PTR_RET("menu", menu, FALSE);
 
        /*
         * Initialize the defaults of the inherited fields.
@@ -55,7 +55,7 @@
                                   EWL_CONTAINER(menu->popbox));
        ewl_widget_internal_set(menu->popbox, TRUE);
 
-       DLEAVE_FUNCTION(DLEVEL_STABLE);
+       DRETURN_INT(TRUE, DLEVEL_STABLE);
 }
 
 /**
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_menu_base.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- ewl_menu_base.h     10 Oct 2005 18:43:31 -0000      1.5
+++ ewl_menu_base.h     23 Oct 2005 17:20:18 -0000      1.6
@@ -96,7 +96,7 @@
 Ewl_Widget     *ewl_menu_separator_new(void);
 void            ewl_menu_separator_init(Ewl_Menu_Separator *sep);
 
-void            ewl_menu_base_init(Ewl_Menu_Base * menu);
+int             ewl_menu_base_init(Ewl_Menu_Base *menu);
 
 /*
  * Internally used callbacks, override at your own risk.




-------------------------------------------------------
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