Commit bc758ecb77a9f0b94e54fd3f0c3777bdfdc2e0b6

Authored by Perry Werneck
1 parent 3235719c

Refactoring session file engine to fix segfault after save-as.

locale/pt_BR.po
@@ -5,8 +5,8 @@ msgid "" @@ -5,8 +5,8 @@ msgid ""
5 msgstr "" 5 msgstr ""
6 "Project-Id-Version: pw3270 5.0\n" 6 "Project-Id-Version: pw3270 5.0\n"
7 "Report-Msgid-Bugs-To: \n" 7 "Report-Msgid-Bugs-To: \n"
8 -"POT-Creation-Date: 2020-08-28 16:00-0300\n"  
9 -"PO-Revision-Date: 2020-08-28 16:02-0300\n" 8 +"POT-Creation-Date: 2020-09-15 14:25-0300\n"
  9 +"PO-Revision-Date: 2020-09-15 14:26-0300\n"
10 "Last-Translator: Perry Werneck <perry.werneck@gmail.com>\n" 10 "Last-Translator: Perry Werneck <perry.werneck@gmail.com>\n"
11 "Language-Team: Português <>\n" 11 "Language-Team: Português <>\n"
12 "Language: pt_BR\n" 12 "Language: pt_BR\n"
@@ -20,7 +20,7 @@ msgstr &quot;&quot; @@ -20,7 +20,7 @@ msgstr &quot;&quot;
20 "11) ? 2 : 3;\n" 20 "11) ? 2 : 3;\n"
21 "X-Generator: Gtranslator 2.91.7\n" 21 "X-Generator: Gtranslator 2.91.7\n"
22 22
23 -#: src/objects/application/application.c:208 23 +#: src/objects/application/application.c:206
24 #, c-format 24 #, c-format
25 msgid "\"%s\" is not a valid user interface name" 25 msgid "\"%s\" is not a valid user interface name"
26 msgstr "\"%s\" não é um nome válido para interface de usuário" 26 msgstr "\"%s\" não é um nome válido para interface de usuário"
@@ -46,7 +46,7 @@ msgstr &quot;Linux 64 bits&quot; @@ -46,7 +46,7 @@ msgstr &quot;Linux 64 bits&quot;
46 msgid "64 bits Windows" 46 msgid "64 bits Windows"
47 msgstr "Windows 64 bits" 47 msgstr "Windows 64 bits"
48 48
49 -#: src/objects/application/actions/about.c:182 ui/application.xml:39 49 +#: src/objects/application/actions/about.c:188 ui/application.xml:39
50 #: ui/application.xml:537 50 #: ui/application.xml:537
51 msgid "About PW3270" 51 msgid "About PW3270"
52 msgstr "Sobre o PW3270" 52 msgstr "Sobre o PW3270"
@@ -55,7 +55,7 @@ msgstr &quot;Sobre o PW3270&quot; @@ -55,7 +55,7 @@ msgstr &quot;Sobre o PW3270&quot;
55 msgid "Action Name" 55 msgid "Action Name"
56 msgstr "Nome da ação" 56 msgstr "Nome da ação"
57 57
58 -#: src/objects/window/window.c:163 src/objects/toolbar/toolbar.c:135 58 +#: src/objects/window/window.c:164 src/objects/toolbar/toolbar.c:135
59 msgid "Action Names" 59 msgid "Action Names"
60 msgstr "Nome das ações" 60 msgstr "Nome das ações"
61 61
@@ -83,7 +83,7 @@ msgstr &quot;Aplicação&quot; @@ -83,7 +83,7 @@ msgstr &quot;Aplicação&quot;
83 msgid "Application preferences" 83 msgid "Application preferences"
84 msgstr "Preferências da aplicação" 84 msgstr "Preferências da aplicação"
85 85
86 -#: src/objects/window/page.c:263 86 +#: src/objects/window/page.c:264
87 msgid "Apply" 87 msgid "Apply"
88 msgstr "Aplicar" 88 msgstr "Aplicar"
89 89
@@ -111,17 +111,22 @@ msgstr &quot;Cursor piscante&quot; @@ -111,17 +111,22 @@ msgstr &quot;Cursor piscante&quot;
111 msgid "Bold" 111 msgid "Bold"
112 msgstr "Negrito" 112 msgstr "Negrito"
113 113
114 -#: src/objects/window/terminal.c:197 114 +#: src/objects/actions/save.c:110 src/objects/window/terminal.c:171
  115 +msgid "Can't load session file"
  116 +msgstr "Não foi possível carregar arquivo de sessão"
  117 +
  118 +#: src/objects/actions/save.c:105
115 #, c-format 119 #, c-format
116 -msgid "Can't save file \"%s\""  
117 -msgstr "Não foi possível salvar arquivo \"%s\"" 120 +msgid "Can't open \"%s\""
  121 +msgstr "Não foi possível abrir %s"
118 122
119 -#: src/objects/window/terminal.c:202  
120 -msgid "Can't save session file"  
121 -msgstr "Não foi possível salvar arquivo de sessão" 123 +#: src/objects/window/terminal.c:166
  124 +#, c-format
  125 +msgid "Can't use \"%s\""
  126 +msgstr "Não posso usar %s"
122 127
123 -#: src/objects/actions/save.c:65 src/objects/application/actions/open.c:49  
124 -#: src/objects/window/page.c:264 128 +#: src/objects/actions/save.c:66 src/objects/application/actions/open.c:49
  129 +#: src/objects/window/page.c:265
125 msgid "Cancel" 130 msgid "Cancel"
126 msgstr "_Cancelar" 131 msgstr "_Cancelar"
127 132
@@ -155,10 +160,6 @@ msgstr &quot;Fechar janela&quot; @@ -155,10 +160,6 @@ msgstr &quot;Fechar janela&quot;
155 msgid "Colors" 160 msgid "Colors"
156 msgstr "Cores" 161 msgstr "Cores"
157 162
158 -#: src/objects/linux/savedesktopicon.c:93  
159 -msgid "Comment"  
160 -msgstr "Comentário"  
161 -  
162 #: src/objects/window/actions/connect.c:59 163 #: src/objects/window/actions/connect.c:59
163 msgid "Connect" 164 msgid "Connect"
164 msgstr "Conectar" 165 msgstr "Conectar"
@@ -171,7 +172,7 @@ msgstr &quot;Conectar ao iniciar&quot; @@ -171,7 +172,7 @@ msgstr &quot;Conectar ao iniciar&quot;
171 msgid "Connect to host" 172 msgid "Connect to host"
172 msgstr "Conectar ao servidor" 173 msgstr "Conectar ao servidor"
173 174
174 -#: src/objects/window/window.c:702 src/objects/window/page.c:217 175 +#: src/objects/window/window.c:703 src/objects/window/page.c:218
175 msgid "Connected to host" 176 msgid "Connected to host"
176 msgstr "Conectado no servidor" 177 msgstr "Conectado no servidor"
177 178
@@ -191,7 +192,7 @@ msgstr &quot;Copiar como tabela&quot; @@ -191,7 +192,7 @@ msgstr &quot;Copiar como tabela&quot;
191 msgid "Copy as text" 192 msgid "Copy as text"
192 msgstr "Copiar como texto" 193 msgstr "Copiar como texto"
193 194
194 -#: src/objects/linux/savedesktopicon.c:106 195 +#: src/objects/windows/savedesktopicon.c:85
195 msgid "Create a desktop icon for the current session" 196 msgid "Create a desktop icon for the current session"
196 msgstr "Criar ícone da área de trabalho para a sessão atual." 197 msgstr "Criar ícone da área de trabalho para a sessão atual."
197 198
@@ -219,6 +220,10 @@ msgstr &quot;Recortar&quot; @@ -219,6 +220,10 @@ msgstr &quot;Recortar&quot;
219 msgid "Delete Field" 220 msgid "Delete Field"
220 msgstr "Apagar campo" 221 msgstr "Apagar campo"
221 222
  223 +#: src/objects/windows/savedesktopicon.c:73
  224 +msgid "Description"
  225 +msgstr "Descrição"
  226 +
222 #: ui/window.xml:93 ui/application.xml:158 227 #: ui/window.xml:93 ui/application.xml:158
223 msgid "Desktop icon" 228 msgid "Desktop icon"
224 msgstr "Ícone da área de trabalho" 229 msgstr "Ícone da área de trabalho"
@@ -227,8 +232,8 @@ msgstr &quot;Ícone da área de trabalho&quot; @@ -227,8 +232,8 @@ msgstr &quot;Ícone da área de trabalho&quot;
227 msgid "Disconnect" 232 msgid "Disconnect"
228 msgstr "Desconectar" 233 msgstr "Desconectar"
229 234
230 -#: src/objects/window/window.c:702 src/objects/window/window.c:729  
231 -#: src/objects/window/page.c:206 235 +#: src/objects/window/window.c:703 src/objects/window/window.c:730
  236 +#: src/objects/window/page.c:207
