diff options
author | Xan Lopez <xlopez@igalia.com> | 2011-09-06 02:35:14 +0800 |
---|---|---|
committer | Xan Lopez <xlopez@igalia.com> | 2011-09-06 02:40:31 +0800 |
commit | 0c1f1ef6e14716bbfd2b64c057ab043e809b4364 (patch) | |
tree | 6f49af067eecff5bb4d060b0ea59e11eada32d03 /embed/ephy-request-about.c | |
parent | 0cff2bef71ac69095f62ace7be8443d42db34d32 (diff) | |
download | gsoc2013-epiphany-0c1f1ef6e14716bbfd2b64c057ab043e809b4364.tar.gz gsoc2013-epiphany-0c1f1ef6e14716bbfd2b64c057ab043e809b4364.tar.zst gsoc2013-epiphany-0c1f1ef6e14716bbfd2b64c057ab043e809b4364.zip |
Implement about:applications
A really simple way to list and delete the existing Web
Applications. Hopefully this will go completely away in 3.4 replaced
with something in the shell itself.
Diffstat (limited to 'embed/ephy-request-about.c')
-rw-r--r-- | embed/ephy-request-about.c | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/embed/ephy-request-about.c b/embed/ephy-request-about.c index 4601e4787..1203d1a7e 100644 --- a/embed/ephy-request-about.c +++ b/embed/ephy-request-about.c @@ -21,16 +21,17 @@ #ifdef HAVE_CONFIG_H #include <config.h> #endif +#include "ephy-request-about.h" + +#include "ephy-file-helpers.h" +#include "ephy-smaps.h" +#include "ephy-web-app-utils.h" #include <gio/gio.h> #include <glib/gi18n.h> #include <libsoup/soup-uri.h> #include <webkit/webkit.h> -#include "ephy-file-helpers.h" -#include "ephy-request-about.h" -#include "ephy-smaps.h" - G_DEFINE_TYPE (EphyRequestAbout, ephy_request_about, SOUP_TYPE_REQUEST) struct _EphyRequestAboutPrivate { @@ -160,6 +161,36 @@ ephy_request_about_send (SoupRequest *request, "<!-- Terre des Hommes, III: L'Avion, p. 60 -->" \ "Antoine de Saint-Exupéry" \ "</div></body>"); + } else if (!g_strcmp0 (uri->path, "applications")) { + GList *applications, *p; + + g_string_append_printf (data_str, "<head><title>%s</title>" \ + "<style type=\"text/css\">%s</style></head>" \ + "<body>", + _("Web Applications"), + about->priv->css_style); + + g_string_append_printf (data_str, "<form><table><thead><tr><th>%s</th><th>%s</th><th>%s</th></tr></thead>", + _("Icon"), _("Name"), _("Delete?")); + + applications = ephy_web_application_get_application_list (); + for (p = applications; p; p = p->next) { + char *img_data = NULL, *img_data_base64 = NULL; + gsize data_length; + EphyWebApplication *app = (EphyWebApplication*)p->data; + + if (g_file_get_contents (app->icon_url, &img_data, &data_length, NULL)) + img_data_base64 = g_base64_encode ((guchar*)img_data, data_length); + g_string_append_printf (data_str, "<tbody><tr><td><img width=64 height=64 src=\"data:image/png;base64,%s\">" \ + " </img></td><td>%s</td><td><input type=\"submit\" value=\"Delete\" id=\"%s\"></td></tr>", + img_data_base64, app->name, app->name); + g_free (img_data_base64); + g_free (img_data); + } + + g_string_append (data_str, "</form></table></body>"); + + ephy_web_application_free_application_list (applications); } g_string_append (data_str, "</html>"); |