Skip to content

Commit

Permalink
fix(gtk): Improve the layout of revealer changelogs
Browse files Browse the repository at this point in the history
Fixes for #18
  • Loading branch information
mmstick committed Aug 13, 2019
1 parent 340ffd2 commit 7a1c66f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
14 changes: 8 additions & 6 deletions gtk/src/changelog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ where
..show_all();
};

let mut initiated = false;
changelog.for_each(|(version, entry)| {
let markdown = if entry.as_ref().is_empty() {
Cow::Borrowed("No changelog available")
Expand Down Expand Up @@ -42,12 +43,13 @@ where
.margin_end(margin)
.build();

changelog_entries.add(&cascade! {
gtk::Box::new(gtk::Orientation::Vertical, 12);
..add(&version);
..add(&gtk::Separator::new(gtk::Orientation::Horizontal));
..add(&changelog);
});
if initiated {
changelog_entries.add(&gtk::Separator::new(gtk::Orientation::Horizontal));
}

initiated = true;
changelog_entries.add(&version);
changelog_entries.add(&changelog);
});

changelog_entries
Expand Down
6 changes: 3 additions & 3 deletions gtk/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,8 @@ impl State {
view_devices: DevicesView,
view_empty: EmptyView,
) -> Self {
let has_battery = upower_dbus::UPower::new(-1)
.and_then(|upower| upower.on_battery())
.unwrap_or(false);
let has_battery =
upower_dbus::UPower::new(-1).and_then(|upower| upower.on_battery()).unwrap_or(false);

Self {
entities: Entities::default(),
Expand Down Expand Up @@ -294,6 +293,7 @@ fn reveal<F: FnMut() -> gtk::Container>(
gtk::Box::new(gtk::Orientation::Vertical, 12);
..set_vexpand(true);
..add(&gtk::Separator::new(gtk::Orientation::Horizontal));
..add(&gtk::LabelBuilder::new().label("<b>Changelog</b>").use_markup(true).xalign(0.0).build());
..add(&widget);
..show_all();
};
Expand Down

0 comments on commit 7a1c66f

Please sign in to comment.