[ghex] appwin: Tweak behaviour of closing tab when only one open
- From: Logan Rathbone <larathbone src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ghex] appwin: Tweak behaviour of closing tab when only one open
- Date: Sun, 12 Jun 2022 01:51:38 +0000 (UTC)
commit e423fe26efa5e24881167260fd4942c5d2c645ce
Author: Logan Rathbone <poprocks gmail com>
Date: Sat Jun 11 21:30:03 2022 -0400
appwin: Tweak behaviour of closing tab when only one open
src/ghex-application-window.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/ghex-application-window.c b/src/ghex-application-window.c
index 2c26296..b53d2de 100644
--- a/src/ghex-application-window.c
+++ b/src/ghex-application-window.c
@@ -152,6 +152,7 @@ static void update_gui_data (GHexApplicationWindow *self);
static gboolean assess_can_save (HexDocument *doc);
static void do_close_window (GHexApplicationWindow *self);
static void close_doc_confirmation_dialog (GHexApplicationWindow *self, GHexNotebookTab *tab);
+static void show_no_file_loaded_label (GHexApplicationWindow *self);
static void doc_read_ready_cb (GObject *source_object, GAsyncResult *res,
gpointer user_data);
@@ -311,7 +312,7 @@ ghex_application_window_remove_tab (GHexApplicationWindow *self,
update_gui_data (self);
if (gtk_notebook_get_n_pages (GTK_NOTEBOOK(self->hex_notebook)) == 0)
- do_close_window (self);
+ show_no_file_loaded_label (self);
}
static void
@@ -562,7 +563,10 @@ close_tab_shortcut_cb (GtkWidget *widget,
GHexApplicationWindow *self = GHEX_APPLICATION_WINDOW(widget);
GHexNotebookTab *tab = ghex_application_window_get_current_tab (self);
- g_signal_emit_by_name (tab, "close-request");
+ if (tab)
+ g_signal_emit_by_name (tab, "close-request");
+ else
+ do_close_window (self);
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]