[gtksourceview/wip/chergert/gsv-gtk4: 44/118] engine: modernize GtkSourceEngine



commit 88b5a442ff28377bd71b99478a64f332110e4caf
Author: Christian Hergert <chergert redhat com>
Date:   Thu Jan 9 12:34:13 2020 -0800

    engine: modernize GtkSourceEngine

 gtksourceview/gtksourcecontextengine-private.h |  2 +-
 gtksourceview/gtksourceengine-private.h        | 74 ++++++++++++++++++++++
 gtksourceview/gtksourceengine.c                | 40 ++++++------
 gtksourceview/gtksourceengine.h                | 86 --------------------------
 4 files changed, 95 insertions(+), 107 deletions(-)
---
diff --git a/gtksourceview/gtksourcecontextengine-private.h b/gtksourceview/gtksourcecontextengine-private.h
index 863c1e52..3d931b3b 100644
--- a/gtksourceview/gtksourcecontextengine-private.h
+++ b/gtksourceview/gtksourcecontextengine-private.h
@@ -21,7 +21,7 @@
 
 #pragma once
 
-#include "gtksourceengine.h"
+#include "gtksourceengine-private.h"
 #include "gtksourcetypes.h"
 #include "gtksourcetypes-private.h"
 
diff --git a/gtksourceview/gtksourceengine-private.h b/gtksourceview/gtksourceengine-private.h
new file mode 100644
index 00000000..aacc8b18
--- /dev/null
+++ b/gtksourceview/gtksourceengine-private.h
@@ -0,0 +1,74 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; coding: utf-8 -*-
+ *
+ * This file is part of GtkSourceView
+ *
+ * Copyright 2003 - Gustavo Giráldez
+ *
+ * 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include <gtk/gtk.h>
+#include "gtksourcetypes.h"
+#include "gtksourcetypes-private.h"
+
+G_BEGIN_DECLS
+
+#define GTK_SOURCE_TYPE_ENGINE (_gtk_source_engine_get_type())
+
+G_GNUC_INTERNAL
+G_DECLARE_INTERFACE (GtkSourceEngine, _gtk_source_engine, GTK_SOURCE, ENGINE, GObject)
+
+struct _GtkSourceEngineInterface
+{
+       GTypeInterface parent_interface;
+
+       void (* attach_buffer)    (GtkSourceEngine      *engine,
+                                  GtkTextBuffer        *buffer);
+       void (* text_inserted)    (GtkSourceEngine      *engine,
+                                  gint                  start_offset,
+                                  gint                  end_offset);
+       void (* text_deleted)     (GtkSourceEngine      *engine,
+                                  gint                  offset,
+                                  gint                  length);
+       void (* update_highlight) (GtkSourceEngine      *engine,
+                                  const GtkTextIter    *start,
+                                  const GtkTextIter    *end,
+                                  gboolean              synchronous);
+       void (* set_style_scheme) (GtkSourceEngine      *engine,
+                                  GtkSourceStyleScheme *scheme);
+};
+
+G_GNUC_INTERNAL
+void _gtk_source_engine_attach_buffer    (GtkSourceEngine      *engine,
+                                          GtkTextBuffer        *buffer);
+G_GNUC_INTERNAL
+void _gtk_source_engine_text_inserted    (GtkSourceEngine      *engine,
+                                          gint                  start_offset,
+                                          gint                  end_offset);
+G_GNUC_INTERNAL
+void _gtk_source_engine_text_deleted     (GtkSourceEngine      *engine,
+                                          gint                  offset,
+                                          gint                  length);
+G_GNUC_INTERNAL
+void _gtk_source_engine_update_highlight (GtkSourceEngine      *engine,
+                                          const GtkTextIter    *start,
+                                          const GtkTextIter    *end,
+                                          gboolean              synchronous);
+G_GNUC_INTERNAL
+void _gtk_source_engine_set_style_scheme (GtkSourceEngine      *engine,
+                                          GtkSourceStyleScheme *scheme);
+
+G_END_DECLS
diff --git a/gtksourceview/gtksourceengine.c b/gtksourceview/gtksourceengine.c
index eb5832e9..9e4b9ca2 100644
--- a/gtksourceview/gtksourceengine.c
+++ b/gtksourceview/gtksourceengine.c
@@ -22,7 +22,7 @@
 
 #include "config.h"
 
-#include "gtksourceengine.h"
+#include "gtksourceengine-private.h"
 #include "gtksourcestylescheme.h"
 
 G_DEFINE_INTERFACE (GtkSourceEngine, _gtk_source_engine, G_TYPE_OBJECT)
