Skip to content

Commit

Permalink
Added fullscreen support
Browse files Browse the repository at this point in the history
  • Loading branch information
babluboy committed May 17, 2017
1 parent 75cc227 commit 7cb9fcb
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 27 deletions.
66 changes: 43 additions & 23 deletions po/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: 2017-05-16 18:34+0100\n"
"POT-Creation-Date: 2017-05-17 20:54+0100\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 @@ -17,15 +17,15 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"

#: src/constants.vala:97
#: src/constants.vala:103
msgid "About"
msgstr ""

#: src/constants.vala:66
#: src/constants.vala:69
msgid "Add books to library"
msgstr ""

#: src/constants.vala:128
#: src/constants.vala:134
msgid "All Files"
msgstr ""

Expand All @@ -49,15 +49,19 @@ msgstr ""
msgid "Build your library by adding eBooks"
msgstr ""

#: src/constants.vala:67
msgid "Check Word Meaning"
msgstr ""

#: src/constants.vala:54
msgid "Click on a link to jump to bookmarked section"
msgstr ""

#: src/constants.vala:71
#: src/constants.vala:74
msgid "Click to bookmark this page"
msgstr ""

#: src/constants.vala:72
#: src/constants.vala:75
msgid "Click to remove this bookmark"
msgstr ""

Expand All @@ -69,43 +73,55 @@ msgstr ""
msgid "Contents"
msgstr ""

#: src/constants.vala:80
#: src/constants.vala:84
msgid "Dark theme"
msgstr ""

#: src/constants.vala:74
#: src/constants.vala:77
msgid "Decrease font size"
msgstr ""

#: src/constants.vala:78
#: src/constants.vala:81
msgid "Decrease line spacing"
msgstr ""

#: src/constants.vala:76
#: src/constants.vala:79
msgid "Decrease line width"
msgstr ""

#: src/constants.vala:59
msgid "Edit Info for"
msgstr ""

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

#: src/constants.vala:65
msgid "Enter full screen view"
msgstr ""

#: src/constants.vala:86 src/constants.vala:87
msgid "Enter full screen view and Esc key to exit"
msgstr ""

#: src/constants.vala:66
msgid "Exit full screen view"
msgstr ""

#: src/constants.vala:57
msgid "Found the following matches for '$$$' in &&&:"
msgstr ""

#: src/constants.vala:73
#: src/constants.vala:76
msgid "Increase font size"
msgstr ""

#: src/constants.vala:77
#: src/constants.vala:80
msgid "Increase line spacing"
msgstr ""

#: src/constants.vala:75
#: src/constants.vala:78
msgid "Increase line width"
msgstr ""

Expand All @@ -125,7 +141,7 @@ msgstr ""
msgid "Library"
msgstr ""

#: src/constants.vala:79
#: src/constants.vala:83
msgid "Light theme"
msgstr ""

Expand All @@ -147,7 +163,7 @@ msgstr ""
msgid "Not Available"
msgstr ""

#: src/constants.vala:84 src/constants.vala:98
#: src/constants.vala:90 src/constants.vala:104
msgid "Preferences"
msgstr ""

Expand All @@ -157,7 +173,7 @@ msgid ""
"location : "
msgstr ""

#: src/constants.vala:67
#: src/constants.vala:70
msgid "Remove selected books from library (eBook file will not be deleted)"
msgstr ""

Expand All @@ -177,31 +193,31 @@ msgstr ""
msgid "Search this book..."
msgstr ""

#: src/constants.vala:69
#: src/constants.vala:72
msgid "See Table of Contents, Bookmarks and Search Results"
msgstr ""

#: src/constants.vala:43
msgid "Select an eBook to read"
msgstr ""

#: src/constants.vala:68
#: src/constants.vala:71
msgid "Select one or more books in library"
msgstr ""

#: src/constants.vala:81
#: src/constants.vala:85
msgid "Sepia theme"
msgstr ""

#: src/constants.vala:70
#: src/constants.vala:73
msgid "Set reading preferences"
msgstr ""

#: src/constants.vala:85
#: src/constants.vala:91
msgid "Turn on Night Mode"
msgstr ""

#: src/constants.vala:96
#: src/constants.vala:102
msgid "Unknown Book"
msgstr ""

Expand All @@ -221,6 +237,10 @@ msgstr ""
msgid "Update Title"
msgstr ""

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

#: src/constants.vala:35
msgid "Website"
msgstr ""
Expand Down
4 changes: 3 additions & 1 deletion src/bookworm.vala
Original file line number Diff line number Diff line change
Expand Up @@ -408,11 +408,13 @@ public class BookwormApp.Bookworm : Granite.Application {
aBook = renderPage(aBook, "");
}

