2011-11-07 13:46:58 -06:00
|
|
|
/*
|
2016-01-25 08:13:49 -06:00
|
|
|
* xedit-dirs.c
|
|
|
|
* This file is part of xedit
|
2011-11-07 13:46:58 -06:00
|
|
|
*
|
|
|
|
* Copyright (C) 2008 Ignacio Casal Quinteiro
|
2011-11-07 18:10:16 -06:00
|
|
|
* Copyright (C) 2011 Perberos
|
2011-11-07 13:46:58 -06:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2012-11-18 19:54:49 -06:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2011-11-07 13:46:58 -06:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
2015-08-25 06:40:58 -05:00
|
|
|
#include <config.h>
|
2011-11-07 13:46:58 -06:00
|
|
|
#endif
|
|
|
|
|
2016-01-25 08:13:49 -06:00
|
|
|
#include "xedit-dirs.h"
|
2011-11-07 13:46:58 -06:00
|
|
|
|
2016-01-25 08:13:49 -06:00
|
|
|
gchar* xedit_dirs_get_user_config_dir(void)
|
2011-11-07 13:46:58 -06:00
|
|
|
{
|
2011-11-07 18:10:16 -06:00
|
|
|
gchar* config_dir = NULL;
|
|
|
|
|
2016-01-25 08:13:49 -06:00
|
|
|
config_dir = g_build_filename(g_get_user_config_dir(), "xedit", NULL);
|
2011-11-07 13:46:58 -06:00
|
|
|
|
|
|
|
return config_dir;
|
|
|
|
}
|
|
|
|
|
2016-01-25 08:13:49 -06:00
|
|
|
gchar* xedit_dirs_get_user_cache_dir(void)
|
2011-11-07 13:46:58 -06:00
|
|
|
{
|
2011-11-07 18:10:16 -06:00
|
|
|
const gchar* cache_dir;
|
2011-11-07 13:46:58 -06:00
|
|
|
|
2011-11-07 18:10:16 -06:00
|
|
|
cache_dir = g_get_user_cache_dir();
|
2011-11-07 13:46:58 -06:00
|
|
|
|
2016-01-25 08:13:49 -06:00
|
|
|
return g_build_filename(cache_dir, "xedit", NULL);
|
2011-11-07 13:46:58 -06:00
|
|
|
}
|
|
|
|
|
2016-01-25 08:13:49 -06:00
|
|
|
gchar* xedit_dirs_get_user_plugins_dir(void)
|
2011-11-07 13:46:58 -06:00
|
|
|
{
|
2011-11-07 18:10:16 -06:00
|
|
|
gchar* plugin_dir;
|
2011-11-07 13:46:58 -06:00
|
|
|
|
2016-01-25 08:13:49 -06:00
|
|
|
plugin_dir = g_build_filename(g_get_user_data_dir(), "xedit", "plugins", NULL);
|
2011-11-07 13:46:58 -06:00
|
|
|
|
|
|
|
return plugin_dir;
|
|
|
|
}
|
|
|
|
|
2016-01-25 08:13:49 -06:00
|
|
|
gchar* xedit_dirs_get_user_accels_file(void)
|
2011-11-07 13:46:58 -06:00
|
|
|
{
|
2011-11-07 18:10:16 -06:00
|
|
|
gchar* accels = NULL;
|
2014-02-17 02:42:31 -06:00
|
|
|
gchar *config_dir = NULL;
|
2011-11-07 18:10:16 -06:00
|
|
|
|
2016-01-25 08:13:49 -06:00
|
|
|
config_dir = xedit_dirs_get_user_config_dir();
|
2014-02-17 02:42:31 -06:00
|
|
|
accels = g_build_filename(config_dir, "accels", NULL);
|
2011-11-07 18:10:16 -06:00
|
|
|
|
2014-02-17 02:42:31 -06:00
|
|
|
g_free(config_dir);
|
2011-11-07 13:46:58 -06:00
|
|
|
|
|
|
|
return accels;
|
|
|
|
}
|
|
|
|
|
2016-01-25 08:13:49 -06:00
|
|
|
gchar* xedit_dirs_get_xedit_data_dir(void)
|
2011-11-07 13:46:58 -06:00
|
|
|
{
|
2016-01-25 08:13:49 -06:00
|
|
|
return g_build_filename(DATADIR, "xedit", NULL);
|
2011-11-07 13:46:58 -06:00
|
|
|
}
|
|
|
|
|
2016-01-25 08:13:49 -06:00
|
|
|
gchar* xedit_dirs_get_xedit_locale_dir(void)
|
2011-11-07 13:46:58 -06:00
|
|
|
{
|
2015-08-25 06:40:58 -05:00
|
|
|
return g_build_filename(DATADIR, "locale", NULL);
|
2011-11-07 13:46:58 -06:00
|
|
|
}
|
|
|
|
|
2016-01-25 08:13:49 -06:00
|
|
|
gchar* xedit_dirs_get_xedit_lib_dir(void)
|
2011-11-07 13:46:58 -06:00
|
|
|
{
|
2016-01-25 08:13:49 -06:00
|
|
|
return g_build_filename(LIBDIR, "xedit", NULL);
|
2011-11-07 13:46:58 -06:00
|
|
|
}
|
|
|
|
|
2016-01-25 08:13:49 -06:00
|
|
|
gchar* xedit_dirs_get_xedit_plugins_dir(void)
|
2011-11-07 13:46:58 -06:00
|
|
|
{
|
2011-11-07 18:10:16 -06:00
|
|
|
gchar* lib_dir;
|
|
|
|
gchar* plugin_dir;
|
|
|
|
|
2016-01-25 08:13:49 -06:00
|
|
|
lib_dir = xedit_dirs_get_xedit_lib_dir();
|
2011-11-07 18:10:16 -06:00
|
|
|
|
|
|
|
plugin_dir = g_build_filename(lib_dir, "plugins", NULL);
|
|
|
|
g_free(lib_dir);
|
|
|
|
|
2011-11-07 13:46:58 -06:00
|
|
|
return plugin_dir;
|
|
|
|
}
|
|
|
|
|
2016-01-25 08:13:49 -06:00
|
|
|
gchar* xedit_dirs_get_xedit_plugin_loaders_dir(void)
|
2011-11-07 13:46:58 -06:00
|
|
|
{
|
2011-11-07 18:10:16 -06:00
|
|
|
gchar* lib_dir;
|
|
|
|
gchar* loader_dir;
|
|
|
|
|
2016-01-25 08:13:49 -06:00
|
|
|
lib_dir = xedit_dirs_get_xedit_lib_dir();
|
2011-11-07 18:10:16 -06:00
|
|
|
|
|
|
|
loader_dir = g_build_filename(lib_dir, "plugin-loaders", NULL);
|
|
|
|
g_free(lib_dir);
|
|
|
|
|
2011-11-07 13:46:58 -06:00
|
|
|
return loader_dir;
|
|
|
|
}
|
|
|
|
|
2016-01-25 08:13:49 -06:00
|
|
|
gchar* xedit_dirs_get_ui_file(const gchar* file)
|
2011-11-07 13:46:58 -06:00
|
|
|
{
|
2011-11-07 18:10:16 -06:00
|
|
|
gchar* datadir;
|
|
|
|
gchar* ui_file;
|
|
|
|
|
|
|
|
g_return_val_if_fail(file != NULL, NULL);
|
|
|
|
|
2016-01-25 08:13:49 -06:00
|
|
|
datadir = xedit_dirs_get_xedit_data_dir();
|
2011-11-07 18:10:16 -06:00
|
|
|
ui_file = g_build_filename(datadir, "ui", file, NULL);
|
|
|
|
g_free(datadir);
|
|
|
|
|
2011-11-07 13:46:58 -06:00
|
|
|
return ui_file;
|
|
|
|
}
|