annotate gtk/win32/gtkwin32dep.c @ 14224:ab8a105eff62

[gaim-migrate @ 16905] First step of getting wingaim working again. libgaim and gtk are compiling. The protocols aren't compiling yet. There are a number of things that are compiling, but should be cleaned up. committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Sun, 20 Aug 2006 16:49:37 +0000
parents
children 14933d9055a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14224
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
1 /*
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
2 * gaim
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
3 *
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
4 * File: gtkwin32dep.c
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
5 * Date: June, 2002
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
6 * Description: Windows dependant code for Gaim
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
7 *
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
8 * Copyright (C) 2002-2003, Herman Bloggs <hermanator12002@yahoo.com>
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
9 *
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
10 * This program is free software; you can redistribute it and/or modify
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
11 * it under the terms of the GNU General Public License as published by
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
12 * the Free Software Foundation; either version 2 of the License, or
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
13 * (at your option) any later version.
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
14 *
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
15 * This program is distributed in the hope that it will be useful,
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
18 * GNU General Public License for more details.
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
19 *
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
21 * along with this program; if not, write to the Free Software
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
23 *
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
24 */
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
25 #define _WIN32_IE 0x500
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
26 #include <windows.h>
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
27 #include <io.h>
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
28 #include <stdlib.h>
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
29 #include <stdio.h>
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
30 #include <winuser.h>
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
31
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
32 #include <glib.h>
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
33 #include <glib/gstdio.h>
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
34 #include <gtk/gtk.h>
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
35
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
36 #include "gaim.h"
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
37 #include "debug.h"
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
38 #include "notify.h"
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
39
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
40 #include "resource.h"
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
41 #include "idletrack.h"
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
42 #include "zlib.h"
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
43 #include "untar.h"
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
44
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
45 #include <libintl.h>
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
46
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
47 #include "gtkwin32dep.h"
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
48
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
49 #include "wspell.h"
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
50
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
51 /*
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
52 * GLOBALS
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
53 */
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
54 HINSTANCE gaimexe_hInstance = 0;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
55 HINSTANCE gtkgaimdll_hInstance = 0;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
56
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
57 /*
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
58 * PUBLIC CODE
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
59 */
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
60
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
61 HINSTANCE gtkwgaim_hinstance(void) {
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
62 return gaimexe_hInstance;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
63 }
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
64
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
65 int gtkwgaim_gz_decompress(const char* in, const char* out) {
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
66 gzFile fin;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
67 FILE *fout;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
68 char buf[1024];
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
69 int ret;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
70
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
71 if((fin = gzopen(in, "rb"))) {
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
72 if(!(fout = g_fopen(out, "wb"))) {
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
73 gaim_debug(GAIM_DEBUG_ERROR, "wgaim_gz_decompress", "Error opening file: %s\n", out);
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
74 gzclose(fin);
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
75 return 0;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
76 }
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
77 }
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
78 else {
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
79 gaim_debug(GAIM_DEBUG_ERROR, "wgaim_gz_decompress", "gzopen failed to open: %s\n", in);
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
80 return 0;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
81 }
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
82
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
83 while((ret = gzread(fin, buf, 1024))) {
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
84 if(fwrite(buf, 1, ret, fout) < ret) {
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
85 gaim_debug(GAIM_DEBUG_ERROR, "wgaim_gz_decompress", "Error writing %d bytes to file\n", ret);
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
86 gzclose(fin);
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
87 fclose(fout);
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
88 return 0;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
89 }
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
90 }
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
91 fclose(fout);
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
92 gzclose(fin);
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
93
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
94 if(ret < 0) {
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
95 gaim_debug(GAIM_DEBUG_ERROR, "wgaim_gz_decompress", "gzread failed while reading: %s\n", in);
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
96 return 0;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
97 }
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
98
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
99 return 1;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
100 }
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
101
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
102 int gtkwgaim_gz_untar(const char* filename, const char* destdir) {
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
103 char tmpfile[_MAX_PATH];
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
104 char template[]="wgaimXXXXXX";
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
105
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
106 sprintf(tmpfile, "%s%s%s", g_get_tmp_dir(), G_DIR_SEPARATOR_S, _mktemp(template));
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
107 if(gtkwgaim_gz_decompress(filename, tmpfile)) {
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
108 int ret;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
109 if(untar(tmpfile, destdir, UNTAR_FORCE | UNTAR_QUIET))
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
110 ret = 1;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
111 else {
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
112 gaim_debug(GAIM_DEBUG_ERROR, "wgaim_gz_untar", "Failure untaring %s\n", tmpfile);
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
113 ret = 0;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
114 }
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
115 g_unlink(tmpfile);
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
116 return ret;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
117 }
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
118 else {
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
119 gaim_debug(GAIM_DEBUG_ERROR, "wgaim_gz_untar", "Failed to gz decompress %s\n", filename);
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
120 return 0;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
121 }
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
122 }
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
123
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
124 void gtkwgaim_notify_uri(const char *uri) {
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
125
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
126 /* We'll allow whatever URI schemes are supported by the
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
127 * default http browser.
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
128 */
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
129
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
130 if (G_WIN32_HAVE_WIDECHAR_API()) {
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
131 SHELLEXECUTEINFOW wsinfo;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
132 wchar_t *w_uri;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
133
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
134 w_uri = g_utf8_to_utf16(uri, -1, NULL, NULL, NULL);
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
135
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
136 memset(&wsinfo, 0, sizeof(wsinfo));
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
137 wsinfo.cbSize = sizeof(wsinfo);
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
138 wsinfo.fMask = SEE_MASK_CLASSNAME;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
139 wsinfo.lpVerb = L"open";
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
140 wsinfo.lpFile = w_uri;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
141 wsinfo.nShow = SW_SHOWNORMAL;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
142 wsinfo.lpClass = L"http";
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
143
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
144 gaim_debug(GAIM_DEBUG_INFO, "wgaim_notify_uri", "The wide uri is %s\n", uri);
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
145 if(!ShellExecuteExW(&wsinfo))
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
146 gaim_debug_error("wgaim", "Error opening URI: %s error: %d\n",
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
147 uri, (int) wsinfo.hInstApp);
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
148
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
149 g_free(w_uri);
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
150 } else {
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
151 SHELLEXECUTEINFOA sinfo;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
152 gchar *locale_uri;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
153
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
154 locale_uri = g_locale_from_utf8(uri, -1, NULL, NULL, NULL);
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
155
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
156 memset(&sinfo, 0, sizeof(sinfo));
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
157 sinfo.cbSize = sizeof(sinfo);
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
158 sinfo.fMask = SEE_MASK_CLASSNAME;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
159 sinfo.lpVerb = "open";
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
160 sinfo.lpFile = locale_uri;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
161 sinfo.nShow = SW_SHOWNORMAL;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
162 sinfo.lpClass = "http";
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
163
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
164 if(!ShellExecuteExA(&sinfo))
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
165 gaim_debug_error("wgaim", "Error opening URI: %s error: %d\n",
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
166 uri, (int) sinfo.hInstApp);
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
167
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
168 g_free(locale_uri);
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
169 }
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
170 }
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
171
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
172 void gtkwgaim_init(HINSTANCE hint) {
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
173 gaim_debug_info("gtkwgaim", "gtkwgaim_init start\n");
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
174
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
175 gaimexe_hInstance = hint;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
176
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
177 /* IdleTracker Initialization */
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
178 if(!wgaim_set_idlehooks())
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
179 gaim_debug(GAIM_DEBUG_ERROR, "gtkwgaim", "Failed to initialize idle tracker\n");
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
180
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
181 wgaim_gtkspell_init();
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
182 gaim_debug_info("gtkwgaim", "GTK+ :%u.%u.%u\n",
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
183 gtk_major_version, gtk_minor_version, gtk_micro_version);
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
184
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
185 gaim_debug(GAIM_DEBUG_INFO, "gtkwgaim", "gtkwgaim_init end\n");
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
186 }
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
187
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
188 /* Windows Cleanup */
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
189
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
190 void gtkwgaim_cleanup(void) {
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
191 gaim_debug(GAIM_DEBUG_INFO, "gtkwgaim", "gtkwgaim_cleanup\n");
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
192
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
193 /* Idle tracker cleanup */
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
194 wgaim_remove_idlehooks();
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
195
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
196 }
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
197
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
198 /* DLL initializer */
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
199 BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved ) {
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
200 gtkgaimdll_hInstance = hinstDLL;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
201 return TRUE;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
202 }