Commit dee1ba19c94f64ca3c75d21a090c2b889a747883

Authored by perry.werneck@gmail.com
1 parent 30b329a7

Implementando sinal e callback para impressão do conteúdo da tela

po/pt_BR.po
... ... @@ -5,8 +5,8 @@ msgid ""
5 5 msgstr ""
6 6 "Project-Id-Version: pw3270 5.0\n"
7 7 "Report-Msgid-Bugs-To: \n"
8   -"POT-Creation-Date: 2013-03-06 09:33-0300\n"
9   -"PO-Revision-Date: 2013-02-25 14:46-0300\n"
  8 +"POT-Creation-Date: 2013-03-11 11:24-0300\n"
  9 +"PO-Revision-Date: 2013-03-11 11:30-0300\n"
10 10 "Last-Translator: Perry Werneck <perry.werneck@gmail.com>\n"
11 11 "Language-Team: Português <>\n"
12 12 "Language: pt_BR\n"
... ... @@ -38,7 +38,7 @@ msgstr &quot;Ação %s precisa de um valor válido&quot;
38 38 msgid "%s action needs src attribute"
39 39 msgstr "Ação %s precisa do atributo src"
40 40  
41   -#: main.c:86
  41 +#: main.c:88
42 42 #, c-format
43 43 msgid "%s requires GTK version %d.%d.%d"
44 44 msgstr "%s requer GTK versão %d.%d.%d"
... ... @@ -83,7 +83,7 @@ msgstr &quot;%s: Familia %d é inválida&quot;
83 83 msgid "%s:%d"
84 84 msgstr "%s:%d"
85 85  
86   -#: main.c:318
  86 +#: main.c:323
87 87 msgid "- 3270 Emulator for Gtk"
88 88 msgstr "- Emulador 3270 para GTK"
89 89  
... ... @@ -164,7 +164,7 @@ msgstr &quot;&quot;
164 164 msgid "<b>SSL state is undefined</b>Unexpected SSL status %ld"
165 165 msgstr "<b>Estado do SSL é indefinido</b>Estado SSL inesperado %ld"
166 166  
167   -#: main.c:338
  167 +#: main.c:343
168 168 msgid ""
169 169 "<b>Valid options:</b>\n"
170 170 "\n"
... ... @@ -217,7 +217,7 @@ msgid &quot;An error occurred trying to allocate memory. This should never happen.&quot;
217 217 msgstr ""
218 218 "Ocorreu um erro ao tentar alocar memória. Isso nunca deveria acontecer."
219 219  
220   -#: main.c:302 main.c:304
  220 +#: main.c:304 main.c:306
221 221 msgid "Application name"
222 222 msgstr "Nome da aplicação"
223 223  
... ... @@ -292,15 +292,15 @@ msgstr &quot;Conexão interrompida&quot;
292 292  
293 293 #: v3270/security.c:124
294 294 msgid "CRL has expired"
295   -msgstr "CRL has expired"
  295 +msgstr "CRL expirou"
296 296  
297 297 #: v3270/security.c:117
298 298 msgid "CRL is not yet valid"
299   -msgstr "CRL is not yet valid"
  299 +msgstr "CRL ainda não é válido"
300 300  
301 301 #: v3270/security.c:96
302 302 msgid "CRL signature failure"
303   -msgstr "CRL signature failure"
  303 +msgstr "Erro na assinatura CRL"
304 304  
305 305 #: dialog.c:109
306 306 msgid "C_haracter Coding:"
... ... @@ -430,7 +430,7 @@ msgstr &quot;Não foi possível criar um manipulador de socket&quot;
430 430 #: session.c:323
431 431 #, c-format
432 432 msgid "Cannot find charset \"%s\", using defaults"
433   -msgstr "Não encontrei codificação \"%s\", usando defaults"
  433 +msgstr "Não encontrei codificação \"%s\", usando padrão"
434 434  
435 435 #: charset.c:660
436 436 #, c-format
... ... @@ -443,7 +443,7 @@ msgstr &quot;O certificado expirou&quot;
443 443  
444 444 #: v3270/security.c:103
445 445 msgid "Certificate is not yet valid"
446   -msgstr "Certificate is not yet valid"
  446 +msgstr "O certificado ainda não é válido"
