pidgin: 0b7accde: Having a backcolor and a background seem...

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


----------------------------------------------------------------------
Revision: 0b7accde6b3ca65c38f4c43ddf138b017b71ebb1
Parent:   0305c99dc3cbe96a88f5df913e6d616c73e778c5
Author:   qulogic at pidgin.im
Date:     02/27/12 01:41:57
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/0b7accde6b3ca65c38f4c43ddf138b017b71ebb1

Changelog: 

Having a backcolor and a background seems a bit redundant. And we
just set one to the other anyway. Might as well keep things simple.

Changes against parent 0305c99dc3cbe96a88f5df913e6d616c73e778c5

  patched  pidgin/gtkwebview.c
  patched  pidgin/gtkwebview.h
  patched  pidgin/gtkwebviewtoolbar.c

-------------- next part --------------
============================================================
--- pidgin/gtkwebview.c	71dca9dbbec3b6f3c7306f9aa73d1e9ec93f295f
+++ pidgin/gtkwebview.c	8947a85df3aa3503a87b998bc72f44b36fd40ed1
@@ -68,7 +68,6 @@ typedef struct _GtkWebViewPriv {
 	GtkWebViewButtons format_functions;
 	struct {
 		gboolean wbfo:1;	/* Whole buffer formatting only. */
-		gchar *background;
 	} edit;
 
 } GtkWebViewPriv;
@@ -304,15 +303,11 @@ webview_clear_formatting(GtkWebView *web
 static void
 webview_clear_formatting(GtkWebView *webview)
 {
-	GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview);
 	WebKitDOMDocument *dom;
 
 	if (!webkit_web_view_get_editable(WEBKIT_WEB_VIEW(webview)))
 		return;
 
-	g_free(priv->edit.background);
-	priv->edit.background = NULL;
-
 	dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview));
 	webkit_dom_document_exec_command(dom, "removeFormat", FALSE, "");
 }
@@ -709,7 +704,7 @@ gtk_webview_setup_entry(GtkWebView *webv
 		} else
 			strcpy(color, "");
 
-		gtk_webview_toggle_background(webview, color);
+		gtk_webview_toggle_backcolor(webview, color);
 
 		if (flags & PURPLE_CONNECTION_FORMATTING_WBFO)
 			gtk_webview_set_whole_buffer_formatting_only(webview, TRUE);
@@ -797,13 +792,6 @@ gtk_webview_get_current_backcolor(GtkWeb
 	return webkit_dom_document_query_command_value(dom, "backColor");
 }
 
-char *
-gtk_webview_get_current_background(GtkWebView *webview)
-{
-	GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview);
-	return g_strdup(priv->edit.background);
-}
-
 gint
 gtk_webview_get_current_fontsize(GtkWebView *webview)
 {
@@ -897,17 +885,6 @@ gboolean
 }
 
 gboolean
