Commit 40fbc881fb47ffffbba511a6d33bc29d0bff6c56
1 parent
4ec193c8
Exists in
master
and in
4 other branches
Loading/saving print settings to/from session file.
Showing
1 changed file
with
25 additions
and
1 deletions
Show diff stats
src/objects/window/terminal.c
... | ... | @@ -32,6 +32,7 @@ |
32 | 32 | #include <lib3270/toggle.h> |
33 | 33 | #include <v3270/settings.h> |
34 | 34 | #include <v3270/actions.h> |
35 | + #include <v3270/print.h> | |
35 | 36 | |
36 | 37 | struct SessionDescriptor |
37 | 38 | { |
... | ... | @@ -252,12 +253,33 @@ |
252 | 253 | |
253 | 254 | } |
254 | 255 | |
255 | - static void toggle_changed(G_GNUC_UNUSED v3270 *widget, G_GNUC_UNUSED LIB3270_TOGGLE_ID toggle_id, gboolean toggle_state, const gchar *toggle_name, struct SessionDescriptor * session) { | |
256 | + 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) { | |
256 | 257 | debug("%s(%s)=%s",__FUNCTION__,toggle_name,toggle_state ? "ON" : "OFF"); |
257 | 258 | g_key_file_set_boolean(session->key_file,"terminal",toggle_name,toggle_state); |
258 | 259 | session->changed = TRUE; |
259 | 260 | } |
260 | 261 | |
262 | + static void print_done(G_GNUC_UNUSED GtkWidget *widget, GtkPrintOperation *operation, GtkPrintOperationResult result, struct SessionDescriptor * session) { | |
263 | + debug("%s(%u)",__FUNCTION__,(unsigned int) result); | |
264 | + | |
265 | + if(result != GTK_PRINT_OPERATION_RESULT_APPLY) | |
266 | + return; | |
267 | + | |
268 | + debug("%s: Saving print settings",__FUNCTION__); | |
269 | + | |
270 | + v3270_print_operation_to_key_file(operation,session->key_file); | |
271 | + | |
272 | + g_key_file_save_to_file(session->key_file,session->filename,NULL); | |
273 | + session->changed = FALSE; | |
274 | + } | |
275 | + | |
276 | + static void print_setup(G_GNUC_UNUSED GtkWidget *widget, GtkPrintOperation *operation, struct SessionDescriptor * session) { | |
277 | + | |
278 | + debug("%s(%p)",__FUNCTION__,operation); | |
279 | + v3270_print_operation_load_key_file(operation,session->key_file); | |
280 | + | |
281 | + } | |
282 | + | |
261 | 283 | static void close_settings(struct SessionDescriptor * session) { |
262 | 284 | |
263 | 285 | if(session->key_file) { |
... | ... | @@ -351,6 +373,8 @@ |
351 | 373 | // Setup signals. |
352 | 374 | g_signal_connect(G_OBJECT(terminal),"save-settings",G_CALLBACK(save_settings),descriptor); |
353 | 375 | g_signal_connect(G_OBJECT(terminal),"toggle_changed",G_CALLBACK(toggle_changed),descriptor); |
376 | + g_signal_connect(G_OBJECT(terminal),"print-done",G_CALLBACK(print_done),descriptor); | |
377 | + g_signal_connect(G_OBJECT(terminal),"print-setup",G_CALLBACK(print_setup),descriptor); | |
354 | 378 | |
355 | 379 | return terminal; |
356 | 380 | ... | ... |