From 46fce038996fa84784df775d0b2e941228388b66 Mon Sep 17 00:00:00 2001 From: rootavish Date: Sat, 19 Jul 2014 10:47:43 +0530 Subject: Thumbnails for all documents 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. --- libview/ev-jobs.h | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'libview/ev-jobs.h') diff --git a/libview/ev-jobs.h b/libview/ev-jobs.h index e6ae4552..8924a129 100644 --- a/libview/ev-jobs.h +++ b/libview/ev-jobs.h @@ -45,6 +45,9 @@ typedef struct _EvJobPageDataClass EvJobPageDataClass; typedef struct _EvJobThumbnail EvJobThumbnail; typedef struct _EvJobThumbnailClass EvJobThumbnailClass; +typedef struct _EvJobWebThumbnail EvJobWebThumbnail; +typedef struct _EvJobWebThumbnailClass EvJobWebThumbnailClass; + typedef struct _EvJobLinks EvJobLinks; typedef struct _EvJobLinksClass EvJobLinksClass; @@ -111,6 +114,11 @@ typedef struct _EvJobPrintClass EvJobPrintClass; #define EV_JOB_THUMBNAIL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), EV_TYPE_JOB_THUMBNAIL, EvJobThumbnailClass)) #define EV_IS_JOB_THUMBNAIL(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), EV_TYPE_JOB_THUMBNAIL)) +#define EV_TYPE_JOB_WEB_THUMBNAIL (ev_job_web_thumbnail_get_type()) +#define EV_JOB_WEB_THUMBNAIL(object) (G_TYPE_CHECK_INSTANCE_CAST((object), EV_TYPE_JOB_WEB_THUMBNAIL, EvJobWebThumbnail)) +#define EV_JOB_WEB_THUMBNAIL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), EV_TYPE_JOB_WEB_THUMBNAIL, EvJobWebThumbnailClass)) +#define EV_IS_JOB_WEB_THUMBNAIL(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), EV_TYPE_JOB_WEB_THUMBNAIL)) + #define EV_TYPE_JOB_FONTS (ev_job_fonts_get_type()) #define EV_JOB_FONTS(object) (G_TYPE_CHECK_INSTANCE_CAST((object), EV_TYPE_JOB_FONTS, EvJobFonts)) #define EV_JOB_FONTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), EV_TYPE_JOB_FONTS, EvJobFontsClass)) @@ -281,11 +289,9 @@ struct _EvJobPageDataClass struct _EvJobThumbnail { EvJob parent; - gint page; gint rotation; gdouble scale; - GdkPixbuf *thumbnail; }; @@ -294,6 +300,20 @@ struct _EvJobThumbnailClass EvJobClass parent_class; }; +struct _EvJobWebThumbnail +{ + EvJob parent; + GtkWidget *webview; + GtkWidget *offscreenwindow; + gboolean *completed; + cairo_surface_t *surface; +}; + +struct _EvJobWebThumbnailClass +{ + EvJobClass parent_class; +}; + struct _EvJobFonts { EvJob parent; @@ -450,6 +470,12 @@ EvJob *ev_job_thumbnail_new (EvDocument *document, gint page, gint rotation, gdouble scale); + +/* EvJobWebThumbnail */ +GType ev_job_web_thumbnail_get_type (void) G_GNUC_CONST; +EvJob *ev_job_web_thumbnail_new (EvDocument *document, + GtkWidget *webview, + gboolean *completed); /* EvJobFonts */ GType ev_job_fonts_get_type (void) G_GNUC_CONST; EvJob *ev_job_fonts_new (EvDocument *document); -- cgit v1.2.1 From e0535b0e61cc56ec62d32518c03a42836f5256e6 Mon Sep 17 00:00:00 2001 From: rootavish Date: Sat, 19 Jul 2014 22:18:40 +0530 Subject: Moving all webkit tasks to main loop jobs --- libview/ev-jobs.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libview/ev-jobs.h') diff --git a/libview/ev-jobs.h b/libview/ev-jobs.h index 8924a129..a45891b6 100644 --- a/libview/ev-jobs.h +++ b/libview/ev-jobs.h @@ -307,6 +307,7 @@ struct _EvJobWebThumbnail GtkWidget *offscreenwindow; gboolean *completed; cairo_surface_t *surface; + gchar* page; }; struct _EvJobWebThumbnailClass @@ -474,8 +475,9 @@ EvJob *ev_job_thumbnail_new (EvDocument *document, /* EvJobWebThumbnail */ GType ev_job_web_thumbnail_get_type (void) G_GNUC_CONST; EvJob *ev_job_web_thumbnail_new (EvDocument *document, + gboolean *completed, GtkWidget *webview, - gboolean *completed); + gchar *webpage); /* EvJobFonts */ GType ev_job_fonts_get_type (void) G_GNUC_CONST; EvJob *ev_job_fonts_new (EvDocument *document); -- cgit v1.2.1 From c8b63e55987f0ee6d4067a7309ef2fac8119b0cc Mon Sep 17 00:00:00 2001 From: rootavish Date: Sun, 20 Jul 2014 23:57:08 +0530 Subject: Moving everything related to webkit to main thread jobs Including creation of windows, webviews etc., still get a crash. The one page epub works fine with the thumbnails though. Also fixing some calls which cause gtk-critical errors when I try to close the window. --- libview/ev-jobs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libview/ev-jobs.h') diff --git a/libview/ev-jobs.h b/libview/ev-jobs.h index a45891b6..ded0f05f 100644 --- a/libview/ev-jobs.h +++ b/libview/ev-jobs.h @@ -306,6 +306,7 @@ struct _EvJobWebThumbnail GtkWidget *webview; GtkWidget *offscreenwindow; gboolean *completed; + GRWLock screenlock; cairo_surface_t *surface; gchar* page; }; @@ -476,7 +477,6 @@ EvJob *ev_job_thumbnail_new (EvDocument *document, GType ev_job_web_thumbnail_get_type (void) G_GNUC_CONST; EvJob *ev_job_web_thumbnail_new (EvDocument *document, gboolean *completed, - GtkWidget *webview, gchar *webpage); /* EvJobFonts */ GType ev_job_fonts_get_type (void) G_GNUC_CONST; -- cgit v1.2.1 From 529473758fee66ac2fb0f2c89e4298789d183d5b Mon Sep 17 00:00:00 2001 From: rootavish Date: Mon, 21 Jul 2014 23:49:08 +0530 Subject: Thumbnails working for all epub documents. Passes the test with a 71 page epub, I don't think it would have much problems were we to scale it further. --- libview/ev-jobs.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'libview/ev-jobs.h') diff --git a/libview/ev-jobs.h b/libview/ev-jobs.h index ded0f05f..39fa4433 100644 --- a/libview/ev-jobs.h +++ b/libview/ev-jobs.h @@ -307,7 +307,7 @@ struct _EvJobWebThumbnail GtkWidget *offscreenwindow; gboolean *completed; GRWLock screenlock; - cairo_surface_t *surface; + cairo_surface_t **surface; gchar* page; }; @@ -477,7 +477,8 @@ EvJob *ev_job_thumbnail_new (EvDocument *document, GType ev_job_web_thumbnail_get_type (void) G_GNUC_CONST; EvJob *ev_job_web_thumbnail_new (EvDocument *document, gboolean *completed, - gchar *webpage); + gchar *webpage, + cairo_surface_t **surface); /* EvJobFonts */ GType ev_job_fonts_get_type (void) G_GNUC_CONST; EvJob *ev_job_fonts_new (EvDocument *document); -- cgit v1.2.1 From 60b002aab6c2ee610377d46208ee16dda1e94fc3 Mon Sep 17 00:00:00 2001 From: rootavish Date: Tue, 29 Jul 2014 19:57:02 +0530 Subject: Searching single pages in epub ..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). --- libview/ev-jobs.h | 1 + 1 file changed, 1 insertion(+) (limited to 'libview/ev-jobs.h') diff --git a/libview/ev-jobs.h b/libview/ev-jobs.h index 39fa4433..87365672 100644 --- a/libview/ev-jobs.h +++ b/libview/ev-jobs.h @@ -365,6 +365,7 @@ struct _EvJobFind gint current_page; gint n_pages; GList **pages; + guint *results; gchar *text; gboolean case_sensitive; gboolean has_results; -- cgit v1.2.1 From 683022d92b63bea1544e8d19bc57d47ef84f5fff Mon Sep 17 00:00:00 2001 From: rootavish Date: Wed, 6 Aug 2014 17:22:34 +0530 Subject: Redesigned the thumbnail code for ePub No more crashes when searching with the sidebar open, will probably add a pixbuf cache as well to speed it up even further. The process which I earlier thought was not possible without separate jobs, work just fine as a single job, if I change the run mode of the thumbnail job, and incorporate a trylock() in case of epub. --- libview/ev-jobs.h | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) (limited to 'libview/ev-jobs.h') diff --git a/libview/ev-jobs.h b/libview/ev-jobs.h index 87365672..fdc23bae 100644 --- a/libview/ev-jobs.h +++ b/libview/ev-jobs.h @@ -292,6 +292,7 @@ struct _EvJobThumbnail gint page; gint rotation; gdouble scale; + cairo_surface_t *surface; GdkPixbuf *thumbnail; }; @@ -300,22 +301,6 @@ struct _EvJobThumbnailClass EvJobClass parent_class; }; -struct _EvJobWebThumbnail -{ - EvJob parent; - GtkWidget *webview; - GtkWidget *offscreenwindow; - gboolean *completed; - GRWLock screenlock; - cairo_surface_t **surface; - gchar* page; -}; - -struct _EvJobWebThumbnailClass -{ - EvJobClass parent_class; -}; - struct _EvJobFonts { EvJob parent; @@ -474,12 +459,6 @@ EvJob *ev_job_thumbnail_new (EvDocument *document, gint rotation, gdouble scale); -/* EvJobWebThumbnail */ -GType ev_job_web_thumbnail_get_type (void) G_GNUC_CONST; -EvJob *ev_job_web_thumbnail_new (EvDocument *document, - gboolean *completed, - gchar *webpage, - cairo_surface_t **surface); /* EvJobFonts */ GType ev_job_fonts_get_type (void) G_GNUC_CONST; EvJob *ev_job_fonts_new (EvDocument *document); -- cgit v1.2.1