From: Dirk-Jan C. Binnema Date: Mon, 15 Jan 2007 10:37:11 +0000 (+0000) Subject: * modest-conf.h, modest-main.c: X-Git-Tag: git_migration_finished~4257 X-Git-Url: http://git.maemo.org/git/?p=modest;a=commitdiff_plain;h=3cb2296c35459b4fbd5ae81ee642576ddcc3e13b * modest-conf.h, modest-main.c: - small cleanups * modest-tny-account-store.c: - update to ModestProtocolInfo pmo-trunk-r622 --- diff --git a/src/modest-conf.h b/src/modest-conf.h index a2c483c..33643e2 100644 --- a/src/modest-conf.h +++ b/src/modest-conf.h @@ -45,8 +45,6 @@ G_BEGIN_DECLS typedef struct _ModestConf ModestConf; typedef struct _ModestConfClass ModestConfClass; -/* typedef enum _ModestConfEvent ModestConfEvent; */ -/* typedef enum _ModestConfValueType ModestConfValueType; */ typedef enum _ModestConfValueType { MODEST_CONF_VALUE_INT, diff --git a/src/modest-main.c b/src/modest-main.c index ceefd22..30b857a 100644 --- a/src/modest-main.c +++ b/src/modest-main.c @@ -47,6 +47,8 @@ #include #include +#include + #if MODEST_PLATFORM_ID==2 /* maemo */ #include #endif /* MODEST_PLATFORM==2 */ @@ -80,21 +82,23 @@ main (int argc, char *argv[]) int retval = MODEST_ERR_NONE; static gboolean batch=FALSE; - static gchar *mailto, *subject, *bcc, *cc, *body; + static gchar *mailto, *subject, *bcc, *cc, *body, *account; static GOptionEntry options[] = { { "mailto", 'm', 0, G_OPTION_ARG_STRING, &mailto, - "New email to (comma-separated)", NULL}, + N_("New email to (comma-separated)"), NULL}, { "subject", 's', 0, G_OPTION_ARG_STRING, &subject, - "Subject for a new mail", NULL}, + N_("Subject for a new mail"), NULL}, { "body", 'b', 0, G_OPTION_ARG_STRING, &body, - "Body for a new email", NULL}, + N_("Body for a new email"), NULL}, { "cc", 'c', 0, G_OPTION_ARG_STRING, &cc, - "Cc: addresses for a new mail (comma-separated)", NULL}, + N_("Cc: addresses for a new mail (comma-separated)"), NULL}, { "bcc", 'x', 0, G_OPTION_ARG_STRING, &bcc, - "Bcc: addresses for a new mail (comma-separated)", NULL}, + N_("Bcc: addresses for a new mail (comma-separated)"), NULL}, + { "account", 'a', 0, G_OPTION_ARG_STRING, &account, + N_("Account to use (if specified, default account is used)"), NULL}, { "batch", 'y', 0, G_OPTION_ARG_NONE, &batch, - "Run in batch mode (don't show UI)", NULL}, + N_("Run in batch mode (don't show UI)"), NULL}, { NULL, 0, 0, 0, NULL, NULL, NULL } }; @@ -147,10 +151,10 @@ main (int argc, char *argv[]) retval = start_ui (mailto, cc, bcc, subject, body, account_store); } else retval = send_mail (mailto, cc, bcc, subject, body); - cleanup: - g_object_unref (G_OBJECT(fact)); + if (fact) + g_object_unref (G_OBJECT(fact)); /* this will clean up account_store as well */ return retval; @@ -233,6 +237,7 @@ hildon_init () } + static int send_mail (const gchar* mailto, const gchar *cc, const gchar *bcc, const gchar* subject, const gchar *body) @@ -240,7 +245,7 @@ send_mail (const gchar* mailto, const gchar *cc, const gchar *bcc, ModestAccountMgr *acc_mgr = NULL; TnyPlatformFactory *fact = NULL; TnyAccountStore *acc_store = NULL; - ModestMailOperation *mail_operation; + ModestMailOperation *mail_operation = NULL; TnyList *accounts = NULL; TnyIterator *iter = NULL; diff --git a/src/modest-tny-account-store.c b/src/modest-tny-account-store.c index 2da7a5d..4d837a8 100644 --- a/src/modest-tny-account-store.c +++ b/src/modest-tny-account-store.c @@ -28,6 +28,7 @@ */ #include +#include #include #include @@ -39,7 +40,7 @@ #include #include #include -#include +#include #include "modest-account-mgr.h" #include "modest-tny-account-store.h" #include "modest-tny-platform-factory.h" @@ -561,7 +562,7 @@ add_account (TnyAccountStore *self, TnyAccount *account) { return modest_account_mgr_add_server_account (priv->account_mgr, account_name, hostname, username, NULL, - proto); + modest_protocol_info_get_protocol(proto)); } @@ -649,7 +650,7 @@ modest_tny_account_store_get_accounts (TnyAccountStore *iface, modest_type = MODEST_PROTOCOL_TYPE_STORE; break; case TNY_ACCOUNT_STORE_BOTH: - modest_type = MODEST_PROTOCOL_TYPE_ANY; + modest_type = MODEST_PROTOCOL_TYPE_UNKNOWN; break; default: g_assert_not_reached (); @@ -673,7 +674,7 @@ modest_tny_account_store_get_accounts (TnyAccountStore *iface, continue; } - if (modest_type == MODEST_PROTOCOL_TYPE_TRANSPORT || modest_type == MODEST_PROTOCOL_TYPE_ANY) { + if (modest_type == MODEST_PROTOCOL_TYPE_TRANSPORT || modest_type == MODEST_PROTOCOL_TYPE_UNKNOWN) { server_account = get_server_account_for_account (self, account_name, MODEST_PROTOCOL_TYPE_TRANSPORT); if (server_account) { @@ -692,7 +693,7 @@ modest_tny_account_store_get_accounts (TnyAccountStore *iface, g_free (server_account); } - if (modest_type == MODEST_PROTOCOL_TYPE_STORE || modest_type == MODEST_PROTOCOL_TYPE_ANY) { + if (modest_type == MODEST_PROTOCOL_TYPE_STORE || modest_type == MODEST_PROTOCOL_TYPE_UNKNOWN) { server_account = get_server_account_for_account (self, account_name, MODEST_PROTOCOL_TYPE_STORE); if (server_account) {