[evince/gnome-3-8] Don't allow "Send To" when there is no mail client available



commit 034896565f7529fba2225d72534f770400aca189
Author: Marek Kasik <mkasik redhat com>
Date:   Mon Dec 16 17:29:22 2013 +0100

    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.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=701654

 shell/ev-window.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 2229ab2..9f9d1cc 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -228,6 +228,9 @@ struct _EvWindowPrivate {
 #endif
 
         guint presentation_mode_inhibit_id;
+
+       /* Send to */
+       gboolean has_mailto_handler;
 };
 
 #define EV_WINDOW_GET_PRIVATE(object) \
@@ -456,7 +459,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 */
@@ -7025,6 +7029,7 @@ ev_window_init (EvWindow *ev_window)
        GDBusConnection *connection;
        static gint window_id = 0;
 #endif
+       GAppInfo *app_info;
 
        g_signal_connect (ev_window, "configure_event",
                          G_CALLBACK (window_configure_event_cb), NULL);
@@ -7075,6 +7080,10 @@ ev_window_init (EvWindow *ev_window)
                          G_CALLBACK (activate_link_cb),
                          ev_window);
 
+       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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]