Am Dienstag, den 23.08.2005, 16:32 +0200 schrieb Christian Neumair: > Am Donnerstag, den 02.06.2005, 11:43 +0200 schrieb Alexander Larsson: > > On Wed, 2005-06-01 at 10:37 -0400, Michael Terry wrote: > > > Hello. I have a patch I'd like reviewed for bug 159621, Icons are > > > outside the nautilus window with "text beside icons." You can see it > > > here: http://bugzilla.gnome.org/show_bug.cgi?id=159621. > > > > > > The bug is that with the text beside icons option selected, if there are > > > short filenames in a folder, the files will appear cut off, partially > > > obscured to the left of the window. > > > > I don't think that approach is right. > > > > We're calculating the max size of the icon+text and use that as the grid > > size. Then we use the max text size to set things up so that the right > > size of the icon/left side of the text is aligned vertically. > > > > This can be really wrong. Think of the case of a two-item directory, one > > item with a very wide icon but small text, one with a small icon but > > wide text. Say the *total* size of both icon+text are the same. This > > would mean we picked that size for grid size. But, to get the alignment > > right we really have to pick a grid size of max_icon_width + > > max_text_width. When that is done we really should use max_icon_width - > > icon_width as x_offset. > > Proposed patch attached. Reattaching, with the unrelated icon placement bits removed. -- Christian Neumair <chris gnome-de org>
Index: libnautilus-private/nautilus-icon-container.c =================================================================== RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-icon-container.c,v retrieving revision 1.393 diff -u -p -r1.393 nautilus-icon-container.c --- libnautilus-private/nautilus-icon-container.c 12 Aug 2005 18:11:29 -0000 1.393 +++ libnautilus-private/nautilus-icon-container.c 23 Aug 2005 14:28:28 -0000 @@ -978,6 +978,7 @@ lay_down_icons_horizontal (NautilusIconC double line_width; gboolean gridded_layout; double grid_width; + double max_text_width, max_icon_width; int icon_width; int i; @@ -998,17 +999,23 @@ lay_down_icons_horizontal (NautilusIconC - container->details->top_margin - container->details->bottom_margin) / EEL_CANVAS (container)->pixels_per_unit; + max_icon_width = max_text_width = 0.0; + if (container->details->label_position == NAUTILUS_ICON_LABEL_POSITION_BESIDE) { - grid_width = 0.0; /* Would it be worth caching these bounds for the next loop? */ for (p = icons; p != NULL; p = p->next) { icon = p->data; - - eel_canvas_item_get_bounds (EEL_CANVAS_ITEM (icon->item), - &bounds.x0, &bounds.y0, - &bounds.x1, &bounds.y1); - grid_width = MAX (grid_width, ceil (bounds.x1 - bounds.x0) + ICON_PAD_LEFT + ICON_PAD_RIGHT); + + icon_bounds = nautilus_icon_canvas_item_get_icon_rectangle (icon->item); + max_icon_width = MAX (max_icon_width, ceil (icon_bounds.x1 - icon_bounds.x0)); + + text_bounds = nautilus_icon_canvas_item_get_text_rectangle (icon->item); + max_text_width = MAX (max_text_width, ceil (text_bounds.x1 - text_bounds.x0 < 0 + ? MAX_TEXT_WIDTH_BESIDE + : text_bounds.x1 - text_bounds.x0)); } + + grid_width = max_icon_width + max_text_width + ICON_PAD_LEFT + ICON_PAD_RIGHT; } else { grid_width = STANDARD_ICON_GRID_WIDTH; } @@ -1093,7 +1100,7 @@ lay_down_icons_horizontal (NautilusIconC if (container->details->label_position == NAUTILUS_ICON_LABEL_POSITION_BESIDE) { if (gridded_layout) { - position->x_offset = icon_width - ((icon_bounds.x1 - icon_bounds.x0) + MAX_TEXT_WIDTH_BESIDE); + position->x_offset = max_icon_width + ICON_PAD_LEFT + ICON_PAD_RIGHT - (icon_bounds.x1 - icon_bounds.x0); } else { position->x_offset = icon_width - ((icon_bounds.x1 - icon_bounds.x0) + (text_bounds.x1 - text_bounds.x0)); }
Attachment:
signature.asc
Description: This is a digitally signed message part