Button: make sure icon is optional
This commit is contained in:
@@ -207,9 +207,14 @@ void button_reload_icon(Button *button)
|
|||||||
free_icon(button->frontend->icon_hover);
|
free_icon(button->frontend->icon_hover);
|
||||||
free_icon(button->frontend->icon_pressed);
|
free_icon(button->frontend->icon_pressed);
|
||||||
button->frontend->icon = NULL;
|
button->frontend->icon = NULL;
|
||||||
|
button->frontend->icon_hover = NULL;
|
||||||
|
button->frontend->icon_pressed = NULL;
|
||||||
|
|
||||||
button->frontend->icon_load_size = button->frontend->iconw;
|
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);
|
char *new_icon_path = get_icon_path(icon_theme_wrapper, button->backend->icon_name, button->frontend->iconw, TRUE);
|
||||||
if (new_icon_path)
|
if (new_icon_path)
|
||||||
button->frontend->icon = imlib_load_image_immediately(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 */
|
/* Button */
|
||||||
else if (strcmp(key, "button") == 0) {
|
else if (strcmp(key, "button") == 0) {
|
||||||
panel_config.button_list = g_list_append(panel_config.button_list, create_button());
|
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 *button = get_or_create_last_button();
|
||||||
button->backend->icon_name = strdup(value);
|
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();
|
Button *button = get_or_create_last_button();
|
||||||
free_and_null(button->backend->text);
|
free_and_null(button->backend->text);
|
||||||
button->backend->text = strdup(value);
|
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();
|
Button *button = get_or_create_last_button();
|
||||||
free_and_null(button->backend->tooltip);
|
free_and_null(button->backend->tooltip);
|
||||||
button->backend->tooltip = strdup(value);
|
button->backend->tooltip = strdup(value);
|
||||||
|
|||||||
Reference in New Issue
Block a user