summaryrefslogtreecommitdiff
path: root/libnautilus-private/nautilus-icon-container.c
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2002-08-15 14:47:25 +0000
committerAlexander Larsson <alexl@src.gnome.org>2002-08-15 14:47:25 +0000
commita9acc6aec1a8778be1d024327af6d14bf7975112 (patch)
treedce5d91accf4207c917ab688fa7a704402209c73 /libnautilus-private/nautilus-icon-container.c
parentb529cc10cc2407d7a5c1b8f22354462f4850c6ef (diff)
downloadnautilus-a9acc6aec1a8778be1d024327af6d14bf7975112.tar.gz
Work around our strange size allocation problems by always assuming the
2002-08-15 Alexander Larsson <alexl@redhat.com> * libnautilus-private/nautilus-icon-container.c (icon_set_position): Work around our strange size allocation problems by always assuming the size of fixed_size containers is the size of the screen. This fixes the problem where all desktop icons end up in a pile in the top left corner on startup. We really need to fix our size allocation.
Diffstat (limited to 'libnautilus-private/nautilus-icon-container.c')
-rw-r--r--libnautilus-private/nautilus-icon-container.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/libnautilus-private/nautilus-icon-container.c b/libnautilus-private/nautilus-icon-container.c
index 842f948f3..6e9f33b77 100644
--- a/libnautilus-private/nautilus-icon-container.c
+++ b/libnautilus-private/nautilus-icon-container.c
@@ -236,7 +236,8 @@ icon_set_position (NautilusIcon *icon,
int left, top, right, bottom;
int width, height;
int x1, y1, x2, y2;
-
+ int container_x, container_y, container_width, container_height;
+
if (icon->x == x && icon->y == y) {
return;
}
@@ -248,12 +249,30 @@ icon_set_position (NautilusIcon *icon,
}
if (nautilus_icon_container_get_is_fixed_size (container)) {
+ /* FIXME: This should be:
+
+ container_x = GTK_WIDGET (container)->allocation.x;
+ container_y = GTK_WIDGET (container)->allocation.y;
+ container_width = GTK_WIDGET (container)->allocation.width;
+ container_height = GTK_WIDGET (container)->allocation.height;
+
+ But for some reason the widget allocation is sometimes not done
+ at startup, and the allocation is then only 45x60. which is
+ really bad.
+
+ For now, we have a cheesy workaround:
+ */
+ container_x = 0;
+ container_y = 0;
+ container_width = gdk_screen_width ();
+ container_height = gdk_screen_height ();
+
pixels_per_unit = GNOME_CANVAS (container)->pixels_per_unit;
/* Clip the position of the icon within our desktop bounds */
- left = GTK_WIDGET (container)->allocation.x / pixels_per_unit;
- top = GTK_WIDGET (container)->allocation.y / pixels_per_unit;
- right = left + GTK_WIDGET (container)->allocation.width / pixels_per_unit;
- bottom = top + GTK_WIDGET (container)->allocation.height / pixels_per_unit;
+ left = container_x / pixels_per_unit;
+ top = container_y / pixels_per_unit;
+ right = left + container_width / pixels_per_unit;
+ bottom = top + container_height / pixels_per_unit;
icon_get_bounding_box (icon, &x1, &y1, &x2, &y2);
width = x2 - x1;