config-parser: Make weston_config_parse() tkae a file name

Take a basename of the config file to parse instead of an fd.
This commit is contained in:
Kristian Høgsberg
2013-09-21 23:02:31 -07:00
parent 81c2c2eb5e
commit 1abe0486bb
8 changed files with 22 additions and 36 deletions
+1 -5
View File
@@ -1280,17 +1280,13 @@ panel_add_launchers(struct panel *panel, struct desktop *desktop)
int main(int argc, char *argv[])
{
struct desktop desktop = { 0 };
int config_fd;
struct output *output;
struct weston_config_section *s;
desktop.unlock_task.run = unlock_dialog_finish;
wl_list_init(&desktop.outputs);
config_fd = open_config_file("weston.ini");
desktop.config = weston_config_parse(config_fd);
close(config_fd);
desktop.config = weston_config_parse("weston.ini");
s = weston_config_get_section(desktop.config, "shell", NULL, NULL);
weston_config_section_get_bool(s, "locking", &desktop.locking, 1);
+1 -5
View File
@@ -412,7 +412,6 @@ int main(int argc, char *argv[])
{
struct tablet tablet = { 0 };
struct display *display;
int config_fd;
struct output *output;
struct weston_config *config;
struct weston_config_section *s;
@@ -438,10 +437,7 @@ int main(int argc, char *argv[])
wl_list_init(&tablet.homescreen->launcher_list);
config_fd = open_config_file("weston.ini");
config = weston_config_parse(config_fd);
close(config_fd);
config = weston_config_parse("weston.ini");
s = weston_config_get_section(config, "shell", NULL, NULL);
weston_config_section_get_string(s, "lockscreen-icon",
&key_lockscreen_icon, NULL);
+1 -5
View File
@@ -2793,7 +2793,6 @@ int main(int argc, char *argv[])
struct terminal *terminal;
struct weston_config *config;
struct weston_config_section *s;
int config_fd;
/* as wcwidth is locale-dependent,
wcwidth needs setlocale call to function properly. */
@@ -2803,10 +2802,7 @@ int main(int argc, char *argv[])
if (!option_shell)
option_shell = "/bin/bash";
config_fd = open_config_file("weston.ini");
config = weston_config_parse(config_fd);
close(config_fd);
config = weston_config_parse("weston.ini");
s = weston_config_get_section(config, "terminal", NULL, NULL);
weston_config_section_get_string(s, "font", &option_font, "mono");
weston_config_section_get_int(s, "font-size", &option_font_size, 14);
+2 -5
View File
@@ -1309,15 +1309,12 @@ create_cursors(struct display *display)
{
struct weston_config *config;
struct weston_config_section *s;
int config_fd, size;
int size;
char *theme = NULL;
unsigned int i, j;
struct wl_cursor *cursor;
config_fd = open_config_file("weston.ini");
config = weston_config_parse(config_fd);
close(config_fd);
config = weston_config_parse("weston.ini");
s = weston_config_get_section(config, "shell", NULL, NULL);
weston_config_section_get_string(s, "cursor-theme", &theme, NULL);
weston_config_section_get_int(s, "cursor-size", &size, 32);