Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SettingsSidebar: add a show_title_buttons option #299

Merged
merged 2 commits into from
Mar 13, 2024
Merged
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
1 change: 1 addition & 0 deletions data/styles/Index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
@import '_common.scss';

@import 'CategoryView.scss';
@import 'Plug.scss';
@import 'SettingsPage.scss';
@import 'SettingsSidebar.scss';
31 changes: 31 additions & 0 deletions data/styles/Plug.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
toolbarview {
&.undershoot-top scrolledwindow {
overshoot.top {
background:
linear-gradient(
to top,
#{'alpha(@accent_color, 0)'} 80%,
#{'alpha(@accent_color, 0.25)'} 100%
),
linear-gradient(
#{'@borders'},
rgba(black, 0.05) 1px,
rgba(black, 0.0) rem(3px)
);
}

undershoot.top {
background:
linear-gradient(
#{'@borders'},
rgba(black, 0.05) 1px,
rgba(black, 0.0) rem(3px)
);
}
}

headerbar {
background: inherit;
box-shadow: none;
}
}
35 changes: 20 additions & 15 deletions data/styles/SettingsSidebar.scss
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
settingssidebar list {
min-width: rem(200px);
settingssidebar {
background: #{'@insensitive_bg_color'};

row,
> .title-4 {
padding: rem(6px);
}
list {
background: inherit;
min-width: rem(200px);

row {
overlay {
// IconSize.LARGE + padding
min-width: calc(32px + #{rem(6px)});
row,
> .title-4 {
padding: rem(6px);
}

overlay:dir(ltr) {
margin-right: rem(6px);
}
row {
overlay {
// IconSize.LARGE + padding
min-width: calc(32px + #{rem(6px)});
}

overlay:dir(ltr) {
margin-right: rem(6px);
}

overlay:dir(rtl) {
margin-left: rem(6px);
overlay:dir(rtl) {
margin-left: rem(6px);
}
}
}
}
20 changes: 19 additions & 1 deletion lib/SettingsSidebar.vala
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ public class Switchboard.SettingsSidebar : Gtk.Widget {
*/
public Gtk.Stack stack { get; construct; }

/**
* Whether to show back and title buttons in the header area
*/
public bool show_title_buttons { get; set;}

/**
* The name of the currently visible Granite.SettingsPage
*/
Expand Down Expand Up @@ -75,7 +80,18 @@ public class Switchboard.SettingsSidebar : Gtk.Widget {
hscrollbar_policy = Gtk.PolicyType.NEVER,
child = listbox
};
scrolled.set_parent (this);

var headerbar = new Adw.HeaderBar () {
show_end_title_buttons = false,
show_title = false
};

var toolbarview = new Adw.ToolbarView () {
content = scrolled,
top_bar_style = FLAT
};
toolbarview.add_top_bar (headerbar);
toolbarview.set_parent (this);

on_sidebar_changed ();
stack.pages.items_changed.connect (on_sidebar_changed);
Expand All @@ -100,6 +116,8 @@ public class Switchboard.SettingsSidebar : Gtk.Widget {
stack.notify["visible-child-name"].connect (() => {
visible_child_name = stack.visible_child_name;
});

bind_property ("show-title-buttons", toolbarview, "reveal-top-bars", SYNC_CREATE);
}

~SettingsSidebar () {
Expand Down
Loading