Merge pull request #342 from bebehei/readability-improvement
improve readability in dbus.c
This commit is contained in:
commit
9065f2f30a
125
src/dbus.c
125
src/dbus.c
@ -152,125 +152,66 @@ static void on_notify(GDBusConnection * connection,
|
|||||||
|
|
||||||
switch (idx) {
|
switch (idx) {
|
||||||
case 0:
|
case 0:
|
||||||
if (g_variant_is_of_type
|
if (g_variant_is_of_type(content, G_VARIANT_TYPE_STRING))
|
||||||
(content, G_VARIANT_TYPE_STRING))
|
appname = g_variant_dup_string(content, NULL);
|
||||||
appname =
|
|
||||||
g_variant_dup_string(content, NULL);
|
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (g_variant_is_of_type
|
if (g_variant_is_of_type(content, G_VARIANT_TYPE_UINT32))
|
||||||
(content, G_VARIANT_TYPE_UINT32))
|
replaces_id = g_variant_get_uint32(content);
|
||||||
replaces_id =
|
|
||||||
g_variant_get_uint32(content);
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (g_variant_is_of_type
|
if (g_variant_is_of_type(content, G_VARIANT_TYPE_STRING))
|
||||||
(content, G_VARIANT_TYPE_STRING))
|
icon = g_variant_dup_string(content, NULL);
|
||||||
icon =
|
|
||||||
g_variant_dup_string(content, NULL);
|
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
if (g_variant_is_of_type
|
if (g_variant_is_of_type(content, G_VARIANT_TYPE_STRING))
|
||||||
(content, G_VARIANT_TYPE_STRING))
|
summary = g_variant_dup_string(content, NULL);
|
||||||
summary =
|
|
||||||
g_variant_dup_string(content, NULL);
|
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
if (g_variant_is_of_type
|
if (g_variant_is_of_type(content, G_VARIANT_TYPE_STRING))
|
||||||
(content, G_VARIANT_TYPE_STRING))
|
body = g_variant_dup_string(content, NULL);
|
||||||
body =
|
|
||||||
g_variant_dup_string(content, NULL);
|
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
if (g_variant_is_of_type
|
if (g_variant_is_of_type(content, G_VARIANT_TYPE_STRING_ARRAY))
|
||||||
(content, G_VARIANT_TYPE_STRING_ARRAY))
|
actions->actions = g_variant_dup_strv(content, &(actions->count));
|
||||||
actions->actions =
|
|
||||||
g_variant_dup_strv(content,
|
|
||||||
&(actions->
|
|
||||||
count));
|
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
if (g_variant_is_of_type
|
if (g_variant_is_of_type(content, G_VARIANT_TYPE_DICTIONARY)) {
|
||||||
(content, G_VARIANT_TYPE_DICTIONARY)) {
|
|
||||||
|
|
||||||
dict_value =
|
dict_value = g_variant_lookup_value(content, "urgency", G_VARIANT_TYPE_BYTE);
|
||||||
g_variant_lookup_value(content,
|
|
||||||
"urgency",
|
|
||||||
G_VARIANT_TYPE_BYTE);
|
|
||||||
if (dict_value)
|
if (dict_value)
|
||||||
urgency =
|
urgency = g_variant_get_byte(dict_value);
|
||||||
g_variant_get_byte
|
|
||||||
(dict_value);
|
|
||||||
|
|
||||||
dict_value =
|
dict_value = g_variant_lookup_value(content, "fgcolor", G_VARIANT_TYPE_STRING);
|
||||||
g_variant_lookup_value(content,
|
|
||||||
"fgcolor",
|
|
||||||
G_VARIANT_TYPE_STRING);
|
|
||||||
if (dict_value)
|
if (dict_value)
|
||||||
fgcolor =
|
fgcolor = g_variant_dup_string(dict_value, NULL);
|
||||||
g_variant_dup_string
|
|
||||||
(dict_value, NULL);
|
|
||||||
|
|
||||||
dict_value =
|
dict_value = g_variant_lookup_value(content, "bgcolor", G_VARIANT_TYPE_STRING);
|
||||||
g_variant_lookup_value(content,
|
|
||||||
"bgcolor",
|
|
||||||
G_VARIANT_TYPE_STRING);
|
|
||||||
if (dict_value)
|
if (dict_value)
|
||||||
bgcolor =
|
bgcolor = g_variant_dup_string(dict_value, NULL);
|
||||||
g_variant_dup_string
|
|
||||||
(dict_value, NULL);
|
|
||||||
|
|
||||||
dict_value =
|
dict_value = g_variant_lookup_value(content, "category", G_VARIANT_TYPE_STRING);
|
||||||
g_variant_lookup_value(content,
|
if (dict_value)
|
||||||
"category",
|
category = g_variant_dup_string(dict_value, NULL);
|
||||||
G_VARIANT_TYPE_STRING);
|
|
||||||
|
|
||||||
|
dict_value = g_variant_lookup_value(content, "image-data", G_VARIANT_TYPE("(iiibiiay)"));
|
||||||
|
if (!dict_value)
|
||||||
|
dict_value = g_variant_lookup_value(content, "icon_data", G_VARIANT_TYPE("(iiibiiay)"));
|
||||||
|
if (dict_value)
|
||||||
|
raw_icon = get_raw_image_from_data_hint(dict_value);
|
||||||
|
|
||||||
|
dict_value = g_variant_lookup_value(content, "value", G_VARIANT_TYPE_INT32);
|
||||||
if (dict_value) {
|
if (dict_value) {
|
||||||
category =
|
progress = g_variant_get_int32(dict_value);
|
||||||
g_variant_dup_string(
|
|
||||||
dict_value, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
dict_value =
|
|
||||||
g_variant_lookup_value(content,
|
|
||||||
"image-data",
|
|
||||||
G_VARIANT_TYPE("(iiibiiay)"));
|
|
||||||
if (!dict_value) {
|
|
||||||
dict_value =
|
|
||||||
g_variant_lookup_value(content,
|
|
||||||
"icon_data",
|
|
||||||
G_VARIANT_TYPE("(iiibiiay)"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dict_value) {
|
|
||||||
raw_icon =
|
|
||||||
get_raw_image_from_data_hint(
|
|
||||||
dict_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
dict_value =
|
|
||||||
g_variant_lookup_value(content,
|
|
||||||
"value",
|
|
||||||
G_VARIANT_TYPE_INT32);
|
|
||||||
|
|
||||||
if (dict_value) {
|
|
||||||
progress =
|
|
||||||
g_variant_get_int32(dict_value);
|
|
||||||
} else {
|
} else {
|
||||||
dict_value =
|
dict_value = g_variant_lookup_value(content, "value", G_VARIANT_TYPE_UINT32);
|
||||||
g_variant_lookup_value(content,
|
|
||||||
"value",
|
|
||||||
G_VARIANT_TYPE_UINT32);
|
|
||||||
|
|
||||||
if (dict_value)
|
if (dict_value)
|
||||||
progress =
|
progress = g_variant_get_uint32(dict_value);
|
||||||
g_variant_get_uint32(dict_value);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
if (g_variant_is_of_type
|
if (g_variant_is_of_type(content, G_VARIANT_TYPE_INT32))
|
||||||
(content, G_VARIANT_TYPE_INT32))
|
|
||||||
timeout = g_variant_get_int32(content);
|
timeout = g_variant_get_int32(content);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user