Skip to content

Commit

Permalink
EncryptView: ErrorRevealer Gtk4 prep (#777)
Browse files Browse the repository at this point in the history
  • Loading branch information
danirabbit authored May 28, 2024
1 parent ff757c6 commit e61a9e5
Showing 1 changed file with 26 additions and 17 deletions.
43 changes: 26 additions & 17 deletions src/Views/EncryptView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -285,26 +285,35 @@ public class EncryptView : AbstractInstallerView {
}
}

private class ErrorRevealer : Gtk.Revealer {
public Gtk.Label label_widget;
private class ErrorRevealer : Gtk.Box {
public bool reveal_child { get; set; }
public Gtk.Label label_widget { get; private set; }
public string label { get; construct set; }

public string label {
set {
label_widget.label = "<span font_size=\"small\">%s</span>".printf (value);
}
public ErrorRevealer (string label) {
Object (label: label);
}

public ErrorRevealer (string label) {
label_widget = new Gtk.Label ("<span font_size=\"small\">%s</span>".printf (label));
label_widget.halign = Gtk.Align.END;
label_widget.justify = Gtk.Justification.RIGHT;
label_widget.max_width_chars = 55;
label_widget.use_markup = true;
label_widget.wrap = true;
label_widget.xalign = 1;

transition_type = Gtk.RevealerTransitionType.CROSSFADE;
add (label_widget);
construct {
label_widget = new Gtk.Label (label) {
halign = END,
justify = RIGHT,
max_width_chars = 55,
use_markup = true,
wrap = true,
xalign = 1
};
label_widget.get_style_context ().add_class (Granite.STYLE_CLASS_SMALL_LABEL);

var revealer = new Gtk.Revealer () {
child = label_widget,
transition_type = CROSSFADE
};

add (revealer);

bind_property ("reveal-child", revealer, "reveal-child");
bind_property ("label", label_widget, "label");
}
}
}

0 comments on commit e61a9e5

Please sign in to comment.