Skip to content

Commit

Permalink
Merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
danirabbit committed Feb 2, 2024
2 parents 3f1ac86 + bf3088c commit 6c67a82
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions lib/SettingsPage.vala
Original file line number Diff line number Diff line change
Expand Up @@ -120,21 +120,19 @@ public abstract class Switchboard.SettingsPage : Gtk.Widget {
};
title_label.add_css_class (Granite.STYLE_CLASS_H2_LABEL);

var description_label = new Gtk.Label (description) {
selectable = true,
use_markup = true,
wrap = true,
xalign = 0
};

var header_area = new Gtk.Grid ();
header_area.attach (title_label, 1, 0);

if (description != null) {
var description_label = new Gtk.Label (description) {
selectable = true,
use_markup = true,
wrap = true,
xalign = 0
};

header_area.attach (header_widget, 0, 0, 1, 2);
header_area.attach (description_label, 1, 1, 2);

bind_property ("description", description_label, "label");
} else {
header_area.attach (header_widget, 0, 0);
}
Expand Down Expand Up @@ -179,9 +177,14 @@ public abstract class Switchboard.SettingsPage : Gtk.Widget {
grid.append (action_bar);
grid.set_parent (this);

notify["title"].connect (() => {
if (title_label != null) {
title_label.label = title;
bind_property ("description", description_label, "label");
bind_property ("title", title_label, "label");

notify["description"].connect (() => {
if (description_label.parent == null) {
header_area.remove (header_widget);
header_area.attach (header_widget, 0, 0, 1, 2);
header_area.attach (description_label, 1, 1, 2);
}
});
}
Expand Down

0 comments on commit 6c67a82

Please sign in to comment.