From: Paul Mangan Date: Wed, 30 Mar 2005 12:01:26 +0000 (+0000) Subject: 2005-03-30 [paul] 1.9.6cvs12 X-Git-Tag: rel_1_9_9~52 X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=commitdiff_plain;h=7d98e8c6a793506aad1fb962c222ca9f50f7fb37 2005-03-30 [paul] 1.9.6cvs12 partial sync with main: * src/action.c create_io_dialog(): use user-defined text font (thanks to Alfons), and modified its appearance. * src/addrgather.c * src/addrharvest.c * src/browseldap.c replace old code * src/compose.c don't join (presumably) itemized lines on line-wrapping fixed wrapping of quote when auto-wrapping is enabled compose_destroy(): destroy paned only if it's not attached to window. Fixed memory leak of popup menu. * src/exphtmldlg.c * src/expldifdlg.c replace old code * src/html.c * src/html.h * src/importmutt.c * src/importpine.c replace old code * src/main.c removed redundant code * src/mainwindow.c changed 'Code set' (which is rather incorrect) in the menu to 'Character encoding' main_window_set_widgets(): request size first to prevent window size becoming wrong fixed remembering of the state of the visibility of MessageView * src/messageview.c changed 'Code set' (which is rather incorrect) in the menu to 'Character encoding' * src/prefs_common.c * src/prefs_common.h added an option whether to render HTML as text or not added separators to outgoing encoding menu * src/procheader.c procheader_scan_date_string(): support header like: "[Tue,] 01 Feb 2005 09:57[:00]" * src/summaryview.c * src/summaryview.h minor code cleanup * src/textview.c textview_show_html(): force output of newline added an option whether to render HTML as text or not * src/common/utils.c strncpy2(): optimized based on Alfons' code * src/gtk/gtkutils.c * src/gtk/gtkutils.h removed non-used code * src/plugins/pgpmime/passphrase.c partially fixed grab input of passphrase dialog Confine pointer to window --- diff --git a/ChangeLog-gtk2.claws b/ChangeLog-gtk2.claws index e1c1ff998..0b5463471 100644 --- a/ChangeLog-gtk2.claws +++ b/ChangeLog-gtk2.claws @@ -1,3 +1,61 @@ +2005-03-30 [paul] 1.9.6cvs12 + + partial sync with main: + + * src/action.c + create_io_dialog(): use user-defined text font + (thanks to Alfons), and modified its appearance. + * src/addrgather.c + * src/addrharvest.c + * src/browseldap.c + replace old code + * src/compose.c + don't join (presumably) itemized lines on line-wrapping + fixed wrapping of quote when auto-wrapping is enabled + compose_destroy(): destroy paned only if it's not + attached to window. Fixed memory leak of popup menu. + * src/exphtmldlg.c + * src/expldifdlg.c + replace old code + * src/html.c + * src/html.h + * src/importmutt.c + * src/importpine.c + replace old code + * src/main.c + removed redundant code + * src/mainwindow.c + changed 'Code set' (which is rather incorrect) + in the menu to 'Character encoding' + main_window_set_widgets(): request size first + to prevent window size becoming wrong + fixed remembering of the state of the visibility + of MessageView + * src/messageview.c + changed 'Code set' (which is rather incorrect) + in the menu to 'Character encoding' + * src/prefs_common.c + * src/prefs_common.h + added an option whether to render HTML as text or not + added separators to outgoing encoding menu + * src/procheader.c + procheader_scan_date_string(): support header + like: "[Tue,] 01 Feb 2005 09:57[:00]" + * src/summaryview.c + * src/summaryview.h + minor code cleanup + * src/textview.c + textview_show_html(): force output of newline + added an option whether to render HTML as text or not + * src/common/utils.c + strncpy2(): optimized based on Alfons' code + * src/gtk/gtkutils.c + * src/gtk/gtkutils.h + removed non-used code + * src/plugins/pgpmime/passphrase.c + partially fixed grab input of passphrase dialog + Confine pointer to window + 2005-03-30 [colin] 1.9.6cvs11 * src/msgcache.c diff --git a/PATCHSETS b/PATCHSETS index 47960a9fc..e569fc0a7 100644 --- a/PATCHSETS +++ b/PATCHSETS @@ -428,3 +428,4 @@ ( cvs diff -u -r 1.654.2.461 -r 1.654.2.462 configure.ac; cvs diff -u -r 1.53.2.9 -r 1.53.2.10 po/POTFILES.in; cvs diff -u -r 1.155.2.18 -r 1.155.2.19 src/Makefile.am; cvs diff -u -r 1.23.2.8 -r 1.23.2.9 src/crash.c; cvs diff -u -r 0 -r 1 src/image_viewer.c; cvs diff -u -r 0 -r 1 src/image_viewer.h; cvs diff -u -r 1.115.2.29 -r 1.115.2.30 src/main.c; cvs diff -u -r 1.204.2.32 -r 1.204.2.33 src/prefs_common.c; cvs diff -u -r 1.103.2.12 -r 1.103.2.13 src/prefs_common.h; cvs diff -u -r 0 -r 1 src/prefs_image_viewer.c; cvs diff -u -r 0 -r 1 src/prefs_image_viewer.h; cvs diff -u -r 1.96.2.49 -r 1.96.2.50 src/textview.c; cvs diff -u -r 1.4.2.9 -r 1.4.2.10 src/gtk/about.c; cvs diff -u -r 1.1.14.1 -r 1.1.14.2 src/pixmaps/sylpheed_logo.xpm; cvs diff -u -r 1.8.2.1 -r 1.8.2.2 src/plugins/Makefile.am; cvs diff -u -r -1.1 -r -1.2 src/plugins/image_viewer/.cvsignore; cvs diff -u -r -1.4.2.2 -r -1.4.2.3 src/plugins/image_viewer/Makefile.am; cvs diff -u -r -1.8.2.3 -r -1.8.2.4 src/plugins/image_viewer/plugin.c; cvs diff -u -r -1.7.2.10 -r -1.7.2.11 src/plugins/image_viewer/viewer.c; cvs diff -u -r -1.1 -r -1.2 src/plugins/image_viewer/viewer.glade; cvs diff -u -r -1.4 -r -1.5 src/plugins/image_viewer/viewer.h; cvs diff -u -r -1.5.2.5 -r -1.5.2.6 src/plugins/image_viewer/viewerprefs.c; cvs diff -u -r -1.1.4.1 -r -1.1.4.2 src/plugins/image_viewer/viewerprefs.glade; cvs diff -u -r -1.3 -r -1.4 src/plugins/image_viewer/viewerprefs.h; ) > 1.9.6cvs9.patchset ( cvs diff -u -r 1.100.2.14 -r 1.100.2.15 AUTHORS; cvs diff -u -r 1.2504.2.55 -r 1.2504.2.56 ChangeLog.claws; cvs diff -u -r 1.382.2.113 -r 1.382.2.114 src/compose.c; cvs diff -u -r 1.9.2.10 -r 1.9.2.11 src/gtk/gtkaspell.c; ) > 1.9.6cvs10.patchset ( cvs diff -u -r 1.16.2.14 -r 1.16.2.15 src/msgcache.c; cvs diff -u -r 1.5 -r 1.6 src/msgcache.h; ) > 1.9.6cvs11.patchset +( cvs diff -u -r 1.12.2.20 -r 1.12.2.21 src/action.c; cvs diff -u -r 1.5.10.7 -r 1.5.10.8 src/addrgather.c; cvs diff -u -r 1.6.10.4 -r 1.6.10.5 src/addrharvest.c; cvs diff -u -r 1.2.4.5 -r 1.2.4.6 src/browseldap.c; cvs diff -u -r 1.382.2.114 -r 1.382.2.115 src/compose.c; cvs diff -u -r 1.3.2.7 -r 1.3.2.8 src/exphtmldlg.c; cvs diff -u -r 1.1.4.9 -r 1.1.4.10 src/expldifdlg.c; cvs diff -u -r 1.12.2.6 -r 1.12.2.7 src/html.c; cvs diff -u -r 1.3.2.1 -r 1.3.2.2 src/html.h; cvs diff -u -r 1.4.12.4 -r 1.4.12.5 src/importmutt.c; cvs diff -u -r 1.1.14.4 -r 1.1.14.5 src/importpine.c; cvs diff -u -r 1.115.2.30 -r 1.115.2.31 src/main.c; cvs diff -u -r 1.274.2.32 -r 1.274.2.33 src/mainwindow.c; cvs diff -u -r 1.94.2.48 -r 1.94.2.49 src/messageview.c; cvs diff -u -r 1.204.2.33 -r 1.204.2.34 src/prefs_common.c; cvs diff -u -r 1.103.2.13 -r 1.103.2.14 src/prefs_common.h; cvs diff -u -r 1.47.2.17 -r 1.47.2.18 src/procheader.c; cvs diff -u -r 1.395.2.61 -r 1.395.2.62 src/summaryview.c; cvs diff -u -r 1.68.2.6 -r 1.68.2.7 src/summaryview.h; cvs diff -u -r 1.96.2.50 -r 1.96.2.51 src/textview.c; cvs diff -u -r 1.36.2.26 -r 1.36.2.27 src/common/utils.c; cvs diff -u -r 1.5.2.10 -r 1.5.2.11 src/gtk/gtkutils.c; cvs diff -u -r 1.4.2.8 -r 1.4.2.9 src/gtk/gtkutils.h; cvs diff -u -r 1.1.2.5 -r 1.1.2.6 src/plugins/pgpmime/passphrase.c; ) > 1.9.6cvs12.patchset diff --git a/configure.ac b/configure.ac index 4ccc573c2..55706c376 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ MINOR_VERSION=9 MICRO_VERSION=6 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=11 +EXTRA_VERSION=12 EXTRA_RELEASE= EXTRA_GTK2_VERSION= diff --git a/src/action.c b/src/action.c index 901d07a28..3b1d9b62f 100644 --- a/src/action.c +++ b/src/action.c @@ -1173,21 +1173,30 @@ static void create_io_dialog(Children *children) scrolledwin = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwin), - GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwin), + GTK_SHADOW_IN); gtk_box_pack_start(GTK_BOX(vbox), scrolledwin, TRUE, TRUE, 0); - gtk_widget_set_size_request(scrolledwin, 480, 200); + gtk_widget_set_size_request(scrolledwin, 560, 200); gtk_widget_hide(scrolledwin); text = gtk_text_view_new(); + if (prefs_common.textfont) { - if (NULL != (text_font = pango_font_description_from_string - (prefs_common.textfont))) { - gtk_widget_modify_font(text, text_font); - pango_font_description_free(text_font); - } - } + PangoFontDescription *font_desc; + font_desc = pango_font_description_from_string + (prefs_common.textfont); + if (font_desc) { + gtk_widget_modify_font(text, font_desc); + pango_font_description_free(font_desc); + } + } + gtk_text_view_set_editable(GTK_TEXT_VIEW(text), FALSE); + gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text), GTK_WRAP_WORD); + gtk_text_view_set_left_margin(GTK_TEXT_VIEW(text), 6); + gtk_text_view_set_right_margin(GTK_TEXT_VIEW(text), 6); gtk_container_add(GTK_CONTAINER(scrolledwin), text); gtk_widget_show(text); diff --git a/src/addrgather.c b/src/addrgather.c index 061698463..029c2ff20 100644 --- a/src/addrgather.c +++ b/src/addrgather.c @@ -504,8 +504,9 @@ static void addrgather_dlg_create( void ) { gtk_box_pack_start( GTK_BOX(hsbox), statusbar, TRUE, TRUE, BORDER_WIDTH ); /* Button panel */ - gtkut_button_set_create( &hbbox, &btnOk, _("OK"), - &btnCancel, _("Cancel"), NULL, NULL ); + gtkut_stock_button_set_create(&hbbox, &btnOk, GTK_STOCK_OK, + &btnCancel, GTK_STOCK_CANCEL, + NULL, NULL ); gtk_box_pack_end( GTK_BOX(vbox), hbbox, FALSE, FALSE, 0 ); gtk_container_set_border_width( GTK_CONTAINER(hbbox), 0 ); diff --git a/src/addrharvest.c b/src/addrharvest.c index e80a8e849..e97b8655f 100644 --- a/src/addrharvest.c +++ b/src/addrharvest.c @@ -514,6 +514,7 @@ static void addrharvest_parse_address( AddressCache *cache, const gchar *hdrBuf ) { gchar buffer[ ADDR_BUFFSIZE + 2 ]; + gchar buf[ADDR_BUFFSIZE]; const gchar *bp; const gchar *ep; gchar *atCh, *email, *name; @@ -555,10 +556,9 @@ static void addrharvest_parse_address( name = ""; } else { - gchar *tmp = conv_unmime_header(buffer, NULL); - strncpy2(buffer, tmp, sizeof buffer); - name = buffer; - g_free(tmp); + name = buffer; + conv_unmime_header(buf, sizeof(buf), name, + NULL); } /* Insert into address book */ diff --git a/src/browseldap.c b/src/browseldap.c index 2e864b7d6..1e7d2706f 100644 --- a/src/browseldap.c +++ b/src/browseldap.c @@ -304,8 +304,8 @@ static void browse_create( void ) { gtk_box_pack_start(GTK_BOX(hsbox), statusbar, TRUE, TRUE, BORDER_WIDTH); /* Button panel */ - gtkut_button_set_create(&hbbox, &close_btn, _( "Close" ), - NULL, NULL, NULL, NULL); + gtkut_stock_button_set_create(&hbbox, &close_btn, GTK_STOCK_CLOSE, + NULL, NULL, NULL, NULL); gtk_box_pack_end(GTK_BOX(vbox), hbbox, FALSE, FALSE, 0); gtk_container_set_border_width( GTK_CONTAINER(hbbox), 0 ); diff --git a/src/common/utils.c b/src/common/utils.c index 213c45b73..c55f5d9d0 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -335,20 +335,14 @@ gpointer my_memmem(gconstpointer haystack, size_t haystacklen, /* Copy no more than N characters of SRC to DEST, with NULL terminating. */ gchar *strncpy2(gchar *dest, const gchar *src, size_t n) { - register gchar c; - gchar *s = dest; + register const gchar *s = src; + register gchar *d = dest; - do { - if (--n == 0) { - *dest = '\0'; - return s; - } - c = *src++; - *dest++ = c; - } while (c != '\0'); + while (--n && *s) + *d++ = *s++; + *d = '\0'; - /* don't do zero fill */ - return s; + return dest; } #if !HAVE_ISWALNUM @@ -3448,7 +3442,7 @@ void debug_print_real(const gchar *format, ...) g_vsnprintf(buf, sizeof(buf), format, args); va_end(args); - fputs(buf, stdout); + g_print("%s", buf); } void * subject_table_lookup(GHashTable *subject_table, gchar * subject) diff --git a/src/compose.c b/src/compose.c index e048b3163..4389c063d 100644 --- a/src/compose.c +++ b/src/compose.c @@ -1345,10 +1345,14 @@ void compose_reedit(MsgInfo *msginfo) if ((fp = procmime_get_first_text_content(msginfo)) == NULL) g_warning("Can't get text part\n"); else { + gboolean prev_autowrap = compose->autowrap; + + compose->autowrap = FALSE; while (fgets(buf, sizeof(buf), fp) != NULL) { strcrchomp(buf); gtk_text_buffer_insert(textbuf, &iter, buf, -1); } + compose->autowrap = prev_autowrap; fclose(fp); } @@ -1615,6 +1619,9 @@ static void compose_entries_set(Compose *compose, const gchar *mailto) GtkTextBuffer *buffer = gtk_text_view_get_buffer(text); GtkTextMark *mark; GtkTextIter iter; + gboolean prev_autowrap = compose->autowrap; + + compose->autowrap = FALSE; mark = gtk_text_buffer_get_insert(buffer); gtk_text_buffer_get_iter_at_mark(buffer, &iter, mark); @@ -1627,6 +1634,10 @@ static void compose_entries_set(Compose *compose, const gchar *mailto) gtk_text_buffer_insert(buffer, &iter, body, -1); } gtk_text_buffer_insert(buffer, &iter, "\n", 1); + + compose->autowrap = prev_autowrap; + if (compose->autowrap) + compose_wrap_all(compose); } g_free(to); @@ -1669,16 +1680,13 @@ static gint compose_parse_header(Compose *compose, MsgInfo *msginfo) fclose(fp); if (hentry[H_REPLY_TO].body != NULL) { - compose->replyto = - conv_unmime_header(hentry[H_REPLY_TO].body, NULL); + if (hentry[H_REPLY_TO].body[0] != '\0') { + compose->replyto = + conv_unmime_header(hentry[H_REPLY_TO].body, + NULL); + } g_free(hentry[H_REPLY_TO].body); hentry[H_REPLY_TO].body = NULL; - /* if empty replyto, let sylpheed figure it out, i.e. - * neglect the reply-to header. */ - if (*(compose->replyto) == 0) { - g_free(compose->replyto); - compose->replyto = NULL; - } } if (hentry[H_CC].body != NULL) { compose->cc = conv_unmime_header(hentry[H_CC].body, NULL); @@ -1707,8 +1715,11 @@ static gint compose_parse_header(Compose *compose, MsgInfo *msginfo) hentry[H_NEWSGROUPS].body = NULL; } if (hentry[H_FOLLOWUP_TO].body != NULL) { - compose->followup_to = - conv_unmime_header(hentry[H_FOLLOWUP_TO].body, NULL); + if (hentry[H_FOLLOWUP_TO].body[0] != '\0') { + compose->followup_to = + conv_unmime_header(hentry[H_FOLLOWUP_TO].body, + NULL); + } g_free(hentry[H_FOLLOWUP_TO].body); hentry[H_FOLLOWUP_TO].body = NULL; } @@ -1745,13 +1756,17 @@ static gint compose_parse_header(Compose *compose, MsgInfo *msginfo) compose->priority = priority; } - if (compose->mode == COMPOSE_REEDIT && msginfo->inreplyto) - compose->inreplyto = g_strdup(msginfo->inreplyto); - else if (compose->mode != COMPOSE_REEDIT && - msginfo->msgid && *msginfo->msgid) { + if (compose->mode == COMPOSE_REEDIT) { + if (msginfo->inreplyto && *msginfo->inreplyto) + compose->inreplyto = g_strdup(msginfo->inreplyto); + return 0; + } + + if (msginfo->msgid && *msginfo->msgid) compose->inreplyto = g_strdup(msginfo->msgid); - if (!compose->references) { + if (!compose->references) { + if (msginfo->msgid && *msginfo->msgid) { if (msginfo->inreplyto && *msginfo->inreplyto) compose->references = g_strdup_printf("<%s>\n\t<%s>", @@ -1761,6 +1776,10 @@ static gint compose_parse_header(Compose *compose, MsgInfo *msginfo) compose->references = g_strconcat("<", msginfo->msgid, ">", NULL); + } else if (msginfo->inreplyto && *msginfo->inreplyto) { + compose->references = + g_strconcat("<", msginfo->inreplyto, ">", + NULL); } } @@ -1826,6 +1845,7 @@ static gchar *compose_quote_fmt(Compose *compose, MsgInfo *msginfo, gchar *buf; gchar *p, *lastp; gint len; + gboolean prev_autowrap; const gchar *trimmed_body = body; if (!msginfo) @@ -1860,6 +1880,9 @@ static gchar *compose_quote_fmt(Compose *compose, MsgInfo *msginfo, } else buf = ""; + prev_autowrap = compose->autowrap; + compose->autowrap = FALSE; + for (p = buf; *p != '\0'; ) { GtkTextView *text = GTK_TEXT_VIEW(compose->text); GtkTextBuffer *buffer = gtk_text_view_get_buffer(text); @@ -1894,6 +1917,10 @@ static gchar *compose_quote_fmt(Compose *compose, MsgInfo *msginfo, break; } + compose->autowrap = prev_autowrap; + if (compose->autowrap) + compose_wrap_all(compose); + return buf; } @@ -2070,10 +2097,14 @@ static void compose_insert_sig(Compose *compose, gboolean replace) GtkTextMark *mark; GtkTextIter iter; gint cur_pos; + gboolean prev_autowrap; g_return_if_fail(compose->account != NULL); + prev_autowrap = compose->autowrap; + compose->autowrap = FALSE; + g_signal_handlers_block_by_func(G_OBJECT(buffer), G_CALLBACK(compose_changed_cb), compose); @@ -2122,6 +2153,9 @@ static void compose_insert_sig(Compose *compose, gboolean replace) G_CALLBACK(compose_changed_cb), compose); + compose->autowrap = prev_autowrap; + if (compose->autowrap) + compose_wrap_all(compose); } static gchar *compose_get_signature_str(Compose *compose) @@ -2194,6 +2228,9 @@ static ComposeInsertResult compose_insert_file(Compose *compose, const gchar *fi return COMPOSE_INSERT_READ_ERROR; } + prev_autowrap = compose->autowrap; + compose->autowrap = FALSE; + text = GTK_TEXT_VIEW(compose->text); buffer = gtk_text_view_get_buffer(text); mark = gtk_text_buffer_get_insert(buffer); @@ -2205,9 +2242,6 @@ static ComposeInsertResult compose_insert_file(Compose *compose, const gchar *fi cur_encoding = conv_get_locale_charset_str(); - prev_autowrap = compose->autowrap; - compose->autowrap = FALSE; - while (fgets(buf, sizeof(buf), fp) != NULL) { gchar *str; @@ -2550,6 +2584,44 @@ static gchar *compose_get_quote_str(GtkTextBuffer *buffer, return NULL; } +/* return TRUE if the line is itemized */ +static gboolean compose_is_itemized(GtkTextBuffer *buffer, + const GtkTextIter *start) +{ + GtkTextIter iter = *start; + gunichar wc; + gchar ch[6]; + gint clen; + + if (gtk_text_iter_ends_line(&iter)) + return FALSE; + + while (1) { + wc = gtk_text_iter_get_char(&iter); + if (!g_unichar_isspace(wc)) + break; + gtk_text_iter_forward_char(&iter); + if (gtk_text_iter_ends_line(&iter)) + return FALSE; + } + + clen = g_unichar_to_utf8(wc, ch); + if (clen != 1) + return FALSE; + + if (!strchr("*-+", ch[0])) + return FALSE; + + gtk_text_iter_forward_char(&iter); + if (gtk_text_iter_ends_line(&iter)) + return FALSE; + wc = gtk_text_iter_get_char(&iter); + if (g_unichar_isspace(wc)) + return TRUE; + + return FALSE; +} + static gboolean compose_get_line_break_pos(GtkTextBuffer *buffer, const GtkTextIter *start, GtkTextIter *break_pos, @@ -2678,7 +2750,7 @@ static gboolean compose_join_next_line(Compose *compose, GtkTextIter *iter, const gchar *quote_str) { - GtkTextIter iter_ = *iter, cur, prev, next; + GtkTextIter iter_ = *iter, cur, prev, next, end; PangoLogAttr attrs[3]; gchar *str; gchar *next_quote_str; @@ -2699,20 +2771,21 @@ static gboolean compose_join_next_line(Compose *compose, } g_free(next_quote_str); - /* delete quote str */ + end = iter_; if (quote_len > 0) { - GtkTextIter end = iter_; - gtk_text_iter_forward_chars(&end, quote_len); if (gtk_text_iter_ends_line(&end)) return FALSE; - gtk_text_buffer_delete(buffer, &iter_, &end); } - /* don't join if next line is sig separator */ - if (is_sig_separator(compose, buffer, &iter_)) + /* don't join itemized lines */ + if (compose_is_itemized(buffer, &end)) return FALSE; + /* delete quote str */ + if (quote_len > 0) + gtk_text_buffer_delete(buffer, &iter_, &end); + /* delete linebreak and extra spaces */ prev = cur = iter_; while (gtk_text_iter_backward_char(&cur)) { @@ -2729,7 +2802,6 @@ static gboolean compose_join_next_line(Compose *compose, gtk_text_iter_forward_char(&cur); next = cur; } - if (!gtk_text_iter_equal(&prev, &next)) { GtkTextMark *mark; @@ -2770,6 +2842,9 @@ static void compose_wrap_paragraph(Compose *compose, GtkTextIter *par_iter) gchar *quote_str = NULL; gint quote_len; gboolean wrap_quote = prefs_common.linewrap_quote; + gboolean prev_autowrap = compose->autowrap; + + compose->autowrap = FALSE; buffer = gtk_text_view_get_buffer(text); @@ -2796,13 +2871,8 @@ static void compose_wrap_paragraph(Compose *compose, GtkTextIter *par_iter) } } - if (gtk_text_iter_is_end(&iter)) { - if (par_iter) - *par_iter = iter; - return; - } - - do { + /* go until paragraph end (empty line) */ + while (!gtk_text_iter_ends_line(&iter)) { quote_str = compose_get_quote_str(buffer, &iter, "e_len); if (quote_str) { if (!wrap_quote) { @@ -2855,11 +2925,12 @@ static void compose_wrap_paragraph(Compose *compose, GtkTextIter *par_iter) } g_free(quote_str); - } while (!gtk_text_iter_ends_line(&iter)); - /* stop if paragraph end (empty line) */ + } if (par_iter) *par_iter = iter; + + compose->autowrap = prev_autowrap; } static void compose_wrap_all(Compose *compose) @@ -5332,7 +5403,9 @@ static void compose_destroy(Compose *compose) prefs_common.compose_width = compose->scrolledwin->allocation.width; prefs_common.compose_height = compose->window->allocation.height; - gtk_widget_destroy(compose->paned); + if (!gtk_widget_get_parent(compose->paned)) + gtk_widget_destroy(compose->paned); + gtk_widget_destroy(compose->popupmenu); toolbar_destroy(compose->toolbar); g_free(compose->toolbar); diff --git a/src/exphtmldlg.c b/src/exphtmldlg.c index 082bae92d..e6581328e 100644 --- a/src/exphtmldlg.c +++ b/src/exphtmldlg.c @@ -723,9 +723,9 @@ static void export_html_dialog_create( void ) { gtk_box_pack_start(GTK_BOX(hsbox), statusbar, TRUE, TRUE, BORDER_WIDTH); /* Button panel */ - gtkut_button_set_create(&hbbox, &btnPrev, _( "Prev" ), - &btnNext, _( "Next" ), - &btnCancel, _( "Cancel" ) ); + gtkut_stock_button_set_create(&hbbox, &btnPrev, GTK_STOCK_GO_BACK, + &btnNext, GTK_STOCK_GO_FORWARD, + &btnCancel, GTK_STOCK_CANCEL); gtk_box_pack_end(GTK_BOX(vbox), hbbox, FALSE, FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(hbbox), 2); gtk_widget_grab_default(btnNext); diff --git a/src/expldifdlg.c b/src/expldifdlg.c index e6ec59e44..679936aed 100644 --- a/src/expldifdlg.c +++ b/src/expldifdlg.c @@ -744,9 +744,9 @@ static void export_ldif_dialog_create( void ) { gtk_box_pack_start(GTK_BOX(hsbox), statusbar, TRUE, TRUE, BORDER_WIDTH); /* Button panel */ - gtkut_button_set_create(&hbbox, &btnPrev, _( "Prev" ), - &btnNext, _( "Next" ), - &btnCancel, _( "Cancel" ) ); + gtkut_stock_button_set_create(&hbbox, &btnPrev, GTK_STOCK_GO_BACK, + &btnNext, GTK_STOCK_GO_FORWARD, + &btnCancel, GTK_STOCK_CANCEL); gtk_box_pack_end(GTK_BOX(vbox), hbbox, FALSE, FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(hbbox), 2); gtk_widget_grab_default(btnNext); diff --git a/src/gtk/gtkutils.c b/src/gtk/gtkutils.c index b23177ca4..88f475ef9 100644 --- a/src/gtk/gtkutils.c +++ b/src/gtk/gtkutils.c @@ -95,38 +95,6 @@ void gtkut_convert_int_to_gdk_color(gint rgbvalue, GdkColor *color) color->blue = (int) (((gdouble) (rgbvalue & 0x0000ff) / 255.0) * 65535.0); } -void gtkut_button_set_create(GtkWidget **bbox, - GtkWidget **button1, const gchar *label1, - GtkWidget **button2, const gchar *label2, - GtkWidget **button3, const gchar *label3) -{ - g_return_if_fail(bbox != NULL); - g_return_if_fail(button1 != NULL); - - *bbox = gtk_hbutton_box_new(); - gtk_button_box_set_layout(GTK_BUTTON_BOX(*bbox), GTK_BUTTONBOX_END); - gtk_box_set_spacing(GTK_BOX(*bbox), 5); - - *button1 = gtk_button_new_with_label(label1); - GTK_WIDGET_SET_FLAGS(*button1, GTK_CAN_DEFAULT); - gtk_box_pack_start(GTK_BOX(*bbox), *button1, TRUE, TRUE, 0); - gtk_widget_show(*button1); - - if (button2) { - *button2 = gtk_button_new_with_label(label2); - GTK_WIDGET_SET_FLAGS(*button2, GTK_CAN_DEFAULT); - gtk_box_pack_start(GTK_BOX(*bbox), *button2, TRUE, TRUE, 0); - gtk_widget_show(*button2); - } - - if (button3) { - *button3 = gtk_button_new_with_label(label3); - GTK_WIDGET_SET_FLAGS(*button3, GTK_CAN_DEFAULT); - gtk_box_pack_start(GTK_BOX(*bbox), *button3, TRUE, TRUE, 0); - gtk_widget_show(*button3); - } -} - void gtkut_stock_button_set_create(GtkWidget **bbox, GtkWidget **button1, const gchar *label1, GtkWidget **button2, const gchar *label2, @@ -473,46 +441,8 @@ void gtkut_editable_disable_im(GtkEditable *editable) #endif } -/* - * Walk through the widget tree and disclaim the selection from all currently - * realized GtkEditable widgets. - */ -static void gtkut_check_before_remove(GtkWidget *widget, gpointer unused) -{ - g_return_if_fail(widget != NULL); - - if (!GTK_WIDGET_REALIZED(widget)) - return; /* all nested widgets must be unrealized too */ - if (GTK_IS_CONTAINER(widget)) - gtk_container_forall(GTK_CONTAINER(widget), - gtkut_check_before_remove, NULL); -#warning FIXME_GTK2 -#if 0 - if (GTK_IS_EDITABLE(widget)) - gtk_editable_claim_selection(GTK_EDITABLE(widget), - FALSE, GDK_CURRENT_TIME); -#endif -} - -/* - * Wrapper around gtk_container_remove to work around a bug in GtkText and - * GtkEntry (in all GTK+ versions up to and including at least 1.2.10). - * - * The problem is that unrealizing a GtkText or GtkEntry widget which has the - * active selection completely messes up selection handling, leading to - * non-working selections and crashes. Removing a widget from its container - * implies unrealizing it and all its child widgets; this triggers the bug if - * the removed widget or any of its children is GtkText or GtkEntry. As a - * workaround, this function walks through the widget subtree before removing - * and disclaims the selection from all GtkEditable widgets found. - * - * A similar workaround may be needed for gtk_widget_reparent(); currently it - * is not necessary because Sylpheed does not use gtk_widget_reparent() for - * GtkEditable widgets or containers holding such widgets. - */ void gtkut_container_remove(GtkContainer *container, GtkWidget *widget) { - gtkut_check_before_remove(widget, NULL); gtk_container_remove(container, widget); } diff --git a/src/gtk/gtkutils.h b/src/gtk/gtkutils.h index 9850886de..c4d3434c8 100644 --- a/src/gtk/gtkutils.h +++ b/src/gtk/gtkutils.h @@ -96,14 +96,6 @@ gboolean gtkut_get_font_size (GtkWidget *widget, void gtkut_convert_int_to_gdk_color (gint rgbvalue, GdkColor *color); -void gtkut_button_set_create (GtkWidget **bbox, - GtkWidget **button1, - const gchar *label1, - GtkWidget **button2, - const gchar *label2, - GtkWidget **button3, - const gchar *label3); - void gtkut_stock_button_set_create (GtkWidget **bbox, GtkWidget **button1, const gchar *label1, diff --git a/src/html.c b/src/html.c index d7833a017..0cdd01f03 100644 --- a/src/html.c +++ b/src/html.c @@ -1,6 +1,6 @@ /* * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2003 Hiroyuki Yamamoto + * Copyright (C) 1999-2005 Hiroyuki Yamamoto * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -111,201 +111,7 @@ static HTMLSymbol ascii_symbol_list[] = { {"ý", "y'"}, }; -static HTMLSymbol eucjp_symbol_list[] = { - {"¡" , "^!"}, - {"¢" , "\xa1\xf1"}, - {"£" , "\xa1\xf2"}, - {"¥" , "\xa1\xef"}, - {"¦", "|"}, - {"§" , "\xa1\xf8"}, - {"¨" , "\xa1\xaf"}, - {"©" , "(C)"}, - {"«" , "<<"}, - {"®" , "(R)"}, - - {"°" , "\xa1\xeb"}, - {"±", "\xa1\xde"}, - {"²" , "^2"}, - {"³" , "^3"}, - {"´" , "'"}, - {"µ" , "\xa6\xcc"}, - {"¶" , "\xa2\xf9"}, - {"·", "\xa1\xa6"}, - {"¸" , ","}, - {"¹" , "^1"}, - {"»" , ">>"}, - {"¼", "1/4"}, - {"½", "1/2"}, - {"¾", "3/4"}, - {"¿", "^?"}, - - {"À", "A`"}, - {"Á", "A'"}, - {"Â" , "A^"}, - {"Ã", "A~"}, - {"Ä" , "A\xa1\xaf"}, - {"Å" , "A\xa1\xeb"}, - {"Æ" , "AE"}, - {"È", "E`"}, - {"É", "E'"}, - {"Ê" , "E^"}, - {"Ë" , "E\xa1\xaf"}, - {"Ì", "I`"}, - {"Í", "I'"}, - {"Î" , "I^"}, - {"Ï" , "I\xa1\xaf"}, - - {"Ñ", "N~"}, - {"Ò", "O`"}, - {"Ó", "O'"}, - {"Ô" , "O^"}, - {"Õ", "O~"}, - {"Ö" , "O\xa1\xaf"}, - {"×" , "\xa1\xdf"}, - {"Ù", "U`"}, - {"Ú", "U'"}, - {"Û" , "U^"}, - {"Ü" , "U\xa1\xaf"}, - {"Ý", "Y'"}, - - {"à", "a`"}, - {"á", "a'"}, - {"â" , "a^"}, - {"ã", "a~"}, - {"ä" , "a\xa1\xaf"}, - {"å" , "a\xa1\xeb"}, - {"æ" , "ae"}, - {"è", "e`"}, - {"é", "e'"}, - {"ê" , "e^"}, - {"ë" , "e\xa1\xaf"}, - {"ì", "i`"}, - {"í", "i'"}, - {"î" , "i^"}, - {"ï" , "i\xa1\xaf"}, - - {"ð" , "\xa2\xdf"}, - {"ñ", "n~"}, - {"ò", "o`"}, - {"ó", "o'"}, - {"ô" , "o^"}, - {"õ", "o~"}, - {"ö" , "o\xa1\xaf"}, - {"÷", "\xa1\xe0"}, - {"ù", "u`"}, - {"ú", "u'"}, - {"û" , "u^"}, - {"ü" , "u\xa1\xaf"}, - {"ý", "y'"}, - {"ÿ" , "y\xa1\xaf"}, -}; - -static HTMLSymbol latin_symbol_list[] = { - {"¡" , "\xa1"}, - {"¢" , "\xa2"}, - {"£" , "\xa3"}, - {"¤", "\xa4"}, - {"¥" , "\xa5"}, - {"¦", "\xa6"}, - {"§" , "\xa7"}, - {"¨" , "\xa8"}, - {"©" , "\xa9"}, - {"ª" , "\xaa"}, - {"«" , "\xab"}, - {"¬" , "\xac"}, - {"­" , "\xad"}, - {"®" , "\xae"}, - {"¯" , "\xaf"}, - - {"°" , "\xb0"}, - {"±", "\xb1"}, - {"²" , "\xb2"}, - {"³" , "\xb3"}, - {"´" , "\xb4"}, - {"µ" , "\xb5"}, - {"¶" , "\xb6"}, - {"·", "\xb7"}, - {"¸" , "\xb8"}, - {"¹" , "\xb9"}, - {"º" , "\xba"}, - {"»" , "\xbb"}, - {"¼", "\xbc"}, - {"½", "\xbd"}, - {"¾", "\xbe"}, - {"¿", "\xbf"}, - - {"À", "\xc0"}, - {"Á", "\xc1"}, - {"Â" , "\xc2"}, - {"Ã", "\xc3"}, - {"Ä" , "\xc4"}, - {"Å" , "\xc5"}, - {"Æ" , "\xc6"}, - {"Ç", "\xc7"}, - {"È", "\xc8"}, - {"É", "\xc9"}, - {"Ê" , "\xca"}, - {"Ë" , "\xcb"}, - {"Ì", "\xcc"}, - {"Í", "\xcd"}, - {"Î" , "\xce"}, - {"Ï" , "\xcf"}, - - {"Ð" , "\xd0"}, - {"Ñ", "\xd1"}, - {"Ò", "\xd2"}, - {"Ó", "\xd3"}, - {"Ô" , "\xd4"}, - {"Õ", "\xd5"}, - {"Ö" , "\xd6"}, - {"×" , "\xd7"}, - {"Ø", "\xd8"}, - {"Ù", "\xd9"}, - {"Ú", "\xda"}, - {"Û" , "\xdb"}, - {"Ü" , "\xdc"}, - {"Ý", "\xdd"}, - {"Þ" , "\xde"}, - {"ß" , "\xdf"}, - - {"à", "\xe0"}, - {"á", "\xe1"}, - {"â" , "\xe2"}, - {"ã", "\xe3"}, - {"ä" , "\xe4"}, - {"å" , "\xe5"}, - {"æ" , "\xe6"}, - {"ç", "\xe7"}, - {"è", "\xe8"}, - {"é", "\xe9"}, - {"ê" , "\xea"}, - {"ë" , "\xeb"}, - {"ì", "\xec"}, - {"í", "\xed"}, - {"î" , "\xee"}, - {"ï" , "\xef"}, - - {"ð" , "\xf0"}, - {"ñ", "\xf1"}, - {"ò", "\xf2"}, - {"ó", "\xf3"}, - {"ô" , "\xf4"}, - {"õ", "\xf5"}, - {"ö" , "\xf6"}, - {"÷", "\xf7"}, - {"ø", "\xf8"}, - {"ù", "\xf9"}, - {"ú", "\xfa"}, - {"û" , "\xfb"}, - {"ü" , "\xfc"}, - {"ý", "\xfd"}, - {"þ" , "\xfe"}, - {"ÿ" , "\xff"}, -}; - static GHashTable *default_symbol_table; -static GHashTable *eucjp_symbol_table; -static GHashTable *latin_symbol_table; static HTMLState html_read_line (HTMLParser *parser); static void html_append_char (HTMLParser *parser, @@ -354,31 +160,10 @@ HTMLParser *html_parser_new(FILE *fp, CodeConverter *conv) SYMBOL_TABLE_ADD(default_symbol_table, symbol_list); SYMBOL_TABLE_ADD(default_symbol_table, ascii_symbol_list); } - if (!eucjp_symbol_table) { - eucjp_symbol_table = - g_hash_table_new(g_str_hash, g_str_equal); - SYMBOL_TABLE_ADD(eucjp_symbol_table, symbol_list); - SYMBOL_TABLE_ADD(eucjp_symbol_table, eucjp_symbol_list); - } - if (!latin_symbol_table) { - latin_symbol_table = - g_hash_table_new(g_str_hash, g_str_equal); - SYMBOL_TABLE_ADD(latin_symbol_table, symbol_list); - SYMBOL_TABLE_ADD(latin_symbol_table, latin_symbol_list); - } #undef SYMBOL_TABLE_ADD - if (conv->charset == C_ISO_8859_1) - parser->symbol_table = latin_symbol_table; - else if ((conv->charset == C_ISO_2022_JP || - conv->charset == C_ISO_2022_JP_2 || - conv->charset == C_EUC_JP || - conv->charset == C_SHIFT_JIS) && - conv_get_locale_charset() == C_EUC_JP) - parser->symbol_table = eucjp_symbol_table; - else - parser->symbol_table = default_symbol_table; + parser->symbol_table = default_symbol_table; return parser; } @@ -534,7 +319,7 @@ static HTMLTag *html_get_tag(const gchar *str) tag = g_new0(HTMLTag, 1); - for (tmpp = tmp; *tmpp != '\0' && !isspace(*tmpp); tmpp++) + for (tmpp = tmp; *tmpp != '\0' && !g_ascii_isspace(*tmpp); tmpp++) ; if (*tmpp == '\0') { @@ -554,18 +339,20 @@ static HTMLTag *html_get_tag(const gchar *str) gchar *p; gchar quote; - while (isspace(*tmpp)) tmpp++; + while (g_ascii_isspace(*tmpp)) tmpp++; attr_name = tmpp; - while (*tmpp != '\0' && !isspace(*tmpp) && *tmpp != '=') tmpp++; + while (*tmpp != '\0' && !g_ascii_isspace(*tmpp) && + *tmpp != '=') + tmpp++; if (*tmpp != '\0' && *tmpp != '=') { *tmpp++ = '\0'; - while (isspace(*tmpp)) tmpp++; + while (g_ascii_isspace(*tmpp)) tmpp++; } if (*tmpp == '=') { *tmpp++ = '\0'; - while (isspace(*tmpp)) tmpp++; + while (g_ascii_isspace(*tmpp)) tmpp++; if (*tmpp == '"' || *tmpp == '\'') { /* name="value" */ @@ -578,11 +365,11 @@ static HTMLTag *html_get_tag(const gchar *str) } tmpp = p; *tmpp++ = '\0'; - while (isspace(*tmpp)) tmpp++; + while (g_ascii_isspace(*tmpp)) tmpp++; } else { /* name=value */ attr_value = tmpp; - while (*tmpp != '\0' && !isspace(*tmpp)) tmpp++; + while (*tmpp != '\0' && !g_ascii_isspace(*tmpp)) tmpp++; if (*tmpp != '\0') *tmpp++ = '\0'; } @@ -667,7 +454,7 @@ static HTMLState html_parse_tag(HTMLParser *parser) !strcmp(tag->name, "li") || !strcmp(tag->name, "table") || !strcmp(tag->name, "tr") || - (tag->name[0] == 'h' && isdigit((guchar)tag->name[1]))) { + (tag->name[0] == 'h' && g_ascii_isdigit(tag->name[1]))) { if (!parser->newline) { parser->space = FALSE; html_append_char(parser, '\n'); @@ -676,7 +463,7 @@ static HTMLState html_parse_tag(HTMLParser *parser) } else if (!strcmp(tag->name, "/table") || (tag->name[0] == '/' && tag->name[1] == 'h' && - isdigit((guchar)tag->name[1]))) { + g_ascii_isdigit(tag->name[1]))) { if (!parser->empty_line) { parser->space = FALSE; if (!parser->newline) html_append_char(parser, '\n'); @@ -724,7 +511,7 @@ static void html_parse_special(HTMLParser *parser) html_append_str(parser, val, -1); parser->state = HTML_NORMAL; return; - } else if (symbol_name[1] == '#' && isdigit((guchar)symbol_name[2])) { + } else if (symbol_name[1] == '#' && g_ascii_isdigit(symbol_name[2])) { gint ch; ch = atoi(symbol_name + 2); diff --git a/src/html.h b/src/html.h index c7e1a75af..72a55748c 100644 --- a/src/html.h +++ b/src/html.h @@ -1,6 +1,6 @@ /* * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2003 Hiroyuki Yamamoto + * Copyright (C) 1999-2005 Hiroyuki Yamamoto * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/importmutt.c b/src/importmutt.c index 100a0438b..0d110bf44 100644 --- a/src/importmutt.c +++ b/src/importmutt.c @@ -285,8 +285,9 @@ static void imp_mutt_create( gboolean *cancelled ) { gtk_box_pack_start(GTK_BOX(hsbox), statusbar, TRUE, TRUE, BORDER_WIDTH); /* Button panel */ - gtkut_button_set_create(&hbbox, &ok_btn, _("OK"), - &cancel_btn, _("Cancel"), NULL, NULL); + gtkut_stock_button_set_create(&hbbox, &ok_btn, GTK_STOCK_OK, + &cancel_btn, GTK_STOCK_CANCEL, + NULL, NULL); gtk_box_pack_end(GTK_BOX(vbox), hbbox, FALSE, FALSE, 0); gtk_container_set_border_width( GTK_CONTAINER(hbbox), 0 ); gtk_widget_grab_default(ok_btn); diff --git a/src/importpine.c b/src/importpine.c index 11a63443e..80afee610 100644 --- a/src/importpine.c +++ b/src/importpine.c @@ -285,8 +285,9 @@ static void imp_pine_create( gboolean *cancelled ) { gtk_box_pack_start(GTK_BOX(hsbox), statusbar, TRUE, TRUE, BORDER_WIDTH); /* Button panel */ - gtkut_button_set_create(&hbbox, &ok_btn, _("OK"), - &cancel_btn, _("Cancel"), NULL, NULL); + gtkut_stock_button_set_create(&hbbox, &ok_btn, GTK_STOCK_OK, + &cancel_btn, GTK_STOCK_CANCEL, + NULL, NULL); gtk_box_pack_end(GTK_BOX(vbox), hbbox, FALSE, FALSE, 0); gtk_container_set_border_width( GTK_CONTAINER(hbbox), 0 ); gtk_widget_grab_default(ok_btn); diff --git a/src/main.c b/src/main.c index 5489b1a02..9edeafdf8 100644 --- a/src/main.c +++ b/src/main.c @@ -150,12 +150,6 @@ static void quit_signal_handler (int sig); static void install_basic_sighandlers (void); static void exit_sylpheed (MainWindow *mainwin); -#if 0 -/* for gettext */ -_("File `%s' already exists.\n" - "Can't create folder.") -#endif - #define MAKE_DIR_IF_NOT_EXIST(dir) \ { \ if (!is_dir_exist(dir)) { \ diff --git a/src/mainwindow.c b/src/mainwindow.c index e86774151..66d846ea2 100644 --- a/src/mainwindow.c +++ b/src/mainwindow.c @@ -488,7 +488,7 @@ static GtkItemFactoryEntry mainwin_entries[] = NULL, toggle_statusbar_cb, 0, ""}, {N_("/_View/---"), NULL, NULL, 0, ""}, {N_("/_View/Separate f_older tree"), NULL, separate_widget_cb, SEPARATE_FOLDER, ""}, - {N_("/_View/Separate m_essage view"), NULL, separate_widget_cb, SEPARATE_MESSAGE, ""}, + {N_("/_View/Separate _message view"), NULL, separate_widget_cb, SEPARATE_MESSAGE, ""}, {N_("/_View/---"), NULL, NULL, 0, ""}, {N_("/_View/_Sort"), NULL, NULL, 0, ""}, {N_("/_View/_Sort/by _number"), NULL, sort_summary_cb, SORT_BY_NUMBER, ""}, @@ -544,95 +544,104 @@ static GtkItemFactoryEntry mainwin_entries[] = {N_("/_View/_Go to/Other _folder..."), "G", goto_folder_cb, 0, NULL}, {N_("/_View/---"), NULL, NULL, 0, ""}, -#define CODESET_SEPARATOR \ - {N_("/_View/_Code set/---"), NULL, NULL, 0, ""} -#define CODESET_ACTION(action) \ - NULL, set_charset_cb, action, "/View/Code set/Auto detect" +#define ENC_SEPARATOR \ + {N_("/_View/Character _encoding/---"), NULL, NULL, 0, ""} +#define ENC_ACTION(action) \ + NULL, set_charset_cb, action, "/View/Character encoding/Auto detect" - {N_("/_View/_Code set"), NULL, NULL, 0, ""}, - {N_("/_View/_Code set/_Auto detect"), + {N_("/_View/Character _encoding"), NULL, NULL, 0, ""}, + {N_("/_View/Character _encoding/_Auto detect"), NULL, set_charset_cb, C_AUTO, ""}, - {N_("/_View/_Code set/---"), NULL, NULL, 0, ""}, - {N_("/_View/_Code set/7bit ascii (US-ASC_II)"), - CODESET_ACTION(C_US_ASCII)}, - - {N_("/_View/_Code set/Unicode (_UTF-8)"), - CODESET_ACTION(C_UTF_8)}, - CODESET_SEPARATOR, - {N_("/_View/_Code set/Western European (ISO-8859-_1)"), - CODESET_ACTION(C_ISO_8859_1)}, - {N_("/_View/_Code set/Western European (ISO-8859-15)"), - CODESET_ACTION(C_ISO_8859_15)}, - CODESET_SEPARATOR, - {N_("/_View/_Code set/Central European (ISO-8859-_2)"), - CODESET_ACTION(C_ISO_8859_2)}, - CODESET_SEPARATOR, - {N_("/_View/_Code set/_Baltic (ISO-8859-13)"), - CODESET_ACTION(C_ISO_8859_13)}, - {N_("/_View/_Code set/Baltic (ISO-8859-_4)"), - CODESET_ACTION(C_ISO_8859_4)}, - CODESET_SEPARATOR, - {N_("/_View/_Code set/Greek (ISO-8859-_7)"), - CODESET_ACTION(C_ISO_8859_7)}, - CODESET_SEPARATOR, - {N_("/_View/_Code set/Turkish (ISO-8859-_9)"), - CODESET_ACTION(C_ISO_8859_9)}, - CODESET_SEPARATOR, - {N_("/_View/_Code set/Cyrillic (ISO-8859-_5)"), - CODESET_ACTION(C_ISO_8859_5)}, - {N_("/_View/_Code set/Cyrillic (KOI8-_R)"), - CODESET_ACTION(C_KOI8_R)}, - {N_("/_View/_Code set/Cyrillic (KOI8-U)"), - CODESET_ACTION(C_KOI8_U)}, - {N_("/_View/_Code set/Cyrillic (Windows-1251)"), - CODESET_ACTION(C_WINDOWS_1251)}, - CODESET_SEPARATOR, - {N_("/_View/_Code set/Japanese (ISO-2022-_JP)"), - CODESET_ACTION(C_ISO_2022_JP)}, - {N_("/_View/_Code set/Japanese (ISO-2022-JP-2)"), - CODESET_ACTION(C_ISO_2022_JP_2)}, - {N_("/_View/_Code set/Japanese (_EUC-JP)"), - CODESET_ACTION(C_EUC_JP)}, - {N_("/_View/_Code set/Japanese (_Shift__JIS)"), - CODESET_ACTION(C_SHIFT_JIS)}, - CODESET_SEPARATOR, - {N_("/_View/_Code set/Simplified Chinese (_GB2312)"), - CODESET_ACTION(C_GB2312)}, - {N_("/_View/_Code set/Traditional Chinese (_Big5)"), - CODESET_ACTION(C_BIG5)}, - {N_("/_View/_Code set/Traditional Chinese (EUC-_TW)"), - CODESET_ACTION(C_EUC_TW)}, - {N_("/_View/_Code set/Chinese (ISO-2022-_CN)"), - CODESET_ACTION(C_ISO_2022_CN)}, - CODESET_SEPARATOR, - {N_("/_View/_Code set/Korean (EUC-_KR)"), - CODESET_ACTION(C_EUC_KR)}, - {N_("/_View/_Code set/Korean (ISO-2022-KR)"), - CODESET_ACTION(C_ISO_2022_KR)}, - CODESET_SEPARATOR, - {N_("/_View/_Code set/Thai (TIS-620)"), - CODESET_ACTION(C_TIS_620)}, - {N_("/_View/_Code set/Thai (Windows-874)"), - CODESET_ACTION(C_WINDOWS_874)}, - -#undef CODESET_SEPARATOR -#undef CODESET_ACTION - -#define DECODE_SEPARATOR \ + {N_("/_View/Character _encoding/---"), NULL, NULL, 0, ""}, + {N_("/_View/Character _encoding/7bit ascii (US-ASC_II)"), + ENC_ACTION(C_US_ASCII)}, + {N_("/_View/Character _encoding/Unicode (_UTF-8)"), + ENC_ACTION(C_UTF_8)}, + ENC_SEPARATOR, + + {N_("/_View/Character _encoding/Western European (ISO-8859-_1)"), + ENC_ACTION(C_ISO_8859_1)}, + {N_("/_View/Character _encoding/Western European (ISO-8859-15)"), + ENC_ACTION(C_ISO_8859_15)}, + ENC_SEPARATOR, + + {N_("/_View/Character _encoding/Central European (ISO-8859-_2)"), + ENC_ACTION(C_ISO_8859_2)}, + ENC_SEPARATOR, + + {N_("/_View/Character _encoding/_Baltic (ISO-8859-13)"), + ENC_ACTION(C_ISO_8859_13)}, + {N_("/_View/Character _encoding/Baltic (ISO-8859-_4)"), + ENC_ACTION(C_ISO_8859_4)}, + ENC_SEPARATOR, + + {N_("/_View/Character _encoding/Greek (ISO-8859-_7)"), + ENC_ACTION(C_ISO_8859_7)}, + ENC_SEPARATOR, + + {N_("/_View/Character _encoding/Turkish (ISO-8859-_9)"), + ENC_ACTION(C_ISO_8859_9)}, + ENC_SEPARATOR, + + {N_("/_View/Character _encoding/Cyrillic (ISO-8859-_5)"), + ENC_ACTION(C_ISO_8859_5)}, + {N_("/_View/Character _encoding/Cyrillic (KOI8-_R)"), + ENC_ACTION(C_KOI8_R)}, + {N_("/_View/Character _encoding/Cyrillic (KOI8-U)"), + ENC_ACTION(C_KOI8_U)}, + {N_("/_View/Character _encoding/Cyrillic (Windows-1251)"), + ENC_ACTION(C_CP1251)}, + ENC_SEPARATOR, + + {N_("/_View/Character _encoding/Japanese (ISO-2022-_JP)"), + ENC_ACTION(C_ISO_2022_JP)}, + {N_("/_View/Character _encoding/Japanese (ISO-2022-JP-2)"), + ENC_ACTION(C_ISO_2022_JP_2)}, + {N_("/_View/Character _encoding/Japanese (_EUC-JP)"), + ENC_ACTION(C_EUC_JP)}, + {N_("/_View/Character _encoding/Japanese (_Shift__JIS)"), + ENC_ACTION(C_SHIFT_JIS)}, + ENC_SEPARATOR, + + {N_("/_View/Character _encoding/Simplified Chinese (_GB2312)"), + ENC_ACTION(C_GB2312)}, + {N_("/_View/Character _encoding/Traditional Chinese (_Big5)"), + ENC_ACTION(C_BIG5)}, + {N_("/_View/Character _encoding/Traditional Chinese (EUC-_TW)"), + ENC_ACTION(C_EUC_TW)}, + {N_("/_View/Character _encoding/Chinese (ISO-2022-_CN)"), + ENC_ACTION(C_ISO_2022_CN)}, + ENC_SEPARATOR, + + {N_("/_View/Character _encoding/Korean (EUC-_KR)"), + ENC_ACTION(C_EUC_KR)}, + {N_("/_View/Character _encoding/Korean (ISO-2022-KR)"), + ENC_ACTION(C_ISO_2022_KR)}, + ENC_SEPARATOR, + + {N_("/_View/Character _encoding/Thai (TIS-620)"), + ENC_ACTION(C_TIS_620)}, + {N_("/_View/Character _encoding/Thai (Windows-874)"), + ENC_ACTION(C_WINDOWS_874)}, + +#undef ENC_SEPARATOR +#undef ENC_ACTION + +#define DEC_SEPARATOR \ {N_("/_View/Decode/---"), NULL, NULL, 0, ""} -#define DECODE_ACTION(action) \ +#define DEC_ACTION(action) \ NULL, set_decode_cb, action, "/View/Decode/Auto detect" {N_("/_View/Decode"), NULL, NULL, 0, ""}, {N_("/_View/Decode/_Auto detect"), NULL, set_decode_cb, 0, ""}, {N_("/_View/Decode/---"), NULL, NULL, 0, ""}, - {N_("/_View/Decode/_8bit"), DECODE_ACTION(ENC_8BIT)}, - {N_("/_View/Decode/_Quoted printable"), DECODE_ACTION(ENC_QUOTED_PRINTABLE)}, - {N_("/_View/Decode/_Base64"), DECODE_ACTION(ENC_BASE64)}, - {N_("/_View/Decode/_Uuencode"), DECODE_ACTION(ENC_X_UUENCODE)}, + {N_("/_View/Decode/_8bit"), DEC_ACTION(ENC_8BIT)}, + {N_("/_View/Decode/_Quoted printable"), DEC_ACTION(ENC_QUOTED_PRINTABLE)}, + {N_("/_View/Decode/_Base64"), DEC_ACTION(ENC_BASE64)}, + {N_("/_View/Decode/_Uuencode"), DEC_ACTION(ENC_X_UUENCODE)}, -#undef DECODE_SEPARATOR -#undef DECODE_ACTION +#undef DEC_SEPARATOR +#undef DEC_ACTION {N_("/_View/---"), NULL, NULL, 0, ""}, {N_("/_View/Open in new _window"), "N", open_msg_cb, 0, NULL}, @@ -1026,7 +1035,7 @@ MainWindow *main_window_create(SeparateType type) /* set menu items */ menuitem = gtk_item_factory_get_item - (ifactory, "/View/Code set/Auto detect"); + (ifactory, "/View/Character encoding/Auto detect"); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE); switch (prefs_common.toolbar_style) { @@ -1468,17 +1477,20 @@ void main_window_toggle_message_view(MainWindow *mainwin) gtk_widget_ref(vpaned); gtkut_container_remove(GTK_CONTAINER(container), vpaned); gtk_widget_reparent(GTK_WIDGET_PTR(summaryview), container); - gtk_arrow_set(GTK_ARROW(summaryview->toggle_arrow), - GTK_ARROW_UP, GTK_SHADOW_OUT); } else { mainwin->messageview->visible = TRUE; gtk_widget_reparent(GTK_WIDGET_PTR(summaryview), vpaned); gtk_container_add(GTK_CONTAINER(container), vpaned); gtk_widget_unref(vpaned); - gtk_arrow_set(GTK_ARROW(summaryview->toggle_arrow), - GTK_ARROW_DOWN, GTK_SHADOW_OUT); } + if (messageview_is_visible(mainwin->messageview)) + gtk_arrow_set(GTK_ARROW(mainwin->summaryview->toggle_arrow), + GTK_ARROW_DOWN, GTK_SHADOW_OUT); + else + gtk_arrow_set(GTK_ARROW(mainwin->summaryview->toggle_arrow), + GTK_ARROW_UP, GTK_SHADOW_OUT); + if (mainwin->messageview->visible == FALSE) messageview_clear(mainwin->messageview); @@ -1982,6 +1994,16 @@ static void main_window_set_widgets(MainWindow *mainwin, SeparateType type) debug_print("Setting widgets... "); + gtk_widget_set_size_request(GTK_WIDGET_PTR(mainwin->folderview), + prefs_common.folderview_width, + prefs_common.folderview_height); + gtk_widget_set_size_request(GTK_WIDGET_PTR(mainwin->summaryview), + prefs_common.summaryview_width, + prefs_common.summaryview_height); + gtk_widget_set_size_request(GTK_WIDGET_PTR(mainwin->messageview), + prefs_common.msgview_width, + prefs_common.msgview_height); + /* create separated window(s) if needed */ if (type & SEPARATE_FOLDER) { folderwin = gtk_window_new(GTK_WINDOW_TOPLEVEL); @@ -2025,16 +2047,6 @@ static void main_window_set_widgets(MainWindow *mainwin, SeparateType type) mainwin->messageview->statusbar_cid = mainwin->messageview_cid; } - gtk_widget_set_size_request(GTK_WIDGET_PTR(mainwin->folderview), - prefs_common.folderview_width, - prefs_common.folderview_height); - gtk_widget_set_size_request(GTK_WIDGET_PTR(mainwin->summaryview), - prefs_common.summaryview_width, - prefs_common.summaryview_height); - gtk_widget_set_size_request(GTK_WIDGET_PTR(mainwin->messageview), - prefs_common.msgview_width, - prefs_common.msgview_height); - switch (type) { case SEPARATE_NONE: hpaned = gtk_hpaned_new(); @@ -2138,6 +2150,13 @@ static void main_window_set_widgets(MainWindow *mainwin, SeparateType type) break; } + if (messageview_is_visible(mainwin->messageview)) + gtk_arrow_set(GTK_ARROW(mainwin->summaryview->toggle_arrow), + GTK_ARROW_DOWN, GTK_SHADOW_OUT); + else + gtk_arrow_set(GTK_ARROW(mainwin->summaryview->toggle_arrow), + GTK_ARROW_UP, GTK_SHADOW_OUT); + gtk_window_move(GTK_WINDOW(mainwin->window), prefs_common.mainwin_x, prefs_common.mainwin_y); @@ -2168,9 +2187,9 @@ static void main_window_set_widgets(MainWindow *mainwin, SeparateType type) gtk_widget_set_sensitive(menuitem, ((type & SEPARATE_FOLDER) != 0)); menuitem = gtk_item_factory_get_item (ifactory, "/View/Show or hide/Message view"); - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), - (type & SEPARATE_MESSAGE) == 0 ? TRUE : - prefs_common.msgview_visible); + gtk_check_menu_item_set_active + (GTK_CHECK_MENU_ITEM(menuitem), + messageview_is_visible(mainwin->messageview)); menuitem = gtk_item_factory_get_item (ifactory, "/View/Separate folder tree"); diff --git a/src/messageview.c b/src/messageview.c index d915de2d4..b553630cd 100644 --- a/src/messageview.c +++ b/src/messageview.c @@ -1,6 +1,6 @@ /* * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2004 Hiroyuki Yamamoto + * Copyright (C) 1999-2005 Hiroyuki Yamamoto * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include @@ -166,95 +165,95 @@ static GtkItemFactoryEntry msgview_entries[] = {N_("/_View"), NULL, NULL, 0, ""}, -#define CODESET_SEPARATOR \ - {N_("/_View/_Code set/---"), NULL, NULL, 0, ""} -#define CODESET_ACTION(action) \ - NULL, set_charset_cb, action, "/View/Code set/Auto detect" +#define ENC_SEPARATOR \ + {N_("/_View/Character _encoding/---"), NULL, NULL, 0, ""} +#define ENC_ACTION(action) \ + NULL, set_charset_cb, action, "/View/Character encoding/Auto detect" - {N_("/_View/_Code set"), NULL, NULL, 0, ""}, - {N_("/_View/_Code set/_Auto detect"), + {N_("/_View/Character _encoding"), NULL, NULL, 0, ""}, + {N_("/_View/Character _encoding/_Auto detect"), NULL, set_charset_cb, C_AUTO, ""}, - CODESET_SEPARATOR, - {N_("/_View/_Code set/7bit ascii (US-ASC_II)"), - CODESET_ACTION(C_US_ASCII)}, - - {N_("/_View/_Code set/Unicode (_UTF-8)"), - CODESET_ACTION(C_UTF_8)}, - CODESET_SEPARATOR, - {N_("/_View/_Code set/Western European (ISO-8859-_1)"), - CODESET_ACTION(C_ISO_8859_1)}, - {N_("/_View/_Code set/Western European (ISO-8859-15)"), - CODESET_ACTION(C_ISO_8859_15)}, - CODESET_SEPARATOR, - {N_("/_View/_Code set/Central European (ISO-8859-_2)"), - CODESET_ACTION(C_ISO_8859_2)}, - CODESET_SEPARATOR, - {N_("/_View/_Code set/_Baltic (ISO-8859-13)"), - CODESET_ACTION(C_ISO_8859_13)}, - {N_("/_View/_Code set/Baltic (ISO-8859-_4)"), - CODESET_ACTION(C_ISO_8859_4)}, - CODESET_SEPARATOR, - {N_("/_View/_Code set/Greek (ISO-8859-_7)"), - CODESET_ACTION(C_ISO_8859_7)}, - CODESET_SEPARATOR, - {N_("/_View/_Code set/Turkish (ISO-8859-_9)"), - CODESET_ACTION(C_ISO_8859_9)}, - CODESET_SEPARATOR, - {N_("/_View/_Code set/Cyrillic (ISO-8859-_5)"), - CODESET_ACTION(C_ISO_8859_5)}, - {N_("/_View/_Code set/Cyrillic (KOI8-_R)"), - CODESET_ACTION(C_KOI8_R)}, - {N_("/_View/_Code set/Cyrillic (KOI8-U)"), - CODESET_ACTION(C_KOI8_U)}, - {N_("/_View/_Code set/Cyrillic (Windows-1251)"), - CODESET_ACTION(C_CP1251)}, - CODESET_SEPARATOR, - {N_("/_View/_Code set/Japanese (ISO-2022-_JP)"), - CODESET_ACTION(C_ISO_2022_JP)}, - {N_("/_View/_Code set/Japanese (ISO-2022-JP-2)"), - CODESET_ACTION(C_ISO_2022_JP_2)}, - {N_("/_View/_Code set/Japanese (_EUC-JP)"), - CODESET_ACTION(C_EUC_JP)}, - {N_("/_View/_Code set/Japanese (_Shift__JIS)"), - CODESET_ACTION(C_SHIFT_JIS)}, - CODESET_SEPARATOR, - {N_("/_View/_Code set/Simplified Chinese (_GB2312)"), - CODESET_ACTION(C_GB2312)}, - {N_("/_View/_Code set/Traditional Chinese (_Big5)"), - CODESET_ACTION(C_BIG5)}, - {N_("/_View/_Code set/Traditional Chinese (EUC-_TW)"), - CODESET_ACTION(C_EUC_TW)}, - {N_("/_View/_Code set/Chinese (ISO-2022-_CN)"), - CODESET_ACTION(C_ISO_2022_CN)}, - CODESET_SEPARATOR, - {N_("/_View/_Code set/Korean (EUC-_KR)"), - CODESET_ACTION(C_EUC_KR)}, - {N_("/_View/_Code set/Korean (ISO-2022-KR)"), - CODESET_ACTION(C_ISO_2022_KR)}, - CODESET_SEPARATOR, - {N_("/_View/_Code set/Thai (TIS-620)"), - CODESET_ACTION(C_TIS_620)}, - {N_("/_View/_Code set/Thai (Windows-874)"), - CODESET_ACTION(C_WINDOWS_874)}, - -#undef CODESET_SEPARATOR -#undef CODESET_ACTION - -#define DECODE_SEPARATOR \ + ENC_SEPARATOR, + {N_("/_View/Character _encoding/7bit ascii (US-ASC_II)"), + ENC_ACTION(C_US_ASCII)}, + + {N_("/_View/Character _encoding/Unicode (_UTF-8)"), + ENC_ACTION(C_UTF_8)}, + ENC_SEPARATOR, + {N_("/_View/Character _encoding/Western European (ISO-8859-_1)"), + ENC_ACTION(C_ISO_8859_1)}, + {N_("/_View/Character _encoding/Western European (ISO-8859-15)"), + ENC_ACTION(C_ISO_8859_15)}, + ENC_SEPARATOR, + {N_("/_View/Character _encoding/Central European (ISO-8859-_2)"), + ENC_ACTION(C_ISO_8859_2)}, + ENC_SEPARATOR, + {N_("/_View/Character _encoding/_Baltic (ISO-8859-13)"), + ENC_ACTION(C_ISO_8859_13)}, + {N_("/_View/Character _encoding/Baltic (ISO-8859-_4)"), + ENC_ACTION(C_ISO_8859_4)}, + ENC_SEPARATOR, + {N_("/_View/Character _encoding/Greek (ISO-8859-_7)"), + ENC_ACTION(C_ISO_8859_7)}, + ENC_SEPARATOR, + {N_("/_View/Character _encoding/Turkish (ISO-8859-_9)"), + ENC_ACTION(C_ISO_8859_9)}, + ENC_SEPARATOR, + {N_("/_View/Character _encoding/Cyrillic (ISO-8859-_5)"), + ENC_ACTION(C_ISO_8859_5)}, + {N_("/_View/Character _encoding/Cyrillic (KOI8-_R)"), + ENC_ACTION(C_KOI8_R)}, + {N_("/_View/Character _encoding/Cyrillic (KOI8-U)"), + ENC_ACTION(C_KOI8_U)}, + {N_("/_View/Character _encoding/Cyrillic (Windows-1251)"), + ENC_ACTION(C_CP1251)}, + ENC_SEPARATOR, + {N_("/_View/Character _encoding/Japanese (ISO-2022-_JP)"), + ENC_ACTION(C_ISO_2022_JP)}, + {N_("/_View/Character _encoding/Japanese (ISO-2022-JP-2)"), + ENC_ACTION(C_ISO_2022_JP_2)}, + {N_("/_View/Character _encoding/Japanese (_EUC-JP)"), + ENC_ACTION(C_EUC_JP)}, + {N_("/_View/Character _encoding/Japanese (_Shift__JIS)"), + ENC_ACTION(C_SHIFT_JIS)}, + ENC_SEPARATOR, + {N_("/_View/Character _encoding/Simplified Chinese (_GB2312)"), + ENC_ACTION(C_GB2312)}, + {N_("/_View/Character _encoding/Traditional Chinese (_Big5)"), + ENC_ACTION(C_BIG5)}, + {N_("/_View/Character _encoding/Traditional Chinese (EUC-_TW)"), + ENC_ACTION(C_EUC_TW)}, + {N_("/_View/Character _encoding/Chinese (ISO-2022-_CN)"), + ENC_ACTION(C_ISO_2022_CN)}, + ENC_SEPARATOR, + {N_("/_View/Character _encoding/Korean (EUC-_KR)"), + ENC_ACTION(C_EUC_KR)}, + {N_("/_View/Character _encoding/Korean (ISO-2022-KR)"), + ENC_ACTION(C_ISO_2022_KR)}, + ENC_SEPARATOR, + {N_("/_View/Character _encoding/Thai (TIS-620)"), + ENC_ACTION(C_TIS_620)}, + {N_("/_View/Character _encoding/Thai (Windows-874)"), + ENC_ACTION(C_WINDOWS_874)}, + +#undef ENC_SEPARATOR +#undef ENC_ACTION + +#define DEC_SEPARATOR \ {N_("/_View/Decode/---"), NULL, NULL, 0, ""} -#define DECODE_ACTION(action) \ +#define DEC_ACTION(action) \ NULL, set_decode_cb, action, "/View/Decode/Auto detect" {N_("/_View/Decode"), NULL, NULL, 0, ""}, {N_("/_View/Decode/_Auto detect"), NULL, set_decode_cb, 0, ""}, {N_("/_View/Decode/---"), NULL, NULL, 0, ""}, - {N_("/_View/Decode/_8bit"), DECODE_ACTION(ENC_8BIT)}, - {N_("/_View/Decode/_Quoted printable"), DECODE_ACTION(ENC_QUOTED_PRINTABLE)}, - {N_("/_View/Decode/_Base64"), DECODE_ACTION(ENC_BASE64)}, - {N_("/_View/Decode/_Uuencode"), DECODE_ACTION(ENC_X_UUENCODE)}, + {N_("/_View/Decode/_8bit"), DEC_ACTION(ENC_8BIT)}, + {N_("/_View/Decode/_Quoted printable"), DEC_ACTION(ENC_QUOTED_PRINTABLE)}, + {N_("/_View/Decode/_Base64"), DEC_ACTION(ENC_BASE64)}, + {N_("/_View/Decode/_Uuencode"), DEC_ACTION(ENC_X_UUENCODE)}, -#undef DECODE_SEPARATOR -#undef DECODE_ACTION +#undef DEC_SEPARATOR +#undef DEC_ACTION {N_("/_View/---"), NULL, NULL, 0, ""}, {N_("/_View/Mess_age source"), NULL, view_source_cb, 0, NULL}, @@ -920,28 +919,17 @@ void messageview_copy_clipboard(MessageView *messageview) void messageview_select_all(MessageView *messageview) { TextView *text; - GtkTextView *edit = NULL; - GtkTextBuffer *textbuf; - gint body_pos = 0; - GtkTextIter start, end; - - g_return_if_fail(messageview != NULL); text = messageview_get_current_textview(messageview); - g_return_if_fail(text != NULL); - - edit = GTK_TEXT_VIEW(text->text); - g_return_if_fail(edit != NULL); - - textbuf = gtk_text_view_get_buffer(edit); - g_return_if_fail(textbuf != NULL); + if (text) { + GtkTextView *textview = GTK_TEXT_VIEW(text->text); + GtkTextBuffer *buffer; + GtkTextIter start, end; - gtk_text_buffer_get_bounds(textbuf, &start, &end); - - gtk_text_buffer_move_mark_by_name(textbuf, - "selection_bound", &start); - gtk_text_buffer_move_mark_by_name(textbuf, - "insert", &end); + buffer = gtk_text_view_get_buffer(textview); + gtk_text_buffer_get_bounds(buffer, &start, &end); + gtk_text_buffer_select_range(buffer, &start, &end); + } } void messageview_set_position(MessageView *messageview, gint pos) diff --git a/src/plugins/pgpmime/passphrase.c b/src/plugins/pgpmime/passphrase.c index f1cbb62cd..dc69112e5 100644 --- a/src/plugins/pgpmime/passphrase.c +++ b/src/plugins/pgpmime/passphrase.c @@ -22,12 +22,14 @@ #if USE_GPGME -#include -#include -#include #include #include +#include #include +#include +#ifdef GDK_WINDOWING_X11 +# include +#endif /* GDK_WINDOWING_X11 */ #include #include #include @@ -39,9 +41,9 @@ #include #include #include -#ifdef GDK_WINDOWING_X11 -#include /* GDK_DISPLAY() */ -#endif /* GDK_WINDOWING_X11 */ +#include +#include +#include #include "passphrase.h" #include "prefs_common.h" @@ -49,7 +51,7 @@ #include "utils.h" #include "prefs_gpg.h" -static int grab_all = 0; +static gboolean grab_all = FALSE; static gboolean pass_ack; static gchar *last_pass = NULL; @@ -66,14 +68,9 @@ static gchar* passphrase_mbox (const gchar *desc); static GtkWidget *create_description (const gchar *desc); void -gpgmegtk_set_passphrase_grab (gint yes) +gpgmegtk_set_passphrase_grab(gint yes) { -#warning "passphrase grab does not work" -#if 0 grab_all = yes; -#else - grab_all = FALSE; -#endif } static gchar* @@ -129,40 +126,37 @@ passphrase_mbox (const gchar *desc) g_signal_connect(G_OBJECT(cancel_button), "clicked", G_CALLBACK(passphrase_cancel_cb), NULL); - if (grab_all) - g_object_set (G_OBJECT(window), "type", GTK_WINDOW_POPUP, NULL); gtk_window_set_position (GTK_WINDOW(window), GTK_WIN_POS_CENTER); if (grab_all) gtk_window_set_resizable(GTK_WINDOW(window), FALSE); gtk_widget_show_all(window); - /* don't use XIM on entering passphrase */ - gtkut_editable_disable_im(GTK_EDITABLE(pass_entry)); - if (grab_all) { + /* make sure that window is viewable + * FIXME: this is still not enough */ + gtk_widget_show_now(window); + gdk_flush(); #ifdef GDK_WINDOWING_X11 - XGrabServer(GDK_DISPLAY()); + gdk_x11_display_grab(gdk_display_get_default()); #endif /* GDK_WINDOWING_X11 */ - if ( grab_result = gdk_pointer_grab ( window->window, TRUE, 0, - NULL, NULL, GDK_CURRENT_TIME)) { + if (gdk_pointer_grab(window->window, TRUE, 0, + window->window, NULL, GDK_CURRENT_TIME)) { #ifdef GDK_WINDOWING_X11 - XUngrabServer ( GDK_DISPLAY() ); + gdk_x11_display_ungrab(gdk_display_get_default()); #endif /* GDK_WINDOWING_X11 */ - g_warning ("OOPS: Could not grab mouse (grab status %d)\n", - grab_result); - gtk_widget_destroy (window); + g_warning("OOPS: Could not grab mouse\n"); + gtk_widget_destroy(window); return NULL; } - if ( grab_result = gdk_keyboard_grab( window->window, FALSE, - GDK_CURRENT_TIME )) { - gdk_pointer_ungrab (GDK_CURRENT_TIME); + if (gdk_keyboard_grab(window->window, FALSE, GDK_CURRENT_TIME)) { + gdk_display_pointer_ungrab(gdk_display_get_default(), + GDK_CURRENT_TIME); #ifdef GDK_WINDOWING_X11 - XUngrabServer ( GDK_DISPLAY() ); + gdk_x11_display_ungrab(gdk_display_get_default()); #endif /* GDK_WINDOWING_X11 */ - g_warning ("OOPS: Could not grab keyboard (grab status %d)\n", - grab_result); - gtk_widget_destroy (window); + g_warning("OOPS: Could not grab keyboard\n"); + gtk_widget_destroy(window); return NULL; } } @@ -170,11 +164,12 @@ passphrase_mbox (const gchar *desc) gtk_main(); if (grab_all) { + gdk_display_keyboard_ungrab(gdk_display_get_default(), + GDK_CURRENT_TIME); + gdk_display_pointer_ungrab(gdk_display_get_default(), GDK_CURRENT_TIME); #ifdef GDK_WINDOWING_X11 - XUngrabServer (GDK_DISPLAY()); + gdk_x11_display_ungrab(gdk_display_get_default()); #endif /* GDK_WINDOWING_X11 */ - gdk_pointer_ungrab (GDK_CURRENT_TIME); - gdk_keyboard_ungrab (GDK_CURRENT_TIME); gdk_flush(); } diff --git a/src/prefs_common.c b/src/prefs_common.c index 492fb74aa..6ece36ad4 100644 --- a/src/prefs_common.c +++ b/src/prefs_common.c @@ -147,6 +147,7 @@ static struct Message { GtkWidget *chkbtn_mbalnum; GtkWidget *chkbtn_disphdrpane; GtkWidget *chkbtn_disphdr; + GtkWidget *chkbtn_html; GtkWidget *spinbtn_linespc; GtkObject *spinbtn_linespc_adj; @@ -603,6 +604,9 @@ static PrefParam param[] = { {"display_header", "TRUE", &prefs_common.display_header, P_BOOL, &message.chkbtn_disphdr, prefs_set_data_from_toggle, prefs_set_toggle}, + {"render_html", "TRUE", &prefs_common.render_html, P_BOOL, + &message.chkbtn_html, + prefs_set_data_from_toggle, prefs_set_toggle}, {"line_space", "2", &prefs_common.line_space, P_INT, &message.spinbtn_linespc, prefs_set_data_from_spinbtn, prefs_set_spinbtn}, @@ -1219,7 +1223,7 @@ static void prefs_send_create(void) gtk_widget_show (hbox1); gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0); - label_outcharset = gtk_label_new (_("Outgoing codeset")); + label_outcharset = gtk_label_new (_("Outgoing encoding")); gtk_widget_show (label_outcharset); gtk_box_pack_start (GTK_BOX (hbox1), label_outcharset, FALSE, FALSE, 0); @@ -1241,31 +1245,43 @@ static void prefs_send_create(void) } SET_MENUITEM(_("Automatic (Recommended)"), CS_AUTO); + SET_MENUITEM(NULL, NULL); SET_MENUITEM(_("7bit ascii (US-ASCII)"), CS_US_ASCII); + SET_MENUITEM(NULL, NULL); SET_MENUITEM(_("Unicode (UTF-8)"), CS_UTF_8); + SET_MENUITEM(NULL, NULL); SET_MENUITEM(_("Western European (ISO-8859-1)"), CS_ISO_8859_1); SET_MENUITEM(_("Western European (ISO-8859-15)"), CS_ISO_8859_15); + SET_MENUITEM(NULL, NULL); SET_MENUITEM(_("Central European (ISO-8859-2)"), CS_ISO_8859_2); + SET_MENUITEM(NULL, NULL); SET_MENUITEM(_("Baltic (ISO-8859-13)"), CS_ISO_8859_13); SET_MENUITEM(_("Baltic (ISO-8859-4)"), CS_ISO_8859_4); + SET_MENUITEM(NULL, NULL); SET_MENUITEM(_("Greek (ISO-8859-7)"), CS_ISO_8859_7); + SET_MENUITEM(NULL, NULL); SET_MENUITEM(_("Turkish (ISO-8859-9)"), CS_ISO_8859_9); + SET_MENUITEM(NULL, NULL); SET_MENUITEM(_("Cyrillic (ISO-8859-5)"), CS_ISO_8859_5); SET_MENUITEM(_("Cyrillic (KOI8-R)"), CS_KOI8_R); - SET_MENUITEM(_("Cyrillic (Windows-1251)"), CS_WINDOWS_1251); SET_MENUITEM(_("Cyrillic (KOI8-U)"), CS_KOI8_U); + SET_MENUITEM(_("Cyrillic (Windows-1251)"), CS_WINDOWS_1251); + SET_MENUITEM(NULL, NULL); SET_MENUITEM(_("Japanese (ISO-2022-JP)"), CS_ISO_2022_JP); #if 0 SET_MENUITEM(_("Japanese (EUC-JP)"), CS_EUC_JP); SET_MENUITEM(_("Japanese (Shift_JIS)"), CS_SHIFT_JIS); #endif /* 0 */ + SET_MENUITEM(NULL, NULL); SET_MENUITEM(_("Simplified Chinese (GB2312)"), CS_GB2312); SET_MENUITEM(_("Traditional Chinese (Big5)"), CS_BIG5); #if 0 SET_MENUITEM(_("Traditional Chinese (EUC-TW)"), CS_EUC_TW); SET_MENUITEM(_("Chinese (ISO-2022-CN)"), CS_ISO_2022_CN); #endif /* 0 */ + SET_MENUITEM(NULL, NULL); SET_MENUITEM(_("Korean (EUC-KR)"), CS_EUC_KR); + SET_MENUITEM(NULL, NULL); SET_MENUITEM(_("Thai (TIS-620)"), CS_TIS_620); SET_MENUITEM(_("Thai (Windows-874)"), CS_WINDOWS_874); @@ -1753,6 +1769,7 @@ static void prefs_message_create(void) GtkWidget *chkbtn_disphdrpane; GtkWidget *chkbtn_disphdr; GtkWidget *button_edit_disphdr; + GtkWidget *chkbtn_html; GtkWidget *hbox_linespc; GtkWidget *label_linespc; GtkObject *spinbtn_linespc_adj; @@ -1805,6 +1822,9 @@ static void prefs_message_create(void) SET_TOGGLE_SENSITIVITY(chkbtn_disphdr, button_edit_disphdr); + PACK_CHECK_BUTTON(vbox2, chkbtn_html, + _("Render HTML messages as text")); + PACK_VSPACER(vbox2, vbox3, VSPACING_NARROW_2); hbox1 = gtk_hbox_new (FALSE, 32); @@ -1883,6 +1903,7 @@ static void prefs_message_create(void) message.chkbtn_mbalnum = chkbtn_mbalnum; message.chkbtn_disphdrpane = chkbtn_disphdrpane; message.chkbtn_disphdr = chkbtn_disphdr; + message.chkbtn_html = chkbtn_html; message.spinbtn_linespc = spinbtn_linespc; message.chkbtn_smoothscroll = chkbtn_smoothscroll; @@ -2894,7 +2915,7 @@ static void prefs_common_charset_set_optmenu(PrefParam *pparam) g_return_if_fail(*((gchar **)pparam->data) != NULL); index = menu_find_option_menu_index(optmenu, *((gchar **)pparam->data), - (GCompareFunc)strcmp); + (GCompareFunc)strcmp2); if (index >= 0) gtk_option_menu_set_history(optmenu, index); else { diff --git a/src/prefs_common.h b/src/prefs_common.h index 081d408c6..1944f1343 100644 --- a/src/prefs_common.h +++ b/src/prefs_common.h @@ -1,6 +1,6 @@ /* * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2004 Hiroyuki Yamamoto + * Copyright (C) 1999-2005 Hiroyuki Yamamoto * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -231,6 +231,7 @@ struct _PrefsCommon gboolean display_header_pane; gboolean display_header; gint line_space; + gboolean render_html; gboolean enable_smooth_scroll; gint scroll_step; gboolean scroll_halfpage; diff --git a/src/procheader.c b/src/procheader.c index 398f93bf8..15b9e0bce 100644 --- a/src/procheader.c +++ b/src/procheader.c @@ -1,6 +1,6 @@ /* * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2004 Hiroyuki Yamamoto + * Copyright (C) 1999-2005 Hiroyuki Yamamoto * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -166,7 +166,7 @@ gint procheader_get_one_field_asis(gchar *buf, size_t len, FILE *fp) } #if 0 -gchar *procheader_get_unfolded_line(gchar *buf, gint len, FILE *fp) +gchar *procheader_get_unfolded_line(gchar *buf, size_t len, FILE *fp) { gboolean folded = FALSE; gint nexthead; @@ -190,13 +190,13 @@ gchar *procheader_get_unfolded_line(gchar *buf, gint len, FILE *fp) else if (nexthead == EOF) break; else if (folded == TRUE) { - if (nexthead == '\r' || nexthead == '\n') { + if ((len - (bufp - buf)) <= 2) break; + + if (nexthead == '\n') { folded = FALSE; continue; } - if ((len - (bufp - buf)) <= 2) break; - /* replace return code on the tail end with space */ *bufp++ = ' '; @@ -808,6 +808,10 @@ static gint procheader_scan_date_string(const gchar *str, weekday, day, month, year, hh, mm, ss); if (result == 7) return 0; + result = sscanf(str, "%d %9s %d %2d:%2d:%2d", + day, month, year, hh, mm, ss); + if (result == 6) return 0; + *ss = 0; result = sscanf(str, "%10s %d %9s %d %2d:%2d %5s", weekday, day, month, year, hh, mm, zone); @@ -817,6 +821,15 @@ static gint procheader_scan_date_string(const gchar *str, day, month, year, hh, mm, zone); if (result == 6) return 0; + *zone = '\0'; + result = sscanf(str, "%10s %d %9s %d %2d:%2d", + weekday, day, month, year, hh, mm); + if (result == 6) return 0; + + result = sscanf(str, "%d %9s %d %2d:%2d", + day, month, year, hh, mm); + if (result == 5) return 0; + return -1; } diff --git a/src/summaryview.c b/src/summaryview.c index 3bc45cafc..3e8ba5059 100644 --- a/src/summaryview.c +++ b/src/summaryview.c @@ -1,6 +1,6 @@ /* * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2004 Hiroyuki Yamamoto + * Copyright (C) 1999-2005 Hiroyuki Yamamoto * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -2401,12 +2401,13 @@ static void summary_display_msg_full(SummaryView *summaryview, msgview = summaryview->messageview; summaryview->displayed = row; - if (!messageview_is_visible(msgview)) + if (!messageview_is_visible(msgview)) { main_window_toggle_message_view(summaryview->mainwin); + GTK_EVENTS_FLUSH(); + } val = messageview_show(msgview, msginfo, all_headers); if (GTK_CLIST(msgview->mimeview->ctree)->row_list == NULL) gtk_widget_grab_focus(summaryview->ctree); - GTK_EVENTS_FLUSH(); gtkut_ctree_node_move_if_on_the_edge(ctree, row); } @@ -2492,37 +2493,37 @@ void summary_reedit(SummaryView *summaryview) compose_reedit(msginfo); } -void summary_step(SummaryView *summaryview, GtkScrollType type) +gboolean summary_step(SummaryView *summaryview, GtkScrollType type) { GtkCTree *ctree = GTK_CTREE(summaryview->ctree); GtkCTreeNode *node; - if (summary_is_locked(summaryview)) return; + if (summary_is_locked(summaryview)) return FALSE; if (type == GTK_SCROLL_STEP_FORWARD) { node = gtkut_ctree_node_next(ctree, summaryview->selected); if (node) gtkut_ctree_expand_parent_all(ctree, node); else - return; + return FALSE; } else { if (summaryview->selected) { node = GTK_CTREE_NODE_PREV(summaryview->selected); - if (!node) return; + if (!node) return FALSE; } } if (messageview_is_visible(summaryview->messageview)) summaryview->display_msg = TRUE; - g_signal_emit_by_name(G_OBJECT(ctree), "scroll_vertical", - type, 0.0); + g_signal_emit_by_name(G_OBJECT(ctree), "scroll_vertical", type, 0.0); if (GTK_CLIST(ctree)->selection) gtk_sctree_set_anchor_row (GTK_SCTREE(ctree), GTK_CTREE_NODE(GTK_CLIST(ctree)->selection->data)); + return TRUE; } void summary_toggle_view(SummaryView *summaryview) @@ -3256,6 +3257,8 @@ void summary_copy_selected_to(SummaryView *summaryview, FolderItem *to_folder) folder_item_update_thaw(); gtk_clist_thaw(GTK_CLIST(summaryview->ctree)); + summary_step(summaryview, GTK_SCROLL_STEP_FORWARD); + if (prefs_common.immediate_exec) summary_execute(summaryview); else { @@ -4398,7 +4401,7 @@ void summary_pass_key_press_event(SummaryView *summaryview, GdkEventKey *event) if ((event->state & (GDK_MOD1_MASK|GDK_CONTROL_MASK)) != 0) break static gboolean summary_key_pressed(GtkWidget *widget, GdkEventKey *event, - SummaryView *summaryview) + SummaryView *summaryview) { GtkCTree *ctree = GTK_CTREE(widget); GtkCTreeNode *node; @@ -4478,6 +4481,9 @@ static gboolean summary_key_pressed(GtkWidget *widget, GdkEventKey *event, messageview = summaryview->messageview; textview = messageview->mimeview->textview; + mod_pressed = + ((event->state & (GDK_SHIFT_MASK|GDK_MOD1_MASK)) != 0); + switch (event->keyval) { case GDK_space: /* Page down or go to the next */ if (event->state & GDK_SHIFT_MASK) @@ -4488,8 +4494,6 @@ static gboolean summary_key_pressed(GtkWidget *widget, GdkEventKey *event, summaryview->selected); break; } - mod_pressed = ((event->state & - (GDK_SHIFT_MASK|GDK_MOD1_MASK)) != 0); if (mod_pressed) { if (!textview_scroll_page(textview, TRUE)) summary_select_prev_unread(summaryview); @@ -4508,9 +4512,7 @@ static gboolean summary_key_pressed(GtkWidget *widget, GdkEventKey *event, summaryview->selected); break; } - textview_scroll_one_line - (textview, (event->state & - (GDK_SHIFT_MASK|GDK_MOD1_MASK)) != 0); + textview_scroll_one_line(textview, mod_pressed); break; case GDK_Delete: BREAK_ON_MODIFIER_KEY(); diff --git a/src/summaryview.h b/src/summaryview.h index a8fc6a7da..608210aad 100644 --- a/src/summaryview.h +++ b/src/summaryview.h @@ -1,6 +1,6 @@ /* * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2004 Hiroyuki Yamamoto + * Copyright (C) 1999-2005 Hiroyuki Yamamoto * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -228,7 +228,7 @@ void summary_redisplay_msg (SummaryView *summaryview); void summary_open_msg (SummaryView *summaryview); void summary_view_source (SummaryView *summaryview); void summary_reedit (SummaryView *summaryview); -void summary_step (SummaryView *summaryview, +gboolean summary_step (SummaryView *summaryview, GtkScrollType type); void summary_toggle_view (SummaryView *summaryview); void summary_set_marks_selected (SummaryView *summaryview); diff --git a/src/textview.c b/src/textview.c index 6d8faf0d6..a83eccb00 100644 --- a/src/textview.c +++ b/src/textview.c @@ -694,7 +694,8 @@ static void textview_write_body(TextView *textview, MimeInfo *mimeinfo) procmime_decode_content(mimeinfo); - if (!g_ascii_strcasecmp(mimeinfo->subtype, "html")) { + if (!g_ascii_strcasecmp(mimeinfo->subtype, "html") && + prefs_common.render_html) { gchar *filename; filename = procmime_get_tmp_file_name(mimeinfo); @@ -758,6 +759,7 @@ static void textview_show_html(TextView *textview, FILE *fp, } else textview_write_line(textview, str, NULL); } + textview_write_line(textview, "\n", NULL); html_parser_destroy(parser); }