+
+static gboolean
+on_idle_send_receive(gpointer user_data)
+{
+ ModestWindow* main_window = modest_window_mgr_get_main_window(
+ modest_runtime_get_window_mgr ());
+ do_send_receive(main_window);
+
+ return FALSE; /* Do not call this callback again. */
+}
+
+static gint on_send_receive(GArray * arguments, gpointer data, osso_rpc_t * retval)
+{
+ /* Use g_idle to context-switch into the application's thread: */
+
+ /* This method has no arguments. */
+
+ /* printf(" debug: to=%s\n", idle_data->to); */
+ g_idle_add(on_idle_send_receive, NULL);
+
+ /* Note that we cannot report failures during send/receive,
+ * because that would be asynchronous. */
+ return OSSO_OK;
+}