[evince] libdocument: Add API to find text with options
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince] libdocument: Add API to find text with options
- Date: Sun, 10 Jun 2012 11:26:55 +0000 (UTC)
commit 378277b5125489df417eb57729e04c8ad79ca0dc
Author: Carlos Garcia Campos <carlosgc gnome org>
Date: Sun Jun 10 11:58:43 2012 +0200
libdocument: Add API to find text with options
libdocument/ev-document-find.c | 23 +++++++++++++++++++++++
libdocument/ev-document-find.h | 34 +++++++++++++++++++++++++---------
2 files changed, 48 insertions(+), 9 deletions(-)
---
diff --git a/libdocument/ev-document-find.c b/libdocument/ev-document-find.c
index 0b5fac0..1ac464f 100644
--- a/libdocument/ev-document-find.c
+++ b/libdocument/ev-document-find.c
@@ -40,3 +40,26 @@ ev_document_find_find_text (EvDocumentFind *document_find,
return iface->find_text (document_find, page, text, case_sensitive);
}
+GList *
+ev_document_find_find_text_with_options (EvDocumentFind *document_find,
+ EvPage *page,
+ const gchar *text,
+ EvFindOptions options)
+{
+ EvDocumentFindInterface *iface = EV_DOCUMENT_FIND_GET_IFACE (document_find);
+
+ if (iface->find_text_with_options)
+ return iface->find_text_with_options (document_find, page, text, options);
+
+ return ev_document_find_find_text (document_find, page, text, options & EV_FIND_CASE_SENSITIVE);
+}
+
+EvFindOptions
+ev_document_find_get_supported_options (EvDocumentFind *document_find)
+{
+ EvDocumentFindInterface *iface = EV_DOCUMENT_FIND_GET_IFACE (document_find);
+
+ if (iface->get_supported_options)
+ return iface->get_supported_options (document_find);
+ return 0;
+}
diff --git a/libdocument/ev-document-find.h b/libdocument/ev-document-find.h
index dcc3438..f50ef0a 100644
--- a/libdocument/ev-document-find.h
+++ b/libdocument/ev-document-find.h
@@ -43,22 +43,38 @@ G_BEGIN_DECLS
typedef struct _EvDocumentFind EvDocumentFind;
typedef struct _EvDocumentFindInterface EvDocumentFindInterface;
+typedef enum {
+ EV_FIND_DEFAULT = 0,
+ EV_FIND_CASE_SENSITIVE = 1 << 0,
+ EV_FIND_WHOLE_WORDS_ONLY = 1 << 1
+} EvFindOptions;
+
struct _EvDocumentFindInterface
{
GTypeInterface base_iface;
/* Methods */
- GList *(* find_text) (EvDocumentFind *document_find,
- EvPage *page,
- const gchar *text,
- gboolean case_sensitive);
+ GList *(* find_text) (EvDocumentFind *document_find,
+ EvPage *page,
+ const gchar *text,
+ gboolean case_sensitive);
+ GList *(* find_text_with_options) (EvDocumentFind *document_find,
+ EvPage *page,
+ const gchar *text,
+ EvFindOptions options);
+ EvFindOptions (*get_supported_options) (EvDocumentFind *document_find);
};
-GType ev_document_find_get_type (void) G_GNUC_CONST;
-GList *ev_document_find_find_text (EvDocumentFind *document_find,
- EvPage *page,
- const gchar *text,
- gboolean case_sensitive);
+GType ev_document_find_get_type (void) G_GNUC_CONST;
+GList *ev_document_find_find_text (EvDocumentFind *document_find,
+ EvPage *page,
+ const gchar *text,
+ gboolean case_sensitive);
+GList *ev_document_find_find_text_with_options (EvDocumentFind *document_find,
+ EvPage *page,
+ const gchar *text,
+ EvFindOptions options);
+EvFindOptions ev_document_find_get_supported_options (EvDocumentFind *document_find);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]