447 447  
448 448 #: v3270/security.c:222
449 449 msgid "Certificate not trusted"
... ... @@ -722,7 +722,7 @@ msgstr &quot;Tela cheia&quot;
722 722 msgid "Function bar"
723 723 msgstr "Barra de funções"
724 724  
725   -#: main.c:90 main.c:379
  725 +#: main.c:92 main.c:384
726 726 msgid "GTK Version mismatch"
727 727 msgstr "Divergência de versão GTK"
728 728  
... ... @@ -791,11 +791,11 @@ msgstr &quot;Servidor rejeitou o tipo de dispositivo ou requisição&quot;
791 791 msgid "Host rejected resource(s)"
792 792 msgstr "Servidor rejeitou recurso(s)"
793 793  
794   -#: main.c:310
  794 +#: main.c:312
795 795 msgid "Host system type"
796 796 msgstr "Tipo do sistema no servidor"
797 797  
798   -#: main.c:308
  798 +#: main.c:310
799 799 msgid "Host to connect"
800 800 msgstr "Servidor a conectar"
801 801  
... ... @@ -814,7 +814,7 @@ msgstr &quot;IBM S/390&quot;
814 814  
815 815 #: v3270/widget.c:314
816 816 msgid "Identity not verified"
817   -msgstr "Identity not verified"
  817 +msgstr "Identidade não verificada"
818 818  
819 819 #: ft_cut.c:508
820 820 msgid "Illegal frame length"
... ... @@ -1007,15 +1007,15 @@ msgstr &quot;Laranja&quot;
1007 1007  
1008 1008 #: hostdialog.c:44
1009 1009 msgid "Other (TSO)"
1010   -msgstr "Other (TSO)"
  1010 +msgstr "Outro (TSO)"
1011 1011  
1012 1012 #: hostdialog.c:45
1013 1013 msgid "Other (VM/CMS)"
1014   -msgstr "Other (VM/CMS)"
  1014 +msgstr "Outro (VM/CMS)"
1015 1015  
1016 1016 #: v3270/security.c:159
1017 1017 msgid "Out of memory"
1018   -msgstr "Out of memory"
  1018 +msgstr "Memória insuficiente"
1019 1019  
1020 1020 #: ui/10keypad.xml:138
1021 1021 msgid "PA1"
... ... @@ -1125,7 +1125,7 @@ msgstr &quot;PF8&quot;
1125 1125 msgid "PF9"
1126 1126 msgstr "PF9"
1127 1127  
1128   -#: main.c:336
  1128 +#: main.c:341
1129 1129 msgid "Parse error"
1130 1130 msgstr "Erro de interpretação"
1131 1131  
... ... @@ -1162,9 +1162,9 @@ msgstr &quot;Colar com margem esquerda&quot;
1162 1162 msgid "Path length constraint exceeded"
1163 1163 msgstr "Path length constraint exceeded"
1164 1164  
1165   -#: main.c:305
  1165 +#: main.c:307
1166 1166 msgid "Path to application data files"
1167   -msgstr "Path to application data files"
  1167 +msgstr "Caminho para os arquivos de dados da aplicação"
1168 1168  
1169 1169 #: colors.c:396
1170 1170 msgid "Pink"
... ... @@ -1565,11 +1565,11 @@ msgstr &quot;Frente da seleção&quot;
1565 1565  
1566 1566 #: v3270/security.c:166
1567 1567 msgid "Self signed certificate"
1568   -msgstr "Self signed certificate"
  1568 +msgstr "Certificado auto assinada"
1569 1569  
1570 1570 #: v3270/security.c:173
1571 1571 msgid "Self signed certificate in certificate chain"
1572   -msgstr "Self signed certificate in certificate chain"
  1572 +msgstr "Certificado auto assinado na cadeia de certificados"
