Fix pluma_dirs_get_user_accels_file

And free always config_dir
This commit is contained in:
Stefano Karapetsas 2014-02-17 09:42:31 +01:00
parent 38f6f2b09c
commit 6996153b65
1 changed files with 4 additions and 33 deletions

View File

@ -65,42 +65,13 @@ gchar* pluma_dirs_get_user_plugins_dir(void)
gchar* pluma_dirs_get_user_accels_file(void)
{
gchar* accels = NULL;
#ifndef G_OS_WIN32
const gchar* envvar;
const gchar* config_dir;
/* on linux accels are stored in .config/accels
* for historic reasons (backward compat with the
* old libmate that took care of saving them */
/* Support old libmate env var */
envvar = g_getenv("MATE22_USER_DIR");
if (envvar != NULL)
{
accels = g_build_filename(envvar, "accels", "pluma", NULL);
}
else
{
config_dir = pluma_dirs_get_user_config_dir();
if (config_dir != NULL)
{
accels = g_build_filename(config_dir, "accels", NULL);
}
}
#else
gchar *config_dir = NULL;
config_dir = pluma_dirs_get_user_config_dir();
accels = g_build_filename(config_dir, "accels", "pluma", NULL);
accels = g_build_filename(config_dir, "accels", NULL);
g_free(config_dir);
#endif
return accels;
}