Commit 5c6b307f3a772bfde2b118c60d4cc6d9e0a26a45
1 parent
988afbcb
Exists in
master
and in
3 other branches
Adding option to disable dialogs from windows registry.
Showing
1 changed file
with
13 additions
and
8 deletions
Show diff stats
src/objects/window/terminal.c
... | ... | @@ -41,6 +41,7 @@ |
41 | 41 | #include <v3270/settings.h> |
42 | 42 | #include <v3270/actions.h> |
43 | 43 | #include <v3270/print.h> |
44 | + #include <lib3270/os.h> | |
44 | 45 | |
45 | 46 | struct SessionDescriptor |
46 | 47 | { |
... | ... | @@ -234,24 +235,28 @@ |
234 | 235 | |
235 | 236 | static GtkResponseType load_popup_response(v3270 G_GNUC_UNUSED(*widget), const gchar *popup_name, struct SessionDescriptor * session) { |
236 | 237 | |
237 | - if(!session->key_file) | |
238 | - return 0; | |
239 | - | |
240 | - if(g_key_file_has_key(session->key_file,"dialogs",popup_name,NULL)) | |
238 | + if(session->key_file && g_key_file_has_key(session->key_file,"dialogs",popup_name,NULL)) | |
241 | 239 | return (GtkResponseType) g_key_file_get_integer(session->key_file,"dialogs",popup_name,NULL); |
242 | 240 | |
243 | 241 | #ifdef _WIN32 |
244 | 242 | { |
245 | 243 | // Windows - Check predefined responses on system registry. |
244 | + lib3270_auto_cleanup(HKEY) hKey; | |
246 | 245 | |
247 | -#ifndef DEBUG | |
248 | - #error parei aqui. | |
249 | -#endif // DEBUG | |
246 | + if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,G_STRINGIFY(PRODUCT_NAME)"\\dialogs",0,KEY_READ,&hKey) == ERROR_SUCCESS) { | |
247 | + | |
248 | + DWORD val = 0; | |
249 | + DWORD cbData = sizeof(DWORD); | |
250 | 250 | |
251 | + if(RegQueryValueEx(hKey, popup_name, NULL, NULL, (LPBYTE) &val, &cbData) == ERROR_SUCCESS) { | |
252 | + return (GtkResponseType) val; | |
253 | + } | |
254 | + | |
255 | + } | |
251 | 256 | } |
252 | 257 | #endif // _WIN32 |
253 | 258 | |
254 | - return GTK_RESPONSE_NONE; | |
259 | + return session->key_file ? GTK_RESPONSE_NONE : 0; | |
255 | 260 | } |
256 | 261 | |
257 | 262 | static gboolean save_popup_response(GtkWidget *widget, const gchar *popup_name, GtkResponseType response, struct SessionDescriptor * session) { | ... | ... |