Skip to content

Commit

Permalink
Reimplement reload action
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremypw committed Jun 20, 2024
1 parent f12db05 commit 04cdd15
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
17 changes: 17 additions & 0 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ namespace Terminal {
public const string ACTION_NEW_TAB = "action-term_widgetnew-tab";
public const string ACTION_NEW_TAB_AT = "action-new-tab-at";
public const string ACTION_TAB_ACTIVE_SHELL = "action-tab_active_shell";
public const string ACTION_TAB_RELOAD = "action-tab_reload";
public const string ACTION_RESTORE_CLOSED_TAB = "action-restore-closed-tab";
public const string ACTION_DUPLICATE_TAB = "action-duplicate-tab";
public const string ACTION_NEXT_TAB = "action-next-tab";
Expand All @@ -97,6 +98,7 @@ namespace Terminal {
{ ACTION_FULLSCREEN, action_fullscreen },
{ ACTION_NEW_TAB, action_new_tab },
{ ACTION_NEW_TAB_AT, action_new_tab_at, "s" },
{ ACTION_TAB_RELOAD, action_tab_reload},
{ ACTION_TAB_ACTIVE_SHELL, action_tab_active_shell, "s" },
{ ACTION_RESTORE_CLOSED_TAB, action_restore_closed_tab, "s" },
{ ACTION_DUPLICATE_TAB, action_duplicate_tab },
Expand All @@ -123,6 +125,7 @@ namespace Terminal {
action_accelerators[ACTION_FULLSCREEN] = "F11";
action_accelerators[ACTION_NEW_TAB] = "<Control><Shift>t";
action_accelerators[ACTION_DUPLICATE_TAB] = "<Control><Shift>d";
action_accelerators[ACTION_TAB_RELOAD] = "<Control><Shift>r";
action_accelerators[ACTION_NEXT_TAB] = "<Control>Tab";
action_accelerators[ACTION_NEXT_TAB] = "<Control>Page_Down";
action_accelerators[ACTION_PREVIOUS_TAB] = "<Control><Shift>Tab";
Expand Down Expand Up @@ -957,6 +960,20 @@ namespace Terminal {
term.feed_child ("clear\n".data);
}

private void action_tab_reload () {
TerminalWidget? term;
var target = notebook.tab_menu_target;
if (target != null) {
term = get_term_widget (target);
} else {
term = get_term_widget (notebook.tab_view.selected_page);
}

if (term != null) {
term.reload ();
}
}

private void action_duplicate_tab () requires (current_terminal != null) {
var term = notebook.tab_menu_target != null ?
get_term_widget (notebook.tab_menu_target) :
Expand Down
8 changes: 4 additions & 4 deletions src/Widgets/TerminalView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,6 @@ public class Terminal.TerminalView : Gtk.Box {
tab_view.selected_page = target;
}

public void duplicate_tab () {

}

public void transfer_tab_to_new_window () {
var target = tab_menu_target ?? tab_view.selected_page;

Expand Down Expand Up @@ -208,8 +204,12 @@ public class Terminal.TerminalView : Gtk.Box {
open_tab_section.append (_("Open in New Window"), MainWindow.ACTION_PREFIX + MainWindow.ACTION_MOVE_TAB_TO_NEW_WINDOW);
open_tab_section.append (_("Duplicate Tab"), MainWindow.ACTION_PREFIX + MainWindow.ACTION_DUPLICATE_TAB);

var reload_section = new Menu ();
reload_section.append (_("ReLoad"), MainWindow.ACTION_PREFIX + MainWindow.ACTION_TAB_RELOAD);

menu.append_section (null, open_tab_section);
menu.append_section (null, close_tab_section);
menu.append_section (null, reload_section);
return menu;
}

Expand Down

0 comments on commit 04cdd15

Please sign in to comment.