Commit f8f7163da34db629b8c349747d9444c0f7bfd015
1 parent
ba062e90
Exists in
master
and in
4 other branches
Adding method to set environment variables from session settings file
(allow use of an alternative openssl config file).
Showing
2 changed files
with
26 additions
and
3 deletions
Show diff stats
src/objects/window/header.c
| @@ -50,12 +50,14 @@ | @@ -50,12 +50,14 @@ | ||
| 50 | g_autoptr(GtkBuilder) builder = pw3270_application_get_builder("window.xml"); | 50 | g_autoptr(GtkBuilder) builder = pw3270_application_get_builder("window.xml"); |
| 51 | 51 | ||
| 52 | if(!gtk_application_prefers_app_menu(GTK_APPLICATION(g_application_get_default()))) { | 52 | if(!gtk_application_prefers_app_menu(GTK_APPLICATION(g_application_get_default()))) { |
| 53 | + | ||
| 54 | + // No application menu, add view and help sections to open menu. | ||
| 55 | + | ||
| 53 | g_autoptr(GtkBuilder) app_builder = pw3270_application_get_builder("application.xml"); | 56 | g_autoptr(GtkBuilder) app_builder = pw3270_application_get_builder("application.xml"); |
| 54 | 57 | ||
| 55 | - g_menu_insert_submenu( | 58 | + g_menu_append_section( |
| 56 | G_MENU(gtk_builder_get_object(builder,"open-menu")), | 59 | G_MENU(gtk_builder_get_object(builder,"open-menu")), |
| 57 | - 0, | ||
| 58 | - _("Help"), | 60 | + NULL, |
| 59 | G_MENU_MODEL(gtk_builder_get_object(app_builder,"help-menu-placeholder")) | 61 | G_MENU_MODEL(gtk_builder_get_object(app_builder,"help-menu-placeholder")) |
| 60 | ); | 62 | ); |
| 61 | 63 |
src/objects/window/terminal.c
| @@ -34,6 +34,7 @@ | @@ -34,6 +34,7 @@ | ||
| 34 | #include <fcntl.h> | 34 | #include <fcntl.h> |
| 35 | #include <sys/types.h> | 35 | #include <sys/types.h> |
| 36 | #include <sys/stat.h> | 36 | #include <sys/stat.h> |
| 37 | + #include <stdlib.h> | ||
| 37 | 38 | ||
| 38 | #include <pw3270/actions.h> | 39 | #include <pw3270/actions.h> |
| 39 | #include <lib3270/toggle.h> | 40 | #include <lib3270/toggle.h> |
| @@ -261,9 +262,29 @@ | @@ -261,9 +262,29 @@ | ||
| 261 | 262 | ||
| 262 | } else { | 263 | } else { |
| 263 | 264 | ||
| 265 | + // Got key file, load it. | ||
| 264 | v3270_load_key_file(terminal,descriptor->key_file,NULL); | 266 | v3270_load_key_file(terminal,descriptor->key_file,NULL); |
| 265 | v3270_accelerator_map_load_key_file(terminal,descriptor->key_file,NULL); | 267 | v3270_accelerator_map_load_key_file(terminal,descriptor->key_file,NULL); |
| 266 | 268 | ||
| 269 | + if(g_key_file_has_group(descriptor->key_file,"environment")) { | ||
| 270 | + | ||
| 271 | + // Has environment group, set values. | ||
| 272 | + gchar **keys = g_key_file_get_keys(descriptor->key_file,"environment",NULL,NULL); | ||
| 273 | + | ||
| 274 | + if(keys) { | ||
| 275 | + size_t ix; | ||
| 276 | + for(ix=0;keys[ix];ix++) { | ||
| 277 | + g_autofree gchar * value = g_key_file_get_string(descriptor->key_file,"environment",keys[ix],NULL); | ||
| 278 | + if(value) { | ||
| 279 | + if(setenv(keys[ix],value,1)) { | ||
| 280 | + g_warning("Can't set \"%s\" to \"%s\"",keys[ix],value); | ||
| 281 | + } | ||
| 282 | + } | ||
| 283 | + } | ||
| 284 | + | ||
| 285 | + g_strfreev(keys); | ||
| 286 | + } | ||
| 287 | + } | ||
| 267 | } | 288 | } |
| 268 | 289 | ||
| 269 | // Setup signals. | 290 | // Setup signals. |