-gtk_webview_toggle_background(GtkWebView *webview, const char *color)
-{
-	GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview);
-
-	g_free(priv->edit.background);
-	priv->edit.background = g_strdup(color);
-
-	return FALSE;
-}
-
-gboolean
 gtk_webview_toggle_fontface(GtkWebView *webview, const char *face)
 {
 	WebKitDOMDocument *dom;
============================================================
--- pidgin/gtkwebview.h	6b3a64ffd30804f5df8132642539ae8a773c4eb5
+++ pidgin/gtkwebview.h	557e200272afcb0f7f462e66dca7165d3242a130
@@ -48,14 +48,13 @@ typedef enum {
 	GTK_WEBVIEW_FACE          = 1 << 5,
 	GTK_WEBVIEW_FORECOLOR     = 1 << 6,
 	GTK_WEBVIEW_BACKCOLOR     = 1 << 7,
-	GTK_WEBVIEW_BACKGROUND    = 1 << 8,
-	GTK_WEBVIEW_LINK          = 1 << 9,
-	GTK_WEBVIEW_IMAGE         = 1 << 10,
-	GTK_WEBVIEW_SMILEY        = 1 << 11,
-	GTK_WEBVIEW_LINKDESC      = 1 << 12,
-	GTK_WEBVIEW_STRIKE        = 1 << 13,
+	GTK_WEBVIEW_LINK          = 1 << 8,
+	GTK_WEBVIEW_IMAGE         = 1 << 9,
+	GTK_WEBVIEW_SMILEY        = 1 << 10,
+	GTK_WEBVIEW_LINKDESC      = 1 << 11,
+	GTK_WEBVIEW_STRIKE        = 1 << 12,
 	/** Show custom smileys when appropriate. */
-	GTK_WEBVIEW_CUSTOM_SMILEY = 1 << 14,
+	GTK_WEBVIEW_CUSTOM_SMILEY = 1 << 13,
 	GTK_WEBVIEW_ALL           = -1
 } GtkWebViewButtons;
 
@@ -265,16 +264,6 @@ char *gtk_webview_get_current_backcolor(
 char *gtk_webview_get_current_backcolor(GtkWebView *webview);
 
 /**
- * Returns a string containing the selected background color at the current
- * position in a GtkWebView.
- *
- * @param webview The GtkWebView
- *
- * @return A string containg the background color or @c NULL if none is set.
- */
-char *gtk_webview_get_current_background(GtkWebView *webview);
-
-/**
  * Returns a integer containing the selected HTML font size at the current
  * position in a GtkWebView.
  *
@@ -351,17 +340,6 @@ gboolean gtk_webview_toggle_backcolor(Gt
 gboolean gtk_webview_toggle_backcolor(GtkWebView *webview, const char *color);
 
 /**
- * Toggles a background color at the current location or selection in a 
- * GtkWebView.
- *
- * @param webview The GtkWebView
- * @param color  The HTML-style color, or @c NULL or "" to clear the color.
- *
- * @return @c TRUE if a color was set, or @c FALSE if it was cleared.
- */
-gboolean gtk_webview_toggle_background(GtkWebView *webview, const char *color);
-
-/**
  * Toggles a font face at the current location or selection in a GtkWebView.
  *
  * @param webview The GtkWebView
============================================================
--- pidgin/gtkwebviewtoolbar.c	5f779f8927584bb9386bb2abf7e252fa8cdc9077
+++ pidgin/gtkwebviewtoolbar.c	b0ab1d001837bc83afbc77be45fe5f7753bc423d
@@ -377,12 +377,7 @@ destroy_toolbar_bgcolor(GtkWidget *widge
 {
 	GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
 	if (widget != NULL) {
-#if 0
-		if (gtk_text_buffer_get_selection_bounds(GTK_WEBVIEW(toolbar->webview)->text_buffer, NULL, NULL))
-			gtk_webview_toggle_backcolor(GTK_WEBVIEW(toolbar->webview), "");
-		else
-#endif
-			gtk_webview_toggle_background(GTK_WEBVIEW(toolbar->webview), "");
+		gtk_webview_toggle_backcolor(GTK_WEBVIEW(toolbar->webview), "");
 	}
 
 	if (priv->bgcolor_dialog != NULL)
@@ -418,12 +413,7 @@ do_bgcolor(GtkWidget *widget, GtkWebView
 			   text_color.red / 256,
 			   text_color.green / 256,
 			   text_color.blue / 256);
-#if 0
-	if (gtk_text_buffer_get_selection_bounds(GTK_WEBVIEW(toolbar->webview)->text_buffer, NULL, NULL))
-		gtk_webview_toggle_backcolor(GTK_WEBVIEW(toolbar->webview), open_tag);
-	else
-#endif
-		gtk_webview_toggle_background(GTK_WEBVIEW(toolbar->webview), open_tag);
+	gtk_webview_toggle_backcolor(GTK_WEBVIEW(toolbar->webview), open_tag);
 	g_free(open_tag);
 
 	cancel_toolbar_bgcolor(NULL, toolbar);
@@ -1104,7 +1094,7 @@ update_buttons(GtkWebViewToolbar *toolba
 {
 	GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
 	gboolean bold, italic, underline, strike;
-	char *tmp, *tmp2;
+	char *tmp;
 	GtkLabel *label = GTK_LABEL(priv->font_label);
 
 	gtk_label_set_label(label, _("_Font"));
@@ -1177,9 +1167,8 @@ update_buttons(GtkWebViewToolbar *toolba
 	g_free(tmp);
 
 	tmp = gtk_webview_get_current_backcolor(GTK_WEBVIEW(toolbar->webview));
-	tmp2 = gtk_webview_get_current_background(GTK_WEBVIEW(toolbar->webview));
 	toggle_button_set_active_block(GTK_TOGGLE_BUTTON(priv->bgcolor),
-								   (tmp != NULL || tmp2 != NULL), toolbar);
+								   (tmp != NULL), toolbar);
 	if (tmp != NULL) {
 		gchar *markup = g_strdup_printf("<span background=\"%s\">%s</span>",
 				tmp, gtk_label_get_label(label));
@@ -1187,7 +1176,6 @@ update_buttons(GtkWebViewToolbar *toolba
 		g_free(markup);
 	}
 	g_free(tmp);
-	g_free(tmp2);
 }
 
 static void


More information about the Commits mailing list