Commit a85935378c2e507a0fb38cc94dda4f81d50cf597

Authored by Perry Werneck
Committed by GitHub
2 parents f503b3ee 4be428c2

Merge pull request #14 from PerryWerneck/develop

Small fixes and optional lockdown of host settings.
branding/appdata.xml.in
1 1 <?xml version="1.0" encoding="UTF-8"?>
2   -<component type="desktop">
3   - <id>br.com.bb.pw3270</id>
4   - <name>3270 Terminal</name>
5   - <name xml:lang="pt_BR">Terminal 3270</name>
  2 +<application>
  3 +
  4 + <id type="desktop">@PRODUCT_NAME@.desktop</id>
  5 +
  6 + <metadata_license>CC0-1.0</metadata_license>
  7 + <project_license>LGPL-3.0</project_license>
  8 +
6 9 <summary>IBM 3270 Terminal emulator</summary>
7 10 <summary xml:lang="pt_BR">Emulador de terminal IBM 3270</summary>
  11 +
8 12 <developer_name>perry.werneck@gmail.com</developer_name>
9   - <description>
10   - <p>
11   - GTK Based 3270 terminal emulator
12   - pw3270 is a modern, GTK-based, completely free tn3270 emulator.
13 13  
14   - Created originally for Banco do Brasil, it's now an official Brazilian Government Public Software project, and is used worldwide.
15   - </p>
  14 + <description>
  15 + <p>GTK Based 3270 terminal emulator</p>
  16 + <p>pw3270 is a modern, GTK-based, completely free tn3270 emulator.</p>
  17 + <p>Created originally for Banco do Brasil, it's now an official Brazilian Government Public Software project, and is used worldwide.</p>
16 18 </description>
17 19  
18   - <metadata_license>CC0-1.0</metadata_license>
19   - <project_license>LGPL-3.0</project_license>
20   -
21 20 <url type="bugtracker">https://github.com/PerryWerneck/pw3270/issues</url>
22 21 <url type="homepage">https://github.com/PerryWerneck/pw3270</url>
23   - <project_group>GNOME</project_group>
24   -
25   - <launchable type="desktop-id">@PRODUCT_NAME@.desktop</launchable>
26 22  
27 23 <screenshots>
28 24 <screenshot type="default">
29 25 <caption>@PRODUCT_NAME@</caption>
30   - <image height="600" width="600">https://raw.githubusercontent.com/PerryWerneck/pw3270/master/branding/pw3270-logo.svg</image>
  26 + <image height="600" width="600">https://raw.githubusercontent.com/PerryWerneck/pw3270/master/branding/pw3270.svg</image>
31 27 </screenshot>
32 28 </screenshots>
33 29  
34 30 <update_contact>perry.werneck@gmail.com</update_contact>
35 31  
36 32 <provides>
37   - <id>@PRODUCT_NAME@pw32.desktop</id>
  33 + <binary>@PRODUCT_NAME@</binary>
38 34 </provides>
39   -</component>
  35 +
  36 +
  37 +</application>
... ...
branding/launcher.desktop.in
1 1 [Desktop Entry]
2 2 X-SuSE-translate=true
3 3 GenericName=@PRODUCT_NAME@
  4 +GenericName[pt_BR]=@PRODUCT_NAME@
4 5 Name=3270 Terminal
5 6 Name[pt_BR]=Terminal 3270
6 7 Comment=IBM 3270 Terminal emulator
... ...
configure.ac
... ... @@ -32,7 +32,7 @@ AC_PREREQ(2.61)
32 32  
33 33 dnl Initialise automake with the package name, version and
34 34 dnl bug-reporting address.
35   -AC_INIT([pw3270], [5.3], [perry.werneck@gmail.com])
  35 +AC_INIT([pw3270], [5.4], [perry.werneck@gmail.com])
