[gnome-documents] books: Show a warning when trying to load e-Books
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents] books: Show a warning when trying to load e-Books
- Date: Fri, 6 Mar 2015 15:34:29 +0000 (UTC)
commit 9c5cf3e98c15c17736bacda1aa2eea9458cbf4ce
Author: Bastien Nocera <hadess hadess net>
Date: Mon Mar 2 14:23:55 2015 +0100
books: Show a warning when trying to load e-Books
e-Books cannot be previewed yet, but will be in the future. When trying
to load an ePub, MOBI, etc. book, throw an error saying:
You are using a preview of Books. Full viewing capabilities are coming
soon!
https://bugzilla.gnome.org/show_bug.cgi?id=745172
src/documents.js | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/src/documents.js b/src/documents.js
index 420e421..39cdb48 100644
--- a/src/documents.js
+++ b/src/documents.js
@@ -717,6 +717,17 @@ const LocalDocument = new Lang.Class({
},
load: function(passwd, cancellable, callback) {
+ if (this.mimeType == 'application/epub+zip' ||
+ this.mimeType == 'application/x-mobipocket-ebook' ||
+ this.mimeType == 'application/x-fictionbook+xml' ||
+ this.mimeType == 'application/x-zip-compressed-fb2') {
+ let exception = new GLib.Error(Gio.IOErrorEnum,
+ Gio.IOErrorEnum.NOT_SUPPORTED,
+ "Internal error: Ebooks preview isn't support yet");
+ callback(this, null, exception);
+ return;
+ }
+
GdPrivate.pdf_loader_load_uri_async(this.uri, passwd, cancellable, Lang.bind(this,
function(source, res) {
try {
@@ -1248,7 +1259,17 @@ const DocumentManager = new Lang.Class({
message = _("Hmm, something is fishy (%d).").format(error.code);
break;
}
+ } else if (error.domain == Gio.IOErrorEnum) {
+ switch (error.code) {
+ case Gio.IOErrorEnum.NOT_SUPPORTED:
+ if (Application.application.isBooks)
+ message = _("You are using a preview of Books. Full viewing capabilities are coming
soon!");
+ break;
+ default:
+ break;
+ }
}
+
let exception = new GLib.Error(error.domain, error.code, message);
return exception;
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]