[gedit/wip/gcode] Create gcode-gedit.h



commit 29a59907decf836e67754ffc8c7ba7ef90914624
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Wed May 6 15:12:21 2015 +0200

    Create gcode-gedit.h
    
    This is a public gedit header. See the comment in the code.

 gedit/gcode/Makefile.am      |    9 ++++++-
 gedit/gcode/gcode-document.h |   21 +--------------
 gedit/gcode/gcode-gedit.h    |   58 ++++++++++++++++++++++++++++++++++++++++++
 gedit/gcode/gcode.h          |    1 +
 4 files changed, 68 insertions(+), 21 deletions(-)
---
diff --git a/gedit/gcode/Makefile.am b/gedit/gcode/Makefile.am
index 79687ea..cc2c90b 100644
--- a/gedit/gcode/Makefile.am
+++ b/gedit/gcode/Makefile.am
@@ -18,6 +18,9 @@ gedit_gcode_libgcode_la_LIBADD =      \
 
 gedit_gcode_libgcode_la_LDFLAGS = -no-undefined
 
+gcode_INST_H_FILES =                                   \
+       gedit/gcode/gcode-gedit.h
+
 gedit_gcode_libgcode_la_SOURCES =                      \
        gedit/gcode/gcode.h                             \
        gedit/gcode/gcode-debug.c                       \
@@ -27,4 +30,8 @@ gedit_gcode_libgcode_la_SOURCES =                     \
        gedit/gcode/gcode-metadata-manager.c            \
        gedit/gcode/gcode-metadata-manager.h            \
        gedit/gcode/gcode-utils.c                       \
-       gedit/gcode/gcode-utils.h
+       gedit/gcode/gcode-utils.h                       \
+       $(gcode_INST_H_FILES)
+
+gcode_headerdir = $(prefix)/include/gedit-$(GEDIT_API_VERSION)/gedit/gcode
+gcode_header_HEADERS = $(gcode_INST_H_FILES)
diff --git a/gedit/gcode/gcode-document.h b/gedit/gcode/gcode-document.h
index ebeaa63..43e3ae3 100644
--- a/gedit/gcode/gcode-document.h
+++ b/gedit/gcode/gcode-document.h
@@ -24,13 +24,10 @@
 #define __GCODE_DOCUMENT_H__
 
 #include <gtksourceview/gtksource.h>
+#include "gcode-gedit.h"
 
 G_BEGIN_DECLS
 
-#define GCODE_TYPE_DOCUMENT (gcode_document_get_type())
-
-G_DECLARE_DERIVABLE_TYPE (GcodeDocument, gcode_document, GCODE, DOCUMENT, GtkSourceBuffer)
-
 #ifdef G_OS_WIN32
 #define GCODE_METADATA_ATTRIBUTE_POSITION "position"
 #define GCODE_METADATA_ATTRIBUTE_ENCODING "encoding"
@@ -41,22 +38,6 @@ G_DECLARE_DERIVABLE_TYPE (GcodeDocument, gcode_document, GCODE, DOCUMENT, GtkSou
 #define GCODE_METADATA_ATTRIBUTE_LANGUAGE "metadata::gcode-language"
 #endif
 
-struct _GcodeDocumentClass
-{
-       GtkSourceBufferClass parent_class;
-
-       /* Signals */
-       void (* cursor_moved)           (GcodeDocument *document);
-
-       void (* load)                   (GcodeDocument *document);
-
-       void (* loaded)                 (GcodeDocument *document);
-
-       void (* save)                   (GcodeDocument *document);
-
-       void (* saved)                  (GcodeDocument *document);
-};
-
 GcodeDocument   *gcode_document_new                            (void);
 
 GtkSourceFile  *gcode_document_get_file                        (GcodeDocument       *doc);
diff --git a/gedit/gcode/gcode-gedit.h b/gedit/gcode/gcode-gedit.h
new file mode 100644
index 0000000..14384a4
--- /dev/null
+++ b/gedit/gcode/gcode-gedit.h
@@ -0,0 +1,58 @@
+/*
+ * This file is part of gcode.
+ *
+ * Copyright 2015 - Sébastien Wilmet <swilmet gnome org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GCODE_GEDIT_H__
+#define __GCODE_GEDIT_H__
+
+#include <gtksourceview/gtksource.h>
+
+/* This header is a public gedit header (for plugins). It contains GObject
+ * classes definition needed for the gedit public classes, so that they can
+ * subclass the classes defined here.
+ * For example GeditDocument is a subclass of GcodeDocument. Since GeditDocument
+ * is a public class, it needs the class definition of GcodeDocument.
+ */
+
+G_BEGIN_DECLS
+
+#define GCODE_TYPE_DOCUMENT (gcode_document_get_type())
+
+G_DECLARE_DERIVABLE_TYPE (GcodeDocument, gcode_document, GCODE, DOCUMENT, GtkSourceBuffer)
+
+struct _GcodeDocumentClass
+{
+       GtkSourceBufferClass parent_class;
+
+       /* Signals */
+       void (* cursor_moved)           (GcodeDocument *document);
+
+       void (* load)                   (GcodeDocument *document);
+
+       void (* loaded)                 (GcodeDocument *document);
+
+       void (* save)                   (GcodeDocument *document);
+
+       void (* saved)                  (GcodeDocument *document);
+};
+
+G_END_DECLS
+
+#endif /* __GCODE_GEDIT_H__ */
+
+/* ex:set ts=8 noet: */
diff --git a/gedit/gcode/gcode.h b/gedit/gcode/gcode.h
index 37ab76b..1249089 100644
--- a/gedit/gcode/gcode.h
+++ b/gedit/gcode/gcode.h
@@ -20,6 +20,7 @@
 #ifndef __GCODE_H__
 #define __GCODE_H__
 
+#include "gcode/gcode-gedit.h"
 #include "gcode/gcode-metadata-manager.h"
 #include "gcode/gcode-utils.h"
 


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