36 36  
37 37 dnl Place auxilliary scripts here.
38 38 AC_CONFIG_AUX_DIR([scripts])
... ...
locale/pt_BR.po
... ... @@ -5,7 +5,7 @@ msgid &quot;&quot;
5 5 msgstr ""
6 6 "Project-Id-Version: pw3270 5.0\n"
7 7 "Report-Msgid-Bugs-To: \n"
8   -"POT-Creation-Date: 2020-10-29 19:50-0300\n"
  8 +"POT-Creation-Date: 2020-11-03 15:48-0300\n"
9 9 "PO-Revision-Date: 2020-10-15 13:45-0300\n"
10 10 "Last-Translator: Perry Werneck <perry.werneck@gmail.com>\n"
11 11 "Language-Team: Português <>\n"
... ... @@ -25,11 +25,11 @@ msgstr &quot;&quot;
25 25 msgid "\"%s\" is not a valid user interface name"
26 26 msgstr "\"%s\" não é um nome válido para interface de usuário"
27 27  
28   -#: src/objects/application/actions/about.c:93
  28 +#: src/objects/application/actions/about.c:136
29 29 msgid "32 bits Linux"
30 30 msgstr "Linux 32 bits"
31 31  
32   -#: src/objects/application/actions/about.c:91
  32 +#: src/objects/application/actions/about.c:134
33 33 msgid "32 bits Windows"
34 34 msgstr "Windows 32 bits"
35 35  
... ... @@ -37,20 +37,20 @@ msgstr &quot;Windows 32 bits&quot;
37 37 msgid "3270 session files"
38 38 msgstr "Arquivos de sessão TN3270"
39 39  
40   -#: src/objects/application/actions/about.c:87
  40 +#: src/objects/application/actions/about.c:130
41 41 #, c-format
42 42 msgid "3270 terminal emulator for %s."
43 43 msgstr "Emulador 3270 para %s"
44 44  
45   -#: src/objects/application/actions/about.c:95
  45 +#: src/objects/application/actions/about.c:138
46 46 msgid "64 bits Linux"
47 47 msgstr "Linux 64 bits"
48 48  
49   -#: src/objects/application/actions/about.c:89
  49 +#: src/objects/application/actions/about.c:132
50 50 msgid "64 bits Windows"
51 51 msgstr "Windows 64 bits"
52 52  
53   -#: src/objects/application/actions/about.c:188 ui/application.xml:39
  53 +#: src/objects/application/actions/about.c:231 ui/application.xml:39
54 54 #: ui/application.xml:537
55 55 msgid "About PW3270"
56 56 msgstr "Sobre o PW3270"
... ... @@ -75,7 +75,7 @@ msgstr &quot;Todos os arquivos&quot;
75 75 msgid "Append to copy"
76 76 msgstr "Adicionar à cópia"
77 77  
78   -#: src/objects/application/actions/about.c:129
  78 +#: src/objects/application/actions/about.c:172
79 79 msgid "Apple version"
80 80 msgstr "Versão Apple"
81 81  
... ... @@ -103,7 +103,7 @@ msgstr &quot;Reconectar automaticamente&quot;
103 103 msgid "Available"
104 104 msgstr "Disponível"
105 105  
106   -#: src/objects/application/actions/about.c:132
  106 +#: src/objects/application/actions/about.c:175
107 107 msgid "Based on X3270 from"
108 108 msgstr "Baseado no X3270 por"
109 109  
... ... @@ -194,7 +194,7 @@ msgstr &quot;Conectar ao servidor&quot;
194 194 msgid "Connected to host"
195 195 msgstr "Conectado no servidor"
196 196  
197   -#: src/objects/application/actions/about.c:130
  197 +#: src/objects/application/actions/about.c:173
198 198 msgid "Contributors"
199 199 msgstr "Contribuidores"
200 200  
... ... @@ -407,7 +407,7 @@ msgstr &quot;Largura do painel em colunas&quot;
407 407 msgid "Keypads"
408 408 msgstr "Painéis"
409 409  
410   -#: src/objects/application/actions/about.c:140
  410 +#: src/objects/application/actions/about.c:183
