Skip to content

Commit

Permalink
nemo-view.c: Use a shorter menu update delay when the update has
Browse files Browse the repository at this point in the history
been triggered by a selection change.

The minimum update delay was increased from 50 to 200 a while back
to improve loading large numbers of files, but user actions don't
need to be tied to this.

ref:
linuxmint/mint21-beta#110
  • Loading branch information
mtwebster committed Jul 20, 2022
1 parent 7934751 commit 8a1887e
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions src/nemo-view.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@

#define MAX_QUEUED_UPDATES 250

#define SELECTION_CHANGED_UPDATE_INTERVAL 50

#define NEMO_VIEW_MENU_PATH_OPEN_PLACEHOLDER "/MenuBar/File/Open Placeholder"
#define NEMO_VIEW_MENU_PATH_APPLICATIONS_SUBMENU_PLACEHOLDER "/MenuBar/File/Open Placeholder/Open With/Applications Placeholder"
#define NEMO_VIEW_MENU_PATH_APPLICATIONS_PLACEHOLDER "/MenuBar/File/Open Placeholder/Applications Placeholder"
Expand Down Expand Up @@ -10232,9 +10234,8 @@ nemo_view_pop_up_location_context_menu (NemoView *view,
}

static void
schedule_update_menus (NemoView *view)
real_schedule_update_menus (NemoView *view, guint update_interval)
{
g_assert (NEMO_IS_VIEW (view));
/* Don't schedule updates after destroy (#349551),
* or if we are not active.
*/
Expand All @@ -10249,11 +10250,28 @@ schedule_update_menus (NemoView *view)
g_source_remove (view->details->update_menus_timeout_id);
view->details->update_menus_timeout_id = 0;
}
view->details->update_menus_timeout_id = g_timeout_add (view->details->update_interval,

view->details->update_menus_timeout_id = g_timeout_add (update_interval,
update_menus_timeout_callback,
view);
}

static void
schedule_update_menus (NemoView *view)
{
g_assert (NEMO_IS_VIEW (view));

real_schedule_update_menus (view, view->details->update_interval);
}

static void
selection_changed_schedule_update_menus (NemoView *view)
{
g_assert (NEMO_IS_VIEW (view));

real_schedule_update_menus (view, SELECTION_CHANGED_UPDATE_INTERVAL);
}

static void
remove_update_status_idle_callback (NemoView *view)
{
Expand Down Expand Up @@ -10343,7 +10361,7 @@ nemo_view_notify_selection_changed (NemoView *view)
*/

/* Schedule an update of menu item states to match selection */
schedule_update_menus (view);
selection_changed_schedule_update_menus (view);
}
}

Expand Down

0 comments on commit 8a1887e

Please sign in to comment.