Skip to content

Commit

Permalink
nemo-view.c: Clear extension menu items during real_update_menus.
Browse files Browse the repository at this point in the history
Extension menu items take a reference to the file selection, and
this reference isn't cleared until the next time the extension
menu items are fetched (via  GClosureNotify), which, as of f5124bc
is only done during a right-click.

Instead, clear the extension actions when real_update_menus runs,
which includes after a selection change, and during view location
changes.

Fixes linuxmint/mint20.2-beta#20.
  • Loading branch information
mtwebster committed Jun 24, 2021
1 parent 659362f commit 001912f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/nemo-view.c
Original file line number Diff line number Diff line change
Expand Up @@ -5648,6 +5648,8 @@ add_extension_action_for_files (NemoView *view,
gtk_action_set_sensitive (action, sensitive);
g_object_set (action, "is-important", priority, NULL);

// FIXME: Don't add the selection to the action data.
// Just grab the selection in the activation callback.
data = g_new0 (ExtensionActionCallbackData, 1);
data->item = g_object_ref (item);
data->view = view;
Expand Down Expand Up @@ -9604,6 +9606,7 @@ update_configurable_context_menu_items (NemoView *view)
static void
real_update_menus (NemoView *view)
{
GtkUIManager *ui_manager;
GList *selection, *l;
gint selection_count;
const char *tip, *label;
Expand Down Expand Up @@ -10033,6 +10036,11 @@ real_update_menus (NemoView *view)
!selection_contains_recent && !selection_contains_trash);
}

ui_manager = nemo_window_get_ui_manager (view->details->window);
nemo_ui_unmerge_ui (ui_manager,
&view->details->extensions_menu_merge_id,
&view->details->extensions_menu_action_group);

update_configurable_context_menu_items (view);

nemo_file_list_free (selection);
Expand Down

1 comment on commit 001912f

@schinfo
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The patch doesn't work - it makes a problem with the submenu.

without the patch:

Bildschirmfoto vom 2021-06-25 12-36-10

with the patch:
Bildschirmfoto vom 2021-06-25 12-38-38

Please sign in to comment.