From ec2aa10ab1ec9246d6c35b90f5d1df372f39c732 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Thu, 23 Dec 2004 03:09:00 +0000 Subject: display an error if the document doesn't support find (better ideas?) 2004-12-22 Havoc Pennington * shell/ev-window.c (ev_window_cmd_edit_find): display an error if the document doesn't support find (better ideas?) (find_bar_search_changed_cb): handle missing document or document that doesn't support find * pdf/xpdf/pdf-document.cc: port to implement the new EvDocumentFindIface * backend/ev-document-find.c: create a new interface for searching * backend/ev-document.h, backend/ev-document.c: delete the find stuff --- (limited to 'backend') diff --git a/backend/Makefile.am b/backend/Makefile.am index 5ccd5a1..d1f5cbf 100644 --- a/backend/Makefile.am +++ b/backend/Makefile.am @@ -17,6 +17,8 @@ libevbackend_la_SOURCES= \ ev-document-thumbnails.h \ ev-document-bookmarks.c \ ev-document-bookmarks.h \ + ev-document-find.c \ + ev-document-find.h \ ev-ps-exporter.c \ ev-ps-exporter.h \ $(NULL) diff --git a/backend/ev-document.c b/backend/ev-document.c index 2f50dcc..59697bd 100644 --- a/backend/ev-document.c +++ b/backend/ev-document.c @@ -21,7 +21,7 @@ #include "config.h" #include "ev-document.h" -#include "ev-backend-marshal.c" +#include "ev-backend-marshalers.h" static void ev_document_base_init (gpointer g_class); @@ -50,22 +50,7 @@ ev_document_get_type (void) static void ev_document_base_init (gpointer g_class) { - static gboolean initialized = FALSE; - - if (!initialized) { - g_signal_new ("found", - EV_TYPE_DOCUMENT, - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EvDocumentIface, found), - NULL, NULL, - _ev_backend_marshal_VOID__POINTER_INT_DOUBLE, - G_TYPE_NONE, 3, - G_TYPE_POINTER, - G_TYPE_INT, - G_TYPE_DOUBLE); - - initialized = TRUE; - } + } gboolean @@ -143,31 +128,4 @@ ev_document_render (EvDocument *document, EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document); iface->render (document, clip_x, clip_y, clip_width, clip_height); } - -void -ev_document_begin_find (EvDocument *document, - const char *search_string, - gboolean case_sensitive) -{ - EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document); - iface->begin_find (document, search_string, case_sensitive); -} - -void -ev_document_end_find (EvDocument *document) -{ - EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document); - iface->end_find (document); -} - -void -ev_document_found (EvDocument *document, - const EvFindResult *results, - int n_results, - double percent_complete) -{ - g_signal_emit_by_name (document, - "found", - results, n_results, percent_complete); -} diff --git a/backend/ev-document.h b/backend/ev-document.h index 4cf4601..083bd1a 100644 --- a/backend/ev-document.h +++ b/backend/ev-document.h @@ -28,12 +28,6 @@ G_BEGIN_DECLS -typedef struct -{ - int page_num; - GdkRectangle highlight_area; -} EvFindResult; - #define EV_TYPE_DOCUMENT (ev_document_get_type ()) #define EV_DOCUMENT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EV_TYPE_DOCUMENT, EvDocument)) #define EV_DOCUMENT_IFACE(k) (G_TYPE_CHECK_CLASS_CAST((k), EV_TYPE_DOCUMENT, EvDocumentIface)) @@ -71,23 +65,6 @@ struct _EvDocumentIface int clip_y, int clip_width, int clip_height); - - void (* begin_find) (EvDocument *document, - const char *search_string, - gboolean case_sensitive); - void (* end_find) (EvDocument *document); - - /* Signals */ - - /* "found" emitted at least 1 time (possibly with n_results == 0) - * for any call to begin_find; also emitted with NULL,0 when - * you end_find. Calling begin_find twice without calling end_find - * is considered OK. - */ - void (* found) (EvDocument *document, - const EvFindResult *results, - int n_results, - double percent_complete); }; GType ev_document_get_type (void); @@ -114,16 +91,6 @@ void ev_document_render (EvDocument *document, int clip_y, int clip_width, int clip_height); -void ev_document_begin_find (EvDocument *document, - const char *search_string, - gboolean case_sensitive); -void ev_document_end_find (EvDocument *document); - -void ev_document_found (EvDocument *document, - const EvFindResult *results, - int n_results, - double percent_complete); - G_END_DECLS -- cgit v0.9.1