.IP "abort-on-warning"
Abort the program when any Gtk/Glib warning or error occurs. This can be
useful when running inside a debugger.
+.IP "debug-code"
+Run various pieces of debug-only code in modest
.IP "log-actions"
Log actions to the log file (not available yet)
.IP "debug-objects"
#
# Makefile.am
-# Time-stamp: <2007-10-26 12:47:06 (djcb)>
+# Time-stamp: <2007-11-14 22:42:34 (djcb)>
SUBDIRS=$(MODEST_PLATFORM) widgets $(dbus_api)
modest-conf.c \
modest-conf.h \
modest-defs.h \
+ modest-debug.h \
modest-dimming-rule.c \
modest-dimming-rule.h \
modest-dimming-rules-group.c \
--- /dev/null
+/* Copyright (c) 2006, Nokia Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the Nokia Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __MODEST_DEBUG_H__
+#define __MODEST_DEBUG_H__
+
+#include "modest-runtime.h"
+
+/* some debugging macros */
+
+/**
+ * MODEST_RUNTIME_VERIFY_OBJECT_LAST_REF:
+ * @OBJ: some (GObject) ptr
+ * @NAME: name of @OBJ
+ *
+ * macro to check whether @obj holds only one more ref (ie. after the
+ * next unref it will die)
+ *
+ * not, a g_warning will be issued on stderr. NOTE: this is only active
+ * when MODEST_DEBUG contains "debug-objects".
+ *
+ ***/
+#define MODEST_DEBUG_VERIFY_OBJECT_LAST_REF(OBJ,name) \
+ do { \
+ if (modest_runtime_get_debug_flags() & MODEST_RUNTIME_DEBUG_OBJECTS) \
+ if (G_IS_OBJECT(OBJ) && G_OBJECT(OBJ)->ref_count != 1) \
+ g_warning ("%s:%d: %s (" \
+ #OBJ ") still holds a ref count of %d", \
+ __FILE__,__LINE__,name, G_OBJECT(OBJ)->ref_count); \
+ } while (0)
+
+
+
+
+/**
+ * MODEST_DEBUG_BLOCK:
+ * @BLOCK: some block of code
+ *
+ * macro to which run its argument (block) only when MODEST_DEBUG contains "debug-code"
+ *
+ ***/
+#define MODEST_DEBUG_BLOCK(BLOCK) \
+ do { \
+ if (modest_runtime_get_debug_flags() & MODEST_RUNTIME_DEBUG_CODE) { \
+ BLOCK \
+ } \
+ } while (0)
+
+
+/**
+ * MODEST_DEBUG_NOT_IMPLEMENTED:
+ * @WIN: the parent GtkWindow, or NULL
+ *
+ * give a not-implemented-yet warning popup or g_warning
+ *
+ ***/
+#define MODEST_DEBUG_NOT_IMPLEMENTED(WIN) \
+ do { \
+ if (gtk_main_level() > 0) { \
+ GtkWidget *popup; \
+ popup = gtk_message_dialog_new (WIN,\
+ GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,\
+ GTK_MESSAGE_WARNING, \
+ GTK_BUTTONS_OK, \
+ "Not yet implemented");\
+ gtk_dialog_run (GTK_DIALOG(popup)); \
+ gtk_widget_destroy (popup); \
+ } else \
+ g_warning ("%s:%d: Not yet implemented",__FILE__,__LINE__); \
+ } while (0) \
+
+
+#endif /*__MODEST_DEBUG_H__*/
gflags = 0;
mflags = modest_runtime_get_debug_flags ();
- if (mflags & MODEST_RUNTIME_DEBUG_DEBUG_OBJECTS)
+ if (mflags & MODEST_RUNTIME_DEBUG_OBJECTS)
gflags |= G_TYPE_DEBUG_OBJECTS;
- if (mflags & MODEST_RUNTIME_DEBUG_DEBUG_SIGNALS)
+ if (mflags & MODEST_RUNTIME_DEBUG_SIGNALS)
gflags |= G_TYPE_DEBUG_SIGNALS;
g_type_init_with_debug_flags (gflags);
#include <modest-account-mgr-helpers.h>
#include <modest-icon-names.h>
#include <modest-ui-actions.h>
+#include <modest-debug.h>
static ModestSingletons *_singletons = NULL;
return TRUE; /* uninit maybe called if runtime_init failed */
g_return_val_if_fail (MODEST_IS_SINGLETONS(_singletons), FALSE);
-
+
if (_account_store) {
- modest_runtime_verify_object_last_ref(_account_store,"");
- g_object_unref(G_OBJECT(_account_store));
+ MODEST_DEBUG_VERIFY_OBJECT_LAST_REF(_account_store,"");
+ g_object_unref(_account_store);
_account_store = NULL;
}
-
- modest_runtime_verify_object_last_ref(_singletons,"");
- g_object_unref(G_OBJECT(_singletons));
+
+ MODEST_DEBUG_VERIFY_OBJECT_LAST_REF(_singletons,"");
+ g_object_unref(_singletons);
_singletons = NULL;
static const GDebugKey debug_keys[] = {
{ "abort-on-warning", MODEST_RUNTIME_DEBUG_ABORT_ON_WARNING },
{ "log-actions", MODEST_RUNTIME_DEBUG_LOG_ACTIONS },
- { "debug-objects", MODEST_RUNTIME_DEBUG_DEBUG_OBJECTS },
- { "debug-signals", MODEST_RUNTIME_DEBUG_DEBUG_SIGNALS },
- { "factory-settings", MODEST_RUNTIME_DEBUG_FACTORY_SETTINGS}
+ { "debug-objects", MODEST_RUNTIME_DEBUG_OBJECTS },
+ { "debug-signals", MODEST_RUNTIME_DEBUG_SIGNALS },
+ { "factory-settings", MODEST_RUNTIME_DEBUG_FACTORY_SETTINGS},
+ { "debug-code", MODEST_RUNTIME_DEBUG_CODE}
};
const gchar *str;
static ModestRuntimeDebugFlags debug_flags = -1;
typedef enum {
MODEST_RUNTIME_DEBUG_ABORT_ON_WARNING = 1 << 0,
MODEST_RUNTIME_DEBUG_LOG_ACTIONS = 1 << 1, /* not in use atm */
- MODEST_RUNTIME_DEBUG_DEBUG_OBJECTS = 1 << 2, /* for g_type_init */
- MODEST_RUNTIME_DEBUG_DEBUG_SIGNALS = 1 << 3, /* for g_type_init */
- MODEST_RUNTIME_DEBUG_FACTORY_SETTINGS = 1 << 4 /* reset to factory defaults */
+ MODEST_RUNTIME_DEBUG_OBJECTS = 1 << 2, /* for g_type_init */
+ MODEST_RUNTIME_DEBUG_SIGNALS = 1 << 3, /* for g_type_init */
+ MODEST_RUNTIME_DEBUG_FACTORY_SETTINGS = 1 << 4, /* reset to factory defaults */
+ MODEST_RUNTIME_DEBUG_CODE = 1 << 5 /* print various debugging messages */
} ModestRuntimeDebugFlags;
/**
**/
ModestWindowMgr* modest_runtime_get_window_mgr (void);
-/**
- * modest_runtime_verify_object_last_ref
- * @OBJ: some (GObject) ptr
- * @NAME: name of @OBJ
- *
- * macro to check whether @obj holds only one more ref (ie. after the
- * next unref it will die)
- *
- * not, a g_warning will be issued on stderr. NOTE: this is only active
- * when MODEST_DEBUG contains "debug-objects".
- *
- ***/
-#define modest_runtime_verify_object_last_ref(OBJ,name) \
- do { \
- if (modest_runtime_get_debug_flags() & MODEST_RUNTIME_DEBUG_DEBUG_OBJECTS) \
- if (G_IS_OBJECT(OBJ) && G_OBJECT(OBJ)->ref_count != 1) \
- g_warning ("%s:%d: %s (" \
- #OBJ ") still holds a ref count of %d", \
- __FILE__,__LINE__,name, G_OBJECT(OBJ)->ref_count); \
- } while (0)
-
-
-
-/**
- * modest_runtime_not_implemented
- * @WIN: the parent GtkWindow, or NULL
- *
- * give a not-implemented-yet warning popup or g_warning
- *
- ***/
-#define modest_runtime_not_implemented(WIN) \
- do { \
- if (gtk_main_level() > 0) { \
- GtkWidget *popup; \
- popup = gtk_message_dialog_new (WIN,\
- GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,\
- GTK_MESSAGE_WARNING, \
- GTK_BUTTONS_OK, \
- "Not yet implemented");\
- gtk_dialog_run (GTK_DIALOG(popup)); \
- gtk_widget_destroy (popup); \
- } else \
- g_warning ("%s:%d: Not yet implemented",__FILE__,__LINE__); \
- } while (0) \
-
G_END_DECLS
#include "modest-singletons.h"
#include "modest-runtime.h"
+#include "modest-debug.h"
/* 'private'/'protected' functions */
static void modest_singletons_class_init (ModestSingletonsClass *klass);
priv = MODEST_SINGLETONS_GET_PRIVATE(obj);
if (priv->window_mgr) {
- modest_runtime_verify_object_last_ref(priv->window_mgr,"");
+ MODEST_DEBUG_VERIFY_OBJECT_LAST_REF(priv->window_mgr,"");
g_object_unref (G_OBJECT(priv->window_mgr));
priv->window_mgr = NULL;
}
if (priv->email_clipboard) {
- modest_runtime_verify_object_last_ref(priv->email_clipboard,"");
+ MODEST_DEBUG_VERIFY_OBJECT_LAST_REF(priv->email_clipboard,"");
g_object_unref (G_OBJECT(priv->email_clipboard));
priv->email_clipboard = NULL;
}
if (priv->cache_mgr) {
- modest_runtime_verify_object_last_ref(priv->cache_mgr,"");
+ MODEST_DEBUG_VERIFY_OBJECT_LAST_REF(priv->cache_mgr,"");
g_object_unref (G_OBJECT(priv->cache_mgr));
priv->cache_mgr = NULL;
}
if (priv->device) {
- modest_runtime_verify_object_last_ref(priv->device,"");
+ MODEST_DEBUG_VERIFY_OBJECT_LAST_REF(priv->device,"");
g_object_unref (G_OBJECT(priv->device));
priv->device = NULL;
}
if (priv->platform_fact) {
- modest_runtime_verify_object_last_ref(priv->platform_fact,"");
+ MODEST_DEBUG_VERIFY_OBJECT_LAST_REF(priv->platform_fact,"");
g_object_unref (G_OBJECT(priv->platform_fact));
priv->platform_fact = NULL;
}
if (priv->mail_op_queue) {
- modest_runtime_verify_object_last_ref(priv->mail_op_queue,"");
+ MODEST_DEBUG_VERIFY_OBJECT_LAST_REF(priv->mail_op_queue,"");
g_object_unref (G_OBJECT(priv->mail_op_queue));
priv->mail_op_queue = NULL;
}
* cancells any mail operations which in turn access the account
* manager (see modest_mail_operation_notify_end()). */
if (priv->account_mgr) {
- modest_runtime_verify_object_last_ref(priv->account_mgr,"");
+ MODEST_DEBUG_VERIFY_OBJECT_LAST_REF(priv->account_mgr,"");
g_object_unref (G_OBJECT(priv->account_mgr));
priv->account_mgr = NULL;
}
if (priv->conf) {
- modest_runtime_verify_object_last_ref(priv->conf,"");
+ MODEST_DEBUG_VERIFY_OBJECT_LAST_REF(priv->conf,"");
g_object_unref (G_OBJECT(priv->conf));
priv->conf = NULL;
}
#include <modest-account-settings-dialog.h>
#include <maemo/modest-maemo-utils.h>
#include <modest-signal-mgr.h>
+#include <modest-debug.h>
#include "modest-tny-account-store.h"
#include "modest-tny-platform-factory.h"
g_return_if_fail (account && TNY_IS_ACCOUNT(account));
txt = g_strdup_printf ("%s: %s", str ? str : "?", tny_account_get_name(account));
- modest_runtime_verify_object_last_ref(G_OBJECT(account),txt);
+ MODEST_DEBUG_VERIFY_OBJECT_LAST_REF(G_OBJECT(account),txt);
g_free (txt);
}
/* TODO: Settting cancel to FALSE does not actually cancel everything.
* We still get multiple requests afterwards, so we end up showing the
* same dialogs repeatedly.
- */
-
- printf ("DEBUG: modest: %s: prompt (not shown) = %s\n", __FUNCTION__, prompt_not_used);
-
- g_return_val_if_fail (account, NULL);
-
+ */
const TnyAccountStore *account_store = NULL;
ModestTnyAccountStore *self = NULL;
ModestTnyAccountStorePrivate *priv;
gpointer pwd_ptr = NULL;
gboolean already_asked = FALSE;
+ g_return_val_if_fail (account, NULL);
+
+ MODEST_DEBUG_BLOCK(
+ g_debug ("DEBUG: modest: %s: prompt (not shown) = %s\n", __FUNCTION__, prompt_not_used);
+ );
+
/* Initialize the output parameter: */
if (cancel)
*cancel = FALSE;
server_account_name,
NULL,
(gpointer*)&pwd_ptr);
-
- printf ("DEBUG: modest: %s: Already asked = %d\n", __FUNCTION__, already_asked);
-
+ MODEST_DEBUG_BLOCK(
+ g_debug ("DEBUG: modest: %s: Already asked = %d\n", __FUNCTION__, already_asked);
+ );
+
/* If the password is not already there, try ModestConf */
if (!already_asked) {
pwd = modest_account_mgr_get_server_account_password (priv->account_mgr,
*/
const gboolean settings_have_password =
modest_account_mgr_get_server_account_has_password (priv->account_mgr, server_account_name);
- printf ("DEBUG: modest: %s: settings_have_password=%d\n", __FUNCTION__, settings_have_password);
+ MODEST_DEBUG_BLOCK(
+ printf ("DEBUG: modest: %s: settings_have_password=%d\n",
+ __FUNCTION__, settings_have_password);
+ );
if (settings_have_password) {
/* The password must be wrong, so show the account settings dialog so it can be corrected: */
show_wrong_password_dialog (account);
username = NULL;
} else
if (cancel)
- *cancel = FALSE;
-
- /* printf(" DEBUG: %s: returning %s\n", __FUNCTION__, pwd); */
-
+ *cancel = FALSE;
return pwd;
}
#include <tny-camel-imap-store-account.h>
#include <tny-camel-pop-store-account.h>
#include <tny-folder-stats.h>
+#include <modest-debug.h>
#include <string.h>
#ifdef MODEST_HAVE_HILDON0_WIDGETS
#include <hildon-widgets/hildon-file-system-info.h>
modest_tny_account_get_special_folder (TnyAccount *account,
TnyFolderType special_type)
{
- TnyList *folders;
- TnyIterator *iter;
+ TnyList *folders = NULL;
+ TnyIterator *iter = NULL;
TnyFolder *special_folder = NULL;
-
+ TnyAccount *local_account = NULL;
+ GError *error = NULL;
g_return_val_if_fail (account, NULL);
g_return_val_if_fail (0 <= special_type && special_type < TNY_FOLDER_TYPE_NUM,
NULL);
- TnyAccount *local_account = NULL;
-
/* The accounts have already been instantiated by
* modest_tny_account_store_get_accounts(), which is the
* TnyAccountStore::get_accounts_func() implementation,
/* Per-account outbox folders are each in their own on-disk directory: */
if (special_type == TNY_FOLDER_TYPE_OUTBOX) {
- const gchar *modest_account_name =
+
+ gchar *account_id;
+ const gchar *modest_account_name;
+
+ modest_account_name =
modest_tny_account_get_parent_modest_account_name_for_server_account (account);
-
- if (modest_account_name) {
- gchar *account_id = g_strdup_printf (
- MODEST_PER_ACCOUNT_LOCAL_OUTBOX_FOLDER_ACCOUNT_ID_PREFIX "%s",
- modest_account_name);
-
- local_account = modest_tny_account_store_get_tny_account_by (modest_runtime_get_account_store(),
- MODEST_TNY_ACCOUNT_STORE_QUERY_ID,
- account_id);
- if (!local_account) {
- g_printerr ("modest: %s: modest_tny_account_store_get_tny_account_by(ID) returned NULL for %s\n", __FUNCTION__, account_id);
+ if (!modest_account_name) {
+ g_warning ("%s: could not get modest account name", __FUNCTION__);
return NULL;
- }
-
- g_free (account_id);
- } else {
- g_warning ("%s: modest_account_name was NULL.", __FUNCTION__);
}
- } else {
+
+ account_id = g_strdup_printf (
+ MODEST_PER_ACCOUNT_LOCAL_OUTBOX_FOLDER_ACCOUNT_ID_PREFIX "%s",
+ modest_account_name);
+
+ local_account = modest_tny_account_store_get_tny_account_by (modest_runtime_get_account_store(),
+ MODEST_TNY_ACCOUNT_STORE_QUERY_ID,
+ account_id);
+ g_free (account_id);
+ } else
/* Other local folders are all in one on-disk directory: */
local_account = modest_tny_account_store_get_tny_account_by (modest_runtime_get_account_store(),
MODEST_TNY_ACCOUNT_STORE_QUERY_ID,
MODEST_LOCAL_FOLDERS_ACCOUNT_ID);
- }
-
if (!local_account) {
g_printerr ("modest: cannot get local account\n");
- return NULL;
+ goto cleanup;
}
folders = TNY_LIST (tny_simple_list_new ());
-
+
/* There is no need to do this _async, as these are local folders. */
/* TODO: However, this seems to fail sometimes when the network is busy,
* returning an empty list. murrayc. */
- GError *error = NULL;
- tny_folder_store_get_folders (TNY_FOLDER_STORE (local_account),
- folders, NULL, &error);
+ tny_folder_store_get_folders (TNY_FOLDER_STORE (local_account), folders, NULL, &error);
if (error) {
- g_warning ("%s: tny_folder_store_get_folders() failed:\n error=%s\n",
- __FUNCTION__, error->message);
+ g_warning ("%s: tny_folder_store_get_folders() failed:%s\n", __FUNCTION__, error->message);
+ g_error_free (error);
+ goto cleanup;
}
if (tny_list_get_length (folders) == 0) {
gchar* url_string = tny_account_get_url_string (local_account);
- g_printerr ("modest: %s: tny_folder_store_get_folders() returned an empty list for account with URL '%s'\n",
- __FUNCTION__, url_string);
+ g_printerr ("modest: %s: tny_folder_store_get_folders(%s) returned an empty list\n",
+ __FUNCTION__, url_string);
g_free (url_string);
+ goto cleanup;
}
iter = tny_list_create_iterator (folders);
while (!tny_iterator_is_done (iter)) {
- TnyFolder *folder =
- TNY_FOLDER (tny_iterator_get_current (iter));
+ TnyFolder *folder = TNY_FOLDER (tny_iterator_get_current (iter));
if (folder) {
if (modest_tny_folder_get_local_or_mmc_folder_type (folder) == special_type) {
special_folder = folder;
break; /* Leaving a ref for the special_folder return value. */
}
-
- g_object_unref (G_OBJECT(folder));
+ g_object_unref (folder);
}
-
tny_iterator_next (iter);
}
-
- g_object_unref (G_OBJECT (folders));
- g_object_unref (G_OBJECT (iter));
- g_object_unref (G_OBJECT (local_account));
- /*
- if (!special_folder) {
- g_warning ("%s: Returning NULL.", __FUNCTION__);
- }
- */
+cleanup:
+ if (folders)
+ g_object_unref (folders);
+ if (iter)
+ g_object_unref (iter);
+ if (local_account)
+ g_object_unref (local_account);
return special_folder;
}
TnySessionCamel *session,
ModestServerAccountData *account_data)
{
+ TnyAccount *tny_account = NULL;
+ const gchar* proto_name;
+
g_return_val_if_fail (account_mgr, NULL);
g_return_val_if_fail (session, NULL);
g_return_val_if_fail (account_data, NULL);
-
- /* sanity checks */
- if (account_data->proto == MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN) {
- g_printerr ("modest: '%s' does not provide a protocol\n",
- account_data->account_name);
- return NULL;
- }
-
- TnyAccount *tny_account = NULL;
+ g_return_val_if_fail (account_data->proto != MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN,
+ NULL);
switch (account_data->proto) {
case MODEST_PROTOCOL_TRANSPORT_SENDMAIL:
default:
g_return_val_if_reached (NULL);
}
+
if (!tny_account) {
- g_printerr ("modest: could not create tny account for '%s'\n",
- account_data->account_name);
+ g_printerr ("modest: %s: could not create tny account for '%s'\n",
+ __FUNCTION__, account_data->account_name);
return NULL;
}
tny_account_set_id (tny_account, account_data->account_name);
tny_camel_account_set_session (TNY_CAMEL_ACCOUNT (tny_account), session);
/* Proto */
- const gchar* proto_name =
- modest_protocol_info_get_transport_store_protocol_name(account_data->proto);
+ proto_name = modest_protocol_info_get_transport_store_protocol_name(account_data->proto);
tny_account_set_proto (tny_account, proto_name);
return tny_account;
update_tny_account (TnyAccount *tny_account, ModestAccountMgr *account_mgr,
ModestServerAccountData *account_data)
{
- gchar *url = NULL;
-
g_return_val_if_fail (account_mgr, FALSE);
g_return_val_if_fail (account_data, FALSE);
+ g_return_val_if_fail (account_data->account_name, FALSE);
g_return_val_if_fail (tny_account, FALSE);
-
+
tny_account_set_id (tny_account, account_data->account_name);
-
+
/* mbox and maildir accounts use a URI instead of the rest:
* Note that this is not where we create the special local folders account.
* We do that in modest_tny_account_new_for_local_folders() instead. */
if (account_data->uri)
tny_account_set_url_string (TNY_ACCOUNT(tny_account), account_data->uri);
else {
- /* Set camel-specific options: */
-
+ /* Set camel-specific options: */
/* Enable secure connection settings: */
const gchar* option_security = NULL;
+ const gchar* auth_mech_name = NULL;
+
+
switch (account_data->security) {
case MODEST_PROTOCOL_CONNECTION_NORMAL:
option_security = MODEST_ACCOUNT_OPTION_SSL "=" MODEST_ACCOUNT_OPTION_SSL_NEVER;
option_security);
/* Secure authentication: */
-
- const gchar* auth_mech_name = NULL;
switch (account_data->secure_auth) {
case MODEST_PROTOCOL_AUTH_NONE:
/* IMAP and POP need at least a password,
default:
g_warning ("%s: Unhandled secure authentication setting %d for "
- "account=%s (%s)", __FUNCTION__, account_data->secure_auth,
+ "account_name=%s (%s)", __FUNCTION__, account_data->secure_auth,
account_data->account_name, account_data->hostname);
break;
}
tny_account_set_port (tny_account, account_data->port);
}
- /* FIXME: for debugging.
- * Let's keep this because it is very useful for debugging. */
- url = tny_account_get_url_string (TNY_ACCOUNT(tny_account));
- g_debug ("%s:\n account-url: %s\n", __FUNCTION__, url);
-
- g_free (url);
+ MODEST_DEBUG_BLOCK (
+ gchar *url = tny_account_get_url_string (TNY_ACCOUNT(tny_account));
+ g_debug ("%s:\n account-url: %s\n", __FUNCTION__, url);
+ g_free (url);
+ );
+
return TRUE;
}
}
-#if 0
-gboolean
-modest_tny_account_update_from_server_account_name (TnyAccount *tny_account,
- ModestAccountMgr *account_mgr,
- const gchar *server_account_name)
-{
- ModestServerAccountData *account_data;
- gboolean valid_account_type;
-
- g_return_val_if_fail (tny_account, FALSE);
- g_return_val_if_fail (server_account_name, FALSE);
-
- account_data = modest_account_mgr_get_server_account_data (account_mgr,
- server_account_name);
- if (!account_data) {
- g_warning ("%s: failed to get server account data for %s",
- __FUNCTION__, server_account_name);
- return FALSE;
- }
-
- valid_account_type = FALSE;
-
- /* you cannot change the protocol type of an existing account;
- * so double check we don't even try
- */
- switch (account_data->proto) {
- case MODEST_PROTOCOL_TRANSPORT_SENDMAIL:
- case MODEST_PROTOCOL_TRANSPORT_SMTP:
- if (!TNY_IS_CAMEL_TRANSPORT_ACCOUNT(tny_account))
- g_warning ("%s: expecting transport account", __FUNCTION__);
- else
- valid_account_type = TRUE;
- break;
- case MODEST_PROTOCOL_STORE_POP:
- if (!TNY_IS_CAMEL_POP_STORE_ACCOUNT(tny_account))
- g_warning ("%s: expecting pop account", __FUNCTION__);
- else
- valid_account_type = TRUE;
- break;
- case MODEST_PROTOCOL_STORE_IMAP:
- if (!TNY_IS_CAMEL_IMAP_STORE_ACCOUNT(tny_account))
- g_warning ("%s: expecting imap account", __FUNCTION__);
- else
- valid_account_type = TRUE;
- break;
- case MODEST_PROTOCOL_STORE_MAILDIR:
- case MODEST_PROTOCOL_STORE_MBOX:
- if (!TNY_IS_CAMEL_STORE_ACCOUNT(tny_account))
- g_warning ("%s: expecting store account", __FUNCTION__);
- else
- valid_account_type = TRUE;
- break;
- default:
- g_warning ("invalid account type");
- }
-
- if (!valid_account_type) {
- g_warning ("%s: protocol type cannot be changed", __FUNCTION__);
- modest_account_mgr_free_server_account_data (account_mgr, account_data);
- return FALSE;
- }
-
- if (!update_tny_account (tny_account, account_mgr, account_data)) {
- g_warning ("%s: failed to update account", __FUNCTION__);
- modest_account_mgr_free_server_account_data (account_mgr, account_data);
- return FALSE;
- }
-
- modest_account_mgr_free_server_account_data (account_mgr, account_data);
- return TRUE;
-}
-#endif
-
-
/* we need these dummy functions, or tinymail will complain */
/* Gets the memory card name: */
static void
-on_modest_file_system_info(HildonFileSystemInfoHandle *handle,
- HildonFileSystemInfo *info,
- const GError *error, gpointer data)
+on_modest_file_system_info (HildonFileSystemInfoHandle *handle,
+ HildonFileSystemInfo *info,
+ const GError *error, gpointer data)
{
GetMmcAccountNameData *callback_data = (GetMmcAccountNameData*)data;
#include "widgets/modest-main-window.h"
#include "widgets/modest-msg-edit-window.h"
#include "widgets/modest-msg-view-window.h"
+#include "modest-debug.h"
/* 'private'/'protected' functions */
if (!priv->main_window && create) {
/* modest_window_mgr_register_window will set priv->main_window */
modest_window_mgr_register_window (self, modest_main_window_new ());
- g_debug ("%s: created main window: %p\n", __FUNCTION__, priv->main_window);
+ MODEST_DEBUG_BLOCK(
+ g_debug ("%s: created main window: %p\n", __FUNCTION__, priv->main_window);
+ );
}
return priv->main_window;