[evolution-data-server/tintou/camel-traverse] camel: Define CamelProviderAutoDetectFunc



commit c7b2156c5dc9147ab76bfb6025f982c5a058d4dc
Author: Corentin Noël <corentin noel collabora com>
Date:   Mon Jan 20 12:44:23 2020 +0100

    camel: Define CamelProviderAutoDetectFunc
    
    Allow camel_message_content_info_traverse to be binding-friendly by properly defining a callback type.
    
    Add documentation to the callback and the function itself.

 src/camel/camel-mime-part-utils.c | 19 ++++++++++++-------
 src/camel/camel-mime-part-utils.h | 20 +++++++++++++++++---
 2 files changed, 29 insertions(+), 10 deletions(-)
---
diff --git a/src/camel/camel-mime-part-utils.c b/src/camel/camel-mime-part-utils.c
index 580230699..81265fe91 100644
--- a/src/camel/camel-mime-part-utils.c
+++ b/src/camel/camel-mime-part-utils.c
@@ -319,15 +319,20 @@ camel_message_content_info_new_from_headers (const CamelNameValueArray *headers)
        return ci;
 }
 
-/* Calls the @func for each ci, including the top one. The @func can return TRUE to
-   continue processing or FALSE to stop it.
-   The function returns FALSE on error or when the @func returned FALSE, otherwise
-   it returns TRUE. */
+/**
+ * camel_message_content_info_traverse:
+ * @ci: a #CamelMessageContentInfo
+ * @func: (scope call): a #CamelMessageContentInfoTraverseCallback
+ * @user_data: user data passed to @func
+ *
+ * Calls the @func for each #CamelMessageContentInfo, including the top one.
+ * The @func can return %TRUE to continue processing or %FALSE to stop it.
+ *
+ * Returns: %FALSE on error or when the @func returned %FALSE, otherwise %TRUE
+ **/
 gboolean
 camel_message_content_info_traverse (CamelMessageContentInfo *ci,
-                                    gboolean (* func) (CamelMessageContentInfo *ci,
-                                                       gint depth,
-                                                       gpointer user_data),
+                                    CamelMessageContentInfoTraverseCallback func,
                                     gpointer user_data)
 {
        CamelMessageContentInfo *next, *cur;
diff --git a/src/camel/camel-mime-part-utils.h b/src/camel/camel-mime-part-utils.h
index da6d22684..6f77c24ed 100644
--- a/src/camel/camel-mime-part-utils.h
+++ b/src/camel/camel-mime-part-utils.h
@@ -38,6 +38,22 @@ gboolean     camel_mime_part_construct_content_from_parser
 
 typedef struct _CamelMessageContentInfo CamelMessageContentInfo;
 
+/**
+ * CamelMessageContentInfoTraverseCallback:
+ * @ci: a #CamelMessageContentInfo
+ * @depth: the current depth
+ * @user_data: data passed to camel_message_content_info_traverse()
+ *
+ * This is the callback signature for camel_message_content_info_traverse().
+ *
+ * Returns: %TRUE to continue processing or %FALSE to stop it.
+ *
+ * Since: 3.36
+ **/
+typedef gboolean       (*CamelMessageContentInfoTraverseCallback)      (CamelMessageContentInfo *ci,
+                                                                        gint depth,
+                                                                        gpointer user_data);
+
 /* A tree of message content info structures
  * describe the content structure of the message (if it has any) */
 struct _CamelMessageContentInfo {
@@ -72,9 +88,7 @@ CamelMessageContentInfo *
                                                (CamelMimePart *mime_part);
 gboolean       camel_message_content_info_traverse
                                                (CamelMessageContentInfo *ci,
-                                                gboolean (* func) (CamelMessageContentInfo *ci,
-                                                                   gint depth,
-                                                                   gpointer user_data),
+                                                CamelMessageContentInfoTraverseCallback func,
                                                 gpointer user_data);
 /* debugging functions */
 void           camel_message_content_info_dump (CamelMessageContentInfo *ci,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]