Mercurial > pidgin
comparison src/prefs.c @ 5007:414b6a68578f
[gaim-migrate @ 5342]
Enabled dnd theme install for win32
committer: Tailor Script <tailor@pidgin.im>
author | Herman Bloggs <hermanator12002@yahoo.com> |
---|---|
date | Sat, 05 Apr 2003 01:11:57 +0000 |
parents | 2c191ee5cd7a |
children | 330a78666a5b |
comparison
equal
deleted
inserted
replaced
5006:1f27b4e54855 | 5007:414b6a68578f |
---|---|
259 | 259 |
260 void theme_install_theme(char *path, char *extn) { | 260 void theme_install_theme(char *path, char *extn) { |
261 gchar *command; | 261 gchar *command; |
262 gchar *destdir; | 262 gchar *destdir; |
263 gchar *tail; | 263 gchar *tail; |
264 gchar *tmp; | |
265 GError *converr = NULL; | |
264 | 266 |
265 /* Just to be safe */ | 267 /* Just to be safe */ |
266 g_strchomp(path); | 268 g_strchomp(path); |
269 | |
270 if(!(tmp = g_filename_from_uri(path, NULL, &converr))) { | |
271 debug_printf("%s\n", converr ? converr->message : "g_filename_from_uri error"); | |
272 return; | |
273 } | |
267 | 274 |
268 /* I dont know what you are, get out of here */ | 275 /* I dont know what you are, get out of here */ |
269 if (extn != NULL) | 276 if (extn != NULL) |
270 tail = extn; | 277 tail = extn; |
271 else if ((tail = strrchr(path, '.')) == NULL) | 278 else if ((tail = strrchr(tmp, '.')) == NULL) { |
279 g_free(tmp); | |
272 return; | 280 return; |
273 | 281 } |
274 destdir = g_strconcat(gaim_user_dir(), G_DIR_SEPARATOR_S "smileys", NULL); | 282 destdir = g_strconcat(gaim_user_dir(), G_DIR_SEPARATOR_S "smileys", NULL); |
275 | 283 |
276 /* We'll check this just to make sure. This also lets us do something different on | 284 /* We'll check this just to make sure. This also lets us do something different on |
277 * other platforms, if need be */ | 285 * other platforms, if need be */ |
278 if (!g_ascii_strcasecmp(tail, ".gz") || !g_ascii_strcasecmp(tail, ".tgz")) | 286 if (!g_ascii_strcasecmp(tail, ".gz") || !g_ascii_strcasecmp(tail, ".tgz")) { |
287 #ifndef _WIN32 | |
279 command = g_strdup_printf("tar > /dev/null xzf \"%s\" -C %s", path, destdir); | 288 command = g_strdup_printf("tar > /dev/null xzf \"%s\" -C %s", path, destdir); |
289 #else | |
290 if(!wgaim_gz_untar(tmp, destdir)) { | |
291 g_free(destdir); | |
292 g_free(tmp); | |
293 return; | |
294 } | |
295 #endif | |
296 } | |
280 else { | 297 else { |
298 g_free(tmp); | |
281 g_free(destdir); | 299 g_free(destdir); |
282 return; | 300 return; |
283 } | 301 } |
284 | 302 |
303 #ifndef _WIN32 | |
285 /* Fire! */ | 304 /* Fire! */ |
286 system(command); | 305 system(command); |
287 | 306 |
288 g_free(command); | 307 g_free(command); |
308 #endif | |
309 g_free(tmp); | |
289 g_free(destdir); | 310 g_free(destdir); |
290 | 311 |
291 theme_refresh_theme_list(); | 312 theme_refresh_theme_list(); |
292 } | 313 } |
293 | 314 |
314 * Let's do something with it */ | 335 * Let's do something with it */ |
315 | 336 |
316 if (!g_ascii_strncasecmp(name, "file://", 7)) { | 337 if (!g_ascii_strncasecmp(name, "file://", 7)) { |
317 /* It looks like we're dealing with a local file. Let's | 338 /* It looks like we're dealing with a local file. Let's |
318 * just untar it in the right place */ | 339 * just untar it in the right place */ |
319 theme_install_theme(name + 7, NULL); | 340 theme_install_theme(name, NULL); |
320 } else if (!g_ascii_strncasecmp(name, "http://", 7)) { | 341 } else if (!g_ascii_strncasecmp(name, "http://", 7)) { |
321 /* Oo, a web drag and drop. This is where things | 342 /* Oo, a web drag and drop. This is where things |
322 * will start to get interesting */ | 343 * will start to get interesting */ |
323 gchar *tail; | 344 gchar *tail; |
324 | 345 |