Skip to content

Commit

Permalink
gtk4: Fix visibility regression with actionbar
Browse files Browse the repository at this point in the history
Previously, the actionbar will always be visible.
It should have not been that.
Instead, it should only appear when the screen is small.

tchx84#464 (comment)
Signed-off-by: Fiana Fortressia <fortressnordlys@outlook.com>
  • Loading branch information
togetherwithasteria authored and A6GibKm committed Apr 1, 2023
1 parent ff3eb35 commit 6b7cd57
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
23 changes: 16 additions & 7 deletions src/widgets/window.js
Expand Up @@ -112,8 +112,10 @@ var FlatsealWindow = GObject.registerClass({
this._contentLeaflet.connect('notify::visible-child-name', this._focusContent.bind(this));
this._contentLeaflet.bind_property(
'folded', this._backButton, 'visible', _bindReadFlags);
this._permissionsHeaderBar.connect_after(
'size-allocate', this._updateVisibility.bind(this));
this.root.connect(
'notify::default-width', this._updateVisibility.bind(this));
this.connect(
'notify::maximized', this._updateVisibility.bind(this));

if (allApplications.length === 0 || allPermissions.length === 0)
return;
Expand Down Expand Up @@ -307,13 +309,20 @@ var FlatsealWindow = GObject.registerClass({
return GLib.SOURCE_REMOVE;
}

_updateVisibility(window, allocation) {
const visible = window.root.default_width <= ACTION_BAR_THRESHOLD;
_updateVisibility(window) {
if (window.maximized) {
this._detailsHeaderButton.visible = true;
this._resetHeaderButton.visible = true;

this._detailsHeaderButton.visible = !visible;
this._resetHeaderButton.visible = !visible;
this._actionBar.visible = false;
} else {
const visible = window.root.default_width <= ACTION_BAR_THRESHOLD;

this._detailsHeaderButton.visible = !visible;
this._resetHeaderButton.visible = !visible;

this._actionBar.visible = visible;
this._actionBar.visible = visible;
}
}

_filter(row) {
Expand Down
3 changes: 2 additions & 1 deletion src/widgets/window.ui
Expand Up @@ -152,7 +152,7 @@
<child>
<object class="GtkImage">
<property name="icon-name">system-search-symbolic</property>
<property name="icon_size">6</property>
<property name="icon_size">normal</property>
</object>
</child>
<child>
Expand Down Expand Up @@ -300,6 +300,7 @@
</child>
<child>
<object class="GtkActionBar" id="actionBar">
<property name="visible">False</property>
<child>
<object class="GtkBox" id="startActionBox">
<property name="valign">center</property>
Expand Down

0 comments on commit 6b7cd57

Please sign in to comment.