static void migrate_web_app_links () { GList *apps, *p; apps = ephy_web_application_get_application_list (); for (p = apps; p; p = p->next) { char *desktop_file, *app_link; EphyWebApplication *app = (EphyWebApplication*)p->data; desktop_file = app->desktop_file; /* Update the link in applications. */ app_link = g_build_filename (g_get_user_data_dir (), "applications", desktop_file, NULL); if (g_file_test (app_link, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_SYMLINK)) { /* Change the link to point to the new profile dir. */ GFileInfo *info; const char *target; GFile *file = g_file_new_for_path (app_link); info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET, 0, NULL, NULL); if (info) { char *new_target; target = g_file_info_get_symlink_target (info); new_target = fix_desktop_file_and_return_new_location (target); /* FIXME: Updating the file info and setting it again should * work, but it does not? Just delete and create the link * again. */ g_file_delete (file, 0, 0); g_object_unref (file); file = g_file_new_for_path (app_link); g_file_make_symbolic_link (file, new_target, NULL, NULL); g_object_unref (info); g_free (new_target); } g_object_unref (file); } g_free (app_link); } ephy_web_application_free_application_list (apps); }
static GInputStream * ephy_request_about_send (SoupRequest *request, GCancellable *cancellable, GError **error) { EphyRequestAbout *about = EPHY_REQUEST_ABOUT (request); SoupURI *uri = soup_request_get_uri (request); GString *data_str = g_string_new("<html>"); if (!about->priv->css_style) read_css_style (about); if (!g_strcmp0 (uri->path, "plugins")) { WebKitWebPluginDatabase* database = webkit_get_web_plugin_database (); GSList *plugin_list, *p; g_string_append_printf (data_str, "<head><title>%s</title>" \ "<style type=\"text/css\">%s</style></head><body>", _("Installed plugins"), about->priv->css_style); g_string_append_printf (data_str, "<h1>%s</h1>", _("Installed plugins")); plugin_list = webkit_web_plugin_database_get_plugins (database); for (p = plugin_list; p; p = p->next) { WebKitWebPlugin *plugin = WEBKIT_WEB_PLUGIN (p->data); GSList *m, *mime_types; g_string_append_printf (data_str, "<h2>%s</h2>%s<br>%s: <b>%s</b>"\ "<table id=\"plugin-table\">" \ " <thead><tr><th>%s</th><th>%s</th><th>%s</th></tr></thead><tbody>", webkit_web_plugin_get_name (plugin), webkit_web_plugin_get_description (plugin), _("Enabled"), webkit_web_plugin_get_enabled (plugin) ? _("Yes") : _("No"), _("MIME type"), _("Description"), _("Suffixes")); mime_types = webkit_web_plugin_get_mimetypes (plugin); for (m = mime_types; m; m = m->next) { WebKitWebPluginMIMEType *mime_type = (WebKitWebPluginMIMEType*) m->data; guint i; g_string_append_printf (data_str, "<tr><td>%s</td><td>%s</td><td>", mime_type->name, mime_type->description); for (i = 0; mime_type->extensions[i] != NULL; i++) g_string_append_printf (data_str, "%s%c", mime_type->extensions[i], mime_type->extensions[i + 1] ? ',' : ' '); g_string_append (data_str, "</td></tr>"); } g_string_append (data_str, "</tbody></table>"); } webkit_web_plugin_database_plugins_list_free (plugin_list); g_string_append (data_str, "</body>"); } else if (!g_strcmp0 (uri->path, "memory")) { char *memory = ephy_smaps_to_html (EPHY_REQUEST_ABOUT (request)->priv->smaps); if (memory) { g_string_append_printf (data_str, "<head><title>%s</title>" \ "<style type=\"text/css\">%s</style></head><body>", _("Memory usage"), about->priv->css_style); g_string_append_printf (data_str, "<h1>%s</h1>", _("Memory usage")); g_string_append (data_str, memory); g_free (memory); } } else if (!g_strcmp0 (uri->path, "epiphany")) { g_string_append_printf (data_str, "<head><title>Epiphany</title>" \ "<style type=\"text/css\">%s</style></head>" \ "<body style=\"background: #3369FF; color: white; font-style: italic;\">", about->priv->css_style); g_string_append (data_str, "<div id=\"ephytext\">" \ "Il semble que la perfection soit atteinte non quand il n'y a plus rien à" \ " ajouter, mais quand il n'y a plus rien à retrancher." \ "</div>" \ "<div id=\"from\">" \ "<!-- 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 class=\"applications-body\"><h1>%s</h1>" \ "<p>%s</p>", _("Applications"), about->priv->css_style, _("Applications"), _("List of installed web applications")); g_string_append (data_str, "<form><table>"); 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 class=\"icon\"><img width=64 height=64 src=\"data:image/png;base64,%s\">" \ " </img></td><td class=\"data\"><div class=\"appname\">%s</div><div class=\"appurl\">%s</div></td><td class=\"input\"><input type=\"submit\" value=\"Delete\" id=\"%s\"></td><td class=\"date\">%s <br /> %s</td></tr>", img_data_base64, app->name, app->url, app->name, /* Note for translators: this refers to the installation date. */ _("Installed on:"), app->install_date); 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>"); about->priv->content_length = data_str->len; return g_memory_input_stream_new_from_data (g_string_free (data_str, false), about->priv->content_length, g_free); }