2006-03-19 [colin] 2.0.0cvs157
authorColin Leroy <colin@colino.net>
Sun, 19 Mar 2006 10:31:30 +0000 (10:31 +0000)
committerColin Leroy <colin@colino.net>
Sun, 19 Mar 2006 10:31:30 +0000 (10:31 +0000)
* src/addressbook.c
Order groups before names, as previously

ChangeLog
PATCHSETS
configure.ac
src/addressbook.c

index 7cec1cb..ab82f4b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-03-19 [colin]     2.0.0cvs157
+
+       * src/addressbook.c
+               Order groups before names, as previously
+
 2006-03-19 [colin]     2.0.0cvs156
 
        * src/addressbook.c
index 2f354c4..7221fde 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.96.2.103 -r 1.96.2.104 src/textview.c;  ) > 2.0.0cvs154.patchset
 ( cvs diff -u -r 1.60.2.50 -r 1.60.2.51 src/addressbook.c;  ) > 2.0.0cvs155.patchset
 ( cvs diff -u -r 1.60.2.51 -r 1.60.2.52 src/addressbook.c;  ) > 2.0.0cvs156.patchset
+( cvs diff -u -r 1.60.2.52 -r 1.60.2.53 src/addressbook.c;  ) > 2.0.0cvs157.patchset
index de106a2..8bab5c0 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=0
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=156
+EXTRA_VERSION=157
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 159072f..60f2af4 100644 (file)
@@ -682,18 +682,34 @@ static void addressbook_size_allocate_cb(GtkWidget *widget,
        prefs_common.addressbookwin_height = allocation->height;
 }
 
+static gint sort_column_number = 0;
+
 static gint list_case_sort(
        GtkCList *clist, gconstpointer ptr1, gconstpointer ptr2 )
 {
-       GtkCell *cell1 = ((GtkCListRow *)ptr1)->cell;
-       GtkCell *cell2 = ((GtkCListRow *)ptr2)->cell;
+       GtkCListRow *row1 = (GtkCListRow *) ptr1;
+       GtkCListRow *row2 = (GtkCListRow *) ptr2;
        gchar *name1 = NULL, *name2 = NULL;
-
-       if( cell1 ) name1 = cell1->u.text;
-       if( cell2 ) name2 = cell2->u.text;
-       if( ! name1 ) return ( name2 != NULL );
-       if( ! name2 ) return -1;
-       return strcasecmp( name1, name2 );
+       AddrItemObject *aio1 = ((GtkCListRow *)ptr1)->data;
+       AddrItemObject *aio2 = ((GtkCListRow *)ptr2)->data;
+
+       if( aio1->type == aio2->type ) {
+               if( row1 ) 
+                       name1 = GTK_CELL_TEXT (row1->cell[sort_column_number])->text;
+               if( row2 ) 
+                       name2 = GTK_CELL_TEXT (row2->cell[sort_column_number])->text;
+               if( ! name1 ) return ( name2 != NULL );
+               if( ! name2 ) return -1;
+               return strcasecmp( name1, name2 );
+       } else {
+               /* Order groups before person */
+               if( aio1->type == ITEMTYPE_GROUP ) {
+                       return -1;
+               } else if( aio2->type == ITEMTYPE_GROUP ) {
+                       return 1;
+               }
+               return 0;
+       }
 }
 
 static void addressbook_sort_list(GtkCList *clist, const gint col,
@@ -702,6 +718,7 @@ static void addressbook_sort_list(GtkCList *clist, const gint col,
        gint pos;
        GtkWidget *hbox, *label, *arrow;
 
+       sort_column_number = col;
        gtk_clist_set_compare_func(clist, list_case_sort);
        gtk_clist_set_sort_type(clist, sort_type);
        gtk_clist_set_sort_column(clist, col);