[ghex/gtk4-port: 39/91] Reassess saveability when switching tabs




commit d5d3ab7bfa02bd33b1005c576ef222d730f0e743
Author: Logan Rathbone <poprocks gmail com>
Date:   Mon Jan 18 00:36:45 2021 -0500

    Reassess saveability when switching tabs

 src/ghex-application-window.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/src/ghex-application-window.c b/src/ghex-application-window.c
index 55f2b327..9ecfbcea 100644
--- a/src/ghex-application-window.c
+++ b/src/ghex-application-window.c
@@ -365,6 +365,7 @@ notebook_switch_page_cb (GtkNotebook *notebook,
                GHEX_APPLICATION_WINDOW(user_data);
        GHexNotebookTab *tab =
                GHEX_NOTEBOOK_TAB(gtk_notebook_get_tab_label (notebook, page));
+       HexDocument *doc;
 
        g_return_if_fail (GHEX_IS_NOTEBOOK_TAB(tab));
 
@@ -373,8 +374,13 @@ notebook_switch_page_cb (GtkNotebook *notebook,
 
        if (tab->gh != self->gh) {
                ghex_application_window_set_hex (self, tab->gh);
-               ghex_application_window_activate_tab (self, tab->gh);
+               ghex_application_window_activate_tab (self, self->gh);
        }
+
+       /* Assess saveability based on new tab we've switched to */
+       doc = gtk_hex_get_document (self->gh);
+       ghex_application_window_set_can_save (self,
+                       hex_document_has_changed (doc));
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]