Skip to content

Commit

Permalink
Merge pull request #95 from tfuxu/proper-close-tab
Browse files Browse the repository at this point in the history
Make sure we handle app closing the GTK way
  • Loading branch information
ranfdev committed Apr 9, 2024
2 parents c97be16 + 8a5f15d commit fc18bf1
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/widgets/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,17 @@ impl Window {
this.page_switched(tab_view);
}),
);
imp.tab_view.connect_close_page(
clone!(@weak self as this => @default-panic, move |tab_view, page| {
tab_view.close_page_finish(page, !page.is_pinned());

if tab_view.n_pages() == 0 {
this.close();
};

true
}),
);
imp.tab_overview.connect_create_tab(
clone!(@weak self as this => @default-panic, move |_| {
this.new_tab();
Expand Down Expand Up @@ -571,9 +582,6 @@ impl Window {
let imp = self.imp();
imp.tab_view
.close_page(&imp.tab_view.page(&self.current_tab()));
if imp.tab_view.n_pages() == 0 {
std::process::exit(0); // TODO: maybe there's a better way for gtk apps...
}
}

fn focus_url_bar(&self) {
Expand Down

0 comments on commit fc18bf1

Please sign in to comment.