diff options
author | António Fernandes <antoniof@gnome.org> | 2019-06-22 19:05:14 +0100 |
---|---|---|
committer | Ondrej Holy <oholy@redhat.com> | 2020-03-10 14:02:25 +0000 |
commit | 0ddd5c64157ae23021bd429a325a469629fd4077 (patch) | |
tree | ef0d4b85810b92ec771f0fb09909ccaf7ae9ce7f | |
parent | bd81bd895f15c7784a2487ea7d1006910ab0cb40 (diff) | |
download | nautilus-0ddd5c64157ae23021bd429a325a469629fd4077.tar.gz |
pathbar: Don't reset current location menu
Everytime there is a signal that the templates submenu or the extension
menu items may have changed, we rebuild the whole menu anew.
This is uncessary work and results in visible glitches, for instance
when thumbnails are still loading.
So, reset only the tumbnails submenu or extension submenu instead.
Fixes: https://gitlab.gnome.org/GNOME/nautilus/issues/1068
-rw-r--r-- | src/nautilus-pathbar.c | 37 |
1 files changed, 4 insertions, 33 deletions
diff --git a/src/nautilus-pathbar.c b/src/nautilus-pathbar.c index a5bace76f..6bf10c93d 100644 --- a/src/nautilus-pathbar.c +++ b/src/nautilus-pathbar.c @@ -918,49 +918,20 @@ nautilus_path_bar_class_init (NautilusPathBarClass *path_bar_class) gtk_container_class_handle_border_width (container_class); } -static void -update_current_view_menu (NautilusPathBar *self) -{ - if (self->extensions_background_menu != NULL) - { - nautilus_gmenu_set_from_model (self->extensions_section, - G_MENU_MODEL (self->extensions_background_menu)); - } - - if (self->templates_menu != NULL) - { - nautilus_gmenu_set_from_model (self->templates_submenu, - G_MENU_MODEL (self->templates_menu)); - } -} - -static void -reset_current_view_menu (NautilusPathBar *self) -{ - g_autoptr (GtkBuilder) builder = NULL; - - g_clear_object (&self->current_view_menu); - builder = gtk_builder_new_from_resource ("/org/gnome/nautilus/ui/nautilus-pathbar-context-menu.ui"); - self->current_view_menu = g_object_ref_sink (G_MENU (gtk_builder_get_object (builder, - "current-view-menu"))); - gtk_popover_bind_model (self->current_view_menu_popover, - G_MENU_MODEL (self->current_view_menu), NULL); -} - void nautilus_path_bar_set_extensions_background_menu (NautilusPathBar *self, GMenu *menu) { g_return_if_fail (NAUTILUS_IS_PATH_BAR (self)); - reset_current_view_menu (self); g_clear_object (&self->extensions_background_menu); if (menu != NULL) { self->extensions_background_menu = g_object_ref (menu); } - update_current_view_menu (self); + nautilus_gmenu_set_from_model (self->extensions_section, + G_MENU_MODEL (menu)); } void @@ -969,14 +940,14 @@ nautilus_path_bar_set_templates_menu (NautilusPathBar *self, { g_return_if_fail (NAUTILUS_IS_PATH_BAR (self)); - reset_current_view_menu (self); g_clear_object (&self->templates_menu); if (menu != NULL) { self->templates_menu = g_object_ref (menu); } - update_current_view_menu (self); + nautilus_gmenu_set_from_model (self->templates_submenu, + G_MENU_MODEL (menu)); } /* Changes the icons wherever it is needed */ |