[gtksourceview/wip/delegate-space-drawing] Create SpaceDrawer private class to delegate space drawing



commit 9c88a782d193f4ef80e30fa122ca4ebf6274bde5
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Thu Jul 21 15:05:12 2016 +0200

    Create SpaceDrawer private class to delegate space drawing
    
    gtksourceview.c is quite big (more than 5000 lines of code). So
    delegating some more work is better. It's clearer to have all the
    space-drawing-related code in one place.
    
    In gtksourcespacedrawer.c, add correct copyrights based on git blame.

 docs/reference/Makefile.am             |    1 +
 gtksourceview/Makefile.am              |    2 +
 gtksourceview/gtksourcespacedrawer.c   |   54 ++++++++++++++++++++++++++++++
 gtksourceview/gtksourcespacedrawer.h   |   56 ++++++++++++++++++++++++++++++++
 gtksourceview/gtksourcetypes-private.h |    3 +-
 po/POTFILES.in                         |    1 +
 6 files changed, 116 insertions(+), 1 deletions(-)
---
diff --git a/docs/reference/Makefile.am b/docs/reference/Makefile.am
index a6f6b16..23037c6 100644
--- a/docs/reference/Makefile.am
+++ b/docs/reference/Makefile.am
@@ -53,6 +53,7 @@ IGNORE_HFILES =                                       \
        gtksourcemarkssequence.h                \
        gtksourcepixbufhelper.h                 \
        gtksourceregex.h                        \
+       gtksourcespacedrawer.h                  \
        gtksourcestyle-private.h                \
        gtksourcetypes-private.h                \
        gtksourceundomanagerdefault.h           \
diff --git a/gtksourceview/Makefile.am b/gtksourceview/Makefile.am
index 86f2a76..787132f 100644
--- a/gtksourceview/Makefile.am
+++ b/gtksourceview/Makefile.am
@@ -114,6 +114,7 @@ libgtksourceview_private_headers =          \
        gtksourcemarkssequence.h                \
        gtksourcepixbufhelper.h                 \
        gtksourceregex.h                        \
+       gtksourcespacedrawer.h                  \
        gtksourcestyle-private.h                \
        gtksourcetypes-private.h                \
        gtksourceundomanagerdefault.h           \
@@ -135,6 +136,7 @@ libgtksourceview_private_c_files =  \
        gtksourcemarkssequence.c        \
        gtksourcepixbufhelper.c         \
        gtksourceregex.c                \
+       gtksourcespacedrawer.c          \
        gtksourceundomanagerdefault.c   \
        gtksourceview-i18n.c            \
        gtksourceview-utils.c