232 msgid "Disconnected from host" 237 msgid "Disconnected from host"
233 msgstr "Desconectado do servidor" 238 msgstr "Desconectado do servidor"
234 239
@@ -272,10 +277,6 @@ msgstr &quot;Apagar até o final da linha&quot; @@ -272,10 +277,6 @@ msgstr &quot;Apagar até o final da linha&quot;
272 msgid "Field attributes" 277 msgid "Field attributes"
273 msgstr "Mostra atributos de campo" 278 msgstr "Mostra atributos de campo"
274 279
275 -#: src/objects/linux/savedesktopicon.c:72  
276 -msgid "File name"  
277 -msgstr "Nome do arquivo"  
278 -  
279 #: ui/application.xml:454 280 #: ui/application.xml:454
280 msgid "Full Screen" 281 msgid "Full Screen"
281 msgstr "Tela cheia" 282 msgstr "Tela cheia"
@@ -288,10 +289,6 @@ msgstr &quot;Tela cheia&quot; @@ -288,10 +289,6 @@ msgstr &quot;Tela cheia&quot;
288 msgid "Function bar" 289 msgid "Function bar"
289 msgstr "Barra de funções" 290 msgstr "Barra de funções"
290 291
291 -#: src/objects/linux/savedesktopicon.c:86  
292 -msgid "Generic name"  
293 -msgstr "Nome genérico"  
294 -  
295 #: ui/application.xml:36 ui/application.xml:534 292 #: ui/application.xml:36 ui/application.xml:534
296 msgid "Help" 293 msgid "Help"
297 msgstr "Ajuda" 294 msgstr "Ajuda"
@@ -300,7 +297,7 @@ msgstr &quot;Ajuda&quot; @@ -300,7 +297,7 @@ msgstr &quot;Ajuda&quot;
300 msgid "Host properties" 297 msgid "Host properties"
301 msgstr "Propriedades do Servidor" 298 msgstr "Propriedades do Servidor"
302 299
303 -#: src/objects/window/window.c:469 300 +#: src/objects/window/window.c:470 src/objects/windows/savedesktopicon.c:213
304 msgid "IBM 3270 Terminal emulator" 301 msgid "IBM 3270 Terminal emulator"
305 msgstr "Emulador 3270" 302 msgstr "Emulador 3270"
306 303
@@ -368,8 +365,7 @@ msgstr &quot;Largura do painel em colunas&quot; @@ -368,8 +365,7 @@ msgstr &quot;Largura do painel em colunas&quot;
368 msgid "Keypads" 365 msgid "Keypads"
369 msgstr "Painéis" 366 msgstr "Painéis"
370 367
371 -#: src/objects/application/actions/about.c:138  
372 -msgctxt "LicenseFileName" 368 +#: src/objects/application/actions/about.c:140
373 msgid "LICENSE" 369 msgid "LICENSE"
374 msgstr "LICENCA" 370 msgstr "LICENCA"
375 371
@@ -381,7 +377,7 @@ msgstr &quot;Etiqueta&quot; @@ -381,7 +377,7 @@ msgstr &quot;Etiqueta&quot;
381 msgid "Large" 377 msgid "Large"
382 msgstr "Grande" 378 msgstr "Grande"
383 379
384 -#: src/objects/linux/savedesktopicon.c:79 380 +#: src/objects/windows/savedesktopicon.c:68
385 msgid "Launcher name" 381 msgid "Launcher name"
386 msgstr "Nome do lançador" 382 msgstr "Nome do lançador"
387 383
@@ -433,7 +429,7 @@ msgstr &quot;Só Maiúsculas&quot; @@ -433,7 +429,7 @@ msgstr &quot;Só Maiúsculas&quot;
433 msgid "Network keep alive" 429 msgid "Network keep alive"
434 msgstr "Network keep alive" 430 msgstr "Network keep alive"
435 431
436 -#: src/objects/window/page.c:274 432 +#: src/objects/window/page.c:275
437 msgid "New session name" 433 msgid "New session name"
438 msgstr "Novo nome de sessão" 434 msgstr "Novo nome de sessão"
439 435
@@ -530,7 +526,7 @@ msgstr &quot;Propriedade \&quot;%s\&quot; é inválida para este objeto&quot; @@ -530,7 +526,7 @@ msgstr &quot;Propriedade \&quot;%s\&quot; é inválida para este objeto&quot;
530 msgid "Quit" 526 msgid "Quit"
531 msgstr "Sair" 527 msgstr "Sair"
532 528
533 -#: src/objects/window/page.c:261 529 +#: src/objects/window/page.c:262
534 msgid "Rename Session" 530 msgid "Rename Session"
535 msgstr "Renomear sessão" 531 msgstr "Renomear sessão"
536 532
@@ -550,15 +546,15 @@ msgstr &quot;Painel direito&quot; @@ -550,15 +546,15 @@ msgstr &quot;Painel direito&quot;
550 msgid "S_tyle" 546 msgid "S_tyle"
551 msgstr "E_stilo" 547 msgstr "E_stilo"
552 548
553 -#: src/objects/actions/save.c:64 ui/window.xml:69 ui/application.xml:134 549 +#: src/objects/actions/save.c:65 ui/window.xml:69 ui/application.xml:134
554 msgid "Save" 550 msgid "Save"
555 msgstr "Salvar" 551 msgstr "Salvar"
556 552
557 -#: src/objects/actions/save.c:49 553 +#: src/objects/actions/save.c:50
558 msgid "Save As" 554 msgid "Save As"
559 msgstr "Salvar Como" 555 msgstr "Salvar Como"
560 556
561 -#: src/objects/linux/savedesktopicon.c:105 557 +#: src/objects/windows/savedesktopicon.c:84
562 msgid "Save desktop icon" 558 msgid "Save desktop icon"
563 msgstr "Salvar ícone da área de trabalho" 559 msgstr "Salvar ícone da área de trabalho"
564 560
@@ -570,7 +566,7 @@ msgstr &quot;Salvar tela&quot; @@ -570,7 +566,7 @@ msgstr &quot;Salvar tela&quot;
570 msgid "Save selected" 566 msgid "Save selected"
571 msgstr "Salvar seleção" 567 msgstr "Salvar seleção"
572 568
573 -#: src/objects/actions/save.c:51 569 +#: src/objects/actions/save.c:52
574 msgid "Save session properties" 570 msgid "Save session properties"
575 msgstr "Salvar propriedades da sessão" 571 msgstr "Salvar propriedades da sessão"
576 572
@@ -637,7 +633,7 @@ msgstr &quot;Sessão em nova janela&quot; @@ -637,7 +633,7 @@ msgstr &quot;Sessão em nova janela&quot;
637 msgid "Session properties" 633 msgid "Session properties"
638 msgstr "Propriedades da sessão" 634 msgstr "Propriedades da sessão"
639 635
640 -#: src/objects/application/application.c:221 636 +#: src/objects/application/application.c:219
641 msgid "Set the user-interface type" 637 msgid "Set the user-interface type"
642 msgstr "Define o tipo de interface do usuário" 638 msgstr "Define o tipo de interface do usuário"
643 639
@@ -729,7 +725,7 @@ msgstr &quot;A etiqueta da ação&quot; @@ -729,7 +725,7 @@ msgstr &quot;A etiqueta da ação&quot;
729 msgid "The name of associated action" 725 msgid "The name of associated action"
730 msgstr "Nome da ação associada" 726 msgstr "Nome da ação associada"
731 727
732 -#: src/objects/window/window.c:164 728 +#: src/objects/window/window.c:165
733 msgid "The name of the actions in the header bar" 729 msgid "The name of the actions in the header bar"
734 msgstr "O nome das ações na barra de título" 730 msgstr "O nome das ações na barra de título"
735 731
@@ -820,7 +816,7 @@ msgstr &quot;Versão %s-%s&quot; @@ -820,7 +816,7 @@ msgstr &quot;Versão %s-%s&quot;
820 msgid "View" 816 msgid "View"
821 msgstr "Exibir" 817 msgstr "Exibir"
822 818
823 -#: src/objects/application/actions/about.c:157 819 +#: src/objects/application/actions/about.c:163
824 msgid "View this project on github" 820 msgid "View this project on github"
825 msgstr "Portal do Software Público Brasileiro" 821 msgstr "Portal do Software Público Brasileiro"
826 822
@@ -832,11 +828,11 @@ msgstr &quot;Janela com sessão padrão&quot; @@ -832,11 +828,11 @@ msgstr &quot;Janela com sessão padrão&quot;
832 msgid "_Apply" 828 msgid "_Apply"
833 msgstr "_Aplicar" 829 msgstr "_Aplicar"
834 830
835 -#: src/objects/settings/dialog.c:78 src/objects/linux/savedesktopicon.c:132 831 +#: src/objects/settings/dialog.c:78 src/objects/windows/savedesktopicon.c:110
836 msgid "_Cancel" 832 msgid "_Cancel"
837 msgstr "_Cancelar" 833 msgstr "_Cancelar"
838 834
839 -#: src/objects/window/page.c:394 835 +#: src/objects/window/page.c:395
840 msgid "_Close session" 836 msgid "_Close session"
841 msgstr "_Fechar sessão" 837 msgstr "_Fechar sessão"
842 838
@@ -872,11 +868,11 @@ msgstr &quot;_Abrir&quot; @@ -872,11 +868,11 @@ msgstr &quot;_Abrir&quot;
872 msgid "_Properties" 868 msgid "_Properties"
873 msgstr "_Propriedades" 869 msgstr "_Propriedades"
874 870
875 -#: src/objects/window/page.c:388 871 +#: src/objects/window/page.c:389
876 msgid "_Rename session" 872 msgid "_Rename session"
877 msgstr "Renomear sessão" 873 msgstr "Renomear sessão"
878 874
879 -#: src/objects/linux/savedesktopicon.c:133 875 +#: src/objects/windows/savedesktopicon.c:111
880 msgid "_Save" 876 msgid "_Save"
881 msgstr "_Salvar" 877 msgstr "_Salvar"
882 878
@@ -884,11 +880,11 @@ msgstr &quot;_Salvar&quot; @@ -884,11 +880,11 @@ msgstr &quot;_Salvar&quot;
884 msgid "_View" 880 msgid "_View"
885 msgstr "_Exibir" 881 msgstr "_Exibir"
886 882
887 -#: src/objects/application/actions/about.c:156 883 +#: src/objects/application/actions/about.c:162
888 msgid "https://github.com/PerryWerneck/pw3270" 884 msgid "https://github.com/PerryWerneck/pw3270"
889 msgstr "https://portal.softwarepublico.gov.br/social/pw3270/" 885 msgstr "https://portal.softwarepublico.gov.br/social/pw3270/"
890 886
891 -#: src/objects/application/actions/about.c:159 887 +#: src/objects/application/actions/about.c:165
892 msgid "translator-credits" 888 msgid "translator-credits"
893 msgstr "translator-credits" 889 msgstr "translator-credits"
894 890
@@ -1323,9 +1319,6 @@ msgstr &quot;translator-credits&quot; @@ -1323,9 +1319,6 @@ msgstr &quot;translator-credits&quot;
1323 #~ msgid "Can't load plugin %s" 1319 #~ msgid "Can't load plugin %s"
1324 #~ msgstr "Não foi possível carregar plugin %s" 1320 #~ msgstr "Não foi possível carregar plugin %s"
1325 1321
1326 -#~ msgid "Can't open %s"  
1327 -#~ msgstr "Não foi possível abrir %s"  
1328 -  
1329 #~ msgid "Can't open CRL File" 1322 #~ msgid "Can't open CRL File"
1330 #~ msgstr "Não foi possível abrir arquivo CRL" 1323 #~ msgstr "Não foi possível abrir arquivo CRL"
1331 1324
@@ -1371,9 +1364,6 @@ msgstr &quot;translator-credits&quot; @@ -1371,9 +1364,6 @@ msgstr &quot;translator-credits&quot;
1371 #~ msgid "Can't save \"%s\": %s" 1364 #~ msgid "Can't save \"%s\": %s"
1372 #~ msgstr "Não foi possível salvar %s: %s" 1365 #~ msgstr "Não foi possível salvar %s: %s"
1373 1366
1374 -#~ msgid "Can't save %s"  
1375 -#~ msgstr "Não foi possível salvar arquivo %s"  
1376 -  
1377 #~ msgid "" 1367 #~ msgid ""
1378 #~ "Can't save copy to file\n" 1368 #~ "Can't save copy to file\n"
1379 #~ "%s" 1369 #~ "%s"
@@ -1381,6 +1371,9 @@ msgstr &quot;translator-credits&quot; @@ -1381,6 +1371,9 @@ msgstr &quot;translator-credits&quot;
1381 #~ "Não foi possível salvar cópia para o arquivo\n" 1371 #~ "Não foi possível salvar cópia para o arquivo\n"
1382 #~ "%s" 1372 #~ "%s"
1383 1373
  1374 +#~ msgid "Can't save file \"%s\""
  1375 +#~ msgstr "Não foi possível salvar arquivo \"%s\""
  1376 +
