* modest-conf.h, modest-main.c:
authorDirk-Jan C. Binnema <dirk-jan.binnema@nokia.com>
Mon, 15 Jan 2007 10:37:11 +0000 (10:37 +0000)
committerDirk-Jan C. Binnema <dirk-jan.binnema@nokia.com>
Mon, 15 Jan 2007 10:37:11 +0000 (10:37 +0000)
  - small cleanups
* modest-tny-account-store.c:
  - update to ModestProtocolInfo

pmo-trunk-r622

src/modest-conf.h
src/modest-main.c
src/modest-tny-account-store.c

index a2c483c..33643e2 100644 (file)
@@ -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,
index ceefd22..30b857a 100644 (file)
@@ -47,6 +47,8 @@
 #include <modest-tny-platform-factory.h>
 #include <modest-mail-operation.h>
 
+#include <camel/camel-url.h>
+
 #if MODEST_PLATFORM_ID==2 /* maemo */
 #include <libosso.h>
 #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 <addresses> (comma-separated)", NULL},
+                 N_("New email to <addresses> (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;
index 2da7a5d..4d837a8 100644 (file)
@@ -28,6 +28,7 @@
  */
 
 #include <string.h>
+#include <glib/gi18n.h>
 
 #include <tny-account.h>
 #include <tny-account-store.h>
@@ -39,7 +40,7 @@
 #include <tny-camel-imap-store-account.h>
 #include <tny-camel-pop-store-account.h>
 #include <modest-marshal.h>
-#include <glib/gi18n.h>
+#include <modest-protocol-info.h>
 #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) {