[epiphany] Add an about: handler
- From: William Jon McCann <mccann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Add an about: handler
- Date: Tue, 17 Dec 2013 15:53:08 +0000 (UTC)
commit f389331b0e864bc3ff5a92bc3286987351a6c4e1
Author: William Jon McCann <william jon mccann gmail com>
Date: Sun Dec 15 13:00:44 2013 -0500
Add an about: handler
https://bugzilla.gnome.org/show_bug.cgi?id=665484
data/pages/about.css | 37 ++++++++++++++++++++++++++++++-
embed/Makefile.am | 1 +
embed/ephy-about-handler.c | 52 ++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 89 insertions(+), 1 deletions(-)
---
diff --git a/data/pages/about.css b/data/pages/about.css
index 7f349d9..cf95a7d 100644
--- a/data/pages/about.css
+++ b/data/pages/about.css
@@ -3,10 +3,11 @@
h1 {
color: #babdb6;
text-shadow: 0 1px 0 white;
- margin-bottom 0;
+ margin-bottom: 0;
}
body {
+ font-family: Cantarell, sans-serif;
font: 11pt cantarell;
color: #2e3436;
padding: 20px 20px 0 20px;
@@ -22,6 +23,40 @@ body {
background-repeat: no-repeat;
}
+/* about: */
+
+.dialog {
+ padding: 2em;
+ margin: 2em auto;
+ text-align: center;
+ background-color: #fff;
+ border-radius: 1em;
+ border: 2px solid #d3d7cf;
+ width: 40em;
+}
+
+.properties {
+ margin: auto;
+}
+
+.prop-label {
+ color: #999;
+}
+
+#about-title {
+ color: black;
+}
+
+#about-subtitle {
+ color: #babdb6;
+ text-shadow: 0 1px 0 white;
+ margin-top: 0;
+}
+
+#about-subtitle {
+ color: #babdb6;
+ text-shadow: 0 1px 0 white;
+}
/* about:plugins */
diff --git a/embed/Makefile.am b/embed/Makefile.am
index 75ab652..f182c9b 100644
--- a/embed/Makefile.am
+++ b/embed/Makefile.am
@@ -61,6 +61,7 @@ libephyembed_la_CPPFLAGS = \
$(AM_CPPFLAGS)
libephyembed_la_CFLAGS = \
+ -DDATADIR="\"$(datadir)\"" \
-DSHARE_DIR=\"$(pkgdatadir)\" \
-DEPHY_WEB_EXTENSIONS_DIR=\""$(libdir)/epiphany/$(EPIPHANY_MAJOR)/web-extensions"\" \
$(DEPENDENCIES_CFLAGS) \
diff --git a/embed/ephy-about-handler.c b/embed/ephy-about-handler.c
index 9e8a01c..b11f0a3 100644
--- a/embed/ephy-about-handler.c
+++ b/embed/ephy-about-handler.c
@@ -27,6 +27,7 @@
#include "ephy-web-app-utils.h"
#include <gio/gio.h>
+#include <gtk/gtk.h>
#include <glib/gi18n.h>
struct _EphyAboutHandlerPrivate {
@@ -261,6 +262,55 @@ ephy_about_handler_handle_memory (EphyAboutHandler *handler,
}
static gboolean
+ephy_about_handler_handle_about (EphyAboutHandler *handler,
+ WebKitURISchemeRequest *request)
+{
+ char *data;
+ char *version;
+ char *image_data = NULL;
+ const char *filename;
+ GtkIconInfo *icon_info;
+
+ version = g_strdup_printf (_("Version %s"), VERSION);
+
+ icon_info = gtk_icon_theme_lookup_icon (gtk_icon_theme_get_default (),
+ "web-browser",
+ 256,
+ GTK_ICON_LOOKUP_GENERIC_FALLBACK);
+ if (icon_info != NULL) {
+ filename = gtk_icon_info_get_filename (icon_info);
+ image_data = ephy_file_create_data_uri_for_filename (filename, NULL);
+ }
+
+ data = g_strdup_printf ("<html><head><title>%s</title>"
+ "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />"
+ "<style type=\"text/css\">%s</style></head>" \
+ "<body>"
+ "<div class=\"dialog\">"
+ "<img src=\"%s\"/>"
+ "<h1 id=\"about-title\">%s</h1>"
+ "<h2 id=\"about-subtitle\">%s</h2>"
+ "<p id=\"about-tagline\">ā%sā</p>"
+ "<table class=\"properties\">"
+ "<tr><td class=\"prop-label\">%s</td><td class=\"prop-value\">%d.%d.%d</td></tr>"
+ "</table>"
+ "</div></body></html>",
+ _("About Web"),
+ ephy_about_handler_get_style_sheet (handler),
+ image_data ? image_data : "",
+ _("Web"),
+ version,
+ _("A simple, clean, beautiful view of the web"),
+ "WebKit", webkit_get_major_version (), webkit_get_minor_version (),
webkit_get_micro_version ());
+ g_free (version);
+ g_free (image_data);
+
+ ephy_about_handler_finish_request (request, data, -1);
+
+ return TRUE;
+}
+
+static gboolean
ephy_about_handler_handle_epiphany (EphyAboutHandler *handler,
WebKitURISchemeRequest *request)
{
@@ -446,6 +496,8 @@ ephy_about_handler_handle_request (EphyAboutHandler *handler,
handled = ephy_about_handler_handle_applications (handler, request);
else if (!g_strcmp0 (path, "incognito"))
handled = ephy_about_handler_handle_incognito (handler, request);
+ else if (path == NULL || path[0] == '\0' || !g_strcmp0 (path, "Web") || !g_strcmp0 (path, "web"))
+ handled = ephy_about_handler_handle_about (handler, request);
if (!handled)
ephy_about_handler_handle_blank (handler, request);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]