| 525 theme_got_url(void *data, const char *themedata, size_t len) |
525 theme_got_url(void *data, const char *themedata, size_t len) |
| 526 { |
526 { |
| 527 FILE *f; |
527 FILE *f; |
| 528 gchar *path; |
528 gchar *path; |
| 529 |
529 |
| |
530 if (len == 0) |
| |
531 return; |
| |
532 |
| 530 f = gaim_mkstemp(&path, TRUE); |
533 f = gaim_mkstemp(&path, TRUE); |
| 531 fwrite(themedata, len, 1, f); |
534 fwrite(themedata, len, 1, f); |
| 532 fclose(f); |
535 fclose(f); |
| 533 |
536 |
| 534 theme_install_theme(path, data); |
537 theme_install_theme(path, data); |
| 559 theme_install_theme(tmp, NULL); |
562 theme_install_theme(tmp, NULL); |
| 560 g_free(tmp); |
563 g_free(tmp); |
| 561 } else if (!g_ascii_strncasecmp(name, "http://", 7)) { |
564 } else if (!g_ascii_strncasecmp(name, "http://", 7)) { |
| 562 /* Oo, a web drag and drop. This is where things |
565 /* Oo, a web drag and drop. This is where things |
| 563 * will start to get interesting */ |
566 * will start to get interesting */ |
| 564 gchar *tail; |
|
| 565 |
|
| 566 if ((tail = strrchr(name, '.')) == NULL) |
|
| 567 return; |
|
| 568 |
|
| 569 /* We'll check this just to make sure. This also lets us do something different on |
|
| 570 * other platforms, if need be */ |
|
| 571 gaim_url_fetch(name, TRUE, NULL, FALSE, theme_got_url, ".tgz"); |
567 gaim_url_fetch(name, TRUE, NULL, FALSE, theme_got_url, ".tgz"); |
| |
568 } else if (!g_ascii_strncasecmp(name, "https://", 8)) { |
| |
569 /* gaim_url_fetch() doesn't support HTTPS, but we want users |
| |
570 * to be able to drag and drop links from the SF trackers, so |
| |
571 * we'll try it as an HTTP URL. */ |
| |
572 char *tmp = g_strdup(name + 1); |
| |
573 tmp[0] = 'h'; |
| |
574 tmp[1] = 't'; |
| |
575 tmp[2] = 't'; |
| |
576 tmp[3] = 'p'; |
| |
577 gaim_url_fetch(tmp, TRUE, NULL, FALSE, theme_got_url, ".tgz"); |
| |
578 g_free(tmp); |
| 572 } |
579 } |
| 573 |
580 |
| 574 gtk_drag_finish(dc, TRUE, FALSE, t); |
581 gtk_drag_finish(dc, TRUE, FALSE, t); |
| 575 } |
582 } |
| 576 |
583 |