annotate src/win32/win32dep.c @ 4041:3a36ec242415

[gaim-migrate @ 4249] Michael Golden replaced a deprecated gtk call, and I fixed a leak in gtkimhtmlc. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Tue, 03 Dec 2002 22:26:54 +0000
parents a997156437b6
children a3ec0146c73e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1 /*
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2 * win32dep.c
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3 *
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4 * Author: Herman Bloggs <hermanator12002@yahoo.com>
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
5 * Date: June, 2002
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
6 * Description: Windows dependant code for Gaim
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
7 */
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
8 #include <windows.h>
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
9 #include <stdlib.h>
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
10 #include <stdio.h>
3983
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
11 #include <winuser.h>
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
12 #include <glib.h>
3973
d9287e87ba56 [gaim-migrate @ 4157]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3950
diff changeset
13 #include <gdk/gdkwin32.h>
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
14 #include "gaim.h"
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
15
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
16 #include "stdafx.h"
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
17 #include "resource.h"
3950
c25cf0495533 [gaim-migrate @ 4129]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3907
diff changeset
18 #include "MinimizeToTray.h"
c25cf0495533 [gaim-migrate @ 4129]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3907
diff changeset
19 #include "systray.h"
3973
d9287e87ba56 [gaim-migrate @ 4157]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3950
diff changeset
20 #include "winuser_extra.h"
d9287e87ba56 [gaim-migrate @ 4157]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3950
diff changeset
21 #include "IdleTracker.h"
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
22
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
23 /*
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
24 * DEFINES & MACROS
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
25 */
3950
c25cf0495533 [gaim-migrate @ 4129]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3907
diff changeset
26
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
27 /*
3983
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
28 * DATA STRUCTS
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
29 */
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
30 struct _WGAIM_FLASH_INFO {
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
31 guint t_handle;
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
32 guint sig_handler;
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
33 };
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
34 typedef struct _WGAIM_FLASH_INFO WGAIM_FLASH_INFO;
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
35
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
36 /*
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
37 * LOCALS
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
38 */
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
39 static char install_dir[MAXPATHLEN];
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
40 static char lib_dir[MAXPATHLEN];
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
41 static char locale_dir[MAXPATHLEN];
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
42 static int bhide_icon;
4026
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
43 static int imalpha = 255;
3950
c25cf0495533 [gaim-migrate @ 4129]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3907
diff changeset
44
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
45 /*
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
46 * GLOBALS
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
47 */
3856
50ac7e205045 [gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3630
diff changeset
48 HINSTANCE gaimexe_hInstance = 0;
50ac7e205045 [gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3630
diff changeset
49 HINSTANCE gaimdll_hInstance = 0;
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
50
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
51 /*
3983
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
52 * PROTOS
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
53 */
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
54 BOOL (*MyFlashWindowEx)(PFLASHWINFO pfwi)=NULL;
4026
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
55 BOOL (*MySetLayeredWindowAttributes)(HWND hwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags)=NULL;
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
56 void wgaim_set_wintrans(GtkWidget *window, int trans);
3983
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
57
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
58 /*
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
59 * STATIC CODE
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
60 */
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
61
3983
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
62 /* Window flasher */
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
63 static gboolean flash_window_cb(gpointer data) {
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
64 FlashWindow((HWND)data, TRUE);
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
65 return TRUE;
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
66 }
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
67
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
68 static void halt_flash_filter(GtkWidget *widget, GdkEventFocus *event, WGAIM_FLASH_INFO *finfo) {
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
69 /* Stop flashing and remove filter */
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
70 debug_printf("Removing timeout\n");
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
71 gtk_timeout_remove(finfo->t_handle);
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
72 debug_printf("Disconnecting signal handler\n");
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
73 g_signal_handler_disconnect(G_OBJECT(widget),finfo->sig_handler);
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
74 debug_printf("done\n");
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
75 }
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
76
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
77 /* Determine whether the specified dll contains the specified procedure.
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
78 If so, load it (if not already loaded). */
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
79 static FARPROC find_and_loadproc( char* dllname, char* procedure ) {
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
80 HMODULE hmod;
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
81 int did_load=0;
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
82 FARPROC proc = 0;
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
83
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
84 if(!(hmod=GetModuleHandle(dllname))) {
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
85 debug_printf("%s not found. Loading it..\n", dllname);
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
86 if(!(hmod = LoadLibrary(dllname))) {
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
87 debug_printf("Could not load: %s\n", dllname);
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
88 return NULL;
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
89 }
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
90 else
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
91 did_load = 1;
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
92 }
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
93
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
94 if((proc=GetProcAddress(hmod, procedure))) {
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
95 debug_printf("This version of %s contains %s\n", dllname, procedure);
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
96 return proc;
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
97 }
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
98 else {
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
99 debug_printf("Function: %s not found in dll: %s\n", procedure, dllname);
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
100 if(did_load) {
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
101 /* unload dll */
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
102 FreeLibrary(hmod);
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
103 }
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
104 return NULL;
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
105 }
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
106 }
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
107
4026
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
108 static void load_winver_specific_procs(void) {
3983
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
109 /* Used for Win98+ and WinNT5+ */
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
110 MyFlashWindowEx = (void*)find_and_loadproc("user32.dll", "FlashWindowEx" );
4026
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
111 /* Used for Win2k+ */
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
112 MySetLayeredWindowAttributes = (void*)find_and_loadproc("user32.dll", "SetLayeredWindowAttributes" );
3983
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
113 }
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
114
4026
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
115 /* Transparency slider callbacks */
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
116 static void change_im_alpha(GtkWidget *w, gpointer data) {
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
117 wgaim_set_wintrans(GTK_WIDGET(data), gtk_range_get_value(GTK_RANGE(w)));
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
118 }
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
119
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
120 /*
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
121 * PUBLIC CODE
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
122 */
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
123
3950
c25cf0495533 [gaim-migrate @ 4129]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3907
diff changeset
124 /* Misc Wingaim functions */
c25cf0495533 [gaim-migrate @ 4129]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3907
diff changeset
125 HINSTANCE wgaim_hinstance(void) {
c25cf0495533 [gaim-migrate @ 4129]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3907
diff changeset
126 return gaimexe_hInstance;
c25cf0495533 [gaim-migrate @ 4129]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3907
diff changeset
127 }
c25cf0495533 [gaim-migrate @ 4129]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3907
diff changeset
128
3856
50ac7e205045 [gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3630
diff changeset
129 /* Determine Gaim Paths during Runtime */
50ac7e205045 [gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3630
diff changeset
130
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
131 char* wgaim_install_dir(void) {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
132 HMODULE hmod;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
133 char* buf;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
134
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
135 hmod = GetModuleHandle(NULL);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
136 if( hmod == 0 ) {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
137 buf = g_win32_error_message( GetLastError() );
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
138 debug_printf("GetModuleHandle error: %s\n", buf);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
139 free(buf);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
140 return NULL;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
141 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
142 if(GetModuleFileName( hmod, (char*)&install_dir, MAXPATHLEN ) == 0) {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
143 buf = g_win32_error_message( GetLastError() );
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
144 debug_printf("GetModuleFileName error: %s\n", buf);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
145 free(buf);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
146 return NULL;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
147 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
148 buf = g_path_get_dirname( install_dir );
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
149 strcpy( (char*)&install_dir, buf );
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
150 free( buf );
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
151
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
152 return (char*)&install_dir;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
153 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
154
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
155 char* wgaim_lib_dir(void) {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
156 strcpy(lib_dir, wgaim_install_dir());
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
157 strcat(lib_dir, G_DIR_SEPARATOR_S "plugins");
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
158 return (char*)&lib_dir;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
159 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
160
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
161 char* wgaim_locale_dir(void) {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
162 strcpy(locale_dir, wgaim_install_dir());
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
163 strcat(locale_dir, G_DIR_SEPARATOR_S "locale");
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
164 return (char*)&locale_dir;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
165 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
166
3973
d9287e87ba56 [gaim-migrate @ 4157]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3950
diff changeset
167 /* Miscellaneous */
d9287e87ba56 [gaim-migrate @ 4157]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3950
diff changeset
168
3983
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
169 /* FlashWindowEx is only supported by Win98+ and WinNT5+. If its
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
170 not supported we do it our own way */
3973
d9287e87ba56 [gaim-migrate @ 4157]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3950
diff changeset
171 void wgaim_im_blink(GtkWidget *window) {
3983
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
172 if(MyFlashWindowEx) {
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
173 FLASHWINFO info;
3973
d9287e87ba56 [gaim-migrate @ 4157]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3950
diff changeset
174
3983
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
175 info.cbSize = sizeof(FLASHWINFO);
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
176 info.hwnd = GDK_WINDOW_HWND(window->window);
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
177 info.dwFlags = FLASHW_ALL | FLASHW_TIMERNOFG;
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
178 info.dwTimeout = 0;
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
179 MyFlashWindowEx(&info);
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
180 }
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
181 else {
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
182 WGAIM_FLASH_INFO *finfo = g_new0(WGAIM_FLASH_INFO, 1);
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
183
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
184 /* Start Flashing window */
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
185 finfo->t_handle = gtk_timeout_add(1000, flash_window_cb, GDK_WINDOW_HWND(window->window));
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
186 finfo->sig_handler = g_signal_connect(G_OBJECT(window), "focus-in-event", G_CALLBACK(halt_flash_filter), finfo);
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
187 }
3973
d9287e87ba56 [gaim-migrate @ 4157]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3950
diff changeset
188 }
d9287e87ba56 [gaim-migrate @ 4157]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3950
diff changeset
189
4026
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
190 /* Set window transparency level */
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
191 void wgaim_set_wintrans(GtkWidget *window, int trans) {
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
192 if(MySetLayeredWindowAttributes) {
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
193 HWND hWnd = GDK_WINDOW_HWND(window->window);
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
194 SetWindowLong(hWnd,GWL_EXSTYLE,GetWindowLong(hWnd,GWL_EXSTYLE) | WS_EX_LAYERED);
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
195 MySetLayeredWindowAttributes(hWnd,0,trans,LWA_ALPHA);
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
196 }
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
197 }
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
198
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
199 void wgaim_set_imalpha(int val) {
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
200 imalpha = val;
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
201 }
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
202
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
203 int wgaim_get_imalpha(int val) {
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
204 return imalpha;
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
205 }
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
206
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
207 int wgaim_has_transparency() {
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
208 return MySetLayeredWindowAttributes ? TRUE : FALSE;
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
209 }
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
210
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
211 GtkWidget *wgaim_wintrans_slider(GtkWidget *win) {
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
212 GtkWidget *hbox;
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
213 GtkWidget *label, *slider;
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
214
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
215 hbox = gtk_hbox_new(FALSE, 5);
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
216
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
217 label = gtk_label_new(_("Opacity:"));
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
218 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
219
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
220 slider = gtk_hscale_new_with_range(50,255,1);
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
221 gtk_range_set_value(GTK_RANGE(slider), imalpha);
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
222 gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1);
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
223
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
224 /* On slider val change, update window's transparency level */
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
225 gtk_signal_connect(GTK_OBJECT(slider), "value-changed", GTK_SIGNAL_FUNC(change_im_alpha), win);
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
226 gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5);
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
227
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
228 /* Set the initial transparency level */
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
229 wgaim_set_wintrans(win, imalpha);
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
230
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
231 gtk_widget_show_all(hbox);
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
232
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
233 return hbox;
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
234 }
a997156437b6 [gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3983
diff changeset
235
3856
50ac7e205045 [gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3630
diff changeset
236 /* Windows Initializations */
50ac7e205045 [gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3630
diff changeset
237
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
238 void wgaim_init(void) {
3907
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
239 WORD wVersionRequested;
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
240 WSADATA wsaData;
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
241 int err;
3856
50ac7e205045 [gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3630
diff changeset
242 char* locale=0;
50ac7e205045 [gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3630
diff changeset
243 char newenv[128];
50ac7e205045 [gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3630
diff changeset
244
3907
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
245 debug_printf("wgaim_init\n");
3950
c25cf0495533 [gaim-migrate @ 4129]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3907
diff changeset
246
3983
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
247 load_winver_specific_procs();
a1245dcf7b31 [gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3973
diff changeset
248
3950
c25cf0495533 [gaim-migrate @ 4129]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3907
diff changeset
249 /* Initialize Wingaim systray icon */
c25cf0495533 [gaim-migrate @ 4129]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3907
diff changeset
250 wgaim_systray_init();
c25cf0495533 [gaim-migrate @ 4129]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3907
diff changeset
251
3907
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
252 /*
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
253 * Winsock init
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
254 */
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
255 wVersionRequested = MAKEWORD( 2, 2 );
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
256
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
257 err = WSAStartup( wVersionRequested, &wsaData );
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
258 if ( err != 0 ) {
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
259 return 1;
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
260 }
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
261
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
262 /* Confirm that the winsock DLL supports 2.2 */
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
263 /* Note that if the DLL supports versions greater than
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
264 2.2 in addition to 2.2, it will still return 2.2 in
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
265 wVersion since that is the version we requested. */
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
266
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
267 if ( LOBYTE( wsaData.wVersion ) != 2 ||
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
268 HIBYTE( wsaData.wVersion ) != 2 ) {
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
269 debug_printf("Could not find a usable WinSock DLL. Oh well.\n");
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
270 WSACleanup( );
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
271 return 1;
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
272 }
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
273
3856
50ac7e205045 [gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3630
diff changeset
274 /* get default locale */
50ac7e205045 [gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3630
diff changeset
275 locale = g_win32_getlocale();
50ac7e205045 [gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3630
diff changeset
276 debug_printf("Language profile used: %s\n", locale);
50ac7e205045 [gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3630
diff changeset
277
50ac7e205045 [gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3630
diff changeset
278 /*
50ac7e205045 [gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3630
diff changeset
279 * Aspell config
50ac7e205045 [gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3630
diff changeset
280 */
50ac7e205045 [gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3630
diff changeset
281 /* Set LANG env var */
50ac7e205045 [gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3630
diff changeset
282 sprintf(newenv, "LANG=%s", locale);
50ac7e205045 [gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3630
diff changeset
283 if(putenv(newenv)<0)
50ac7e205045 [gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3630
diff changeset
284 debug_printf("putenv failed\n");
50ac7e205045 [gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3630
diff changeset
285 g_free(locale);
3905
3e508dd31b76 [gaim-migrate @ 4058]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3856
diff changeset
286
3907
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
287 /*
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
288 * IdleTracker Initialization
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
289 */
3905
3e508dd31b76 [gaim-migrate @ 4058]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3856
diff changeset
290 if(!IdleTrackerInit())
3e508dd31b76 [gaim-migrate @ 4058]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3856
diff changeset
291 debug_printf("IdleTracker failed to initialize\n");
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
292 }
3856
50ac7e205045 [gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3630
diff changeset
293
3907
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
294 /* Windows Cleanup */
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
295
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
296 void wgaim_cleanup(void) {
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
297 debug_printf("wgaim_cleanup\n");
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
298
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
299 /* winsock cleanup */
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
300 WSACleanup( );
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
301
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
302 /* IdleTracker cleanup */
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
303 IdleTrackerTerm();
3950
c25cf0495533 [gaim-migrate @ 4129]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3907
diff changeset
304
c25cf0495533 [gaim-migrate @ 4129]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3907
diff changeset
305 /* Remove systray icon */
c25cf0495533 [gaim-migrate @ 4129]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3907
diff changeset
306 wgaim_systray_cleanup();
3907
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
307 }
41e7544a9c67 [gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3905
diff changeset
308
3950
c25cf0495533 [gaim-migrate @ 4129]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3907
diff changeset
309 /* DLL initializer */
3856
50ac7e205045 [gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3630
diff changeset
310 BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved ) {
50ac7e205045 [gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3630
diff changeset
311 gaimdll_hInstance = hinstDLL;
50ac7e205045 [gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3630
diff changeset
312 return TRUE;
50ac7e205045 [gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3630
diff changeset
313 }