From 5d4cb83ea030f5f30673df7bf466051425eef443 Mon Sep 17 00:00:00 2001 From: Martin Schaaf Date: Wed, 23 Oct 2002 07:44:28 +0000 Subject: [PATCH] changed get_abbrev_newsgroup_name() that it shortens ng names only so long the name is shorter than the length param --- ChangeLog.claws | 11 +++++++++++ configure.in | 2 +- src/folderview.c | 2 +- src/summaryview.c | 2 +- src/utils.c | 9 ++++++--- src/utils.h | 4 +++- 6 files changed, 23 insertions(+), 7 deletions(-) diff --git a/ChangeLog.claws b/ChangeLog.claws index 44d471be5..75e73f49b 100644 --- a/ChangeLog.claws +++ b/ChangeLog.claws @@ -1,3 +1,14 @@ +2002-10-23 [martin] 0.8.5claws50 + + * src/folderview.c + * src/summaryview.c + * src/utils.h + * src/utils.c + added length parameter to get_abbrev_newsgroup_name() + changed this function so that it abbreviates the newsgroup + names only so long it is smaller than the length parameter + (for better reading of some newsgroup names and space efficiency) + 2002-10-22 [colin] 0.8.5claws49 *src/foldersel.c diff --git a/configure.in b/configure.in index f1375e798..8429da1bb 100644 --- a/configure.in +++ b/configure.in @@ -11,7 +11,7 @@ MINOR_VERSION=8 MICRO_VERSION=5 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=claws49 +EXTRA_VERSION=claws50 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION dnl set $target diff --git a/src/folderview.c b/src/folderview.c index 7575655bc..804565e49 100644 --- a/src/folderview.c +++ b/src/folderview.c @@ -1126,7 +1126,7 @@ static void folderview_update_node(FolderView *folderview, GtkCTreeNode *node) item->path && !strcmp2(item->name, item->path) && prefs_common.ng_abbrev_len < strlen(item->path)) - name = get_abbrev_newsgroup_name(item->path); + name = get_abbrev_newsgroup_name(item->path, prefs_common.ng_abbrev_len); else name = g_strdup(item->name); } diff --git a/src/summaryview.c b/src/summaryview.c index 01ca28618..f44746cc0 100644 --- a/src/summaryview.c +++ b/src/summaryview.c @@ -1795,7 +1795,7 @@ static void summary_status_show(SummaryView *summaryview) prefs_common.ng_abbrev_len < strlen(summaryview->folder_item->path)) { gchar *group; group = get_abbrev_newsgroup_name - (g_basename(summaryview->folder_item->path)); + (g_basename(summaryview->folder_item->path), prefs_common.ng_abbrev_len); gtk_label_set(GTK_LABEL(summaryview->statlabel_folder), group); g_free(group); } else { diff --git a/src/utils.c b/src/utils.c index ff10b1d11..86cf39597 100644 --- a/src/utils.c +++ b/src/utils.c @@ -1249,24 +1249,27 @@ gchar **strsplit_with_quote(const gchar *str, const gchar *delim, return str_array; } -gchar *get_abbrev_newsgroup_name(const gchar *group) +gchar *get_abbrev_newsgroup_name(const gchar *group, gint len) { gchar *abbrev_group; gchar *ap; const gchar *p = group; + gint count = 0; abbrev_group = ap = g_malloc(strlen(group) + 1); while (*p) { while (*p == '.') *ap++ = *p++; - if (strchr(p, '.')) { + + if ((strlen( p) + count) > len && strchr(p, '.')) { *ap++ = *p++; while (*p != '.') p++; } else { - strcpy(ap, p); + strcpy( ap, p); return abbrev_group; } + count = count + 2; } *ap = '\0'; diff --git a/src/utils.h b/src/utils.h index 0383a780a..387e26af5 100644 --- a/src/utils.h +++ b/src/utils.h @@ -285,7 +285,9 @@ gchar **strsplit_with_quote (const gchar *str, const gchar *delim, gint max_tokens); -gchar *get_abbrev_newsgroup_name (const gchar *group); +gchar *get_abbrev_newsgroup_name (const gchar *group, + gint len); + gchar *trim_string (const gchar *str, gint len); -- 2.25.1