* src/summaryview.c
authorAlfons Hoogervorst <alfons@proteus.demon.nl>
Sun, 25 Aug 2002 11:01:36 +0000 (11:01 +0000)
committerAlfons Hoogervorst <alfons@proteus.demon.nl>
Sun, 25 Aug 2002 11:01:36 +0000 (11:01 +0000)
treat sent boxes as special and allow sorting them by addressee
(closes "[ 589418 ] Sent folder sorting misbehavior"
submitted by Steve Lamb)

ChangeLog.claws
configure.in
src/summaryview.c

index 0d2c186b55c01b47428235ce6869e774de93a234..ab60edc33e59febb9652aa04272bfbcc27520084 100644 (file)
@@ -1,3 +1,10 @@
+2002-08-25 [alfons]    0.8.2claws117
+
+       * src/summaryview.c
+               treat sent boxes as special and allow sorting them by addressee
+               (closes "[ 589418 ] Sent folder sorting misbehavior"
+               submitted by Steve Lamb)
+
 2002-08-24 [alfons]    0.8.2claws116
 
        * src/matcher.c
index a622f923e51eeb2a956e389ed41147331ef2b8f8..bd2d17fc44a127fd387942effe7c580d4be7b7f0 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=8
 MICRO_VERSION=1
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws116
+EXTRA_VERSION=claws117
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index 51e8c265dab8b724dd54b3ce8894abab43f23f31..68d32a54208ddbc17dfabb13baf9b6fed3ff016a 100644 (file)
@@ -356,6 +356,9 @@ static gint summary_cmp_by_date             (GtkCList               *clist,
 static gint summary_cmp_by_from                (GtkCList               *clist,
                                         gconstpointer           ptr1,
                                         gconstpointer           ptr2);
+static gint summary_cmp_by_to          (GtkCList               *clist,
+                                        gconstpointer           ptr1, 
+                                        gconstpointer           ptr2);
 static gint summary_cmp_by_subject     (GtkCList               *clist,
                                         gconstpointer           ptr1,
                                         gconstpointer           ptr2);
@@ -1970,7 +1973,9 @@ void summary_sort(SummaryView *summaryview,
                cmp_func = (GtkCListCompareFunc)summary_cmp_by_date;
                break;
        case SORT_BY_FROM:
-               cmp_func = (GtkCListCompareFunc)summary_cmp_by_from;
+               cmp_func = summaryview->folder_item->stype != F_OUTBOX ? 
+                       (GtkCListCompareFunc) summary_cmp_by_from :
+                       (GtkCListCompareFunc) summary_cmp_by_to;
                break;
        case SORT_BY_SUBJECT:
                if (summaryview->simplify_subject_preg)
@@ -4824,6 +4829,33 @@ static gint summary_cmp_by_from(GtkCList *clist,
        return strcasecmp(msginfo1->fromname, msginfo2->fromname);
 }
 
+static gint summary_cmp_by_to(GtkCList *clist,
+                             gconstpointer ptr1, gconstpointer ptr2)
+{
+       const gchar *str1, *str2;
+       const GtkCListRow *r1 = (const GtkCListRow *) ptr1;
+       const GtkCListRow *r2 = (const GtkCListRow *) ptr2;
+       const SummaryView *sv = gtk_object_get_data(GTK_OBJECT(clist), "summaryview");
+       
+       g_return_val_if_fail(sv, -1);
+       
+       str1 = GTK_CELL_TEXT(r1->cell[sv->col_pos[S_COL_FROM]])->text;
+       str2 = GTK_CELL_TEXT(r2->cell[sv->col_pos[S_COL_FROM]])->text;
+
+       if (!str1)
+               return str2 != NULL;
+
+       if (!str2)
+               return -1;
+
+       if (g_strncasecmp(str1, "-->", 3) == 0)
+               str1 += 3;
+       if (g_strncasecmp(str2, "-->", 3) == 0)
+               str2 += 3;
+
+       return strcasecmp(str1, str2);
+}
+
 static gint summary_cmp_by_subject(GtkCList *clist,
                               gconstpointer ptr1, gconstpointer ptr2)
 {