files-view: Clear :templates-menu if it should not be used

If the templates dir is set to Home, then it should not be used.
We set the priv->templates_present boolean to FALSE in that case,
but forget to set the :templates-menu property to NULL too.

Fix that corner case issue. Also, drop the useless boolean and
just check directly whether the menu is present (i.e. not NULL).
This commit is contained in:
António Fernandes 2021-10-26 17:05:31 +01:00 committed by Ondrej Holy
parent 6afce418af
commit a520e27048

View file

@ -220,7 +220,6 @@ typedef struct
* after it finishes loading the directory and its view.
*/
gboolean loading;
gboolean templates_present;
gboolean scripts_present;
gboolean in_destruction;
@ -5895,7 +5894,7 @@ update_templates_menu (NautilusFilesView *view,
}
else
{
priv->templates_present = FALSE;
nautilus_view_set_templates_menu (NAUTILUS_VIEW (view), NULL);
return;
}
@ -5929,8 +5928,6 @@ update_templates_menu (NautilusFilesView *view,
nautilus_directory_unref (directory);
priv->templates_present = submenu != NULL;
g_free (templates_directory_uri);
}
@ -7967,7 +7964,7 @@ real_update_actions_state (NautilusFilesView *view)
can_create_files &&
!selection_contains_recent &&
!selection_contains_starred &&
priv->templates_present);
priv->templates_menu != NULL);
/* Actions that are related to the clipboard need request, request the data
* and update them once we have the data */