Disable spell check option if there are no enchant modules
This commit is contained in:
parent
49d7ae1fad
commit
e6ecd20be4
4 changed files with 37 additions and 17 deletions
|
@ -1197,27 +1197,11 @@ midori_load_extensions (gpointer data)
|
|||
g_object_set (app, "extensions", extensions, NULL);
|
||||
if (g_module_supported ())
|
||||
{
|
||||
/* FIXME: Read extensions from system data dirs */
|
||||
gchar* extension_path;
|
||||
GDir* extension_dir;
|
||||
|
||||
if (!(extension_path = g_strdup (g_getenv ("MIDORI_EXTENSION_PATH"))))
|
||||
{
|
||||
#ifdef G_OS_WIN32
|
||||
{
|
||||
gchar *path = g_win32_get_package_installation_directory_of_module (NULL);
|
||||
extension_path = g_build_filename (path, "lib", PACKAGE_NAME, NULL);
|
||||
g_free (path);
|
||||
if (g_access (extension_path, F_OK) != 0)
|
||||
{
|
||||
g_free (extension_path);
|
||||
extension_path = g_build_filename (LIBDIR, PACKAGE_NAME, NULL);
|
||||
}
|
||||
}
|
||||
#else
|
||||
extension_path = g_build_filename (LIBDIR, PACKAGE_NAME, NULL);
|
||||
#endif
|
||||
}
|
||||
extension_path = sokoke_find_lib_path (PACKAGE_NAME);
|
||||
extension_dir = g_dir_open (extension_path, 0, NULL);
|
||||
if (extension_dir != NULL)
|
||||
{
|
||||
|
|
|
@ -357,6 +357,14 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
|
|||
INDENTED_ADD (button);
|
||||
button = katze_property_proxy (settings, "enable-spell-checking", NULL);
|
||||
SPANNED_ADD (button);
|
||||
/* Disable spell check option if there are no enchant modules */
|
||||
{
|
||||
gchar* enchant_path = sokoke_find_lib_path ("enchant");
|
||||
if (enchant_path == NULL)
|
||||
gtk_widget_set_sensitive (button, FALSE);
|
||||
else
|
||||
g_free (enchant_path);
|
||||
}
|
||||
button = katze_property_proxy (settings, "enable-scripts", NULL);
|
||||
INDENTED_ADD (button);
|
||||
button = katze_property_proxy (settings, "enable-plugins", NULL);
|
||||
|
|
|
@ -1705,6 +1705,31 @@ sokoke_find_config_filename (const gchar* folder,
|
|||
return g_build_filename (SYSCONFDIR, "xdg", PACKAGE_NAME, folder, filename, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* sokoke_find_lib_path:
|
||||
* @folder: the lib subfolder
|
||||
*
|
||||
* Looks for the specified folder in the lib directories.
|
||||
*
|
||||
* Return value: a newly allocated full path, or %NULL
|
||||
**/
|
||||
gchar* sokoke_find_lib_path (const gchar* folder)
|
||||
{
|
||||
#ifdef G_OS_WIN32
|
||||
gchar* path = g_win32_get_package_installation_directory_of_module (NULL);
|
||||
gchar* lib_path = g_build_filename (path, "lib", folder ? folder : "", NULL);
|
||||
g_free (path);
|
||||
if (g_access (lib_path, F_OK) == 0)
|
||||
return lib_path;
|
||||
#else
|
||||
gchar* lib_path = g_build_filename (LIBDIR, folder ? folder : "", NULL);
|
||||
if (g_access (lib_path, F_OK) == 0)
|
||||
return lib_path;
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* sokoke_find_data_filename:
|
||||
* @filename: a filename or relative path
|
||||
|
|
|
@ -225,6 +225,9 @@ gchar*
|
|||
sokoke_find_config_filename (const gchar* folder,
|
||||
const gchar* filename);
|
||||
|
||||
gchar*
|
||||
sokoke_find_lib_path (const gchar* folder);
|
||||
|
||||
gchar*
|
||||
sokoke_find_data_filename (const gchar* filename);
|
||||
|
||||
|
|
Loading…
Reference in a new issue