[gtksourceview/wip/search-start-signal] Add empty GtkSourceBufferInternal private extension class



commit 7195edc60428c4338aa18f7f216147fd73ab3e12
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Wed Aug 10 12:57:11 2016 +0200

    Add empty GtkSourceBufferInternal private extension class
    
    https://bugzilla.gnome.org/show_bug.cgi?id=742550

 docs/reference/Makefile.am              |    1 +
 gtksourceview/Makefile.am               |    2 +
 gtksourceview/gtksourcebufferinternal.c |   88 +++++++++++++++++++++++++++++++
 gtksourceview/gtksourcebufferinternal.h |   44 +++++++++++++++
 gtksourceview/gtksourcetypes-private.h  |    1 +
 po/POTFILES.in                          |    1 +
 6 files changed, 137 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/Makefile.am b/docs/reference/Makefile.am
index 1e85a23..7da1e9e 100644
--- a/docs/reference/Makefile.am
+++ b/docs/reference/Makefile.am
@@ -34,6 +34,7 @@ IGNORE_HFILES =                                       \
        gtksource.h                             \
        gtksourcebuffer-private.h               \
        gtksourcebufferinputstream.h            \
+       gtksourcebufferinternal.h               \
        gtksourcebufferoutputstream.h           \
        gtksourcecompletioncontainer.h          \
        gtksourcecompletionmodel.h              \
diff --git a/gtksourceview/Makefile.am b/gtksourceview/Makefile.am
index e304301..b86eccf 100644
--- a/gtksourceview/Makefile.am
+++ b/gtksourceview/Makefile.am
@@ -99,6 +99,7 @@ libgtksourceview_private_headers =            \
        gconstructor.h                          \
        gtksourcebuffer-private.h               \
        gtksourcebufferinputstream.h            \
+       gtksourcebufferinternal.h               \
        gtksourcebufferoutputstream.h           \
        gtksourcecompletioncontainer.h          \
        gtksourcecompletionmodel.h              \
@@ -124,6 +125,7 @@ libgtksourceview_private_headers =          \
 
 libgtksourceview_private_c_files =     \
        gtksourcebufferinputstream.c    \
+       gtksourcebufferinternal.c       \
        gtksourcebufferoutputstream.c   \
        gtksourcecompletioncontainer.c  \
        gtksourcecompletionmodel.c      \
