-static int status_read_property(const char *name, sd_bus_message *property, StatusInfo *i) {
- char type;
- const char *contents;
- int r;
-
- assert(name);
- assert(property);
-
- r = sd_bus_message_peek_type(property, &type, &contents);
- if (r < 0) {
- log_error("Could not determine type of message: %s", strerror(-r));
- return r;
- }
-
- switch (type) {
-
- case SD_BUS_TYPE_STRING: {
- const char *s;
-
- sd_bus_message_read_basic(property, type, &s);
- if (isempty(s))
- break;
-
- if (streq(name, "VConsoleKeymap"))
- i->vconsole_keymap = s;
- else if (streq(name, "VConsoleKeymapToggle"))
- i->vconsole_keymap_toggle = s;
- else if (streq(name, "X11Layout"))
- i->x11_layout = s;
- else if (streq(name, "X11Model"))
- i->x11_model = s;
- else if (streq(name, "X11Variant"))
- i->x11_variant = s;
- else if (streq(name, "X11Options"))
- i->x11_options = s;
-
- break;
- }
-
- case SD_BUS_TYPE_ARRAY: {
- _cleanup_strv_free_ char **l = NULL;
-
- if (!streq(contents, "s"))
- break;
-
- if (!streq(name, "Locale"))
- break;
-
- r = bus_message_read_strv_extend(property, &l);
- if (r < 0)
- break;
-
- strv_free(i->locale);
- i->locale = l;
- l = NULL;
-
- break;
- }
- }
-
- return r;
-}
-