pidgin/pidginabout.c

changeset 38664
253a9bbc3317
parent 38663
a463d40cb9ec
child 38665
35676a9b7faa
--- a/pidgin/pidginabout.c	Thu Aug 17 20:11:49 2017 -0500
+++ b/pidgin/pidginabout.c	Thu Aug 17 22:02:45 2017 -0500
@@ -4,6 +4,8 @@
 #include "pidginabout.h"
 #include "pidginresources.h"
 #include "internal.h"
+#include "gtkutils.h"
+#include "gtkwebview.h"
 
 #include <stdio.h>
 
@@ -15,8 +17,11 @@
 #endif
 
 struct _PidginAboutDialogPrivate {
+	GtkWidget *application_name;
 	GtkWidget *stack;
 
+	GtkWidget *main_scrolled_window;
+
 	GtkWidget *developers_button;
 	GtkWidget *developers_page;
 	GtkWidget *developers_treeview;
@@ -66,6 +71,42 @@
 }
 
 static void
+_pidgin_about_dialog_load_main_page(PidginAboutDialog *about) {
+	GtkWidget *webview = NULL;
+	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);
+
+	/* now load the html */
+	istream = g_resource_open_stream(
+		pidgin_get_resource(),
+		"/im/pidgin/Pidgin/About/about.html",
+		G_RESOURCE_LOOKUP_FLAGS_NONE,
+		NULL
+	);
+
+	str = g_string_new("");
+
+	while((read = g_input_stream_read(istream, buffer, sizeof(buffer), NULL, NULL)) > 0) {
+		g_string_append_len(str, (gchar *)buffer, read);
+	}
+
+	pidgin_webview_append_html(PIDGIN_WEBVIEW(webview), str->str);
+
+	g_string_free(str, TRUE);
+
+	g_input_stream_close(istream, NULL, NULL);
+}
+
+static void
 _pidgin_about_dialog_load_developers(PidginAboutDialog *about) {
 	GInputStream *istream = NULL;
 	GList *l = NULL, *sections = NULL;
@@ -465,8 +506,11 @@
 		"/im/pidgin/Pidgin/About/about.ui"
 	);
 
+	gtk_widget_class_bind_template_child_private(widget_class, PidginAboutDialog, application_name);
 	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, developers_button);
 	gtk_widget_class_bind_template_child_private(widget_class, PidginAboutDialog, developers_page);
 	gtk_widget_class_bind_template_child_private(widget_class, PidginAboutDialog, developers_store);
@@ -491,6 +535,9 @@
 
 	gtk_widget_init_template(GTK_WIDGET(about));
 
+	/* setup the main page */
+	_pidgin_about_dialog_load_main_page(about);
+
 	/* setup the developers stuff */
 	g_signal_connect(
 		about->priv->developers_button,

mercurial