sendto-extension: Check for available mail client

The sendto extension now checks for an available client
supported by nautilus sendto and conditionaly adds the
"Email" option to the file menu list.

https://bugzilla.gnome.org/show_bug.cgi?id=701653
This commit is contained in:
Plamena Manolova 2013-06-04 13:05:24 +01:00 committed by Cosimo Cecchi
parent 034806e4b0
commit 837091b55d

View file

@ -56,6 +56,20 @@ sendto_callback (NautilusMenuItem *item,
g_string_free (cmd, TRUE);
}
static gboolean
check_available_mailer ()
{
GAppInfo *app_info;
app_info = g_app_info_get_default_for_uri_scheme ("mailto");
if (app_info) {
g_clear_object (&app_info);
return TRUE;
}
else
return FALSE;
}
static GList *
nautilus_nste_get_file_items (NautilusMenuProvider *provider,
GtkWidget *window,
@ -72,6 +86,9 @@ nautilus_nste_get_file_items (NautilusMenuProvider *provider,
if (files == NULL)
return NULL;
if (!check_available_mailer ())
return NULL;
one_item = (files != NULL) && (files->next == NULL);
if (one_item &&
@ -161,4 +178,3 @@ nautilus_nste_register_type (GTypeModule *module)
NAUTILUS_TYPE_MENU_PROVIDER,
&menu_provider_iface_info);
}