diff --git a/data/com.github.johnfactotum.Foliate.gschema.xml b/data/com.github.johnfactotum.Foliate.gschema.xml
index 0dd1e736..ba2b40de 100644
--- a/data/com.github.johnfactotum.Foliate.gschema.xml
+++ b/data/com.github.johnfactotum.Foliate.gschema.xml
@@ -30,6 +30,12 @@
'grid'
+
+ true
+
+
+ 256
+
= 1 ? cover
+ : cover.scale_simple(width, Math.round(cover.get_height() * ratio),
+ GdkPixbuf.InterpType.BILINEAR)
+ scaled.savev(path, 'png', [], [])
+ }
}
class BookDataStore {
@@ -816,11 +829,10 @@ export const BookViewer = GObject.registerClass({
this._navbar.loadPageList(book.pageList, reader.pageTotal)
this._navbar.loadLandmarks(book.landmarks)
- this._view.getCover().then(cover => {
- this.#cover = cover
- if (cover) this._book_cover.set_from_pixbuf(cover)
- else this._book_cover.icon_name = 'image-missing-symbolic'
- })
+ const cover = await this._view.getCover()
+ this.#cover = cover
+ if (cover) this._book_cover.set_from_pixbuf(cover)
+ else this._book_cover.icon_name = 'image-missing-symbolic'
book.metadata.identifier ||= makeIdentifier(this.#file)
const { identifier } = book.metadata
@@ -842,6 +854,7 @@ export const BookViewer = GObject.registerClass({
updateBookmarks()
this.#data.storage.set('metadata', book.metadata)
getURIStore().set(identifier, this.#file.get_uri())
+ if (cover) this.#data.saveCover(cover)
}
else await this._view.next()
}
diff --git a/src/library.js b/src/library.js
index 8fe31d5a..6f7f8c0e 100644
--- a/src/library.js
+++ b/src/library.js
@@ -12,6 +12,8 @@ import * as format from './format.js'
import { exportAnnotations } from './annotations.js'
import { formatAuthors, makeBookInfoWindow } from './book-info.js'
+const showCovers = utils.settings('library')?.get_boolean('show-covers') ?? true
+
const listDir = function* (path) {
const dir = Gio.File.new_for_path(path)
if (!GLib.file_test(path, GLib.FileTest.IS_DIR)) return null
@@ -288,7 +290,7 @@ GObject.registerClass({
'setup': (_, item) => item.child =
utils.connect(new BookItem(), this.#itemConnections),
'bind': (_, { child, item }) => {
- const { cover, data } = this.#getData(item, true)
+ const { cover, data } = this.#getData(item, showCovers)
child.update(item, data, cover)
if (cover?.then) cover
.then(cover => child.update(item, data, cover))
@@ -308,7 +310,7 @@ GObject.registerClass({
'setup': (_, item) => item.child = utils.connect(
new BookRow(), this.#itemConnections),
'bind': (_, { child, item }) => {
- const { data } = this.#getData(item, true)
+ const { data } = this.#getData(item, false)
child.update(item, data)
},
}),