diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index bb19ca6..d4a5246 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -3,7 +3,7 @@ { "name": "Win32", "includePath": [ - "${workspaceFolder}/**" + "${workspaceFolder}/src/include" ], "defines": [ "_DEBUG", diff --git a/src/terminal/windows/registry.c b/src/terminal/windows/registry.c index c408423..e9e367a 100644 --- a/src/terminal/windows/registry.c +++ b/src/terminal/windows/registry.c @@ -32,6 +32,7 @@ #include #include #include + #include #include #include #include @@ -60,7 +61,7 @@ } else { - RegDeleteKey(hKey,name); + RegDeleteValue(hKey,name); } } break; @@ -76,7 +77,7 @@ } else { - RegDeleteKey(hKey,name); + RegDeleteValue(hKey,name); } } break; @@ -92,7 +93,7 @@ } else { - RegDeleteKey(hKey,name); + RegDeleteValue(hKey,name); } } @@ -109,7 +110,7 @@ } else { - RegDeleteKey(hKey,name); + RegDeleteValue(hKey,name); } } diff --git a/src/testprogram/testprogram.c b/src/testprogram/testprogram.c index 8bf4aa8..581a662 100644 --- a/src/testprogram/testprogram.c +++ b/src/testprogram/testprogram.c @@ -65,6 +65,35 @@ } */ +#ifdef _WIN32 + + static int get_registry(HKEY *hKey,REGSAM samDesired) + { + DWORD disp; + + if(RegCreateKeyEx(HKEY_CURRENT_USER,"software\\v3270",0,NULL,REG_OPTION_NON_VOLATILE,samDesired,NULL,hKey,&disp) != ERROR_SUCCESS) + { + g_warning("Can't open registry"); + return -1; + } + + return 0; + + } + + static void save_settings(GtkWidget *terminal, GtkWidget *window) + { + HKEY hKey = 0; + + if(get_registry(&hKey,KEY_SET_VALUE)) + return; + + v3270_to_registry(terminal,hKey,"terminal"); + RegCloseKey(hKey); + } + +#else + static GKeyFile * get_key_file() { GKeyFile * key_file = g_key_file_new(); @@ -81,8 +110,12 @@ g_key_file_save_to_file(key_file,"terminal.conf",NULL); g_key_file_free(key_file); + } +#endif // _WIN32 + + static void activate(GtkApplication* app, G_GNUC_UNUSED gpointer user_data) { GtkWidget * window = gtk_application_window_new(app); @@ -108,10 +141,14 @@ #endif // _WIN32 // Load settings before connecting the signals. +#ifdef _WIN32 + +#else debug("%s: Loading settings...",__FUNCTION__); GKeyFile * key_file = get_key_file(); v3270_load_key_file(terminal,key_file,"terminal"); g_key_file_free(key_file); +#endif // _WIN32 } -- libgit2 0.21.2