Commit 33cff6e713376fafb7d313086a013e24c413fd0f
1 parent
25d497e8
Exists in
master
and in
1 other branch
Working on load/save settings engine.
Showing
11 changed files
with
75 additions
and
67 deletions
Show diff stats
src/include/terminal.h
@@ -33,6 +33,7 @@ | @@ -33,6 +33,7 @@ | ||
33 | 33 | ||
34 | G_BEGIN_DECLS | 34 | G_BEGIN_DECLS |
35 | 35 | ||
36 | +/* | ||
36 | /// @brief V3270 Properties saved to the configuration file. | 37 | /// @brief V3270 Properties saved to the configuration file. |
37 | typedef enum | 38 | typedef enum |
38 | { | 39 | { |
@@ -56,6 +57,7 @@ G_BEGIN_DECLS | @@ -56,6 +57,7 @@ G_BEGIN_DECLS | ||
56 | } V3270_SETTING; | 57 | } V3270_SETTING; |
57 | 58 | ||
58 | G_GNUC_INTERNAL void v3270_notify_setting(GtkWidget *widget, V3270_SETTING id); | 59 | G_GNUC_INTERNAL void v3270_notify_setting(GtkWidget *widget, V3270_SETTING id); |
60 | +*/ | ||
59 | 61 | ||
60 | struct _v3270Class | 62 | struct _v3270Class |
61 | { | 63 | { |
@@ -69,7 +71,7 @@ G_BEGIN_DECLS | @@ -69,7 +71,7 @@ G_BEGIN_DECLS | ||
69 | GParamSpec * toggle[LIB3270_TOGGLE_COUNT]; // Toggle properties. | 71 | GParamSpec * toggle[LIB3270_TOGGLE_COUNT]; // Toggle properties. |
70 | 72 | ||
71 | // Properties saved to the configuration file. | 73 | // Properties saved to the configuration file. |
72 | - GParamSpec * settings[V3270_SETTING_COUNT]; | 74 | + const gchar **persistent; |
73 | 75 | ||
74 | // Signal related properties | 76 | // Signal related properties |
75 | GParamSpec * online; | 77 | GParamSpec * online; |
@@ -92,9 +94,6 @@ G_BEGIN_DECLS | @@ -92,9 +94,6 @@ G_BEGIN_DECLS | ||
92 | 94 | ||
93 | } properties; | 95 | } properties; |
94 | 96 | ||
95 | - // Predefined responses. | ||
96 | -// GParamSpec * responses[V3270_TOGGLEABLE_DIALOG_CUSTOM]; | ||
97 | - | ||
98 | // Cursors | 97 | // Cursors |
99 | GdkCursor * cursors[LIB3270_POINTER_COUNT]; | 98 | GdkCursor * cursors[LIB3270_POINTER_COUNT]; |
100 | 99 |
src/include/v3270/settings.h
@@ -48,7 +48,7 @@ | @@ -48,7 +48,7 @@ | ||
48 | LIB3270_EXPORT void v3270_to_key_file(GtkWidget *widget, GKeyFile *key_file, const gchar *group_name); | 48 | LIB3270_EXPORT void v3270_to_key_file(GtkWidget *widget, GKeyFile *key_file, const gchar *group_name); |
49 | 49 | ||
50 | /// @brief Emit the "save-settings" signal. | 50 | /// @brief Emit the "save-settings" signal. |
51 | - LIB3270_EXPORT void v3270_emit_save_settings(GtkWidget *widget); | 51 | + LIB3270_EXPORT void v3270_emit_save_settings(GtkWidget *widget, const gchar *property_name); |
52 | 52 | ||
53 | #ifdef _WIN32 | 53 | #ifdef _WIN32 |
54 | 54 |
src/selection/selection.c
@@ -151,7 +151,7 @@ void v3270_selection_set_font_family(GtkWidget *widget, const gchar *name) { | @@ -151,7 +151,7 @@ void v3270_selection_set_font_family(GtkWidget *widget, const gchar *name) { | ||
151 | terminal->selection.font_family = g_strdup(name); | 151 | terminal->selection.font_family = g_strdup(name); |
152 | } | 152 | } |
153 | 153 | ||
154 | - v3270_emit_save_settings(widget); | 154 | + v3270_emit_save_settings(widget,NULL); |
155 | 155 | ||
156 | } | 156 | } |
157 | 157 | ||
@@ -181,7 +181,7 @@ void v3270_selection_set_color_scheme(GtkWidget *widget, const gchar *name) { | @@ -181,7 +181,7 @@ void v3270_selection_set_color_scheme(GtkWidget *widget, const gchar *name) { | ||
181 | terminal->selection.color.scheme = g_strdup(name); | 181 | terminal->selection.color.scheme = g_strdup(name); |
182 | } | 182 | } |
183 | 183 | ||
184 | - v3270_emit_save_settings(widget); | 184 | + v3270_emit_save_settings(widget,NULL); |
185 | 185 | ||
186 | } | 186 | } |
187 | 187 |
src/terminal/callbacks.c
@@ -112,7 +112,8 @@ static gboolean v3270_update_url(v3270 *terminal) | @@ -112,7 +112,8 @@ static gboolean v3270_update_url(v3270 *terminal) | ||
112 | { | 112 | { |
113 | GtkWidget * widget = GTK_WIDGET(terminal); | 113 | GtkWidget * widget = GTK_WIDGET(terminal); |
114 | debug("url=%s",v3270_get_url(widget)); | 114 | debug("url=%s",v3270_get_url(widget)); |
115 | - v3270_notify_setting(widget,V3270_SETTING_URL); | 115 | + |
116 | + v3270_emit_save_settings(widget,"url"); | ||
116 | v3270_signal_emit(widget, V3270_SIGNAL_SESSION_CHANGED); | 117 | v3270_signal_emit(widget, V3270_SIGNAL_SESSION_CHANGED); |
117 | return FALSE; | 118 | return FALSE; |
118 | } | 119 | } |
@@ -201,9 +202,7 @@ static void update_model(H3270 *session, const char *name, int model, G_GNUC_UNU | @@ -201,9 +202,7 @@ static void update_model(H3270 *session, const char *name, int model, G_GNUC_UNU | ||
201 | { | 202 | { |
202 | GtkWidget * widget = GTK_WIDGET(lib3270_get_user_data(session)); | 203 | GtkWidget * widget = GTK_WIDGET(lib3270_get_user_data(session)); |
203 | 204 | ||
204 | - debug("%s: terminal=%p pspec=%p",__FUNCTION__,widget,GTK_V3270_GET_CLASS(widget)->properties.settings[V3270_SETTING_MODEL_NUMBER]); | ||
205 | - g_object_notify_by_pspec(G_OBJECT(widget), GTK_V3270_GET_CLASS(widget)->properties.settings[V3270_SETTING_MODEL_NUMBER]); | ||
206 | - | 205 | +// g_object_notify_by_pspec(G_OBJECT(widget), GTK_V3270_GET_CLASS(widget)->properties.settings[V3270_SETTING_MODEL_NUMBER]); |
207 | v3270_signal_emit(widget,V3270_SIGNAL_MODEL_CHANGED, (guint) model, name); | 206 | v3270_signal_emit(widget,V3270_SIGNAL_MODEL_CHANGED, (guint) model, name); |
208 | } | 207 | } |
209 | 208 |
src/terminal/charset.c
@@ -337,8 +337,7 @@ | @@ -337,8 +337,7 @@ | ||
337 | g_free(cfg.host); | 337 | g_free(cfg.host); |
338 | g_free(cfg.display); | 338 | g_free(cfg.display); |
339 | 339 | ||
340 | - debug("%s=%p",__FUNCTION__,GTK_V3270_GET_CLASS(widget)->properties.settings[V3270_SETTING_REMAP_FILE]); | ||
341 | - v3270_notify_setting(widget,V3270_SETTING_REMAP_FILE); | 340 | + v3270_emit_save_settings(widget,"remap_file"); |
342 | 341 | ||
343 | } | 342 | } |
344 | 343 |
src/terminal/colors.c
@@ -135,7 +135,7 @@ LIB3270_EXPORT void v3270_set_colors(GtkWidget *widget, const gchar *colors) | @@ -135,7 +135,7 @@ LIB3270_EXPORT void v3270_set_colors(GtkWidget *widget, const gchar *colors) | ||
135 | } | 135 | } |
136 | 136 | ||
137 | v3270_set_color_table(GTK_V3270(widget)->color,colors); | 137 | v3270_set_color_table(GTK_V3270(widget)->color,colors); |
138 | - v3270_emit_save_settings(widget); | 138 | + v3270_emit_save_settings(widget,NULL); |
139 | v3270_reload(widget); | 139 | v3270_reload(widget); |
140 | 140 | ||
141 | } | 141 | } |
src/terminal/font/properties.c
@@ -162,10 +162,7 @@ LIB3270_EXPORT void v3270_set_font_family(GtkWidget *widget, const gchar *name) | @@ -162,10 +162,7 @@ LIB3270_EXPORT void v3270_set_font_family(GtkWidget *widget, const gchar *name) | ||
162 | terminal->font.family = g_strdup(name); | 162 | terminal->font.family = g_strdup(name); |
163 | terminal->font.weight = lib3270_get_toggle(terminal->host,LIB3270_TOGGLE_BOLD) ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL; | 163 | terminal->font.weight = lib3270_get_toggle(terminal->host,LIB3270_TOGGLE_BOLD) ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL; |
164 | 164 | ||
165 | - v3270_emit_save_settings(widget); | ||
166 | - | ||
167 | - debug("%s: %p",__FUNCTION__,GTK_V3270_GET_CLASS(widget)->properties.settings[V3270_SETTING_FONT_FAMILY]); | ||
168 | - v3270_notify_setting(widget,V3270_SETTING_FONT_FAMILY); | 165 | + v3270_emit_save_settings(widget,"font_family"); |
169 | 166 | ||
170 | if(gtk_widget_get_realized(widget) && gtk_widget_get_has_window(widget)) | 167 | if(gtk_widget_get_realized(widget) && gtk_widget_get_has_window(widget)) |
171 | { | 168 | { |
@@ -177,13 +174,6 @@ LIB3270_EXPORT void v3270_set_font_family(GtkWidget *widget, const gchar *name) | @@ -177,13 +174,6 @@ LIB3270_EXPORT void v3270_set_font_family(GtkWidget *widget, const gchar *name) | ||
177 | 174 | ||
178 | } | 175 | } |
179 | 176 | ||
180 | -void v3270_notify_setting(GtkWidget *widget, V3270_SETTING id) | ||
181 | -{ | ||
182 | - debug("%s(%u)",__FUNCTION__,(unsigned int) id); | ||
183 | - g_object_notify_by_pspec(G_OBJECT(widget), GTK_V3270_GET_CLASS(widget)->properties.settings[id]); | ||
184 | - v3270_emit_save_settings(widget); | ||
185 | -} | ||
186 | - | ||
187 | LIB3270_EXPORT const gchar * v3270_get_font_family(GtkWidget *widget) | 177 | LIB3270_EXPORT const gchar * v3270_get_font_family(GtkWidget *widget) |
188 | { | 178 | { |
189 | g_return_val_if_fail(GTK_IS_V3270(widget),NULL); | 179 | g_return_val_if_fail(GTK_IS_V3270(widget),NULL); |
src/terminal/keyfile.c
@@ -308,15 +308,17 @@ | @@ -308,15 +308,17 @@ | ||
308 | for(ix = 0; ix < G_N_ELEMENTS(klass->properties.toggle); ix++) | 308 | for(ix = 0; ix < G_N_ELEMENTS(klass->properties.toggle); ix++) |
309 | save_by_pspec(widget,klass->properties.toggle[ix],key_file,group_name); | 309 | save_by_pspec(widget,klass->properties.toggle[ix],key_file,group_name); |
310 | 310 | ||
311 | - // Save V3270 Responses | ||
312 | - /* | ||
313 | - for(ix = 0; ix < G_N_ELEMENTS(terminal->responses); ix++) | ||
314 | - save_by_pspec(widget,klass->responses[ix],key_file,group_name); | ||
315 | - */ | ||
316 | - | ||
317 | // Save V3270 properties | 311 | // Save V3270 properties |
318 | - for(ix = 0; ix < V3270_SETTING_COUNT; ix++) | ||
319 | - save_by_pspec(widget,klass->properties.settings[ix],key_file,group_name); | 312 | + for(ix = 0; klass->properties.persistent[ix];ix++) |
313 | + { | ||
314 | + save_by_pspec( | ||
315 | + widget, | ||
316 | + g_object_class_find_property(G_OBJECT_CLASS(klass),klass->properties.persistent[ix]), | ||
317 | + key_file, | ||
318 | + group_name | ||
319 | + ); | ||
320 | + | ||
321 | + } | ||
320 | 322 | ||
321 | } | 323 | } |
322 | 324 | ||
@@ -362,15 +364,17 @@ | @@ -362,15 +364,17 @@ | ||
362 | for(ix = 0; ix < G_N_ELEMENTS(klass->properties.toggle); ix++) | 364 | for(ix = 0; ix < G_N_ELEMENTS(klass->properties.toggle); ix++) |
363 | load_by_pspec(widget,klass->properties.toggle[ix],key_file,group_name); | 365 | load_by_pspec(widget,klass->properties.toggle[ix],key_file,group_name); |
364 | 366 | ||
365 | - /* | ||
366 | - // Load V3270 Responses | ||
367 | - for(ix = 0; ix < G_N_ELEMENTS(terminal->responses); ix++) | ||
368 | - load_by_pspec(widget,klass->responses[ix],key_file,group_name); | ||
369 | - */ | ||
370 | - | ||
371 | // Load V3270 properties | 367 | // Load V3270 properties |
372 | - for(ix = 0; ix < V3270_SETTING_COUNT; ix++) | ||
373 | - load_by_pspec(widget,klass->properties.settings[ix],key_file,group_name); | 368 | + for(ix = 0; klass->properties.persistent[ix];ix++) |
369 | + { | ||
370 | + load_by_pspec( | ||
371 | + widget, | ||
372 | + g_object_class_find_property(G_OBJECT_CLASS(klass),klass->properties.persistent[ix]), | ||
373 | + key_file, | ||
374 | + group_name | ||
375 | + ); | ||
376 | + | ||
377 | + } | ||
374 | 378 | ||
375 | g_object_thaw_notify(G_OBJECT(widget)); | 379 | g_object_thaw_notify(G_OBJECT(widget)); |
376 | terminal->freeze = 0; | 380 | terminal->freeze = 0; |
src/terminal/properties/init.c
@@ -43,15 +43,7 @@ | @@ -43,15 +43,7 @@ | ||
43 | } properties[] = { | 43 | } properties[] = { |
44 | { "connected", &klass->properties.online }, | 44 | { "connected", &klass->properties.online }, |
45 | { "associated-lu", &klass->properties.associated_lu }, | 45 | { "associated-lu", &klass->properties.associated_lu }, |
46 | - { "url", &klass->properties.settings[V3270_SETTING_URL] }, | ||
47 | - { "model-number", &klass->properties.settings[V3270_SETTING_MODEL_NUMBER] }, | ||
48 | { "has-selection", &klass->properties.selection }, | 46 | { "has-selection", &klass->properties.selection }, |
49 | - { "oversize", &klass->properties.settings[V3270_SETTING_OVERSIZE] }, | ||
50 | - { "host-charset", &klass->properties.settings[V3270_SETTING_HOST_CHARSET] }, | ||
51 | - { "unlock-delay", &klass->properties.settings[V3270_SETTING_UNLOCK_DELAY] }, | ||
52 | - { "color-type", &klass->properties.settings[V3270_SETTING_COLOR_TYPE] }, | ||
53 | - { "host-type", &klass->properties.settings[V3270_SETTING_HOST_TYPE] }, | ||
54 | - { "crl-preferred-protocol", &klass->properties.settings[V3270_SETTING_CRL_PROTOCOL] }, | ||
55 | }; | 47 | }; |
56 | 48 | ||
57 | size_t ix; | 49 | size_t ix; |
@@ -83,7 +75,7 @@ | @@ -83,7 +75,7 @@ | ||
83 | // Setup internal properties. | 75 | // Setup internal properties. |
84 | 76 | ||
85 | // Font family | 77 | // Font family |
86 | - klass->properties.settings[V3270_SETTING_FONT_FAMILY] = | 78 | + spec = |
87 | g_param_spec_string( | 79 | g_param_spec_string( |
88 | "font_family", | 80 | "font_family", |
89 | "font_family", | 81 | "font_family", |
@@ -95,7 +87,7 @@ | @@ -95,7 +87,7 @@ | ||
95 | g_object_class_install_property( | 87 | g_object_class_install_property( |
96 | gobject_class, | 88 | gobject_class, |
97 | V3270_PROPERTY_FONT_FAMILY, | 89 | V3270_PROPERTY_FONT_FAMILY, |
98 | - klass->properties.settings[V3270_SETTING_FONT_FAMILY] | 90 | + spec |
99 | ); | 91 | ); |
100 | 92 | ||
101 | // Session name. | 93 | // Session name. |
@@ -114,7 +106,7 @@ | @@ -114,7 +106,7 @@ | ||
114 | ); | 106 | ); |
115 | 107 | ||
116 | // Auto disconnect | 108 | // Auto disconnect |
117 | - klass->properties.settings[V3270_SETTING_AUTO_DISCONNECT] = | 109 | + spec = |
118 | g_param_spec_uint( | 110 | g_param_spec_uint( |
119 | "auto_disconnect", | 111 | "auto_disconnect", |
120 | "auto_disconnect", | 112 | "auto_disconnect", |
@@ -128,7 +120,7 @@ | @@ -128,7 +120,7 @@ | ||
128 | g_object_class_install_property( | 120 | g_object_class_install_property( |
129 | gobject_class, | 121 | gobject_class, |
130 | V3270_PROPERTY_AUTO_DISCONNECT, | 122 | V3270_PROPERTY_AUTO_DISCONNECT, |
131 | - klass->properties.settings[V3270_SETTING_AUTO_DISCONNECT] | 123 | + spec |
132 | ); | 124 | ); |
133 | 125 | ||
134 | // Clipboard | 126 | // Clipboard |
@@ -147,7 +139,7 @@ | @@ -147,7 +139,7 @@ | ||
147 | ); | 139 | ); |
148 | 140 | ||
149 | // Remap file | 141 | // Remap file |
150 | - klass->properties.settings[V3270_SETTING_REMAP_FILE] = | 142 | + spec = |
151 | g_param_spec_string( | 143 | g_param_spec_string( |
152 | "remap_file", | 144 | "remap_file", |
153 | "remap_file", | 145 | "remap_file", |
@@ -159,11 +151,11 @@ | @@ -159,11 +151,11 @@ | ||
159 | g_object_class_install_property( | 151 | g_object_class_install_property( |
160 | gobject_class, | 152 | gobject_class, |
161 | V3270_PROPERTY_REMAP_FILE, | 153 | V3270_PROPERTY_REMAP_FILE, |
162 | - klass->properties.settings[V3270_SETTING_REMAP_FILE] | 154 | + spec |
163 | ); | 155 | ); |
164 | 156 | ||
165 | // Dynamic font spacing | 157 | // Dynamic font spacing |
166 | - klass->properties.settings[V3270_SETTING_DYNAMIC_SPACING] = | 158 | + spec = |
167 | g_param_spec_boolean( | 159 | g_param_spec_boolean( |
168 | "dynamic_font_spacing", | 160 | "dynamic_font_spacing", |
169 | "dynamic_font_spacing", | 161 | "dynamic_font_spacing", |
@@ -175,11 +167,11 @@ | @@ -175,11 +167,11 @@ | ||
175 | g_object_class_install_property( | 167 | g_object_class_install_property( |
176 | gobject_class, | 168 | gobject_class, |
177 | V3270_PROPERTY_DYNAMIC_SPACING, | 169 | V3270_PROPERTY_DYNAMIC_SPACING, |
178 | - klass->properties.settings[V3270_SETTING_DYNAMIC_SPACING] | 170 | + spec |
179 | ); | 171 | ); |
180 | 172 | ||
181 | // Lu names | 173 | // Lu names |
182 | - klass->properties.settings[V3270_SETTING_LU_NAMES] = | 174 | + spec = |
183 | g_param_spec_string( | 175 | g_param_spec_string( |
184 | "lu_names", | 176 | "lu_names", |
185 | "lu_names", | 177 | "lu_names", |
@@ -191,7 +183,7 @@ | @@ -191,7 +183,7 @@ | ||
191 | g_object_class_install_property( | 183 | g_object_class_install_property( |
192 | gobject_class, | 184 | gobject_class, |
193 | V3270_PROPERTY_LU_NAMES, | 185 | V3270_PROPERTY_LU_NAMES, |
194 | - klass->properties.settings[V3270_SETTING_LU_NAMES] | 186 | + spec |
195 | ); | 187 | ); |
196 | 188 | ||
197 | // Trace | 189 | // Trace |
@@ -209,7 +201,7 @@ | @@ -209,7 +201,7 @@ | ||
209 | ); | 201 | ); |
210 | 202 | ||
211 | // Colors | 203 | // Colors |
212 | - klass->properties.settings[V3270_SETTING_TERMINAL_COLORS] = | 204 | + spec = |
213 | g_param_spec_string( | 205 | g_param_spec_string( |
214 | "colors", | 206 | "colors", |
215 | "colors", | 207 | "colors", |
@@ -221,11 +213,11 @@ | @@ -221,11 +213,11 @@ | ||
221 | g_object_class_install_property( | 213 | g_object_class_install_property( |
222 | gobject_class, | 214 | gobject_class, |
223 | V3270_PROPERTY_TERMINAL_COLORS, | 215 | V3270_PROPERTY_TERMINAL_COLORS, |
224 | - klass->properties.settings[V3270_SETTING_TERMINAL_COLORS] | 216 | + spec |
225 | ); | 217 | ); |
226 | 218 | ||
227 | // Clipboard options | 219 | // Clipboard options |
228 | - klass->properties.settings[V3270_SETTING_SELECTION_OPTIONS] = | 220 | + spec = |
229 | g_param_spec_uint( | 221 | g_param_spec_uint( |
230 | "selection_flags", | 222 | "selection_flags", |
231 | "selection_flags", | 223 | "selection_flags", |
@@ -239,7 +231,7 @@ | @@ -239,7 +231,7 @@ | ||
239 | g_object_class_install_property( | 231 | g_object_class_install_property( |
240 | gobject_class, | 232 | gobject_class, |
241 | V3270_PROPERTY_SELECTION_OPTIONS, | 233 | V3270_PROPERTY_SELECTION_OPTIONS, |
242 | - klass->properties.settings[V3270_SETTING_SELECTION_OPTIONS] | 234 | + spec |
243 | ); | 235 | ); |
244 | 236 | ||
245 | klass->properties.has_copy = | 237 | klass->properties.has_copy = |
src/terminal/properties/set.c
@@ -256,7 +256,7 @@ LIB3270_EXPORT void v3270_set_auto_disconnect(GtkWidget *widget, guint minutes) | @@ -256,7 +256,7 @@ LIB3270_EXPORT void v3270_set_auto_disconnect(GtkWidget *widget, guint minutes) | ||
256 | if(terminal->activity.disconnect != minutes) | 256 | if(terminal->activity.disconnect != minutes) |
257 | { | 257 | { |
258 | terminal->activity.disconnect = minutes; | 258 | terminal->activity.disconnect = minutes; |
259 | - v3270_notify_setting(widget,V3270_SETTING_AUTO_DISCONNECT); | 259 | + v3270_emit_save_settings(widget,"auto_disconnect"); |
260 | } | 260 | } |
261 | 261 | ||
262 | } | 262 | } |
@@ -273,7 +273,7 @@ LIB3270_EXPORT void v3270_set_dynamic_font_spacing(GtkWidget *widget, gboolean s | @@ -273,7 +273,7 @@ LIB3270_EXPORT void v3270_set_dynamic_font_spacing(GtkWidget *widget, gboolean s | ||
273 | terminal->font.spacing.dynamic = state; | 273 | terminal->font.spacing.dynamic = state; |
274 | v3270_reconfigure(terminal); | 274 | v3270_reconfigure(terminal); |
275 | gtk_widget_queue_draw(widget); | 275 | gtk_widget_queue_draw(widget); |
276 | - v3270_notify_setting(widget,V3270_SETTING_DYNAMIC_SPACING); | 276 | + v3270_emit_save_settings(widget,"dynamic_font_spacing"); |
277 | } | 277 | } |
278 | 278 | ||
279 | } | 279 | } |
@@ -282,6 +282,6 @@ LIB3270_EXPORT void v3270_set_lunames(GtkWidget *widget, const gchar *lunames) | @@ -282,6 +282,6 @@ LIB3270_EXPORT void v3270_set_lunames(GtkWidget *widget, const gchar *lunames) | ||
282 | { | 282 | { |
283 | g_return_if_fail(GTK_IS_V3270(widget)); | 283 | g_return_if_fail(GTK_IS_V3270(widget)); |
284 | lib3270_set_lunames(GTK_V3270(widget)->host,(lunames && *lunames ? lunames : NULL)); | 284 | lib3270_set_lunames(GTK_V3270(widget)->host,(lunames && *lunames ? lunames : NULL)); |
285 | - v3270_notify_setting(widget,V3270_SETTING_LU_NAMES); | 285 | + v3270_emit_save_settings(widget,"lu_names"); |
286 | } | 286 | } |
287 | 287 |
src/terminal/widget.c
@@ -58,6 +58,26 @@ | @@ -58,6 +58,26 @@ | ||
58 | * | 58 | * |
59 | */ | 59 | */ |
60 | 60 | ||
61 | +/// @brief Persistent properties (load/save from session file). | ||
62 | +static const gchar *persistent_properties[] = { | ||
63 | + "url", | ||
64 | + "model-number", | ||
65 | + "oversize", | ||
66 | + "host-charset", | ||
67 | + "unlock-delay", | ||
68 | + "color-type", | ||
69 | + "host-type", | ||
70 | + "crl-preferred-protocol", | ||
71 | + "remap_file", | ||
72 | + "dynamic_font_spacing", | ||
73 | + "lu_names", | ||
74 | + "font_family", | ||
75 | + "auto_disconnect", | ||
76 | + "colors", | ||
77 | + "selection_flags", | ||
78 | + NULL | ||
79 | +}; | ||
80 | + | ||
61 | /*--[ Widget definition ]----------------------------------------------------------------------------*/ | 81 | /*--[ Widget definition ]----------------------------------------------------------------------------*/ |
62 | 82 | ||
63 | G_DEFINE_TYPE(v3270, v3270, GTK_TYPE_WIDGET); | 83 | G_DEFINE_TYPE(v3270, v3270, GTK_TYPE_WIDGET); |
@@ -207,6 +227,8 @@ static void finalize(GObject *object) { | @@ -207,6 +227,8 @@ static void finalize(GObject *object) { | ||
207 | GtkWidgetClass * widget_class = GTK_WIDGET_CLASS(klass); | 227 | GtkWidgetClass * widget_class = GTK_WIDGET_CLASS(klass); |
208 | GtkBindingSet * binding = gtk_binding_set_by_class(klass); | 228 | GtkBindingSet * binding = gtk_binding_set_by_class(klass); |
209 | 229 | ||
230 | + klass->properties.persistent = persistent_properties; | ||
231 | + | ||
210 | // Setup widget key bindings | 232 | // Setup widget key bindings |
211 | gtk_binding_entry_skip(binding,GDK_F10,0); | 233 | gtk_binding_entry_skip(binding,GDK_F10,0); |
212 | 234 | ||
@@ -824,8 +846,11 @@ static gboolean bg_emit_save_settings(v3270 *terminal) | @@ -824,8 +846,11 @@ static gboolean bg_emit_save_settings(v3270 *terminal) | ||
824 | return FALSE; | 846 | return FALSE; |
825 | } | 847 | } |
826 | 848 | ||
827 | -LIB3270_EXPORT void v3270_emit_save_settings(GtkWidget *widget) | 849 | +LIB3270_EXPORT void v3270_emit_save_settings(GtkWidget *widget, const gchar *property_name) |
828 | { | 850 | { |
851 | + if(property_name) | ||
852 | + g_object_notify(G_OBJECT(widget),property_name); | ||
853 | + | ||
829 | debug("%s(Freeze is %s)",__FUNCTION__,GTK_V3270(widget)->freeze ? "ON" : "OFF"); | 854 | debug("%s(Freeze is %s)",__FUNCTION__,GTK_V3270(widget)->freeze ? "ON" : "OFF"); |
830 | if(widget && GTK_IS_V3270(widget) && !GTK_V3270(widget)->freeze) | 855 | if(widget && GTK_IS_V3270(widget) && !GTK_V3270(widget)->freeze) |
831 | { | 856 | { |