1573 1573  
1574 1574 #: ui/00default.xml:277
1575 1575 msgid "Send file"
... ... @@ -1579,7 +1579,7 @@ msgstr &quot;Enviar arquivo&quot;
1579 1579 msgid "Send file to host"
1580 1580 msgstr "Enviar arquivo para o servidor"
1581 1581  
1582   -#: main.c:312
  1582 +#: main.c:317
1583 1583 msgid "Send messages to syslog"
1584 1584 msgstr "Send messages to syslog"
1585 1585  
... ... @@ -1587,7 +1587,7 @@ msgstr &quot;Send messages to syslog&quot;
1587 1587 msgid "Send/Receive"
1588 1588 msgstr "Enviar/Receber"
1589 1589  
1590   -#: main.c:307
  1590 +#: main.c:309
1591 1591 msgid "Session name"
1592 1592 msgstr "Nome da sessão"
1593 1593  
... ... @@ -1595,10 +1595,18 @@ msgstr &quot;Nome da sessão&quot;
1595 1595 msgid "Set hostname"
1596 1596 msgstr "Selecione servidor"
1597 1597  
1598   -#: main.c:309
  1598 +#: main.c:311
1599 1599 msgid "Set reported colors (8/16)"
1600 1600 msgstr "Define número de cores informadas (8/16)"
1601 1601  
  1602 +#: main.c:314
  1603 +msgid "Set toggles OFF"
  1604 +msgstr "Desativa toggles"
  1605 +
  1606 +#: main.c:313
  1607 +msgid "Set toggles ON"
  1608 +msgstr "Ativa toggles"
  1609 +
1602 1610 #: ui/00default.xml:329
1603 1611 msgid "Settings"
1604 1612 msgstr "Configurações"
... ... @@ -1874,7 +1882,7 @@ msgstr &quot;&quot;
1874 1882 "programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple "
1875 1883 "Place, Suite 330, Boston, MA, 02111-1307, USA"
1876 1884  
1877   -#: main.c:375
  1885 +#: main.c:380
1878 1886 #, c-format
1879 1887 msgid "This program requires GTK version %d.%d.%d"
1880 1888 msgstr "Este programa precisa do GTK versão %d.%d.%d"
... ... @@ -2011,7 +2019,7 @@ msgstr &quot;Atributo %s inesperado ou inválido: \&quot;%s\&quot;&quot;
2011 2019 msgid "Unexpected or invalid attribute value \"%s\""
2012 2020 msgstr "Valor de attributo inesperado ou inválido: \"%s\""
2013 2021  
2014   -#: main.c:191
  2022 +#: main.c:193
2015 2023 #, c-format
2016 2024 msgid "Unexpected or invalid color value \"%s\""
2017 2025 msgstr "Valor de cor inválido ou inesperado: \"%s\""
... ...
src/include/lib3270/session.h
... ... @@ -412,6 +412,7 @@
412 412 void (*set_selection)(H3270 *session, unsigned char on);
413 413 void (*ctlr_done)(H3270 *session);
414 414 void (*autostart)(H3270 *session);
  415 + int (*print)(H3270 *session);
415 416  
416 417 void (*message)(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *message, const char *text);
417 418  
... ...
src/lib3270/session.c
... ... @@ -138,6 +138,12 @@ static void set_cursor(H3270 *session, LIB3270_CURSOR id)
138 138 {
139 139 }
140 140  
  141 +static int print(H3270 *session)
  142 +{
  143 + lib3270_write_log(session, "print", "%s", "Printing is unavailable");
  144 + return -1;
  145 +}
  146 +
