From 33d7252dbea61cae1347cc1d965e88fd075c7e34 Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Wed, 20 Nov 2019 17:43:02 -0300 Subject: [PATCH] Fixing warnings when using default print settings. --- src/pw3270/linux/print.c | 24 ++++++++++++++++-------- src/pw3270/print.c | 3 ++- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/pw3270/linux/print.c b/src/pw3270/linux/print.c index 9292423..80f59bc 100644 --- a/src/pw3270/linux/print.c +++ b/src/pw3270/linux/print.c @@ -31,6 +31,7 @@ #include #include #include + #include #define FONT_CONFIG "font-family" #define DEFAULT_FONT "Courier New" @@ -50,11 +51,15 @@ GKeyFile * conf = get_application_keyfile(); GError * err = NULL; - if(g_key_file_has_group(conf,"print_settings") && !gtk_print_settings_load_key_file(settings,conf,"print_settings",&err)) + debug("print_settings=%s",g_key_file_has_group(conf,"print_settings") ? "TRUE" : "FALSE"); + if(g_key_file_has_group(conf,"print_settings")) { - g_warning("Error getting print settings: %s",err->message); - g_error_free(err); - err = NULL; + if(!gtk_print_settings_load_key_file(settings,conf,"print_settings",&err)) + { + g_warning("Error getting print settings: %s",err->message); + g_error_free(err); + err = NULL; + } } #ifdef DEBUG else @@ -63,11 +68,14 @@ } #endif // DEBUG - if(g_key_file_has_group(conf,"page_setup") && !gtk_page_setup_load_key_file(setup,conf,"page_setup",&err)) + if(g_key_file_has_group(conf,"page_setup")) { - g_warning("Error getting page setup: %s",err->message); - g_error_free(err); - err = NULL; + if(!gtk_page_setup_load_key_file(setup,conf,"page_setup",&err)) + { + g_warning("Error getting page setup: %s",err->message); + g_error_free(err); + err = NULL; + } } #ifdef DEBUG else diff --git a/src/pw3270/print.c b/src/pw3270/print.c index c062993..7a6c4ec 100644 --- a/src/pw3270/print.c +++ b/src/pw3270/print.c @@ -126,7 +126,8 @@ { // Setup async mode - gboolean async = get_boolean_from_config("terminal","allow_async_print",TRUE); + gboolean async = get_boolean_from_config("print","allow_async",TRUE); + debug("Allow async is %s",async ? "enabled" : "disabled"); gtk_print_operation_set_allow_async(operation,async); } -- libgit2 0.21.2