From: Dan Winship Date: Fri, 7 Jul 2000 21:13:41 +0000 (+0000) Subject: Make this return a GPtrArray rather than a GList. X-Git-Tag: upstream/3.7.4~11618 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e38ad18334dd5badb154c75a1712690ec4a14d47;p=platform%2Fupstream%2Fevolution-data-server.git Make this return a GPtrArray rather than a GList. * camel-folder.c (camel_folder_search_by_expression): Make this return a GPtrArray rather than a GList. * camel-folder-search.c (camel_folder_search_execute_expression): * providers/imap/camel-imap-folder.c (imap_search_by_expression): * providers/mbox/camel-mbox-folder.c (mbox_search_by_expression): * providers/nntp/camel-nntp-folder.c (nntp_search_by_expression): Update to return a GPtrArray rather than a GList. --- diff --git a/camel/ChangeLog b/camel/ChangeLog index e628e69..03ecd34 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,14 @@ +2000-07-07 Dan Winship + + * camel-folder.c (camel_folder_search_by_expression): Make this + return a GPtrArray rather than a GList. + + * camel-folder-search.c (camel_folder_search_execute_expression): + * providers/imap/camel-imap-folder.c (imap_search_by_expression): + * providers/mbox/camel-mbox-folder.c (mbox_search_by_expression): + * providers/nntp/camel-nntp-folder.c (nntp_search_by_expression): + Update to return a GPtrArray rather than a GList. + 2000-07-07 Jeffrey Stedfast * providers/smtp/camel-smtp-transport.c (esmtp_get_authtypes): diff --git a/camel/camel-folder-search.c b/camel/camel-folder-search.c index e065316..583316d 100644 --- a/camel/camel-folder-search.c +++ b/camel/camel-folder-search.c @@ -237,25 +237,24 @@ camel_folder_search_set_body_index(CamelFolderSearch *search, ibex *index) * @expr: * @ex: * - * Execute the search expression @expr, returning a list of - * all matches as a GList of uid's of matching messages. + * Execute the search expression @expr, returning an array of + * all matches as a GPtrArray of uid's of matching messages. * * Note that any settings such as set_body_index(), set_folder(), * and so on are reset to #NULL once the search has completed. * - * TODO: The interface should probably return a GPtrArray - * of summary items instead (since they are much more useful - * to any client). + * TODO: The interface should probably return summary items instead + * (since they are much more useful to any client). * - * Return value: A GList of strings of all matching messages. Once + * Return value: A GPtrArray of strings of all matching messages. Once * finished with this, the array AND CONTENTS should be free'd * by the caller. **/ -GList * +GPtrArray * camel_folder_search_execute_expression(CamelFolderSearch *search, const char *expr, CamelException *ex) { ESExpResult *r; - GList *matches = NULL; + GPtrArray *matches = g_ptr_array_new (); int i; /* only re-parse if the search has changed */ @@ -274,7 +273,7 @@ camel_folder_search_execute_expression(CamelFolderSearch *search, const char *ex d(printf("got result ...\n")); for (i=0;ivalue.ptrarray->len;i++) { d(printf("adding match: %s\n", (char *)g_ptr_array_index(r->value.ptrarray, i))); - matches = g_list_prepend(matches, g_strdup(g_ptr_array_index(r->value.ptrarray, i))); + g_ptr_array_add(matches, g_strdup(g_ptr_array_index(r->value.ptrarray, i))); } e_sexp_result_free(r); } else { diff --git a/camel/camel-folder-search.h b/camel/camel-folder-search.h index 8749391..e601eba 100644 --- a/camel/camel-folder-search.h +++ b/camel/camel-folder-search.h @@ -80,6 +80,6 @@ void camel_folder_search_construct (CamelFolderSearch *search); void camel_folder_search_set_folder(CamelFolderSearch *search, CamelFolder *folder); void camel_folder_search_set_summary(CamelFolderSearch *search, GPtrArray *summary); void camel_folder_search_set_body_index(CamelFolderSearch *search, ibex *index); -GList *camel_folder_search_execute_expression(CamelFolderSearch *search, const char *expr, CamelException *ex); +GPtrArray *camel_folder_search_execute_expression(CamelFolderSearch *search, const char *expr, CamelException *ex); #endif /* ! _CAMEL_FOLDER_SEARCH_H */ diff --git a/camel/camel-folder.c b/camel/camel-folder.c index aa5991b..8420bd7 100644 --- a/camel/camel-folder.c +++ b/camel/camel-folder.c @@ -119,8 +119,9 @@ static void delete_message (CamelFolder *folder, static const CamelMessageInfo *get_message_info (CamelFolder *folder, const char *uid); -static GList *search_by_expression (CamelFolder *folder, const char *exp, - CamelException *ex); +static GPtrArray *search_by_expression (CamelFolder *folder, + const char *exp, + CamelException *ex); static void copy_message_to (CamelFolder *source, const char *uid, @@ -1018,7 +1019,7 @@ camel_folder_has_search_capability (CamelFolder *folder) return folder->has_search_capability; } -static GList * +static GPtrArray * search_by_expression (CamelFolder *folder, const char *expression, CamelException *ex) { @@ -1038,7 +1039,7 @@ search_by_expression (CamelFolder *folder, const char *expression, * Return value: a list of uids of matching messages. The caller must * free the list and each of the elements when it is done. **/ -GList * +GPtrArray * camel_folder_search_by_expression (CamelFolder *folder, const char *expression, CamelException *ex) { diff --git a/camel/camel-folder.h b/camel/camel-folder.h index d49a7f7..a7fc8fa 100644 --- a/camel/camel-folder.h +++ b/camel/camel-folder.h @@ -159,9 +159,9 @@ typedef struct { gboolean (*has_search_capability) (CamelFolder *folder); - GList * (*search_by_expression) (CamelFolder *folder, - const char *expression, - CamelException *ex); + GPtrArray * (*search_by_expression) (CamelFolder *folder, + const char *expression, + CamelException *ex); const CamelMessageInfo * (*get_message_info) (CamelFolder *, const char *uid); @@ -203,8 +203,6 @@ CamelFolder * camel_folder_get_parent_folder (CamelFolder *folder, CamelException *ex); CamelStore * camel_folder_get_parent_store (CamelFolder *folder, CamelException *ex); -GList * camel_folder_list_subfolders (CamelFolder *folder, - CamelException *ex); /* delete operations */ @@ -285,9 +283,11 @@ void camel_folder_free_uids (CamelFolder *folder, /* search api */ gboolean camel_folder_has_search_capability (CamelFolder *folder); -GList * camel_folder_search_by_expression (CamelFolder *folder, const char *expression, CamelException *ex); +GPtrArray * camel_folder_search_by_expression (CamelFolder *folder, + const char *expression, + CamelException *ex); -/* summary info. FIXME: rename this slightly? */ +/* summary info */ const CamelMessageInfo *camel_folder_get_message_info (CamelFolder *summary, const char *uid); diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c index baa3831..8922d0d 100644 --- a/camel/providers/imap/camel-imap-folder.c +++ b/camel/providers/imap/camel-imap-folder.c @@ -78,7 +78,7 @@ static void imap_expunge (CamelFolder *folder, CamelException *ex); static const CamelMessageInfo *imap_get_message_info (CamelFolder *folder, const char *uid); -static GList *imap_search_by_expression (CamelFolder *folder, const char *expression, CamelException *ex); +static GPtrArray *imap_search_by_expression (CamelFolder *folder, const char *expression, CamelException *ex); static void imap_finalize (GtkObject *object); @@ -1341,7 +1341,7 @@ imap_get_message_info (CamelFolder *folder, const char *uid) return info; } -static GList * +static GPtrArray * imap_search_by_expression (CamelFolder *folder, const char *expression, CamelException *ex) { return NULL; diff --git a/camel/providers/mbox/camel-mbox-folder.c b/camel/providers/mbox/camel-mbox-folder.c index d7ee9c2..ca313ec 100644 --- a/camel/providers/mbox/camel-mbox-folder.c +++ b/camel/providers/mbox/camel-mbox-folder.c @@ -76,7 +76,7 @@ static void mbox_delete_message (CamelFolder *folder, const gchar *uid, CamelExc static const CamelMessageInfo *mbox_get_message_info (CamelFolder *folder, const char *uid); -static GList *mbox_search_by_expression(CamelFolder *folder, const char *expression, CamelException *ex); +static GPtrArray *mbox_search_by_expression(CamelFolder *folder, const char *expression, CamelException *ex); static guint32 mbox_get_message_flags (CamelFolder *folder, const char *uid, CamelException *ex); static void mbox_set_message_flags (CamelFolder *folder, const char *uid, guint32 flags, guint32 set, CamelException *ex); @@ -496,7 +496,7 @@ mbox_get_message_info (CamelFolder *folder, const char *uid) return camel_folder_summary_uid (CAMEL_FOLDER_SUMMARY (mbox_folder->summary), uid); } -static GList * +static GPtrArray * mbox_search_by_expression (CamelFolder *folder, const char *expression, CamelException *ex) { CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (folder); diff --git a/camel/providers/nntp/camel-nntp-folder.c b/camel/providers/nntp/camel-nntp-folder.c index a3cfc49..033259a 100644 --- a/camel/providers/nntp/camel-nntp-folder.c +++ b/camel/providers/nntp/camel-nntp-folder.c @@ -359,7 +359,7 @@ nntp_folder_free_subfolder_names (CamelFolder *folder, GPtrArray *subfolders) } } -static GList* +static GPtrArray* nntp_folder_search_by_expression (CamelFolder *folder, const char *expression, CamelException *ex) { g_assert (0);