Re: pending patches
- From: Philip Van Hoof <spam pvanhoof be>
- To: Martin Bonnin <martinbonnin gmail com>
- Cc: tinymail-devel-list <tinymail-devel-list gnome org>
- Subject: Re: pending patches
- Date: Thu, 16 Oct 2008 20:08:30 +0200
About just Patch #10
On Thu, 2008-10-16 at 18:18 +0200, Martin Bonnin wrote:
> +static gboolean _tny_camel_send_queue_query_passes (TnyFolderStoreQuery *query, TnyFolder *folder)
> +{
> + gboolean retval = FALSE;
> +
> + if (query && (tny_list_get_length (tny_folder_store_query_get_items (query)) > 0)) {
You can't do this with a caller-owns API like
tny_folder_store_query_get_items
TnyList *list = tny_folder_store_query_get_items (query);
if (query && (tny_list_get_length (list) > 0)) {
...
}
g_object_unref (list);
> + TnyList *items = tny_folder_store_query_get_items (query);
> + TnyIterator *iterator;
> + iterator = tny_list_create_iterator (items);
> +
> + while (!tny_iterator_is_done (iterator))
> + {
> + TnyFolderStoreQueryItem *item = (TnyFolderStoreQueryItem*) tny_iterator_get_current (iterator);
> + if (item) {
> + TnyFolderStoreQueryOption options = tny_folder_store_query_item_get_options (item);
> + const regex_t *regex = tny_folder_store_query_item_get_regex (item);
> +
> + if ((options & TNY_FOLDER_STORE_QUERY_OPTION_SUBSCRIBED) && tny_folder_is_subscribed (folder)){
> + retval = TRUE;
> + }
> +
> + if ((options & TNY_FOLDER_STORE_QUERY_OPTION_UNSUBSCRIBED) && !(tny_folder_is_subscribed (folder))){
> + retval = TRUE;
> + }
> +
> + if (regex && options & TNY_FOLDER_STORE_QUERY_OPTION_MATCH_ON_NAME){
> + if (regexec (regex, tny_folder_get_name (folder), 0, NULL, 0) == 0)
> + retval = TRUE;
> + }
> +
> + if (regex && options & TNY_FOLDER_STORE_QUERY_OPTION_MATCH_ON_ID){
> + if (regexec (regex, tny_folder_get_id (folder), 0, NULL, 0) == 0)
> + retval = TRUE;
> + }
> +
> + g_object_unref (G_OBJECT (item));
> + }
> +
> + tny_iterator_next (iterator);
> + }
> + g_object_unref (G_OBJECT (iterator));
> + g_object_unref (G_OBJECT (items));
There's no need to do casting using G_OBJECT here.
> + } else {
> + retval = TRUE;
> + }
> +
> + return retval;
> +}
--
Philip Van Hoof, freelance software developer
home: me at pvanhoof dot be
gnome: pvanhoof at gnome dot org
http://pvanhoof.be/blog
http://codeminded.be
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]