[nautilus/wip/antoniof/preserve_popover_menu_model: 85/87] pathbar: Don't reset current location menu
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/antoniof/preserve_popover_menu_model: 85/87] pathbar: Don't reset current location menu
- Date: Mon, 9 Mar 2020 22:58:06 +0000 (UTC)
commit 1eb48e50d57902edf18b47e5667fa391a3a2d5b4
Author: António Fernandes <antoniof gnome org>
Date: Sat Jun 22 19:05:14 2019 +0100
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
src/nautilus-pathbar.c | 37 ++++---------------------------------
1 file 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 */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]