[grilo] Make sure only grilo.h can be included



commit 52e1f1879292ff12eaedac6cb4f5e2ef51dafe3b
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date:   Fri Apr 9 11:08:05 2010 +0200

    Make sure only grilo.h can be included
    
    Add some definitions so if client includes other files than grilo.h an error
    will be raised at building time.

 src/Makefile.am            |    3 ++-
 src/data/grl-config.h      |    4 ++++
 src/data/grl-data.h        |    4 ++++
 src/data/grl-media-audio.h |    4 ++++
 src/data/grl-media-box.h   |    4 ++++
 src/data/grl-media-image.h |    4 ++++
 src/data/grl-media-video.h |    4 ++++
 src/data/grl-media.h       |    4 ++++
 src/grilo.h                |    4 ++++
 src/grl-error.h            |    4 ++++
 src/grl-log.h              |    4 ++++
 src/grl-media-plugin.h     |    4 ++++
 src/grl-media-source.h     |    4 ++++
 src/grl-metadata-key.h     |    4 ++++
 src/grl-metadata-source.h  |    4 ++++
 src/grl-plugin-registry.h  |    4 ++++
 16 files changed, 62 insertions(+), 1 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index fab374a..34d768b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -12,7 +12,8 @@ lib_LTLIBRARIES = lib GRL_NAME@.la
 lib GRL_NAME@_la_CFLAGS =	\
 	$(DEPS_CFLAGS)		\
 	-I$(srcdir)		\
-	-I$(srcdir)/data
+	-I$(srcdir)/data	\
+	-DGRILO_COMPILATION
 
 lib GRL_NAME@_la_LIBADD =	\
 	$(DEPS_LIBS)
diff --git a/src/data/grl-config.h b/src/data/grl-config.h
index 1ca24e6..ea77fd6 100644
--- a/src/data/grl-config.h
+++ b/src/data/grl-config.h
@@ -22,6 +22,10 @@
  *
  */
 
+#if !defined (_GRILO_H_INSIDE_) && !defined (GRILO_COMPILATION)
+#error "Only <grilo.h> can be included directly."
+#endif
+
 #ifndef _GRL_CONFIG_H_
 #define _GRL_CONFIG_H_
 
diff --git a/src/data/grl-data.h b/src/data/grl-data.h
index 500a297..7bd2f4b 100644
--- a/src/data/grl-data.h
+++ b/src/data/grl-data.h
@@ -22,6 +22,10 @@
  *
  */
 
+#if !defined (_GRILO_H_INSIDE_) && !defined (GRILO_COMPILATION)
+#error "Only <grilo.h> can be included directly."
+#endif
+
 #ifndef _GRL_DATA_H_
 #define _GRL_DATA_H_
 
diff --git a/src/data/grl-media-audio.h b/src/data/grl-media-audio.h
index 02c96bb..7c172ae 100644
--- a/src/data/grl-media-audio.h
+++ b/src/data/grl-media-audio.h
@@ -22,6 +22,10 @@
  *
  */
 
+#if !defined (_GRILO_H_INSIDE_) && !defined (GRILO_COMPILATION)
+#error "Only <grilo.h> can be included directly."
+#endif
+
 #ifndef _GRL_MEDIA_AUDIO_H_
 #define _GRL_MEDIA_AUDIO_H_
 
diff --git a/src/data/grl-media-box.h b/src/data/grl-media-box.h
index 623b016..55d7e1b 100644
--- a/src/data/grl-media-box.h
+++ b/src/data/grl-media-box.h
@@ -22,6 +22,10 @@
  *
  */
 
+#if !defined (_GRILO_H_INSIDE_) && !defined (GRILO_COMPILATION)
+#error "Only <grilo.h> can be included directly."
+#endif
+
 #ifndef _GRL_MEDIA_BOX_H_
 #define _GRL_MEDIA_BOX_H_
 
diff --git a/src/data/grl-media-image.h b/src/data/grl-media-image.h
index 3548e97..a774688 100644
--- a/src/data/grl-media-image.h
+++ b/src/data/grl-media-image.h
@@ -22,6 +22,10 @@
  *
  */
 
+#if !defined (_GRILO_H_INSIDE_) && !defined (GRILO_COMPILATION)
+#error "Only <grilo.h> can be included directly."
+#endif
+
 #ifndef _GRL_MEDIA_IMAGE_H_
 #define _GRL_MEDIA_IMAGE_H_
 
diff --git a/src/data/grl-media-video.h b/src/data/grl-media-video.h
index 679195d..afdaad6 100644
--- a/src/data/grl-media-video.h
+++ b/src/data/grl-media-video.h
@@ -22,6 +22,10 @@
  *
  */
 
+#if !defined (_GRILO_H_INSIDE_) && !defined (GRILO_COMPILATION)
+#error "Only <grilo.h> can be included directly."
+#endif
+
 #ifndef _GRL_MEDIA_VIDEO_H_
 #define _GRL_MEDIA_VIDEO_H_
 
