Skip to content

Commit

Permalink
Remember Sidepane width after restart (#8936)
Browse files Browse the repository at this point in the history
  • Loading branch information
HoussemNasri authored Jul 3, 2022
1 parent 1301384 commit b251ebc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We fixed an issue where the exception that there are invalid characters in filename. [#8786](https://github.com/JabRef/jabref/issues/8786)
- When the proxy configuration removed the proxy user/password, this change is applied immediately.
- We fixed an issue where removing several groups deletes only one of them. [#8390](https://github.com/JabRef/jabref/issues/8390)
- We fixed an issue where the Sidepane(groups, web search and open office) width is not remembered after restarting JabRef. [#8907](https://github.com/JabRef/jabref/issues/8907)
- We fixed a bug where switching between themes will cause an error/exception. [#8939](https://github.com/JabRef/jabref/pull/8939)

### Removed
Expand Down
11 changes: 6 additions & 5 deletions src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,10 @@ private void initLayout() {
@Override
public void invalidated(Observable observable) {
if (mainStage.isShowing()) {
setDividerPosition();
observable.removeListener(this);
Platform.runLater(() -> {
setDividerPosition();
observable.removeListener(this);
});
}
}
});
Expand All @@ -472,10 +474,9 @@ private void updateSidePane() {
}

private void setDividerPosition() {
splitPane.setDividerPositions(prefs.getGuiPreferences().getSidePaneWidth());
if (mainStage.isShowing() && !sidePane.getChildren().isEmpty()) {
dividerSubscription = EasyBind.subscribe(splitPane.getDividers().get(0).positionProperty(),
position -> prefs.getGuiPreferences().setSidePaneWidth(position.doubleValue()));
splitPane.setDividerPositions(prefs.getGuiPreferences().getSidePaneWidth() / splitPane.getWidth());
dividerSubscription = EasyBind.subscribe(sidePane.widthProperty(), width -> prefs.getGuiPreferences().setSidePaneWidth(width.doubleValue()));
}
}

Expand Down

0 comments on commit b251ebc

Please sign in to comment.