comparison pidgin/gtkprefs.c @ 28656:a177a1cdfe4e

merged with im.pidgin.pidgin
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Thu, 24 Sep 2009 16:02:36 +0900
parents 493f48f8d17f a21d3f8b4cf8
children 291c89bfe040
comparison
equal deleted inserted replaced
28621:ce5593e0e1dc 28656:a177a1cdfe4e
457 } 457 }
458 458
459 return row_ref; 459 return row_ref;
460 } 460 }
461 461
462 static gchar *
463 get_theme_markup(const char *name, gboolean custom, const char *author,
464 const char *description)
465 {
466
467 return g_strdup_printf("<b>%s</b>%s%s%s%s\n<span foreground='dim grey'>%s</span>",
468 name, custom ? " " : "", custom ? _("(Custom)") : "",
469 author != NULL ? " - " : "", author != NULL ? author : "",
470 description != NULL ? description : "");
471 }
472
462 /* Rebuild the markup for the sound theme selection for "(Custom)" themes */ 473 /* Rebuild the markup for the sound theme selection for "(Custom)" themes */
463 static void 474 static void
464 pref_sound_generate_markup(void) 475 pref_sound_generate_markup(void)
465 { 476 {
466 gboolean print_custom, customized; 477 gboolean print_custom, customized;
467 const gchar *name, *author, *description, *current_theme; 478 const gchar *author, *description, *current_theme;
468 gchar *markup; 479 gchar *name, *markup;
469 PurpleSoundTheme *theme; 480 PurpleSoundTheme *theme;
470 GtkTreeIter iter; 481 GtkTreeIter iter;
471 482
472 customized = pidgin_sound_is_customized(); 483 customized = pidgin_sound_is_customized();
473 current_theme = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/theme"); 484 current_theme = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/theme");
474 485
475 if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(prefs_sound_themes), &iter)) { 486 if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(prefs_sound_themes), &iter)) {
476 do { 487 do {
477 gtk_tree_model_get(GTK_TREE_MODEL(prefs_sound_themes), &iter, 2, &name, -1); 488 gtk_tree_model_get(GTK_TREE_MODEL(prefs_sound_themes), &iter, 2, &name, -1);
478 489
479 print_custom = customized && g_str_equal(current_theme, name); 490 print_custom = customized && name && g_str_equal(current_theme, name);
480 491
481 if (!name || *name == '\0') 492 if (!name || *name == '\0') {
482 markup = g_strdup_printf("<b>(Default)</b>%s%s - None\n<span foreground='dim grey'>The default Pidgin sound theme</span>", 493 g_free(name);
483 print_custom ? " " : "", print_custom ? "(Custom)" : ""); 494 name = g_strdup(_("(Default)"));
484 else { 495 author = _("None");
496 description = _("The default Pidgin sound theme");
497 } else {
485 theme = PURPLE_SOUND_THEME(purple_theme_manager_find_theme(name, "sound")); 498 theme = PURPLE_SOUND_THEME(purple_theme_manager_find_theme(name, "sound"));
486 author = purple_theme_get_author(PURPLE_THEME(theme)); 499 author = purple_theme_get_author(PURPLE_THEME(theme));
487 description = purple_theme_get_description(PURPLE_THEME(theme)); 500 description = purple_theme_get_description(PURPLE_THEME(theme));
488
489 markup = g_strdup_printf("<b>%s</b>%s%s%s%s\n<span foreground='dim grey'>%s</span>",
490 name, print_custom ? " " : "", print_custom ? "(Custom)" : "",
491 author != NULL ? " - " : "", author != NULL ? author : "", description != NULL ? description : "");
492 } 501 }
493 502
503 markup = get_theme_markup(name, print_custom, author, description);
504
494 gtk_list_store_set(prefs_sound_themes, &iter, 1, markup, -1); 505 gtk_list_store_set(prefs_sound_themes, &iter, 1, markup, -1);
495 506
507 g_free(name);
496 g_free(markup); 508 g_free(markup);
497 509
498 } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(prefs_sound_themes), &iter)); 510 } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(prefs_sound_themes), &iter));
499 } 511 }
500 } 512 }
512 524
513 image_full = purple_theme_get_image_full(theme); 525 image_full = purple_theme_get_image_full(theme);
514 if (image_full != NULL){ 526 if (image_full != NULL){
515 pixbuf = gdk_pixbuf_new_from_file_at_scale(image_full, PREFS_OPTIMAL_ICON_SIZE, PREFS_OPTIMAL_ICON_SIZE, TRUE, NULL); 527 pixbuf = gdk_pixbuf_new_from_file_at_scale(image_full, PREFS_OPTIMAL_ICON_SIZE, PREFS_OPTIMAL_ICON_SIZE, TRUE, NULL);
516 g_free(image_full); 528 g_free(image_full);
517 } else pixbuf = NULL; 529 } else
530 pixbuf = NULL;
518 531
519 gtk_list_store_append(prefs_sound_themes, &iter); 532 gtk_list_store_append(prefs_sound_themes, &iter);
520 gtk_list_store_set(prefs_sound_themes, &iter, 0, pixbuf, 2, purple_theme_get_name(theme), -1); 533 gtk_list_store_set(prefs_sound_themes, &iter, 0, pixbuf, 2, purple_theme_get_name(theme), -1);
521 534
522 if (pixbuf != NULL) 535 if (pixbuf != NULL)
525 } else if (PIDGIN_IS_BLIST_THEME(theme) || PIDGIN_IS_STATUS_ICON_THEME(theme)){ 538 } else if (PIDGIN_IS_BLIST_THEME(theme) || PIDGIN_IS_STATUS_ICON_THEME(theme)){
526 GtkListStore *store; 539 GtkListStore *store;
527 540
528 if (PIDGIN_IS_BLIST_THEME(theme)) 541 if (PIDGIN_IS_BLIST_THEME(theme))
529 store = prefs_blist_themes; 542 store = prefs_blist_themes;
530 else store = prefs_status_icon_themes; 543 else
544 store = prefs_status_icon_themes;
531 545
532 image_full = purple_theme_get_image_full(theme); 546 image_full = purple_theme_get_image_full(theme);
533 if (image_full != NULL){ 547 if (image_full != NULL){
534 pixbuf = gdk_pixbuf_new_from_file_at_scale(image_full, PREFS_OPTIMAL_ICON_SIZE, PREFS_OPTIMAL_ICON_SIZE, TRUE, NULL); 548 pixbuf = gdk_pixbuf_new_from_file_at_scale(image_full, PREFS_OPTIMAL_ICON_SIZE, PREFS_OPTIMAL_ICON_SIZE, TRUE, NULL);
535 g_free(image_full); 549 g_free(image_full);
536 } else pixbuf = NULL; 550 } else
551 pixbuf = NULL;
537 552
538 name = purple_theme_get_name(theme); 553 name = purple_theme_get_name(theme);
539 author = purple_theme_get_author(theme); 554 author = purple_theme_get_author(theme);
540 description = purple_theme_get_description(theme); 555 description = purple_theme_get_description(theme);
541 556
542 markup = g_strdup_printf("<b>%s</b>%s%s\n<span foreground='dim grey'>%s</span>", name, author != NULL ? " - " : "", 557 markup = get_theme_markup(name, FALSE, author, description);
543 author != NULL ? author : "", description != NULL ? description : "");
544 558
545 gtk_list_store_append(store, &iter); 559 gtk_list_store_append(store, &iter);
546 gtk_list_store_set(store, &iter, 0, pixbuf, 1, markup, 2, name, -1); 560 gtk_list_store_set(store, &iter, 0, pixbuf, 1, markup, 2, name, -1);
547 561
548 g_free(markup); 562 g_free(markup);
577 591
578 static void 592 static void
579 prefs_themes_refresh(void) 593 prefs_themes_refresh(void)
580 { 594 {
581 GdkPixbuf *pixbuf = NULL; 595 GdkPixbuf *pixbuf = NULL;
582 gchar *filename; 596 gchar *tmp;
583 GtkTreeIter iter; 597 GtkTreeIter iter;
584 598
585 prefs_sound_themes_loading = TRUE; 599 prefs_sound_themes_loading = TRUE;
586 /* refresh the list of themes in the manager */ 600 /* refresh the list of themes in the manager */
587 purple_theme_manager_refresh(); 601 purple_theme_manager_refresh();
588 602
589 filename = g_build_filename(DATADIR, "icons", "hicolor", "32x32", "apps", "pidgin.png", NULL); 603 tmp = g_build_filename(DATADIR, "icons", "hicolor", "32x32", "apps", "pidgin.png", NULL);
590 pixbuf = gdk_pixbuf_new_from_file_at_scale(filename, PREFS_OPTIMAL_ICON_SIZE, PREFS_OPTIMAL_ICON_SIZE, TRUE, NULL); 604 pixbuf = gdk_pixbuf_new_from_file_at_scale(tmp, PREFS_OPTIMAL_ICON_SIZE, PREFS_OPTIMAL_ICON_SIZE, TRUE, NULL);
591 g_free(filename); 605 g_free(tmp);
592 606
593 /* sound themes */ 607 /* sound themes */
594 gtk_list_store_clear(prefs_sound_themes); 608 gtk_list_store_clear(prefs_sound_themes);
595 gtk_list_store_append(prefs_sound_themes, &iter); 609 gtk_list_store_append(prefs_sound_themes, &iter);
596 gtk_list_store_set(prefs_sound_themes, &iter, 0, pixbuf, 2, "", -1); 610 gtk_list_store_set(prefs_sound_themes, &iter, 0, pixbuf, 2, "", -1);
597 611
598 /* blist themes */ 612 /* blist themes */
599 gtk_list_store_clear(prefs_blist_themes); 613 gtk_list_store_clear(prefs_blist_themes);
600 gtk_list_store_append(prefs_blist_themes, &iter); 614 gtk_list_store_append(prefs_blist_themes, &iter);
601 gtk_list_store_set(prefs_blist_themes, &iter, 0, pixbuf, 1, 615 tmp = get_theme_markup(_("(Default)"), FALSE, _("None"),
602 "<b>(Default)</b> - None\n<span color='dim grey'>" 616 _("The default Pidgin buddy list theme"));
603 "The default Pidgin buddy list theme</span>", 2, "", -1); 617 gtk_list_store_set(prefs_blist_themes, &iter, 0, pixbuf, 1, tmp, 2, "", -1);
618 g_free(tmp);
604 619
605 /* status icon themes */ 620 /* status icon themes */
606 gtk_list_store_clear(prefs_status_icon_themes); 621 gtk_list_store_clear(prefs_status_icon_themes);
607 gtk_list_store_append(prefs_status_icon_themes, &iter); 622 gtk_list_store_append(prefs_status_icon_themes, &iter);
608 gtk_list_store_set(prefs_status_icon_themes, &iter, 0, pixbuf, 1, 623 tmp = get_theme_markup(_("(Default)"), FALSE, _("None"),
609 "<b>(Default)</b> - None\n<span color='dim grey'>" 624 _("The default Pidgin status icon theme"));
610 "The default Pidgin status icon theme</span>", 2, "", -1); 625 gtk_list_store_set(prefs_status_icon_themes, &iter, 0, pixbuf, 1, tmp, 2, "", -1);
626 g_free(tmp);
611 g_object_unref(G_OBJECT(pixbuf)); 627 g_object_unref(G_OBJECT(pixbuf));
612 628
613 purple_theme_manager_for_each_theme(prefs_themes_sort); 629 purple_theme_manager_for_each_theme(prefs_themes_sort);
614 pref_sound_generate_markup(); 630 pref_sound_generate_markup();
615 631
674 fclose(src); 690 fclose(src);
675 691
676 return TRUE; 692 return TRUE;
677 } 693 }
678 694
695 static void
696 free_theme_info(struct theme_info *info)
697 {
698 if (info != NULL) {
699 g_free(info->type);
700 g_free(info->extension);
701 g_free(info->original_name);
702 g_free(info);
703 }
704 }
705
679 /* installs a theme, info is freed by function */ 706 /* installs a theme, info is freed by function */
680 static void 707 static void
681 theme_install_theme(char *path, struct theme_info *info) 708 theme_install_theme(char *path, struct theme_info *info)
682 { 709 {
683 #ifndef _WIN32 710 #ifndef _WIN32
684 gchar *command; 711 gchar *command;
685 #endif 712 #endif
686 gchar *destdir, *tail, *type, *original_name; 713 gchar *destdir;
714 const char *tail;
687 GtkTreeRowReference *theme_rowref; 715 GtkTreeRowReference *theme_rowref;
688 gboolean is_smiley_theme, is_archive; 716 gboolean is_smiley_theme, is_archive;
689 PurpleTheme *theme = NULL; 717 PurpleTheme *theme = NULL;
690 718
691 if (info == NULL) 719 if (info == NULL)
692 return; 720 return;
693 721
694 original_name = info->original_name;
695 type = info->type;
696
697 /* check the extension */ 722 /* check the extension */
698 tail = info->extension ? info->extension : g_strdup(strrchr(path, '.')); 723 tail = info->extension ? info->extension : strrchr(path, '.');
699 724
700 if (!tail) { 725 if (!tail) {
701 g_free(type); 726 free_theme_info(info);
702 g_free(original_name);
703 g_free(info);
704 return; 727 return;
705 } else 728 }
706 g_free(info);
707 729
708 is_archive = !g_ascii_strcasecmp(tail, ".gz") || !g_ascii_strcasecmp(tail, ".tgz"); 730 is_archive = !g_ascii_strcasecmp(tail, ".gz") || !g_ascii_strcasecmp(tail, ".tgz");
709
710 g_free(tail);
711 731
712 /* Just to be safe */ 732 /* Just to be safe */
713 g_strchomp(path); 733 g_strchomp(path);
714 734
715 if ((is_smiley_theme = g_str_equal(type, "smiley"))) 735 if ((is_smiley_theme = g_str_equal(info->type, "smiley")))
716 destdir = g_build_filename(purple_user_dir(), "smileys", NULL); 736 destdir = g_build_filename(purple_user_dir(), "smileys", NULL);
717 else destdir = g_build_filename(purple_user_dir(), "themes", "temp", NULL); 737 else
738 destdir = g_build_filename(purple_user_dir(), "themes", "temp", NULL);
718 739
719 /* We'll check this just to make sure. This also lets us do something different on 740 /* We'll check this just to make sure. This also lets us do something different on
720 * other platforms, if need be */ 741 * other platforms, if need be */
721 if (is_archive) { 742 if (is_archive) {
722 #ifndef _WIN32 743 #ifndef _WIN32
733 /* Fire! */ 754 /* Fire! */
734 if (system(command)) { 755 if (system(command)) {
735 purple_notify_error(NULL, NULL, _("Theme failed to unpack."), NULL); 756 purple_notify_error(NULL, NULL, _("Theme failed to unpack."), NULL);
736 g_free(command); 757 g_free(command);
737 g_free(destdir); 758 g_free(destdir);
738 g_free(type); 759 free_theme_info(info);
739 g_free(original_name);
740 return; 760 return;
741 } 761 }
742 #else 762 #else
743 if(!winpidgin_gz_untar(path, destdir)) { 763 if (!winpidgin_gz_untar(path, destdir)) {
764 purple_notify_error(NULL, NULL, _("Theme failed to unpack."), NULL);
744 g_free(destdir); 765 g_free(destdir);
745 g_free(type); 766 free_theme_info(info);
746 g_free(original_name);
747 return; 767 return;
748 } 768 }
749 #endif 769 #endif
750 } 770 }
751 771
761 781
762 gtk_tree_row_reference_free(theme_rowref); 782 gtk_tree_row_reference_free(theme_rowref);
763 } 783 }
764 784
765 } else if (is_archive) { 785 } else if (is_archive) {
766 theme = prefs_theme_find_theme(destdir, type); 786 theme = prefs_theme_find_theme(destdir, info->type);
767 787
768 if (PURPLE_IS_THEME(theme)) { 788 if (PURPLE_IS_THEME(theme)) {
769 /* create the location for the theme */ 789 /* create the location for the theme */
770 gchar *theme_dest = g_build_filename(purple_user_dir(), "themes", 790 gchar *theme_dest = g_build_filename(purple_user_dir(), "themes",
771 purple_theme_get_name(theme), 791 purple_theme_get_name(theme),
772 "purple", type, NULL); 792 "purple", info->type, NULL);
773 793
774 if (!g_file_test(theme_dest, G_FILE_TEST_IS_DIR)) 794 if (!g_file_test(theme_dest, G_FILE_TEST_IS_DIR))
775 purple_build_dir(theme_dest, S_IRUSR | S_IWUSR | S_IXUSR); 795 purple_build_dir(theme_dest, S_IRUSR | S_IWUSR | S_IXUSR);
776 796
777 g_free(theme_dest); 797 g_free(theme_dest);
778 theme_dest = g_build_filename(purple_user_dir(), "themes", 798 theme_dest = g_build_filename(purple_user_dir(), "themes",
779 purple_theme_get_name(theme), 799 purple_theme_get_name(theme),
780 "purple", type, NULL); 800 "purple", info->type, NULL);
781 801
782 /* move the entire directory to new location */ 802 /* move the entire directory to new location */
783 g_rename(purple_theme_get_dir(theme), theme_dest); 803 g_rename(purple_theme_get_dir(theme), theme_dest);
784 804
785 g_free(theme_dest); 805 g_free(theme_dest);
797 } else { /* just a single file so copy it to a new temp directory and attempt to load it*/ 817 } else { /* just a single file so copy it to a new temp directory and attempt to load it*/
798 gchar *temp_path, *temp_file; 818 gchar *temp_path, *temp_file;
799 819
800 temp_path = g_build_filename(purple_user_dir(), "themes", "temp", "sub_folder", NULL); 820 temp_path = g_build_filename(purple_user_dir(), "themes", "temp", "sub_folder", NULL);
801 821
802 if (original_name != NULL) { 822 if (info->original_name != NULL) {
803 /* name was changed from the original (probably a dnd) change it back before loading */ 823 /* name was changed from the original (probably a dnd) change it back before loading */
804 temp_file = g_build_filename(temp_path, original_name, NULL); 824 temp_file = g_build_filename(temp_path, info->original_name, NULL);
805 825
806 } else { 826 } else {
807 gchar *source_name = g_path_get_basename(path); 827 gchar *source_name = g_path_get_basename(path);
808 temp_file = g_build_filename(temp_path, source_name, NULL); 828 temp_file = g_build_filename(temp_path, source_name, NULL);
809 g_free(source_name); 829 g_free(source_name);
812 if (!g_file_test(temp_path, G_FILE_TEST_IS_DIR)) 832 if (!g_file_test(temp_path, G_FILE_TEST_IS_DIR))
813 purple_build_dir(temp_path, S_IRUSR | S_IWUSR | S_IXUSR); 833 purple_build_dir(temp_path, S_IRUSR | S_IWUSR | S_IXUSR);
814 834
815 if (purple_theme_file_copy(path, temp_file)) { 835 if (purple_theme_file_copy(path, temp_file)) {
816 /* find the theme, could be in subfolder */ 836 /* find the theme, could be in subfolder */
817 theme = prefs_theme_find_theme(temp_path, type); 837 theme = prefs_theme_find_theme(temp_path, info->type);
818 838
819 if (PURPLE_IS_THEME(theme)) { 839 if (PURPLE_IS_THEME(theme)) {
820 gchar *theme_dest = g_build_filename(purple_user_dir(), "themes", 840 gchar *theme_dest = g_build_filename(purple_user_dir(), "themes",
821 purple_theme_get_name(theme), 841 purple_theme_get_name(theme),
822 "purple", type, NULL); 842 "purple", info->type, NULL);
823 843
824 if(!g_file_test(theme_dest, G_FILE_TEST_IS_DIR)) 844 if(!g_file_test(theme_dest, G_FILE_TEST_IS_DIR))
825 purple_build_dir(theme_dest, S_IRUSR | S_IWUSR | S_IXUSR); 845 purple_build_dir(theme_dest, S_IRUSR | S_IWUSR | S_IXUSR);
826 846
827 g_rename(purple_theme_get_dir(theme), theme_dest); 847 g_rename(purple_theme_get_dir(theme), theme_dest);
840 860
841 g_free(temp_file); 861 g_free(temp_file);
842 g_free(temp_path); 862 g_free(temp_path);
843 } 863 }
844 864
845 g_free(type);
846 g_free(original_name);
847 g_free(destdir); 865 g_free(destdir);
866 free_theme_info(info);
848 } 867 }
849 868
850 static void 869 static void
851 theme_got_url(PurpleUtilFetchUrlData *url_data, gpointer user_data, 870 theme_got_url(PurpleUtilFetchUrlData *url_data, gpointer user_data,
852 const gchar *themedata, size_t len, const gchar *error_message) 871 const gchar *themedata, size_t len, const gchar *error_message)
853 { 872 {
854 FILE *f; 873 FILE *f;
855 gchar *path; 874 gchar *path;
856 size_t wc; 875 size_t wc;
857 876
858 if ((error_message != NULL) || (len == 0)) 877 if ((error_message != NULL) || (len == 0)) {
878 free_theme_info(user_data);
859 return; 879 return;
880 }
860 881
861 f = purple_mkstemp(&path, TRUE); 882 f = purple_mkstemp(&path, TRUE);
862 wc = fwrite(themedata, len, 1, f); 883 wc = fwrite(themedata, len, 1, f);
863 if (wc != 1) { 884 if (wc != 1) {
864 purple_debug_warning("theme_got_url", "Unable to write theme data.\n"); 885 purple_debug_warning("theme_got_url", "Unable to write theme data.\n");
865 fclose(f); 886 fclose(f);
866 g_unlink(path); 887 g_unlink(path);
867 g_free(path); 888 g_free(path);
889 free_theme_info(user_data);
868 return; 890 return;
869 } 891 }
870 fclose(f); 892 fclose(f);
871 893
872 theme_install_theme(path, user_data); 894 theme_install_theme(path, user_data);
898 * just untar it in the right place */ 920 * just untar it in the right place */
899 if(!(tmp = g_filename_from_uri(name, NULL, &converr))) { 921 if(!(tmp = g_filename_from_uri(name, NULL, &converr))) {
900 purple_debug(PURPLE_DEBUG_ERROR, "theme dnd", "%s\n", 922 purple_debug(PURPLE_DEBUG_ERROR, "theme dnd", "%s\n",
901 (converr ? converr->message : 923 (converr ? converr->message :
902 "g_filename_from_uri error")); 924 "g_filename_from_uri error"));
925 free_theme_info(info);
903 return; 926 return;
904 } 927 }
905 theme_install_theme(tmp, info); 928 theme_install_theme(tmp, info);
906 g_free(tmp); 929 g_free(tmp);
907 } else if (!g_ascii_strncasecmp(name, "http://", 7)) { 930 } else if (!g_ascii_strncasecmp(name, "http://", 7)) {
918 tmp[2] = 't'; 941 tmp[2] = 't';
919 tmp[3] = 'p'; 942 tmp[3] = 'p';
920 943
921 purple_util_fetch_url(tmp, TRUE, NULL, FALSE, theme_got_url, info); 944 purple_util_fetch_url(tmp, TRUE, NULL, FALSE, theme_got_url, info);
922 g_free(tmp); 945 g_free(tmp);
923 } 946 } else
947 free_theme_info(info);
924 948
925 gtk_drag_finish(dc, TRUE, FALSE, t); 949 gtk_drag_finish(dc, TRUE, FALSE, t);
926 } 950 }
927 951
928 gtk_drag_finish(dc, FALSE, FALSE, t); 952 gtk_drag_finish(dc, FALSE, FALSE, t);
929 } 953 }
930 954
931 /* builds a theme combo box from a list store with colums: icon preview, markup, theme name */ 955 /* builds a theme combo box from a list store with colums: icon preview, markup, theme name */
932 static GtkWidget * 956 static GtkWidget *
933 prefs_build_theme_combo_box(GtkListStore *store, const gchar *current_theme, gchar *type) 957 prefs_build_theme_combo_box(GtkListStore *store, const char *current_theme, const char *type)
934 { 958 {
935 GtkCellRenderer *cell_rend; 959 GtkCellRenderer *cell_rend;
936 GtkWidget *combo_box; 960 GtkWidget *combo_box;
937 GtkTargetEntry te[3] = { 961 GtkTargetEntry te[3] = {
938 {"text/plain", 0, 0}, 962 {"text/plain", 0, 0},
957 #endif*/ 981 #endif*/
958 982
959 gtk_drag_dest_set(combo_box, GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_HIGHLIGHT | GTK_DEST_DEFAULT_DROP, te, 983 gtk_drag_dest_set(combo_box, GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_HIGHLIGHT | GTK_DEST_DEFAULT_DROP, te,
960 sizeof(te) / sizeof(GtkTargetEntry) , GDK_ACTION_COPY | GDK_ACTION_MOVE); 984 sizeof(te) / sizeof(GtkTargetEntry) , GDK_ACTION_COPY | GDK_ACTION_MOVE);
961 985
962 g_signal_connect(G_OBJECT(combo_box), "drag_data_received", G_CALLBACK(theme_dnd_recv), type); 986 g_signal_connect(G_OBJECT(combo_box), "drag_data_received", G_CALLBACK(theme_dnd_recv), (gpointer) type);
963 987
964 return combo_box; 988 return combo_box;
965 } 989 }
966 990
967 /* sets the current sound theme */ 991 /* sets the current sound theme */
978 gtk_tree_model_get(GTK_TREE_MODEL(prefs_sound_themes), &new_iter, 2, &new_theme, -1); 1002 gtk_tree_model_get(GTK_TREE_MODEL(prefs_sound_themes), &new_iter, 2, &new_theme, -1);
979 1003
980 purple_prefs_set_string(PIDGIN_PREFS_ROOT "/sound/theme", new_theme); 1004 purple_prefs_set_string(PIDGIN_PREFS_ROOT "/sound/theme", new_theme);
981 1005
982 /* New theme removes all customization */ 1006 /* New theme removes all customization */
983 for(i=0; i < PURPLE_NUM_SOUNDS; i++){ 1007 for(i = 0; i < PURPLE_NUM_SOUNDS; i++){
984 pref = g_strdup_printf(PIDGIN_PREFS_ROOT "/sound/file/%s", 1008 pref = g_strdup_printf(PIDGIN_PREFS_ROOT "/sound/file/%s",
985 pidgin_sound_get_event_option(i)); 1009 pidgin_sound_get_event_option(i));
986 purple_prefs_set_path(pref, ""); 1010 purple_prefs_set_path(pref, "");
987 g_free(pref); 1011 g_free(pref);
988 } 1012 }
1035 static void 1059 static void
1036 request_theme_file_name_cb(gpointer data, char *theme_file_name) 1060 request_theme_file_name_cb(gpointer data, char *theme_file_name)
1037 { 1061 {
1038 struct theme_info *info = g_new0(struct theme_info, 1); 1062 struct theme_info *info = g_new0(struct theme_info, 1);
1039 info->type = g_strdup("smiley"); 1063 info->type = g_strdup("smiley");
1040 info->extension = NULL;
1041 info->original_name = NULL;
1042 1064
1043 theme_install_theme(theme_file_name, info); 1065 theme_install_theme(theme_file_name, info);
1044 } 1066 }
1045 1067
1046 static void 1068 static void