[gtksourceview: 2/2] Include words completion provider header in gtksoure.h



commit 94322d442698026dfee0f33eb83d06f2647701ab
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sat Jun 25 13:19:11 2016 +0200

    Include words completion provider header in gtksoure.h
    
    Now that the completion provider is always built (see previous commit),
    we can easily #include the header in the main header of GtkSourceView,
    gtksource.h. So that applications have just one header to #include, it's
    simpler.
    
    For generating GtkSource-3.0.gir, gtksource.h must be the first header
    in the list, otherwise there are warnings.

 docs/reference/gtksourceview-3.0-sections.txt      |    1 -
 gtksourceview/Makefile.am                          |    5 +++++
 .../words/gtksourcecompletionwords.h               |   10 +++++++---
 gtksourceview/gtksource.h                          |    1 +
 tests/test-completion.c                            |    1 -
 5 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/docs/reference/gtksourceview-3.0-sections.txt b/docs/reference/gtksourceview-3.0-sections.txt
index 96d35f6..0853431 100644
--- a/docs/reference/gtksourceview-3.0-sections.txt
+++ b/docs/reference/gtksourceview-3.0-sections.txt
@@ -213,7 +213,6 @@ gtk_source_completion_provider_get_type
 <SECTION>
 <FILE>completionwords</FILE>
 <TITLE>GtkSourceCompletionWords</TITLE>
-<INCLUDE>gtksourceview/completion-providers/words/gtksourcecompletionwords.h</INCLUDE>
 GtkSourceCompletionWords
 gtk_source_completion_words_new
 gtk_source_completion_words_register
diff --git a/gtksourceview/Makefile.am b/gtksourceview/Makefile.am
index 80ebd0b..86f2a76 100644
--- a/gtksourceview/Makefile.am
+++ b/gtksourceview/Makefile.am
@@ -282,7 +282,10 @@ GtkSource_3_0_gir_VERSION = 3.0
 GtkSource_3_0_gir_CFLAGS = $(DEP_CFLAGS)
 GtkSource_3_0_gir_SCANNERFLAGS = $(WARN_SCANNERFLAGS)
 GtkSource_3_0_gir_LIBS = libgtksourceview-3.0.la
+
+# Ensure that gtksource.h is the first one.
 GtkSource_3_0_gir_FILES =                      \
+       gtksource.h                             \
        $(libgtksourcecompletionwords_files)    \
        $(libgtksourceview_public_headers)      \
        $(libgtksourceview_public_c_files)      \
@@ -383,7 +386,9 @@ NMAKE_INTROSPECTION_FILES = \
 
 MSVC_INTROSPECT_GIRS = GtkSource-3.0.gir
 
+# Ensure that gtksource.h is the first one.
 GtkSource_3_0_gir_MSVC_FILES = \
+       gtksource.h                             \
        $(libgtksourcecompletionwords_files)    \
        $(libgtksourceview_public_headers)      \
        $(libgtksourceview_public_c_files)      \
diff --git a/gtksourceview/completion-providers/words/gtksourcecompletionwords.h 
b/gtksourceview/completion-providers/words/gtksourcecompletionwords.h
index f28fd6a..c908c1a 100644
--- a/gtksourceview/completion-providers/words/gtksourcecompletionwords.h
+++ b/gtksourceview/completion-providers/words/gtksourcecompletionwords.h
@@ -22,13 +22,17 @@
 #ifndef GTK_SOURCE_COMPLETION_WORDS_H
 #define GTK_SOURCE_COMPLETION_WORDS_H
 
-#define GTK_SOURCE_H_INSIDE
+#if !defined (GTK_SOURCE_H_INSIDE) && !defined (GTK_SOURCE_COMPILATION)
+#  if defined (__GNUC__)
+#    warning "Only <gtksourceview/gtksource.h> can be included directly."
+#  elif defined (G_OS_WIN32)
+#    pragma message("Only <gtksourceview/gtksource.h> can be included directly.")
+#  endif
+#endif
 
 #include <gtksourceview/gtksourcecompletionprovider.h>
 #include <gtk/gtk.h>
 
-#undef GTK_SOURCE_H_INSIDE
-
 G_BEGIN_DECLS
 
 #define GTK_SOURCE_TYPE_COMPLETION_WORDS               (gtk_source_completion_words_get_type ())
diff --git a/gtksourceview/gtksource.h b/gtksourceview/gtksource.h
index ad1642e..011ada9 100644
--- a/gtksourceview/gtksource.h
+++ b/gtksourceview/gtksource.h
@@ -22,6 +22,7 @@
 
 #define GTK_SOURCE_H_INSIDE
 
+#include <gtksourceview/completion-providers/words/gtksourcecompletionwords.h>
 #include <gtksourceview/gtksourcetypes.h>
 #include <gtksourceview/gtksourcebuffer.h>
 #include <gtksourceview/gtksourcecompletioncontext.h>
diff --git a/tests/test-completion.c b/tests/test-completion.c
index 60d38b0..d250354 100644
--- a/tests/test-completion.c
+++ b/tests/test-completion.c
@@ -22,7 +22,6 @@
 
 #include <gtk/gtk.h>
 #include <gtksourceview/gtksource.h>
-#include <gtksourceview/completion-providers/words/gtksourcecompletionwords.h>
 
 typedef struct _TestProvider TestProvider;
 typedef struct _TestProviderClass TestProviderClass;


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