1384 #~ msgid "" 1377 #~ msgid ""
1385 #~ "Can't save screen to file\n" 1378 #~ "Can't save screen to file\n"
1386 #~ "%s" 1379 #~ "%s"
@@ -1544,6 +1537,9 @@ msgstr &quot;translator-credits&quot; @@ -1544,6 +1537,9 @@ msgstr &quot;translator-credits&quot;
1544 #~ msgid "Command to execute" 1537 #~ msgid "Command to execute"
1545 #~ msgstr "Comando a executar" 1538 #~ msgstr "Comando a executar"
1546 1539
  1540 +#~ msgid "Comment"
  1541 +#~ msgstr "Comentário"
  1542 +
1547 #~ msgid "Complete" 1543 #~ msgid "Complete"
1548 #~ msgstr "Completo" 1544 #~ msgstr "Completo"
1549 1545
@@ -1799,6 +1795,9 @@ msgstr &quot;translator-credits&quot; @@ -1799,6 +1795,9 @@ msgstr &quot;translator-credits&quot;
1799 #~ msgid "File _Format" 1795 #~ msgid "File _Format"
1800 #~ msgstr "_Formato do arquivo" 1796 #~ msgstr "_Formato do arquivo"
1801 1797
  1798 +#~ msgid "File name"
  1799 +#~ msgstr "Nome do arquivo"
  1800 +
1802 #~ msgid "File transfer complete" 1801 #~ msgid "File transfer complete"
1803 #~ msgstr "Transferência completa" 1802 #~ msgstr "Transferência completa"
1804 1803
@@ -1869,6 +1868,9 @@ msgstr &quot;translator-credits&quot; @@ -1869,6 +1868,9 @@ msgstr &quot;translator-credits&quot;
1869 #~ msgid "GTK Version mismatch" 1868 #~ msgid "GTK Version mismatch"
1870 #~ msgstr "Divergência de versão GTK" 1869 #~ msgstr "Divergência de versão GTK"
1871 1870
  1871 +#~ msgid "Generic name"
  1872 +#~ msgstr "Nome genérico"
  1873 +
1872 #~ msgid "Get transfer queue from an external XML file" 1874 #~ msgid "Get transfer queue from an external XML file"
1873 #~ msgstr "Obtém a fila de transferência de um arquivo XML externo" 1875 #~ msgstr "Obtém a fila de transferência de um arquivo XML externo"
1874 1876
locale/pw3270.pot
@@ -8,7 +8,7 @@ msgid &quot;&quot; @@ -8,7 +8,7 @@ msgid &quot;&quot;
8 msgstr "" 8 msgstr ""
9 "Project-Id-Version: PACKAGE VERSION\n" 9 "Project-Id-Version: PACKAGE VERSION\n"
10 "Report-Msgid-Bugs-To: \n" 10 "Report-Msgid-Bugs-To: \n"
11 -"POT-Creation-Date: 2020-08-28 16:00-0300\n" 11 +"POT-Creation-Date: 2020-09-15 14:25-0300\n"
12 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 12 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 13 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14 "Language-Team: LANGUAGE <LL@li.org>\n" 14 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -17,7 +17,7 @@ msgstr &quot;&quot; @@ -17,7 +17,7 @@ msgstr &quot;&quot;
17 "Content-Type: text/plain; charset=CHARSET\n" 17 "Content-Type: text/plain; charset=CHARSET\n"
18 "Content-Transfer-Encoding: 8bit\n" 18 "Content-Transfer-Encoding: 8bit\n"
19 19
20 -#: src/objects/application/application.c:208 20 +#: src/objects/application/application.c:206
21 #, c-format 21 #, c-format
22 msgid "\"%s\" is not a valid user interface name" 22 msgid "\"%s\" is not a valid user interface name"
23 msgstr "" 23 msgstr ""
@@ -43,7 +43,7 @@ msgstr &quot;&quot; @@ -43,7 +43,7 @@ msgstr &quot;&quot;
43 msgid "64 bits Windows" 43 msgid "64 bits Windows"
44 msgstr "" 44 msgstr ""
45 45
46 -#: src/objects/application/actions/about.c:182 ui/application.xml:39 46 +#: src/objects/application/actions/about.c:188 ui/application.xml:39
47 #: ui/application.xml:537 47 #: ui/application.xml:537
48 msgid "About PW3270" 48 msgid "About PW3270"
49 msgstr "" 49 msgstr ""
@@ -52,7 +52,7 @@ msgstr &quot;&quot; @@ -52,7 +52,7 @@ msgstr &quot;&quot;
52 msgid "Action Name" 52 msgid "Action Name"
53 msgstr "" 53 msgstr ""
54 54
55 -#: src/objects/window/window.c:163 src/objects/toolbar/toolbar.c:135 55 +#: src/objects/window/window.c:164 src/objects/toolbar/toolbar.c:135
56 msgid "Action Names" 56 msgid "Action Names"
57 msgstr "" 57 msgstr ""
58 58
@@ -80,7 +80,7 @@ msgstr &quot;&quot; @@ -80,7 +80,7 @@ msgstr &quot;&quot;
80 msgid "Application preferences" 80 msgid "Application preferences"
81 msgstr "" 81 msgstr ""
82 82
83 -#: src/objects/window/page.c:263 83 +#: src/objects/window/page.c:264
84 msgid "Apply" 84 msgid "Apply"
85 msgstr "" 85 msgstr ""
86 86
@@ -108,17 +108,22 @@ msgstr &quot;&quot; @@ -108,17 +108,22 @@ msgstr &quot;&quot;
108 msgid "Bold" 108 msgid "Bold"
109 msgstr "" 109 msgstr ""
110 110
111 -#: src/objects/window/terminal.c:197 111 +#: src/objects/actions/save.c:110 src/objects/window/terminal.c:171
  112 +msgid "Can't load session file"
  113 +msgstr ""
  114 +
  115 +#: src/objects/actions/save.c:105
112 #, c-format 116 #, c-format
113 -msgid "Can't save file \"%s\"" 117 +msgid "Can't open \"%s\""
114 msgstr "" 118 msgstr ""
115 119
116 -#: src/objects/window/terminal.c:202  
117 -msgid "Can't save session file" 120 +#: src/objects/window/terminal.c:166
  121 +#, c-format
  122 +msgid "Can't use \"%s\""
118 msgstr "" 123 msgstr ""
119 124
120 -#: src/objects/actions/save.c:65 src/objects/application/actions/open.c:49  
121 -#: src/objects/window/page.c:264 125 +#: src/objects/actions/save.c:66 src/objects/application/actions/open.c:49
  126 +#: src/objects/window/page.c:265
122 msgid "Cancel" 127 msgid "Cancel"
123 msgstr "" 128 msgstr ""
124 129
@@ -152,10 +157,6 @@ msgstr &quot;&quot; @@ -152,10 +157,6 @@ msgstr &quot;&quot;
152 msgid "Colors" 157 msgid "Colors"
153 msgstr "" 158 msgstr ""
154 159
155 -#: src/objects/linux/savedesktopicon.c:93  
156 -msgid "Comment"  
157 -msgstr ""  
158 -  
159 #: src/objects/window/actions/connect.c:59 160 #: src/objects/window/actions/connect.c:59
160 msgid "Connect" 161 msgid "Connect"
161 msgstr "" 162 msgstr ""
@@ -168,7 +169,7 @@ msgstr &quot;&quot; @@ -168,7 +169,7 @@ msgstr &quot;&quot;
168 msgid "Connect to host" 169 msgid "Connect to host"
169 msgstr "" 170 msgstr ""
170 171
171 -#: src/objects/window/window.c:702 src/objects/window/page.c:217 172 +#: src/objects/window/window.c:703 src/objects/window/page.c:218
172 msgid "Connected to host" 173 msgid "Connected to host"
173 msgstr "" 174 msgstr ""
174 175
@@ -188,7 +189,7 @@ msgstr &quot;&quot; @@ -188,7 +189,7 @@ msgstr &quot;&quot;
188 msgid "Copy as text" 189 msgid "Copy as text"
189 msgstr "" 190 msgstr ""
190 191
191 -#: src/objects/linux/savedesktopicon.c:106 192 +#: src/objects/windows/savedesktopicon.c:85
192 msgid "Create a desktop icon for the current session" 193 msgid "Create a desktop icon for the current session"
193 msgstr "" 194 msgstr ""
194 195
@@ -216,6 +217,10 @@ msgstr &quot;&quot; @@ -216,6 +217,10 @@ msgstr &quot;&quot;
216 msgid "Delete Field" 217 msgid "Delete Field"
217 msgstr "" 218 msgstr ""
218 219
  220 +#: src/objects/windows/savedesktopicon.c:73
  221 +msgid "Description"
  222 +msgstr ""
  223 +
219 #: ui/window.xml:93 ui/application.xml:158 224 #: ui/window.xml:93 ui/application.xml:158
220 msgid "Desktop icon" 225 msgid "Desktop icon"
221 msgstr "" 226 msgstr ""
@@ -224,8 +229,8 @@ msgstr &quot;&quot; @@ -224,8 +229,8 @@ msgstr &quot;&quot;
224 msgid "Disconnect" 229 msgid "Disconnect"
225 msgstr "" 230 msgstr ""
226 231
227 -#: src/objects/window/window.c:702 src/objects/window/window.c:729  
228 -#: src/objects/window/page.c:206 232 +#: src/objects/window/window.c:703 src/objects/window/window.c:730
  233 +#: src/objects/window/page.c:207
