X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=clients%2Fgtk2%2Fhublist-xml.c;h=fcd9d7304cb38aec1b5dc28828cc1e6f519fd645;hb=f079b169f32e5407e55266392b46498edafa1a85;hp=dd2c1cbdbf4e9740db7cfa81d227023a6a0da793;hpb=302a260054ea38d3cb97be6d1a3010082c09265d;p=doldaconnect.git diff --git a/clients/gtk2/hublist-xml.c b/clients/gtk2/hublist-xml.c index dd2c1cb..fcd9d73 100644 --- a/clients/gtk2/hublist-xml.c +++ b/clients/gtk2/hublist-xml.c @@ -61,7 +61,7 @@ static int checkvalid(xmlNodePtr n) int pubhubxmlhandler(int op, char *buf, size_t len) { static xmlParserCtxtPtr ctxt = NULL; - int i; + int i, o; xmlNodePtr dr, r, cr, c, n; int numcols, *cols, sortcol; GType type, *types; @@ -119,6 +119,8 @@ int pubhubxmlhandler(int op, char *buf, size_t len) type = G_TYPE_STRING; else if(!strcmp(stype, "int")) type = G_TYPE_INT; + else if(!strcmp(stype, "percent")) + type = G_TYPE_INT; else if(!strcmp(stype, "bytes")) type = G_TYPE_INT64; } @@ -142,14 +144,16 @@ int pubhubxmlhandler(int op, char *buf, size_t len) } for(i = 0; i < numcols; i++) { - if(!strcmp(names[i], "Address")) + if(!strcasecmp(names[i], "Address")) { - name = names[0]; - names[0] = names[i]; - names[i] = name; - type = types[0]; - types[0] = types[i]; - types[i] = type; + for(o = i; o > 0; o--) { + name = names[o]; + type = types[o]; + names[o] = names[o - 1]; + types[o] = types[o - 1]; + names[o - 1] = name; + types[o - 1] = type; + } break; } } @@ -171,12 +175,18 @@ int pubhubxmlhandler(int op, char *buf, size_t len) attr = (char *)xmlGetProp(n, (xmlChar *)names[i]); if(attr != NULL) { - if(types[i] == G_TYPE_STRING) + if(!strcmp(names[i], "Address")) { + if(!strncmp(attr, "dchub://", 8)) + gtk_list_store_set(model, &iter, i, attr + 8, -1); + else + gtk_list_store_set(model, &iter, i, attr, -1); + } else if(types[i] == G_TYPE_STRING) { gtk_list_store_set(model, &iter, i, attr, -1); - else if(types[i] == G_TYPE_INT) + } else if(types[i] == G_TYPE_INT) { gtk_list_store_set(model, &iter, i, atoi(attr), -1); - else if(types[i] == G_TYPE_INT64) + } else if(types[i] == G_TYPE_INT64) { gtk_list_store_set(model, &iter, i, strtoll(attr, NULL, 0), -1); + } xmlFree(attr); } }