Skip to content

Commit

Permalink
Consistent action names
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Wootten authored and Jeremy Wootten committed Jan 29, 2025
1 parent e9630cd commit dd443a9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/FolderManager/FileView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class Scratch.FolderManager.FileView : Code.Widgets.SourceList, Code.Pane
public const string ACTION_DELETE = "delete";
public const string ACTION_NEW_FILE = "new-file";
public const string ACTION_NEW_FOLDER = "new-folder";
public const string ACTION_CHANGE_BRANCH = "change-branch";
public const string ACTION_CHECKOUT_LOCAL_BRANCH = "checkout-local-branch";
public const string ACTION_CHECKOUT_REMOTE_BRANCH = "checkout-remote-branch";
public const string ACTION_CLOSE_FOLDER = "close-folder";
public const string ACTION_CLOSE_OTHER_FOLDERS = "close-other-folders";
Expand Down
16 changes: 8 additions & 8 deletions src/FolderManager/ProjectFolderItem.vala
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace Scratch.FolderManager {

private static Icon added_icon;
private static Icon modified_icon;
private SimpleAction change_branch_action;
private SimpleAction checkout_local_branch_action;
private SimpleAction checkout_remote_branch_action;

public signal void closed ();
Expand Down Expand Up @@ -69,16 +69,16 @@ namespace Scratch.FolderManager {
);
}

change_branch_action.set_state (monitored_repo.branch_name);
checkout_local_branch_action.set_state (monitored_repo.branch_name);
}
}

construct {
monitored_repo = Scratch.Services.GitManager.get_instance ().add_project (this);
notify["name"].connect (branch_or_name_changed);
if (monitored_repo != null) {
change_branch_action = new SimpleAction.stateful (
FileView.ACTION_CHANGE_BRANCH,
checkout_local_branch_action = new SimpleAction.stateful (
FileView.ACTION_CHECKOUT_LOCAL_BRANCH,
GLib.VariantType.STRING,
""
);
Expand All @@ -92,7 +92,7 @@ namespace Scratch.FolderManager {
monitored_repo.file_status_change.connect (() => update_item_status (null));
monitored_repo.update_status_map ();
monitored_repo.branch_changed ();
change_branch_action.activate.connect (handle_change_branch_action);
checkout_local_branch_action.activate.connect (handle_checkout_local_branch_action);
checkout_remote_branch_action.activate.connect (handle_checkout_remote_branch_action);
}
}
Expand Down Expand Up @@ -310,7 +310,7 @@ namespace Scratch.FolderManager {

protected GLib.MenuItem create_submenu_for_branch () {
// Ensures that action for relevant project is being used
view.actions.add_action (change_branch_action);
view.actions.add_action (checkout_local_branch_action);
view.actions.add_action (checkout_remote_branch_action);

unowned var local_branches = monitored_repo.get_local_branches ();
Expand All @@ -322,7 +322,7 @@ namespace Scratch.FolderManager {
local_branch_menu.append (
branch_name,
GLib.Action.print_detailed_name (
FileView.ACTION_PREFIX + FileView.ACTION_CHANGE_BRANCH,
FileView.ACTION_PREFIX + FileView.ACTION_CHECKOUT_LOCAL_BRANCH,
branch_name
)
);
Expand Down Expand Up @@ -378,7 +378,7 @@ namespace Scratch.FolderManager {
return menu_item;
}

private void handle_change_branch_action (GLib.Variant? param) {
private void handle_checkout_local_branch_action (GLib.Variant? param) {
var branch_name = param != null ? param.get_string () : "";
try {
monitored_repo.change_local_branch (branch_name);
Expand Down

0 comments on commit dd443a9

Please sign in to comment.