summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend/epub/epub-document.c138
-rw-r--r--backend/epub/epub-document.h1
-rw-r--r--libdocument/ev-document-find.c9
-rw-r--r--libdocument/ev-document-find.h9
-rw-r--r--libview/ev-document-model.c11
-rw-r--r--libview/ev-jobs.c40
-rw-r--r--libview/ev-jobs.h1
-rw-r--r--libview/ev-web-view.c117
-rw-r--r--libview/ev-web-view.h27
-rw-r--r--shell/ev-window.c86
10 files changed, 330 insertions, 109 deletions
diff --git a/backend/epub/epub-document.c b/backend/epub/epub-document.c
index a107b710..56d7e67d 100644
--- a/backend/epub/epub-document.c
+++ b/backend/epub/epub-document.c
@@ -20,10 +20,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#include "ev-file-helpers.h"
#include "epub-document.h"
+#include "ev-file-helpers.h"
#include "unzip.h"
#include "ev-document-thumbnails.h"
+#include "ev-document-find.h"
#include "ev-document-misc.h"
#include <libxml/parser.h>
#include <libxml/xmlmemory.h>
@@ -40,6 +41,11 @@
#endif
#include <gtk/gtk.h>
+#include <stdio.h>
+
+/*For strcasestr()*/
+
+#include <string.h>
typedef enum _xmlParseReturnType
{
@@ -76,11 +82,14 @@ struct _EpubDocument
};
static void epub_document_document_thumbnails_iface_init (EvDocumentThumbnailsInterface *iface);
+static void epub_document_find_iface_init (EvDocumentFindInterface *iface);
EV_BACKEND_REGISTER_WITH_CODE (EpubDocument, epub_document,
{
EV_BACKEND_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_THUMBNAILS,
epub_document_document_thumbnails_iface_init);
+ EV_BACKEND_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_FIND,
+ epub_document_find_iface_init);
} );
static void
@@ -112,6 +121,50 @@ epub_document_thumbnails_get_thumbnail (EvDocumentThumbnails *document,
return thumbnailpix;
}
+static gboolean
+epub_document_check_hits(EvDocumentFind *document_find,
+ EvPage *page,
+ const gchar *text,
+ gboolean case_sensitive)
+{
+ gchar *filepath = g_filename_from_uri((gchar*)page->backend_page,NULL,NULL);
+ FILE *fp = fopen(filepath,"r");
+ GString *buffer;
+ gchar *found ;
+
+ while (!feof(fp)) {
+ gchar c;
+ gint pos=0;
+ buffer = g_string_sized_new (1024);
+
+ while ((c = fgetc(fp)) != '\n' && !feof(fp)) {
+ g_string_insert_c(buffer,pos++,c);
+ }
+
+ g_string_insert_c(buffer,pos,'\0');
+
+ if (case_sensitive) {
+ if ((found = strstr(buffer->str,text)) != NULL) {
+ g_string_free(buffer,TRUE);
+ fclose(fp);
+ return TRUE;
+ }
+ }
+ else {
+
+ if ( (found = strcasestr(buffer->str,text)) != NULL) {
+ g_string_free(buffer,TRUE);
+ fclose(fp);
+ return TRUE;
+ }
+ }
+ g_string_free(buffer,TRUE);
+ }
+
+ fclose(fp);
+ return FALSE;
+}
+
static void
epub_document_document_thumbnails_iface_init (EvDocumentThumbnailsInterface *iface)
{
@@ -119,6 +172,12 @@ epub_document_document_thumbnails_iface_init (EvDocumentThumbnailsInterface *ifa
iface->get_dimensions = epub_document_thumbnails_get_dimensions;
}
+static void
+epub_document_find_iface_init (EvDocumentFindInterface *iface)
+{
+ iface->check_for_hits = epub_document_check_hits;
+}
+
static gboolean
epub_document_save (EvDocument *document,
const char *uri,
@@ -139,53 +198,7 @@ epub_document_get_n_pages (EvDocument *document)
return g_list_length(epub_document->contentList);
}
-#if !GTK_CHECK_VERSION(3, 0, 0)
-#else /* The webkit2 code for GTK3 */
-
-static void
-snapshot_chain_cb(WebKitWebView *web_view,
- GAsyncResult* res,
- cairo_surface_t **surface)
-{
- GError * err = NULL ;
- *surface = webkit_web_view_get_snapshot_finish(WEBKIT_WEB_VIEW(web_view),res,&err);
- if ( err ) {
- surface = NULL ;
- }
-}
-
-static void
-webkit_render_cb(WebKitWebView *webview,
- WebKitLoadEvent load_status,
- cairo_surface_t **surface)
-{
- if ( load_status != WEBKIT_LOAD_FINISHED )
- return ;
-
- webkit_web_view_get_snapshot(webview,
- WEBKIT_SNAPSHOT_REGION_FULL_DOCUMENT,
- WEBKIT_SNAPSHOT_OPTIONS_INCLUDE_SELECTION_HIGHLIGHTING,
- NULL,
- (GAsyncReadyCallback)snapshot_chain_cb,
- surface);
-}
-
-{
- GtkWidget *offscreen_window = gtk_offscreen_window_new ();
- gtk_window_set_default_size(GTK_WINDOW(offscreen_window),800,600);
- GtkWidget* scroll_view = gtk_scrolled_window_new (NULL,NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(scroll_view),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC);
- GtkWidget* web_view = webkit_web_view_new ();
-
- gtk_container_add(GTK_CONTAINER(offscreen_window),scroll_view);
- gtk_container_add(GTK_CONTAINER(scroll_view),web_view);
-
- gtk_widget_show_all(offscreen_window);
- g_signal_connect(web_view,"load-changed",G_CALLBACK(webkit_render_cb),surface);
- return web_view ;
-}
-#endif
/**
* epub_remove_temporary_dir : Removes a directory recursively.
* This function is same as comics_remove_temporary_dir
@@ -431,8 +444,10 @@ static gboolean
check_mime_type(const gchar* uri,GError** error)
{
GError * err = NULL ;
- gchar* mimeFromFile = ev_file_get_mime_type(uri,FALSE,&err);
+ const gchar* mimeFromFile = ev_file_get_mime_type(uri,FALSE,&err);
+ gchar* mimetypes[] = {"application/epub+zip","application/x-booki+zip"};
+ int typecount = 2;
if ( !mimeFromFile )
{
if (err) {
@@ -446,12 +461,16 @@ check_mime_type(const gchar* uri,GError** error)
}
return FALSE;
}
- else if ( g_strcmp0(mimeFromFile, "application/epub+zip") == 0 )
- {
- return TRUE ;
- }
else
{
+ int i=0;
+ for (i=0; i < typecount ;i++) {
+ if ( g_strcmp0(mimeFromFile, mimetypes[i]) == 0 ) {
+ return TRUE;
+ }
+ }
+
+ /*We didn't find a match*/
g_set_error_literal (error,
EV_DOCUMENT_ERROR,
EV_DOCUMENT_ERROR_INVALID,
@@ -882,6 +901,18 @@ epub_document_init (EpubDocument *epub_document)
epub_document->documentdir = NULL;
}
+typedef struct _linknode {
+ guint page;
+ gchar *linktext;
+}linknode;
+
+static void
+setup_document_index(EpubDocument *epub_document,const gchar* contentUri)
+{
+ linknode *index;
+
+}
+
static gboolean
epub_document_load (EvDocument* document,
const char* uri,
@@ -906,6 +937,7 @@ epub_document_load (EvDocument* document,
g_propagate_error( error,err );
return FALSE;
}
+
/*FIXME : can this be different, ever?*/
containerpath = g_string_new(epub_document->tmp_archive_dir);
g_string_append_printf(containerpath,"/META-INF/container.xml");
@@ -952,7 +984,7 @@ epub_document_finalize (GObject *object)
}
if ( epub_document->contentList ) {
- g_list_free_full(epub_document->contentList,(GDestroyNotify)free_tree_nodes);
+ g_list_free_full(epub_document->contentList,(GDestroyNotify)free_tree_nodes);
epub_document->contentList = NULL;
}
if ( epub_document->tmp_archive_dir) {
diff --git a/backend/epub/epub-document.h b/backend/epub/epub-document.h
index c9fd760d..b1120ec7 100644
--- a/backend/epub/epub-document.h
+++ b/backend/epub/epub-document.h
@@ -1,6 +1,7 @@
#ifndef __EPUB_DOCUMENT_H__
#define __EPUB_DOCUMENT_H__
+#define _GNU_SOURCE
#include "ev-document.h"
G_BEGIN_DECLS
diff --git a/libdocument/ev-document-find.c b/libdocument/ev-document-find.c
index 0b5fac01..c22b913d 100644
--- a/libdocument/ev-document-find.c
+++ b/libdocument/ev-document-find.c
@@ -40,3 +40,12 @@ ev_document_find_find_text (EvDocumentFind *document_find,
return iface->find_text (document_find, page, text, case_sensitive);
}
+gboolean
+ev_document_find_check_for_hits(EvDocumentFind *document_find,
+ EvPage *page,
+ const gchar *text,
+ gboolean case_sensitive)
+{
+ EvDocumentFindInterface *iface = EV_DOCUMENT_FIND_GET_IFACE (document_find);
+ return iface->check_for_hits (document_find, page, text, case_sensitive);
+} \ No newline at end of file
diff --git a/libdocument/ev-document-find.h b/libdocument/ev-document-find.h
index 7fcf49c7..7fb5d22c 100644
--- a/libdocument/ev-document-find.h
+++ b/libdocument/ev-document-find.h
@@ -52,6 +52,11 @@ struct _EvDocumentFindInterface
EvPage *page,
const gchar *text,
gboolean case_sensitive);
+
+ gboolean (* check_for_hits)(EvDocumentFind *document_find,
+ EvPage *page,
+ const gchar *text,
+ gboolean case_sensitive);
};
GType ev_document_find_get_type (void) G_GNUC_CONST;
@@ -60,6 +65,10 @@ GList *ev_document_find_find_text (EvDocumentFind *document_find,
const gchar *text,
gboolean case_sensitive);
+gboolean ev_document_find_check_for_hits(EvDocumentFind *document_find,
+ EvPage *page,
+ const gchar *text,
+ gboolean case_sensitive);
G_END_DECLS
#endif /* EV_DOCUMENT_FIND_H */
diff --git a/libview/ev-document-model.c b/libview/ev-document-model.c
index 00ce782b..dbf0477f 100644
--- a/libview/ev-document-model.c
+++ b/libview/ev-document-model.c
@@ -106,15 +106,8 @@ ev_document_model_set_property (GObject *object,
ev_document_model_set_page (model, g_value_get_int (value));
break;
case PROP_ROTATION:
- {
- if ( model->document->iswebdocument == TRUE ) {
- model->rotation=0;
- }
- else {
- ev_document_model_set_rotation (model, g_value_get_int (value));
- }
- break;
- }
+ ev_document_model_set_rotation (model, g_value_get_int (value));
+ break;
case PROP_INVERTED_COLORS:
if ( model->document->iswebdocument == TRUE ) {
atril_web_document_set_inverted_colors(model,g_value_get_boolean(value));
diff --git a/libview/ev-jobs.c b/libview/ev-jobs.c
index 884baabc..155990e9 100644
--- a/libview/ev-jobs.c
+++ b/libview/ev-jobs.c
@@ -1349,6 +1349,10 @@ ev_job_find_dispose (GObject *object)
g_free (job->pages);
job->pages = NULL;
}
+
+ if (job->results) {
+ g_free(job->results);
+ }
(* G_OBJECT_CLASS (ev_job_find_parent_class)->dispose) (object);
}
@@ -1360,7 +1364,6 @@ ev_job_find_run (EvJob *job)
EvDocumentFind *find = EV_DOCUMENT_FIND (job->document);
EvPage *ev_page;
GList *matches;
-
ev_debug_message (DEBUG_JOBS, NULL);
/* Do not block the main loop */
@@ -1374,16 +1377,26 @@ ev_job_find_run (EvJob *job)
#endif
ev_page = ev_document_get_page (job->document, job_find->current_page);
- matches = ev_document_find_find_text (find, ev_page, job_find->text,
- job_find->case_sensitive);
+
+ if (job->document->iswebdocument) {
+ job_find->has_results = ev_document_find_check_for_hits(find, ev_page, job_find->text,
+ job_find->case_sensitive);
+ }else {
+ matches = ev_document_find_find_text (find, ev_page, job_find->text,
+ job_find->case_sensitive);
+ }
+
g_object_unref (ev_page);
ev_document_doc_mutex_unlock ();
- if (!job_find->has_results)
+ if (!job_find->has_results && !job->document->iswebdocument) {
job_find->has_results = (matches != NULL);
-
- job_find->pages[job_find->current_page] = matches;
+ }
+
+ if (job->document->iswebdocument == FALSE) {
+ job_find->pages[job_find->current_page] = matches;
+ }
g_signal_emit (job_find, job_find_signals[FIND_UPDATED], 0, job_find->current_page);
job_find->current_page = (job_find->current_page + 1) % job_find->n_pages;
@@ -1433,7 +1446,13 @@ ev_job_find_new (EvDocument *document,
job->start_page = start_page;
job->current_page = start_page;
job->n_pages = n_pages;
- job->pages = g_new0 (GList *, n_pages);
+
+ if (document->iswebdocument) {
+ job->results = g_malloc0 (sizeof(guint) *n_pages);
+ }
+ else {
+ job->pages = g_new0 (GList *, n_pages);
+ }
job->text = g_strdup (text);
job->case_sensitive = case_sensitive;
job->has_results = FALSE;
@@ -1445,7 +1464,12 @@ gint
ev_job_find_get_n_results (EvJobFind *job,
gint page)
{
- return g_list_length (job->pages[page]);
+ if (EV_JOB(job)->document->iswebdocument) {
+ return job->results[page];
+ }
+ else {
+ return g_list_length (job->pages[page]);
+ }
}
gdouble
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;
diff --git a/libview/ev-web-view.c b/libview/ev-web-view.c
index a1caba36..6b134a0c 100644
--- a/libview/ev-web-view.c
+++ b/libview/ev-web-view.c
@@ -31,11 +31,21 @@
#include "ev-web-view.h"
#include "ev-document-model.h"
+#include "ev-jobs.h"
#define EV_WEB_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EV_TYPE_WEB_VIEW, EvWebViewClass))
#define EV_IS_WEB_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EV_TYPE_WEB_VIEW))
#define EV_WEB_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EV_TYPE_WEB_VIEW, EvWebViewClass))
+typedef struct _SearchParams {
+ gboolean case_sensitive;
+ guint page_current;
+ gboolean search_jump;
+ gchar* search_string;
+ guint on_result;
+ guint n_results;
+}SearchParams;
+
struct _EvWebView
{
WebKitWebView web_view;
@@ -44,6 +54,7 @@ struct _EvWebView
gint current_page;
gboolean inverted_colors ;
gboolean fullscreen;
+ SearchParams *search;
};
struct _EvWebViewClass
@@ -116,8 +127,11 @@ ev_web_view_init (EvWebView *webview)
webview->current_page = 0;
- webview->fullscreen = FALSE;
+ webview->search = g_new0(SearchParams, 1);
+
+ webview->search->search_jump = TRUE ;
+ webview->fullscreen = FALSE;
}
static void
@@ -294,6 +308,7 @@ ev_web_view_next_page (EvWebView *webview)
if (page < n_pages) {
ev_document_model_set_page (webview->model, page);
EvPage *webpage = ev_document_get_page(webview->document,page);
+ webview->current_page = page ;
webkit_web_view_load_uri(WEBKIT_WEB_VIEW(webview),(gchar*)webpage->backend_page);
return TRUE;
} else if (page == n_pages) {
@@ -341,18 +356,116 @@ ev_web_view_handle_link(EvWebView *webview,EvLink *link)
}
+/* Searching */
void
ev_web_view_find_next(EvWebView *webview)
{
-
+ /*First search for the next item on the current page*/
+ webkit_web_view_search_text (WEBKIT_WEB_VIEW(webview),
+ webview->search->search_string,
+ webview->search->case_sensitive,
+ TRUE,
+ FALSE);
}
void
ev_web_view_find_previous(EvWebView *webview)
{
+ webkit_web_view_search_text (WEBKIT_WEB_VIEW(webview),
+ webview->search->search_string,
+ webview->search->case_sensitive,
+ FALSE,
+ TRUE);
+}
+
+void
+ev_web_view_find_set_highlight_search(EvWebView *webview, gboolean visible)
+{
+ webkit_web_view_set_highlight_text_matches(WEBKIT_WEB_VIEW(webview),visible);
+}
+typedef struct _FindCBStruct {
+ EvJobFind *job;
+ gint page;
+}FindCBStruct;
+
+static void
+find_page_change_cb(WebKitWebView *webview,
+ WebKitWebFrame *webframe,
+ FindCBStruct *findcbs)
+{
+ findcbs->job->results[findcbs->page] = webkit_web_view_mark_text_matches(WEBKIT_WEB_VIEW(webview),
+ findcbs->job->text,
+ findcbs->job->case_sensitive,
+ 0);
+ ev_web_view_find_set_highlight_search(webview, TRUE);
+
+ webkit_web_view_search_text (WEBKIT_WEB_VIEW(webview),
+ findcbs->job->text,
+ findcbs->job->case_sensitive,
+ TRUE,
+ FALSE);
+}
+void
+ev_web_view_find_changed(EvWebView *webview, gint page_found_on,EvJobFind *job)
+{
+ if (job->has_results == FALSE)
+ return;
+
+ if (webview->search->search_jump == TRUE) {
+
+ webview->search->on_result = 1;
+ webview->search->case_sensitive = job->case_sensitive;
+ webview->search->search_string = g_strdup(job->text);
+ webview->search->search_jump = FALSE;
+
+ if (page_found_on != webview->current_page) {
+ ev_web_view_change_page(webview, page_found_on);
+
+ FindCBStruct *findstruct = g_new0 (FindCBStruct, 1);
+ findstruct->job = job;
+ findstruct->page = page_found_on;
+
+ g_signal_connect(WEBKIT_WEB_VIEW(webview),"document-load-finished",G_CALLBACK(find_page_change_cb),findstruct);
+ }
+ else {
+ job->results[webview->current_page] = webkit_web_view_mark_text_matches(WEBKIT_WEB_VIEW(webview),
+ job->text,
+ job->case_sensitive,
+ 0);
+
+ ev_web_view_find_set_highlight_search(webview, TRUE);
+ }
+ }
+}
+
+void
+ev_web_view_find_search_changed(EvWebView *webview)
+{
+ ev_web_view_find_set_highlight_search(webview,FALSE);
+ webkit_web_view_unmark_text_matches (WEBKIT_WEB_VIEW(webview));
+ webview->search->search_jump = TRUE;
+}
+
+void
+ev_web_view_find_cancel(EvWebView *webview)
+{
+ ev_web_view_find_set_highlight_search(webview,FALSE);
+ webkit_web_view_unmark_text_matches (WEBKIT_WEB_VIEW(webview));
+}
+
+void
+ev_web_view_empty_search(EvWebView *webview)
+{
+ SearchParams *search = webview->search ;
+ search->case_sensitive = FALSE;
+ if (search->search_string)
+ g_free(search->search_string);
+ search->search_string = NULL;
+ search->search_jump = TRUE ;
}
+/* Selection */
gboolean
ev_web_view_get_has_selection(EvWebView *webview)
{
diff --git a/libview/ev-web-view.h b/libview/ev-web-view.h
index 2c920434..aa2d5492 100644
--- a/libview/ev-web-view.h
+++ b/libview/ev-web-view.h
@@ -28,7 +28,7 @@
#include <gtk/gtk.h>
#include <atril-document.h>
-
+#include "ev-jobs.h"
#include "ev-document-model.h"
#include <glib-object.h>
G_BEGIN_DECLS
@@ -44,30 +44,37 @@ typedef struct _EvWebViewClass EvWebViewClass;
GType ev_web_view_get_type (void) G_GNUC_CONST;
GtkWidget* ev_web_view_new (void);
+
void ev_web_view_set_model (EvWebView *webview,
EvDocumentModel *model);
-void ev_web_view_reload (EvWebView *webview);
-void
-ev_web_view_reload_page (EvWebView *webview,
+
+void ev_web_view_reload (EvWebView *webview);
+
+void ev_web_view_reload_page (EvWebView *webview,
gint page);
/* Navigation */
gboolean ev_web_view_next_page (EvWebView *webview);
gboolean ev_web_view_previous_page (EvWebView *webview);
-/*Sidebar links*/
+/* Sidebar links */
void ev_web_view_handle_link (EvWebView *webview, EvLink* link);
-/*Searching*/
-void ev_web_view_find_next (EvWebView *webview);
-void ev_web_view_find_previous (EvWebView *webview);
+/* Searching */
+void ev_web_view_find_next (EvWebView *webview);
+void ev_web_view_find_previous (EvWebView *webview);
+void ev_web_view_find_changed (EvWebView *webview, gint page_found_on,EvJobFind *job);
+void ev_web_view_find_search_changed (EvWebView *webview);
+void ev_web_view_find_cancel (EvWebView *webview);
+void ev_web_view_find_set_highlight_search (EvWebView *webview,gboolean visible);
+void ev_web_view_empty_search (EvWebView *webview);
-/*Selection*/
+/* Selection */
gboolean ev_web_view_get_has_selection (EvWebView *webview);
void ev_web_view_select_all (EvWebView *webview);
void ev_web_view_copy (EvWebView *webview);
-/*Zoom control*/
+/* Zoom control */
gboolean ev_web_view_zoom_in (EvWebView *webview);
gboolean ev_web_view_zoom_out (EvWebView *webview);
diff --git a/shell/ev-window.c b/shell/ev-window.c
index a59658f3..937b40d3 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -1493,6 +1493,7 @@ ev_window_set_document (EvWindow *ev_window, EvDocument *document)
}
else {
/*Since the document is not a webdocument might as well get rid of the webview now*/
+ g_object_ref_sink(ev_window->priv->webview);
g_object_unref(ev_window->priv->webview);
}
#endif
@@ -4490,14 +4491,19 @@ static void
ev_window_cmd_escape (GtkAction *action, EvWindow *window)
{
GtkWidget *widget;
- if ( window->priv->document->iswebdocument == FALSE ) return ;
- ev_view_autoscroll_stop (EV_VIEW (window->priv->view));
+
+ if (!window->priv->document->iswebdocument && window->priv->view)
+ ev_view_autoscroll_stop (EV_VIEW (window->priv->view));
widget = gtk_window_get_focus (GTK_WINDOW (window));
if (widget && gtk_widget_get_ancestor (widget, EGG_TYPE_FIND_BAR)) {
update_chrome_flag (window, EV_CHROME_FINDBAR, FALSE);
update_chrome_visibility (window);
- gtk_widget_grab_focus (window->priv->view);
+
+ if (window->priv->view)
+ gtk_widget_grab_focus (window->priv->view);
+ else
+ gtk_widget_grab_focus (window->priv->webview);
} else {
gboolean fullscreen;
@@ -4509,7 +4515,10 @@ ev_window_cmd_escape (GtkAction *action, EvWindow *window)
ev_window_stop_presentation (window, TRUE);
gtk_widget_grab_focus (window->priv->view);
} else {
- gtk_widget_grab_focus (window->priv->view);
+ if (window->priv->view)
+ gtk_widget_grab_focus (window->priv->view);
+ else
+ gtk_widget_grab_focus (window->priv->webview);
}
if (fullscreen && EV_WINDOW_IS_PRESENTATION (window))
@@ -5059,10 +5068,14 @@ ev_window_find_job_updated_cb (EvJobFind *job,
EvWindow *ev_window)
{
ev_window_update_actions (ev_window);
- if (ev_window->priv->document->iswebdocument == TRUE ) return ;
- ev_view_find_changed (EV_VIEW (ev_window->priv->view),
- ev_job_find_get_results (job),
- page);
+ if (ev_window->priv->document->iswebdocument == TRUE ) {
+ ev_web_view_find_changed(EV_WEB_VIEW(ev_window->priv->webview), page,job);
+ }
+ else {
+ ev_view_find_changed (EV_VIEW (ev_window->priv->view),
+ ev_job_find_get_results (job),
+ page);
+ }
ev_window_update_find_status_message (ev_window);
}
@@ -5088,24 +5101,34 @@ static void
find_bar_previous_cb (EggFindBar *find_bar,
EvWindow *ev_window)
{
- if (ev_window->priv->document->iswebdocument == TRUE ) return ;
- ev_view_find_previous (EV_VIEW (ev_window->priv->view));
+ if (ev_window->priv->document->iswebdocument == TRUE ) {
+ ev_web_view_find_previous(EV_WEB_VIEW(ev_window->priv->webview));
+ }else {
+ ev_view_find_previous (EV_VIEW (ev_window->priv->view));
+ }
}
static void
find_bar_next_cb (EggFindBar *find_bar,
EvWindow *ev_window)
{
- if (ev_window->priv->document->iswebdocument == TRUE ) return ;
- ev_view_find_next (EV_VIEW (ev_window->priv->view));
+ if (ev_window->priv->document->iswebdocument == TRUE ) {
+ ev_web_view_find_next(EV_WEB_VIEW(ev_window->priv->webview));
+ } else {
+ ev_view_find_next (EV_VIEW (ev_window->priv->view));
+ }
}
static void
find_bar_close_cb (EggFindBar *find_bar,
EvWindow *ev_window)
{
- if (ev_window->priv->document->iswebdocument == TRUE ) return ;
- ev_view_find_cancel (EV_VIEW (ev_window->priv->view));
+ if (ev_window->priv->document->iswebdocument == TRUE ) {
+ ev_web_view_find_cancel(EV_WEB_VIEW(ev_window->priv->webview));
+ }
+ else {
+ ev_view_find_cancel (EV_VIEW (ev_window->priv->view));
+ }
ev_window_clear_find_job (ev_window);
update_chrome_flag (ev_window, EV_CHROME_FINDBAR, FALSE);
update_chrome_visibility (ev_window);
@@ -5121,13 +5144,16 @@ find_bar_search_changed_cb (EggFindBar *find_bar,
if (!ev_window->priv->document || !EV_IS_DOCUMENT_FIND (ev_window->priv->document))
return;
- if (ev_window->priv->document->iswebdocument == TRUE ) return ;
+
/* Either the string or case sensitivity could have changed. */
case_sensitive = egg_find_bar_get_case_sensitive (find_bar);
search_string = egg_find_bar_get_search_string (find_bar);
- ev_view_find_search_changed (EV_VIEW (ev_window->priv->view));
-
+ if (ev_window->priv->document->iswebdocument) {
+ ev_web_view_find_search_changed(EV_WEB_VIEW(ev_window->priv->webview));
+ } else {
+ ev_view_find_search_changed (EV_VIEW (ev_window->priv->view));
+ }
ev_window_clear_find_job (ev_window);
if (search_string && search_string[0]) {
@@ -5136,6 +5162,7 @@ find_bar_search_changed_cb (EggFindBar *find_bar,
ev_document_get_n_pages (ev_window->priv->document),
search_string,
case_sensitive);
+
g_signal_connect (ev_window->priv->find_job, "finished",
G_CALLBACK (ev_window_find_job_finished_cb),
ev_window);
@@ -5147,7 +5174,11 @@ find_bar_search_changed_cb (EggFindBar *find_bar,
ev_window_update_actions (ev_window);
egg_find_bar_set_status_text (EGG_FIND_BAR (ev_window->priv->find_bar),
NULL);
- gtk_widget_queue_draw (GTK_WIDGET (ev_window->priv->view));
+ if (ev_window->priv->document->iswebdocument == TRUE) {
+ ev_web_view_empty_search(EV_WEB_VIEW(ev_window->priv->webview));
+ } else {
+ gtk_widget_queue_draw (GTK_WIDGET (ev_window->priv->view));
+ }
}
}
@@ -5157,13 +5188,20 @@ find_bar_visibility_changed_cb (EggFindBar *find_bar,
EvWindow *ev_window)
{
gboolean visible;
- if (ev_window->priv->document->iswebdocument == TRUE ) return ;
visible = gtk_widget_get_visible (GTK_WIDGET (find_bar));
if (ev_window->priv->document &&
EV_IS_DOCUMENT_FIND (ev_window->priv->document)) {
- ev_view_find_set_highlight_search (EV_VIEW (ev_window->priv->view), visible);
- ev_view_find_search_changed (EV_VIEW (ev_window->priv->view));
+
+ if (!ev_window->priv->document->iswebdocument) {
+ ev_view_find_set_highlight_search (EV_VIEW (ev_window->priv->view), visible);
+ ev_view_find_search_changed (EV_VIEW (ev_window->priv->view));
+ }
+ else {
+ ev_web_view_find_set_highlight_search(EV_WEB_VIEW(ev_window->priv->webview),visible);
+ ev_web_view_find_search_changed(EV_WEB_VIEW(ev_window->priv->webview));
+ }
+
ev_window_update_actions (ev_window);
if (visible)
@@ -5429,12 +5467,6 @@ ev_window_dispose (GObject *object)
priv->view = NULL;
}
-/*#ifdef ENABLE_EPUB
- if ( priv->webview ) {
- g_object_unref (EV_WEB_VIEW(priv->webview));
- priv->webview = NULL ;
- }
-#endif*/
if (priv->password_view) {
g_object_unref (priv->password_view);
priv->password_view = NULL;