Commit 1156fdda authored by Marek Kašík's avatar Marek Kašík

Don't allow "Send To" when there is no mail client available

Check for availability of handler of "mailto" scheme and
make "Send To..." menu entry sensitive / insensitive
accordingly during initialization of EvWindow.

Based on patch of Plamena Manolova.
parent d46d3224
......@@ -234,6 +234,9 @@ struct _EvWindowPrivate {
/* Caret navigation */
GtkWidget *ask_caret_navigation_check;
/* Send to */
gboolean has_mailto_handler;
#define EV_WINDOW_GET_PRIVATE(object) \
......@@ -465,7 +468,8 @@ ev_window_setup_action_sensitivity (EvWindow *ev_window)
ev_window_set_action_sensitive (ev_window, "FilePrint", has_pages && ok_to_print);
ev_window_set_action_sensitive (ev_window, "FileProperties", has_document && has_properties);
ev_window_set_action_sensitive (ev_window, "FileOpenContainingFolder", has_document);
ev_window_set_action_sensitive (ev_window, "FileSendTo", has_document);
ev_window_set_action_sensitive (ev_window, "FileSendTo",
has_document && ev_window->priv->has_mailto_handler);
ev_window_set_action_sensitive (ev_window, "ViewPresentation", has_document);
/* Edit menu */
......@@ -7288,6 +7292,7 @@ ev_window_init (EvWindow *ev_window)
GDBusConnection *connection;
static gint window_id = 0;
GAppInfo *app_info;
g_signal_connect (ev_window, "configure_event",
G_CALLBACK (window_configure_event_cb), NULL);
......@@ -7338,6 +7343,10 @@ ev_window_init (EvWindow *ev_window)
G_CALLBACK (activate_link_cb),
app_info = g_app_info_get_default_for_uri_scheme ("mailto");
ev_window->priv->has_mailto_handler = app_info != NULL;
g_clear_object (&app_info);
ev_window->priv->main_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (ev_window), ev_window->priv->main_box);
gtk_widget_show (ev_window->priv->main_box);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment