2007-08-13 Murray Cumming <murrayc@murrayc.com>
+ * src/widgets/modest-account-view.c: (on_account_changed):
+ Do not try to use the human-readable TnyAccount name instead of the
+ ID of the modest account to get the transport account. And unref
+ the transport account. This prevents a g_warning(), and a possible
+ ref leak.
+
+2007-08-13 Murray Cumming <murrayc@murrayc.com>
+
* src/maemo/modest-platform.c:
(modest_platform_set_update_interval): Handle the new
alarmd error to warn when alarmd is not running, as is the case in
return NULL;
/* Get the connection-specific transport acccount, if any: */
+ /* Note: This gives us a reference: */
TnyAccount *account =
get_smtp_specific_transport_account_for_open_connection (self, account_name);
/* The special local folders don't have transport accounts. */
if (strcmp (account_name, MODEST_LOCAL_FOLDERS_ACCOUNT_ID) == 0)
account = NULL;
- else
+ else {
+ /* Note: This gives us a reference: */
account = modest_tny_account_store_get_server_account (self, account_name,
TNY_ACCOUNT_TYPE_TRANSPORT);
+ }
}
-
+
+ /* returns a reference. */
return account;
}
#include <modest-account-mgr.h>
#include <modest-account-mgr-helpers.h>
+#include <modest-tny-account.h>
#include <modest-text-utils.h>
#include <modest-runtime.h>
ModestAccountViewPrivate *priv = NULL;
TnyTransportAccount *transport_account = NULL;
ModestTnySendQueue *send_queue = NULL;
- const gchar *account_name = NULL;
g_return_if_fail (MODEST_IS_ACCOUNT_VIEW (user_data));
+ g_return_if_fail (account);
+ g_return_if_fail (TNY_IS_ACCOUNT (account));
self = MODEST_ACCOUNT_VIEW (user_data);
priv = MODEST_ACCOUNT_VIEW_GET_PRIVATE (self);
update_account_view (priv->account_mgr, self);
/* Get transport account */
- account_name = tny_account_get_name (account);
- transport_account = (TnyTransportAccount *)
+ const gchar *modest_account_name =
+ modest_tny_account_get_parent_modest_account_name_for_server_account (account);
+ g_return_if_fail (modest_account_name);
+
+ transport_account = (TnyTransportAccount*)
modest_tny_account_store_get_transport_account_for_open_connection (modest_runtime_get_account_store(),
- account_name);
-
- /* Restart send queue */
- g_return_if_fail (TNY_IS_TRANSPORT_ACCOUNT(transport_account));
- send_queue = modest_runtime_get_send_queue (transport_account);
- g_return_if_fail (MODEST_IS_TNY_SEND_QUEUE(send_queue));
- modest_tny_send_queue_try_to_send (send_queue);
+ modest_account_name);
+
+ /* Restart send queue */
+ if (transport_account) {
+ g_return_if_fail (TNY_IS_TRANSPORT_ACCOUNT(transport_account));
+ send_queue = modest_runtime_get_send_queue (transport_account);
+ g_return_if_fail (MODEST_IS_TNY_SEND_QUEUE(send_queue));
+ modest_tny_send_queue_try_to_send (send_queue);
+
+ g_object_unref (transport_account);
+ }
}