Restore Insert Horizontal Rule functionality.

Sun, 03 Jun 2012 20:50:42 +0000

author
Elliott Sales de Andrade <qulogic@pidgin.im>
date
Sun, 03 Jun 2012 20:50:42 +0000
changeset 33012
3a742f00a0f4
parent 33011
861a290f5464
child 33013
f62232fb738a

Restore Insert Horizontal Rule functionality.

pidgin/gtkwebview.c file | annotate | diff | comparison | revisions
pidgin/gtkwebview.h file | annotate | diff | comparison | revisions
pidgin/gtkwebviewtoolbar.c file | annotate | diff | comparison | revisions
--- 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;
+}
+
--- 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_ */
--- 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

mercurial