X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=libdocument%2Fev-document.h;h=bc040d14fa93913d8004d31576405c2b7e1f396e;hb=08a9f7ae85046d4b4434927a2f0fbe8642287089;hp=6e7232bb0d7686036cec931f476364ee76ace5d2;hpb=31e16bd8f386dc292e60489d4a17227804bdc2e6;p=evince.git diff --git a/libdocument/ev-document.h b/libdocument/ev-document.h index 6e7232bb..bc040d14 100644 --- a/libdocument/ev-document.h +++ b/libdocument/ev-document.h @@ -126,6 +126,24 @@ cairo_surface_t *ev_document_render (EvDocument *document, gint ev_rect_cmp (EvRectangle *a, EvRectangle *b); +/* convenience macro to ease interface addition in the CODE + * section of EV_BACKEND_REGISTER_WITH_CODE (this macro relies on + * the g_define_type_id present within EV_BACKEND_REGISTER_WITH_CODE()). + * usage example: + * EV_BACKEND_REGISTER_WITH_CODE (PdfDocument, pdf_document, + * EV_BACKEND_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_THUMBNAILS, + * pdf_document_document_thumbnails_iface_init)); + */ +#define EV_BACKEND_IMPLEMENT_INTERFACE(TYPE_IFACE, iface_init) { \ + const GInterfaceInfo g_implement_interface_info = { \ + (GInterfaceInitFunc) iface_init, NULL, NULL \ + }; \ + g_type_module_add_interface (module, \ + g_define_type_id, \ + TYPE_IFACE, \ + &g_implement_interface_info); \ +} + /* * Utility macro used to register backends * @@ -174,8 +192,8 @@ register_evince_backend (GTypeModule *module) \ #BackendName, \ &our_info, \ (GTypeFlags)0); \ - \ - G_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT, \ + \ + EV_BACKEND_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT, \ backend_name##_document_iface_init); \ \ CODE \