aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXan Lopez <xan@src.gnome.org>2008-12-12 04:10:09 +0800
committerXan Lopez <xan@src.gnome.org>2008-12-12 04:10:09 +0800
commitd9316c22dde31d8fe2907ca30f23532412363d01 (patch)
tree29bf814d1f2b6bc96732d1424286e12964217b00
parentbef98049462193ddbf06ef9b792fb357ec7415da (diff)
downloadgsoc2013-epiphany-d9316c22dde31d8fe2907ca30f23532412363d01.tar
gsoc2013-epiphany-d9316c22dde31d8fe2907ca30f23532412363d01.tar.gz
gsoc2013-epiphany-d9316c22dde31d8fe2907ca30f23532412363d01.tar.bz2
gsoc2013-epiphany-d9316c22dde31d8fe2907ca30f23532412363d01.tar.lz
gsoc2013-epiphany-d9316c22dde31d8fe2907ca30f23532412363d01.tar.xz
gsoc2013-epiphany-d9316c22dde31d8fe2907ca30f23532412363d01.tar.zst
gsoc2013-epiphany-d9316c22dde31d8fe2907ca30f23532412363d01.zip
window-commands: fix Send Link by Email for URLs with '&'
Bug #549357, patch by Susana Pereira with small modifications. svn path=/trunk/; revision=8631
-rw-r--r--src/window-commands.c46
1 files changed, 26 insertions, 20 deletions
diff --git a/src/window-commands.c b/src/window-commands.c
index 18a1ca98a..5943b3c32 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -116,15 +116,10 @@ window_cmd_file_send_to (GtkAction *action,
EphyWindow *window)
{
EphyEmbed *embed;
- char *handler, *command;
+ char *command, *subject, *body;
const char *location, *title;
- GAppInfo *appinfo;
-
- if (eel_gconf_get_boolean ("/desktop/gnome/url-handlers/mailto/enabled") == FALSE)
- {
- /* FIXME: add some UI to inform the user? */
- return;
- }
+ GdkScreen *screen;
+ GError *error = NULL;
embed = ephy_embed_container_get_active_child
(EPHY_EMBED_CONTAINER (window));
@@ -133,20 +128,31 @@ window_cmd_file_send_to (GtkAction *action,
location = ephy_embed_get_address (embed);
title = ephy_embed_get_title (embed);
- /* FIXME: better use g_app_info_get_default_for_uri_scheme () when it is
- * implemented.
- */
- handler = eel_gconf_get_string ("/desktop/gnome/url-handlers/mailto/command");
- command = g_strconcat (handler, "mailto:",
- "?Subject=\"", title,
- "\"&Body=\"", location, "\"", NULL);
+ subject = g_uri_escape_string (title, NULL, TRUE);
+ body = g_uri_escape_string (location, NULL, TRUE);
+
+ command = g_strconcat ("mailto:",
+ "?Subject=", subject,
+ "&Body=", body, NULL);
+
+ g_free (subject);
+ g_free (body);
+
+ if (window)
+ {
+ screen = gtk_widget_get_screen (GTK_WIDGET (window));
+ }
+ else
+ {
+ screen = gdk_screen_get_default ();
+ }
- appinfo = g_app_info_create_from_commandline (command, NULL, 0, NULL);
- ephy_file_launch_application (appinfo, NULL,
- gtk_get_current_event_time (),
- GTK_WIDGET (window));
+ if (!gtk_show_uri (screen, command, gtk_get_current_event_time(), &error))
+ {
+ g_warning ("Unable to send link by email: %s\n", error->message);
+ g_error_free (error);
+ }
- g_free (handler);
g_free (command);
}