Changeset 723
- Timestamp:
- 08/20/06 20:20:31
- Files:
-
- trunk/ChangeLog (modified) (1 diff)
- trunk/bindings/python/tinymail.override (modified) (1 diff)
- trunk/libtinymail-camel/tny-camel-common.c (modified) (1 diff)
- trunk/libtinymail-camel/tny-folder-list-iterator.c (modified) (15 diffs)
- trunk/libtinymail-camel/tny-folder.c (modified) (1 diff)
- trunk/libtinymail-camel/tny-header.c (modified) (1 diff)
- trunk/libtinymail-camel/tny-mime-part.c (modified) (2 diffs)
- trunk/libtinymail-camel/tny-msg.c (modified) (4 diffs)
- trunk/libtinymail-camel/tny-session-camel.c (modified) (1 diff)
- trunk/libtinymail-camel/tny-store-account.c (modified) (3 diffs)
- trunk/libtinymail-gnome-desktop/tny-account-store.c (modified) (5 diffs)
- trunk/libtinymail-gnome-desktop/tny-password-dialog.c (modified) (1 diff)
- trunk/libtinymail-gnome-desktop/tny-platform-factory.c (modified) (1 diff)
- trunk/libtinymail-gnomevfs/tny-vfs-stream.c (modified) (1 diff)
- trunk/libtinymail-test/tny-list-iface-test.c (modified) (4 diffs)
- trunk/libtinymail/tny-account-iface.c (modified) (1 diff)
- trunk/libtinymail/tny-account-store-iface.c (modified) (1 diff)
- trunk/libtinymail/tny-device-iface.c (modified) (1 diff)
- trunk/libtinymail/tny-folder-iface.c (modified) (2 diffs)
- trunk/libtinymail/tny-fs-stream.c (modified) (1 diff)
- trunk/libtinymail/tny-header-iface.c (modified) (1 diff)
- trunk/libtinymail/tny-iterator-iface.c (modified) (11 diffs)
- trunk/libtinymail/tny-iterator-iface.h (modified) (2 diffs)
- trunk/libtinymail/tny-list-iface.c (modified) (2 diffs)
- trunk/libtinymail/tny-list-iterator-priv.h (modified) (1 diff)
- trunk/libtinymail/tny-list-iterator.c (modified) (14 diffs)
- trunk/libtinymail/tny-list.c (modified) (2 diffs)
- trunk/libtinymail/tny-mime-part-iface.c (modified) (1 diff)
- trunk/libtinymail/tny-msg-iface.c (modified) (1 diff)
- trunk/libtinymail/tny-store-account-iface.c (modified) (1 diff)
- trunk/libtinymail/tny-stream-iface.c (modified) (1 diff)
- trunk/libtinymail/tny-transport-account-iface.c (modified) (1 diff)
- trunk/libtinymailui-gtk/tny-account-tree-model-iterator.c (modified) (16 diffs)
- trunk/libtinymailui-gtk/tny-account-tree-model.c (modified) (4 diffs)
- trunk/libtinymailui-gtk/tny-attach-list-model-iterator.c (modified) (13 diffs)
- trunk/libtinymailui-gtk/tny-attach-list-model.c (modified) (2 diffs)
- trunk/libtinymailui-gtk/tny-header-list-iterator-priv.h (modified) (1 diff)
- trunk/libtinymailui-gtk/tny-header-list-iterator.c (modified) (14 diffs)
- trunk/libtinymailui-gtk/tny-header-list-model.c (modified) (17 diffs)
- trunk/libtinymailui-gtk/tny-msg-view.c (modified) (6 diffs)
- trunk/libtinymailui-gtk/tny-msg-window.c (modified) (2 diffs)
- trunk/libtinymailui-gtk/tny-save-strategy.c (modified) (1 diff)
- trunk/libtinymailui-gtk/tny-text-buffer-stream.c (modified) (1 diff)
- trunk/libtinymailui-mozembed/tny-moz-embed-msg-view.c (modified) (6 diffs)
- trunk/libtinymailui-mozembed/tny-moz-embed-stream.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/ChangeLog
r715 r723 1 20-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 7 08-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 1 13 08-01-2006 Philip Van Hoof <pvanhoof@gnome.org> 2 14 trunk/bindings/python/tinymail.override
r715 r723 131 131 iter = tny_list_iface_create_iterator (TNY_LIST_IFACE (self->obj)); 132 132 /* 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)); 135 137 g_object_unref (G_OBJECT (iter)); 138 136 139 } else { 137 140 /* TODO: handle other keys */ trunk/libtinymail-camel/tny-camel-common.c
r380 r723 77 77 _foreach_email_add_to_inet_addr (const gchar *emails, CamelInternetAddress *target) 78 78 { 79 int length = strlen (emails), i = 0;80 79 char *dup = g_strdup (emails); 81 80 char *tok, *save; trunk/libtinymail-camel/tny-folder-list-iterator.c
r700 r723 25 25 static GObjectClass *parent_class = NULL; 26 26 27 28 27 void 29 28 _tny_folder_list_iterator_set_model (TnyFolderListIterator *self, TnyFolderList *model) … … 71 70 tny_folder_list_iterator_finalize (GObject *object) 72 71 { 73 TnyFolderListIterator *self = (TnyFolderListIterator *)object;74 75 72 (*parent_class->finalize) (object); 76 73 … … 78 75 } 79 76 80 81 static GObject* 77 static void 82 78 tny_folder_list_iterator_next (TnyIteratorIface *self) 83 79 { … … 85 81 86 82 if (G_UNLIKELY (!me || !me->current || !me->model)) 87 return NULL;83 return; 88 84 89 85 /* Move the iterator to the next node */ … … 93 89 g_mutex_unlock (me->model->iterator_lock); 94 90 95 return me->current ? me->current->data : NULL;91 return; 96 92 } 97 93 … … 113 109 114 110 115 static GObject*111 static void 116 112 tny_folder_list_iterator_prev (TnyIteratorIface *self) 117 113 { … … 119 115 120 116 if (G_UNLIKELY (!me || !me->current || !me->model)) 121 return NULL;117 return; 122 118 123 119 /* Move the iterator to the previous node */ … … 127 123 g_mutex_unlock (me->model->iterator_lock); 128 124 129 return me->current ? me->current->data : NULL;130 } 131 132 static GObject*125 return; 126 } 127 128 static void 133 129 tny_folder_list_iterator_first (TnyIteratorIface *self) 134 130 { … … 136 132 137 133 if (G_UNLIKELY (!me || !me->current || !me->model)) 138 return NULL;134 return; 139 135 140 136 /* Move the iterator to the first node. We know that model always … … 146 142 g_mutex_unlock (me->model->iterator_lock); 147 143 148 return me->current->data;149 } 150 151 152 static GObject*144 return; 145 } 146 147 148 static void 153 149 tny_folder_list_iterator_nth (TnyIteratorIface *self, guint nth) 154 150 { 155 151 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; 159 155 160 156 /* Move the iterator to the nth node. We'll count from zero, … … 166 162 g_mutex_unlock (me->model->iterator_lock); 167 163 168 return me->current->data;164 return; 169 165 } 170 166 … … 174 170 { 175 171 TnyFolderListIterator *me = (TnyFolderListIterator*) self; 176 gpointer retval;172 GObject *obj; 177 173 178 174 if (G_UNLIKELY (!me || !me->model)) … … 182 178 183 179 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 225 189 226 190 static TnyListIface* … … 240 204 tny_iterator_iface_init (TnyIteratorIfaceClass *klass) 241 205 { 242 243 206 klass->next_func = tny_folder_list_iterator_next; 244 207 klass->prev_func = tny_folder_list_iterator_prev; … … 246 209 klass->nth_func = tny_folder_list_iterator_nth; 247 210 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;250 211 klass->get_list_func = tny_folder_list_iterator_get_list; 251 212 klass->is_done = tny_folder_list_iterator_is_done; trunk/libtinymail-camel/tny-folder.c
r715 r723 107 107 if (!priv->folder && !priv->loaded) 108 108 { 109 CamelFolderInfo *folder_info;110 109 CamelException ex = CAMEL_EXCEPTION_INITIALISER; 111 110 CamelStore *store = (CamelStore*) _tny_account_get_service trunk/libtinymail-camel/tny-header.c
r715 r723 567 567 sizeof (TnyHeader), 568 568 0, /* n_preallocs */ 569 NULL /* instance_init */ 569 NULL, /* instance_init */ 570 NULL 570 571 }; 571 572 trunk/libtinymail-camel/tny-mime-part.c
r713 r723 26 26 #include <tny-mime-part.h> 27 27 #include <tny-camel-stream.h> 28 #include <tny-stream-camel.h> 28 29 #include <camel/camel-stream-mem.h> 29 30 #include <camel/camel-data-wrapper.h> … … 623 624 sizeof (TnyMimePart), 624 625 0, /* n_preallocs */ 625 tny_mime_part_instance_init /* instance_init */ 626 tny_mime_part_instance_init, /* instance_init */ 627 NULL 626 628 }; 627 629 trunk/libtinymail-camel/tny-msg.c
r715 r723 98 98 99 99 if (!part) 100 return ;101 100 return FALSE; 101 102 102 /* http://bugzilla.gnome.org/show_bug.cgi?id=343683 103 103 and tny-mime-part.c:515 ! */ … … 205 205 CamelMedium *medium; 206 206 CamelDataWrapper *containee; 207 TnyMimePartIface *tpart;208 207 gint curl = 0; 209 208 … … 253 252 TnyMimePartPriv *ppriv = TNY_MIME_PART_GET_PRIVATE (self); 254 253 gpointer remove; 255 TnyIteratorIface *iterator;256 254 CamelDataWrapper *containee; 257 255 … … 435 433 sizeof (TnyMsg), 436 434 0, /* n_preallocs */ 437 tny_msg_instance_init /* instance_init */ 435 tny_msg_instance_init, /* instance_init */ 436 NULL 438 437 }; 439 438 trunk/libtinymail-camel/tny-session-camel.c
r646 r723 461 461 { 462 462 TnyListIface *accounts = self->current_accounts; 463 gboolean next = FALSE;464 463 TnyIteratorIface *iterator; 465 464 466 465 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)) 470 468 { 471 469 TnyStoreAccountIface *account = (TnyStoreAccountIface*)tny_iterator_iface_current (iterator); 472 470 473 471 _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); 478 476 } 479 477 trunk/libtinymail-camel/tny-store-account.c
r700 r723 86 86 { 87 87 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)) 91 90 { 92 91 TnyFolderIface *folder = (TnyFolderIface*)tny_iterator_iface_current (iterator); … … 98 97 walk_folders_uncache_em (self, more_folders); 99 98 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); 104 102 } 105 103 … … 333 331 folder = (TnyFolderIface*)tny_iterator_iface_current (iterator); 334 332 g_signal_emit (folder, tny_folder_iface_signals [TNY_FOLDER_IFACE_FOLDERS_RELOADED], 0); 335 333 g_object_unref (G_OBJECT (folder)); 336 334 g_object_unref (G_OBJECT (iterator)); 337 335 } trunk/libtinymail-gnome-desktop/tny-account-store.c
r698 r723 74 74 { 75 75 gchar *retval = NULL; 76 const gchar *accountid = tny_account_iface_get_id (account); 77 GList *list; 76 GList *list; 78 77 GnomeKeyringResult keyringret; 79 78 gchar *keyring; … … 155 154 per_account_forget_pass_func (TnyAccountIface *account) 156 155 { 157 const TnyAccountStoreIface *self = tny_account_iface_get_account_store (account);158 TnyAccountStorePriv *priv = TNY_ACCOUNT_STORE_GET_PRIVATE (self);159 TnyGetPassFunc func;160 161 156 GList *list=NULL; 162 157 GnomeKeyringResult keyringret; … … 298 293 { 299 294 TnyAccountStoreIface *self = user_data; 300 TnyAccountStorePriv *priv = TNY_ACCOUNT_STORE_GET_PRIVATE (self);301 302 295 303 296 gchar *key = g_strdup (entry->key); … … 571 564 tny_account_store_add_store_account (TnyAccountStoreIface *self, TnyStoreAccountIface *account) 572 565 { 573 TnyAccountStorePriv *priv = TNY_ACCOUNT_STORE_GET_PRIVATE (self);574 575 566 tny_account_store_notify_remove (self); 576 567 tny_account_store_add_account (self, TNY_ACCOUNT_IFACE (account), "store"); … … 585 576 tny_account_store_add_transport_account (TnyAccountStoreIface *self, TnyTransportAccountIface *account) 586 577 { 587 TnyAccountStorePriv *priv = TNY_ACCOUNT_STORE_GET_PRIVATE (self);588 589 578 tny_account_store_notify_remove (self); 590 579 tny_account_store_add_account (self, TNY_ACCOUNT_IFACE (account), "transport"); trunk/libtinymail-gnome-desktop/tny-password-dialog.c
r414 r723 116 116 tny_password_dialog_finalize (GObject *object) 117 117 { 118 TnyPasswordDialog *self = (TnyPasswordDialog *)object;119 120 118 (*parent_class->finalize) (object); 121 119 trunk/libtinymail-gnome-desktop/tny-platform-factory.c
r463 r723 90 90 tny_platform_factory_finalize (GObject *object) 91 91 { 92 TnyPlatformFactory *self = (TnyPlatformFactory *)object;93 94 92 (*parent_class->finalize) (object); 95 93 trunk/libtinymail-gnomevfs/tny-vfs-stream.c
r666 r723 474 474 sizeof (TnyVfsStream), 475 475 0, /* n_preallocs */ 476 tny_vfs_stream_instance_init /* instance_init */ 476 tny_vfs_stream_instance_init,/* instance_init */ 477 NULL 477 478 }; 478 479 trunk/libtinymail-test/tny-list-iface-test.c
r698 r723 114 114 iterator = tny_list_iface_create_iterator (iface); 115 115 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);123 116 124 117 str = g_strdup_printf ("get_list returns the wrong instance\n"); … … 126 119 g_free (str); 127 120 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 130 124 str = g_strdup_printf ("Item should be \"3\" but is %s\n", item->str); 131 125 gunit_fail_unless (!strcmp (item->str, "3"), str); 132 126 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); 136 131 str = g_strdup_printf ("Item should be \"4\" but is %s\n", item->str); 137 132 gunit_fail_unless (!strcmp (item->str, "4"), str); 138 133 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); 141 138 142 139 str = g_strdup_printf ("Item should be \"3\" but is %s\n", item->str); 143 140 gunit_fail_unless (!strcmp (item->str, "3"), str); 144 141 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 148 147 str = g_strdup_printf ("Item should be \"4\" but is %s\n", item->str); 149 148 gunit_fail_unless (!strcmp (item->str, "4"), str); 150 149 g_free (str); 151 150 g_object_unref (G_OBJECT(item)); 152 151 153 152 item = (TnyTestObject*)tny_iterator_iface_current (iterator); 154 153 155 154 str = g_strdup_printf ("Item should be \"4\" but is %s\n", item->str); 156 155 gunit_fail_unless (!strcmp (item->str, "4"), str); … … 165 164 g_free (str); 166 165 167 166 g_object_unref (G_OBJECT(item)); /* need to unref ? */ 167 168 168 iterator = tny_list_iface_create_iterator (iface); 169 169 170 item = (TnyTestObject*)tny_iterator_iface_first (iterator); 171 170 tny_iterator_iface_first (iterator); 171 item = (TnyTestObject*)tny_iterator_iface_current (iterator); 172 172 173 str = g_strdup_printf ("Item should be \"1\" but is %s\n", item->str); 173 174 gunit_fail_unless (!strcmp (item->str, "1"), str); … … 188 189 189 190 g_object_unref (G_OBJECT (iterator)); 190 191 g_object_unref (G_OBJECT(item)); /* need to unref ? */ 191 192 } 192 193 trunk/libtinymail/tny-account-iface.c
r652 r723 474 474 0, 475 475 0, /* n_preallocs */ 476 NULL /* instance_init */ 476 NULL, /* instance_init */ 477 NULL 477 478 }; 478 479 type = g_type_register_static (G_TYPE_INTERFACE, trunk/libtinymail/tny-account-store-iface.c
r652 r723 264 264 0, 265 265 0, /* n_preallocs */ 266 NULL /* instance_init */ 266 NULL, /* instance_init */ 267 NULL 267 268 }; 268 269 type = g_type_register_static (G_TYPE_INTERFACE, trunk/libtinymail/tny-device-iface.c
r520 r723 152 152 0, 153 153 0, /* n_preallocs */ 154 NULL /* instance_init */ 154 NULL, /* instance_init */ 155 NULL 155 156 }; 156 157 type = g_type_register_static (G_TYPE_INTERFACE, trunk/libtinymail/tny-folder-iface.c
r715 r723 404 404 { 405 405 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; 408 409 } 409 410 … … 472 473 0, 473 474 0, /* n_preallocs */ 474 NULL /* instance_init */ 475 NULL, /* instance_init */ 476 NULL 475 477 }; 476 478 type = g_type_register_static (G_TYPE_INTERFACE, trunk/libtinymail/tny-fs-stream.c
r666 r723 278 278 sizeof (TnyFsStream), 279 279 0, /* n_preallocs */ 280 tny_fs_stream_instance_init /* instance_init */ 280 tny_fs_stream_instance_init, /* instance_init */ 281 NULL 281 282 }; 282 283 trunk/libtinymail/tny-header-iface.c
r715 r723 465 465 0, 466 466 0, /* n_preallocs */ 467 NULL /* instance_init */ 467 NULL, /* instance_init */ 468 NULL 468 469 }; 469 470 trunk/libtinymail/tny-iterator-iface.c
r646 r723 27 27 * 28 28 * 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 **/ 31 void 34 32 tny_iterator_iface_next (TnyIteratorIface *self) 35 33 { … … 38 36 g_critical ("You must implement tny_iterator_iface_next\n"); 39 37 #endif 40 41 return TNY_ITERATOR_IFACE_GET_CLASS (self)->next_func (self); 38 TNY_ITERATOR_IFACE_GET_CLASS (self)->next_func (self); 42 39 } 43 40 … … 48 45 * Moves the iterator to the previous node 49 46 * 50 * Return value: the previous value of the underlying #TnyListIface instance 51 * 52 **/ 53 GObject* 47 **/ 48 void 54 49 tny_iterator_iface_prev (TnyIteratorIface *self) 55 50 { … … 58 53 g_critical ("You must implement tny_iterator_iface_prev\n"); 59 54 #endif 60 61 return TNY_ITERATOR_IFACE_GET_CLASS (self)->prev_func (self); 55 TNY_ITERATOR_IFACE_GET_CLASS (self)->prev_func (self); 62 56 } 63 57 … … 69 63 * Moves the iterator to the first node 70 64 * 71 * Return value: the first value of the underlying #TnyListIface instance 72 * 73 **/ 74 GObject* 65 **/ 66 void 75 67 tny_iterator_iface_first (TnyIteratorIface *self) 76 68 { … … 80 72 #endif 81 73 82 returnTNY_ITERATOR_IFACE_GET_CLASS (self)->first_func (self);74 TNY_ITERATOR_IFACE_GET_CLASS (self)->first_func (self); 83 75 } 84 76 … … 93 85 * 94 86 **/ 95 GObject* 87 void 96 88 tny_iterator_iface_nth (TnyIteratorIface *self, guint nth) 97 89 { … … 100 92 g_critical ("You must implement tny_iterator_iface_nth\n"); 101 93 #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); 104 95 } 105 96 … … 121 112 g_critical ("You must implement tny_iterator_iface_current\n"); 122 113 #endif 123 124 114 return TNY_ITERATOR_IFACE_GET_CLASS (self)->current_func (self); 125 115 } … … 148 138 149 139 150 151 152 /**153 * tny_iterator_iface_has_first:154 * @self: A #TnyIteratorIface instance155 *156 * Does not move the iterator157 *158 * Return value: Whether or not there's a first node159 *160 **/161 gboolean162 tny_iterator_iface_has_first (TnyIteratorIface *self)163 {164 #ifdef DEBUG165 if (!TNY_ITERATOR_IFACE_GET_CLASS (self)->has_first_func)166 g_critical ("You must implement tny_iterator_iface_has_first\n");167 #endif168 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 instance175 *176 * Does not move the iterator177 *178 * Return value: Whether or not there's a next node179 *180 **/181 gboolean182 tny_iterator_iface_has_next (TnyIteratorIface *self)183 {184 #ifdef DEBUG185 if (!TNY_ITERATOR_IFACE_GET_CLASS (self)->has_next_func)186 g_critical ("You must implement tny_iterator_iface_has_next\n");187 #endif188 189 return TNY_ITERATOR_IFACE_GET_CLASS (self)->has_next_func (self);190 }191 140 192 141 /** … … 240 189 0, 241 190 0, /* n_preallocs */ 242 NULL /* instance_init */ 191 NULL, /* instance_init */ 192 NULL 243 193 }; 244 194 type = g_type_register_static (G_TYPE_INTERFACE, trunk/libtinymail/tny-iterator-iface.h
r646 r723 39 39 GTypeInterface parent; 40 40 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); 45 45 GObject* (*current_func) (TnyIteratorIface *self); 46 gboolean (*has_first_func) (TnyIteratorIface *self); 47 gboolean (*has_next_func) (TnyIteratorIface *self); 46 48 47 gboolean (*is_done) (TnyIteratorIface *self); 49 48 TnyListIface* (*get_list_func) (TnyIteratorIface *self); … … 52 51 GType tny_iterator_iface_get_type (void); 53 52 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); 53 void tny_iterator_iface_next (TnyIteratorIface *self); 54 void tny_iterator_iface_prev (TnyIteratorIface *self); 55 void tny_iterator_iface_first (TnyIteratorIface *self); 56 void tny_iterator_iface_nth (TnyIteratorIface *self, guint nth); 57 GObject* tny_iterator_iface_current (TnyIteratorIface *self); 58 gboolean tny_iterator_iface_is_done (TnyIteratorIface *self); 62 59 TnyListIface* tny_iterator_iface_get_list (TnyIteratorIface *self); 63 60 trunk/libtinymail/tny-list-iface.c
r665 r723 35 35 g_critical ("You must implement tny_list_iface_length\n"); 36 36 #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); 40 38 } 41 39 … … 185 183 0, 186 184 0, /* n_preallocs */ 187 NULL /* instance_init */ 185 NULL, /* instance_init */ 186 NULL 188 187 }; 189 188 type = g_type_register_static (G_TYPE_INTERFACE, trunk/libtinymail/tny-list-iterator-priv.h
r715 r723 56 56 void _tny_list_iterator_set_model (TnyListIterator *self, TnyList *model); 57 57 TnyListIterator* _tny_header_list_iterator_new (TnyList *model); 58 TnyListIterator* _tny_list_iterator_new (TnyList *model); 58 59 59 60 G_END_DECLS trunk/libtinymail/tny-list-iterator.c
r646 r723 72 72 tny_list_iterator_finalize (GObject *object) 73 73 { 74 TnyListIterator *self = (TnyListIterator *)object;75 76 74 (*parent_class->finalize) (object); 77 75 … … 80 78 81 79 82 static GObject*80 static void 83 81 tny_list_iterator_next (TnyIteratorIface *self) 84 82 { … … 87 85 88 86 if (G_UNLIKELY (!me || !me->current || !me->model)) 89 return NULL;87 return; 90 88 91 89 lpriv = TNY_LIST_GET_PRIVATE (me->model); … … 95 93 g_mutex_unlock (lpriv->iterator_lock); 96 94 97
