ui: remove deprecated GTK code

This commit is contained in:
Peter F. Patel-Schneider 2023-02-06 08:38:08 -05:00
parent ee3f2652ba
commit 04f2adfd75
1 changed files with 8 additions and 13 deletions

View File

@ -68,25 +68,20 @@ assert len(_COLUMN_TYPES) == len(_COLUMN)
def _new_button(label, icon_name=None, icon_size=_NORMAL_BUTTON_ICON_SIZE, tooltip=None, toggle=False, clicked=None): def _new_button(label, icon_name=None, icon_size=_NORMAL_BUTTON_ICON_SIZE, tooltip=None, toggle=False, clicked=None):
if toggle: b = Gtk.ToggleButton() if toggle else Gtk.Button()
b = Gtk.ToggleButton() c = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 5)
else:
b = Gtk.Button(label) if label else Gtk.Button()
if icon_name: if icon_name:
image = Gtk.Image.new_from_icon_name(icon_name, icon_size) c.pack_start(Gtk.Image.new_from_icon_name(icon_name, icon_size), True, True, 0)
b.set_image(image) if label:
c.pack_start(Gtk.Label(label), True, True, 0)
b.add(c)
if clicked is not None:
b.connect('clicked', clicked)
if tooltip: if tooltip:
b.set_tooltip_text(tooltip) b.set_tooltip_text(tooltip)
if not label and icon_size < _NORMAL_BUTTON_ICON_SIZE: if not label and icon_size < _NORMAL_BUTTON_ICON_SIZE:
b.set_relief(Gtk.ReliefStyle.NONE) b.set_relief(Gtk.ReliefStyle.NONE)
b.set_focus_on_click(False) b.set_focus_on_click(False)
if clicked is not None:
b.connect('clicked', clicked)
return b return b