Skip to content

Commit

Permalink
#4064 show configure gui from main gui
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Dec 14, 2023
1 parent 2836d79 commit 47b0bea
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 12 deletions.
36 changes: 25 additions & 11 deletions xpra/gtk/dialogs/base_gui_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion xpra/gtk/dialogs/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

0 comments on commit 47b0bea

Please sign in to comment.