diff options
Diffstat (limited to 'composer/e-msg-composer-hdrs.c')
-rw-r--r-- | composer/e-msg-composer-hdrs.c | 414 |
1 files changed, 207 insertions, 207 deletions
diff --git a/composer/e-msg-composer-hdrs.c b/composer/e-msg-composer-hdrs.c index a3170054fc..523c66f695 100644 --- a/composer/e-msg-composer-hdrs.c +++ b/composer/e-msg-composer-hdrs.c @@ -97,18 +97,18 @@ typedef struct { struct _EMsgComposerHdrsPrivate { ENameSelector *name_selector; - + /* ui component */ BonoboUIComponent *uic; - + /* The tooltips. */ GtkTooltips *tooltips; - + EAccountList *accounts; GSList *from_options; - + gboolean post_custom; - + /* Standard headers. */ EMsgComposerHdrPair from, reply_to, to, cc, bcc, post_to, subject; }; @@ -138,9 +138,9 @@ setup_name_selector (EMsgComposerHdrs *hdrs) { EMsgComposerHdrsPrivate *priv; ENameSelectorDialog *name_selector_dialog; - + priv = hdrs->priv; - + g_return_if_fail (priv->name_selector == NULL); priv->name_selector = e_name_selector_new (); @@ -167,13 +167,13 @@ static EMsgComposerHdrsAndString * e_msg_composer_hdrs_and_string_create (EMsgComposerHdrs *hdrs, const char *string) { EMsgComposerHdrsAndString *emchas; - + emchas = g_new (EMsgComposerHdrsAndString, 1); emchas->hdrs = hdrs; emchas->string = g_strdup (string); if (emchas->hdrs) g_object_ref (emchas->hdrs); - + return emchas; } @@ -185,11 +185,11 @@ address_button_clicked_cb (GtkButton *button, gpointer data) EMsgComposerHdrsPrivate *priv; ENameSelectorDialog *name_selector_dialog; guint index = 0; - + emchas = data; hdrs = emchas->hdrs; priv = hdrs->priv; - + if (button == (GtkButton *) hdrs->priv->to.label) { gtk_widget_grab_focus (hdrs->priv->to.entry); index = 0; @@ -205,7 +205,7 @@ address_button_clicked_cb (GtkButton *button, gpointer data) index = 2; printf("index:%d\n", index); } - + name_selector_dialog = e_name_selector_peek_dialog (priv->name_selector); e_name_selector_dialog_set_destination_index (name_selector_dialog, index); gtk_widget_show (GTK_WIDGET (name_selector_dialog)); @@ -217,25 +217,25 @@ from_changed (GtkWidget *item, gpointer data) EMsgComposerHdrs *hdrs = E_MSG_COMPOSER_HDRS (data); const char *reply_to; GList *post_items = NULL; - + /* this will retrieve items relative to the previous account */ if (!hdrs->priv->post_custom) post_items = e_msg_composer_hdrs_get_post_to(hdrs); - + hdrs->account = g_object_get_data ((GObject *) item, "account"); - + /* we do this rather than calling e_msg_composer_hdrs_set_reply_to() because we don't want to change the visibility of the header */ reply_to = hdrs->account->id->reply_to; gtk_entry_set_text (GTK_ENTRY (hdrs->priv->reply_to.entry), reply_to ? reply_to : ""); - + /* folders should be made relative to the new from */ if (!hdrs->priv->post_custom) { e_msg_composer_hdrs_set_post_to_list (hdrs, post_items); g_list_foreach (post_items, (GFunc)g_free, NULL); g_list_free(post_items); } - + g_signal_emit (hdrs, signals [FROM_CHANGED], 0); } @@ -245,11 +245,11 @@ account_can_send (EAccount *account) static CamelStore *store; CamelException ex; gboolean result = FALSE; - - if (!account->parent_uid) + + if (!account->parent_uid) return TRUE; - - if (!(store = (CamelStore *) camel_session_get_service (session, e_account_get_string(account, E_ACCOUNT_SOURCE_URL), CAMEL_PROVIDER_STORE, &ex))) { + + if (!(store = (CamelStore *) camel_session_get_service (session, e_account_get_string(account, E_ACCOUNT_SOURCE_URL), CAMEL_PROVIDER_STORE, &ex))) { camel_exception_clear (&ex); return result; } else if (store->mode & CAMEL_STORE_WRITE) @@ -264,10 +264,10 @@ account_added_cb (EAccountList *accounts, EAccount *account, EMsgComposerHdrs *h { GtkWidget *item, *menu, *omenu, *toplevel; char *label; - + omenu = e_msg_composer_hdrs_get_from_omenu (hdrs); menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (omenu)); - + if (account_can_send (account)) { label = g_strdup_printf ("%s <%s>", account->id->name, account->id->address); item = gtk_menu_item_new_with_label (label); @@ -277,12 +277,12 @@ account_added_cb (EAccountList *accounts, EAccount *account, EMsgComposerHdrs *h g_object_ref (account); g_object_set_data ((GObject *) item, "account", account); g_signal_connect (item, "activate", G_CALLBACK (from_changed), hdrs); - + /* this is so we can later set which one we want */ hdrs->priv->from_options = g_slist_append (hdrs->priv->from_options, item); - + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); - + toplevel = gtk_widget_get_toplevel ((GtkWidget *) hdrs); gtk_widget_set_sensitive (toplevel, TRUE); } @@ -307,7 +307,7 @@ account_changed_cb (EAccountList *accounts, EAccount *account, EMsgComposerHdrs g_free (text); break; } - + node = node->next; } } @@ -327,30 +327,30 @@ account_removed_cb (EAccountList *accounts, EAccount *account, EMsgComposerHdrs if (acnt == account) { if (hdrs->account == account) hdrs->account = NULL; - + priv->from_options = g_slist_delete_link (priv->from_options, node); g_object_unref (account); gtk_widget_destroy (item); break; } - + node = node->next; } - + if (hdrs->account == NULL) { if (priv->from_options) { /* the previously selected account was removed, default the new selection to the first account in the menu list */ omenu = e_msg_composer_hdrs_get_from_omenu (hdrs); - + item = priv->from_options->data; gtk_option_menu_set_history (GTK_OPTION_MENU (omenu), 0); g_signal_emit_by_name (item, "activate", hdrs); } else { toplevel = gtk_widget_get_toplevel ((GtkWidget *) hdrs); gtk_widget_set_sensitive (toplevel, FALSE); - + /* FIXME: this should offer a 'configure account' button, can we do that? */ e_error_run((GtkWindow *)toplevel, "mail-composer:all-accounts-deleted", NULL); } @@ -371,11 +371,11 @@ create_from_optionmenu (EMsgComposerHdrs *hdrs) omenu = gtk_option_menu_new (); menu = gtk_menu_new (); - + gconf = gconf_client_get_default (); uid = gconf_client_get_string (gconf, "/apps/evolution/mail/default_account", NULL); g_object_unref (gconf); - + /* Make list of account email addresses */ addresses = g_ptr_array_new (); iter = e_list_get_iterator ((EList *) priv->accounts); @@ -384,23 +384,23 @@ create_from_optionmenu (EMsgComposerHdrs *hdrs) if (account->id->address && account_can_send (account) && account->enabled) g_ptr_array_add (addresses, account->id->address); - + e_iterator_next (iter); } - + e_iterator_reset (iter); - + while (e_iterator_is_valid (iter)) { char *label; - + account = (EAccount *) e_iterator_get (iter); - + /* this should never ever fail */ if (!account || !account->name || !account->id) { g_warning ("account details are bad\n"); continue; } - + if (account->id->address && *account->id->address && account_can_send (account) && account->enabled) { /* If the account has a unique email address, just * show that. Otherwise include the account name. @@ -409,60 +409,60 @@ create_from_optionmenu (EMsgComposerHdrs *hdrs) if (!strcmp (account->id->address, addresses->pdata[m])) matches++; } - + if (matches > 1) label = g_strdup_printf ("%s <%s> (%s)", account->id->name, account->id->address, account->name); else label = g_strdup_printf ("%s <%s>", account->id->name, account->id->address); - + item = gtk_menu_item_new_with_label (label); g_free (label); - + g_object_ref (account); g_object_set_data ((GObject *) item, "account", account); g_signal_connect (item, "activate", G_CALLBACK (from_changed), hdrs); - + if (uid && !strcmp (account->uid, uid)) { first = item; history = i; } - + /* this is so we can later set which one we want */ hdrs->priv->from_options = g_slist_append (hdrs->priv->from_options, item); - + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show (item); i++; } - + e_iterator_next (iter); } - + g_free (uid); g_object_unref (iter); - + g_ptr_array_free (addresses, TRUE); - + gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu); - + if (first) { gtk_option_menu_set_history (GTK_OPTION_MENU (omenu), history); g_signal_emit_by_name (first, "activate", hdrs); } - + hbox = gtk_hbox_new (FALSE, 6); gtk_box_pack_start_defaults (GTK_BOX (hbox), omenu); gtk_widget_show (omenu); gtk_widget_show (hbox); - + g_object_set_data ((GObject *) hbox, "from_menu", omenu); - + /* listen for changes to the account list so we can auto-update the from menu */ g_signal_connect (priv->accounts, "account-added", G_CALLBACK (account_added_cb), hdrs); g_signal_connect (priv->accounts, "account-changed", G_CALLBACK (account_changed_cb), hdrs); g_signal_connect (priv->accounts, "account-removed", G_CALLBACK (account_removed_cb), hdrs); - + return hbox; } @@ -471,7 +471,7 @@ addressbook_entry_changed (GtkWidget *entry, gpointer user_data) { EMsgComposerHdrs *hdrs = E_MSG_COMPOSER_HDRS (user_data); - + g_signal_emit (hdrs, signals[HDRS_CHANGED], 0); } @@ -519,7 +519,7 @@ create_addressbook_entry (EMsgComposerHdrs *hdrs, const char *name) EMsgComposerHdrsPrivate *priv; ENameSelectorModel *name_selector_model; ENameSelectorEntry *name_selector_entry; - + priv = hdrs->priv; name_selector_model = e_name_selector_peek_model (priv->name_selector); @@ -537,31 +537,31 @@ create_addressbook_entry (EMsgComposerHdrs *hdrs, const char *name) #if 0 CORBA_exception_init (&ev); - + GNOME_Evolution_Addressbook_SelectNames_addSection ( corba_select_names, name, name, &ev); if (ev._major != CORBA_NO_EXCEPTION) { CORBA_exception_free (&ev); return NULL; } - + corba_control = GNOME_Evolution_Addressbook_SelectNames_getEntryBySection ( corba_select_names, name, &ev); - + if (ev._major != CORBA_NO_EXCEPTION) { CORBA_exception_free (&ev); return NULL; } - + CORBA_exception_free (&ev); - + control_widget = bonobo_widget_new_control_from_objref ( corba_control, bonobo_ui_component_get_container (priv->uic)); - + cf = bonobo_widget_get_control_frame (BONOBO_WIDGET (control_widget)); pb = bonobo_control_frame_get_control_property_bag (cf, NULL); - + bonobo_control_frame_set_autoactivate (cf, TRUE); bonobo_event_source_client_add_listener ( @@ -584,7 +584,7 @@ post_browser_response (EMFolderSelector *emfs, int response, EMsgComposerHdrs *h g_list_foreach (uris, (GFunc) g_free, NULL); g_list_free (uris); } - + gtk_widget_destroy ((GtkWidget *) emfs); } @@ -595,7 +595,7 @@ post_browser_clicked_cb (GtkButton *button, EMsgComposerHdrs *hdrs) EMFolderTree *emft; GtkWidget *dialog; GList *post_items; - + gtk_widget_grab_focus(hdrs->priv->post_to.entry); model = mail_component_peek_tree_model (mail_component_peek ()); emft = (EMFolderTree *) em_folder_tree_new_with_model (model); @@ -605,12 +605,12 @@ post_browser_clicked_cb (GtkButton *button, EMsgComposerHdrs *hdrs) dialog = em_folder_selector_new (emft, EM_FOLDER_SELECTOR_CAN_CREATE, _("Posting destination"), _("Choose folders to post the message to."), NULL); - - post_items = e_msg_composer_hdrs_get_post_to (hdrs); + + post_items = e_msg_composer_hdrs_get_post_to (hdrs); em_folder_selector_set_selected_list ((EMFolderSelector *) dialog, post_items); g_list_foreach (post_items, (GFunc) g_free, NULL); g_list_free (post_items); - + g_signal_connect (dialog, "response", G_CALLBACK (post_browser_response), hdrs); gtk_widget_show (dialog); } @@ -621,7 +621,7 @@ post_entry_changed_cb (GtkButton *button, EMsgComposerHdrs *hdrs) hdrs->priv->post_custom = TRUE; } -static EMsgComposerHdrPair +static EMsgComposerHdrPair header_new_recipient (EMsgComposerHdrs *hdrs, const char *name, const char *tip) { EMsgComposerHdrPair ret; @@ -633,14 +633,14 @@ header_new_recipient (EMsgComposerHdrs *hdrs, const char *name, const char *tip) e_msg_composer_hdrs_and_string_create (hdrs, name), (GClosureNotify) e_msg_composer_hdrs_and_string_free, 0); - + gtk_tooltips_set_tip (hdrs->priv->tooltips, ret.label, _("Click here for the address book"), NULL); - + ret.entry = create_addressbook_entry (hdrs, name); ret.visible = FALSE; - + return ret; } @@ -659,7 +659,7 @@ create_headers (EMsgComposerHdrs *hdrs) { EMsgComposerHdrsPrivate *priv = hdrs->priv; AtkObject *a11y; - + /* * Reply-To: * @@ -670,14 +670,14 @@ create_headers (EMsgComposerHdrs *hdrs) priv->reply_to.label = gtk_label_new_with_mnemonic (_("_Reply-To:")); priv->reply_to.entry = gtk_entry_new (); gtk_label_set_mnemonic_widget((GtkLabel *)priv->reply_to.label, priv->reply_to.entry); - + /* * From */ priv->from.label = gtk_label_new_with_mnemonic (_("Fr_om:")); priv->from.entry = create_from_optionmenu (hdrs); gtk_label_set_mnemonic_widget((GtkLabel *)priv->from.label, e_msg_composer_hdrs_get_from_omenu (hdrs)); - + /* * Subject */ @@ -693,11 +693,11 @@ create_headers (EMsgComposerHdrs *hdrs) priv->to = header_new_recipient ( hdrs, _("_To:"), _("Enter the recipients of the message")); - + priv->cc = header_new_recipient ( hdrs, _("_Cc:"), _("Enter the addresses that will receive a carbon copy of the message")); - + priv->bcc = header_new_recipient ( hdrs, _("_Bcc:"), _("Enter the addresses that will receive a carbon copy of " @@ -714,11 +714,11 @@ create_headers (EMsgComposerHdrs *hdrs) gtk_tooltips_set_tip (hdrs->priv->tooltips, priv->post_to.label, _("Click here to select folders to post to"), NULL); - + priv->post_to.entry = gtk_entry_new (); if ((a11y = gtk_widget_get_accessible (priv->post_to.entry))) - atk_object_set_name (a11y, _("Post To:")); - + atk_object_set_name (a11y, _("Post To:")); + g_signal_connect(priv->post_to.entry, "changed", G_CALLBACK (post_entry_changed_cb), hdrs); @@ -732,7 +732,7 @@ attach_couple (EMsgComposerHdrs *hdrs, EMsgComposerHdrPair *pair, int line) pair->label, 0, 1, line, line + 1, GTK_FILL, GTK_FILL, 3, 3); - + if (line == LINE_TO || line == LINE_CC || line == LINE_BCC) { gtk_table_attach (GTK_TABLE (hdrs), pair->entry, 1, 2, @@ -751,7 +751,7 @@ static void attach_headers (EMsgComposerHdrs *hdrs) { EMsgComposerHdrsPrivate *p = hdrs->priv; - + attach_couple (hdrs, &p->from, LINE_FROM); attach_couple (hdrs, &p->reply_to, LINE_REPLYTO); attach_couple (hdrs, &p->to, LINE_TO); @@ -779,13 +779,13 @@ static void headers_set_visibility (EMsgComposerHdrs *h, int visible_flags) { EMsgComposerHdrsPrivate *p = h->priv; - + /* To is always visible if we're not doing Post-To */ if (!(h->visible_mask & E_MSG_COMPOSER_VISIBLE_POSTTO)) visible_flags |= E_MSG_COMPOSER_VISIBLE_TO; else visible_flags |= E_MSG_COMPOSER_VISIBLE_POSTTO; - + set_pair_visibility (h, &p->from, visible_flags & E_MSG_COMPOSER_VISIBLE_FROM); set_pair_visibility (h, &p->reply_to, visible_flags & E_MSG_COMPOSER_VISIBLE_REPLYTO); set_pair_visibility (h, &p->to, visible_flags & E_MSG_COMPOSER_VISIBLE_TO); @@ -802,7 +802,7 @@ headers_set_sensitivity (EMsgComposerHdrs *h) bonobo_ui_component_set_prop ( h->priv->uic, "/commands/ViewTo", "sensitive", h->visible_mask & E_MSG_COMPOSER_VISIBLE_TO ? "0" : "1", NULL); - + bonobo_ui_component_set_prop ( h->priv->uic, "/commands/ViewPostTo", "sensitive", h->visible_mask & E_MSG_COMPOSER_VISIBLE_POSTTO ? "0" : "1", NULL); @@ -812,7 +812,7 @@ void e_msg_composer_hdrs_set_visible_mask (EMsgComposerHdrs *hdrs, int visible_mask) { g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs)); - + hdrs->visible_mask = visible_mask; headers_set_sensitivity (hdrs); } @@ -821,7 +821,7 @@ void e_msg_composer_hdrs_set_visible (EMsgComposerHdrs *hdrs, int visible_flags) { g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs)); - + headers_set_visibility (hdrs, visible_flags); gtk_widget_queue_resize (GTK_WIDGET (hdrs)); } @@ -831,7 +831,7 @@ setup_headers (EMsgComposerHdrs *hdrs, int visible_flags) { create_headers (hdrs); attach_headers (hdrs); - + headers_set_sensitivity (hdrs); headers_set_visibility (hdrs, visible_flags); } @@ -845,10 +845,10 @@ destroy (GtkObject *object) EMsgComposerHdrs *hdrs; EMsgComposerHdrsPrivate *priv; GSList *l, *n; - + hdrs = E_MSG_COMPOSER_HDRS (object); priv = hdrs->priv; - + if (priv) { if (priv->name_selector != NULL) { g_object_unref (priv->name_selector); @@ -860,32 +860,32 @@ destroy (GtkObject *object) g_object_unref (priv->tooltips); priv->tooltips = NULL; } - + if (priv->accounts) { g_signal_handlers_disconnect_matched(priv->accounts, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, hdrs); g_object_unref (priv->accounts); priv->accounts = NULL; } - + l = priv->from_options; while (l) { EAccount *account; GtkWidget *item = l->data; - + account = g_object_get_data ((GObject *) item, "account"); g_object_unref (account); - + n = l->next; g_slist_free_1 (l); l = n; } - + priv->from_options = NULL; - + g_free (priv); hdrs->priv = NULL; } - + if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } @@ -895,12 +895,12 @@ static void class_init (EMsgComposerHdrsClass *class) { GtkObjectClass *object_class; - + object_class = GTK_OBJECT_CLASS (class); object_class->destroy = destroy; - + parent_class = g_type_class_ref (gtk_table_get_type ()); - + signals[SHOW_ADDRESS_DIALOG] = g_signal_new ("show_address_dialog", E_TYPE_MSG_COMPOSER_HDRS, @@ -909,7 +909,7 @@ class_init (EMsgComposerHdrsClass *class) NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); - + signals[SUBJECT_CHANGED] = g_signal_new ("subject_changed", E_TYPE_MSG_COMPOSER_HDRS, @@ -919,7 +919,7 @@ class_init (EMsgComposerHdrsClass *class) g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING); - + signals[HDRS_CHANGED] = g_signal_new ("hdrs_changed", E_TYPE_MSG_COMPOSER_HDRS, @@ -928,7 +928,7 @@ class_init (EMsgComposerHdrsClass *class) NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); - + signals[FROM_CHANGED] = g_signal_new ("from_changed", E_TYPE_MSG_COMPOSER_HDRS, @@ -943,17 +943,17 @@ static void init (EMsgComposerHdrs *hdrs) { EMsgComposerHdrsPrivate *priv; - + priv = g_new0 (EMsgComposerHdrsPrivate, 1); - + priv->tooltips = gtk_tooltips_new (); g_object_ref_sink (priv->tooltips); - + priv->accounts = mail_config_get_accounts (); g_object_ref (priv->accounts); priv->post_custom = FALSE; - + hdrs->priv = priv; } @@ -962,7 +962,7 @@ GType e_msg_composer_hdrs_get_type (void) { static GType type = 0; - + if (type == 0) { static const GTypeInfo info = { sizeof (EMsgComposerHdrsClass), @@ -975,10 +975,10 @@ e_msg_composer_hdrs_get_type (void) 0, (GInstanceInitFunc) init, }; - + type = g_type_register_static (gtk_table_get_type (), "EMsgComposerHdrs", &info, 0); } - + return type; } @@ -987,7 +987,7 @@ e_msg_composer_hdrs_new (BonoboUIComponent *uic, int visible_mask, int visible_f { EMsgComposerHdrs *new; EMsgComposerHdrsPrivate *priv; - + new = g_object_new (e_msg_composer_hdrs_get_type (), NULL); priv = new->priv; priv->uic = uic; @@ -995,11 +995,11 @@ e_msg_composer_hdrs_new (BonoboUIComponent *uic, int visible_mask, int visible_f g_object_ref_sink (new); setup_name_selector (new); - + new->visible_mask = visible_mask; - + setup_headers (new, visible_flags); - + return GTK_WIDGET (new); } @@ -1017,15 +1017,15 @@ set_recipients_from_destv (CamelMimeMessage *msg, const char *text_addr, *header; gboolean seen_hidden_list = FALSE; int i; - + to_addr = camel_internet_address_new (); cc_addr = camel_internet_address_new (); bcc_addr = camel_internet_address_new (); - + if (to_destv) { for (i = 0; to_destv[i] != NULL; ++i) { text_addr = e_destination_get_address (to_destv[i]); - + if (text_addr && *text_addr) { target = to_addr; if (e_destination_is_evolution_list (to_destv[i]) @@ -1033,12 +1033,12 @@ set_recipients_from_destv (CamelMimeMessage *msg, target = bcc_addr; seen_hidden_list = TRUE; } - + camel_address_decode (CAMEL_ADDRESS (target), text_addr); } } } - + if (cc_destv) { for (i = 0; cc_destv[i] != NULL; ++i) { text_addr = e_destination_get_address (cc_destv[i]); @@ -1049,38 +1049,38 @@ set_recipients_from_destv (CamelMimeMessage *msg, target = bcc_addr; seen_hidden_list = TRUE; } - + camel_address_decode (CAMEL_ADDRESS (target), text_addr); } } } - + if (bcc_destv) { for (i = 0; bcc_destv[i] != NULL; ++i) { text_addr = e_destination_get_address (bcc_destv[i]); - if (text_addr && *text_addr) { + if (text_addr && *text_addr) { camel_address_decode (CAMEL_ADDRESS (bcc_addr), text_addr); } } } - + header = redirect ? CAMEL_RECIPIENT_TYPE_RESENT_TO : CAMEL_RECIPIENT_TYPE_TO; if (camel_address_length (CAMEL_ADDRESS (to_addr)) > 0) { camel_mime_message_set_recipients (msg, header, to_addr); } else if (seen_hidden_list) { camel_medium_set_header (CAMEL_MEDIUM (msg), header, "Undisclosed-Recipient:;"); } - + header = redirect ? CAMEL_RECIPIENT_TYPE_RESENT_CC : CAMEL_RECIPIENT_TYPE_CC; if (camel_address_length (CAMEL_ADDRESS (cc_addr)) > 0) { camel_mime_message_set_recipients (msg, header, cc_addr); } - + header = redirect ? CAMEL_RECIPIENT_TYPE_RESENT_BCC : CAMEL_RECIPIENT_TYPE_BCC; if (camel_address_length (CAMEL_ADDRESS (bcc_addr)) > 0) { camel_mime_message_set_recipients (msg, header, bcc_addr); } - + camel_object_unref (to_addr); camel_object_unref (cc_addr); camel_object_unref (bcc_addr); @@ -1098,10 +1098,10 @@ e_msg_composer_hdrs_to_message_internal (EMsgComposerHdrs *hdrs, g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs)); g_return_if_fail (CAMEL_IS_MIME_MESSAGE (msg)); - + subject = e_msg_composer_hdrs_get_subject (hdrs); camel_mime_message_set_subject (msg, subject); - + addr = e_msg_composer_hdrs_get_from (hdrs); if (redirect) { header = camel_address_encode (CAMEL_ADDRESS (addr)); @@ -1111,27 +1111,27 @@ e_msg_composer_hdrs_to_message_internal (EMsgComposerHdrs *hdrs, camel_mime_message_set_from (msg, addr); } camel_object_unref (addr); - + addr = e_msg_composer_hdrs_get_reply_to (hdrs); if (addr) { camel_mime_message_set_reply_to (msg, addr); camel_object_unref (addr); } - + if (hdrs->priv->to.visible || hdrs->priv->cc.visible || hdrs->priv->bcc.visible) { to_destv = e_msg_composer_hdrs_get_to (hdrs); cc_destv = e_msg_composer_hdrs_get_cc (hdrs); bcc_destv = e_msg_composer_hdrs_get_bcc (hdrs); - + /* Attach destinations to the message. */ - + set_recipients_from_destv (msg, to_destv, cc_destv, bcc_destv, redirect); - + e_destination_freev (to_destv); e_destination_freev (cc_destv); e_destination_freev (bcc_destv); } - + if (hdrs->priv->post_to.visible) { GList *post, *l; @@ -1173,9 +1173,9 @@ e_msg_composer_hdrs_set_from_account (EMsgComposerHdrs *hdrs, char *uid = NULL; GSList *l; int i = 0; - + g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs)); - + omenu = GTK_OPTION_MENU (e_msg_composer_hdrs_get_from_omenu (hdrs)); if (!account_name) { @@ -1183,13 +1183,13 @@ e_msg_composer_hdrs_set_from_account (EMsgComposerHdrs *hdrs, uid = gconf_client_get_string (gconf, "/apps/evolution/mail/default_account", NULL); g_object_unref (gconf); } - + /* find the item that represents the account and activate it */ l = hdrs->priv->from_options; while (l) { EAccount *account; item = l->data; - + account = g_object_get_data ((GObject *) item, "account"); if (account_can_send (account)) { if (account_name) { @@ -1198,7 +1198,7 @@ e_msg_composer_hdrs_set_from_account (EMsgComposerHdrs *hdrs, gtk_option_menu_set_history (omenu, i); g_signal_emit_by_name (item, "activate", hdrs); g_free (uid); - + return; } } else if (uid && !strcmp (account->uid, uid)) { @@ -1206,14 +1206,14 @@ e_msg_composer_hdrs_set_from_account (EMsgComposerHdrs *hdrs, gtk_option_menu_set_history (omenu, i); g_signal_emit_by_name (item, "activate", hdrs); g_free (uid); - + return; } } l = l->next; i++; } - + g_free (uid); } @@ -1222,9 +1222,9 @@ e_msg_composer_hdrs_set_reply_to (EMsgComposerHdrs *hdrs, const char *reply_to) { g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs)); - + gtk_entry_set_text (GTK_ENTRY (hdrs->priv->reply_to.entry), reply_to ? reply_to : ""); - + if (reply_to && *reply_to) set_pair_visibility (hdrs, &hdrs->priv->cc, TRUE); } @@ -1271,7 +1271,7 @@ e_msg_composer_hdrs_set_cc (EMsgComposerHdrs *hdrs, g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs)); destinations_to_name_selector_entry (E_NAME_SELECTOR_ENTRY (hdrs->priv->cc.entry), cc_destv); - + if (cc_destv && *cc_destv) set_pair_visibility (hdrs, &hdrs->priv->cc, TRUE); } @@ -1283,7 +1283,7 @@ e_msg_composer_hdrs_set_bcc (EMsgComposerHdrs *hdrs, g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs)); destinations_to_name_selector_entry (E_NAME_SELECTOR_ENTRY (hdrs->priv->bcc.entry), bcc_destv); - + if (bcc_destv && *bcc_destv) set_pair_visibility (hdrs, &hdrs->priv->bcc, TRUE); } @@ -1294,14 +1294,14 @@ e_msg_composer_hdrs_set_post_to (EMsgComposerHdrs *hdrs, const char *post_to) { GList *list; - + g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs)); g_return_if_fail (post_to != NULL); - + list = g_list_append (NULL, g_strdup (post_to)); - + e_msg_composer_hdrs_set_post_to_list (hdrs, list); - + g_free (list->data); g_list_free (list); } @@ -1310,22 +1310,22 @@ static GList * newsgroups_list_split (const char *list) { GList *lst = NULL; - char *tmp; + char *tmp; char **items, **cur_ptr; - + cur_ptr = items = g_strsplit (list, ",", 0); - + while ((tmp = *cur_ptr) != NULL) { g_strstrip (tmp); - + if (tmp[0]) lst = g_list_append (lst, g_strdup (tmp)); - + cur_ptr++; } - + g_strfreev (items); - + return lst; } @@ -1334,7 +1334,7 @@ get_account_store_url (EMsgComposerHdrs *hdrs) { CamelURL *url; char *ret = NULL; - + if (hdrs->account->source && hdrs->account->source->url && hdrs->account->source->url[0] @@ -1342,27 +1342,27 @@ get_account_store_url (EMsgComposerHdrs *hdrs) ret = camel_url_to_string (url, CAMEL_URL_HIDE_ALL); camel_url_free (url); } - + return ret; -} +} static char * folder_name_to_string (EMsgComposerHdrs *hdrs, const char *uri) { char *storeurl = get_account_store_url (hdrs); int len; - + if (storeurl) { len = strlen (storeurl); - + if (g_ascii_strncasecmp (uri, storeurl, len) == 0) { g_free (storeurl); return g_strdup (uri + len); } - + g_free (storeurl); } - + return g_strdup (uri); } @@ -1372,7 +1372,7 @@ e_msg_composer_hdrs_set_post_to_list (EMsgComposerHdrs *hdrs, GList *urls) GString *caption; char *tmp; gboolean post_custom; - + if (hdrs->priv->post_to.entry == NULL) return; @@ -1384,10 +1384,10 @@ e_msg_composer_hdrs_set_post_to_list (EMsgComposerHdrs *hdrs, GList *urls) g_string_append(caption, ", "); g_string_append(caption, tmp); } - + urls = g_list_next (urls); } - + post_custom = hdrs->priv->post_custom; gtk_entry_set_text(GTK_ENTRY(hdrs->priv->post_to.entry), caption->str); hdrs->priv->post_custom = post_custom; @@ -1402,11 +1402,11 @@ e_msg_composer_hdrs_set_post_to_base (EMsgComposerHdrs *hdrs, const char *base, char *tmp, *tmp2; gboolean post_custom; GString *caption; - + /* split to newsgroup names */ lst = newsgroups_list_split(post_to); curlist = lst; - + caption = g_string_new(""); while (curlist) { /* FIXME: this doens't handle all folder names properly */ @@ -1420,7 +1420,7 @@ e_msg_composer_hdrs_set_post_to_base (EMsgComposerHdrs *hdrs, const char *base, } curlist = g_list_next(curlist); } - + post_custom = hdrs->priv->post_custom; gtk_entry_set_text(GTK_ENTRY(hdrs->priv->post_to.entry), caption->str); hdrs->priv->post_custom = post_custom; @@ -1436,7 +1436,7 @@ e_msg_composer_hdrs_set_subject (EMsgComposerHdrs *hdrs, { g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs)); g_return_if_fail (subject != NULL); - + gtk_entry_set_text ((GtkEntry *) hdrs->priv->subject.entry, subject); } @@ -1448,15 +1448,15 @@ e_msg_composer_hdrs_get_from (EMsgComposerHdrs *hdrs) EAccount *account; g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL); - + if (!(account = hdrs->account)) { /* FIXME: perhaps we should try the default account? */ return NULL; } - + addr = camel_internet_address_new (); camel_internet_address_add (addr, account->id->name, account->id->address); - + return addr; } @@ -1465,20 +1465,20 @@ e_msg_composer_hdrs_get_reply_to (EMsgComposerHdrs *hdrs) { CamelInternetAddress *addr; const char *reply_to; - + g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL); - + reply_to = gtk_entry_get_text (GTK_ENTRY (hdrs->priv->reply_to.entry)); - + if (!reply_to || *reply_to == '\0') return NULL; - + addr = camel_internet_address_new (); if (camel_address_unformat (CAMEL_ADDRESS (addr), reply_to) == -1) { camel_object_unref (CAMEL_OBJECT (addr)); return NULL; } - + return addr; } @@ -1510,7 +1510,7 @@ e_msg_composer_hdrs_get_internal (EMsgComposerHdrs *hdrs, ENameSelectorEntry *en EDestinationStore *destination_store; GList *destinations; EDestination **destv = NULL; - + destination_store = e_name_selector_entry_peek_destination_store (entry); destinations = e_destination_store_list_destinations (destination_store); @@ -1552,42 +1552,42 @@ e_msg_composer_hdrs_get_recipients (EMsgComposerHdrs *hdrs) EDestination **bcc_destv; EDestination **recip_destv; int i, j, n; - + g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL); - + to_destv = e_msg_composer_hdrs_get_to (hdrs); cc_destv = e_msg_composer_hdrs_get_cc (hdrs); bcc_destv = e_msg_composer_hdrs_get_bcc (hdrs); - + n = 0; - + for (i = 0; to_destv && to_destv[i] != NULL; i++, n++); for (i = 0; cc_destv && cc_destv[i] != NULL; i++, n++); for (i = 0; bcc_destv && bcc_destv[i] != NULL; i++, n++); - + if (n == 0) return NULL; - + recip_destv = g_new (EDestination *, n + 1); - + j = 0; - + for (i = 0; to_destv && to_destv[i] != NULL; i++, j++) recip_destv[j] = to_destv[i]; for (i = 0; cc_destv && cc_destv[i] != NULL; i++, j++) recip_destv[j] = cc_destv[i]; for (i = 0; bcc_destv && bcc_destv[i] != NULL; i++, j++) recip_destv[j] = bcc_destv[i]; - + if (j != n) { g_warning ("j!=n \n"); } recip_destv[j] = NULL; - + g_free (to_destv); g_free (cc_destv); g_free (bcc_destv); - + return recip_destv; } @@ -1597,16 +1597,16 @@ e_msg_composer_hdrs_get_post_to (EMsgComposerHdrs *hdrs) { GList *uris, *cur; char *storeurl = NULL, *tmp; - + g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL); - + if (hdrs->priv->post_to.entry == NULL) return NULL; - + tmp = g_strdup (gtk_entry_get_text (GTK_ENTRY (hdrs->priv->post_to.entry))); uris = newsgroups_list_split (tmp); g_free (tmp); - + cur = uris; while (cur) { /* FIXME: this is a bit of a hack, should use camelurl's etc */ @@ -1620,12 +1620,12 @@ e_msg_composer_hdrs_get_post_to (EMsgComposerHdrs *hdrs) g_free (cur->data); cur->data = tmp; } - + cur = cur->next; } - + g_free (storeurl); - + return uris; } @@ -1634,7 +1634,7 @@ const char * e_msg_composer_hdrs_get_subject (EMsgComposerHdrs *hdrs) { g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL); - + return gtk_entry_get_text ((GtkEntry *) hdrs->priv->subject.entry); } @@ -1643,7 +1643,7 @@ GtkWidget * e_msg_composer_hdrs_get_reply_to_entry (EMsgComposerHdrs *hdrs) { g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL); - + return hdrs->priv->reply_to.entry; } @@ -1651,7 +1651,7 @@ GtkWidget * e_msg_composer_hdrs_get_to_entry (EMsgComposerHdrs *hdrs) { g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL); - + return hdrs->priv->to.entry; } @@ -1659,7 +1659,7 @@ GtkWidget * e_msg_composer_hdrs_get_cc_entry (EMsgComposerHdrs *hdrs) { g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL); - + return hdrs->priv->cc.entry; } @@ -1667,7 +1667,7 @@ GtkWidget * e_msg_composer_hdrs_get_bcc_entry (EMsgComposerHdrs *hdrs) { g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL); - + return hdrs->priv->bcc.entry; } @@ -1675,7 +1675,7 @@ GtkWidget * e_msg_composer_hdrs_get_post_to_label (EMsgComposerHdrs *hdrs) { g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL); - + return hdrs->priv->post_to.entry; } @@ -1683,7 +1683,7 @@ GtkWidget * e_msg_composer_hdrs_get_subject_entry (EMsgComposerHdrs *hdrs) { g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL); - + return hdrs->priv->subject.entry; } @@ -1691,7 +1691,7 @@ GtkWidget * e_msg_composer_hdrs_get_from_hbox (EMsgComposerHdrs *hdrs) { g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL); - + return hdrs->priv->from.entry; } @@ -1699,7 +1699,7 @@ GtkWidget * e_msg_composer_hdrs_get_from_omenu (EMsgComposerHdrs *hdrs) { g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL); - + return GTK_WIDGET (g_object_get_data ((GObject *) hdrs->priv->from.entry, "from_menu")); } |