aboutsummaryrefslogtreecommitdiffstats
path: root/swaynag/types.c
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-07-28 23:15:12 -0400
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-08-01 22:47:54 -0400
commita6145914c60351d8e541192c7fe35556f8e02507 (patch)
tree8bb5cacc6e91ed4483c8a4fd0b903aacb76abf15 /swaynag/types.c
parentswaynag: split config into own file and fix optind (diff)
downloadsway-a6145914c60351d8e541192c7fe35556f8e02507.tar.gz
sway-a6145914c60351d8e541192c7fe35556f8e02507.tar.zst
sway-a6145914c60351d8e541192c7fe35556f8e02507.zip
swaynag: refactor {sway_,}nagbar to swaynag
Diffstat (limited to 'swaynag/types.c')
-rw-r--r--swaynag/types.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/swaynag/types.c b/swaynag/types.c
index dbc841f7..c92d0e89 100644
--- a/swaynag/types.c
+++ b/swaynag/types.c
@@ -10,9 +10,9 @@
10#include "swaynag/types.h" 10#include "swaynag/types.h"
11#include "util.h" 11#include "util.h"
12 12
13void nagbar_types_add_default(list_t *types) { 13void swaynag_types_add_default(list_t *types) {
14 struct sway_nagbar_type *type_error; 14 struct swaynag_type *type_error;
15 type_error = calloc(1, sizeof(struct sway_nagbar_type)); 15 type_error = calloc(1, sizeof(struct swaynag_type));
16 type_error->name = strdup("error"); 16 type_error->name = strdup("error");
17 type_error->button_background = 0x680A0AFF; 17 type_error->button_background = 0x680A0AFF;
18 type_error->background = 0x900000FF; 18 type_error->background = 0x900000FF;
@@ -21,8 +21,8 @@ void nagbar_types_add_default(list_t *types) {
21 type_error->border_bottom = 0x470909FF; 21 type_error->border_bottom = 0x470909FF;
22 list_add(types, type_error); 22 list_add(types, type_error);
23 23
24 struct sway_nagbar_type *type_warning; 24 struct swaynag_type *type_warning;
25 type_warning = calloc(1, sizeof(struct sway_nagbar_type)); 25 type_warning = calloc(1, sizeof(struct swaynag_type));
26 type_warning->name = strdup("warning"); 26 type_warning->name = strdup("warning");
27 type_warning->button_background = 0xFFC100FF; 27 type_warning->button_background = 0xFFC100FF;
28 type_warning->background = 0xFFA800FF; 28 type_warning->background = 0xFFA800FF;
@@ -32,9 +32,9 @@ void nagbar_types_add_default(list_t *types) {
32 list_add(types, type_warning); 32 list_add(types, type_warning);
33} 33}
34 34
35struct sway_nagbar_type *nagbar_type_get(list_t *types, char *name) { 35struct swaynag_type *swaynag_type_get(list_t *types, char *name) {
36 for (int i = 0; i < types->length; i++) { 36 for (int i = 0; i < types->length; i++) {
37 struct sway_nagbar_type *type = types->items[i]; 37 struct swaynag_type *type = types->items[i];
38 if (strcasecmp(type->name, name) == 0) { 38 if (strcasecmp(type->name, name) == 0) {
39 return type; 39 return type;
40 } 40 }
@@ -42,9 +42,9 @@ struct sway_nagbar_type *nagbar_type_get(list_t *types, char *name) {
42 return NULL; 42 return NULL;
43} 43}
44 44
45struct sway_nagbar_type *nagbar_type_clone(struct sway_nagbar_type *type) { 45struct swaynag_type *swaynag_type_clone(struct swaynag_type *type) {
46 struct sway_nagbar_type *clone; 46 struct swaynag_type *clone;
47 clone = calloc(1, sizeof(struct sway_nagbar_type)); 47 clone = calloc(1, sizeof(struct swaynag_type));
48 clone->name = strdup(type->name); 48 clone->name = strdup(type->name);
49 clone->button_background = type->button_background; 49 clone->button_background = type->button_background;
50 clone->background = type->background; 50 clone->background = type->background;
@@ -54,21 +54,21 @@ struct sway_nagbar_type *nagbar_type_clone(struct sway_nagbar_type *type) {
54 return clone; 54 return clone;
55} 55}
56 56
57void nagbar_type_free(struct sway_nagbar_type *type) { 57void swaynag_type_free(struct swaynag_type *type) {
58 free(type->name); 58 free(type->name);
59 free(type); 59 free(type);
60} 60}
61 61
62void nagbar_types_free(list_t *types) { 62void swaynag_types_free(list_t *types) {
63 while (types->length) { 63 while (types->length) {
64 struct sway_nagbar_type *type = types->items[0]; 64 struct swaynag_type *type = types->items[0];
65 nagbar_type_free(type); 65 swaynag_type_free(type);
66 list_del(types, 0); 66 list_del(types, 0);
67 } 67 }
68 list_free(types); 68 list_free(types);
69} 69}
70 70
71int nagbar_parse_type(int argc, char **argv, struct sway_nagbar_type *type) { 71int swaynag_parse_type(int argc, char **argv, struct swaynag_type *type) {
72 enum color_option { 72 enum color_option {
73 COLOR_BACKGROUND, 73 COLOR_BACKGROUND,
74 COLOR_BORDER, 74 COLOR_BORDER,