From 05c9434b7f853a68617365cf918a7f5d2dde0a2e Mon Sep 17 00:00:00 2001
From: Virgile Prevosto <virgile.prevosto@m4x.org>
Date: Wed, 21 Nov 2018 18:11:40 +0100
Subject: [PATCH] [GUI] Hack for maintaining compatibility between
 gtksourceview 2 and 3

---
 .gitignore                          |  1 +
 Makefile                            | 11 +++++++++++
 src/plugins/gui/GSourceView2.ml.in  |  2 ++
 src/plugins/gui/GSourceView2.mli.in |  2 ++
 4 files changed, 16 insertions(+)
 create mode 100644 src/plugins/gui/GSourceView2.ml.in
 create mode 100644 src/plugins/gui/GSourceView2.mli.in

diff --git a/.gitignore b/.gitignore
index 583b96d24e7..ddbe6066a1e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -197,3 +197,4 @@ hello-*.tar.gz
 #######################
 # should remain empty #
 #######################
+/src/plugins/gui/GSourceView2.mli
diff --git a/Makefile b/Makefile
index 88062fe83bd..24819a4a472 100644
--- a/Makefile
+++ b/Makefile
@@ -680,8 +680,19 @@ STARTUP_CMX=$(STARTUP_CMO:.cmo=.cmx)
 WTOOLKIT= \
 	wutil widget wbox wfile wpane wpalette wtext wtable
 
+SOURCEVIEWCOMPAT:=
+ifeq ($(strip $(GTKSOURCEVIEW)),lablgtk2.sourceview3)
+SOURCEVIEWCOMPAT:=GSourceView2
+
+src/plugins/gui/GSourceView2.ml%: src/plugins/gui/GSourceView2.ml%.in
+	$(CP) $< $@
+	$(CHMOD_RO) $@
+
+endif
+
 SINGLE_GUI_CMO:= \
 	$(WTOOLKIT) \
+	$(SOURCEVIEWCOMPAT) \
 	gui_parameters \
 	gtk_helper gtk_form \
 	source_viewer pretty_source source_manager book_manager \
diff --git a/src/plugins/gui/GSourceView2.ml.in b/src/plugins/gui/GSourceView2.ml.in
new file mode 100644
index 00000000000..0229c6b8a98
--- /dev/null
+++ b/src/plugins/gui/GSourceView2.ml.in
@@ -0,0 +1,2 @@
+(** compatibility layer between gtksourceview 2 and 3. *)
+include GSourceView3
diff --git a/src/plugins/gui/GSourceView2.mli.in b/src/plugins/gui/GSourceView2.mli.in
new file mode 100644
index 00000000000..5bc79402e96
--- /dev/null
+++ b/src/plugins/gui/GSourceView2.mli.in
@@ -0,0 +1,2 @@
+(* compatibility between gtksourceview 2 and 3. *)
+include module type of GSourceView3
-- 
GitLab