X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=clients%2Fgtk2%2Fdolcon.c;h=18a0a3811b571f00f4094811ad9cc6ef99698c53;hb=066e55b45cc24f24d7d1859d1a082898bac3971c;hp=9da836b8fd3ebadb7e8006ecf5141ac9ece0b65d;hpb=a9477b339d8edadb9eb109718e3acffc178d65c6;p=doldaconnect.git diff --git a/clients/gtk2/dolcon.c b/clients/gtk2/dolcon.c index 9da836b..18a0a38 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; @@ -981,6 +1001,7 @@ gint ksupdatecb(gpointer data) ksquerytag = dc_queuecmd(NULL, NULL, L"filtercmd", L"userspeeda", L"%a", users, NULL); dc_freewcsarr(users); } + updatewrite(); return(TRUE); } @@ -1296,6 +1317,7 @@ void cb_main_lsres_activate(GtkWidget *widget, gpointer data) lsrestag = dc_queuecmd(NULL, NULL, L"filtercmd", L"lsres", NULL); gtk_widget_set_sensitive(reslist_reload, FALSE); } + updatewrite(); } void dcconnect(char *host) @@ -2035,6 +2057,7 @@ void cb_reslist_reload_clicked(GtkWidget *widget, gpointer data) gtk_list_store_clear(reslist); lsrestag = dc_queuecmd(NULL, NULL, L"filtercmd", L"lsres", NULL); gtk_widget_set_sensitive(reslist_reload, FALSE); + updatewrite(); } int rmres(char *id) @@ -2208,18 +2231,22 @@ int main(int argc, char **argv) textdomain(PACKAGE); gtk_init(&argc, &argv); connlocal = 0; - while((c = getopt(argc, argv, "lh")) != -1) { + while((c = getopt(argc, argv, "lhV")) != -1) { switch(c) { case 'l': connlocal = 1; break; case 'h': - printf("usage: dolcon [-hl]\n"); + printf("usage: dolcon [-hlV]\n"); printf("\t-h\tDisplay this help message\n"); printf("\t-l\tConnect to the locally running daemon\n"); + printf("\t-V\tDisplay version info and exit\n"); + exit(0); + case 'V': + printf("%s", RELEASEINFO); exit(0); default: - fprintf(stderr, "usage: dolcon [-hl]\n"); + fprintf(stderr, "usage: dolcon [-hlV]\n"); exit(1); } }