Skip to content

Commit

Permalink
Sort Apps for "Open in ..." (#1519)
Browse files Browse the repository at this point in the history
* Sort Apps for "Open in ..." by name; avoid duplicate Files entry

* Use string.collate ()

---------

Co-authored-by: Jeremy Wootten <[email protected]>
Co-authored-by: Ryo Nakano <[email protected]>
  • Loading branch information
3 people authored Jan 29, 2025
1 parent 657ff2e commit 6056e9a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/Utils.vala
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,14 @@ namespace Scratch.Utils {
}

public GLib.Menu create_executable_app_items_for_file (GLib.File file, string file_type) {
List<AppInfo> external_apps = GLib.AppInfo.get_all_for_type (file_type);
var files_appinfo = AppInfo.get_default_for_type ("inode/directory", true);
external_apps.prepend (files_appinfo);

string this_id = GLib.Application.get_default ().application_id + ".desktop";
var external_apps = GLib.AppInfo.get_all_for_type (file_type);
var this_id = GLib.Application.get_default ().application_id + ".desktop";
var menu = new GLib.Menu ();

external_apps.sort ((a, b) => {
return a.get_name ().collate (b.get_name ());
});

foreach (AppInfo app_info in external_apps) {
string app_id = app_info.get_id ();
if (app_id == this_id) {
Expand Down

0 comments on commit 6056e9a

Please sign in to comment.