epiphany r8631 - trunk/src
- From: xan svn gnome org
- To: svn-commits-list gnome org
- Subject: epiphany r8631 - trunk/src
- Date: Thu, 11 Dec 2008 20:10:10 +0000 (UTC)
Author: xan
Date: Thu Dec 11 20:10:09 2008
New Revision: 8631
URL: http://svn.gnome.org/viewvc/epiphany?rev=8631&view=rev
Log:
window-commands: fix Send Link by Email for URLs with '&'
Bug #549357, patch by Susana Pereira with small modifications.
Modified:
trunk/src/window-commands.c
Modified: trunk/src/window-commands.c
==============================================================================
--- trunk/src/window-commands.c (original)
+++ trunk/src/window-commands.c Thu Dec 11 20:10:09 2008
@@ -116,15 +116,10 @@
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 @@
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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]