From 9c3dee18ce2e216a8a391c9484d594ddb5b6dfbc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg?= Date: Sat, 21 Sep 2013 22:23:08 -0700 Subject: [PATCH] terminal: Port to new weston_config parse --- clients/terminal.c | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/clients/terminal.c b/clients/terminal.c index ee2baf0..c45c776 100644 --- a/clients/terminal.c +++ b/clients/terminal.c @@ -44,9 +44,9 @@ #include "window.h" static int option_fullscreen; -static char *option_font = "mono"; -static int option_font_size = 14; -static char *option_term = "xterm"; +static char *option_font; +static int option_font_size; +static char *option_term; static char *option_shell; static struct wl_list terminal_list; @@ -2781,17 +2781,6 @@ terminal_run(struct terminal *terminal, const char *path) return 0; } -static const struct config_key terminal_config_keys[] = { - { "font", CONFIG_KEY_STRING, &option_font }, - { "font-size", CONFIG_KEY_INTEGER, &option_font_size }, - { "term", CONFIG_KEY_STRING, &option_term }, -}; - -static const struct config_section config_sections[] = { - { "terminal", - terminal_config_keys, ARRAY_LENGTH(terminal_config_keys) }, -}; - static const struct weston_option terminal_options[] = { { WESTON_OPTION_BOOLEAN, "fullscreen", 'f', &option_fullscreen }, { WESTON_OPTION_STRING, "font", 0, &option_font }, @@ -2802,6 +2791,8 @@ int main(int argc, char *argv[]) { struct display *d; struct terminal *terminal; + struct weston_config *config; + struct weston_config_section *s; int config_fd; /* as wcwidth is locale-dependent, @@ -2813,13 +2804,14 @@ int main(int argc, char *argv[]) option_shell = "/bin/bash"; config_fd = open_config_file("weston.ini"); - parse_config_file(config_fd, - config_sections, ARRAY_LENGTH(config_sections), - NULL); + config = weston_config_parse(config_fd); close(config_fd); - parse_options(terminal_options, - ARRAY_LENGTH(terminal_options), &argc, argv); + 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); + weston_config_section_get_string(s, "term", &option_term, "xterm"); + weston_config_destroy(config); d = display_create(&argc, argv); if (d == NULL) { -- 2.7.4