4 * An object oriented GL/GLES Abstraction/Utility Layer
6 * Copyright (C) 2011 Intel Corporation.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library. If not, see
20 * <http://www.gnu.org/licenses/>.
24 * Robert Bragg <robert@linux.intel.com>
31 #include "cogl-debug.h"
32 #include "cogl-config-private.h"
36 char *_cogl_config_driver;
37 char *_cogl_config_renderer;
40 _cogl_config_process (GKeyFile *key_file)
44 value = g_key_file_get_string (key_file, "global", "COGL_DEBUG", NULL);
47 _cogl_parse_debug_string (value,
48 TRUE /* enable the flags */,
49 TRUE /* ignore help option */);
53 value = g_key_file_get_string (key_file, "global", "COGL_NO_DEBUG", NULL);
56 _cogl_parse_debug_string (value,
57 FALSE /* disable the flags */,
58 TRUE /* ignore help option */);
62 value = g_key_file_get_string (key_file, "global", "COGL_DRIVER", NULL);
65 if (_cogl_config_driver)
66 g_free (_cogl_config_driver);
68 _cogl_config_driver = value;
71 value = g_key_file_get_string (key_file, "global", "COGL_RENDERER", NULL);
74 if (_cogl_config_renderer)
75 g_free (_cogl_config_renderer);
77 _cogl_config_renderer = value;
82 _cogl_config_read (void)
84 GKeyFile *key_file = g_key_file_new ();
85 const char * const *system_dirs = g_get_system_config_dirs ();
87 gboolean status = FALSE;
90 for (i = 0; system_dirs[i]; i++)
92 filename = g_build_filename (system_dirs[i], "cogl", "cogl.conf", NULL);
93 status = g_key_file_load_from_file (key_file,
100 _cogl_config_process (key_file);
101 g_key_file_free (key_file);
102 key_file = g_key_file_new ();
107 filename = g_build_filename (g_get_user_config_dir (), "cogl", "cogl.conf", NULL);
108 status = g_key_file_load_from_file (key_file,
115 _cogl_config_process (key_file);
117 g_key_file_free (key_file);