sort correctly when using simplified subject line
authorAlfons Hoogervorst <alfons@proteus.demon.nl>
Wed, 24 Jul 2002 19:48:55 +0000 (19:48 +0000)
committerAlfons Hoogervorst <alfons@proteus.demon.nl>
Wed, 24 Jul 2002 19:48:55 +0000 (19:48 +0000)
(closes feature request "[ 585141 ] applying regexp to subject
before sort" submitted by Alexandra Walford)

ChangeLog.claws
configure.in
src/summaryview.c

index 77dbf2d..2f0bacd 100644 (file)
@@ -1,3 +1,10 @@
+2002-07-24 [alfons]    0.8.0claws8
+
+       * src/summaryview.c
+               sort correctly when using simplified subject line
+               (closes feature request "[ 585141 ] applying regexp to subject 
+               before sort" submitted by Alexandra Walford)
+
 2002-07-24 [paul]      0.8.0claws7
 
        * sync with 0.8.0cvs3
@@ -23,7 +30,7 @@
                o don't set ignore thread flag in procmsg_get_thread_tree
                  if it is already set
        * src/mainwindow.c
-       * src/statusbar.h
+       * src/shttps://sourceforge.net/account/login.phptatusbar.h
                o moved STATUSBAR_PUSH/POP to statusbar.h because
                  they are used in different files
 
index 69033eb..054d1ac 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=8
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws7
+EXTRA_VERSION=claws8
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index 6e5e7be..488de62 100644 (file)
@@ -354,6 +354,8 @@ static gint summary_cmp_by_from             (GtkCList               *clist,
 static gint summary_cmp_by_subject     (GtkCList               *clist,
                                         gconstpointer           ptr1,
                                         gconstpointer           ptr2);
+static gint summary_cmp_by_simplified_subject
+       (GtkCList *clist, gconstpointer ptr1, gconstpointer ptr2);
 static gint summary_cmp_by_score       (GtkCList               *clist,
                                         gconstpointer           ptr1,
                                         gconstpointer           ptr2);
@@ -524,6 +526,10 @@ SummaryView *summary_create(void)
        summaryview->popupfactory = popupfactory;
        summaryview->lock_count = 0;
 
+       /* CLAWS: need this to get the SummaryView * from
+        * the CList */
+       gtk_object_set_data(GTK_OBJECT(ctree), "summaryview", (gpointer)summaryview); 
+
        gtk_widget_show_all(vbox);
 
        return summaryview;
@@ -1856,7 +1862,14 @@ void summary_sort(SummaryView *summaryview,
                cmp_func = (GtkCListCompareFunc)summary_cmp_by_from;
                break;
        case SORT_BY_SUBJECT:
-               cmp_func = (GtkCListCompareFunc)summary_cmp_by_subject;
+               {
+                       PrefsFolderItem *prefs = summaryview->folder_item->prefs;
+
+                       if (prefs == NULL) 
+                               cmp_func = (GtkCListCompareFunc)summary_cmp_by_subject;
+                       else
+                               cmp_func = (GtkCListCompareFunc)summary_cmp_by_simplified_subject;
+               }                               
                break;
        case SORT_BY_SCORE:
                cmp_func = (GtkCListCompareFunc)summary_cmp_by_score;
@@ -4699,6 +4712,38 @@ static gint summary_cmp_by_subject(GtkCList *clist,
        return strcasecmp(msginfo1->subject, msginfo2->subject);
 }
 
+static gint summary_cmp_by_simplified_subject
+       (GtkCList *clist, gconstpointer ptr1, gconstpointer ptr2)
+{
+       const PrefsFolderItem *prefs;
+       const gchar *str1, *str2;
+       const GtkCListRow *r1 = (const GtkCListRow *) ptr1;
+       const GtkCListRow *r2 = (const GtkCListRow *) ptr2;
+       const MsgInfo *msginfo1 = r1->data;
+       const MsgInfo *msginfo2 = r2->data;
+       const SummaryView *sv = gtk_object_get_data(GTK_OBJECT(clist), "summaryview");
+       
+       g_return_val_if_fail(sv, -1);
+       g_return_val_if_fail(msginfo1 == NULL || msginfo2 == NULL, -1);
+       
+       str1 = GTK_CELL_TEXT(r1->cell[sv->col_pos[S_COL_SUBJECT]])->text;
+       str2 = GTK_CELL_TEXT(r2->cell[sv->col_pos[S_COL_SUBJECT]])->text;
+
+       if (!str1)
+               return str2 != NULL;
+
+       if (!str2)
+               return -1;
+
+       prefs = msginfo1->folder->prefs;
+       if (!prefs)
+               prefs = msginfo2->folder->prefs;
+       if (!prefs)
+               return -1;
+       
+       return strcasecmp(str1, str2);
+}
+
 static gint summary_cmp_by_label(GtkCList *clist,
                                 gconstpointer ptr1, gconstpointer ptr2)
 {