def _on_button_clicked(self, button):
dialog = Gtk.Dialog()
dialog.set_transient_for(self)
gpaste_settings = GPaste.SettingsUiWidget()
for child in gpaste_settings.get_children():
if isinstance(child, Gtk.StackSwitcher):
toplevel = dialog.get_toplevel()
if not toplevel: continue
gpaste_settings.remove(child)
header_bar = Gtk.HeaderBar()
header_bar.set_show_close_button(True)
header_bar.set_title(None)
header_bar.set_subtitle(None)
header_bar.set_custom_title(child)
toplevel.set_titlebar(header_bar)
if isinstance(child, Gtk.Stack):
child.set_transition_type(
Gtk.StackTransitionType.SLIDE_LEFT_RIGHT
)
child.set_transition_duration(self._transition_duration)
content_area = dialog.get_content_area()
content_area.add(gpaste_settings)
dialog.show_all()
dialog.run()
dialog.destroy()
评论列表
文章目录