Commit 8cbce81b470dcea952ccb60ccbb06bc82f9b979c
1 parent
ac099fa7
Exists in
master
and in
5 other branches
Updating windows builds.
Showing
2 changed files
with
47 additions
and
14 deletions
Show diff stats
src/include/config.h.in
src/pw3270/main.c
| ... | ... | @@ -31,6 +31,10 @@ |
| 31 | 31 | |
| 32 | 32 | #include <config.h> |
| 33 | 33 | |
| 34 | +#if defined( _WIN32 ) | |
| 35 | + #include <windows.h> | |
| 36 | +#endif // _WIN32 | |
| 37 | + | |
| 34 | 38 | #include <glib.h> |
| 35 | 39 | #include <glib/gstdio.h> |
| 36 | 40 | #include "globals.h" |
| ... | ... | @@ -45,7 +49,7 @@ |
| 45 | 49 | #include <stdlib.h> |
| 46 | 50 | |
| 47 | 51 | #if defined( HAVE_SYSLOG ) |
| 48 | - #include <syslog.h> | |
| 52 | + #include <syslog.h> | |
| 49 | 53 | #endif // HAVE_SYSLOG |
| 50 | 54 | |
| 51 | 55 | #define ERROR_DOMAIN g_quark_from_static_string(PACKAGE_NAME) |
| ... | ... | @@ -253,21 +257,58 @@ int main(int argc, char *argv[]) |
| 253 | 257 | setlocale( LC_ALL, "" ); |
| 254 | 258 | #endif |
| 255 | 259 | |
| 256 | - // Get DATADIR | |
| 260 | + // OS | |
| 257 | 261 | #if defined( _WIN32 ) |
| 258 | 262 | { |
| 259 | 263 | g_autofree gchar * appdir = g_win32_get_package_installation_directory_of_module(NULL); |
| 260 | 264 | g_autofree gchar * locdir = g_build_filename(appdir,"locale",NULL); |
| 261 | 265 | |
| 266 | + g_set_application_name(PACKAGE_NAME); | |
| 267 | + | |
| 262 | 268 | trace("appdir=\"%s\"",appdir); |
| 263 | 269 | trace("locdir=\"%s\"",locdir); |
| 264 | 270 | |
| 265 | 271 | g_chdir(appdir); |
| 266 | 272 | |
| 273 | + bindtextdomain( PACKAGE_NAME, locdir ); | |
| 267 | 274 | bind_textdomain_codeset(PACKAGE_NAME, "UTF-8"); |
| 268 | 275 | textdomain(PACKAGE_NAME); |
| 269 | 276 | |
| 270 | - bindtextdomain( PACKAGE_NAME, locdir ); | |
| 277 | +#if defined(ENABLE_WINDOWS_REGISTRY) | |
| 278 | + HKEY hMainKey; | |
| 279 | + | |
| 280 | + if(RegOpenKeyEx(HKEY_CURRENT_USER,PACKAGE_NAME,0,KEY_WRITE,&hMainKey) == ERROR_SUCCESS) | |
| 281 | + { | |
| 282 | + HKEY hKey; | |
| 283 | + | |
| 284 | + if(RegOpenKeyEx(HKEY_CURRENT_USER,"application",0,KEY_WRITE,&hKey) == ERROR_SUCCESS) | |
| 285 | + { | |
| 286 | + const struct _versions | |
| 287 | + { | |
| 288 | + const char * name; | |
| 289 | + const char * value; | |
| 290 | + } | |
| 291 | + versions[] = | |
| 292 | + { | |
| 293 | + { "version", PACKAGE_VERSION }, | |
| 294 | + { "release", G_STRINGIFY(PACKAGE_RELEASE) }, | |
| 295 | + { "path", appdir }, | |
| 296 | + }; | |
| 297 | + | |
| 298 | + size_t ix; | |
| 299 | + | |
| 300 | + for(ix = 0; ix < G_N_ELEMENTS(versions); ix++) | |
| 301 | + { | |
| 302 | + RegSetValueEx(hKey,versions[ix].name,0,REG_SZ,(const BYTE *) versions[ix].value,strlen(versions[ix].value)+1); | |
| 303 | + } | |
| 304 | + | |
| 305 | + RegCloseKey(hKey); | |
| 306 | + | |
| 307 | + } | |
| 308 | + RegCloseKey(hMainKey); | |
| 309 | + } | |
| 310 | + | |
| 311 | +#endif // ENABLE_WINDOWS_REGISTRY | |
| 271 | 312 | |
| 272 | 313 | } |
| 273 | 314 | #elif defined(HAVE_GTKMAC) |
| ... | ... | @@ -409,10 +450,6 @@ int main(int argc, char *argv[]) |
| 409 | 450 | // Just in case! |
| 410 | 451 | g_mkdir_with_parents(g_get_tmp_dir(),0777); |
| 411 | 452 | |
| 412 | -#ifdef _WIN32 | |
| 413 | - g_set_application_name(PACKAGE_NAME); | |
| 414 | -#endif // _WIN32 | |
| 415 | - | |
| 416 | 453 | if(!session_name) |
| 417 | 454 | session_name = PACKAGE_NAME; |
| 418 | 455 | |
| ... | ... | @@ -431,11 +468,9 @@ int main(int argc, char *argv[]) |
| 431 | 468 | toplevel = pw3270_new(host,systype,syscolors); |
| 432 | 469 | pw3270_set_session_name(toplevel,session_name); |
| 433 | 470 | |
| 434 | -#if defined(_WIN32) && defined(ENABLE_WINDOWS_REGISTRY) | |
| 435 | - pw3270_set_string(toplevel,"app","version",PACKAGE_VERSION); | |
| 436 | - pw3270_set_string(toplevel,"app","release",G_STRINGIFY(PACKAGE_RELEASE)); | |
| 437 | - pw3270_set_string(toplevel,"app","sessionName",session_name); | |
| 438 | -#endif // _WIN32 && ENABLE_WINDOWS_REGISTRY | |
| 471 | +#ifdef _WIN32 | |
| 472 | + pw3270_set_string(toplevel,"application","session",session_name); | |
| 473 | +#endif // _WIN32 | |
| 439 | 474 | |
| 440 | 475 | if(toggleset) |
| 441 | 476 | { | ... | ... |