[gedit/wip/chergert/gsv-4: 2/2] build: port to gtksourceview-4



commit 2dfe26dac92896ce19c09f8ca79d6c5a8c72fb33
Author: Christian Hergert <chergert redhat com>
Date:   Wed Sep 26 11:13:06 2018 -0700

    build: port to gtksourceview-4
    
    This is a port to GtkSourceView-4 which alters the API a bit. The only
    non-straightforward part is the fix for replaying previous search results,
    although even that is not much different.

 configure.ac                  |  4 ++--
 data/gedit-bugreport.sh       |  2 +-
 data/gedit.pc.in              |  2 +-
 gedit/Makefile.am             |  4 ++--
 gedit/gedit-commands-search.c | 34 ++++++++++++++++----------------
 gedit/gedit-view-frame.c      | 46 ++++++++++++++++++++++++-------------------
 osx/bundle/data/gedit.bundle  |  2 +-
 snap/snapcraft.yaml           |  2 +-
 win32/make-gedit-installer    |  2 +-
 9 files changed, 52 insertions(+), 46 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 31634f0eb..92f2592ed 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,7 +19,7 @@ AC_SUBST(GEDIT_API_VERSION)
 # Dependencies
 GLIB_REQUIRED=2.44
 GTK_REQUIRED=3.22.0
-GTKSOURCEVIEW_REQUIRED=3.22.0
+GTKSOURCEVIEW_REQUIRED=4.0.2
 LIBPEAS_REQUIRED=1.14.1
 LIBXML_REQUIRED=2.5.0
 GSPELL_REQUIRED=0.2.5
