Mercurial > pidgin
changeset 32563:e63ca20258fb
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.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Mon, 27 Feb 2012 06:41:57 +0000 |
parents | 4547ab591cfc |
children | 0e641c228680 |
files | pidgin/gtkwebview.c pidgin/gtkwebview.h pidgin/gtkwebviewtoolbar.c |
diffstat | 3 files changed, 11 insertions(+), 68 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/gtkwebview.c Mon Feb 27 06:35:27 2012 +0000 +++ b/pidgin/gtkwebview.c Mon Feb 27 06:41:57 2012 +0000 @@ -68,7 +68,6 @@ GtkWebViewButtons format_functions; struct { gboolean wbfo:1; /* Whole buffer formatting only. */ - gchar *background; } edit; } GtkWebViewPriv; @@ -304,15 +303,11 @@ 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 @@ } 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 @@ 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 -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;
--- a/pidgin/gtkwebview.h Mon Feb 27 06:35:27 2012 +0000 +++ b/pidgin/gtkwebview.h Mon Feb 27 06:41:57 2012 +0000 @@ -48,14 +48,13 @@ 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(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(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
--- a/pidgin/gtkwebviewtoolbar.c Mon Feb 27 06:35:27 2012 +0000 +++ b/pidgin/gtkwebviewtoolbar.c Mon Feb 27 06:41:57 2012 +0000 @@ -377,12 +377,7 @@ { 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 @@ 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 @@ { 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 @@ 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 @@ g_free(markup); } g_free(tmp); - g_free(tmp2); } static void