static gint compose_remove_reedit_target (Compose *compose,
gboolean force);
static void compose_remove_draft (Compose *compose);
-static gint compose_queue_sub (Compose *compose,
+static ComposeQueueResult compose_queue_sub (Compose *compose,
gint *msgnum,
FolderItem **item,
gchar **msgpath,
{
GtkTextBuffer *buffer;
GdkColor black = {(gulong)0, (gushort)0, (gushort)0, (gushort)0};
-#if !GTK_CHECK_VERSION(2, 24, 0)
- GdkColormap *cmap;
- gboolean success[8];
- int i;
- GdkColor color[8];
-#endif
buffer = gtk_text_view_get_buffer(text);
if (prefs_common.enable_color) {
/* grab the quote colors, converting from an int to a GdkColor */
- gtkut_convert_int_to_gdk_color(prefs_common.quote_level1_col,
+ gtkut_convert_int_to_gdk_color(prefs_common.color[COL_QUOTE_LEVEL1],
"e_color1);
- gtkut_convert_int_to_gdk_color(prefs_common.quote_level2_col,
+ gtkut_convert_int_to_gdk_color(prefs_common.color[COL_QUOTE_LEVEL2],
"e_color2);
- gtkut_convert_int_to_gdk_color(prefs_common.quote_level3_col,
+ gtkut_convert_int_to_gdk_color(prefs_common.color[COL_QUOTE_LEVEL3],
"e_color3);
- gtkut_convert_int_to_gdk_color(prefs_common.quote_level1_bgcol,
+ gtkut_convert_int_to_gdk_color(prefs_common.color[COL_QUOTE_LEVEL1_BG],
"e_bgcolor1);
- gtkut_convert_int_to_gdk_color(prefs_common.quote_level2_bgcol,
+ gtkut_convert_int_to_gdk_color(prefs_common.color[COL_QUOTE_LEVEL2_BG],
"e_bgcolor2);
- gtkut_convert_int_to_gdk_color(prefs_common.quote_level3_bgcol,
+ gtkut_convert_int_to_gdk_color(prefs_common.color[COL_QUOTE_LEVEL3_BG],
"e_bgcolor3);
- gtkut_convert_int_to_gdk_color(prefs_common.signature_col,
+ gtkut_convert_int_to_gdk_color(prefs_common.color[COL_SIGNATURE],
&signature_color);
- gtkut_convert_int_to_gdk_color(prefs_common.uri_col,
+ gtkut_convert_int_to_gdk_color(prefs_common.color[COL_URI],
&uri_color);
} else {
signature_color = quote_color1 = quote_color2 = quote_color3 =
NULL);
compose->no_wrap_tag = gtk_text_buffer_create_tag(buffer, "no_wrap", NULL);
compose->no_join_tag = gtk_text_buffer_create_tag(buffer, "no_join", NULL);
-
-#if !GTK_CHECK_VERSION(2, 24, 0)
- color[0] = quote_color1;
- color[1] = quote_color2;
- color[2] = quote_color3;
- color[3] = quote_bgcolor1;
- color[4] = quote_bgcolor2;
- color[5] = quote_bgcolor3;
- color[6] = signature_color;
- color[7] = uri_color;
-
- cmap = gdk_drawable_get_colormap(gtk_widget_get_window(compose->window));
- gdk_colormap_alloc_colors(cmap, color, 8, FALSE, TRUE, success);
-
- for (i = 0; i < 8; i++) {
- if (success[i] == FALSE) {
- g_warning("Compose: color allocation failed.");
- quote_color1 = quote_color2 = quote_color3 =
- quote_bgcolor1 = quote_bgcolor2 = quote_bgcolor3 =
- signature_color = uri_color = black;
- }
- }
-#endif
}
Compose *compose_new(PrefsAccount *account, const gchar *mailto,
{
GtkEditable *entry;
if (folderidentifier) {
-#if !GTK_CHECK_VERSION(2, 24, 0)
- combobox_unset_popdown_strings(GTK_COMBO_BOX(compose->savemsg_combo));
-#else
combobox_unset_popdown_strings(GTK_COMBO_BOX_TEXT(compose->savemsg_combo));
-#endif
prefs_common.compose_save_to_history = add_history(
prefs_common.compose_save_to_history, folderidentifier);
-#if !GTK_CHECK_VERSION(2, 24, 0)
- combobox_set_popdown_strings(GTK_COMBO_BOX(compose->savemsg_combo),
- prefs_common.compose_save_to_history);
-#else
combobox_set_popdown_strings(GTK_COMBO_BOX_TEXT(compose->savemsg_combo),
prefs_common.compose_save_to_history);
-#endif
}
entry = GTK_EDITABLE(gtk_bin_get_child(GTK_BIN(compose->savemsg_combo)));
result = gtk_editable_get_chars(entry, 0, -1);
if (result) {
-#if !GTK_CHECK_VERSION(2, 24, 0)
- combobox_unset_popdown_strings(GTK_COMBO_BOX(compose->savemsg_combo));
-#else
combobox_unset_popdown_strings(GTK_COMBO_BOX_TEXT(compose->savemsg_combo));
-#endif
prefs_common.compose_save_to_history = add_history(
prefs_common.compose_save_to_history, result);
-#if !GTK_CHECK_VERSION(2, 24, 0)
- combobox_set_popdown_strings(GTK_COMBO_BOX(compose->savemsg_combo),
- prefs_common.compose_save_to_history);
-#else
combobox_set_popdown_strings(GTK_COMBO_BOX_TEXT(compose->savemsg_combo),
prefs_common.compose_save_to_history);
-#endif
}
return result;
}
"in the message body. Are you sure you want to do that?"),
to_human_readable(size));
aval = alertpanel_full(_("Are you sure?"), msg, GTK_STOCK_CANCEL,
- g_strconcat("+", _("_Insert"), NULL), NULL, TRUE, NULL, ALERT_QUESTION, G_ALERTDEFAULT);
+ _("_Insert"), NULL, ALERTFOCUS_SECOND, TRUE,
+ NULL, ALERT_QUESTION);
g_free(msg);
/* do we ask for confirmation next time? */
if (size == 0 && !compose->batch) {
gchar * msg = g_strdup_printf(_("File %s is empty."), filename);
AlertValue aval = alertpanel_full(_("Empty file"), msg,
- GTK_STOCK_CANCEL, g_strconcat("+", _("_Attach anyway"), NULL), NULL, FALSE,
- NULL, ALERT_WARNING, G_ALERTDEFAULT);
+ GTK_STOCK_CANCEL, _("_Attach anyway"), NULL,
+ ALERTFOCUS_SECOND, FALSE, NULL, ALERT_WARNING);
g_free(msg);
if (aval != G_ALERTALTERNATE) {
{
gchar *from = NULL, *header = NULL;
ComposeHeaderEntry *header_entry;
-#if GTK_CHECK_VERSION(2, 24, 0)
GtkTreeIter iter;
-#endif
cm_return_if_fail(account != NULL);
}
header_entry = (ComposeHeaderEntry *) compose->header_list->data;
-#if !GTK_CHECK_VERSION(2, 24, 0)
- header = gtk_combo_box_get_active_text(GTK_COMBO_BOX(header_entry->combo));
-#else
if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(header_entry->combo), &iter))
gtk_tree_model_get(gtk_combo_box_get_model(GTK_COMBO_BOX(
header_entry->combo)), &iter, COMBOBOX_TEXT, &header, -1);
-#endif
if (header && !strlen(gtk_entry_get_text(GTK_ENTRY(header_entry->entry)))) {
if (account->protocol == A_NNTP) {
prefs_common_translated_header_name("Cc"));
aval = alertpanel(_("Send"),
text,
- GTK_STOCK_CANCEL, g_strconcat("+", _("_Send"), NULL), NULL);
+ GTK_STOCK_CANCEL, _("_Send"), NULL, ALERTFOCUS_SECOND);
g_free(text);
if (aval != G_ALERTALTERNATE)
return FALSE;
prefs_common_translated_header_name("Bcc"));
aval = alertpanel(_("Send"),
text,
- GTK_STOCK_CANCEL, g_strconcat("+", _("_Send"), NULL), NULL);
+ GTK_STOCK_CANCEL, _("_Send"), NULL, ALERTFOCUS_SECOND);
g_free(text);
if (aval != G_ALERTALTERNATE)
return FALSE;
if (*str == '\0' && check_everything == TRUE &&
compose->mode != COMPOSE_REDIRECT) {
AlertValue aval;
- gchar *button_label;
gchar *message;
- if (compose->sending)
- button_label = g_strconcat("+", _("_Send"), NULL);
- else
- button_label = g_strconcat("+", _("_Queue"), NULL);
message = g_strdup_printf(_("Subject is empty. %s"),
compose->sending?_("Send it anyway?"):
_("Queue it anyway?"));
aval = alertpanel_full(compose->sending?_("Send"):_("Send later"), message,
- GTK_STOCK_CANCEL, button_label, NULL, TRUE, NULL,
- ALERT_QUESTION, G_ALERTDEFAULT);
+ GTK_STOCK_CANCEL, compose->sending?_("_Send"):_("_Queue"), NULL,
+ ALERTFOCUS_FIRST, TRUE, NULL, ALERT_QUESTION);
g_free(message);
- g_free(button_label);
if (aval & G_ALERTDISABLE) {
aval &= ~G_ALERTDISABLE;
prefs_common.warn_empty_subj = FALSE;
}
if (cnt > prefs_common.warn_sending_many_recipients_num) {
AlertValue aval;
- gchar *button_label;
gchar *message;
- if (compose->sending)
- button_label = g_strconcat("+", _("_Send"), NULL);
- else
- button_label = g_strconcat("+", _("_Queue"), NULL);
message = g_strdup_printf(_("Sending to %d recipients. %s"), cnt,
compose->sending?_("Send it anyway?"):
_("Queue it anyway?"));
aval = alertpanel_full(compose->sending?_("Send"):_("Send later"), message,
- GTK_STOCK_CANCEL, button_label, NULL, TRUE, NULL,
- ALERT_QUESTION, G_ALERTDEFAULT);
+ GTK_STOCK_CANCEL, compose->sending?_("_Send"):_("_Queue"), NULL,
+ ALERTFOCUS_FIRST, TRUE, NULL, ALERT_QUESTION);
g_free(message);
if (aval & G_ALERTDISABLE) {
aval &= ~G_ALERTDISABLE;
return TRUE;
}
+static void _display_queue_error(ComposeQueueResult val)
+{
+ switch (val) {
+ case COMPOSE_QUEUE_SUCCESS:
+ break;
+ case COMPOSE_QUEUE_ERROR_NO_MSG:
+ alertpanel_error(_("Could not queue message."));
+ break;
+ case COMPOSE_QUEUE_ERROR_WITH_ERRNO:
+ alertpanel_error(_("Could not queue message:\n\n%s."),
+ g_strerror(errno));
+ break;
+ case COMPOSE_QUEUE_ERROR_SIGNING_FAILED:
+ alertpanel_error(_("Could not queue message for sending:\n\n"
+ "Signature failed: %s"),
+ privacy_peek_error() ? privacy_get_error() : _("Unknown error"));
+ break;
+ case COMPOSE_QUEUE_ERROR_ENCRYPT_FAILED:
+ alertpanel_error(_("Could not queue message for sending:\n\n"
+ "Encryption failed: %s"),
+ privacy_peek_error() ? privacy_get_error() : _("Unknown error"));
+ break;
+ case COMPOSE_QUEUE_ERROR_CHAR_CONVERSION:
+ alertpanel_error(_("Could not queue message for sending:\n\n"
+ "Charset conversion failed."));
+ break;
+ case COMPOSE_QUEUE_ERROR_NO_ENCRYPTION_KEY:
+ alertpanel_error(_("Could not queue message for sending:\n\n"
+ "Couldn't get recipient encryption key."));
+ break;
+ default:
+ /* unhandled error */
+ debug_print("oops, unhandled compose_queue() return value %d\n",
+ val);
+ break;
+ }
+}
+
gint compose_send(Compose *compose)
{
gint msgnum;
FolderItem *folder = NULL;
- gint val = -1;
+ ComposeQueueResult val = COMPOSE_QUEUE_ERROR_NO_MSG;
gchar *msgpath = NULL;
gboolean discard_window = FALSE;
gchar *errstr = NULL;
inc_lock();
val = compose_queue(compose, &msgnum, &folder, &msgpath, TRUE);
- if (val) {
+ if (val != COMPOSE_QUEUE_SUCCESS) {
if (compose->batch) {
gtk_widget_show_all(compose->window);
}
- if (val == -4) {
- alertpanel_error(_("Could not queue message for sending:\n\n"
- "Charset conversion failed."));
- } else if (val == -5) {
- alertpanel_error(_("Could not queue message for sending:\n\n"
- "Couldn't get recipient encryption key."));
- } else if (val == -6) {
- /* silent error */
- } else if (val == -3) {
- if (privacy_peek_error())
- alertpanel_error(_("Could not queue message for sending:\n\n"
- "Signature failed: %s"), privacy_get_error());
- } else if (val == -2 && errno != 0) {
- alertpanel_error(_("Could not queue message for sending:\n\n%s."), g_strerror(errno));
- } else {
- alertpanel_error(_("Could not queue message for sending."));
- }
+
+ _display_queue_error(val);
+
goto bail;
}
"to the specified %s charset.\n"
"Send it as %s?"), out_codeset, src_codeset);
aval = alertpanel_full(_("Error"), msg, GTK_STOCK_CANCEL,
- g_strconcat("+", _("_Send"), NULL), NULL, FALSE,
- NULL, ALERT_ERROR, G_ALERTDEFAULT);
+ _("_Send"), NULL, ALERTFOCUS_SECOND, FALSE,
+ NULL, ALERT_ERROR);
g_free(msg);
if (aval != G_ALERTALTERNATE) {
g_free(chars);
- return -3;
+ return COMPOSE_QUEUE_ERROR_CHAR_CONVERSION;
} else {
buf = chars;
out_codeset = src_codeset;
"The contents of the message might be broken on the way to the delivery.\n"
"\n"
"Send it anyway?"), line + 1);
- aval = alertpanel(_("Warning"), msg, GTK_STOCK_CANCEL, GTK_STOCK_OK, NULL);
+ aval = alertpanel(_("Warning"), msg, GTK_STOCK_CANCEL, GTK_STOCK_OK, NULL,
+ ALERTFOCUS_FIRST);
g_free(msg);
if (aval != G_ALERTALTERNATE) {
g_free(buf);
- return -1;
+ return COMPOSE_QUEUE_ERROR_NO_MSG;
}
}
g_node_append(mimemsg->node, mimempart->node);
if (compose_add_attachments(compose, mimempart) < 0)
- return -1;
+ return COMPOSE_QUEUE_ERROR_NO_MSG;
} else
g_node_append(mimemsg->node, mimetext->node);
compose->account, from_addr)) {
g_free(from_name);
g_free(from_addr);
- return -2;
+ return COMPOSE_QUEUE_ERROR_SIGNING_FAILED;
}
g_free(from_name);
g_free(from_addr);
if (!privacy_encrypt(compose->privacy_system, mimemsg, compose->encdata)) {
debug_print("Couldn't encrypt mime structure: %s.\n",
privacy_get_error());
- alertpanel_error(_("Couldn't encrypt the email: %s"),
- privacy_get_error());
+ return COMPOSE_QUEUE_ERROR_ENCRYPT_FAILED;
}
}
}
}
-gint compose_queue(Compose *compose, gint *msgnum, FolderItem **item, gchar **msgpath,
+ComposeQueueResult compose_queue(Compose *compose, gint *msgnum, FolderItem **item, gchar **msgpath,
gboolean remove_reedit_target)
{
return compose_queue_sub (compose, msgnum, item, msgpath, FALSE, remove_reedit_target);
return TRUE;
val = alertpanel_full(_("Encryption warning"), warning,
- GTK_STOCK_CANCEL, g_strconcat("+", _("C_ontinue"), NULL), NULL,
- TRUE, NULL, ALERT_WARNING, G_ALERTALTERNATE);
+ GTK_STOCK_CANCEL, _("C_ontinue"), NULL, ALERTFOCUS_SECOND,
+ TRUE, NULL, ALERT_WARNING);
if (val & G_ALERTDISABLE) {
val &= ~G_ALERTDISABLE;
if (val == G_ALERTALTERNATE)
}
}
-static gint compose_queue_sub(Compose *compose, gint *msgnum, FolderItem **item,
+static ComposeQueueResult compose_queue_sub(Compose *compose, gint *msgnum, FolderItem **item,
gchar **msgpath, gboolean perform_checks,
gboolean remove_reedit_target)
{
if (compose->batch) {
gtk_widget_show_all(compose->window);
}
- return -1;
+ return COMPOSE_QUEUE_ERROR_NO_MSG;
}
if (!compose->to_list && !compose->newsgroup_list) {
g_warning("can't get recipient list.");
- return -1;
+ return COMPOSE_QUEUE_ERROR_NO_MSG;
}
if (compose->to_list) {
mailac = cur_account;
else if (!(mailac = compose_current_mail_account())) {
alertpanel_error(_("No account for sending mails available!"));
- return -1;
+ return COMPOSE_QUEUE_ERROR_NO_MSG;
}
}
newsac = compose->account;
else {
alertpanel_error(_("Selected account isn't NNTP: Posting is impossible."));
- return -1;
+ return COMPOSE_QUEUE_ERROR_NO_MSG;
}
}
if ((fp = g_fopen(tmp, "w+b")) == NULL) {
FILE_OP_ERROR(tmp, "fopen");
g_free(tmp);
- return -2;
+ return COMPOSE_QUEUE_ERROR_WITH_ERRNO;
}
if (change_file_mode_rw(fp, tmp) < 0) {
else
err |= (fprintf(fp, "NSV:\n") < 0);
err |= (fprintf(fp, "SSH:\n") < 0);
- /* write recepient list */
+ /* write recipient list */
if (compose->to_list) {
err |= (fprintf(fp, "R:<%s>", (gchar *)compose->to_list->data) < 0);
for (cur = compose->to_list->next; cur != NULL;
err |= (fprintf(fp, ",%s", (gchar *)cur->data) < 0);
err |= (fprintf(fp, "\n") < 0);
}
- /* Sylpheed account IDs */
+ /* account IDs */
if (mailac)
err |= (fprintf(fp, "MAID:%d\n", mailac->account_id) < 0);
if (newsac)
fclose(fp);
claws_unlink(tmp);
g_free(tmp);
- return -6;
+ return COMPOSE_QUEUE_ERROR_NO_MSG;
}
if (mailac && mailac->encrypt_to_self) {
GSList *tmp_list = g_slist_copy(compose->to_list);
fclose(fp);
claws_unlink(tmp);
g_free(tmp);
- return -5;
+ return COMPOSE_QUEUE_ERROR_NO_ENCRYPTION_KEY;
}
}
}
fclose(fp);
claws_unlink(tmp);
g_free(tmp);
- return -2;
+ return COMPOSE_QUEUE_ERROR_WITH_ERRNO;
}
} else {
gint result = 0;
fclose(fp);
claws_unlink(tmp);
g_free(tmp);
- return result - 1; /* -2 for a generic error, -3 for signing error, -4 for encoding */
+ return result;
}
}
if (err == TRUE) {
fclose(fp);
claws_unlink(tmp);
g_free(tmp);
- return -2;
+ return COMPOSE_QUEUE_ERROR_WITH_ERRNO;
}
if (fclose(fp) == EOF) {
FILE_OP_ERROR(tmp, "fclose");
claws_unlink(tmp);
g_free(tmp);
- return -2;
+ return COMPOSE_QUEUE_ERROR_WITH_ERRNO;
}
if (item && *item) {
g_warning("can't find queue folder");
claws_unlink(tmp);
g_free(tmp);
- return -1;
+ return COMPOSE_QUEUE_ERROR_NO_MSG;
}
folder_item_scan(queue);
if ((num = folder_item_add_msg(queue, tmp, NULL, FALSE)) < 0) {
g_warning("can't queue the message");
claws_unlink(tmp);
g_free(tmp);
- return -1;
+ return COMPOSE_QUEUE_ERROR_NO_MSG;
}
if (msgpath == NULL) {
*item = queue;
}
- return 0;
+ return COMPOSE_QUEUE_SUCCESS;
}
static int compose_add_attachments(Compose *compose, MimeInfo *parent)
if (!is_file_exist(ainfo->file)) {
gchar *msg = g_strdup_printf(_("Attachment %s doesn't exist anymore. Ignore?"), ainfo->file);
- AlertValue val = alertpanel_full(_("Warning"), msg, _("Cancel sending"), _("Ignore attachment"),
- NULL, FALSE, NULL, ALERT_WARNING, G_ALERTDEFAULT);
+ AlertValue val = alertpanel_full(_("Warning"), msg,
+ _("Cancel sending"), _("Ignore attachment"), NULL,
+ ALERTFOCUS_FIRST, FALSE, NULL, ALERT_WARNING);
g_free(msg);
if (val == G_ALERTDEFAULT) {
return -1;
g_slist_foreach(extra_headers, (GFunc)compose_add_extra_header, (gpointer)model);
}
+#ifdef USE_LDAP
static void _ldap_srv_func(gpointer data, gpointer user_data)
{
LdapServer *server = (LdapServer *)data;
debug_print("%s server '%s'\n", (*enable == TRUE ? "enabling" : "disabling"), server->control->hostName);
server->searchFlag = *enable;
}
+#endif
static void compose_create_header_entry(Compose *compose)
{
/* Combo box model */
model = gtk_list_store_new(3, G_TYPE_STRING, G_TYPE_INT, G_TYPE_BOOLEAN);
-#if !GTK_CHECK_VERSION(2, 24, 0)
- combo = gtk_combo_box_entry_new_with_model(GTK_TREE_MODEL(model), 0);
-#endif
COMBOBOX_ADD(model, prefs_common_translated_header_name("To:"),
COMPOSE_TO);
COMBOBOX_ADD(model, prefs_common_translated_header_name("Cc:"),
compose_add_extra_header_entries(model);
/* Combo box */
-#if GTK_CHECK_VERSION(2, 24, 0)
combo = gtk_combo_box_new_with_model_and_entry(GTK_TREE_MODEL(model));
GtkCellRenderer *cell = gtk_cell_renderer_text_new();
gtk_cell_renderer_set_alignment(cell, 0.0, 0.5);
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), cell, TRUE);
gtk_combo_box_set_entry_text_column(GTK_COMBO_BOX(combo), 0);
-#endif
gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0);
g_signal_connect(G_OBJECT(gtk_bin_get_child(GTK_BIN(combo))), "grab_focus",
G_CALLBACK(compose_grab_focus_cb), compose);
NULL);
#ifdef USE_LDAP
+#ifndef PASSWORD_CRYPTO_OLD
GSList *pwd_servers = addrindex_get_password_protected_ldap_servers();
if (pwd_servers != NULL && master_passphrase() == NULL) {
gboolean enable = FALSE;
g_slist_foreach(pwd_servers, _ldap_srv_func, &enable);
compose->passworded_ldap_servers = pwd_servers;
}
-#endif
+#endif /* PASSWORD_CRYPTO_OLD */
+#endif /* USE_LDAP */
address_completion_register_entry(GTK_ENTRY(entry), TRUE);
g_signal_connect(G_OBJECT(savemsg_checkbtn), "toggled",
G_CALLBACK(compose_savemsg_checkbtn_cb), compose);
-#if !GTK_CHECK_VERSION(2, 24, 0)
- savemsg_combo = gtk_combo_box_entry_new_text();
-#else
savemsg_combo = gtk_combo_box_text_new_with_entry();
-#endif
compose->savemsg_checkbtn = savemsg_checkbtn;
compose->savemsg_combo = savemsg_combo;
gtk_widget_show(savemsg_combo);
if (prefs_common.compose_save_to_history)
-#if !GTK_CHECK_VERSION(2, 24, 0)
- combobox_set_popdown_strings(GTK_COMBO_BOX(savemsg_combo),
- prefs_common.compose_save_to_history);
-#else
combobox_set_popdown_strings(GTK_COMBO_BOX_TEXT(savemsg_combo),
prefs_common.compose_save_to_history);
-#endif
gtk_table_attach(GTK_TABLE(table), savemsg_combo, 1, 2, rowcount, rowcount + 1, GTK_FILL|GTK_EXPAND, GTK_SHRINK, 0, 0);
gtk_widget_set_sensitive(GTK_WIDGET(savemsg_combo), prefs_common.savemsg);
g_signal_connect_after(G_OBJECT(savemsg_combo), "grab_focus",
cm_return_val_if_fail(account != NULL, NULL);
- gtkut_convert_int_to_gdk_color(prefs_common.default_header_bgcolor,
+ gtkut_convert_int_to_gdk_color(prefs_common.color[COL_DEFAULT_HEADER_BG],
&default_header_bgcolor);
- gtkut_convert_int_to_gdk_color(prefs_common.default_header_color,
+ gtkut_convert_int_to_gdk_color(prefs_common.color[COL_DEFAULT_HEADER],
&default_header_color);
debug_print("Creating compose window...\n");
gtkaspell = gtkaspell_new(prefs_common.dictionary,
prefs_common.alt_dictionary,
conv_get_locale_charset_str(),
- prefs_common.misspelled_col,
+ prefs_common.color[COL_MISSPELLED],
prefs_common.check_while_typing,
prefs_common.recheck_when_changing_dict,
prefs_common.use_alternate,
/* process the other fields */
- compose_template_apply_fields(compose, tmpl);
compose_attach_from_list(compose, quote_fmt_get_attachments_list(), FALSE);
+ compose_template_apply_fields(compose, tmpl);
quote_fmt_reset_vartable();
quote_fmtlex_destroy();
compose_list = g_list_remove(compose_list, compose);
+#ifdef USE_LDAP
gboolean enable = TRUE;
g_slist_foreach(compose->passworded_ldap_servers,
_ldap_srv_func, &enable);
g_slist_free(compose->passworded_ldap_servers);
+#endif
if (compose->updating) {
debug_print("danger, not destroying anything now\n");
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, (0 + 1),
GTK_FILL, 0, 0, 0);
gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
-#if !GTK_CHECK_VERSION(2, 24, 0)
- mimetype_entry = gtk_combo_box_entry_new_text();
-#else
mimetype_entry = gtk_combo_box_text_new_with_entry();
-#endif
gtk_table_attach(GTK_TABLE(table), mimetype_entry, 1, 2, 0, (0 + 1),
GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0);
for (mime_type_list = strlist; mime_type_list != NULL;
mime_type_list = mime_type_list->next) {
-#if !GTK_CHECK_VERSION(2, 24, 0)
- gtk_combo_box_append_text(GTK_COMBO_BOX(mimetype_entry), mime_type_list->data);
-#else
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(mimetype_entry), mime_type_list->data);
-#endif
g_free(mime_type_list->data);
}
g_list_free(strlist);
"Force terminating the process?\n"
"process group id: %d"), -pgid);
val = alertpanel_full(_("Notice"), msg, GTK_STOCK_NO, GTK_STOCK_YES,
- NULL, FALSE, NULL, ALERT_WARNING, G_ALERTDEFAULT);
+ NULL, ALERTFOCUS_FIRST, FALSE, NULL,
+ ALERT_WARNING);
g_free(msg);
static void compose_send_later_cb(GtkAction *action, gpointer data)
{
Compose *compose = (Compose *)data;
- gint val;
+ ComposeQueueResult val;
inc_lock();
compose_allow_user_actions(compose, FALSE);
compose_allow_user_actions(compose, TRUE);
inc_unlock();
- if (!val) {
+ if (val == COMPOSE_QUEUE_SUCCESS) {
compose_close(compose);
- } else if (val == -1) {
- alertpanel_error(_("Could not queue message."));
- } else if (val == -2) {
- alertpanel_error(_("Could not queue message:\n\n%s."), g_strerror(errno));
- } else if (val == -3) {
- if (privacy_peek_error())
- alertpanel_error(_("Could not queue message for sending:\n\n"
- "Signature failed: %s"), privacy_get_error());
- } else if (val == -4) {
- alertpanel_error(_("Could not queue message for sending:\n\n"
- "Charset conversion failed."));
- } else if (val == -5) {
- alertpanel_error(_("Could not queue message for sending:\n\n"
- "Couldn't get recipient encryption key."));
- } else if (val == -6) {
- /* silent error */
+ } else {
+ _display_queue_error(val);
}
+
toolbar_main_set_sensitive(mainwindow_get_mainwindow());
}
val = alertpanel_full(_("Could not save draft"),
_("Could not save draft.\n"
"Do you want to cancel exit or discard this email?"),
- _("_Cancel exit"), _("_Discard email"), NULL,
- FALSE, NULL, ALERT_QUESTION, G_ALERTDEFAULT);
+ _("_Cancel exit"), _("_Discard email"), NULL, ALERTFOCUS_FIRST,
+ FALSE, NULL, ALERT_QUESTION);
if (val == G_ALERTALTERNATE) {
lock = FALSE;
g_mutex_unlock(compose->mutex); /* must be done before closing */
GFile *f;
GFileInfo *fi;
GTimeVal tv;
- GError *error;
+ GError *error = NULL;
#else
GStatBuf s;
#endif
mtime = tv.tv_sec;
g_object_unref(fi);
g_object_unref(f);
- g_free(path);
#else
if (g_stat(path, &s) < 0) {
FILE_OP_ERROR(path, "stat");
if (!reedit) {
val = alertpanel(_("Discard message"),
_("This message has been modified. Discard it?"),
- _("_Discard"), _("_Save to Drafts"), GTK_STOCK_CANCEL);
+ _("_Discard"), _("_Save to Drafts"), GTK_STOCK_CANCEL,
+ ALERTFOCUS_FIRST);
} else {
val = alertpanel(_("Save changes"),
_("This message has been modified. Save the latest changes?"),
- _("_Don't save"), g_strconcat("+", _("_Save to Drafts"), NULL),
- GTK_STOCK_CANCEL);
+ _("_Don't save"), _("_Save to Drafts"), GTK_STOCK_CANCEL,
+ ALERTFOCUS_SECOND);
}
g_mutex_unlock(compose->mutex);
switch (val) {
msg = g_strdup_printf(_("Do you want to apply the template '%s'?"),
tmpl->name);
val = alertpanel(_("Apply template"), msg,
- _("_Replace"), _("_Insert"), GTK_STOCK_CANCEL);
+ _("_Replace"), _("_Insert"), GTK_STOCK_CANCEL, ALERTFOCUS_FIRST);
g_free(msg);
if (val == G_ALERTDEFAULT)
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);
+ GTK_STOCK_CANCEL, _("_Insert"), _("_Attach"),
+ ALERTFOCUS_SECOND,
+ TRUE, NULL, ALERT_QUESTION);
g_free(msg);
break;
case COMPOSE_DND_INSERT:
"want to continue?"),
g_slist_length(msginfo_list));
if (g_slist_length(msginfo_list) > 9
- && alertpanel(_("Warning"), msg, GTK_STOCK_CANCEL, "+" GTK_STOCK_YES, NULL)
- != G_ALERTALTERNATE) {
+ && alertpanel(_("Warning"), msg, GTK_STOCK_CANCEL, GTK_STOCK_YES, NULL,
+ ALERTFOCUS_SECOND) != G_ALERTALTERNATE) {
g_free(msg);
return;
}