@@ -109,7 +109,7 @@ namespace Scratch.FolderManager {
109109 };
110110
111111 var menu = new Gtk .Menu ();
112- menu. append (create_submenu_for_open_in (info, file_type));
112+ menu. append (create_open_in_menuitem (info, file_type));
113113 menu. append (contractor_item);
114114 menu. append (new Gtk .SeparatorMenuItem ());
115115 menu. append (create_submenu_for_new ());
@@ -122,49 +122,56 @@ namespace Scratch.FolderManager {
122122 return menu;
123123 }
124124
125- protected Gtk .MenuItem create_submenu_for_open_in (GLib .FileInfo ? info , string ? file_type ) {
126- var other_menuitem = new Gtk .MenuItem .with_label (_(" Other Application…" ));
127- other_menuitem. activate. connect (() = > show_app_chooser (file));
125+ protected Gtk .MenuItem create_open_in_menuitem (GLib .FileInfo ? info , string ? file_type ) {
126+ Gtk . MenuItem open_in_item = null ;
128127
129- file_type = file_type ?? " inode/directory" ;
128+ if (in_sandbox) {
129+ open_in_item = new Gtk .MenuItem .with_label (_(" Open In…" ));
130+ open_in_item. activate. connect (() = > show_app_chooser (file));
131+ } else {
132+ var other_menuitem = new Gtk .MenuItem .with_label (_(" Other Application…" ));
133+ other_menuitem. activate. connect (() = > show_app_chooser (file));
130134
131- var open_in_menu = new Gtk . Menu () ;
135+ file_type = file_type ?? " inode/directory " ;
132136
133- if (info != null ) {
134- List<AppInfo > external_apps = GLib . AppInfo . get_all_for_type (file_type);
137+ var open_in_menu = new Gtk .Menu ();
135138
136- string this_id = GLib . Application . get_default (). application_id + " .desktop" ;
139+ if (info != null ) {
140+ List<AppInfo > external_apps = GLib . AppInfo . get_all_for_type (file_type);
137141
138- foreach (AppInfo app_info in external_apps) {
139- if (app_info. get_id () == this_id) {
140- continue ;
141- }
142+ string this_id = GLib . Application . get_default (). application_id + " .desktop" ;
143+
144+ foreach (AppInfo app_info in external_apps) {
145+ if (app_info. get_id () == this_id) {
146+ continue ;
147+ }
142148
143- var menuitem_icon = new Gtk .Image .from_gicon (app_info. get_icon (), Gtk . IconSize . MENU );
144- menuitem_icon. pixel_size = 16 ;
149+ var menuitem_icon = new Gtk .Image .from_gicon (app_info. get_icon (), Gtk . IconSize . MENU );
150+ menuitem_icon. pixel_size = 16 ;
145151
146- var menuitem_grid = new Gtk .Grid ();
147- menuitem_grid. add (menuitem_icon);
148- menuitem_grid. add (new Gtk .Label (app_info. get_name ()));
152+ var menuitem_grid = new Gtk .Grid ();
153+ menuitem_grid. add (menuitem_icon);
154+ menuitem_grid. add (new Gtk .Label (app_info. get_name ()));
149155
150- var item_app = new Gtk .MenuItem ();
151- item_app. add (menuitem_grid);
156+ var item_app = new Gtk .MenuItem ();
157+ item_app. add (menuitem_grid);
152158
153- item_app. activate. connect (() = > {
154- launch_app_with_file (app_info, file. file);
155- });
156- open_in_menu. add (item_app);
159+ item_app. activate. connect (() = > {
160+ launch_app_with_file (app_info, file. file);
161+ });
162+ open_in_menu. add (item_app);
163+ }
157164 }
158- }
159165
160- if (open_in_menu. get_children (). length () > 0 ) {
161- open_in_menu. add (new Gtk .SeparatorMenuItem ());
162- }
166+ if (open_in_menu. get_children (). length () > 0 ) {
167+ open_in_menu. add (new Gtk .SeparatorMenuItem ());
168+ }
163169
164- open_in_menu. add (other_menuitem);
170+ open_in_menu. add (other_menuitem);
165171
166- var open_in_item = new Gtk .MenuItem .with_label (_(" Open In" ));
167- open_in_item. submenu = open_in_menu;
172+ open_in_item = new Gtk .MenuItem .with_label (_(" Open In" ));
173+ open_in_item. submenu = open_in_menu;
174+ }
168175
169176 return open_in_item;
170177 }
0 commit comments