summaryrefslogtreecommitdiff
path: root/backend/epub/epub-document.c
AgeCommit message (Collapse)AuthorFilesLines
2015-12-17Fix crash for epubs when accessibility is enabledAndrey Gursky1-0/+11
Once epub support has been implemented, atril crashes with all epubs. Backtrace for 1.10.2+repack1-1 (Debian Stretch): Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7fffd26d2700 (LWP 22276)] 0x0000000000000000 in ?? () (gdb) bt #0 0x0000000000000000 in () #1 0x00007ffff755914e in ev_job_page_data_run (job=0x9e3850 [EvJobPageData]) at ev-jobs.c:762 #2 0x00007ffff755a85a in ev_job_thread_proxy (job=0x9e3850 [EvJobPageData]) at ev-job-scheduler.c:184 #3 0x00007ffff755a85a in ev_job_thread_proxy (data=<optimized out>) at ev-job-scheduler.c:217 #4 0x00007ffff14e1955 in g_thread_proxy (data=0x7fff84002280) at /build/glib2.0-VKSJTv/glib2.0-2.46.1/./glib/gthread.c:778 #5 0x00007ffff08690a4 in start_thread (arg=0x7fffd26d2700) at pthread_create.c:309 #6 0x00007ffff059e06d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111 (gdb) It turns out it couldn't really work since one function pointer is uninitialized. But nobody complained. Thus I investigated it further, why it fails only for me. First, I tried a gtk3 version. And it works properly, but the broken code is not hit at all. Due to the threaded design, it was harder to figure out, why. Here is the code path: --> ev_window_load_job_cb (shell/ev-window.c) --> ev_document_model_set_document (libview/ev-document-model.c) --> ev_view_document_changed_cb (libview/ev-view.c) --> setup_caches (libview/ev-view.c) --> if (ev_view_is_a11y_enabled (view)) { ev_page_cache_set_flags(); } ev_page_cache_set_flags (libview/ev-page-cache.c) --> ev_page_cache_set_page_range (libview/ev-page-cache.c) --> data->job = ev_job_page_data_new (cache->document, i, flags); ... ev_job_scheduler_push_job (data->job, EV_JOB_PRIORITY_NONE); ... --> ev_job_thread_proxy (libview/ev-job-scheduler.c) --> ev_job_page_data_run (libview/ev-jobs.c) --> ev_document_links_get_links (libdocument/ev-document-links.c) --> EvDocumentLinksInterface *iface = EV_DOCUMENT_LINKS_GET_IFACE (document_links); return iface->get_links (document_links, page); (get_links == NULL) --> crash As one can see it depends on the accessibility. And it is enabled on my box. It can be reproduced with gsettings set org.mate.interface accessibility true (mate logout and login) Why the enabled accessibility is not discovered by the gtk3 version is another story. My question [1] was motivated by this. [1] https://github.com/mate-desktop/atril/issues/171
2015-09-10epub: drop embedded MathJax in favor of using distro-packaged onemonsta1-2/+1
closes https://github.com/mate-desktop/atril/issues/158
2015-01-22fix careless hack: don't do double-free, avoid weird crashesMonsta1-2/+1
because backends manager frees that var already. actually, adding ev_backends_manager_get_backends_dir to the public API was still careless. backends manager and epub document jobs seem to be in the different threads, and there's no mutex seen anywhere around. luckily, what we have here is just a reading of a variable that has been assigned only once (in backends_dir function), so it's not as catastrophic as it would be if it was e.g. concurrent writing without a mutex. Closes https://github.com/mate-desktop/atril/pull/124
2014-12-29epub: Fix some typosinfirit1-2/+2
Thanks to tibbi <[email protected]> for spotting them.
2014-12-10fix some more leaks and stuffMonsta1-2/+2
2014-12-08don't leak memoryMonsta1-100/+125
2014-12-08removed some code that had no effectmonsta1-1/+0
2014-12-08epub backend: more anti-NULL protection for epub_document_set_index_pagesMonsta1-1/+4
2014-12-08ePub: Can open documents which do not have tocrootavish1-2/+15
I always thought all ePub documents had either a traditional ncx or an epub3 nav. Now as it turns out, sometimes neither of these are present. Fixed.
2014-12-08ePub backend: unescape uri strings from tocrootavish1-0/+6
Toc may include links with strings escaped for URI format. We needed to un-escape them.
2014-11-25properly return a value from non-void functionmonsta1-2/+2
2014-08-19Mathjax Supportrootavish1-1/+78
The Mathjax files will be installed to $(backenddir)/epub/MathJax This was as small as the install got.
2014-08-17Added epub3 navsheetsrootavish1-21/+174
I came across a document that didn't have an old style toc, and thus the all accomodating navsheet support. Also fixed some mistakes here and there.
2014-08-14Tweaked the inverted colors,shell Makefilerootavish1-4/+19
Tweaked the way we handle inverted colors so that documents with no "day" class tag fr their primary stylesheets can revert back to these stylesheets when prompted, the inverted colors run into problems on document reload, this needs to be fixed. Other than that I removed the webkit flags and libs from shell/Makefile.am , they were there because at a very early stage of the project I had decided to use a webkit_web_view directly, then I ended up extending and using it in libview.
2014-08-14Inverted colors(night) viewing mode for ePubrootavish1-0/+135
Added the capability to view and epub document with inverted colors, yet to test for documents where we write the stylesheet, although the code is there.
2014-08-09GTK3, Webkit2 support for epubrootavish1-1/+4
I added the code to make it possible to build Atril with GTK3 and webkit2. Everything runs fine with both GTK3 and GTK2. The find module for epub was also tested and changed. Now I shall first attempt to fix some Glib errors, and the problem of the temporary directory not getting deleted, that arose when I stabilized the thumbnails.
2014-08-06Searching in epub documentsrootavish1-34/+58
I added the capability to search through documents. The search is quite buggy, and we'll be taking care of each bug one at a time.
2014-08-03Table of contents(index) for epubrootavish1-111/+361
The documents can finally be read alongside a TOC, I tested it with a variety of documents before this commit, so I presume it should work with all. Also fixed the part where I had screwed up PDF annotations owing to a wrong call. In the next commit, fully functional searching would be up, using HTML parser of libxml in combination with webkit. Also some other minor changes.
2014-07-29Searching single pages in epubrootavish1-53/+85
..and other fixing other bugs that were present once the webview was added, like the escape key command etc. Will look to refactor the thumbnails into ev-web-view.c. In the next commit I'll extend this search over the entire document.Also will incorporate document index(table of contents).
2014-07-25Fixing dispose functions, display in webviewrootavish1-1/+4
Fixed the backend epub_document_finalize function which was caused caja to crash when you opened the document properties dialog. Fixed the ev_window_dispose and the webview's dispose and finalise functions, now the window closes without any glib-critical errors. Also now it is possible to read epub documents, once you have changed pages at least once, I still have to figure out where I call load_uri at document load.
2014-07-20Active properties dialog, other actionsrootavish1-3/+15
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.
2014-07-19Moving all webkit tasks to main loop jobsrootavish1-28/+0
2014-07-19Thumbnails for all documentsrootavish1-92/+85
Now other problems with webkit. After much fidgeting I was able to resolve the previous problems of threads. However, now there is a different webkit error.
2014-07-11Fixing the extraction problemrootavish1-14/+39
Due to the no fixed guidelines on how content in an ePub file should be arranged, in many cases,in files with content in subdirectories could not be extracted as those cases were not covered. The new code should not leave any corner cases.
2014-07-10Files for EvWebView, thumbnails possible with GTK+-2.0rootavish1-26/+54
My last commit was supposed to have ev-web-view.c and ev-web-view.h however due to some reason I missed them last time, so here they are now. i am able to achieve thumbnails for my epub however these are of absurdly large size. Still struggling to get the webview done due to thread problems that I am encountering.
2014-07-07Refactored code, created a new EvWebView typerootavish1-14/+84
Earlier my approach was to replace the atril view directly with a webview. However as it turned out it was extremely difficult to accomplish much tasks without the document-model. So I created an Extension of the WebKitWebView class, EvWebView so that now we can manipulate the webview as desired. Also having a separate file really helps in terms of clarity. Please note that there are many empty functions and TODO tags right now, I shall aim to fill these up once the display part is done, probably in this week. I also added some code on the backend to draw thumbnails when with GTK+-3.0, although I have never tested a GTK+-3.0 build.With GTK+-2.0 you won't get any build errors, however epub backend won't work right now. That being said, this commit is mostly because there was a lot of code that was lying in the local repository, and it was best to back it up as a failsafe. I modified ev-window to accomodate this new data structure, and having an equivalent ev_web_view function for every ev_view function, I can achieve most functionality by filling those functions with Webkit modules. Other than that on the backend Other than that there were some minor changes to the code. Although I did the above, currently I am not able to instantiate the EvWebView because of some class and object type definition errors, due to which I can't display the document.
2014-07-04Thumbnails for Epub Documentsrootavish1-35/+29
This commit is mainly so that any further changes can be reverted to this state. The thumbnails are of very large sizes so I need to fix that, and in general implement thumbnails. Also I am facing an X-windows error, which I can't seem to fix. I feel it may be a problem with webkit-1.0, so will try the build with gtk3 and webkit2. If so is the case, I'll have to work something out for that. Should be able to push a commit soon where the document can actually be read, soon as I figure out the perfect place for the call to load uri. Other than that more function were modified in accordance with webkit. The error I get when opening the file from the filechooser still persists, I need to fix that too.
2014-07-01More changes to accomodate webviewrootavish1-10/+10
- Modified configure.ac to use both webkit2 and webkit1 based on gtk version - Modified Automake file in help/reference/shell/Makefile.am to compile with gtk-doc - Modified ev-document-model to support epub-documents. - Modified ev-window for epub documents. - Modified jobs so epub pages are not rendered. - Modified ev-document, although I'm not sure if this is necessary. Still need to figure out where the web view load uri has to be called to actually load pages, from there the puzzle would be much simpler. Hope to get this done in the week, and pick up the pace now that only six weeks of coding remain before final evaluation.
2014-06-23Functions for document info and EvPage,other changesrootavish1-27/+121
Summary: I added functions in the backend to get document info. Added a member to evdocument to deal with web documents(ePub) on the frontend. Added a webview to the window, that shall replace the Atril view. Due to removing the view from the main Atril window, I have given rise to various GTK-critical errors in response to signals, will be sure to suppress these in the next commit. Worked towards overall blending in of ePub documents.
2014-06-21Changed dependecy to webkit-1.0,added web view to window propertiesrootavish1-129/+374
Currently the backend/epub/epub-document.c file has some dummy code, such as that for thumbnails, solely to get it to build. Now that we are done with all functions that we would possibly need to handle the backend, I am now working now on displaying the document via a webview, starting with this commit where i add a webview to the EvWindow properties. Similar to this I need to put in custom functions for epub, as rendering is done by the layout engine. I will also need to add some epub specific callback functions to the widgets.
2014-06-07Redefined most XML parsing functions,more helpersrootavish1-48/+366
This commit as compared to previous ones has much more changes as: > The xml parsing functions were not generic enough to my needs and needed to be redefined as well as renamed . > I also set up the document tree for the document using these parsers.All that is now left is to serve these to a webview. > Fixed a typo in epub-document.h TODO: integrate with Atril frontend.
2014-05-30Created a Makefile for minizip, modified epub Makefilerootavish1-0/+1
I created a Makefile for the minizip backend, since i am only using part of that library and modified the epub backend to work with the library. Also modified the configure script to suit our purpose. The epub backend can now be compiled using the make command in the epub directory, although it cannot still be compiled as a part of atril.
2014-05-30created a separate directory for minizip content, fixed indentation in ↵rootavish1-1/+1
configure.ac Moved ioapi.c unzip.c unzip.h and ioapi.h into a separate directory backend/epub/minizip Fixed an indentation problem in configure.ac, which was affecting the displayed result. Also fixed a typo in epub-document.h where i had wrongly named the function.
2014-05-30Added functions to extract epub archive,fixed headerrootavish1-13/+215
In this commit i added functionality to extract an epub archive to a temporary location.Again i tried to keep the design modular. This will be changed as changes come along. I also fixed the header to the standard atril backend header. Performed some code cleaning, naming functions as in the atril style of coding.
2014-05-24XML parsing for ePubrootavish1-0/+125
using libxml some functions were written which will be used to get keywords,attributes from files such as the ePub container.tried to keep the code generalised so as to facilitate reusability of code.