Opened 8 years ago

Closed 7 years ago

#4279 closed defect (fixed)

tray items not always left aligned

Reported by: erikos Owned by: humitos
Priority: Normal Milestone: Unspecified
Component: Sugar Version: 0.97.x
Severity: Minor Keywords: regression
Cc: erikos Distribution/OS: OLPC
Bug Status: Unconfirmed

Description

When testing #3565 I came across the following issue:

  • open Browse
  • create a session bookmark

---> a bookmark is added to the tray, left to it is some space for the 'go-forward' button but it is not shown

  • add more bookmarks until the forward/backward buttons are shown
  • now remove one bookmark

---> the bookmarks are now left aligned, no space reserved for the forward button

Attachments (3)

0001-Do-not-show-Prev-Next-button-the-first-time-a-Tray-i.patch (1.7 KB) - added by humitos 8 years ago.
A candidate solution; not the best one.
testing-sl-4279.diff (980 bytes) - added by humitos 8 years ago.
PATCH to test this ticket easly. This patch does not worrie about adding a repeated link
0002-TrayViewport-handle-the-case-of-the-widget-not-yet-a.patch (1.6 KB) - added by manuq 8 years ago.
Improved commit comment.

Download all attachments as: .zip

Change History (14)

comment:1 Changed 8 years ago by humitos

  • Owner changed from manuq to humitos
  • Status changed from new to accepted

Changed 8 years ago by humitos

A candidate solution; not the best one.

comment:2 Changed 8 years ago by humitos

  • Cc erikos added
  • Keywords r? added

The patch attached fixes this test case but I don't like the solution. I'm not really sure why the _size_allocated_cb is called with allocation.width/height in 1 yet. I need to keep researching about this and maybe propose a better solution.

Anyway, please take a look at the patch maybe you see other things and I'm not seeing... (the patch has a long commit message explaining what I did)

Changed 8 years ago by humitos

PATCH to test this ticket easly. This patch does not worrie about adding a repeated link

comment:5 Changed 8 years ago by manuq

The issue happens because the tray is not visible, so when the size-allocate callback is called for the first time, it's size is unknown, and it is set to 1x1 as the documentation say:

http://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-size-allocate

Adding a show() in Browse tray fixes the issue if you resume a Browse instance that has the tray already displayed. But this breaks the Browse functionality (tray hidden by default).

--- a/webactivity.py
+++ b/webactivity.py
@@ -178,6 +178,7 @@ class WebActivity(activity.Activity):
 
         self._tray = HTray()
         self.set_tray(self._tray, Gtk.PositionType.BOTTOM)
+        self._tray.show()
 
         self._primary_toolbar = PrimaryToolbar(self._tabbed_view, self)
         self._edit_toolbar = EditToolbar(self)

So I think we are good adding the conditional for the 1x1 size case as per humitos patch, with a better comment.

Changed 8 years ago by manuq

Improved commit comment.

comment:6 Changed 8 years ago by manuq

Pushed 0788e546 but let's leave this open as we may find a real solution.

comment:7 Changed 8 years ago by erikos

  • Keywords r? removed
  • Milestone changed from 0.98 to 1.0

comment:8 Changed 8 years ago by dnarvaez

  • Component changed from sugar-toolkit-gtk3 to Sugar

comment:9 Changed 8 years ago by dnarvaez

  • Milestone changed from 1.0 to Unspecified

comment:10 Changed 8 years ago by dnarvaez

  • Bug Status changed from Assigned to Unconfirmed

comment:11 Changed 7 years ago by dnarvaez

  • Resolution set to fixed
  • Status changed from accepted to closed
Note: See TracTickets for help on using tickets.