diff --git a/gtksourceview/gtksourcespacedrawer.c b/gtksourceview/gtksourcespacedrawer.c
new file mode 100644
index 0000000..627244e
--- /dev/null
+++ b/gtksourceview/gtksourcespacedrawer.c
@@ -0,0 +1,54 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; coding: utf-8 -*- */
+/* gtksourcespacedrawer.c
+ * This file is part of GtkSourceView
+ *
+ * Copyright (C) 2008, 2011, 2016 - Paolo Borelli <pborelli gnome org>
+ * Copyright (C) 2008, 2010 - Ignacio Casal Quinteiro <icq gnome org>
+ * Copyright (C) 2010 - Garret Regier
+ * Copyright (C) 2013 - Arpad Borsos <arpad borsos googlemail com>
+ * Copyright (C) 2015, 2016 - Sébastien Wilmet <swilmet gnome org>
+ * Copyright (C) 2016 - Christian Hergert <christian hergert me>
+ *
+ * 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 "gtksourcespacedrawer.h"
+
+struct _GtkSourceSpaceDrawerPrivate
+{
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (GtkSourceSpaceDrawer, _gtk_source_space_drawer, G_TYPE_OBJECT)
+
+static void
+_gtk_source_space_drawer_finalize (GObject *object)
+{
+
+       G_OBJECT_CLASS (_gtk_source_space_drawer_parent_class)->finalize (object);
+}
+
+static void
+_gtk_source_space_drawer_class_init (GtkSourceSpaceDrawerClass *klass)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+       object_class->finalize = _gtk_source_space_drawer_finalize;
+}
+
+static void
+_gtk_source_space_drawer_init (GtkSourceSpaceDrawer *drawer)
+{
+       drawer->priv = _gtk_source_space_drawer_get_instance_private (drawer);
+}
diff --git a/gtksourceview/gtksourcespacedrawer.h b/gtksourceview/gtksourcespacedrawer.h
new file mode 100644
index 0000000..0551054
--- /dev/null
+++ b/gtksourceview/gtksourcespacedrawer.h
@@ -0,0 +1,56 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; coding: utf-8 -*- */
+/* gtksourcespacedrawer.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_SPACE_DRAWER_H
+#define GTK_SOURCE_SPACE_DRAWER_H
+
+#include <glib-object.h>
+#include "gtksourcetypes-private.h"
+
+G_BEGIN_DECLS
+
+#define GTK_SOURCE_TYPE_SPACE_DRAWER             (_gtk_source_space_drawer_get_type ())
+#define GTK_SOURCE_SPACE_DRAWER(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GTK_SOURCE_TYPE_SPACE_DRAWER, GtkSourceSpaceDrawer))
+#define GTK_SOURCE_SPACE_DRAWER_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), 
GTK_SOURCE_TYPE_SPACE_DRAWER, GtkSourceSpaceDrawerClass))
+#define GTK_SOURCE_IS_SPACE_DRAWER(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
GTK_SOURCE_TYPE_SPACE_DRAWER))
+#define GTK_SOURCE_IS_SPACE_DRAWER_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), 
GTK_SOURCE_TYPE_SPACE_DRAWER))
+#define GTK_SOURCE_SPACE_DRAWER_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), 
GTK_SOURCE_TYPE_SPACE_DRAWER, GtkSourceSpaceDrawerClass))
+
+typedef struct _GtkSourceSpaceDrawerClass    GtkSourceSpaceDrawerClass;
+typedef struct _GtkSourceSpaceDrawerPrivate  GtkSourceSpaceDrawerPrivate;
+
+struct _GtkSourceSpaceDrawer
+{
+       GObject parent;
+
+       GtkSourceSpaceDrawerPrivate *priv;
+};
+
+struct _GtkSourceSpaceDrawerClass
+{
+       GObjectClass parent_class;
+};
+
+GType _gtk_source_space_drawer_get_type (void) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif /* GTK_SOURCE_SPACE_DRAWER_H */
diff --git a/gtksourceview/gtksourcetypes-private.h b/gtksourceview/gtksourcetypes-private.h
index 283bfe0..857a4b2 100644
--- a/gtksourceview/gtksourcetypes-private.h
+++ b/gtksourceview/gtksourcetypes-private.h
@@ -2,7 +2,7 @@
  * gtksourcetypes-private.h
  * This file is part of GtkSourceView
  *
- * Copyright (C) 2012 - Sébastien Wilmet <swilmet gnome org>
+ * Copyright (C) 2012, 2013, 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
@@ -37,6 +37,7 @@ typedef struct _GtkSourceGutterRendererMarks  GtkSourceGutterRendererMarks;
 typedef struct _GtkSourceMarksSequence         GtkSourceMarksSequence;
 typedef struct _GtkSourcePixbufHelper          GtkSourcePixbufHelper;
 typedef struct _GtkSourceRegex                 GtkSourceRegex;
+typedef struct _GtkSourceSpaceDrawer           GtkSourceSpaceDrawer;
 typedef struct _GtkSourceUndoManagerDefault    GtkSourceUndoManagerDefault;
 
 #ifdef _MSC_VER
diff --git a/po/POTFILES.in b/po/POTFILES.in
index bc45896..95fdced 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -32,6 +32,7 @@ gtksourceview/gtksourceprintcompositor.c
 gtksourceview/gtksourceregex.c
 gtksourceview/gtksourcesearchcontext.c
 gtksourceview/gtksourcesearchsettings.c
+gtksourceview/gtksourcespacedrawer.c
 gtksourceview/gtksourcestyle.c
 gtksourceview/gtksourcestylescheme.c
 gtksourceview/gtksourcestyleschemechooserbutton.c


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