diff --git a/python/fapolicy_analyzer/ui/main_window.py b/python/fapolicy_analyzer/ui/main_window.py index e73ee8e88..cb6afaff5 100644 --- a/python/fapolicy_analyzer/ui/main_window.py +++ b/python/fapolicy_analyzer/ui/main_window.py @@ -16,6 +16,11 @@ def __init__(self): self.window = self.builder.get_object("mainWindow") self.window.show_all() + # To support unapplied/unsaved changeset status in UI + # Maintain original title, toplevel reference + self.windowTopLevel = self.window.get_toplevel() + self.strTopLevelTitle = self.windowTopLevel.get_title() + def __unapplied_changes(self): # Check backend for unapplied changes if not stateManager.is_dirty_queue(): @@ -56,10 +61,16 @@ def on_start(self, *args): mainContent = self.builder.get_object("mainContent") mainContent.pack_start(page, True, True, 0) + def set_modified_titlebar(self, bModified=True): + """Adds leading '*' to titlebar text with True or default argument""" + if bModified: + # Prefix title with '*' + self.windowTopLevel.set_title("*" + self.strTopLevelTitle) + else: + # Reset title to original text + self.windowTopLevel.set_title(self.strTopLevelTitle) + def on_changeset_updated(self): """The callback function invoked from the StateManager when state changes.""" - if stateManager.is_dirty_queue(): - print("main_window -> There are undeployed changes!") - else: - print("main_window -> There are no undeployed changes...") + self.set_modified_titlebar(stateManager.is_dirty_queue())