Commit 3ceaedc510455d8945bb65497740cd5d8ae782cb

Authored by Perry Werneck
1 parent 80464a35
Exists in master and in 1 other branch develop

Adding convenience method for GtkEntry.

src/dialogs/tools.c
@@ -82,7 +82,7 @@ @@ -82,7 +82,7 @@
82 return child; 82 return child;
83 } 83 }
84 84
85 - void gtk_entry_set_text_printf(GtkEntry *entry, const gchar *fmt, ...) 85 + LIB3270_EXPORT void gtk_entry_set_printf(GtkEntry *entry, const gchar *fmt, ...)
86 { 86 {
87 va_list arg_ptr; 87 va_list arg_ptr;
88 va_start(arg_ptr, fmt); 88 va_start(arg_ptr, fmt);
src/filetransfer/worker.c
@@ -344,7 +344,7 @@ @@ -344,7 +344,7 @@
344 344
345 if(cfg->length) 345 if(cfg->length)
346 { 346 {
347 - gtk_entry_set_text_printf(cfg->worker->field[PROGRESS_FIELD_TOTAL],"%lu",cfg->length); 347 + gtk_entry_set_printf(cfg->worker->field[PROGRESS_FIELD_TOTAL],"%lu",cfg->length);
348 } 348 }
349 else 349 else
350 { 350 {
@@ -432,8 +432,8 @@ @@ -432,8 +432,8 @@
432 static gboolean bg_emit_update(struct bg_update * update) 432 static gboolean bg_emit_update(struct bg_update * update)
433 { 433 {
434 // Update values 434 // Update values
435 - gtk_entry_set_text_printf(update->worker->field[PROGRESS_FIELD_CURRENT],"%lu",update->current);  
436 - gtk_entry_set_text_printf(update->worker->field[PROGRESS_FIELD_TOTAL],"%lu",update->total); 435 + gtk_entry_set_printf(update->worker->field[PROGRESS_FIELD_CURRENT],"%lu",update->current);
  436 + gtk_entry_set_printf(update->worker->field[PROGRESS_FIELD_TOTAL],"%lu",update->total);
437 437
438 if(update->total) 438 if(update->total)
439 { 439 {
@@ -462,7 +462,7 @@ @@ -462,7 +462,7 @@
462 gtk_progress_bar_set_fraction(update->worker->pbar, ((gdouble) update->current) / ((gdouble) update->total)); 462 gtk_progress_bar_set_fraction(update->worker->pbar, ((gdouble) update->current) / ((gdouble) update->total));
463 } 463 }
464 464
465 - gtk_entry_set_text_printf(update->worker->field[PROGRESS_FIELD_ETA],"%lu",update->total); 465 + gtk_entry_set_printf(update->worker->field[PROGRESS_FIELD_ETA],"%lu",update->total);
466 466
467 } 467 }
468 468
src/include/internals.h
@@ -73,8 +73,6 @@ @@ -73,8 +73,6 @@
73 G_GNUC_INTERNAL void v3270_activity_list_save(GtkWidget *widget); 73 G_GNUC_INTERNAL void v3270_activity_list_save(GtkWidget *widget);
74 G_GNUC_INTERNAL void v3270_activity_list_save_as(GtkWidget *widget); 74 G_GNUC_INTERNAL void v3270_activity_list_save_as(GtkWidget *widget);
75 75
76 - G_GNUC_INTERNAL void gtk_entry_set_text_printf(GtkEntry *entry, const gchar *fmt, ...);  
77 -  
78 G_END_DECLS 76 G_END_DECLS
79 77
80 #endif // V3270_INTERNALS_H_INCLUDED 78 #endif // V3270_INTERNALS_H_INCLUDED
src/include/v3270.h
@@ -291,6 +291,10 @@ @@ -291,6 +291,10 @@
291 291
292 LIB3270_EXPORT GtkWidget * v3270_dialog_new(GtkWidget *widget, const gchar *title, const gchar *apply); 292 LIB3270_EXPORT GtkWidget * v3270_dialog_new(GtkWidget *widget, const gchar *title, const gchar *apply);
293 293
  294 + // Convenience
  295 + LIB3270_EXPORT void gtk_entry_set_printf(GtkEntry *entry, const gchar *fmt, ...) G_GNUC_PRINTF(2,3);
  296 +
  297 +
294 G_END_DECLS 298 G_END_DECLS
295 299
296 #endif // V3270_H_INCLUDED 300 #endif // V3270_H_INCLUDED