411 411 msgid "LICENSE"
412 412 msgstr "LICENCA"
413 413  
... ... @@ -439,7 +439,7 @@ msgstr &quot;Barra de ferramentas&quot;
439 439 msgid "Main menu"
440 440 msgstr "Menu principal"
441 441  
442   -#: src/objects/application/actions/about.c:128
  442 +#: src/objects/application/actions/about.c:171
443 443 msgid "Maintainers"
444 444 msgstr "Mantenedores"
445 445  
... ... @@ -923,7 +923,7 @@ msgstr &quot;Remover seleção&quot;
923 923 msgid "Use +/- for field navigation"
924 924 msgstr "Usar teclas +/- para navegar por campos"
925 925  
926   -#: src/objects/application/actions/about.c:70
  926 +#: src/objects/application/actions/about.c:113
927 927 #, c-format
928 928 msgid "Version %s-%s"
929 929 msgstr "Versão %s-%s"
... ... @@ -933,7 +933,7 @@ msgstr &quot;Versão %s-%s&quot;
933 933 msgid "View"
934 934 msgstr "Exibir"
935 935  
936   -#: src/objects/application/actions/about.c:163
  936 +#: src/objects/application/actions/about.c:206
937 937 msgid "View this project on github"
938 938 msgstr "Portal do Software Público Brasileiro"
939 939  
... ... @@ -998,11 +998,11 @@ msgstr &quot;_Salvar&quot;
998 998 msgid "_View"
999 999 msgstr "_Exibir"
1000 1000  
1001   -#: src/objects/application/actions/about.c:162
  1001 +#: src/objects/application/actions/about.c:205
1002 1002 msgid "https://github.com/PerryWerneck/pw3270"
1003 1003 msgstr "https://portal.softwarepublico.gov.br/social/pw3270/"
1004 1004  
1005   -#: src/objects/application/actions/about.c:165
  1005 +#: src/objects/application/actions/about.c:208
1006 1006 msgid "translator-credits"
1007 1007 msgstr "translator-credits"
1008 1008  
... ...
locale/pw3270.pot
... ... @@ -8,7 +8,7 @@ msgid &quot;&quot;
8 8 msgstr ""
9 9 "Project-Id-Version: PACKAGE VERSION\n"
10 10 "Report-Msgid-Bugs-To: \n"
11   -"POT-Creation-Date: 2020-10-29 19:50-0300\n"
  11 +"POT-Creation-Date: 2020-11-03 15:50-0300\n"
12 12 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13 13 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14 14 "Language-Team: LANGUAGE <LL@li.org>\n"
... ... @@ -22,11 +22,11 @@ msgstr &quot;&quot;
22 22 msgid "\"%s\" is not a valid user interface name"
23 23 msgstr ""
24 24  
25   -#: src/objects/application/actions/about.c:93
  25 +#: src/objects/application/actions/about.c:136
26 26 msgid "32 bits Linux"
27 27 msgstr ""
28 28  
29   -#: src/objects/application/actions/about.c:91
  29 +#: src/objects/application/actions/about.c:134
30 30 msgid "32 bits Windows"
31 31 msgstr ""
32 32  
... ... @@ -34,20 +34,20 @@ msgstr &quot;&quot;
34 34 msgid "3270 session files"
35 35 msgstr ""
36 36  
37   -#: src/objects/application/actions/about.c:87
  37 +#: src/objects/application/actions/about.c:130
38 38 #, c-format
39 39 msgid "3270 terminal emulator for %s."
40 40 msgstr ""
41 41  
42   -#: src/objects/application/actions/about.c:95
  42 +#: src/objects/application/actions/about.c:138
43 43 msgid "64 bits Linux"
44 44 msgstr ""
45 45  
46   -#: src/objects/application/actions/about.c:89
  46 +#: src/objects/application/actions/about.c:132
47 47 msgid "64 bits Windows"
48 48 msgstr ""
49 49  
50   -#: src/objects/application/actions/about.c:188 ui/application.xml:39
  50 +#: src/objects/application/actions/about.c:231 ui/application.xml:39
