[gtksourceview/wip/chergert/gsv-gtk4: 54/131] renderer: modernize GtkSourceGutterRendererMarks
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/chergert/gsv-gtk4: 54/131] renderer: modernize GtkSourceGutterRendererMarks
- Date: Wed, 29 Jan 2020 17:22:03 +0000 (UTC)
commit a2e2440ab54b1a638dbc0c9956fa1f4b444dbe8c
Author: Christian Hergert <chergert redhat com>
Date: Thu Jan 9 11:47:36 2020 -0800
renderer: modernize GtkSourceGutterRendererMarks
docs/reference/meson.build | 2 +-
.../gtksourcegutterrenderermarks-private.h | 39 +++++++++++++++
gtksourceview/gtksourcegutterrenderermarks.c | 25 ++++++----
gtksourceview/gtksourcegutterrenderermarks.h | 56 ----------------------
gtksourceview/gtksourceview.c | 2 +-
5 files changed, 56 insertions(+), 68 deletions(-)
---
diff --git a/docs/reference/meson.build b/docs/reference/meson.build
index 2324b862..8415e80c 100644
--- a/docs/reference/meson.build
+++ b/docs/reference/meson.build
@@ -25,7 +25,7 @@ reference_private_h = [
'gtksourceengine.h',
'gtksourcegutter-private.h',
'gtksourcegutterrendererlines.h',
- 'gtksourcegutterrenderermarks.h',
+ 'gtksourcegutterrenderermarks-private.h',
'gtksourcegutterrenderer-private.h',
'gtksourceiter.h',
'gtksourcelanguage-private.h',
diff --git a/gtksourceview/gtksourcegutterrenderermarks-private.h
b/gtksourceview/gtksourcegutterrenderermarks-private.h
new file mode 100644
index 00000000..83976c31
--- /dev/null
+++ b/gtksourceview/gtksourcegutterrenderermarks-private.h
@@ -0,0 +1,39 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; coding: utf-8 -*-
+ *
+ * This file is part of GtkSourceView
+ *
+ * Copyright 2010 - Jesse van den Kieboom
+ *
+ * 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"
+#include "gtksourcegutterrendererpixbuf.h"
+
+G_BEGIN_DECLS
+
+#define GTK_SOURCE_TYPE_GUTTER_RENDERER_MARKS (gtk_source_gutter_renderer_marks_get_type())
+
+G_GNUC_INTERNAL
+G_DECLARE_FINAL_TYPE (GtkSourceGutterRendererMarks, gtk_source_gutter_renderer_marks, GTK_SOURCE,
GUTTER_RENDERER_MARKS, GtkSourceGutterRendererPixbuf)
+
+G_GNUC_INTERNAL
+GtkSourceGutterRenderer *gtk_source_gutter_renderer_marks_new (void);
+
+G_END_DECLS
diff --git a/gtksourceview/gtksourcegutterrenderermarks.c b/gtksourceview/gtksourcegutterrenderermarks.c
index af7da0e3..70f9d508 100644
--- a/gtksourceview/gtksourcegutterrenderermarks.c
+++ b/gtksourceview/gtksourcegutterrenderermarks.c
@@ -20,24 +20,29 @@
#include "config.h"
-#include "gtksourcegutterrenderermarks.h"
+#include "gtksourcegutterrenderermarks-private.h"
#include "gtksourceview.h"
#include "gtksourcebuffer.h"
#include "gtksourcemarkattributes.h"
#include "gtksourcemark.h"
-#define COMPOSITE_ALPHA 225
+#define COMPOSITE_ALPHA 225
+
+struct _GtkSourceGutterRendererMarks
+{
+ GtkSourceGutterRendererPixbuf parent_instance;
+};
G_DEFINE_TYPE (GtkSourceGutterRendererMarks, gtk_source_gutter_renderer_marks,
GTK_SOURCE_TYPE_GUTTER_RENDERER_PIXBUF)
static gint
sort_marks_by_priority (gconstpointer m1,
- gconstpointer m2,
- gpointer data)
+ gconstpointer m2,
+ gpointer data)
{
- GtkSourceMark *mark1 = GTK_SOURCE_MARK (m1);
- GtkSourceMark *mark2 = GTK_SOURCE_MARK (m2);
- GtkSourceView *view = GTK_SOURCE_VIEW (data);
+ GtkSourceMark *mark1 = (GtkSourceMark *)m1;
+ GtkSourceMark *mark2 = (GtkSourceMark *)m2;
+ GtkSourceView *view = data;
GtkTextIter iter1, iter2;
gint line1;
gint line2;
@@ -165,9 +170,9 @@ composite_marks (GtkSourceView *view,
static void
gutter_renderer_query_data (GtkSourceGutterRenderer *renderer,
- GtkTextIter *start,
- GtkTextIter *end,
- GtkSourceGutterRendererState state)
+ GtkTextIter *start,
+ GtkTextIter *end,
+ GtkSourceGutterRendererState state)
{
GSList *marks;
GdkPixbuf *pixbuf = NULL;
diff --git a/gtksourceview/gtksourceview.c b/gtksourceview/gtksourceview.c
index aaede543..d5a56741 100644
--- a/gtksourceview/gtksourceview.c
+++ b/gtksourceview/gtksourceview.c
@@ -46,7 +46,7 @@
#include "gtksourcegutter.h"
#include "gtksourcegutter-private.h"
#include "gtksourcegutterrendererlines.h"
-#include "gtksourcegutterrenderermarks.h"
+#include "gtksourcegutterrenderermarks-private.h"
#include "gtksourceiter.h"
#include "gtksourcesearchcontext.h"
#include "gtksourcespacedrawer.h"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]