X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fmodest-pair.h;h=f2deaf33cb492cdc83011e51780da717cc19c12c;hp=4e23d14493bd8b2e7b7eec44d0d2530321a3e29c;hb=4d39841513a3a7f7aa9d38ab97cb9fcc9171e80b;hpb=fd0987fe062d13dcd572a0f1bb9787a5edda1f7a diff --git a/src/modest-pair.h b/src/modest-pair.h index 4e23d14..f2deaf3 100644 --- a/src/modest-pair.h +++ b/src/modest-pair.h @@ -34,12 +34,13 @@ G_BEGIN_DECLS -struct _ModestPair { +typedef struct _ModestPair { gpointer *first; gpointer *second; gboolean own; -}; -typedef struct _ModestPair ModestPair; +} ModestPair; + +typedef GSList ModestPairList; /** @@ -52,30 +53,41 @@ typedef struct _ModestPair ModestPair; * * Returns: a newly allocated ModestPair instance */ -ModestPair* modest_pair_new (gpointer first, gpointer second, gboolean own); +ModestPair* modest_pair_new (gpointer first, gpointer second, gboolean own); /** - * modest_pair_destroy: + * modest_pair_free: * @self: a valid ModestPair instance or NULL * - * destroy a ModestPair instance. If it was created with own==TRUE, the elements + * free a ModestPair instance. If it was created with own==TRUE, the elements * will be g_free'd as well. If pair==NULL, nothing will be done. */ -void modest_pair_destroy (ModestPair *pair); +void modest_pair_free (ModestPair *self); /** - * modest_pair_gslist_destroy: - * @pairs: a list of ModestPair instances + * modest_pair_list_free: + * @pairs: a valid ModestPairList * - * convenience function to destroy all pairs in a list + * Convenience function to destroy all pairs in a list and the list itself. * - * Returns: NULL */ -GSList *modest_pair_gslist_destroy (GSList *pairs); +void modest_pair_list_free (ModestPairList *pairs); +/** + * modest_pair_list_find_by_first + * @pairs: A valid ModestPairList + * @first: The first element of the pair to be found. + * @func: The function to call for each element. It should return 0 when the desired element is found. + * + * Find an element with a matching first entry. + * + * Returns: a previously allocated ModestPair instance, or NULL if none was found. + */ +ModestPair* modest_pair_list_find_by_first_as_string (ModestPairList *pairs, + const gchar* first); G_END_DECLS