51 51 #: ui/application.xml:537
52 52 msgid "About PW3270"
53 53 msgstr ""
... ... @@ -72,7 +72,7 @@ msgstr &quot;&quot;
72 72 msgid "Append to copy"
73 73 msgstr ""
74 74  
75   -#: src/objects/application/actions/about.c:129
  75 +#: src/objects/application/actions/about.c:172
76 76 msgid "Apple version"
77 77 msgstr ""
78 78  
... ... @@ -100,7 +100,7 @@ msgstr &quot;&quot;
100 100 msgid "Available"
101 101 msgstr ""
102 102  
103   -#: src/objects/application/actions/about.c:132
  103 +#: src/objects/application/actions/about.c:175
104 104 msgid "Based on X3270 from"
105 105 msgstr ""
106 106  
... ... @@ -191,7 +191,7 @@ msgstr &quot;&quot;
191 191 msgid "Connected to host"
192 192 msgstr ""
193 193  
194   -#: src/objects/application/actions/about.c:130
  194 +#: src/objects/application/actions/about.c:173
195 195 msgid "Contributors"
196 196 msgstr ""
197 197  
... ... @@ -404,7 +404,7 @@ msgstr &quot;&quot;
404 404 msgid "Keypads"
405 405 msgstr ""
406 406  
407   -#: src/objects/application/actions/about.c:140
  407 +#: src/objects/application/actions/about.c:183
408 408 msgid "LICENSE"
409 409 msgstr ""
410 410  
... ... @@ -436,7 +436,7 @@ msgstr &quot;&quot;
436 436 msgid "Main menu"
437 437 msgstr ""
438 438  
439   -#: src/objects/application/actions/about.c:128
  439 +#: src/objects/application/actions/about.c:171
440 440 msgid "Maintainers"
441 441 msgstr ""
442 442  
... ... @@ -918,7 +918,7 @@ msgstr &quot;&quot;
918 918 msgid "Use +/- for field navigation"
919 919 msgstr ""
920 920  
921   -#: src/objects/application/actions/about.c:70
  921 +#: src/objects/application/actions/about.c:113
922 922 #, c-format
923 923 msgid "Version %s-%s"
924 924 msgstr ""
... ... @@ -928,7 +928,7 @@ msgstr &quot;&quot;
928 928 msgid "View"
929 929 msgstr ""
930 930  
931   -#: src/objects/application/actions/about.c:163
  931 +#: src/objects/application/actions/about.c:206
932 932 msgid "View this project on github"
933 933 msgstr ""
934 934  
... ... @@ -993,10 +993,10 @@ msgstr &quot;&quot;
993 993 msgid "_View"
994 994 msgstr ""
995 995  
996   -#: src/objects/application/actions/about.c:162
  996 +#: src/objects/application/actions/about.c:205
997 997 msgid "https://github.com/PerryWerneck/pw3270"
998 998 msgstr ""
999 999  
1000   -#: src/objects/application/actions/about.c:165
  1000 +#: src/objects/application/actions/about.c:208
1001 1001 msgid "translator-credits"
1002 1002 msgstr ""
... ...
pw3270.cbp
... ... @@ -199,9 +199,6 @@
199 199 <Unit filename="src/objects/window/window.c">
200 200 <Option compilerVar="CC" />
201 201 </Unit>
202   - <Unit filename="src/tools/entry.c">
203   - <Option compilerVar="CC" />
204   - </Unit>
205 202 <Unit filename="ui/application.xml" />
206 203 <Unit filename="ui/window.xml" />
207 204 <Extensions>
... ...
rpm/_service
... ... @@ -13,7 +13,6 @@
13 13 </service>
14 14  
15 15 <!-- https://github.com/openSUSE/obs-service-extract_file -->
16   - <!--
17 16 <service name="extract_file">
18 17 <param name="archive">*.tar</param>
19 18 <param name="files">*/rpm/pw3270.spec</param>
... ... @@ -59,7 +58,6 @@
59 58 <param name="files">*/arch/PKGBUILD</param>
60 59 <param name="outfilename">PKGBUILD</param>
61 60 </service>
62   - -->
63 61  
64 62 <service name="recompress">
65 63 <param name="file">*.tar</param>
... ... @@ -68,4 +66,4 @@
68 66  
69 67 <service name="set_version" />
70 68  
71   -</services>
72 69 \ No newline at end of file
  70 +</services>
