[geany/geany-plugins] bad88d: Revert "projectorganizer: When sorting tree, use case-insensitive comparison"
Jiří Techet
git-noreply at xxxxx
Tue Feb 17 20:56:37 UTC 2015
Branch: refs/heads/master
Author: Jiří Techet <techet at gmail.com>
Committer: Jiří Techet <techet at gmail.com>
Date: Tue, 17 Feb 2015 20:56:37 UTC
Commit: bad88d98fe00ac22d92fbe0c86b08cd0b8bd4068
https://github.com/geany/geany-plugins/commit/bad88d98fe00ac22d92fbe0c86b08cd0b8bd4068
Log Message:
-----------
Revert "projectorganizer: When sorting tree, use case-insensitive comparison"
This reverts commit db9465995ec9be3ac4a345c598e564b651cc787b.
First I didn't notice the dereference in the root_comparator() and
thought the function was unnecessary. Even though it worked by
accident (base_dir is the first member of PrjOrgRoot), such a change
was ugly, fragile and totally unintentional (thanks to Colomban
for noticing my idiocy).
Second, I relaized I don't like lower/uppercase filenames mixed.
Usually they are lowercase and only the special ones are uppercase
(like Makefile, etc.) and case sensitivity makes them nicely separated
from normal sources.
Modified Paths:
--------------
projectorganizer/src/prjorg-project.c
projectorganizer/src/prjorg-sidebar.c
Modified: projectorganizer/src/prjorg-project.c
12 lines changed, 9 insertions(+), 3 deletions(-)
===================================================================
@@ -369,10 +369,16 @@ static void close_root(PrjOrgRoot *root, gpointer user_data)
}
+static gint root_comparator(PrjOrgRoot *a, PrjOrgRoot *b)
+{
+ return g_strcmp0(a->base_dir, b->base_dir);
+}
+
+
void prjorg_project_add_external_dir(const gchar *dirname)
{
PrjOrgRoot *new_root = create_root(dirname);
- if (g_slist_find_custom (prj_org->roots, new_root, (GCompareFunc)g_strcmp0) != NULL)
+ if (g_slist_find_custom (prj_org->roots, new_root, (GCompareFunc)root_comparator) != NULL)
{
close_root(new_root, NULL);
return;
@@ -380,7 +386,7 @@ void prjorg_project_add_external_dir(const gchar *dirname)
GSList *lst = prj_org->roots->next;
lst = g_slist_prepend(lst, new_root);
- lst = g_slist_sort(lst, (GCompareFunc)utils_str_casecmp);
+ lst = g_slist_sort(lst, (GCompareFunc)root_comparator);
prj_org->roots->next = lst;
prjorg_project_rescan();
@@ -390,7 +396,7 @@ void prjorg_project_add_external_dir(const gchar *dirname)
void prjorg_project_remove_external_dir(const gchar *dirname)
{
PrjOrgRoot *test_root = create_root(dirname);
- GSList *found = g_slist_find_custom (prj_org->roots, test_root, (GCompareFunc)g_strcmp0);
+ GSList *found = g_slist_find_custom (prj_org->roots, test_root, (GCompareFunc)root_comparator);
if (found != NULL)
{
PrjOrgRoot *found_root = found->data;
Modified: projectorganizer/src/prjorg-sidebar.c
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -1008,7 +1008,7 @@ static void load_project_root(PrjOrgRoot *root, GtkTreeIter *parent, GSList *hea
gchar *path = get_file_relative_path(root->base_dir, key);
lst = g_slist_prepend(lst, path);
}
- lst = g_slist_sort(lst, (GCompareFunc) utils_str_casecmp);
+ lst = g_slist_sort(lst, (GCompareFunc) strcmp);
foreach_slist (elem, lst)
{
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Plugins-Commits
mailing list