-
- /* Get the TnyTransportAccount so we can instantiate a mail operation: */
- ModestAccountMgr *account_mgr = modest_runtime_get_account_mgr();
- gchar *account_name = modest_account_mgr_get_default_account (account_mgr);
- if (!account_name) {
- g_printerr ("modest: no account found\n");
- }
-
- TnyAccount *account = NULL;
- if (account_mgr) {
- account = modest_tny_account_store_get_transport_account_for_open_connection (
- modest_runtime_get_account_store(), account_name);
- }
-
- if (!account) {
- g_printerr ("modest: failed to get tny account folder'\n", account_name);
- } else {
- gchar * from = modest_account_mgr_get_from_string (account_mgr,
- account_name);
- if (!from) {
- g_printerr ("modest: no from address for account '%s'\n", account_name);
- } else {
- const gchar *cc = NULL;
- const gchar *bcc = NULL;
- const gchar *subject = NULL;
- const gchar *body = NULL;
-
- /* Get the relevant items from the list: */
- GSList *list = list_names_and_values;
- while (list) {
- const gchar * name = (const gchar*)list->data;
- GSList *list_value = g_slist_next (list);
- const gchar * value = (const gchar*)list_value->data;
-
- if (strcmp (name, "cc") == 0) {
- cc = value;
- } else if (strcmp (name, "bcc") == 0) {
- bcc = value;
- } else if (strcmp (name, "subject") == 0) {
- subject = value;
- } else if (strcmp (name, "body") == 0) {
- body = value;
- }
-
- /* Go to the next pair: */
- if (list_value) {
- list = g_slist_next (list_value);
- } else
- list = NULL;
- }
-
- /* Create the message: */
- gchar *to = uri_parse_mailto (uri, &list_names_and_values);
- TnyMsg *msg = modest_tny_msg_new (to, from,
- cc, bcc, subject, body,
- NULL /* attachments */);
- g_free(to);
- to = NULL;
-
- if (!msg) {
- g_printerr ("modest: failed to create message\n");
- } else {
- ModestWindow *win;
-
- /* This is a GDK lock because we are an idle callback and
- * the code below is or does Gtk+ code */
- gdk_threads_enter ();
- win = modest_msg_edit_window_new (msg, account_name, FALSE);
- modest_window_mgr_register_window (modest_runtime_get_window_mgr (), win);
- gtk_widget_show_all (GTK_WIDGET (win));
- gdk_threads_leave ();
-
- g_object_unref (win);
- }
-
- g_object_unref (G_OBJECT(msg));
- g_object_unref (G_OBJECT(account));
+
+ const gchar *cc = NULL;
+ const gchar *bcc = NULL;
+ const gchar *subject = NULL;
+ const gchar *body = NULL;
+
+ /* Get the relevant items from the list: */
+ gchar *to = uri_parse_mailto (uri, &list_names_and_values);
+ GSList *list = list_names_and_values;
+ while (list) {
+ GSList *list_value = g_slist_next (list);
+ const gchar * name = (const gchar*)list->data;
+ const gchar * value = (const gchar*)list_value->data;
+
+ if (strcmp (name, "cc") == 0) {
+ cc = value;
+ } else if (strcmp (name, "bcc") == 0) {
+ bcc = value;
+ } else if (strcmp (name, "subject") == 0) {
+ subject = value;
+ } else if (strcmp (name, "body") == 0) {
+ body = value;