summaryrefslogtreecommitdiff
path: root/embed/ephy-about-handler.c
diff options
context:
space:
mode:
authorJan-Michael Brummer <jan.brummer@tabos.org>2019-05-02 15:08:00 +0200
committerJan-Michael Brummer <jan.brummer@tabos.org>2019-05-02 15:03:48 +0000
commit70b587d5da80e76ba0838a4e7e6b0fecd290a47a (patch)
tree43b162e06b8fb34c1bafd393bb8f54b7cbda4680 /embed/ephy-about-handler.c
parenta48d8eea97e6cbcb8b37e8b278e5f16f44e7e900 (diff)
downloadepiphany-70b587d5da80e76ba0838a4e7e6b0fecd290a47a.tar.gz
Add empty state for about:applications
Fixes: https://gitlab.gnome.org/GNOME/epiphany/issues/663
Diffstat (limited to 'embed/ephy-about-handler.c')
-rw-r--r--embed/ephy-about-handler.c87
1 files changed, 57 insertions, 30 deletions
diff --git a/embed/ephy-about-handler.c b/embed/ephy-about-handler.c
index 2bbf1c90e..2ee1c8df9 100644
--- a/embed/ephy-about-handler.c
+++ b/embed/ephy-about-handler.c
@@ -236,41 +236,68 @@ handle_applications_finished_cb (EphyAboutHandler *handler,
GList *applications, *p;
data_str = g_string_new (NULL);
- g_string_append_printf (data_str, "<html><head><title>%s</title>"
- "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />"
- "<link href=\""EPHY_PAGE_TEMPLATE_ABOUT_CSS "\" rel=\"stylesheet\" type=\"text/css\">"
- "<script>"
- " function deleteWebApp(appID) {"
- " window.webkit.messageHandlers.aboutApps.postMessage(appID);"
- " var row = document.getElementById(appID);"
- " row.parentNode.removeChild(row);"
- " }"
- "</script>"
- "</head><body class=\"applications-body\"><h1>%s</h1>"
- "<p>%s</p>",
- _("Applications"),
- _("Applications"),
- _("List of installed web applications"));
-
- g_string_append (data_str, "<table>");
-
applications = g_task_propagate_pointer (G_TASK (result), NULL);
- for (p = applications; p; p = p->next) {
- EphyWebApplication *app = (EphyWebApplication *)p->data;
+ if (g_list_length (applications) > 0) {
+ g_string_append_printf (data_str, "<html><head><title>%s</title>"
+ "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />"
+ "<link href=\""EPHY_PAGE_TEMPLATE_ABOUT_CSS "\" rel=\"stylesheet\" type=\"text/css\">"
+ "<script>"
+ " function deleteWebApp(appID) {"
+ " window.webkit.messageHandlers.aboutApps.postMessage(appID);"
+ " var row = document.getElementById(appID);"
+ " row.parentNode.removeChild(row);"
+ " }"
+ "</script>"
+ "</head><body class=\"applications-body\"><h1>%s</h1>"
+ "<p>%s</p>",
+ _("Applications"),
+ _("Applications"),
+ _("List of installed web applications"));
+
+ g_string_append (data_str, "<table>");
+
+ for (p = applications; p; p = p->next) {
+ EphyWebApplication *app = (EphyWebApplication *)p->data;
+
+ g_string_append_printf (data_str,
+ "<tbody><tr id =\"%s\">"
+ "<td class=\"icon\"><img width=64 height=64 src=\"file://%s\"></img></td>"
+ "<td class=\"data\"><div class=\"appname\">%s</div><div class=\"appurl\">%s</div></td>"
+ "<td class=\"input\"><input type=\"button\" value=\"%s\" onclick=\"deleteWebApp('%s');\"></td>"
+ "<td class=\"date\">%s <br /> %s</td></tr></tbody>",
+ app->id, app->icon_url, app->name, app->url, _("Delete"), app->id,
+ /* Note for translators: this refers to the installation date. */
+ _("Installed on:"), app->install_date);
+ }
+
+ g_string_append (data_str, "</table></body></html>");
+ } else {
+ g_autoptr(GtkIconInfo) icon_info = NULL;
+ g_autofree gchar *icon = g_strconcat ("application-x-addon-symbolic", NULL);
+
+ g_string_append_printf (data_str, "<html><head><title>%s</title>"
+ "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />"
+ "<link href=\""EPHY_PAGE_TEMPLATE_ABOUT_CSS "\" rel=\"stylesheet\" type=\"text/css\">"
+ "</head><body class=\"applications-body\">",
+ _("Applications"));
+
+ icon_info = gtk_icon_theme_lookup_icon (gtk_icon_theme_get_default (),
+ icon,
+ 128,
+ 0);
g_string_append_printf (data_str,
- "<tbody><tr id =\"%s\">"
- "<td class=\"icon\"><img width=64 height=64 src=\"file://%s\"></img></td>"
- "<td class=\"data\"><div class=\"appname\">%s</div><div class=\"appurl\">%s</div></td>"
- "<td class=\"input\"><input type=\"button\" value=\"%s\" onclick=\"deleteWebApp('%s');\"></td>"
- "<td class=\"date\">%s <br /> %s</td></tr></tbody>",
- app->id, app->icon_url, app->name, app->url, _("Delete"), app->id,
- /* Note for translators: this refers to the installation date. */
- _("Installed on:"), app->install_date);
+ " <div id=\"overview\" 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 applications without any installed web apps. */
+ _("Applications"), _("You can add your favorite website by clicking <b>Install Site as Web Application…</b> within page menu."));
}
- g_string_append (data_str, "</table></body></html>");
-
ephy_web_application_free_application_list (applications);
data_length = data_str->len;