Mercurial > pidgin
comparison src/dialogs.c @ 2763:477a035d81e5
[gaim-migrate @ 2776]
more font stuff! yay!
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Mon, 19 Nov 2001 12:03:38 +0000 |
parents | 367d19133917 |
children | a0fd8f91e294 |
comparison
equal
deleted
inserted
replaced
2762:8eb8db9a8449 | 2763:477a035d81e5 |
---|---|
2651 { | 2651 { |
2652 /* this could be expanded to include font size, weight, etc. | 2652 /* this could be expanded to include font size, weight, etc. |
2653 but for now only works with font face */ | 2653 but for now only works with font face */ |
2654 int i, j = 0, k = 0; | 2654 int i, j = 0, k = 0; |
2655 char *fontname; | 2655 char *fontname; |
2656 char font[64]; | |
2657 struct conversation *c = gtk_object_get_user_data(GTK_OBJECT(fontsel)); | 2656 struct conversation *c = gtk_object_get_user_data(GTK_OBJECT(fontsel)); |
2658 | 2657 |
2659 if (c) { | 2658 if (c) { |
2660 fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(fontsel)); | 2659 fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(fontsel)); |
2661 | 2660 |
2662 for (i = 0; i < strlen(fontname); i++) { | 2661 set_font_face(fontname, c); |
2663 if (fontname[i] == '-') { | |
2664 if (++j > 2) | |
2665 break; | |
2666 } else if (j == 2) | |
2667 font[k++] = fontname[i]; | |
2668 } | |
2669 font[k] = '\0'; | |
2670 | |
2671 debug_printf("Setting font face %s\n", font); | |
2672 | |
2673 set_font_face(font, c); | |
2674 } else { | 2662 } else { |
2675 fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(fontsel)); | 2663 fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(fontsel)); |
2676 | 2664 |
2677 for (i = 0; i < strlen(fontname); i++) { | 2665 for (i = 0; i < strlen(fontname); i++) { |
2678 if (fontname[i] == '-') { | 2666 if (fontname[i] == '-') { |
2680 break; | 2668 break; |
2681 } else if (j == 2) | 2669 } else if (j == 2) |
2682 fontface[k++] = fontname[i]; | 2670 fontface[k++] = fontname[i]; |
2683 } | 2671 } |
2684 fontface[k] = '\0'; | 2672 fontface[k] = '\0'; |
2673 | |
2674 g_snprintf(fontxfld, sizeof(fontxfld), "%s", fontname); | |
2685 } | 2675 } |
2686 | 2676 |
2687 cancel_font(NULL, c); | 2677 cancel_font(NULL, c); |
2688 } | 2678 } |
2689 | 2679 |
2708 break; | 2698 break; |
2709 } else if (j == 2) | 2699 } else if (j == 2) |
2710 fontface[k++] = fontname[i]; | 2700 fontface[k++] = fontname[i]; |
2711 } | 2701 } |
2712 fontface[k] = '\0'; | 2702 fontface[k] = '\0'; |
2703 g_snprintf(fontxfld, sizeof(fontxfld), "%s", fontname); | |
2713 update_convo_font(); | 2704 update_convo_font(); |
2714 } | 2705 } |
2715 | 2706 |
2716 void show_font_dialog(struct conversation *c, GtkWidget *font) | 2707 void show_font_dialog(struct conversation *c, GtkWidget *font) |
2717 { | 2708 { |
2718 | 2709 |
2719 if (!font) { /* we came from the prefs dialog */ | 2710 if (!font) { /* we came from the prefs dialog */ |
2720 if (fontseld) | 2711 if (fontseld) |
2721 return; | 2712 return; |
2722 fontseld = gtk_font_selection_dialog_new(_("Select Font")); | 2713 fontseld = gtk_font_selection_dialog_new(_("Select Font")); |
2723 gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(fontseld), | 2714 if (fontxfld[0]) { |
2724 DEFAULT_FONT_XFLD); | 2715 gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(fontseld), |
2716 fontxfld); | |
2717 } else { | |
2718 gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(fontseld), | |
2719 DEFAULT_FONT_XFLD); | |
2720 } | |
2725 | 2721 |
2726 gtk_object_set_user_data(GTK_OBJECT(fontseld), NULL); | 2722 gtk_object_set_user_data(GTK_OBJECT(fontseld), NULL); |
2727 gtk_signal_connect(GTK_OBJECT(fontseld), "delete_event", | 2723 gtk_signal_connect(GTK_OBJECT(fontseld), "delete_event", |
2728 GTK_SIGNAL_FUNC(destroy_fontsel), NULL); | 2724 GTK_SIGNAL_FUNC(destroy_fontsel), NULL); |
2729 gtk_signal_connect(GTK_OBJECT(GTK_FONT_SELECTION_DIALOG(fontseld)->cancel_button), | 2725 gtk_signal_connect(GTK_OBJECT(GTK_FONT_SELECTION_DIALOG(fontseld)->cancel_button), |
2743 if (font) | 2739 if (font) |
2744 gtk_object_set_user_data(GTK_OBJECT(c->font_dialog), c); | 2740 gtk_object_set_user_data(GTK_OBJECT(c->font_dialog), c); |
2745 else | 2741 else |
2746 gtk_object_set_user_data(GTK_OBJECT(c->font_dialog), NULL); | 2742 gtk_object_set_user_data(GTK_OBJECT(c->font_dialog), NULL); |
2747 | 2743 |
2748 gtk_font_selection_dialog_set_font_name((GtkFontSelectionDialog *) c->font_dialog, | 2744 if (c->fontxfld[0]) { |
2749 DEFAULT_FONT_XFLD); | 2745 gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(fontseld), |
2746 c->fontxfld); | |
2747 } else { | |
2748 gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(fontseld), | |
2749 DEFAULT_FONT_XFLD); | |
2750 } | |
2750 | 2751 |
2751 gtk_signal_connect(GTK_OBJECT(c->font_dialog), "delete_event", | 2752 gtk_signal_connect(GTK_OBJECT(c->font_dialog), "delete_event", |
2752 GTK_SIGNAL_FUNC(delete_event_dialog), c); | 2753 GTK_SIGNAL_FUNC(delete_event_dialog), c); |
2753 gtk_signal_connect(GTK_OBJECT(GTK_FONT_SELECTION_DIALOG(c->font_dialog)->ok_button), | 2754 gtk_signal_connect(GTK_OBJECT(GTK_FONT_SELECTION_DIALOG(c->font_dialog)->ok_button), |
2754 "clicked", GTK_SIGNAL_FUNC(apply_font), c->font_dialog); | 2755 "clicked", GTK_SIGNAL_FUNC(apply_font), c->font_dialog); |
2755 gtk_signal_connect(GTK_OBJECT(GTK_FONT_SELECTION_DIALOG(c->font_dialog)->cancel_button), | 2756 gtk_signal_connect(GTK_OBJECT(GTK_FONT_SELECTION_DIALOG(c->font_dialog)->cancel_button), |
2756 "clicked", GTK_SIGNAL_FUNC(cancel_font), c); | 2757 "clicked", GTK_SIGNAL_FUNC(cancel_font), c); |
2757 | |
2758 gtk_font_selection_dialog_set_font_name((GtkFontSelectionDialog *) c->font_dialog, | |
2759 DEFAULT_FONT_XFLD); | |
2760 | 2758 |
2761 gtk_widget_realize(c->font_dialog); | 2759 gtk_widget_realize(c->font_dialog); |
2762 | 2760 |
2763 aol_icon(c->font_dialog->window); | 2761 aol_icon(c->font_dialog->window); |
2764 } | 2762 } |