gboolean eex_ui_composer_actions (GtkUIManager *manager, EMsgComposer *composer) { static GtkActionEntry entries[] = { { "eex-send-options", NULL, N_("_Send Options"), NULL, N_("Insert Send options"), G_CALLBACK (action_send_options_cb) } }; GtkhtmlEditor *editor; EComposerHeaderTable *headers; EComposerHeader *header; editor = GTKHTML_EDITOR (composer); /* Add actions to the "composer" action group. */ e_action_group_add_actions_localized ( gtkhtml_editor_get_action_group (editor, "composer"), GETTEXT_PACKAGE, entries, G_N_ELEMENTS (entries), composer); headers = e_msg_composer_get_header_table (composer); header = e_composer_header_table_get_header (headers, E_COMPOSER_HEADER_FROM); from_changed_cb (E_COMPOSER_FROM_HEADER (header), composer); g_signal_connect (G_OBJECT (header), "changed", G_CALLBACK (from_changed_cb), composer); return TRUE; }
void e_composer_update_signature (EMsgComposer *composer) { EComposerHeaderTable *table; EMailSignatureComboBox *combo_box; EHTMLEditor *editor; EHTMLEditorView *view; WebKitLoadStatus status; g_return_if_fail (E_IS_MSG_COMPOSER (composer)); /* Do nothing if we're redirecting a message or we disabled * the signature on purpose */ if (composer->priv->redirect || composer->priv->disable_signature) return; table = e_msg_composer_get_header_table (composer); combo_box = e_composer_header_table_get_signature_combo_box (table); editor = e_msg_composer_get_editor (composer); view = e_html_editor_get_view (editor); status = webkit_web_view_get_load_status (WEBKIT_WEB_VIEW (view)); /* If document is not loaded, we will wait for him */ if (status != WEBKIT_LOAD_FINISHED) { /* Disconnect previous handlers */ g_signal_handlers_disconnect_by_func ( WEBKIT_WEB_VIEW (view), G_CALLBACK (composer_web_view_load_status_changed_cb), composer); g_signal_connect ( WEBKIT_WEB_VIEW(view), "notify::load-status", G_CALLBACK (composer_web_view_load_status_changed_cb), composer); return; } /* XXX Signature files should be local and therefore load quickly, * so while we do load them asynchronously we don't allow for * user cancellation and we keep the composer alive until the * asynchronous loading is complete. */ e_mail_signature_combo_box_load_selected ( combo_box, G_PRIORITY_DEFAULT, NULL, (GAsyncReadyCallback) composer_load_signature_cb, g_object_ref (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); }
static void append_to_header (ExchangeSendOptionsDialog *dialog, gint state, gpointer data) { EMsgComposer *composer; CamelAddress *sender_address; const gchar *sender_id, *recipient_id; struct _camel_header_address *addr; struct _camel_header_address *sender_addr; composer = (EMsgComposer *) data; if (state == GTK_RESPONSE_OK) { if (dialog->options->importance) { switch (dialog->options->importance) { case E_IMP_HIGH : e_msg_composer_set_header (composer, "Importance", "high"); break; case E_IMP_LOW : e_msg_composer_set_header (composer, "Importance", "low"); break; default : g_print ("\nNo importance set"); break; } } else e_msg_composer_remove_header (composer, "Importance"); if (dialog->options->sensitivity) { switch (dialog->options->sensitivity) { case E_SENSITIVITY_CONFIDENTIAL : e_msg_composer_set_header (composer, "Sensitivity", "Company-Confidential"); break; case E_SENSITIVITY_PERSONAL : e_msg_composer_set_header (composer, "Sensitivity", "Personal"); break; case E_SENSITIVITY_PRIVATE : e_msg_composer_set_header (composer, "Sensitivity", "Private"); break; default : g_print ("\nNo importance set"); break; } } else e_msg_composer_remove_header (composer, "Sensitivity"); sender_address = (CamelAddress *) e_msg_composer_get_from (composer); sender_id = (const gchar *) camel_address_encode (sender_address); addr = camel_header_address_decode (dialog->options->delegate_address, NULL); sender_addr = camel_header_address_decode (sender_id, NULL); if (dialog->options->send_as_del_enabled && dialog->options->delegate_address && g_ascii_strcasecmp (addr->v.addr, sender_addr->v.addr)) { e_msg_composer_set_header (composer, "Sender" , sender_id); /* This block handles the case wherein the address to be added * in the "From" field has no name associated with it. * So for cases where there is no name we append the address * (only email) within angular braces. */ if (!g_ascii_strcasecmp (addr->name, "")) { recipient_id = g_strdup_printf ("<%s>", dialog->options->delegate_address); e_msg_composer_add_header (composer, "From", recipient_id); } else e_msg_composer_add_header (composer, "From", dialog->options->delegate_address); } else { e_msg_composer_remove_header (composer, "Sender"); e_msg_composer_add_header (composer, "From", sender_id); } if (dialog->options->delivery_enabled) { EComposerHeaderTable *table; EAccount *account; gchar *mdn_address; table = e_msg_composer_get_header_table (composer); account = e_composer_header_table_get_account (table); mdn_address = account->id->reply_to; if (!mdn_address || !*mdn_address) mdn_address = account->id->address; e_msg_composer_set_header (composer, "Return-Receipt-To", mdn_address); } else e_msg_composer_remove_header (composer, "Return-Receipt-To"); if (dialog->options->read_enabled) { EComposerHeaderTable *table; EAccount *account; gchar *mdn_address; table = e_msg_composer_get_header_table (composer); account = e_composer_header_table_get_account (table); mdn_address = account->id->reply_to; if (!mdn_address || !*mdn_address) mdn_address = account->id->address; e_msg_composer_set_header (composer, "Disposition-Notification-To", mdn_address); } else e_msg_composer_remove_header (composer, "Disposition-Notification-To"); } }
void eab_send_as_to (EShell *shell, GSList *destinations) { EMsgComposer *composer; EComposerHeaderTable *table; GPtrArray *to_array; GPtrArray *bcc_array; union { gpointer *pdata; EDestination **destinations; } convert; g_return_if_fail (E_IS_SHELL (shell)); if (destinations == NULL) return; composer = e_msg_composer_new (shell); table = e_msg_composer_get_header_table (composer); to_array = g_ptr_array_new (); bcc_array = g_ptr_array_new (); /* Sort contacts into "To" and "Bcc" destinations. */ while (destinations != NULL) { EDestination *destination = destinations->data; if (e_destination_is_evolution_list (destination)) { if (e_destination_list_show_addresses (destination)) g_ptr_array_add (to_array, destination); else g_ptr_array_add (bcc_array, destination); } else g_ptr_array_add (to_array, destination); destinations = g_slist_next (destinations); } /* Add sentinels to each array. */ g_ptr_array_add (to_array, NULL); g_ptr_array_add (bcc_array, NULL); /* XXX Acrobatics like this make me question whether NULL-terminated * arrays are really the best argument type for passing a list of * destinations to the header table. */ /* Set "To" destinations. */ convert.pdata = to_array->pdata; e_composer_header_table_set_destinations_to ( table, convert.destinations); g_ptr_array_free (to_array, FALSE); /* Add "Bcc" destinations. */ convert.pdata = bcc_array->pdata; e_composer_header_table_add_destinations_bcc ( table, convert.destinations); g_ptr_array_free (bcc_array, FALSE); gtk_widget_show (GTK_WIDGET (composer)); }
void eab_send_as_attachment (EShell *shell, GSList *destinations) { EMsgComposer *composer; EComposerHeaderTable *table; CamelMimePart *attachment; GSList *contacts, *iter; gchar *data; g_return_if_fail (E_IS_SHELL (shell)); if (destinations == NULL) return; composer = e_msg_composer_new (shell); table = e_msg_composer_get_header_table (composer); attachment = camel_mime_part_new (); contacts = g_slist_copy (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 (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 (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 (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 (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)); }