Skip to content

Commit

Permalink
#3070 support starting remote sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Apr 3, 2021
1 parent 7ba5868 commit 6f3afe3
Show file tree
Hide file tree
Showing 3 changed files with 218 additions and 97 deletions.
14 changes: 7 additions & 7 deletions xpra/gtk_common/gtk_util.py
Expand Up @@ -585,7 +585,7 @@ def get_icon_from_file(filename):
return pixbuf


def imagebutton(title, icon, tooltip=None, clicked_callback=None, icon_size=32,
def imagebutton(title, icon=None, tooltip=None, clicked_callback=None, icon_size=32,
default=False, min_size=None, label_color=None, label_font=None) -> Gtk.Button:
button = Gtk.Button(title)
settings = button.get_settings()
Expand All @@ -603,17 +603,17 @@ def imagebutton(title, icon, tooltip=None, clicked_callback=None, icon_size=32,
if default:
button.set_can_default(True)
if label_color or label_font:
l = button
try:
alignment = button.get_children()[0]
b_hbox = alignment.get_children()[0]
l = b_hbox.get_children()[1]
except IndexError:
except (IndexError, AttributeError):
pass
else:
if label_color:
l.modify_fg(Gtk.StateType.NORMAL, label_color)
if label_font:
l.modify_font(label_font)
if label_color and hasattr(l, "modify_fg"):
l.modify_fg(Gtk.StateType.NORMAL, label_color)
if label_font and hasattr(l, "modify_font"):
l.modify_font(label_font)
return button

def menuitem(title, image=None, tooltip=None, cb=None) -> Gtk.ImageMenuItem:
Expand Down
10 changes: 2 additions & 8 deletions xpra/gtk_common/gui.py
Expand Up @@ -123,16 +123,10 @@ def hide(*_args):
self.shadow_button.set_sensitive(False)
self.widgets.append(self.shadow_button)
icon = get_icon_pixbuf("windows.png")
label = "Start a new %sxpra session" % (" remote" if (WIN32 or OSX) else "")
self.start_button = imagebutton("Start", icon,
"Start a session", clicked_callback=self.start,
label, clicked_callback=self.start,
icon_size=48, label_font=label_font)
#not all builds and platforms can start sessions:
if OSX or WIN32:
self.start_button.set_tooltip_text("Starting sessions is not supported on %s" % platform_name(sys.platform))
self.start_button.set_sensitive(False)
elif not has_server:
self.start_button.set_tooltip_text("This build of Xpra does not support starting sessions")
self.start_button.set_sensitive(False)
self.widgets.append(self.start_button)
assert len(self.widgets)%2==0
table = Gtk.Table(len(self.widgets)//2, 2, True)
Expand Down

0 comments on commit 6f3afe3

Please sign in to comment.