Skip to content

Commit

Permalink
Fixes for loading a book from right click in Files
Browse files Browse the repository at this point in the history
  • Loading branch information
babluboy committed Feb 11, 2018
1 parent 1a5bfa6 commit 65de43d
Show file tree
Hide file tree
Showing 12 changed files with 171 additions and 108 deletions.
22 changes: 16 additions & 6 deletions data/com.github.babluboy.bookworm.appdata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<project_group>bookworm</project_group>
<project_license>GPL-3.0+</project_license>
<name>Bookworm</name>
<summary>A simple, focused eBook reader</summary>
<summary>A focused eBook reader</summary>
<description>
<p>Read the books you love without having to worry about the different format complexities like epub, pdf, mobi, cbr, etc.</p>
<p>Manage your library by tagging and updating metadata on books, to quickly find books using metadata searching and tag based filtering.</p>
Expand All @@ -26,16 +26,21 @@
<binary>com.github.babluboy.bookworm</binary>
</provides>
<releases>
<release version="0.9.5" date="2017-12-10">
<release version="1.0.0" date="2018-02-11">
<description>
<p>Annotations and Two Page Views</p>
<p>Right to Left Reading</p>
<ul>
<li>Support for creating Annotations with searchable tags</li>
<li>Two page reading</li>
<li>New shortcuts (See Bookworm Homepage for details)</li>
<li>Support for Right to Left Reading</li>
<li>A shiny new icon and new cover images</li>
<li>Better support for EPUB Table of Contents</li>
</ul>
</description>
</release>
<release version="0.9.5" date="2017-12-10">
<description>
<p>Annotations and Two Page Views</p>
</description>
</release>
<release version="0.9" date="2017-07-23">
<description>
<p>Support mobi format and UX improvements</p>
Expand Down Expand Up @@ -67,4 +72,9 @@
<url type="bugtracker">https://github.com/babluboy/bookworm/issues</url>
<url type="help">https://github.com/babluboy/bookworm/wiki</url>
<update_contact>bablu.boy_AT_gmail.com</update_contact>
<custom>
<value key="x-appcenter-color-primary">#e29ffc</value>
<value key="x-appcenter-color-primary-text">#260063</value>
<value key="x-appcenter-suggested-price">2</value>
</custom>
</component>
50 changes: 29 additions & 21 deletions po/com.github.babluboy.bookworm.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-02-10 16:45+0000\n"
"POT-Creation-Date: 2018-02-11 16:20+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand All @@ -21,7 +21,7 @@ msgstr ""
msgid "Select Image"
msgstr ""

#: ../src/dialog.vala:504
#: ../src/dialog.vala:510
msgid "Select folder"
msgstr ""

Expand Down Expand Up @@ -330,82 +330,90 @@ msgid "Decrease line spacing"
msgstr ""

#: ../src/constants.vala:106
msgid "Update cover image"
msgid "Align left"
msgstr ""

#: ../src/constants.vala:107
msgid "Align right"
msgstr ""

#: ../src/constants.vala:108
msgid "Update cover image"
msgstr ""

#: ../src/constants.vala:109
msgid "Apply theme for this colour profile"
msgstr ""

#: ../src/constants.vala:108 ../src/constants.vala:109
#: ../src/constants.vala:110 ../src/constants.vala:111
msgid "Enter full screen view and Esc key to undo"
msgstr ""

#: ../src/constants.vala:110
#: ../src/constants.vala:112
msgid "Add folder to scan for books"
msgstr ""

#: ../src/constants.vala:111
#: ../src/constants.vala:113
msgid "Remove displayed folder from book scan"
msgstr ""

#: ../src/constants.vala:112
#: ../src/constants.vala:114
msgid "Add annotation to selected text"
msgstr ""

#: ../src/constants.vala:114 ../src/constants.vala:139
#: ../src/constants.vala:116 ../src/constants.vala:141
msgid "Preferences"
msgstr ""

#: ../src/constants.vala:115
#: ../src/constants.vala:117
msgid "Turn on Dark Mode"
msgstr ""

#: ../src/constants.vala:116
#: ../src/constants.vala:118
msgid "Enable cache (opens books faster)"
msgstr ""

#: ../src/constants.vala:117
#: ../src/constants.vala:119
msgid "Always show library on startup"
msgstr ""

