* modest-widget-factory.[ch]:
[modest] / src / modest-main.c
index d79db1f..118db3f 100644 (file)
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 #include <tny-list.h>
-
+#include <tny-transport-account.h>
 #include <tny-account-store.h>
 #include <tny-list.h>
 #include <tny-simple-list.h>
 
+#include "config.h"
 #include "modest-conf.h"
 #include "modest-account-mgr.h"
 #include "modest-ui.h"
 #include "modest-icon-factory.h"
-#include "modest-tny-transport-actions.h"
 #include "modest-tny-account-store.h"
 #include "modest-tny-platform-factory.h"
+#include "modest-mail-operation.h"
 
 
-#ifdef MODEST_ENABLE_HILDON /* Hildon includes */
+#if MODEST_PLATFORM_ID==2 
 #include <libosso.h>
-#endif /* MODEST_ENABLE_HILDON */
+#endif /* MODEST_PLATFORM==2 */
 
 /* return values */
 #define MODEST_ERR_NONE    0
@@ -98,7 +99,12 @@ main (int argc, char *argv[])
                { NULL, 0, 0, 0, NULL, NULL, NULL }
        };
 
-       g_type_init ();
+       bindtextdomain (GETTEXT_PACKAGE, MODESTLOCALEDIR);
+       bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+       textdomain (GETTEXT_PACKAGE);
+
+       g_type_init ();         
+       g_thread_init (NULL);
 
        context = g_option_context_new (NULL);
        g_option_context_add_main_entries (context, options, NULL);
@@ -196,18 +202,17 @@ cleanup:
 static gboolean
 hildon_init ()
 {
-#ifdef MODEST_ENABLE_HILDON
-
+#if MODEST_PLATFORM_ID==2 
+       
        osso_context_t *osso_context =
                osso_initialize(PACKAGE, PACKAGE_VERSION,
                                TRUE, NULL);    
        if (!osso_context) {
-               g_printerr ("modest: failed to aquire osso context, exiting\n");
-
+               g_printerr ("modest: failed to acquire osso context\n");
                return FALSE;
-               
        }
-#endif /* MODEST_ENABLE_HILDON */
+       
+#endif /* MODEST_PLATFORM_ID==2 */
 
        return TRUE;
 }
@@ -221,6 +226,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;
 
        TnyList *accounts = NULL;
        TnyIterator *iter = NULL;
@@ -245,20 +251,26 @@ send_mail (const gchar* mailto, const gchar *cc, const gchar *bcc,
 
        account = TNY_TRANSPORT_ACCOUNT (tny_iterator_get_current(iter));
 
-       if (!modest_mail_operation_send_mail (account,
-                                             "djcb@djcbsoftware.nl", mailto, cc, bcc, subject, body,
-                                             NULL)) {
+       mail_operation = modest_mail_operation_new ();
+
+       modest_mail_operation_send_new_mail (mail_operation,
+                                            account,
+                                            "djcb@djcbsoftware.nl", mailto, cc, bcc, 
+                                            subject, body, NULL);
+
+
+       if (modest_mail_operation_get_status (mail_operation) == 
+           MODEST_MAIL_OPERATION_STATUS_FAILED) {
                retval = MODEST_ERR_SEND;
                goto cleanup;
        } else
                retval = MODEST_ERR_NONE; /* hurray! */
 
 cleanup:
-       if (iter)
-               g_object_unref (G_OBJECT(iter));
-       if (accounts)
-               g_object_unref (G_OBJECT(accounts));
-       
+       if (iter) g_object_unref (G_OBJECT (iter));
+       if (accounts) g_object_unref (G_OBJECT (accounts));
+       if (mail_operation) g_object_unref (G_OBJECT (mail_operation));
+
        return retval;
 }