nautilus r14510 - in trunk: . libnautilus-private
- From: cneumair svn gnome org
- To: svn-commits-list gnome org
- Subject: nautilus r14510 - in trunk: . libnautilus-private
- Date: Wed, 20 Aug 2008 23:08:47 +0000 (UTC)
Author: cneumair
Date: Wed Aug 20 23:08:47 2008
New Revision: 14510
URL: http://svn.gnome.org/viewvc/nautilus?rev=14510&view=rev
Log:
2008-08-21 Christian Neumair <cneumair gnome org>
* libnautilus-private/nautilus-icon-canvas-item.c
(layout_get_full_size), (draw_or_measure_label_text):
* libnautilus-private/nautilus-icon-container.c
(nautilus_icon_container_constructor),
(nautilus_icon_container_get_max_layout_lines_for_pango),
(nautilus_icon_container_get_max_layout_lines):
* libnautilus-private/nautilus-icon-container.h:
Add helper for getting max. number of layout lines, which does not use
the negative PangoLayout height convention. Use it in
layout_get_full_size() instead of hardcoding three lines.
Only connect GConf text ellipsis preferences container callbacks while
the containers are alive.
Modified:
trunk/ChangeLog
trunk/libnautilus-private/nautilus-icon-canvas-item.c
trunk/libnautilus-private/nautilus-icon-container.c
trunk/libnautilus-private/nautilus-icon-container.h
Modified: trunk/libnautilus-private/nautilus-icon-canvas-item.c
==============================================================================
--- trunk/libnautilus-private/nautilus-icon-canvas-item.c (original)
+++ trunk/libnautilus-private/nautilus-icon-canvas-item.c Wed Aug 20 23:08:47 2008
@@ -976,9 +976,10 @@
*/
static void
layout_get_full_size (PangoLayout *layout,
+ int max_layout_line_count,
int *width,
int *height,
- int *height_for_for_layout,
+ int *height_for_layout,
int *dx)
{
PangoLayoutIter *iter;
@@ -991,24 +992,24 @@
*dx = total_width - *width;
*height = (logical_rect.height + PANGO_SCALE / 2) / PANGO_SCALE;
- if (height_for_for_layout != NULL) {
+ if (height_for_layout != NULL) {
/* only use the first three lines for the gridded auto layout */
- if (pango_layout_get_line_count (layout) <= 3) {
- *height_for_for_layout = *height;
+ if (pango_layout_get_line_count (layout) <= max_layout_line_count) {
+ *height_for_layout = *height;
} else {
- *height_for_for_layout = 0;
+ *height_for_layout = 0;
iter = pango_layout_get_iter (layout);
/* VOODOO-TODO, determine number of lines based on the icon size for text besides icon.
* cf. compute_text_rectangle() */
- for (i = 0; i < 3; i++) {
+ for (i = 0; i < max_layout_line_count; i++) {
pango_layout_iter_get_line_extents (iter, NULL, &logical_rect);
- *height_for_for_layout += (logical_rect.height + PANGO_SCALE / 2) / PANGO_SCALE;
+ *height_for_layout += (logical_rect.height + PANGO_SCALE / 2) / PANGO_SCALE;
if (!pango_layout_iter_next_line (iter)) {
break;
}
- *height_for_for_layout += pango_layout_get_spacing (layout);
+ *height_for_layout += pango_layout_get_spacing (layout);
}
pango_layout_iter_free (iter);
}
@@ -1115,14 +1116,18 @@
pango_layout_set_height (editable_layout, G_MININT);
} else {
pango_layout_set_height (editable_layout,
- nautilus_icon_container_get_layout_height (container));
+ nautilus_icon_container_get_max_layout_lines_for_pango (container));
}
- layout_get_full_size (editable_layout, &editable_width, &editable_height, &editable_for_layout_height, &editable_dx);
+ layout_get_full_size (editable_layout,
+ nautilus_icon_container_get_max_layout_lines (container),
+ &editable_width, &editable_height, &editable_for_layout_height, &editable_dx);
}
if (have_additional) {
additional_layout = get_label_layout (&details->additional_text_layout, item, details->additional_text);
- layout_get_full_size (additional_layout, &additional_width, &additional_height, NULL, &additional_dx);
+ layout_get_full_size (additional_layout,
+ nautilus_icon_container_get_max_layout_lines (container),
+ &additional_width, &additional_height, NULL, &additional_dx);
}
if (editable_width > additional_width) {
Modified: trunk/libnautilus-private/nautilus-icon-container.c
==============================================================================
--- trunk/libnautilus-private/nautilus-icon-container.c (original)
+++ trunk/libnautilus-private/nautilus-icon-container.c Wed Aug 20 23:08:47 2008
@@ -5127,13 +5127,13 @@
container = NAUTILUS_ICON_CONTAINER (object);
if (nautilus_icon_container_get_is_desktop (container)) {
- eel_preferences_add_callback (NAUTILUS_PREFERENCES_DESKTOP_TEXT_ELLIPSIS_LIMIT,
- text_ellipsis_limit_changed_container_callback,
- container);
+ eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_DESKTOP_TEXT_ELLIPSIS_LIMIT,
+ text_ellipsis_limit_changed_container_callback,
+ container, G_OBJECT (container));
} else {
- eel_preferences_add_callback (NAUTILUS_PREFERENCES_ICON_VIEW_TEXT_ELLIPSIS_LIMIT,
- text_ellipsis_limit_changed_container_callback,
- container);
+ eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_ICON_VIEW_TEXT_ELLIPSIS_LIMIT,
+ text_ellipsis_limit_changed_container_callback,
+ container, G_OBJECT (container));
}
return object;
@@ -5767,7 +5767,7 @@
nautilus_icon_container_theme_changed (container);
eel_preferences_add_callback (NAUTILUS_PREFERENCES_THEME,
nautilus_icon_container_theme_changed,
- container);
+ container);
if (!setup_prefs) {
eel_preferences_add_callback (NAUTILUS_PREFERENCES_ICON_VIEW_TEXT_ELLIPSIS_LIMIT,
@@ -8976,7 +8976,7 @@
}
int
-nautilus_icon_container_get_layout_height (NautilusIconContainer *container)
+nautilus_icon_container_get_max_layout_lines_for_pango (NautilusIconContainer *container)
{
int limit;
@@ -8993,5 +8993,23 @@
return -limit;
}
+int
+nautilus_icon_container_get_max_layout_lines (NautilusIconContainer *container)
+{
+ int limit;
+
+ if (nautilus_icon_container_get_is_desktop (container)) {
+ limit = desktop_text_ellipsis_limit;
+ } else {
+ limit = text_ellipsis_limits[container->details->zoom_level];
+ }
+
+ if (limit <= 0) {
+ return G_MAXINT;
+ }
+
+ return limit;
+}
+
#endif /* ! NAUTILUS_OMIT_SELF_CHECK */
Modified: trunk/libnautilus-private/nautilus-icon-container.h
==============================================================================
--- trunk/libnautilus-private/nautilus-icon-container.h (original)
+++ trunk/libnautilus-private/nautilus-icon-container.h Wed Aug 20 23:08:47 2008
@@ -252,7 +252,8 @@
void nautilus_icon_container_sort (NautilusIconContainer *container);
void nautilus_icon_container_freeze_icon_positions (NautilusIconContainer *container);
-int nautilus_icon_container_get_layout_height (NautilusIconContainer *container);
+int nautilus_icon_container_get_max_layout_lines (NautilusIconContainer *container);
+int nautilus_icon_container_get_max_layout_lines_for_pango (NautilusIconContainer *container);
/* operations on all icons */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]