diff --git a/gtksourceview/gtksourcebufferinternal.c b/gtksourceview/gtksourcebufferinternal.c
new file mode 100644
index 0000000..a6f0793
--- /dev/null
+++ b/gtksourceview/gtksourcebufferinternal.c
@@ -0,0 +1,88 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; coding: utf-8 -*- */
+/* gtksourcebufferinternal.c
+ * This file is part of GtkSourceView
+ *
+ * Copyright (C) 2016 - Sébastien Wilmet <swilmet gnome org>
+ *
+ * GtkSourceView is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * GtkSourceView is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "gtksourcebufferinternal.h"
+#include "gtksourcebuffer.h"
+
+/* A private extension of GtkSourceBuffer, to add private signals and
+ * properties.
+ */
+
+struct _GtkSourceBufferInternal
+{
+       GObject parent_instance;
+};
+
+#define GTK_SOURCE_BUFFER_INTERNAL_KEY "gtk-source-buffer-internal-key"
+
+G_DEFINE_TYPE (GtkSourceBufferInternal, _gtk_source_buffer_internal, G_TYPE_OBJECT)
+
+static void
+_gtk_source_buffer_internal_dispose (GObject *object)
+{
+
+       G_OBJECT_CLASS (_gtk_source_buffer_internal_parent_class)->dispose (object);
+}
+
+static void
+_gtk_source_buffer_internal_class_init (GtkSourceBufferInternalClass *klass)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+       object_class->dispose = _gtk_source_buffer_internal_dispose;
+}
+
+static void
+_gtk_source_buffer_internal_init (GtkSourceBufferInternal *buffer_internal)
+{
+}
+
+/*
+ * _gtk_source_buffer_internal_get_from_buffer:
+ * @buffer: a #GtkSourceBuffer.
+ *
+ * Returns the #GtkSourceBufferInternal object of @buffer. The returned object
+ * is guaranteed to be the same for the lifetime of @buffer.
+ *
+ * Returns: (transfer none): the #GtkSourceBufferInternal object of @buffer.
+ */
+GtkSourceBufferInternal *
+_gtk_source_buffer_internal_get_from_buffer (GtkSourceBuffer *buffer)
+{
+       GtkSourceBufferInternal *buffer_internal;
+
+       g_return_val_if_fail (GTK_SOURCE_IS_BUFFER (buffer), NULL);
+
+       buffer_internal = g_object_get_data (G_OBJECT (buffer), GTK_SOURCE_BUFFER_INTERNAL_KEY);
+
+       if (buffer_internal == NULL)
+       {
+               buffer_internal = g_object_new (GTK_SOURCE_TYPE_BUFFER_INTERNAL, NULL);
+
+               g_object_set_data_full (G_OBJECT (buffer),
+                                       GTK_SOURCE_BUFFER_INTERNAL_KEY,
+                                       buffer_internal,
+                                       g_object_unref);
+       }
+
+       g_return_val_if_fail (GTK_SOURCE_IS_BUFFER_INTERNAL (buffer_internal), NULL);
+       return buffer_internal;
+}
diff --git a/gtksourceview/gtksourcebufferinternal.h b/gtksourceview/gtksourcebufferinternal.h
new file mode 100644
index 0000000..f67ab3b
--- /dev/null
+++ b/gtksourceview/gtksourcebufferinternal.h
@@ -0,0 +1,44 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; coding: utf-8 -*- */
+/* gtksourcebufferinternal.h
+ * This file is part of GtkSourceView
+ *
+ * Copyright (C) 2016 - Sébastien Wilmet <swilmet gnome org>
+ *
+ * GtkSourceView is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * GtkSourceView is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef GTK_SOURCE_BUFFER_INTERNAL_H
+#define GTK_SOURCE_BUFFER_INTERNAL_H
+
+#include <glib-object.h>
+#include "gtksourcetypes.h"
+#include "gtksourcetypes-private.h"
+
+G_BEGIN_DECLS
+
+#define GTK_SOURCE_TYPE_BUFFER_INTERNAL (_gtk_source_buffer_internal_get_type ())
+
+G_GNUC_INTERNAL
+G_DECLARE_FINAL_TYPE (GtkSourceBufferInternal, _gtk_source_buffer_internal,
+                     GTK_SOURCE, BUFFER_INTERNAL,
+                     GObject)
+
+G_GNUC_INTERNAL
+GtkSourceBufferInternal *
+               _gtk_source_buffer_internal_get_from_buffer             (GtkSourceBuffer *buffer);
+
+G_END_DECLS
+
+#endif /* GTK_SOURCE_BUFFER_INTERNAL_H */
diff --git a/gtksourceview/gtksourcetypes-private.h b/gtksourceview/gtksourcetypes-private.h
index 857a4b2..f613625 100644
--- a/gtksourceview/gtksourcetypes-private.h
+++ b/gtksourceview/gtksourcetypes-private.h
@@ -27,6 +27,7 @@
 G_BEGIN_DECLS
 
 typedef struct _GtkSourceBufferInputStream     GtkSourceBufferInputStream;
+typedef struct _GtkSourceBufferInternal                GtkSourceBufferInternal;
 typedef struct _GtkSourceBufferOutputStream    GtkSourceBufferOutputStream;
 typedef struct _GtkSourceCompletionContainer   GtkSourceCompletionContainer;
 typedef struct _GtkSourceCompletionModel       GtkSourceCompletionModel;
diff --git a/po/POTFILES.in b/po/POTFILES.in
index ad05598..aa0c00e 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -4,6 +4,7 @@ data/styles/styles.pot
 gtksourceview/completion-providers/words/gtksourcecompletionwords.c
 gtksourceview/gtksourcebuffer.c
 gtksourceview/gtksourcebufferinputstream.c
+gtksourceview/gtksourcebufferinternal.c
 gtksourceview/gtksourcebufferoutputstream.c
 gtksourceview/gtksourcecompletion.c
 gtksourceview/gtksourcecompletioncontainer.c


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