SF.net SVN: geany-plugins:[944] trunk/geany-plugins/spellcheck
eht16 at users.sourceforge.net
eht16 at xxxxx
Sun Sep 20 19:20:26 UTC 2009
Revision: 944
http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=944&view=rev
Author: eht16
Date: 2009-09-20 19:20:25 +0000 (Sun, 20 Sep 2009)
Log Message:
-----------
Add preliminary support for configurable dictionary directories.
Modified Paths:
--------------
trunk/geany-plugins/spellcheck/ChangeLog
trunk/geany-plugins/spellcheck/src/speller.c
Modified: trunk/geany-plugins/spellcheck/ChangeLog
===================================================================
--- trunk/geany-plugins/spellcheck/ChangeLog 2009-09-20 19:17:32 UTC (rev 943)
+++ trunk/geany-plugins/spellcheck/ChangeLog 2009-09-20 19:20:25 UTC (rev 944)
@@ -2,6 +2,8 @@
* src/scplugin.c:
Remove more unused code.
+ * src/speller.c:
+ Add preliminary support for configurable dictionary directories.
2009-08-09 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
Modified: trunk/geany-plugins/spellcheck/src/speller.c
===================================================================
--- trunk/geany-plugins/spellcheck/src/speller.c 2009-09-20 19:17:32 UTC (rev 943)
+++ trunk/geany-plugins/spellcheck/src/speller.c 2009-09-20 19:20:25 UTC (rev 944)
@@ -396,10 +396,47 @@
}
+#ifdef HAVE_ENCHANT_1_5
+/* TODO make this configurable */
+static gchar *get_dictionary_directory(void)
+{
+#ifdef G_OS_WIN32
+ gchar *path, *result;
+# if GLIB_CHECK_VERSION(2, 16, 0)
+ path = g_win32_get_package_installation_directory_of_module(NULL);
+# else
+ path = g_win32_get_package_installation_directory(NULL, NULL);
+# endif
+ result = g_build_filename(path, "dict", NULL);
+ g_free(path);
+ return result;
+#else
+ return g_build_filename(geany->app->datadir, "dict", NULL);
+#endif
+}
+#endif
+
+
void sc_speller_init(void)
{
+ const gchar *old_path;
+ gchar *new_path, *dict_dir;
+
sc_speller_broker = enchant_broker_init();
+#if HAVE_ENCHANT_1_5
+ /* add custom dictionary path for myspell (primarily used on Windows) */
+ dict_dir = get_dictionary_directory();
+ old_path = enchant_broker_get_param(sc_speller_broker, "enchant.myspell.dictionary.path");
+ if (old_path != NULL)
+ new_path = g_strconcat(old_path, G_SEARCHPATH_SEPARATOR_S, dict_dir, NULL);
+ else
+ new_path = dict_dir;
+ enchant_broker_set_param(sc_speller_broker, "enchant.myspell.dictionary.path", new_path);
+ if (new_path != dict_dir)
+ g_free(dict_dir);
+ g_free(new_path);
+#endif
create_dicts_array();
sc_speller_reinit_enchant_dict();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Plugins-Commits
mailing list