[gtk-osx] make enchant to look for modules/configs in env specified dirs



commit f60fc5dc19f057b341402a503f469edea61c030b
Author: Igor Mammedov <imammedo redhat com>
Date:   Wed Dec 31 17:28:41 2014 +0100

    make enchant to look for modules/configs in env specified dirs
    
    currently library looks for dictionary modules libraries and configs
    only at hardcoded places i.e. at isnstall prefix and $HOME.
    
    However it doesn't work when bundled application is moved to
    system without gtk-osx build env or it's moved to another place.
    
    Teach library check addtional pathes provided via env variables:
    ENCHANT_MODULE_PATH - for backend libraries
    XDG_DATA_DIRS - for default ordering config
    which should be set by luncher script of the bundle to point
    at spelling modules/configs directories.
    
    Signed-off-by: Igor Mammedov <imammedo redhat com>

 modulesets-stable/gtk-osx-unsupported.modules |    1 +
 patches/enchant-env.patch                     |   44 +++++++++++++++++++++++++
 2 files changed, 45 insertions(+), 0 deletions(-)
---
diff --git a/modulesets-stable/gtk-osx-unsupported.modules b/modulesets-stable/gtk-osx-unsupported.modules
index 116b905..cd53e91 100644
--- a/modulesets-stable/gtk-osx-unsupported.modules
+++ b/modulesets-stable/gtk-osx-unsupported.modules
@@ -125,6 +125,7 @@
     <branch module="1.6.0/enchant-1.6.0.tar.gz" version="1.6.0"
            repo="abisource/enchant">
  <patch file="http://git.gnome.org/browse/gtk-osx/plain/patches/enchant-gsize.patch"; strip="1"/>
+ <patch file="http://git.gnome.org/browse/gtk-osx/plain/patches/enchant-env.patch"; strip="1"/>
     </branch>
     <dependencies>
       <dep package="glib"/>
diff --git a/patches/enchant-env.patch b/patches/enchant-env.patch
new file mode 100644
index 0000000..71e4625
--- /dev/null
+++ b/patches/enchant-env.patch
@@ -0,0 +1,44 @@
+diff --git a/src/enchant.c b/src/enchant.c
+index 79fb21c..6f57fff 100644
+--- a/src/enchant.c
++++ b/src/enchant.c
+@@ -250,6 +250,11 @@ enchant_get_module_dirs (void)
+                       module_dirs = enchant_slist_append_unique_path (module_dirs, module_dir);
+               }
+ #endif
++      module_dir = g_getenv("ENCHANT_MODULE_PATH");
++      if (module_dir)
++              {
++                      module_dirs = enchant_slist_append_unique_path (module_dirs, g_strdup(module_dir));
++              }
+ 
+       return module_dirs;
+ }
+@@ -259,6 +264,7 @@ enchant_get_conf_dirs (void)
+ {
+       GSList *conf_dirs = NULL, *user_conf_dirs, *iter;
+       char * ordering_dir = NULL, * prefix = NULL;
++      char *xdg_data_dir;
+ 
+       user_conf_dirs = enchant_get_user_config_dirs();
+ 
+@@ -291,6 +297,19 @@ enchant_get_conf_dirs (void)
+       conf_dirs = enchant_slist_append_unique_path (conf_dirs, g_strdup (ENCHANT_GLOBAL_ORDERING));
+ #endif
+ 
++      xdg_data_dir = g_getenv ("XDG_DATA_DIRS");
++      if (xdg_data_dir)
++              {
++                      char **xdg_ddirs = g_strsplit (xdg_data_dir, ":", 0);
++                      char *xdg_iter;
++
++                      for (xdg_iter = xdg_ddirs; xdg_iter != NULL; xdg_iter++)
++                              {
++                                      conf_dirs = enchant_slist_append_unique_path (conf_dirs, 
g_strdup(*xdg_iter));
++                              }
++                      g_strfreev (xdg_ddirs);
++              }
++
+       return conf_dirs;
+ }
+ 


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