shell: Use new config parser

dev
Kristian Høgsberg 12 years ago
parent a30989a47d
commit 673a889fd8
  1. 49
      src/shell.c

@ -381,36 +381,27 @@ get_animation_type(char *animation)
static void static void
shell_configuration(struct desktop_shell *shell, int config_fd) shell_configuration(struct desktop_shell *shell, int config_fd)
{ {
char *path = NULL; struct weston_config_section *section;
int duration = 60; int duration;
unsigned int num_workspaces = DEFAULT_NUM_WORKSPACES; char *s;
char *modifier = NULL;
char *win_animation = NULL; section = weston_config_get_section(shell->compositor->config,
"screensaver", NULL, NULL);
struct config_key shell_keys[] = { weston_config_section_get_string(section,
{ "binding-modifier", CONFIG_KEY_STRING, &modifier }, "path", &shell->screensaver.path, NULL);
{ "animation", CONFIG_KEY_STRING, &win_animation}, weston_config_section_get_int(section, "duration", &duration, 60);
{ "num-workspaces",
CONFIG_KEY_UNSIGNED_INTEGER, &num_workspaces },
};
struct config_key saver_keys[] = {
{ "path", CONFIG_KEY_STRING, &path },
{ "duration", CONFIG_KEY_INTEGER, &duration },
};
struct config_section cs[] = {
{ "shell", shell_keys, ARRAY_LENGTH(shell_keys), NULL },
{ "screensaver", saver_keys, ARRAY_LENGTH(saver_keys), NULL },
};
parse_config_file(config_fd, cs, ARRAY_LENGTH(cs), shell);
shell->screensaver.path = path;
shell->screensaver.duration = duration * 1000; shell->screensaver.duration = duration * 1000;
shell->binding_modifier = get_modifier(modifier);
shell->win_animation_type = get_animation_type(win_animation); section = weston_config_get_section(shell->compositor->config,
shell->workspaces.num = num_workspaces > 0 ? num_workspaces : 1; "shell", NULL, NULL);
weston_config_section_get_string(section,
"binding-modifier", &s, "super");
shell->binding_modifier = get_modifier(s);
weston_config_section_get_string(section, "animation", &s, "none");
shell->win_animation_type = get_animation_type(s);
weston_config_section_get_uint(section, "num-workspaces",
&shell->workspaces.num,
DEFAULT_NUM_WORKSPACES);
} }
static void static void

Loading…
Cancel
Save