diff --git a/src/data/grl-media.h b/src/data/grl-media.h
index 5e89074..9f1d126 100644
--- a/src/data/grl-media.h
+++ b/src/data/grl-media.h
@@ -22,6 +22,10 @@
  *
  */
 
+#if !defined (_GRILO_H_INSIDE_) && !defined (GRILO_COMPILATION)
+#error "Only <grilo.h> can be included directly."
+#endif
+
 #ifndef _GRL_MEDIA_H_
 #define _GRL_MEDIA_H_
 
diff --git a/src/grilo.h b/src/grilo.h
index 13124d3..e65503b 100644
--- a/src/grilo.h
+++ b/src/grilo.h
@@ -23,6 +23,8 @@
 #ifndef _GRILO_H_
 #define _GRILO_H_
 
+#define _GRILO_H_INSIDE_
+
 #ifdef HAVE_CONFIG_H
 # ifndef PACKAGE
 #  include "config.h"
@@ -44,4 +46,6 @@
 #include <grl-media-box.h>
 #include <grl-config.h>
 
+#undef _GRILO_H_INSIDE_
+
 #endif /* _GRILO_H_ */
diff --git a/src/grl-error.h b/src/grl-error.h
index 2e63fcd..398ee3b 100644
--- a/src/grl-error.h
+++ b/src/grl-error.h
@@ -20,6 +20,10 @@
  *
  */
 
+#if !defined (_GRILO_H_INSIDE_) && !defined (GRILO_COMPILATION)
+#error "Only <grilo.h> can be included directly."
+#endif
+
 #ifndef _GRL_ERROR_H_
 #define _GRL_ERROR_H_
 
diff --git a/src/grl-log.h b/src/grl-log.h
index 5b4e694..486802a 100644
--- a/src/grl-log.h
+++ b/src/grl-log.h
@@ -20,6 +20,10 @@
  *
  */
 
+#if !defined (_GRILO_H_INSIDE_) && !defined (GRILO_COMPILATION)
+#error "Only <grilo.h> can be included directly."
+#endif
+
 #ifndef _GRL_LOG_H_
 #define _GRL_LOG_H_
 
diff --git a/src/grl-media-plugin.h b/src/grl-media-plugin.h
index 4b6e898..c3cb839 100644
--- a/src/grl-media-plugin.h
+++ b/src/grl-media-plugin.h
@@ -20,6 +20,10 @@
  *
  */
 
+#if !defined (_GRILO_H_INSIDE_) && !defined (GRILO_COMPILATION)
+#error "Only <grilo.h> can be included directly."
+#endif
+
 #ifndef _GRL_MEDIA_PLUGIN_H_
 #define _GRL_MEDIA_PLUGIN_H_
 
diff --git a/src/grl-media-source.h b/src/grl-media-source.h
index a8bf744..bc167c0 100644
--- a/src/grl-media-source.h
+++ b/src/grl-media-source.h
@@ -20,6 +20,10 @@
  *
  */
 
+#if !defined (_GRILO_H_INSIDE_) && !defined (GRILO_COMPILATION)
+#error "Only <grilo.h> can be included directly."
+#endif
+
 #ifndef _GRL_MEDIA_SOURCE_H_
 #define _GRL_MEDIA_SOURCE_H_
 
diff --git a/src/grl-metadata-key.h b/src/grl-metadata-key.h
index edc8555..131e377 100644
--- a/src/grl-metadata-key.h
+++ b/src/grl-metadata-key.h
@@ -20,6 +20,10 @@
  *
  */
 
+#if !defined (_GRILO_H_INSIDE_) && !defined (GRILO_COMPILATION)
+#error "Only <grilo.h> can be included directly."
+#endif
+
 #ifndef _GRL_METADATA_KEY_H_
 #define _GRL_METADATA_KEY_H_
 
diff --git a/src/grl-metadata-source.h b/src/grl-metadata-source.h
index 60c5405..f0a482e 100644
--- a/src/grl-metadata-source.h
+++ b/src/grl-metadata-source.h
@@ -20,6 +20,10 @@
  *
  */
 
+#if !defined (_GRILO_H_INSIDE_) && !defined (GRILO_COMPILATION)
+#error "Only <grilo.h> can be included directly."
+#endif
+
 #ifndef _GRL_METADATA_SOURCE_H_
 #define _GRL_METADATA_SOURCE_H_
 
diff --git a/src/grl-plugin-registry.h b/src/grl-plugin-registry.h
index 06ebd09..54fff5e 100644
--- a/src/grl-plugin-registry.h
+++ b/src/grl-plugin-registry.h
@@ -20,6 +20,10 @@
  *
  */
 
+#if !defined (_GRILO_H_INSIDE_) && !defined (GRILO_COMPILATION)
+#error "Only <grilo.h> can be included directly."
+#endif
+
 #ifndef _GRL_PLUGIN_REGISTRY_H_
 #define _GRL_PLUGIN_REGISTRY_H_
 



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