| 129 gaim_debug_error("gtkwgaim_gz_untar", "Failed to gz decompress %s\n", filename); |
129 gaim_debug_error("gtkwgaim_gz_untar", "Failed to gz decompress %s\n", filename); |
| 130 return 0; |
130 return 0; |
| 131 } |
131 } |
| 132 } |
132 } |
| 133 |
133 |
| |
134 void gtkwgaim_shell_execute(const char *target, const char *verb, const char *clazz) { |
| |
135 |
| |
136 g_return_if_fail(target != NULL); |
| |
137 g_return_if_fail(verb != NULL); |
| |
138 |
| |
139 if (G_WIN32_HAVE_WIDECHAR_API()) { |
| |
140 SHELLEXECUTEINFOW wsinfo; |
| |
141 wchar_t *w_uri, *w_verb, *w_clazz = NULL; |
| |
142 |
| |
143 w_uri = g_utf8_to_utf16(target, -1, NULL, NULL, NULL); |
| |
144 w_verb = g_utf8_to_utf16(verb, -1, NULL, NULL, NULL); |
| |
145 |
| |
146 memset(&wsinfo, 0, sizeof(wsinfo)); |
| |
147 wsinfo.cbSize = sizeof(wsinfo); |
| |
148 wsinfo.lpVerb = w_verb; |
| |
149 wsinfo.lpFile = w_uri; |
| |
150 wsinfo.nShow = SW_SHOWNORMAL; |
| |
151 if (clazz != NULL) { |
| |
152 w_clazz = g_utf8_to_utf16(clazz, -1, NULL, NULL, NULL); |
| |
153 wsinfo.fMask |= SEE_MASK_CLASSNAME; |
| |
154 wsinfo.lpClass = w_clazz; |
| |
155 } |
| |
156 |
| |
157 if(!ShellExecuteExW(&wsinfo)) |
| |
158 gaim_debug_error("gtkwgaim", "Error opening URI: %s error: %d\n", |
| |
159 target, (int) wsinfo.hInstApp); |
| |
160 |
| |
161 g_free(w_uri); |
| |
162 g_free(w_verb); |
| |
163 g_free(w_clazz); |
| |
164 } else { |
| |
165 SHELLEXECUTEINFOA sinfo; |
| |
166 gchar *locale_uri; |
| |
167 |
| |
168 locale_uri = g_locale_from_utf8(target, -1, NULL, NULL, NULL); |
| |
169 |
| |
170 memset(&sinfo, 0, sizeof(sinfo)); |
| |
171 sinfo.cbSize = sizeof(sinfo); |
| |
172 sinfo.lpVerb = verb; |
| |
173 sinfo.lpFile = locale_uri; |
| |
174 sinfo.nShow = SW_SHOWNORMAL; |
| |
175 if (clazz != NULL) { |
| |
176 sinfo.fMask |= SEE_MASK_CLASSNAME; |
| |
177 sinfo.lpClass = clazz; |
| |
178 } |
| |
179 |
| |
180 if(!ShellExecuteExA(&sinfo)) |
| |
181 gaim_debug_error("gtkwgaim", "Error opening URI: %s error: %d\n", |
| |
182 target, (int) sinfo.hInstApp); |
| |
183 |
| |
184 g_free(locale_uri); |
| |
185 } |
| |
186 |
| |
187 } |
| |
188 |
| 134 void gtkwgaim_notify_uri(const char *uri) { |
189 void gtkwgaim_notify_uri(const char *uri) { |
| 135 |
|
| 136 /* We'll allow whatever URI schemes are supported by the |
190 /* We'll allow whatever URI schemes are supported by the |
| 137 * default http browser. |
191 * default http browser. |
| 138 */ |
192 */ |
| 139 |
193 gtkwgaim_shell_execute(uri, "open", "http"); |
| 140 if (G_WIN32_HAVE_WIDECHAR_API()) { |
|
| 141 SHELLEXECUTEINFOW wsinfo; |
|
| 142 wchar_t *w_uri; |
|
| 143 |
|
| 144 w_uri = g_utf8_to_utf16(uri, -1, NULL, NULL, NULL); |
|
| 145 |
|
| 146 memset(&wsinfo, 0, sizeof(wsinfo)); |
|
| 147 wsinfo.cbSize = sizeof(wsinfo); |
|
| 148 wsinfo.fMask = SEE_MASK_CLASSNAME; |
|
| 149 wsinfo.lpVerb = L"open"; |
|
| 150 wsinfo.lpFile = w_uri; |
|
| 151 wsinfo.nShow = SW_SHOWNORMAL; |
|
| 152 wsinfo.lpClass = L"http"; |
|
| 153 |
|
| 154 if(!ShellExecuteExW(&wsinfo)) |
|
| 155 gaim_debug_error("gtkwgaim", "Error opening URI: %s error: %d\n", |
|
| 156 uri, (int) wsinfo.hInstApp); |
|
| 157 |
|
| 158 g_free(w_uri); |
|
| 159 } else { |
|
| 160 SHELLEXECUTEINFOA sinfo; |
|
| 161 gchar *locale_uri; |
|
| 162 |
|
| 163 locale_uri = g_locale_from_utf8(uri, -1, NULL, NULL, NULL); |
|
| 164 |
|
| 165 memset(&sinfo, 0, sizeof(sinfo)); |
|
| 166 sinfo.cbSize = sizeof(sinfo); |
|
| 167 sinfo.fMask = SEE_MASK_CLASSNAME; |
|
| 168 sinfo.lpVerb = "open"; |
|
| 169 sinfo.lpFile = locale_uri; |
|
| 170 sinfo.nShow = SW_SHOWNORMAL; |
|
| 171 sinfo.lpClass = "http"; |
|
| 172 |
|
| 173 if(!ShellExecuteExA(&sinfo)) |
|
| 174 gaim_debug_error("gtkwgaim", "Error opening URI: %s error: %d\n", |
|
| 175 uri, (int) sinfo.hInstApp); |
|
| 176 |
|
| 177 g_free(locale_uri); |
|
| 178 } |
|
| 179 } |
194 } |
| 180 |
195 |
| 181 #define WM_FOCUS_REQUEST (WM_APP + 13) |
196 #define WM_FOCUS_REQUEST (WM_APP + 13) |
| 182 |
197 |
| 183 static LRESULT CALLBACK message_window_handler(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { |
198 static LRESULT CALLBACK message_window_handler(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { |