]> www.fi.muni.cz Git - evince.git/commitdiff
add marshaler-generator thingy. I'm sure there's a better way to do this
authorHavoc Pennington <hp@redhat.com>
Wed, 22 Dec 2004 04:37:26 +0000 (04:37 +0000)
committerHavoc Pennington <hp@src.gnome.org>
Wed, 22 Dec 2004 04:37:26 +0000 (04:37 +0000)
2004-12-21  Havoc Pennington  <hp@redhat.com>

* backend/ev-backend-marshal.c,
backend/ev-backend-marshalers.list, backend/Makefile.am: add
marshaler-generator thingy. I'm sure there's a better way to do
this in the modern world.

* backend/ev-document.h (struct _EvDocumentIface): add begin_find,
end_find methods and "found" signal.

* configure.ac: find glib-genmarshal

ChangeLog
backend/Makefile.am
backend/ev-backend-marshal.c [new file with mode: 0644]
backend/ev-document.c
backend/ev-document.h
configure.ac

index 97e906a34d02b85b283a777917b1769199d9b308..fe7e53b5063d39dbe76dea22d958e068f959e44f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2004-12-21  Havoc Pennington  <hp@redhat.com>
+
+       * backend/ev-backend-marshal.c,
+       backend/ev-backend-marshalers.list, backend/Makefile.am: add
+       marshaler-generator thingy. I'm sure there's a better way to do
+       this in the modern world.
+
+       * backend/ev-document.h (struct _EvDocumentIface): add begin_find,
+       end_find methods and "found" signal.
+
+       * configure.ac: find glib-genmarshal
+
 Tue Dec 21 23:20:35 2004  Jonathan Blandford  <jrb@redhat.com>
 
        * shell/ev-sidebar.c: Construct an actual sidebar.
index cc0acf44563e0146a62e0fa46d926a4d263ef8db..c163aa0440b540938bcf87909e0dc9c7aacfed31 100644 (file)
@@ -10,6 +10,27 @@ INCLUDES=                                    \
 noinst_LTLIBRARIES = libevbackend.la
 
 libevbackend_la_SOURCES=                       \
+       ev-backend-marshal.c                    \
        ev-document.c                           \
        ev-document.h                           \
        $(NULL)
+
+ev-backend-marshalers.h: ev-backend-marshalers.list
+       cd $(srcdir) \
+       && $(GLIB_GENMARSHAL) --prefix=_ev_backend_marshal ev-backend-marshalers.list --header > xgen-emh \
+       && cp xgen-emh ev-backend-marshalers.h \
+       && rm -f xgen-emh xgen-emh~
+
+ev-backend-marshalers.c: ev-backend-marshalers.list
+       cd $(srcdir) \
+       && $(GLIB_GENMARSHAL) --prefix=_ev_backend_marshal ev-backend-marshalers.list --body > xgen-emc \
+       && cp xgen-emc ev-backend-marshalers.c \
+       && rm -f xgen-emc xgen-emc~
+
+ev-backend-marshal.c: ev-backend-marshalers.h ev-backend-marshalers.c
+
+noinst_HEADERS = \
+       ev-backend-marshalers.h
+
+EXTRA_DIST=                    \
+       ev-backend-marshalers.list
diff --git a/backend/ev-backend-marshal.c b/backend/ev-backend-marshal.c
new file mode 100644 (file)
index 0000000..2bc7b6a
--- /dev/null
@@ -0,0 +1,2 @@
+#include "ev-backend-marshalers.h"
+#include "ev-backend-marshalers.c"
index 3ed1181d70d3f1b8ca6d14abf23f15e69aea4f20..02c24427f288c2523cd49a0e1eeed8ae8d98ae14 100644 (file)
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-indent-level: 8 -*- */
 /*
  *  Copyright (C) 2004 Marco Pesenti Gritti
  *
@@ -20,6 +21,7 @@
 #include "config.h"
 
 #include "ev-document.h"
+#include "ev-backend-marshal.c"
 
 static void ev_document_base_init (gpointer g_class);
 
@@ -48,6 +50,22 @@ 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
@@ -118,3 +136,19 @@ 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);
+}
index e572fed60cfad2937db751bdd1ce89a6ea93ad91..cc65f5cd45347c116c7f95e6b900fdd574255b7f 100644 (file)
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-indent-level: 8 -*- */
 /*
  *  Copyright (C) 2000-2003 Marco Pesenti Gritti
  *
 
 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))
@@ -63,6 +70,21 @@ 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.
+         */
+        void         (* found)          (EvDocument         *document,
+                                         const EvFindResult *results,
+                                         int                 n_results,
+                                         double              percent_complete);
 };
 
 GType ev_document_get_type (void);
@@ -88,6 +110,10 @@ 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);
 
 G_END_DECLS
 
index b4fd125b752e987359ba28c63dfff6fa8fd08cf2..a1a3c48861a6b09a1939be5aee7b3531f29cfcf1 100644 (file)
@@ -34,6 +34,9 @@ PKG_CHECK_MODULES(RECENT_FILES, gtk+-2.0 >= 2.4.0 libgnomeui-2.0 >= 2.4.0 libbon
 PKG_CHECK_MODULES(SHELL, gtk+-2.0 >= 2.5.0 libgnomeui-2.0 gnome-vfs-2.0 libbonoboui-2.0 libgnomeprint-2.2 libgnomeprintui-2.2 libglade-2.0)
 PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.6.0)
 
+GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`  
+AC_SUBST(GLIB_GENMARSHAL)
+
 dnl Compile with disable-deprecated switches
 
 AC_ARG_ENABLE(deprecated,