229 msgid "Disconnected from host" 234 msgid "Disconnected from host"
230 msgstr "" 235 msgstr ""
231 236
@@ -269,10 +274,6 @@ msgstr &quot;&quot; @@ -269,10 +274,6 @@ msgstr &quot;&quot;
269 msgid "Field attributes" 274 msgid "Field attributes"
270 msgstr "" 275 msgstr ""
271 276
272 -#: src/objects/linux/savedesktopicon.c:72  
273 -msgid "File name"  
274 -msgstr ""  
275 -  
276 #: ui/application.xml:454 277 #: ui/application.xml:454
277 msgid "Full Screen" 278 msgid "Full Screen"
278 msgstr "" 279 msgstr ""
@@ -285,10 +286,6 @@ msgstr &quot;&quot; @@ -285,10 +286,6 @@ msgstr &quot;&quot;
285 msgid "Function bar" 286 msgid "Function bar"
286 msgstr "" 287 msgstr ""
287 288
288 -#: src/objects/linux/savedesktopicon.c:86  
289 -msgid "Generic name"  
290 -msgstr ""  
291 -  
292 #: ui/application.xml:36 ui/application.xml:534 289 #: ui/application.xml:36 ui/application.xml:534
293 msgid "Help" 290 msgid "Help"
294 msgstr "" 291 msgstr ""
@@ -297,7 +294,7 @@ msgstr &quot;&quot; @@ -297,7 +294,7 @@ msgstr &quot;&quot;
297 msgid "Host properties" 294 msgid "Host properties"
298 msgstr "" 295 msgstr ""
299 296
300 -#: src/objects/window/window.c:469 297 +#: src/objects/window/window.c:470 src/objects/windows/savedesktopicon.c:213
301 msgid "IBM 3270 Terminal emulator" 298 msgid "IBM 3270 Terminal emulator"
302 msgstr "" 299 msgstr ""
303 300
@@ -365,8 +362,7 @@ msgstr &quot;&quot; @@ -365,8 +362,7 @@ msgstr &quot;&quot;
365 msgid "Keypads" 362 msgid "Keypads"
366 msgstr "" 363 msgstr ""
367 364
368 -#: src/objects/application/actions/about.c:138  
369 -msgctxt "LicenseFileName" 365 +#: src/objects/application/actions/about.c:140
370 msgid "LICENSE" 366 msgid "LICENSE"
371 msgstr "" 367 msgstr ""
372 368
@@ -378,7 +374,7 @@ msgstr &quot;&quot; @@ -378,7 +374,7 @@ msgstr &quot;&quot;
378 msgid "Large" 374 msgid "Large"
379 msgstr "" 375 msgstr ""
380 376
381 -#: src/objects/linux/savedesktopicon.c:79 377 +#: src/objects/windows/savedesktopicon.c:68
382 msgid "Launcher name" 378 msgid "Launcher name"
383 msgstr "" 379 msgstr ""
384 380
@@ -430,7 +426,7 @@ msgstr &quot;&quot; @@ -430,7 +426,7 @@ msgstr &quot;&quot;
430 msgid "Network keep alive" 426 msgid "Network keep alive"
431 msgstr "" 427 msgstr ""
432 428
433 -#: src/objects/window/page.c:274 429 +#: src/objects/window/page.c:275
434 msgid "New session name" 430 msgid "New session name"
435 msgstr "" 431 msgstr ""
436 432
@@ -527,7 +523,7 @@ msgstr &quot;&quot; @@ -527,7 +523,7 @@ msgstr &quot;&quot;
527 msgid "Quit" 523 msgid "Quit"
528 msgstr "" 524 msgstr ""
529 525
530 -#: src/objects/window/page.c:261 526 +#: src/objects/window/page.c:262
531 msgid "Rename Session" 527 msgid "Rename Session"
532 msgstr "" 528 msgstr ""
533 529
@@ -547,15 +543,15 @@ msgstr &quot;&quot; @@ -547,15 +543,15 @@ msgstr &quot;&quot;
547 msgid "S_tyle" 543 msgid "S_tyle"
548 msgstr "" 544 msgstr ""
549 545
550 -#: src/objects/actions/save.c:64 ui/window.xml:69 ui/application.xml:134 546 +#: src/objects/actions/save.c:65 ui/window.xml:69 ui/application.xml:134
551 msgid "Save" 547 msgid "Save"
552 msgstr "" 548 msgstr ""
553 549
554 -#: src/objects/actions/save.c:49 550 +#: src/objects/actions/save.c:50
555 msgid "Save As" 551 msgid "Save As"
556 msgstr "" 552 msgstr ""
557 553
558 -#: src/objects/linux/savedesktopicon.c:105 554 +#: src/objects/windows/savedesktopicon.c:84
559 msgid "Save desktop icon" 555 msgid "Save desktop icon"
560 msgstr "" 556 msgstr ""
561 557
@@ -567,7 +563,7 @@ msgstr &quot;&quot; @@ -567,7 +563,7 @@ msgstr &quot;&quot;
567 msgid "Save selected" 563 msgid "Save selected"
568 msgstr "" 564 msgstr ""
569 565
570 -#: src/objects/actions/save.c:51 566 +#: src/objects/actions/save.c:52
571 msgid "Save session properties" 567 msgid "Save session properties"
572 msgstr "" 568 msgstr ""
573 569
@@ -634,7 +630,7 @@ msgstr &quot;&quot; @@ -634,7 +630,7 @@ msgstr &quot;&quot;
634 msgid "Session properties" 630 msgid "Session properties"
635 msgstr "" 631 msgstr ""
636 632
637 -#: src/objects/application/application.c:221 633 +#: src/objects/application/application.c:219
638 msgid "Set the user-interface type" 634 msgid "Set the user-interface type"
639 msgstr "" 635 msgstr ""
640 636
@@ -726,7 +722,7 @@ msgstr &quot;&quot; @@ -726,7 +722,7 @@ msgstr &quot;&quot;
726 msgid "The name of associated action" 722 msgid "The name of associated action"
727 msgstr "" 723 msgstr ""
728 724
729 -#: src/objects/window/window.c:164 725 +#: src/objects/window/window.c:165
730 msgid "The name of the actions in the header bar" 726 msgid "The name of the actions in the header bar"
731 msgstr "" 727 msgstr ""
732 728
@@ -817,7 +813,7 @@ msgstr &quot;&quot; @@ -817,7 +813,7 @@ msgstr &quot;&quot;
817 msgid "View" 813 msgid "View"
818 msgstr "" 814 msgstr ""
819 815
820 -#: src/objects/application/actions/about.c:157 816 +#: src/objects/application/actions/about.c:163
821 msgid "View this project on github" 817 msgid "View this project on github"
822 msgstr "" 818 msgstr ""
823 819
@@ -829,11 +825,11 @@ msgstr &quot;&quot; @@ -829,11 +825,11 @@ msgstr &quot;&quot;
829 msgid "_Apply" 825 msgid "_Apply"
830 msgstr "" 826 msgstr ""
831 827
832 -#: src/objects/settings/dialog.c:78 src/objects/linux/savedesktopicon.c:132 828 +#: src/objects/settings/dialog.c:78 src/objects/windows/savedesktopicon.c:110
833 msgid "_Cancel" 829 msgid "_Cancel"
834 msgstr "" 830 msgstr ""
835 831
836 -#: src/objects/window/page.c:394 832 +#: src/objects/window/page.c:395
837 msgid "_Close session" 833 msgid "_Close session"
838 msgstr "" 834 msgstr ""
839 835
@@ -869,11 +865,11 @@ msgstr &quot;&quot; @@ -869,11 +865,11 @@ msgstr &quot;&quot;
869 msgid "_Properties" 865 msgid "_Properties"
870 msgstr "" 866 msgstr ""
871 867
872 -#: src/objects/window/page.c:388 868 +#: src/objects/window/page.c:389
873 msgid "_Rename session" 869 msgid "_Rename session"
874 msgstr "" 870 msgstr ""
875 871
876 -#: src/objects/linux/savedesktopicon.c:133 872 +#: src/objects/windows/savedesktopicon.c:111
877 msgid "_Save" 873 msgid "_Save"
878 msgstr "" 874 msgstr ""
879 875
@@ -881,10 +877,10 @@ msgstr &quot;&quot; @@ -881,10 +877,10 @@ msgstr &quot;&quot;
881 msgid "_View" 877 msgid "_View"
882 msgstr "" 878 msgstr ""
883 879
884 -#: src/objects/application/actions/about.c:156 880 +#: src/objects/application/actions/about.c:162
885 msgid "https://github.com/PerryWerneck/pw3270" 881 msgid "https://github.com/PerryWerneck/pw3270"
886 msgstr "" 882 msgstr ""
887 883
888 -#: src/objects/application/actions/about.c:159 884 +#: src/objects/application/actions/about.c:165
889 msgid "translator-credits" 885 msgid "translator-credits"
890 msgstr "" 886 msgstr ""
@@ -53,6 +53,7 @@ @@ -53,6 +53,7 @@
53 <Unit filename="src/include/pw3270/settings.h" /> 53 <Unit filename="src/include/pw3270/settings.h" />
54 <Unit filename="src/include/pw3270/toolbar.h" /> 54 <Unit filename="src/include/pw3270/toolbar.h" />
55 <Unit filename="src/include/pw3270/window.h" /> 55 <Unit filename="src/include/pw3270/window.h" />
  56 + <Unit filename="src/include/v3270/keyfile.h" />
56 <Unit filename="src/main/main.c"> 57 <Unit filename="src/main/main.c">
57 <Option compilerVar="CC" /> 58 <Option compilerVar="CC" />
58 </Unit> 59 </Unit>
@@ -169,6 +170,9 @@ @@ -169,6 +170,9 @@
169 <Unit filename="src/objects/window/header.c"> 170 <Unit filename="src/objects/window/header.c">
170 <Option compilerVar="CC" /> 171 <Option compilerVar="CC" />
171 </Unit> 172 </Unit>
  173 + <Unit filename="src/objects/window/keyfile.c">
  174 + <Option compilerVar="CC" />
  175 + </Unit>
