Improve callbacks readability in elm_entry, elm_anchorblock and elm_anchorview 
using typedefs.

typedef Evas_Object* (*Elm_Entry_Item_Provider_Cb) (void *data, Evas_Object * 
entry, const char *item);

impacts
 - elm_entry.h
 - elm_entry.c
 - elc_anchorblock.h
 - elc_anchorblock.c
 - elc_anchorview.h
 - elc_anchorview.c

Jeremy
diff -Naur orig/elc_anchorblock.c trunk/elc_anchorblock.c
--- orig/elc_anchorblock.c      2012-02-29 12:35:17.713500727 +0100
+++ trunk/elc_anchorblock.c     2012-02-29 12:34:34.650167606 +0100
@@ -15,7 +15,7 @@
 
 struct _Elm_Anchorblock_Item_Provider
 {
-   Evas_Object *(*func) (void *data, Evas_Object *anchorblock, const char 
*item);
+   Elm_Entry_Item_Provider_Cb func;
    void *data;
 };
 
@@ -303,7 +303,7 @@
 }
 
 EAPI void
-elm_anchorblock_item_provider_append(Evas_Object *obj, Evas_Object *(*func) 
(void *data, Evas_Object *anchorblock, const char *item), void *data)
+elm_anchorblock_item_provider_append(Evas_Object *obj, 
Elm_Entry_Item_Provider_Cb func, void *data)
 {
    ELM_CHECK_WIDTYPE(obj, widtype);
    Widget_Data *wd = elm_widget_data_get(obj);
@@ -317,7 +317,7 @@
 }
 
 EAPI void
-elm_anchorblock_item_provider_prepend(Evas_Object *obj, Evas_Object *(*func) 
(void *data, Evas_Object *anchorblock, const char *item), void *data)
+elm_anchorblock_item_provider_prepend(Evas_Object *obj, 
Elm_Entry_Item_Provider_Cb func, void *data)
 {
    ELM_CHECK_WIDTYPE(obj, widtype);
    Widget_Data *wd = elm_widget_data_get(obj);
@@ -331,7 +331,7 @@
 }
 
 EAPI void
