[gtksourceview] Better return type for gtk_source_completion_get_view()
- From: SÃbastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] Better return type for gtk_source_completion_get_view()
- Date: Tue, 14 Aug 2012 22:08:03 +0000 (UTC)
commit 56269298d902299888336c0a1c740e85a99755cb
Author: SÃbastien Wilmet <swilmet gnome org>
Date: Tue Aug 14 00:32:11 2012 +0200
Better return type for gtk_source_completion_get_view()
The return type of gtk_source_completion_get_view() is
"GtkSourceView *". But due to a cycle in the .h includes, the type was
"struct _GtkSourceView *".
The header includes cycle: gtksourceview.h needs the GtkSourceCompletion
type. But gtksourcecompletion.h needs the GtkSourceView type.
The solution is to put the typedef of GtkSourceCompletion in
gtksourcecompletion-private.h and include this header both in
gtksourceview.h and gtksourcecompletion.h.
Redifining two times the same type with typedef is not allowed in C.
gtksourceview/gtksourcecompletion-private.h | 7 ++++++-
gtksourceview/gtksourcecompletion.h | 9 +++------
gtksourceview/gtksourceview.h | 2 +-
3 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/gtksourceview/gtksourcecompletion-private.h b/gtksourceview/gtksourcecompletion-private.h
index 457ea94..fec41fd 100644
--- a/gtksourceview/gtksourcecompletion-private.h
+++ b/gtksourceview/gtksourcecompletion-private.h
@@ -23,7 +23,12 @@
#define __GTK_SOURCE_COMPLETION_PIVATE_H__
#include <gtk/gtk.h>
-#include <gtksourceview/gtksourcecompletion.h>
+
+/* Break the cycle between gtksourceview.h and gtksourcecompletion.h */
+typedef struct _GtkSourceCompletion GtkSourceCompletion;
+
+/* Forward declaration */
+struct _GtkSourceView;
GtkSourceCompletion *gtk_source_completion_new (struct _GtkSourceView *source_view);
diff --git a/gtksourceview/gtksourcecompletion.h b/gtksourceview/gtksourcecompletion.h
index a3aded7..a67d79e 100644
--- a/gtksourceview/gtksourcecompletion.h
+++ b/gtksourceview/gtksourcecompletion.h
@@ -24,9 +24,11 @@
#define __GTK_SOURCE_COMPLETION_H__
#include <gtk/gtk.h>
+#include <gtksourceview/gtksourceview.h>
#include <gtksourceview/gtksourcecompletioninfo.h>
#include <gtksourceview/gtksourcecompletionprovider.h>
#include <gtksourceview/gtksourcelanguage.h>
+#include "gtksourcecompletion-private.h"
G_BEGIN_DECLS
@@ -43,7 +45,6 @@ G_BEGIN_DECLS
#define GTK_SOURCE_COMPLETION_ERROR (gtk_source_completion_error_quark ())
typedef struct _GtkSourceCompletionPrivate GtkSourceCompletionPrivate;
-typedef struct _GtkSourceCompletion GtkSourceCompletion;
typedef struct _GtkSourceCompletionClass GtkSourceCompletionClass;
typedef enum
@@ -52,9 +53,6 @@ typedef enum
GTK_SOURCE_COMPLETION_ERROR_NOT_BOUND
} GtkSourceCompletionError;
-/* Forward declaration of GtkSourceView */
-struct _GtkSourceView;
-
struct _GtkSourceCompletion
{
GObject parent_instance;
@@ -107,8 +105,7 @@ void gtk_source_completion_hide (GtkSourceCompletion *completion);
GtkSourceCompletionInfo *
gtk_source_completion_get_info_window (GtkSourceCompletion *completion);
-struct _GtkSourceView *
- gtk_source_completion_get_view (GtkSourceCompletion *completion);
+GtkSourceView *gtk_source_completion_get_view (GtkSourceCompletion *completion);
GtkSourceCompletionContext *
gtk_source_completion_create_context (GtkSourceCompletion *completion,
diff --git a/gtksourceview/gtksourceview.h b/gtksourceview/gtksourceview.h
index 3a8f846..2fe67e6 100644
--- a/gtksourceview/gtksourceview.h
+++ b/gtksourceview/gtksourceview.h
@@ -27,9 +27,9 @@
#include <gtk/gtk.h>
#include <gtksourceview/gtksourcebuffer.h>
-#include <gtksourceview/gtksourcecompletion.h>
#include <gtksourceview/gtksourcegutter.h>
#include <gtksourceview/gtksourcemarkattributes.h>
+#include "gtksourcecompletion-private.h"
G_BEGIN_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]