# HG changeset patch # User Elliott Sales de Andrade # Date 1338756642 0 # Node ID 3a742f00a0f4f37085dab75101a6fddecee59e2f # Parent 861a290f5464a033f9bda29eb46672e74a5ec941 Restore Insert Horizontal Rule functionality. diff -r 861a290f5464 -r 3a742f00a0f4 pidgin/gtkwebview.c --- a/pidgin/gtkwebview.c Sun Jun 03 20:23:23 2012 +0000 +++ b/pidgin/gtkwebview.c Sun Jun 03 20:50:42 2012 +0000 @@ -1007,3 +1007,16 @@ g_free(tmp); } +void +gtk_webview_insert_hr(GtkWebView *webview) +{ + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + WebKitDOMDocument *dom; + + dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); + + priv->edit.block_changed = TRUE; + webkit_dom_document_exec_command(dom, "insertHorizontalRule", FALSE, ""); + priv->edit.block_changed = FALSE; +} + diff -r 861a290f5464 -r 3a742f00a0f4 pidgin/gtkwebview.h --- a/pidgin/gtkwebview.h Sun Jun 03 20:23:23 2012 +0000 +++ b/pidgin/gtkwebview.h Sun Jun 03 20:50:42 2012 +0000 @@ -402,6 +402,14 @@ */ void gtk_webview_font_grow(GtkWebView *webview); +/** + * Inserts a horizontal rule at the current location or selection in a + * GtkWebView. + * + * @param webview The GtkWebView + */ +void gtk_webview_insert_hr(GtkWebView *webview); + G_END_DECLS #endif /* _PIDGIN_WEBVIEW_H_ */ diff -r 861a290f5464 -r 3a742f00a0f4 pidgin/gtkwebviewtoolbar.c --- a/pidgin/gtkwebviewtoolbar.c Sun Jun 03 20:23:23 2012 +0000 +++ b/pidgin/gtkwebviewtoolbar.c Sun Jun 03 20:50:42 2012 +0000 @@ -569,16 +569,7 @@ static void insert_hr_cb(GtkWidget *widget, GtkWebViewToolbar *toolbar) { -#if 0 - GtkTextIter iter; - GtkTextMark *ins; - GtkIMHtmlScalable *hr; - - ins = gtk_text_buffer_get_insert(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->webview))); - gtk_text_buffer_get_iter_at_mark(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->webview)), &iter, ins); - hr = gtk_webview_hr_new(); - gtk_webview_hr_add_to(hr, GTK_WEBVIEW(toolbar->webview), &iter); -#endif + gtk_webview_insert_hr(GTK_WEBVIEW(toolbar->webview)); } static void