static void autosave_composer_created_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { CreateComposerData *ccd = user_data; EMsgComposer *composer; GError *error = NULL; composer = e_msg_composer_new_finish (result, &error); if (error) { g_warning ("%s: Failed to create msg composer: %s", G_STRFUNC, error->message); g_simple_async_result_take_error (ccd->simple, error); } else { e_msg_composer_setup_with_message (composer, ccd->message, TRUE, NULL, NULL); g_object_set_data_full ( G_OBJECT (composer), SNAPSHOT_FILE_KEY, g_object_ref (ccd->snapshot_file), (GDestroyNotify) delete_snapshot_file); ccd->context->composer = g_object_ref_sink (composer); } g_simple_async_result_complete (ccd->simple); g_clear_object (&ccd->simple); g_clear_object (&ccd->message); g_clear_object (&ccd->snapshot_file); g_free (ccd); }
static void action_new_message_composer_created_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { EMsgComposer *composer; GError *error = NULL; composer = e_msg_composer_new_finish (result, &error); if (error) { g_warning ("%s: Failed to create msg composer: %s", G_STRFUNC, error->message); g_clear_error (&error); } else { gtk_widget_show (GTK_WIDGET (composer)); } }
static void eab_composer_created_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { CreateComposerData *ccd = user_data; EComposerHeaderTable *table; EMsgComposer *composer; GError *error = NULL; g_return_if_fail (ccd != NULL); composer = e_msg_composer_new_finish (result, &error); if (error) { g_warning ("%s: Failed to create msg composer: %s", G_STRFUNC, error->message); g_clear_error (&error); } else { table = e_msg_composer_get_header_table (composer); if (ccd->to_destinations) e_composer_header_table_set_destinations_to (table, ccd->to_destinations); if (ccd->bcc_destinations) e_composer_header_table_set_destinations_bcc (table, ccd->bcc_destinations); if (ccd->attachment_destinations) { CamelMimePart *attachment; GSList *contacts, *iter; gchar *data; attachment = camel_mime_part_new (); contacts = g_slist_copy (ccd->attachment_destinations); for (iter = contacts; iter != NULL; iter = iter->next) iter->data = e_destination_get_contact (iter->data); data = eab_contact_list_to_string (contacts); g_slist_free (contacts); camel_mime_part_set_content (attachment, data, strlen (data), "text/x-vcard"); if (ccd->attachment_destinations->next != NULL) { camel_mime_part_set_description (attachment, _("Multiple vCards")); } else { EContact *contact; const gchar *file_as; gchar *description; contact = e_destination_get_contact (ccd->attachment_destinations->data); file_as = e_contact_get_const (contact, E_CONTACT_FILE_AS); description = g_strdup_printf (_("vCard for %s"), file_as); camel_mime_part_set_description (attachment, description); g_free (description); } camel_mime_part_set_disposition (attachment, "attachment"); e_msg_composer_attach (composer, attachment); g_object_unref (attachment); if (ccd->attachment_destinations->next != NULL) { e_composer_header_table_set_subject (table, _("Contact information")); } else { EContact *contact; gchar *tempstr; const gchar *tempstr2; gchar *tempfree = NULL; contact = e_destination_get_contact (ccd->attachment_destinations->data); tempstr2 = e_contact_get_const (contact, E_CONTACT_FILE_AS); if (!tempstr2 || !*tempstr2) tempstr2 = e_contact_get_const (contact, E_CONTACT_FULL_NAME); if (!tempstr2 || !*tempstr2) tempstr2 = e_contact_get_const (contact, E_CONTACT_ORG); if (!tempstr2 || !*tempstr2) { g_free (tempfree); tempstr2 = get_email (contact, E_CONTACT_EMAIL_1, &tempfree); } if (!tempstr2 || !*tempstr2) { g_free (tempfree); tempstr2 = get_email (contact, E_CONTACT_EMAIL_2, &tempfree); } if (!tempstr2 || !*tempstr2) { g_free (tempfree); tempstr2 = get_email (contact, E_CONTACT_EMAIL_3, &tempfree); } if (!tempstr2 || !*tempstr2) tempstr = g_strdup_printf (_("Contact information")); else tempstr = g_strdup_printf (_("Contact information for %s"), tempstr2); e_composer_header_table_set_subject (table, tempstr); g_free (tempstr); g_free (tempfree); } } gtk_widget_show (GTK_WIDGET (composer)); } if (ccd->to_destinations) e_destination_freev (ccd->to_destinations); if (ccd->bcc_destinations) e_destination_freev (ccd->bcc_destinations); g_slist_free_full (ccd->attachment_destinations, g_object_unref); g_free (ccd); }