From: Nick Bowler Date: Sat, 12 May 2012 02:09:40 +0000 (-0400) Subject: upkg: Display object names in property listings. X-Git-Url: https://git.draconx.ca/gitweb/upkg.git/commitdiff_plain/e6d2653b6a2612ea2cee768d4dadcc3fb9315d00 upkg: Display object names in property listings. Not particularly useful right now since we can only display the last component of the name, but it's a start. --- diff --git a/src/upkg.c b/src/upkg.c index dbaa3fd..8fe9a2a 100644 --- a/src/upkg.c +++ b/src/upkg.c @@ -296,13 +296,24 @@ static int object_info(GTypeModule *pkg, unsigned long idx) GValue val = {0}; char *valstr; - printf(" property %s: ", props[i]->name); + printf(" property %s:", props[i]->name); fflush(stdout); g_value_init(&val, props[i]->value_type); g_object_get_property(obj, props[i]->name, &val); + + if (G_VALUE_HOLDS(&val, U_TYPE_OBJECT)) { + UObject *obj = g_value_get_object(&val); + + /* TODO: Display full object names here. */ + if (obj->pkg_file) { + printf(" %s", obj->pkg_file->name); + } + } + valstr = g_strdup_value_contents(&val); - printf("%s\n", valstr); + printf(" %s\n", valstr); + g_free(valstr); } free(props);