Skip to content

Instantly share code, notes, and snippets.

@LinuxMatt
Last active August 29, 2015 14:13
Show Gist options
  • Save LinuxMatt/b29c87b4b43941355655 to your computer and use it in GitHub Desktop.
Save LinuxMatt/b29c87b4b43941355655 to your computer and use it in GitHub Desktop.
This is an incomplete draft of a patch for bug 11075 in Thunar
diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c
index 60fe3e7..db84c78 100644
--- a/thunar/thunar-file.c
+++ b/thunar/thunar-file.c
@@ -67,6 +67,7 @@
#include <thunar/thunar-util.h>
#include <thunar/thunar-dialogs.h>
#include <thunar/thunar-icon-factory.h>
+#include <thunar/thunar-preferences.h>
@@ -884,6 +885,8 @@ thunar_file_info_reload (ThunarFile *file,
gboolean is_secure = FALSE;
gchar *casefold;
gchar *path;
+ gboolean alpha_sort = FALSE;
+ ThunarPreferences *preferences;
_thunar_return_if_fail (THUNAR_IS_FILE (file));
_thunar_return_if_fail (file->info == NULL || G_IS_FILE_INFO (file->info));
@@ -991,15 +994,27 @@ thunar_file_info_reload (ThunarFile *file,
file->display_name = thunar_g_file_get_display_name (file->gfile);
}
+ preferences = thunar_preferences_get ();
+ g_object_get (preferences, "misc-alpha-sort", &alpha_sort, NULL);
+ g_object_unref (preferences);
+
/* create case sensitive collation key */
- file->collate_key = g_utf8_collate_key_for_filename (file->display_name, -1);
+ if(alpha_sort)
+ file->collate_key = g_utf8_collate_key (file->display_name, -1);
+ else
+ file->collate_key = g_utf8_collate_key_for_filename (file->display_name, -1);
/* lowercase the display name */
casefold = g_utf8_casefold (file->display_name, -1);
/* if the lowercase name is equal, only peek the already hash key */
if (casefold != NULL && strcmp (casefold, file->display_name) != 0)
- file->collate_key_nocase = g_utf8_collate_key_for_filename (casefold, -1);
+ {
+ if(alpha_sort)
+ file->collate_key_nocase = g_utf8_collate_key (casefold, -1);
+ else
+ file->collate_key_nocase = g_utf8_collate_key_for_filename (casefold, -1);
+ }
else
file->collate_key_nocase = file->collate_key;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment