shell: Use new config parser
This commit is contained in:
parent
a30989a47d
commit
673a889fd8
47
src/shell.c
47
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;
|
|
||||||
|
|
||||||
struct config_key shell_keys[] = {
|
section = weston_config_get_section(shell->compositor->config,
|
||||||
{ "binding-modifier", CONFIG_KEY_STRING, &modifier },
|
"screensaver", NULL, NULL);
|
||||||
{ "animation", CONFIG_KEY_STRING, &win_animation},
|
weston_config_section_get_string(section,
|
||||||
{ "num-workspaces",
|
"path", &shell->screensaver.path, NULL);
|
||||||
CONFIG_KEY_UNSIGNED_INTEGER, &num_workspaces },
|
weston_config_section_get_int(section, "duration", &duration, 60);
|
||||||
};
|
|
||||||
|
|
||||||
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…
x
Reference in New Issue
Block a user