#: ../src/constants.vala:118
#: ../src/constants.vala:120
msgid "Enable two page reading"
msgstr ""

#: ../src/constants.vala:119
#: ../src/constants.vala:121
msgid "Select Font"
msgstr ""

#: ../src/constants.vala:120
#: ../src/constants.vala:122
msgid "Customize reading profile"
msgstr ""

#: ../src/constants.vala:121
#: ../src/constants.vala:123
msgid "Text"
msgstr ""

#: ../src/constants.vala:122
#: ../src/constants.vala:124
msgid "Background"
msgstr ""

#: ../src/constants.vala:123
#: ../src/constants.vala:125
msgid "Add folders to scan for books"
msgstr ""

#: ../src/constants.vala:124
#: ../src/constants.vala:126
msgid "Profile"
msgstr ""

#: ../src/constants.vala:125
#: ../src/constants.vala:127
msgid "Reset to default values"
msgstr ""

#: ../src/constants.vala:137
#: ../src/constants.vala:139
msgid "Unknown Book"
msgstr ""

#: ../src/constants.vala:138
#: ../src/constants.vala:140
msgid "About"
msgstr ""

Expand Down
5 changes: 4 additions & 1 deletion schemas/com.github.babluboy.bookworm.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@
</key>
<key name="list-of-profile-colors" type="s">
<default>"#000000,#fbfbfb,#586e75,#fdf6e3,#93a1a1,#002b36"</default>
<summary>List of profile colours. Three profiles with two colors each. First color is text color and second one is bgcolor</summary>
<summary>
List of profile colours. Each profiles has two colors - First color is text color and second one is bgcolor.
The first three sets are customizable and the last two sets are the default light and dark profiles
</summary>
</key>
<key name="list-of-scan-dirs" type="s">
<default>""</default>
Expand Down
7 changes: 4 additions & 3 deletions src/bookinfo.vala
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,10 @@ public class BookwormApp.Info:Gtk.Window {
int bookmarkNumber = 1;
foreach (string bookmarkedPage in bookmarkList) {
if(bookmarkedPage != null && bookmarkedPage.length > 0){
LinkButton bookmarkLinkButton = new LinkButton.with_label (bookmarkedPage, BookwormApp.Constants.TEXT_FOR_BOOKMARKS
.replace("NNN", bookmarkNumber.to_string())
.replace("PPP", (int.parse(bookmarkedPage)+1).to_string()));
LinkButton bookmarkLinkButton = new LinkButton.with_label (bookmarkedPage,
BookwormApp.Constants.TEXT_FOR_BOOKMARKS
.replace("NNN", bookmarkNumber.to_string())
.replace("PPP", (int.parse(bookmarkedPage)+1).to_string()));
bookmarkNumber++;
bookmarkLinkButton.halign = Align.START;
bookmarks_box.pack_start(bookmarkLinkButton,false,false,0);
Expand Down
13 changes: 8 additions & 5 deletions src/bookworm.vala
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public class BookwormApp.Bookworm : Granite.Application {
flags |= ApplicationFlags.HANDLES_COMMAND_LINE;
program_name = BookwormApp.Constants.program_name;
exec_name = "com.github.babluboy.bookworm";

options = new OptionEntry[4];
options[0] = { "version", 0, 0, OptionArg.NONE, ref command_line_option_version, _("Display version number"), null };
options[1] = { "debug", 0, 0, OptionArg.NONE, ref command_line_option_debug, _("Run Bookworm in debug mode"), null };
Expand Down Expand Up @@ -135,6 +135,9 @@ public class BookwormApp.Bookworm : Granite.Application {
opt_context.add_main_entries (options, null);
unowned string[] tmpArgs = args;
opt_context.parse (ref tmpArgs);
if("--version" in args){
command_line_option_version = true;
}
} catch (OptionError e) {
info ("Run '%s --help' to see a full list of available command line options.\n", args[0]);
info ("error: %s\n", e.message);
Expand All @@ -148,7 +151,7 @@ public class BookwormApp.Bookworm : Granite.Application {
debug ("Bookworm running in info mode...");
}
if(command_line_option_version){
print("\nbookworm version "+Constants.bookworm_version+"\n");
print("\nBookworm Version "+BookwormApp.Constants.bookworm_version+"\n");
return 0;
}else if(command_line_option_discover){
BookwormApp.BackgroundTasks.performTasks();
Expand Down Expand Up @@ -397,9 +400,9 @@ public class BookwormApp.Bookworm : Granite.Application {
//Update the library view
BookwormApp.Library.updateLibraryViewFromDB();
//load scripts data
bookwormScripts = BookwormApp.Utils.fileOperations("READ_FILE",
BookwormApp.Constants.HTML_SCRIPT_LOCATION,
"",
bookwormScripts = BookwormApp.Utils.fileOperations("READ_FILE",
BookwormApp.Constants.HTML_SCRIPT_LOCATION,
"",
"");
}

Expand Down
29 changes: 19 additions & 10 deletions src/constants.vala
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ namespace BookwormApp.Constants {
public const string TOOLTIP_TEXT_FOR_LINE_WIDTH_DECREASE = _("Decrease line width");
public const string TOOLTIP_TEXT_FOR_LINE_HEIGHT_INCREASE = _("Increase line spacing");
public const string TOOLTIP_TEXT_FOR_LINE_HEIGHT_DECREASE = _("Decrease line spacing");
public const string TOOLTIP_TEXT_FOR_READING_LEFT_ALIGN = _("Align left");
public const string TOOLTIP_TEXT_FOR_READING_RIGHT_ALIGN = _("Align right");
public const string TOOLTIP_TEXT_FOR_UPDATING_COVER_IMAGE = _("Update cover image");
public const string TOOLTIP_TEXT_FOR_PROFILE = _("Apply theme for this colour profile");
public const string TOOLTIP_TEXT_FOR_PAGE_CONTEXTMENU_FULL_SCREEN_ENTRY = _("Enter full screen view and Esc key to undo");
Expand Down Expand Up @@ -182,16 +184,23 @@ namespace BookwormApp.Constants {
public const string FILE_CHOOSER_FILTER_IMAGES[] = {"*.jpg", "*.jpeg", "*.gif", "*.png", "*.svg"};


public const string BOOKWORM_READING_MODE[] = {"PROFILE1","PROFILE2","PROFILE3"};
public const string BOOKWORM_UI_STATES[] = {"LIBRARY_MODE_GRID",
"READING_MODE",
"GRID_SELECTION_MODE",
"GRID_SELECTED_MODE",
"CONTENT_MODE",
"LIBRARY_MODE_LIST",
"LIST_SELECTION_MODE",
"LIST_SELECTED_MODE"
};
public const string BOOKWORM_READING_MODE[] = {
"PROFILE1",
"PROFILE2",
"PROFILE3",
"PROFILE_LIGHT_DEFAULT",
"PROFILE_DARK_DEFAULT"
};
public const string BOOKWORM_UI_STATES[] = {
"LIBRARY_MODE_GRID",
"READING_MODE",
"GRID_SELECTION_MODE",
"GRID_SELECTED_MODE",
"CONTENT_MODE",
"LIBRARY_MODE_LIST",
"LIST_SELECTION_MODE",
"LIST_SELECTED_MODE"
};
public const string IDENTIFIER_FOR_PROPERTY_VALUE = "==";
public const string IDENTIFIER_FOR_PROPERTY_START = "~~";
public const string IDENTIFIER_FOR_PROPERTY_END = "##\n";
Expand Down
29 changes: 19 additions & 10 deletions src/constants.vala.in
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ namespace BookwormApp.Constants {
public const string TOOLTIP_TEXT_FOR_LINE_WIDTH_DECREASE = _("Decrease line width");
public const string TOOLTIP_TEXT_FOR_LINE_HEIGHT_INCREASE = _("Increase line spacing");
public const string TOOLTIP_TEXT_FOR_LINE_HEIGHT_DECREASE = _("Decrease line spacing");
public const string TOOLTIP_TEXT_FOR_READING_LEFT_ALIGN = _("Align left");
public const string TOOLTIP_TEXT_FOR_READING_RIGHT_ALIGN = _("Align right");
public const string TOOLTIP_TEXT_FOR_UPDATING_COVER_IMAGE = _("Update cover image");
public const string TOOLTIP_TEXT_FOR_PROFILE = _("Apply theme for this colour profile");
public const string TOOLTIP_TEXT_FOR_PAGE_CONTEXTMENU_FULL_SCREEN_ENTRY = _("Enter full screen view and Esc key to undo");
Expand Down Expand Up @@ -182,16 +184,23 @@ namespace BookwormApp.Constants {
public const string FILE_CHOOSER_FILTER_IMAGES[] = {"*.jpg", "*.jpeg", "*.gif", "*.png", "*.svg"};


public const string BOOKWORM_READING_MODE[] = {"PROFILE1","PROFILE2","PROFILE3"};
public const string BOOKWORM_UI_STATES[] = {"LIBRARY_MODE_GRID",
"READING_MODE",
"GRID_SELECTION_MODE",
"GRID_SELECTED_MODE",
"CONTENT_MODE",
"LIBRARY_MODE_LIST",
"LIST_SELECTION_MODE",
"LIST_SELECTED_MODE"
};
public const string BOOKWORM_READING_MODE[] = {
"PROFILE1",
"PROFILE2",
"PROFILE3",
"PROFILE_LIGHT_DEFAULT",
"PROFILE_DARK_DEFAULT"
};
public const string BOOKWORM_UI_STATES[] = {
"LIBRARY_MODE_GRID",
"READING_MODE",
"GRID_SELECTION_MODE",
"GRID_SELECTED_MODE",
"CONTENT_MODE",
"LIBRARY_MODE_LIST",
"LIST_SELECTION_MODE",
"LIST_SELECTED_MODE"
};
public const string IDENTIFIER_FOR_PROPERTY_VALUE = "==";
public const string IDENTIFIER_FOR_PROPERTY_START = "~~";
public const string IDENTIFIER_FOR_PROPERTY_END = "##\n";
Expand Down
19 changes: 16 additions & 3 deletions src/contentHandler.vala
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,20 @@ public class BookwormApp.contentHandler {
}
//Set background and font colour based on profile
string[] profileColorList = settings.list_of_profile_colors.split (",");
if(BookwormApp.Constants.BOOKWORM_READING_MODE[2] == BookwormApp.Bookworm.settings.reading_profile){

if(BookwormApp.Constants.BOOKWORM_READING_MODE[4] == BookwormApp.Bookworm.settings.reading_profile){
//default dark profile
cssForTextAndBackgroundColor = " background-color: #002b36"+
" !important; color: #93a1a1"+
" !important;";
currentBookwormScripts = currentBookwormScripts.replace("$SCROLLBAR_BACKGROUND", "#002b36");
} else if(BookwormApp.Constants.BOOKWORM_READING_MODE[3] == BookwormApp.Bookworm.settings.reading_profile){
//default light profile
cssForTextAndBackgroundColor = " background-color: #fbfbfb"+
" !important; color: #000000"+
" !important;";
currentBookwormScripts = currentBookwormScripts.replace("$SCROLLBAR_BACKGROUND", "#fbfbfb");
} else if(BookwormApp.Constants.BOOKWORM_READING_MODE[2] == BookwormApp.Bookworm.settings.reading_profile){
cssForTextAndBackgroundColor = " background-color: "+ profileColorList[5] +
" !important; color: "+ profileColorList[4] +
" !important;";
Expand All @@ -147,7 +160,7 @@ public class BookwormApp.contentHandler {
" !important; color: "+ profileColorList[2] +
" !important;";
currentBookwormScripts = currentBookwormScripts.replace("$SCROLLBAR_BACKGROUND", profileColorList[3]);
}else{
} else{
cssForTextAndBackgroundColor = " background-color: "+ profileColorList[1] +
" !important; color: "+ profileColorList[0] +
" !important;";
Expand Down Expand Up @@ -299,7 +312,7 @@ public class BookwormApp.contentHandler {
//open the book added, if only one book path is present on command line
//if this book was not in the library, then the library view will be shown
if(BookwormApp.Bookworm.pathsOfBooksToBeAdded.length == 2 &&
"bookworm" == BookwormApp.Bookworm.pathsOfBooksToBeAdded[0])
BookwormApp.Constants.bookworm_id == BookwormApp.Bookworm.pathsOfBooksToBeAdded[0])
{
BookwormApp.Book requestedBook = null;
//Check if the requested book is available in the library
Expand Down
Loading

0 comments on commit 65de43d

Please sign in to comment.