Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/FolderManager/FileItem.vala
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace Scratch.FolderManager {
view.activate (file.path);
}

public override Gtk.Menu? get_context_menu () {
public override GLib.Menu? get_context_menu () {
GLib.FileInfo info = null;

try {
Expand Down Expand Up @@ -77,9 +77,7 @@ namespace Scratch.FolderManager {
menu_model.append_section (null, external_actions_section);
menu_model.append_section (null, direct_actions_section);

var menu = new Gtk.Menu.from_model (menu_model);
menu.insert_action_group (FileView.ACTION_GROUP, view.actions);
return menu;
return menu_model;
}

private GLib.MenuItem create_submenu_for_open_in (string? file_type) {
Expand Down
6 changes: 2 additions & 4 deletions src/FolderManager/FolderItem.vala
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ namespace Scratch.FolderManager {
}
}

public override Gtk.Menu? get_context_menu () {
public override GLib.Menu? get_context_menu () {
GLib.FileInfo info = null;
try {
info = file.file.query_info (GLib.FileAttribute.STANDARD_CONTENT_TYPE, GLib.FileQueryInfoFlags.NONE);
Expand Down Expand Up @@ -179,9 +179,7 @@ namespace Scratch.FolderManager {
menu_model.append_section (null, direct_actions_section);
menu_model.append_section (null, search_section);

var menu = new Gtk.Menu.from_model (menu_model);
menu.insert_action_group (FileView.ACTION_GROUP, view.actions);
return menu;
return menu_model;
}

protected GLib.MenuItem create_submenu_for_open_in (string? file_type) {
Expand Down
6 changes: 2 additions & 4 deletions src/FolderManager/ProjectFolderItem.vala
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ namespace Scratch.FolderManager {
}
}

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

var menu = new Gtk.Menu.from_model (menu_model);
menu.insert_action_group (FileView.ACTION_GROUP, view.actions);
return menu;
return menu_model;
}

protected GLib.MenuItem create_submenu_for_branch () {
Expand Down
13 changes: 8 additions & 5 deletions src/Widgets/SourceList/SourceList.vala
Original file line number Diff line number Diff line change
Expand Up @@ -422,10 +422,10 @@ public class SourceList : Gtk.ScrolledWindow {
* any context menu items should be actioned on the item instance rather than the selected item
* in the SourceList
*
* @return A {@link Gtk.Menu} or //null// if nothing should be displayed.
* @return A {@link GLib.Menu} or //null// if nothing should be displayed.
* @since 0.2
*/
public virtual Gtk.Menu? get_context_menu () {
public virtual GLib.Menu? get_context_menu () {
return null;
}
}
Expand Down Expand Up @@ -2407,10 +2407,13 @@ public class SourceList : Gtk.ScrolledWindow {
if (item != null) {
var menu = item.get_context_menu ();
if (menu != null) {
menu.attach_widget = this;
menu.popup_at_pointer (event);
var gtk_menu = new Gtk.Menu.from_model (menu) {
attach_widget = this
};

gtk_menu.popup_at_pointer (event);
if (event == null) {
menu.select_first (false);
gtk_menu.select_first (false);
}

return true;
Expand Down