Refactor if chain to avoid nested statements
This commit is contained in:
parent
585f0f85e0
commit
02ba060490
@ -216,15 +216,11 @@ static void on_notify(GDBusConnection * connection,
|
|||||||
else if((dict_value = g_variant_lookup_value(content, "transient", G_VARIANT_TYPE_INT32)))
|
else if((dict_value = g_variant_lookup_value(content, "transient", G_VARIANT_TYPE_INT32)))
|
||||||
transient = g_variant_get_int32(dict_value) > 0;
|
transient = g_variant_get_int32(dict_value) > 0;
|
||||||
|
|
||||||
dict_value = g_variant_lookup_value(content, "value", G_VARIANT_TYPE_INT32);
|
if((dict_value = g_variant_lookup_value(content, "value", G_VARIANT_TYPE_INT32)))
|
||||||
if (dict_value) {
|
|
||||||
progress = g_variant_get_int32(dict_value);
|
progress = g_variant_get_int32(dict_value);
|
||||||
} else {
|
else if((dict_value = g_variant_lookup_value(content, "value", G_VARIANT_TYPE_UINT32)))
|
||||||
dict_value = g_variant_lookup_value(content, "value", G_VARIANT_TYPE_UINT32);
|
|
||||||
if (dict_value)
|
|
||||||
progress = g_variant_get_uint32(dict_value);
|
progress = g_variant_get_uint32(dict_value);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
if (g_variant_is_of_type(content, G_VARIANT_TYPE_INT32))
|
if (g_variant_is_of_type(content, G_VARIANT_TYPE_INT32))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user