Changeset 563

Show
Ignore:
Timestamp:
07/09/06 09:05:06
Author:
pvanhoof
Message:

06-09-2006 Dirk-Jan C. Binnema <dirk-jan.binnema@nokia.com>

        • tny_iterator_iface_is_end method
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/AUTHORS

    r377 r563  
    99Florian Boor  <florian.boor@kernelconcepts.de> 
    1010 
    11         * Initial support for status flags. 
     11        * Initial support for status flags 
     12 
     13Dirk-Jan C. Binnema <dirk-jan.binnema@nokia.com> 
     14 
     15        * Contributions to the TnyIteratorIface type 
  • trunk/ChangeLog

    r539 r563  
     106-09-2006  Dirk-Jan C. Binnema <dirk-jan.binnema@nokia.com> 
     2 
     3        * tny_iterator_iface_is_end method 
     4 
     506-07-2006  Philip Van Hoof  <pvanhoof@gnome.org> 
     6 
     7        * Major API changes in TnyAccountStore 
     8         
    1906-21-2006  Florian Boor  <florian.boor@kernelconcepts.de> 
    210 
    311        * Make GPE TnyDevice default to be online for now. 
    412 
     1306-01-2006  Philip Van Hoof  <pvanhoof@gnome.org> 
     14 
     15        * Implementation and implementing 
     16 
    51706-09-2006  Florian Boor  <florian.boor@kernelconcepts.de> 
    618 
    719        * Fix endless loop sending mails. 
     20 
     2105-01-2006  Philip Van Hoof  <pvanhoof@gnome.org> 
     22 
     23        * Implementation and implementing 
    824 
    92505-24-2006  Florian Boor  <florian.boor@kernelconcepts.de> 
     
    1228        * Minor fixes. 
    1329 
    14 XX-YY-2006  Philip Van Hoof  <pvanhoof@gnome.org> 
     3004-01-2006  Philip Van Hoof  <pvanhoof@gnome.org> 
    1531 
    16         * More ChangeLog items coming soon. Really. 
     32        * Implementation and implementing 
    1733         
    183403-07-2006  Raphael Slinckx  <raphael@slinckx.net> 
  • trunk/libtinymail-camel/tny-msg-folder-list-iterator.c

    r550 r563  
    9393        g_mutex_unlock (me->model->iterator_lock); 
    9494 
    95         return me->current->data; 
    96 
     95        return me->current ? me->current->data : NULL; 
     96
     97 
     98 
     99 
     100 
     101static gboolean  
     102tny_msg_folder_list_iterator_is_done (TnyIteratorIface *self) 
     103
     104        TnyMsgFolderListIterator *me = (TnyMsgFolderListIterator*) self; 
     105 
     106        if (G_UNLIKELY (!me || !me->model)) 
     107                return TRUE; 
     108 
     109        return me->current != NULL; 
     110
     111 
     112 
     113 
    97114 
    98115static gpointer  
     
    232249        klass->has_first_func = tny_msg_folder_list_iterator_has_first; 
    233250        klass->get_list_func = tny_msg_folder_list_iterator_get_list; 
    234  
     251        klass->is_done = tny_msg_folder_list_iterator_is_done; 
     252         
    235253        return; 
    236254} 
  • trunk/libtinymail/tny-iterator-iface.c

    r550 r563  
    124124        return TNY_ITERATOR_IFACE_GET_CLASS (self)->current_func (self); 
    125125} 
     126 
     127 
     128 
     129/** 
     130 * tny_iterator_iface_is_done: 
     131 * @self: A #TnyIteratorIface instance 
     132 * 
     133 * Does the iterator point to some valid list item 
     134 * 
     135 * Return value: TRUE if it points to a valid list item, FALSE otherwise 
     136 * 
     137 **/ 
     138gboolean 
     139tny_iterator_iface_is_done (TnyIteratorIface *self) 
     140{ 
     141#ifdef DEBUG 
     142        if (!TNY_ITERATOR_IFACE_GET_CLASS (self)->is_done) 
     143                g_critical ("You must implement tny_iterator_iface_is_done\n"); 
     144#endif 
     145 
     146        return TNY_ITERATOR_IFACE_GET_CLASS (self)->is_done (self); 
     147} 
     148 
     149 
    126150 
    127151 
  • trunk/libtinymail/tny-iterator-iface.h

    r554 r563  
    4949        gboolean (*has_next_func) (TnyIteratorIface *self); 
    5050 
     51        gboolean (*is_done) (TnyIteratorIface *self); 
     52         
    5153        TnyListIface* (*get_list_func) (TnyIteratorIface *self); 
    5254}; 
     
    6264gboolean tny_iterator_iface_has_first (TnyIteratorIface *self); 
    6365gboolean tny_iterator_iface_has_next (TnyIteratorIface *self); 
     66 
     67gboolean tny_iterator_iface_is_done (TnyIteratorIface *self); 
     68 
    6469TnyListIface* tny_iterator_iface_get_list (TnyIteratorIface *self); 
    6570 
  • trunk/libtinymail/tny-list-iterator.c

    r552 r563  
    9595        g_mutex_unlock (lpriv->iterator_lock); 
    9696 
     97        return me->current ? me->current->data : NULL; 
     98} 
     99 
     100static gpointer  
     101tny_list_iterator_prev (TnyIteratorIface *self) 
     102{ 
     103        TnyListIterator *me = (TnyListIterator*) self; 
     104        TnyListPriv *lpriv; 
     105 
     106        if (G_UNLIKELY (!me || !me->current || !me->model)) 
     107                return NULL; 
     108 
     109        lpriv = TNY_LIST_GET_PRIVATE (me->model); 
     110 
     111        g_mutex_lock (lpriv->iterator_lock); 
     112        me->current = g_list_previous (me->current); 
     113        g_mutex_unlock (lpriv->iterator_lock); 
     114 
    97115        return me->current->data; 
    98116} 
    99117 
    100118static gpointer  
    101 tny_list_iterator_prev (TnyIteratorIface *self) 
     119tny_list_iterator_first (TnyIteratorIface *self) 
    102120{ 
    103121        TnyListIterator *me = (TnyListIterator*) self; 
     
    110128 
    111129        g_mutex_lock (lpriv->iterator_lock); 
    112         me->current = g_list_previous (me->current)
     130        me->current = lpriv->first
    113131        g_mutex_unlock (lpriv->iterator_lock); 
    114132 
     
    116134} 
    117135 
    118 static gpointer  
    119 tny_list_iterator_first (TnyIteratorIface *self) 
    120 
    121         TnyListIterator *me = (TnyListIterator*) self; 
    122         TnyListPriv *lpriv; 
    123  
    124         if (G_UNLIKELY (!me || !me->current || !me->model)) 
    125                 return NULL; 
    126  
    127         lpriv = TNY_LIST_GET_PRIVATE (me->model); 
    128  
    129         g_mutex_lock (lpriv->iterator_lock); 
    130         me->current = lpriv->first; 
    131         g_mutex_unlock (lpriv->iterator_lock); 
    132  
    133         return me->current->data; 
    134 
     136 
     137static gboolean  
     138tny_list_iterator_is_done (TnyIteratorIface *self) 
     139
     140        TnyListIterator *me = (TnyListIterator*) self; 
     141 
     142        return me->current == NULL; 
     143
     144 
    135145 
    136146 
     
    241251        klass->has_next_func = tny_list_iterator_has_next; 
    242252        klass->get_list_func = tny_list_iterator_get_list; 
    243  
     253        klass->is_done = tny_list_iterator_is_done; 
     254         
    244255        return; 
    245256} 
  • trunk/libtinymailui-gtk/tny-account-tree-model-iterator.c

    r556 r563  
    8787        g_mutex_unlock (me->model->iterator_lock); 
    8888 
     89        return me->current ? me->current->data : NULL; 
     90} 
     91 
     92static gpointer  
     93tny_account_tree_model_iterator_prev (TnyIteratorIface *self) 
     94{ 
     95        TnyAccountTreeModelIterator *me = (TnyAccountTreeModelIterator*) self; 
     96 
     97        if (G_UNLIKELY (!me || !me->current || !me->model)) 
     98                return NULL; 
     99 
     100        /* Move the iterator to the previous node */ 
     101 
     102        g_mutex_lock (me->model->iterator_lock); 
     103        me->current = g_list_previous (me->current); 
     104        g_mutex_unlock (me->model->iterator_lock); 
     105 
    89106        return me->current->data; 
    90107} 
    91108 
    92 static gpointer  
    93 tny_account_tree_model_iterator_prev (TnyIteratorIface *self) 
    94 
    95         TnyAccountTreeModelIterator *me = (TnyAccountTreeModelIterator*) self; 
    96  
    97         if (G_UNLIKELY (!me || !me->current || !me->model)) 
    98                 return NULL; 
    99  
    100         /* Move the iterator to the previous node */ 
    101  
    102         g_mutex_lock (me->model->iterator_lock); 
    103         me->current = g_list_previous (me->current); 
    104         g_mutex_unlock (me->model->iterator_lock); 
    105  
    106         return me->current->data; 
    107 
     109 
     110static gboolean  
     111tny_account_tree_model_iterator_is_done (TnyIteratorIface *self) 
     112
     113        TnyAccountTreeModelIterator *me = (TnyAccountTreeModelIterator*) self; 
     114         
     115        if (G_UNLIKELY (!me || !me->model)) 
     116                return TRUE; 
     117 
     118        return me->current == NULL; 
     119
     120 
     121 
    108122 
    109123static gpointer  
     
    229243        klass->has_next_func = tny_account_tree_model_iterator_has_next; 
    230244        klass->get_list_func = tny_account_tree_model_iterator_get_list; 
    231  
     245        klass->is_done  = tny_account_tree_model_iterator_is_done; 
     246         
    232247        return; 
    233248} 
  • trunk/libtinymailui-gtk/tny-msg-header-list-iterator.c

    r550 r563  
    109109        g_mutex_unlock (me->model->iterator_lock); 
    110110 
     111        return me->current ? me->current->data : NULL; 
     112} 
     113 
     114gpointer  
     115_tny_msg_header_list_iterator_prev_nl (TnyMsgHeaderListIterator *me) 
     116{ 
     117        me->current = me->current?g_list_previous (me->current):NULL; 
     118        return me->current?me->current->data:NULL; 
     119} 
     120 
     121static gpointer  
     122tny_msg_header_list_iterator_prev (TnyIteratorIface *self) 
     123{ 
     124        TnyMsgHeaderListIterator *me = (TnyMsgHeaderListIterator*) self; 
     125 
     126        if (G_UNLIKELY (!me || !me->current || !me->model)) 
     127                return NULL; 
     128 
     129        /* Move the iterator to the previous node */ 
     130 
     131        g_mutex_lock (me->model->iterator_lock); 
     132        me->current = g_list_previous (me->current); 
     133        g_mutex_unlock (me->model->iterator_lock); 
     134 
    111135        return me->current->data; 
    112136} 
    113137 
    114 gpointer  
    115 _tny_msg_header_list_iterator_prev_nl (TnyMsgHeaderListIterator *me) 
    116 
    117         me->current = me->current?g_list_previous (me->current):NULL; 
    118         return me->current?me->current->data:NULL; 
    119 
    120  
    121 static gpointer  
    122 tny_msg_header_list_iterator_prev (TnyIteratorIface *self) 
    123 
    124         TnyMsgHeaderListIterator *me = (TnyMsgHeaderListIterator*) self; 
    125  
    126         if (G_UNLIKELY (!me || !me->current || !me->model)) 
    127                 return NULL; 
    128  
    129         /* Move the iterator to the previous node */ 
    130  
    131         g_mutex_lock (me->model->iterator_lock); 
    132         me->current = g_list_previous (me->current); 
    133         g_mutex_unlock (me->model->iterator_lock); 
    134  
    135         return me->current->data; 
    136 
     138 
     139static gboolean  
     140tny_msg_header_list_iterator_is_done (TnyIteratorIface *self) 
     141
     142        TnyMsgHeaderListIterator *me = (TnyMsgHeaderListIterator*) self; 
     143 
     144        if (G_UNLIKELY (!me  || !me->model)) 
     145                return TRUE; 
     146 
     147        return me->current != NULL; 
     148
     149 
    137150 
    138151gpointer  
     
    284297        klass->has_next_func = tny_msg_header_list_iterator_has_next; 
    285298        klass->get_list_func = tny_msg_header_list_iterator_get_list; 
    286  
     299        klass->is_done = tny_msg_header_list_iterator_is_done; 
     300         
    287301        return; 
    288302}