mirror of
https://github.com/swaywm/sway.git
synced 2026-04-25 06:46:24 -04:00
tray: refactor a questionable code path in item.c
This commit is contained in:
parent
5133013fb1
commit
ae4ff7226f
1 changed files with 7 additions and 8 deletions
|
|
@ -115,25 +115,26 @@ static int get_property_callback(sd_bus_message *msg, void *data,
|
||||||
const char *prop = d->prop;
|
const char *prop = d->prop;
|
||||||
const char *type = d->type;
|
const char *type = d->type;
|
||||||
void *dest = d->dest;
|
void *dest = d->dest;
|
||||||
|
wl_list_remove(&d->link);
|
||||||
|
free(d);
|
||||||
|
|
||||||
int ret;
|
int ret;
|
||||||
if (sd_bus_message_is_method_error(msg, NULL)) {
|
if (sd_bus_message_is_method_error(msg, NULL)) {
|
||||||
sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop,
|
sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop,
|
||||||
sd_bus_message_get_error(msg)->message);
|
sd_bus_message_get_error(msg)->message);
|
||||||
ret = sd_bus_message_get_errno(msg);
|
return sd_bus_message_get_errno(msg);
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = sd_bus_message_enter_container(msg, 'v', type);
|
ret = sd_bus_message_enter_container(msg, 'v', type);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret));
|
sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret));
|
||||||
goto cleanup;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!type) {
|
if (!type) {
|
||||||
ret = read_pixmap(msg, sni, prop, dest);
|
ret = read_pixmap(msg, sni, prop, dest);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
goto cleanup;
|
return ret;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (*type == 's' || *type == 'o') {
|
if (*type == 's' || *type == 'o') {
|
||||||
|
|
@ -143,7 +144,7 @@ static int get_property_callback(sd_bus_message *msg, void *data,
|
||||||
ret = sd_bus_message_read(msg, type, dest);
|
ret = sd_bus_message_read(msg, type, dest);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret));
|
sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret));
|
||||||
goto cleanup;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*type == 's' || *type == 'o') {
|
if (*type == 's' || *type == 'o') {
|
||||||
|
|
@ -160,9 +161,7 @@ static int get_property_callback(sd_bus_message *msg, void *data,
|
||||||
prop[0] == 'A' : strncmp(prop, "Icon", 4) == 0))) {
|
prop[0] == 'A' : strncmp(prop, "Icon", 4) == 0))) {
|
||||||
set_sni_dirty(sni);
|
set_sni_dirty(sni);
|
||||||
}
|
}
|
||||||
cleanup:
|
|
||||||
wl_list_remove(&d->link);
|
|
||||||
free(data);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue