soc.2009.webkitmessageview: 5d598fb5: hmm, fonts and font sizes from Info.plis...

tdrhq at soc.pidgin.im tdrhq at soc.pidgin.im
Tue Aug 25 12:02:45 EDT 2009


-----------------------------------------------------------------
Revision: 5d598fb51bc6da01a4b505635fd46a356f8aa97c
Ancestor: ab736fe1b75a0da644454aab9547d9cf005ceee2
Author: tdrhq at soc.pidgin.im
Date: 2009-08-12T02:24:41
Branch: im.pidgin.soc.2009.webkitmessageview
URL: http://d.pidgin.im/viewmtn/revision/info/5d598fb51bc6da01a4b505635fd46a356f8aa97c

Modified files:
        pidgin/plugins/adiumthemes/webkit.c

ChangeLog: 

hmm, fonts and font sizes from Info.plist.

-------------- next part --------------
============================================================
--- pidgin/plugins/adiumthemes/webkit.c	894d48147793a9a253f1939fcc693160dca4f76e
+++ pidgin/plugins/adiumthemes/webkit.c	4a751daef604f9459eb85a3c9637907c19507944
@@ -730,6 +730,19 @@ get_webkit(PurpleConversation *conv)
 		return gtkconv->webview;
 }
 
+static void set_theme_font_settings (WebKitWebView *webview, PidginMessageStyle *style)
+{
+	WebKitWebSettings *settings;
+
+	g_object_get (G_OBJECT(webview), "settings", &settings, NULL);
+	if (style->default_font_family)
+		g_object_set (G_OBJECT (settings), "default-font-family", style->default_font_family, NULL);
+	
+	if (style->default_font_size)
+		g_object_set (G_OBJECT (settings), "default-font-size", GINT_TO_POINTER (style->default_font_size), NULL);
+}
+
+
 /**
  * Called when either a new PurpleConversation is created
  * or when a PidginConversation changes its active PurpleConversation
@@ -769,6 +782,8 @@ init_theme_for_webkit (PurpleConversatio
 	g_assert(template);
 	
 	purple_debug_info ("webkit", "template: %s\n", template);
+
+	set_theme_font_settings (WEBKIT_WEB_VIEW(webkit), style);
 	webkit_web_view_load_string(WEBKIT_WEB_VIEW(webkit), template, "text/html", "UTF-8", baseuri);
 
 	g_object_set_data (G_OBJECT(webkit), MESSAGE_STYLE_KEY, style);
@@ -1103,6 +1118,8 @@ variant_update_conversation (PurpleConve
 
 	script = g_strdup_printf ("setStylesheet(\"mainStyle\",\"%s\")", pidgin_message_style_get_css (style));
 	gtk_webview_safe_execute_script (GTK_WEBVIEW(webview), script);
+
+	set_theme_font_settings (WEBKIT_WEB_VIEW (gtkconv->webview), style);
 	g_free (script);
 }
 


More information about the Commits mailing list