Skip to content

Commit

Permalink
Manuals: Changes from review and switch back to CustomSorter
Browse files Browse the repository at this point in the history
  • Loading branch information
AkshayWarrier committed Sep 12, 2023
1 parent d247f44 commit 663f147
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/DocumentationViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export default function DocumentationViewer({ application }) {
});
action_documentation.connect("activate", () => {
window.present();
open();
open().catch(console.error);
});
application.add_action(action_documentation);
}
Expand All @@ -159,8 +159,7 @@ async function loadLibrary(model, directory) {

model.append(page);
} catch (error) {
if (!error.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.NOT_FOUND))
logError(error);
if (!error.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.NOT_FOUND)) throw error;
}
}

Expand All @@ -177,7 +176,7 @@ async function scanLibraries(model, base_dir) {
const libraries = [];

const iter = await base_dir.enumerate_children_async(
"standard::*",
"standard::name,standard::type",
Gio.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,
GLib.PRIORITY_DEFAULT,
null,
Expand Down Expand Up @@ -215,12 +214,13 @@ function createBrowseSelectionModel(root_model, webview) {
false,
(item) => item.children,
);
const expr = new Gtk.ClosureExpression(
GObject.TYPE_STRING,
(item) => item.search_name,
null,
const sorter = Gtk.TreeListRowSorter.new(
Gtk.CustomSorter.new((a, b) => {
const name1 = a.name;
const name2 = b.name;
return name1.localeCompare(name2);
}),
);
const sorter = Gtk.TreeListRowSorter.new(Gtk.StringSorter.new(expr));
const sort_model = Gtk.SortListModel.new(tree_model, sorter);
const selection_model = Gtk.SingleSelection.new(sort_model);

Expand Down

0 comments on commit 663f147

Please sign in to comment.