After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 627985 - Calculate whether we need an expansion row for the banner correctly
Calculate whether we need an expansion row for the banner correctly
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2010-08-25 21:26 UTC by Marina Zhurakhinskaya
Modified: 2010-08-26 20:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Calculate whether we need an expansion row for the banner correctly (3.96 KB, patch)
2010-08-25 21:26 UTC, Marina Zhurakhinskaya
reviewed Details | Review
Calculate whether we need an expansion row for the banner correctly (3.53 KB, patch)
2010-08-26 20:09 UTC, Marina Zhurakhinskaya
committed Details | Review

Description Marina Zhurakhinskaya 2010-08-25 21:26:49 UTC
This patch applies on top of the patches in bug 627303 .
Comment 1 Marina Zhurakhinskaya 2010-08-25 21:26:51 UTC
Created attachment 168768 [details] [review]
Calculate whether we need an expansion row for the banner correctly

The old calculation did not take into account the icon and the spacing
between columns. This resulted in the notifications that had a slightly
longer title/banner combination than could actually fit not being expandable.

The new calculation is done in _bannerBoxAllocate() so
that we don't need to hardcode which other elements are present.
Comment 2 Dan Winship 2010-08-26 18:18:36 UTC
Review of attachment 168768 [details] [review]:

::: js/ui/messageTray.js
@@ -324,3 @@
-    _styleChanged: function() {
-        let [has_spacing, spacing] = this.actor.get_theme_node().get_length('spacing-columns', false);
-        this._spacing = has_spacing ? spacing : 0;

I think it's better to still do this part from _styleChanged. That way the value is cached rather than needing to be looked up again each time.

@@ +364,3 @@
             this._bannerLabel.allocate(bannerBox, flags);
+            // Figure out if the notification should be expandable
+            // and add the expansion row after the allocation is done.

I'd say something like "Figure out if the banner text is too long to fit on one line, and if so, add it to the body. We can't do that from here though since that will force a relayout."

@@ +366,3 @@
+            // and add the expansion row after the allocation is done.
+            if (this._bannerBodyText && (bannerBox.x1 + bannerNatW > availWidth))
+                Mainloop.idle_add(Lang.bind(this,

This is in the wrong place; you need to do it in the case of the parent "if" being true as well (the case where it calls "this._bannerLabel.hide();". So it should happen outside the "if (titleBox.x2..." if, triggered by a flag set in the various cases
Comment 3 Marina Zhurakhinskaya 2010-08-26 20:09:31 UTC
Created attachment 168839 [details] [review]
Calculate whether we need an expansion row for the banner correctly

The old calculation did not take into account the icon and the spacing
between columns. This resulted in the notifications that had a slightly
longer title/banner combination than could actually fit not being expandable.

The new calculation is done in _bannerBoxAllocate() so
that we don't need to hardcode which other elements are present.

Addressed all comments.

This patch still doesn't do anything in the case when the banner
doesn't fully fit, but this._bannerBody is false.