+2007-04-30 Murray Cumming <murrayc@murrayc.com>
+
+ * src/modest-account-mgr-helpers.c:
+ (modest_account_mgr_get_account_data): Add a more helpful error message, and comment,
+ for the case that the account does not exist.
+
+ * src/widgets/modest-folder-view.c: (filter_row): Use the tinymail account ID
+ (equivalent to the modest account name) rather than the tinymail account name
+ (equivalent to the modest account title - human readable) to get the account data.
+ Check for null account data to prevent the crash, and add a TODO comment saying that
+ this needs fixing because it is using the server account name instead of the account name.
+
2007-04-29 Murray Cumming <murrayc@murrayc.com>
* src/maemo/easysetup/modest-easysetup-wizard.c: (show_error):
g_return_val_if_fail (self, NULL);
g_return_val_if_fail (name, NULL);
- g_return_val_if_fail (modest_account_mgr_account_exists (self, name,FALSE), NULL);
+
+ if (!modest_account_mgr_account_exists (self, name, FALSE)) {
+ /* For instance, maybe you are mistakenly checking for a server account name? */
+ g_warning ("%s: Account %s does not exist.", __FUNCTION__, name);
+ return NULL;
+ }
+
data = g_slice_new0 (ModestAccountData);
data->account_name = g_strdup (name);
ModestAccountMgr *mgr;
acc = TNY_ACCOUNT (instance);
- account_id = tny_account_get_id (acc);
+ account_id = tny_account_get_id (acc); /* Non human-readable name, not the title */
mgr = modest_runtime_get_account_mgr ();
- acc_data = modest_account_mgr_get_account_data (mgr, tny_account_get_name (acc));
-
- if (strcmp (account_id, MODEST_LOCAL_FOLDERS_ACCOUNT_ID) &&
- strcmp (account_id, MODEST_MMC_ACCOUNT_ID)) {
- /* Show only the default account */
- if (!acc_data->is_default)
- retval = FALSE;
+
+ /* TODO: This does not work because acc is the _server_account,
+ * and this code assumes that it is the normal account, which uses a server account.
+ * Maybe we need some way to get the parent account from the server account.
+ */
+ acc_data = modest_account_mgr_get_account_data (mgr, account_id);
+ if (acc_data) {
+ if (strcmp (account_id, MODEST_LOCAL_FOLDERS_ACCOUNT_ID) &&
+ strcmp (account_id, MODEST_MMC_ACCOUNT_ID)) {
+ /* Show only the default account */
+ if (!acc_data->is_default)
+ retval = FALSE;
+ }
+ modest_account_mgr_free_account_data (mgr, acc_data);
}
- modest_account_mgr_free_account_data (mgr, acc_data);
}
g_object_unref (instance);