... ...
schemas/linux/application.gschema.xml.in
... ... @@ -38,6 +38,24 @@
38 38 <description>The ID of the current user interface style</description>
39 39 </key>
40 40  
  41 + <key name="allow-host-settings" type="b">
  42 + <default>true</default>
  43 + <summary>Allow host settings</summary>
  44 + <description>Allow changing of host session properties</description>
  45 + </key>
  46 +
  47 + <key name="allow-new-tab-actions" type="b">
  48 + <default>true</default>
  49 + <summary>Enable new tab actions</summary>
  50 + <description>Enable new tab actions</description>
  51 + </key>
  52 +
  53 + <key name="allow-new-window-actions" type="b">
  54 + <default>true</default>
  55 + <summary>Enable new window actions</summary>
  56 + <description>Enable new window actions</description>
  57 + </key>
  58 +
41 59 </schema>
42 60  
43 61 </schemalist>
... ...
schemas/windows/application.gschema.xml.in
... ... @@ -38,6 +38,12 @@
38 38 <description>The ID of the current user interface style</description>
39 39 </key>
40 40  
  41 + <key name="allow-host-settings" type="b">
  42 + <default>true</default>
  43 + <summary>Allow host settings</summary>
  44 + <description>Allow changing of host session properties</description>
  45 + </key>
  46 +
41 47 <key name="gtk-csd" type="i">
42 48 <default>0</default>
43 49 <summary>GTK CSD</summary>
... ...
src/objects/application/actions/about.c
... ... @@ -31,10 +31,18 @@
31 31 #include <pw3270/actions.h>
32 32 #include <pw3270/application.h>
33 33  
34   - static GtkWidget * factory(PW3270Action G_GNUC_UNUSED(*action), GtkApplication G_GNUC_UNUSED(*application)) {
  34 + static GtkWidget * factory(PW3270Action G_GNUC_UNUSED(*action), GtkApplication *application) {
35 35  
36 36 GtkAboutDialog * dialog = GTK_ABOUT_DIALOG(gtk_about_dialog_new());
37 37  
  38 + if(GTK_IS_APPLICATION(application)) {
  39 +
  40 + gtk_window_set_transient_for(GTK_WINDOW(dialog),gtk_application_get_active_window(GTK_APPLICATION(application)));
  41 + gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog),TRUE);
  42 + gtk_window_set_modal(GTK_WINDOW(dialog),TRUE);
  43 +
  44 + }
  45 +
