From 70c59eedb833a89084ec6f30e977834ae74e03a4 Mon Sep 17 00:00:00 2001 From: Paul Mangan Date: Fri, 10 May 2002 07:32:09 +0000 Subject: [PATCH 1/1] sync with 0.7.5cvs16 --- ChangeLog | 10 ++++++ ChangeLog.claws | 6 ++++ ChangeLog.jp | 10 ++++++ configure.in | 2 +- src/folderview.c | 4 ++- src/imap.c | 77 ++++++++++++++++++++++++++-------------------- src/prefs_common.c | 44 +++++++++++++++++++++++--- src/prefs_common.h | 1 + src/summaryview.c | 3 +- 9 files changed, 116 insertions(+), 41 deletions(-) diff --git a/ChangeLog b/ChangeLog index 46ba9ba6a..ea0bab58f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,17 @@ +2002-05-10 + + * src/folderview.c + src/prefs_common.[ch] + src/summaryview.c: added an option to specify the minimum length + for abbreviated newsgroups name. + 2002-05-09 * src/folderview.c: folderview_check_new(): skip unselectable folders. * src/summaryview.c: added 'Create filter rule' to the context menu. + * src/imap.c: some code cleanups. + imap_scan_tree_recursive(): get path separator for each calls. + imap_get_path_separator(): new. 2002-05-08 diff --git a/ChangeLog.claws b/ChangeLog.claws index 8589de70e..4af3f3446 100644 --- a/ChangeLog.claws +++ b/ChangeLog.claws @@ -1,3 +1,9 @@ +2002-05-10 [paul] 0.7.5claws16 + + * sync with 0.7.5cvs16 + see ChangeLog entries 2002-05-09 and + 2002-05-10 + 2002-05-10 [colin] 0.7.5claws15 * src/textview.c diff --git a/ChangeLog.jp b/ChangeLog.jp index 1d58394d4..d32ddd425 100644 --- a/ChangeLog.jp +++ b/ChangeLog.jp @@ -1,9 +1,19 @@ +2002-05-10 + + * src/folderview.c + src/prefs_common.[ch] + src/summaryview.c: ¥Ë¥å¡¼¥¹¥°¥ë¡¼¥×̾¤ò´Êάɽ¼¨¤¹¤ëºÇ¾®¤Îʸ»ú¿ô + ¤ò»ØÄꤹ¤ë¥ª¥×¥·¥ç¥ó¤òÄɲᣠ+ 2002-05-09 * src/folderview.c: folderview_check_new(): ÁªÂò¤Ç¤­¤Ê¤¤¥Õ¥©¥ë¥À¤ò ¥¹¥­¥Ã¥×¡£ * src/summaryview.c: ¥³¥ó¥Æ¥­¥¹¥È¥á¥Ë¥å¡¼¤Ë¡Ö¿¶¤êʬ¤±¥ë¡¼¥ë¤òºîÀ®¡× ¤òÄɲᣠ+ * src/imap.c: ¥³¡¼¥É¤ÎÀ°Íý¡£ + imap_scan_tree_recursive(): ³Æ¸Æ¤Ó½Ð¤·»þ¤Ë¥Ñ¥¹¶èÀÚ¤ê¤ò¼èÆÀ¡£ + imap_get_path_separator(): ¿·µ¬¡£ 2002-05-08 diff --git a/configure.in b/configure.in index 9f6efcc24..d69f27808 100644 --- a/configure.in +++ b/configure.in @@ -8,7 +8,7 @@ MINOR_VERSION=7 MICRO_VERSION=5 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=claws15 +EXTRA_VERSION=claws16 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION dnl set $target diff --git a/src/folderview.c b/src/folderview.c index f2aa44bd1..0e564152a 100644 --- a/src/folderview.c +++ b/src/folderview.c @@ -1087,7 +1087,9 @@ static void folderview_update_node(FolderView *folderview, GtkCTreeNode *node) name = g_strconcat(item->name, name, NULL); } else { if (item->folder->type == F_NEWS && - !strcmp2(item->name, item->path)) + item->path && + !strcmp2(item->name, item->path) && + prefs_common.ng_abbrev_len < strlen(item->path)) name = get_abbrev_newsgroup_name(item->path); else name = g_strdup(item->name); diff --git a/src/imap.c b/src/imap.c index 4ff4d074a..835e66c03 100644 --- a/src/imap.c +++ b/src/imap.c @@ -80,8 +80,7 @@ static void imap_folder_init (Folder *folder, static IMAPSession *imap_session_get (Folder *folder); static gint imap_scan_tree_recursive (IMAPSession *session, - FolderItem *item, - IMAPNameSpace *namespace); + FolderItem *item); static GSList *imap_parse_list (IMAPSession *session, const gchar *real_path); @@ -152,6 +151,8 @@ static void imap_parse_namespace (IMAPSession *session, IMAPFolder *folder); static IMAPNameSpace *imap_find_namespace (IMAPFolder *folder, const gchar *path); +static gchar imap_get_path_separator (IMAPFolder *folder, + const gchar *path); static gchar *imap_get_real_path (IMAPFolder *folder, const gchar *path); @@ -268,6 +269,7 @@ static gchar *imap_locale_to_modified_utf7 (const gchar *from); static gboolean imap_rename_folder_func (GNode *node, gpointer data); + Folder *imap_folder_new(const gchar *name, const gchar *path) { Folder *folder; @@ -974,7 +976,6 @@ void imap_scan_tree(Folder *folder) IMAPFolder *imapfolder = IMAP_FOLDER(folder); FolderItem *item; IMAPSession *session; - IMAPNameSpace *namespace = NULL; gchar *root_folder = NULL; g_return_if_fail(folder != NULL); @@ -983,13 +984,15 @@ void imap_scan_tree(Folder *folder) session = imap_session_get(folder); if (!session) return; - if (imapfolder->ns_personal && imapfolder->ns_personal->data) - namespace = (IMAPNameSpace *)imapfolder->ns_personal->data; - if (folder->account->imap_dir && *folder->account->imap_dir) { gchar *imap_dir; + IMAPNameSpace *namespace = NULL; + Xstrdup_a(imap_dir, folder->account->imap_dir, return); strtailchomp(imap_dir, '/'); + + if (imapfolder->ns_personal && imapfolder->ns_personal->data) + namespace = (IMAPNameSpace *)imapfolder->ns_personal->data; root_folder = g_strconcat (namespace && namespace->name ? namespace->name : "", imap_dir, NULL); @@ -1006,13 +1009,12 @@ void imap_scan_tree(Folder *folder) folder->node = g_node_new(item); g_free(root_folder); - imap_scan_tree_recursive(session, item, namespace); + imap_scan_tree_recursive(session, item); imap_create_missing_folders(folder); } -static gint imap_scan_tree_recursive(IMAPSession *session, FolderItem *item, - IMAPNameSpace *namespace) +static gint imap_scan_tree_recursive(IMAPSession *session, FolderItem *item) { Folder *folder; IMAPFolder *imapfolder; @@ -1020,7 +1022,7 @@ static gint imap_scan_tree_recursive(IMAPSession *session, FolderItem *item, GSList *item_list, *cur; gchar *real_path; gchar *wildcard_path; - gchar separator = '/'; + gchar separator; gchar wildcard[3]; g_return_val_if_fail(item != NULL, -1); @@ -1030,8 +1032,7 @@ static gint imap_scan_tree_recursive(IMAPSession *session, FolderItem *item, folder = FOLDER(item->folder); imapfolder = IMAP_FOLDER(folder); - if (namespace && namespace->separator) - separator = namespace->separator; + separator = imap_get_path_separator(imapfolder, item->path); if (item->folder->ui_func) item->folder->ui_func(folder, item, folder->ui_func_data); @@ -1044,9 +1045,7 @@ static gint imap_scan_tree_recursive(IMAPSession *session, FolderItem *item, } else { wildcard[0] = '%'; wildcard[1] = '\0'; - real_path = g_strdup(namespace && namespace->name && - strncmp(namespace->name, "INBOX", 5) != 0 - ? namespace->name : ""); + real_path = g_strdup(""); } Xstrcat_a(wildcard_path, real_path, wildcard, @@ -1093,7 +1092,7 @@ static gint imap_scan_tree_recursive(IMAPSession *session, FolderItem *item, if (new_item->no_select == FALSE) imap_scan_folder(folder, new_item); if (new_item->no_sub == FALSE) - imap_scan_tree_recursive(session, new_item, namespace); + imap_scan_tree_recursive(session, new_item); } return IMAP_SUCCESS; @@ -1255,8 +1254,8 @@ FolderItem *imap_create_folder(Folder *folder, FolderItem *parent, { gchar *dirpath, *imap_path; IMAPSession *session; - IMAPNameSpace *namespace; FolderItem *new_item; + gchar separator; gchar *new_name; const gchar *p; gint ok; @@ -1288,11 +1287,9 @@ FolderItem *imap_create_folder(Folder *folder, FolderItem *parent, imap_path = imap_locale_to_modified_utf7(dirpath); Xstrdup_a(new_name, name, {g_free(dirpath); return NULL;}); strtailchomp(new_name, '/'); - namespace = imap_find_namespace(IMAP_FOLDER(folder), imap_path); - if (namespace && namespace->separator) { - imap_path_separator_subst(imap_path, namespace->separator); - subst_char(new_name, '/', namespace->separator); - } + separator = imap_get_path_separator(IMAP_FOLDER(folder), imap_path); + imap_path_separator_subst(imap_path, separator); + subst_char(new_name, '/', separator); if (strcmp(name, "INBOX") != 0) { GPtrArray *argbuf; @@ -1357,7 +1354,7 @@ gint imap_rename_folder(Folder *folder, FolderItem *item, const gchar *name) gchar *old_cache_dir; gchar *new_cache_dir; IMAPSession *session; - IMAPNameSpace *namespace; + gchar separator; gint ok; gint exists, recent, unseen; guint32 uid_validity; @@ -1382,7 +1379,7 @@ gint imap_rename_folder(Folder *folder, FolderItem *item, const gchar *name) return -1; } - namespace = imap_find_namespace(IMAP_FOLDER(folder), item->path); + separator = imap_get_path_separator(IMAP_FOLDER(folder), item->path); if (strchr(item->path, G_DIR_SEPARATOR)) { dirpath = g_dirname(item->path); newpath = g_strconcat(dirpath, G_DIR_SEPARATOR_S, name, NULL); @@ -1391,8 +1388,7 @@ gint imap_rename_folder(Folder *folder, FolderItem *item, const gchar *name) newpath = g_strdup(name); real_newpath = imap_locale_to_modified_utf7(newpath); - if (namespace && namespace->separator) - imap_path_separator_subst(real_newpath, namespace->separator); + imap_path_separator_subst(real_newpath, separator); ok = imap_cmd_rename(SESSION(session)->sock, real_oldpath, real_newpath); statusbar_pop_all(); @@ -1744,9 +1740,11 @@ static IMAPNameSpace *imap_find_namespace_from_list(GList *ns_list, const gchar *path) { IMAPNameSpace *namespace = NULL; - gchar *name; + gchar *tmp_path, *name; - g_return_val_if_fail(path != NULL, NULL); + if (!path) path = ""; + + Xstrcat_a(tmp_path, path, "/", return NULL); for (; ns_list != NULL; ns_list = ns_list->next) { IMAPNameSpace *tmp_ns = ns_list->data; @@ -1754,7 +1752,7 @@ static IMAPNameSpace *imap_find_namespace_from_list(GList *ns_list, Xstrdup_a(name, tmp_ns->name, return namespace); if (tmp_ns->separator && tmp_ns->separator != '/') subst_char(name, tmp_ns->separator, '/'); - if (strncmp(path, name, strlen(name)) == 0) + if (strncmp(tmp_path, name, strlen(name)) == 0) namespace = tmp_ns; } @@ -1766,6 +1764,8 @@ static IMAPNameSpace *imap_find_namespace(IMAPFolder *folder, { IMAPNameSpace *namespace; + g_return_val_if_fail(folder != NULL, NULL); + namespace = imap_find_namespace_from_list(folder->ns_personal, path); if (namespace) return namespace; namespace = imap_find_namespace_from_list(folder->ns_others, path); @@ -1776,18 +1776,29 @@ static IMAPNameSpace *imap_find_namespace(IMAPFolder *folder, return NULL; } +static gchar imap_get_path_separator(IMAPFolder *folder, const gchar *path) +{ + IMAPNameSpace *namespace; + gchar separator = '/'; + + namespace = imap_find_namespace(folder, path); + if (namespace && namespace->separator) + separator = namespace->separator; + + return separator; +} + static gchar *imap_get_real_path(IMAPFolder *folder, const gchar *path) { gchar *real_path; - IMAPNameSpace *namespace; + gchar separator; g_return_val_if_fail(folder != NULL, NULL); g_return_val_if_fail(path != NULL, NULL); real_path = imap_locale_to_modified_utf7(path); - namespace = imap_find_namespace(folder, path); - if (namespace && namespace->separator) - imap_path_separator_subst(real_path, namespace->separator); + separator = imap_get_path_separator(folder, path); + imap_path_separator_subst(real_path, separator); return real_path; } diff --git a/src/prefs_common.c b/src/prefs_common.c index d8c270eed..471648687 100644 --- a/src/prefs_common.c +++ b/src/prefs_common.c @@ -165,6 +165,9 @@ static struct Display { GtkWidget *chkbtn_folder_unread; GtkWidget *chkbtn_display_img; + GtkWidget *entry_ng_abbrev_len; + GtkWidget *spinbtn_ng_abbrev_len; + GtkObject *spinbtn_ng_abbrev_len_adj; GtkWidget *chkbtn_transhdr; @@ -173,7 +176,6 @@ static struct Display { GtkWidget *chkbtn_useaddrbook; GtkWidget *chkbtn_expand_thread; GtkWidget *chkbtn_bold_unread; - GtkWidget *entry_datefmt; } display; @@ -472,6 +474,10 @@ static PrefParam param[] = { &prefs_common.display_img, P_BOOL, &display.chkbtn_display_img, prefs_set_data_from_toggle, prefs_set_toggle}, + {"newsgroup_abbrev_len", "16", + &prefs_common.ng_abbrev_len, P_INT, + &display.spinbtn_ng_abbrev_len, + prefs_set_data_from_spinbtn, prefs_set_spinbtn}, {"translate_header", "TRUE", &prefs_common.trans_hdr, P_BOOL, &display.chkbtn_transhdr, @@ -2049,9 +2055,13 @@ static void prefs_display_create(void) GtkWidget *label_textfont; GtkWidget *entry_textfont; GtkWidget *button_textfont; - GtkWidget *chkbtn_folder_unread; GtkWidget *chkbtn_display_img; GtkWidget *chkbtn_transhdr; + GtkWidget *chkbtn_folder_unread; + GtkWidget *hbox1; + GtkWidget *label_ng_abbrev; + GtkWidget *spinbtn_ng_abbrev_len; + GtkObject *spinbtn_ng_abbrev_len_adj; GtkWidget *frame_summary; GtkWidget *vbox2; GtkWidget *chkbtn_swapfrom; @@ -2060,7 +2070,6 @@ static void prefs_display_create(void) GtkWidget *chkbtn_expand_thread; GtkWidget *chkbtn_bold_unread; GtkWidget *vbox3; - GtkWidget *hbox1; GtkWidget *label_datefmt; GtkWidget *button_datefmt; GtkWidget *entry_datefmt; @@ -2171,6 +2180,29 @@ static void prefs_display_create(void) PACK_CHECK_BUTTON (vbox2, chkbtn_display_img, _("Automatically display images")); + hbox1 = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox1); + gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, TRUE, 0); + + label_ng_abbrev = gtk_label_new + (_("Abbreviate newsgroups longer than")); + gtk_widget_show (label_ng_abbrev); + gtk_box_pack_start (GTK_BOX (hbox1), label_ng_abbrev, FALSE, FALSE, 0); + + spinbtn_ng_abbrev_len_adj = gtk_adjustment_new (16, 0, 999, 1, 10, 10); + spinbtn_ng_abbrev_len = gtk_spin_button_new + (GTK_ADJUSTMENT (spinbtn_ng_abbrev_len_adj), 1, 0); + gtk_widget_show (spinbtn_ng_abbrev_len); + gtk_box_pack_start (GTK_BOX (hbox1), spinbtn_ng_abbrev_len, + FALSE, FALSE, 0); + gtk_widget_set_usize (spinbtn_ng_abbrev_len, 56, -1); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_ng_abbrev_len), + TRUE); + + label_ng_abbrev = gtk_label_new + (_("letters")); + gtk_widget_show (label_ng_abbrev); + gtk_box_pack_start (GTK_BOX (hbox1), label_ng_abbrev, FALSE, FALSE, 0); /* ---- Summary ---- */ @@ -2233,9 +2265,11 @@ static void prefs_display_create(void) display.entry_textfont = entry_textfont; display.button_textfont = button_textfont; - display.chkbtn_folder_unread = chkbtn_folder_unread; display.chkbtn_display_img = chkbtn_display_img; - display.chkbtn_transhdr = chkbtn_transhdr; + display.chkbtn_transhdr = chkbtn_transhdr; + display.chkbtn_folder_unread = chkbtn_folder_unread; + display.spinbtn_ng_abbrev_len = spinbtn_ng_abbrev_len; + display.spinbtn_ng_abbrev_len_adj = spinbtn_ng_abbrev_len_adj; display.chkbtn_swapfrom = chkbtn_swapfrom; display.chkbtn_hscrollbar = chkbtn_hscrollbar; diff --git a/src/prefs_common.h b/src/prefs_common.h index d823de4eb..4d07b357c 100644 --- a/src/prefs_common.h +++ b/src/prefs_common.h @@ -114,6 +114,7 @@ struct _PrefsCommon gchar *smallfont; gboolean display_folder_unread; gboolean display_img; + gint ng_abbrev_len; ToolbarStyle toolbar_style; gboolean show_statusbar; gboolean trans_hdr; diff --git a/src/summaryview.c b/src/summaryview.c index 793d28dd4..88552f2b2 100644 --- a/src/summaryview.c +++ b/src/summaryview.c @@ -1709,7 +1709,8 @@ static void summary_status_show(SummaryView *summaryview) n_selected++; } - if (summaryview->folder_item->folder->type == F_NEWS) { + if (summaryview->folder_item->folder->type == F_NEWS && + prefs_common.ng_abbrev_len < strlen(summaryview->folder_item->path)) { gchar *group; group = get_abbrev_newsgroup_name (g_basename(summaryview->folder_item->path)); -- 2.25.1