changed get_abbrev_newsgroup_name() that it shortens ng names only so long the name...
authorMartin Schaaf <mascha@ma-scha.de>
Wed, 23 Oct 2002 07:44:28 +0000 (07:44 +0000)
committerMartin Schaaf <mascha@ma-scha.de>
Wed, 23 Oct 2002 07:44:28 +0000 (07:44 +0000)
ChangeLog.claws
configure.in
src/folderview.c
src/summaryview.c
src/utils.c
src/utils.h

index 44d471b..75e73f4 100644 (file)
@@ -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
index f1375e7..8429da1 100644 (file)
@@ -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
index 7575655..804565e 100644 (file)
@@ -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);
                }
index 01ca286..f44746c 100644 (file)
@@ -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 {
index ff10b1d..86cf395 100644 (file)
@@ -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';
index 0383a78..387e26a 100644 (file)
@@ -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);