X-Git-Url: http://git.dolda2000.com/gitweb/?a=blobdiff_plain;f=clients%2Fgtk2%2Fmain.c;h=d74e19206d93073f19aed2524a078dca8437809a;hb=7a2dee1d890df9fe5888ae8b8c80c41d3ae02f05;hp=88d68b9bb462b2349ae2950d7b43c29edb0679fd;hpb=0931eb36fd5528e336ecb69e801b05e8062b64fd;p=doldaconnect.git diff --git a/clients/gtk2/main.c b/clients/gtk2/main.c index 88d68b9..d74e192 100644 --- a/clients/gtk2/main.c +++ b/clients/gtk2/main.c @@ -102,7 +102,7 @@ pid_t pubhubproc = 0; char *pubhubaddr = NULL; char *connectas = NULL; char *dcserver = NULL; -int autoconn = 0; +int autoconn = 1; int srchautoupdate = 0; int cursrch = -1, nextsrch = -1; time_t srcheta; @@ -363,7 +363,7 @@ void percentagefunc(GtkTreeViewColumn *col, GtkCellRenderer *rend, GtkTreeModel float val; char buf[64]; - colnum = (int)data; + colnum = GPOINTER_TO_INT(data); gtk_tree_model_get(model, iter, colnum, &val, -1); snprintf(buf, 64, "%.2f%%", (double)(val * 100.0)); g_object_set(rend, "text", buf, NULL); @@ -374,7 +374,7 @@ void transnicebytefunc(GtkTreeViewColumn *col, GtkCellRenderer *rend, GtkTreeMod int colnum, val; char buf[64]; - colnum = (int)data; + colnum = GPOINTER_TO_INT(data); gtk_tree_model_get(model, iter, colnum, &val, -1); if(val >= 0) snprintf(buf, 64, "%'i", val); @@ -389,7 +389,7 @@ void transnicebytefunc2(GtkTreeViewColumn *col, GtkCellRenderer *rend, GtkTreeMo long long val; char buf[64]; - colnum = (int)data; + colnum = GPOINTER_TO_INT(data); gtk_tree_model_get(model, iter, colnum, &val, -1); if(val >= 0) strcpy(buf, bytes2si(val)); @@ -403,7 +403,7 @@ void hidezerofunc(GtkTreeViewColumn *col, GtkCellRenderer *rend, GtkTreeModel *m int colnum, val; char buf[64]; - colnum = (int)data; + colnum = GPOINTER_TO_INT(data); gtk_tree_model_get(model, iter, colnum, &val, -1); if(val > 0) snprintf(buf, 64, "%i", val); @@ -695,6 +695,12 @@ char *inputbox(char *title, char *prompt, char *def, int echo) } int msgbox(int type, int buttons, char *format, ...) +#if defined(__GNUC__) + __attribute__ ((format (printf, 3, 4))) +#endif +; + +int msgbox(int type, int buttons, char *format, ...) { GtkWidget *swnd; va_list args; @@ -1464,7 +1470,7 @@ void setpubhubmodel(GtkTreeModel *model, int sortcol, int numcols, int *cols, ch gtk_tree_view_column_set_title(col, names[i]); rnd = gtk_cell_renderer_text_new(); gtk_tree_view_column_pack_start(col, rnd, TRUE); - gtk_tree_view_column_set_cell_data_func(col, rnd, transnicebytefunc2, (gpointer)cols[i], NULL); + gtk_tree_view_column_set_cell_data_func(col, rnd, transnicebytefunc2, GINT_TO_POINTER(cols[i]), NULL); } else { col = gtk_tree_view_column_new_with_attributes(names[i], gtk_cell_renderer_text_new(), "text", cols[i], NULL); } @@ -1518,6 +1524,11 @@ int pubhubxmlhandler(int op, char *buf, size_t *len) } break; case PHO_EOF: + if(ctxt == NULL) + { + msgbox(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, _("A hub list could not be read from %s"), pubhubaddr); + break; + } xmlParseChunk(ctxt, NULL, 0, 1); if(!ctxt->wellFormed) { @@ -1582,7 +1593,7 @@ int pubhubxmlhandler(int op, char *buf, size_t *len) } if(i == numcols) { - msgbox(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, _("The hub list at %s did not contain the address to any hubs")); + msgbox(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, _("The hub list at %s did not contain the address to any hubs"), pubhubaddr); break; } model = gtk_list_store_newv(numcols, types);