Commit b2e41aad3dd66ef5003f093a065dac0199fafb4c
1 parent
01f8a2b9
Exists in
master
and in
5 other branches
Implementando mecanismo para imprimir o conteudo do terminal sem interacao com o usuario
Showing
1 changed file
with
8 additions
and
14 deletions
Show diff stats
src/pw3270/print.c
@@ -394,12 +394,11 @@ static gchar * enum_to_string(GType type, guint enum_value) | @@ -394,12 +394,11 @@ static gchar * enum_to_string(GType type, guint enum_value) | ||
394 | } | 394 | } |
395 | #endif // WIN32 | 395 | #endif // WIN32 |
396 | 396 | ||
397 | - static GtkPrintOperation * begin_print_operation(GtkAction *action, GtkWidget *widget, PRINT_INFO **info) | 397 | + static GtkPrintOperation * begin_print_operation(GObject *obj, GtkWidget *widget, PRINT_INFO **info) |
398 | { | 398 | { |
399 | GtkPrintOperation * print = gtk_print_operation_new(); | 399 | GtkPrintOperation * print = gtk_print_operation_new(); |
400 | GtkPrintSettings * settings = gtk_print_settings_new(); | 400 | GtkPrintSettings * settings = gtk_print_settings_new(); |
401 | GtkPageSetup * setup = gtk_page_setup_new(); | 401 | GtkPageSetup * setup = gtk_page_setup_new(); |
402 | - const gchar * attr; | ||
403 | 402 | ||
404 | *info = g_new0(PRINT_INFO,1); | 403 | *info = g_new0(PRINT_INFO,1); |
405 | (*info)->session = v3270_get_session(widget); | 404 | (*info)->session = v3270_get_session(widget); |
@@ -408,16 +407,11 @@ static gchar * enum_to_string(GType type, guint enum_value) | @@ -408,16 +407,11 @@ static gchar * enum_to_string(GType type, guint enum_value) | ||
408 | // Basic setup | 407 | // Basic setup |
409 | gtk_print_operation_set_allow_async(print,TRUE); | 408 | gtk_print_operation_set_allow_async(print,TRUE); |
410 | 409 | ||
411 | - attr = (const gchar *) g_object_get_data(G_OBJECT(action),"jobname"); | ||
412 | - if(attr) | 410 | + if(obj) |
413 | { | 411 | { |
414 | - gtk_print_operation_set_job_name(print,attr); | ||
415 | - } | ||
416 | - else | ||
417 | - { | ||
418 | - gchar *ptr = g_strconcat(PACKAGE_NAME,".",gtk_action_get_name(action),NULL); | ||
419 | - gtk_print_operation_set_job_name(print,ptr); | ||
420 | - g_free(ptr); | 412 | + const gchar * attr = (const gchar *) g_object_get_data(obj,"jobname"); |
413 | + if(attr) | ||
414 | + gtk_print_operation_set_job_name(print,attr); | ||
421 | } | 415 | } |
422 | 416 | ||
423 | gtk_print_operation_set_custom_tab_label(print,_( "Options" )); | 417 | gtk_print_operation_set_custom_tab_label(print,_( "Options" )); |
@@ -492,7 +486,7 @@ static gchar * enum_to_string(GType type, guint enum_value) | @@ -492,7 +486,7 @@ static gchar * enum_to_string(GType type, guint enum_value) | ||
492 | void print_all_action(GtkAction *action, GtkWidget *widget) | 486 | void print_all_action(GtkAction *action, GtkWidget *widget) |
493 | { | 487 | { |
494 | PRINT_INFO * info = NULL; | 488 | PRINT_INFO * info = NULL; |
495 | - GtkPrintOperation * print = begin_print_operation(action,widget,&info); | 489 | + GtkPrintOperation * print = begin_print_operation(G_OBJECT(action),widget,&info); |
496 | 490 | ||
497 | #ifdef X3270_TRACE | 491 | #ifdef X3270_TRACE |
498 | lib3270_trace_event(NULL,"Action %s activated on widget %p\n",gtk_action_get_name(action),widget); | 492 | lib3270_trace_event(NULL,"Action %s activated on widget %p\n",gtk_action_get_name(action),widget); |
@@ -515,7 +509,7 @@ static gchar * enum_to_string(GType type, guint enum_value) | @@ -515,7 +509,7 @@ static gchar * enum_to_string(GType type, guint enum_value) | ||
515 | { | 509 | { |
516 | PRINT_INFO * info = NULL; | 510 | PRINT_INFO * info = NULL; |
517 | int start, end, rows; | 511 | int start, end, rows; |
518 | - GtkPrintOperation * print = begin_print_operation(action,widget,&info);; | 512 | + GtkPrintOperation * print = begin_print_operation(G_OBJECT(action),widget,&info);; |
519 | 513 | ||
520 | #ifdef X3270_TRACE | 514 | #ifdef X3270_TRACE |
521 | lib3270_trace_event(NULL,"Action %s activated on widget %p\n",gtk_action_get_name(action),widget); | 515 | lib3270_trace_event(NULL,"Action %s activated on widget %p\n",gtk_action_get_name(action),widget); |
@@ -584,7 +578,7 @@ static gchar * enum_to_string(GType type, guint enum_value) | @@ -584,7 +578,7 @@ static gchar * enum_to_string(GType type, guint enum_value) | ||
584 | if(!text) | 578 | if(!text) |
585 | return; | 579 | return; |
586 | 580 | ||
587 | - print = begin_print_operation(action,widget,&info); | 581 | + print = begin_print_operation(G_OBJECT(action),widget,&info); |
588 | info->text = g_strsplit(text,"\n",-1); | 582 | info->text = g_strsplit(text,"\n",-1); |
589 | info->rows = g_strv_length(info->text); | 583 | info->rows = g_strv_length(info->text); |
590 | 584 |