aboutsummaryrefslogtreecommitdiffstats
path: root/embed/ephy-about-handler.c
diff options
context:
space:
mode:
authorClaudio Saavedra <csaavedra@igalia.com>2013-02-20 02:26:21 +0800
committerClaudio Saavedra <csaavedra@igalia.com>2013-03-05 16:58:10 +0800
commit4e23859050fd1410820312c16a21b3716d9f08e9 (patch)
treeae6542e35263ec9533c1e61e35a70eab103adabb /embed/ephy-about-handler.c
parentbce597e87f3e3d27da65732b0625e383e73d4f03 (diff)
downloadgsoc2013-epiphany-4e23859050fd1410820312c16a21b3716d9f08e9.tar
gsoc2013-epiphany-4e23859050fd1410820312c16a21b3716d9f08e9.tar.gz
gsoc2013-epiphany-4e23859050fd1410820312c16a21b3716d9f08e9.tar.bz2
gsoc2013-epiphany-4e23859050fd1410820312c16a21b3716d9f08e9.tar.lz
gsoc2013-epiphany-4e23859050fd1410820312c16a21b3716d9f08e9.tar.xz
gsoc2013-epiphany-4e23859050fd1410820312c16a21b3716d9f08e9.tar.zst
gsoc2013-epiphany-4e23859050fd1410820312c16a21b3716d9f08e9.zip
ephy-about-handler: add a about:incognito handler
This shows a welcome message for incognito windows. Artwork by Jakub Steiner. https://bugzilla.gnome.org/show_bug.cgi?id=694200
Diffstat (limited to 'embed/ephy-about-handler.c')
-rw-r--r--embed/ephy-about-handler.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/embed/ephy-about-handler.c b/embed/ephy-about-handler.c
index e9328a118..9955d36e5 100644
--- a/embed/ephy-about-handler.c
+++ b/embed/ephy-about-handler.c
@@ -21,6 +21,7 @@
#include "config.h"
#include "ephy-about-handler.h"
+#include "ephy-embed-shell.h"
#include "ephy-file-helpers.h"
#include "ephy-smaps.h"
#include "ephy-web-app-utils.h"
@@ -239,6 +240,43 @@ ephy_about_handler_handle_applications (GString *data_str)
ephy_web_application_free_application_list (applications);
}
+static void
+ephy_about_handler_handle_incognito (GString *data_str)
+{
+ const char *filename;
+ char *img_data = NULL, *img_data_base64 = NULL;
+ gsize data_length;
+
+ filename = ephy_file ("incognito.png");
+ if (filename) {
+ g_file_get_contents (filename, &img_data, &data_length, NULL);
+ img_data_base64 = g_base64_encode ((guchar*)img_data, data_length);
+ }
+ g_string_append_printf (data_str, \
+ "<head>\n" \
+ "<title>%s</title>\n" \
+ "<style type=\"text/css\">%s</style>\n" \
+ "</head>\n" \
+ "<body class=\"incognito-body\">\n" \
+ " <div id=\"mainblock\">\n" \
+ " <div style=\"background: transparent url(data:image/png;base64,%s) no-repeat 10px center;\">\n" \
+ " <h1>%s</h1>\n" \
+ " <p>%s</p>\n" \
+ " </div>\n" \
+ " </div>\n" \
+ "</body>\n",
+ _("Private Browsing"),
+ css_style, img_data_base64 ? img_data_base64 : "",
+ _("Private Browsing"),
+ _("You are currently browsing <em>incognito</em>. Pages viewed in this "
+ "mode will not show up in your browsing history and all stored "
+ "information will be cleared when you close the window."));
+
+ g_free (img_data_base64);
+ g_free (img_data);
+
+}
+
GString *
ephy_about_handler_handle (const char *about)
{
@@ -254,6 +292,10 @@ ephy_about_handler_handle (const char *about)
ephy_about_handler_handle_epiphany (data_str);
else if (!g_strcmp0 (about, "applications"))
ephy_about_handler_handle_applications (data_str);
+ else if (!g_strcmp0 (about, "incognito") &&
+ ephy_embed_shell_get_mode (ephy_embed_shell_get_default ())
+ == EPHY_EMBED_SHELL_MODE_INCOGNITO)
+ ephy_about_handler_handle_incognito (data_str);
g_string_append (data_str, "</html>");