172 <Unit filename="src/objects/window/page.c"> 176 <Unit filename="src/objects/window/page.c">
173 <Option compilerVar="CC" /> 177 <Option compilerVar="CC" />
174 </Unit> 178 </Unit>
src/include/pw3270.h
@@ -68,13 +68,6 @@ @@ -68,13 +68,6 @@
68 68
69 void gtk_file_chooser_set_pw3270_filters(GtkFileChooser *chooser); 69 void gtk_file_chooser_set_pw3270_filters(GtkFileChooser *chooser);
70 70
71 - const gchar * v3270_get_session_filename(GtkWidget *widget);  
72 - void v3270_set_session_filename(GtkWidget *widget, const gchar *filename);  
73 - GKeyFile * v3270_get_session_keyfile(GtkWidget *widget);  
74 -  
75 - /// @brief Check if the terminal has a customized session file.  
76 - gboolean v3270_allow_custom_settings(GtkWidget *widget);  
77 -  
78 G_END_DECLS 71 G_END_DECLS
79 72
80 #endif // PW3270_H_INCLUDED 73 #endif // PW3270_H_INCLUDED
src/include/v3270/keyfile.h 0 → 100644
@@ -0,0 +1,58 @@ @@ -0,0 +1,58 @@
  1 +/*
  2 + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  3 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  4 + * aplicativos mainframe. Registro no INPI sob o nome G3270.
  5 + *
  6 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  7 + *
  8 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  9 + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  10 + * Free Software Foundation.
  11 + *
  12 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  13 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  14 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  15 + * obter mais detalhes.
  16 + *
  17 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  18 + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  19 + * St, Fifth Floor, Boston, MA 02110-1301 USA
  20 + *
  21 + * Este programa está nomeado como - e possui - linhas de código.
  22 + *
  23 + * Contatos:
  24 + *
  25 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  26 + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
  27 + *
  28 + */
  29 +
  30 +/**
  31 + * @brief Declares the v3270 keyfile object.
  32 + *
  33 + */
  34 +
  35 +#ifndef V3270_KEYFILE_H_INCLUDED
  36 +
  37 + #define V3270_KEYFILE_H_INCLUDED
  38 +
  39 + #include <glib.h>
  40 +
  41 + G_BEGIN_DECLS
  42 +
  43 + typedef struct _V3270KeyFile V3270KeyFile;
  44 +
  45 + V3270KeyFile * v3270_key_file_open(GtkWidget *terminal, const gchar *name, GError **error);
  46 + void v3270_key_file_close(GtkWidget *terminal);
  47 + void v3270_key_file_save(GtkWidget *terminal);
  48 + const gchar * v3270_key_file_get_file_name(GtkWidget *terminal);
  49 +
  50 + GKeyFile * v3270_key_file_get(GtkWidget *terminal);
  51 +
  52 + gboolean v3270_key_file_can_write(GtkWidget *widget);
  53 +
  54 + void v3270_key_file_set_boolean(GtkWidget *terminal, const gchar *group_name, const gchar *key, gboolean value);
  55 +
  56 + G_END_DECLS
  57 +
  58 +#endif // PW3270_H_INCLUDED
src/objects/actions/save.c
@@ -34,6 +34,7 @@ @@ -34,6 +34,7 @@
34 34
35 #include "private.h" 35 #include "private.h"
36 #include <v3270.h> 36 #include <v3270.h>
  37 + #include <v3270/keyfile.h>
37 #include <pw3270.h> 38 #include <pw3270.h>
38 #include <pw3270/application.h> 39 #include <pw3270/application.h>
39 40
@@ -70,9 +71,10 @@ @@ -70,9 +71,10 @@
70 gtk_file_chooser_set_pw3270_filters(GTK_FILE_CHOOSER(dialog)); 71 gtk_file_chooser_set_pw3270_filters(GTK_FILE_CHOOSER(dialog));
71 72
72 if(terminal) { 73 if(terminal) {
73 - const gchar * current_file = v3270_get_session_filename(terminal);  
74 - if(current_file && g_file_test(current_file,G_FILE_TEST_IS_REGULAR) && !g_str_has_prefix(current_file,g_get_user_config_dir())) 74 + const gchar * current_file = v3270_key_file_get_file_name(terminal);
  75 + if(current_file && g_file_test(current_file,G_FILE_TEST_IS_REGULAR) && !g_str_has_prefix(current_file,g_get_user_config_dir())) {
75 gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog),current_file); 76 gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog),current_file);
  77 + }
76 } 78 }
77 79
78 g_signal_connect(dialog,"response",G_CALLBACK(response),terminal); 80 g_signal_connect(dialog,"response",G_CALLBACK(response),terminal);
@@ -90,7 +92,31 @@ @@ -90,7 +92,31 @@
90 gtk_widget_destroy(dialog); 92 gtk_widget_destroy(dialog);
91 93
92 if(response_id == GTK_RESPONSE_OK) { 94 if(response_id == GTK_RESPONSE_OK) {
93 - v3270_set_session_filename(terminal, filename); 95 + GError * error = NULL;
  96 + v3270_key_file_open(terminal,filename,&error);
  97 +
  98 + if(error) {
  99 +
  100 + GtkWidget * dialog = gtk_message_dialog_new_with_markup(
  101 + GTK_WINDOW(gtk_widget_get_toplevel(terminal)),
  102 + GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
  103 + GTK_MESSAGE_ERROR,
  104 + GTK_BUTTONS_CANCEL,
  105 + _("Can't open \"%s\""),filename
  106 + );
  107 +
  108 + gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),"%s",error->message);
  109 +
  110 + gtk_window_set_title(GTK_WINDOW(dialog),_("Can't load session file"));
  111 +
  112 + gtk_widget_show_all(dialog);
  113 +
  114 + g_signal_connect(dialog,"close",G_CALLBACK(gtk_widget_destroy),NULL);
  115 + g_signal_connect(dialog,"response",G_CALLBACK(gtk_widget_destroy),NULL);
  116 +
  117 + g_error_free(error);
  118 + }
  119 +
