[epiphany] Improve the overview's empty state
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Improve the overview's empty state
- Date: Mon, 29 Feb 2016 20:23:21 +0000 (UTC)
commit 63fd0aa3e06b6c69ef78e0189577dc1f487c58e6
Author: Michael Catanzaro <mcatanzaro igalia com>
Date: Sat Feb 27 22:17:20 2016 -0600
Improve the overview's empty state
Not gonna admit how long it took me to figure out how to do this. This
"CSS" thing....
https://bugzilla.gnome.org/show_bug.cgi?id=762812
embed/ephy-about-handler.c | 114 +++++++++++++++++++++++---------------------
src/resources/about.css | 17 +++++--
2 files changed, 72 insertions(+), 59 deletions(-)
---
diff --git a/embed/ephy-about-handler.c b/embed/ephy-about-handler.c
index f2062c9..614b6bd 100644
--- a/embed/ephy-about-handler.c
+++ b/embed/ephy-about-handler.c
@@ -430,6 +430,7 @@ history_service_query_urls_cb (EphyHistoryService *history,
GList *urls,
WebKitURISchemeRequest *request)
{
+ EphySnapshotService *snapshot_service = ephy_snapshot_service_get_default ();
GString *data_str;
gsize data_length;
char *lang;
@@ -464,66 +465,69 @@ history_service_query_urls_cb (EphyHistoryService *history,
" }\n"
" </script>\n"
"</head>\n"
- "<body>\n"
- " <div id=\"overview\">\n"
- " <div id=\"overview-grid\">\n"
- " <ul id=\"overview-item-list\">\n", lang, lang,
+ "<body>\n",
+ lang, lang,
((gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL) ? "rtl" : "ltr"),
_("Most Visited"));
g_free (lang);
- if (success) {
- EphySnapshotService *snapshot_service = ephy_snapshot_service_get_default ();
-
- if (g_list_length (urls) > 0) {
- for (l = urls; l; l = g_list_next (l)) {
- EphyHistoryURL *url = (EphyHistoryURL *)l->data;
- const char *snapshot;
- char *thumbnail_style = NULL;
-
- snapshot = ephy_snapshot_service_lookup_snapshot_path (snapshot_service, url->url);
- if (!snapshot) {
- GetSnapshotPathAsyncData *data = g_new (GetSnapshotPathAsyncData, 1);
-
- data->url = g_strdup (url->url);
- data->mtime = url->thumbnail_time;
- ephy_snapshot_service_get_snapshot_path_for_url_async (ephy_snapshot_service_get_default (),
- url->url, url->thumbnail_time, NULL,
-
(GAsyncReadyCallback)got_snapshot_path_for_url_cb,
- data);
- } else {
- thumbnail_style = g_strdup_printf (" style=\"background: url(file://%s) no-repeat;\"", snapshot);
- }
-
- g_string_append_printf (data_str,
- "<li>"
- " <a class=\"overview-item\" title=\"%s\" href=\"%s\">"
- " <div class=\"overview-close-button\"
onclick=\"removeFromOverview(this.parentNode, event)\" title=\"%s\">✖</div>"
- " <span class=\"overview-thumbnail\"%s></span>"
- " <span class=\"overview-title\">%s</span>"
- " </a>"
- "</li>",
- g_markup_escape_text (url->title, -1), url->url, _("Remove from overview"),
- thumbnail_style ? thumbnail_style : "", url->title);
- g_free (thumbnail_style);
- }
+ if (g_list_length (urls) == 0 || !success) {
+ GtkIconInfo *icon_info;
+
+ icon_info = gtk_icon_theme_lookup_icon (gtk_icon_theme_get_default (),
+ "web-browser-symbolic",
+ 128,
+ 0);
+ g_string_append_printf (data_str,
+ " <div class=\"overview-empty\">\n"
+ " <img src=\"file://%s\"/>\n"
+ " <div><h1>%s</h1></div>\n"
+ " <div><p>%s</p></div>\n"
+ " </div>\n"
+ "</body></html>\n",
+ icon_info ? gtk_icon_info_get_filename (icon_info) : "",
+ /* Displayed when opening the browser for the first time. */
+ _("Welcome to Web"), _("Start browsing and your most-visited sites will appear
here."));
+ if (icon_info)
+ g_object_unref (icon_info);
+ goto out;
+ }
+
+ g_string_append (data_str,
+ "<div id=\"overview\">\n"
+ " <div id=\"overview-grid\">\n"
+ " <ul id=\"overview-item-list\">\n");
+
+ for (l = urls; l; l = g_list_next (l)) {
+ EphyHistoryURL *url = (EphyHistoryURL *)l->data;
+ const char *snapshot;
+ char *thumbnail_style = NULL;
+
+ snapshot = ephy_snapshot_service_lookup_snapshot_path (snapshot_service, url->url);
+ if (!snapshot) {
+ GetSnapshotPathAsyncData *data = g_new (GetSnapshotPathAsyncData, 1);
+
+ data->url = g_strdup (url->url);
+ data->mtime = url->thumbnail_time;
+ ephy_snapshot_service_get_snapshot_path_for_url_async (ephy_snapshot_service_get_default (),
+ url->url, url->thumbnail_time, NULL,
+
(GAsyncReadyCallback)got_snapshot_path_for_url_cb,
+ data);
} else {
- GtkIconInfo *icon_info;
- icon_info = gtk_icon_theme_lookup_icon (gtk_icon_theme_get_default (),
- "web-browser",
- 256,
- GTK_ICON_LOOKUP_GENERIC_FALLBACK);
-
- g_string_append_printf (data_str,
- "<li class=\"overview-empty\" >"
- " <img src=\"file://%s\"/>"
- " <h1>%s</h1>"
- "</li>",
- icon_info ? gtk_icon_info_get_filename (icon_info) : "",
- /* Displayed when opening the browser for the first time. */
- _("Start browsing and your most-visited sites will appear here"));
- gtk_icon_info_free (icon_info);
+ thumbnail_style = g_strdup_printf (" style=\"background: url(file://%s) no-repeat;\"", snapshot);
}
+
+ g_string_append_printf (data_str,
+ "<li>"
+ " <a class=\"overview-item\" title=\"%s\" href=\"%s\">"
+ " <div class=\"overview-close-button\"
onclick=\"removeFromOverview(this.parentNode, event)\" title=\"%s\">✖</div>"
+ " <span class=\"overview-thumbnail\"%s></span>"
+ " <span class=\"overview-title\">%s</span>"
+ " </a>"
+ "</li>",
+ g_markup_escape_text (url->title, -1), url->url, _("Remove from overview"),
+ thumbnail_style ? thumbnail_style : "", url->title);
+ g_free (thumbnail_style);
}
data_str = g_string_append (data_str,
@@ -532,7 +536,7 @@ history_service_query_urls_cb (EphyHistoryService *history,
" </div>\n"
"</body></html>\n");
-
+out:
data_length = data_str->len;
ephy_about_handler_finish_request (request, g_string_free (data_str, FALSE), data_length);
g_object_unref (request);
diff --git a/src/resources/about.css b/src/resources/about.css
index 9ce676e..5146ab6 100644
--- a/src/resources/about.css
+++ b/src/resources/about.css
@@ -330,20 +330,29 @@ html[dir="rtl"] .overview-item {
float: right;
}
-#overview-grid li.overview-empty {
+.overview-empty {
display: flex;
+ flex-direction: column;
align-items: center;
+ justify-content: center;
margin-left: auto;
margin-right: auto;
height: 80%;
max-width: 800px;
- -webkit-user-select: none;
- -webkit-user-drag: none;
+ opacity: 0.55; /* Adwaita's dim-label */
+ -webkit-user-select: none;
+ -webkit-user-drag: none;
+}
+
+.overview-empty h1 {
+ color: black;
+ opacity: 0.55; /* Adwaita's dim-label */
+ text-shadow: none;
}
.overview-empty img {
-webkit-user-select: none;
-webkit-user-drag: none;
filter: grayscale(100%);
- opacity: 0.2;
+ width: 128px;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]