/pidgin/main: d33b4fa5ea06: win32: hack for webkit's feature of ...

Tomasz Wasilczyk tomkiewicz at cpw.pidgin.im
Thu Apr 11 21:33:50 EDT 2013


Changeset: d33b4fa5ea069ee2cf4e801630affd0aea47a68e
Author:	 Tomasz Wasilczyk <tomkiewicz at cpw.pidgin.im>
Date:	 2013-04-12 03:33 +0200
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/d33b4fa5ea06

Description:

win32: hack for webkit's feature of replacing backslash with yen sign; silencing some warnings in gtkconv.c; consistent messages in proxy.c

diffstat:

 libpurple/proxy.c   |   8 ++++----
 pidgin/gtkconv.c    |  27 +++++++++++++++++++++++----
 pidgin/gtkwebview.c |  16 +++++++++++++++-
 3 files changed, 42 insertions(+), 9 deletions(-)

diffs (172 lines):

diff --git a/libpurple/proxy.c b/libpurple/proxy.c
--- a/libpurple/proxy.c
+++ b/libpurple/proxy.c
@@ -775,7 +775,7 @@ proxy_connect_udp_none(PurpleProxyConnec
 	{
 		if ((errno == EINPROGRESS) || (errno == EINTR))
 		{
-			purple_debug_info("proxy", "UDP Connection in progress\n");
+			purple_debug_info("proxy", "UDP connection in progress\n");
 			connect_data->inpa = purple_input_add(connect_data->fd,
 					PURPLE_INPUT_WRITE, socket_ready_cb, connect_data);
 		}
@@ -1276,7 +1276,7 @@ proxy_connect_http(PurpleProxyConnectDat
 
 	if (connect(connect_data->fd, addr, addrlen) != 0) {
 		if (errno == EINPROGRESS || errno == EINTR) {
-			purple_debug_info("proxy", "Connection in progress\n");
+			purple_debug_info("proxy", "HTTP connection in progress\n");
 
 			connect_data->inpa = purple_input_add(connect_data->fd,
 					PURPLE_INPUT_WRITE, http_canwrite, connect_data);
@@ -1472,7 +1472,7 @@ proxy_connect_socks4(PurpleProxyConnectD
 	{
 		if ((errno == EINPROGRESS) || (errno == EINTR))
 		{
-			purple_debug_info("proxy", "Connection in progress.\n");
+			purple_debug_info("proxy", "SOCKS4 connection in progress\n");
 			connect_data->inpa = purple_input_add(connect_data->fd,
 					PURPLE_INPUT_WRITE, s4_canwrite, connect_data);
 		}
@@ -2131,7 +2131,7 @@ proxy_connect_socks5(PurpleProxyConnectD
 	{
 		if ((errno == EINPROGRESS) || (errno == EINTR))
 		{
-			purple_debug_info("socks5 proxy", "Connection in progress\n");
+			purple_debug_info("proxy", "SOCKS5 connection in progress\n");
 			connect_data->inpa = purple_input_add(connect_data->fd,
 					PURPLE_INPUT_WRITE, s5_canwrite, connect_data);
 		}
diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c
--- a/pidgin/gtkconv.c
+++ b/pidgin/gtkconv.c
@@ -197,7 +197,9 @@ static void generate_send_to_items(Pidgi
 /* Prototypes. <-- because Paco-Paco hates this comment. */
 static void load_conv_theme(PidginConversation *gtkconv);
 static gboolean infopane_entry_activate(PidginConversation *gtkconv);
+#if 0
 static void got_typing_keypress(PidginConversation *gtkconv, gboolean first);
+#endif
 static void gray_stuff_out(PidginConversation *gtkconv);
 static void add_chat_buddy_common(PurpleConversation *conv, PurpleConvChatBuddy *cb, const char *old_name);
 static gboolean tab_complete(PurpleConversation *conv);
@@ -2439,6 +2441,7 @@ menu_conv_sel_send_cb(GObject *m, gpoint
 	pidgin_conv_switch_active_conversation(conv);
 }
 
+#if 0
 static void
 insert_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *position,
 			   gchar *new_text, gint new_text_length, gpointer user_data)
@@ -2485,6 +2488,7 @@ delete_text_cb(GtkTextBuffer *textbuffer
 		got_typing_keypress(gtkconv, FALSE);
 	}
 }
+#endif
 
 /**************************************************************************
  * A bunch of buddy icon functions
@@ -3738,6 +3742,7 @@ setup_menubar(PidginWindow *win)
  * Utility functions
  **************************************************************************/
 
+#if 0
 static void
 got_typing_keypress(PidginConversation *gtkconv, gboolean first)
 {
@@ -3766,7 +3771,6 @@ got_typing_keypress(PidginConversation *
 	}
 }
 
-#if 0
 static gboolean
 typing_animation(gpointer data) {
 	PidginConversation *gtkconv = data;
@@ -4248,6 +4252,7 @@ add_chat_buddy_common(PurpleConversation
 	g_free(alias_key);
 }
 
+#if 0
 /**
  * @param most_matched Used internally by this function.
  * @param entered The partial string that the user types before hitting the
@@ -4303,6 +4308,7 @@ tab_complete_process_item(int *most_matc
 	*matches = g_list_insert_sorted(*matches, g_strdup(name),
 								   (GCompareFunc)purple_utf8_strcasecmp);
 }
+#endif
 
 static gboolean
 tab_complete(PurpleConversation *conv)
@@ -5267,12 +5273,23 @@ set_theme_webkit_settings(WebKitWebView 
 {
 	WebKitWebSettings *settings;
 	const GValue *val;
-
+	
 	g_object_get(G_OBJECT(webview), "settings", &settings, NULL);
 
 	val = pidgin_conversation_theme_lookup(theme, "DefaultFontFamily", TRUE);
 	if (val && G_VALUE_HOLDS_STRING(val))
-		g_object_set(G_OBJECT(settings), "default-font-family", g_value_get_string(val), NULL);
+	{
+		const gchar *font_family = g_value_get_string(val);
+#ifdef _WIN32
+		/* XXX: a hack for not converting backslash to yen sign.
+		 * See gtkwebview.c: gtk_webview_new.
+		 */
+		if (g_ascii_strcasecmp(font_family, "sans-serif") == 0)
+			font_family = NULL;
+#endif
+		if (font_family)
+			g_object_set(G_OBJECT(settings), "default-font-family", font_family, NULL);
+	}
 
 	val = pidgin_conversation_theme_lookup(theme, "DefaultFontSize", TRUE);
 	if (val && G_VALUE_HOLDS_INT(val))
@@ -6376,8 +6393,8 @@ pidgin_conv_write_conv(PurpleConversatio
 	char *str;
 	char *with_font_tag;
 	char *sml_attrib = NULL;
+	size_t length;
 #endif
-	size_t length;
 	PurpleConversationType type;
 	char *displaying;
 	gboolean plugin_return;
@@ -6446,7 +6463,9 @@ pidgin_conv_write_conv(PurpleConversatio
 		g_free(displaying);
 		return;
 	}
+#if 0
 	length = strlen(displaying) + 1;
+#endif
 
 	old_flags = gtkconv->last_flags;
 	if ((flags & PURPLE_MESSAGE_SEND) && (old_flags & PURPLE_MESSAGE_SEND)) {
diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c
--- a/pidgin/gtkwebview.c
+++ b/pidgin/gtkwebview.c
@@ -1354,7 +1354,21 @@ editable_input_cb(GtkWebView *webview, g
 GtkWidget *
 gtk_webview_new(void)
 {
-	return GTK_WIDGET(g_object_new(gtk_webview_get_type(), NULL));
+	WebKitWebView *webview = WEBKIT_WEB_VIEW(g_object_new(gtk_webview_get_type(), NULL));
+	WebKitWebSettings *settings = webkit_web_view_get_settings(webview);
+	
+	g_object_set(G_OBJECT(settings), "default-encoding", "utf-8", NULL);
+#ifdef _WIN32
+	/* XXX: win32 WebKitGTK replaces backslash with yen sign for
+	 * "sans-serif" font. We should figure out, how to disable this
+	 * behavior, but for now I will just apply this simple hack (using other
+	 * font family).
+	 */
+	g_object_set(G_OBJECT(settings), "default-font-family", "Verdana", NULL);
+#endif
+	webkit_web_view_set_settings(webview, settings);
+	
+	return GTK_WIDGET(webview);
 }
 
 static void



More information about the Commits mailing list