]> git.mdlowis.com Git - proto/labwc.git/commitdiff
theme: fix pattern match bug
authorJohan Malm <jgm323@gmail.com>
Sat, 10 Apr 2021 18:17:39 +0000 (19:17 +0100)
committerJohan Malm <jgm323@gmail.com>
Sat, 10 Apr 2021 18:17:39 +0000 (19:17 +0100)
Remove 'else' from if-statements in order for the pattern match to apply
to more than just the first instance of each match.

src/theme.c

index 348a32692ee97ced282bba9eef63bd7460a2329f..bfbbffce580db25a27f8b11cd00fec3f146cef62 100644 (file)
@@ -91,31 +91,46 @@ static void entry(struct theme *theme, const char *key, const char *value)
        if (!key || !value) {
                return;
        }
+
+       /*
+        * Note that in order for the pattern match to apply to more than just
+        * the first instance, "else if" cannot be used throughout this function
+        */
        if (match(key, "border.width")) {
                theme->border_width = atoi(value);
+       }
 
-       } else if (match(key, "window.active.border.color")) {
+       if (match(key, "window.active.border.color")) {
                parse_hexstr(value, theme->window_active_border_color);
-       } else if (match(key, "window.inactive.border.color")) {
+       }
+       if (match(key, "window.inactive.border.color")) {
                parse_hexstr(value, theme->window_inactive_border_color);
+       }
 
-       } else if (match(key, "window.active.title.bg.color")) {
+       if (match(key, "window.active.title.bg.color")) {
                parse_hexstr(value, theme->window_active_title_bg_color);
-       } else if (match(key, "window.inactive.title.bg.color")) {
+       }
+       if (match(key, "window.inactive.title.bg.color")) {
                parse_hexstr(value, theme->window_inactive_title_bg_color);
+       }
 
-       } else if (match(key, "window.active.button.unpressed.image.color")) {
+       if (match(key, "window.active.button.unpressed.image.color")) {
                parse_hexstr(value, theme->window_active_button_unpressed_image_color);
-       } else if (match(key, "window.inactive.button.unpressed.image.color")) {
+       }
+       if (match(key, "window.inactive.button.unpressed.image.color")) {
                parse_hexstr(value, theme->window_inactive_button_unpressed_image_color);
+       }
 
-       } else if (match(key, "menu.items.bg.color")) {
+       if (match(key, "menu.items.bg.color")) {
                parse_hexstr(value, theme->menu_items_bg_color);
-       } else if (match(key, "menu.items.text.color")) {
+       }
+       if (match(key, "menu.items.text.color")) {
                parse_hexstr(value, theme->menu_items_text_color);
-       } else if (match(key, "menu.items.active.bg.color")) {
+       }
+       if (match(key, "menu.items.active.bg.color")) {
                parse_hexstr(value, theme->menu_items_active_bg_color);
-       } else if (match(key, "menu.items.active.text.color")) {
+       }
+       if (match(key, "menu.items.active.text.color")) {
                parse_hexstr(value, theme->menu_items_active_text_color);
        }
 }