#include <libgnomevfs/gnome-vfs-mime.h>
#include <libgnomeui/gnome-icon-lookup.h>
#include <tny-gnome-device.h>
+#include <modest-runtime.h>
gboolean
modest_platform_init (void)
gboolean
modest_platform_activate_uri (const gchar *uri)
{
- g_message ("not implemented %s", __FUNCTION__);
+ modest_runtime_not_implemented (NULL);
+ return FALSE;
}
gboolean
modest_platform_show_uri_popup (const gchar *uri)
{
- g_message ("not implemented %s", __FUNCTION__);
+ modest_runtime_not_implemented (NULL);
+ return FALSE;
}
GdkPixbuf*
{
GSList *account_names = modest_account_mgr_account_names (modest_runtime_get_account_mgr());
- gboolean accounts_exist = account_names != NULL;
+ //gboolean accounts_exist = account_names != NULL;
g_slist_free (account_names);
/* This is currently only implemented for Maemo,
}
-void
-modest_ui_actions_on_send_receive (GtkAction *action, ModestWindow *win)
+static gboolean
+action_send (const gchar* account_name)
{
- gchar *account_name;
TnyAccount *tny_account;
ModestTnySendQueue *send_queue;
- ModestMailOperation *mail_op;
-
- account_name =
- g_strdup(modest_window_get_active_account(MODEST_WINDOW(win)));
- if (!account_name)
- account_name = modest_account_mgr_get_default_account (modest_runtime_get_account_mgr());
- if (!account_name) {
- g_printerr ("modest: cannot get account\n");
- return;
- }
+
+ g_return_val_if_fail (account_name, FALSE);
tny_account =
modest_tny_account_store_get_tny_account_by_account (modest_runtime_get_account_store(),
TNY_ACCOUNT_TYPE_TRANSPORT);
if (!tny_account) {
g_printerr ("modest: cannot get tny transport account for %s\n", account_name);
- return;
+ return FALSE;
}
send_queue = modest_tny_send_queue_new (TNY_CAMEL_TRANSPORT_ACCOUNT(tny_account));
if (!send_queue) {
g_object_unref (G_OBJECT(tny_account));
g_printerr ("modest: cannot get send queue for %s\n", account_name);
- return;
- }
+ return FALSE;
+ }
+
//modest_tny_send_queue_flush (send_queue);
g_object_unref (G_OBJECT(send_queue));
g_object_unref (G_OBJECT(tny_account));
+ return TRUE;
+}
+
+
+static gboolean
+action_receive (const gchar* account_name)
+{
+ TnyAccount *tny_account;
+ ModestMailOperation *mail_op;
+
+ g_return_val_if_fail (account_name, FALSE);
+
tny_account =
modest_tny_account_store_get_tny_account_by_account (modest_runtime_get_account_store(),
account_name,
TNY_ACCOUNT_TYPE_STORE);
if (!tny_account) {
g_printerr ("modest: cannot get tny store account for %s\n", account_name);
- return;
+ return FALSE;
}
/* Create the mail operation */
mail_op = modest_mail_operation_new ();
modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), mail_op);
modest_mail_operation_update_account (mail_op, TNY_STORE_ACCOUNT(tny_account));
-
- /* Frees */
- g_object_unref (G_OBJECT (tny_account));
+ g_object_unref (G_OBJECT(tny_account));
g_object_unref (G_OBJECT (mail_op));
+
+ return TRUE;
+}
+
+
+
+void
+modest_ui_actions_on_send_receive (GtkAction *action, ModestWindow *win)
+{
+ gchar *account_name;
+
+ account_name =
+ g_strdup(modest_window_get_active_account(MODEST_WINDOW(win)));
+ if (!account_name)
+ account_name = modest_account_mgr_get_default_account (modest_runtime_get_account_mgr());
+ if (!account_name) {
+ g_printerr ("modest: cannot get account\n");
+ return;
+ }
+
+ if (!action_send(account_name))
+ g_printerr ("modest: failed to send\n");
+ if (!action_receive(account_name))
+ g_printerr ("modest: failed to receive\n");
}