141 147 static void message(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *msg, const char *text)
142 148 {
143 149 #ifdef ANDROID
... ... @@ -203,6 +209,7 @@ static void lib3270_session_init(H3270 *hSession, const char *model)
203 209 hSession->update_status = (void (*)(H3270 *, LIB3270_STATUS)) nop_int;
204 210 hSession->autostart = nop;
205 211 hSession->set_timer = set_timer;
  212 + hSession->print = print;
206 213  
207 214 // Set the defaults.
208 215 hSession->extended = 1;
... ...
src/lib3270/util.c
... ... @@ -1020,5 +1020,7 @@ int gettimeofday(struct timeval *tv, void *ignored)
1020 1020  
1021 1021 LIB3270_EXPORT int lib3270_print(H3270 *h)
1022 1022 {
1023   - return -1;
  1023 + CHECK_SESSION_HANDLE(h);
  1024 + trace("%s(%p)",__FUNCTION__,h);
  1025 + return h->print(h);
1024 1026 }
... ...
src/pw3270/v3270/keyboard.c
... ... @@ -79,10 +79,10 @@
79 79 { GDK_KP_Add, GDK_NUMLOCK_MASK, NULL, NULL },
80 80 { GDK_KP_Subtract, GDK_NUMLOCK_MASK, NULL, NULL },
81 81  
82   - { GDK_3270_PrintScreen, 0, NULL, NULL },
  82 + { GDK_3270_PrintScreen, 0, lib3270_print, NULL },
83 83 { GDK_Sys_Req, 0, lib3270_sysreq, NULL },
84 84  
85   - { GDK_Print, GDK_CONTROL_MASK, NULL, NULL },
  85 + { GDK_Print, GDK_CONTROL_MASK, lib3270_print, NULL },
86 86 { GDK_Print, GDK_SHIFT_MASK, lib3270_sysreq, NULL },
87 87 { GDK_Control_R, 0, NULL, NULL },
88 88 { GDK_Control_L, 0, NULL, NULL },
... ...
src/pw3270/v3270/private.h
... ... @@ -81,6 +81,7 @@ G_BEGIN_DECLS
81 81 SIGNAL_CHANGED,
82 82 SIGNAL_MESSAGE,
83 83 SIGNAL_FIELD,
  84 + SIGNAL_PRINT,
84 85  
85 86 LAST_SIGNAL
86 87 };
... ...
src/pw3270/v3270/widget.c
... ... @@ -165,18 +165,6 @@ static gboolean v3270_popup_menu(GtkWidget * widget)
165 165  
166 166 #if GTK_CHECK_VERSION(3,0,0)
167 167  
168   -/*
169   -static GtkSizeRequestMode get_request_mode(GtkWidget *widget)
170   -{
171   - int rows, cols;
172   -
173   - lib3270_get_screen_size(GTK_V3270(widget)->host,&rows,&cols);
174   -
175   - return rows > cols ? GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT : GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH;
176   -
177   -}
178   -*/
179   -
180 168 void get_preferred_height(GtkWidget *widget, gint *minimum_height, gint *natural_height)
181 169 {
182 170 int height = GTK_V3270(widget)->minimum_height;
... ... @@ -200,31 +188,6 @@ void get_preferred_width(GtkWidget *widget, gint *minimum_width, gint *natural_w
200 188 *natural_width = 600;
201 189 }
202 190  
203   -/*
204   -void get_preferred_height_for_width(GtkWidget *widget, gint width, gint *minimum_height, gint *natural_height)
205   -{
206   - trace("%s",__FUNCTION__);
207   -
208   - if(minimum_height)
209   - *minimum_height = 10;
210   -
211   - if(natural_height)
212   - *natural_height = 10;
213   -}
214   -
215   -static void get_preferred_width_for_height(GtkWidget *widget,gint height, gint *minimum_width, gint *natural_width)
216   -{
217   - trace("%s",__FUNCTION__);
218   -
219   - if(minimum_width)
220   - *minimum_width = 10;
221   -
222   - if(natural_width)
223   - *natural_width = 10;
224   -
225   -}
226   -*/
227   -
228 191 #endif // GTK(3,0,0)
229 192  
230 193 void v3270_popup_message(GtkWidget *widget, LIB3270_NOTIFY type , const gchar *title, const gchar *message, const gchar *text)
... ... @@ -276,14 +239,6 @@ void v3270_popup_message(GtkWidget *widget, LIB3270_NOTIFY type , const gchar *t
276 239  
277 240 gboolean v3270_query_tooltip(GtkWidget *widget, gint x, gint y, gboolean keyboard_tooltip, GtkTooltip *tooltip)
278 241 {
279   -/*
280   - if(!lib3270_connected(GTK_V3270(widget)->host))
281   - {
282   - gtk_tooltip_set_text(tooltip,_( "Disconnected" ) );
283   - return TRUE;
284   - }
285   -*/
286   -
287 242 if(y >= GTK_V3270(widget)->oia_rect->y)
288 243 {
289 244 GdkRectangle *rect = GTK_V3270(widget)->oia_rect;
... ... @@ -369,8 +324,6 @@ static void v3270_class_init(v3270Class *klass)
369 324  
370 325 widget_class->get_preferred_height = get_preferred_height;
371 326 widget_class->get_preferred_width = get_preferred_width;
372   -// widget_class->get_preferred_width_for_height = get_preferred_width_for_height;
373   -// widget_class->get_preferred_height_for_width = get_preferred_height_for_width;
374 327  
375 328 widget_class->destroy = v3270_destroy;
376 329 widget_class->draw = v3270_draw;
... ... @@ -589,6 +542,16 @@ static void v3270_class_init(v3270Class *klass)
589 542 pw3270_BOOL__VOID_BOOL_UINT_POINTER,
590 543 G_TYPE_BOOLEAN, 3, G_TYPE_BOOLEAN, G_TYPE_UINT, G_TYPE_POINTER);
591 544  
  545 +
  546 + v3270_widget_signal[SIGNAL_PRINT] =
  547 + g_signal_new( "print",
  548 + G_OBJECT_CLASS_TYPE (gobject_class),
  549 + G_SIGNAL_RUN_FIRST,
  550 + 0,
  551 + NULL, NULL,
  552 + pw3270_VOID__VOID,
  553 + G_TYPE_NONE, 0);
  554 +
592 555 }
593 556  
594 557 void v3270_update_font_metrics(v3270 *terminal, cairo_t *cr, int width, int height)
... ... @@ -865,6 +828,12 @@ static void message(H3270 *session, LIB3270_NOTIFY id , const char *title, const
865 828  
866 829 }
867 830  
  831 +static int emit_print_signal(H3270 *session)
  832 +{
  833 + g_signal_emit(GTK_WIDGET(session->widget), v3270_widget_signal[SIGNAL_PRINT], 0);
  834 + return 0;
  835 +}
  836 +
868 837 static void v3270_init(v3270 *widget)
869 838 {
870 839 widget->host = lib3270_session_new("");
... ... @@ -899,6 +868,7 @@ static void v3270_init(v3270 *widget)
899 868 widget->host->ctlr_done = ctlr_done;
900 869 widget->host->message = message;
901 870 widget->host->update_ssl = v3270_update_ssl;
  871 + widget->host->print = emit_print_signal;
902 872  
903 873 // Setup input method
904 874 widget->input_method = gtk_im_multicontext_new();
... ...
src/pw3270/window.c
... ... @@ -457,6 +457,11 @@
457 457 gtk_action_group_set_sensitive(group[ACTION_GROUP_CLIPBOARD],on);
458 458 }
459 459  
  460 + static void print_all(GtkWidget *widget, GtkWidget *window)
  461 + {
  462 + pw3270_print(widget,G_OBJECT(widget), GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, PW3270_SRC_ALL);
  463 + }
  464 +
460 465 static void toggle_changed(GtkWidget *widget, LIB3270_TOGGLE id, gboolean toggled, const gchar *name, GtkWindow *toplevel)
461 466 {
462 467 GtkAction **list = (GtkAction **) g_object_get_data(G_OBJECT(widget),"toggle_actions");
... ... @@ -604,6 +609,7 @@
604 609 // Connect widget signals
605 610 g_signal_connect(widget->terminal,"field_clicked",G_CALLBACK(field_clicked),widget);
606 611 g_signal_connect(widget->terminal,"toggle_changed",G_CALLBACK(toggle_changed),widget);
  612 + g_signal_connect(widget->terminal,"print",G_CALLBACK(print_all),widget);
607 613  
608 614 // Connect window signals
609 615 g_signal_connect(widget,"window_state_event",G_CALLBACK(window_state_event),widget->terminal);
... ...