[gnome-documents] application, embed, search: Don't negate Application.isBooks
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents] application, embed, search: Don't negate Application.isBooks
- Date: Mon, 12 Oct 2015 17:52:46 +0000 (UTC)
commit 30cea1859ea7ae0fcacde7b44f0c396a1126c7d9
Author: Alessandro Bono <shadow openaliasbox org>
Date: Tue Oct 6 23:46:38 2015 +0200
application, embed, search: Don't negate Application.isBooks
https://bugzilla.gnome.org/show_bug.cgi?id=756146
src/application.js | 14 +++++++-------
src/embed.js | 8 ++++----
src/search.js | 49 +++++++++++++++++++++++++------------------------
3 files changed, 36 insertions(+), 35 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index 9a02527..785fb18 100644
--- a/src/application.js
+++ b/src/application.js
@@ -110,12 +110,12 @@ const Application = new Lang.Class({
this.isBooks = isBooks;
let appid;
- if (!this.isBooks) {
- GLib.set_application_name(_("Documents"));
- appid = 'org.gnome.Documents';
- } else {
+ if (this.isBooks) {
GLib.set_application_name(_("Books"));
appid = 'org.gnome.Books';
+ } else {
+ GLib.set_application_name(_("Documents"));
+ appid = 'org.gnome.Documents';
}
this.parent({ application_id: appid,
@@ -477,10 +477,10 @@ const Application = new Lang.Class({
EvDoc.init();
application = this;
- if (!application.isBooks)
- settings = new Gio.Settings({ schema_id: 'org.gnome.documents' });
- else
+ if (application.isBooks)
settings = new Gio.Settings({ schema_id: 'org.gnome.books' });
+ else
+ settings = new Gio.Settings({ schema_id: 'org.gnome.documents' });
let gtkSettings = Gtk.Settings.get_default();
gtkSettings.connect('notify::gtk-theme-name', Lang.bind(this, this._themeChanged));
diff --git a/src/embed.js b/src/embed.js
index 42fbccd..d5d5cd6 100644
--- a/src/embed.js
+++ b/src/embed.js
@@ -77,7 +77,7 @@ const Embed = new Lang.Class({
// now create the actual content widgets
this._documents = new View.ViewContainer(WindowMode.WindowMode.DOCUMENTS);
- let label = !Application.application.isBooks ? _("Documents") : _('Books');
+ let label = Application.application.isBooks ? _('Books') : _("Documents");
this._stack.add_titled(this._documents, 'documents', label);
this._collections = new View.ViewContainer(WindowMode.WindowMode.COLLECTIONS);
@@ -340,10 +340,10 @@ const Embed = new Lang.Class({
},
_onLoadFinished: function(manager, doc, docModel) {
- if (!Application.application.isBooks)
- docModel.set_sizing_mode(EvView.SizingMode.AUTOMATIC);
- else
+ if (Application.application.isBooks)
docModel.set_sizing_mode(EvView.SizingMode.FIT_PAGE);
+ else
+ docModel.set_sizing_mode(EvView.SizingMode.AUTOMATIC);
docModel.set_page_layout(EvView.PageLayout.AUTOMATIC);
this._toolbar.setModel(docModel);
this._preview.setModel(docModel);
diff --git a/src/search.js b/src/search.js
index cb23c00..811661f 100644
--- a/src/search.js
+++ b/src/search.js
@@ -198,7 +198,13 @@ const SearchTypeManager = new Lang.Class({
this.addItem(new SearchType({ id: SearchTypeStock.ALL,
name: _("All") }));
- if (!Application.application.isBooks) {
+ if (Application.application.isBooks) {
+ this.addItem(new SearchType({ id: SearchTypeStock.COLLECTIONS,
+ name: _("Collections"),
+ filter: 'fn:starts-with(nao:identifier(?urn), \"gb:collection\")',
+ where: '?urn rdf:type nfo:DataContainer .' }));
+ //FIXME we need to remove all the non-Comics PDFs here
+ } else {
this.addItem(new SearchType({ id: SearchTypeStock.COLLECTIONS,
name: _("Collections"),
filter: 'fn:starts-with(nao:identifier(?urn), \"gd:collection\")',
@@ -207,15 +213,18 @@ const SearchTypeManager = new Lang.Class({
name: _("PDF Documents"),
filter: 'fn:contains(nie:mimeType(?urn), \"application/pdf\")',
where: '?urn rdf:type nfo:PaginatedTextDocument .' }));
- } else {
- this.addItem(new SearchType({ id: SearchTypeStock.COLLECTIONS,
- name: _("Collections"),
- filter: 'fn:starts-with(nao:identifier(?urn), \"gb:collection\")',
- where: '?urn rdf:type nfo:DataContainer .' }));
- //FIXME we need to remove all the non-Comics PDFs here
}
- if (!Application.application.isBooks) {
+ if (Application.application.isBooks) {
+ this.addItem(new SearchType({ id: SearchTypeStock.EBOOKS,
+ name: _("e-Books"),
+ filter: '(nie:mimeType(?urn) IN (\"application/epub+zip\",
\"application/x-mobipocket-ebook\", \"application/x-fictionbook+xml\",
\"application/x-zip-compressed-fb2\"))',
+ where: '?urn rdf:type nfo:EBook .' }));
+ this.addItem(new SearchType({ id: SearchTypeStock.COMICS,
+ name: _("Comics"),
+ filter: '(nie:mimeType(?urn) IN (\"application/x-cbr\",
\"application/x-cbz\", \"application/x-cbt\", \"application/x-cb7\"))',
+ where: '?urn rdf:type nfo:EBook .' }));
+ } else {
this.addItem(new SearchType({ id: SearchTypeStock.PRESENTATIONS,
name: _("Presentations"),
where: '?urn rdf:type nfo:Presentation .' }));
@@ -226,15 +235,6 @@ const SearchTypeManager = new Lang.Class({
name: _("Text Documents"),
filter: 'NOT EXISTS { ?urn a nfo:EBook }',
where: '?urn rdf:type nfo:PaginatedTextDocument .' }));
- } else {
- this.addItem(new SearchType({ id: SearchTypeStock.EBOOKS,
- name: _("e-Books"),
- filter: '(nie:mimeType(?urn) IN (\"application/epub+zip\",
\"application/x-mobipocket-ebook\", \"application/x-fictionbook+xml\",
\"application/x-zip-compressed-fb2\"))',
- where: '?urn rdf:type nfo:EBook .' }));
- this.addItem(new SearchType({ id: SearchTypeStock.COMICS,
- name: _("Comics"),
- filter: '(nie:mimeType(?urn) IN (\"application/x-cbr\",
\"application/x-cbz\", \"application/x-cbt\", \"application/x-cb7\"))',
- where: '?urn rdf:type nfo:EBook .' }));
}
@@ -253,14 +253,14 @@ const SearchTypeManager = new Lang.Class({
getDocumentTypes: function() {
let types = [];
- if (!Application.application.isBooks) {
+ if (Application.application.isBooks) {
+ types.push(this.getItemById(SearchTypeStock.EBOOKS));
+ types.push(this.getItemById(SearchTypeStock.COMICS));
+ } else {
types.push(this.getItemById(SearchTypeStock.PDF));
types.push(this.getItemById(SearchTypeStock.PRESENTATIONS));
types.push(this.getItemById(SearchTypeStock.SPREADSHEETS));
types.push(this.getItemById(SearchTypeStock.TEXTDOCS));
- } else {
- types.push(this.getItemById(SearchTypeStock.EBOOKS));
- types.push(this.getItemById(SearchTypeStock.COMICS));
}
return types;
@@ -459,10 +459,11 @@ const Source = new Lang.Class({
filters.push('(fn:contains (nie:url(?urn), "%s"))'.format(location.get_uri()));
}));
- if (!Application.application.isBooks)
- filters.push('(fn:starts-with (nao:identifier(?urn), "gd:collection:local:"))');
- else
+ if (Application.application.isBooks)
filters.push('(fn:starts-with (nao:identifier(?urn), "gb:collection:local:"))');
+ else
+ filters.push('(fn:starts-with (nao:identifier(?urn), "gd:collection:local:"))');
+
return '(' + filters.join(' || ') + ')';
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]