From 683b5951944ff49d5e2e7a5241d8dc1796841b7e Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Fri, 31 Aug 2007 14:06:54 +0000 Subject: [PATCH 1/1] * only allow real, non-pseudo accounts pmo-trunk-r3172 --- src/widgets/modest-window.c | 20 ++++++++++++++++++-- src/widgets/modest-window.h | 3 ++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/widgets/modest-window.c b/src/widgets/modest-window.c index 2469941..b5c3d8d 100644 --- a/src/widgets/modest-window.c +++ b/src/widgets/modest-window.c @@ -33,6 +33,7 @@ #include "modest-tny-platform-factory.h" #include "modest-runtime.h" #include "modest-window-mgr.h" +#include /* for strcmp */ /* 'private'/'protected' functions */ static void modest_window_class_init (ModestWindowClass *klass); @@ -166,17 +167,32 @@ const gchar* modest_window_get_active_account (ModestWindow *self) { g_return_val_if_fail (self, NULL); - + //g_warning ("%s: %s", __FUNCTION__, MODEST_WINDOW_GET_PRIVATE(self)->active_account); return MODEST_WINDOW_GET_PRIVATE(self)->active_account; } void modest_window_set_active_account (ModestWindow *self, const gchar *active_account) { - ModestWindowPrivate *priv; + ModestWindowPrivate *priv; + g_return_if_fail (self); priv = MODEST_WINDOW_GET_PRIVATE(self); + //g_warning ("%s: %s", __FUNCTION__, active_account); + + /* only 'real' account should be set here; for example the email signature + * depends on the current account, so if you reply to a message in your + * archive, it should take the signature from the real active account, + * not the non-existing one from your mmc-pseudo-account + */ + if (active_account && ((strcmp (active_account, MODEST_LOCAL_FOLDERS_ACCOUNT_ID) == 0) || + (strcmp (active_account, MODEST_MMC_ACCOUNT_ID) == 0))) { + g_warning ("%s: %s is not a valid active account", + __FUNCTION__, active_account); + return; + } + if (active_account == priv->active_account) return; else { diff --git a/src/widgets/modest-window.h b/src/widgets/modest-window.h index d3fa65d..b351ff5 100644 --- a/src/widgets/modest-window.h +++ b/src/widgets/modest-window.h @@ -137,7 +137,8 @@ const gchar* modest_window_get_active_account (ModestWindow *self); * @self: a modest window instance * @active_account: a new active account name for this window * - * set the active account for this window + * set the active account for this window. + * NOTE: this must be a valid, non-pseudo account. * */ void modest_window_set_active_account (ModestWindow *self, const gchar *active_account); -- 1.7.9.5