94 } 120 }
95 121
96 } 122 }
src/objects/keypad/load.c
@@ -82,7 +82,7 @@ @@ -82,7 +82,7 @@
82 82
83 } 83 }
84 84
85 - static void element_end(GMarkupParseContext *context, const gchar *element_name, GList **keypads, GError **error) { 85 + static void element_end(GMarkupParseContext *context, const gchar *element_name, GList G_GNUC_UNUSED(**keypads), GError G_GNUC_UNUSED(**error)) {
86 86
87 debug("%s(%s)",__FUNCTION__,element_name); 87 debug("%s(%s)",__FUNCTION__,element_name);
88 88
src/objects/linux/savedesktopicon.c
@@ -36,6 +36,7 @@ @@ -36,6 +36,7 @@
36 #include <pw3270.h> 36 #include <pw3270.h>
37 #include <pw3270/application.h> 37 #include <pw3270/application.h>
38 #include <v3270/actions.h> 38 #include <v3270/actions.h>
  39 + #include <v3270/keyfile.h>
39 #include <lib3270.h> 40 #include <lib3270.h>
40 #include <lib3270/log.h> 41 #include <lib3270/log.h>
41 42
@@ -278,7 +279,7 @@ X-Desktop-File-Install-Version=0.23 @@ -278,7 +279,7 @@ X-Desktop-File-Install-Version=0.23
278 if(bytes >= 0) 279 if(bytes >= 0)
279 buffer[bytes] = '\0'; 280 buffer[bytes] = '\0';
280 281
281 - g_autofree gchar * exec_line = g_strdup_printf("%s \"%s\"",buffer,v3270_get_session_filename(terminal)); 282 + g_autofree gchar * exec_line = g_strdup_printf("%s \"%s\"",buffer,v3270_key_file_get_file_name(terminal));
282 g_key_file_set_string(keyfile,"Desktop Entry","Exec",exec_line); 283 g_key_file_set_string(keyfile,"Desktop Entry","Exec",exec_line);
283 284
284 } 285 }
src/objects/window/keyfile.c 0 → 100644
@@ -0,0 +1,247 @@ @@ -0,0 +1,247 @@
  1 +/*
  2 + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  3 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  4 + * aplicativos mainframe. Registro no INPI sob o nome G3270.
  5 + *
  6 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  7 + *
  8 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  9 + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  10 + * Free Software Foundation.
  11 + *
  12 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  13 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  14 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  15 + * obter mais detalhes.
  16 + *
  17 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  18 + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  19 + * St, Fifth Floor, Boston, MA 02110-1301 USA
  20 + *
  21 + * Este programa está nomeado como - e possui - linhas de código.
  22 + *
  23 + * Contatos:
  24 + *
  25 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  26 + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
  27 + *
  28 + */
  29 +
  30 + #include <config.h>
  31 + #include <lib3270.h>
  32 + #include <lib3270/log.h>
  33 + #include <v3270.h>
  34 + #include <v3270/settings.h>
  35 + #include <v3270/keyfile.h>
  36 + #include <v3270/actions.h>
  37 + #include <string.h>
  38 + #include <stdlib.h>
  39 +
  40 + struct _V3270KeyFile
  41 + {
  42 + gboolean changed; ///< @brief Save file?
  43 + GKeyFile * key_file;
  44 + gchar filename[1];
  45 + };
  46 +
  47 + static V3270KeyFile * v3270_get_session_descriptor(GtkWidget *terminal) {
  48 +
  49 + return (V3270KeyFile *) g_object_get_data(G_OBJECT(terminal),"session-descriptor");
  50 +
  51 + }
  52 +
  53 + static void close_keyfile(V3270KeyFile * session) {
  54 +
  55 + if(session->key_file) {
  56 +
  57 + if(session->changed) {
  58 + g_message("Saving file %s",session->filename);
  59 + g_key_file_save_to_file(session->key_file,session->filename,NULL);
  60 + session->changed = FALSE;
  61 + } else {
  62 + g_message("Closing file %s",session->filename);
  63 + }
  64 +
  65 + g_key_file_free(session->key_file);
  66 + session->key_file = NULL;
  67 + }
  68 +
  69 + g_free(session);
  70 + }
  71 +
  72 + V3270KeyFile * v3270_key_file_open(GtkWidget *terminal, const gchar *filename, GError **error) {
  73 +
  74 + g_return_val_if_fail(GTK_IS_V3270(terminal),FALSE);
  75 + g_return_val_if_fail(*error == NULL,FALSE);
  76 +
  77 + V3270KeyFile * new_session = (V3270KeyFile *) g_malloc0(sizeof(struct _V3270KeyFile) + strlen(filename));
  78 + V3270KeyFile * old_session = g_object_get_data(G_OBJECT(terminal),"session-descriptor");
  79 +
  80 + // Clone session
  81 + if(old_session) {
  82 + *new_session = *old_session;
  83 + }
  84 +
  85 + strcpy(new_session->filename,filename);
  86 + new_session->key_file = g_key_file_new();
  87 +
  88 + // Load file
  89 + if(g_file_test(new_session->filename,G_FILE_TEST_IS_REGULAR)) {
  90 +
  91 + // Found session file, open it.
  92 + if(!g_key_file_load_from_file(new_session->key_file,new_session->filename,G_KEY_FILE_NONE,error)) {
  93 + g_warning("Can't load \"%s\"",new_session->filename);
  94 + } else {
  95 + g_message("Loading session properties from %s",new_session->filename);
  96 + }
  97 +
  98 + } else {
  99 +
  100 + // No session file, load the defaults (if available) and save file
  101 + lib3270_autoptr(char) default_settings = lib3270_build_data_filename("defaults.conf",NULL);
  102 +
  103 + if(g_file_test(default_settings,G_FILE_TEST_IS_REGULAR)) {
  104 + if(!g_key_file_load_from_file(new_session->key_file,default_settings,G_KEY_FILE_NONE,error)) {
  105 + g_warning("Can't load \"%s\"",default_settings);
  106 + } else {
  107 + g_message("Loading session properties from %s",default_settings);
  108 + }
  109 + } else {
  110 +#ifdef DEBUG
  111 + g_message("Can't find default settings file \"%s\"",default_settings);
  112 +#else
  113 + g_warning("Can't find default settings file \"%s\"",default_settings);
  114 +#endif // DEBUG
  115 + }
  116 +
  117 + new_session->changed = TRUE;
  118 +
  119 + }
  120 +
  121 + g_object_set_data_full(G_OBJECT(terminal),"session-descriptor",new_session,(GDestroyNotify) close_keyfile);
  122 + if(new_session->changed) {
  123 + v3270_key_file_save(terminal);
  124 + }
  125 +
  126 + if(!*error) {
  127 +
  128 + // Got key file, load it.
  129 + v3270_load_key_file(terminal,new_session->key_file,NULL);
  130 + v3270_accelerator_map_load_key_file(terminal,new_session->key_file,NULL);
  131 +
  132 + if(g_key_file_has_group(new_session->key_file,"environment")) {
  133 +
  134 + // Has environment group, set values.
  135 + gchar **keys = g_key_file_get_keys(new_session->key_file,"environment",NULL,NULL);
  136 +
  137 + if(keys) {
  138 + size_t ix;
  139 + for(ix=0;keys[ix];ix++) {
  140 + g_autofree gchar * value = g_key_file_get_string(new_session->key_file,"environment",keys[ix],NULL);
  141 + if(value) {
  142 +#ifdef _WIN32
  143 + g_autofree gchar * env = g_strconcat(keys[ix],"=",value,NULL);
  144 + putenv(env);
  145 +#else
  146 + if(setenv(keys[ix],value,1)) {
  147 + g_warning("Can't set \"%s\" to \"%s\"",keys[ix],value);
  148 + }
  149 +#endif // _WIN32
  150 + }
  151 + }
  152 +
  153 + g_strfreev(keys);
  154 + }
  155 + }
  156 +
  157 + }
  158 +
  159 + return new_session;
  160 +}
  161 +
  162 +void v3270_key_file_close(GtkWidget *terminal) {
  163 +
  164 + V3270KeyFile *session = g_object_get_data(G_OBJECT(terminal),"session-descriptor");
  165 +
  166 + if(session->key_file) {
  167 +
  168 + if(session->changed) {
  169 + g_message("Saving file %s",session->filename);
  170 + g_key_file_save_to_file(session->key_file,session->filename,NULL);
  171 + session->changed = FALSE;
  172 + } else {
  173 + g_message("Closing file %s",session->filename);
  174 + }
  175 +
  176 + g_key_file_free(session->key_file);
  177 + session->key_file = NULL;
  178 + }
  179 +
  180 + }
  181 +
  182 + GKeyFile * v3270_key_file_get(GtkWidget *terminal) {
  183 + return v3270_get_session_descriptor(terminal)->key_file;
  184 + }
  185 +
  186 + void v3270_key_file_save(GtkWidget *terminal) {
  187 +
  188 + V3270KeyFile *session = v3270_get_session_descriptor(terminal);
  189 +
  190 + session->changed = FALSE;
  191 +
  192 + debug("%s: terminal=%p session=%p key-file=%p)",__FUNCTION__,terminal,session,session->key_file);
  193 +
  194 + v3270_to_key_file(terminal,session->key_file,"terminal");
  195 + v3270_accelerator_map_to_key_file(terminal, session->key_file, "accelerators");
  196 +
  197 + g_key_file_save_to_file(session->key_file,session->filename,NULL);
  198 +
  199 + }
  200 +
  201 + const gchar * v3270_key_file_get_file_name(GtkWidget *terminal) {
  202 +
  203 + V3270KeyFile *session = v3270_get_session_descriptor(terminal);
  204 +
  205 + if(session && *session->filename)
  206 + return session->filename;
  207 +
  208 + return NULL;
  209 +
  210 + }
  211 +
  212 + void v3270_key_file_set_boolean(GtkWidget *terminal, const gchar *group_name, const gchar *key, gboolean value) {
  213 +
  214 + V3270KeyFile *session = v3270_get_session_descriptor(terminal);
  215 + g_key_file_set_boolean(session->key_file,group_name ? group_name : "terminal",key,value);
  216 + session->changed = TRUE;
  217 +
  218 +}
  219 +
  220 + gboolean v3270_key_file_can_write(GtkWidget *widget) {
  221 +
  222 +#if defined(DEBUG)
  223 +
  224 + return TRUE;
  225 +
  226 +#else
  227 +
  228 + const struct SessionDescriptor * descriptor = v3270_get_session_descriptor(widget);
  229 +
  230 + if(!(descriptor && *descriptor->filename))
  231 + return FALSE;
  232 +
  233 + if(g_access(descriptor->filename,W_OK))
  234 + return FALSE;
  235 +
  236 +#ifdef _WIN32
  237 + return TRUE;
  238 +#else
  239 + return !g_str_has_prefix(descriptor->filename,g_get_user_config_dir());
  240 +#endif // _WIN32
  241 +
  242 +#endif // DEBUG
  243 +
  244 + }
  245 +
  246 +
  247 +
src/objects/window/page.c
@@ -35,6 +35,7 @@ @@ -35,6 +35,7 @@
35 #include <v3270/dialogs.h> 35 #include <v3270/dialogs.h>
36 #include <v3270/actions.h> 36 #include <v3270/actions.h>
37 #include <v3270/print.h> 37 #include <v3270/print.h>
  38 + #include <v3270/keyfile.h>