38 46 // Get application logo
39 47 {
40 48 #ifdef DEBUG
... ...
src/objects/application/application.c
... ... @@ -352,14 +352,15 @@
352 352  
353 353 G_APPLICATION_CLASS(pw3270Application_parent_class)->startup(application);
354 354  
  355 + g_autoptr(GSettings) settings = pw3270_application_get_settings(application);
  356 +
  357 + //
  358 + // Common actions
  359 + //
355 360 GAction * actions[] = {
356 361 pw3270_about_action_new(),
357 362 pw3270_preferences_action_new(),
358   - pw3270_new_tab_action_new(),
359   - pw3270_new_window_action_new(),
360   - pw3270_quit_action_new(),
361   - pw3270_open_window_action_new(),
362   - pw3270_open_tab_action_new()
  363 + pw3270_quit_action_new()
363 364 };
364 365  
365 366 for(ix = 0; ix < G_N_ELEMENTS(actions); ix++) {
... ... @@ -367,6 +368,38 @@
367 368 }
368 369  
369 370 //
  371 + // New tab actions
  372 + //
  373 + if(g_settings_get_boolean(settings,"allow-new-tab-actions")) {
  374 +
  375 + GAction * new_tab_actions[] = {
  376 + pw3270_open_tab_action_new(),
  377 + pw3270_new_tab_action_new()
  378 + };
  379 +
  380 + for(ix = 0; ix < G_N_ELEMENTS(new_tab_actions); ix++) {
  381 + g_action_map_add_action(G_ACTION_MAP(application),new_tab_actions[ix]);
  382 + }
  383 +
  384 + }
  385 +
  386 + //
  387 + // New window actions
  388 + //
  389 + if(g_settings_get_boolean(settings,"allow-new-window-actions")) {
  390 +
  391 + GAction * new_window_actions[] = {
  392 + pw3270_open_window_action_new(),
  393 + pw3270_new_window_action_new()
  394 + };
  395 +
  396 + for(ix = 0; ix < G_N_ELEMENTS(new_window_actions); ix++) {
  397 + g_action_map_add_action(G_ACTION_MAP(application),new_window_actions[ix]);
  398 + }
  399 +
  400 + }
  401 +
  402 + //
370 403 // Setup application menus
371 404 //
372 405 GtkBuilder * builder;
... ...
src/objects/toolbar/actions.c
... ... @@ -58,7 +58,7 @@
58 58  
59 59 GtkWidget * window = gtk_widget_get_toplevel(toolbar);
60 60  
61   - if(window) {
  61 + if(window && G_IS_ACTION_MAP(window)) {
62 62  
63 63 GtkToolItem * item = NULL;
64 64 GAction *action = g_action_map_lookup_action(G_ACTION_MAP(window), name);
... ... @@ -81,7 +81,7 @@
81 81 }
82 82 }
83 83  
84   - debug("%s(%s)=%p",__FUNCTION__,name,action);
  84 +// debug("%s(%s)=%p",__FUNCTION__,name,action);
85 85  
86 86 if(!action) {
87 87 g_warning("Can't find action \"%s\"",name);
... ...
src/objects/toolbar/models.c
... ... @@ -190,7 +190,7 @@
190 190 const struct _contents *model = (const struct _contents *) g_object_get_data(menuitem, I_("pw3270_model_data"));
191 191 const char *name = (const char *) g_object_get_data(menuitem, I_("pw3270_property_name"));
192 192  
193   - debug("%s(%s,%d)",__FUNCTION__,name,model->value);
  193 +// debug("%s(%s,%d)",__FUNCTION__,name,model->value);
194 194 g_object_set(widget,name,model->value,NULL);
195 195  
196 196 }
... ... @@ -210,7 +210,7 @@
210 210 const gchar * name = g_object_get_data(G_OBJECT(menu), I_("pw3270_property_name"));
211 211 g_object_get(widget,name,&value,NULL);
212 212  
213   - debug("%s(%p,%s)=%d",__FUNCTION__,widget,name,value);
  213 +// debug("%s(%p,%s)=%d",__FUNCTION__,widget,name,value);
214 214  
215 215 gtk_container_foreach(menu,(GtkCallback) set_toggle_menu_item,&value);
216 216  
... ...
src/objects/toolbar/toolbar.c
... ... @@ -363,6 +363,13 @@
363 363  
364 364 void pw3270_toolbar_set_actions(GtkWidget *toolbar, const gchar *action_names) {
365 365  
  366 + // The action search requires a toplevel window.
  367 + if(!gtk_widget_get_parent(toolbar)) {
  368 + g_warning("Can't set actions on an orphan toolbar");
  369 + return;
  370 + }
  371 +
  372 + // Split action names
366 373 size_t ix;
367 374 gint pos = 0;
368 375  
... ...
src/objects/window/actions/sessionproperties.c
... ... @@ -53,18 +53,23 @@
53 53  
54 54 size_t ix;
55 55  
  56 + g_autoptr(GSettings) settings = pw3270_application_get_settings(g_application_get_default());
  57 +
56 58 GtkWidget * dialog = v3270_settings_dialog_new();
57 59 gtk_window_set_title(GTK_WINDOW(dialog), action->label);
58 60  
59 61 // Add settings pages.
60 62 GtkWidget * elements[] = {
61   - v3270_host_settings_new(),
62 63 v3270_color_settings_new(),
63 64 v3270_font_settings_new(),
64 65 v3270_accelerator_settings_new(),
65 66 v3270_clipboard_settings_new()
66 67 };
67 68  
  69 + if(g_settings_get_boolean(settings,"allow-host-settings")) {
  70 + gtk_container_add(GTK_CONTAINER(dialog), v3270_host_settings_new());
  71 + }
  72 +
68 73 for(ix = 0; ix < G_N_ELEMENTS(elements); ix++) {
69 74 gtk_container_add(GTK_CONTAINER(dialog), elements[ix]);
70 75 }
... ...
src/objects/window/keyfile.c
... ... @@ -90,6 +90,7 @@
90 90  
91 91 strcpy(new_session->filename,filename);
92 92 new_session->key_file = g_key_file_new();
  93 + g_object_set_data_full(G_OBJECT(terminal),"session-descriptor",new_session,(GDestroyNotify) close_keyfile);
93 94  
94 95 // Load file
95 96 if(g_file_test(new_session->filename,G_FILE_TEST_IS_REGULAR)) {
... ... @@ -120,46 +121,40 @@
120 121 #endif // DEBUG
121 122 }
122 123  
123   - new_session->changed = TRUE;
124   -
125 124 }
126 125  
127   - g_object_set_data_full(G_OBJECT(terminal),"session-descriptor",new_session,(GDestroyNotify) close_keyfile);
128   - if(new_session->changed) {
129   - v3270_key_file_save(terminal,error);
  126 + if(*error) {
  127 + g_warning("Error '%s' loading keyfile", (*error)->message);
  128 + return new_session;
130 129 }
131 130  
132   - if(!*error) {
  131 + // Got key file, load it.
  132 + v3270_load_key_file(terminal,new_session->key_file,NULL);
  133 + v3270_accelerator_map_load_key_file(terminal,new_session->key_file,NULL);
133 134  
134   - // Got key file, load it.
135   - v3270_load_key_file(terminal,new_session->key_file,NULL);
136   - v3270_accelerator_map_load_key_file(terminal,new_session->key_file,NULL);
  135 + if(g_key_file_has_group(new_session->key_file,"environment")) {
137 136  
138   - if(g_key_file_has_group(new_session->key_file,"environment")) {
  137 + // Has environment group, set values.
  138 + gchar **keys = g_key_file_get_keys(new_session->key_file,"environment",NULL,NULL);
139 139  
140   - // Has environment group, set values.
141   - gchar **keys = g_key_file_get_keys(new_session->key_file,"environment",NULL,NULL);
142   -
143   - if(keys) {
144   - size_t ix;
145   - for(ix=0;keys[ix];ix++) {
146   - g_autofree gchar * value = g_key_file_get_string(new_session->key_file,"environment",keys[ix],NULL);
147   - if(value) {
  140 + if(keys) {
  141 + size_t ix;
  142 + for(ix=0;keys[ix];ix++) {
  143 + g_autofree gchar * value = g_key_file_get_string(new_session->key_file,"environment",keys[ix],NULL);
  144 + if(value) {
148 145 #ifdef _WIN32
149   - g_autofree gchar * env = g_strconcat(keys[ix],"=",value,NULL);
150   - putenv(env);
  146 + g_autofree gchar * env = g_strconcat(keys[ix],"=",value,NULL);
  147 + putenv(env);
151 148 #else
152   - if(setenv(keys[ix],value,1)) {
153   - g_warning("Can't set \"%s\" to \"%s\"",keys[ix],value);
154   - }
155   -#endif // _WIN32
  149 + if(setenv(keys[ix],value,1)) {
  150 + g_warning("Can't set \"%s\" to \"%s\"",keys[ix],value);
156 151 }
  152 +#endif // _WIN32
157 153 }
158   -
159   - g_strfreev(keys);
160 154 }
161   - }
162 155  
  156 + g_strfreev(keys);
  157 + }
163 158 }
164 159  
165 160 return new_session;
... ...