-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jens Luedicke wrote:
> Hi...
> 
> attached is a patch to make Thunar sub-sort on the filename if
> both compare values are equal.
> 

alternative patch attached

jens

- --
Jens Luedicke
web: http://perldude.de

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFC7oUAiCvkc4H0gTERAr78AKCp4/O6z5A9d3A7kskfwgw6Me+vTgCdF0Tg
xcwLElAgGnPN6hgb8qKVqY4=
=OwrN
-----END PGP SIGNATURE-----
Index: thunar-list-model.c
===================================================================
--- thunar-list-model.c (revision 16427)
+++ thunar-list-model.c (working copy)
@@ -1307,7 +1307,8 @@
   ThunarVfsFileTime date_b;
   gboolean          can_a;
   gboolean          can_b;
-
+  gint result;
+  
   can_a = thunar_file_get_date (a, THUNAR_FILE_DATE_ACCESSED, &date_a);
   can_b = thunar_file_get_date (b, THUNAR_FILE_DATE_ACCESSED, &date_b);
 
@@ -1318,11 +1319,12 @@
   else if (G_UNLIKELY (!can_b))
     return 1;
 
-  if (date_a < date_b)
-    return -1;
-  else if (date_a > date_b)
-    return 1;
-  return 0;
+  result = date_a - date_b;
+
+  if (result == 0)
+    return sort_by_name(a,b);
+  
+  return result;
 }
 
 
@@ -1335,6 +1337,7 @@
   ThunarVfsFileTime date_b;
   gboolean          can_a;
   gboolean          can_b;
+  gint result;
 
   can_a = thunar_file_get_date (a, THUNAR_FILE_DATE_MODIFIED, &date_a);
   can_b = thunar_file_get_date (b, THUNAR_FILE_DATE_MODIFIED, &date_b);
@@ -1346,11 +1349,12 @@
   else if (G_UNLIKELY (!can_b))
     return 1;
 
-  if (date_a < date_b)
-    return -1;
-  else if (date_a > date_b)
-    return 1;
-  return 0;
+  result = date_a - date_b;
+
+  if (result == 0)
+    return sort_by_name(a,b);
+
+  return result;
 }
 
 
@@ -1382,6 +1386,9 @@
   result = strcasecmp (thunar_vfs_mime_info_get_name (info_a),
                        thunar_vfs_mime_info_get_name (info_b));
 
+  if (result == 0)
+    result = sort_by_name(a,b);
+
   thunar_vfs_mime_info_unref (info_b);
   thunar_vfs_mime_info_unref (info_a);
 
@@ -1406,15 +1413,17 @@
 {
   ThunarVfsFileMode mode_a;
   ThunarVfsFileMode mode_b;
+  int result;
 
   mode_a = thunar_file_get_mode (a);
   mode_b = thunar_file_get_mode (b);
 
-  if (mode_a < mode_b)
-    return -1;
-  else if (mode_a > mode_b)
-    return 1;
-  return 0;
+  result = mode_a - mode_b;
+
+  if (result == 0)
+    return sort_by_name(a,b);
+
+  return result;
 }
 
 
@@ -1427,6 +1436,7 @@
   ThunarVfsFileSize size_b;
   gboolean          can_a;
   gboolean          can_b;
+  gint result;
 
   can_a = thunar_file_get_size (a, &size_a);
   can_b = thunar_file_get_size (b, &size_b);
@@ -1438,11 +1448,12 @@
   else if (G_UNLIKELY (!can_b))
     return 1;
 
-  if (size_a < size_b)
-    return -1;
-  else if (size_a > size_b)
-    return 1;
-  return 0;
+  result = size_a - size_b;
+
+  if (result == 0)
+    return sort_by_name(a,b);
+
+  return result;
 }
 
 
@@ -1474,6 +1485,9 @@
   result = strcasecmp (thunar_vfs_mime_info_get_comment (info_a),
                        thunar_vfs_mime_info_get_comment (info_b));
 
+  if (result == 0)
+    result = sort_by_name(a,b);
+
   thunar_vfs_mime_info_unref (info_b);
   thunar_vfs_mime_info_unref (info_a);
 
_______________________________________________
Thunar-dev mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/thunar-dev

Reply via email to