Skip to content

Commit 6056e9a

Browse files
jeremypwJeremy Woottenryonakano
authored
Sort Apps for "Open in ..." (#1519)
* 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]>
1 parent 657ff2e commit 6056e9a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/Utils.vala

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,13 +202,14 @@ namespace Scratch.Utils {
202202
}
203203

204204
public GLib.Menu create_executable_app_items_for_file (GLib.File file, string file_type) {
205-
List<AppInfo> external_apps = GLib.AppInfo.get_all_for_type (file_type);
206-
var files_appinfo = AppInfo.get_default_for_type ("inode/directory", true);
207-
external_apps.prepend (files_appinfo);
208-
209-
string this_id = GLib.Application.get_default ().application_id + ".desktop";
205+
var external_apps = GLib.AppInfo.get_all_for_type (file_type);
206+
var this_id = GLib.Application.get_default ().application_id + ".desktop";
210207
var menu = new GLib.Menu ();
211208

209+
external_apps.sort ((a, b) => {
210+
return a.get_name ().collate (b.get_name ());
211+
});
212+
212213
foreach (AppInfo app_info in external_apps) {
213214
string app_id = app_info.get_id ();
214215
if (app_id == this_id) {

0 commit comments

Comments
 (0)