38 #include <pw3270.h> 39 #include <pw3270.h>
39 40
40 //---[ Gtk Label with customized popup-menu ]--------------------------------------------------------------------------------------- 41 //---[ Gtk Label with customized popup-menu ]---------------------------------------------------------------------------------------
@@ -387,7 +388,7 @@ @@ -387,7 +388,7 @@
387 { 388 {
388 .label = N_("_Rename session"), 389 .label = N_("_Rename session"),
389 .callback = G_CALLBACK(rename_session), 390 .callback = G_CALLBACK(rename_session),
390 - .check_permission = v3270_allow_custom_settings 391 + .check_permission = v3270_key_file_can_write
391 }, 392 },
392 393
393 { 394 {
src/objects/window/terminal.c
@@ -40,60 +40,24 @@ @@ -40,60 +40,24 @@
40 #include <lib3270/toggle.h> 40 #include <lib3270/toggle.h>
41 #include <v3270/settings.h> 41 #include <v3270/settings.h>
42 #include <v3270/actions.h> 42 #include <v3270/actions.h>
  43 + #include <v3270/keyfile.h>
43 #include <v3270/print.h> 44 #include <v3270/print.h>
44 #include <lib3270/os.h> 45 #include <lib3270/os.h>
45 46
46 - struct SessionDescriptor  
47 - {  
48 - gboolean changed; ///< @brief Save file?  
49 - GKeyFile * key_file;  
50 - gchar filename[1];  
51 - };  
52 -  
53 - static void destroy(GtkWidget G_GNUC_UNUSED(*terminal), struct SessionDescriptor * session) {  
54 -  
55 - if(session->changed) {  
56 -  
57 - session->changed = FALSE;  
58 -  
59 - GError * error = NULL;  
60 - g_key_file_save_to_file(session->key_file,session->filename,&error);  
61 -  
62 - if(error) {  
63 -  
64 - g_warning("Can't save \"%s\": %s",session->filename,error->message);  
65 - g_error_free(error);  
66 -  
67 - } else {  
68 -  
69 - g_message("Session was saved to %s",session->filename);  
70 -  
71 - }  
72 -  
73 - }  
74 - 47 + static void destroy(GtkWidget *terminal, gpointer GNUC_UNUSED(dunno)) {
  48 + v3270_key_file_close(terminal);
75 } 49 }
76 50
77 - static void save_settings(GtkWidget *terminal, struct SessionDescriptor * session) {  
78 -  
79 - session->changed = FALSE;  
80 -  
81 - debug("%s(%p,%p)",__FUNCTION__,terminal,session);  
82 -  
83 - v3270_to_key_file(terminal,session->key_file,"terminal");  
84 - v3270_accelerator_map_to_key_file(terminal, session->key_file, "accelerators");  
85 -  
86 - g_key_file_save_to_file(session->key_file,session->filename,NULL);  
87 - 51 + static void toggle_changed(GtkWidget *widget, G_GNUC_UNUSED LIB3270_TOGGLE_ID toggle_id, gboolean toggle_state, const gchar *toggle_name, gpointer GNUC_UNUSED(dunno)) {
  52 + debug("%s(%s)=%s",__FUNCTION__,toggle_name,toggle_state ? "ON" : "OFF");
  53 + v3270_key_file_set_boolean(widget,"terminal",toggle_name,toggle_state);
88 } 54 }
89 55
90 - static void toggle_changed(G_GNUC_UNUSED GtkWidget *widget, G_GNUC_UNUSED LIB3270_TOGGLE_ID toggle_id, gboolean toggle_state, const gchar *toggle_name, struct SessionDescriptor * session) {  
91 - debug("%s(%s)=%s",__FUNCTION__,toggle_name,toggle_state ? "ON" : "OFF");  
92 - g_key_file_set_boolean(session->key_file,"terminal",toggle_name,toggle_state);  
93 - session->changed = TRUE; 56 + static void save_settings(GtkWidget *terminal, gpointer G_GNUC_UNUSED(dunno)) {
  57 + v3270_key_file_save(terminal);
94 } 58 }
95 59
96 - static void print_done(G_GNUC_UNUSED GtkWidget *widget, GtkPrintOperation *operation, GtkPrintOperationResult result, struct SessionDescriptor * session) { 60 + static void print_done(GtkWidget *widget, GtkPrintOperation *operation, GtkPrintOperationResult result, gpointer G_GNUC_UNUSED(dunno)) {
97 debug("%s(%u)",__FUNCTION__,(unsigned int) result); 61 debug("%s(%u)",__FUNCTION__,(unsigned int) result);
98 62
99 if(result != GTK_PRINT_OPERATION_RESULT_APPLY) 63 if(result != GTK_PRINT_OPERATION_RESULT_APPLY)
@@ -101,166 +65,72 @@ @@ -101,166 +65,72 @@
101 65
102 debug("%s: Saving print settings",__FUNCTION__); 66 debug("%s: Saving print settings",__FUNCTION__);
103 67
104 - v3270_print_operation_to_key_file(operation,session->key_file); 68 + v3270_print_operation_to_key_file(operation,v3270_key_file_get(widget));
  69 + v3270_emit_save_settings(widget,NULL);
105 70
106 - g_key_file_save_to_file(session->key_file,session->filename,NULL);  
107 - session->changed = FALSE;  
108 } 71 }
109 72
110 - static void print_setup(G_GNUC_UNUSED GtkWidget *widget, GtkPrintOperation *operation, struct SessionDescriptor * session) { 73 + static void print_setup(G_GNUC_UNUSED GtkWidget *widget, GtkPrintOperation *operation, gpointer G_GNUC_UNUSED(dunno) ) {
111 74
112 debug("%s(%p)",__FUNCTION__,operation); 75 debug("%s(%p)",__FUNCTION__,operation);
113 - v3270_print_operation_load_key_file(operation,session->key_file);  
114 -  
115 - }  
116 -  
117 - static void close_settings(struct SessionDescriptor * session) {  
118 -  
119 - if(session->key_file) {  
120 -  
121 - if(session->changed) {  
122 - g_message("Saving file %s",session->filename);  
123 - g_key_file_save_to_file(session->key_file,session->filename,NULL);  
124 - session->changed = FALSE;  
125 - } else {  
126 - g_message("Closing file %s",session->filename);  
127 - }  
128 -  
129 - g_key_file_free(session->key_file);  
130 - session->key_file = NULL;  
131 - }  
132 -  
133 - g_free(session);  
134 - }  
135 -  
136 - const gchar * v3270_get_session_filename(GtkWidget *widget) {  
137 -  
138 - g_return_val_if_fail(GTK_IS_V3270(widget),NULL);  
139 -  
140 - const struct SessionDescriptor * descriptor = (const struct SessionDescriptor *) g_object_get_data(G_OBJECT(widget),"session-descriptor");  
141 -  
142 - if(descriptor)  
143 - return descriptor->filename;  
144 -  
145 - return NULL;  
146 - }  
147 -  
148 - void v3270_set_session_filename(GtkWidget *terminal, const gchar *filename) {  
149 -  
150 - struct SessionDescriptor * old_session = (struct SessionDescriptor *) g_object_get_data(G_OBJECT(terminal),"session-descriptor");  
151 - struct SessionDescriptor * new_session = (struct SessionDescriptor *) g_malloc0(sizeof(struct SessionDescriptor) + strlen(filename));  
152 -  
153 - if(old_session) {  
154 - memcpy(new_session,old_session,sizeof(struct SessionDescriptor));  
155 - }  
156 -  
157 - strcpy(new_session->filename,filename);  
158 - new_session->key_file = g_key_file_new();  
159 -  
160 - v3270_to_key_file(terminal,new_session->key_file,NULL);  
161 - v3270_accelerator_map_to_key_file(terminal,new_session->key_file,NULL);  
162 -  
163 - GError *error = NULL;  
164 - g_key_file_save_to_file(new_session->key_file,new_session->filename,&error);  
165 -  
166 - if(error) {  
167 -  
168 - g_message("Can't save file \"%s\": %s",new_session->filename,error->message);  
169 -  
170 - GtkWidget * dialog = gtk_message_dialog_new_with_markup(  
171 - GTK_WINDOW(gtk_widget_get_toplevel(terminal)),  
172 - GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,  
173 - GTK_MESSAGE_ERROR,  
174 - GTK_BUTTONS_CANCEL,  
175 - _("Can't save file \"%s\""),new_session->filename  
176 - );  
177 -  
178 - gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),"%s",error->message);  
179 -  
180 - gtk_window_set_title(GTK_WINDOW(dialog),_("Can't save session file"));  
181 -  
182 - gtk_widget_show_all(dialog);  
183 -  
184 - g_signal_connect(dialog,"close",G_CALLBACK(gtk_widget_destroy),NULL);  
185 - g_signal_connect(dialog,"response",G_CALLBACK(gtk_widget_destroy),NULL);  
186 -  
187 - g_error_free(error);  
188 - g_key_file_free(new_session->key_file);  
189 - g_free(new_session);  
190 -  
191 - } else {  
192 -  
193 - new_session->changed = FALSE;  
194 - g_object_set_data_full(G_OBJECT(terminal),"session-descriptor",new_session,(GDestroyNotify) close_settings);  
195 -  
196 - }  
197 - 76 + v3270_print_operation_load_key_file(operation,v3270_key_file_get(widget));
198 77
199 } 78 }
200 79
201 - GKeyFile * v3270_get_session_keyfile(GtkWidget *widget) { 80 + static GtkResponseType load_popup_response(GtkWidget *widget, const gchar *popup_name, gpointer G_GNUC_UNUSED(dunno)) {
202 81
203 - g_return_val_if_fail(GTK_IS_V3270(widget),NULL);  
204 -  
205 - const struct SessionDescriptor * descriptor = (const struct SessionDescriptor *) g_object_get_data(G_OBJECT(widget),"session-descriptor");  
206 -  
207 - if(descriptor)  
208 - return descriptor->key_file;  
209 -  
210 - return NULL;  
211 - } 82 + GKeyFile * key_file = v3270_key_file_get(widget);
212 83
213 - static GtkResponseType load_popup_response(v3270 G_GNUC_UNUSED(*widget), const gchar *popup_name, struct SessionDescriptor * session) {  
214 -  
215 - if(session->key_file && g_key_file_has_key(session->key_file,"dialogs",popup_name,NULL))  
216 - return (GtkResponseType) g_key_file_get_integer(session->key_file,"dialogs",popup_name,NULL); 84 + if(key_file && g_key_file_has_key(key_file,"dialogs",popup_name,NULL))
  85 + return (GtkResponseType) g_key_file_get_integer(key_file,"dialogs",popup_name,NULL);
217 86
218 #ifdef _WIN32 87 #ifdef _WIN32
219 - {  
220 - // Windows - Check predefined responses on system registry.  
221 - lib3270_auto_cleanup(HKEY) hKey; 88 + {
  89 + // Windows - Check predefined responses on system registry.
  90 + lib3270_auto_cleanup(HKEY) hKey;
222 91
223 - if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,G_STRINGIFY(PRODUCT_NAME)"\dialogs",0,KEY_READ,&hKey) == ERROR_SUCCESS) { 92 + if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,G_STRINGIFY(PRODUCT_NAME)"\dialogs",0,KEY_READ,&hKey) == ERROR_SUCCESS) {
224 93
225 - DWORD val = 0;  
226 - DWORD cbData = sizeof(DWORD);  
227 -  
228 - if(RegQueryValueEx(hKey, popup_name, NULL, NULL, (LPBYTE) &val, &cbData) == ERROR_SUCCESS) {  
229 - return (GtkResponseType) val;  
230 - } 94 + DWORD val = 0;
  95 + DWORD cbData = sizeof(DWORD);
231 96
  97 + if(RegQueryValueEx(hKey, popup_name, NULL, NULL, (LPBYTE) &val, &cbData) == ERROR_SUCCESS) {
  98 + return (GtkResponseType) val;
232 } 99 }
  100 +
233 } 101 }
  102 + }
