| 558 } |
558 } |
| 559 |
559 |
| 560 /* Rebuild the markup for the sound theme selection for "(Custom)" themes */ |
560 /* Rebuild the markup for the sound theme selection for "(Custom)" themes */ |
| 561 static void |
561 static void |
| 562 pref_sound_generate_markup() |
562 pref_sound_generate_markup() |
| 563 { |
563 { |
| 564 gboolean print_custom, customized; |
564 gboolean print_custom, customized; |
| 565 const gchar *name, *author, *description, *current_theme; |
565 const gchar *name, *author, *description, *current_theme; |
| 566 gchar *markup; |
566 gchar *markup; |
| 567 PurpleSoundTheme *theme; |
567 PurpleSoundTheme *theme; |
| 568 GtkTreeIter iter; |
568 GtkTreeIter iter; |
| 569 |
569 |
| 570 customized = pidgin_sound_is_customized(); |
570 customized = pidgin_sound_is_customized(); |
| 571 current_theme = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/theme"); |
571 current_theme = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/theme"); |
| 572 |
572 |
| 573 if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(prefs_sound_themes), &iter)) { |
573 if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(prefs_sound_themes), &iter)) { |
| 574 do { |
574 do { |
| 575 gtk_tree_model_get(GTK_TREE_MODEL(prefs_sound_themes), &iter, 2, &name, -1); |
575 gtk_tree_model_get(GTK_TREE_MODEL(prefs_sound_themes), &iter, 2, &name, -1); |
| 576 |
576 |
| 577 print_custom = customized && g_str_equal(current_theme, name); |
577 print_custom = customized && g_str_equal(current_theme, name); |
| 578 |
578 |
| 579 if (g_str_equal(name, "")) |
579 if (g_str_equal(name, "")) |
| 580 markup = g_strdup_printf("<b>(Default)</b>%s%s - None\n<span foreground='dim grey'>The default Pidgin sound theme</span>", |
580 markup = g_strdup_printf("<b>(Default)</b>%s%s - None\n<span foreground='dim grey'>The default Pidgin sound theme</span>", |
| 581 print_custom ? " " : "", print_custom ? "(Custom)" : ""); |
581 print_custom ? " " : "", print_custom ? "(Custom)" : ""); |
| 582 else { |
582 else { |
| 583 theme = PURPLE_SOUND_THEME(purple_theme_manager_find_theme(name, "sound")); |
583 theme = PURPLE_SOUND_THEME(purple_theme_manager_find_theme(name, "sound")); |
| 584 author = purple_theme_get_author(PURPLE_THEME(theme)); |
584 author = purple_theme_get_author(PURPLE_THEME(theme)); |
| 585 description = purple_theme_get_description(PURPLE_THEME(theme)); |
585 description = purple_theme_get_description(PURPLE_THEME(theme)); |
| 586 |
586 |
| 587 markup = g_strdup_printf("<b>%s</b>%s%s%s%s\n<span foreground='dim grey'>%s</span>", |
587 markup = g_strdup_printf("<b>%s</b>%s%s%s%s\n<span foreground='dim grey'>%s</span>", |
| 588 name, print_custom ? " " : "", print_custom ? "(Custom)" : "", |
588 name, print_custom ? " " : "", print_custom ? "(Custom)" : "", |
| 589 author != NULL ? " - " : "", author != NULL ? author : "", description != NULL ? description : ""); |
589 author != NULL ? " - " : "", author != NULL ? author : "", description != NULL ? description : ""); |
| 590 } |
590 } |
| 591 |
591 |
| 592 gtk_list_store_set(prefs_sound_themes, &iter, 1, markup, -1); |
592 gtk_list_store_set(prefs_sound_themes, &iter, 1, markup, -1); |
| 593 |
593 |
| 594 g_free(markup); |
594 g_free(markup); |
| 603 { |
603 { |
| 604 GdkPixbuf *pixbuf = NULL; |
604 GdkPixbuf *pixbuf = NULL; |
| 605 GtkTreeIter iter; |
605 GtkTreeIter iter; |
| 606 gchar *image_full = NULL, *markup; |
606 gchar *image_full = NULL, *markup; |
| 607 const gchar *name, *author, *description; |
607 const gchar *name, *author, *description; |
| 608 |
608 |
| 609 if (PURPLE_IS_SOUND_THEME(theme)){ |
609 if (PURPLE_IS_SOUND_THEME(theme)){ |
| 610 |
610 |
| 611 image_full = purple_theme_get_image_full(theme); |
611 image_full = purple_theme_get_image_full(theme); |
| 612 if (image_full != NULL){ |
612 if (image_full != NULL){ |
| 613 pixbuf = gdk_pixbuf_new_from_file_at_scale(image_full, PREFS_OPTIMAL_ICON_SIZE, PREFS_OPTIMAL_ICON_SIZE, TRUE, NULL); |
613 pixbuf = gdk_pixbuf_new_from_file_at_scale(image_full, PREFS_OPTIMAL_ICON_SIZE, PREFS_OPTIMAL_ICON_SIZE, TRUE, NULL); |
| 614 g_free(image_full); |
614 g_free(image_full); |
| 615 } else pixbuf = NULL; |
615 } else pixbuf = NULL; |
| 616 |
616 |
| 617 gtk_list_store_append(prefs_sound_themes, &iter); |
617 gtk_list_store_append(prefs_sound_themes, &iter); |
| 618 gtk_list_store_set(prefs_sound_themes, &iter, 0, pixbuf, 2, purple_theme_get_name(theme), -1); |
618 gtk_list_store_set(prefs_sound_themes, &iter, 0, pixbuf, 2, purple_theme_get_name(theme), -1); |
| 619 |
619 |
| 620 if (pixbuf != NULL) |
620 if (pixbuf != NULL) |
| 621 gdk_pixbuf_unref(pixbuf); |
621 gdk_pixbuf_unref(pixbuf); |
| 622 |
622 |
| 623 } else if (PIDGIN_IS_BLIST_THEME(theme) || PIDGIN_IS_STATUS_ICON_THEME(theme)){ |
623 } else if (PIDGIN_IS_BLIST_THEME(theme) || PIDGIN_IS_STATUS_ICON_THEME(theme)){ |
| 624 GtkListStore *store; |
624 GtkListStore *store; |
| 625 |
625 |
| 626 if (PIDGIN_IS_BLIST_THEME(theme)) |
626 if (PIDGIN_IS_BLIST_THEME(theme)) |
| 627 store = prefs_blist_themes; |
627 store = prefs_blist_themes; |
| 628 else store = prefs_status_icon_themes; |
628 else store = prefs_status_icon_themes; |
| 629 |
629 |
| 630 image_full = purple_theme_get_image_full(theme); |
630 image_full = purple_theme_get_image_full(theme); |
| 631 if (image_full != NULL){ |
631 if (image_full != NULL){ |
| 632 pixbuf = gdk_pixbuf_new_from_file_at_scale(image_full, PREFS_OPTIMAL_ICON_SIZE, PREFS_OPTIMAL_ICON_SIZE, TRUE, NULL); |
632 pixbuf = gdk_pixbuf_new_from_file_at_scale(image_full, PREFS_OPTIMAL_ICON_SIZE, PREFS_OPTIMAL_ICON_SIZE, TRUE, NULL); |
| 633 g_free(image_full); |
633 g_free(image_full); |
| 634 } else pixbuf = NULL; |
634 } else pixbuf = NULL; |
| 635 |
635 |
| 636 name = purple_theme_get_name(theme); |
636 name = purple_theme_get_name(theme); |
| 637 author = purple_theme_get_author(theme); |
637 author = purple_theme_get_author(theme); |
| 638 description = purple_theme_get_description(theme); |
638 description = purple_theme_get_description(theme); |
| 639 |
639 |
| 640 markup = g_strdup_printf("<b>%s</b>%s%s\n<span foreground='dim grey'>%s</span>", name, author != NULL ? " - " : "", |
640 markup = g_strdup_printf("<b>%s</b>%s%s\n<span foreground='dim grey'>%s</span>", name, author != NULL ? " - " : "", |
| 641 author != NULL ? author : "", description != NULL ? description : ""); |
641 author != NULL ? author : "", description != NULL ? description : ""); |
| 642 |
642 |
| 643 gtk_list_store_append(store, &iter); |
643 gtk_list_store_append(store, &iter); |
| 644 gtk_list_store_set(store, &iter, 0, pixbuf, 1, markup, 2, name, -1); |
644 gtk_list_store_set(store, &iter, 0, pixbuf, 1, markup, 2, name, -1); |
| 645 |
645 |
| 646 g_free(markup); |
646 g_free(markup); |
| 647 if (pixbuf != NULL) |
647 if (pixbuf != NULL) |
| 648 gdk_pixbuf_unref(pixbuf); |
648 gdk_pixbuf_unref(pixbuf); |
| 649 } |
649 } |
| 650 |
650 |
| 651 } |
651 } |
| 652 |
652 |
| 653 /* init all the theme variables so that the themes can be sorted later and used by pref pages */ |
653 /* init all the theme variables so that the themes can be sorted later and used by pref pages */ |
| 654 static void |
654 static void |
| 1199 /* Status Icon Themes */ |
1199 /* Status Icon Themes */ |
| 1200 combo_box = prefs_build_theme_combo_box(prefs_status_icon_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/status/icon-theme")); |
1200 combo_box = prefs_build_theme_combo_box(prefs_status_icon_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/status/icon-theme")); |
| 1201 gtk_box_pack_start(GTK_BOX (vbox), combo_box, FALSE, FALSE, 0); |
1201 gtk_box_pack_start(GTK_BOX (vbox), combo_box, FALSE, FALSE, 0); |
| 1202 g_signal_connect(G_OBJECT(combo_box), "changed", (GCallback)prefs_set_status_icon_theme_cb, NULL); |
1202 g_signal_connect(G_OBJECT(combo_box), "changed", (GCallback)prefs_set_status_icon_theme_cb, NULL); |
| 1203 |
1203 |
| 1204 /* System Tray */ |
1204 /* System Tray */ |
| 1205 vbox = pidgin_make_frame(ret, _("System Tray Icon")); |
1205 vbox = pidgin_make_frame(ret, _("System Tray Icon")); |
| 1206 label = pidgin_prefs_dropdown(vbox, _("_Show system tray icon:"), PURPLE_PREF_STRING, |
1206 label = pidgin_prefs_dropdown(vbox, _("_Show system tray icon:"), PURPLE_PREF_STRING, |
| 1207 PIDGIN_PREFS_ROOT "/docklet/show", |
1207 PIDGIN_PREFS_ROOT "/docklet/show", |
| 1208 _("Always"), "always", |
1208 _("Always"), "always", |
| 1209 _("On unread messages"), "pending", |
1209 _("On unread messages"), "pending", |