X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=clients%2Fgtk2%2Fmain.c;h=d74e19206d93073f19aed2524a078dca8437809a;hb=e7e964564de02c1e2e73eb30fd72bf92a8526fd4;hp=ccdd6d400b913793c7b75b1beb550a1757d64da4;hpb=ef0f20e9c964e5c65bdc8542ba02a8900783230c;p=doldaconnect.git diff --git a/clients/gtk2/main.c b/clients/gtk2/main.c index ccdd6d4..d74e192 100644 --- a/clients/gtk2/main.c +++ b/clients/gtk2/main.c @@ -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);