changeset 28960:b027d1d97edb

I *think* this properly adds back the font preference stuff I axed earlier, but only for Windows.
author John Bailey <rekkanoryo@rekkanoryo.org>
date Tue, 17 Nov 2009 06:45:20 +0000
parents 11909a84be9f
children 36de2b72f82b
files pidgin/gtkconv.c pidgin/gtkprefs.c pidgin/gtkutils.c
diffstat 3 files changed, 42 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkconv.c	Tue Nov 17 05:59:51 2009 +0000
+++ b/pidgin/gtkconv.c	Tue Nov 17 06:45:20 2009 +0000
@@ -7931,6 +7931,11 @@
 	purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/tab_side", GTK_POS_TOP);
 	purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/scrollback_lines", 4000);
 
+#ifdef _WIN32
+	purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/use_theme_font", TRUE);
+	purple_prefs_add_string(PIDGIN_PREFS_ROOT "/conversations/custom_font", "");
+#endif
+
 	/* Conversations -> Chat */
 	purple_prefs_add_none(PIDGIN_PREFS_ROOT "/conversations/chat");
 	purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/chat/entry_height", 54);
--- a/pidgin/gtkprefs.c	Tue Nov 17 05:59:51 2009 +0000
+++ b/pidgin/gtkprefs.c	Tue Nov 17 06:45:20 2009 +0000
@@ -1475,6 +1475,27 @@
 		PIDGIN_PREFS_ROOT "/conversations/minimum_entry_lines",
 		1, 8, NULL);
 
+#if GTK_CHECK_VERSION(2,4,0) && defined _WIN32
+	vbox = pidgin_make_frame(ret, _("Font"));
+
+	fontpref = pidgin_prefs_checkbox(_("Use font from _theme"),
+									 PIDGIN_PREFS_ROOT "/conversations/use_theme_font", vbox);
+
+	font_name = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/custom_font");
+	if ((font_name == NULL) || (*font_name == '\0')) {
+		font_button = gtk_font_button_new();
+	} else {
+		font_button = gtk_font_button_new_with_font(font_name);
+	}
+
+	gtk_font_button_set_show_style(GTK_FONT_BUTTON(font_button), TRUE);
+	hbox = pidgin_add_widget_to_vbox(GTK_BOX(vbox), _("Conversation _font:"), NULL, font_button, FALSE, NULL);
+	if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/use_theme_font"))
+		gtk_widget_set_sensitive(hbox, FALSE);
+	g_signal_connect(G_OBJECT(fontpref), "clicked", G_CALLBACK(pidgin_toggle_sensitive), hbox);
+	g_signal_connect(G_OBJECT(font_button), "font-set", G_CALLBACK(pidgin_custom_font_set), NULL);
+#endif
+
 	vbox = pidgin_make_frame(ret, _("Default Formatting"));
 	gtk_box_set_child_packing(GTK_BOX(vbox->parent), vbox, TRUE, TRUE, 0, GTK_PACK_START);
 
@@ -2856,7 +2877,6 @@
 	purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/use_custom_bgcolor");
 	purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/use_custom_fgcolor");
 	purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/use_custom_font");
-	purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/custom_font");
 	purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/use_custom_size");
 	purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/chat/old_tab_complete");
 	purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/chat/tab_completion");
@@ -2871,6 +2891,10 @@
 	purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/signon");
 	purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/silent_signon");
 
+#ifndef _WIN32
+	purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/custom_font");
+#endif
+
 	/* Convert old queuing prefs to hide_new 3-way pref. */
 	if (purple_prefs_exists("/plugins/gtk/docklet/queue_messages") &&
 	    purple_prefs_get_bool("/plugins/gtk/docklet/queue_messages"))
--- a/pidgin/gtkutils.c	Tue Nov 17 05:59:51 2009 +0000
+++ b/pidgin/gtkutils.c	Tue Nov 17 06:45:20 2009 +0000
@@ -105,6 +105,7 @@
 void
 pidgin_setup_imhtml(GtkWidget *imhtml)
 {
+	PangoFontDescription *desc = NULL;
 	g_return_if_fail(imhtml != NULL);
 	g_return_if_fail(GTK_IS_IMHTML(imhtml));
 
@@ -112,6 +113,17 @@
 
 	gtk_imhtml_set_funcs(GTK_IMHTML(imhtml), &gtkimhtml_cbs);
 
+#ifdef _WIN32
+	if (!purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/use_theme_font")) {
+		const char *font = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/custom_font");
+		desc = pango_font_description_from_string(font);
+	}
+#endif
+
+	if (desc) {
+		gtk_widget_modify_font(imhtml, desc);
+		pango_font_description_free(desc);
+	}
 }
 
 static