Skip to content

Commit 7194028

Browse files
authored
Merge branch 'master' into danirabbit/sourceview-menu
2 parents 851a482 + 79766ab commit 7194028

File tree

4 files changed

+14
-17
lines changed

4 files changed

+14
-17
lines changed

src/FolderManager/FileItem.vala

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ namespace Scratch.FolderManager {
3131
view.activate (file.path);
3232
}
3333

34-
public override Gtk.Menu? get_context_menu () {
34+
public override GLib.Menu? get_context_menu () {
3535
GLib.FileInfo info = null;
3636

3737
try {
@@ -77,9 +77,7 @@ namespace Scratch.FolderManager {
7777
menu_model.append_section (null, external_actions_section);
7878
menu_model.append_section (null, direct_actions_section);
7979

80-
var menu = new Gtk.Menu.from_model (menu_model);
81-
menu.insert_action_group (FileView.ACTION_GROUP, view.actions);
82-
return menu;
80+
return menu_model;
8381
}
8482

8583
private GLib.MenuItem create_submenu_for_open_in (string? file_type) {

src/FolderManager/FolderItem.vala

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ namespace Scratch.FolderManager {
124124
}
125125
}
126126

127-
public override Gtk.Menu? get_context_menu () {
127+
public override GLib.Menu? get_context_menu () {
128128
GLib.FileInfo info = null;
129129
try {
130130
info = file.file.query_info (GLib.FileAttribute.STANDARD_CONTENT_TYPE, GLib.FileQueryInfoFlags.NONE);
@@ -179,9 +179,7 @@ namespace Scratch.FolderManager {
179179
menu_model.append_section (null, direct_actions_section);
180180
menu_model.append_section (null, search_section);
181181

182-
var menu = new Gtk.Menu.from_model (menu_model);
183-
menu.insert_action_group (FileView.ACTION_GROUP, view.actions);
184-
return menu;
182+
return menu_model;
185183
}
186184

187185
protected GLib.MenuItem create_submenu_for_open_in (string? file_type) {

src/FolderManager/ProjectFolderItem.vala

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ namespace Scratch.FolderManager {
130130
}
131131
}
132132

133-
public override Gtk.Menu? get_context_menu () {
133+
public override GLib.Menu? get_context_menu () {
134134
string file_type = "";
135135
try {
136136
var info = file.file.query_info (GLib.FileAttribute.STANDARD_CONTENT_TYPE, GLib.FileQueryInfoFlags.NONE);
@@ -303,9 +303,7 @@ namespace Scratch.FolderManager {
303303
menu_model.append_section (null, direct_actions_section);
304304
menu_model.append_section (null, search_actions_section);
305305

306-
var menu = new Gtk.Menu.from_model (menu_model);
307-
menu.insert_action_group (FileView.ACTION_GROUP, view.actions);
308-
return menu;
306+
return menu_model;
309307
}
310308

311309
protected GLib.MenuItem create_submenu_for_branch () {

src/Widgets/SourceList/SourceList.vala

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -422,10 +422,10 @@ public class SourceList : Gtk.ScrolledWindow {
422422
* any context menu items should be actioned on the item instance rather than the selected item
423423
* in the SourceList
424424
*
425-
* @return A {@link Gtk.Menu} or //null// if nothing should be displayed.
425+
* @return A {@link GLib.Menu} or //null// if nothing should be displayed.
426426
* @since 0.2
427427
*/
428-
public virtual Gtk.Menu? get_context_menu () {
428+
public virtual GLib.Menu? get_context_menu () {
429429
return null;
430430
}
431431
}
@@ -2407,10 +2407,13 @@ public class SourceList : Gtk.ScrolledWindow {
24072407
if (item != null) {
24082408
var menu = item.get_context_menu ();
24092409
if (menu != null) {
2410-
menu.attach_widget = this;
2411-
menu.popup_at_pointer (event);
2410+
var gtk_menu = new Gtk.Menu.from_model (menu) {
2411+
attach_widget = this
2412+
};
2413+
2414+
gtk_menu.popup_at_pointer (event);
24122415
if (event == null) {
2413-
menu.select_first (false);
2416+
gtk_menu.select_first (false);
24142417
}
24152418

24162419
return true;

0 commit comments

Comments
 (0)