Button: make sure icon is optional
This commit is contained in:
parent
a7fc86cfbb
commit
63dd4a3e6c
2 changed files with 8 additions and 3 deletions
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue