Refactor if chain to avoid nested statements

This commit is contained in:
Benedikt Heine 2017-07-27 20:34:03 +02:00
parent 585f0f85e0
commit 02ba060490

View File

@ -216,15 +216,11 @@ static void on_notify(GDBusConnection * connection,
else if((dict_value = g_variant_lookup_value(content, "transient", G_VARIANT_TYPE_INT32)))
transient = g_variant_get_int32(dict_value) > 0;
dict_value = g_variant_lookup_value(content, "value", G_VARIANT_TYPE_INT32);
if (dict_value) {
if((dict_value = g_variant_lookup_value(content, "value", G_VARIANT_TYPE_INT32)))
progress = g_variant_get_int32(dict_value);
} else {
dict_value = g_variant_lookup_value(content, "value", G_VARIANT_TYPE_UINT32);
if (dict_value)
else if((dict_value = g_variant_lookup_value(content, "value", G_VARIANT_TYPE_UINT32)))
progress = g_variant_get_uint32(dict_value);
}
}
break;
case 7:
if (g_variant_is_of_type(content, G_VARIANT_TYPE_INT32))