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 77  
78 78 #ifdef ENABLE_WINDOWS_REGISTRY
79 79 gboolean get_registry_handle(const gchar *group, HKEY *hKey, REGSAM samDesired);
  80 + HKEY get_application_registry(REGSAM samDesired);
80 81 void registry_foreach(HKEY parent, const gchar *name,void (*cbk)(const gchar *key, const gchar *val, gpointer *user_data), gpointer *user_data);
81 82 void registry_set_double(HKEY hKey, const gchar *key, gdouble value);
82 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 726 gboolean get_registry_handle(const gchar *group, HKEY *hKey, REGSAM samDesired)
727 727 {
728 728 gboolean ret;
729   - gchar * path = g_strdup_printf("%s\\%s\\%s",registry_path,g_get_application_name(),group);
  729 + gchar * path;
730 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 737 if(RegCreateKeyEx(HKEY_CURRENT_USER,path,0,NULL,REG_OPTION_NON_VOLATILE,samDesired,NULL,hKey,&disp) == ERROR_SUCCESS)
733 738 ret = TRUE;
734 739 else
... ...
src/pw3270/window.c
... ... @@ -409,8 +409,18 @@ static GtkWidget * trace_window = NULL;
409 409  
410 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 420 #else
  421 +
413 422 v3270_to_key_file(widget, get_application_keyfile(), "terminal");
  423 +
414 424 #endif // _WIN32
415 425  
416 426 }
... ...