[librsvg] Deprecate including headers other than rsvg.h



commit 3b8adaa7e780b85695306292dfb23107d219bb34
Author: Evan Nemerson <evan coeus-group com>
Date:   Sun Jun 10 18:17:58 2012 -0700

    Deprecate including headers other than rsvg.h

 Makefile.am             |    7 ++++---
 librsvg-features.c      |    2 +-
 librsvg-features.h.in   |    4 ++++
 rsvg-cairo.h            |    4 ++++
 rsvg-convert.c          |    1 -
 rsvg-gobject.c          |    2 +-
 rsvg.h                  |    8 ++++++++
 test-display.c          |    1 -
 tools/rsvg-tools-main.c |    1 -
 9 files changed, 22 insertions(+), 8 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 1adb278..2f7ae36 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -84,6 +84,7 @@ librsvg_ RSVG_API_MAJOR_VERSION@_la_CPPFLAGS = \
 	$(AM_CPPFLAGS)
 
 librsvg_ RSVG_API_MAJOR_VERSION@_la_CFLAGS = \
+	-DRSVG_COMPILATION	\
 	$(LIBRSVG_CFLAGS) 	\
 	$(AM_CFLAGS)
 
@@ -183,7 +184,7 @@ librsvg-enum-types.h: s-enum-types-h
 
 s-enum-types-h: $(headers) Makefile
 	$(AM_V_GEN) ( cd $(srcdir) && $(GLIB_MKENUMS) \
-			--fhead "#ifndef __LIBRSVG_ENUM_TYPES_H__\n#define __LIBRSVG_ENUM_TYPES_H__\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n" \
+			--fhead "#if !defined (__RSVG_RSVG_H_INSIDE__) && !defined (RSVG_COMPILATION)\n#warning \"Including <librsvg/librsvg-enum-types.h> directly is deprecated.\"\n#endif\n\n#ifndef __LIBRSVG_ENUM_TYPES_H__\n#define __LIBRSVG_ENUM_TYPES_H__\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n" \
 			--fprod "/* enumerations from \"@filename \" */\n" \
 			--vhead "GType @enum_name _get_type (void);\n#define RSVG_TYPE_ ENUMSHORT@ (@enum_name _get_type())\n" 	\
 			--ftail "G_END_DECLS\n\n#endif /* __LIBRSVG_ENUM_TYPES_H__ */" \
@@ -197,7 +198,7 @@ librsvg-enum-types.c: s-enum-types-c librsvg-enum-types.h
 
 s-enum-types-c: $(headers) Makefile
 	$(AM_V_GEN) ( cd $(srcdir) && $(GLIB_MKENUMS) \
-			--fhead "#include \"librsvg-enum-types.h\"\n#include \"rsvg.h\"" \
+			--fhead "#include \"rsvg.h\"" \
 			--fprod "\n/* enumerations from \"@filename \" */" \
 			--vhead "GType\n enum_name@_get_type (void)\n{\n  static GType etype = 0;\n  if (etype == 0) {\n    static const G Type@Value values[] = {" 	\
 			--vprod "      { @VALUENAME@, \"@VALUENAME \", \"@valuenick \" }," \
@@ -235,7 +236,7 @@ Rsvg_ RSVG_API_VERSION_U@_gir_PACKAGES = \
 	pango \
 	libxml-2.0 \
 	$(NULL)
-Rsvg_ RSVG_API_VERSION_U@_gir_CFLAGS = -I$(top_builddir)
+Rsvg_ RSVG_API_VERSION_U@_gir_CFLAGS = -I$(top_builddir) -DRSVG_COMPILATION
 Rsvg_ RSVG_API_VERSION_U@_gir_LIBS = librsvg- RSVG_API_MAJOR_VERSION@.la
 
 girdir = $(datadir)/gir-1.0
diff --git a/librsvg-features.c b/librsvg-features.c
index 621d4f0..367ccbd 100644
--- a/librsvg-features.c
+++ b/librsvg-features.c
@@ -1,4 +1,4 @@
-#include "librsvg-features.h"
+#include "rsvg.h"
 
 /* General initialization hooks */
 const unsigned int librsvg_major_version = LIBRSVG_MAJOR_VERSION,
diff --git a/librsvg-features.h.in b/librsvg-features.h.in
index c0d3332..53ea0ac 100644
--- a/librsvg-features.h.in
+++ b/librsvg-features.h.in
@@ -1,3 +1,7 @@
+#if !defined (__RSVG_RSVG_H_INSIDE__) && !defined (RSVG_COMPILATION)
+#warning "Including <librsvg/librsvg-features.h> directly is deprecated."
+#endif
+
 #ifndef LIBRSVG_FEATURES_H
 #define LIBRSVG_FEATURES_H 1
 
diff --git a/rsvg-cairo.h b/rsvg-cairo.h
index 45f4d62..d9ebfb2 100644
--- a/rsvg-cairo.h
+++ b/rsvg-cairo.h
@@ -23,6 +23,10 @@
    Author: Carl Worth <cworth cworth org>
 */
 
+#if !defined (__RSVG_RSVG_H_INSIDE__) && !defined (RSVG_COMPILATION)
+#warning "Including <librsvg/rsvg-cairo.h> directly is deprecated."
+#endif
+
 #ifndef RSVG_CAIRO_H
 #define RSVG_CAIRO_H
 
diff --git a/rsvg-convert.c b/rsvg-convert.c
index f26fd87..0f43cb7 100644
--- a/rsvg-convert.c
+++ b/rsvg-convert.c
@@ -37,7 +37,6 @@
 
 #include "rsvg-css.h"
 #include "rsvg.h"
-#include "rsvg-cairo.h"
 #include "rsvg-private.h"
 #include "rsvg-size-callback.h"
 
diff --git a/rsvg-gobject.c b/rsvg-gobject.c
index 3f05221..48ad928 100644
--- a/rsvg-gobject.c
+++ b/rsvg-gobject.c
@@ -39,7 +39,7 @@
 
 #include "rsvg-private.h"
 #include "rsvg-defs.h"
-#include "librsvg-enum-types.h"
+#include "rsvg.h"
 
 enum {
     PROP_0,
diff --git a/rsvg.h b/rsvg.h
index 8c99311..c8968db 100644
--- a/rsvg.h
+++ b/rsvg.h
@@ -26,6 +26,8 @@
 #ifndef RSVG_H
 #define RSVG_H
 
+#define __RSVG_RSVG_H_INSIDE__
+
 #include <glib-object.h>
 #include <gio/gio.h>
 
@@ -238,4 +240,10 @@ const char *rsvg_handle_get_metadata    (RsvgHandle * handle);
 
 G_END_DECLS
 
+#include "librsvg-enum-types.h"
+#include "librsvg-features.h"
+#include "rsvg-cairo.h"
+
+#undef __RSVG_RSVG_H_INSIDE__
+
 #endif                          /* RSVG_H */
diff --git a/test-display.c b/test-display.c
index 42fad37..78d06ef 100644
--- a/test-display.c
+++ b/test-display.c
@@ -19,7 +19,6 @@
 
 #include "config.h"
 #include "rsvg.h"
-#include "rsvg-cairo.h"
 #include "rsvg-private.h"
 #include "rsvg-size-callback.h"
 
diff --git a/tools/rsvg-tools-main.c b/tools/rsvg-tools-main.c
index 132db3a..4f864b5 100644
--- a/tools/rsvg-tools-main.c
+++ b/tools/rsvg-tools-main.c
@@ -30,7 +30,6 @@
 #include <stdlib.h>
 
 #include "rsvg.h"
-#include "rsvg-cairo.h"
 #include "rsvg-private.h"
 #include "rsvg-tools-main.h"
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]