pidgin: 5721a223: Update prefs usage of the webview for pr...

qulogic at pidgin.im qulogic at pidgin.im
Mon Feb 27 18:12:01 EST 2012


----------------------------------------------------------------------
Revision: 5721a223d24aa9cde766c1913195b260e3acc553
Parent:   0b7accde6b3ca65c38f4c43ddf138b017b71ebb1
Author:   qulogic at pidgin.im
Date:     02/27/12 01:42:29
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/5721a223d24aa9cde766c1913195b260e3acc553

Changelog: 

Update prefs usage of the webview for previous changes.

Changes against parent 0b7accde6b3ca65c38f4c43ddf138b017b71ebb1

  patched  pidgin/gtkprefs.c

-------------- next part --------------
============================================================
--- pidgin/gtkprefs.c	5ed25135604bbaef5fbab7c4a8768ab8bda6d35d
+++ pidgin/gtkprefs.c	fe0dd6c1b9b449566b2e690b913cc25de9b8d2e6
@@ -1306,51 +1306,37 @@ formatting_toggle_cb(GtkWebView *webview
 		purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/font_size",
 		                     gtk_webview_get_current_fontsize(webview));
 	if (buttons & GTK_WEBVIEW_FACE) {
-		const char *face = gtk_webview_get_current_fontface(webview);
-		if (!face)
-			face = "";
+		char *face = gtk_webview_get_current_fontface(webview);
 
-		purple_prefs_set_string(PIDGIN_PREFS_ROOT "/conversations/font_face", face);
+		if (face)
+			purple_prefs_set_string(PIDGIN_PREFS_ROOT "/conversations/font_face", face);
+		else
+			purple_prefs_set_string(PIDGIN_PREFS_ROOT "/conversations/font_face", "");
+
+		g_free(face);
 	}
 
 	if (buttons & GTK_WEBVIEW_FORECOLOR) {
-		const char *color = gtk_webview_get_current_forecolor(webview);
-		if (!color)
-			color = "";
+		char *color = gtk_webview_get_current_forecolor(webview);
 
-		purple_prefs_set_string(PIDGIN_PREFS_ROOT "/conversations/fgcolor", color);
+		if (color)
+			purple_prefs_set_string(PIDGIN_PREFS_ROOT "/conversations/fgcolor", color);
+		else
+			purple_prefs_set_string(PIDGIN_PREFS_ROOT "/conversations/fgcolor", "");
+
+		g_free(color);
 	}
 
 	if (buttons & GTK_WEBVIEW_BACKCOLOR) {
-		const char *color;
-		GObject *object;
+		char *color = gtk_webview_get_current_backcolor(webview);
 
-		color = gtk_webview_get_current_backcolor(webview);
-		if (!color)
-			color = "";
+		if (color)
+			purple_prefs_set_string(PIDGIN_PREFS_ROOT "/conversations/bgcolor", color);
+		else
+			purple_prefs_set_string(PIDGIN_PREFS_ROOT "/conversations/bgcolor", "");
 
-		/* Block the signal to prevent a loop. */
-		object = g_object_ref(G_OBJECT(webview));
-		g_signal_handlers_block_matched(object, G_SIGNAL_MATCH_DATA, 0, 0, NULL,
-		                                NULL, toolbar);
-		/* Clear the backcolor. */
-		gtk_webview_toggle_backcolor(webview, "");
-		/* Unblock the signal. */
-		g_signal_handlers_unblock_matched(object, G_SIGNAL_MATCH_DATA, 0, 0,
-		                                  NULL, NULL, toolbar);
-		g_object_unref(object);
-
-		/* This will fire a toggle signal and get saved below. */
-		gtk_webview_toggle_background(webview, color);
+		g_free(color);
 	}
-
-	if (buttons & GTK_WEBVIEW_BACKGROUND) {
-		const char *color = gtk_webview_get_current_background(webview);
-		if (!color)
-			color = "";
-
-		purple_prefs_set_string(PIDGIN_PREFS_ROOT "/conversations/bgcolor", color);
-	}
 }
 
 static void
@@ -1703,8 +1689,7 @@ conv_page(void)
 	                                 GTK_WEBVIEW_SHRINK |
 	                                 GTK_WEBVIEW_FACE |
 	                                 GTK_WEBVIEW_FORECOLOR |
-	                                 GTK_WEBVIEW_BACKCOLOR |
-	                                 GTK_WEBVIEW_BACKGROUND);
+	                                 GTK_WEBVIEW_BACKCOLOR);
 
 	gtk_webview_append_html(GTK_WEBVIEW(webview),
 	                        _("This is how your outgoing message text will "


More information about the Commits mailing list