static void compose_insert_sig (Compose *compose,
gboolean replace);
-static gchar *compose_get_signature_str (Compose *compose);
static ComposeInsertResult compose_insert_file (Compose *compose,
const gchar *file);
static GtkRadioActionEntry compose_radio_enc_entries[] =
{
- ENC_ACTION(CS_AUTO, C_AUTO, "_Automatic"), /* RADIO compose_set_encoding_cb */
- ENC_ACTION(CS_US_ASCII, C_US_ASCII, "7bit ASCII (US-ASC_II)"), /* RADIO compose_set_encoding_cb */
- ENC_ACTION(CS_UTF_8, C_UTF_8, "Unicode (_UTF-8)"), /* RADIO compose_set_encoding_cb */
+ ENC_ACTION(CS_AUTO, C_AUTO, N_("_Automatic")), /* RADIO compose_set_encoding_cb */
+ ENC_ACTION(CS_US_ASCII, C_US_ASCII, N_("7bit ASCII (US-ASC_II)")), /* RADIO compose_set_encoding_cb */
+ ENC_ACTION(CS_UTF_8, C_UTF_8, N_("Unicode (_UTF-8)")), /* RADIO compose_set_encoding_cb */
ENC_ACTION("Western/"CS_ISO_8859_1, C_ISO_8859_1, "ISO-8859-_1"), /* RADIO compose_set_encoding_cb */
ENC_ACTION("Western/"CS_ISO_8859_15, C_ISO_8859_15, "ISO-8859-15"), /* RADIO compose_set_encoding_cb */
ENC_ACTION("Western/"CS_WINDOWS_1252, C_WINDOWS_1252, "Windows-1252"), /* RADIO compose_set_encoding_cb */
- ENC_ACTION(CS_ISO_8859_2, C_ISO_8859_2, "Central European (ISO-8859-_2)"), /* RADIO compose_set_encoding_cb */
+ ENC_ACTION(CS_ISO_8859_2, C_ISO_8859_2, N_("Central European (ISO-8859-_2)")), /* RADIO compose_set_encoding_cb */
ENC_ACTION("Baltic/"CS_ISO_8859_13, C_ISO_8859_13, "ISO-8859-13"), /* RADIO compose_set_encoding_cb */
ENC_ACTION("Baltic/"CS_ISO_8859_4, C_ISO_8859_14, "ISO-8859-_4"), /* RADIO compose_set_encoding_cb */
- ENC_ACTION(CS_ISO_8859_7, C_ISO_8859_7, "Greek (ISO-8859-_7)"), /* RADIO compose_set_encoding_cb */
+ ENC_ACTION(CS_ISO_8859_7, C_ISO_8859_7, N_("Greek (ISO-8859-_7)")), /* RADIO compose_set_encoding_cb */
ENC_ACTION("Hebrew/"CS_ISO_8859_8, C_ISO_8859_8, "ISO-8859-_8"), /* RADIO compose_set_encoding_cb */
ENC_ACTION("Hebrew/"CS_WINDOWS_1255, C_WINDOWS_1255, "Windows-1255"), /* RADIO compose_set_encoding_cb */
ENC_ACTION("Arabic/"CS_ISO_8859_6, C_ISO_8859_6, "ISO-8859-_6"), /* RADIO compose_set_encoding_cb */
ENC_ACTION("Arabic/"CS_WINDOWS_1256, C_WINDOWS_1256, "Windows-1256"), /* RADIO compose_set_encoding_cb */
- ENC_ACTION(CS_ISO_8859_9, C_ISO_8859_9, "Turkish (ISO-8859-_9)"), /* RADIO compose_set_encoding_cb */
+ ENC_ACTION(CS_ISO_8859_9, C_ISO_8859_9, N_("Turkish (ISO-8859-_9)")), /* RADIO compose_set_encoding_cb */
ENC_ACTION("Cyrillic/"CS_ISO_8859_5, C_ISO_8859_5, "ISO-8859-_5"), /* RADIO compose_set_encoding_cb */
ENC_ACTION("Cyrillic/"CS_KOI8_R, C_KOI8_R, "KOI8-_R"), /* RADIO compose_set_encoding_cb */
ENC_ACTION("Cyrillic/"CS_KOI8_U, C_KOI8_U, "KOI8-_U"), /* RADIO compose_set_encoding_cb */
return NULL;
}
- compose->sig_str = compose_get_signature_str(compose);
+ compose->sig_str = account_get_signature_str(compose->account);
return compose;
}
}
g_free(compose->sig_str);
- compose->sig_str = compose_get_signature_str(compose);
+ compose->sig_str = account_get_signature_str(compose->account);
cur_pos = gtk_text_iter_get_offset(&iter);
else
gtk_text_buffer_get_iter_at_offset(buffer, &iter,
compose->set_cursor_pos);
-
+
+ compose->set_cursor_pos = -1;
gtk_text_buffer_place_cursor(buffer, &iter);
g_signal_handlers_unblock_by_func(G_OBJECT(buffer),
G_CALLBACK(compose_changed_cb),
UNBLOCK_WRAP();
}
-static gchar *compose_get_signature_str(Compose *compose)
-{
- gchar *sig_body = NULL;
- gchar *sig_str = NULL;
- gchar *utf8_sig_str = NULL;
-
- g_return_val_if_fail(compose->account != NULL, NULL);
-
- if (!compose->account->sig_path)
- return NULL;
-
- if (compose->account->sig_type == SIG_FILE) {
- if (!is_file_or_fifo_exist(compose->account->sig_path)) {
- g_warning("can't open signature file: %s\n",
- compose->account->sig_path);
- return NULL;
- }
- }
-
- if (compose->account->sig_type == SIG_COMMAND)
- sig_body = get_command_output(compose->account->sig_path);
- else {
- gchar *tmp;
-
- tmp = file_read_to_str(compose->account->sig_path);
- if (!tmp)
- return NULL;
- sig_body = normalize_newlines(tmp);
- g_free(tmp);
- }
-
- if (compose->account->sig_sep) {
- sig_str = g_strconcat("\n", compose->account->sig_sep, "\n", sig_body,
- NULL);
- g_free(sig_body);
- } else
- sig_str = g_strconcat("\n", sig_body, NULL);
-
- if (sig_str) {
- if (g_utf8_validate(sig_str, -1, NULL) == TRUE)
- utf8_sig_str = sig_str;
- else {
- utf8_sig_str = conv_codeset_strdup
- (sig_str, conv_get_locale_charset_str_no_utf8(),
- CS_INTERNAL);
- g_free(sig_str);
- }
- }
-
- return utf8_sig_str;
-}
-
static ComposeInsertResult compose_insert_file(Compose *compose, const gchar *file)
{
GtkTextView *text;
mimepart->tmp = FALSE; /* or we destroy our attachment */
mimepart->offset = 0;
- stat(ainfo->file, &statbuf);
+ g_stat(ainfo->file, &statbuf);
mimepart->length = statbuf.st_size;
type = g_strdup(ainfo->content_type);
#ifndef MAEMO
MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/", "Menu", NULL, GTK_UI_MANAGER_MENUBAR)
#else
- MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/", "Menu", NULL, GTK_UI_MANAGER_MENU)
+ MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/", "Menu", NULL, GTK_UI_MANAGER_POPUP)
#endif
MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu", "Message", "Message", GTK_UI_MANAGER_MENU)
compose_set_ext_editor_sensitive(compose, FALSE);
+#ifndef G_OS_WIN32
compose->exteditor_ch = g_io_channel_unix_new(pipe_fds[0]);
+#else
+ compose->exteditor_ch = g_io_channel_win32_new_fd(pipe_fds[0]);
+#endif
compose->exteditor_tag = g_io_add_watch(compose->exteditor_ch,
G_IO_IN,
compose_input_cb,
gtk_text_buffer_set_text(buffer, "", -1);
compose_insert_file(compose, compose->exteditor_file);
compose_changed_cb(NULL, compose);
+ compose_draft((gpointer)compose, COMPOSE_AUTO_SAVE);
if (claws_unlink(compose->exteditor_file) < 0)
FILE_OP_ERROR(compose->exteditor_file, "unlink");
{
gchar *filepath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
DRAFTED_AT_EXIT, NULL);
- FILE *fp = fopen(filepath, "ab");
+ FILE *fp = g_fopen(filepath, "ab");
if (fp) {
fprintf(fp, "%s\t%d\n", folder_item_get_identifier(info->folder),
{
gchar *filepath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
DRAFTED_AT_EXIT, NULL);
- FILE *fp = fopen(filepath, "rb");
+ FILE *fp = g_fopen(filepath, "rb");
gchar buf[1024];
if (fp) {