Skip to content

Commit 28f9325

Browse files
committed
Order plugins by priority and ensure uniqueness
Changed plugin priority in MediaInfoViewer to int.MinValue. Updated ViewerWindow.Actions to display more menu items from plugins in order of priority and to avoid duplicate plugins by grouping by plugin name.
1 parent 2af849e commit 28f9325

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

QuickLook.Plugin/QuickLook.Plugin.MediaInfoViewer/Plugin.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public partial class Plugin : IViewer, IMoreMenuExtended
3232
{
3333
private TextViewerPanel _tvp;
3434

35-
public int Priority => 0;
35+
public int Priority => int.MinValue;
3636

3737
public IEnumerable<IMenuItem> MenuItems => GetMenuItems();
3838

QuickLook/ViewerWindow.Actions.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,12 @@ internal void BeginShow(IViewer matchedPlugin, string path,
203203

204204
// Initial the more menu
205205
ClearMoreMenuUnpin();
206-
foreach (var plugin in PluginManager.GetInstance().LoadedPlugins)
206+
foreach (var plugin in
207+
PluginManager.GetInstance().LoadedPlugins
208+
.GroupBy(x => x.ToString()).Select(g => g.First()) // DistinctBy plugin name
209+
.OrderBy(p => p.Priority)) // OrderBy plugin priority
207210
{
208-
if (plugin == Plugin)
211+
if (plugin.ToString() == Plugin.ToString())
209212
{
210213
if (Plugin is IMoreMenu moreMenu && moreMenu.MenuItems is not null)
211214
{

0 commit comments

Comments
 (0)