changeset 32564:0e641c228680

Update prefs usage of the webview for previous changes.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Mon, 27 Feb 2012 06:42:29 +0000
parents e63ca20258fb
children 42b3e6ded93b
files pidgin/gtkprefs.c
diffstat 1 files changed, 25 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkprefs.c	Mon Feb 27 06:41:57 2012 +0000
+++ b/pidgin/gtkprefs.c	Mon Feb 27 06:42:29 2012 +0000
@@ -1306,50 +1306,36 @@
 		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 = "";
-
-		purple_prefs_set_string(PIDGIN_PREFS_ROOT "/conversations/font_face", face);
+		char *face = gtk_webview_get_current_fontface(webview);
+
+		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 = "";
-
-		purple_prefs_set_string(PIDGIN_PREFS_ROOT "/conversations/fgcolor", color);
+		char *color = gtk_webview_get_current_forecolor(webview);
+
+		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;
-
-		color = gtk_webview_get_current_backcolor(webview);
-		if (!color)
-			color = "";
-
-		/* 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);
-	}
-
-	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);
+		char *color = gtk_webview_get_current_backcolor(webview);
+
+		if (color)
+			purple_prefs_set_string(PIDGIN_PREFS_ROOT "/conversations/bgcolor", color);
+		else
+			purple_prefs_set_string(PIDGIN_PREFS_ROOT "/conversations/bgcolor", "");
+
+		g_free(color);
 	}
 }
 
@@ -1703,8 +1689,7 @@
 	                                 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 "