Mercurial > pidgin
comparison src/dialogs.c @ 7079:5a45833dd253
[gaim-migrate @ 7644]
close 772082
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Tue, 30 Sep 2003 20:13:22 +0000 |
parents | 7fdac700deb1 |
children | fc9c74cfb306 |
comparison
equal
deleted
inserted
replaced
7078:acd2a66e59ed | 7079:5a45833dd253 |
---|---|
1758 | 1758 |
1759 void apply_font(GtkWidget *widget, GtkFontSelection *fontsel) | 1759 void apply_font(GtkWidget *widget, GtkFontSelection *fontsel) |
1760 { | 1760 { |
1761 /* this could be expanded to include font size, weight, etc. | 1761 /* this could be expanded to include font size, weight, etc. |
1762 but for now only works with font face */ | 1762 but for now only works with font face */ |
1763 int i = 0; | |
1764 char *fontname; | 1763 char *fontname; |
1764 char *space; | |
1765 GaimConversation *c = g_object_get_data(G_OBJECT(fontsel), | 1765 GaimConversation *c = g_object_get_data(G_OBJECT(fontsel), |
1766 "gaim_conversation"); | 1766 "gaim_conversation"); |
1767 | 1767 |
1768 if(!c) | |
1769 return; | |
1770 | |
1768 fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(fontsel)); | 1771 fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(fontsel)); |
1769 | 1772 |
1770 if (c) { | 1773 space = strrchr(fontname, ' '); |
1771 while(fontname[i] && !isdigit(fontname[i])) { | 1774 if(space && isdigit(*(space+1))) |
1772 i++; | 1775 *space = '\0'; |
1773 } | 1776 |
1774 fontname[i] = 0; | 1777 gaim_gtk_set_font_face(GAIM_GTK_CONVERSATION(c), fontname); |
1775 gaim_gtk_set_font_face(GAIM_GTK_CONVERSATION(c), fontname); | |
1776 } else { | |
1777 char *c; | |
1778 | |
1779 fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(fontsel)); | |
1780 | |
1781 for (c = fontname; *c != '\0'; c++) { | |
1782 if (isdigit(*c)) { | |
1783 *(--c) = '\0'; | |
1784 break; | |
1785 } | |
1786 } | |
1787 | |
1788 gaim_prefs_set_string("/gaim/gtk/conversations/font_face", fontname); | |
1789 } | |
1790 | 1778 |
1791 g_free(fontname); | 1779 g_free(fontname); |
1792 | 1780 |
1793 cancel_font(NULL, c); | 1781 cancel_font(NULL, c); |
1794 } | 1782 } |