Changeset 723

Show
Ignore:
Timestamp:
08/20/06 20:20:31
Author:
pvanhoof
Message:

20-08-2006 Philip Van Hoof <pvanhoof@gnome.org>

        • Reviewed and corrected Dirk-Jan's patch of 08-08
        • Removed the has_first and has_next methods from

the iterator API

08-08-2006 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>

        • make iterator ops next/prev/first/last/nth all void
        • g_object_ref iterator _current retval, except with headers...
        • misc small fixes (-Wall -Wextra helps...)
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ChangeLog

    r715 r723  
     120-08-2006  Philip Van Hoof <pvanhoof@gnome.org> 
     2 
     3        * Reviewed and corrected Dirk-Jan's patch of 08-08 
     4        * Removed the has_first and has_next methods from 
     5        the iterator API 
     6 
     708-08-2006  Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> 
     8 
     9        * make iterator ops next/prev/first/last/nth all void 
     10        * g_object_ref iterator _current retval, except with headers... 
     11        * misc small fixes (-Wall -Wextra helps...) 
     12 
    11308-01-2006  Philip Van Hoof  <pvanhoof@gnome.org> 
    214 
  • trunk/bindings/python/tinymail.override

    r715 r723  
    131131        iter = tny_list_iface_create_iterator (TNY_LIST_IFACE (self->obj)); 
    132132        /* TODO: check for failure? */ 
    133  
    134         ret = tny_iterator_iface_nth (iter, index); 
     133                 
     134                tny_iterator_iface_nth (iter, index); 
     135        ret = tny_iterator_iface_current (iter); 
     136        g_object_unref (G_OBJECT (ret)); 
    135137        g_object_unref (G_OBJECT (iter)); 
     138         
    136139    } else { 
    137140        /* TODO: handle other keys */ 
  • trunk/libtinymail-camel/tny-camel-common.c

    r380 r723  
    7777_foreach_email_add_to_inet_addr (const gchar *emails, CamelInternetAddress *target) 
    7878{ 
    79         int length = strlen (emails), i = 0; 
    8079        char *dup = g_strdup (emails); 
    8180        char *tok, *save; 
  • trunk/libtinymail-camel/tny-folder-list-iterator.c

    r700 r723  
    2525static GObjectClass *parent_class = NULL; 
    2626 
    27  
    2827void  
    2928_tny_folder_list_iterator_set_model (TnyFolderListIterator *self, TnyFolderList *model) 
     
    7170tny_folder_list_iterator_finalize (GObject *object) 
    7271{ 
    73         TnyFolderListIterator *self = (TnyFolderListIterator *)object; 
    74  
    7572        (*parent_class->finalize) (object); 
    7673 
     
    7875} 
    7976 
    80  
    81 static GObject*  
     77static void 
    8278tny_folder_list_iterator_next (TnyIteratorIface *self) 
    8379{ 
     
    8581 
    8682        if (G_UNLIKELY (!me || !me->current || !me->model)) 
    87                 return NULL
     83                return
    8884 
    8985        /* Move the iterator to the next node */ 
     
    9389        g_mutex_unlock (me->model->iterator_lock); 
    9490 
    95         return me->current ? me->current->data : NULL
     91        return
    9692} 
    9793 
     
    113109 
    114110 
    115 static GObject*  
     111static void 
    116112tny_folder_list_iterator_prev (TnyIteratorIface *self) 
    117113{ 
     
    119115 
    120116        if (G_UNLIKELY (!me || !me->current || !me->model)) 
    121                 return NULL
     117                return
    122118 
    123119        /* Move the iterator to the previous node */ 
     
    127123        g_mutex_unlock (me->model->iterator_lock); 
    128124 
    129         return me->current ? me->current->data : NULL
    130 } 
    131  
    132 static GObject*  
     125        return
     126} 
     127 
     128static void 
    133129tny_folder_list_iterator_first (TnyIteratorIface *self) 
    134130{ 
     
    136132 
    137133        if (G_UNLIKELY (!me || !me->current || !me->model)) 
    138                 return NULL
     134                return
    139135 
    140136        /* Move the iterator to the first node. We know that model always  
     
    146142        g_mutex_unlock (me->model->iterator_lock); 
    147143 
    148         return me->current->data
    149 } 
    150  
    151  
    152 static GObject*  
     144        return
     145} 
     146 
     147 
     148static void 
    153149tny_folder_list_iterator_nth (TnyIteratorIface *self, guint nth) 
    154150{ 
    155151        TnyFolderListIterator *me = (TnyFolderListIterator*) self; 
    156  
    157         if (G_UNLIKELY (!me || !me->current || !me->model)) 
    158                 return NULL
     152         
     153        if (G_UNLIKELY (!me || !me->current || !me->model)) 
     154                return
    159155 
    160156        /* Move the iterator to the nth node. We'll count from zero, 
     
    166162        g_mutex_unlock (me->model->iterator_lock); 
    167163 
    168         return me->current->data
     164        return
    169165} 
    170166 
     
    174170{ 
    175171        TnyFolderListIterator *me = (TnyFolderListIterator*) self; 
    176         gpointer retval
     172        GObject *obj
    177173 
    178174        if (G_UNLIKELY (!me || !me->model)) 
     
    182178 
    183179        g_mutex_lock (me->model->iterator_lock); 
    184         retval = (G_UNLIKELY (me->current)) ? me->current->data : NULL; 
    185         g_mutex_unlock (me->model->iterator_lock); 
    186  
    187         return retval; 
    188 
    189  
    190 static gboolean  
    191 tny_folder_list_iterator_has_next (TnyIteratorIface *self) 
    192 
    193         TnyFolderListIterator *me = (TnyFolderListIterator*) self; 
    194         gboolean retval; 
    195  
    196         if (G_UNLIKELY (!me || !me->model)) 
    197                 return FALSE; 
    198  
    199         /* Return whether or not there's a next node */ 
    200  
    201         g_mutex_lock (me->model->iterator_lock); 
    202         retval = (G_LIKELY (me->current) && me->current->next); 
    203         g_mutex_unlock (me->model->iterator_lock); 
    204  
    205         return retval; 
    206 
    207  
    208 static gboolean  
    209 tny_folder_list_iterator_has_first (TnyIteratorIface *self) 
    210 
    211         TnyFolderListIterator *me = (TnyFolderListIterator*) self; 
    212         gboolean retval; 
    213  
    214         if (G_UNLIKELY (!me || !me->model)) 
    215                 return FALSE; 
    216  
    217         /* Return whether or not there's a next node */ 
    218  
    219         g_mutex_lock (me->model->iterator_lock); 
    220         retval = G_LIKELY (me->current); 
    221         g_mutex_unlock (me->model->iterator_lock); 
    222  
    223         return retval; 
    224 
     180        obj = (G_UNLIKELY (me->current)) ? me->current->data : NULL; 
     181        g_mutex_unlock (me->model->iterator_lock); 
     182 
     183        if (obj) 
     184                g_object_ref (obj); 
     185         
     186        return obj; 
     187
     188 
    225189 
    226190static TnyListIface*  
     
    240204tny_iterator_iface_init (TnyIteratorIfaceClass *klass) 
    241205{ 
    242  
    243206        klass->next_func = tny_folder_list_iterator_next; 
    244207        klass->prev_func = tny_folder_list_iterator_prev; 
     
    246209        klass->nth_func = tny_folder_list_iterator_nth; 
    247210        klass->current_func = tny_folder_list_iterator_current; 
    248         klass->has_next_func = tny_folder_list_iterator_has_next; 
    249         klass->has_first_func = tny_folder_list_iterator_has_first; 
    250211        klass->get_list_func = tny_folder_list_iterator_get_list; 
    251212        klass->is_done = tny_folder_list_iterator_is_done; 
  • trunk/libtinymail-camel/tny-folder.c

    r715 r723  
    107107        if (!priv->folder && !priv->loaded) 
    108108        { 
    109                 CamelFolderInfo *folder_info; 
    110109                CamelException ex = CAMEL_EXCEPTION_INITIALISER; 
    111110                CamelStore *store = (CamelStore*) _tny_account_get_service  
  • trunk/libtinymail-camel/tny-header.c

    r715 r723  
    567567                  sizeof (TnyHeader), 
    568568                  0,      /* n_preallocs */ 
    569                   NULL    /* instance_init */ 
     569                  NULL,    /* instance_init */ 
     570                  NULL 
    570571                }; 
    571572 
  • trunk/libtinymail-camel/tny-mime-part.c

    r713 r723  
    2626#include <tny-mime-part.h> 
    2727#include <tny-camel-stream.h> 
     28#include <tny-stream-camel.h> 
    2829#include <camel/camel-stream-mem.h> 
    2930#include <camel/camel-data-wrapper.h> 
     
    623624                  sizeof (TnyMimePart), 
    624625                  0,      /* n_preallocs */ 
    625                   tny_mime_part_instance_init    /* instance_init */ 
     626                  tny_mime_part_instance_init,    /* instance_init */ 
     627                  NULL 
    626628                }; 
    627629 
  • trunk/libtinymail-camel/tny-msg.c

    r715 r723  
    9898 
    9999        if (!part) 
    100                 return
    101  
     100                return FALSE
     101         
    102102        /* http://bugzilla.gnome.org/show_bug.cgi?id=343683  
    103103           and tny-mime-part.c:515 ! */ 
     
    205205        CamelMedium *medium; 
    206206        CamelDataWrapper *containee; 
    207         TnyMimePartIface *tpart; 
    208207        gint curl = 0; 
    209208 
     
    253252        TnyMimePartPriv *ppriv = TNY_MIME_PART_GET_PRIVATE (self); 
    254253        gpointer remove; 
    255         TnyIteratorIface *iterator; 
    256254        CamelDataWrapper *containee; 
    257255 
     
    435433                  sizeof (TnyMsg), 
    436434                  0,      /* n_preallocs */ 
    437                   tny_msg_instance_init    /* instance_init */ 
     435                  tny_msg_instance_init,    /* instance_init */ 
     436                  NULL 
    438437                }; 
    439438 
  • trunk/libtinymail-camel/tny-session-camel.c

    r646 r723  
    461461        { 
    462462                TnyListIface *accounts = self->current_accounts; 
    463                 gboolean next = FALSE; 
    464463                TnyIteratorIface *iterator; 
    465464 
    466465                iterator = tny_list_iface_create_iterator (accounts); 
    467                 next = tny_iterator_iface_has_first (iterator); 
    468          
    469                 while (next) 
     466         
     467                while (!tny_iterator_iface_is_done (iterator)) 
    470468                { 
    471469                        TnyStoreAccountIface *account = (TnyStoreAccountIface*)tny_iterator_iface_current (iterator); 
    472  
     470                         
    473471                        _tny_account_set_online_status (account, !online); 
    474  
    475                         next = tny_iterator_iface_has_next (iterator); 
    476                         if (next) 
    477                                tny_iterator_iface_next (iterator); 
     472         
     473                        g_object_unref (G_OBJECT(account)); 
     474                         
     475                        tny_iterator_iface_next (iterator); 
    478476                } 
    479477 
  • trunk/libtinymail-camel/tny-store-account.c

    r700 r723  
    8686  { 
    8787        TnyIteratorIface *iterator = tny_list_iface_create_iterator (folders); 
    88         gboolean next = tny_iterator_iface_has_first (iterator); 
    89  
    90         while (next) 
     88 
     89        while (!tny_iterator_iface_is_done (iterator)) 
    9190        { 
    9291                TnyFolderIface *folder = (TnyFolderIface*)tny_iterator_iface_current (iterator); 
     
    9897                        walk_folders_uncache_em (self, more_folders); 
    9998 
    100                 next = tny_iterator_iface_has_next (iterator); 
    101  
    102                 if (next) 
    103                         tny_iterator_iface_next (iterator); 
     99                g_object_unref (G_OBJECT(folder)); 
     100                 
     101                tny_iterator_iface_next (iterator); 
    104102        } 
    105103 
     
    333331                folder = (TnyFolderIface*)tny_iterator_iface_current (iterator); 
    334332                g_signal_emit (folder, tny_folder_iface_signals [TNY_FOLDER_IFACE_FOLDERS_RELOADED], 0); 
    335  
     333                g_object_unref (G_OBJECT (folder)); 
    336334                g_object_unref (G_OBJECT (iterator)); 
    337335        } 
  • trunk/libtinymail-gnome-desktop/tny-account-store.c

    r698 r723  
    7474{ 
    7575        gchar *retval = NULL; 
    76         const gchar *accountid = tny_account_iface_get_id (account); 
    77         GList *list; 
     76GList *list; 
    7877        GnomeKeyringResult keyringret; 
    7978        gchar *keyring; 
     
    155154per_account_forget_pass_func (TnyAccountIface *account) 
    156155{ 
    157         const TnyAccountStoreIface *self = tny_account_iface_get_account_store (account); 
    158         TnyAccountStorePriv *priv = TNY_ACCOUNT_STORE_GET_PRIVATE (self); 
    159         TnyGetPassFunc func; 
    160  
    161156        GList *list=NULL; 
    162157        GnomeKeyringResult keyringret; 
     
    298293{ 
    299294        TnyAccountStoreIface *self = user_data; 
    300         TnyAccountStorePriv *priv = TNY_ACCOUNT_STORE_GET_PRIVATE (self); 
    301  
    302295 
    303296        gchar *key = g_strdup (entry->key); 
     
    571564tny_account_store_add_store_account (TnyAccountStoreIface *self, TnyStoreAccountIface *account) 
    572565{ 
    573         TnyAccountStorePriv *priv = TNY_ACCOUNT_STORE_GET_PRIVATE (self); 
    574  
    575566        tny_account_store_notify_remove (self); 
    576567        tny_account_store_add_account (self, TNY_ACCOUNT_IFACE (account), "store"); 
     
    585576tny_account_store_add_transport_account (TnyAccountStoreIface *self, TnyTransportAccountIface *account) 
    586577{ 
    587         TnyAccountStorePriv *priv = TNY_ACCOUNT_STORE_GET_PRIVATE (self); 
    588  
    589578        tny_account_store_notify_remove (self); 
    590579        tny_account_store_add_account (self, TNY_ACCOUNT_IFACE (account), "transport"); 
  • trunk/libtinymail-gnome-desktop/tny-password-dialog.c

    r414 r723  
    116116tny_password_dialog_finalize (GObject *object) 
    117117{ 
    118         TnyPasswordDialog *self = (TnyPasswordDialog *)object;   
    119          
    120118        (*parent_class->finalize) (object); 
    121119 
  • trunk/libtinymail-gnome-desktop/tny-platform-factory.c

    r463 r723  
    9090tny_platform_factory_finalize (GObject *object) 
    9191{ 
    92         TnyPlatformFactory *self = (TnyPlatformFactory *)object;         
    93  
    9492        (*parent_class->finalize) (object); 
    9593 
  • trunk/libtinymail-gnomevfs/tny-vfs-stream.c

    r666 r723  
    474474                  sizeof (TnyVfsStream), 
    475475                  0,      /* n_preallocs */ 
    476                   tny_vfs_stream_instance_init    /* instance_init */ 
     476                  tny_vfs_stream_instance_init,/* instance_init */ 
     477                  NULL 
    477478                }; 
    478479 
  • trunk/libtinymail-test/tny-list-iface-test.c

    r698 r723  
    114114        iterator = tny_list_iface_create_iterator (iface); 
    115115 
    116         str = g_strdup_printf ("has_first should return TRUE in this case\n"); 
    117         gunit_fail_unless (tny_iterator_iface_has_first (iterator) == TRUE, str); 
    118         g_free (str); 
    119  
    120         str = g_strdup_printf ("has_next should return TRUE in this case\n"); 
    121         gunit_fail_unless (tny_iterator_iface_has_next (iterator) == TRUE, str); 
    122         g_free (str); 
    123116 
    124117        str = g_strdup_printf ("get_list returns the wrong instance\n"); 
     
    126119        g_free (str); 
    127120 
    128         item = (TnyTestObject*)tny_iterator_iface_nth (iterator, 2); 
    129  
     121        tny_iterator_iface_nth (iterator, 2); 
     122        item = (TnyTestObject*)tny_iterator_iface_current (iterator); 
     123         
    130124        str = g_strdup_printf ("Item should be \"3\" but is %s\n", item->str); 
    131125        gunit_fail_unless (!strcmp (item->str, "3"), str); 
    132126        g_free (str); 
    133  
    134         item = (TnyTestObject*)tny_iterator_iface_next (iterator); 
    135  
     127        g_object_unref (G_OBJECT(item)); 
     128         
     129        tny_iterator_iface_next (iterator); 
     130        item = (TnyTestObject*)tny_iterator_iface_current (iterator);    
    136131        str = g_strdup_printf ("Item should be \"4\" but is %s\n", item->str); 
    137132        gunit_fail_unless (!strcmp (item->str, "4"), str); 
    138133        g_free (str); 
    139  
    140         item = (TnyTestObject*)tny_iterator_iface_prev (iterator); 
     134        g_object_unref (G_OBJECT(item)); 
     135         
     136        tny_iterator_iface_prev (iterator); 
     137        item = (TnyTestObject*)tny_iterator_iface_current (iterator);    
    141138 
    142139        str = g_strdup_printf ("Item should be \"3\" but is %s\n", item->str); 
    143140        gunit_fail_unless (!strcmp (item->str, "3"), str); 
    144141        g_free (str); 
    145  
    146         item = (TnyTestObject*)tny_iterator_iface_next (iterator); 
    147  
     142        g_object_unref (G_OBJECT(item)); 
     143         
     144        tny_iterator_iface_next (iterator); 
     145        tny_iterator_iface_current (iterator);   
     146         
    148147        str = g_strdup_printf ("Item should be \"4\" but is %s\n", item->str); 
    149148        gunit_fail_unless (!strcmp (item->str, "4"), str); 
    150149        g_free (str); 
    151  
     150        g_object_unref (G_OBJECT(item)); 
    152151 
    153152        item = (TnyTestObject*)tny_iterator_iface_current (iterator); 
    154  
     153         
    155154        str = g_strdup_printf ("Item should be \"4\" but is %s\n", item->str); 
    156155        gunit_fail_unless (!strcmp (item->str, "4"), str); 
     
    165164        g_free (str); 
    166165 
    167  
     166        g_object_unref (G_OBJECT(item)); /* need to unref ? */ 
     167         
    168168        iterator = tny_list_iface_create_iterator (iface); 
    169169 
    170         item = (TnyTestObject*)tny_iterator_iface_first (iterator); 
    171  
     170        tny_iterator_iface_first (iterator); 
     171        item = (TnyTestObject*)tny_iterator_iface_current (iterator); 
     172         
    172173        str = g_strdup_printf ("Item should be \"1\" but is %s\n", item->str); 
    173174        gunit_fail_unless (!strcmp (item->str, "1"), str); 
     
    188189         
    189190        g_object_unref (G_OBJECT (iterator)); 
    190  
     191        g_object_unref (G_OBJECT(item)); /* need to unref ? */   
    191192} 
    192193 
  • trunk/libtinymail/tny-account-iface.c

    r652 r723  
    474474                  0, 
    475475                  0,      /* n_preallocs */ 
    476                   NULL    /* instance_init */ 
     476                  NULL,   /* instance_init */ 
     477                  NULL 
    477478                }; 
    478479                type = g_type_register_static (G_TYPE_INTERFACE,  
  • trunk/libtinymail/tny-account-store-iface.c

    r652 r723  
    264264                  0, 
    265265                  0,      /* n_preallocs */ 
    266                   NULL    /* instance_init */ 
     266                  NULL,    /* instance_init */ 
     267                  NULL 
    267268                }; 
    268269                type = g_type_register_static (G_TYPE_INTERFACE,  
  • trunk/libtinymail/tny-device-iface.c

    r520 r723  
    152152                  0, 
    153153                  0,      /* n_preallocs */ 
    154                   NULL    /* instance_init */ 
     154                  NULL,   /* instance_init */ 
     155                  NULL 
    155156                }; 
    156157                type = g_type_register_static (G_TYPE_INTERFACE,  
  • trunk/libtinymail/tny-folder-iface.c

    r715 r723  
    404404{ 
    405405        if (TNY_FOLDER_IFACE_GET_CLASS (self)->has_cache_func != NULL) 
    406                 TNY_FOLDER_IFACE_GET_CLASS (self)->has_cache_func (self); 
    407         return; 
     406                return TNY_FOLDER_IFACE_GET_CLASS (self)->has_cache_func (self); 
     407        else 
     408                return FALSE; 
    408409} 
    409410 
     
    472473                  0, 
    473474                  0,      /* n_preallocs */ 
    474                   NULL    /* instance_init */ 
     475                  NULL,    /* instance_init */ 
     476                  NULL 
    475477                }; 
    476478                type = g_type_register_static (G_TYPE_INTERFACE,  
  • trunk/libtinymail/tny-fs-stream.c

    r666 r723  
    278278                  sizeof (TnyFsStream), 
    279279                  0,      /* n_preallocs */ 
    280                   tny_fs_stream_instance_init    /* instance_init */ 
     280                  tny_fs_stream_instance_init,   /* instance_init */ 
     281                  NULL 
    281282                }; 
    282283 
  • trunk/libtinymail/tny-header-iface.c

    r715 r723  
    465465                  0, 
    466466                  0,      /* n_preallocs */ 
    467                   NULL    /* instance_init */ 
     467                  NULL,   /* instance_init */ 
     468                  NULL 
    468469                }; 
    469470 
  • trunk/libtinymail/tny-iterator-iface.c

    r646 r723  
    2727 * 
    2828 * Moves the iterator to the next node  
    29  *  
    30  * Return value: the next value of the underlying #TnyListIface instance 
    31  * 
    32  **/ 
    33 GObject*  
     29 * 
     30 **/ 
     31void  
    3432tny_iterator_iface_next (TnyIteratorIface *self) 
    3533{ 
     
    3836                g_critical ("You must implement tny_iterator_iface_next\n"); 
    3937#endif 
    40  
    41         return TNY_ITERATOR_IFACE_GET_CLASS (self)->next_func (self); 
     38        TNY_ITERATOR_IFACE_GET_CLASS (self)->next_func (self); 
    4239} 
    4340 
     
    4845 * Moves the iterator to the previous node 
    4946 * 
    50  * Return value: the previous value of the underlying #TnyListIface instance 
    51  * 
    52  **/ 
    53 GObject*  
     47 **/ 
     48void 
    5449tny_iterator_iface_prev (TnyIteratorIface *self) 
    5550{ 
     
    5853                g_critical ("You must implement tny_iterator_iface_prev\n"); 
    5954#endif 
    60  
    61         return TNY_ITERATOR_IFACE_GET_CLASS (self)->prev_func (self); 
     55        TNY_ITERATOR_IFACE_GET_CLASS (self)->prev_func (self); 
    6256} 
    6357 
     
    6963 * Moves the iterator to the first node 
    7064 * 
    71  * Return value: the first value of the underlying #TnyListIface instance 
    72  * 
    73  **/ 
    74 GObject*  
     65 **/ 
     66void  
    7567tny_iterator_iface_first (TnyIteratorIface *self) 
    7668{ 
     
    8072#endif 
    8173 
    82         return TNY_ITERATOR_IFACE_GET_CLASS (self)->first_func (self); 
     74        TNY_ITERATOR_IFACE_GET_CLASS (self)->first_func (self); 
    8375} 
    8476 
     
    9385 * 
    9486 **/ 
    95 GObject* 
     87void 
    9688tny_iterator_iface_nth (TnyIteratorIface *self, guint nth) 
    9789{ 
     
    10092                g_critical ("You must implement tny_iterator_iface_nth\n"); 
    10193#endif 
    102  
    103         return TNY_ITERATOR_IFACE_GET_CLASS (self)->nth_func (self, nth); 
     94        TNY_ITERATOR_IFACE_GET_CLASS (self)->nth_func (self, nth); 
    10495} 
    10596 
     
    121112                g_critical ("You must implement tny_iterator_iface_current\n"); 
    122113#endif 
    123  
    124114        return TNY_ITERATOR_IFACE_GET_CLASS (self)->current_func (self); 
    125115} 
     
    148138 
    149139 
    150  
    151  
    152 /** 
    153  * tny_iterator_iface_has_first: 
    154  * @self: A #TnyIteratorIface instance 
    155  * 
    156  * Does not move the iterator 
    157  * 
    158  * Return value: Whether or not there's a first node 
    159  * 
    160  **/ 
    161 gboolean 
    162 tny_iterator_iface_has_first (TnyIteratorIface *self) 
    163 { 
    164 #ifdef DEBUG 
    165         if (!TNY_ITERATOR_IFACE_GET_CLASS (self)->has_first_func) 
    166                 g_critical ("You must implement tny_iterator_iface_has_first\n"); 
    167 #endif 
    168  
    169         return TNY_ITERATOR_IFACE_GET_CLASS (self)->has_first_func (self); 
    170 } 
    171  
    172 /** 
    173  * tny_iterator_iface_has_next: 
    174  * @self: A #TnyIteratorIface instance 
    175  * 
    176  * Does not move the iterator 
    177  * 
    178  * Return value: Whether or not there's a next node 
    179  * 
    180  **/ 
    181 gboolean 
    182 tny_iterator_iface_has_next (TnyIteratorIface *self) 
    183 { 
    184 #ifdef DEBUG 
    185         if (!TNY_ITERATOR_IFACE_GET_CLASS (self)->has_next_func) 
    186                 g_critical ("You must implement tny_iterator_iface_has_next\n"); 
    187 #endif 
    188  
    189         return TNY_ITERATOR_IFACE_GET_CLASS (self)->has_next_func (self); 
    190 } 
    191140 
    192141/** 
     
    240189                  0, 
    241190                  0,      /* n_preallocs */ 
    242                   NULL    /* instance_init */ 
     191                  NULL,    /* instance_init */ 
     192                  NULL 
    243193                }; 
    244194                type = g_type_register_static (G_TYPE_INTERFACE,  
  • trunk/libtinymail/tny-iterator-iface.h

    r646 r723  
    3939        GTypeInterface parent; 
    4040 
    41         GObject* (*next_func) (TnyIteratorIface *self); 
    42         GObject* (*prev_func) (TnyIteratorIface *self); 
    43         GObject* (*first_func) (TnyIteratorIface *self); 
    44         GObject* (*nth_func) (TnyIteratorIface *self, guint nth); 
     41        void (*next_func) (TnyIteratorIface *self); 
     42        void (*prev_func) (TnyIteratorIface *self); 
     43        void (*first_func) (TnyIteratorIface *self); 
     44        void (*nth_func) (TnyIteratorIface *self, guint nth); 
    4545        GObject* (*current_func) (TnyIteratorIface *self); 
    46         gboolean (*has_first_func) (TnyIteratorIface *self); 
    47         gboolean (*has_next_func) (TnyIteratorIface *self); 
     46 
    4847        gboolean (*is_done) (TnyIteratorIface *self); 
    4948        TnyListIface* (*get_list_func) (TnyIteratorIface *self); 
     
    5251GType tny_iterator_iface_get_type (void); 
    5352 
    54 GObject* tny_iterator_iface_next (TnyIteratorIface *self); 
    55 GObject* tny_iterator_iface_prev (TnyIteratorIface *self); 
    56 GObject* tny_iterator_iface_first (TnyIteratorIface *self); 
    57 GObject* tny_iterator_iface_nth (TnyIteratorIface *self, guint nth); 
    58 GObject* tny_iterator_iface_current (TnyIteratorIface *self); 
    59 gboolean tny_iterator_iface_has_first (TnyIteratorIface *self); 
    60 gboolean tny_iterator_iface_has_next (TnyIteratorIface *self); 
    61 gboolean tny_iterator_iface_is_done (TnyIteratorIface *self); 
     53void tny_iterator_iface_next              (TnyIteratorIface *self); 
     54void tny_iterator_iface_prev              (TnyIteratorIface *self); 
     55void tny_iterator_iface_first             (TnyIteratorIface *self); 
     56void tny_iterator_iface_nth               (TnyIteratorIface *self, guint nth); 
     57GObject* tny_iterator_iface_current       (TnyIteratorIface *self); 
     58gboolean tny_iterator_iface_is_done       (TnyIteratorIface *self); 
    6259TnyListIface* tny_iterator_iface_get_list (TnyIteratorIface *self); 
    6360 
  • trunk/libtinymail/tny-list-iface.c

    r665 r723  
    3535                g_critical ("You must implement tny_list_iface_length\n"); 
    3636#endif 
    37  
    38         TNY_LIST_IFACE_GET_CLASS (self)->length_func (self); 
    39         return; 
     37        return TNY_LIST_IFACE_GET_CLASS (self)->length_func (self); 
    4038} 
    4139 
     
    185183                  0, 
    186184                  0,      /* n_preallocs */ 
    187                   NULL    /* instance_init */ 
     185                  NULL,    /* instance_init */ 
     186                  NULL 
    188187                }; 
    189188                type = g_type_register_static (G_TYPE_INTERFACE,  
  • trunk/libtinymail/tny-list-iterator-priv.h

    r715 r723  
    5656void _tny_list_iterator_set_model (TnyListIterator *self, TnyList *model); 
    5757TnyListIterator* _tny_header_list_iterator_new (TnyList *model); 
     58TnyListIterator* _tny_list_iterator_new (TnyList *model); 
    5859 
    5960G_END_DECLS 
  • trunk/libtinymail/tny-list-iterator.c

    r646 r723  
    7272tny_list_iterator_finalize (GObject *object) 
    7373{ 
    74         TnyListIterator *self = (TnyListIterator *)object; 
    75  
    7674        (*parent_class->finalize) (object); 
    7775 
     
    8078 
    8179 
    82 static GObject*  
     80static void  
    8381tny_list_iterator_next (TnyIteratorIface *self) 
    8482{ 
     
    8785 
    8886        if (G_UNLIKELY (!me || !me->current || !me->model)) 
    89                 return NULL
     87                return
    9088 
    9189        lpriv = TNY_LIST_GET_PRIVATE (me->model); 
     
    9593        g_mutex_unlock (lpriv->iterator_lock); 
    9694 
    97</