diff options
author | rootavish <[email protected]> | 2014-07-20 16:08:07 +0530 |
---|---|---|
committer | rootavish <[email protected]> | 2014-07-20 16:08:07 +0530 |
commit | 4a3ac19d1365cb87a31eecea4759484673fad667 (patch) | |
tree | 3aeb0f092e04fc18445ced4757d1944352cb636a | |
parent | e0535b0e61cc56ec62d32518c03a42836f5256e6 (diff) | |
download | atril-4a3ac19d1365cb87a31eecea4759484673fad667.tar.bz2 atril-4a3ac19d1365cb87a31eecea4759484673fad667.tar.xz |
Active properties dialog, other actions
Properties dialog for epub documents, will some basic properties.
Also set toolbar and menu sensitivity for the actions available in epub, will add more(find) once I write the module. Also inverted colors needs to be done with CSS or the like.
-rw-r--r-- | backend/epub/epub-document.c | 18 | ||||
-rw-r--r-- | libview/ev-jobs.c | 2 | ||||
-rw-r--r-- | libview/ev-web-view.c | 6 | ||||
-rw-r--r-- | libview/ev-web-view.h | 3 | ||||
-rw-r--r-- | shell/ev-window.c | 25 |
5 files changed, 42 insertions, 12 deletions
diff --git a/backend/epub/epub-document.c b/backend/epub/epub-document.c index 51a13d9a..0801c3ab 100644 --- a/backend/epub/epub-document.c +++ b/backend/epub/epub-document.c @@ -989,7 +989,17 @@ epub_document_get_info(EvDocument *document) return NULL ; } EvDocumentInfo* epubinfo = g_new0 (EvDocumentInfo, 1); - + + epubinfo->fields_mask = EV_DOCUMENT_INFO_TITLE | + EV_DOCUMENT_INFO_FORMAT | + EV_DOCUMENT_INFO_AUTHOR | + EV_DOCUMENT_INFO_SUBJECT | + EV_DOCUMENT_INFO_KEYWORDS | + EV_DOCUMENT_INFO_LAYOUT | + EV_DOCUMENT_INFO_CREATOR | + EV_DOCUMENT_INFO_LINEARIZED | + EV_DOCUMENT_INFO_N_PAGES ; + if ( xmldocument != NULL ) xml_free_doc(); @@ -1024,8 +1034,7 @@ epub_document_get_info(EvDocument *document) epubinfo->format = g_strdup(buffer->str); /*FIXME: Add more of these as you write the corresponding modules*/ - epubinfo->permissions = EV_DOCUMENT_PERMISSIONS_OK_TO_ADD_NOTES; - + epubinfo->layout = EV_DOCUMENT_LAYOUT_SINGLE_PAGE; metanode = xml_get_pointer_to_node((xmlChar*)"publisher",NULL,NULL); @@ -1034,6 +1043,9 @@ epub_document_get_info(EvDocument *document) else epubinfo->creator = (char*)xml_get_data_from_node(metanode,XML_KEYWORD,NULL); + /* number of pages */ + epubinfo->n_pages = epub_document_get_n_pages(document); + /*TODO : Add a function to get date*/ g_free(uri); g_string_free(containerpath,TRUE); diff --git a/libview/ev-jobs.c b/libview/ev-jobs.c index 4596b58a..44881516 100644 --- a/libview/ev-jobs.c +++ b/libview/ev-jobs.c @@ -968,7 +968,7 @@ ev_job_web_thumbnail_new (EvDocument *document, { EvJobWebThumbnail *job; - ev_debug_message (DEBUG_JOBS, "%d", page); + ev_debug_message (DEBUG_JOBS, "%s", webpage); job = g_object_new (EV_TYPE_JOB_WEB_THUMBNAIL, NULL); diff --git a/libview/ev-web-view.c b/libview/ev-web-view.c index b88d09ff..136e1e96 100644 --- a/libview/ev-web-view.c +++ b/libview/ev-web-view.c @@ -353,3 +353,9 @@ ev_web_view_find_previous(EvWebView *webview) { } + +gboolean +ev_web_view_get_has_selection(EvWebView *webview) +{ + return webkit_web_view_has_selection(WEBKIT_WEB_VIEW(webview)); +}
\ No newline at end of file diff --git a/libview/ev-web-view.h b/libview/ev-web-view.h index 55736871..19d6c8a1 100644 --- a/libview/ev-web-view.h +++ b/libview/ev-web-view.h @@ -62,6 +62,9 @@ void ev_web_view_handle_link (EvWebView *webview, EvLink* link); void ev_web_view_find_next (EvWebView *webview); void ev_web_view_find_previous (EvWebView *webview); +/*Selection*/ +gboolean ev_web_view_get_has_selection (EvWebView *webview); + G_END_DECLS #endif /* __EV_WEB_VIEW_H__ */ diff --git a/shell/ev-window.c b/shell/ev-window.c index 5c18b28c..3fcf3786 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -408,7 +408,9 @@ ev_window_setup_action_sensitivity (EvWindow *ev_window) if (has_document && EV_IS_SELECTION (document)) { can_get_text = TRUE; } - + else if (has_document && document->iswebdocument) { + can_get_text = TRUE; + } if (has_pages && EV_IS_DOCUMENT_FIND (document)) { can_find = TRUE; } @@ -447,18 +449,20 @@ ev_window_setup_action_sensitivity (EvWindow *ev_window) ev_window_set_action_sensitive (ev_window, "EditSelectAll", has_pages && can_get_text); ev_window_set_action_sensitive (ev_window, "EditFind", can_find); ev_window_set_action_sensitive (ev_window, "Slash", can_find); - ev_window_set_action_sensitive (ev_window, "EditRotateLeft", has_pages); - ev_window_set_action_sensitive (ev_window, "EditRotateRight", has_pages); + ev_window_set_action_sensitive (ev_window, "EditRotateLeft", has_pages && !(document->iswebdocument)); + ev_window_set_action_sensitive (ev_window, "EditRotateRight", has_pages && !(document->iswebdocument)); /* View menu */ - ev_window_set_action_sensitive (ev_window, "ViewContinuous", has_pages); - ev_window_set_action_sensitive (ev_window, "ViewDual", has_pages); - ev_window_set_action_sensitive (ev_window, "ViewBestFit", has_pages); + /*If it has pages it is a document, so our check for a webdocument lead to a crash. We need to switch these off since more than one + *webview is hard to manage */ + ev_window_set_action_sensitive (ev_window, "ViewContinuous", has_pages && !(document->iswebdocument)); + ev_window_set_action_sensitive (ev_window, "ViewDual", has_pages && !(document->iswebdocument)); + ev_window_set_action_sensitive (ev_window, "ViewBestFit", has_pages && !(document->iswebdocument)); ev_window_set_action_sensitive (ev_window, "ViewPageWidth", has_pages); ev_window_set_action_sensitive (ev_window, "ViewReload", has_pages); - ev_window_set_action_sensitive (ev_window, "ViewAutoscroll", has_pages); + ev_window_set_action_sensitive (ev_window, "ViewAutoscroll", has_pages && !(document->iswebdocument)); ev_window_set_action_sensitive (ev_window, "ViewInvertedColors", has_pages); - ev_window_set_action_sensitive (ev_window, "ViewExpandWindow", has_pages); + ev_window_set_action_sensitive (ev_window, "ViewExpandWindow", has_pages && !(document->iswebdocument)); /* Toolbar-specific actions: */ ev_window_set_action_sensitive (ev_window, PAGE_SELECTOR_ACTION, has_pages); @@ -499,6 +503,11 @@ ev_window_update_actions (EvWindow *ev_window) has_pages && ev_view_get_has_selection (view)); } + else if(webview) { + ev_window_set_action_sensitive (ev_window, "EditCopy", + has_pages && + ev_web_view_get_has_selection (webview)); + } ev_window_set_action_sensitive (ev_window, "EditFindNext", has_pages && can_find_in_page); ev_window_set_action_sensitive (ev_window, "EditFindPrevious", |