diff options
Diffstat (limited to 'composer')
-rw-r--r-- | composer/e-msg-composer-hdrs.c | 414 | ||||
-rw-r--r-- | composer/e-msg-composer-hdrs.h | 8 | ||||
-rw-r--r-- | composer/e-msg-composer-select-file.c | 26 | ||||
-rw-r--r-- | composer/e-msg-composer.c | 1498 | ||||
-rw-r--r-- | composer/e-msg-composer.h | 4 | ||||
-rw-r--r-- | composer/evolution-composer.c | 30 | ||||
-rw-r--r-- | composer/listener.c | 18 | ||||
-rw-r--r-- | composer/listener.h | 4 |
8 files changed, 1001 insertions, 1001 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")); } diff --git a/composer/e-msg-composer-hdrs.h b/composer/e-msg-composer-hdrs.h index 2888c5daa7..919400167d 100644 --- a/composer/e-msg-composer-hdrs.h +++ b/composer/e-msg-composer-hdrs.h @@ -51,13 +51,13 @@ typedef struct _EMsgComposerHdrsPrivate EMsgComposerHdrsPrivate; struct _EMsgComposerHdrs { GtkTable parent; - + EMsgComposerHdrsPrivate *priv; - + EAccount *account; - + guint32 visible_mask; - + gboolean has_changed; }; diff --git a/composer/e-msg-composer-select-file.c b/composer/e-msg-composer-select-file.c index 1d02f2bd8a..4cf92a661e 100644 --- a/composer/e-msg-composer-select-file.c +++ b/composer/e-msg-composer-select-file.c @@ -59,9 +59,9 @@ get_selector(struct _EMsgComposer *composer, const char *title, guint32 flags) GtkWidget *showinline = NULL; GList *icon_list; char *path; - + path = g_object_get_data ((GObject *) composer, "attach_path"); - + if (flags & SELECTOR_MODE_SAVE) selection = gtk_file_chooser_dialog_new (title, NULL, @@ -76,37 +76,37 @@ get_selector(struct _EMsgComposer *composer, const char *title, guint32 flags) GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, _("A_ttach"), GTK_RESPONSE_OK, NULL); - + gtk_dialog_set_default_response (GTK_DIALOG (selection), GTK_RESPONSE_OK); gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (selection), FALSE); - + if ((flags & SELECTOR_MODE_SAVE) == 0) gtk_file_chooser_set_select_multiple ((GtkFileChooser *) selection, (flags & SELECTOR_MODE_MULTI)); - + /* restore last path used */ if (!path) gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (selection), g_get_home_dir ()); else gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (selection), path); - + if (flags & SELECTOR_SHOW_INLINE) { showinline = gtk_check_button_new_with_mnemonic (_("_Suggest automatic display of attachment")); gtk_widget_show (showinline); gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (selection), showinline); g_object_set_data((GObject *)selection, "show-inline", showinline); } - + gtk_window_set_transient_for ((GtkWindow *) selection, (GtkWindow *) composer); gtk_window_set_wmclass ((GtkWindow *) selection, "fileselection", "Evolution:composer"); gtk_window_set_modal ((GtkWindow *) selection, FALSE); - + icon_list = e_icon_factory_get_icon_list ("mail-message-new"); if (icon_list) { gtk_window_set_icon_list (GTK_WINDOW (selection), icon_list); g_list_foreach (icon_list, (GFunc) g_object_unref, NULL); g_list_free (icon_list); } - + return selection; } @@ -143,7 +143,7 @@ select_file_response(GtkWidget *selector, guint response, struct _EMsgComposer * void e_msg_composer_select_file(struct _EMsgComposer *composer, GtkWidget **w, EMsgComposerSelectFileFunc func, const char *title, int save) { if (*w) { - gtk_window_present((GtkWindow *)*w); + gtk_window_present((GtkWindow *)*w); return; } @@ -163,7 +163,7 @@ select_attach_response(GtkWidget *selector, guint response, struct _EMsgComposer EMsgComposerSelectAttachFunc func = g_object_get_data((GObject *)selector, "callback"); GtkToggleButton *showinline = g_object_get_data((GObject *)selector, "show-inline"); char *path = NULL; - + char *filename = NULL; names = gtk_file_chooser_get_uris (GTK_FILE_CHOOSER (selector)); filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (selector)); @@ -175,7 +175,7 @@ select_attach_response(GtkWidget *selector, guint response, struct _EMsgComposer g_object_set_data_full ((GObject *) composer, "attach_path", path, g_free); func(composer, names, gtk_toggle_button_get_active(showinline)); - + e_msg_composer_show_attachments_ui (composer); @@ -189,7 +189,7 @@ select_attach_response(GtkWidget *selector, guint response, struct _EMsgComposer void e_msg_composer_select_file_attachments(struct _EMsgComposer *composer, GtkWidget **w, EMsgComposerSelectAttachFunc func) { if (*w) { - gtk_window_present((GtkWindow *)*w); + gtk_window_present((GtkWindow *)*w); return; } diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index f5b639dde0..eb4cac1e8b 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -23,7 +23,7 @@ * Jeffrey Stedfast (fejj@ximian.com) * Miguel de Icaza (miguel@ximian.com) * Radek Doulik (rodo@ximian.com) - * + * */ /* @@ -86,7 +86,7 @@ #include "misc/e-expander.h" #include "e-util/e-error.h" #include "e-util/e-util-private.h" -#include <mail/em-event.h> +#include <mail/em-event.h> #include <camel/camel-session.h> #include <camel/camel-charset-map.h> @@ -138,13 +138,13 @@ typedef struct _EMsgComposerPrivate EMsgComposerPrivate; struct _EMsgComposer { BonoboWindow parent; - + EMsgComposerPrivate *priv; }; struct _EMsgComposerClass { BonoboWindowClass parent_class; - + void (* send) (EMsgComposer *composer); void (* save_draft) (EMsgComposer *composer, int quit); }; @@ -158,36 +158,36 @@ struct _EMsgComposerPrivate { /* UIComponent for the non-control GtkEntries */ BonoboUIComponent *entry_uic; - + GtkWidget *hdrs; GPtrArray *extra_hdr_names, *extra_hdr_values; - + GtkWidget *focused_entry; - + GtkWidget *eeditor; - + GtkWidget *attachment_bar; GtkWidget *attachment_scrolled_window; GtkWidget *attachment_expander; GtkWidget *attachment_expander_label; GtkWidget *attachment_expander_icon; GtkWidget *attachment_expander_num; - + GtkWidget *address_dialog; - + Bonobo_PersistFile persist_file_interface; Bonobo_PersistStream persist_stream_interface; GNOME_GtkHTML_Editor_Engine eeditor_engine; BonoboObject *eeditor_listener; GHashTable *inline_images, *inline_images_by_url; GList *current_images; - + char *mime_type, *mime_body, *charset; - + char *autosave_file; int autosave_fd; guint32 enable_autosave : 1; - + guint32 attachment_bar_visible : 1; guint32 send_html : 1; guint32 is_alternative : 1; @@ -206,22 +206,22 @@ struct _EMsgComposerPrivate { guint32 set_priority : 1; guint32 has_changed : 1; guint32 autosaved : 1; - + guint32 mode_post : 1; - + guint32 in_signature_insert : 1; - + struct _ESignature *signature; struct _GtkOptionMenu *sig_menu; guint sig_added_id; guint sig_removed_id; guint sig_changed_id; - + CamelMimeMessage *redirect; - + guint notify_id; - gboolean send_invoked; + gboolean send_invoked; EMMenu *menu; GtkWidget *saveas; /* saveas async file requester */ @@ -306,13 +306,13 @@ destination_list_to_vector_sized (GList *list, int n) { EDestination **destv; int i = 0; - + if (n == -1) n = g_list_length (list); - + if (n == 0) return NULL; - + destv = g_new (EDestination *, n + 1); while (list != NULL && i < n) { destv[i] = E_DESTINATION (list->data); @@ -321,7 +321,7 @@ destination_list_to_vector_sized (GList *list, int n) list = g_list_next (list); } destv[i] = NULL; - + return destv; } @@ -338,9 +338,9 @@ get_text (Bonobo_PersistStream persist, char *format) BonoboStreamMem *stream_mem; CORBA_Environment ev; GByteArray *text; - + CORBA_exception_init (&ev); - + stream = bonobo_stream_mem_create (NULL, 0, FALSE, TRUE); Bonobo_PersistStream_save (persist, (Bonobo_Stream)bonobo_object_corba_objref (BONOBO_OBJECT (stream)), format, &ev); @@ -349,14 +349,14 @@ get_text (Bonobo_PersistStream persist, char *format) bonobo_exception_get_text (&ev)); return NULL; } - + CORBA_exception_free (&ev); - + stream_mem = BONOBO_STREAM_MEM (stream); text = g_byte_array_new (); g_byte_array_append (text, (const guint8 *)stream_mem->buffer, stream_mem->pos); bonobo_object_unref (BONOBO_OBJECT (stream)); - + return text; } @@ -369,14 +369,14 @@ best_encoding (GByteArray *buf, const char *charset) size_t inlen, outlen; int status, count = 0; iconv_t cd; - + if (!charset) return -1; - + cd = e_iconv_open (charset, "utf-8"); if (cd == (iconv_t) -1) return -1; - + in = (char*)buf->data; inlen = buf->len; do { @@ -389,10 +389,10 @@ best_encoding (GByteArray *buf, const char *charset) } } while (status == (size_t) -1 && errno == E2BIG); e_iconv_close (cd); - + if (status == (size_t) -1 || status > 0) return -1; - + if (count == 0) return CAMEL_TRANSFER_ENCODING_7BIT; else if (count <= buf->len * 0.17) @@ -407,10 +407,10 @@ composer_get_default_charset_setting (void) GConfClient *gconf; const char *locale; char *charset; - + gconf = gconf_client_get_default (); charset = gconf_client_get_string (gconf, "/apps/evolution/mail/composer/charset", NULL); - + if (!charset || charset[0] == '\0') { g_free (charset); charset = gconf_client_get_string (gconf, "/apps/evolution/mail/format/charset", NULL); @@ -419,12 +419,12 @@ composer_get_default_charset_setting (void) charset = NULL; } } - + g_object_unref (gconf); - + if (!charset && (locale = e_iconv_locale_charset ())) charset = g_strdup (locale); - + return charset ? charset : g_strdup ("us-ascii"); } @@ -432,31 +432,31 @@ static char * best_charset (GByteArray *buf, const char *default_charset, CamelTransferEncoding *encoding) { char *charset; - + /* First try US-ASCII */ *encoding = best_encoding (buf, "US-ASCII"); if (*encoding == CAMEL_TRANSFER_ENCODING_7BIT) return NULL; - + /* Next try the user-specified charset for this message */ *encoding = best_encoding (buf, default_charset); if (*encoding != -1) return g_strdup (default_charset); - + /* Now try the user's default charset from the mail config */ charset = composer_get_default_charset_setting (); *encoding = best_encoding (buf, charset); if (*encoding != -1) return charset; - + /* Try to find something that will work */ if (!(charset = (char *) camel_charset_best ((const gchar *)buf->data, buf->len))) { *encoding = CAMEL_TRANSFER_ENCODING_7BIT; return NULL; } - + *encoding = best_encoding (buf, charset); - + return g_strdup (charset); } @@ -522,17 +522,17 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data) GByteArray *data; char *charset; int i; - + if (p->persist_stream_interface == CORBA_OBJECT_NIL) return NULL; - + /* evil kludgy hack for Redirect */ if (p->redirect) { e_msg_composer_hdrs_to_redirect (hdrs, p->redirect); camel_object_ref (p->redirect); return p->redirect; } - + new = camel_mime_message_new (); e_msg_composer_hdrs_to_message (hdrs, new); for (i = 0; i < p->extra_hdr_names->len; i++) { @@ -546,14 +546,14 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data) char *mdn_address = hdrs->account->id->reply_to; if (!mdn_address || !*mdn_address) mdn_address = hdrs->account->id->address; - + camel_medium_add_header (CAMEL_MEDIUM (new), "Disposition-Notification-To", mdn_address); } /* Message Priority */ - if (p->set_priority) + if (p->set_priority) camel_medium_add_header (CAMEL_MEDIUM (new), "X-Priority", "1"); - + if (p->mime_body) { plain_encoding = CAMEL_TRANSFER_ENCODING_7BIT; for (i = 0; p->mime_body[i]; i++) { @@ -572,7 +572,7 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data) camel_object_unref (CAMEL_OBJECT (new)); return NULL; } - + /* FIXME: we may want to do better than this... */ type = camel_content_type_new ("text", "plain"); @@ -582,35 +582,35 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data) g_free (charset); } } - + stream = camel_stream_mem_new_with_byte_array (data); - + /* convert the stream to the appropriate charset */ if (iconv_charset && g_ascii_strcasecmp (iconv_charset, "UTF-8") != 0) { CamelStreamFilter *filter_stream; CamelMimeFilterCharset *filter; - + filter_stream = camel_stream_filter_new_with_stream (stream); camel_object_unref (stream); - + stream = (CamelStream *) filter_stream; filter = camel_mime_filter_charset_new_convert ("UTF-8", iconv_charset); camel_stream_filter_add (filter_stream, (CamelMimeFilter *) filter); camel_object_unref (filter); } - + /* construct the content object */ plain = camel_data_wrapper_new (); camel_data_wrapper_construct_from_stream (plain, stream); camel_object_unref (stream); - + camel_data_wrapper_set_mime_type_field (plain, type); camel_content_type_unref (type); - + if (p->send_html) { CORBA_Environment ev; clear_current_images (composer); - + if (save_html_object_data) { CORBA_exception_init (&ev); GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "save-data-on", &ev); @@ -620,79 +620,79 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data) GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "save-data-off", &ev); CORBA_exception_free (&ev); } - + if (!data) { /* The component has probably died */ camel_object_unref (new); camel_object_unref (plain); return NULL; } - + html = camel_data_wrapper_new (); - + stream = camel_stream_mem_new_with_byte_array (data); camel_data_wrapper_construct_from_stream (html, stream); camel_object_unref (stream); camel_data_wrapper_set_mime_type (html, "text/html; charset=utf-8"); - + /* Build the multipart/alternative */ body = camel_multipart_new (); camel_data_wrapper_set_mime_type (CAMEL_DATA_WRAPPER (body), "multipart/alternative"); camel_multipart_set_boundary (body, NULL); - + part = camel_mime_part_new (); camel_medium_set_content_object (CAMEL_MEDIUM (part), plain); camel_object_unref (plain); camel_mime_part_set_encoding (part, plain_encoding); camel_multipart_add_part (body, part); camel_object_unref (part); - + part = camel_mime_part_new (); camel_medium_set_content_object (CAMEL_MEDIUM (part), html); camel_object_unref (html); camel_multipart_add_part (body, part); camel_object_unref (part); - + /* If there are inlined images, construct a * multipart/related containing the * multipart/alternative and the images. */ if (p->current_images) { CamelMultipart *html_with_images; - + html_with_images = camel_multipart_new (); camel_data_wrapper_set_mime_type ( CAMEL_DATA_WRAPPER (html_with_images), "multipart/related; type=\"multipart/alternative\""); camel_multipart_set_boundary (html_with_images, NULL); - + part = camel_mime_part_new (); camel_medium_set_content_object (CAMEL_MEDIUM (part), CAMEL_DATA_WRAPPER (body)); camel_object_unref (body); camel_multipart_add_part (html_with_images, part); camel_object_unref (part); - + add_inlined_images (composer, html_with_images); clear_current_images (composer); - + current = CAMEL_DATA_WRAPPER (html_with_images); } else current = CAMEL_DATA_WRAPPER (body); } else current = plain; - + if (e_attachment_bar_get_num_attachments (attachment_bar)) { CamelMultipart *multipart = camel_multipart_new (); - + if (p->is_alternative) { camel_data_wrapper_set_mime_type (CAMEL_DATA_WRAPPER (multipart), "multipart/alternative"); } - + /* Generate a random boundary. */ camel_multipart_set_boundary (multipart, NULL); - + part = camel_mime_part_new (); camel_medium_set_content_object (CAMEL_MEDIUM (part), current); if (current == plain) @@ -700,19 +700,19 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data) camel_object_unref (current); camel_multipart_add_part (multipart, part); camel_object_unref (part); - + e_attachment_bar_to_multipart (attachment_bar, multipart, p->charset); - + if (p->is_alternative) { for (i = camel_multipart_get_number (multipart); i > 1; i--) { part = camel_multipart_get_part (multipart, i - 1); camel_medium_remove_header (CAMEL_MEDIUM (part), "Content-Disposition"); } } - + current = CAMEL_DATA_WRAPPER (multipart); } - + camel_exception_init (&ex); /* Setup working recipient list if we're encrypting */ @@ -735,7 +735,7 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data) } } - + if (p->pgp_sign || p->pgp_encrypt) { const char *pgp_userid; CamelInternetAddress *from = NULL; @@ -753,14 +753,14 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data) from = e_msg_composer_hdrs_get_from(hdrs); camel_internet_address_get(from, 0, NULL, &pgp_userid); } - + if (p->pgp_sign) { CamelMimePart *npart = camel_mime_part_new(); cipher = mail_crypto_get_pgp_cipher_context(hdrs->account); camel_cipher_sign(cipher, pgp_userid, CAMEL_CIPHER_HASH_SHA1, part, npart, &ex); camel_object_unref(cipher); - + if (camel_exception_is_set(&ex)) { camel_object_unref(npart); goto exception; @@ -769,7 +769,7 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data) camel_object_unref(part); part = npart; } - + if (p->pgp_encrypt) { CamelMimePart *npart = camel_mime_part_new(); @@ -794,13 +794,13 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data) } if (from) - camel_object_unref (from); - + camel_object_unref (from); + current = camel_medium_get_content_object (CAMEL_MEDIUM (part)); camel_object_ref (current); camel_object_unref (part); } - + #if defined (HAVE_NSS) && defined (SMIME_SUPPORTED) if (p->smime_sign || p->smime_encrypt) { CamelInternetAddress *from = NULL; @@ -818,7 +818,7 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data) _("Cannot sign outgoing message: No signing certificate set for this account")); goto exception; } - + if (p->smime_encrypt && (hdrs->account == NULL || hdrs->account->smime_sign_key == NULL || hdrs->account->smime_sign_key[0] == 0)) { camel_exception_set (&ex, CAMEL_EXCEPTION_SYSTEM, @@ -841,7 +841,7 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data) camel_cipher_sign(cipher, hdrs->account->smime_sign_key, CAMEL_CIPHER_HASH_SHA1, part, npart, &ex); camel_object_unref(cipher); - + if (camel_exception_is_set(&ex)) { camel_object_unref(npart); goto exception; @@ -850,7 +850,7 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data) camel_object_unref(part); part = npart; } - + if (p->smime_encrypt) { /* check to see if we should encrypt to self, NB removed after use */ if (hdrs->account->smime_encrypt_to_self) @@ -901,16 +901,16 @@ skip_content: /* Attach whether this message was written in HTML */ camel_medium_set_header (CAMEL_MEDIUM (new), "X-Evolution-Format", p->send_html ? "text/html" : "text/plain"); - + return new; - + exception: - + if (part != CAMEL_MIME_PART (new)) camel_object_unref (part); - + camel_object_unref (new); - + if (ex.id != CAMEL_EXCEPTION_USER_CANCEL) { e_error_run((GtkWindow *)composer, "mail-composer:no-build-message", camel_exception_get_description(&ex), NULL); @@ -923,7 +923,7 @@ skip_content: g_free(recipients->pdata[i]); g_ptr_array_free(recipients, TRUE); } - + return NULL; } @@ -939,7 +939,7 @@ get_file_content (EMsgComposer *composer, const char *file_name, gboolean want_h char *charset; char *content; int fd; - + fd = g_open (file_name, O_RDONLY, 0); if (fd == -1) { if (warn) @@ -947,27 +947,27 @@ get_file_content (EMsgComposer *composer, const char *file_name, gboolean want_h file_name, g_strerror(errno), NULL); return g_strdup (""); } - + stream = camel_stream_fs_new_with_fd (fd); - + if (want_html) { filtered_stream = camel_stream_filter_new_with_stream (stream); camel_object_unref (stream); - + html = camel_mime_filter_tohtml_new (flags, 0); camel_stream_filter_add (filtered_stream, html); camel_object_unref (html); - + stream = (CamelStream *) filtered_stream; } - + memstream = (CamelStreamMem *) camel_stream_mem_new (); buffer = g_byte_array_new (); camel_stream_mem_set_byte_array (memstream, buffer); - + camel_stream_write_to_stream (stream, (CamelStream *) memstream); camel_object_unref (stream); - + /* The newer signature UI saves signatures in UTF-8, but we still need to check that the signature is valid UTF-8 because it is possible that the user imported a signature file that is in his/her locale charset. If it's not in UTF-8 and not in @@ -977,32 +977,32 @@ get_file_content (EMsgComposer *composer, const char *file_name, gboolean want_h stream = (CamelStream *) memstream; memstream = (CamelStreamMem *) camel_stream_mem_new (); camel_stream_mem_set_byte_array (memstream, g_byte_array_new ()); - + filtered_stream = camel_stream_filter_new_with_stream (stream); camel_object_unref (stream); - + charset = composer && composer->priv->charset ? composer->priv->charset : NULL; charset = charset ? g_strdup (charset) : composer_get_default_charset_setting (); if ((charenc = (CamelMimeFilter *) camel_mime_filter_charset_new_convert (charset, "UTF-8"))) { camel_stream_filter_add (filtered_stream, charenc); camel_object_unref (charenc); } - + g_free (charset); - + camel_stream_write_to_stream ((CamelStream *) filtered_stream, (CamelStream *) memstream); camel_object_unref (filtered_stream); g_byte_array_free (buffer, TRUE); - + buffer = memstream->buffer; } - + camel_object_unref (memstream); - + g_byte_array_append (buffer, (const guint8 *)"", 1); content = (char*)buffer->data; g_byte_array_free (buffer, FALSE); - + return content; } @@ -1012,7 +1012,7 @@ e_msg_composer_get_sig_file_content (const char *sigfile, gboolean in_html) if (!sigfile || !*sigfile) { return NULL; } - + return get_file_content (NULL, sigfile, !in_html, CAMEL_MIME_FILTER_TOHTML_PRESERVE_8BIT | CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS | @@ -1026,16 +1026,16 @@ prepare_engine (EMsgComposer *composer) { CORBA_Environment ev; EMsgComposerPrivate *p = composer->priv; - + g_return_if_fail (E_IS_MSG_COMPOSER (composer)); - + /* printf ("prepare_engine\n"); */ - + CORBA_exception_init (&ev); p->eeditor_engine = (GNOME_GtkHTML_Editor_Engine) Bonobo_Unknown_queryInterface (bonobo_widget_get_objref (BONOBO_WIDGET (p->eeditor)), "IDL:GNOME/GtkHTML/Editor/Engine:1.0", &ev); if ((p->eeditor_engine != CORBA_OBJECT_NIL) && (ev._major == CORBA_NO_EXCEPTION)) { - + /* printf ("trying set listener\n"); */ p->eeditor_listener = BONOBO_OBJECT (listener_new (composer)); if (p->eeditor_listener != NULL) @@ -1045,12 +1045,12 @@ prepare_engine (EMsgComposer *composer) (bonobo_object_corba_objref (p->eeditor_listener), &ev), &ev); - + if ((ev._major != CORBA_NO_EXCEPTION) || (p->eeditor_listener == NULL)) { CORBA_Environment err_ev; CORBA_exception_init (&err_ev); - + Bonobo_Unknown_unref (p->eeditor_engine, &err_ev); CORBA_Object_release (p->eeditor_engine, &err_ev); @@ -1108,7 +1108,7 @@ encode_signature_name (const char *name) s ++; } *e = 0; - + return ename; } @@ -1165,16 +1165,16 @@ get_signature_html (EMsgComposer *composer) EMsgComposerPrivate *p = composer->priv; char *text = NULL, *html = NULL; gboolean format_html; - + if (!p->signature) return NULL; - + if (!p->signature->autogen) { if (!p->signature->filename) return NULL; - + format_html = p->signature->html; - + if (p->signature->script) { text = mail_config_signature_run_script (p->signature->filename); } else { @@ -1185,12 +1185,12 @@ get_signature_html (EMsgComposer *composer) char *organization; char *address; char *name; - + id = E_MSG_COMPOSER_HDRS (p->hdrs)->account->id; address = id->address ? camel_text_to_html (id->address, CONVERT_SPACES, 0) : NULL; name = id->name ? camel_text_to_html (id->name, CONVERT_SPACES, 0) : NULL; organization = id->organization ? camel_text_to_html (id->organization, CONVERT_SPACES, 0) : NULL; - + text = g_strdup_printf ("-- <BR>%s%s%s%s%s%s%s%s", name ? name : "", (address && *address) ? " <<A HREF=\"mailto:" : "", @@ -1205,14 +1205,14 @@ get_signature_html (EMsgComposer *composer) g_free (organization); format_html = TRUE; } - + /* printf ("text: %s\n", text); */ if (text) { char *encoded_uid = NULL; - + if (p->signature) encoded_uid = encode_signature_name (p->signature->uid); - + /* The signature dash convention ("-- \n") is specified in the * "Son of RFC 1036": http://www.chemie.fu-berlin.de/outerspace/netnews/son-of-1036.html, * section 4.3.2. @@ -1231,7 +1231,7 @@ get_signature_html (EMsgComposer *composer) g_free (encoded_uid); text = html; } - + return text; } @@ -1248,22 +1248,22 @@ set_editor_text(EMsgComposer *composer, const char *text, ssize_t len, int set_s GConfClient *gconf; g_return_if_fail (p->persist_stream_interface != CORBA_OBJECT_NIL); - + persist = p->persist_stream_interface; - + CORBA_exception_init (&ev); - + gconf = gconf_client_get_default (); - - /* - Keeping Signatures in the beginning of composer + /* + + Keeping Signatures in the beginning of composer ------------------------------------------------ - Purists are gonna blast me for this. - But there are so many people (read Outlook users) who want this. + Purists are gonna blast me for this. + But there are so many people (read Outlook users) who want this. And Evo is an exchange-client, Outlook-replacement etc. - So Here it goes :( + So Here it goes :( -- Sankar @@ -1279,7 +1279,7 @@ set_editor_text(EMsgComposer *composer, const char *text, ssize_t len, int set_s if (tmp) { /* Minimizing the damage. Make it just a part of the body instead of a signature */ html = strstr (tmp, "-- \n"); - if (html) { + if (html) { /* That two consecutive - symbols followed by a space */ *(html+1) = ' '; body = g_strdup_printf ("</br>%s</br>%s", tmp, text); @@ -1311,11 +1311,11 @@ set_editor_text(EMsgComposer *composer, const char *text, ssize_t len, int set_s CORBA_exception_free (&ev); return; } - + CORBA_exception_free (&ev); - + bonobo_object_unref (BONOBO_OBJECT (stream)); - + if (set_signature && !reply_signature_on_top) e_msg_composer_show_sig_file (composer); } @@ -1323,18 +1323,18 @@ set_editor_text(EMsgComposer *composer, const char *text, ssize_t len, int set_s /* Commands. */ static void -show_attachments (EMsgComposer *composer, - gboolean show) +show_attachments (EMsgComposer *composer, + gboolean show) { EMsgComposerPrivate *p = composer->priv; e_expander_set_expanded (E_EXPANDER (p->attachment_expander), show); - if (show) - gtk_label_set_text_with_mnemonic (GTK_LABEL (composer->priv->attachment_expander_label), - _("Hide _Attachment Bar")); - else - gtk_label_set_text_with_mnemonic (GTK_LABEL (composer->priv->attachment_expander_label), - _("Show _Attachment Bar")); + if (show) + gtk_label_set_text_with_mnemonic (GTK_LABEL (composer->priv->attachment_expander_label), + _("Hide _Attachment Bar")); + else + gtk_label_set_text_with_mnemonic (GTK_LABEL (composer->priv->attachment_expander_label), + _("Show _Attachment Bar")); } static void @@ -1343,12 +1343,12 @@ save (EMsgComposer *composer, const char *filename) EMsgComposerPrivate *p = composer->priv; CORBA_Environment ev; int fd; - + /* check to see if we already have the file and that we can create it */ if ((fd = g_open (filename, O_RDONLY | O_CREAT | O_EXCL, 0777)) == -1) { int resp, errnosav = errno; struct stat st; - + if (g_stat (filename, &st) == 0 && S_ISREG (st.st_mode)) { resp = e_error_run((GtkWindow *)composer, E_ERROR_ASK_FILE_EXISTS_OVERWRITE, filename, NULL); if (resp != GTK_RESPONSE_OK) @@ -1359,11 +1359,11 @@ save (EMsgComposer *composer, const char *filename) } } else close (fd); - + CORBA_exception_init (&ev); - + Bonobo_PersistFile_save (p->persist_file_interface, filename, &ev); - + if (ev._major != CORBA_NO_EXCEPTION) { e_error_run((GtkWindow *)composer, E_ERROR_NO_SAVE_FILE, filename, _("Unknown reason")); @@ -1393,15 +1393,15 @@ load (EMsgComposer *composer, const char *file_name) { EMsgComposerPrivate *p = composer->priv; CORBA_Environment ev; - + CORBA_exception_init (&ev); - + Bonobo_PersistFile_load (p->persist_file_interface, file_name, &ev); - + if (ev._major != CORBA_NO_EXCEPTION) e_error_run((GtkWindow *)composer, E_ERROR_NO_LOAD_FILE, file_name, _("Unknown reason"), NULL); - + CORBA_exception_free (&ev); } @@ -1428,28 +1428,28 @@ autosave_save_draft (EMsgComposer *composer) char *file; int fd, camelfd; gboolean success = TRUE; - + if (!e_msg_composer_is_dirty (composer)) return TRUE; fd = p->autosave_fd; file = p->autosave_file; - + if (fd == -1) { /* This code is odd, the fd is opened elsewhere but a failure is ignored */ e_error_run((GtkWindow *)composer, "mail-composer:no-autosave", file, _("Could not open file"), NULL); return FALSE; } - + message = e_msg_composer_get_message_draft (composer); - + if (message == NULL) { e_error_run((GtkWindow *)composer, "mail-composer:no-autosave", file, _("Unable to retrieve message from editor"), NULL); return FALSE; } - + if (lseek (fd, (off_t)0, SEEK_SET) == -1 || ftruncate (fd, (off_t)0) == -1 || (camelfd = dup(fd)) == -1) { @@ -1458,7 +1458,7 @@ autosave_save_draft (EMsgComposer *composer) file, g_strerror(errno), NULL); return FALSE; } - + /* this does an lseek so we don't have to */ stream = camel_stream_fs_new_with_fd (camelfd); if (camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), stream) == -1 @@ -1474,46 +1474,46 @@ autosave_save_draft (EMsgComposer *composer) e_msg_composer_unset_changed (composer); e_msg_composer_set_autosaved (composer); } - + camel_object_unref (stream); - + camel_object_unref (message); - + return success; } -static EMsgComposer * +static EMsgComposer * autosave_load_draft (const char *filename) { CamelStream *stream; CamelMimeMessage *msg; EMsgComposer *composer; - + g_return_val_if_fail (filename != NULL, NULL); - + g_warning ("autosave load filename = \"%s\"", filename); - + if (!(stream = camel_stream_fs_new_with_name (filename, O_RDONLY, 0))) return NULL; - + msg = camel_mime_message_new (); camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (msg), stream); camel_object_unref (stream); - + composer = e_msg_composer_new_with_message (msg); if (composer) { if (autosave_save_draft (composer)) g_unlink (filename); - + g_signal_connect (GTK_OBJECT (composer), "send", G_CALLBACK (em_utils_composer_send_cb), NULL); - + g_signal_connect (GTK_OBJECT (composer), "save-draft", G_CALLBACK (em_utils_composer_save_draft_cb), NULL); - + gtk_widget_show (GTK_WIDGET (composer)); } - + return composer; } @@ -1538,7 +1538,7 @@ autosave_manager_query_load_orphans (AutosaveManager *am, GtkWindow *parent) if (!dir) { return; } - + while ((dname = g_dir_read_name (dir))) { if ((!strncmp (dname, AUTOSAVE_SEED, len - 6)) && (strlen (dname) == len) @@ -1547,9 +1547,9 @@ autosave_manager_query_load_orphans (AutosaveManager *am, GtkWindow *parent) struct stat st; filename = g_build_filename (dirname, dname, NULL); - + /* - * check if the file has any length, It is a valid case if it doesn't + * check if the file has any length, It is a valid case if it doesn't * so we simply don't ask then. */ if (g_stat (filename, &st) == -1 || st.st_size == 0) { @@ -1557,32 +1557,32 @@ autosave_manager_query_load_orphans (AutosaveManager *am, GtkWindow *parent) g_free (filename); continue; } - match = g_slist_prepend (match, filename); + match = g_slist_prepend (match, filename); } } - + g_dir_close (dir); g_free (dirname); - + if (match != NULL) load = e_error_run(parent, "mail-composer:recover-autosave", NULL) == GTK_RESPONSE_YES; - + while (match != NULL) { GSList *next = match->next; char *filename = match->data; EMsgComposer *composer; - + if (load) { - /* FIXME: composer is never used */ + /* FIXME: composer is never used */ composer = autosave_load_draft (filename); } else { g_unlink (filename); } - + g_free (filename); g_slist_free_1 (match); match = next; - } + } } static void @@ -1590,7 +1590,7 @@ autosave_run_foreach_cb (gpointer key, gpointer value, gpointer data) { EMsgComposer *composer = E_MSG_COMPOSER (value); EMsgComposerPrivate *p = composer->priv; - + if (p->enable_autosave) autosave_save_draft (composer); } @@ -1599,12 +1599,12 @@ static gint autosave_run (gpointer data) { AutosaveManager *am = data; - + g_hash_table_foreach (am->table, (GHFunc)autosave_run_foreach_cb, am); autosave_manager_stop (am); autosave_manager_start (am); - + return FALSE; } @@ -1647,23 +1647,23 @@ autosave_manager_new (void) g_str_hash, g_str_equal, (GDestroyNotify) g_free, (GDestroyNotify) NULL); - + am = g_new (AutosaveManager, 1); am->table = table; am->id = 0; am->ask = TRUE; - + return am; } static void -autosave_manager_register (AutosaveManager *am, EMsgComposer *composer) +autosave_manager_register (AutosaveManager *am, EMsgComposer *composer) { char *key; EMsgComposerPrivate *p = composer->priv; - + g_return_if_fail (composer != NULL); - + if (autosave_init_file (composer)) { key = g_path_get_basename (p->autosave_file); g_hash_table_insert (am->table, key, composer); @@ -1678,7 +1678,7 @@ autosave_manager_register (AutosaveManager *am, EMsgComposer *composer) } static void -autosave_manager_unregister (AutosaveManager *am, EMsgComposer *composer) +autosave_manager_unregister (AutosaveManager *am, EMsgComposer *composer) { EMsgComposerPrivate *p = composer->priv; gchar *key; @@ -1689,7 +1689,7 @@ autosave_manager_unregister (AutosaveManager *am, EMsgComposer *composer) key = g_path_get_basename (p->autosave_file); g_hash_table_remove (am->table, key); g_free (key); - + /* only remove the file if we can successfully save it */ /* FIXME this test could probably be more efficient */ if (autosave_save_draft (composer)) { @@ -1701,7 +1701,7 @@ autosave_manager_unregister (AutosaveManager *am, EMsgComposer *composer) } g_free (p->autosave_file); p->autosave_file = NULL; - + if (g_hash_table_size (am->table) == 0) autosave_manager_stop (am); } @@ -1722,14 +1722,14 @@ do_exit (EMsgComposer *composer) const char *subject; int button; EMsgComposerPrivate *p = composer->priv; - + if (!e_msg_composer_is_dirty (composer) && !e_msg_composer_is_autosaved (composer)) { gtk_widget_destroy (GTK_WIDGET (composer)); return; } - + gdk_window_raise (GTK_WIDGET (composer)->window); - + subject = e_msg_composer_hdrs_get_subject (E_MSG_COMPOSER_HDRS (p->hdrs)); button = e_error_run((GtkWindow *)composer, "mail-composer:exit-unsaved", @@ -1781,11 +1781,11 @@ menu_file_save_cb (BonoboUIComponent *uic, EMsgComposerPrivate *p = composer->priv; CORBA_char *file_name; CORBA_Environment ev; - + CORBA_exception_init (&ev); - + file_name = Bonobo_PersistFile_getCurrentFile (p->persist_file_interface, &ev); - + if (ev._major != CORBA_NO_EXCEPTION) { saveas (composer); } else { @@ -1817,7 +1817,7 @@ menu_file_close_cb (BonoboUIComponent *uic, const char *path) { EMsgComposer *composer; - + composer = E_MSG_COMPOSER (data); do_exit (composer); } @@ -1829,7 +1829,7 @@ menu_help_cb (BonoboUIComponent *uic, const char *path) { EMsgComposer *composer = (EMsgComposer *) data; - + e_msg_composer_show_help (composer); } @@ -1841,21 +1841,21 @@ add_to_bar (EMsgComposer *composer, GSList *names, int is_inline) while (names) { CamelURL *url; - + if (!(url = camel_url_new (names->data, NULL))) continue; - - if (!g_ascii_strcasecmp (url->protocol, "file")) { + + if (!g_ascii_strcasecmp (url->protocol, "file")) { e_attachment_bar_attach((EAttachmentBar *)p->attachment_bar, url->path, is_inline ? "inline" : "attachment"); } else { - e_attachment_bar_attach_remote_file ((EAttachmentBar *)p->attachment_bar, names->data, is_inline ? "inline" : "attachment"); + e_attachment_bar_attach_remote_file ((EAttachmentBar *)p->attachment_bar, names->data, is_inline ? "inline" : "attachment"); } - + camel_url_free (url); names = names->next; } } - + static void menu_file_add_attachment_cb (BonoboUIComponent *uic, void *data, @@ -1874,9 +1874,9 @@ menu_edit_cut_cb (BonoboUIComponent *uic, void *data, const char *path) { EMsgComposer *composer = data; EMsgComposerPrivate *p = composer->priv; - + g_return_if_fail (p->focused_entry != NULL); - + if (GTK_IS_ENTRY (p->focused_entry)) { gtk_editable_cut_clipboard (GTK_EDITABLE (p->focused_entry)); } else { @@ -1892,7 +1892,7 @@ menu_edit_copy_cb (BonoboUIComponent *uic, void *data, const char *path) EMsgComposerPrivate *p = composer->priv; g_return_if_fail (p->focused_entry != NULL); - + if (GTK_IS_ENTRY (p->focused_entry)) { gtk_editable_copy_clipboard (GTK_EDITABLE (p->focused_entry)); } else { @@ -1906,9 +1906,9 @@ menu_edit_paste_cb (BonoboUIComponent *uic, void *data, const char *path) { EMsgComposer *composer = data; EMsgComposerPrivate *p = composer->priv; - + g_return_if_fail (p->focused_entry != NULL); - + if (GTK_IS_ENTRY (p->focused_entry)) { gtk_editable_paste_clipboard (GTK_EDITABLE (p->focused_entry)); } else { @@ -1925,10 +1925,10 @@ menu_send_options_cb (BonoboUIComponent *component, void *data, const char *path EMsgComposer *composer = data; target = em_event_target_new_composer (e, composer, EM_EVENT_COMPOSER_SEND_OPTION); - e_msg_composer_set_send_options (composer, FALSE); + e_msg_composer_set_send_options (composer, FALSE); e_event_emit((EEvent *)e, "composer.selectsendoption", (EEventTarget *)target); if (!composer->priv->send_invoked) { - e_error_run ((GtkWindow *)composer, "mail-composer:send-options-support", NULL); + e_error_run ((GtkWindow *)composer, "mail-composer:send-options-support", NULL); } } @@ -1939,7 +1939,7 @@ menu_edit_select_all_cb (BonoboUIComponent *uic, void *data, const char *path) EMsgComposerPrivate *p = composer->priv; g_return_if_fail (p->focused_entry != NULL); - + if (GTK_IS_ENTRY (p->focused_entry)) { gtk_editable_set_position (GTK_EDITABLE (p->focused_entry), -1); gtk_editable_select_region (GTK_EDITABLE (p->focused_entry), 0, -1); @@ -1957,7 +1957,7 @@ menu_edit_delete_all_cb (BonoboUIComponent *uic, void *data, const char *path) CORBA_Environment ev; CORBA_exception_init (&ev); - + GNOME_GtkHTML_Editor_Engine_undoBegin (p->eeditor_engine, "Delete all but signature", "Undelete all", &ev); GNOME_GtkHTML_Editor_Engine_freeze (p->eeditor_engine, &ev); GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "disable-selection", &ev); @@ -1974,7 +1974,7 @@ menu_edit_delete_all_cb (BonoboUIComponent *uic, void *data, const char *path) GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "style-normal", &ev); GNOME_GtkHTML_Editor_Engine_thaw (p->eeditor_engine, &ev); GNOME_GtkHTML_Editor_Engine_undoEnd (p->eeditor_engine, &ev); - + CORBA_exception_free (&ev); /* printf ("delete all\n"); */ } @@ -1989,7 +1989,7 @@ menu_format_html_cb (BonoboUIComponent *component, { if (type != Bonobo_UIComponent_STATE_CHANGED) return; - + e_msg_composer_set_send_html (E_MSG_COMPOSER (user_data), atoi (state)); } @@ -2003,7 +2003,7 @@ menu_security_pgp_sign_cb (BonoboUIComponent *component, { if (type != Bonobo_UIComponent_STATE_CHANGED) return; - + e_msg_composer_set_pgp_sign (E_MSG_COMPOSER (composer), atoi (state)); } @@ -2017,7 +2017,7 @@ menu_security_pgp_encrypt_cb (BonoboUIComponent *component, { if (type != Bonobo_UIComponent_STATE_CHANGED) return; - + e_msg_composer_set_pgp_encrypt (E_MSG_COMPOSER (composer), atoi (state)); } @@ -2031,7 +2031,7 @@ menu_security_smime_sign_cb (BonoboUIComponent *component, { if (type != Bonobo_UIComponent_STATE_CHANGED) return; - + e_msg_composer_set_smime_sign (E_MSG_COMPOSER (composer), atoi (state)); } @@ -2045,7 +2045,7 @@ menu_security_smime_encrypt_cb (BonoboUIComponent *component, { if (type != Bonobo_UIComponent_STATE_CHANGED) return; - + e_msg_composer_set_smime_encrypt (E_MSG_COMPOSER (composer), atoi (state)); } @@ -2059,7 +2059,7 @@ menu_view_from_cb (BonoboUIComponent *component, { if (type != Bonobo_UIComponent_STATE_CHANGED) return; - + e_msg_composer_set_view_from (E_MSG_COMPOSER (user_data), atoi (state)); } @@ -2072,7 +2072,7 @@ menu_view_replyto_cb (BonoboUIComponent *component, { if (type != Bonobo_UIComponent_STATE_CHANGED) return; - + e_msg_composer_set_view_replyto (E_MSG_COMPOSER (user_data), atoi (state)); } @@ -2085,7 +2085,7 @@ menu_view_to_cb (BonoboUIComponent *component, { if (type != Bonobo_UIComponent_STATE_CHANGED) return; - + e_msg_composer_set_view_to (E_MSG_COMPOSER (user_data), atoi (state)); } @@ -2098,7 +2098,7 @@ menu_view_postto_cb (BonoboUIComponent *component, { if (type != Bonobo_UIComponent_STATE_CHANGED) return; - + e_msg_composer_set_view_postto (E_MSG_COMPOSER (user_data), atoi (state)); } @@ -2111,7 +2111,7 @@ menu_view_cc_cb (BonoboUIComponent *component, { if (type != Bonobo_UIComponent_STATE_CHANGED) return; - + e_msg_composer_set_view_cc (E_MSG_COMPOSER (user_data), atoi (state)); } @@ -2124,7 +2124,7 @@ menu_view_bcc_cb (BonoboUIComponent *component, { if (type != Bonobo_UIComponent_STATE_CHANGED) return; - + e_msg_composer_set_view_bcc (E_MSG_COMPOSER (user_data), atoi (state)); } @@ -2137,7 +2137,7 @@ menu_insert_receipt_cb (BonoboUIComponent *component, { if (type != Bonobo_UIComponent_STATE_CHANGED) return; - + e_msg_composer_set_request_receipt (E_MSG_COMPOSER (user_data), atoi (state)); } @@ -2150,7 +2150,7 @@ menu_insert_priority_cb (BonoboUIComponent *component, { if (type != Bonobo_UIComponent_STATE_CHANGED) return; - + e_msg_composer_set_priority (E_MSG_COMPOSER (user_data), atoi (state)); } @@ -2163,7 +2163,7 @@ menu_changed_charset_cb (BonoboUIComponent *component, { if (type != Bonobo_UIComponent_STATE_CHANGED) return; - + if (atoi (state)) { EMsgComposer *composer = E_MSG_COMPOSER (user_data); EMsgComposerPrivate *p = composer->priv; @@ -2181,14 +2181,14 @@ static BonoboUIVerb verbs [] = { BONOBO_UI_VERB ("FileSaveAs", menu_file_save_as_cb), BONOBO_UI_VERB ("FileSaveDraft", menu_file_save_draft_cb), BONOBO_UI_VERB ("FileClose", menu_file_close_cb), - BONOBO_UI_VERB ("Help", menu_help_cb), + BONOBO_UI_VERB ("Help", menu_help_cb), BONOBO_UI_VERB ("FileAttach", menu_file_add_attachment_cb), - + BONOBO_UI_VERB ("FileSend", menu_file_send_cb), - + BONOBO_UI_VERB ("DeleteAll", menu_edit_delete_all_cb), BONOBO_UI_VERB ("InsertXSendOptions", menu_send_options_cb), - + BONOBO_UI_VERB_END }; @@ -2200,11 +2200,11 @@ static EPixmap pixcache [] = { E_PIXMAP ("/commands/FileSave", "document-save", E_ICON_SIZE_MENU), E_PIXMAP ("/commands/FileSaveAs", "document-save-as", E_ICON_SIZE_MENU), E_PIXMAP ("/commands/FileSend", "mail-send", E_ICON_SIZE_MENU), - + E_PIXMAP ("/Toolbar/FileSend", "mail-send", E_ICON_SIZE_LARGE_TOOLBAR), E_PIXMAP ("/Toolbar/FileSaveDraft", "document-save", E_ICON_SIZE_LARGE_TOOLBAR) , E_PIXMAP ("/Toolbar/FileAttach", "mail-attachment", E_ICON_SIZE_LARGE_TOOLBAR), - + E_PIXMAP_END }; @@ -2215,10 +2215,10 @@ signature_activate_cb (GtkWidget *menu, EMsgComposer *composer) GtkWidget *active; ESignature *sig; EMsgComposerPrivate *p = composer->priv; - + active = gtk_menu_get_active (GTK_MENU (menu)); sig = g_object_get_data ((GObject *) active, "sig"); - + if (p->signature != sig) { p->signature = sig; e_msg_composer_show_sig_file (composer); @@ -2230,16 +2230,16 @@ signature_added (ESignatureList *signatures, ESignature *sig, EMsgComposer *comp { GtkWidget *menu, *item; EMsgComposerPrivate *p = composer->priv; - + menu = gtk_option_menu_get_menu (p->sig_menu); - + if (sig->autogen) item = gtk_menu_item_new_with_label (_("Autogenerated")); else item = gtk_menu_item_new_with_label (sig->name); g_object_set_data ((GObject *) item, "sig", sig); gtk_widget_show (item); - + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); } @@ -2250,12 +2250,12 @@ signature_removed (ESignatureList *signatures, ESignature *sig, EMsgComposer *co ESignature *cur; GList *items; EMsgComposerPrivate *p = composer->priv; - + if (p->signature == sig) { p->signature = NULL; e_msg_composer_show_sig_file (composer); } - + menu = gtk_option_menu_get_menu (p->sig_menu); items = GTK_MENU_SHELL (menu)->children; while (items != NULL) { @@ -2272,7 +2272,7 @@ static void menu_item_set_label (GtkMenuItem *item, const char *label) { GtkWidget *widget; - + widget = gtk_bin_get_child ((GtkBin *) item); if (GTK_IS_LABEL (widget)) gtk_label_set_text ((GtkLabel *) widget, label); @@ -2285,7 +2285,7 @@ signature_changed (ESignatureList *signatures, ESignature *sig, EMsgComposer *co ESignature *cur; GList *items; EMsgComposerPrivate *p = composer->priv; - + menu = gtk_option_menu_get_menu (p->sig_menu); items = GTK_MENU_SHELL (menu)->children; while (items != NULL) { @@ -2306,12 +2306,12 @@ sig_select_item (EMsgComposer *composer) GList *items; int i = 0; EMsgComposerPrivate *p = composer->priv; - + if (!p->signature) { gtk_option_menu_set_history (p->sig_menu, 0); return; } - + menu = gtk_option_menu_get_menu (p->sig_menu); items = GTK_MENU_SHELL (menu)->children; while (items != NULL) { @@ -2334,7 +2334,7 @@ setup_signatures_menu (EMsgComposer *composer) ESignature *sig; EIterator *it; EMsgComposerPrivate *p = composer->priv; - + hbox = e_msg_composer_hdrs_get_from_hbox (E_MSG_COMPOSER_HDRS (p->hdrs)); label = gtk_label_new_with_mnemonic (_("Si_gnature:")); @@ -2349,31 +2349,31 @@ setup_signatures_menu (EMsgComposer *composer) hspace = gtk_hbox_new (FALSE, 0); gtk_widget_show (hspace); gtk_box_pack_start (GTK_BOX (hbox), hspace, FALSE, FALSE, 0); - + menu = gtk_menu_new (); gtk_widget_show (menu); gtk_option_menu_set_menu (p->sig_menu, menu); - + item = gtk_menu_item_new_with_label (_("None")); gtk_widget_show (item); - + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); - + signatures = mail_config_get_signatures (); it = e_list_get_iterator ((EList *) signatures); - + while (e_iterator_is_valid (it)) { sig = (ESignature *) e_iterator_get (it); signature_added (signatures, sig, composer); e_iterator_next (it); } - + g_object_unref (it); - + g_signal_connect (menu, "selection-done", G_CALLBACK (signature_activate_cb), composer); gtk_widget_show ((GtkWidget *) p->sig_menu); - + p->sig_added_id = g_signal_connect (signatures, "signature-added", G_CALLBACK (signature_added), composer); p->sig_removed_id = g_signal_connect (signatures, "signature-removed", G_CALLBACK (signature_removed), composer); p->sig_changed_id = g_signal_connect (signatures, "signature-changed", G_CALLBACK (signature_changed), composer); @@ -2388,25 +2388,25 @@ setup_ui (EMsgComposer *composer) gboolean hide_smime; char *charset; char *xmlfile; - + container = bonobo_window_get_ui_container (BONOBO_WINDOW (composer)); - + p->uic = bonobo_ui_component_new_default (); /* FIXME: handle bonobo exceptions */ bonobo_ui_component_set_container (p->uic, bonobo_object_corba_objref (BONOBO_OBJECT (container)), NULL); - + bonobo_ui_component_add_verb_list_with_data (p->uic, verbs, composer); - + bonobo_ui_component_freeze (p->uic, NULL); - + xmlfile = g_build_filename (EVOLUTION_UIDIR, "evolution-message-composer.xml", NULL); bonobo_ui_util_set_ui (p->uic, PREFIX, xmlfile, "evolution-message-composer", NULL); g_free (xmlfile); - + e_pixmaps_update (p->uic, pixcache); - + /* Populate the Charset Encoding menu and default it to whatever the user chose as his default charset in the mailer */ charset = composer_get_default_charset_setting (); @@ -2415,7 +2415,7 @@ setup_ui (EMsgComposer *composer) menu_changed_charset_cb, composer); g_free (charset); - + /* Format -> HTML */ bonobo_ui_component_set_prop ( p->uic, "/commands/FormatHtml", @@ -2431,7 +2431,7 @@ setup_ui (EMsgComposer *composer) bonobo_ui_component_add_listener ( p->uic, "ViewFrom", menu_view_from_cb, composer); - + /* View/ReplyTo */ bonobo_ui_component_set_prop ( p->uic, "/commands/ViewReplyTo", @@ -2439,7 +2439,7 @@ setup_ui (EMsgComposer *composer) bonobo_ui_component_add_listener ( p->uic, "ViewReplyTo", menu_view_replyto_cb, composer); - + /* View/To */ bonobo_ui_component_set_prop ( p->uic, "/commands/ViewTo", @@ -2447,7 +2447,7 @@ setup_ui (EMsgComposer *composer) bonobo_ui_component_add_listener ( p->uic, "ViewTo", menu_view_to_cb, composer); - + /* View/PostTo */ bonobo_ui_component_set_prop ( p->uic, "/commands/ViewPostTo", @@ -2455,7 +2455,7 @@ setup_ui (EMsgComposer *composer) bonobo_ui_component_add_listener ( p->uic, "ViewPostTo", menu_view_postto_cb, composer); - + /* View/CC */ bonobo_ui_component_set_prop ( p->uic, "/commands/ViewCC", @@ -2463,7 +2463,7 @@ setup_ui (EMsgComposer *composer) bonobo_ui_component_add_listener ( p->uic, "ViewCC", menu_view_cc_cb, composer); - + /* View/BCC */ bonobo_ui_component_set_prop ( p->uic, "/commands/ViewBCC", @@ -2479,7 +2479,7 @@ setup_ui (EMsgComposer *composer) bonobo_ui_component_add_listener ( p->uic, "RequestReceipt", menu_insert_receipt_cb, composer); - + /* Insert/Exchange Send Options */ /* bonobo_ui_component_set_prop ( p->uic, "/commands/XSendOptions", @@ -2495,31 +2495,31 @@ setup_ui (EMsgComposer *composer) bonobo_ui_component_add_listener ( p->uic, "SetPriority", menu_insert_priority_cb, composer); - + /* Security -> PGP Sign */ bonobo_ui_component_set_prop ( p->uic, "/commands/SecurityPGPSign", "state", p->pgp_sign ? "1" : "0", NULL); - + bonobo_ui_component_add_listener ( p->uic, "SecurityPGPSign", menu_security_pgp_sign_cb, composer); - + /* Security -> PGP Encrypt */ bonobo_ui_component_set_prop ( p->uic, "/commands/SecurityPGPEncrypt", "state", p->pgp_encrypt ? "1" : "0", NULL); - + bonobo_ui_component_add_listener ( p->uic, "SecurityPGPEncrypt", menu_security_pgp_encrypt_cb, composer); - + #if defined(HAVE_NSS) && defined(SMIME_SUPPORTED) hide_smime = FALSE; #else hide_smime = TRUE; #endif - + /* Security -> S/MIME Sign */ bonobo_ui_component_set_prop ( p->uic, "/commands/SecuritySMimeSign", @@ -2527,11 +2527,11 @@ setup_ui (EMsgComposer *composer) bonobo_ui_component_set_prop ( p->uic, "/commands/SecuritySMimeSign", "hidden", hide_smime ? "1" : "0", NULL); - + bonobo_ui_component_add_listener ( p->uic, "SecuritySMimeSign", menu_security_smime_sign_cb, composer); - + /* Security -> S/MIME Encrypt */ bonobo_ui_component_set_prop ( p->uic, "/commands/SecuritySMimeEncrypt", @@ -2539,11 +2539,11 @@ setup_ui (EMsgComposer *composer) bonobo_ui_component_set_prop ( p->uic, "/commands/SecuritySMimeEncrypt", "hidden", hide_smime ? "1" : "0", NULL); - + bonobo_ui_component_add_listener ( p->uic, "SecuritySMimeEncrypt", menu_security_smime_encrypt_cb, composer); - + bonobo_ui_component_thaw (p->uic, NULL); /* Create the UIComponent for the non-control entries */ @@ -2580,29 +2580,29 @@ attachment_bar_changed_cb (EAttachmentBar *bar, show_attachments (composer, TRUE); } else { gtk_label_set_text (GTK_LABEL (p->attachment_expander_num), ""); - gtk_widget_hide (p->attachment_expander_icon); + gtk_widget_hide (p->attachment_expander_icon); show_attachments (composer, FALSE); } - - + + /* Mark the composer as changed so it prompts about unsaved changes on close */ e_msg_composer_set_changed (composer); } static void -attachment_expander_activate_cb (EExpander *expander, - void *data) -{ - EMsgComposer *composer = E_MSG_COMPOSER (data); - gboolean show = e_expander_get_expanded (expander); - - /* Update the expander label */ - if (show) - gtk_label_set_text_with_mnemonic (GTK_LABEL (composer->priv->attachment_expander_label), - _("Hide _Attachment Bar")); - else - gtk_label_set_text_with_mnemonic (GTK_LABEL (composer->priv->attachment_expander_label), - _("Show _Attachment Bar")); +attachment_expander_activate_cb (EExpander *expander, + void *data) +{ + EMsgComposer *composer = E_MSG_COMPOSER (data); + gboolean show = e_expander_get_expanded (expander); + + /* Update the expander label */ + if (show) + gtk_label_set_text_with_mnemonic (GTK_LABEL (composer->priv->attachment_expander_label), + _("Hide _Attachment Bar")); + else + gtk_label_set_text_with_mnemonic (GTK_LABEL (composer->priv->attachment_expander_label), + _("Show _Attachment Bar")); } static void subject_changed_cb (EMsgComposerHdrs *hdrs, @@ -2610,9 +2610,9 @@ subject_changed_cb (EMsgComposerHdrs *hdrs, void *data) { EMsgComposer *composer; - + composer = E_MSG_COMPOSER (data); - + gtk_window_set_title (GTK_WINDOW (composer), subject[0] ? subject : _("Compose Message")); } @@ -2621,9 +2621,9 @@ hdrs_changed_cb (EMsgComposerHdrs *hdrs, void *data) { EMsgComposer *composer; - + composer = E_MSG_COMPOSER (data); - + /* Mark the composer as changed so it prompts about unsaved changes on close */ e_msg_composer_set_changed (composer); } @@ -2640,31 +2640,31 @@ update_auto_recipients (EMsgComposerHdrs *hdrs, int mode, const char *auto_addrs CamelInternetAddress *iaddr; GList *list, *tail, *node; int i, n = 0; - + tail = list = NULL; - + if (auto_addrs) { iaddr = camel_internet_address_new (); if (camel_address_decode (CAMEL_ADDRESS (iaddr), auto_addrs) != -1) { for (i = 0; i < camel_address_length (CAMEL_ADDRESS (iaddr)); i++) { const char *name, *addr; - + if (!camel_internet_address_get (iaddr, i, &name, &addr)) continue; - + dest = e_destination_new (); e_destination_set_auto_recipient (dest, TRUE); - + if (name) e_destination_set_name (dest, name); - + if (addr) e_destination_set_email (dest, addr); - + node = g_list_alloc (); node->data = dest; node->next = NULL; - + if (tail) { node->prev = tail; tail->next = node; @@ -2672,15 +2672,15 @@ update_auto_recipients (EMsgComposerHdrs *hdrs, int mode, const char *auto_addrs node->prev = NULL; list = node; } - + tail = node; n++; } } - + camel_object_unref (iaddr); } - + switch (mode) { case UPDATE_AUTO_CC: destv = e_msg_composer_hdrs_get_cc (hdrs); @@ -2691,14 +2691,14 @@ update_auto_recipients (EMsgComposerHdrs *hdrs, int mode, const char *auto_addrs default: g_return_if_reached (); } - + if (destv) { for (i = 0; destv[i]; i++) { if (!e_destination_is_auto_recipient (destv[i])) { node = g_list_alloc (); node->data = e_destination_copy (destv[i]); node->next = NULL; - + if (tail) { node->prev = tail; tail->next = node; @@ -2706,18 +2706,18 @@ update_auto_recipients (EMsgComposerHdrs *hdrs, int mode, const char *auto_addrs node->prev = NULL; list = node; } - + tail = node; n++; } } - + e_destination_freev (destv); } - + destv = destination_list_to_vector_sized (list, n); g_list_free (list); - + switch (mode) { case UPDATE_AUTO_CC: e_msg_composer_hdrs_set_cc (hdrs, destv); @@ -2728,7 +2728,7 @@ update_auto_recipients (EMsgComposerHdrs *hdrs, int mode, const char *auto_addrs default: g_return_if_reached (); } - + e_destination_freev (destv); } @@ -2737,10 +2737,10 @@ from_changed_cb (EMsgComposerHdrs *hdrs, void *data) { EMsgComposer *composer = E_MSG_COMPOSER (data); EMsgComposerPrivate *p = composer->priv; - + if (hdrs->account) { EAccount *account = hdrs->account; - + e_msg_composer_set_pgp_sign (composer, account->pgp_always_sign && (!account->pgp_no_imip_sign || !p->mime_type || @@ -2753,7 +2753,7 @@ from_changed_cb (EMsgComposerHdrs *hdrs, void *data) update_auto_recipients (hdrs, UPDATE_AUTO_CC, NULL); update_auto_recipients (hdrs, UPDATE_AUTO_BCC, NULL); } - + set_editor_signature (composer); e_msg_composer_show_sig_file (composer); } @@ -2769,10 +2769,10 @@ composer_finalise (GObject *object) composer = E_MSG_COMPOSER (object); p = composer->priv; - + if (p->extra_hdr_names) { int i; - + for (i = 0; i < p->extra_hdr_names->len; i++) { g_free (p->extra_hdr_names->pdata[i]); g_free (p->extra_hdr_values->pdata[i]); @@ -2780,23 +2780,23 @@ composer_finalise (GObject *object) g_ptr_array_free (p->extra_hdr_names, TRUE); g_ptr_array_free (p->extra_hdr_values, TRUE); } - + g_hash_table_destroy (p->inline_images); g_hash_table_destroy (p->inline_images_by_url); - + g_free (p->charset); g_free (p->mime_type); g_free (p->mime_body); - + if (p->redirect) camel_object_unref (p->redirect); - - + + g_free (p); p = NULL; composer->priv = NULL; - + if (G_OBJECT_CLASS (parent_class)->finalize != NULL) (* G_OBJECT_CLASS (parent_class)->finalize) (object); } @@ -2809,7 +2809,7 @@ composer_dispose(GObject *object) * been destroyed, so we have to do this here. */ autosave_manager_unregister (am, E_MSG_COMPOSER (object)); - + if (G_OBJECT_CLASS (parent_class)->dispose != NULL) (* G_OBJECT_CLASS (parent_class)->dispose) (object); } @@ -2822,7 +2822,7 @@ destroy (GtkObject *object) EMsgComposerPrivate *p = composer->priv; CORBA_Environment ev; ESignatureList *signatures; - + CORBA_exception_init (&ev); if (p->menu) { @@ -2850,7 +2850,7 @@ destroy (GtkObject *object) bonobo_object_unref (BONOBO_OBJECT (p->entry_uic)); p->entry_uic = NULL; } - + /* FIXME? I assume the Bonobo widget will get destroyed normally? */ if (p->address_dialog != NULL) { @@ -2861,51 +2861,51 @@ destroy (GtkObject *object) gtk_widget_destroy (p->hdrs); p->hdrs = NULL; } - + if (p->notify_id) { GConfClient *gconf = gconf_client_get_default (); gconf_client_notify_remove (gconf, p->notify_id); p->notify_id = 0; g_object_unref (gconf); - } + } if (p->persist_stream_interface != CORBA_OBJECT_NIL) { Bonobo_Unknown_unref (p->persist_stream_interface, &ev); CORBA_Object_release (p->persist_stream_interface, &ev); p->persist_stream_interface = CORBA_OBJECT_NIL; } - + if (p->persist_file_interface != CORBA_OBJECT_NIL) { Bonobo_Unknown_unref (p->persist_file_interface, &ev); CORBA_Object_release (p->persist_file_interface, &ev); p->persist_file_interface = CORBA_OBJECT_NIL; } - + if (p->eeditor_engine != CORBA_OBJECT_NIL) { Bonobo_Unknown_unref (p->eeditor_engine, &ev); CORBA_Object_release (p->eeditor_engine, &ev); p->eeditor_engine = CORBA_OBJECT_NIL; } - + CORBA_exception_free (&ev); - + if (p->eeditor_listener) { bonobo_object_unref (p->eeditor_listener); p->eeditor_listener = NULL; } - + signatures = mail_config_get_signatures (); - + if (p->sig_added_id != 0) { g_signal_handler_disconnect (signatures, p->sig_added_id); p->sig_added_id = 0; } - + if (p->sig_removed_id != 0) { g_signal_handler_disconnect (signatures, p->sig_removed_id); p->sig_removed_id = 0; } - + if (p->sig_changed_id != 0) { g_signal_handler_disconnect (signatures, p->sig_changed_id); p->sig_changed_id = 0; @@ -2938,7 +2938,7 @@ delete_event (GtkWidget *widget, GdkEventAny *event) { do_exit (E_MSG_COMPOSER (widget)); - + return TRUE; } @@ -2986,7 +2986,7 @@ int e_msg_composer_get_remote_download_count (EMsgComposer *composer) { EMsgComposerPrivate *p = composer->priv; - return e_attachment_bar_get_download_count + return e_attachment_bar_get_download_count (E_ATTACHMENT_BAR (p->attachment_bar)); } @@ -3020,7 +3020,7 @@ drop_action(EMsgComposer *composer, GdkDragContext *context, guint32 action, Gtk char *content_type; int i, success = FALSE, delete = FALSE; EMsgComposerPrivate *p = composer->priv; - + switch (info) { case DND_TYPE_MESSAGE_RFC822: d(printf ("dropping a message/rfc822\n")); @@ -3028,7 +3028,7 @@ drop_action(EMsgComposer *composer, GdkDragContext *context, guint32 action, Gtk stream = camel_stream_mem_new (); camel_stream_write (stream, (const gchar *)selection->data, selection->length); camel_stream_reset (stream); - + msg = camel_mime_message_new (); if (camel_data_wrapper_construct_from_stream((CamelDataWrapper *)msg, stream) != -1) { attach_message(composer, msg); @@ -3056,18 +3056,18 @@ drop_action(EMsgComposer *composer, GdkDragContext *context, guint32 action, Gtk tmp = g_strndup ((const gchar *) selection->data, selection->length); urls = g_strsplit (tmp, "\n", 0); g_free (tmp); - + for (i = 0; urls[i] != NULL; i++) { str = g_strstrip (urls[i]); if (str[0] == '#' || str[0] == '\0') { g_free (str); continue; } - + handle_uri (composer, str, html_dnd); g_free (str); } - + g_free (urls); success = TRUE; break; @@ -3075,16 +3075,16 @@ drop_action(EMsgComposer *composer, GdkDragContext *context, guint32 action, Gtk case DND_TYPE_TEXT_CALENDAR: content_type = gdk_atom_name (selection->type); d(printf ("dropping a %s\n", content_type)); - + mime_part = camel_mime_part_new (); camel_mime_part_set_content (mime_part, (const gchar *)selection->data, selection->length, content_type); camel_mime_part_set_disposition (mime_part, "inline"); - + e_attachment_bar_attach_mime_part (E_ATTACHMENT_BAR (p->attachment_bar), mime_part); - + camel_object_unref (mime_part); g_free (content_type); - + success = TRUE; break; case DND_TYPE_X_UID_LIST: { @@ -3180,7 +3180,7 @@ drop_action(EMsgComposer *composer, GdkDragContext *context, guint32 action, Gtk if (e_attachment_bar_get_num_attachments(E_ATTACHMENT_BAR(p->attachment_bar))) show_attachments (composer, TRUE); - + gtk_drag_finish(context, success, delete, time); } @@ -3307,14 +3307,14 @@ class_init (EMsgComposerClass *klass) gobject_class = G_OBJECT_CLASS(klass); object_class = GTK_OBJECT_CLASS (klass); widget_class = GTK_WIDGET_CLASS (klass); - + gobject_class->finalize = composer_finalise; gobject_class->dispose = composer_dispose; object_class->destroy = destroy; widget_class->delete_event = delete_event; - + parent_class = g_type_class_ref(bonobo_window_get_type ()); - + signals[SEND] = g_signal_new ("send", E_TYPE_MSG_COMPOSER, @@ -3323,7 +3323,7 @@ class_init (EMsgComposerClass *klass) NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); - + signals[SAVE_DRAFT] = g_signal_new ("save-draft", E_TYPE_MSG_COMPOSER, @@ -3353,46 +3353,46 @@ init (EMsgComposer *composer) (GDestroyNotify) camel_object_unref); p->uic = NULL; - + p->hdrs = NULL; p->extra_hdr_names = g_ptr_array_new (); p->extra_hdr_values = g_ptr_array_new (); - + p->focused_entry = NULL; - + p->eeditor = NULL; - + p->address_dialog = NULL; - + p->attachment_bar = NULL; p->attachment_scrolled_window = NULL; - + p->persist_file_interface = CORBA_OBJECT_NIL; p->persist_stream_interface = CORBA_OBJECT_NIL; - + p->eeditor_engine = CORBA_OBJECT_NIL; p->inline_images = inline_images; p->inline_images_by_url = inline_images_by_url; p->current_images = NULL; - + p->attachment_bar_visible = FALSE; p->send_html = FALSE; p->pgp_sign = FALSE; p->pgp_encrypt = FALSE; p->smime_sign = FALSE; p->smime_encrypt = FALSE; - + p->has_changed = FALSE; p->autosaved = FALSE; - - p->redirect = NULL; - p->send_invoked = FALSE; + + p->redirect = NULL; + p->send_invoked = FALSE; p->charset = NULL; - + p->enable_autosave = TRUE; p->autosave_file = NULL; p->autosave_fd = -1; - + /** @HookPoint-EMMenu: Main Mail Menu * @Id: org.gnome.evolution.mail.composer * @Class: org.gnome.evolution.mail.bonobomenu:1.0 @@ -3402,7 +3402,7 @@ init (EMsgComposer *composer) * target will point to the EMsgComposer object. */ p->menu = em_menu_new("org.gnome.evolution.mail.composer"); - + composer->priv = p; } @@ -3411,7 +3411,7 @@ GtkType e_msg_composer_get_type (void) { static GType type = 0; - + if (type == 0) { static const GTypeInfo info = { sizeof (EMsgComposerClass), @@ -3422,10 +3422,10 @@ e_msg_composer_get_type (void) 0, (GInstanceInitFunc) init, }; - + type = g_type_register_static (bonobo_window_get_type (), "EMsgComposer", &info, 0); } - + return type; } @@ -3434,9 +3434,9 @@ e_msg_composer_load_config (EMsgComposer *composer, int visible_mask) { GConfClient *gconf; EMsgComposerPrivate *p = composer->priv; - + gconf = gconf_client_get_default (); - + p->view_from = gconf_client_get_bool ( gconf, "/apps/evolution/mail/composer/view/From", NULL); p->view_replyto = gconf_client_get_bool ( @@ -3445,32 +3445,32 @@ e_msg_composer_load_config (EMsgComposer *composer, int visible_mask) gconf, "/apps/evolution/mail/composer/view/To", NULL); p->view_postto = gconf_client_get_bool ( gconf, "/apps/evolution/mail/composer/view/PostTo", NULL); - p->view_cc = gconf_client_get_bool ( + p->view_cc = gconf_client_get_bool ( gconf, "/apps/evolution/mail/composer/view/Cc", NULL); p->view_bcc = gconf_client_get_bool ( gconf, "/apps/evolution/mail/composer/view/Bcc", NULL); p->view_subject = gconf_client_get_bool ( gconf, "/apps/evolution/mail/composer/view/Subject", NULL); - + /* if we're mailing, you cannot disable to so it should appear checked */ if (visible_mask & E_MSG_COMPOSER_VISIBLE_TO) p->view_to = TRUE; else p->view_to = FALSE; - + /* ditto for post-to */ if (visible_mask & E_MSG_COMPOSER_VISIBLE_POSTTO) p->view_postto = TRUE; else p->view_postto = FALSE; - + /* we set these to false initially if we're posting */ if (!(visible_mask & E_MSG_COMPOSER_VISIBLE_CC)) p->view_cc = FALSE; - + if (!(visible_mask & E_MSG_COMPOSER_VISIBLE_BCC)) p->view_bcc = FALSE; - + g_object_unref (gconf); } @@ -3479,7 +3479,7 @@ e_msg_composer_get_visible_flags (EMsgComposer *composer) { int flags = 0; EMsgComposerPrivate *p = composer->priv; - + if (p->view_from) flags |= E_MSG_COMPOSER_VISIBLE_FROM; if (p->view_replyto) @@ -3494,14 +3494,14 @@ e_msg_composer_get_visible_flags (EMsgComposer *composer) flags |= E_MSG_COMPOSER_VISIBLE_BCC; if (p->view_subject) flags |= E_MSG_COMPOSER_VISIBLE_SUBJECT; - + /* * Until we have a GUI way, lets make sure that * even if the user screws up, we will do the right * thing (screws up == edit the config file manually * and screw up). */ - flags |= E_MSG_COMPOSER_VISIBLE_SUBJECT; + flags |= E_MSG_COMPOSER_VISIBLE_SUBJECT; return flags; } @@ -3515,29 +3515,29 @@ map_default_cb (EMsgComposer *composer, gpointer user_data) const char *text; EMsgComposerPrivate *p = composer->priv; - /* If the 'To:' field is empty, focus it */ + /* If the 'To:' field is empty, focus it */ widget = e_msg_composer_hdrs_get_to_entry (E_MSG_COMPOSER_HDRS (p->hdrs)); text = gtk_entry_get_text (GTK_ENTRY (widget)); - + if (!text || text[0] == '\0') { gtk_widget_grab_focus (widget); - + return; } - + /* If not, check the subject field */ - + subject = e_msg_composer_hdrs_get_subject (E_MSG_COMPOSER_HDRS (p->hdrs)); - + if (!subject || subject[0] == '\0') { widget = e_msg_composer_hdrs_get_subject_entry (E_MSG_COMPOSER_HDRS (p->hdrs)); gtk_widget_grab_focus (widget); return; } - + /* Jump to the editor as a last resort. */ - + CORBA_exception_init (&ev); GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "grab-focus", &ev); CORBA_exception_free (&ev); @@ -3547,7 +3547,7 @@ static void msg_composer_destroy_notify (void *data) { EMsgComposer *composer = E_MSG_COMPOSER (data); - + all_composers = g_slist_remove (all_composers, composer); } @@ -3576,7 +3576,7 @@ composer_key_pressed (EMsgComposer *composer, GdkEventKey *event, void *user_dat GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "grab-focus", &ev); CORBA_exception_free (&ev); g_signal_stop_emission_by_name (composer, "key-press-event"); - return TRUE; + return TRUE; } return FALSE; } @@ -3616,7 +3616,7 @@ composer_entry_focus_in_event_cb (GtkWidget *widget, GdkEventFocus *event, gpoin g_free (xmlfile); bonobo_ui_component_thaw (p->entry_uic, NULL); - + return FALSE; } @@ -3625,12 +3625,12 @@ composer_entry_focus_out_event_cb (GtkWidget *widget, GdkEventFocus *event, gpoi { EMsgComposer *composer = user_data; EMsgComposerPrivate *p = composer->priv; - + g_return_val_if_fail (p->focused_entry == widget, FALSE); p->focused_entry = NULL; bonobo_ui_component_unset_container (p->entry_uic, NULL); - + return FALSE; } @@ -3640,13 +3640,13 @@ setup_cut_copy_paste (EMsgComposer *composer) EMsgComposerHdrs *hdrs; EMsgComposerPrivate *p = composer->priv; GtkWidget *entry; - + hdrs = (EMsgComposerHdrs *) p->hdrs; - + entry = e_msg_composer_hdrs_get_subject_entry (hdrs); g_signal_connect (entry, "focus_in_event", G_CALLBACK (composer_entry_focus_in_event_cb), composer); g_signal_connect (entry, "focus_out_event", G_CALLBACK (composer_entry_focus_out_event_cb), composer); - + entry = e_msg_composer_hdrs_get_reply_to_entry (hdrs); g_signal_connect (entry, "focus_in_event", G_CALLBACK (composer_entry_focus_in_event_cb), composer); g_signal_connect (entry, "focus_out_event", G_CALLBACK (composer_entry_focus_out_event_cb), composer); @@ -3722,7 +3722,7 @@ static void emcab_properties(EPopup *ep, EPopupItem *item, void *data) { EAttachmentBar *bar = data; - + e_attachment_bar_edit_selected(bar); } @@ -3749,17 +3749,17 @@ emcab_popup_position(GtkMenu *menu, int *x, int *y, gboolean *push_in, gpointer GnomeIconList *icon_list = user_data; GList *selection; GnomeCanvasPixbuf *image; - + gdk_window_get_origin (((GtkWidget*) bar)->window, x, y); - + selection = gnome_icon_list_get_selection (icon_list); if (selection == NULL) return; - + image = gnome_icon_list_get_icon_pixbuf_item (icon_list, GPOINTER_TO_INT(selection->data)); if (image == NULL) return; - + /* Put menu to the center of icon. */ *x += (int)(image->item.x1 + image->item.x2) / 2; *y += (int)(image->item.y1 + image->item.y2) / 2; @@ -3783,7 +3783,7 @@ emcab_popup(EAttachmentBar *bar, GdkEventButton *event, int id) GtkMenu *menu; attachments = e_attachment_bar_get_attachment(bar, id); - + for (i=0;i<sizeof(emcab_popups)/sizeof(emcab_popups[0]);i++) menus = g_slist_prepend(menus, &emcab_popups[i]); @@ -3806,7 +3806,7 @@ emcab_popup(EAttachmentBar *bar, GdkEventButton *event, int id) gtk_menu_popup(menu, NULL, NULL, NULL, NULL, event->button, event->time); } -static gboolean +static gboolean popup_menu_event (GtkWidget *widget) { emcab_popup((EAttachmentBar *)widget, NULL, -1); @@ -3820,10 +3820,10 @@ button_press_event (GtkWidget *widget, GdkEventButton *event) EAttachmentBar *bar = (EAttachmentBar *)widget; GnomeIconList *icon_list = GNOME_ICON_LIST(widget); int icon_number; - + if (event->button != 3) return FALSE; - + icon_number = gnome_icon_list_get_icon_at (icon_list, event->x, event->y); if (icon_number >= 0) { gnome_icon_list_unselect_all(icon_list); @@ -3831,7 +3831,7 @@ button_press_event (GtkWidget *widget, GdkEventButton *event) } emcab_popup(bar, event, icon_number); - + return TRUE; } @@ -3844,7 +3844,7 @@ key_press_event(GtkWidget *widget, GdkEventKey *event) e_attachment_bar_remove_selected (bar); return TRUE; } - + return FALSE; } @@ -3861,20 +3861,20 @@ create_composer (int visible_mask) BonoboControlFrame *control_frame; GtkWidget *html_widget = NULL; gpointer servant; - BonoboObject *impl; + BonoboObject *impl; EMsgComposerPrivate *p; - + composer = g_object_new (E_TYPE_MSG_COMPOSER, "win_name", _("Compose Message"), NULL); p = composer->priv; - + gtk_window_set_title ((GtkWindow *) composer, _("Compose Message")); - + all_composers = g_slist_prepend (all_composers, composer); - + g_signal_connect (composer, "key-press-event", G_CALLBACK (composer_key_pressed), NULL); - + g_signal_connect (composer, "destroy", G_CALLBACK (msg_composer_destroy_notify), NULL); @@ -3891,11 +3891,11 @@ create_composer (int visible_mask) g_signal_connect(composer, "drag_data_received", G_CALLBACK (drag_data_received), composer); g_signal_connect(composer, "drag-motion", G_CALLBACK(drag_motion), composer); e_msg_composer_load_config (composer, visible_mask); - + setup_ui (composer); - + vbox = gtk_vbox_new (FALSE, 0); - + vis = e_msg_composer_get_visible_flags (composer); p->hdrs = e_msg_composer_hdrs_new (p->uic, visible_mask, vis); if (!p->hdrs) { @@ -3903,7 +3903,7 @@ create_composer (int visible_mask) gtk_object_destroy (GTK_OBJECT (composer)); return NULL; } - + gtk_box_set_spacing (GTK_BOX (vbox), 6); gtk_box_pack_start (GTK_BOX (vbox), p->hdrs, FALSE, FALSE, 0); g_signal_connect (p->hdrs, "subject_changed", @@ -3913,7 +3913,7 @@ create_composer (int visible_mask) g_signal_connect (p->hdrs, "from_changed", G_CALLBACK (from_changed_cb), composer); gtk_widget_show (p->hdrs); - + setup_signatures_menu (composer); from_changed_cb((EMsgComposerHdrs *)p->hdrs, composer); @@ -3930,12 +3930,12 @@ create_composer (int visible_mask) control_frame = bonobo_widget_get_control_frame (BONOBO_WIDGET (p->eeditor)); bonobo_control_frame_set_autoactivate (control_frame, TRUE); - + /* let the editor know which mode we are in */ - bonobo_widget_set_property (BONOBO_WIDGET (p->eeditor), + bonobo_widget_set_property (BONOBO_WIDGET (p->eeditor), "FormatHTML", TC_CORBA_boolean, p->send_html, NULL); - + gconf = gconf_client_get_default (); composer_settings_update (gconf, 0, NULL, composer); gconf_client_add_dir (gconf, "/apps/evolution/mail/composer", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); @@ -3946,9 +3946,9 @@ create_composer (int visible_mask) gconf_client_get_int (gconf, "/apps/evolution/mail/composer/height", NULL)); g_signal_connect (composer, "unrealize", G_CALLBACK (e_msg_composer_unrealize), NULL); g_object_unref (gconf); - + editor_server = bonobo_widget_get_objref (BONOBO_WIDGET (p->eeditor)); - + /* FIXME: handle exceptions */ CORBA_exception_init (&ev); p->persist_file_interface @@ -3956,24 +3956,24 @@ create_composer (int visible_mask) p->persist_stream_interface = Bonobo_Unknown_queryInterface (editor_server, "IDL:Bonobo/PersistStream:1.0", &ev); CORBA_exception_free (&ev); - + gtk_box_pack_start (GTK_BOX (vbox), p->eeditor, TRUE, TRUE, 0); - + /* Attachment editor, wrapped into an EScrollFrame. It's hidden in an EExpander. */ - + p->attachment_scrolled_window = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (p->attachment_scrolled_window), GTK_SHADOW_IN); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (p->attachment_scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - + p->attachment_bar = e_attachment_bar_new (NULL); g_signal_connect (p->attachment_bar, "button_press_event", G_CALLBACK (button_press_event), NULL); g_signal_connect (p->attachment_bar, "key_press_event", G_CALLBACK (key_press_event), NULL); g_signal_connect (p->attachment_bar, "popup-menu", G_CALLBACK (popup_menu_event), NULL); - + GTK_WIDGET_SET_FLAGS (p->attachment_bar, GTK_CAN_FOCUS); gtk_container_add (GTK_CONTAINER (p->attachment_scrolled_window), p->attachment_bar); @@ -3988,7 +3988,7 @@ create_composer (int visible_mask) gtk_misc_set_alignment (GTK_MISC (p->attachment_expander_label), 0.0, 0.5); gtk_misc_set_alignment (GTK_MISC (p->attachment_expander_num), 1.0, 0.5); expander_hbox = gtk_hbox_new (FALSE, 0); - + p->attachment_expander_icon = e_icon_factory_get_image ("mail-attachment", E_ICON_SIZE_MENU); gtk_misc_set_alignment (GTK_MISC (p->attachment_expander_icon), 1, 0.5); gtk_widget_set_size_request (p->attachment_expander_icon, 100, -1); @@ -4008,18 +4008,18 @@ create_composer (int visible_mask) gtk_box_pack_start (GTK_BOX (vbox), p->attachment_expander, FALSE, FALSE, GNOME_PAD_SMALL); gtk_widget_show (p->attachment_expander); - e_expander_set_expanded (E_EXPANDER (p->attachment_expander), FALSE); - g_signal_connect_after (p->attachment_expander, "activate", + e_expander_set_expanded (E_EXPANDER (p->attachment_expander), FALSE); + g_signal_connect_after (p->attachment_expander, "activate", G_CALLBACK (attachment_expander_activate_cb), composer); bonobo_window_set_contents (BONOBO_WINDOW (composer), vbox); gtk_widget_show (vbox); - + /* If we show this widget earlier, we lose network transparency. i.e. the component appears on the machine evo is running on, ignoring any DISPLAY variable. */ gtk_widget_show (p->eeditor); - + prepare_engine (composer); if (p->eeditor_engine == CORBA_OBJECT_NIL) { e_error_run (GTK_WINDOW (composer), "mail-composer:no-editor-control", NULL); @@ -4030,7 +4030,7 @@ create_composer (int visible_mask) /* The engine would have the GtkHTML widget stored in "html-widget" * We'll use that to listen for DnD signals */ - + servant = ORBit_small_get_servant (p->eeditor_engine); if (servant && (impl = bonobo_object (servant))) html_widget = g_object_get_data (G_OBJECT(impl), "html-widget"); @@ -4038,18 +4038,18 @@ create_composer (int visible_mask) if (html_widget) { g_signal_connect (html_widget, "drag_data_received", G_CALLBACK (drag_data_received), composer); } - + setup_cut_copy_paste (composer); g_signal_connect (composer, "map", (GCallback) map_default_cb, NULL); - + if (am == NULL) am = autosave_manager_new (); - + autosave_manager_register (am, composer); p->has_changed = FALSE; - + return composer; } @@ -4058,15 +4058,15 @@ set_editor_signature (EMsgComposer *composer) { EAccountIdentity *id; EMsgComposerPrivate *p = composer->priv; - + g_return_if_fail (E_MSG_COMPOSER_HDRS (p->hdrs)->account != NULL); - + id = E_MSG_COMPOSER_HDRS (p->hdrs)->account->id; if (id->sig_uid) p->signature = mail_config_get_signature_by_uid (id->sig_uid); else p->signature = NULL; - + sig_select_item (composer); } @@ -4114,7 +4114,7 @@ e_msg_composer_new_with_type (int type) * e_msg_composer_new: * * Create a new message composer widget. - * + * * Return value: A pointer to the newly created widget **/ EMsgComposer * @@ -4132,12 +4132,12 @@ is_special_header (const char *hdr_name) */ if (g_ascii_strncasecmp (hdr_name, "X-", 2)) return TRUE; - + if (!g_ascii_strncasecmp (hdr_name, "X-Evolution", 11)) return TRUE; - + /* we can keep all other X-* headers */ - + return FALSE; } @@ -4145,7 +4145,7 @@ static void e_msg_composer_set_pending_body (EMsgComposer *composer, char *text, ssize_t len) { char *old; - + old = g_object_get_data ((GObject *) composer, "body:text"); g_free (old); g_object_set_data ((GObject *) composer, "body:text", text); @@ -4157,20 +4157,20 @@ e_msg_composer_flush_pending_body (EMsgComposer *composer, gboolean apply) { char *body; ssize_t len; - + body = g_object_get_data ((GObject *) composer, "body:text"); len = GPOINTER_TO_SIZE (g_object_get_data ((GObject *) composer, "body:len")); if (body) { - if (apply) + if (apply) set_editor_text (composer, body, len, FALSE, FALSE); - + g_object_set_data ((GObject *) composer, "body:text", NULL); g_free (body); } -} +} static void -add_attachments_handle_mime_part (EMsgComposer *composer, CamelMimePart *mime_part, +add_attachments_handle_mime_part (EMsgComposer *composer, CamelMimePart *mime_part, gboolean just_inlines, gboolean related, int depth) { CamelContentType *content_type; @@ -4181,7 +4181,7 @@ add_attachments_handle_mime_part (EMsgComposer *composer, CamelMimePart *mime_pa content_type = camel_mime_part_get_content_type (mime_part); wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (mime_part)); - + if (CAMEL_IS_MULTIPART (wrapper)) { /* another layer of multipartness... */ add_attachments_from_multipart (composer, (CamelMultipart *) wrapper, just_inlines, depth + 1); @@ -4210,9 +4210,9 @@ add_attachments_from_multipart (EMsgComposer *composer, CamelMultipart *multipar CamelMimePart *mime_part; gboolean related; int i, nparts; - + related = camel_content_type_is (CAMEL_DATA_WRAPPER (multipart)->mime_type, "multipart", "related"); - + if (CAMEL_IS_MULTIPART_SIGNED (multipart)) { mime_part = camel_multipart_get_part (multipart, CAMEL_MULTIPART_SIGNED_CONTENT); add_attachments_handle_mime_part (composer, mime_part, just_inlines, related, depth); @@ -4244,11 +4244,11 @@ e_msg_composer_add_message_attachments (EMsgComposer *composer, CamelMimeMessage gboolean just_inlines) { CamelDataWrapper *wrapper; - + wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (message)); if (!CAMEL_IS_MULTIPART (wrapper)) return; - + /* there must be attachments... */ add_attachments_from_multipart (composer, (CamelMultipart *) wrapper, just_inlines, 0); } @@ -4260,27 +4260,27 @@ handle_multipart_signed (EMsgComposer *composer, CamelMultipart *multipart, int CamelContentType *content_type; CamelDataWrapper *content; CamelMimePart *mime_part; - + /* FIXME: make sure this isn't an s/mime signed part?? */ e_msg_composer_set_pgp_sign (composer, TRUE); - + mime_part = camel_multipart_get_part (multipart, CAMEL_MULTIPART_SIGNED_CONTENT); if (!mime_part) return; content_type = camel_mime_part_get_content_type (mime_part); - + content = camel_medium_get_content_object (CAMEL_MEDIUM (mime_part)); - + if (CAMEL_IS_MULTIPART (content)) { multipart = CAMEL_MULTIPART (content); - + /* Note: depth is preserved here because we're not counting multipart/signed as a multipart, instead we want to treat the content part as our mime part here. */ - + if (CAMEL_IS_MULTIPART_SIGNED (content)) { /* handle the signed content and configure the composer to sign outgoing messages */ handle_multipart_signed (composer, multipart, depth); @@ -4317,7 +4317,7 @@ handle_multipart_encrypted (EMsgComposer *composer, CamelMimePart *multipart, in /* FIXME: make sure this is a PGP/MIME encrypted part?? */ e_msg_composer_set_pgp_encrypt (composer, TRUE); - + camel_exception_init (&ex); cipher = mail_crypto_get_pgp_cipher_context (NULL); mime_part = camel_mime_part_new(); @@ -4325,21 +4325,21 @@ handle_multipart_encrypted (EMsgComposer *composer, CamelMimePart *multipart, in camel_object_unref(cipher); camel_exception_clear (&ex); if (valid == NULL) - return; + return; camel_cipher_validity_free(valid); - + content_type = camel_mime_part_get_content_type (mime_part); - + content = camel_medium_get_content_object (CAMEL_MEDIUM (mime_part)); - + if (CAMEL_IS_MULTIPART (content)) { CamelMultipart *content_multipart = CAMEL_MULTIPART (content); - + /* Note: depth is preserved here because we're not counting multipart/encrypted as a multipart, instead we want to treat the content part as our mime part here. */ - + if (CAMEL_IS_MULTIPART_SIGNED (content)) { /* handle the signed content and configure the composer to sign outgoing messages */ handle_multipart_signed (composer, content_multipart, depth); @@ -4362,7 +4362,7 @@ handle_multipart_encrypted (EMsgComposer *composer, CamelMimePart *multipart, in } else { e_msg_composer_attach (composer, mime_part); } - + camel_object_unref (mime_part); } @@ -4372,14 +4372,14 @@ handle_multipart_alternative (EMsgComposer *composer, CamelMultipart *multipart, /* Find the text/html part and set the composer body to it's contents */ CamelMimePart *text_part = NULL; int i, nparts; - + nparts = camel_multipart_get_number (multipart); - + for (i = 0; i < nparts; i++) { CamelContentType *content_type; CamelDataWrapper *content; CamelMimePart *mime_part; - + mime_part = camel_multipart_get_part (multipart, i); if (!mime_part) @@ -4387,12 +4387,12 @@ handle_multipart_alternative (EMsgComposer *composer, CamelMultipart *multipart, content_type = camel_mime_part_get_content_type (mime_part); content = camel_medium_get_content_object (CAMEL_MEDIUM (mime_part)); - + if (CAMEL_IS_MULTIPART (content)) { CamelMultipart *mp; - + mp = CAMEL_MULTIPART (content); - + if (CAMEL_IS_MULTIPART_SIGNED (content)) { /* handle the signed content and configure the composer to sign outgoing messages */ handle_multipart_signed (composer, mp, depth + 1); @@ -4416,7 +4416,7 @@ handle_multipart_alternative (EMsgComposer *composer, CamelMultipart *multipart, e_msg_composer_attach (composer, mime_part); } } - + if (text_part) { ssize_t len; char *html; @@ -4430,9 +4430,9 @@ static void handle_multipart (EMsgComposer *composer, CamelMultipart *multipart, int depth) { int i, nparts; - + nparts = camel_multipart_get_number (multipart); - + for (i = 0; i < nparts; i++) { CamelContentType *content_type; CamelDataWrapper *content; @@ -4445,12 +4445,12 @@ handle_multipart (EMsgComposer *composer, CamelMultipart *multipart, int depth) content_type = camel_mime_part_get_content_type (mime_part); content = camel_medium_get_content_object (CAMEL_MEDIUM (mime_part)); - + if (CAMEL_IS_MULTIPART (content)) { CamelMultipart *mp; - + mp = CAMEL_MULTIPART (content); - + if (CAMEL_IS_MULTIPART_SIGNED (content)) { /* handle the signed content and configure the composer to sign outgoing messages */ handle_multipart_signed (composer, mp, depth + 1); @@ -4486,13 +4486,13 @@ set_signature_gui (EMsgComposer *composer) { CORBA_Environment ev; EMsgComposerPrivate *p = composer->priv; - + p->signature = NULL; - + CORBA_exception_init (&ev); if (GNOME_GtkHTML_Editor_Engine_searchByData (p->eeditor_engine, 1, "ClueFlow", "signature", "1", &ev)) { char *name, *str = NULL; - + str = GNOME_GtkHTML_Editor_Engine_getParagraphData (p->eeditor_engine, "signature_name", &ev); if (ev._major == CORBA_NO_EXCEPTION && str) { if (!strncmp (str, "uid:", 4)) { @@ -4505,7 +4505,7 @@ set_signature_gui (EMsgComposer *composer) g_free (name); } } - + sig_select_item (composer); } CORBA_exception_free (&ev); @@ -4515,7 +4515,7 @@ set_signature_gui (EMsgComposer *composer) /** * e_msg_composer_new_with_message: * @message: The message to use as the source - * + * * Create a new message composer widget. * * Note: Designed to work only for messages constructed using Evolution. @@ -4539,7 +4539,7 @@ e_msg_composer_new_with_message (CamelMimeMessage *message) struct _camel_header_raw *xev; int len, i; EMsgComposerPrivate *p; - + for (headers = CAMEL_MIME_PART (message)->headers;headers;headers = headers->next) { if (!strcmp(headers->name, "X-Evolution-PostTo")) postto = g_list_append(postto, g_strstrip(g_strdup(headers->value))); @@ -4547,26 +4547,26 @@ e_msg_composer_new_with_message (CamelMimeMessage *message) new = create_composer (postto ? E_MSG_COMPOSER_VISIBLE_MASK_POST : E_MSG_COMPOSER_VISIBLE_MASK_MAIL); p = new->priv; - + if (!new) { g_list_foreach(postto, (GFunc)g_free, NULL); g_list_free(postto); return NULL; } - + if (postto) { e_msg_composer_hdrs_set_post_to_list(E_MSG_COMPOSER_HDRS (p->hdrs), postto); g_list_foreach(postto, (GFunc)g_free, NULL); g_list_free(postto); postto = NULL; } - + /* Restore the Account preference */ account_name = (char *) camel_medium_get_header (CAMEL_MEDIUM (message), "X-Evolution-Account"); if (account_name) { account_name = g_strdup (account_name); g_strstrip (account_name); - + if ((account = mail_config_get_account_by_uid(account_name)) == NULL) /* 'old' setting */ account = mail_config_get_account_by_name(account_name); @@ -4575,7 +4575,7 @@ e_msg_composer_new_with_message (CamelMimeMessage *message) account_name = g_strdup (account->name); } } - + if (postto == NULL) { auto_cc = g_hash_table_new_full ( camel_strcase_hash, camel_strcase_equal, @@ -4586,50 +4586,50 @@ e_msg_composer_new_with_message (CamelMimeMessage *message) camel_strcase_hash, camel_strcase_equal, (GDestroyNotify) g_free, (GDestroyNotify) NULL); - + if (account) { CamelInternetAddress *iaddr; - + /* hash our auto-recipients for this account */ if (account->always_cc) { iaddr = camel_internet_address_new (); if (camel_address_decode (CAMEL_ADDRESS (iaddr), account->cc_addrs) != -1) { for (i = 0; i < camel_address_length (CAMEL_ADDRESS (iaddr)); i++) { const char *name, *addr; - + if (!camel_internet_address_get (iaddr, i, &name, &addr)) continue; - + g_hash_table_insert (auto_cc, g_strdup (addr), GINT_TO_POINTER (TRUE)); } } camel_object_unref (iaddr); } - + if (account->always_bcc) { iaddr = camel_internet_address_new (); if (camel_address_decode (CAMEL_ADDRESS (iaddr), account->bcc_addrs) != -1) { for (i = 0; i < camel_address_length (CAMEL_ADDRESS (iaddr)); i++) { const char *name, *addr; - + if (!camel_internet_address_get (iaddr, i, &name, &addr)) continue; - + g_hash_table_insert (auto_bcc, g_strdup (addr), GINT_TO_POINTER (TRUE)); } } camel_object_unref (iaddr); } } - + to = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO); cc = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC); bcc = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_BCC); - + len = CAMEL_ADDRESS (to)->addresses->len; for (i = 0; i < len; i++) { const char *name, *addr; - + if (camel_internet_address_get (to, i, &name, &addr)) { EDestination *dest = e_destination_new (); e_destination_set_name (dest, name); @@ -4639,43 +4639,43 @@ e_msg_composer_new_with_message (CamelMimeMessage *message) } Tov = destination_list_to_vector (To); g_list_free (To); - + len = CAMEL_ADDRESS (cc)->addresses->len; for (i = 0; i < len; i++) { const char *name, *addr; - + if (camel_internet_address_get (cc, i, &name, &addr)) { EDestination *dest = e_destination_new (); e_destination_set_name (dest, name); e_destination_set_email (dest, addr); - + if (g_hash_table_lookup (auto_cc, addr)) e_destination_set_auto_recipient (dest, TRUE); - + Cc = g_list_append (Cc, dest); } } - + Ccv = destination_list_to_vector (Cc); g_hash_table_destroy (auto_cc); g_list_free (Cc); - + len = CAMEL_ADDRESS (bcc)->addresses->len; for (i = 0; i < len; i++) { const char *name, *addr; - + if (camel_internet_address_get (bcc, i, &name, &addr)) { EDestination *dest = e_destination_new (); e_destination_set_name (dest, name); e_destination_set_email (dest, addr); - + if (g_hash_table_lookup (auto_bcc, addr)) e_destination_set_auto_recipient (dest, TRUE); - + Bcc = g_list_append (Bcc, dest); } } - + Bccv = destination_list_to_vector (Bcc); g_hash_table_destroy (auto_bcc); g_list_free (Bcc); @@ -4684,17 +4684,17 @@ e_msg_composer_new_with_message (CamelMimeMessage *message) Ccv = NULL; Bccv = NULL; } - + subject = camel_mime_message_get_subject (message); - + e_msg_composer_set_headers (new, account_name, Tov, Ccv, Bccv, subject); - + g_free (account_name); - + e_destination_freev (Tov); e_destination_freev (Ccv); e_destination_freev (Bccv); - + /* Restore the format editing preference */ format = camel_medium_get_header (CAMEL_MEDIUM (message), "X-Evolution-Format"); if (format) { @@ -4722,11 +4722,11 @@ e_msg_composer_new_with_message (CamelMimeMessage *message) } g_strfreev(flags); } - + /* Remove any other X-Evolution-* headers that may have been set */ xev = mail_tool_remove_xevolution_headers (message); camel_header_raw_clear(&xev); - + /* set extra headers */ headers = CAMEL_MIME_PART (message)->headers; while (headers) { @@ -4736,18 +4736,18 @@ e_msg_composer_new_with_message (CamelMimeMessage *message) g_ptr_array_add (p->extra_hdr_names, g_strdup (headers->name)); g_ptr_array_add (p->extra_hdr_values, g_strdup (headers->value)); } - + headers = headers->next; } - + /* Restore the attachments and body text */ content = camel_medium_get_content_object (CAMEL_MEDIUM (message)); if (CAMEL_IS_MULTIPART (content)) { CamelMultipart *multipart; - + multipart = CAMEL_MULTIPART (content); content_type = camel_mime_part_get_content_type (CAMEL_MIME_PART (message)); - + if (CAMEL_IS_MULTIPART_SIGNED (content)) { /* handle the signed content and configure the composer to sign outgoing messages */ handle_multipart_signed (new, multipart, 0); @@ -4768,14 +4768,14 @@ e_msg_composer_new_with_message (CamelMimeMessage *message) html = em_utils_part_to_html((CamelMimePart *)message, &length, NULL); e_msg_composer_set_pending_body(new, html, length); } - + /* We wait until now to set the body text because we need to ensure that * the attachment bar has all the attachments, before we request them. - */ + */ e_msg_composer_flush_pending_body (new, TRUE); - + set_signature_gui (new); - + return new; } @@ -4788,9 +4788,9 @@ disable_editor (EMsgComposer *composer) CORBA_exception_init (&ev); GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "editable-off", &ev); CORBA_exception_free (&ev); - + gtk_widget_set_sensitive (p->attachment_bar, FALSE); - + bonobo_ui_component_set_prop (p->uic, "/menu/Edit", "sensitive", "0", NULL); bonobo_ui_component_set_prop (p->uic, "/menu/Format", "sensitive", "0", NULL); bonobo_ui_component_set_prop (p->uic, "/menu/Insert", "sensitive", "0", NULL); @@ -4799,7 +4799,7 @@ disable_editor (EMsgComposer *composer) /** * e_msg_composer_new_redirect: * @message: The message to use as the source - * + * * Create a new message composer widget. * * Return value: A pointer to the newly created widget @@ -4810,21 +4810,21 @@ e_msg_composer_new_redirect (CamelMimeMessage *message, const char *resent_from) EMsgComposer *composer; EMsgComposerPrivate *p; const char *subject; - + g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (message), NULL); - + composer = e_msg_composer_new_with_message (message); p = composer->priv; - + subject = camel_mime_message_get_subject (message); - + p->redirect = message; camel_object_ref (message); - + e_msg_composer_set_headers (composer, resent_from, NULL, NULL, NULL, subject); - + disable_editor (composer); - + return composer; } @@ -4835,20 +4835,20 @@ add_recipients (GList *list, const char *recips) CamelInternetAddress *cia; const char *name, *addr; int num, i; - + cia = camel_internet_address_new (); num = camel_address_decode (CAMEL_ADDRESS (cia), recips); - + for (i = 0; i < num; i++) { if (camel_internet_address_get (cia, i, &name, &addr)) { EDestination *dest = e_destination_new (); e_destination_set_name (dest, name); e_destination_set_email (dest, addr); - + list = g_list_append (list, dest); } } - + return list; } @@ -4865,9 +4865,9 @@ handle_mailto (EMsgComposer *composer, const char *mailto) const char *p; int len, clen; CamelURL *url; - + buf = g_strdup (mailto); - + /* Parse recipients (everything after ':' until '?' or eos). */ p = buf + 7; len = strcspn (p, "?"); @@ -4877,27 +4877,27 @@ handle_mailto (EMsgComposer *composer, const char *mailto) to = add_recipients (to, content); g_free (content); } - + p += len; if (*p == '?') { p++; - + while (*p) { len = strcspn (p, "=&"); - + /* If it's malformed, give up. */ if (p[len] != '=') break; - + header = (char *) p; header[len] = '\0'; p += len + 1; - + clen = strcspn (p, "&"); - + content = g_strndup (p, clen); camel_url_decode (content); - + if (!g_ascii_strcasecmp (header, "to")) { to = add_recipients (to, content); } else if (!g_ascii_strcasecmp (header, "cc")) { @@ -4945,7 +4945,7 @@ handle_mailto (EMsgComposer *composer, const char *mailto) "attachment"); } gtk_widget_show (priv->attachment_expander); - gtk_widget_show (priv->attachment_scrolled_window); + gtk_widget_show (priv->attachment_scrolled_window); } else if (!g_ascii_strcasecmp (header, "from")) { /* Ignore */ } else if (!g_ascii_strcasecmp (header, "reply-to")) { @@ -4954,9 +4954,9 @@ handle_mailto (EMsgComposer *composer, const char *mailto) /* add an arbitrary header? */ e_msg_composer_add_header (composer, header, content); } - + g_free (content); - + p += clen; if (*p == '&') { p++; @@ -4965,35 +4965,35 @@ handle_mailto (EMsgComposer *composer, const char *mailto) } } } - + g_free (buf); - + tov = destination_list_to_vector (to); ccv = destination_list_to_vector (cc); bccv = destination_list_to_vector (bcc); - + g_list_free (to); g_list_free (cc); g_list_free (bcc); - + hdrs = E_MSG_COMPOSER_HDRS (priv->hdrs); - + e_msg_composer_hdrs_set_to (hdrs, tov); e_msg_composer_hdrs_set_cc (hdrs, ccv); e_msg_composer_hdrs_set_bcc (hdrs, bccv); - + e_destination_freev (tov); e_destination_freev (ccv); e_destination_freev (bccv); - + if (subject) { e_msg_composer_hdrs_set_subject (hdrs, subject); g_free (subject); } - + if (body) { char *htmlbody; - + htmlbody = camel_text_to_html (body, CAMEL_MIME_FILTER_TOHTML_PRE, 0); set_editor_text (composer, htmlbody, -1, FALSE, FALSE); g_free (htmlbody); @@ -5043,15 +5043,15 @@ EMsgComposer * e_msg_composer_new_from_url (const char *url) { EMsgComposer *composer; - + g_return_val_if_fail (g_ascii_strncasecmp (url, "mailto:", 7) == 0, NULL); - + composer = e_msg_composer_new (); if (!composer) return NULL; - + handle_mailto (composer, url); - + return composer; } @@ -5067,7 +5067,7 @@ e_msg_composer_new_from_url (const char *url) * * Sets the headers in the composer to the given values. **/ -void +void e_msg_composer_set_headers (EMsgComposer *composer, const char *from, EDestination **to, @@ -5077,11 +5077,11 @@ e_msg_composer_set_headers (EMsgComposer *composer, { EMsgComposerHdrs *hdrs; EMsgComposerPrivate *p = composer->priv; - + g_return_if_fail (E_IS_MSG_COMPOSER (composer)); - + hdrs = E_MSG_COMPOSER_HDRS (p->hdrs); - + e_msg_composer_hdrs_set_to (hdrs, to); e_msg_composer_hdrs_set_cc (hdrs, cc); e_msg_composer_hdrs_set_bcc (hdrs, bcc); @@ -5102,7 +5102,7 @@ e_msg_composer_set_body_text (EMsgComposer *composer, const char *text, ssize_t { g_return_if_fail (E_IS_MSG_COMPOSER (composer)); g_return_if_fail (text != NULL); - + set_editor_text (composer, text, len, TRUE, *text == '\0'); } @@ -5121,11 +5121,11 @@ e_msg_composer_set_body (EMsgComposer *composer, const char *body, { EMsgComposerPrivate *p = composer->priv; g_return_if_fail (E_IS_MSG_COMPOSER (composer)); - + set_editor_text (composer, _("<b>(The composer contains a non-text message body, which cannot be edited.)</b>"), -1, FALSE, FALSE); e_msg_composer_set_send_html (composer, FALSE); disable_editor (composer); - + g_free (p->mime_body); p->mime_body = g_strdup (body); g_free (p->mime_type); @@ -5158,7 +5158,7 @@ e_msg_composer_add_header (EMsgComposer *composer, const char *name, g_return_if_fail (E_IS_MSG_COMPOSER (composer)); g_return_if_fail (name != NULL); g_return_if_fail (value != NULL); - + g_ptr_array_add (p->extra_hdr_names, g_strdup (name)); g_ptr_array_add (p->extra_hdr_values, g_strdup (value)); } @@ -5169,19 +5169,19 @@ e_msg_composer_add_header (EMsgComposer *composer, const char *name, * @change_value: the header value to put in place of the previous * value * - * Searches for a header with name=@name ,if found it removes - * that header and adds a new header with the @name and @change_value . + * Searches for a header with name=@name ,if found it removes + * that header and adds a new header with the @name and @change_value . * If not found then it creates a new header with @name and @change_value . **/ -void +void e_msg_composer_modify_header (EMsgComposer *composer, const char *name, const char *change_value) { g_return_if_fail (E_IS_MSG_COMPOSER (composer)); g_return_if_fail (name != NULL); g_return_if_fail (change_value != NULL); - - e_msg_composer_remove_header (composer, name); + + e_msg_composer_remove_header (composer, name); e_msg_composer_add_header (composer, name, change_value); } @@ -5191,7 +5191,7 @@ e_msg_composer_modify_header (EMsgComposer *composer, const char *name, * @name: the header name * * Searches for the header and if found it removes it . - **/ + **/ void e_msg_composer_remove_header (EMsgComposer *composer, const char *name) { @@ -5205,7 +5205,7 @@ e_msg_composer_remove_header (EMsgComposer *composer, const char *name) for (i = 0; i < p->extra_hdr_names->len; i++) { if (strcmp (p->extra_hdr_names->pdata[i], name) == 0) { - g_print ("Hit : %s",name); + g_print ("Hit : %s",name); g_ptr_array_remove_index (p->extra_hdr_names, i); g_ptr_array_remove_index (p->extra_hdr_values, i); } @@ -5223,10 +5223,10 @@ e_msg_composer_attach (EMsgComposer *composer, CamelMimePart *attachment) { EAttachmentBar *bar; EMsgComposerPrivate *p = composer->priv; - + g_return_if_fail (E_IS_MSG_COMPOSER (composer)); g_return_if_fail (CAMEL_IS_MIME_PART (attachment)); - + bar = E_ATTACHMENT_BAR (p->attachment_bar); e_attachment_bar_attach_mime_part (bar, attachment); @@ -5258,45 +5258,45 @@ e_msg_composer_add_inline_image_from_file (EMsgComposer *composer, dec_file_name = g_strdup(file_name); camel_url_decode(dec_file_name); - + /* check for regular file */ if (g_stat (dec_file_name, &statbuf) < 0 || !S_ISREG (statbuf.st_mode)) return NULL; - + stream = camel_stream_fs_new_with_name (dec_file_name, O_RDONLY, 0); if (!stream) return NULL; - + wrapper = camel_data_wrapper_new (); camel_data_wrapper_construct_from_stream (wrapper, stream); camel_object_unref (CAMEL_OBJECT (stream)); - + mime_type = e_msg_composer_guess_mime_type (dec_file_name); camel_data_wrapper_set_mime_type (wrapper, mime_type ? mime_type : "application/octet-stream"); g_free (mime_type); - + part = camel_mime_part_new (); camel_medium_set_content_object (CAMEL_MEDIUM (part), wrapper); camel_object_unref (wrapper); - + cid = camel_header_msgid_generate (); camel_mime_part_set_content_id (part, cid); name = g_path_get_basename(dec_file_name); camel_mime_part_set_filename (part, name); g_free(name); camel_mime_part_set_encoding (part, CAMEL_TRANSFER_ENCODING_BASE64); - + url = g_strdup_printf ("file:%s", dec_file_name); g_hash_table_insert (p->inline_images_by_url, url, part); - + url = g_strdup_printf ("cid:%s", cid); g_hash_table_insert (p->inline_images, url, part); g_free (cid); g_free(dec_file_name); - + return part; -} +} /** @@ -5320,11 +5320,11 @@ e_msg_composer_add_inline_image_from_mime_part (EMsgComposer *composer, camel_mime_part_set_content_id (part, NULL); cid = camel_mime_part_get_content_id (part); } - + url = g_strdup_printf ("cid:%s", cid); g_hash_table_insert (p->inline_images, url, part); camel_object_ref (part); - + location = camel_mime_part_get_content_location (part); if (location) { g_hash_table_insert (p->inline_images_by_url, @@ -5336,11 +5336,11 @@ e_msg_composer_add_inline_image_from_mime_part (EMsgComposer *composer, /** * e_msg_composer_get_message: * @composer: A message composer widget - * + * * Retrieve the message edited by the user as a CamelMimeMessage. The * CamelMimeMessage object is created on the fly; subsequent calls to this * function will always create new objects from scratch. - * + * * Return value: A pointer to the new CamelMimeMessage object **/ CamelMimeMessage * @@ -5352,7 +5352,7 @@ e_msg_composer_get_message (EMsgComposer *composer, gboolean save_html_object_da return NULL; } } - + return build_message (composer, save_html_object_data); } @@ -5409,7 +5409,7 @@ e_msg_composer_get_message_draft (EMsgComposer *composer) GString *flags; int i; EMsgComposerPrivate *p = composer->priv; - + /* always save drafts as HTML to preserve formatting */ old_send_html = p->send_html; p->send_html = TRUE; @@ -5421,20 +5421,20 @@ e_msg_composer_get_message_draft (EMsgComposer *composer) p->smime_sign = FALSE; old_flags[3] = p->smime_encrypt; p->smime_encrypt = FALSE; - + msg = build_message (composer, TRUE); - + p->send_html = old_send_html; p->pgp_sign = old_flags[0]; p->pgp_encrypt = old_flags[1]; p->smime_sign = old_flags[2]; p->smime_encrypt = old_flags[3]; - + /* Attach account info to the draft. */ account = e_msg_composer_get_preferred_account (composer); if (account && account->name) camel_medium_set_header (CAMEL_MEDIUM (msg), "X-Evolution-Account", account->uid); - + /* build_message() set this to text/html since we set p->send_html to TRUE before calling e_msg_composer_get_message() */ if (!p->send_html) @@ -5461,7 +5461,7 @@ delete_old_signature (EMsgComposer *composer) { CORBA_Environment ev; EMsgComposerPrivate *p = composer->priv; - + /* printf ("delete_old_signature\n"); */ CORBA_exception_init (&ev); GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "block-selection", &ev); @@ -5484,7 +5484,7 @@ delete_old_signature (EMsgComposer *composer) /** * e_msg_composer_show_sig: * @composer: A message composer widget - * + * * Set a signature **/ void @@ -5494,7 +5494,7 @@ e_msg_composer_show_sig_file (EMsgComposer *composer) char *html; EMsgComposerPrivate *p = composer->priv; g_return_if_fail (E_IS_MSG_COMPOSER (composer)); - + /* printf ("e_msg_composer_show_sig_file\n"); */ /* printf ("set sig '%s' '%s'\n", sig_file, p->sig_file); */ if (!p->redirect) { @@ -5503,7 +5503,7 @@ e_msg_composer_show_sig_file (EMsgComposer *composer) GNOME_GtkHTML_Editor_Engine_freeze (p->eeditor_engine, &ev); GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "cursor-position-save", &ev); GNOME_GtkHTML_Editor_Engine_undoBegin (p->eeditor_engine, "Set signature", "Reset signature", &ev); - + delete_old_signature (composer); html = get_signature_html (composer); if (html) { @@ -5519,7 +5519,7 @@ e_msg_composer_show_sig_file (EMsgComposer *composer) GNOME_GtkHTML_Editor_Engine_insertHTML (p->eeditor_engine, html, &ev); g_free (html); } - + GNOME_GtkHTML_Editor_Engine_undoEnd (p->eeditor_engine, &ev); GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "cursor-position-restore", &ev); GNOME_GtkHTML_Editor_Engine_thaw (p->eeditor_engine, &ev); @@ -5534,7 +5534,7 @@ e_msg_composer_show_sig_file (EMsgComposer *composer) * e_msg_composer_set_send_html: * @composer: A message composer widget * @send_html: Whether the composer should have the "Send HTML" flag set - * + * * Set the status of the "Send HTML" toggle item. The user can override it. **/ void @@ -5543,30 +5543,30 @@ e_msg_composer_set_send_html (EMsgComposer *composer, { CORBA_Environment ev; EMsgComposerPrivate *p = composer->priv; - + g_return_if_fail (E_IS_MSG_COMPOSER (composer)); - + if (p->send_html && send_html) return; - + if (!p->send_html && !send_html) return; - + p->send_html = send_html; - + CORBA_exception_init (&ev); GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "block-redraw", &ev); CORBA_exception_free (&ev); - + bonobo_ui_component_set_prop (p->uic, "/commands/FormatHtml", "state", p->send_html ? "1" : "0", NULL); - + /* let the editor know which mode we are in */ bonobo_widget_set_property (BONOBO_WIDGET (p->eeditor), "FormatHTML", TC_CORBA_boolean, p->send_html, NULL); - - + + CORBA_exception_init (&ev); GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "unblock-redraw", &ev); CORBA_exception_free (&ev); @@ -5576,9 +5576,9 @@ e_msg_composer_set_send_html (EMsgComposer *composer, /** * e_msg_composer_get_send_html: * @composer: A message composer widget - * + * * Get the status of the "Send HTML mail" flag. - * + * * Return value: The status of the "Send HTML mail" flag. **/ gboolean @@ -5587,7 +5587,7 @@ e_msg_composer_get_send_html (EMsgComposer *composer) EMsgComposerPrivate *p = composer->priv; g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), FALSE); - + return p->send_html; } @@ -5603,11 +5603,11 @@ e_msg_composer_get_preferred_account (EMsgComposer *composer) { EMsgComposerPrivate *p = composer->priv; EMsgComposerHdrs *hdrs; - + g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), NULL); - + hdrs = E_MSG_COMPOSER_HDRS (p->hdrs); - + return hdrs->account; } @@ -5616,7 +5616,7 @@ e_msg_composer_get_preferred_account (EMsgComposer *composer) * e_msg_composer_set_pgp_sign: * @composer: A message composer widget * @send_html: Whether the composer should have the "PGP Sign" flag set - * + * * Set the status of the "PGP Sign" toggle item. The user can override it. **/ void @@ -5624,15 +5624,15 @@ e_msg_composer_set_pgp_sign (EMsgComposer *composer, gboolean pgp_sign) { EMsgComposerPrivate *p = composer->priv; g_return_if_fail (E_IS_MSG_COMPOSER (composer)); - + if (p->pgp_sign && pgp_sign) return; if (!p->pgp_sign && !pgp_sign) return; - + p->pgp_sign = pgp_sign; e_msg_composer_set_changed (composer); - + bonobo_ui_component_set_prop (p->uic, "/commands/SecurityPGPSign", "state", p->pgp_sign ? "1" : "0", NULL); } @@ -5641,9 +5641,9 @@ e_msg_composer_set_pgp_sign (EMsgComposer *composer, gboolean pgp_sign) /** * e_msg_composer_get_pgp_sign: * @composer: A message composer widget - * + * * Get the status of the "PGP Sign" flag. - * + * * Return value: The status of the "PGP Sign" flag. **/ gboolean @@ -5651,7 +5651,7 @@ e_msg_composer_get_pgp_sign (EMsgComposer *composer) { EMsgComposerPrivate *p = composer->priv; g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), FALSE); - + return p->pgp_sign; } @@ -5660,7 +5660,7 @@ e_msg_composer_get_pgp_sign (EMsgComposer *composer) * e_msg_composer_set_pgp_encrypt: * @composer: A message composer widget * @send_html: Whether the composer should have the "PGP Encrypt" flag set - * + * * Set the status of the "PGP Encrypt" toggle item. The user can override it. **/ void @@ -5668,15 +5668,15 @@ e_msg_composer_set_pgp_encrypt (EMsgComposer *composer, gboolean pgp_encrypt) { EMsgComposerPrivate *p = composer->priv; g_return_if_fail (E_IS_MSG_COMPOSER (composer)); - + if (p->pgp_encrypt && pgp_encrypt) return; if (!p->pgp_encrypt && !pgp_encrypt) return; - + p->pgp_encrypt = pgp_encrypt; e_msg_composer_set_changed (composer); - + bonobo_ui_component_set_prop (p->uic, "/commands/SecurityPGPEncrypt", "state", p->pgp_encrypt ? "1" : "0", NULL); } @@ -5685,9 +5685,9 @@ e_msg_composer_set_pgp_encrypt (EMsgComposer *composer, gboolean pgp_encrypt) /** * e_msg_composer_get_pgp_encrypt: * @composer: A message composer widget - * + * * Get the status of the "PGP Encrypt" flag. - * + * * Return value: The status of the "PGP Encrypt" flag. **/ gboolean @@ -5695,7 +5695,7 @@ e_msg_composer_get_pgp_encrypt (EMsgComposer *composer) { EMsgComposerPrivate *p = composer->priv; g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), FALSE); - + return p->pgp_encrypt; } @@ -5704,7 +5704,7 @@ e_msg_composer_get_pgp_encrypt (EMsgComposer *composer) * e_msg_composer_set_smime_sign: * @composer: A message composer widget * @send_html: Whether the composer should have the "S/MIME Sign" flag set - * + * * Set the status of the "S/MIME Sign" toggle item. The user can override it. **/ void @@ -5712,13 +5712,13 @@ e_msg_composer_set_smime_sign (EMsgComposer *composer, gboolean smime_sign) { EMsgComposerPrivate *p = composer->priv; g_return_if_fail (E_IS_MSG_COMPOSER (composer)); - + if (p->smime_sign && smime_sign) return; if (!p->smime_sign && !smime_sign) return; - - p->smime_sign = smime_sign; + + p->smime_sign = smime_sign; e_msg_composer_set_changed (composer); bonobo_ui_component_set_prop (p->uic, "/commands/SecuritySMimeSign", @@ -5729,9 +5729,9 @@ e_msg_composer_set_smime_sign (EMsgComposer *composer, gboolean smime_sign) /** * e_msg_composer_get_smime_sign: * @composer: A message composer widget - * + * * Get the status of the "S/MIME Sign" flag. - * + * * Return value: The status of the "S/MIME Sign" flag. **/ gboolean @@ -5739,7 +5739,7 @@ e_msg_composer_get_smime_sign (EMsgComposer *composer) { EMsgComposerPrivate *p = composer->priv; g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), FALSE); - + return p->smime_sign; } @@ -5748,7 +5748,7 @@ e_msg_composer_get_smime_sign (EMsgComposer *composer) * e_msg_composer_set_smime_encrypt: * @composer: A message composer widget * @send_html: Whether the composer should have the "S/MIME Encrypt" flag set - * + * * Set the status of the "S/MIME Encrypt" toggle item. The user can override it. **/ void @@ -5756,15 +5756,15 @@ e_msg_composer_set_smime_encrypt (EMsgComposer *composer, gboolean smime_encrypt { EMsgComposerPrivate *p = composer->priv; g_return_if_fail (E_IS_MSG_COMPOSER (composer)); - + if (p->smime_encrypt && smime_encrypt) return; if (!p->smime_encrypt && !smime_encrypt) return; - + p->smime_encrypt = smime_encrypt; e_msg_composer_set_changed (composer); - + bonobo_ui_component_set_prop (p->uic, "/commands/SecuritySMimeEncrypt", "state", p->smime_encrypt ? "1" : "0", NULL); } @@ -5773,9 +5773,9 @@ e_msg_composer_set_smime_encrypt (EMsgComposer *composer, gboolean smime_encrypt /** * e_msg_composer_get_smime_encrypt: * @composer: A message composer widget - * + * * Get the status of the "S/MIME Encrypt" flag. - * + * * Return value: The status of the "S/MIME Encrypt" flag. **/ gboolean @@ -5783,7 +5783,7 @@ e_msg_composer_get_smime_encrypt (EMsgComposer *composer) { EMsgComposerPrivate *p = composer->priv; g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), FALSE); - + return p->smime_encrypt; } @@ -5791,9 +5791,9 @@ e_msg_composer_get_smime_encrypt (EMsgComposer *composer) /** * e_msg_composer_get_view_from: * @composer: A message composer widget - * + * * Get the status of the "View From header" flag. - * + * * Return value: The status of the "View From header" flag. **/ gboolean @@ -5801,7 +5801,7 @@ e_msg_composer_get_view_from (EMsgComposer *composer) { EMsgComposerPrivate *p = composer->priv; g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), FALSE); - + return p->view_from; } @@ -5818,21 +5818,21 @@ e_msg_composer_set_view_from (EMsgComposer *composer, gboolean view_from) { EMsgComposerPrivate *p = composer->priv; GConfClient *gconf; - + g_return_if_fail (E_IS_MSG_COMPOSER (composer)); - + if ((p->view_from && view_from) || (!p->view_from && !view_from)) return; - + p->view_from = view_from; bonobo_ui_component_set_prop (p->uic, "/commands/ViewFrom", "state", p->view_from ? "1" : "0", NULL); - + gconf = gconf_client_get_default (); gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/From", view_from, NULL); g_object_unref (gconf); - + e_msg_composer_hdrs_set_visible (E_MSG_COMPOSER_HDRS (p->hdrs), e_msg_composer_get_visible_flags (composer)); } @@ -5851,7 +5851,7 @@ e_msg_composer_get_view_replyto (EMsgComposer *composer) { EMsgComposerPrivate *p = composer->priv; g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), FALSE); - + return p->view_replyto; } @@ -5868,22 +5868,22 @@ e_msg_composer_set_view_replyto (EMsgComposer *composer, gboolean view_replyto) { EMsgComposerPrivate *p = composer->priv; GConfClient *gconf; - + g_return_if_fail (E_IS_MSG_COMPOSER (composer)); - + if ((p->view_replyto && view_replyto) || (!p->view_replyto && !view_replyto)) return; - + p->view_replyto = view_replyto; bonobo_ui_component_set_prop (p->uic, "/commands/ViewReplyTo", "state", p->view_replyto ? "1" : "0", NULL); - + /* we do this /only/ if the fields is in the visible_mask */ gconf = gconf_client_get_default (); gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/ReplyTo", view_replyto, NULL); g_object_unref (gconf); - + e_msg_composer_hdrs_set_visible (E_MSG_COMPOSER_HDRS (p->hdrs), e_msg_composer_get_visible_flags (composer)); } @@ -5902,7 +5902,7 @@ e_msg_composer_get_view_to (EMsgComposer *composer) { EMsgComposerPrivate *p = composer->priv; g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), FALSE); - + return p->view_to; } @@ -5919,23 +5919,23 @@ e_msg_composer_set_view_to (EMsgComposer *composer, gboolean view_to) { EMsgComposerPrivate *p = composer->priv; GConfClient *gconf; - + g_return_if_fail (E_IS_MSG_COMPOSER (composer)); - + if ((p->view_to && view_to) || (!p->view_to && !view_to)) return; - + p->view_to = view_to; bonobo_ui_component_set_prop (p->uic, "/commands/ViewTo", "state", p->view_to ? "1" : "0", NULL); - + if ((E_MSG_COMPOSER_HDRS(p->hdrs))->visible_mask & E_MSG_COMPOSER_VISIBLE_TO) { gconf = gconf_client_get_default (); gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/To", view_to, NULL); g_object_unref (gconf); } - + e_msg_composer_hdrs_set_visible (E_MSG_COMPOSER_HDRS (p->hdrs), e_msg_composer_get_visible_flags (composer)); } @@ -5955,7 +5955,7 @@ e_msg_composer_get_view_postto (EMsgComposer *composer) { EMsgComposerPrivate *p = composer->priv; g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), FALSE); - + return p->view_postto; } @@ -5972,23 +5972,23 @@ e_msg_composer_set_view_postto (EMsgComposer *composer, gboolean view_postto) { GConfClient *gconf; EMsgComposerPrivate *p = composer->priv; - + g_return_if_fail (E_IS_MSG_COMPOSER (composer)); - + if ((p->view_postto && view_postto) || (!p->view_postto && !view_postto)) return; - + p->view_postto = view_postto; bonobo_ui_component_set_prop (p->uic, "/commands/ViewPostTo", "state", p->view_postto ? "1" : "0", NULL); - + if ((E_MSG_COMPOSER_HDRS(p->hdrs))->visible_mask & E_MSG_COMPOSER_VISIBLE_POSTTO) { gconf = gconf_client_get_default (); gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/PostTo", view_postto, NULL); g_object_unref (gconf); } - + e_msg_composer_hdrs_set_visible (E_MSG_COMPOSER_HDRS (p->hdrs), e_msg_composer_get_visible_flags (composer)); } @@ -5998,9 +5998,9 @@ e_msg_composer_set_view_postto (EMsgComposer *composer, gboolean view_postto) /** * e_msg_composer_get_view_cc: * @composer: A message composer widget - * + * * Get the status of the "View CC header" flag. - * + * * Return value: The status of the "View CC header" flag. **/ gboolean @@ -6008,7 +6008,7 @@ e_msg_composer_get_view_cc (EMsgComposer *composer) { EMsgComposerPrivate *p = composer->priv; g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), FALSE); - + return p->view_cc; } @@ -6025,23 +6025,23 @@ e_msg_composer_set_view_cc (EMsgComposer *composer, gboolean view_cc) { GConfClient *gconf; EMsgComposerPrivate *p = composer->priv; - + g_return_if_fail (E_IS_MSG_COMPOSER (composer)); - + if ((p->view_cc && view_cc) || (!p->view_cc && !view_cc)) return; - + p->view_cc = view_cc; bonobo_ui_component_set_prop (p->uic, "/commands/ViewCC", "state", p->view_cc ? "1" : "0", NULL); - + if ((E_MSG_COMPOSER_HDRS (p->hdrs))->visible_mask & E_MSG_COMPOSER_VISIBLE_CC) { gconf = gconf_client_get_default (); gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/Cc", view_cc, NULL); g_object_unref (gconf); } - + e_msg_composer_hdrs_set_visible (E_MSG_COMPOSER_HDRS (p->hdrs), e_msg_composer_get_visible_flags (composer)); } @@ -6051,9 +6051,9 @@ e_msg_composer_set_view_cc (EMsgComposer *composer, gboolean view_cc) /** * e_msg_composer_get_view_bcc: * @composer: A message composer widget - * + * * Get the status of the "View BCC header" flag. - * + * * Return value: The status of the "View BCC header" flag. **/ gboolean @@ -6062,7 +6062,7 @@ e_msg_composer_get_view_bcc (EMsgComposer *composer) EMsgComposerPrivate *p = composer->priv; g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), FALSE); - + return p->view_bcc; } @@ -6079,23 +6079,23 @@ e_msg_composer_set_view_bcc (EMsgComposer *composer, gboolean view_bcc) { GConfClient *gconf; EMsgComposerPrivate *p = composer->priv; - + g_return_if_fail (E_IS_MSG_COMPOSER (composer)); - + if ((p->view_bcc && view_bcc) || (!p->view_bcc && !view_bcc)) return; - + p->view_bcc = view_bcc; bonobo_ui_component_set_prop (p->uic, "/commands/ViewBCC", "state", p->view_bcc ? "1" : "0", NULL); - + if ((E_MSG_COMPOSER_HDRS (p->hdrs))->visible_mask & E_MSG_COMPOSER_VISIBLE_BCC) { gconf = gconf_client_get_default (); gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/Bcc", view_bcc, NULL); g_object_unref (gconf); } - + e_msg_composer_hdrs_set_visible (E_MSG_COMPOSER_HDRS (p->hdrs), e_msg_composer_get_visible_flags (composer)); } @@ -6105,9 +6105,9 @@ e_msg_composer_set_view_bcc (EMsgComposer *composer, gboolean view_bcc) /** * e_msg_composer_get_request_receipt * @composer: A message composer widget - * + * * Get the status of the "Request receipt" flag. - * + * * Return value: The status of the "Request receipt" flag. **/ gboolean @@ -6115,7 +6115,7 @@ e_msg_composer_get_request_receipt (EMsgComposer *composer) { EMsgComposerPrivate *p = composer->priv; g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), FALSE); - + return p->request_receipt; } @@ -6132,11 +6132,11 @@ e_msg_composer_set_request_receipt (EMsgComposer *composer, gboolean request_rec { EMsgComposerPrivate *p = composer->priv; g_return_if_fail (E_IS_MSG_COMPOSER (composer)); - + if ((p->request_receipt && request_receipt) || (!p->request_receipt && !request_receipt)) return; - + p->request_receipt = request_receipt; bonobo_ui_component_set_prop (p->uic, "/commands/RequestReceipt", "state", p->request_receipt ? "1" : "0", NULL); @@ -6146,9 +6146,9 @@ e_msg_composer_set_request_receipt (EMsgComposer *composer, gboolean request_rec /** * e_msg_composer_get_priority * @composer: A message composer widget - * + * * Get the status of the "Priority" flag. - * + * * Return value: The status of the "Priority" flag. **/ gboolean @@ -6156,7 +6156,7 @@ e_msg_composer_get_priority (EMsgComposer *composer) { EMsgComposerPrivate *p = composer->priv; g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), FALSE); - + return p->set_priority; } @@ -6173,11 +6173,11 @@ e_msg_composer_set_priority (EMsgComposer *composer, gboolean set_priority) { EMsgComposerPrivate *p = composer->priv; g_return_if_fail (E_IS_MSG_COMPOSER (composer)); - + if ((p->set_priority && set_priority) || (!p->set_priority && !set_priority)) return; - + p->set_priority= set_priority; bonobo_ui_component_set_prop (p->uic, "/commands/SetPriority", "state", p->set_priority ? "1" : "0", NULL); @@ -6197,7 +6197,7 @@ e_msg_composer_get_to (EMsgComposer *composer) { EMsgComposerPrivate *p = composer->priv; g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), NULL); - + return p->hdrs ? e_msg_composer_hdrs_get_to (E_MSG_COMPOSER_HDRS (p->hdrs)) : NULL; } @@ -6206,7 +6206,7 @@ e_msg_composer_get_cc (EMsgComposer *composer) { EMsgComposerPrivate *p = composer->priv; g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), NULL); - + return p->hdrs ? e_msg_composer_hdrs_get_cc (E_MSG_COMPOSER_HDRS (p->hdrs)) : NULL; } @@ -6215,7 +6215,7 @@ e_msg_composer_get_bcc (EMsgComposer *composer) { EMsgComposerPrivate *p = composer->priv; g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), NULL); - + return p->hdrs ? e_msg_composer_hdrs_get_bcc (E_MSG_COMPOSER_HDRS (p->hdrs)) : NULL; } @@ -6224,7 +6224,7 @@ e_msg_composer_get_subject (EMsgComposer *composer) { EMsgComposerPrivate *p = composer->priv; g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), NULL); - + return p->hdrs ? e_msg_composer_hdrs_get_subject (E_MSG_COMPOSER_HDRS (p->hdrs)) : NULL; } @@ -6268,7 +6268,7 @@ e_msg_composer_set_changed (EMsgComposer *composer) { EMsgComposerPrivate *p = composer->priv; g_return_if_fail (E_IS_MSG_COMPOSER (composer)); - + p->has_changed = TRUE; } @@ -6285,7 +6285,7 @@ e_msg_composer_unset_changed (EMsgComposer *composer) { EMsgComposerPrivate *p = composer->priv; g_return_if_fail (E_IS_MSG_COMPOSER (composer)); - + p->has_changed = FALSE; } @@ -6295,7 +6295,7 @@ e_msg_composer_is_dirty (EMsgComposer *composer) EMsgComposerPrivate *p = composer->priv; CORBA_Environment ev; gboolean rv; - + CORBA_exception_init (&ev); rv = p->has_changed || (GNOME_GtkHTML_Editor_Engine_hasUndo (p->eeditor_engine, &ev) && @@ -6334,13 +6334,13 @@ e_msg_composer_unset_autosaved (EMsgComposer *composer) { EMsgComposerPrivate *p = composer->priv; g_return_if_fail (E_IS_MSG_COMPOSER (composer)); - + p->autosaved = FALSE; } /** * e_msg_composer_get_raw_message_text: - * + * * Returns the text/plain of the message from composer **/ const gchar * @@ -6388,7 +6388,7 @@ e_msg_composer_drop_editor_undo (EMsgComposer *composer) { EMsgComposerPrivate *p = composer->priv; CORBA_Environment ev; - + CORBA_exception_init (&ev); GNOME_GtkHTML_Editor_Engine_dropUndo (p->eeditor_engine, &ev); CORBA_exception_free (&ev); @@ -6429,7 +6429,7 @@ e_msg_composer_show_attachments_ui (EMsgComposer *composer) { EMsgComposerPrivate *p = composer->priv; - if (e_attachment_bar_get_num_attachments(E_ATTACHMENT_BAR(p->attachment_bar))) + if (e_attachment_bar_get_num_attachments(E_ATTACHMENT_BAR(p->attachment_bar))) show_attachments (composer, TRUE); } @@ -6437,7 +6437,7 @@ void e_msg_composer_set_alternative (EMsgComposer *composer, gboolean alt) { EMsgComposerPrivate *p = composer->priv; - + p->is_alternative = alt; p->send_html = !alt; } @@ -6447,9 +6447,9 @@ e_msg_composer_reply_indent (EMsgComposer *composer) { EMsgComposerPrivate *p = composer->priv; CORBA_Environment ev; - + CORBA_exception_init (&ev); - + if (!GNOME_GtkHTML_Editor_Engine_isParagraphEmpty (p->eeditor_engine, &ev)) { if (GNOME_GtkHTML_Editor_Engine_isPreviousParagraphEmpty (p->eeditor_engine, &ev)) GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "cursor-backward", &ev); @@ -6465,7 +6465,7 @@ e_msg_composer_reply_indent (EMsgComposer *composer) GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "indent-zero", &ev); GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "text-default-color", &ev); GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "italic-off", &ev); - + CORBA_exception_free (&ev); } @@ -6475,9 +6475,9 @@ e_msg_composer_insert_paragraph_before (EMsgComposer *composer) { EMsgComposerPrivate *p = composer->priv; CORBA_Environment ev; - + CORBA_exception_init (&ev); - + if (!p->in_signature_insert) { CORBA_char *orig, *signature; gboolean changed = FALSE; @@ -6504,7 +6504,7 @@ e_msg_composer_insert_paragraph_before (EMsgComposer *composer) } } } - + CORBA_exception_free (&ev); } @@ -6527,14 +6527,14 @@ e_msg_composer_insert_paragraph_after (EMsgComposer *composer) { EMsgComposerPrivate *p = composer->priv; CORBA_Environment ev; - + CORBA_exception_init (&ev); - + if (!p->in_signature_insert) { CORBA_char *orig, *signature; /* FIXME check for insert-paragraph command */ GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "italic-off", &ev); - + orig = GNOME_GtkHTML_Editor_Engine_getParagraphData (p->eeditor_engine, "orig", &ev); if (ev._major == CORBA_NO_EXCEPTION) { if (orig && *orig == '1') @@ -6549,7 +6549,7 @@ e_msg_composer_insert_paragraph_after (EMsgComposer *composer) CORBA_free (signature); } } - + CORBA_exception_free (&ev); } @@ -6558,13 +6558,13 @@ e_msg_composer_delete (EMsgComposer *composer) { EMsgComposerPrivate *p = composer->priv; CORBA_Environment ev; - + CORBA_exception_init (&ev); - + if (GNOME_GtkHTML_Editor_Engine_isParagraphEmpty (p->eeditor_engine, &ev)) { CORBA_char *orig; CORBA_char *signature; - + orig = GNOME_GtkHTML_Editor_Engine_getParagraphData (p->eeditor_engine, "orig", &ev); if (ev._major == CORBA_NO_EXCEPTION) { if (orig && *orig == '1') { @@ -6621,7 +6621,7 @@ e_msg_composer_url_requested (EMsgComposer *composer, gchar *url) { EMsgComposerPrivate *p = composer->priv; CamelMimePart *part = NULL; - + part = g_hash_table_lookup (p->inline_images_by_url, url); if (!part) part = g_hash_table_lookup (p->inline_images, url); @@ -6663,7 +6663,7 @@ e_msg_composer_set_saved (EMsgComposer *composer) { CORBA_Environment ev; EMsgComposerPrivate *p = composer->priv; - + CORBA_exception_init (&ev); GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "saved", &ev); CORBA_exception_free (&ev); @@ -6674,6 +6674,6 @@ e_msg_composer_set_send_options (EMsgComposer *composer, gboolean send_enable) { EMsgComposerPrivate *priv; priv = composer->priv; - - priv->send_invoked = send_enable; -} + + priv->send_invoked = send_enable; +} diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h index a1ab0c1287..d285c0d6f1 100644 --- a/composer/e-msg-composer.h +++ b/composer/e-msg-composer.h @@ -68,7 +68,7 @@ void e_msg_composer_show_attachments_ui (EMsgComposer *composer); void e_msg_composer_set_alternative (EMsgComposer *composer, gboolean alt); - + void e_msg_composer_set_headers (EMsgComposer *composer, const char *from, EDestination **to, @@ -190,7 +190,7 @@ void e_msg_composer_link_clicked (EMsgComposer *composer, const gchar *url EMsgComposerHdrs* e_msg_composer_get_hdrs (EMsgComposer *composer); void e_msg_composer_set_saved (EMsgComposer *composer); -void e_msg_composer_set_send_options (EMsgComposer *composer, +void e_msg_composer_set_send_options (EMsgComposer *composer, gboolean send_enable); const gchar * e_msg_composer_get_raw_message_text (EMsgComposer *composer); diff --git a/composer/evolution-composer.c b/composer/evolution-composer.c index adfc0bb1ef..5c20c3a6aa 100644 --- a/composer/evolution-composer.c +++ b/composer/evolution-composer.c @@ -69,7 +69,7 @@ corba_recipientlist_to_destv (const GNOME_Evolution_Composer_RecipientList *cl) if (*recip->name) e_destination_set_name (destv[i], recip->name); e_destination_set_email (destv[i], recip->address); - + } destv[cl->_length] = NULL; @@ -92,38 +92,38 @@ impl_Composer_set_headers (PortableServer_Servant servant, EAccount *account; EIterator *iter; int found = 0; - + bonobo_object = bonobo_object_from_servant (servant); composer = EVOLUTION_COMPOSER (bonobo_object); - + account = mail_config_get_account_by_name (from); if (!account) { accounts = mail_config_get_accounts (); iter = e_list_get_iterator ((EList *) accounts); while (e_iterator_is_valid (iter)) { account = (EAccount *) e_iterator_get (iter); - + if (!g_ascii_strcasecmp (account->id->address, from)) { found = TRUE; break; } - + e_iterator_next (iter); } - + g_object_unref (iter); - + if (!found) account = mail_config_get_default_account (); } - + tov = corba_recipientlist_to_destv (to); ccv = corba_recipientlist_to_destv (cc); bccv = corba_recipientlist_to_destv (bcc); - + e_msg_composer_set_headers (composer->composer, account->name, tov, ccv, bccv, subject); - + e_destination_freev (tov); e_destination_freev (ccv); e_destination_freev (bccv); @@ -159,7 +159,7 @@ impl_Composer_set_body (PortableServer_Servant servant, if (!g_ascii_strcasecmp (mime_type, "text/plain")) { char *htmlbody = camel_text_to_html (body, CAMEL_MIME_FILTER_TOHTML_PRE, 0); - + e_msg_composer_set_body_text (composer->composer, htmlbody, -1); g_free (htmlbody); } else if (!g_ascii_strcasecmp (mime_type, "text/html")) @@ -330,20 +330,20 @@ enum_objects (BonoboItemHandler *handler, gpointer data, CORBA_Environment *ev) } #endif -static Bonobo_Unknown +static Bonobo_Unknown get_object (BonoboItemHandler *h, const char *item_name, gboolean only_if_exists, gpointer data, CORBA_Environment *ev) { EvolutionComposer *composer = data; GSList *options, *l; - + options = bonobo_item_option_parse (item_name); for (l = options; l; l = l->next){ BonoboItemOption *option = l->data; if (strcmp (option->key, "visible") == 0){ gboolean show = 1; - + if (option->value) show = atoi (option->value); @@ -362,7 +362,7 @@ evolution_composer_construct (EvolutionComposer *composer, GNOME_Evolution_Composer corba_object) { BonoboObject *item_handler; - + g_return_if_fail (composer != NULL); g_return_if_fail (EVOLUTION_IS_COMPOSER (composer)); g_return_if_fail (corba_object != CORBA_OBJECT_NIL); diff --git a/composer/listener.c b/composer/listener.c index 9bfd11a13d..474ac5f64f 100644 --- a/composer/listener.c +++ b/composer/listener.c @@ -7,12 +7,12 @@ This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, @@ -83,7 +83,7 @@ impl_event (PortableServer_Servant _servant, } } else if (!strcmp (name, "image_url")) { gchar *url; - + if ((url = e_msg_composer_resolve_image_url (l->composer, BONOBO_ARG_GET_STRING (arg)))) { rv = bonobo_arg_new (BONOBO_ARG_STRING); BONOBO_ARG_SET_STRING (rv, url); @@ -92,22 +92,22 @@ impl_event (PortableServer_Servant _servant, } } else if (!strcmp (name, "delete")) { e_msg_composer_delete (l->composer); - + } else if (!strcmp (name, "url_requested")) { GNOME_GtkHTML_Editor_URLRequestEvent *e = arg->_value; CamelMimePart *part; GByteArray *ba; CamelStream *cstream; CamelDataWrapper *wrapper; - + if (!e->url || e->stream == CORBA_OBJECT_NIL) return get_any_null (); part = e_msg_composer_url_requested (l->composer, e->url); - + if (!part) return get_any_null (); - + /* Write the data to a CamelStreamMem... */ ba = g_byte_array_new (); cstream = camel_stream_mem_new_with_byte_array (ba); @@ -116,7 +116,7 @@ impl_event (PortableServer_Servant _servant, bonobo_stream_client_write (e->stream, ba->data, ba->len, ev); camel_object_unref (cstream); - + } else if (!strcmp (name, "link_clicked")) { e_msg_composer_link_clicked (l->composer, BONOBO_ARG_GET_STRING (arg)); } @@ -149,6 +149,6 @@ listener_new (EMsgComposer *composer) listener = g_object_new (EDITOR_LISTENER_TYPE, NULL); listener->composer = composer; - + return listener; } diff --git a/composer/listener.h b/composer/listener.h index a66d707ffd..d9f13454c0 100644 --- a/composer/listener.h +++ b/composer/listener.h @@ -7,12 +7,12 @@ This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |