api: only allow including `ModemManager.h' directly

This commit is contained in:
Aleksander Morgado
2012-10-03 18:06:14 +02:00
parent 239c56cf7f
commit 4251030bd8
7 changed files with 18 additions and 7 deletions

View File

@@ -17,6 +17,10 @@
#ifndef _MODEMMANAGER_ENUMS_H_ #ifndef _MODEMMANAGER_ENUMS_H_
#define _MODEMMANAGER_ENUMS_H_ #define _MODEMMANAGER_ENUMS_H_
#if !defined (__MODEM_MANAGER_H_INSIDE__)
#error "Only <ModemManager.h> can be included directly."
#endif
/** /**
* SECTION:mm-enums * SECTION:mm-enums
* @short_description: Common enumerations and types in the API. * @short_description: Common enumerations and types in the API.

View File

@@ -17,6 +17,10 @@
#ifndef _MODEMMANAGER_ERRORS_H_ #ifndef _MODEMMANAGER_ERRORS_H_
#define _MODEMMANAGER_ERRORS_H_ #define _MODEMMANAGER_ERRORS_H_
#if !defined (__MODEM_MANAGER_H_INSIDE__)
#error "Only <ModemManager.h> can be included directly."
#endif
#include <ModemManager-names.h> #include <ModemManager-names.h>
/** /**

View File

@@ -25,6 +25,8 @@
#ifndef _MODEM_MANAGER_H_ #ifndef _MODEM_MANAGER_H_
#define _MODEM_MANAGER_H_ #define _MODEM_MANAGER_H_
#define __MODEM_MANAGER_H_INSIDE__
/* Public header with DBus Interface, Method, Signal and Property names */ /* Public header with DBus Interface, Method, Signal and Property names */
#include <ModemManager-names.h> #include <ModemManager-names.h>

View File

@@ -41,7 +41,7 @@ BUILT_SOURCES = $(GENERATED_H) $(GENERATED_C) $(GENERATED_DOC)
# Enum types # Enum types
mm-enums-types.h: Makefile.am $(top_srcdir)/include/ModemManager-enums.h $(top_srcdir)/build-aux/mm-enums-template.h mm-enums-types.h: Makefile.am $(top_srcdir)/include/ModemManager-enums.h $(top_srcdir)/build-aux/mm-enums-template.h
$(AM_V_GEN) $(GLIB_MKENUMS) \ $(AM_V_GEN) $(GLIB_MKENUMS) \
--fhead "#include <ModemManager-enums.h>\n#ifndef __MM_ENUMS_TYPES_H__\n#define __MM_ENUMS_TYPES_H__\n" \ --fhead "#include <ModemManager.h>\n#ifndef __MM_ENUMS_TYPES_H__\n#define __MM_ENUMS_TYPES_H__\n" \
--template $(top_srcdir)/build-aux/mm-enums-template.h \ --template $(top_srcdir)/build-aux/mm-enums-template.h \
--ftail "#endif /* __MM_ENUMS_TYPES_H__ */\n" \ --ftail "#endif /* __MM_ENUMS_TYPES_H__ */\n" \
$(top_srcdir)/include/ModemManager-enums.h > $@ $(top_srcdir)/include/ModemManager-enums.h > $@
@@ -62,13 +62,13 @@ mm-errors-types.h: Makefile.am $(top_srcdir)/include/ModemManager-errors.h $(top
mm-errors-types.c: Makefile.am $(top_srcdir)/include/ModemManager-errors.h $(top_srcdir)/build-aux/mm-errors-template.c mm-errors-types.h mm-errors-types.c: Makefile.am $(top_srcdir)/include/ModemManager-errors.h $(top_srcdir)/build-aux/mm-errors-template.c mm-errors-types.h
$(AM_V_GEN) $(GLIB_MKENUMS) \ $(AM_V_GEN) $(GLIB_MKENUMS) \
--fhead "#include <ModemManager-errors.h>\n#include \"mm-errors-types.h\"\n" \ --fhead "#include <ModemManager.h>\n#include \"mm-errors-types.h\"\n" \
--template $(top_srcdir)/build-aux/mm-errors-template.c \ --template $(top_srcdir)/build-aux/mm-errors-template.c \
$(top_srcdir)/include/ModemManager-errors.h > $@ $(top_srcdir)/include/ModemManager-errors.h > $@
mm-errors-quarks.c: Makefile.am $(top_srcdir)/include/ModemManager-errors.h $(top_srcdir)/build-aux/mm-errors-quarks-template.c $(top_srcdir)/include/ModemManager-names.h mm-errors-types.h mm-errors-quarks.c: Makefile.am $(top_srcdir)/include/ModemManager-errors.h $(top_srcdir)/build-aux/mm-errors-quarks-template.c $(top_srcdir)/include/ModemManager-names.h mm-errors-types.h
$(AM_V_GEN) $(GLIB_MKENUMS) \ $(AM_V_GEN) $(GLIB_MKENUMS) \
--fhead "#include <ModemManager-errors.h>\n#include \"mm-errors-types.h\"\n" \ --fhead "#include <ModemManager.h>\n#include \"mm-errors-types.h\"\n" \
--template $(top_srcdir)/build-aux/mm-errors-quarks-template.c \ --template $(top_srcdir)/build-aux/mm-errors-quarks-template.c \
$(top_srcdir)/include/ModemManager-errors.h > $@ $(top_srcdir)/include/ModemManager-errors.h > $@

View File

@@ -16,7 +16,7 @@
*/ */
#include <glib.h> #include <glib.h>
#include <ModemManager-enums.h> #include <ModemManager.h>
#if !defined (__LIBMM_GLIB_H_INSIDE__) && !defined (LIBMM_GLIB_COMPILATION) #if !defined (__LIBMM_GLIB_H_INSIDE__) && !defined (LIBMM_GLIB_COMPILATION)
#error "Only <libmm-glib.h> can be included directly." #error "Only <libmm-glib.h> can be included directly."

View File

@@ -21,8 +21,9 @@
#include <glib.h> #include <glib.h>
#include <glib-object.h> #include <glib-object.h>
#include <ModemManager.h>
#include "mm-base-modem.h" #include "mm-base-modem.h"
#include "ModemManager-enums.h"
#define MM_TYPE_BROADBAND_MODEM (mm_broadband_modem_get_type ()) #define MM_TYPE_BROADBAND_MODEM (mm_broadband_modem_get_type ())
#define MM_BROADBAND_MODEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_BROADBAND_MODEM, MMBroadbandModem)) #define MM_BROADBAND_MODEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_BROADBAND_MODEM, MMBroadbandModem))

View File

@@ -20,8 +20,8 @@
#include <glib-object.h> #include <glib-object.h>
#include <ModemManager-errors.h> #include <ModemManager.h>
#include <mm-errors-types.h> #include <libmm-glib.h>
GError *mm_connection_error_for_code (MMConnectionError code); GError *mm_connection_error_for_code (MMConnectionError code);
GError *mm_mobile_equipment_error_for_code (MMMobileEquipmentError code); GError *mm_mobile_equipment_error_for_code (MMMobileEquipmentError code);