diff options
author | Milan Crha <mcrha@redhat.com> | 2011-02-28 20:54:50 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-06-30 00:41:40 +0800 |
commit | 07d728685900606936f408ec931967eeb8f338f0 (patch) | |
tree | 5c3680a307e2a2df8682191429bd47ca6da34a50 | |
parent | 095a0e5d65a7029cc8abc9ba8c7ca01de3836556 (diff) | |
download | gsoc2013-evolution-07d728685900606936f408ec931967eeb8f338f0.tar gsoc2013-evolution-07d728685900606936f408ec931967eeb8f338f0.tar.gz gsoc2013-evolution-07d728685900606936f408ec931967eeb8f338f0.tar.bz2 gsoc2013-evolution-07d728685900606936f408ec931967eeb8f338f0.tar.lz gsoc2013-evolution-07d728685900606936f408ec931967eeb8f338f0.tar.xz gsoc2013-evolution-07d728685900606936f408ec931967eeb8f338f0.tar.zst gsoc2013-evolution-07d728685900606936f408ec931967eeb8f338f0.zip |
Bug #641374 - "Send new mail to..." popup action doesn't work
-rw-r--r-- | mail/e-mail-display.c | 54 | ||||
-rw-r--r-- | widgets/misc/e-web-view.c | 18 | ||||
-rw-r--r-- | widgets/misc/e-web-view.h | 1 |
3 files changed, 56 insertions, 17 deletions
diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c index d13eca3bcf..7fc16943a4 100644 --- a/mail/e-mail-display.c +++ b/mail/e-mail-display.c @@ -228,6 +228,41 @@ mail_display_url_requested (GtkHTML *html, * until EMFormatHTML is made asynchronous. */ } +static gboolean +mail_display_process_mailto (EWebView *web_view, const gchar *mailto_uri) +{ + g_return_val_if_fail (web_view != NULL, FALSE); + g_return_val_if_fail (mailto_uri != NULL, FALSE); + g_return_val_if_fail (E_IS_MAIL_DISPLAY (web_view), FALSE); + + if (g_ascii_strncasecmp (mailto_uri, "mailto:", 7) == 0) { + EMailDisplayPrivate *priv; + EMFormat *format; + CamelFolder *folder = NULL; + const gchar *folder_uri = NULL; + EShell *shell; + + priv = E_MAIL_DISPLAY (web_view)->priv; + g_return_val_if_fail (priv->formatter != NULL, FALSE); + + format = EM_FORMAT (priv->formatter); + + if (format != NULL && format->folder != NULL) + folder = format->folder; + + if (folder != NULL) + folder_uri = camel_folder_get_uri (folder); + + shell = e_shell_get_default (); + em_utils_compose_new_message_with_mailto ( + shell, mailto_uri, folder_uri); + + return TRUE; + } + + return FALSE; +} + static void mail_display_link_clicked (GtkHTML *html, const gchar *uri) @@ -262,22 +297,8 @@ mail_display_link_clicked (GtkHTML *html, priv->formatter->header_wrap_flags = flags; em_format_queue_redraw (EM_FORMAT (priv->formatter)); - } else if (g_ascii_strncasecmp (uri, "mailto:", 7) == 0) { - EMFormat *format = EM_FORMAT (priv->formatter); - CamelFolder *folder = NULL; - const gchar *folder_uri = NULL; - EShell *shell; - - if (format != NULL && format->folder != NULL) - folder = format->folder; - - if (folder != NULL) - folder_uri = camel_folder_get_uri (folder); - - shell = e_shell_get_default (); - em_utils_compose_new_message_with_mailto ( - shell, uri, folder_uri); - + } else if (mail_display_process_mailto (E_WEB_VIEW (html), uri)) { + /* do nothing, function handled the "mailto:" uri already */ } else if (*uri == '#') gtk_html_jump_to_anchor (html, uri + 1); @@ -315,6 +336,7 @@ mail_display_class_init (EMailDisplayClass *class) web_view_class = E_WEB_VIEW_CLASS (class); web_view_class->load_string = mail_display_load_string; + web_view_class->process_mailto = mail_display_process_mailto; html_class = GTK_HTML_CLASS (class); html_class->url_requested = mail_display_url_requested; diff --git a/widgets/misc/e-web-view.c b/widgets/misc/e-web-view.c index d227a720ad..0e90d7dff9 100644 --- a/widgets/misc/e-web-view.c +++ b/widgets/misc/e-web-view.c @@ -88,6 +88,7 @@ enum { STATUS_MESSAGE, STOP_LOADING, UPDATE_ACTIONS, + PROCESS_MAILTO, LAST_SIGNAL }; @@ -337,6 +338,7 @@ action_send_message_cb (GtkAction *action, { const gchar *uri; gpointer parent; + gboolean handled; parent = gtk_widget_get_toplevel (GTK_WIDGET (web_view)); parent = gtk_widget_is_toplevel (parent) ? parent : NULL; @@ -344,7 +346,11 @@ action_send_message_cb (GtkAction *action, uri = e_web_view_get_selected_uri (web_view); g_return_if_fail (uri != NULL); - e_show_uri (parent, uri); + handled = FALSE; + g_signal_emit (web_view, signals[PROCESS_MAILTO], 0, uri, &handled); + + if (!handled) + e_show_uri (parent, uri); } static void @@ -1335,6 +1341,16 @@ e_web_view_class_init (EWebViewClass *class) NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); + + /* return TRUE when a signal handler processed the mailto URI */ + signals[PROCESS_MAILTO] = g_signal_new ( + "process-mailto", + G_TYPE_FROM_CLASS (class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (EWebViewClass, process_mailto), + NULL, NULL, + e_marshal_BOOLEAN__STRING, + G_TYPE_BOOLEAN, 1, G_TYPE_STRING); } static void diff --git a/widgets/misc/e-web-view.h b/widgets/misc/e-web-view.h index f7ffefe935..1ad87c6756 100644 --- a/widgets/misc/e-web-view.h +++ b/widgets/misc/e-web-view.h @@ -88,6 +88,7 @@ struct _EWebViewClass { const gchar *status_message); void (*stop_loading) (EWebView *web_view); void (*update_actions) (EWebView *web_view); + gboolean (*process_mailto) (EWebView *web_view, const gchar *mailto_uri); }; GType e_web_view_get_type (void); |