Commit b47410a7 authored by segfault's avatar segfault

Greeter: Define headerbar in UI file instead of code

parent 0159a230
......@@ -113,6 +113,8 @@ class GreeterMainWindow(Gtk.Window, TranslatableWindow):
self.toolbutton_settings_add = builder.get_object('toolbutton_settings_add')
self.listbox_settings = builder.get_object("listbox_settings")
self.listbox_region = builder.get_object("listbox_region")
self.button_start = builder.get_object("button_start")
self.headerbar = builder.get_object("headerbar")
# Set preferred width
self.set_default_size(min(Gdk.Screen.get_default().get_width(),
......@@ -133,7 +135,7 @@ class GreeterMainWindow(Gtk.Window, TranslatableWindow):
# Add children to ApplicationWindow
self.add(self.box_main)
self.set_titlebar(self._build_headerbar())
self.set_titlebar(self.headerbar)
# Set keyboard focus chain
self._set_focus_chain()
......@@ -164,26 +166,6 @@ class GreeterMainWindow(Gtk.Window, TranslatableWindow):
Gtk.AccelFlags.VISIBLE,
self.cb_accelgroup_setting_activated)
def _build_headerbar(self) -> Gtk.HeaderBar:
headerbar = Gtk.HeaderBar()
headerbar_sizegroup = Gtk.SizeGroup(Gtk.SizeGroupMode.HORIZONTAL)
self.button_shutdown = Gtk.Button.new_with_label(_("Shutdown"))
self.button_shutdown.connect('clicked', self.cb_button_shutdown_clicked)
headerbar_sizegroup.add_widget(self.button_shutdown)
headerbar.pack_start(self.button_shutdown)
self.button_start = Gtk.Button.new_with_mnemonic(_("_Start Tails"))
Gtk.StyleContext.add_class(self.button_start.get_style_context(),
'suggested-action')
self.button_start.connect('clicked', self.cb_button_start_clicked)
headerbar_sizegroup.add_widget(self.button_start)
headerbar.pack_end(self.button_start)
headerbar.show_all()
return headerbar
def _set_focus_chain(self):
self.box_language.set_focus_chain([
self.frame_language,
......
......@@ -634,4 +634,40 @@
</row>
</data>
</object>
<object class="GtkHeaderBar" id="headerbar">
<property name="visible">True</property>
<child>
<object class="GtkButton" id="button_shutdown">
<property name="label" translatable="yes">Shutdown</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<signal name="clicked" handler="cb_button_shutdown_clicked"/>
</object>
<packing>
<property name="pack-type">start</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button_start">
<property name="label" translatable="yes">_Start Tails</property>
<property name="use_underline">True</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<signal name="clicked" handler="cb_button_start_clicked"/>
<style>
<class name="suggested-action"/>
</style>
</object>
<packing>
<property name="pack-type">end</property>
</packing>
</child>
</object>
<object class="GtkSizeGroup">
<property name="mode">GTK_SIZE_GROUP_HORIZONTAL</property>
<widgets>
<widget name="button_shutdown"/>
<widget name="button_start"/>
</widgets>
</object>
</interface>
......@@ -6,7 +6,6 @@ tmp/pot/electrum.pot
tmp/pot/Frontend.pm.pot
tmp/pot/greeter-add_settings_dialog.py.pot
tmp/pot/greeter-additional_settings.py.pot
tmp/pot/greeter-main_window.py.pot
tmp/pot/greeter-persistence.py.pot
tmp/pot/greeter-persistent_storage.py.pot
tmp/pot/greeter-region_settings.py.pot
......
......@@ -3,7 +3,6 @@ config/chroot_local-includes/usr/share/doc/tails/website/
config/chroot_local-includes/usr/lib/python3/dist-packages/tailsgreeter/settings/persistence.py
config/chroot_local-includes/usr/lib/python3/dist-packages/tailsgreeter/ui/add_settings_dialog.py
config/chroot_local-includes/usr/lib/python3/dist-packages/tailsgreeter/ui/additional_settings.py
config/chroot_local-includes/usr/lib/python3/dist-packages/tailsgreeter/ui/main_window.py
config/chroot_local-includes/usr/lib/python3/dist-packages/tailsgreeter/ui/persistent_storage.py
config/chroot_local-includes/usr/lib/python3/dist-packages/tailsgreeter/ui/region_settings.py
config/chroot_local-includes/usr/lib/python3/dist-packages/unlock_veracrypt_volumes/volume.py
......
......@@ -31,7 +31,6 @@ PYTHON_PROGS="/etc/whisperback/config.py \
/usr/lib/python3/dist-packages/tailsgreeter/settings/persistence.py \
/usr/lib/python3/dist-packages/tailsgreeter/ui/add_settings_dialog.py \
/usr/lib/python3/dist-packages/tailsgreeter/ui/additional_settings.py \
/usr/lib/python3/dist-packages/tailsgreeter/ui/main_window.py \
/usr/lib/python3/dist-packages/tailsgreeter/ui/persistent_storage.py \
/usr/lib/python3/dist-packages/tailsgreeter/ui/region_settings.py \
/usr/lib/python3/dist-packages/unlock_veracrypt_volumes/volume.py \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment