From 4e23859050fd1410820312c16a21b3716d9f08e9 Mon Sep 17 00:00:00 2001 From: Claudio Saavedra Date: Tue, 19 Feb 2013 20:26:21 +0200 Subject: 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 --- embed/ephy-about-handler.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'embed/ephy-about-handler.c') 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, \ + "\n" \ + "%s\n" \ + "\n" \ + "\n" \ + "\n" \ + "
\n" \ + "
\n" \ + "

%s

\n" \ + "

%s

\n" \ + "
\n" \ + "
\n" \ + "\n", + _("Private Browsing"), + css_style, img_data_base64 ? img_data_base64 : "", + _("Private Browsing"), + _("You are currently browsing incognito. 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, ""); -- cgit v1.2.3