pidgin/win32/gtkwin32dep.c

branch
next.minor
changeset 29508
26abf4ffa828
parent 24053
4ef3a40e1d9e
child 29635
e30bf262a1f2
equal deleted inserted replaced
29507:5cacea67b489 29508:26abf4ffa828
140 } 140 }
141 } 141 }
142 142
143 void winpidgin_shell_execute(const char *target, const char *verb, const char *clazz) { 143 void winpidgin_shell_execute(const char *target, const char *verb, const char *clazz) {
144 144
145 SHELLEXECUTEINFOW wsinfo;
146 wchar_t *w_uri, *w_verb, *w_clazz = NULL;
147
145 g_return_if_fail(target != NULL); 148 g_return_if_fail(target != NULL);
146 g_return_if_fail(verb != NULL); 149 g_return_if_fail(verb != NULL);
147 150
148 if (G_WIN32_HAVE_WIDECHAR_API()) { 151 w_uri = g_utf8_to_utf16(target, -1, NULL, NULL, NULL);
149 SHELLEXECUTEINFOW wsinfo; 152 w_verb = g_utf8_to_utf16(verb, -1, NULL, NULL, NULL);
150 wchar_t *w_uri, *w_verb, *w_clazz = NULL; 153
151 154 memset(&wsinfo, 0, sizeof(wsinfo));
152 w_uri = g_utf8_to_utf16(target, -1, NULL, NULL, NULL); 155 wsinfo.cbSize = sizeof(wsinfo);
153 w_verb = g_utf8_to_utf16(verb, -1, NULL, NULL, NULL); 156 wsinfo.lpVerb = w_verb;
154 157 wsinfo.lpFile = w_uri;
155 memset(&wsinfo, 0, sizeof(wsinfo)); 158 wsinfo.nShow = SW_SHOWNORMAL;
156 wsinfo.cbSize = sizeof(wsinfo); 159 if (clazz != NULL) {
157 wsinfo.lpVerb = w_verb; 160 w_clazz = g_utf8_to_utf16(clazz, -1, NULL, NULL, NULL);
158 wsinfo.lpFile = w_uri; 161 wsinfo.fMask |= SEE_MASK_CLASSNAME;
159 wsinfo.nShow = SW_SHOWNORMAL; 162 wsinfo.lpClass = w_clazz;
160 if (clazz != NULL) { 163 }
161 w_clazz = g_utf8_to_utf16(clazz, -1, NULL, NULL, NULL); 164
162 wsinfo.fMask |= SEE_MASK_CLASSNAME; 165 if(!ShellExecuteExW(&wsinfo))
163 wsinfo.lpClass = w_clazz; 166 purple_debug_error("winpidgin", "Error opening URI: %s error: %d\n",
164 } 167 target, (int) wsinfo.hInstApp);
165 168
166 if(!ShellExecuteExW(&wsinfo)) 169 g_free(w_uri);
167 purple_debug_error("winpidgin", "Error opening URI: %s error: %d\n", 170 g_free(w_verb);
168 target, (int) wsinfo.hInstApp); 171 g_free(w_clazz);
169
170 g_free(w_uri);
171 g_free(w_verb);
172 g_free(w_clazz);
173 } else {
174 SHELLEXECUTEINFOA sinfo;
175 gchar *locale_uri;
176
177 locale_uri = g_locale_from_utf8(target, -1, NULL, NULL, NULL);
178
179 memset(&sinfo, 0, sizeof(sinfo));
180 sinfo.cbSize = sizeof(sinfo);
181 sinfo.lpVerb = verb;
182 sinfo.lpFile = locale_uri;
183 sinfo.nShow = SW_SHOWNORMAL;
184 if (clazz != NULL) {
185 sinfo.fMask |= SEE_MASK_CLASSNAME;
186 sinfo.lpClass = clazz;
187 }
188
189 if(!ShellExecuteExA(&sinfo))
190 purple_debug_error("winpidgin", "Error opening URI: %s error: %d\n",
191 target, (int) sinfo.hInstApp);
192
193 g_free(locale_uri);
194 }
195 172
196 } 173 }
197 174
198 void winpidgin_notify_uri(const char *uri) { 175 void winpidgin_notify_uri(const char *uri) {
199 /* We'll allow whatever URI schemes are supported by the 176 /* We'll allow whatever URI schemes are supported by the

mercurial