fallback to system config files
This commit is contained in:
parent
94f6ed428f
commit
82bcca3b86
11
termite.c
11
termite.c
|
@ -257,15 +257,16 @@ static void load_config(GtkWindow *window, VteTerminal *vte,
|
||||||
gboolean *dynamic_title, gboolean *urgent_on_bell,
|
gboolean *dynamic_title, gboolean *urgent_on_bell,
|
||||||
gboolean *clickable_url) {
|
gboolean *clickable_url) {
|
||||||
|
|
||||||
|
static const char *filename = "termite.cfg";
|
||||||
const gchar *dir = g_get_user_config_dir();
|
const gchar *dir = g_get_user_config_dir();
|
||||||
gchar *path = g_strconcat(dir, "/termite.cfg", NULL);
|
gchar *path = g_build_filename(dir, filename, NULL);
|
||||||
|
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GKeyFile *config = g_key_file_new();
|
GKeyFile *config = g_key_file_new();
|
||||||
if (!g_key_file_load_from_file(config, path, G_KEY_FILE_NONE, &error)) {
|
|
||||||
g_printerr("could not open config file: %s\n", error->message);
|
if ((g_key_file_load_from_file(config, path, G_KEY_FILE_NONE, NULL) ||
|
||||||
g_error_free(error);
|
g_key_file_load_from_dirs(config, filename, (const char **)g_get_system_config_dirs(),
|
||||||
} else {
|
NULL, G_KEY_FILE_NONE, NULL))) {
|
||||||
gboolean cfgbool;
|
gboolean cfgbool;
|
||||||
gchar *cfgstr;
|
gchar *cfgstr;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue