changeset 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 acd2a66e59ed
children fc9c74cfb306
files src/dialogs.c src/gtkprefs.c
diffstat 2 files changed, 13 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/src/dialogs.c	Tue Sep 30 18:41:28 2003 +0000
+++ b/src/dialogs.c	Tue Sep 30 20:13:22 2003 +0000
@@ -1760,33 +1760,21 @@
 {
 	/* this could be expanded to include font size, weight, etc.
 	   but for now only works with font face */
-	int i = 0;
 	char *fontname;
+	char *space;
 	GaimConversation *c = g_object_get_data(G_OBJECT(fontsel),
 			"gaim_conversation");
 
+	if(!c)
+		return;
+
 	fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(fontsel));
 
-	if (c) {
-		while(fontname[i] && !isdigit(fontname[i])) {
-			i++;
-		}
-		fontname[i] = 0;
-		gaim_gtk_set_font_face(GAIM_GTK_CONVERSATION(c), fontname);
-	} else {
-		char *c;
-
-		fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(fontsel));
-
-		for (c = fontname; *c != '\0'; c++) {
-			if (isdigit(*c)) {
-				*(--c) = '\0';
-				break;
-			}
-		}
-
-		gaim_prefs_set_string("/gaim/gtk/conversations/font_face", fontname);
-	}
+	space = strrchr(fontname, ' ');
+	if(space && isdigit(*(space+1)))
+		*space = '\0';
+
+	gaim_gtk_set_font_face(GAIM_GTK_CONVERSATION(c), fontname);
 
 	g_free(fontname);
 
--- a/src/gtkprefs.c	Tue Sep 30 18:41:28 2003 +0000
+++ b/src/gtkprefs.c	Tue Sep 30 20:13:22 2003 +0000
@@ -2662,19 +2662,16 @@
 
 void apply_font_dlg(GtkWidget *w, GtkWidget *f)
 {
-	char *fontname, *c;
+	char *fontname, *space;
 
 	fontname =
 		gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(f));
 
 	destroy_fontsel(0, 0);
 
-	for (c = fontname; *c != '\0'; c++) {
-		if (isdigit(*c)) {
-			*(--c) = '\0';
-			break;
-		}
-	}
+	space = strrchr(fontname, ' ');
+	if(space && isdigit(*(space+1)))
+		*space = '\0';
 
 	gaim_prefs_set_string("/gaim/gtk/conversations/font_face", fontname);