After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 701653 - Send To option is still displayed on item right click even if there is no email client
Send To option is still displayed on item right click even if there is no ema...
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: general
3.8.x
Other Linux
: High critical
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-06-05 15:17 UTC by pnmanolova
Modified: 2013-06-07 21:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
My proposed fix for this issue (1.63 KB, patch)
2013-06-05 15:18 UTC, pnmanolova
needs-work Details | Review
Updated patch (1.90 KB, patch)
2013-06-06 10:24 UTC, pnmanolova
needs-work Details | Review
Updated patch with removed string checks (1.55 KB, patch)
2013-06-07 10:24 UTC, pnmanolova
committed Details | Review

Description pnmanolova 2013-06-05 15:17:24 UTC
The Send To option is still available to the user if there is no email client
installed on the system. Furthermore if the Send To option is selected the current nautilus window crashes since nautilus-sendto is executed even though there is no mailer for it to start.
Comment 1 pnmanolova 2013-06-05 15:18:00 UTC
Created attachment 246087 [details] [review]
My proposed fix for this issue
Comment 2 Cosimo Cecchi 2013-06-05 16:09:01 UTC
Review of attachment 246087 [details] [review]:

Thanks for the patch! Looks generally good to me, with some comments below.

::: nautilus-sendto-extension/nautilus-nste.c
@@ +74,3 @@
 		return NULL;
+  
+  if (!check_available_mailer ())

Indentation should follow the surrounding coding style.

@@ +171,3 @@
+  GAppInfo *app_info;
+
+	app_info = g_app_info_get_default_for_uri_scheme ("mailto");

You need to unref app_info when not NULL - you can use g_clear_object(&app_info); that also takes care of the NULL check for you.

@@ +174,3 @@
+	if (app_info)
+	  {
+  GAppInfo *app_info;

I don't think you need to explicitly check the name here; just return FALSE if app_info is NULL.
Comment 3 pnmanolova 2013-06-06 10:24:39 UTC
Created attachment 246133 [details] [review]
Updated patch
Comment 4 pnmanolova 2013-06-06 10:26:03 UTC
Thanks for the review! I uploaded the modified patch. I think it's worthwhile to keep the name-check since nautilus-sendto only supports and recognizes these 4 email clients (any others are marked as unknown). And even though it would still try to launch an email client even if it's unknown, this usually leads to a crash (since different email clients need different parameters in order to be launched from command line).
Comment 5 Cosimo Cecchi 2013-06-06 18:03:25 UTC
(In reply to comment #4)
> Thanks for the review! I uploaded the modified patch. I think it's worthwhile
> to keep the name-check since nautilus-sendto only supports and recognizes these
> 4 email clients (any others are marked as unknown). And even though it would
> still try to launch an email client even if it's unknown, this usually leads to
> a crash (since different email clients need different parameters in order to be
> launched from command line).

Thanks for the updated patch! I don't want to keep those special cases in the extension code - nautilus-sendto should be made more robust not to crash when spawning an unknown mailer if that's problematic for any reason.
Comment 6 Cosimo Cecchi 2013-06-06 18:07:17 UTC
Review of attachment 246133 [details] [review]:

::: nautilus-sendto-extension/nautilus-nste.c
@@ +65,3 @@
+	if (app_info) {
+		char *mailer_name = g_app_info_get_name (app_info);
+	GAppInfo *app_info;

As for previous comment, please remove these checks, nautilus-sendto should possibly deal better with unknown mailers instead of crashing if that's problematic.

@@ +75,3 @@
+		else
+			return FALSE;
+		if (g_strcmp0 (mailer_name, "Evolution") == 0)

This line of code will never be reached, as you always return before getting here in the function.
Comment 7 pnmanolova 2013-06-07 10:24:36 UTC
Created attachment 246238 [details] [review]
Updated patch with removed string checks
Comment 8 pnmanolova 2013-06-07 10:26:23 UTC
(In reply to comment #6)
> Review of attachment 246133 [details] [review]:
> 
> ::: nautilus-sendto-extension/nautilus-nste.c
> @@ +65,3 @@
> +    if (app_info) {
> +        char *mailer_name = g_app_info_get_name (app_info);
> +    GAppInfo *app_info;
> 
> As for previous comment, please remove these checks, nautilus-sendto should
> possibly deal better with unknown mailers instead of crashing if that's
> problematic.
> 
> @@ +75,3 @@
> +        else
> +            return FALSE;
> +        if (g_strcmp0 (mailer_name, "Evolution") == 0)
> 
> This line of code will never be reached, as you always return before getting
> here in the function.

I've removed the string checks in the new patch.

Thanks,
Pam
Comment 9 Cosimo Cecchi 2013-06-07 15:27:38 UTC
Review of attachment 246238 [details] [review]:

Looks good, thanks! Do you have a GNOME git account?
Comment 10 pnmanolova 2013-06-07 16:50:07 UTC
Sorry, no. Would you mind applying the patch?
Comment 11 Cosimo Cecchi 2013-06-07 21:55:22 UTC
Pushed to master for you, thanks.