Commit 71ca8b98 authored by segfault's avatar segfault
Browse files

Remove screenlocker.ui

Create the GTK widgets in tails-screen-locker instead of using the
glade file. This solves the issue that we don't have a way to generate
.po files from glade files (although there is `xgettext -L Glade`, in
case we ever need it for something else).
parent 4a17e312
......@@ -82,7 +82,7 @@ class PasswordDialog(object):
else:
# Passwords don't match
self.ok_button.set_sensitive(False)
self.entry2.set_icon_from_stock(1, self.mismatch_icon)
self.entry2.set_icon_from_stock(1, "gtk-dialog-warning")
def on_ok_clicked(self, button, data=None):
pw1 = self.entry1.get_text()
......@@ -135,17 +135,78 @@ class PasswordDialog(object):
def __init__(self):
self.pw = None
self.builder = Gtk.Builder()
self.builder.add_from_file(UI_FILE)
self.builder.connect_signals(self)
self.ok_button = self.builder.get_object('button_ok')
self.entry1 = self.builder.get_object('entry1')
self.entry2 = self.builder.get_object('entry2')
self.mismatch_icon = self.entry2.get_icon_stock(1)
self.entry2.set_icon_from_icon_name(1, None)
self.ok_button.set_sensitive(False)
self.window = self.builder.get_object("window")
self.window.set_title(_("Set a screen lock password"))
self.window = Gtk.Window(
title=_("Set a screen lock password"),
type_hint=Gdk.WindowTypeHint.DIALOG
)
self.window.connect("key-press-event", self.on_key_pressed)
label1 = Gtk.Label(
label=_("New password"),
justify=Gtk.Justification.RIGHT,
xalign=1
)
label1.get_style_context().add_class("dim-label")
label2 = Gtk.Label(
label=_("Confirm password"),
justify=Gtk.Justification.RIGHT,
xalign=1
)
label2.get_style_context().add_class("dim-label")
self.entry1 = Gtk.Entry(
can_focus=True,
visibility=False
)
self.entry1.connect("changed", self.on_entry_changed)
self.entry2 = Gtk.Entry(
can_focus=True,
visibility=False
)
self.entry2.connect("changed", self.on_entry_changed)
grid = Gtk.Grid(row_spacing=2, column_spacing=10)
grid.attach(label1, 0, 0, 1, 1)
grid.attach(label2, 0, 1, 1, 1)
grid.attach(self.entry1, 1, 0, 1, 1)
grid.attach(self.entry2, 1, 1, 1, 1)
self.ok_button = Gtk.Button(
label=_("Lock"),
width_request=86,
receives_default=True,
sensitive=False
)
self.ok_button.connect("clicked", self.on_ok_clicked)
cancel_button = Gtk.Button(
label=_("Cancel"),
width_request=86
)
cancel_button.connect("clicked", self.on_cancel_clicked)
button_box = Gtk.ButtonBox(
margin_top=15,
spacing=5,
layout_style=Gtk.ButtonBoxStyle.END)
button_box.add(self.ok_button)
button_box.add(cancel_button)
box = Gtk.Box(
orientation=Gtk.Orientation.VERTICAL,
margin_top=12,
margin_bottom=12,
margin_left=12,
margin_right=12,
spacing=2
)
box.add(grid)
box.add(button_box)
self.window.add(box)
self.window.show_all()
def get_lock():
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.2 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<object class="GtkWindow" id="window">
<property name="can_focus">False</property>
<property name="type_hint">dialog</property>
<signal name="key-press-event" handler="on_key_pressed" swapped="no"/>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="margin_right">12</property>
<property name="margin_top">12</property>
<property name="margin_bottom">12</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="row_spacing">2</property>
<property name="column_spacing">10</property>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">New password</property>
<property name="justify">right</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Confirm password</property>
<property name="justify">right</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="entry1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="visibility">False</property>
<property name="invisible_char"></property>
<signal name="changed" handler="on_entry_changed" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="entry2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="visibility">False</property>
<property name="invisible_char"></property>
<property name="secondary_icon_stock">gtk-dialog-warning</property>
<property name="secondary_icon_activatable">False</property>
<signal name="changed" handler="on_entry_changed" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButtonBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">15</property>
<property name="homogeneous">True</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="button_cancel">
<property name="label" translatable="yes">Cancel</property>
<property name="width_request">86</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">end</property>
<signal name="clicked" handler="on_cancel_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button_ok">
<property name="label" translatable="yes">Lock</property>
<property name="width_request">86</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">end</property>
<signal name="clicked" handler="on_ok_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<child>
<placeholder/>
</child>
</object>
</interface>
wiki/src/
config/chroot_local-includes/usr/share/doc/tails/website/
config/chroot_local-includes/usr/share/tails/screenlocker.ui
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