Commit e4ac7e4687c6d6504db3038dc4ef2779114991e8

Authored by Perry Werneck
1 parent a9f33603
Exists in v5.2

Saving terminal settings to registry.

src/pw3270/common/common.h
@@ -77,6 +77,7 @@ @@ -77,6 +77,7 @@
77 77
78 #ifdef ENABLE_WINDOWS_REGISTRY 78 #ifdef ENABLE_WINDOWS_REGISTRY
79 gboolean get_registry_handle(const gchar *group, HKEY *hKey, REGSAM samDesired); 79 gboolean get_registry_handle(const gchar *group, HKEY *hKey, REGSAM samDesired);
  80 + HKEY get_application_registry(REGSAM samDesired);
80 void registry_foreach(HKEY parent, const gchar *name,void (*cbk)(const gchar *key, const gchar *val, gpointer *user_data), gpointer *user_data); 81 void registry_foreach(HKEY parent, const gchar *name,void (*cbk)(const gchar *key, const gchar *val, gpointer *user_data), gpointer *user_data);
81 void registry_set_double(HKEY hKey, const gchar *key, gdouble value); 82 void registry_set_double(HKEY hKey, const gchar *key, gdouble value);
82 gboolean registry_get_double(HKEY hKey, const gchar *key, gdouble *value); 83 gboolean registry_get_double(HKEY hKey, const gchar *key, gdouble *value);
src/pw3270/common/config.c
@@ -726,9 +726,14 @@ gchar * filename_from_va(const gchar *first_element, va_list args) @@ -726,9 +726,14 @@ gchar * filename_from_va(const gchar *first_element, va_list args)
726 gboolean get_registry_handle(const gchar *group, HKEY *hKey, REGSAM samDesired) 726 gboolean get_registry_handle(const gchar *group, HKEY *hKey, REGSAM samDesired)
727 { 727 {
728 gboolean ret; 728 gboolean ret;
729 - gchar * path = g_strdup_printf("%s\\%s\\%s",registry_path,g_get_application_name(),group); 729 + gchar * path;
730 DWORD disp; 730 DWORD disp;
731 731
  732 + if(group)
  733 + path = g_strdup_printf("%s\\%s\\%s",registry_path,g_get_application_name(),group);
  734 + else
  735 + path = g_strdup_printf("%s\\%s",registry_path,g_get_application_name());
  736 +
732 if(RegCreateKeyEx(HKEY_CURRENT_USER,path,0,NULL,REG_OPTION_NON_VOLATILE,samDesired,NULL,hKey,&disp) == ERROR_SUCCESS) 737 if(RegCreateKeyEx(HKEY_CURRENT_USER,path,0,NULL,REG_OPTION_NON_VOLATILE,samDesired,NULL,hKey,&disp) == ERROR_SUCCESS)
733 ret = TRUE; 738 ret = TRUE;
734 else 739 else
src/pw3270/window.c
@@ -409,8 +409,18 @@ static GtkWidget * trace_window = NULL; @@ -409,8 +409,18 @@ static GtkWidget * trace_window = NULL;
409 409
410 #ifdef ENABLE_WINDOWS_REGISTRY 410 #ifdef ENABLE_WINDOWS_REGISTRY
411 411
  412 + HKEY hKey;
  413 +
  414 + if(get_registry_handle(NULL, &hKey, KEY_SET_VALUE))
  415 + {
  416 + v3270_to_registry(widget, hKey, "terminal");
  417 + RegCloseKey(hKey);
  418 + }
  419 +
412 #else 420 #else
  421 +
413 v3270_to_key_file(widget, get_application_keyfile(), "terminal"); 422 v3270_to_key_file(widget, get_application_keyfile(), "terminal");
  423 +
414 #endif // _WIN32 424 #endif // _WIN32
415 425
416 } 426 }