X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fmodest-tny-account-store.c;h=5373c30929b8774bb490dd04a766886b8e9ab4d0;hp=2da76dbd87a2d6e8e7f140babf4254c733a41ee2;hb=68c46ab60057371ae8752ce6a4b63e835401e019;hpb=5cdabd649e46ee673b0d908831d15ccb5122942a diff --git a/src/modest-tny-account-store.c b/src/modest-tny-account-store.c index 2da76db..5373c30 100644 --- a/src/modest-tny-account-store.c +++ b/src/modest-tny-account-store.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -46,6 +47,7 @@ struct _ModestTnyAccountStorePrivate { gchar *cache_dir; TnySessionCamel *tny_session_camel; + TnyDeviceIface *device; ModestAccountMgr *modest_acc_mgr; }; @@ -83,7 +85,7 @@ modest_tny_account_store_get_type (void) my_type = g_type_register_static (TNY_TYPE_ACCOUNT_STORE, "ModestTnyAccountStore", &my_info, 0); - g_type_add_interface_static (my_type, TNY_TYPE_ACCOUNT_STORE_IFACE, + g_type_add_interface_static (my_type, TNY_TYPE_ACCOUNT_STORE_IFACE, &iface_info); } return my_type; @@ -118,6 +120,7 @@ modest_tny_account_store_init (ModestTnyAccountStore *obj) MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(obj); priv->modest_acc_mgr = NULL; + priv->device = NULL; priv->store_accounts = NULL; priv->transport_accounts = NULL; @@ -163,6 +166,11 @@ modest_tny_account_store_finalize (GObject *obj) priv->tny_session_camel = NULL; } + if (priv->device) { + g_object_unref (G_OBJECT(priv->device)); + priv->device = NULL; + } + priv->store_accounts = free_gobject_list (priv->store_accounts); priv->transport_accounts = free_gobject_list (priv->store_accounts); @@ -186,10 +194,16 @@ modest_tny_account_store_new (ModestAccountMgr *modest_acc_mgr) priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(obj); g_object_ref(G_OBJECT(priv->modest_acc_mgr = modest_acc_mgr)); + priv->device = (TnyDeviceIface*)tny_device_new(); + if (!priv->device) { + g_warning ("Cannot create Device instance"); + g_object_unref (obj); + return NULL; + } priv->tny_session_camel = tny_session_camel_new (TNY_ACCOUNT_STORE_IFACE(obj)); if (!priv->tny_session_camel) { - g_warning ("cannot create TnySessionCamel instance"); + g_warning ("Cannot create TnySessionCamel instance"); g_object_unref (obj); return NULL; } @@ -207,8 +221,6 @@ get_password (TnyAccountIface *account, const gchar *prompt) ModestTnyAccountStorePrivate *priv; gchar *val; - g_message (__FUNCTION__); - g_return_val_if_fail (account, NULL); key = tny_account_iface_get_id (account); @@ -219,8 +231,8 @@ get_password (TnyAccountIface *account, const gchar *prompt) val = modest_account_mgr_get_server_account_string (priv->modest_acc_mgr, key, MODEST_ACCOUNT_PASSWORD, - NULL); - if (!val || strlen(val)==0) + NULL); + if (!val) { /* FIXME: * append the prompt to the emitted signal, @@ -415,12 +427,9 @@ modest_tny_account_store_get_store_accounts (TnyAccountStoreIface *iface) MODEST_PROTO_TYPE_STORE, NULL, FALSE); - g_message ("accounts: %d", g_slist_length (accounts)); tny_accounts = tny_accounts_from_server_accounts (self, accounts, TRUE); g_slist_free (accounts); - g_message ("store accounts: %d", g_list_length (tny_accounts)); - - + /* * FIXME: after gconf notification support is added, * we can simply return priv->store_account @@ -488,9 +497,6 @@ tny_account_store_get_session (TnyAccountStore *self) priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self); - g_message ("returning tny session camel %p", - priv->tny_session_camel); - return priv->tny_session_camel; } @@ -527,7 +533,9 @@ modest_tny_account_store_get_cache_dir (TnyAccountStoreIface *self) static const TnyDeviceIface* modest_tny_account_store_get_device (TnyAccountStoreIface *self) { - return NULL; /* FIXME */ + ModestTnyAccountStorePrivate *priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE (self); + + return priv->device; }