Changeset 738
- Timestamp:
- 08/22/06 00:13:59
- Files:
-
- trunk/ChangeLog (modified) (1 diff)
- trunk/configure.ac (modified) (1 diff)
- trunk/libtinymail-camel/tny-account-priv.h (modified) (1 diff)
- trunk/libtinymail-camel/tny-account.c (modified) (4 diffs)
- trunk/libtinymail-camel/tny-account.h (modified) (2 diffs)
- trunk/libtinymail-camel/tny-session-camel.c (modified) (3 diffs)
- trunk/libtinymail-camel/tny-store-account.c (modified) (9 diffs)
- trunk/libtinymail-camel/tny-transport-account.c (modified) (1 diff)
- trunk/libtinymail-gnome-desktop/tny-account-store.c (modified) (5 diffs)
- trunk/libtinymail-gpe/tny-account-store.c (modified) (4 diffs)
- trunk/libtinymail-maemo/tny-account-store.c (modified) (4 diffs)
- trunk/libtinymail-olpc/tny-account-store.c (modified) (4 diffs)
- trunk/libtinymail-test/tny-test-anything.c (modified) (1 diff)
- trunk/libtinymail/tny-account-iface.c (modified) (1 diff)
- trunk/libtinymail/tny-account-iface.h (modified) (2 diffs)
- trunk/tests/Makefile.am (modified) (1 diff)
- trunk/tests/functional/Makefile.am (modified) (2 diffs)
- trunk/tests/functional/folder-lister.c (modified) (1 diff)
- trunk/tests/memory/Makefile.am (modified) (2 diffs)
- trunk/tests/memory/memory-test.c (modified) (1 diff)
- trunk/tests/shared/Makefile.am (modified) (3 diffs)
- trunk/tests/shared/account-store.c (modified) (9 diffs)
- trunk/tests/shared/account-store.h (modified) (2 diffs)
- trunk/tests/shared/device-priv.h (added)
- trunk/tests/shared/device.c (added)
- trunk/tests/shared/device.h (added)
- trunk/tests/shared/platfact.c (added)
- trunk/tests/shared/platfact.h (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/ChangeLog
r726 r738 1 22-08-2006 Philip Van oof <pvanhoof@gnome.org> 2 3 * tests/*: Added some tests 4 1 5 20-08-2006 Philip Van Hoof <pvanhoof@gnome.org> 2 6 trunk/configure.ac
r731 r738 137 137 esac],[build_unittests=false]) 138 138 AM_CONDITIONAL(BUILD_UNITTESTS, test x$build_unittests = xtrue) 139 140 dnl ### Enable building the tests ## 141 AC_ARG_ENABLE(tests, 142 [ --enable-tests build tests [default=no]], 143 [case "${enableval}" in 144 yes) build_tests=true ;; 145 no) build_tests=false ;; 146 *) AC_MSG_ERROR(bad value ${enableval} for --enable-tests) ;; 147 esac],[build_tests=false]) 148 AM_CONDITIONAL(BUILD_TESTS, test x$build_tests = xtrue) 139 149 140 150 dnl ### gtk-doc trunk/libtinymail-camel/tny-account-priv.h
r550 r738 35 35 TnyForgetPassFunc forget_pass_func; 36 36 gboolean pass_func_set, forget_pass_func_set; 37 TnyAccountStoreIface *store;38 37 CamelProviderType type; 39 38 CamelOperation *cancel; trunk/libtinymail-camel/tny-account.c
r700 r738 212 212 } 213 213 214 static void 215 tny_account_set_account_store (TnyAccountIface *self, TnyAccountStoreIface *store) 216 { 217 TnyAccountPriv *priv = TNY_ACCOUNT_GET_PRIVATE (self); 218 219 /* No need to reference (would also be cross reference): If store dies, 220 self should also die. */ 221 222 priv->store = (TnyAccountStoreIface*) store; 223 224 g_static_rec_mutex_lock (priv->service_lock); 225 226 priv->session = tny_account_store_get_session 227 (TNY_ACCOUNT_STORE (priv->store)); 228 214 void 215 tny_account_set_session (TnyAccount *self, TnySessionCamel *session) 216 { 217 TnyAccountPriv *priv = TNY_ACCOUNT_GET_PRIVATE (self); 218 219 g_static_rec_mutex_lock (priv->service_lock); 220 221 priv->session = session; 222 229 223 TNY_ACCOUNT_GET_CLASS (self)->reconnect_func (TNY_ACCOUNT (self)); 230 224 … … 232 226 233 227 return; 234 }235 236 static TnyAccountStoreIface*237 tny_account_get_account_store (TnyAccountIface *self)238 {239 TnyAccountPriv *priv = TNY_ACCOUNT_GET_PRIVATE (self);240 241 return priv->store;242 228 } 243 229 … … 472 458 473 459 priv->options = NULL; 474 priv->store = NULL;475 460 priv->id = NULL; 476 461 priv->user = NULL; … … 618 603 klass->set_id_func = tny_account_set_id; 619 604 klass->get_id_func = tny_account_get_id; 620 klass->set_account_store_func = tny_account_set_account_store;621 klass->get_account_store_func = tny_account_get_account_store;622 605 klass->is_connected_func = tny_account_is_connected; 623 606 klass->set_url_string_func = tny_account_set_url_string; trunk/libtinymail-camel/tny-account.h
r550 r738 23 23 #include <glib.h> 24 24 #include <glib-object.h> 25 25 #include <tny-camel-shared.h> 26 26 #include <tny-account-iface.h> 27 27 … … 56 56 57 57 void tny_account_add_option (TnyAccount *self, const gchar *option); 58 void tny_account_set_session (TnyAccount *self, TnySessionCamel *session); 58 59 59 60 G_END_DECLS trunk/libtinymail-camel/tny-session-camel.c
r729 r738 155 155 GList *copy = password_funcs, *mark_del = NULL; 156 156 PrivPassFunc *pf; 157 CamelSession *me = CAMEL_SESSION (self);157 CamelSession *me = (CamelSession*)self; 158 158 gboolean found = FALSE; 159 159 CamelService *service = (CamelService*)_tny_account_get_service (TNY_ACCOUNT (account)); … … 525 525 tny_session_camel_set_account_store (TnySessionCamel *self, TnyAccountStoreIface *account_store) 526 526 { 527 CamelSession *session = CAMEL_SESSION (self);527 CamelSession *session = (CamelSession*) self; 528 528 TnyDeviceIface *device = (TnyDeviceIface*)tny_account_store_iface_get_device (account_store); 529 529 … … 532 532 gchar *base_directory = g_strdup (tny_account_store_iface_get_cache_dir (account_store)); 533 533 gchar *camel_dir = NULL; 534 534 535 535 if (G_LIKELY (camel_init (base_directory, TRUE) != 0)) 536 536 { trunk/libtinymail-camel/tny-store-account.c
r735 r738 173 173 174 174 priv->service = camel_session_get_service 175 ( CAMEL_SESSION (priv->session), priv->url_string,175 ((CamelSession*) priv->session, priv->url_string, 176 176 priv->type, priv->ex); 177 177 … … 184 184 185 185 priv->service = camel_session_get_service 186 ( CAMEL_SESSION (priv->session), priv->url_string,186 ((CamelSession*) priv->session, priv->url_string, 187 187 priv->type, priv->ex); 188 188 … … 353 353 354 354 g_static_rec_mutex_lock (apriv->service_lock); 355 store = camel_session_get_store ( CAMEL_SESSION (apriv->session),355 store = camel_session_get_store ((CamelSession*) apriv->session, 356 356 apriv->url_string, &ex); 357 357 g_static_rec_mutex_unlock (apriv->service_lock); … … 472 472 { 473 473 TnyAccountPriv *apriv = TNY_ACCOUNT_GET_PRIVATE (self); 474 TnyAccountStoreIface *astore = (TnyAccountStoreIface *)tny_account_iface_get_account_store (TNY_ACCOUNT_IFACE (self));475 474 476 475 CamelException ex = CAMEL_EXCEPTION_INITIALISER; … … 478 477 479 478 g_static_rec_mutex_lock (apriv->service_lock); 480 store = camel_session_get_store ( CAMEL_SESSION (apriv->session),479 store = camel_session_get_store ((CamelSession*) apriv->session, 481 480 apriv->url_string, &ex); 482 481 g_static_rec_mutex_unlock (apriv->service_lock); … … 486 485 tny_store_account_get_folders (self, TNY_STORE_ACCOUNT_FOLDER_TYPE_SUBSCRIBED); 487 486 488 if (astore)489 g_signal_emit (astore, tny_account_store_iface_signals [TNY_ACCOUNT_STORE_IFACE_ACCOUNTS_RELOADED], 0);490 491 487 /* Sync */ 492 488 _tny_folder_set_subscribed_priv (folder, TRUE); … … 499 495 { 500 496 TnyAccountPriv *apriv = TNY_ACCOUNT_GET_PRIVATE (self); 501 TnyAccountStoreIface *astore = (TnyAccountStoreIface *)tny_account_iface_get_account_store (TNY_ACCOUNT_IFACE (self));502 497 503 498 CamelException ex = CAMEL_EXCEPTION_INITIALISER; … … 505 500 506 501 g_static_rec_mutex_lock (apriv->service_lock); 507 store = camel_session_get_store ( CAMEL_SESSION (apriv->session),502 store = camel_session_get_store ((CamelSession*) apriv->session, 508 503 apriv->url_string, &ex); 509 504 g_static_rec_mutex_unlock (apriv->service_lock); … … 512 507 513 508 tny_store_account_get_folders (self, TNY_STORE_ACCOUNT_FOLDER_TYPE_SUBSCRIBED); 514 515 if (astore)516 g_signal_emit (astore, tny_account_store_iface_signals [TNY_ACCOUNT_STORE_IFACE_ACCOUNTS_RELOADED], 0);517 509 518 510 /* Sync */ trunk/libtinymail-camel/tny-transport-account.c
r715 r738 91 91 CamelTransport *transport; 92 92 93 transport = camel_session_get_transport ( CAMEL_SESSION (apriv->session),93 transport = camel_session_get_transport ((CamelSession*) apriv->session, 94 94 apriv->url_string, &ex); 95 95 trunk/libtinymail-gnome-desktop/tny-account-store.c
r729 r738 36 36 37 37 #include <tny-account-iface.h> 38 #include <tny-account.h> 38 39 #include <tny-store-account-iface.h> 39 40 #include <tny-transport-account-iface.h> … … 74 75 { 75 76 gchar *retval = NULL; 76 GList *list;77 GList *list; 77 78 GnomeKeyringResult keyringret; 78 79 gchar *keyring; … … 393 394 if (account) 394 395 { 395 tny_account_ iface_set_account_store (account, self);396 tny_account_set_session (TNY_ACCOUNT (account), priv->session); 396 397 397 398 key = g_strdup_printf ("/apps/tinymail/accounts/%d/proto", i); … … 603 604 { 604 605 TnyAccountStore *self = g_object_new (TNY_TYPE_ACCOUNT_STORE, NULL); 605 606 TnyAccountStorePriv *priv = TNY_ACCOUNT_STORE_GET_PRIVATE (self); 607 priv->session = tny_session_camel_new (TNY_ACCOUNT_STORE_IFACE (self)); 606 608 607 609 return self; … … 626 628 priv->device = tny_platform_factory_iface_new_device (platfact); 627 629 /* tny_device_iface_force_online (priv->device); */ 628 priv->session = tny_session_camel_new (TNY_ACCOUNT_STORE_IFACE (self));630 629 631 630 632 return; trunk/libtinymail-gpe/tny-account-store.c
r729 r738 33 33 #include <tny-account-store-iface.h> 34 34 #include <tny-account-store.h> 35 #include <tny-account.h> 36 35 37 #include <tny-password-dialog.h> 36 38 … … 279 281 if (account) 280 282 { 281 tny_account_iface_set_account_store (account, self); 282 283 tny_account_set_session (TNY_ACCOUNT (account), priv->session); 283 284 284 285 key = g_strdup_printf ("/apps/tinymail/accounts/%d/proto", i); … … 495 496 { 496 497 TnyAccountStore *self = g_object_new (TNY_TYPE_ACCOUNT_STORE, NULL); 498 TnyAccountStorePriv *priv = TNY_ACCOUNT_STORE_GET_PRIVATE (self); 499 priv->session = tny_session_camel_new (TNY_ACCOUNT_STORE_IFACE (self)); 497 500 498 501 return self; … … 519 522 priv->device = tny_platform_factory_iface_new_device (platfact); 520 523 /* tny_device_iface_force_online (priv->device); */ 521 priv->session = tny_session_camel_new (TNY_ACCOUNT_STORE_IFACE (self)); 522 524 523 525 return; 524 526 } trunk/libtinymail-maemo/tny-account-store.c
r729 r738 33 33 #include <tny-account-store-iface.h> 34 34 #include <tny-account-store.h> 35 #include <tny-account.h> 36 35 37 #include <tny-password-dialog.h> 36 38 … … 279 281 if (account) 280 282 { 281 tny_account_ iface_set_account_store (account, self);283 tny_account_set_session (TNY_ACCOUNT (account), priv->session); 282 284 283 285 … … 496 498 { 497 499 TnyAccountStore *self = g_object_new (TNY_TYPE_ACCOUNT_STORE, NULL); 500 TnyAccountStorePriv *priv = TNY_ACCOUNT_STORE_GET_PRIVATE (self); 501 priv->session = tny_session_camel_new (TNY_ACCOUNT_STORE_IFACE (self)); 498 502 499 503 return self; … … 520 524 priv->device = tny_platform_factory_iface_new_device (platfact); 521 525 /* tny_device_iface_force_online (priv->device); */ 522 priv->session = tny_session_camel_new (TNY_ACCOUNT_STORE_IFACE (self)); 523 526 524 527 return; 525 528 } trunk/libtinymail-olpc/tny-account-store.c
r729 r738 32 32 #include <tny-account-store-iface.h> 33 33 #include <tny-account-store.h> 34 #include <tny-account.h> 35 34 36 #include <tny-password-dialog.h> 35 37 … … 240 242 gchar **options; 241 243 242 tny_account_ iface_set_account_store (account, self);244 tny_account_set_session (TNY_ACCOUNT (account), priv->session); 243 245 244 246 proto = g_key_file_get_value (keyfile, "tinymail", "proto", NULL); … … 369 371 { 370 372 TnyAccountStore *self = g_object_new (TNY_TYPE_ACCOUNT_STORE, NULL); 371 373 TnyAccountStorePriv *priv = TNY_ACCOUNT_STORE_GET_PRIVATE (self); 374 priv->session = tny_session_camel_new (TNY_ACCOUNT_STORE_IFACE (self)); 375 372 376 return self; 373 377 } … … 383 387 priv->device = tny_platform_factory_iface_new_device (platfact); 384 388 /* tny_device_iface_force_online (priv->device); */ 385 priv->session = tny_session_camel_new (TNY_ACCOUNT_STORE_IFACE (self)); 386 389 387 390 return; 388 391 } trunk/libtinymail-test/tny-test-anything.c
r715 r738 115 115 TNY_MIME_PART_IFACE (tny_mime_part_new (camel_mime_part_new())); 116 116 117 tny_account_iface_set_account_store (TNY_ACCOUNT_IFACE (account), 118 TNY_ACCOUNT_STORE_IFACE (tny_account_store_get_instance ())); 117 // tny_account_iface_set_session (TNY_ACCOUNT_IFACE (account), session); 119 118 120 119 /* tny_account_iface_set_user (TNY_ACCOUNT_IFACE (account), ""); */ trunk/libtinymail/tny-account-iface.c
r723 r738 79 79 } 80 80 81 82 /**83 * tny_account_iface_set_account_store:84 * @self: a #TnyAccountIface object85 * @store: a #TnyAccountStoreIface object86 *87 * Set the parent account store for the account. You need to set this property88 * before you can start using the account.89 *90 **/91 void92 tny_account_iface_set_account_store (TnyAccountIface *self, TnyAccountStoreIface *store)93 {94 #ifdef DEBUG95 if (!TNY_ACCOUNT_IFACE_GET_CLASS (self)->set_account_store_func)96 g_critical ("You must implement tny_account_iface_set_account_store\n");97 #endif98 99 TNY_ACCOUNT_IFACE_GET_CLASS (self)->set_account_store_func (self, store);100 return;101 }102 103 /**104 * tny_account_iface_get_account_store:105 * @self: a #TnyAccountIface object106 *107 * Get the parent store for the account.108 *109 * Return value: the store or NULL if none110 **/111 TnyAccountStoreIface*112 tny_account_iface_get_account_store (TnyAccountIface *self)113 {114 #ifdef DEBUG115 if (!TNY_ACCOUNT_IFACE_GET_CLASS (self)->get_account_store_func)116 g_critical ("You must implement tny_account_iface_get_account_store\n");117 #endif118 119 return TNY_ACCOUNT_IFACE_GET_CLASS (self)->get_account_store_func (self);120 }121 81 122 82 /** trunk/libtinymail/tny-account-iface.h
r652 r738 67 67 const gchar* (*get_url_string_func) (TnyAccountIface *self); 68 68 TnyAccountType (*get_account_type_func) (TnyAccountIface *self); 69 70 void (*set_account_store_func) (TnyAccountIface *self, TnyAccountStoreIface *store);71 TnyAccountStoreIface* (*get_account_store_func) (TnyAccountIface *self);72 73 69 }; 74 70 … … 103 99 TnyForgetPassFunc tny_account_iface_get_forget_pass_func (TnyAccountIface *self); 104 100 105 void tny_account_iface_set_account_store (TnyAccountIface *self, TnyAccountStoreIface *store);106 TnyAccountStoreIface* tny_account_iface_get_account_store (TnyAccountIface *self);107 108 101 G_END_DECLS 109 102 trunk/tests/Makefile.am
r735 r738 1 1 SUBDIRS = python-demo 2 2 3 if BUILD_ UNITTESTS3 if BUILD_TESTS 4 4 SUBDIRS += shared memory functional 5 5 endif trunk/tests/functional/Makefile.am
r731 r738 5 5 -I$(top_srcdir)/libtinymailui-gtk \ 6 6 -I$(top_srcdir)/libtinymail-camel \ 7 -I$(top_srcdir)/$(PLATFORMDIR) \8 7 -DASYNC_HEADERS 9 8 … … 27 26 $(top_builddir)/libtinymailui-gtk/libtinymailui-gtk-$(API_VERSION).la \ 28 27 $(top_builddir)/libtinymail-camel/libtinymail-camel-$(API_VERSION).la \ 29 $(top_builddir)/$(PLATFORMDIR)/$(PLATFORMDIR)-$(API_VERSION).la \30 28 $(top_builddir)/tests/shared/libtestsshared.a 31 29 trunk/tests/functional/folder-lister.c
r731 r738 68 68 { 69 69 TnyAccountStoreIface *account_store = TNY_ACCOUNT_STORE_IFACE 70 (tny_ memtest_account_store_new ());70 (tny_account_store_new ()); 71 71 TnyListIface *accounts = tny_list_new (), *folders; 72 72 TnyStoreAccountIface *account; trunk/tests/memory/Makefile.am
r728 r738 5 5 -I$(top_srcdir)/libtinymailui-gtk \ 6 6 -I$(top_srcdir)/libtinymail-camel \ 7 -I$(top_srcdir)/$(PLATFORMDIR) \8 7 -DASYNC_HEADERS 9 8 … … 27 26 $(top_builddir)/libtinymailui-gtk/libtinymailui-gtk-$(API_VERSION).la \ 28 27 $(top_builddir)/libtinymail-camel/libtinymail-camel-$(API_VERSION).la \ 29 $(top_builddir)/$(PLATFORMDIR)/$(PLATFORMDIR)-$(API_VERSION).la \30 28 $(top_builddir)/tests/shared/libtestsshared.a 31 29 trunk/tests/memory/memory-test.c
r736 r738 74 74 { 75 75 TnyAccountStoreIface *account_store = TNY_ACCOUNT_STORE_IFACE 76 (tny_ memtest_account_store_new ());76 (tny_account_store_new ()); 77 77 TnyListIface *accounts = tny_list_new (), *folders; 78 78 TnyStoreAccountIface *account; trunk/tests/shared/Makefile.am
r728 r738 4 4 -I$(top_srcdir)/libtinymailui \ 5 5 -I$(top_srcdir)/libtinymailui-gtk \ 6 -I$(top_srcdir)/libtinymail-camel \ 7 -I$(top_srcdir)/$(PLATFORMDIR) \ 6 -I$(top_srcdir)/libtinymail-camel \ 8 7 -DASYNC_HEADERS 9 8 … … 17 16 18 17 noinst_LIBRARIES = libtestsshared.a 19 libtestsshared_a_SOURCES = account-store.c account-store.h 18 libtestsshared_a_SOURCES = account-store.c account-store.h \ 19 platfact.c platfact.h device.c device.h device-priv.h 20 20 21 libtestsshared_a_LDFLAGS = $(LIBTINYMAIL_LIBS) \ 21 22 $(LIBTINYMAIL_GNOME_DESKTOP_LIBS) \ … … 23 24 $(top_builddir)/libtinymailui/libtinymailui-$(API_VERSION).la \ 24 25 $(top_builddir)/libtinymailui-gtk/libtinymailui-gtk-$(API_VERSION).la \ 25 $(top_builddir)/libtinymail-camel/libtinymail-camel-$(API_VERSION).la \ 26 $(top_builddir)/$(PLATFORMDIR)/$(PLATFORMDIR)-$(API_VERSION).la 26 $(top_builddir)/libtinymail-camel/libtinymail-camel-$(API_VERSION).la trunk/tests/shared/account-store.c
r737 r738 27 27 28 28 #include <tny-platform-factory-iface.h> 29 #include <tny-platform-factory.h>29 #include "platfact.h" 30 30 31 31 #include <tny-account-store-iface.h> 32 32 #include <tny-account-iface.h> 33 #include <tny-account.h> 34 33 35 #include <tny-store-account-iface.h> 34 36 #include <tny-transport-account-iface.h> … … 36 38 #include <tny-transport-account.h> 37 39 #include <tny-device-iface.h> 38 #include <tny-device.h> 40 41 #include "device.h" 39 42 40 43 #include <tny-camel-shared.h> … … 61 64 62 65 static gboolean 63 tny_ memtest_account_store_alert (TnyAccountStoreIface *self, TnyAlertType type, const gchar *prompt)66 tny_account_store_alert (TnyAccountStoreIface *self, TnyAlertType type, const gchar *prompt) 64 67 { 65 68 return TRUE; … … 68 71 69 72 static const gchar* 70 tny_memtest_account_store_get_cache_dir (TnyAccountStoreIface *self) 71 { 72 /* FIXME: Small memleak here */ 73 return g_build_filename (g_get_home_dir (), ".tinymail", NULL); 74 } 75 76 77 static void 78 tny_memtest_account_store_get_accounts (TnyAccountStoreIface *self, TnyListIface *list, TnyGetAccountsRequestType types) 79 { 73 tny_account_store_get_cache_dir (TnyAccountStoreIface *self) 74 { 75 TnyAccountStore *me = (TnyAccountStore*) self; 76 77 if (!me->cache_dir) 78 { 79 gint att=0; 80 GDir *dir = NULL; 81 do { 82 gchar *attempt = g_strdup_printf ("tinymail.%d", att); 83 gchar *str = g_build_filename (g_get_tmp_dir (), attempt, NULL); 84 g_free (attempt); 85 dir = g_dir_open (str, 0, NULL); 86 if (dir) 87 { 88 g_dir_close (dir); 89 g_free (str); 90 } else 91 me->cache_dir = str; 92 att++; 93 } while (dir != NULL); 94 } 95 96 return me->cache_dir; 97 } 98 99 100 static void 101 tny_account_store_get_accounts (TnyAccountStoreIface *self, TnyListIface *list, TnyGetAccountsRequestType types) 102 { 103 TnyAccountStore *me = (TnyAccountStore *) self; 104 80 105 TnyAccountIface *account = TNY_ACCOUNT_IFACE (tny_store_account_new ()); 81 106 82 83 107 /* Dear visitor of the SVN-web. This is indeed a fully functional and 84 working IMAP account. This does not mean that you need to fuck it up. 85 86 And I know you can. Just like I can very easily correct your mess by 87 restoring the backup. 88 89 The purpose of this account is testing software. Not your enjoyment 90 nor showing your friends how 3l33t you are (in which case you most 91 certainly aren't. In that case you are just a pain in the ass or a 92 piece of stinking shit being annoying to people). 93 94 So .. please DO use the account of preparing your automated tests. 95 96 But don't screwup the account. */ 97 98 tny_account_iface_set_account_store (account, (TnyAccountStoreIface*)self); 99 tny_account_iface_set_proto (TNY_ACCOUNT_IFACE (account), "imap"); 100 tny_account_iface_set_name (TNY_ACCOUNT_IFACE (account), "unit test account"); 101 tny_account_iface_set_user (TNY_ACCOUNT_IFACE (account), "tinymailunittest"); 102 tny_account_iface_set_hostname (TNY_ACCOUNT_IFACE (account), "mail.tinymail.org"); 103 tny_account_iface_set_id (TNY_ACCOUNT_IFACE (account), "unique"); 104 tny_account_iface_set_forget_pass_func (TNY_ACCOUNT_IFACE (account), 105 per_account_forget_pass_func); 106 tny_account_iface_set_pass_func (TNY_ACCOUNT_IFACE (account), 107 per_account_get_pass_func); 108 working IMAP account. This does not mean that you need to fuck it up */ 109 110 tny_account_set_session (TNY_ACCOUNT (account), me->session); 111 112 tny_account_iface_set_proto (account, "imap"); 113 tny_account_iface_set_name (account, "unit test account"); 114 tny_account_iface_set_user (account, "tinymailunittest"); 115 tny_account_iface_set_hostname (account, "mail.tinymail.org"); 116 tny_account_iface_set_id (account, "unique"); 117 tny_account_iface_set_forget_pass_func (account, per_account_forget_pass_func); 118 tny_account_iface_set_pass_func (account, per_account_get_pass_func); 108 119 109 120 tny_list_iface_prepend (list, (GObject*)account); … … 115 126 116 127 117 static void 118 tny_memtest_account_store_add_account (TnyAccountStoreIface *self, TnyAccountIface *account, const gchar *type) 119 { 120 return; 121 } 122 123 124 125 TnyMemTestAccountStore* 126 tny_memtest_account_store_new (void) 127 { 128 TnyMemTestAccountStore *self = g_object_new (TNY_TYPE_MEMTEST_ACCOUNT_STORE, NULL); 129 128 TnyAccountStore* 129 tny_account_store_new (void) 130 { 131 TnyAccountStore *self = g_object_new (TNY_TYPE_ACCOUNT_STORE, NULL); 132 133 self->session = tny_session_camel_new (TNY_ACCOUNT_STORE_IFACE (self)); 134 130 135 return self; 131 136 } … … 133 138 134 139 static void 135 tny_memtest_account_store_instance_init (GTypeInstance *instance, gpointer g_class) 136 { 137 TnyDeviceIface *device = tny_account_store_iface_get_device (TNY_ACCOUNT_STORE_IFACE (instance)); 138 139 tny_device_iface_force_online (device); 140 141 return; 142 } 143 144 145 static void 146 tny_memtest_account_store_finalize (GObject *object) 147 { 140 tny_account_store_instance_init (GTypeInstance *instance, gpointer g_class) 141 { 142 TnyAccountStore *self = (TnyAccountStore *)instance; 143 TnyPlatformFactoryIface *platfact = TNY_PLATFORM_FACTORY_IFACE ( 144 tny_platform_factory_get_instance ()); 145 146 self->device = tny_platform_factory_iface_new_device (platfact); 147 /* tny_device_iface_force_online (priv->device); */ 148 149 return; 150 } 151 152 153 static void 154 tny_account_store_finalize (GObject *object) 155 { 156 TnyAccountStore *me = (TnyAccountStore*) object; 157 158 if (me->cache_dir) 159 g_free (me->cache_dir); 160 148 161 (*parent_class->finalize) (object); 149 162 … … 153 166 154 167 static void 155 tny_ memtest_account_store_class_init (TnyMemTestAccountStoreClass *class)168 tny_account_store_class_init (TnyAccountStoreClass *class) 156 169 { 157 170 GObjectClass *object_class; 158 171 159 172 parent_class = g_type_class_peek_parent (class); 160 173 object_class = (GObjectClass*) class; 161 174 162 object_class->finalize = tny_memtest_account_store_finalize; 163 164 return; 165 } 166 167 static void 168 tny_memtest_account_store_iface_init (gpointer g_iface, gpointer iface_data) 175 object_class->finalize = tny_account_store_finalize; 176 177 return; 178 } 179 180 181 static void 182 tny_account_store_add_store_account (TnyAccountStoreIface *self, TnyStoreAccountIface *account) 183 { 184 return; 185 } 186 187 static void 188 tny_account_store_add_transport_account (TnyAccountStoreIface *self, TnyTransportAccountIface *account) 189 { 190 return; 191 } 192 193 static TnyDeviceIface* 194 tny_account_store_get_device (TnyAccountStoreIface *self) 195 { 196 TnyAccountStore *me = (TnyAccountStore*) self; 197 198 return me->device; 199 } 200 201 202 static void 203 tny_account_store_iface_init (gpointer g_iface, gpointer iface_data) 169 204 { 170 205 TnyAccountStoreIfaceClass *klass = (TnyAccountStoreIfaceClass *)g_iface; 171 206 172 klass->get_accounts_func = tny_memtest_account_store_get_accounts; 173 klass->get_cache_dir_func = tny_memtest_account_store_get_cache_dir; 174 klass->alert_func = tny_memtest_account_store_alert; 207 klass->get_accounts_func = tny_account_store_get_accounts; 208 klass->get_cache_dir_func = tny_account_store_get_cache_dir; 209 klass->alert_func = tny_account_store_alert; 210 klass->add_store_account_func = tny_account_store_add_store_account; 211 klass->add_transport_account_func = tny_account_store_add_transport_account; 212 klass->get_device_func = tny_account_store_get_device; 175 213 176 214 return; … … 179 217 180 218 GType 181 tny_ memtest_account_store_get_type (void)219 tny_account_store_get_type (void) 182 220 { 183 221 static GType type = 0; … … 187 225 static const GTypeInfo info = 188 226 { 189 sizeof (Tny MemTestAccountStoreClass),227 sizeof (TnyAccountStoreClass), 190 228 NULL, /* base_init */ 191 229 NULL, /* base_finalize */ 192 (GClassInitFunc) tny_ memtest_account_store_class_init, /* class_init */230 (GClassInitFunc) tny_account_store_class_init, /* class_init */ 193 231 NULL, /* class_finalize */ 194 232 NULL, /* class_data */ 195 sizeof (Tny MemTestAccountStore),233 sizeof (TnyAccountStore), 196 234 0, /* n_preallocs */ 197 tny_ memtest_account_store_instance_init /* instance_init */235 tny_account_store_instance_init /* instance_init */ 198 236 }; 199 237 200 static const GInterfaceInfo tny_ memtest_account_store_iface_info =238 static const GInterfaceInfo tny_account_store_iface_info = 201 239 { 202 (GInterfaceInitFunc) tny_ memtest_account_store_iface_init, /* interface_init */240 (GInterfaceInitFunc) tny_account_store_iface_init, /* interface_init */ 203 241 NULL, /* interface_finalize */ 204 242 NULL /* interface_data */ 205 243 }; 206 244 207 type = g_type_register_static ( TNY_TYPE_ACCOUNT_STORE,208 "Tny MemTestAccountStore",245 type = g_type_register_static (G_TYPE_OBJECT, 246 "TnyAccountStore", 209 247 &info, 0); 210 248 211 249 g_type_add_interface_static (type, TNY_TYPE_ACCOUNT_STORE_IFACE, 212 &tny_ memtest_account_store_iface_info);250 &tny_account_store_iface_info); 213 251 } 214 252 trunk/tests/shared/account-store.h
r728 r738 1 #ifndef TNY_ MEMTEST_ACCOUNT_STORE_H2 #define TNY_ MEMTEST_ACCOUNT_STORE_H1 #ifndef TNY_ACCOUNT_STORE_H 2 #define TNY_ACCOUNT_STORE_H 3 3 4 4 /* tinymail - Tiny Mail … … 23 23 #include <glib-object.h> 24 24 #include <tny-shared.h> 25 #include <tny-account-store.h>26 25 #include <tny-camel-shared.h> 27 26 28 27 G_BEGIN_DECLS 29 28 30 #define TNY_TYPE_ MEMTEST_ACCOUNT_STORE (tny_memtest_account_store_get_type ())31 #define TNY_ MEMTEST_ACCOUNT_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TNY_TYPE_MEMTEST_ACCOUNT_STORE, TnyMemTestAccountStore))32 #define TNY_ MEMTEST_ACCOUNT_STORE_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), TNY_TYPE_MEMTEST_ACCOUNT_STORE, TnyMemTestAccountStoreClass))33 #define TNY_IS_ MEMTEST_ACCOUNT_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TNY_TYPE_MEMTEST_ACCOUNT_STORE))34 #define TNY_IS_ MEMTEST_ACCOUNT_STORE_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), TNY_TYPE_MEMTEST_ACCOUNT_STORE))35 #define TNY_ MEMTEST_ACCOUNT_STORE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), TNY_TYPE_MEMTEST_ACCOUNT_STORE, TnyMemTestAccountStoreClass))29 #define TNY_TYPE_ACCOUNT_STORE (tny_account_store_get_type ()) 30 #define TNY_ACCOUNT_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TNY_TYPE_ACCOUNT_STORE, TnyAccountStore)) 31 #define TNY_ACCOUNT_STORE_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), TNY_TYPE_ACCOUNT_STORE, TnyAccountStoreClass)) 32 #define TNY_IS_ACCOUNT_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TNY_TYPE_ACCOUNT_STORE)) 33 #define TNY_IS_ACCOUNT_STORE_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), TNY_TYPE_ACCOUNT_STORE)) 34 #define TNY_ACCOUNT_STORE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), TNY_TYPE_ACCOUNT_STORE, TnyAccountStoreClass)) 36 35 37 typedef struct _Tny MemTestAccountStore TnyMemTestAccountStore;38 typedef struct _Tny MemTestAccountStoreClass TnyMemTestAccountStoreClass;36 typedef struct _TnyAccountStore TnyAccountStore; 37 typedef struct _TnyAccountStoreClass TnyAccountStoreClass; 39 38 40 struct _Tny MemTestAccountStore39 struct _TnyAccountStore 41 40 { 42 TnyAccountStore parent; 41 GObject parent; 42 43 gchar *cache_dir; 44 TnySessionCamel *session; 45 TnyDeviceIface *device; 43 46 }; 44 47 45 struct _Tny MemTestAccountStoreClass48 struct _TnyAccountStoreClass 46 49 { 47 TnyAccountStoreClass parent;50 GObjectClass parent; 48 51 }; 49 52 50 GType tny_ memtest_account_store_get_type (void);51 Tny MemTestAccountStore* tny_memtest_account_store_new (void);52 TnySessionCamel* tny_ memtest_account_store_get_session (TnyMemTestAccountStore *self);53 GType tny_account_store_get_type (void); 54 TnyAccountStore* tny_account_store_new (void); 55 TnySessionCamel* tny_account_store_get_session (TnyAccountStore *self); 53 56 <
