Merged in rw_grim/pidgin (pull request #389)

Wed, 12 Sep 2018 21:56:35 +0000

author
Gary Kramlich <grim@reaperworld.com>
date
Wed, 12 Sep 2018 21:56:35 +0000
changeset 39218
88cc5868273f
parent 39215
f7465cc3a44f (current diff)
parent 39217
4c5b6c2e7007 (diff)
child 39220
b3e750730566
child 39225
a3f3275250a4
child 39227
291b3c800668

Merged in rw_grim/pidgin (pull request #389)

Replace the AboutBox WebkitWebView with Talkatu widgets.

Approved-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>

pidgin/resources/About/about.html file | annotate | diff | comparison | revisions
--- a/pidgin/pidginabout.c	Wed Sep 12 21:56:03 2018 +0000
+++ b/pidgin/pidginabout.c	Wed Sep 12 21:56:35 2018 +0000
@@ -18,13 +18,13 @@
  */
 #include <gdk-pixbuf/gdk-pixbuf.h>
 #include <json-glib/json-glib.h>
+#include <talkatu.h>
 
 #include "package_revision.h"
 #include "pidginabout.h"
 #include "pidginresources.h"
 #include "internal.h"
 #include "gtkutils.h"
-#include "gtkwebview.h"
 
 #include <stdio.h>
 
@@ -54,6 +54,7 @@
 	GtkWidget *stack;
 
 	GtkWidget *main_scrolled_window;
+	GtkTextBuffer *main_buffer;
 
 	GtkWidget *developers_page;
 	GtkWidget *developers_treeview;
@@ -68,6 +69,8 @@
 	GtkTreeStore *build_info_store;
 };
 
+G_DEFINE_TYPE_WITH_PRIVATE(PidginAboutDialog, pidgin_about_dialog, GTK_TYPE_DIALOG);
+
 /******************************************************************************
  * Helpers
  *****************************************************************************/
@@ -86,23 +89,17 @@
 
 static void
 _pidgin_about_dialog_load_main_page(PidginAboutDialog *about) {
-	GtkWidget *webview = NULL;
+	PidginAboutDialogPrivate *priv = pidgin_about_dialog_get_instance_private(about);
+	GtkTextIter start;
 	GInputStream *istream = NULL;
 	GString *str = NULL;
 	gchar buffer[8192];
-	gssize read = 0;
-
-	/* create our webview */
-	webview = pidgin_webview_new(FALSE);
-	pidgin_setup_webview(webview);
-	pidgin_webview_set_format_functions(PIDGIN_WEBVIEW(webview), PIDGIN_WEBVIEW_ALL ^ PIDGIN_WEBVIEW_SMILEY);
-
-	gtk_container_add(GTK_CONTAINER(about->priv->main_scrolled_window), webview);
+	gssize read = 0, size = 0;
 
 	/* now load the html */
 	istream = g_resource_open_stream(
 		pidgin_get_resource(),
-		"/im/pidgin/Pidgin/About/about.html",
+		"/im/pidgin/Pidgin/About/about.md",
 		G_RESOURCE_LOOKUP_FLAGS_NONE,
 		NULL
 	);
@@ -111,9 +108,17 @@
 
 	while((read = g_input_stream_read(istream, buffer, sizeof(buffer), NULL, NULL)) > 0) {
 		g_string_append_len(str, (gchar *)buffer, read);
+		size += read;
 	}
 
-	pidgin_webview_append_html(PIDGIN_WEBVIEW(webview), str->str);
+	gtk_text_buffer_get_start_iter(priv->main_buffer, &start);
+
+	talkatu_markdown_buffer_insert_markdown(
+		TALKATU_MARKDOWN_BUFFER(priv->main_buffer),
+		&start,
+		str->str,
+		size
+	);
 
 	g_string_free(str, TRUE);
 
@@ -391,9 +396,6 @@
 #ifdef MESON_ARGS
 	_pidgin_about_dialog_add_build_args(about, "Meson Arguments", MESON_ARGS);
 #endif /* MESON_ARGS */
-#ifdef CONFIG_ARGS
-	_pidgin_about_dialog_add_build_args(about, "Configure Arguments", CONFIG_ARGS);
-#endif /* CONFIG_ARGS */
 
 	_pidgin_about_dialog_load_build_info(about);
 	_pidgin_about_dialog_load_runtime_info(about);
@@ -410,8 +412,6 @@
 /******************************************************************************
  * GObject Stuff
  *****************************************************************************/
-G_DEFINE_TYPE_WITH_PRIVATE(PidginAboutDialog, pidgin_about_dialog, GTK_TYPE_DIALOG);
-
 static void
 pidgin_about_dialog_class_init(PidginAboutDialogClass *klass) {
 	GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
@@ -426,6 +426,7 @@
 	gtk_widget_class_bind_template_child_private(widget_class, PidginAboutDialog, stack);
 
 	gtk_widget_class_bind_template_child_private(widget_class, PidginAboutDialog, main_scrolled_window);
+	gtk_widget_class_bind_template_child_private(widget_class, PidginAboutDialog, main_buffer);
 
 	gtk_widget_class_bind_template_child_private(widget_class, PidginAboutDialog, developers_page);
 	gtk_widget_class_bind_template_child_private(widget_class, PidginAboutDialog, developers_store);
--- a/pidgin/resources/About/about.html	Wed Sep 12 21:56:03 2018 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-<h2>Pidgin</h2>
-
-<p>Pidgin is a messaging client based on libpurple which is capable of connecting to multiple messaging services at once.  Pidgin is written in C using GTK+.  Pidgin is released, and may be modified and redistributed,  under the terms of the GPL version 2 (or later).  A copy of the GPL is distributed with Pidgin.  Pidgin is copyrighted by its contributors, a list of whom is also distributed with Pidgin.  There is no warranty for Pidgin.</p>
-
-<h3>Helpful Resources</h3>
-
-<ul>
-<li><a href="https://pidgin.im">Website</a></li>
-<li><a href="https://developer.pidgin.im/wiki/FAQ">Frequently Asked Questions</a></li>
-<li>IRC Channel: #pidgin on irc.freenode.net</li>
-<li>XMPP MUC: devel@conference.pidgin.im</li>
-</ul>
-
-<p><strong>Help for Oracle Employees</strong> is available from your normal internal helpdesk or IT department. The Pidgin developer and user communities cannot assist you in the configuration or use of Pidgin within Oracle, as we know nothing of Oracle's infrastructure.</p>
-
-<p><strong>Help from other Pidgin users</strong> is available by e-mailing <a href="mailto:support@pidgin.im">support@pidgin.im</a>.</p>
-
-<p>This is a <strong>public</strong> mailing list with a <strong>public</strong> <a href="https://pidgin.im/pipermail/support/">archive</a>.</p>
-
-<p>We can't help with third-party protocols or plugins, but you may be able to find support via the <a href="https://developer.pidgin.im/wiki/ThirdPartyPlugins">ThirdPartyPlugins WIKI Page</a>.</p>
-
-<p>The list's primary language is English.  You are welcome to post in another language, but the responses may be less helpful.</p>
--- a/pidgin/resources/About/about.ui	Wed Sep 12 21:56:03 2018 +0000
+++ b/pidgin/resources/About/about.ui	Wed Sep 12 21:56:35 2018 +0000
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- Generated with glade 3.22.1 -->
 <interface>
+  <requires lib="Talkatu" version="0.0"/>
   <requires lib="gtk+" version="3.10"/>
   <object class="GtkTreeStore" id="build_info_store">
     <columns>
@@ -18,6 +19,10 @@
       <column type="gfloat"/>
     </columns>
   </object>
+  <object class="TalkatuTagTable" id="main_tag_table"/>
+  <object class="TalkatuMarkdownBuffer" id="main_buffer">
+    <property name="tag_table">main_tag_table</property>
+  </object>
   <object class="GtkTreeStore" id="translators_store">
     <columns>
       <!-- column-name markup -->
@@ -135,7 +140,13 @@
                     <property name="hscrollbar_policy">never</property>
                     <property name="shadow_type">in</property>
                     <child>
-                      <placeholder/>
+                      <object class="TalkatuView" id="main_page">
+                        <property name="can_focus">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                        <property name="editable">False</property>
+                        <property name="wrap_mode">word</property>
+                        <property name="buffer">main_buffer</property>
+                      </object>
                     </child>
                   </object>
                   <packing>
--- a/pidgin/resources/pidgin.gresource.xml	Wed Sep 12 21:56:03 2018 +0000
+++ b/pidgin/resources/pidgin.gresource.xml	Wed Sep 12 21:56:35 2018 +0000
@@ -3,7 +3,7 @@
   <gresource prefix="/im/pidgin/Pidgin/">
     <file>logo.png</file>
     <file compressed="true">About/about.ui</file>
-    <file compressed="true">About/about.html</file>
+    <file compressed="true">About/about.md</file>
     <file compressed="true">About/credits.json</file>
     <file compressed="true">Debug/debug.ui</file>
     <file compressed="true">Debug/filter-popover.ui</file>

mercurial