[gtksourceview] utils: fix data subdir in get_default_dirs()



commit c6ad8626ed2274e8abff0d48fada38c9643e41b3
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sun Sep 24 10:47:17 2017 +0200

    utils: fix data subdir in get_default_dirs()
    
    GtkSourceView 3.99 was still reading the GtkSourceView 3 data files
    (language specs and style schemes).
    
    Add GSV_API_VERSION to config.h, and use the value for the data subdir.

 configure.ac                        |    7 +++++--
 gtksourceview/gtksourceview-utils.c |    6 +++---
 2 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index c7bd224..5ad86c8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -46,7 +46,7 @@ GSV_LT_CURRENT=0
 GSV_LT_REVISION=0
 GSV_LT_AGE=0
 GSV_LT_VERSION="$GSV_LT_CURRENT:$GSV_LT_REVISION:$GSV_LT_AGE"
-AC_SUBST(GSV_LT_VERSION)
+AC_SUBST([GSV_LT_VERSION])
 
 # API version, used for parallel installability.
 # Not used in:
@@ -55,7 +55,10 @@ AC_SUBST(GSV_LT_VERSION)
 # Because as far as I've tested, it is not easily feasible to not hardcode the
 # API version in those places (swilmet).
 GSV_API_VERSION=4
-AC_SUBST(GSV_API_VERSION)
+AC_SUBST([GSV_API_VERSION])
+AC_DEFINE_UNQUOTED([GSV_API_VERSION],
+                  ["$GSV_API_VERSION"],
+                  [Define to the GtkSourceView API version.])
 
 # Dependencies
 glib_req=2.48
diff --git a/gtksourceview/gtksourceview-utils.c b/gtksourceview/gtksourceview-utils.c
index de4fe4d..56fc5e6 100644
--- a/gtksourceview/gtksourceview-utils.c
+++ b/gtksourceview/gtksourceview-utils.c
@@ -27,7 +27,7 @@
 #include <math.h>
 #include <glib/gi18n-lib.h>
 
-#define SOURCEVIEW_DIR "gtksourceview-3.0"
+#define GSV_DATA_SUBDIR "gtksourceview-" GSV_API_VERSION
 
 gchar **
 _gtk_source_utils_get_default_dirs (const gchar *basename)
@@ -39,7 +39,7 @@ _gtk_source_utils_get_default_dirs (const gchar *basename)
 
        /* User dir */
        g_ptr_array_add (dirs, g_build_filename (g_get_user_data_dir (),
-                                                SOURCEVIEW_DIR,
+                                                GSV_DATA_SUBDIR,
                                                 basename,
                                                 NULL));
 
@@ -49,7 +49,7 @@ _gtk_source_utils_get_default_dirs (const gchar *basename)
             system_dirs++)
        {
                g_ptr_array_add (dirs, g_build_filename (*system_dirs,
-                                                        SOURCEVIEW_DIR,
+                                                        GSV_DATA_SUBDIR,
                                                         basename,
                                                         NULL));
        }


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