@@ -288,7 +288,7 @@ PKG_CHECK_MODULES(GEDIT, [
        gio-2.0 >= $GLIB_REQUIRED
        gmodule-2.0
        gtk+-3.0 >= $GTK_REQUIRED
-       gtksourceview-3.0 >= $GTKSOURCEVIEW_REQUIRED
+       gtksourceview-4 >= $GTKSOURCEVIEW_REQUIRED
        libpeas-1.0 >= $LIBPEAS_REQUIRED
        libpeas-gtk-1.0 >= $LIBPEAS_REQUIRED
        gsettings-desktop-schemas
diff --git a/data/gedit-bugreport.sh b/data/gedit-bugreport.sh
index 163992aa2..e66150278 100755
--- a/data/gedit-bugreport.sh
+++ b/data/gedit-bugreport.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-PKG_CONFIG_MODULES="glib-2.0 gtk+-3.0 gtksourceview-3.0 \
+PKG_CONFIG_MODULES="glib-2.0 gtk+-3.0 gtksourceview-4 \
                    pygobject-2.0 \
                    enchant iso-codes"
 
diff --git a/data/gedit.pc.in b/data/gedit.pc.in
index 27975bf49..e66cc7bc2 100644
--- a/data/gedit.pc.in
+++ b/data/gedit.pc.in
@@ -5,7 +5,7 @@ includedir=@includedir@
 
 Name: gedit
 Description: gedit
-Requires: gtksourceview-3.0 libpeas-1.0 libpeas-gtk-1.0
+Requires: gtksourceview-4 libpeas-1.0 libpeas-gtk-1.0
 Version: @VERSION@
 Cflags: -I${includedir}/gedit-@GEDIT_API_VERSION@
 Libs: -L${libdir} @GEDIT_IMPLIB@
diff --git a/gedit/Makefile.am b/gedit/Makefile.am
index 737b58dfe..fa2f92dd6 100644
--- a/gedit/Makefile.am
+++ b/gedit/Makefile.am
@@ -269,7 +269,7 @@ INTROSPECTION_SCANNER_ARGS = -I$(top_srcdir) --warn-all
 gedit_Gedit_3_0_gir_NAMESPACE = Gedit
 gedit_Gedit_3_0_gir_VERSION = 3.0
 gedit_Gedit_3_0_gir_PROGRAM = $(builddir)/gedit/gedit$(EXEEXT)
-gedit_Gedit_3_0_gir_INCLUDES = Gtk-3.0 GtkSource-3.0
+gedit_Gedit_3_0_gir_INCLUDES = Gtk-3.0 GtkSource-4
 gedit_Gedit_3_0_gir_EXPORT_PACKAGES = gedit
 gedit_Gedit_3_0_gir_SCANNERFLAGS = $(GEDIT_CFLAGS) $(foreach 
header,$(gedit_INST_H_FILES),--c-include="$(header)")
 gedit_Gedit_3_0_gir_FILES =            \
@@ -295,7 +295,7 @@ gedit/gedit.vapi: gedit/Gedit-3.0.gir
 
 VAPIGEN_VAPIS = gedit/gedit.vapi
 
-gedit_gedit_vapi_DEPS = atk gdk-3.0 gio-2.0 gtk+-3.0 gtksourceview-3.0
+gedit_gedit_vapi_DEPS = atk gdk-3.0 gio-2.0 gtk+-3.0 gtksourceview-4
 gedit_gedit_vapi_METADATADIRS = $(top_srcdir)/gedit
 gedit_gedit_vapi_FILES = gedit/Gedit-3.0.gir
 
diff --git a/gedit/gedit-commands-search.c b/gedit/gedit-commands-search.c
index 265b9c268..33a2f56a0 100644
--- a/gedit/gedit-commands-search.c
+++ b/gedit/gedit-commands-search.c
@@ -174,12 +174,12 @@ forward_search_finished (GtkSourceSearchContext *search_context,
        GtkTextIter match_start;
        GtkTextIter match_end;
 
-       found = gtk_source_search_context_forward_finish2 (search_context,
-                                                          result,
-                                                          &match_start,
-                                                          &match_end,
-                                                          NULL,
-                                                          NULL);
+       found = gtk_source_search_context_forward_finish (search_context,
+                                                         result,
+                                                         &match_start,
+                                                         &match_end,
+                                                         NULL,
+                                                         NULL);
 
        buffer = gtk_source_search_context_get_buffer (search_context);
 
@@ -280,12 +280,12 @@ backward_search_finished (GtkSourceSearchContext *search_context,
        GtkTextIter match_end;
        GtkSourceBuffer *buffer;
 
-       found = gtk_source_search_context_backward_finish2 (search_context,
-                                                           result,
-                                                           &match_start,
-                                                           &match_end,
-                                                           NULL,
-                                                           NULL);
+       found = gtk_source_search_context_backward_finish (search_context,
+                                                          result,
+                                                          &match_start,
+                                                          &match_end,
+                                                          NULL,
+                                                          NULL);
 
        buffer = gtk_source_search_context_get_buffer (search_context);
 
@@ -424,11 +424,11 @@ do_replace (GeditReplaceDialog *dialog,
 
        gtk_text_buffer_get_selection_bounds (GTK_TEXT_BUFFER (doc), &start, &end);
 
-       gtk_source_search_context_replace2 (search_context,
-                                           &start,
-                                           &end,
-                                           unescaped_replace_text,
-                                           -1,
+       gtk_source_search_context_replace (search_context,
+                                          &start,
+                                          &end,
+                                          unescaped_replace_text,
+                                          -1,
                                            &error);
 
        g_free (unescaped_replace_text);
diff --git a/gedit/gedit-view-frame.c b/gedit/gedit-view-frame.c
index 059232f0a..0d9923b88 100644
--- a/gedit/gedit-view-frame.c
+++ b/gedit/gedit-view-frame.c
@@ -323,12 +323,12 @@ start_search_finished (GtkSourceSearchContext *search_context,
        gboolean found;
        GtkSourceBuffer *buffer;
 
-       found = gtk_source_search_context_forward_finish2 (search_context,
-                                                          result,
-                                                          &match_start,
-                                                          &match_end,
-                                                          NULL,
-                                                          NULL);
+       found = gtk_source_search_context_forward_finish (search_context,
+                                                         result,
+                                                         &match_start,
+                                                         &match_end,
+                                                         NULL,
+                                                         NULL);
 
        buffer = gtk_source_search_context_get_buffer (search_context);
 
@@ -387,12 +387,12 @@ forward_search_finished (GtkSourceSearchContext *search_context,
        GtkTextIter match_end;
        gboolean found;
 
-       found = gtk_source_search_context_forward_finish2 (search_context,
-                                                          result,
-                                                          &match_start,
-                                                          &match_end,
-                                                          NULL,
-                                                          NULL);
+       found = gtk_source_search_context_forward_finish (search_context,
+                                                         result,
+                                                         &match_start,
+                                                         &match_end,
+                                                         NULL,
+                                                         NULL);
 
        if (found)
        {
@@ -445,12 +445,12 @@ backward_search_finished (GtkSourceSearchContext *search_context,
        gboolean found;
        GtkSourceBuffer *buffer;
 
-       found = gtk_source_search_context_backward_finish2 (search_context,
-                                                           result,
-                                                           &match_start,
-                                                           &match_end,
-                                                           NULL,
-                                                           NULL);
+       found = gtk_source_search_context_backward_finish (search_context,
+                                                          result,
+                                                          &match_start,
+                                                          &match_end,
+                                                          NULL,
+                                                          NULL);
 
        buffer = gtk_source_search_context_get_buffer (search_context);
 
@@ -852,11 +852,17 @@ search_entry_escaped (GtkSearchEntry *entry,
        if (frame->search_mode == SEARCH &&
            search_context != NULL)
        {
+               GtkSourceSearchContext *search_context;
+               GtkTextBuffer *buffer;
+
                g_clear_object (&frame->search_settings);
                frame->search_settings = copy_search_settings (frame->old_search_settings);
 
-               gtk_source_search_context_set_settings (search_context,
-                                                       frame->search_settings);
+               buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (frame->view));
+               search_context = gtk_source_search_context_new (GTK_SOURCE_BUFFER (buffer),
+                                                               frame->search_settings);
+               gedit_document_set_search_context (GEDIT_DOCUMENT (buffer), search_context);
+               g_object_unref (search_context);
 
                g_free (frame->search_text);
                frame->search_text = NULL;
diff --git a/osx/bundle/data/gedit.bundle b/osx/bundle/data/gedit.bundle
index 66df825b1..edb138ff9 100644
--- a/osx/bundle/data/gedit.bundle
+++ b/osx/bundle/data/gedit.bundle
@@ -87,7 +87,7 @@
   <data>${prefix}/etc/gtk-3.0/*</data>
 
   <!-- gtksourceview -->
-  <data>${prefix}/share/gtksourceview-3.0</data>
+  <data>${prefix}/share/gtksourceview-4</data>
 
   <!-- gedit -->
   <data>${prefix}/share/gedit</data>
diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml
index 4d110a820..e4713261e 100644
--- a/snap/snapcraft.yaml
+++ b/snap/snapcraft.yaml
@@ -87,7 +87,7 @@ parts:
       - libxml2-dev
       - libglib2.0-dev
       - libgtk-3-dev
-      - libgtksourceview-3.0-dev
+      - libgtksourceview-4-dev
       - libpeas-dev
       - libx11-dev
       - python3
diff --git a/win32/make-gedit-installer b/win32/make-gedit-installer
index e982319e8..61228c5ab 100644
--- a/win32/make-gedit-installer
+++ b/win32/make-gedit-installer
@@ -104,7 +104,7 @@ remove_useless_stuff() {
   find installer/SourceDir -name *.exe | xargs strip
 
   # remove some translation which seem to add a lot of size
-  find installer/SourceDir/share/locale/ -type f | grep -v atk10.mo | grep -v libpeas.mo | grep -v 
gsettings-desktop-schemas.mo | grep -v json-glib-1.0.mo | grep -v glib20.mo | grep -v gedit.mo | grep -v 
gedit-plugins.mo | grep -v gdk-pixbuf.mo | grep -v gtk30.mo | grep -v gtk30-properties.mo | grep -v 
gtksourceview-3.0.mo | grep -v iso_*.mo | xargs rm
+  find installer/SourceDir/share/locale/ -type f | grep -v atk10.mo | grep -v libpeas.mo | grep -v 
gsettings-desktop-schemas.mo | grep -v json-glib-1.0.mo | grep -v glib20.mo | grep -v gedit.mo | grep -v 
gedit-plugins.mo | grep -v gdk-pixbuf.mo | grep -v gtk30.mo | grep -v gtk30-properties.mo | grep -v 
gtksourceview-4.mo | grep -v iso_*.mo | xargs rm
   find installer/SourceDir/share/locale -type d | xargs rmdir -p --ignore-fail-on-non-empty
 }
 


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