Skip to content

Commit

Permalink
AbstractMountableRow: use add_with_action_name directly (#2473)
Browse files Browse the repository at this point in the history
Co-authored-by: Jeremy Wootten <jeremywootten@gmail.com>
  • Loading branch information
danirabbit and jeremypw authored Sep 5, 2024
1 parent 5359669 commit a0cd0f9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 17 deletions.
15 changes: 1 addition & 14 deletions libcore/PopupMenuBuilder.vala
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,6 @@ public class PopupMenuBuilder : Object {
return add_item (new Gtk.MenuItem.with_label (_("Rename")), cb);
}

public void add_unmount () {
add_with_action_name (_("_Unmount"), "mountable.unmount");
}

public void add_drive_property () {
add_with_action_name (_("Properties"), "mountable.properties");
}

public void add_eject_drive () {
// Do we need different text for USB sticks and optical drives?
add_with_action_name (_("Eject Media"), "mountable.eject");
}

public void add_safely_remove () {
// Do we need different text for USB sticks and optical drives?
add_with_action_name (_("Safely Remove"), "mountable.safely-remove");
Expand Down Expand Up @@ -121,7 +108,7 @@ public class PopupMenuBuilder : Object {
return add_item (new Gtk.SeparatorMenuItem ());
}

private void add_with_action_name (string label, string action_name) {
public void add_with_action_name (string label, string action_name) {
var menu_item = new Gtk.MenuItem.with_mnemonic (label);
menu_item.set_detailed_action_name (
Action.print_detailed_name (action_name, null)
Expand Down
4 changes: 2 additions & 2 deletions src/View/Sidebar/AbstractMountableRow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,12 @@ public abstract class Sidebar.AbstractMountableRow : Sidebar.BookmarkRow, Sideba
}

if (mount.can_unmount ()) {
menu_builder.add_unmount ();
menu_builder.add_with_action_name (_("_Unmount"), "mountable.unmount");
}
}

menu_builder.add_separator ();
menu_builder.add_drive_property (); // This will mount if necessary
menu_builder.add_with_action_name (_("Properties"), "mountable.properties"); // This will mount if necessary
}

protected async bool get_filesystem_space_for_root (File root, Cancellable? update_cancellable) {
Expand Down
3 changes: 2 additions & 1 deletion src/View/Sidebar/VolumeRow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ public class Sidebar.VolumeRow : Sidebar.AbstractMountableRow, SidebarItemInterf
menu_builder.add_safely_remove ();
} else if (mount == null && drive.can_eject ()) {
menu_builder.add_separator ();
menu_builder.add_eject_drive ();
// Do we need different text for USB sticks and optical drives?
menu_builder.add_with_action_name (_("Eject Media"), "mountable.eject");
}
}

Expand Down

0 comments on commit a0cd0f9

Please sign in to comment.