[epiphany] ephy-about-handler: add a about:incognito handler
- From: Claudio Saavedra <csaavedra src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] ephy-about-handler: add a about:incognito handler
- Date: Tue, 5 Mar 2013 09:00:29 +0000 (UTC)
commit 4e23859050fd1410820312c16a21b3716d9f08e9
Author: Claudio Saavedra <csaavedra igalia com>
Date: Tue Feb 19 20:26:21 2013 +0200
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
data/Makefile.am | 3 ++-
data/incognito.png | Bin 0 -> 8445 bytes
data/pages/about.css | 26 ++++++++++++++++++++++++++
embed/ephy-about-handler.c | 42 ++++++++++++++++++++++++++++++++++++++++++
embed/ephy-embed-utils.c | 1 +
5 files changed, 71 insertions(+), 1 deletions(-)
---
diff --git a/data/Makefile.am b/data/Makefile.am
index a95a380..6449caa 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -53,7 +53,8 @@ $(default_bookmarks_DATA): $(default_bookmarks_in_files) Makefile $(INTLTOOL_MER
iconsdir = $(pkgdatadir)/icons
dist_icons_DATA = \
missing-thumbnail.png \
- thumbnail-frame.png
+ thumbnail-frame.png \
+ incognito.png
EXTRA_DIST = \
$(aboutdialog_DATA) \
diff --git a/data/incognito.png b/data/incognito.png
new file mode 100644
index 0000000..8aa2929
Binary files /dev/null and b/data/incognito.png differ
diff --git a/data/pages/about.css b/data/pages/about.css
index 6e563d6..7f349d9 100644
--- a/data/pages/about.css
+++ b/data/pages/about.css
@@ -133,3 +133,29 @@ body {
.applications-body .appname { font-weight: bold; }
.applications-body .appurl, td.date { color: #babdb6; }
.applications-body input { width: 100%; padding: 8px; }
+
+/* about:incognito */
+
+.incognito-body {
+ margin: 0;
+ padding: 0;
+}
+
+.incognito-body div#mainblock {
+ display: table;
+ max-width: 40em;
+ margin-left: auto;
+ margin-right: auto;
+ height: 75%;
+}
+
+.incognito-body div#mainblock>div {
+ margin: 0 10px;
+ display: table-cell;
+ vertical-align: middle;
+ padding: 0 20px 0 160px;
+}
+
+.incognito-body h1 {
+ color: #888a85;
+}
diff --git a/embed/ephy-about-handler.c b/embed/ephy-about-handler.c
index e9328a1..9955d36 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>");
diff --git a/embed/ephy-embed-utils.c b/embed/ephy-embed-utils.c
index 626c1bd..80a28bc 100644
--- a/embed/ephy-embed-utils.c
+++ b/embed/ephy-embed-utils.c
@@ -167,6 +167,7 @@ ephy_embed_utils_url_is_empty (const char *location)
* window's location entry. */
static const char * do_not_show_address[] = {
"about:blank",
+ "ephy-about:incognito",
"ephy-about:overview",
NULL
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]