Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 8 additions & 22 deletions data/styles/SettingsPage.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,19 @@ settingspage {
}

.header-area {
header {
margin: 0;
}

// avatar is inside of a widget
widget {
&:dir(ltr) {
margin-left: rem(4px);
margin-right: rem(9px);
margin-right: rem(3px);
}

&:dir(rtl) {
margin-left: rem(9px);
margin-left: rem(3px);
margin-right: rem(4px);
}
}
Expand All @@ -44,39 +48,21 @@ settingspage {
&:dir(ltr) {
// Match square icon canvas whitespace at 48px
margin-left: rem(-4px);
margin-right: rem(7px);
margin-right: rem(1px);
}

&:dir(rtl) {
margin-left: rem(7px);
margin-left: rem(1px);
margin-right: rem(-4px);
}
}

label.title-2 {
font-weight: 600;
font-size: 2rem;
}

label:not(.title-2) {
font-size: 0.95rem;
opacity: 0.85;
}

switch {
slider {
// Match font size for title
min-height: 2rem;
min-width: 2rem;
}

&:dir(ltr) {
margin-left: rem(12px);
}

&:dir(rtl) {
margin-right: rem(12px);
}
}
}

Expand Down
42 changes: 9 additions & 33 deletions lib/SettingsPage.vala
Original file line number Diff line number Diff line change
Expand Up @@ -118,37 +118,21 @@ public abstract class Switchboard.SettingsPage : Gtk.Widget {
bind_property ("title", header_widget, "text");
}

var title_label = new Gtk.Label (title) {
var title_label = new Granite.HeaderLabel ("") {
hexpand = true,
wrap = true,
xalign = 0
size = H2,
valign = CENTER
};
title_label.add_css_class (Granite.STYLE_CLASS_H2_LABEL);

var description_label = new Gtk.Label (description) {
hexpand = true,
max_width_chars = 0,
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) {
header_area.attach (header_widget, 0, 0, 1, 2);
header_area.attach (description_label, 1, 1, 2);
} else {
header_area.attach (header_widget, 0, 0);
}
var header_area = new Granite.Box (HORIZONTAL, HALF);
header_area.append (header_widget);
header_area.append (title_label);

if (activatable) {
status_switch = new Gtk.Switch () {
valign = Gtk.Align.START
};
header_area.attach (status_switch, 2, 0);
header_area.append (status_switch);
}

var end_widget = new Gtk.WindowControls (END) {
Expand Down Expand Up @@ -196,17 +180,9 @@ public abstract class Switchboard.SettingsPage : Gtk.Widget {
scrolled.set_parent (this);
action_bar.set_parent (this);

bind_property ("description", description_label, "label");
bind_property ("title", title_label, "label");
bind_property ("description", title_label, "secondary-text", SYNC_CREATE);
bind_property ("title", title_label, "label", SYNC_CREATE);
bind_property ("show-end-title-buttons", end_widget, "visible", SYNC_CREATE);

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);
}
});
}

~SettingsPage () {
Expand Down
Loading