Commit bcc67ddf authored by William Jon McCann's avatar William Jon McCann

Really don't show the new document menu item when there are no templates

https://bugzilla.gnome.org/show_bug.cgi?id=676838
parent e053fb90
...@@ -224,6 +224,7 @@ struct NautilusViewDetails ...@@ -224,6 +224,7 @@ struct NautilusViewDetails
gboolean menu_states_untrustworthy; gboolean menu_states_untrustworthy;
gboolean scripts_invalid; gboolean scripts_invalid;
gboolean templates_invalid; gboolean templates_invalid;
gboolean templates_present;
gboolean reported_load_error; gboolean reported_load_error;
/* flag to indicate that no file updates should be dispatched to subclasses. /* flag to indicate that no file updates should be dispatched to subclasses.
...@@ -5640,7 +5641,6 @@ update_templates_menu (NautilusView *view) ...@@ -5640,7 +5641,6 @@ update_templates_menu (NautilusView *view)
NautilusDirectory *directory; NautilusDirectory *directory;
GtkUIManager *ui_manager; GtkUIManager *ui_manager;
char *uri; char *uri;
GtkAction *action;
char *templates_directory_uri; char *templates_directory_uri;
if (nautilus_should_use_templates_directory ()) { if (nautilus_should_use_templates_directory ()) {
...@@ -5683,8 +5683,7 @@ update_templates_menu (NautilusView *view) ...@@ -5683,8 +5683,7 @@ update_templates_menu (NautilusView *view)
} }
nautilus_directory_list_free (sorted_copy); nautilus_directory_list_free (sorted_copy);
action = gtk_action_group_get_action (view->details->dir_action_group, NAUTILUS_ACTION_NEW_DOCUMENTS); view->details->templates_present = any_templates;
gtk_action_set_visible (action, any_templates);
g_free (templates_directory_uri); g_free (templates_directory_uri);
} }
...@@ -8898,14 +8897,15 @@ real_update_menus (NautilusView *view) ...@@ -8898,14 +8897,15 @@ real_update_menus (NautilusView *view)
update_scripts_menu (view); update_scripts_menu (view);
} }
if (can_create_files
&& !selection_contains_recent
&& view->details->templates_invalid) {
update_templates_menu (view);
}
action = gtk_action_group_get_action (view->details->dir_action_group, action = gtk_action_group_get_action (view->details->dir_action_group,
NAUTILUS_ACTION_NEW_DOCUMENTS); NAUTILUS_ACTION_NEW_DOCUMENTS);
gtk_action_set_sensitive (action, can_create_files); gtk_action_set_sensitive (action, can_create_files);
gtk_action_set_visible (action, !selection_contains_recent); gtk_action_set_visible (action, !selection_contains_recent && view->details->templates_present);
if (can_create_files && view->details->templates_invalid) {
update_templates_menu (view);
}
action = gtk_action_group_get_action (view->details->dir_action_group, action = gtk_action_group_get_action (view->details->dir_action_group,
NAUTILUS_ACTION_COPY_TO); NAUTILUS_ACTION_COPY_TO);
......
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