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,41 +65,12 @@ gchar* pluma_dirs_get_user_plugins_dir(void)
gchar* pluma_dirs_get_user_accels_file(void) gchar* pluma_dirs_get_user_accels_file(void)
{ {
gchar* accels = NULL; gchar* accels = NULL;
gchar *config_dir = NULL;
#ifndef G_OS_WIN32 config_dir = pluma_dirs_get_user_config_dir();
const gchar* envvar; accels = g_build_filename(config_dir, "accels", NULL);
const gchar* config_dir;
/* on linux accels are stored in .config/accels g_free(config_dir);
* 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);
g_free(config_dir);
#endif
return accels; return accels;
} }