cpw.rekkanoryo.prefs_window: 7bf03624: I *think* this properly adds back the fo...

rekkanoryo at pidgin.im rekkanoryo at pidgin.im
Tue Nov 17 01:50:44 EST 2009


-----------------------------------------------------------------
Revision: 7bf03624c836a9d7e0b8b87e2528ef4195702631
Ancestor: a6783acf13c4853434b0b394f4eb8d090100d790
Author: rekkanoryo at pidgin.im
Date: 2009-11-17T06:45:20
Branch: im.pidgin.cpw.rekkanoryo.prefs_window
URL: http://d.pidgin.im/viewmtn/revision/info/7bf03624c836a9d7e0b8b87e2528ef4195702631

Modified files:
        pidgin/gtkconv.c pidgin/gtkprefs.c pidgin/gtkutils.c

ChangeLog: 

I *think* this properly adds back the font preference stuff I axed earlier, but
only for Windows.

-------------- next part --------------
============================================================
--- pidgin/gtkconv.c	99f80a19b12b9603073a35ee771275f95e400144
+++ pidgin/gtkconv.c	a3c79f3228adb5cd68e06f5321f451a75fdb0de0
@@ -7931,6 +7931,11 @@ pidgin_conversations_init(void)
 	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);
============================================================
--- pidgin/gtkprefs.c	fc01265e9f203fa936a90513d7b0631d30c1219d
+++ pidgin/gtkprefs.c	ba4e1f0f2302e6d7dfd404811756e4ca0086d316
@@ -1475,6 +1475,27 @@ conv_page(void)
 		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 @@ pidgin_prefs_update_old(void)
 	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 @@ pidgin_prefs_update_old(void)
 	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"))
============================================================
--- pidgin/gtkutils.c	90724560d0f0bb2b1c8f333ca5d253368016af32
+++ pidgin/gtkutils.c	d0ac2b238d7b99044bd153d560d0d0db5b90589e
@@ -105,6 +105,7 @@ pidgin_setup_imhtml(GtkWidget *imhtml)
 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 @@ pidgin_setup_imhtml(GtkWidget *imhtml)
 
 	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


More information about the Commits mailing list