234 #endif // _WIN32 103 #endif // _WIN32
235 104
236 - return session->key_file ? GTK_RESPONSE_NONE : 0; 105 + return key_file ? GTK_RESPONSE_NONE : 0;
237 } 106 }
238 107
239 - static gboolean save_popup_response(GtkWidget *widget, const gchar *popup_name, GtkResponseType response, struct SessionDescriptor * session) {  
240 - debug("%s(%s)",__FUNCTION__,popup_name); 108 + static gboolean save_popup_response(GtkWidget *widget, const gchar *popup_name, GtkResponseType response, gpointer G_GNUC_UNUSED(dunno)) {
  109 +
  110 + GKeyFile * key_file = v3270_key_file_get(widget);
241 111
242 - if(!session->key_file)  
243 - return FALSE; 112 + debug("%s(%s)",__FUNCTION__,popup_name);
244 113
245 - g_key_file_set_integer(session->key_file,"dialogs",popup_name,(gint) response);  
246 - v3270_emit_save_settings(widget,NULL); 114 + if(!key_file)
  115 + return FALSE;
247 116
248 - return TRUE; 117 + g_key_file_set_integer(key_file,"dialogs",popup_name,(gint) response);
  118 + v3270_emit_save_settings(widget,NULL);
  119 +
  120 + return TRUE;
249 } 121 }
250 122
251 GtkWidget * pw3270_terminal_new(const gchar *session_file) { 123 GtkWidget * pw3270_terminal_new(const gchar *session_file) {
252 124
253 - GtkWidget * terminal = v3270_new(); 125 + GtkWidget * terminal = v3270_new();
  126 + GError * error = NULL;
254 127
255 gtk_widget_show_all(terminal); 128 gtk_widget_show_all(terminal);
256 129
257 - struct SessionDescriptor * descriptor = NULL;  
258 -  
259 if(session_file) { 130 if(session_file) {
260 131
261 // Use the supplied session file 132 // Use the supplied session file
262 - descriptor = g_malloc0(sizeof(struct SessionDescriptor) + strlen(session_file));  
263 - strcpy(descriptor->filename,session_file); 133 + v3270_key_file_open(terminal,session_file,&error);
264 134
265 } else { 135 } else {
266 136
@@ -273,93 +143,41 @@ @@ -273,93 +143,41 @@
273 g_rename(compatible,filename); 143 g_rename(compatible,filename);
274 } 144 }
275 145
276 - descriptor = g_malloc0(sizeof(struct SessionDescriptor) + strlen(filename));  
277 - strcpy(descriptor->filename,filename); 146 + v3270_key_file_open(terminal,filename,&error);
278 147
279 } 148 }
280 149
281 - // Setup session file;  
282 - GError *error = NULL;  
283 - g_object_set_data_full(G_OBJECT(terminal),"session-descriptor",descriptor,(GDestroyNotify) close_settings);  
284 -  
285 - descriptor->key_file = g_key_file_new(); 150 + // Setup signals.
  151 + g_signal_connect(G_OBJECT(terminal),"save-settings",G_CALLBACK(save_settings),NULL);
  152 + g_signal_connect(G_OBJECT(terminal),"toggle_changed",G_CALLBACK(toggle_changed),NULL);
  153 + g_signal_connect(G_OBJECT(terminal),"print-done",G_CALLBACK(print_done),NULL);
  154 + g_signal_connect(G_OBJECT(terminal),"print-setup",G_CALLBACK(print_setup),NULL);
  155 + g_signal_connect(G_OBJECT(terminal),"destroy", G_CALLBACK(destroy),NULL);
  156 + g_signal_connect(G_OBJECT(terminal),"load-popup-response",G_CALLBACK(load_popup_response),NULL);
  157 + g_signal_connect(G_OBJECT(terminal),"save-popup-response",G_CALLBACK(save_popup_response),NULL);
286 158
287 - if(g_file_test(descriptor->filename,G_FILE_TEST_IS_REGULAR)) { 159 + if(error) {
288 160
289 - // Found session file, open it.  
290 - if(!g_key_file_load_from_file(descriptor->key_file,descriptor->filename,G_KEY_FILE_NONE,&error)) {  
291 - g_warning("Can't load \"%s\"",descriptor->filename);  
292 - } else {  
293 - g_message("Loading session properties from %s",descriptor->filename);  
294 - } 161 + GtkWidget * dialog = gtk_message_dialog_new_with_markup(
  162 + GTK_WINDOW(gtk_widget_get_toplevel(terminal)),
  163 + GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
  164 + GTK_MESSAGE_ERROR,
  165 + GTK_BUTTONS_CANCEL,
  166 + _("Can't use \"%s\""),session_file
  167 + );
295 168
296 - } else { 169 + gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),"%s",error->message);
297 170
298 - // No session file, load the defaults (if available).  
299 - lib3270_autoptr(char) default_settings = lib3270_build_data_filename("defaults.conf",NULL);  
300 - if(g_file_test(default_settings,G_FILE_TEST_IS_REGULAR)) {  
301 - if(!g_key_file_load_from_file(descriptor->key_file,default_settings,G_KEY_FILE_NONE,&error)) {  
302 - g_warning("Can't load \"%s\"",default_settings);  
303 - } else {  
304 - g_message("Loading session properties from %s",default_settings);  
305 - }  
306 - } else {  
307 -#ifdef DEBUG  
308 - g_message("Can't find default settings file \"%s\"",default_settings);  
309 -#else  
310 - g_warning("Can't find default settings file \"%s\"",default_settings);  
311 -#endif // DEBUG  
312 - } 171 + gtk_window_set_title(GTK_WINDOW(dialog),_("Can't load session file"));
313 172
314 - } 173 + gtk_widget_show_all(dialog);
315 174
316 - if(error) { 175 + g_signal_connect(dialog,"close",G_CALLBACK(gtk_widget_destroy),NULL);
  176 + g_signal_connect(dialog,"response",G_CALLBACK(gtk_widget_destroy),NULL);
317 177
318 - g_warning(error->message);  
319 g_error_free(error); 178 g_error_free(error);
320 - error = NULL;  
321 -  
322 - } else {  
323 -  
324 - // Got key file, load it.  
325 - v3270_load_key_file(terminal,descriptor->key_file,NULL);  
326 - v3270_accelerator_map_load_key_file(terminal,descriptor->key_file,NULL);  
327 -  
328 - if(g_key_file_has_group(descriptor->key_file,"environment")) {  
329 -  
330 - // Has environment group, set values.  
331 - gchar **keys = g_key_file_get_keys(descriptor->key_file,"environment",NULL,NULL);  
332 -  
333 - if(keys) {  
334 - size_t ix;  
335 - for(ix=0;keys[ix];ix++) {  
336 - g_autofree gchar * value = g_key_file_get_string(descriptor->key_file,"environment",keys[ix],NULL);  
337 - if(value) {  
338 -#ifdef _WIN32  
339 - g_autofree gchar * env = g_strconcat(keys[ix],"=",value,NULL);  
340 - putenv(env);  
341 -#else  
342 - if(setenv(keys[ix],value,1)) {  
343 - g_warning("Can't set \"%s\" to \"%s\"",keys[ix],value);  
344 - }  
345 -#endif // _WIN32  
346 - }  
347 - }  
348 -  
349 - g_strfreev(keys);  
350 - }  
351 - }  
352 } 179 }
353 180
354 - // Setup signals.  
355 - g_signal_connect(G_OBJECT(terminal),"save-settings",G_CALLBACK(save_settings),descriptor);  
356 - g_signal_connect(G_OBJECT(terminal),"toggle_changed",G_CALLBACK(toggle_changed),descriptor);  
357 - g_signal_connect(G_OBJECT(terminal),"print-done",G_CALLBACK(print_done),descriptor);  
358 - g_signal_connect(G_OBJECT(terminal),"print-setup",G_CALLBACK(print_setup),descriptor);  
359 - g_signal_connect(G_OBJECT(terminal),"destroy", G_CALLBACK(destroy),descriptor);  
360 - g_signal_connect(G_OBJECT(terminal),"load-popup-response",G_CALLBACK(load_popup_response),descriptor);  
361 - g_signal_connect(G_OBJECT(terminal),"save-popup-response",G_CALLBACK(save_popup_response),descriptor);  
362 -  
363 return terminal; 181 return terminal;
364 } 182 }
365 183
@@ -375,30 +193,4 @@ @@ -375,30 +193,4 @@
375 193
376 } 194 }
377 195
378 - gboolean v3270_allow_custom_settings(GtkWidget *widget) {  
379 -  
380 -#if defined(DEBUG)  
381 -  
382 - return TRUE;  
383 -  
384 -#else  
385 -  
386 - const struct SessionDescriptor * descriptor = (const struct SessionDescriptor *) g_object_get_data(G_OBJECT(widget),"session-descriptor");  
387 -  
388 - if(!(descriptor && *descriptor->filename))  
389 - return FALSE;  
390 -  
391 - if(g_access(descriptor->filename,W_OK))  
392 - return FALSE;  
393 -  
394 -#ifdef _WIN32  
395 - return TRUE;  
396 -#else  
397 - return !g_str_has_prefix(descriptor->filename,g_get_user_config_dir());  
398 -#endif // _WIN32  
399 -  
400 -#endif // DEBUG  
401 -  
402 - }  
403 -  
404 196
src/objects/window/window.c
@@ -34,6 +34,7 @@ @@ -34,6 +34,7 @@
34 #include <pw3270/actions.h> 34 #include <pw3270/actions.h>
35 #include <pw3270/keypad.h> 35 #include <pw3270/keypad.h>
36 #include <v3270/settings.h> 36 #include <v3270/settings.h>
  37 + #include <v3270/keyfile.h>
37 38
38 static void get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); 39 static void get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
39 static void set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); 40 static void set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
@@ -191,8 +192,8 @@ @@ -191,8 +192,8 @@
191 if(!terminal) 192 if(!terminal)
192 return; 193 return;
193 194
194 - GKeyFile * keyfile = v3270_get_session_keyfile(terminal);  
195 - if(!terminal) 195 + GKeyFile * keyfile = v3270_key_file_get(terminal);
  196 + if(!keyfile)
196 return; 197 return;
197 198
198 g_key_file_set_boolean( 199 g_key_file_set_boolean(
@@ -704,7 +705,7 @@ @@ -704,7 +705,7 @@
704 // Setup keypads 705 // Setup keypads
705 if(window->keypads) { 706 if(window->keypads) {
706 707
707 - GKeyFile * keyfile = v3270_get_session_keyfile(terminal); 708 + GKeyFile * keyfile = v3270_key_file_get(terminal);
708 709
709 if(keyfile) { 710 if(keyfile) {
710 711
src/objects/windows/savedesktopicon.c
@@ -256,10 +256,10 @@ @@ -256,10 +256,10 @@
256 GtkWidget ** inputs = g_object_get_data(G_OBJECT(dialog),"inputs"); 256 GtkWidget ** inputs = g_object_get_data(G_OBJECT(dialog),"inputs");
257 257
258 HRESULT hRes = CreateShortCut( 258 HRESULT hRes = CreateShortCut(
259 - NULL, // LPSTR pszTargetfile,  
260 - v3270_get_session_filename(terminal), // LPSTR pszTargetargs,  
261 - gtk_entry_get_text(GTK_ENTRY(inputs[0])), // LPSTR pszLinkfile,  
262 - gtk_entry_get_text(GTK_ENTRY(inputs[1])), //LPSTR pszDescription, 259 + NULL, // LPSTR pszTargetfile,
  260 + v3270_key_file_get_file_name(terminal), // LPSTR pszTargetargs,
  261 + gtk_entry_get_text(GTK_ENTRY(inputs[0])), // LPSTR pszLinkfile,
  262 + gtk_entry_get_text(GTK_ENTRY(inputs[1])), //LPSTR pszDescription,
263 0, 263 0,
264 NULL, 264 NULL,
265 NULL, 265 NULL,