X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=clients%2Fgtk2%2Fdolcon.c;h=c96498fd3cf5af836b419ab265dc7744d2105e87;hb=dbdb91fa4abf642a9699b1381abf8bcbb05b202c;hp=c71b9a1ff5d0c2b2438e2ed4179fe3b3837d7ead;hpb=56c91062e3ba47c3519998b5afb35a2624db78bd;p=doldaconnect.git diff --git a/clients/gtk2/dolcon.c b/clients/gtk2/dolcon.c index c71b9a1..c96498f 100644 --- a/clients/gtk2/dolcon.c +++ b/clients/gtk2/dolcon.c @@ -47,7 +47,6 @@ #endif #include "dolcon.h" #include "hublist.h" -#include "progressbar.h" #define TRHISTSIZE 10 @@ -292,6 +291,27 @@ char *bytes2si(long long bytes) return(ret); } +void progressfunc(GtkTreeViewColumn *col, GtkCellRenderer *rend, GtkTreeModel *model, GtkTreeIter *iter, gpointer data) +{ + int totalc, curc; + int total, cur; + char buf[64]; + + totalc = (GPOINTER_TO_INT(data) & 0xff00) >> 8; + curc = GPOINTER_TO_INT(data) & 0xff; + gtk_tree_model_get(model, iter, totalc, &total, curc, &cur, -1); + if(total < 1) + g_object_set(rend, "value", GINT_TO_POINTER(0), NULL); + else + g_object_set(rend, "value", GINT_TO_POINTER((int)(((double)cur / (double)total) * 100)), NULL); + if(cur < 0) { + g_object_set(rend, "text", "", NULL); + } else { + snprintf(buf, 64, "%'i", cur); + g_object_set(rend, "text", buf, NULL); + } +} + void percentagefunc(GtkTreeViewColumn *col, GtkCellRenderer *rend, GtkTreeModel *model, GtkTreeIter *iter, gpointer data) { int colnum;