From 47b0bea46f1dd836c118617d11e1cd2a60ccdb03 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Thu, 14 Dec 2023 22:47:15 +0700 Subject: [PATCH] #4064 show configure gui from main gui --- xpra/gtk/dialogs/base_gui_window.py | 36 ++++++++++++++++++++--------- xpra/gtk/dialogs/gui.py | 2 +- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/xpra/gtk/dialogs/base_gui_window.py b/xpra/gtk/dialogs/base_gui_window.py index 710150ec74..d44294bf42 100644 --- a/xpra/gtk/dialogs/base_gui_window.py +++ b/xpra/gtk/dialogs/base_gui_window.py @@ -54,7 +54,7 @@ def __init__(self, icon_name="xpra.png", wm_class=("xpra-gui", "Xpra-GUI"), default_size=(640, 300), - header_bar=(True, True), + header_bar=(True, True, False), parent : Gtk.Window | None = None, ): self.exit_code = 0 @@ -127,27 +127,41 @@ def dismiss(self, *args) -> None: log(f"dismiss{args} calling {self.do_dismiss}") self.do_dismiss() - def add_headerbar(self, about=True, toolbox=True) -> None: + def add_headerbar(self, about=True, toolbox=True, configure=False) -> None: hb = Gtk.HeaderBar() hb.set_show_close_button(True) hb.props.title = "Xpra" if about: hb.add(button("About", "help-about", self.show_about)) + + def add_gui(text: str, icon_name: str, gui_class): + + def show_gui(*_args): + w = None + + def hide(*_args): + w.hide() + + gui_class.quit = hide + w = gui_class() + w.show() + + hb.add(button(text, icon_name, show_gui)) + if toolbox: try: from xpra.gtk.dialogs.toolbox import ToolboxGUI except ImportError: pass else: - def show(*_args): - w = None - - def hide(*_args): - w.hide() - ToolboxGUI.quit = hide - w = ToolboxGUI() - w.show() - hb.add(button("Toolbox", "applications-utilities", show)) + add_gui("Toolbox", "applications-utilities", ToolboxGUI) + if configure: + try: + from xpra.gtk.configure.main import ConfigureGUI + except ImportError: + pass + else: + add_gui("Configure", "applications-system", ConfigureGUI) hb.show_all() self.set_titlebar(hb) diff --git a/xpra/gtk/dialogs/gui.py b/xpra/gtk/dialogs/gui.py index a64545d024..5a3cc54f27 100644 --- a/xpra/gtk/dialogs/gui.py +++ b/xpra/gtk/dialogs/gui.py @@ -43,7 +43,7 @@ class GUI(BaseGUIWindow): def __init__(self, argv=()): self.argv = argv self.widgets = [] - super().__init__() + super().__init__(header_bar=(True, True, True)) def populate(self): if has_client():