From 005789a42dfe79276e8c9c94626e0827712efe24 Mon Sep 17 00:00:00 2001 From: Alfons Hoogervorst Date: Sun, 6 Jan 2002 12:21:36 +0000 Subject: [PATCH] Sync with hiro's cvs 10 to 17. --- ChangeLog.claws | 5 + configure.in | 2 +- src/account.c | 38 +++-- src/compose.c | 184 +++++++++++++-------- src/folderview.c | 13 +- src/gtkstext.c | 376 +++++++++++++++++++++++-------------------- src/gtkstext.h | 99 ++++++------ src/gtkutils.c | 26 +-- src/gtkutils.h | 8 +- src/imap.c | 5 + src/importldif.c | 6 +- src/ldif.c | 2 +- src/mainwindow.c | 190 +++++++++++----------- src/menu.h | 1 + src/summary_search.c | 2 +- src/textview.c | 130 +++++++-------- src/textview.h | 3 + src/undo.c | 4 +- 18 files changed, 598 insertions(+), 496 deletions(-) diff --git a/ChangeLog.claws b/ChangeLog.claws index b41f43a8f..7a85a0fed 100644 --- a/ChangeLog.claws +++ b/ChangeLog.claws @@ -1,3 +1,8 @@ +2001-01-05 [alfons] 0.6.6claws38 + + * sync with sylpheed 0.6.6cvs10-17 + (last stuff marked as LAST_STABLE) + 2002-01-04 [melvin] 0.6.6claws37 * src/account.c diff --git a/configure.in b/configure.in index 4283652e1..521c9d5e8 100644 --- a/configure.in +++ b/configure.in @@ -8,7 +8,7 @@ MINOR_VERSION=6 MICRO_VERSION=6 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=claws37 +EXTRA_VERSION=claws38 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION dnl diff --git a/src/account.c b/src/account.c index b58bce3d6..34ced31ed 100644 --- a/src/account.c +++ b/src/account.c @@ -99,6 +99,9 @@ static void account_selected (GtkCList *clist, gint column, GdkEvent *event, gpointer data); +static void account_row_moved (GtkCList *clist, + gint source_row, + gint dest_row); static void account_key_pressed (GtkWidget *widget, GdkEventKey *event, gpointer data); @@ -475,6 +478,8 @@ static void account_edit_create(void) gtk_signal_connect (GTK_OBJECT (clist), "select_row", GTK_SIGNAL_FUNC (account_selected), NULL); + gtk_signal_connect (GTK_OBJECT (clist), "row_move", + GTK_SIGNAL_FUNC (account_row_moved), NULL); vbox2 = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox2); @@ -639,10 +644,8 @@ static void account_up(void) if (!clist->selection) return; row = GPOINTER_TO_INT(clist->selection->data); - if (row > 0) { + if (row > 0) gtk_clist_row_move(clist, row, row - 1); - account_list_set(); - } } static void account_down(void) @@ -653,10 +656,8 @@ static void account_down(void) if (!clist->selection) return; row = GPOINTER_TO_INT(clist->selection->data); - if (row < clist->rows - 1) { + if (row < clist->rows - 1) gtk_clist_row_move(clist, row, row + 1); - account_list_set(); - } } static void account_set_default(void) @@ -720,6 +721,15 @@ static void account_selected(GtkCList *clist, gint row, gint column, } } +static void account_row_moved(GtkCList *clist, gint source_row, gint dest_row) +{ + account_list_set(); + if (gtk_clist_row_is_visible(clist, dest_row) != GTK_VISIBILITY_FULL) { + gtk_clist_moveto(clist, dest_row, -1, + source_row < dest_row ? 1.0 : 0.0, 0.0); + } +} + static void account_key_pressed(GtkWidget *widget, GdkEventKey *event, gpointer data) { @@ -792,19 +802,15 @@ static void account_clist_set(void) { GtkCList *clist = GTK_CLIST(edit_account.clist); GList *cur; - gint prev_row; + gint row = -1, prev_row = -1; if (clist->selection) prev_row = GPOINTER_TO_INT(clist->selection->data); - else - prev_row = -1; gtk_clist_freeze(clist); gtk_clist_clear(clist); for (cur = account_list; cur != NULL; cur = cur->next) { - gint row; - row = account_clist_set_row((PrefsAccount *)cur->data, -1); if ((PrefsAccount *)cur->data == cur_account) { gtk_clist_select_row(clist, row, -1); @@ -813,11 +819,15 @@ static void account_clist_set(void) } if (prev_row >= 0) { - gtk_clist_select_row(clist, prev_row, -1); - gtkut_clist_set_focus_row(clist, prev_row); - gtk_clist_moveto(clist, prev_row, 0, 0.5, 0); + row = prev_row; + gtk_clist_select_row(clist, row, -1); + gtkut_clist_set_focus_row(clist, row); } + if (row >= 0 && + gtk_clist_row_is_visible(clist, row) != GTK_VISIBILITY_FULL) + gtk_clist_moveto(clist, row, -1, 0.5, 0); + gtk_clist_thaw(clist); } diff --git a/src/compose.c b/src/compose.c index 7ad82fe14..5332fa4f4 100644 --- a/src/compose.c +++ b/src/compose.c @@ -53,6 +53,8 @@ #include #include #include +#include +#include #include #include /* #include */ @@ -66,13 +68,11 @@ # include #endif - -#include "gtkstext.h" - #include "intl.h" #include "main.h" #include "mainwindow.h" #include "compose.h" +#include "gtkstext.h" #include "addressbook.h" #include "folderview.h" #include "procmsg.h" @@ -447,21 +447,34 @@ static GtkItemFactoryEntry compose_entries[] = {N_("/_File/---"), NULL, NULL, 0, ""}, {N_("/_File/_Close"), "W", compose_close_cb, 0, NULL}, - {N_("/_Edit"), NULL, NULL, 0, ""}, - {N_("/_Edit/_Undo"), "Z", compose_undo_cb, 0, NULL}, - {N_("/_Edit/_Redo"), "Y", compose_redo_cb, 0, NULL}, - {N_("/_Edit/---"), NULL, NULL, 0, ""}, - {N_("/_Edit/Cu_t"), "X", compose_cut_cb, 0, NULL}, - {N_("/_Edit/_Copy"), "C", compose_copy_cb, 0, NULL}, - {N_("/_Edit/_Paste"), "V", compose_paste_cb, 0, NULL}, - {N_("/_Edit/Select _all"), "A", compose_allsel_cb, 0, NULL}, - {N_("/_Edit/---"), NULL, NULL, 0, ""}, - {N_("/_Edit/_Wrap current paragraph"), "L", compose_wrap_line, 0, NULL}, + {N_("/_Edit"), NULL, NULL, 0, ""}, + {N_("/_Edit/_Undo"), "Z", compose_undo_cb, 0, NULL}, + {N_("/_Edit/_Redo"), "Y", compose_redo_cb, 0, NULL}, + {N_("/_Edit/---"), NULL, NULL, 0, ""}, + {N_("/_Edit/Cu_t"), "X", compose_cut_cb, 0, NULL}, + {N_("/_Edit/_Copy"), "C", compose_copy_cb, 0, NULL}, + {N_("/_Edit/_Paste"), "V", compose_paste_cb, 0, NULL}, + {N_("/_Edit/Select _all"), "A", compose_allsel_cb, 0, NULL}, + {N_("/_Edit/---"), NULL, NULL, 0, ""}, + {N_("/_Edit/_Wrap current paragraph"), + "L", compose_wrap_line, 0, NULL}, {N_("/_Edit/Wrap all long _lines"), - "L", compose_wrap_line_all, 0, NULL}, + "L", compose_wrap_line_all, 0, NULL}, {N_("/_Edit/Edit with e_xternal editor"), - "X", compose_ext_editor_cb, 0, NULL}, - + "X", compose_ext_editor_cb, 0, NULL}, +#if 0 /* NEW COMPOSE GUI */ + {N_("/_View"), NULL, NULL, 0, ""}, + {N_("/_View/_To"), NULL, compose_toggle_to_cb , 0, ""}, + {N_("/_View/_Cc"), NULL, compose_toggle_cc_cb , 0, ""}, + {N_("/_View/_Bcc"), NULL, compose_toggle_bcc_cb , 0, ""}, + {N_("/_View/_Reply to"), NULL, compose_toggle_replyto_cb, 0, ""}, + {N_("/_View/---"), NULL, NULL, 0, ""}, + {N_("/_View/_Followup to"), NULL, compose_toggle_followupto_cb, 0, ""}, + {N_("/_View/---"), NULL, NULL, 0, ""}, + {N_("/_View/R_uler"), NULL, compose_toggle_ruler_cb, 0, ""}, + {N_("/_View/---"), NULL, NULL, 0, ""}, + {N_("/_View/_Attachment"), NULL, compose_toggle_attach_cb, 0, ""}, +#endif {N_("/_Message"), NULL, NULL, 0, ""}, {N_("/_Message/_Send"), "Return", compose_send_cb, 0, NULL}, @@ -469,6 +482,8 @@ static GtkItemFactoryEntry compose_entries[] = compose_send_later_cb, 0, NULL}, {N_("/_Message/Save to _draft folder"), "D", compose_draft_cb, 0, NULL}, + {N_("/_Message/Save and _keep editing"), + "S", compose_draft_cb, 1, NULL}, #if 0 /* NEW COMPOSE GUI */ {N_("/_Message/---"), NULL, NULL, 0, ""}, {N_("/_Message/_To"), NULL, compose_toggle_to_cb , 0, ""}, @@ -491,7 +506,7 @@ static GtkItemFactoryEntry compose_entries[] = {N_("/_Tool/Show _ruler"), NULL, compose_toggle_ruler_cb, 0, ""}, {N_("/_Tool/_Address book"), "A", compose_address_cb , 0, NULL}, {N_("/_Tool/_Template"), NULL, NULL, 0, ""}, - {N_("/_Help"), NULL, NULL, 0, ""}, + {N_("/_Help"), NULL, NULL, 0, ""}, {N_("/_Help/_About"), NULL, about_show, 0, NULL} }; @@ -1706,7 +1721,7 @@ static void compose_reedit_set_entry(Compose *compose, MsgInfo *msginfo) GtkWidget *menuitem; ifactory = gtk_item_factory_from_widget(compose->menubar); - menuitem = gtk_item_factory_get_item(ifactory, "/Message/Bcc"); + menuitem = gtk_item_factory_get_item(ifactory, "/View/Bcc"); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menuitem), TRUE); } @@ -1716,7 +1731,7 @@ static void compose_reedit_set_entry(Compose *compose, MsgInfo *msginfo) ifactory = gtk_item_factory_from_widget(compose->menubar); menuitem = gtk_item_factory_get_item - (ifactory, "/Message/Reply to"); + (ifactory, "/View/Reply to"); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menuitem), TRUE); } @@ -1829,8 +1844,7 @@ static void compose_insert_file(Compose *compose, const gchar *file) while (--len >= 0) if (buf[len] == '\r') buf[len] = '\n'; } - - gtk_stext_insert(text, NULL, NULL, NULL, buf, -1); + gtk_stext_insert(text, NULL, NULL, NULL, buf, -1); } gtk_stext_thaw(text); @@ -1932,7 +1946,7 @@ static void compose_attach_append(Compose *compose, const gchar *file, ifactory = gtk_item_factory_from_widget(compose->menubar); menuitem = gtk_item_factory_get_item(ifactory, - "/Message/Attach"); + "/View/Attachment"); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE); } @@ -1961,7 +1975,7 @@ static void compose_attach_append(Compose *compose, const gchar *file, #define GET_CHAR(pos, buf, len) \ { \ if (text->use_wchar) \ - len = wctomb(buf, (wchar_t)GTK_STEXT_INDEX(text, (pos))); \ + len = wctomb(buf, (wchar_t)GTK_STEXT_INDEX(text, (pos))); \ else { \ buf[0] = GTK_STEXT_INDEX(text, (pos)); \ len = 1; \ @@ -1980,7 +1994,6 @@ static void compose_wrap_line(Compose *compose) gint line_pos, cur_pos; gint line_len, cur_len; - gtk_stext_freeze(text); text_len = gtk_stext_get_length(text); @@ -2215,7 +2228,7 @@ static void compose_wrap_line_all(Compose *compose) /* mark position of new line - needed for quotation wrap */ if (is_new_line) { if (linewrap_quote) { - qlen = gtkut_text_str_compare + qlen = gtkut_stext_str_compare (text, cur_pos, tlen, qfmt); if (qlen) i_len = get_indent_length @@ -2264,7 +2277,7 @@ static void compose_wrap_line_all(Compose *compose) /* if it's just quotation + newline skip it */ if (i_len && (cur_pos + 1 < tlen)) { /* check if text at new line matches indent */ - ilen = gtkut_text_str_compare_n + ilen = gtkut_stext_str_compare_n (text, cur_pos + 1, p_pos, i_len, tlen); if (cur_pos + ilen < tlen) { GET_CHAR(cur_pos + ilen + 1, cb, clen); @@ -2294,16 +2307,16 @@ static void compose_wrap_line_all(Compose *compose) /* if text starts with quote fmt or with indent string, delete them */ if (i_len) { - ilen = gtkut_text_str_compare_n + ilen = gtkut_stext_str_compare_n (text, cur_pos, p_pos, i_len, tlen); if (ilen) { - gtk_stext_forward_delete(text, - ilen); + gtk_stext_forward_delete + (text, ilen); tlen -= ilen; } } else if (qlen) { - if (gtkut_text_str_compare + if (gtkut_stext_str_compare (text, cur_pos, tlen, qfmt)) { gtk_stext_forward_delete (text, qlen); @@ -2318,7 +2331,7 @@ static void compose_wrap_line_all(Compose *compose) ((clen > 1) || isalnum(cb[0]))) { gtk_stext_insert(text, NULL, NULL, NULL, " ", 1); - /* gtk_text_compact_buffer(text); */ + /* gtk_stext_compact_buffer(text); */ tlen++; } @@ -2366,8 +2379,8 @@ static void compose_wrap_line_all(Compose *compose) dump_text(text, line_pos, tlen, 1); #endif /* force wrapping if it is one long word but not URL */ - if (p_pos + i_len == line_pos) - if (!gtkut_text_is_uri_string + if (line_pos - p_pos <= i_len) + if (!gtkut_stext_is_uri_string (text, line_pos, tlen)) line_pos = cur_pos - 1; #ifdef WRAP_DEBUG @@ -2379,7 +2392,7 @@ static void compose_wrap_line_all(Compose *compose) /* if next character is space delete it */ if (clen == 1 && isspace(*cbuf)) { if (p_pos + i_len != line_pos || - !gtkut_text_is_uri_string + !gtkut_stext_is_uri_string (text, line_pos, tlen)) { gtk_stext_set_point(text, line_pos); gtk_stext_backward_delete(text, 1); @@ -2393,7 +2406,7 @@ static void compose_wrap_line_all(Compose *compose) /* if it is URL at beginning of line don't wrap */ if (p_pos + i_len == line_pos && - gtkut_text_is_uri_string(text, line_pos, tlen)) { + gtkut_stext_is_uri_string(text, line_pos, tlen)) { #ifdef WRAP_DEBUG printf("found URL at "); dump_text(text, line_pos, tlen, 1); @@ -2423,7 +2436,7 @@ static void compose_wrap_line_all(Compose *compose) /* should we insert quotation ? */ if (linewrap_quote && qlen) { /* only if line is not already quoted */ - if (!gtkut_text_str_compare + if (!gtkut_stext_str_compare (text, line_pos, tlen, qfmt)) { guint ins_len; @@ -2454,6 +2467,7 @@ static void compose_wrap_line_all(Compose *compose) gtk_stext_thaw(text); } + #undef GET_CHAR static void compose_set_title(Compose *compose) @@ -3734,7 +3748,6 @@ static void compose_generate_msgid(Compose *compose, gchar *buf, gint len) g_free(addr); } - static void compose_add_entry_field(GtkWidget *table, GtkWidget **hbox, GtkWidget **entry, gint *count, const gchar *label_str, @@ -4247,7 +4260,7 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode) gtk_stext_set_editable(GTK_STEXT(text), TRUE); if (prefs_common.block_cursor) { - GTK_STEXT(text)->cursor_type = STEXT_CURSOR_BLOCK; + GTK_STEXT(text)->cursor_type = GTK_STEXT_CURSOR_BLOCK; } if (prefs_common.smart_wrapping) { @@ -4307,7 +4320,7 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode) style = gtk_widget_get_style(text); - /* workaround for the slow down of GtkText when using Pixmap theme */ + /* workaround for the slow down of GtkSText when using Pixmap theme */ if (style->engine) { GtkThemeEngine *engine; @@ -4360,6 +4373,17 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode) tmpl_menu = gtk_item_factory_get_item(ifactory, "/Tool/Template"); #if 0 /* NEW COMPOSE GUI */ + gtk_widget_hide(bcc_hbox); + gtk_widget_hide(bcc_entry); + gtk_widget_hide(reply_hbox); + gtk_widget_hide(reply_entry); + gtk_widget_hide(followup_hbox); + gtk_widget_hide(followup_entry); + gtk_widget_hide(ruler_hbox); + gtk_table_set_row_spacing(GTK_TABLE(table), 4, 0); + gtk_table_set_row_spacing(GTK_TABLE(table), 5, 0); + gtk_table_set_row_spacing(GTK_TABLE(table), 6, 0); + if (account->protocol == A_NNTP) { gtk_widget_hide(to_hbox); gtk_widget_hide(to_entry); @@ -4371,8 +4395,7 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode) gtk_widget_hide(newsgroups_hbox); gtk_widget_hide(newsgroups_entry); gtk_table_set_row_spacing(GTK_TABLE(table), 2, 0); - - menu_set_sensitive(ifactory, "/Message/Followup to", FALSE); + menu_set_sensitive(ifactory, "/View/Followup to", FALSE); } #endif @@ -4473,11 +4496,11 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode) #if 0 /* NEW COMPOSE GUI */ if (account->protocol != A_NNTP) { - menuitem = gtk_item_factory_get_item(ifactory, "/Message/To"); + menuitem = gtk_item_factory_get_item(ifactory, "/View/To"); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menuitem), TRUE); gtk_widget_set_sensitive(menuitem, FALSE); - menuitem = gtk_item_factory_get_item(ifactory, "/Message/Cc"); + menuitem = gtk_item_factory_get_item(ifactory, "/View/Cc"); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menuitem), TRUE); gtk_widget_set_sensitive(menuitem, FALSE); @@ -4488,7 +4511,7 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode) #if 0 /* NEW COMPOSE GUI */ compose->use_cc = TRUE; gtk_entry_set_text(GTK_ENTRY(cc_entry), account->auto_cc); - menuitem = gtk_item_factory_get_item(ifactory, "/Message/Cc"); + menuitem = gtk_item_factory_get_item(ifactory, "/View/Cc"); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menuitem), TRUE); #endif @@ -4496,8 +4519,7 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode) if (account->set_autobcc) { compose_entry_append(compose, account->auto_bcc, COMPOSE_BCC); #if 0 /* NEW COMPOSE GUI */ - compose->use_bcc = TRUE; - menuitem = gtk_item_factory_get_item(ifactory, "/Message/Bcc"); + menuitem = gtk_item_factory_get_item(ifactory, "/View/Bcc"); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menuitem), TRUE); if (account->auto_bcc && mode != COMPOSE_REEDIT) @@ -4510,7 +4532,7 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode) #if 0 /* NEW COMPOSE GUI */ compose->use_replyto = TRUE; menuitem = gtk_item_factory_get_item(ifactory, - "/Message/Reply to"); + "/View/Reply to"); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menuitem), TRUE); gtk_entry_set_text(GTK_ENTRY(reply_entry), @@ -4524,9 +4546,11 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode) gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(compose->header_last->combo)->entry), prefs_common.trans_hdr ? _("Newsgroups:") : "Newsgroups:"); } - menuitem = gtk_item_factory_get_item(ifactory, "/Tool/Show ruler"); +#if 0 /* NEW COMPOSE GUI */ + menuitem = gtk_item_factory_get_item(ifactory, "/View/Ruler"); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), prefs_common.show_ruler); +#endif #if USE_GPGME menuitem = gtk_item_factory_get_item(ifactory, "/Message/Sign"); @@ -4573,23 +4597,6 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode) return compose; } -#include "pixmaps/stock_mail_send.xpm" -#include "pixmaps/stock_mail_send_queue.xpm" -#include "pixmaps/stock_mail.xpm" -#include "pixmaps/stock_paste.xpm" -#include "pixmaps/stock_mail_attach.xpm" -#include "pixmaps/stock_mail_compose.xpm" -#include "pixmaps/linewrap.xpm" -#include "pixmaps/tb_address_book.xpm" - -#define CREATE_TOOLBAR_ICON(xpm_d) \ -{ \ - icon = gdk_pixmap_create_from_xpm_d(container->window, &mask, \ - &container->style->white, \ - xpm_d); \ - icon_wid = gtk_pixmap_new(icon, mask); \ -} - static void compose_toolbar_create(Compose *compose, GtkWidget *container) { GtkWidget *toolbar; @@ -4789,7 +4796,7 @@ static void compose_template_apply(Compose *compose, Template *tmpl) if (!tmpl || !tmpl->value) return; gtk_stext_freeze(GTK_STEXT(compose->text)); - + if (tmpl->subject && *tmpl->subject != '\0') gtk_entry_set_text(GTK_ENTRY(compose->subject_entry), tmpl->subject); @@ -4946,7 +4953,7 @@ static void compose_attach_property(Compose *compose) GtkWidget *menuitem; cancelled = FALSE; - gtk_main(); + gtk_main(); if (cancelled == TRUE) { gtk_widget_hide(attach_prop.window); @@ -5714,6 +5721,7 @@ static void compose_send_cb(gpointer data, guint action, GtkWidget *widget) gint val; val = compose_send(compose); + if (val == 0) gtk_widget_destroy(compose->window); } @@ -5732,24 +5740,34 @@ static void compose_draft_cb(gpointer data, guint action, GtkWidget *widget) Compose *compose = (Compose *)data; FolderItem *draft; gchar *tmp; + gint msgnum; + static gboolean lock = FALSE; + + if (lock) return; draft = folder_get_default_draft(); + g_return_if_fail(draft != NULL); + + lock = TRUE; - tmp = g_strdup_printf("%s%cdraft.%d", g_get_tmp_dir(), + tmp = g_strdup_printf("%s%cdraft.%d", g_get_tmp_dir(), G_DIR_SEPARATOR, (gint)compose); if (compose_write_to_file(compose, tmp, TRUE) < 0) { g_free(tmp); + lock = FALSE; return; } folder_item_scan(draft); - if (folder_item_add_msg(draft, tmp, TRUE) < 0) { + if ((msgnum = folder_item_add_msg(draft, tmp, TRUE)) <= 0) { unlink(tmp); g_free(tmp); + lock = FALSE; return; } g_free(tmp); + draft->mtime = 0; /* force updating */ if (compose->mode == COMPOSE_REEDIT) { compose_remove_reedit_target(compose); @@ -5762,7 +5780,33 @@ static void compose_draft_cb(gpointer data, guint action, GtkWidget *widget) folder_item_scan(draft); folderview_update_item(draft, TRUE); - gtk_widget_destroy(compose->window); + lock = FALSE; + + /* 0: quit editing 1: keep editing */ + if (action == 0) + gtk_widget_destroy(compose->window); + else { + struct stat s; + gchar *path; + + path = folder_item_fetch_msg(draft, msgnum); + g_return_if_fail(path != NULL); + if (stat(path, &s) < 0) { + FILE_OP_ERROR(path, "stat"); + g_free(path); + lock = FALSE; + return; + } + g_free(path); + + procmsg_msginfo_free(compose->targetinfo); + compose->targetinfo = g_new0(MsgInfo, 1); + compose->targetinfo->msgnum = msgnum; + compose->targetinfo->size = s.st_size; + compose->targetinfo->mtime = s.st_mtime; + compose->targetinfo->folder = draft; + compose->mode = COMPOSE_REEDIT; + } } static void compose_attach_cb(gpointer data, guint action, GtkWidget *widget) diff --git a/src/folderview.c b/src/folderview.c index 2746e5c52..ba5098426 100644 --- a/src/folderview.c +++ b/src/folderview.c @@ -248,7 +248,8 @@ static GtkItemFactoryEntry folderview_mail_popup_entries[] = {N_("/_Rename folder..."), NULL, folderview_rename_folder_cb, 0, NULL}, {N_("/_Delete folder"), NULL, folderview_delete_folder_cb, 0, NULL}, {N_("/---"), NULL, NULL, 0, ""}, - {N_("/_Update folder tree"), NULL, folderview_update_tree_cb, 0, NULL}, + {N_("/_Check for new messages"), + NULL, folderview_update_tree_cb, 0, NULL}, {N_("/R_escan folder tree"), NULL, folderview_update_tree_cb, 1, NULL}, {N_("/---"), NULL, NULL, 0, ""}, {N_("/Remove _mailbox"), NULL, folderview_remove_mailbox_cb, 0, NULL}, @@ -265,7 +266,8 @@ static GtkItemFactoryEntry folderview_imap_popup_entries[] = {N_("/_Rename folder..."), NULL, NULL, 0, NULL}, {N_("/_Delete folder"), NULL, folderview_rm_imap_folder_cb, 0, NULL}, {N_("/---"), NULL, NULL, 0, ""}, - {N_("/_Update folder tree"), NULL, folderview_update_tree_cb, 0, NULL}, + {N_("/_Check for new messages"), + NULL, folderview_update_tree_cb, 0, NULL}, {N_("/R_escan folder tree"), NULL, folderview_update_tree_cb, 1, NULL}, {N_("/---"), NULL, NULL, 0, ""}, {N_("/Remove _IMAP4 account"), NULL, folderview_rm_imap_server_cb, 0, NULL}, @@ -1354,7 +1356,7 @@ static void folderview_button_pressed(GtkWidget *ctree, GdkEventButton *event, SET_SENS(mail_factory, "/Create new folder...", new_folder); SET_SENS(mail_factory, "/Rename folder...", rename_folder); SET_SENS(mail_factory, "/Delete folder", delete_folder); - SET_SENS(mail_factory, "/Update folder tree", update_tree); + SET_SENS(mail_factory, "/Check for new messages", update_tree); SET_SENS(mail_factory, "/Rescan folder tree", rescan_tree); SET_SENS(mail_factory, "/Remove mailbox", remove_tree); SET_SENS(mail_factory, "/Property...", folder_property); @@ -1367,7 +1369,7 @@ static void folderview_button_pressed(GtkWidget *ctree, GdkEventButton *event, SET_SENS(imap_factory, "/Create new folder...", new_folder); SET_SENS(imap_factory, "/Rename folder...", rename_folder); SET_SENS(imap_factory, "/Delete folder", delete_folder); - SET_SENS(imap_factory, "/Update folder tree", update_tree); + SET_SENS(imap_factory, "/Check for new messages", update_tree); SET_SENS(imap_factory, "/Rescan folder tree", rescan_tree); SET_SENS(imap_factory, "/Remove IMAP4 account", remove_tree); SET_SENS(imap_factory, "/Processing...", folder_processing); @@ -1378,6 +1380,9 @@ static void folderview_button_pressed(GtkWidget *ctree, GdkEventButton *event, menu_set_insensitive_all(GTK_MENU_SHELL(popup)); SET_SENS(news_factory, "/Subscribe to newsgroup...", new_folder); SET_SENS(news_factory, "/Remove newsgroup", delete_folder); +#if 0 + SET_SENS(news_factory, "/Check for new messages", update_tree); +#endif SET_SENS(news_factory, "/Remove news account", remove_tree); SET_SENS(news_factory, "/Search folder...", search_folder); SET_SENS(news_factory, "/Processing...", folder_processing); diff --git a/src/gtkstext.c b/src/gtkstext.c index 62e417251..11bdd6098 100644 --- a/src/gtkstext.c +++ b/src/gtkstext.c @@ -431,7 +431,7 @@ static void gtk_stext_set_position (GtkEditable *editable, /* SYLPHEED: * cursor timer */ -static void gtk_stext_enable_blink (GtkSText *text); +static void gtk_stext_enable_blink (GtkSText *text); static void gtk_stext_disable_blink (GtkSText *text); /* #define DEBUG_GTK_STEXT */ @@ -787,15 +787,15 @@ gtk_stext_init (GtkSText *text) /* SYLPHEED: * timer for blinking cursor */ - text->cursor_visible = FALSE; /* don't know whether gtktext stores this somewhere */ - text->cursor_timer_on = TRUE; - text->cursor_off_ms = 500; - text->cursor_on_ms = 500; - text->cursor_timer_id = 0; + text->cursor_visible = FALSE; /* don't know whether gtktext stores this somewhere */ + text->cursor_timer_on = TRUE; + text->cursor_off_ms = 500; + text->cursor_on_ms = 500; + text->cursor_timer_id = 0; text->cursor_idle_time_timer_id = 0; - text->wrap_rmargin = 0; - text->cursor_type = STEXT_CURSOR_LINE; - text->persist_column = 0; + text->wrap_rmargin = 0; + text->cursor_type = GTK_STEXT_CURSOR_LINE; + text->persist_column = 0; init_properties (text); @@ -1328,10 +1328,10 @@ gtk_stext_destroy (GtkObject *object) } /* SYLPHEED: - * cursor timer + * cursor timer */ - gtk_stext_disable_blink(text); - + gtk_stext_disable_blink (text); + GTK_OBJECT_CLASS(parent_class)->destroy (object); } @@ -2157,9 +2157,7 @@ gtk_stext_key_press (GtkWidget *widget, break; case GDK_Page_Up: scroll_int (text, -text->vadj->page_increment); break; case GDK_Page_Down: scroll_int (text, +text->vadj->page_increment); break; - case GDK_Up: - scroll_int (text, -KEY_SCROLL_PIXELS); - break; + case GDK_Up: scroll_int (text, -KEY_SCROLL_PIXELS); break; case GDK_Down: scroll_int (text, +KEY_SCROLL_PIXELS); break; case GDK_Return: if (event->state & GDK_CONTROL_MASK) @@ -2194,15 +2192,17 @@ gtk_stext_key_press (GtkWidget *widget, } extend_start = (text->point.index == editable->selection_start_pos); - gtk_stext_disable_blink(text); + /* SYLPHEED: cursor */ + gtk_stext_disable_blink (text); + } + else + { + gtk_stext_enable_blink (text); } /* SYLPHEED: * cursor */ - if (!extend_selection) - gtk_stext_enable_blink(text); - if (event->keyval != GDK_Up && event->keyval != GDK_Down) { reset_persist_col_pos(text); } @@ -2310,19 +2310,15 @@ gtk_stext_key_press (GtkWidget *widget, } break; case GDK_Delete: - { - if (event->state & GDK_CONTROL_MASK) { - gtk_stext_delete_forward_word (text); - } - else if (event->state & GDK_SHIFT_MASK) - { - extend_selection = FALSE; - gtk_editable_cut_clipboard (editable); - } - else { - gtk_stext_delete_forward_character (text); - } - } + if (event->state & GDK_CONTROL_MASK) + gtk_stext_delete_forward_word (text); + else if (event->state & GDK_SHIFT_MASK) + { + extend_selection = FALSE; + gtk_editable_cut_clipboard (editable); + } + else + gtk_stext_delete_forward_character (text); break; case GDK_Tab: position = text->point.index; @@ -2436,8 +2432,9 @@ gtk_stext_focus_in (GtkWidget *widget, #endif draw_cursor (GTK_STEXT(widget), TRUE); + /* SYLPHEED: cursor */ GTK_STEXT(widget)->cursor_visible = TRUE; - gtk_stext_enable_blink(GTK_STEXT(widget)); + gtk_stext_enable_blink (GTK_STEXT(widget)); return FALSE; } @@ -4662,9 +4659,8 @@ static void gtk_stext_kill_word (GtkEditable *editable, gint direction) { - if (editable->selection_start_pos != editable->selection_end_pos) { + if (editable->selection_start_pos != editable->selection_end_pos) gtk_editable_delete_selection (editable); - } else { gint old_pos = editable->current_pos; @@ -5221,7 +5217,7 @@ find_line_params (GtkSText* text, if (lp.end.index == lp.start.index) { /* SYLPHEED: don't wrap URLs */ - if (gtkut_text_is_uri_string(text, lp.end.index, + if (gtkut_stext_is_uri_string(text, lp.end.index, gtk_stext_get_length(text))) { lp.end = saved_mark; @@ -5466,7 +5462,7 @@ draw_line (GtkSText* text, pixel_width = gdk_text_width_wc (gc_values.font, buffer.wc, len); else - pixel_width = gdk_text_width (gc_values.font, + pixel_width = gdk_text_width (gc_values.font, buffer.ch, len); } else @@ -5622,50 +5618,54 @@ undraw_cursor (GtkSText* text, gint absolute) GTK_WIDGET_DRAWABLE (text) && text->line_start_cache) { GdkFont* font; - gint pixel_width, pixel_height; - GdkGC *gc; + gint pixel_width; + gint pixel_height; g_assert(text->cursor_mark.property); - gc = gdk_gc_new(text->text_area); - g_assert(gc); - gdk_gc_copy(gc, text->gc); - font = MARK_CURRENT_FONT(text, &text->cursor_mark); - /* SYLPHEED: - * changed the cursor to a real block (TM) - */ - if (text->cursor_type == STEXT_CURSOR_BLOCK) { - if (text->use_wchar) - pixel_width = gdk_char_width_wc(font, text->cursor_char); - else - pixel_width = gdk_char_width(font, text->cursor_char); - pixel_width -= 1; - pixel_height = LINE_HEIGHT(CACHE_DATA(text->current_line)); - - draw_bg_rect (text, &text->cursor_mark, - text->cursor_pos_x, - text->cursor_pos_y - (pixel_height + 1), - pixel_width + 1, - pixel_height + 1, - FALSE); - } - else { - draw_bg_rect (text, &text->cursor_mark, - text->cursor_pos_x - 1, - text->cursor_pos_y - text->cursor_char_offset - font->ascent, - 2, font->descent + font->ascent + 1, FALSE); - - } - + /* SYLPHEED: + * changed the cursor to a real block (TM) + */ + if (text->cursor_type == GTK_STEXT_CURSOR_BLOCK) + { + if (text->cursor_char) + { + if (text->use_wchar) + pixel_width = gdk_char_width_wc (font, text->cursor_char); + else + pixel_width = gdk_char_width (font, (guchar)text->cursor_char); + } + else + { + pixel_width = gdk_char_width (font, 'W'); + } + + pixel_height = LINE_HEIGHT(CACHE_DATA(text->current_line)); + + draw_bg_rect (text, &text->cursor_mark, + text->cursor_pos_x, + text->cursor_pos_y - (pixel_height + 1), + pixel_width, + pixel_height + 1, + FALSE); + } + else + { + draw_bg_rect (text, &text->cursor_mark, + text->cursor_pos_x, + text->cursor_pos_y - text->cursor_char_offset - font->ascent, + 2, font->descent + font->ascent + 1, FALSE); + } + if (text->cursor_char) { if (font->type == GDK_FONT_FONT) gdk_gc_set_font (text->gc, font); - + gdk_gc_set_foreground (text->gc, MARK_CURRENT_FORE (text, &text->cursor_mark)); - + if (text->use_wchar) gdk_draw_text_wc (text->text_area, font, text->gc, @@ -5684,9 +5684,6 @@ undraw_cursor (GtkSText* text, gint absolute) 1); } } - - gdk_gc_copy(text->gc, gc); - gdk_gc_unref(gc); } } @@ -5718,7 +5715,6 @@ static void draw_cursor (GtkSText* text, gint absolute) { GtkEditable *editable = (GtkEditable *)text; - gint pixel_width, pixel_height; TDEBUG (("in draw_cursor\n")); @@ -5731,46 +5727,51 @@ draw_cursor (GtkSText* text, gint absolute) GTK_WIDGET_DRAWABLE (text) && text->line_start_cache) { GdkFont* font; - GdkGC* gc; + gint pixel_width; + gint pixel_height; g_assert (text->cursor_mark.property); - gc = gdk_gc_new(text->text_area); - g_assert (gc); - gdk_gc_copy(gc, text->gc); - font = MARK_CURRENT_FONT (text, &text->cursor_mark); - if (text->cursor_type == STEXT_CURSOR_BLOCK) { - /* SYLPHEED: - * changed the cursor to a real block (TM) - */ - if (text->use_wchar) { - pixel_width = gdk_char_width_wc(font, text->cursor_char); - } - else { - pixel_width = gdk_char_width(font, text->cursor_char); - } - pixel_width -= 1; - - pixel_height = LINE_HEIGHT(CACHE_DATA(text->current_line)); - gdk_gc_set_foreground (text->gc, >K_WIDGET (text)->style->text[GTK_STATE_NORMAL]); - gdk_gc_set_function(text->gc, GDK_INVERT); - gdk_draw_rectangle(text->text_area, text->gc, TRUE, - text->cursor_pos_x, - text->cursor_pos_y - pixel_height, - pixel_width, - pixel_height); - } - else { - gdk_gc_set_line_attributes(text->gc, 2, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_MITER); - gdk_gc_set_foreground(text->gc, >K_WIDGET (text)->style->text[GTK_STATE_NORMAL]); - gdk_draw_line(text->text_area, text->gc, text->cursor_pos_x, - text->cursor_pos_y + font->descent - text->cursor_char_offset, - text->cursor_pos_x, - text->cursor_pos_y - text->cursor_char_offset - font->ascent ); - - } - gdk_gc_copy(text->gc, gc); - gdk_gc_unref(gc); + font = MARK_CURRENT_FONT (text, &text->cursor_mark); + + /* SYLPHEED: + * change the cursor to a real block (TM) + */ + if (text->cursor_type == GTK_STEXT_CURSOR_BLOCK) + { + if (text->cursor_char) + { + if (text->use_wchar) + pixel_width = gdk_char_width_wc (font, text->cursor_char); + else + pixel_width = gdk_char_width (font, (guchar)text->cursor_char); + } + else + { + pixel_width = gdk_char_width (font, 'W'); + } + + pixel_height = LINE_HEIGHT(CACHE_DATA(text->current_line)); + + gdk_gc_set_foreground (text->gc, >K_WIDGET (text)->style->text[GTK_STATE_NORMAL]); + gdk_gc_set_function (text->gc, GDK_INVERT); + gdk_draw_rectangle (text->text_area, text->gc, TRUE, + text->cursor_pos_x, + text->cursor_pos_y - pixel_height, + pixel_width, + pixel_height); + gdk_gc_set_function (text->gc, GDK_COPY); + } + else + { + gdk_gc_set_line_attributes(text->gc, 2, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_MITER); + gdk_gc_set_foreground (text->gc, >K_WIDGET (text)->style->text[GTK_STATE_NORMAL]); + + gdk_draw_line (text->text_area, text->gc, text->cursor_pos_x + 1, + text->cursor_pos_y + font->descent - text->cursor_char_offset, + text->cursor_pos_x + 1, + text->cursor_pos_y - text->cursor_char_offset - font->ascent); + } } } @@ -6021,82 +6022,109 @@ gtk_stext_set_selection (GtkEditable *editable, * cursor timer */ -static gint stext_blink_timer_proc(GtkSText *text) +static gint +stext_blink_timer_proc (GtkSText *text) { - if (text->cursor_state_on) { - text->cursor_state_on = FALSE; - undraw_cursor(text, TRUE); - /* kill this timer... */ - gtk_timeout_remove(text->cursor_timer_id); - text->cursor_timer_id = gtk_timeout_add(text->cursor_off_ms, (GtkFunction) stext_blink_timer_proc, (gpointer) text); - } - else { - text->cursor_state_on = TRUE; - draw_cursor(text, TRUE); - /* kill this timer... */ - gtk_timeout_remove(text->cursor_timer_id); - text->cursor_timer_id = gtk_timeout_add(text->cursor_on_ms, (GtkFunction) stext_blink_timer_proc, (gpointer) text); - } - return TRUE; + if (text->cursor_state_on) + { + text->cursor_state_on = FALSE; + undraw_cursor (text, TRUE); + /* kill this timer... */ + gtk_timeout_remove (text->cursor_timer_id); + text->cursor_timer_id = gtk_timeout_add (text->cursor_off_ms, + (GtkFunction) stext_blink_timer_proc, + (gpointer) text); + } + else + { + text->cursor_state_on = TRUE; + draw_cursor (text, TRUE); + /* kill this timer... */ + gtk_timeout_remove (text->cursor_timer_id); + text->cursor_timer_id = gtk_timeout_add (text->cursor_on_ms, + (GtkFunction) stext_blink_timer_proc, + (gpointer) text); + } + + return TRUE; } -static gint stext_idle_timer_proc(GtkSText *text) +static gint +stext_idle_timer_proc (GtkSText *text) { - /* make sure the cursor timer is off */ - if (text->cursor_timer_id) { - gtk_timeout_remove(text->cursor_timer_id); - text->cursor_timer_id = 0; - } - /* assuming it's always on when calling this function ... */ - text->cursor_state_on = TRUE; - text->cursor_timer_id = gtk_timeout_add(text->cursor_on_ms, (GtkFunction) stext_blink_timer_proc, (gpointer) text); - /* make sure we kill the timer (could perhaps make this function return FALSE (not documented in - * the current docs). should check the source. */ - gtk_idle_remove( text->cursor_idle_time_timer_id ); - text->cursor_idle_time_timer_id = 0; - return TRUE; + /* make sure the cursor timer is off */ + if (text->cursor_timer_id) + { + gtk_timeout_remove (text->cursor_timer_id); + text->cursor_timer_id = 0; + } + + /* assuming it's always on when calling this function ... */ + text->cursor_state_on = TRUE; + text->cursor_timer_id = gtk_timeout_add (text->cursor_on_ms, + (GtkFunction) stext_blink_timer_proc, + (gpointer) text); + /* make sure we kill the timer (could perhaps make this function return + FALSE (not documented in the current docs). should check the source. */ + gtk_idle_remove (text->cursor_idle_time_timer_id); + text->cursor_idle_time_timer_id = 0; + + return TRUE; } -static void gtk_stext_enable_blink (GtkSText *text) +static void +gtk_stext_enable_blink (GtkSText *text) { - if (text->cursor_timer_on) { - gtk_stext_disable_blink(text); - text->cursor_idle_time_timer_id = gtk_idle_add((GtkFunction) stext_idle_timer_proc, (gpointer) text); - } + if (text->cursor_timer_on) + { + gtk_stext_disable_blink (text); + text->cursor_idle_time_timer_id = gtk_idle_add ((GtkFunction) stext_idle_timer_proc, + (gpointer) text); + } } -static void gtk_stext_disable_blink (GtkSText *text) +static void +gtk_stext_disable_blink (GtkSText *text) { - if (text->cursor_timer_on) { - if (text->cursor_idle_time_timer_id) { - gtk_idle_remove( text->cursor_idle_time_timer_id ); - text->cursor_idle_time_timer_id = 0; - } - if (text->cursor_timer_id) { - gtk_timeout_remove( text->cursor_timer_id ); - text->cursor_timer_id = 0; - } - draw_cursor(text, TRUE); - } + if (text->cursor_timer_on) + { + if (text->cursor_idle_time_timer_id) + { + gtk_idle_remove (text->cursor_idle_time_timer_id); + text->cursor_idle_time_timer_id = 0; + } + if (text->cursor_timer_id) + { + gtk_timeout_remove (text->cursor_timer_id); + text->cursor_timer_id = 0; + } + draw_cursor(text, TRUE); + } } -void gtk_stext_set_blink(GtkSText *text, gboolean blinkin_on) +void +gtk_stext_set_blink (GtkSText *text, gboolean blinking_on) { - if (text->cursor_timer_on != blinkin_on) { - if (text->cursor_timer_on) { - /* text widget already created? */ - if (text->cursor_visible) { - gtk_stext_disable_blink(text); - } - text->cursor_timer_on = FALSE; - } - else { - if (text->cursor_visible) { - gtk_stext_enable_blink(text); - } - text->cursor_timer_on = TRUE; - } + if (text->cursor_timer_on != blinking_on) + { + if (text->cursor_timer_on) + { + /* text widget already created? */ + if (text->cursor_visible) + { + gtk_stext_disable_blink (text); + } + text->cursor_timer_on = FALSE; } + else + { + if (text->cursor_visible) + { + gtk_stext_enable_blink (text); + } + text->cursor_timer_on = TRUE; + } + } } diff --git a/src/gtkstext.h b/src/gtkstext.h index b7e2aad38..f2e9676f1 100644 --- a/src/gtkstext.h +++ b/src/gtkstext.h @@ -24,10 +24,6 @@ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ -/* - * Modified by the Sylpheed Team and others 2001. - */ - #ifndef __GTK_STEXT_H__ #define __GTK_STEXT_H__ @@ -52,13 +48,11 @@ typedef struct _GtkSPropertyMark GtkSPropertyMark; typedef struct _GtkSText GtkSText; typedef struct _GtkSTextClass GtkSTextClass; -typedef enum _GtkSTextCursorType GtkSTextCursorType; - -enum _GtkSTextCursorType +typedef enum { - STEXT_CURSOR_LINE, - STEXT_CURSOR_BLOCK -}; + GTK_STEXT_CURSOR_LINE, + GTK_STEXT_CURSOR_BLOCK +} GtkSTextCursorType; struct _GtkSPropertyMark { @@ -151,13 +145,13 @@ struct _GtkSText /* CURSOR */ - gint cursor_pos_x; /* Position of cursor. */ - gint cursor_pos_y; /* Baseline of line cursor is drawn on. */ + gint cursor_pos_x; /* Position of cursor. */ + gint cursor_pos_y; /* Baseline of line cursor is drawn on. */ GtkSPropertyMark cursor_mark; /* Where it is in the buffer. */ - GdkWChar cursor_char; /* Character to redraw. */ - gchar cursor_char_offset; /* Distance from baseline of the font. */ - gint cursor_virtual_x; /* Where it would be if it could be. */ - gint cursor_drawn_level; /* How many people have undrawn. */ + GdkWChar cursor_char; /* Character to redraw. */ + gchar cursor_char_offset; /* Distance from baseline of the font. */ + gint cursor_virtual_x; /* Where it would be if it could be. */ + gint cursor_drawn_level; /* How many people have undrawn. */ /* Current Line */ @@ -177,14 +171,15 @@ struct _GtkSText GdkGC *bg_gc; /* gc for drawing background pixmap */ /* SYLPHEED: - * properties added for different cursor + * properties added for different cursor */ - gboolean cursor_visible; /* whether cursor is visible */ - gboolean cursor_timer_on; /* blinking enabled */ - guint cursor_off_ms, cursor_on_ms; /* cursor off / on time */ - gboolean cursor_state_on; /* state */ - guint32 cursor_timer_id; /* blinking timer */ - guint32 cursor_idle_time_timer_id; /* timer id */ + gboolean cursor_visible; /* whether cursor is visible */ + gboolean cursor_timer_on; /* blinking enabled */ + guint cursor_off_ms; /* cursor off time */ + guint cursor_on_ms; /* cursor on time */ + gboolean cursor_state_on; /* state */ + guint32 cursor_timer_id; /* blinking timer */ + guint32 cursor_idle_time_timer_id; /* timer id */ GtkSTextCursorType cursor_type; @@ -211,43 +206,45 @@ struct _GtkSTextClass GtkType gtk_stext_get_type (void); GtkWidget* gtk_stext_new (GtkAdjustment *hadj, - GtkAdjustment *vadj); -void gtk_stext_set_editable (GtkSText *text, - gboolean editable); -void gtk_stext_set_word_wrap (GtkSText *text, - gint word_wrap); -void gtk_stext_set_line_wrap (GtkSText *text, - gint line_wrap); -void gtk_stext_set_adjustments (GtkSText *text, - GtkAdjustment *hadj, - GtkAdjustment *vadj); -void gtk_stext_set_point (GtkSText *text, - guint index); -guint gtk_stext_get_point (GtkSText *text); -guint gtk_stext_get_length (GtkSText *text); -void gtk_stext_freeze (GtkSText *text); -void gtk_stext_thaw (GtkSText *text); -void gtk_stext_insert (GtkSText *text, - GdkFont *font, - GdkColor *fore, - GdkColor *back, - const char *chars, - gint length); -gint gtk_stext_backward_delete (GtkSText *text, - guint nchars); -gint gtk_stext_forward_delete (GtkSText *text, - guint nchars); + GtkAdjustment *vadj); +void gtk_stext_set_editable (GtkSText *text, + gboolean editable); +void gtk_stext_set_word_wrap (GtkSText *text, + gint word_wrap); +void gtk_stext_set_line_wrap (GtkSText *text, + gint line_wrap); +void gtk_stext_set_adjustments (GtkSText *text, + GtkAdjustment *hadj, + GtkAdjustment *vadj); +void gtk_stext_set_point (GtkSText *text, + guint index); +guint gtk_stext_get_point (GtkSText *text); +guint gtk_stext_get_length (GtkSText *text); +void gtk_stext_freeze (GtkSText *text); +void gtk_stext_thaw (GtkSText *text); +void gtk_stext_insert (GtkSText *text, + GdkFont *font, + GdkColor *fore, + GdkColor *back, + const char *chars, + gint length); +gint gtk_stext_backward_delete (GtkSText *text, + guint nchars); +gint gtk_stext_forward_delete (GtkSText *text, + guint nchars); /* SYLPHEED */ -void gtk_stext_set_blink (GtkSText *text, gboolean blinking_on); +void gtk_stext_set_blink (GtkSText *text, + gboolean blinking_on); +void gtk_stext_set_cursor_type (GtkSText *text, + GtkSTextCursorType cursor_type); void gtk_stext_compact_buffer (GtkSText *text); /* Set the rmargin for the stext. if rmargin is 0, then reset to old * behaviour */ void gtk_stext_set_wrap_rmargin (GtkSText *text, gint rmargin); -void gtk_stext_set_cursor_type (GtkSText *text, GtkSTextCursorType cursor_type); #define GTK_STEXT_INDEX(t, index) (((t)->use_wchar) \ ? ((index) < (t)->gap_position ? (t)->text.wc[index] : \ diff --git a/src/gtkutils.c b/src/gtkutils.c index 238eef404..be927178f 100644 --- a/src/gtkutils.c +++ b/src/gtkutils.c @@ -288,8 +288,8 @@ void gtkut_container_remove(GtkContainer *container, GtkWidget *widget) gtk_container_remove(container, widget); } -gboolean gtkut_text_match_string(GtkSText *text, gint pos, wchar_t *wcs, - gint len, gboolean case_sens) +gboolean gtkut_stext_match_string(GtkSText *text, gint pos, wchar_t *wcs, + gint len, gboolean case_sens) { gint match_count = 0; @@ -310,8 +310,8 @@ gboolean gtkut_text_match_string(GtkSText *text, gint pos, wchar_t *wcs, return FALSE; } -guint gtkut_text_str_compare_n(GtkSText *text, guint pos1, guint pos2, - guint len, guint text_len) +guint gtkut_stext_str_compare_n(GtkSText *text, guint pos1, guint pos2, + guint len, guint text_len) { guint i; GdkWChar ch1, ch2; @@ -326,8 +326,8 @@ guint gtkut_text_str_compare_n(GtkSText *text, guint pos1, guint pos2, return i; } -guint gtkut_text_str_compare(GtkSText *text, guint start_pos, guint text_len, - const gchar *str) +guint gtkut_stext_str_compare(GtkSText *text, guint start_pos, guint text_len, + const gchar *str) { wchar_t *wcs; guint len; @@ -342,20 +342,20 @@ guint gtkut_text_str_compare(GtkSText *text, guint start_pos, guint text_len, if (len > text_len - start_pos) result = FALSE; else - result = gtkut_text_match_string(text, start_pos, wcs, len, - TRUE); + result = gtkut_stext_match_string(text, start_pos, wcs, len, + TRUE); g_free(wcs); return result ? len : 0; } -gboolean gtkut_text_is_uri_string(GtkSText *text, - guint start_pos, guint text_len) +gboolean gtkut_stext_is_uri_string(GtkSText *text, + guint start_pos, guint text_len) { - if (gtkut_text_str_compare(text, start_pos, text_len, "http://") || - gtkut_text_str_compare(text, start_pos, text_len, "ftp://") || - gtkut_text_str_compare(text, start_pos, text_len, "https://")) + if (gtkut_stext_str_compare(text, start_pos, text_len, "http://") || + gtkut_stext_str_compare(text, start_pos, text_len, "ftp://") || + gtkut_stext_str_compare(text, start_pos, text_len, "https://")) return TRUE; return FALSE; diff --git a/src/gtkutils.h b/src/gtkutils.h index 4b9fdae6d..a9e1fa51f 100644 --- a/src/gtkutils.h +++ b/src/gtkutils.h @@ -105,21 +105,21 @@ void gtkut_combo_set_items (GtkCombo *combo, void gtkut_container_remove (GtkContainer *container, GtkWidget *widget); -gboolean gtkut_text_match_string (GtkSText *text, +gboolean gtkut_stext_match_string (GtkSText *text, gint pos, wchar_t *wcs, gint len, gboolean case_sens); -guint gtkut_text_str_compare_n (GtkSText *text, +guint gtkut_stext_str_compare_n (GtkSText *text, guint pos1, guint pos2, guint len, guint text_len); -guint gtkut_text_str_compare (GtkSText *text, +guint gtkut_stext_str_compare (GtkSText *text, guint start_pos, guint text_len, const gchar *str); -gboolean gtkut_text_is_uri_string (GtkSText *text, +gboolean gtkut_stext_is_uri_string (GtkSText *text, guint start_pos, guint text_len); diff --git a/src/imap.c b/src/imap.c index 68f5dc58e..e6cd4ed8f 100644 --- a/src/imap.c +++ b/src/imap.c @@ -1733,6 +1733,7 @@ static MsgInfo *imap_parse_envelope(SockInfo *sock, GString *line_str) cur_pos = imap_parse_address(sock, cur_pos + 1, &tmp_from, &tmp_fromname, line_str); + g_return_val_if_fail(cur_pos != NULL, NULL); Xstrdup_a(from, tmp_from, {g_free(tmp_from); g_free(tmp_fromname); return NULL;}); @@ -1747,6 +1748,7 @@ static MsgInfo *imap_parse_envelope(SockInfo *sock, GString *line_str) g_return_val_if_fail(*cur_pos == ' ', NULL); \ cur_pos = imap_parse_address(sock, cur_pos + 1, NULL, NULL, \ line_str); \ + g_return_val_if_fail(cur_pos != NULL, NULL); \ } /* skip sender and reply-to */ @@ -1756,6 +1758,7 @@ static MsgInfo *imap_parse_envelope(SockInfo *sock, GString *line_str) g_return_val_if_fail(*cur_pos == ' ', NULL); cur_pos = imap_parse_address(sock, cur_pos + 1, &tmp_to, NULL, line_str); + g_return_val_if_fail(cur_pos != NULL, NULL); Xstrdup_a(to, tmp_to, {g_free(tmp_to); return NULL;}); g_free(tmp_to); @@ -1768,6 +1771,7 @@ static MsgInfo *imap_parse_envelope(SockInfo *sock, GString *line_str) g_return_val_if_fail(*cur_pos == ' ', NULL); cur_pos = imap_parse_atom (sock, cur_pos, buf, sizeof(buf), line_str); + g_return_val_if_fail(cur_pos != NULL, NULL); if (buf[0] != '\0') { eliminate_parenthesis(buf, '(', ')'); extract_parenthesis(buf, '<', '>'); @@ -1778,6 +1782,7 @@ static MsgInfo *imap_parse_envelope(SockInfo *sock, GString *line_str) g_return_val_if_fail(*cur_pos == ' ', NULL); cur_pos = imap_parse_atom (sock, cur_pos, buf, sizeof(buf), line_str); + g_return_val_if_fail(cur_pos != NULL, NULL); if (buf[0] != '\0') { extract_parenthesis(buf, '<', '>'); remove_space(buf); diff --git a/src/importldif.c b/src/importldif.c index 1a821ae7a..506f3dd88 100644 --- a/src/importldif.c +++ b/src/importldif.c @@ -678,7 +678,7 @@ static void imp_ldif_page_finish( gint pageNum, gchar *pageLbl ) { gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1), GTK_FILL, 0, 0, 0); gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); - labelBook = gtk_label_new(_("")); + labelBook = gtk_label_new(""); gtk_table_attach(GTK_TABLE(table), labelBook, 1, 2, top, (top + 1), GTK_FILL, 0, 0, 0); gtk_misc_set_alignment(GTK_MISC(labelBook), 0, 0.5); @@ -688,7 +688,7 @@ static void imp_ldif_page_finish( gint pageNum, gchar *pageLbl ) { gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1), GTK_FILL, 0, 0, 0); gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); - labelFile = gtk_label_new(_("")); + labelFile = gtk_label_new(""); gtk_table_attach(GTK_TABLE(table), labelFile, 1, 2, top, (top + 1), GTK_FILL, 0, 0, 0); gtk_misc_set_alignment(GTK_MISC(labelFile), 0, 0.5); @@ -698,7 +698,7 @@ static void imp_ldif_page_finish( gint pageNum, gchar *pageLbl ) { gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1), GTK_FILL, 0, 0, 0); gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); - labelRecs = gtk_label_new(_("")); + labelRecs = gtk_label_new(""); gtk_table_attach(GTK_TABLE(table), labelRecs, 1, 2, top, (top + 1), GTK_FILL, 0, 0, 0); gtk_misc_set_alignment(GTK_MISC(labelRecs), 0, 0.5); diff --git a/src/ldif.c b/src/ldif.c index 9818503c3..612608d90 100644 --- a/src/ldif.c +++ b/src/ldif.c @@ -226,7 +226,7 @@ static void ldif_close_file( LdifFile *ldifFile ) { */ static gchar *ldif_get_line( LdifFile *ldifFile ) { gchar buf[ LDIFBUFSIZE ]; - int ch; + gint ch; gchar *ptr; if( feof( ldifFile->file ) ) return NULL; diff --git a/src/mainwindow.c b/src/mainwindow.c index 4353d35c9..c11ec38d5 100644 --- a/src/mainwindow.c +++ b/src/mainwindow.c @@ -435,14 +435,15 @@ static GtkItemFactoryEntry mainwin_entries[] = {N_("/_File/_Save as..."), NULL, save_as_cb, 0, NULL}, {N_("/_File/_Print..."), "P", print_cb, 0, NULL}, {N_("/_File/---"), NULL, NULL, 0, ""}, -/* {N_("/_File/_Close"), "W", app_exit_cb, 0, NULL},*/ + /* {N_("/_File/_Close"), "W", app_exit_cb, 0, NULL}, */ {N_("/_File/E_xit"), "Q", app_exit_cb, 0, NULL}, {N_("/_Edit"), NULL, NULL, 0, ""}, {N_("/_Edit/_Copy"), "C", copy_cb, 0, NULL}, {N_("/_Edit/Select _all"), "A", allsel_cb, 0, NULL}, {N_("/_Edit/---"), NULL, NULL, 0, ""}, - {N_("/_Edit/_Find in current message"), "F", search_cb, 0, NULL}, + {N_("/_Edit/_Find in current message..."), + "F", search_cb, 0, NULL}, {N_("/_Edit/_Search folder..."), "S", search_cb, 1, NULL}, {N_("/_View"), NULL, NULL, 0, ""}, @@ -452,18 +453,61 @@ static GtkItemFactoryEntry mainwin_entries[] = {N_("/_View/_Toolbar/Icon _and text"), NULL, toggle_toolbar_cb, TOOLBAR_BOTH, ""}, {N_("/_View/_Toolbar/_Icon"), NULL, toggle_toolbar_cb, TOOLBAR_ICON, "/View/Toolbar/Icon and text"}, {N_("/_View/_Toolbar/_Text"), NULL, toggle_toolbar_cb, TOOLBAR_TEXT, "/View/Toolbar/Icon and text"}, - {N_("/_View/_Toolbar/_None"), NULL, toggle_toolbar_cb, TOOLBAR_NONE, "/View/Toolbar/Icon and text"}, - {N_("/_View/_Status bar"), NULL, toggle_statusbar_cb, 0, ""}, + {N_("/_View/_Toolbar/_None"), NULL, toggle_toolbar_cb, TOOLBAR_NONE, "/View/Toolbar/Icon and text"}, + {N_("/_View/Status _bar"), NULL, toggle_statusbar_cb, 0, ""}, {N_("/_View/---"), NULL, NULL, 0, ""}, {N_("/_View/Separate f_older tree"), NULL, NULL, SEPARATE_ACTION + SEPARATE_FOLDER, ""}, {N_("/_View/Separate m_essage view"), NULL, NULL, SEPARATE_ACTION + SEPARATE_MESSAGE, ""}, {N_("/_View/---"), NULL, NULL, 0, ""}, - {N_("/_View/View _source"), "U", view_source_cb, 0, NULL}, - {N_("/_View/Show all _header"), "H", header_window_show_cb, 0, NULL}, + {N_("/_View/_Sort"), NULL, NULL, 0, ""}, + {N_("/_View/_Sort/Sort by _number"), NULL, sort_summary_cb, SORT_BY_NUMBER, NULL}, + {N_("/_View/_Sort/Sort by s_ize"), NULL, sort_summary_cb, SORT_BY_SIZE, NULL}, + {N_("/_View/_Sort/Sort by _date"), NULL, sort_summary_cb, SORT_BY_DATE, NULL}, + {N_("/_View/_Sort/Sort by _from"), NULL, sort_summary_cb, SORT_BY_FROM, NULL}, + {N_("/_View/_Sort/Sort by _subject"),NULL, sort_summary_cb, SORT_BY_SUBJECT, NULL}, + {N_("/_View/_Sort/Sort by _color label"), + NULL, sort_summary_cb, SORT_BY_LABEL, NULL}, + {N_("/_View/_Sort/Sort by _mark"), NULL, sort_summary_cb, SORT_BY_MARK, NULL}, + {N_("/_View/_Sort/Sort by _unread"), NULL, sort_summary_cb, SORT_BY_UNREAD, NULL}, + {N_("/_View/_Sort/Sort by a_ttachment"), + NULL, sort_summary_cb, SORT_BY_MIME, NULL}, + {N_("/_View/_Sort/---"), NULL, NULL, 0, ""}, + {N_("/_View/_Sort/_Attract by subject"), + NULL, attract_by_subject_cb, 0, NULL}, + {N_("/_View/Th_read view"), "T", thread_cb, 0, NULL}, + {N_("/_View/U_nthread view"), "T", thread_cb, 1, NULL}, + {N_("/_View/Set display _item..."), NULL, set_display_item_cb, 0, NULL}, {N_("/_View/---"), NULL, NULL, 0, ""}, {N_("/_View/_Code set"), NULL, NULL, 0, ""}, {N_("/_View/_Code set/_Auto detect"), NULL, set_charset_cb, C_AUTO, ""}, + {N_("/_View/---"), NULL, NULL, 0, ""}, + {N_("/_View/_Go to"), NULL, NULL, 0, ""}, + {N_("/_View/_Go to/_Prev message"), NULL, prev_cb, 0, NULL}, + {N_("/_View/_Go to/_Next message"), NULL, next_cb, 0, NULL}, + {N_("/_View/_Go to/---"), NULL, NULL, 0, ""}, + {N_("/_View/_Go to/P_rev unread message"), + NULL, prev_unread_cb, 0, NULL}, + {N_("/_View/_Go to/N_ext unread message"), + NULL, next_unread_cb, 0, NULL}, + {N_("/_View/_Go to/---"), NULL, NULL, 0, ""}, + {N_("/_View/_Go to/Prev _marked message"), + NULL, prev_marked_cb, 0, NULL}, + {N_("/_View/_Go to/Next m_arked message"), + NULL, next_marked_cb, 0, NULL}, + {N_("/_View/_Go to/---"), NULL, NULL, 0, ""}, + {N_("/_View/_Go to/Prev _labeled message"), + NULL, prev_labeled_cb, 0, NULL}, + {N_("/_View/_Go to/Next la_beled message"), + NULL, next_labeled_cb, 0, NULL}, + {N_("/_View/_Go to/---"), NULL, NULL, 0, ""}, + {N_("/_View/_Go to/Other _folder..."), "G", goto_folder_cb, 0, NULL}, + {N_("/_View/---"), NULL, NULL, 0, ""}, + {N_("/_View/Open in new _window"), "N", open_msg_cb, 0, NULL}, + {N_("/_View/_View source"), "U", view_source_cb, 0, NULL}, + {N_("/_View/Show all _header"), "H", header_window_show_cb, 0, NULL}, + {N_("/_View/---"), NULL, NULL, 0, ""}, + {N_("/_View/_Update"), "U", update_summary_cb, 0, NULL}, #define CODESET_SEPARATOR \ {N_("/_View/_Code set/---"), NULL, NULL, 0, ""} @@ -541,7 +585,7 @@ static GtkItemFactoryEntry mainwin_entries[] = #undef CODESET_ACTION {N_("/_Message"), NULL, NULL, 0, ""}, - {N_("/_Message/Get new ma_il"), "I", inc_mail_cb, 0, NULL}, + {N_("/_Message/Get new ma_il"), "I", inc_mail_cb, 0, NULL}, {N_("/_Message/Get from _all accounts"), "I", inc_all_account_mail_cb, 0, NULL}, {N_("/_Message/---"), NULL, NULL, 0, ""}, @@ -563,6 +607,9 @@ static GtkItemFactoryEntry mainwin_entries[] = {N_("/_Message/_Copy..."), NULL, copy_to_cb, 0, NULL}, {N_("/_Message/_Delete"), "D", delete_cb, 0, NULL}, {N_("/_Message/---"), NULL, NULL, 0, ""}, + {N_("/_Message/Delete du_plicated messages"), + NULL, delete_duplicated_cb, 0, NULL}, + {N_("/_Message/---"), NULL, NULL, 0, ""}, {N_("/_Message/_Mark"), NULL, NULL, 0, ""}, {N_("/_Message/_Mark/_Mark"), NULL, mark_cb, 0, NULL}, {N_("/_Message/_Mark/_Unmark"), NULL, unmark_cb, 0, NULL}, @@ -570,59 +617,17 @@ static GtkItemFactoryEntry mainwin_entries[] = {N_("/_Message/_Mark/Mark as unr_ead"), NULL, mark_as_unread_cb, 0, NULL}, {N_("/_Message/_Mark/Mark as rea_d"), NULL, mark_as_read_cb, 0, NULL}, - {N_("/_Message/_Mark/Mark all read"), NULL, mark_all_read_cb, 0, NULL}, - {N_("/_Message/---"), NULL, NULL, 0, ""}, - {N_("/_Message/Open in new _window"), "N", open_msg_cb, 0, NULL}, - - {N_("/_Summary"), NULL, NULL, 0, ""}, - {N_("/_Summary/_Hide read messages"), NULL, hide_read_messages, 0, ""}, - {N_("/_Summary/_Delete duplicated messages"), - NULL, delete_duplicated_cb, 0, NULL}, - {N_("/_Summary/_Filter messages"), NULL, filter_cb, 0, NULL}, - {N_("/_Summary/E_xecute"), "X", execute_summary_cb, 0, NULL}, - {N_("/_Summary/_Update"), "U", update_summary_cb, 0, NULL}, - {N_("/_Summary/---"), NULL, NULL, 0, ""}, - {N_("/_Summary/Go _to"), NULL, NULL, 0, ""}, - {N_("/_Summary/Go _to/_Prev message"), NULL, prev_cb, 0, NULL}, - {N_("/_Summary/Go _to/_Next message"), NULL, next_cb, 0, NULL}, - {N_("/_Summary/Go _to/---"), NULL, NULL, 0, ""}, - {N_("/_Summary/Go _to/P_rev unread message"), - NULL, prev_unread_cb, 0, NULL}, - {N_("/_Summary/Go _to/N_ext unread message"), - NULL, next_unread_cb, 0, NULL}, - {N_("/_Summary/Go _to/---"), NULL, NULL, 0, ""}, - {N_("/_Summary/Go _to/Prev _marked message"), - NULL, prev_marked_cb, 0, NULL}, - {N_("/_Summary/Go _to/Next m_arked message"), - NULL, next_marked_cb, 0, NULL}, - {N_("/_Summary/Go _to/---"), NULL, NULL, 0, ""}, - {N_("/_Summary/Go _to/Prev _labeled message"), - NULL, prev_labeled_cb, 0, NULL}, - {N_("/_Summary/Go _to/Next la_beled message"), - NULL, next_labeled_cb, 0, NULL}, - {N_("/_Summary/_Go to other folder..."),"G", goto_folder_cb, 0, NULL}, - {N_("/_Summary/---"), NULL, NULL, 0, ""}, - {N_("/_Summary/_Sort"), NULL, NULL, 0, ""}, - {N_("/_Summary/_Sort/Sort by _number"), NULL, sort_summary_cb, SORT_BY_NUMBER, NULL}, - {N_("/_Summary/_Sort/Sort by s_ize"), NULL, sort_summary_cb, SORT_BY_SIZE, NULL}, - {N_("/_Summary/_Sort/Sort by _date"), NULL, sort_summary_cb, SORT_BY_DATE, NULL}, - {N_("/_Summary/_Sort/Sort by _from"), NULL, sort_summary_cb, SORT_BY_FROM, NULL}, - {N_("/_Summary/_Sort/Sort by _subject"),NULL, sort_summary_cb, SORT_BY_SUBJECT, NULL}, - {N_("/_Summary/_Sort/Sort by _color label"), - NULL, sort_summary_cb, SORT_BY_LABEL, NULL}, - {N_("/_Summary/_Sort/Sort by _mark"), NULL, sort_summary_cb, SORT_BY_MARK, NULL}, - {N_("/_Summary/_Sort/Sort by _unread"), NULL, sort_summary_cb, SORT_BY_UNREAD, NULL}, - {N_("/_Summary/_Sort/Sort by a_ttachment"), - NULL, sort_summary_cb, SORT_BY_MIME, NULL}, - {N_("/_Summary/_Sort/---"), NULL, NULL, 0, ""}, - {N_("/_Summary/_Sort/_Attract by subject"), - NULL, attract_by_subject_cb, 0, NULL}, - {N_("/_Summary/_Thread view"), "T", thread_cb, 0, NULL}, - {N_("/_Summary/Unt_hread view"), "T", thread_cb, 1, NULL}, - {N_("/_Summary/Set display _item..."), NULL, set_display_item_cb, 0, NULL}, + {N_("/_Message/_Mark/Mark all _read"), NULL, mark_all_read_cb, 0, NULL}, {N_("/_Tool"), NULL, NULL, 0, ""}, {N_("/_Tool/_Address book"), "A", addressbook_open_cb, 0, NULL}, + {N_("/_Tool/Add sender to address boo_k"), + NULL, add_address_cb, 0, NULL}, + {N_("/_Tool/---"), NULL, NULL, 0, ""}, + {N_("/_Tool/_Filter messages"), NULL, filter_cb, 0, NULL}, + {N_("/_Tool/---"), NULL, NULL, 0, ""}, + {N_("/_Tool/E_xecute"), "X", execute_summary_cb, 0, NULL}, + {N_("/_Tool/---"), NULL, NULL, 0, ""}, {N_("/_Tool/_Log window"), "L", log_window_show_cb, 0, NULL}, {N_("/_Configuration"), NULL, NULL, 0, ""}, @@ -645,7 +650,7 @@ static GtkItemFactoryEntry mainwin_entries[] = {N_("/_Configuration/C_hange current account"), NULL, NULL, 0, ""}, - {N_("/_Help"), NULL, NULL, 0, ""}, + {N_("/_Help"), NULL, NULL, 0, ""}, {N_("/_Help/_Manual"), NULL, NULL, 0, ""}, {N_("/_Help/_Manual/_English"), NULL, manual_open_cb, MANUAL_LANG_EN, NULL}, {N_("/_Help/_Manual/_Japanese"), NULL, manual_open_cb, MANUAL_LANG_JA, NULL}, @@ -930,13 +935,10 @@ MainWindow *main_window_create(SeparateType type) GUINT_TO_POINTER(SEPARATE_MESSAGE)); - menu_set_sensitive(ifactory, "/Summary/Thread view", + menu_set_sensitive(ifactory, "/View/Thread view", prefs_common.enable_thread ? FALSE : TRUE); - menu_set_sensitive(ifactory, "/Summary/Unthread view", + menu_set_sensitive(ifactory, "/View/Unthread view", prefs_common.enable_thread ? TRUE : FALSE); - - /*main_window_set_thread_option(mainwin);*/ - /* set account selection menu */ ac_menu = gtk_item_factory_get_widget @@ -953,7 +955,6 @@ MainWindow *main_window_create(SeparateType type) prefs_common.mainwin_y); gtk_widget_set_usize(window, prefs_common.mainwin_width, prefs_common.mainwin_height); - gtk_widget_show(mainwin->window); /* initialize views */ @@ -963,7 +964,6 @@ MainWindow *main_window_create(SeparateType type) header_window_init(mainwin->headerwin); log_window_init(mainwin->logwin); - mainwin->lock_count = 0; mainwin->cursor_count = 0; @@ -1440,15 +1440,26 @@ void main_window_set_menu_sensitive(MainWindow *mainwin) {"/File/Empty trash" , M_UNLOCKED}, {"/File/Save as...", M_SINGLE_TARGET_EXIST|M_UNLOCKED}, {"/File/Print..." , M_TARGET_EXIST|M_UNLOCKED}, -/* {"/File/Close", M_UNLOCKED},*/ + /* {"/File/Close", M_UNLOCKED}, */ {"/File/Exit" , M_UNLOCKED}, - {"/View/Show all header" , M_SINGLE_TARGET_EXIST}, - {"/View/View source" , M_SINGLE_TARGET_EXIST}, + {"/View/Sort" , M_MSG_EXIST}, + {"/View/Thread view" , M_UNTHREADED}, + {"/View/Unthread view" , M_THREADED}, + {"/View/Go to" , M_MSG_EXIST}, + {"/View/Go to/Prev message" , M_MSG_EXIST}, + {"/View/Go to/Next message" , M_MSG_EXIST}, + {"/View/Go to/Next unread message" , M_MSG_EXIST}, + {"/View/Go to/Prev marked message" , M_MSG_EXIST}, + {"/View/Go to/Next marked message" , M_MSG_EXIST}, + {"/View/Go to/Prev labeled message", M_MSG_EXIST}, + {"/View/Go to/Next labeled message", M_MSG_EXIST}, + {"/View/Open in new window" , M_SINGLE_TARGET_EXIST}, + {"/View/Show all header" , M_SINGLE_TARGET_EXIST}, + {"/View/View source" , M_SINGLE_TARGET_EXIST}, {"/Message/Get new mail" , M_HAVE_ACCOUNT|M_UNLOCKED}, {"/Message/Get from all accounts" , M_HAVE_ACCOUNT|M_UNLOCKED}, -/* {"/Message/Compose new message" , M_HAVE_ACCOUNT}, */ {"/Message/Compose a news message", M_HAVE_NEWS_ACCOUNT}, {"/Message/Reply" , M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST}, {"/Message/Reply to sender" , M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST}, @@ -1456,33 +1467,22 @@ void main_window_set_menu_sensitive(MainWindow *mainwin) {"/Message/Follow-up and reply to", M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST|M_NEWS}, {"/Message/Forward" , M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST}, {"/Message/Bounce" , M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST}, - {"/Message/Open in new window" , M_SINGLE_TARGET_EXIST}, {"/Message/Re-edit", M_HAVE_ACCOUNT|M_ALLOW_REEDIT}, {"/Message/Move...", M_TARGET_EXIST|M_EXEC|M_UNLOCKED}, {"/Message/Copy...", M_TARGET_EXIST|M_EXEC|M_UNLOCKED}, {"/Message/Delete" , M_TARGET_EXIST|M_EXEC|M_UNLOCKED}, {"/Message/Mark" , M_TARGET_EXIST}, + {"/Message/Delete duplicated messages", M_MSG_EXIST|M_EXEC|M_UNLOCKED}, - {"/Summary/Delete duplicated messages", M_MSG_EXIST|M_EXEC|M_UNLOCKED}, - {"/Summary/Filter messages" , M_MSG_EXIST|M_EXEC|M_UNLOCKED}, - {"/Summary/Execute" , M_MSG_EXIST|M_EXEC|M_UNLOCKED}, - {"/Summary/Go to" , M_MSG_EXIST}, - {"/Summary/Go to/Prev message" , M_MSG_EXIST}, - {"/Summary/Go to/Next message" , M_MSG_EXIST}, - {"/Summary/Go to/Next unread message" , M_MSG_EXIST}, - {"/Summary/Go to/Prev marked message" , M_MSG_EXIST}, - {"/Summary/Go to/Next marked message" , M_MSG_EXIST}, - {"/Summary/Go to/Prev labeled message", M_MSG_EXIST}, - {"/Summary/Go to/Next labeled message", M_MSG_EXIST}, - {"/Summary/Sort" , M_MSG_EXIST}, - {"/Summary/Thread view" , M_UNTHREADED}, - {"/Summary/Unthread view" , M_THREADED}, + {"/Tool/Add sender to address book", M_SINGLE_TARGET_EXIST}, + {"/Tool/Filter messages" , M_MSG_EXIST|M_EXEC|M_UNLOCKED}, + {"/Tool/Execute" , M_MSG_EXIST|M_EXEC|M_UNLOCKED}, {"/Configuration", M_UNLOCKED}, {NULL, 0} }; - + ifactory = gtk_item_factory_from_widget(mainwin->menubar); state = main_window_get_current_state(mainwin); @@ -1559,8 +1559,10 @@ static void main_window_set_widgets(MainWindow *mainwin, SeparateType type) /* create separated window(s) if needed */ if (type & SEPARATE_FOLDER) { folderwin = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_window_set_title(GTK_WINDOW(folderwin), _("Sylpheed - folder view")); - gtk_window_set_wmclass(GTK_WINDOW(folderwin), "separate folderview", "Sylpheed"); + gtk_window_set_title(GTK_WINDOW(folderwin), + _("Sylpheed - Folder View")); + gtk_window_set_wmclass(GTK_WINDOW(folderwin), + "folder_view", "Sylpheed"); gtk_window_set_policy(GTK_WINDOW(folderwin), TRUE, TRUE, FALSE); gtk_widget_set_usize(folderwin, -1, @@ -1573,8 +1575,10 @@ static void main_window_set_widgets(MainWindow *mainwin, SeparateType type) } if (type & SEPARATE_MESSAGE) { messagewin = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_window_set_title(GTK_WINDOW(messagewin), _("Sylpheed - message view")); - gtk_window_set_wmclass(GTK_WINDOW(messagewin), "separate messageview", "Sylpheed"); + gtk_window_set_title(GTK_WINDOW(messagewin), + _("Sylpheed - Message View")); + gtk_window_set_wmclass(GTK_WINDOW(messagewin), + "message_view", "Sylpheed"); gtk_window_set_policy(GTK_WINDOW(messagewin), TRUE, TRUE, FALSE); gtk_widget_set_usize @@ -2698,13 +2702,13 @@ static void thread_cb(MainWindow *mainwin, guint action, GtkWidget *widget) if (0 == action) { summary_thread_build(mainwin->summaryview); mainwin->summaryview->folder_item->threaded = TRUE; - menu_set_sensitive(ifactory, "/Summary/Thread view", FALSE); - menu_set_sensitive(ifactory, "/Summary/Unthread view", TRUE); + menu_set_sensitive(ifactory, "/View/Thread view", FALSE); + menu_set_sensitive(ifactory, "/View/Unthread view", TRUE); } else { summary_unthread(mainwin->summaryview); mainwin->summaryview->folder_item->threaded = FALSE; - menu_set_sensitive(ifactory, "/Summary/Thread view", TRUE); - menu_set_sensitive(ifactory, "/Summary/Unthread view", FALSE); + menu_set_sensitive(ifactory, "/View/Thread view", TRUE); + menu_set_sensitive(ifactory, "/View/Unthread view", FALSE); } } diff --git a/src/menu.h b/src/menu.h index c7eef99d0..f96f4bd05 100644 --- a/src/menu.h +++ b/src/menu.h @@ -23,6 +23,7 @@ #include #include #include +#include #include #define MENUITEM_ADD(menu, menuitem, label, data) \ diff --git a/src/summary_search.c b/src/summary_search.c index fca8d717b..2f31620bc 100644 --- a/src/summary_search.c +++ b/src/summary_search.c @@ -95,7 +95,7 @@ static void summary_search_create(SummaryView *summaryview) GtkWidget *confirm_area; window = gtk_window_new (GTK_WINDOW_DIALOG); - gtk_window_set_title (GTK_WINDOW (window), _("Search folder")); + gtk_window_set_title (GTK_WINDOW (window), _("Search messages")); gtk_widget_set_usize (window, 450, -1); gtk_window_set_policy(GTK_WINDOW(window), FALSE, TRUE, TRUE); gtk_container_set_border_width (GTK_CONTAINER (window), 8); diff --git a/src/textview.c b/src/textview.c index 0d1114702..37fa0bbda 100644 --- a/src/textview.c +++ b/src/textview.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -41,6 +40,7 @@ #include "procheader.h" #include "prefs_common.h" #include "codeconv.h" +#include "gtkstext.h" #include "utils.h" #include "gtkutils.h" #include "procmime.h" @@ -160,15 +160,15 @@ TextView *textview_create(void) gtk_widget_set_usize(scrolledwin_sb, prefs_common.mainview_width, -1); gtk_widget_set_usize(scrolledwin_mb, prefs_common.mainview_width, -1); - /* create GtkText widgets for single-byte and multi-byte character */ - text_sb = gtk_text_new(NULL, NULL); - text_mb = gtk_text_new(NULL, NULL); - GTK_TEXT(text_sb)->default_tab_width = 8; - GTK_TEXT(text_mb)->default_tab_width = 8; + /* create GtkSText widgets for single-byte and multi-byte character */ + text_sb = gtk_stext_new(NULL, NULL); + text_mb = gtk_stext_new(NULL, NULL); + GTK_STEXT(text_sb)->default_tab_width = 8; + GTK_STEXT(text_mb)->default_tab_width = 8; gtk_widget_show(text_sb); gtk_widget_show(text_mb); - gtk_text_set_word_wrap(GTK_TEXT(text_sb), TRUE); - gtk_text_set_word_wrap(GTK_TEXT(text_mb), TRUE); + gtk_stext_set_word_wrap(GTK_STEXT(text_sb), TRUE); + gtk_stext_set_word_wrap(GTK_STEXT(text_mb), TRUE); gtk_widget_ensure_style(text_sb); gtk_widget_ensure_style(text_mb); if (text_sb->style && text_sb->style->font->type == GDK_FONT_FONTSET) { @@ -278,7 +278,7 @@ void textview_show_message(TextView *textview, MimeInfo *mimeinfo, void textview_show_part(TextView *textview, MimeInfo *mimeinfo, FILE *fp) { - GtkText *text; + GtkSText *text; gchar buf[BUFFSIZE]; const gchar *boundary = NULL; gint boundary_len = 0; @@ -361,8 +361,8 @@ void textview_show_part(TextView *textview, MimeInfo *mimeinfo, FILE *fp) conv = conv_code_converter_new(charset); textview_clear(textview); - text = GTK_TEXT(textview->text); - gtk_text_freeze(text); + text = GTK_STEXT(textview->text); + gtk_stext_freeze(text); textview->body_pos = 0; textview->cur_pos = 0; @@ -386,23 +386,23 @@ void textview_show_part(TextView *textview, MimeInfo *mimeinfo, FILE *fp) conv_code_converter_destroy(conv); - gtk_text_thaw(text); + gtk_stext_thaw(text); } #define TEXT_INSERT(str) \ - gtk_text_insert(text, textview->msgfont, NULL, NULL, str, -1) + gtk_stext_insert(text, textview->msgfont, NULL, NULL, str, -1) void textview_show_mime_part(TextView *textview, MimeInfo *partinfo) { - GtkText *text; + GtkSText *text; if (!partinfo) return; textview_set_font(textview, NULL); - text = GTK_TEXT(textview->text); + text = GTK_STEXT(textview->text); textview_clear(textview); - gtk_text_freeze(text); + gtk_stext_freeze(text); TEXT_INSERT(_("To save this part, pop up the context menu with ")); TEXT_INSERT(_("right click and select `Save as...', ")); @@ -416,21 +416,21 @@ void textview_show_mime_part(TextView *textview, MimeInfo *partinfo) TEXT_INSERT(_("or double-click, or click the center button, ")); TEXT_INSERT(_("or press `l' key.")); - gtk_text_thaw(text); + gtk_stext_thaw(text); } #if USE_GPGME void textview_show_signature_part(TextView *textview, MimeInfo *partinfo) { - GtkText *text; + GtkSText *text; if (!partinfo) return; textview_set_font(textview, NULL); - text = GTK_TEXT(textview->text); + text = GTK_STEXT(textview->text); textview_clear(textview); - gtk_text_freeze(text); + gtk_stext_freeze(text); if (partinfo->sigstatus_full == NULL) { TEXT_INSERT(_("This signature has not been checked yet.\n")); @@ -440,7 +440,7 @@ void textview_show_signature_part(TextView *textview, MimeInfo *partinfo) TEXT_INSERT(partinfo->sigstatus_full); } - gtk_text_thaw(text); + gtk_stext_thaw(text); } #endif /* USE_GPGME */ @@ -696,7 +696,7 @@ static gchar *make_email_string(const gchar *bp, const gchar *ep) last->next = NULL; \ } else { \ g_warning("alloc error scanning URIs\n"); \ - gtk_text_insert(text, textview->msgfont, fg_color, NULL, \ + gtk_stext_insert(text, textview->msgfont, fg_color, NULL, \ linebuf, -1); \ return; \ } @@ -743,7 +743,7 @@ static void textview_make_clickable_parts(TextView *textview, struct txtpos *next; /* next */ } head = {NULL, NULL, 0, NULL}, *last = &head; - GtkText *text = GTK_TEXT(textview->text); + GtkSText *text = GTK_STEXT(textview->text); /* parse for clickable parts, and build a list of begin and end positions */ for (walk = linebuf, n = 0;;) { @@ -787,25 +787,25 @@ static void textview_make_clickable_parts(TextView *textview, uri = g_new(RemoteURI, 1); if (last->bp - normal_text > 0) - gtk_text_insert(text, font, + gtk_stext_insert(text, font, fg_color, NULL, normal_text, last->bp - normal_text); - uri->uri = parser[last->pti].build_uri(last->bp, + uri->uri = parser[last->pti].build_uri(last->bp, last->ep); - uri->start = gtk_text_get_point(text); - gtk_text_insert(text, font, uri_color, + uri->start = gtk_stext_get_point(text); + gtk_stext_insert(text, font, uri_color, NULL, last->bp, last->ep - last->bp); - uri->end = gtk_text_get_point(text); + uri->end = gtk_stext_get_point(text); textview->uri_list = g_slist_append(textview->uri_list, uri); } if (*normal_text) - gtk_text_insert(text, font, fg_color, + gtk_stext_insert(text, font, fg_color, NULL, normal_text, -1); } else - gtk_text_insert(text, font, fg_color, NULL, linebuf, -1); + gtk_stext_insert(text, font, fg_color, NULL, linebuf, -1); } #undef ADD_TXT_POS @@ -816,7 +816,7 @@ static void textview_write_link(TextView *textview, const gchar *url, { GdkColor *link_color = NULL; RemoteURI* uri; - GtkText *text = GTK_TEXT(textview->text); + GtkSText *text = GTK_STEXT(textview->text); gchar buf[BUFFSIZE]; /* this part is taken from textview_write_line. Right now the only place @@ -824,7 +824,7 @@ static void textview_write_link(TextView *textview, const gchar *url, if (!conv) strncpy2(buf, str, sizeof(buf)); else if (conv_convert(conv, buf, sizeof(buf), str) < 0) { - gtk_text_insert(text, textview->msgfont, + gtk_stext_insert(text, textview->msgfont, prefs_common.enable_color ? &error_color : NULL, NULL, "*** Warning: code conversion failed ***\n", @@ -838,17 +838,17 @@ static void textview_write_link(TextView *textview, const gchar *url, } uri = g_new(RemoteURI, 1); uri->uri = g_strdup(url); - uri->start = gtk_text_get_point(text); - gtk_text_insert(text, textview->msgfont, link_color, NULL, buf, + uri->start = gtk_stext_get_point(text); + gtk_stext_insert(text, textview->msgfont, link_color, NULL, buf, strlen(buf)); - uri->end = gtk_text_get_point(text); + uri->end = gtk_stext_get_point(text); textview->uri_list = g_slist_append(textview->uri_list, uri); } static void textview_write_line(TextView *textview, const gchar *str, CodeConverter *conv) { - GtkText *text = GTK_TEXT(textview->text); + GtkSText *text = GTK_STEXT(textview->text); gchar buf[BUFFSIZE]; GdkColor *fg_color; gint quotelevel = -1; @@ -856,7 +856,7 @@ static void textview_write_line(TextView *textview, const gchar *str, if (!conv) strncpy2(buf, str, sizeof(buf)); else if (conv_convert(conv, buf, sizeof(buf), str) < 0) { - gtk_text_insert(text, textview->msgfont, + gtk_stext_insert(text, textview->msgfont, prefs_common.enable_color ? &error_color : NULL, NULL, "*** Warning: code conversion failed ***\n", @@ -891,7 +891,7 @@ static void textview_write_line(TextView *textview, const gchar *str, fg_color = "e_colors[quotelevel]; if (prefs_common.head_space && spacingfont && buf[0] != '\n') - gtk_text_insert(text, spacingfont, NULL, NULL, " ", 1); + gtk_stext_insert(text, spacingfont, NULL, NULL, " ", 1); if (prefs_common.enable_color) textview_make_clickable_parts(textview, textview->msgfont, @@ -903,12 +903,12 @@ static void textview_write_line(TextView *textview, const gchar *str, void textview_clear(TextView *textview) { - GtkText *text = GTK_TEXT(textview->text); + GtkSText *text = GTK_STEXT(textview->text); - gtk_text_freeze(text); - gtk_text_set_point(text, 0); - gtk_text_forward_delete(text, gtk_text_get_length(text)); - gtk_text_thaw(text); + gtk_stext_freeze(text); + gtk_stext_set_point(text, 0); + gtk_stext_forward_delete(text, gtk_stext_get_length(text)); + gtk_stext_thaw(text); textview_uri_list_remove_all(textview->uri_list); textview->uri_list = NULL; @@ -939,7 +939,7 @@ void textview_set_font(TextView *textview, const gchar *codeset) { gboolean use_fontset = TRUE; - /* In multi-byte mode, GtkText can't display 8bit characters + /* In multi-byte mode, GtkSText can't display 8bit characters correctly, so it must be single-byte mode. */ if (MB_CUR_MAX > 1) { if (codeset) { @@ -1037,7 +1037,7 @@ void textview_set_position(TextView *textview, gint pos) { if (pos < 0) { textview->cur_pos = - gtk_text_get_length(GTK_TEXT(textview->text)); + gtk_stext_get_length(GTK_STEXT(textview->text)); } else { textview->cur_pos = pos; } @@ -1098,22 +1098,22 @@ static GPtrArray *textview_scan_header(TextView *textview, FILE *fp) static void textview_show_header(TextView *textview, GPtrArray *headers) { - GtkText *text = GTK_TEXT(textview->text); + GtkSText *text = GTK_STEXT(textview->text); Header *header; gint i; g_return_if_fail(headers != NULL); - gtk_text_freeze(text); + gtk_stext_freeze(text); for (i = 0; i < headers->len; i++) { header = g_ptr_array_index(headers, i); g_return_if_fail(header->name != NULL); - gtk_text_insert(text, textview->boldfont, NULL, NULL, + gtk_stext_insert(text, textview->boldfont, NULL, NULL, header->name, -1); if (header->name[strlen(header->name) - 1] != ' ') - gtk_text_insert(text, textview->boldfont, + gtk_stext_insert(text, textview->boldfont, NULL, NULL, " ", 1); if (procheader_headername_equal(header->name, "Subject") || @@ -1127,7 +1127,7 @@ static void textview_show_header(TextView *textview, GPtrArray *headers) procheader_headername_equal(header->name, "X-Newsreader")) && strstr(header->body, "Sylpheed") != NULL) - gtk_text_insert(text, NULL, &emphasis_color, NULL, + gtk_stext_insert(text, NULL, &emphasis_color, NULL, header->body, -1); else if (prefs_common.enable_color) { textview_make_clickable_parts(textview, @@ -1138,18 +1138,18 @@ static void textview_show_header(TextView *textview, GPtrArray *headers) NULL, NULL, NULL, header->body); } - gtk_text_insert(text, textview->msgfont, NULL, NULL, "\n", 1); + gtk_stext_insert(text, textview->msgfont, NULL, NULL, "\n", 1); } - gtk_text_insert(text, textview->msgfont, NULL, NULL, "\n", 1); - gtk_text_thaw(text); - textview->body_pos = gtk_text_get_length(text); + gtk_stext_insert(text, textview->msgfont, NULL, NULL, "\n", 1); + gtk_stext_thaw(text); + textview->body_pos = gtk_stext_get_length(text); } gboolean textview_search_string(TextView *textview, const gchar *str, gboolean case_sens) { - GtkText *text = GTK_TEXT(textview->text); + GtkSText *text = GTK_STEXT(textview->text); gint pos; wchar_t *wcs; gint len; @@ -1164,7 +1164,7 @@ gboolean textview_search_string(TextView *textview, const gchar *str, pos = textview->cur_pos; if (pos < textview->body_pos) pos = textview->body_pos; - text_len = gtk_text_get_length(text); + text_len = gtk_stext_get_length(text); if (text_len - pos < len) { g_free(wcs); return FALSE; @@ -1172,7 +1172,7 @@ gboolean textview_search_string(TextView *textview, const gchar *str, for (; pos < text_len; pos++) { if (text_len - pos < len) break; - if (gtkut_text_match_string(GTK_TEXT(text), pos, wcs, len, case_sens) + if (gtkut_stext_match_string(text, pos, wcs, len, case_sens) == TRUE) { gtk_editable_set_position(GTK_EDITABLE(text), pos + len); @@ -1192,7 +1192,7 @@ gboolean textview_search_string(TextView *textview, const gchar *str, gboolean textview_search_string_backward(TextView *textview, const gchar *str, gboolean case_sens) { - GtkText *text = GTK_TEXT(textview->text); + GtkSText *text = GTK_STEXT(textview->text); gint pos; wchar_t *wcs; gint len; @@ -1205,7 +1205,7 @@ gboolean textview_search_string_backward(TextView *textview, const gchar *str, g_return_val_if_fail(wcs != NULL, FALSE); len = wcslen(wcs); pos = textview->cur_pos; - text_len = gtk_text_get_length(text); + text_len = gtk_stext_get_length(text); if (text_len - textview->body_pos < len) { g_free(wcs); return FALSE; @@ -1214,7 +1214,7 @@ gboolean textview_search_string_backward(TextView *textview, const gchar *str, pos = text_len - len; for (; pos >= textview->body_pos; pos--) { - if (gtkut_text_match_string(GTK_TEXT(text), pos, wcs, len, case_sens) + if (gtkut_stext_match_string(text, pos, wcs, len, case_sens) == TRUE) { gtk_editable_set_position(GTK_EDITABLE(text), pos); gtk_editable_select_region(GTK_EDITABLE(text), @@ -1232,7 +1232,7 @@ gboolean textview_search_string_backward(TextView *textview, const gchar *str, void textview_scroll_one_line(TextView *textview, gboolean up) { - GtkText *text = GTK_TEXT(textview->text); + GtkSText *text = GTK_STEXT(textview->text); gfloat upper; if (prefs_common.enable_smooth_scroll) { @@ -1264,7 +1264,7 @@ void textview_scroll_one_line(TextView *textview, gboolean up) gboolean textview_scroll_page(TextView *textview, gboolean up) { - GtkText *text = GTK_TEXT(textview->text); + GtkSText *text = GTK_STEXT(textview->text); gfloat upper; gfloat page_incr; @@ -1302,7 +1302,7 @@ static void textview_smooth_scroll_do(TextView *textview, gfloat old_value, gfloat last_value, gint step) { - GtkText *text = GTK_TEXT(textview->text); + GtkSText *text = GTK_STEXT(textview->text); gint change_value; gboolean up; gint i; @@ -1331,7 +1331,7 @@ static void textview_smooth_scroll_do(TextView *textview, static void textview_smooth_scroll_one_line(TextView *textview, gboolean up) { - GtkText *text = GTK_TEXT(textview->text); + GtkSText *text = GTK_STEXT(textview->text); gfloat upper; gfloat old_value; gfloat last_value; @@ -1364,7 +1364,7 @@ static void textview_smooth_scroll_one_line(TextView *textview, gboolean up) static gboolean textview_smooth_scroll_page(TextView *textview, gboolean up) { - GtkText *text = GTK_TEXT(textview->text); + GtkSText *text = GTK_STEXT(textview->text); gfloat upper; gfloat page_incr; gfloat old_value; diff --git a/src/textview.h b/src/textview.h index dca4d8587..992a3e7d1 100644 --- a/src/textview.h +++ b/src/textview.h @@ -42,6 +42,9 @@ struct _TextView GtkWidget *text_sb; GtkWidget *text_mb; + GtkWidget *popup_menu; + GtkItemFactory *popup_factory; + gboolean text_is_mb; GSList *uri_list; diff --git a/src/undo.c b/src/undo.c index ae76041eb..337d9e103 100644 --- a/src/undo.c +++ b/src/undo.c @@ -25,12 +25,12 @@ #endif #include -#include "gtkstext.h" #include /* for strlen */ #include /* for mbstowcs */ #include "undo.h" +#include "gtkstext.h" #include "utils.h" #include "prefs_common.h" @@ -78,7 +78,7 @@ void undo_undo (UndoMain *undostruct); void undo_redo (UndoMain *undostruct); -UndoMain *undo_init (GtkWidget *text) +UndoMain *undo_init(GtkWidget *text) { UndoMain *undostruct; -- 2.25.1