diff options
author | Connor E <38229097+c-edw@users.noreply.github.com> | 2018-11-10 12:55:06 +0000 |
---|---|---|
committer | Connor E <38229097+c-edw@users.noreply.github.com> | 2018-11-10 12:55:06 +0000 |
commit | b865dabebab717fea75f91e8ccebabc99e36bdd9 (patch) | |
tree | df51bf83b899933f1347508b9f1bd55aefa21ae5 /sway/commands/bar/wrap_scroll.c | |
parent | Merge pull request #3085 from 7415963987456321/master (diff) | |
download | sway-b865dabebab717fea75f91e8ccebabc99e36bdd9.tar.gz sway-b865dabebab717fea75f91e8ccebabc99e36bdd9.tar.zst sway-b865dabebab717fea75f91e8ccebabc99e36bdd9.zip |
Use parse_boolean where possible.
Diffstat (limited to 'sway/commands/bar/wrap_scroll.c')
-rw-r--r-- | sway/commands/bar/wrap_scroll.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/sway/commands/bar/wrap_scroll.c b/sway/commands/bar/wrap_scroll.c index 701de00a..04a4e6b8 100644 --- a/sway/commands/bar/wrap_scroll.c +++ b/sway/commands/bar/wrap_scroll.c | |||
@@ -2,6 +2,7 @@ | |||
2 | #include <strings.h> | 2 | #include <strings.h> |
3 | #include "sway/commands.h" | 3 | #include "sway/commands.h" |
4 | #include "log.h" | 4 | #include "log.h" |
5 | #include "util.h" | ||
5 | 6 | ||
6 | struct cmd_results *bar_cmd_wrap_scroll(int argc, char **argv) { | 7 | struct cmd_results *bar_cmd_wrap_scroll(int argc, char **argv) { |
7 | struct cmd_results *error = NULL; | 8 | struct cmd_results *error = NULL; |
@@ -11,17 +12,14 @@ struct cmd_results *bar_cmd_wrap_scroll(int argc, char **argv) { | |||
11 | if (!config->current_bar) { | 12 | if (!config->current_bar) { |
12 | return cmd_results_new(CMD_FAILURE, "wrap_scroll", "No bar defined."); | 13 | return cmd_results_new(CMD_FAILURE, "wrap_scroll", "No bar defined."); |
13 | } | 14 | } |
14 | if (strcasecmp("yes", argv[0]) == 0) { | 15 | config->current_bar->wrap_scroll = |
15 | config->current_bar->wrap_scroll = true; | 16 | parse_boolean(argv[0], config->current_bar->wrap_scroll); |
17 | if (config->current_bar->wrap_scroll) { | ||
16 | wlr_log(WLR_DEBUG, "Enabling wrap scroll on bar: %s", | 18 | wlr_log(WLR_DEBUG, "Enabling wrap scroll on bar: %s", |
17 | config->current_bar->id); | 19 | config->current_bar->id); |
18 | } else if (strcasecmp("no", argv[0]) == 0) { | 20 | } else { |
19 | config->current_bar->wrap_scroll = false; | ||
20 | wlr_log(WLR_DEBUG, "Disabling wrap scroll on bar: %s", | 21 | wlr_log(WLR_DEBUG, "Disabling wrap scroll on bar: %s", |
21 | config->current_bar->id); | 22 | config->current_bar->id); |
22 | } else { | ||
23 | return cmd_results_new(CMD_INVALID, | ||
24 | "wrap_scroll", "Invalid value %s", argv[0]); | ||
25 | } | 23 | } |
26 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 24 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); |
27 | } | 25 | } |