Skip to content

Commit

Permalink
* Add new shortcut for opening a new file pane using the same working…
Browse files Browse the repository at this point in the history
… directory
  • Loading branch information
Bios-Marcel committed Dec 27, 2018
1 parent 19d2bf4 commit a9207b7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/filepane.vala
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class FilePane : Gtk.ScrolledWindow {
public FilePane (Window window, IconManager iconManager, string directory) {
this.window = window;
this.iconManager = iconManager;
this.currentDirectory = directory;

fileTree.set_sort_column_id (1, Gtk.SortType.ASCENDING);
fileTree.set_sort_func (1, (model, iterOne, iterTwo) => {
Expand Down
20 changes: 19 additions & 1 deletion src/filepanecontainer.vala
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ class FilePaneContainer : Gtk.Box {
[Signal (action = true)]
public signal void new_file_pane ();

[Signal (action = true)]
public signal void new_file_pane_same_wd ();

[Signal (action = true)]
public signal void delete_file_pane ();

Expand All @@ -16,6 +19,7 @@ class FilePaneContainer : Gtk.Box {

construct {
new_file_pane.connect (new_file_pane_handler);
new_file_pane_same_wd.connect (new_file_pane_same_wd_handler);
delete_file_pane.connect (delete_file_pane_handler);
}

Expand All @@ -39,8 +43,22 @@ class FilePaneContainer : Gtk.Box {
return null;
}

public void new_file_pane_same_wd_handler () {
string newWorkingDirectory = get_dir_of_selected_file_pane ();
if ( newWorkingDirectory == null ) {
newWorkingDirectory = "/";
warning ("NULL");
}

new_file_pane_at (newWorkingDirectory);
}

public void new_file_pane_handler () {
var filePane = new FilePane (window, iconManager, "/");
new_file_pane_at ("/");
}

private void new_file_pane_at (string directory) {
var filePane = new FilePane (window, iconManager, directory);
add (filePane);
filePane.show_all ();
}
Expand Down
1 change: 1 addition & 0 deletions src/key-bindings.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
@binding-set FilePaneContainerBindings
{
bind "<Ctrl><Shift>N" { "new_file_pane" () };
bind "<Ctrl><Shift><Alt>N" { "new_file_pane_same_wd" () };
bind "<Ctrl><Shift>D" { "delete_file_pane" () };
}

Expand Down

0 comments on commit a9207b7

Please sign in to comment.