diff options
author | Fridrich Strba <fridrich.strba@bluewin.ch> | 2010-03-15 06:13:29 +0800 |
---|---|---|
committer | Fridrich Strba <fridrich.strba@bluewin.ch> | 2010-03-15 06:13:29 +0800 |
commit | 730cf96cd054669364c37bc6967984444f40abbd (patch) | |
tree | cbfeb60b8c28271c0ecf375a1d043533e1a1ff1f /capplet/anjal-settings-main.c | |
parent | 22d0d5131c74c70fc9cd4732ec96c4bf38665bbb (diff) | |
download | gsoc2013-evolution-730cf96cd054669364c37bc6967984444f40abbd.tar.gz gsoc2013-evolution-730cf96cd054669364c37bc6967984444f40abbd.tar.zst gsoc2013-evolution-730cf96cd054669364c37bc6967984444f40abbd.zip |
Remove some more unnecessary windows workarounds.
Diffstat (limited to 'capplet/anjal-settings-main.c')
-rw-r--r-- | capplet/anjal-settings-main.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/capplet/anjal-settings-main.c b/capplet/anjal-settings-main.c index bdb257a99b..c9e08d18c0 100644 --- a/capplet/anjal-settings-main.c +++ b/capplet/anjal-settings-main.c @@ -41,9 +41,16 @@ #ifdef G_OS_WIN32 #define WIN32_LEAN_AND_MEAN +#ifdef DATADIR +#undef DATADIR +#endif +#include <io.h> +#include <conio.h> +#define _WIN32_WINNT 0x0501 #include <windows.h> #endif + #include <unique/unique.h> gboolean windowed = FALSE; @@ -173,8 +180,22 @@ main (int argc, char *argv[]) UniqueApp *app; #ifdef G_OS_WIN32 - extern void link_shutdown (void); - set_paths (); + if (fileno (stdout) != -1 && _get_osfhandle (fileno (stdout)) != -1) { + /* stdout is fine, presumably redirected to a file or pipe */ + } else { + typedef BOOL (* WINAPI AttachConsole_t) (DWORD); + + AttachConsole_t p_AttachConsole = + (AttachConsole_t) GetProcAddress ( + GetModuleHandle ("kernel32.dll"), "AttachConsole"); + + if (p_AttachConsole && p_AttachConsole (ATTACH_PARENT_PROCESS)) { + freopen ("CONOUT$", "w", stdout); + dup2 (fileno (stdout), 1); + freopen ("CONOUT$", "w", stderr); + dup2 (fileno (stderr), 2); + } + } #endif static GOptionEntry entries[] = { @@ -245,10 +266,6 @@ main (int argc, char *argv[]) gtk_main (); - -#ifdef G_OS_WIN32 - link_shutdown (); -#endif return 0; } |