Commit 666e3234205dac81b7d2d655f85f995ec1a62ea1
1 parent
367599ab
Exists in
master
and in
4 other branches
Saving keypad states.
Showing
5 changed files
with
49 additions
and
2 deletions
Show diff stats
src/include/pw3270/window.h
src/main/placeholders.c
| ... | ... | @@ -110,7 +110,7 @@ |
| 110 | 110 | |
| 111 | 111 | placeholder = gtk_builder_get_object(builder, placeholders[ix]); |
| 112 | 112 | |
| 113 | - if(placeholder) { | |
| 113 | + if(placeholder && G_IS_MENU(placeholder)) { | |
| 114 | 114 | g_menu_append_item(G_MENU(placeholder), g_menu_item_new_submenu(_("Keypads"),G_MENU_MODEL(keypad_menu))); |
| 115 | 115 | } |
| 116 | 116 | ... | ... |
src/objects/window/private.h
src/objects/window/terminal.c
| ... | ... | @@ -82,6 +82,27 @@ |
| 82 | 82 | v3270_to_key_file(terminal,session->key_file,"terminal"); |
| 83 | 83 | v3270_accelerator_map_to_key_file(terminal, session->key_file, "accelerators"); |
| 84 | 84 | |
| 85 | + GtkWidget * window = gtk_widget_get_toplevel(terminal); | |
| 86 | + | |
| 87 | + if(PW3270_IS_APPLICATION_WINDOW(window) && pw3270_application_window_get_active_terminal(window) == terminal) { | |
| 88 | + | |
| 89 | + debug("%s on active terminal, saving window settings",__FUNCTION__); | |
| 90 | + GList * keypad = pw3270_application_window_get_keypads(window); | |
| 91 | + | |
| 92 | + while(keypad) { | |
| 93 | + | |
| 94 | + g_key_file_set_boolean( | |
| 95 | + session->key_file, | |
| 96 | + "keypads", | |
| 97 | + gtk_widget_get_name(GTK_WIDGET(keypad->data)), | |
| 98 | + gtk_widget_get_visible(GTK_WIDGET(keypad->data)) | |
| 99 | + ); | |
| 100 | + keypad = g_list_next(keypad); | |
| 101 | + | |
| 102 | + } | |
| 103 | + | |
| 104 | + } | |
| 105 | + | |
| 85 | 106 | g_key_file_save_to_file(session->key_file,session->filename,NULL); |
| 86 | 107 | |
| 87 | 108 | } | ... | ... |
src/objects/window/window.c
| ... | ... | @@ -70,6 +70,11 @@ |
| 70 | 70 | g_settings_set_boolean(settings, "is-fullscreen", window->state.is_fullscreen); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | + if(window->keypads) { | |
| 74 | + g_list_free(window->keypads); | |
| 75 | + window->keypads = NULL; | |
| 76 | + } | |
| 77 | + | |
| 73 | 78 | GTK_WIDGET_CLASS(pw3270ApplicationWindow_parent_class)->destroy(widget); |
| 74 | 79 | |
| 75 | 80 | } |
| ... | ... | @@ -191,10 +196,20 @@ |
| 191 | 196 | |
| 192 | 197 | GtkWidget * widget = pw3270_keypad_get_from_model(model); |
| 193 | 198 | |
| 199 | + if(!widget) { | |
| 200 | + return NULL; | |
| 201 | + } | |
| 202 | + | |
| 203 | + window->keypads = g_list_prepend(window->keypads,widget); | |
| 204 | + | |
| 205 | + const gchar * name = pw3270_keypad_model_get_name(model); | |
| 206 | + | |
| 207 | + gtk_widget_set_name(widget,name); | |
| 208 | + | |
| 194 | 209 | g_signal_connect(widget,"hide",G_CALLBACK(keypad_hide),model); |
| 195 | 210 | g_signal_connect(widget,"show",G_CALLBACK(keypad_show),model); |
| 196 | 211 | |
| 197 | - g_autofree gchar * action_name = g_strconcat("keypad.",pw3270_keypad_model_get_name(model),NULL); | |
| 212 | + g_autofree gchar * action_name = g_strconcat("keypad.",name,NULL); | |
| 198 | 213 | |
| 199 | 214 | GPropertyAction * action = |
| 200 | 215 | g_property_action_new( |
| ... | ... | @@ -751,3 +766,9 @@ |
| 751 | 766 | |
| 752 | 767 | } |
| 753 | 768 | |
| 769 | + GList * pw3270_application_window_get_keypads(GtkWidget *window) { | |
| 770 | + | |
| 771 | + g_return_val_if_fail(PW3270_IS_APPLICATION_WINDOW(window),NULL); | |
| 772 | + return PW3270_APPLICATION_WINDOW(window)->keypads; | |
| 773 | + | |
| 774 | + } | ... | ... |