static gboolean compose_edit_size_alloc (GtkEditable *widget,
GtkAllocation *allocation,
GtkSHRuler *shruler);
-static void account_activated (GtkComboBox *optmenu,
- gpointer data);
static void attach_selected (GtkTreeView *tree_view,
GtkTreePath *tree_path,
GtkTreeViewColumn *column,
if (msginfo->msgid && *msginfo->msgid)
compose->msgid = g_strdup(msginfo->msgid);
-
- if (msginfo->references != NULL) {
- GString *refs = g_string_new(NULL);
- GSList *r = msginfo->references;
- while (r != NULL) {
- g_string_append_printf(refs, "<%s>%s", (gchar *)r->data,
- (g_slist_next(r) ? "\n\t" : ""));
- r = g_slist_next(r);
- }
- }
} else {
if (msginfo->msgid && *msginfo->msgid)
compose->inreplyto = g_strdup(msginfo->msgid);
mimemsg->tmp = TRUE; /* must free content later */
mimemsg->data.mem = compose_get_header(compose);
- debug_print(mimemsg->data.mem);
-
/* Create text part MimeInfo */
/* get all composed text */
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(compose->text));
privacy_system_can_sign(compose->privacy_system)) {
encoding = ENC_QUOTED_PRINTABLE;
}
-
+
+#ifdef G_OS_WIN32
+ debug_print("main text: %Id bytes encoded as %s in %d\n",
+#else
debug_print("main text: %zd bytes encoded as %s in %d\n",
+#endif
strlen(buf), out_codeset, encoding);
/* check for line length limit */
gtk_combo_box_set_active(GTK_COMBO_BOX(optmenu), def_menu);
- g_signal_connect(G_OBJECT(optmenu), "changed",
- G_CALLBACK(account_activated),
- compose);
g_signal_connect(G_OBJECT(from_name), "populate-popup",
G_CALLBACK(compose_entry_popup_extend),
NULL);
gboolean entry_marked;
} HeaderEntryState;
-static void account_activated(GtkComboBox *optmenu, gpointer data)
-{
- Compose *compose = (Compose *)data;
-
- PrefsAccount *ac;
- gchar *folderidentifier;
- gint account_id = 0;
- GtkTreeModel *menu;
- GtkTreeIter iter;
- GSList *list, *saved_list = NULL;
- HeaderEntryState *state;
- GtkRcStyle *style = NULL;
-#if !GTK_CHECK_VERSION(3, 0, 0)
- static GdkColor yellow;
- static gboolean color_set = FALSE;
-#else
- static GdkColor yellow = { (guint32)0, (guint32)0xf5, (guint32)0xf6, (guint32)0xbe };
-#endif
-
- /* Get ID of active account in the combo box */
- menu = gtk_combo_box_get_model(optmenu);
- cm_return_if_fail(gtk_combo_box_get_active_iter(optmenu, &iter));
- gtk_tree_model_get(menu, &iter, 1, &account_id, -1);
-
- ac = account_find_from_id(account_id);
- cm_return_if_fail(ac != NULL);
-
- if (ac != compose->account) {
- compose_select_account(compose, ac, FALSE);
-
- for (list = compose->header_list; list; list = list->next) {
- ComposeHeaderEntry *hentry=(ComposeHeaderEntry *)list->data;
-
- if (hentry->type == PREF_ACCOUNT || !list->next) {
- compose_destroy_headerentry(compose, hentry);
- continue;
- }
-
- state = g_malloc0(sizeof(HeaderEntryState));
- state->header = gtk_editable_get_chars(GTK_EDITABLE(
- gtk_bin_get_child(GTK_BIN(hentry->combo))), 0, -1);
- state->entry = gtk_editable_get_chars(
- GTK_EDITABLE(hentry->entry), 0, -1);
- state->type = hentry->type;
-
-#if !GTK_CHECK_VERSION(3, 0, 0)
- if (!color_set) {
- gdk_color_parse("#f5f6be", &yellow);
- color_set = gdk_colormap_alloc_color(
- gdk_colormap_get_system(),
- &yellow, FALSE, TRUE);
- }
-#endif
-
- style = gtk_widget_get_modifier_style(hentry->entry);
- state->entry_marked = gdk_color_equal(&yellow,
- &style->base[GTK_STATE_NORMAL]);
-
- saved_list = g_slist_append(saved_list, state);
- compose_destroy_headerentry(compose, hentry);
- }
-
- compose->header_last = NULL;
- g_slist_free(compose->header_list);
- compose->header_list = NULL;
- compose->header_nextrow = 1;
- compose_create_header_entry(compose);
-
- if (ac->set_autocc && ac->auto_cc)
- compose_entry_append(compose, ac->auto_cc,
- COMPOSE_CC, PREF_ACCOUNT);
-
- if (ac->set_autobcc && ac->auto_bcc)
- compose_entry_append(compose, ac->auto_bcc,
- COMPOSE_BCC, PREF_ACCOUNT);
-
- if (ac->set_autoreplyto && ac->auto_replyto)
- compose_entry_append(compose, ac->auto_replyto,
- COMPOSE_REPLYTO, PREF_ACCOUNT);
-
- for (list = saved_list; list; list = list->next) {
- state = (HeaderEntryState *) list->data;
-
- compose_add_header_entry(compose, state->header,
- state->entry, state->type);
- if (state->entry_marked)
- compose_entry_mark_default_to(compose, state->entry);
-
- g_free(state->header);
- g_free(state->entry);
- g_free(state);
- }
- g_slist_free(saved_list);
-
- combobox_select_by_data(GTK_COMBO_BOX(compose->header_last->combo),
- (ac->protocol == A_NNTP) ?
- COMPOSE_NEWSGROUPS : COMPOSE_TO);
- }
-
- /* Set message save folder */
- if (account_get_special_folder(compose->account, F_OUTBOX)) {
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(compose->savemsg_checkbtn), prefs_common.savemsg);
- }
- g_signal_connect(G_OBJECT(compose->savemsg_checkbtn), "toggled",
- G_CALLBACK(compose_savemsg_checkbtn_cb), compose);
-
- compose_set_save_to(compose, NULL);
- if (account_get_special_folder(compose->account, F_OUTBOX)) {
- folderidentifier = folder_item_get_identifier(account_get_special_folder
- (compose->account, F_OUTBOX));
- compose_set_save_to(compose, folderidentifier);
- g_free(folderidentifier);
- }
-}
-
static void attach_selected(GtkTreeView *tree_view, GtkTreePath *tree_path,
GtkTreeViewColumn *column, Compose *compose)
{
Compose *compose = (Compose *)user_data;
GList *list, *tmp;
GdkAtom type;
+ guint num_files;
+ gchar *msg;
/* strangely, testing data->type == gdk_atom_intern("text/uri-list", TRUE)
* does not work */
const gchar* ddata = (const gchar *)gtk_selection_data_get_data(data);
list = uri_list_extract_filenames(ddata);
+ num_files = g_list_length(list);
if (list == NULL && strstr(ddata, "://")) {
/* Assume a list of no files, and data has ://, is a remote link */
gchar *tmpdata = g_strstrip(g_strdup(ddata));
}
switch (prefs_common.compose_dnd_mode) {
case COMPOSE_DND_ASK:
- val = alertpanel_full(_("Insert or attach?"),
- _("Do you want to insert the contents of the file(s) "
- "into the message body, or attach it to the email?"),
+ msg = g_strdup_printf(
+ ngettext(
+ "Do you want to insert the contents of the file "
+ "into the message body, or attach it to the email?",
+ "Do you want to insert the contents of the %d files "
+ "into the message body, or attach them to the email?",
+ num_files),
+ num_files);
+ val = alertpanel_full(_("Insert or attach?"), msg,
GTK_STOCK_CANCEL, g_strconcat("+", _("_Insert"), NULL), _("_Attach"),
TRUE, NULL, ALERT_QUESTION, G_ALERTALTERNATE);
+ g_free(msg);
break;
case COMPOSE_DND_INSERT:
val = G_ALERTALTERNATE;
if (msginfo->folder->prefs->enable_default_account)
account = account_find_from_id(msginfo->folder->prefs->default_account);
- if (!account)
- account = msginfo->folder->folder->account;
-
if (!account && msginfo->to && prefs_common.forward_account_autosel) {
gchar *to;
Xstrdup_a(to, msginfo->to, return NULL);
account = account_find_from_address(buf, FALSE);
}
}
+
+ if (!account)
+ account = msginfo->folder->folder->account;
return account;
}