public void updateLibraryViewFromDB(){
public async void updateLibraryViewFromDB(){
ArrayList<BookwormApp.Book> listOfBooks = BookwormApp.DB.getBooksFromDB();
foreach (BookwormApp.Book book in listOfBooks){
//add the book to the UI
BookwormApp.Library.updateLibraryView(book);
Idle.add (updateLibraryViewFromDB.callback);
yield;
}
}

Expand Down
6 changes: 6 additions & 0 deletions src/constants.vala
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ namespace BookwormApp.Constants {
public const string TEXT_FOR_BOOK_CONTEXTMENU_UPDATE_TAGS = _("Update Tags");
public const string TEXT_FOR_BOOK_CONTEXTMENU_UPDATE_AUTHOR = _("Update Author");
public const string TEXT_FOR_BOOK_CONTEXTMENU_UPDATE_COVER = _("Update Cover Image");
public const string TEXT_FOR_PAGE_CONTEXTMENU_FULL_SCREEN_ENTRY = _("Enter full screen view");
public const string TEXT_FOR_PAGE_CONTEXTMENU_FULL_SCREEN_EXIT = _("Exit full screen view");
public const string TEXT_FOR_PAGE_CONTEXTMENU_WORD_MEANING = _("Check Word Meaning");

public const string TOOLTIP_TEXT_FOR_ADD_BOOK = _("Add books to library");
public const string TOOLTIP_TEXT_FOR_REMOVE_BOOK = _("Remove selected books from library (eBook file will not be deleted)");
Expand All @@ -76,9 +79,12 @@ 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_UPDATING_COVER_IMAGE = _("Update cover image");
public const string TOOLTIP_TEXT_FOR_LIGHT_MODE = _("Light theme");
public const string TOOLTIP_TEXT_FOR_DARK_MODE = _("Dark theme");
public const string TOOLTIP_TEXT_FOR_SEPIA_MODE = _("Sepia theme");
public const string TOOLTIP_TEXT_FOR_PAGE_CONTEXTMENU_FULL_SCREEN_ENTRY = _("Enter full screen view and Esc key to exit");
public const string TOOLTIP_TEXT_FOR_PAGE_CONTEXTMENU_FULL_SCREEN_EXIT = _("Enter full screen view and Esc key to exit");


public const string TEXT_FOR_PREFERENCES_DIALOG_TITLE = _("Preferences");
Expand Down
1 change: 1 addition & 0 deletions src/dialog.vala
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class BookwormApp.AppDialog : Gtk.Dialog {
Gtk.Button updateCoverImageButton = new Gtk.Button ();
updateCoverImageButton.set_image (updateImageIcon);
updateCoverImageButton.set_relief (ReliefStyle.NONE);
updateCoverImageButton.set_tooltip_markup (BookwormApp.Constants.TOOLTIP_TEXT_FOR_UPDATING_COVER_IMAGE);
Gtk.Box updateCoverImageBox = new Gtk.Box (Orientation.HORIZONTAL, BookwormApp.Constants.SPACING_WIDGETS);
updateCoverImageBox.pack_start(updateCoverLabel,false, true, 0);
updateCoverImageBox.pack_start(updateCoverImageButton,false, true, 0);
Expand Down
46 changes: 43 additions & 3 deletions src/window.vala
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,41 @@ public class BookwormApp.AppWindow {
BookwormApp.Bookworm.removeSelectedBooksFromLibrary();
});
//handle context menu on the webview reader
aWebView.context_menu.connect (() => {
//TO-DO: Build context menu for reading ebook
return true;//stops webview default context menu from loading
aWebView.context_menu.connect ((context_menu, event, hit_test_result) => {
context_menu.remove_all();
Gtk.Action pageActionFullScreenEntry = new Gtk.Action ("FULL_SCREEN_READING_VIEW",
BookwormApp.Constants.TEXT_FOR_PAGE_CONTEXTMENU_FULL_SCREEN_ENTRY,
BookwormApp.Constants.TOOLTIP_TEXT_FOR_PAGE_CONTEXTMENU_FULL_SCREEN_ENTRY,
null);
Gtk.Action pageActionFullScreenExit = new Gtk.Action ("FULL_SCREEN_READING_VIEW",
BookwormApp.Constants.TEXT_FOR_PAGE_CONTEXTMENU_FULL_SCREEN_EXIT,
BookwormApp.Constants.TOOLTIP_TEXT_FOR_PAGE_CONTEXTMENU_FULL_SCREEN_EXIT,
null);
Gtk.Action pageActionWordMeaning = new Gtk.Action ("WORD_MEANING",
BookwormApp.Constants.TEXT_FOR_PAGE_CONTEXTMENU_WORD_MEANING,
null,
null);
pageActionWordMeaning.set_sensitive(false); //TODO: Implement word meaning
WebKit.ContextMenuItem pageContextMenuItemWordMeaning = new WebKit.ContextMenuItem (pageActionWordMeaning);
WebKit.ContextMenuItem pageContextMenuItemFullScreenEntry = new WebKit.ContextMenuItem (pageActionFullScreenEntry);
WebKit.ContextMenuItem pageContextMenuItemFullScreenExit = new WebKit.ContextMenuItem (pageActionFullScreenExit);
context_menu.append(pageContextMenuItemWordMeaning);
if(book_reading_footer_box.get_visible()){
context_menu.append(pageContextMenuItemFullScreenEntry);
}else{
context_menu.append(pageContextMenuItemFullScreenExit);
}

//Set Context menu items
pageActionFullScreenEntry.activate.connect (() => {
book_reading_footer_box.hide();
BookwormApp.Bookworm.window.fullscreen();
});
pageActionFullScreenExit.activate.connect (() => {
book_reading_footer_box.show();
BookwormApp.Bookworm.window.unfullscreen();
});
return false;
});
//capture key press events on the webview reader
aWebView.key_press_event.connect ((ev) => {
Expand All @@ -243,6 +275,14 @@ public class BookwormApp.AppWindow {
//update book details to libraryView Map
BookwormApp.Bookworm.libraryViewMap.set(aBookRightKeyPress.getBookLocation(), aBookRightKeyPress);
}
if (ev.keyval == Gdk.Key.Escape) {// Escape key pressed, remove full screen
book_reading_footer_box.show();
BookwormApp.Bookworm.window.unfullscreen();
}
if (ev.keyval == Gdk.Key.F11) {// F11 key pressed, enter or remove full screen
book_reading_footer_box.hide();
BookwormApp.Bookworm.window.fullscreen();
}
return false;
});

Expand Down

0 comments on commit 7cb9fcb

Please sign in to comment.