From 63dd4a3e6cd2e7e0079a4e083c6f4fbc3d689eb7 Mon Sep 17 00:00:00 2001 From: o9000 Date: Sat, 25 Mar 2017 15:48:03 +0100 Subject: [PATCH] Button: make sure icon is optional --- src/button/button.c | 5 +++++ src/config.c | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/button/button.c b/src/button/button.c index ad2e8e2..7151c14 100644 --- a/src/button/button.c +++ b/src/button/button.c @@ -207,9 +207,14 @@ void button_reload_icon(Button *button) free_icon(button->frontend->icon_hover); free_icon(button->frontend->icon_pressed); button->frontend->icon = NULL; + button->frontend->icon_hover = NULL; + button->frontend->icon_pressed = NULL; button->frontend->icon_load_size = button->frontend->iconw; + if (!button->backend->icon_name) + return; + char *new_icon_path = get_icon_path(icon_theme_wrapper, button->backend->icon_name, button->frontend->iconw, TRUE); if (new_icon_path) button->frontend->icon = imlib_load_image_immediately(new_icon_path); diff --git a/src/config.c b/src/config.c index d4745cb..71d2bb6 100644 --- a/src/config.c +++ b/src/config.c @@ -750,14 +750,14 @@ void add_entry(char *key, char *value) /* Button */ else if (strcmp(key, "button") == 0) { panel_config.button_list = g_list_append(panel_config.button_list, create_button()); - } else if (strcmp(key, "button_icon") == 0) { + } else if (strcmp(key, "button_icon") == 0 && strlen(value)) { Button *button = get_or_create_last_button(); button->backend->icon_name = strdup(value); - } else if (strcmp(key, "button_text") == 0) { + } else if (strcmp(key, "button_text") == 0 && strlen(value)) { Button *button = get_or_create_last_button(); free_and_null(button->backend->text); button->backend->text = strdup(value); - } else if (strcmp(key, "button_tooltip") == 0) { + } else if (strcmp(key, "button_tooltip") == 0 && strlen(value)) { Button *button = get_or_create_last_button(); free_and_null(button->backend->tooltip); button->backend->tooltip = strdup(value);