[gnote] Sort notes and notebooks case-insensitively and internationally
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Sort notes and notebooks case-insensitively and internationally
- Date: Sat, 18 May 2013 21:08:14 +0000 (UTC)
commit 7cfc4624eb68551fcc93459144572ad1c8e17cb4
Author: Aurimas Černius <aurisc4 gmail com>
Date: Sat May 18 23:45:34 2013 +0300
Sort notes and notebooks case-insensitively and internationally
Use Glib::ustring::compare() for comparing lowercased titles.
Fixes Bug 700438.
src/notebooks/notebookmanager.cpp | 4 +---
src/searchnoteswidget.cpp | 6 +++---
2 files changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/src/notebooks/notebookmanager.cpp b/src/notebooks/notebookmanager.cpp
index 6773c95..69ef47d 100644
--- a/src/notebooks/notebookmanager.cpp
+++ b/src/notebooks/notebookmanager.cpp
@@ -441,9 +441,7 @@ namespace gnote {
a_name = a_name.lowercase();
Glib::ustring b_name(notebook_b->get_name());
b_name = b_name.lowercase();
- return a_name== b_name
- ? 0
- : a_name<b_name ? -1 : 1;
+ return a_name.compare(b_name);
}
/// <summary>
diff --git a/src/searchnoteswidget.cpp b/src/searchnoteswidget.cpp
index 85b8e2b..640d7fe 100644
--- a/src/searchnoteswidget.cpp
+++ b/src/searchnoteswidget.cpp
@@ -626,14 +626,14 @@ bool SearchNotesWidget::filter_notes(const Gtk::TreeIter & iter)
int SearchNotesWidget::compare_titles(const Gtk::TreeIter & a, const Gtk::TreeIter & b)
{
- std::string title_a = (*a)[m_column_types.title];
- std::string title_b = (*b)[m_column_types.title];
+ Glib::ustring title_a = std::string((*a)[m_column_types.title]);
+ Glib::ustring title_b = std::string((*b)[m_column_types.title]);
if(title_a.empty() || title_b.empty()) {
return -1;
}
- return title_a.compare(title_b);
+ return title_a.lowercase().compare(title_b.lowercase());
}
int SearchNotesWidget::compare_dates(const Gtk::TreeIter & a, const Gtk::TreeIter & b)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]