@@ -34,51 +34,51 @@ _gtk_source_engine_default_init (GtkSourceEngineInterface *interface)
 
 void
 _gtk_source_engine_attach_buffer (GtkSourceEngine *engine,
-                                 GtkTextBuffer   *buffer)
+                                  GtkTextBuffer   *buffer)
 {
        g_return_if_fail (GTK_SOURCE_IS_ENGINE (engine));
-       g_return_if_fail (GTK_SOURCE_ENGINE_GET_INTERFACE (engine)->attach_buffer != NULL);
+       g_return_if_fail (GTK_SOURCE_ENGINE_GET_IFACE (engine)->attach_buffer != NULL);
 
-       GTK_SOURCE_ENGINE_GET_INTERFACE (engine)->attach_buffer (engine, buffer);
+       GTK_SOURCE_ENGINE_GET_IFACE (engine)->attach_buffer (engine, buffer);
 }
 
 void
 _gtk_source_engine_text_inserted (GtkSourceEngine *engine,
-                                 gint             start_offset,
-                                 gint             end_offset)
+                                  gint             start_offset,
+                                  gint             end_offset)
 {
        g_return_if_fail (GTK_SOURCE_IS_ENGINE (engine));
-       g_return_if_fail (GTK_SOURCE_ENGINE_GET_INTERFACE (engine)->text_inserted != NULL);
+       g_return_if_fail (GTK_SOURCE_ENGINE_GET_IFACE (engine)->text_inserted != NULL);
 
-       GTK_SOURCE_ENGINE_GET_INTERFACE (engine)->text_inserted (engine,
+       GTK_SOURCE_ENGINE_GET_IFACE (engine)->text_inserted (engine,
                                                                 start_offset,
                                                                 end_offset);
 }
 
 void
 _gtk_source_engine_text_deleted (GtkSourceEngine *engine,
-                                gint             offset,
-                                gint             length)
+                                 gint             offset,
+                                 gint             length)
 {
        g_return_if_fail (GTK_SOURCE_IS_ENGINE (engine));
-       g_return_if_fail (GTK_SOURCE_ENGINE_GET_INTERFACE (engine)->text_deleted != NULL);
+       g_return_if_fail (GTK_SOURCE_ENGINE_GET_IFACE (engine)->text_deleted != NULL);
 
-       GTK_SOURCE_ENGINE_GET_INTERFACE (engine)->text_deleted (engine,
+       GTK_SOURCE_ENGINE_GET_IFACE (engine)->text_deleted (engine,
                                                                offset,
                                                                length);
 }
 
 void
 _gtk_source_engine_update_highlight (GtkSourceEngine   *engine,
-                                    const GtkTextIter *start,
-                                    const GtkTextIter *end,
-                                    gboolean           synchronous)
+                                     const GtkTextIter *start,
+                                     const GtkTextIter *end,
+                                     gboolean           synchronous)
 {
        g_return_if_fail (GTK_SOURCE_IS_ENGINE (engine));
        g_return_if_fail (start != NULL && end != NULL);
-       g_return_if_fail (GTK_SOURCE_ENGINE_GET_INTERFACE (engine)->update_highlight != NULL);
+       g_return_if_fail (GTK_SOURCE_ENGINE_GET_IFACE (engine)->update_highlight != NULL);
 
-       GTK_SOURCE_ENGINE_GET_INTERFACE (engine)->update_highlight (engine,
+       GTK_SOURCE_ENGINE_GET_IFACE (engine)->update_highlight (engine,
                                                                    start,
                                                                    end,
                                                                    synchronous);
@@ -86,11 +86,11 @@ _gtk_source_engine_update_highlight (GtkSourceEngine   *engine,
 
 void
 _gtk_source_engine_set_style_scheme (GtkSourceEngine      *engine,
-                                    GtkSourceStyleScheme *scheme)
+                                     GtkSourceStyleScheme *scheme)
 {
        g_return_if_fail (GTK_SOURCE_IS_ENGINE (engine));
        g_return_if_fail (GTK_SOURCE_IS_STYLE_SCHEME (scheme) || scheme == NULL);
-       g_return_if_fail (GTK_SOURCE_ENGINE_GET_INTERFACE (engine)->set_style_scheme != NULL);
+       g_return_if_fail (GTK_SOURCE_ENGINE_GET_IFACE (engine)->set_style_scheme != NULL);
 
-       GTK_SOURCE_ENGINE_GET_INTERFACE (engine)->set_style_scheme (engine, scheme);
+       GTK_SOURCE_ENGINE_GET_IFACE (engine)->set_style_scheme (engine, scheme);
 }


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