Mercurial > pidgin
changeset 32725:e53eb11ff985
propagate from branch 'im.pidgin.cpw.qulogic.gtk3' (head 48830f0ec00f34eaac1edbb7f4d702bb04410b05)
to branch 'im.pidgin.pidgin' (head 9174da183193795cce221fd1aa868986fc775148)
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Mon, 27 Feb 2012 22:45:47 +0000 |
parents | c631931c3794 (current diff) 42b3e6ded93b (diff) |
children | c47349fcd270 |
files | pidgin/gtkprefs.c |
diffstat | 4 files changed, 125 insertions(+), 213 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/gtkprefs.c Sun Feb 26 08:26:11 2012 +0000 +++ b/pidgin/gtkprefs.c Mon Feb 27 22:45:47 2012 +0000 @@ -1346,50 +1346,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); } } @@ -1743,8 +1729,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 "
--- a/pidgin/gtkwebview.c Sun Feb 26 08:26:11 2012 +0000 +++ b/pidgin/gtkwebview.c Mon Feb 27 22:45:47 2012 +0000 @@ -68,16 +68,6 @@ GtkWebViewButtons format_functions; struct { gboolean wbfo:1; /* Whole buffer formatting only. */ - gboolean bold:1; - gboolean italic:1; - gboolean underline:1; - gboolean strike:1; - gchar *forecolor; - gchar *backcolor; - gchar *background; - gchar *fontface; - int fontsize; - /*GtkTextTag *link;*/ } edit; } GtkWebViewPriv; @@ -313,28 +303,13 @@ 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; - priv->edit.bold = FALSE; - priv->edit.italic = FALSE; - priv->edit.underline = FALSE; - priv->edit.strike = FALSE; - priv->edit.fontsize = 0; - - g_free(priv->edit.fontface); - priv->edit.fontface = NULL; - - g_free(priv->edit.forecolor); - priv->edit.forecolor = NULL; - - g_free(priv->edit.backcolor); - priv->edit.backcolor = NULL; - - 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, ""); } static void @@ -541,6 +516,7 @@ return g_string_free(str, FALSE); } + void gtk_webview_safe_execute_script(GtkWebView *webview, const char *script) { @@ -607,7 +583,8 @@ } } -void gtk_webview_page_up(GtkWebView *webview) +void +gtk_webview_page_up(GtkWebView *webview) { GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); GtkAdjustment *vadj = priv->vadj; @@ -624,7 +601,8 @@ gtk_adjustment_set_value(vadj, scroll_val); } -void gtk_webview_page_down(GtkWebView *webview) +void +gtk_webview_page_down(GtkWebView *webview) { GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); GtkAdjustment *vadj = priv->vadj; @@ -653,12 +631,12 @@ void gtk_webview_setup_entry(GtkWebView *webview, PurpleConnectionFlags flags) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); GtkWebViewButtons buttons; if (flags & PURPLE_CONNECTION_HTML) { char color[8]; GdkColor fg_color, bg_color; + gboolean bold, italic, underline, strike; buttons = GTK_WEBVIEW_ALL; @@ -672,17 +650,19 @@ if (flags & PURPLE_CONNECTION_NO_URLDESC) buttons &= ~GTK_WEBVIEW_LINKDESC; + gtk_webview_get_current_format(webview, &bold, &italic, &underline, &strike); + gtk_webview_set_format_functions(webview, GTK_WEBVIEW_ALL); - if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/send_bold") != priv->edit.bold) + if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/send_bold") != bold) gtk_webview_toggle_bold(webview); - if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/send_italic") != priv->edit.italic) + if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/send_italic") != italic) gtk_webview_toggle_italic(webview); - if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/send_underline") != priv->edit.underline) + if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/send_underline") != underline) gtk_webview_toggle_underline(webview); - if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/send_strike") != priv->edit.strike) + if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/send_strike") != strike) gtk_webview_toggle_strike(webview); gtk_webview_toggle_fontface(webview, @@ -701,28 +681,30 @@ { gdk_color_parse(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/fgcolor"), &fg_color); - g_snprintf(color, sizeof(color), "#%02x%02x%02x", - fg_color.red / 256, - fg_color.green / 256, - fg_color.blue / 256); + g_snprintf(color, sizeof(color), + "#%02x%02x%02x", + fg_color.red / 256, + fg_color.green / 256, + fg_color.blue / 256); } else strcpy(color, ""); gtk_webview_toggle_forecolor(webview, color); - if(!(flags & PURPLE_CONNECTION_NO_BGCOLOR) && - strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/bgcolor"), "") != 0) + if (!(flags & PURPLE_CONNECTION_NO_BGCOLOR) && + strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/bgcolor"), "") != 0) { gdk_color_parse(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/bgcolor"), &bg_color); - g_snprintf(color, sizeof(color), "#%02x%02x%02x", - bg_color.red / 256, - bg_color.green / 256, - bg_color.blue / 256); + g_snprintf(color, sizeof(color), + "#%02x%02x%02x", + bg_color.red / 256, + bg_color.green / 256, + bg_color.blue / 256); } 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); @@ -773,50 +755,56 @@ gboolean *italic, gboolean *underline, gboolean *strike) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + WebKitDOMDocument *dom; + dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); + if (bold) - *bold = priv->edit.bold; + *bold = webkit_dom_document_query_command_state(dom, "bold"); if (italic) - *italic = priv->edit.italic; + *italic = webkit_dom_document_query_command_state(dom, "italic"); if (underline) - *underline = priv->edit.underline; + *underline = webkit_dom_document_query_command_state(dom, "underline"); if (strike) - *strike = priv->edit.strike; -} - -const char * -gtk_webview_get_current_fontface(GtkWebView *webview) -{ - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); - return priv->edit.fontface; + *strike = webkit_dom_document_query_command_state(dom, "strikethrough"); } -const char * +char * +gtk_webview_get_current_fontface(GtkWebView *webview) +{ + WebKitDOMDocument *dom; + dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); + return webkit_dom_document_query_command_value(dom, "fontName"); +} + +char * gtk_webview_get_current_forecolor(GtkWebView *webview) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); - return priv->edit.forecolor; + WebKitDOMDocument *dom; + dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); + return webkit_dom_document_query_command_value(dom, "foreColor"); } -const char * +char * gtk_webview_get_current_backcolor(GtkWebView *webview) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); - return priv->edit.backcolor; -} - -const char * -gtk_webview_get_current_background(GtkWebView *webview) -{ - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); - return priv->edit.background; + WebKitDOMDocument *dom; + dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); + return webkit_dom_document_query_command_value(dom, "backColor"); } gint gtk_webview_get_current_fontsize(GtkWebView *webview) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); - return priv->edit.fontsize; + WebKitDOMDocument *dom; + gchar *text; + gint size; + + dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); + text = webkit_dom_document_query_command_value(dom, "fontSize"); + size = atoi(text); + g_free(text); + + return size; } gboolean @@ -841,11 +829,8 @@ void gtk_webview_toggle_bold(GtkWebView *webview) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); WebKitDOMDocument *dom; - priv->edit.bold = !priv->edit.bold; - dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); webkit_dom_document_exec_command(dom, "bold", FALSE, ""); } @@ -853,11 +838,8 @@ void gtk_webview_toggle_italic(GtkWebView *webview) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); WebKitDOMDocument *dom; - priv->edit.italic = !priv->edit.italic; - dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); webkit_dom_document_exec_command(dom, "italic", FALSE, ""); } @@ -865,11 +847,8 @@ void gtk_webview_toggle_underline(GtkWebView *webview) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); WebKitDOMDocument *dom; - priv->edit.underline = !priv->edit.underline; - dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); webkit_dom_document_exec_command(dom, "underline", FALSE, ""); } @@ -877,11 +856,8 @@ void gtk_webview_toggle_strike(GtkWebView *webview) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); WebKitDOMDocument *dom; - priv->edit.strike = !priv->edit.strike; - dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); webkit_dom_document_exec_command(dom, "strikethrough", FALSE, ""); } @@ -889,14 +865,10 @@ gboolean gtk_webview_toggle_forecolor(GtkWebView *webview, const char *color) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); WebKitDOMDocument *dom; - g_free(priv->edit.forecolor); - priv->edit.forecolor = g_strdup(color); - dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); - webkit_dom_document_exec_command(dom, "forecolor", FALSE, color); + webkit_dom_document_exec_command(dom, "foreColor", FALSE, color); return FALSE; } @@ -904,25 +876,10 @@ gboolean gtk_webview_toggle_backcolor(GtkWebView *webview, const char *color) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); WebKitDOMDocument *dom; - g_free(priv->edit.backcolor); - priv->edit.backcolor = g_strdup(color); - dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); - webkit_dom_document_exec_command(dom, "backcolor", FALSE, color); - - return FALSE; -} - -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); + webkit_dom_document_exec_command(dom, "backColor", FALSE, color); return FALSE; } @@ -930,14 +887,10 @@ gboolean gtk_webview_toggle_fontface(GtkWebView *webview, const char *face) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); WebKitDOMDocument *dom; - g_free(priv->edit.fontface); - priv->edit.fontface = g_strdup(face); - dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); - webkit_dom_document_exec_command(dom, "fontname", FALSE, face); + webkit_dom_document_exec_command(dom, "fontName", FALSE, face); return FALSE; } @@ -945,45 +898,44 @@ void gtk_webview_font_set_size(GtkWebView *webview, gint size) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); WebKitDOMDocument *dom; char *tmp; - priv->edit.fontsize = size; - dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); tmp = g_strdup_printf("%d", size); - webkit_dom_document_exec_command(dom, "fontsize", FALSE, tmp); + webkit_dom_document_exec_command(dom, "fontSize", FALSE, tmp); g_free(tmp); } void gtk_webview_font_shrink(GtkWebView *webview) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); WebKitDOMDocument *dom; + gint fontsize; char *tmp; - priv->edit.fontsize = MAX(priv->edit.fontsize - 1, 1); + fontsize = gtk_webview_get_current_fontsize(webview); + fontsize = MAX(fontsize - 1, 1); dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); - tmp = g_strdup_printf("%d", priv->edit.fontsize); - webkit_dom_document_exec_command(dom, "fontsize", FALSE, tmp); + tmp = g_strdup_printf("%d", fontsize); + webkit_dom_document_exec_command(dom, "fontSize", FALSE, tmp); g_free(tmp); } void gtk_webview_font_grow(GtkWebView *webview) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); WebKitDOMDocument *dom; + gint fontsize; char *tmp; - priv->edit.fontsize = MIN(priv->edit.fontsize + 1, MAX_FONT_SIZE); + fontsize = gtk_webview_get_current_fontsize(webview); + fontsize = MIN(fontsize + 1, MAX_FONT_SIZE); dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); - tmp = g_strdup_printf("%d", priv->edit.fontsize); - webkit_dom_document_exec_command(dom, "fontsize", FALSE, tmp); + tmp = g_strdup_printf("%d", fontsize); + webkit_dom_document_exec_command(dom, "fontSize", FALSE, tmp); g_free(tmp); }
--- a/pidgin/gtkwebview.h Sun Feb 26 08:26:11 2012 +0000 +++ b/pidgin/gtkwebview.h Mon Feb 27 22:45:47 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; @@ -242,7 +241,7 @@ * * @return A string containing the font face or @c NULL if none is set. */ -const char *gtk_webview_get_current_fontface(GtkWebView *webview); +char *gtk_webview_get_current_fontface(GtkWebView *webview); /** * Returns a string containing the selected foreground color at the current @@ -252,7 +251,7 @@ * * @return A string containing the foreground color or @c NULL if none is set. */ -const char *gtk_webview_get_current_forecolor(GtkWebView *webview); +char *gtk_webview_get_current_forecolor(GtkWebView *webview); /** * Returns a string containing the selected font background color at the current @@ -262,17 +261,7 @@ * * @return A string containing the background color or @c NULL if none is set. */ -const 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. - */ -const char *gtk_webview_get_current_background(GtkWebView *webview); +char *gtk_webview_get_current_backcolor(GtkWebView *webview); /** * Returns a integer containing the selected HTML font size at the current @@ -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 Sun Feb 26 08:26:11 2012 +0000 +++ b/pidgin/gtkwebviewtoolbar.c Mon Feb 27 22:45:47 2012 +0000 @@ -253,7 +253,7 @@ priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(font))) { - const char *fontname = gtk_webview_get_current_fontface(GTK_WEBVIEW(toolbar->webview)); + char *fontname = gtk_webview_get_current_fontface(GTK_WEBVIEW(toolbar->webview)); if (!priv->font_dialog) { priv->font_dialog = gtk_font_selection_dialog_new(_("Select Font")); @@ -279,6 +279,8 @@ } gtk_window_present(GTK_WINDOW(priv->font_dialog)); + + g_free(fontname); } else { cancel_toolbar_font(font, toolbar); } @@ -341,7 +343,7 @@ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color))) { GtkWidget *colorsel; GdkColor fgcolor; - const char *color = gtk_webview_get_current_forecolor(GTK_WEBVIEW(toolbar->webview)); + char *color = gtk_webview_get_current_forecolor(GTK_WEBVIEW(toolbar->webview)); if (!priv->fgcolor_dialog) { priv->fgcolor_dialog = gtk_color_selection_dialog_new(_("Select Text Color")); @@ -360,6 +362,8 @@ } gtk_window_present(GTK_WINDOW(priv->fgcolor_dialog)); + + g_free(color); } else { cancel_toolbar_fgcolor(color, toolbar); } @@ -373,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) @@ -414,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); @@ -432,7 +426,7 @@ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color))) { GtkWidget *colorsel; GdkColor bgcolor; - const char *color = gtk_webview_get_current_backcolor(GTK_WEBVIEW(toolbar->webview)); + char *color = gtk_webview_get_current_backcolor(GTK_WEBVIEW(toolbar->webview)); if (!priv->bgcolor_dialog) { priv->bgcolor_dialog = gtk_color_selection_dialog_new(_("Select Background Color")); @@ -451,6 +445,8 @@ } gtk_window_present(GTK_WINDOW(priv->bgcolor_dialog)); + + g_free(color); } else { cancel_toolbar_bgcolor(color, toolbar); } @@ -1098,8 +1094,7 @@ { GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); gboolean bold, italic, underline, strike; - const char *tmp; - const char *tmp2; + char *tmp; GtkLabel *label = GTK_LABEL(priv->font_label); gtk_label_set_label(label, _("_Font")); @@ -1158,6 +1153,7 @@ gtk_label_set_markup_with_mnemonic(label, markup); g_free(markup); } + g_free(tmp); tmp = gtk_webview_get_current_forecolor(GTK_WEBVIEW(toolbar->webview)); toggle_button_set_active_block(GTK_TOGGLE_BUTTON(priv->fgcolor), @@ -1168,17 +1164,18 @@ gtk_label_set_markup_with_mnemonic(label, markup); g_free(markup); } + 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)); gtk_label_set_markup_with_mnemonic(label, markup); g_free(markup); } + g_free(tmp); } static void