-elm_anchorblock_item_provider_remove(Evas_Object *obj, Evas_Object *(*func) 
(void *data, Evas_Object *anchorblock, const char *item), void *data)
+elm_anchorblock_item_provider_remove(Evas_Object *obj, 
Elm_Entry_Item_Provider_Cb func, void *data)
 {
    ELM_CHECK_WIDTYPE(obj, widtype);
    Widget_Data *wd = elm_widget_data_get(obj);
diff -Naur orig/elc_anchorblock.h trunk/elc_anchorblock.h
--- orig/elc_anchorblock.h      2012-02-29 12:35:19.386834050 +0100
+++ trunk/elc_anchorblock.h     2012-02-29 12:34:36.963500999 +0100
@@ -170,7 +170,7 @@
  *
  * @see elm_entry_item_provider_append()
  */
-EAPI void                        
elm_anchorblock_item_provider_append(Evas_Object *obj, Evas_Object * 
(*func)(void *data, Evas_Object * anchorblock, const char *item), void *data);
+EAPI void                        
elm_anchorblock_item_provider_append(Evas_Object *obj, 
Elm_Entry_Item_Provider_Cb func, void *data);
 
 /**
  * Prepend a custom item provider to the given anchorblock
@@ -182,7 +182,7 @@
  * @param func The function to add to the list of providers
  * @param data User data that will be passed to the callback function
  */
-EAPI void                        
elm_anchorblock_item_provider_prepend(Evas_Object *obj, Evas_Object * 
(*func)(void *data, Evas_Object * anchorblock, const char *item), void *data);
+EAPI void                        
elm_anchorblock_item_provider_prepend(Evas_Object *obj, 
Elm_Entry_Item_Provider_Cb func, void *data);
 
 /**
  * Remove a custom item provider from the list of the given anchorblock
@@ -197,7 +197,7 @@
  * @param func The function to remove from the list
  * @param data The data matching the function to remove from the list
  */
-EAPI void                        
elm_anchorblock_item_provider_remove(Evas_Object *obj, Evas_Object * 
(*func)(void *data, Evas_Object * anchorblock, const char *item), void *data);
+EAPI void                        
elm_anchorblock_item_provider_remove(Evas_Object *obj, 
Elm_Entry_Item_Provider_Cb func, void *data);
 
 /**
  * @}
diff -Naur orig/elm_entry.c trunk/elm_entry.c
--- orig/elm_entry.c    2012-02-29 12:35:10.706834284 +0100
+++ trunk/elm_entry.c   2012-02-29 12:34:23.540167667 +0100
@@ -91,7 +91,7 @@
 
 struct _Elm_Entry_Item_Provider
 {
-   Evas_Object *(*func) (void *data, Evas_Object *entry, const char *item);
+   Elm_Entry_Item_Provider_Cb func;
    void *data;
 };
 
@@ -2973,7 +2973,7 @@
 }
 
 EAPI void
-elm_entry_item_provider_append(Evas_Object *obj, Evas_Object *(*func) (void 
*data, Evas_Object *entry, const char *item), void *data)
+elm_entry_item_provider_append(Evas_Object *obj, Elm_Entry_Item_Provider_Cb 
func, void *data)
 {
    ELM_CHECK_WIDTYPE(obj, widtype);
    Widget_Data *wd = elm_widget_data_get(obj);
@@ -2987,7 +2987,7 @@
 }
 
 EAPI void
-elm_entry_item_provider_prepend(Evas_Object *obj, Evas_Object *(*func) (void 
*data, Evas_Object *entry, const char *item), void *data)
+elm_entry_item_provider_prepend(Evas_Object *obj, Elm_Entry_Item_Provider_Cb 
func , void *data)
 {
    ELM_CHECK_WIDTYPE(obj, widtype);
    Widget_Data *wd = elm_widget_data_get(obj);
@@ -3001,7 +3001,7 @@
 }
 
 EAPI void
-elm_entry_item_provider_remove(Evas_Object *obj, Evas_Object *(*func) (void 
*data, Evas_Object *entry, const char *item), void *data)
+elm_entry_item_provider_remove(Evas_Object *obj, Elm_Entry_Item_Provider_Cb 
func, void *data)
 {
    ELM_CHECK_WIDTYPE(obj, widtype);
    Widget_Data *wd = elm_widget_data_get(obj);
diff -Naur orig/elm_entry.h trunk/elm_entry.h
--- orig/elm_entry.h    2012-02-29 12:35:12.443500770 +0100
+++ trunk/elm_entry.h   2012-02-29 12:34:26.980167652 +0100
@@ -380,6 +380,8 @@
  */
 typedef void (*Elm_Entry_Filter_Cb)(void *data, Evas_Object *entry, char 
**text);
 
+typedef Evas_Object* (*Elm_Entry_Item_Provider_Cb) (void *data, Evas_Object * 
entry, const char *item);
+
 /**
  * @typedef Elm_Entry_Change_Info
  * This corresponds to Edje_Entry_Change_Info. Includes information about
@@ -880,7 +882,7 @@
  *
  * @see @ref entry-items
  */
-EAPI void               elm_entry_item_provider_append(Evas_Object *obj, 
Evas_Object * (*func)(void *data, Evas_Object * entry, const char *item), void 
*data);
+EAPI void               elm_entry_item_provider_append(Evas_Object *obj, 
Elm_Entry_Item_Provider_Cb func, void *data);
 
 /**
  * This prepends a custom item provider to the list for that entry
@@ -892,7 +894,7 @@
  * @param func The function called to provide the item object
  * @param data The data passed to @p func
  */
-EAPI void               elm_entry_item_provider_prepend(Evas_Object *obj, 
Evas_Object * (*func)(void *data, Evas_Object * entry, const char *item), void 
*data);
+EAPI void               elm_entry_item_provider_prepend(Evas_Object *obj, 
Elm_Entry_Item_Provider_Cb func, void *data);
 
 /**
  * This removes a custom item provider to the list for that entry
@@ -904,7 +906,7 @@
  * @param func The function called to provide the item object
  * @param data The data passed to @p func
  */
-EAPI void               elm_entry_item_provider_remove(Evas_Object *obj, 
Evas_Object * (*func)(void *data, Evas_Object * entry, const char *item), void 
*data);
+EAPI void               elm_entry_item_provider_remove(Evas_Object *obj, 
Elm_Entry_Item_Provider_Cb func, void *data);
 
 /**
  * Append a markup filter function for text inserted in the entry
diff --git a/elementary/src/lib/elc_anchorblock.c 
b/elementary/src/lib/elc_anchorblock.c
index fe1866a..11352c2 100644
--- a/elementary/src/lib/elc_anchorblock.c
+++ b/elementary/src/lib/elc_anchorblock.c
@@ -15,7 +15,7 @@ struct _Widget_Data
 
 struct _Elm_Anchorblock_Item_Provider
 {
-   Evas_Object *(*func) (void *data, Evas_Object *anchorblock, const char 
*item);
+   Elm_Entry_Item_Provider_Cb func;
    void *data;
 };
 
@@ -303,7 +303,7 @@ elm_anchorblock_hover_end(Evas_Object *obj)
 }
 
 EAPI void
-elm_anchorblock_item_provider_append(Evas_Object *obj, Evas_Object *(*func) 
(void *data, Evas_Object *anchorblock, const char *item), void *data)
+elm_anchorblock_item_provider_append(Evas_Object *obj, 
Elm_Entry_Item_Provider_Cb func, void *data)
 {
    ELM_CHECK_WIDTYPE(obj, widtype);
    Widget_Data *wd = elm_widget_data_get(obj);
@@ -317,7 +317,7 @@ elm_anchorblock_item_provider_append(Evas_Object *obj, 
Evas_Object *(*func) (voi
 }
 
 EAPI void
-elm_anchorblock_item_provider_prepend(Evas_Object *obj, Evas_Object *(*func) 
(void *data, Evas_Object *anchorblock, const char *item), void *data)
+elm_anchorblock_item_provider_prepend(Evas_Object *obj, 
Elm_Entry_Item_Provider_Cb func, void *data)
 {
    ELM_CHECK_WIDTYPE(obj, widtype);
    Widget_Data *wd = elm_widget_data_get(obj);
@@ -331,7 +331,7 @@ elm_anchorblock_item_provider_prepend(Evas_Object *obj, 
Evas_Object *(*func) (vo
 }
 
 EAPI void
-elm_anchorblock_item_provider_remove(Evas_Object *obj, Evas_Object *(*func) 
(void *data, Evas_Object *anchorblock, const char *item), void *data)
+elm_anchorblock_item_provider_remove(Evas_Object *obj, 
Elm_Entry_Item_Provider_Cb func, void *data)
 {
    ELM_CHECK_WIDTYPE(obj, widtype);
    Widget_Data *wd = elm_widget_data_get(obj);
diff --git a/elementary/src/lib/elc_anchorblock.h 
b/elementary/src/lib/elc_anchorblock.h
index 6d24699..32664e7 100644
--- a/elementary/src/lib/elc_anchorblock.h
+++ b/elementary/src/lib/elc_anchorblock.h
@@ -170,7 +170,7 @@ EAPI void                        
elm_anchorblock_hover_end(Evas_Object *obj);
  *
  * @see elm_entry_item_provider_append()
  */
-EAPI void                        
elm_anchorblock_item_provider_append(Evas_Object *obj, Evas_Object * 
(*func)(void *data, Evas_Object * anchorblock, const char *item), void *data);
+EAPI void                        
elm_anchorblock_item_provider_append(Evas_Object *obj, 
Elm_Entry_Item_Provider_Cb func, void *data);
 
 /**
  * Prepend a custom item provider to the given anchorblock
@@ -182,7 +182,7 @@ EAPI void                        
elm_anchorblock_item_provider_append(Evas_Objec
  * @param func The function to add to the list of providers
  * @param data User data that will be passed to the callback function
  */
-EAPI void                        
elm_anchorblock_item_provider_prepend(Evas_Object *obj, Evas_Object * 
(*func)(void *data, Evas_Object * anchorblock, const char *item), void *data);
+EAPI void                        
elm_anchorblock_item_provider_prepend(Evas_Object *obj, 
Elm_Entry_Item_Provider_Cb func, void *data);
 
 /**
  * Remove a custom item provider from the list of the given anchorblock
@@ -197,7 +197,7 @@ EAPI void                        
elm_anchorblock_item_provider_prepend(Evas_Obje
  * @param func The function to remove from the list
  * @param data The data matching the function to remove from the list
  */
-EAPI void                        
elm_anchorblock_item_provider_remove(Evas_Object *obj, Evas_Object * 
(*func)(void *data, Evas_Object * anchorblock, const char *item), void *data);
+EAPI void                        
elm_anchorblock_item_provider_remove(Evas_Object *obj, 
Elm_Entry_Item_Provider_Cb func, void *data);
 
 /**
  * @}
diff --git a/elementary/src/lib/elc_anchorview.c 
b/elementary/src/lib/elc_anchorview.c
index ebe9528..de05ada 100644
--- a/elementary/src/lib/elc_anchorview.c
+++ b/elementary/src/lib/elc_anchorview.c
@@ -15,7 +15,7 @@ struct _Widget_Data
 
 struct _Elm_Anchorview_Item_Provider
 {
-   Evas_Object *(*func) (void *data, Evas_Object *anchorview, const char 
*item);
+   Elm_Entry_Item_Provider_Cb func;
    void *data;
 };
 
@@ -318,7 +318,7 @@ elm_anchorview_bounce_get(const Evas_Object *obj, Eina_Bool 
*h_bounce, Eina_Bool
 }
 
 EAPI void
-elm_anchorview_item_provider_append(Evas_Object *obj, Evas_Object *(*func) 
(void *data, Evas_Object *anchorview, const char *item), void *data)
+elm_anchorview_item_provider_append(Evas_Object *obj, 
Elm_Entry_Item_Provider_Cb func, void *data)
 {
    ELM_CHECK_WIDTYPE(obj, widtype);
    Widget_Data *wd = elm_widget_data_get(obj);
@@ -332,7 +332,7 @@ elm_anchorview_item_provider_append(Evas_Object *obj, 
Evas_Object *(*func) (void
 }
 
 EAPI void
-elm_anchorview_item_provider_prepend(Evas_Object *obj, Evas_Object *(*func) 
(void *data, Evas_Object *anchorview, const char *item), void *data)
+elm_anchorview_item_provider_prepend(Evas_Object *obj, 
Elm_Entry_Item_Provider_Cb func, void *data)
 {
    ELM_CHECK_WIDTYPE(obj, widtype);
    Widget_Data *wd = elm_widget_data_get(obj);
@@ -346,7 +346,7 @@ elm_anchorview_item_provider_prepend(Evas_Object *obj, 
Evas_Object *(*func) (voi
 }
 
 EAPI void
-elm_anchorview_item_provider_remove(Evas_Object *obj, Evas_Object *(*func) 
(void *data, Evas_Object *anchorview, const char *item), void *data)
+elm_anchorview_item_provider_remove(Evas_Object *obj, 
Elm_Entry_Item_Provider_Cb func, void *data)
 {
    ELM_CHECK_WIDTYPE(obj, widtype);
    Widget_Data *wd = elm_widget_data_get(obj);
diff --git a/elementary/src/lib/elc_anchorview.h 
b/elementary/src/lib/elc_anchorview.h
index 5e426f3..1803d5f 100644
--- a/elementary/src/lib/elc_anchorview.h
+++ b/elementary/src/lib/elc_anchorview.h
@@ -196,7 +196,7 @@ EAPI void                        
elm_anchorview_bounce_get(const Evas_Object *ob
  *
  * @see elm_entry_item_provider_append()
  */
-EAPI void                        
elm_anchorview_item_provider_append(Evas_Object *obj, Evas_Object * 
(*func)(void *data, Evas_Object * anchorview, const char *item), void *data);
+EAPI void                        
elm_anchorview_item_provider_append(Evas_Object *obj, 
Elm_Entry_Item_Provider_Cb func, void *data);
 
 /**
  * Prepend a custom item provider to the given anchorview
@@ -208,7 +208,7 @@ EAPI void                        
elm_anchorview_item_provider_append(Evas_Object
  * @param func The function to add to the list of providers
  * @param data User data that will be passed to the callback function
  */
-EAPI void                        
elm_anchorview_item_provider_prepend(Evas_Object *obj, Evas_Object * 
(*func)(void *data, Evas_Object * anchorview, const char *item), void *data);
+EAPI void                        
elm_anchorview_item_provider_prepend(Evas_Object *obj, 
Elm_Entry_Item_Provider_Cb func, void *data);
 
 /**
  * Remove a custom item provider from the list of the given anchorview
@@ -223,7 +223,7 @@ EAPI void                        
elm_anchorview_item_provider_prepend(Evas_Objec
  * @param func The function to remove from the list
  * @param data The data matching the function to remove from the list
  */
-EAPI void                        
elm_anchorview_item_provider_remove(Evas_Object *obj, Evas_Object * 
(*func)(void *data, Evas_Object * anchorview, const char *item), void *data);
+EAPI void                        
elm_anchorview_item_provider_remove(Evas_Object *obj, 
Elm_Entry_Item_Provider_Cb func, void *data);
 
 /**
  * @}
diff --git a/elementary/src/lib/elm_entry.c b/elementary/src/lib/elm_entry.c
index d701442..1661a71 100644
--- a/elementary/src/lib/elm_entry.c
+++ b/elementary/src/lib/elm_entry.c
@@ -91,7 +91,7 @@ struct _Elm_Entry_Context_Menu_Item
 
 struct _Elm_Entry_Item_Provider
 {
-   Evas_Object *(*func) (void *data, Evas_Object *entry, const char *item);
+   Elm_Entry_Item_Provider_Cb func;
    void *data;
 };
 
@@ -2973,7 +2973,7 @@ elm_entry_context_menu_disabled_get(const Evas_Object 
*obj)
 }
 
 EAPI void
-elm_entry_item_provider_append(Evas_Object *obj, Evas_Object *(*func) (void 
*data, Evas_Object *entry, const char *item), void *data)
+elm_entry_item_provider_append(Evas_Object *obj, Elm_Entry_Item_Provider_Cb 
func, void *data)
 {
    ELM_CHECK_WIDTYPE(obj, widtype);
    Widget_Data *wd = elm_widget_data_get(obj);
@@ -2987,7 +2987,7 @@ elm_entry_item_provider_append(Evas_Object *obj, 
Evas_Object *(*func) (void *dat
 }
 
 EAPI void
-elm_entry_item_provider_prepend(Evas_Object *obj, Evas_Object *(*func) (void 
*data, Evas_Object *entry, const char *item), void *data)
+elm_entry_item_provider_prepend(Evas_Object *obj, Elm_Entry_Item_Provider_Cb 
func , void *data)
 {
    ELM_CHECK_WIDTYPE(obj, widtype);
    Widget_Data *wd = elm_widget_data_get(obj);
@@ -3001,7 +3001,7 @@ elm_entry_item_provider_prepend(Evas_Object *obj, 
Evas_Object *(*func) (void *da
 }
 
 EAPI void
-elm_entry_item_provider_remove(Evas_Object *obj, Evas_Object *(*func) (void 
*data, Evas_Object *entry, const char *item), void *data)
+elm_entry_item_provider_remove(Evas_Object *obj, Elm_Entry_Item_Provider_Cb 
func, void *data)
 {
    ELM_CHECK_WIDTYPE(obj, widtype);
    Widget_Data *wd = elm_widget_data_get(obj);
diff --git a/elementary/src/lib/elm_entry.h b/elementary/src/lib/elm_entry.h
index 18f9820..1301348 100644
--- a/elementary/src/lib/elm_entry.h
+++ b/elementary/src/lib/elm_entry.h
@@ -369,6 +369,18 @@ struct _Elm_Entry_Anchor_Info
 };
 
 /**
+ * @typedef Elm_Entry_Item_Provider_Cb
+ * This callback type is used by entry item provider to provide items.
+ * @param data The data specified as the last param when adding the provider
+ * @param entry The entry object
+ * @param item The item href string in the text.
+ * @see elm_entry_item_provider_append
+ * @see elm_entry_item_provider_prepend
+ * @see elm_entry_item_provider_remove
+ */
+typedef Evas_Object* (*Elm_Entry_Item_Provider_Cb) (void *data, Evas_Object * 
entry, const char *item);
+
+/**
  * @typedef Elm_Entry_Filter_Cb
  * This callback type is used by entry filters to modify text.
  * @param data The data specified as the last param when adding the filter
@@ -880,7 +892,7 @@ EAPI Eina_Bool          
elm_entry_context_menu_disabled_get(const Evas_Object *o
  *
  * @see @ref entry-items
  */
-EAPI void               elm_entry_item_provider_append(Evas_Object *obj, 
Evas_Object * (*func)(void *data, Evas_Object * entry, const char *item), void 
*data);
+EAPI void               elm_entry_item_provider_append(Evas_Object *obj, 
Elm_Entry_Item_Provider_Cb func, void *data);
 
 /**
  * This prepends a custom item provider to the list for that entry
@@ -892,7 +904,7 @@ EAPI void               
elm_entry_item_provider_append(Evas_Object *obj, Evas_Ob
  * @param func The function called to provide the item object
  * @param data The data passed to @p func
  */
-EAPI void               elm_entry_item_provider_prepend(Evas_Object *obj, 
Evas_Object * (*func)(void *data, Evas_Object * entry, const char *item), void 
*data);
+EAPI void               elm_entry_item_provider_prepend(Evas_Object *obj, 
Elm_Entry_Item_Provider_Cb func, void *data);
 
 /**
  * This removes a custom item provider to the list for that entry
@@ -904,7 +916,7 @@ EAPI void               
elm_entry_item_provider_prepend(Evas_Object *obj, Evas_O
  * @param func The function called to provide the item object
  * @param data The data passed to @p func
  */
-EAPI void               elm_entry_item_provider_remove(Evas_Object *obj, 
Evas_Object * (*func)(void *data, Evas_Object * entry, const char *item), void 
*data);
+EAPI void               elm_entry_item_provider_remove(Evas_Object *obj, 
Elm_Entry_Item_Provider_Cb func, void *data);
 
 /**
  * Append a markup filter function for text inserted in the entry
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to