- char *str;
- gchar **attributes;
- gchar **pp;
- dbus_message_iter_get_basic (&mrc, &str);
- attributes = g_strsplit (str, "\n", -1);
- for (pp = attributes; *pp; pp++)
- {
- str = *pp;
- attr = g_new (AtkAttribute, 1);
- if (attr)
- {
- int len = strcspn (str, ":");
- attr->name = g_strndup (str, len);
- if (str[len] == ':')
- {
- len++;
- if (str[len] == ' ')
- len++;
- attr->value = g_strdup (str + len);
- }
- else
- attr->value = NULL;
- mrp->attributes = g_slist_prepend (mrp->attributes, attr);
- }
- }
- g_strfreev (attributes);
- }
- else
- {
- dbus_message_iter_recurse (&mrc, &arrayc);
- while (dbus_message_iter_get_arg_type (&arrayc) != DBUS_TYPE_INVALID)
- {
- dbus_message_iter_get_basic (&arrayc, &str);
- // TODO: remove this print
- g_print ("Got attribute: %s\n", str);
- attr = g_new (AtkAttribute, 1);
- if (attr)
- {
- int len = strcspn (str, ":");
- attr->name = g_strndup (str, len);
- if (str[len] == ':')
- {
- len++;
- if (str[len] == ' ')
- len++;
- attr->value = g_strdup (str + len);
- }
- else
- attr->value = NULL;
- mrp->attributes = g_slist_prepend (mrp->attributes, attr);
- }
- dbus_message_iter_next (&arrayc);
- }
+ const char *key, *val;
+ dbus_message_iter_recurse (&iter_dict, &iter_dict_entry);
+ dbus_message_iter_get_basic (&iter_dict_entry, &key);
+ dbus_message_iter_next (&iter_dict_entry);
+ dbus_message_iter_get_basic (&iter_dict_entry, &val);
+ attr = g_new (AtkAttribute, 1);
+ attr->name = g_strdup (key);
+ attr->value = g_strdup (val);
+ mrp->attributes = g_slist_prepend (mrp->attributes, attr);
+ dbus_message_iter_next (&iter_dict);