@@ -720,8 +720,6 @@ lay_down_icons_horizontal (NemoIconContainer *container,
720720 EelDRect bounds ;
721721 EelDRect icon_bounds ;
722722 EelDRect text_bounds ;
723- double max_height_above , max_height_below ;
724- double height_above , height_below ;
725723 double line_width ;
726724 double grid_width ;
727725 double max_text_width , max_icon_width ;
@@ -755,7 +753,7 @@ lay_down_icons_horizontal (NemoIconContainer *container,
755753 text_size = nemo_get_icon_text_width_for_zoom_level (container -> details -> zoom_level );
756754
757755 use_size = MAX (icon_size , text_size ) + 15 ;
758-
756+ icon_size /= ppu ;
759757 if (container -> details -> label_position == NEMO_ICON_LABEL_POSITION_BESIDE ) {
760758 /* Would it be worth caching these bounds for the next loop? */
761759 for (p = icons ; p != NULL ; p = p -> next ) {
@@ -782,54 +780,42 @@ lay_down_icons_horizontal (NemoIconContainer *container,
782780 y = start_y + gap ;
783781 i = 0 ;
784782
785- max_height_above = 0 ;
786- max_height_below = 0 ;
787783 for (p = icons ; p != NULL ; p = p -> next ) {
788784 icon = p -> data ;
789785
786+ if (container -> details -> fixed_text_height == -1 ) {
787+ container -> details -> fixed_text_height = nemo_icon_canvas_item_get_fixed_text_height_for_layout (icon -> item ) / ppu ;
788+ }
789+
790790 /* Assume it's only one level hierarchy to avoid costly affine calculations */
791791 nemo_icon_canvas_item_get_bounds_for_layout (icon -> item ,
792792 & bounds .x0 , & bounds .y0 ,
793793 & bounds .x1 , & bounds .y1 );
794794
795795 icon_bounds = nemo_icon_canvas_item_get_icon_rectangle (icon -> item );
796-
797796 icon_width = grid_width ;
798- /* Calculate size above/below baseline */
799- height_above = icon_bounds .y1 - bounds .y0 ;
800- height_below = bounds .y1 - icon_bounds .y1 ;
801797
802798 /* If this icon doesn't fit, it's time to lay out the line that's queued up. */
803799 if (line_start != p && line_width + icon_width >= canvas_width ) {
804800 if (container -> details -> label_position == NEMO_ICON_LABEL_POSITION_BESIDE ) {
805801 y += gap ;
806802 } else {
807803 /* Advance to the baseline. */
808- y += gap + max_height_above ;
804+ y += gap + icon_size ;
809805 }
810806
811- lay_down_one_line (container , line_start , p , y , max_height_above , positions , FALSE, gap );
807+ lay_down_one_line (container , line_start , p , y , icon_size , positions , FALSE, gap );
812808
813809 if (container -> details -> label_position == NEMO_ICON_LABEL_POSITION_BESIDE ) {
814- y += max_height_above + max_height_below + gap ;
810+ y += gap + icon_size ;
815811 } else {
816812 /* Advance to next line. */
817- y += max_height_below + gap ;
813+ y += container -> details -> fixed_text_height + gap ;
818814 }
819815
820816 line_width = container -> details -> label_position == NEMO_ICON_LABEL_POSITION_BESIDE ? gap : 0 ;
821817 line_start = p ;
822818 i = 0 ;
823-
824- max_height_above = height_above ;
825- max_height_below = height_below ;
826- } else {
827- if (height_above > max_height_above ) {
828- max_height_above = height_above ;
829- }
830- if (height_below > max_height_below ) {
831- max_height_below = height_below ;
832- }
833819 }
834820
835821 g_array_set_size (positions , i + 1 );
@@ -855,10 +841,10 @@ lay_down_icons_horizontal (NemoIconContainer *container,
855841 y += gap ;
856842 } else {
857843 /* Advance to the baseline. */
858- y += gap + max_height_above ;
844+ y += gap + icon_size ;
859845 }
860846
861- lay_down_one_line (container , line_start , NULL , y , max_height_above , positions , TRUE, gap );
847+ lay_down_one_line (container , line_start , NULL , y , icon_size , positions , TRUE, gap );
862848 }
863849
864850 g_array_free (positions , TRUE);
@@ -2041,12 +2027,23 @@ nemo_icon_view_container_get_max_layout_lines (NemoIconContainer *container)
20412027 }
20422028
20432029 if (limit <= 0 ) {
2044- return G_MAXINT ;
2030+ return 3 ;
20452031 }
20462032
20472033 return limit ;
20482034}
20492035
2036+ static gint
2037+ nemo_icon_view_container_get_additional_text_line_count (NemoIconContainer * container )
2038+ {
2039+ G_GNUC_UNUSED GQuark * attributes ;
2040+ gint len ;
2041+
2042+ attributes = nemo_icon_view_container_get_icon_text_attribute_names (container , & len );
2043+
2044+ return len ;
2045+ }
2046+
20502047static void
20512048finalize (GObject * object )
20522049{
@@ -2096,6 +2093,7 @@ nemo_icon_view_container_class_init (NemoIconViewContainerClass *klass)
20962093 ic_class -> finish_adding_new_icons = nemo_icon_view_container_finish_adding_new_icons ;
20972094 ic_class -> icon_get_bounding_box = nemo_icon_view_container_icon_get_bounding_box ;
20982095 ic_class -> set_zoom_level = nemo_icon_view_container_set_zoom_level ;
2096+ ic_class -> get_additional_text_line_count = nemo_icon_view_container_get_additional_text_line_count ;
20992097}
21002098
21012099static void
0 commit comments