diff options
author | Anders Carlsson <andersca@gnu.org> | 2002-04-21 19:29:43 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@src.gnome.org> | 2002-04-21 19:29:43 +0000 |
commit | 819f9a0fa0e7d66bffc28a936760cd7870786d14 (patch) | |
tree | e60a8cc7ff91c049f43075661cf679835c963bb7 | |
parent | 1dd22af76a31f3c5fabbedd15d6bc300c626406d (diff) | |
download | nautilus-819f9a0fa0e7d66bffc28a936760cd7870786d14.tar.gz |
Take pixels_per_unit into account when dealing with widget coordinates in
2002-04-21 Anders Carlsson <andersca@gnu.org>
* libnautilus-private/nautilus-icon-container.c:
(icon_set_position),
(nautilus_icon_container_update_scroll_region):
Take pixels_per_unit into account when dealing with widget
coordinates in the fixed mode.
* src/file-manager/fm-desktop-icon-view.c:
(fm_desktop_icon_view_finalize), (get_default_zoom_level),
(default_zoom_level_changed), (fm_desktop_icon_view_init):
Have the desktop view use the default icon view zoom level.
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | libnautilus-private/nautilus-icon-container.c | 18 | ||||
-rw-r--r-- | src/file-manager/fm-desktop-icon-view.c | 45 |
3 files changed, 67 insertions, 9 deletions
@@ -1,5 +1,18 @@ 2002-04-21 Anders Carlsson <andersca@gnu.org> + * libnautilus-private/nautilus-icon-container.c: + (icon_set_position), + (nautilus_icon_container_update_scroll_region): + Take pixels_per_unit into account when dealing with widget + coordinates in the fixed mode. + + * src/file-manager/fm-desktop-icon-view.c: + (fm_desktop_icon_view_finalize), (get_default_zoom_level), + (default_zoom_level_changed), (fm_desktop_icon_view_init): + Have the desktop view use the default icon view zoom level. + +2002-04-21 Anders Carlsson <andersca@gnu.org> + * src/nautilus-zoom-control.c (nautilus_zoom_control_button_press_event): Don't do anything with double-click or triple-click events. diff --git a/libnautilus-private/nautilus-icon-container.c b/libnautilus-private/nautilus-icon-container.c index e64fe892b..62a0a4031 100644 --- a/libnautilus-private/nautilus-icon-container.c +++ b/libnautilus-private/nautilus-icon-container.c @@ -234,7 +234,7 @@ icon_set_position (NautilusIcon *icon, double x, double y) { NautilusIconContainer *container; - + double pixels_per_unit; int left, top, right, bottom; int width, height; int x1, y1, x2, y2; @@ -250,11 +250,12 @@ icon_set_position (NautilusIcon *icon, } if (nautilus_icon_container_get_is_fixed_size (container)) { + 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; - top = GTK_WIDGET (container)->allocation.y; - right = left + GTK_WIDGET (container)->allocation.width; - bottom = top + GTK_WIDGET (container)->allocation.height; + 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; icon_get_bounding_box (icon, &x1, &y1, &x2, &y2); width = x2 - x1; @@ -650,22 +651,25 @@ void nautilus_icon_container_update_scroll_region (NautilusIconContainer *container) { double x1, y1, x2, y2; + double pixels_per_unit; GtkAdjustment *hadj, *vadj; float step_increment; GtkAllocation *allocation; gboolean reset_scroll_region; if (nautilus_icon_container_get_is_fixed_size (container)) { + pixels_per_unit = GNOME_CANVAS (container)->pixels_per_unit; + /* Set the scroll region to the size of the container allocation */ allocation = >K_WIDGET (container)->allocation; eel_gnome_canvas_set_scroll_region_left_justify (GNOME_CANVAS (container), (double) - container->details->left_margin, (double) - container->details->top_margin, - (double) allocation->width - 1 + (double) (allocation->width - 1) / pixels_per_unit - container->details->left_margin - container->details->right_margin, - (double) allocation->height - 1 + (double) (allocation->height - 1) / pixels_per_unit - container->details->top_margin - container->details->bottom_margin); return; diff --git a/src/file-manager/fm-desktop-icon-view.c b/src/file-manager/fm-desktop-icon-view.c index 1afb709f6..54fea50a2 100644 --- a/src/file-manager/fm-desktop-icon-view.c +++ b/src/file-manager/fm-desktop-icon-view.c @@ -100,6 +100,7 @@ static void fm_desktop_icon_view_trash_state_changed_callback (NautilusTrash gboolean state, gpointer callback_data); static void home_uri_changed (gpointer user_data); +static void default_zoom_level_changed (gpointer user_data); static void volume_mounted_callback (NautilusVolumeMonitor *monitor, NautilusVolume *volume, FMDesktopIconView *icon_view); @@ -237,7 +238,10 @@ fm_desktop_icon_view_finalize (GObject *object) eel_preferences_remove_callback (NAUTILUS_PREFERENCES_HOME_URI, home_uri_changed, icon_view); - + eel_preferences_remove_callback (NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL, + default_zoom_level_changed, + icon_view); + /* Clean up details */ if (icon_view->details->ui != NULL) { bonobo_ui_component_unset_container (icon_view->details->ui, NULL); @@ -452,6 +456,35 @@ event_callback (GtkWidget *widget, GdkEvent *event, FMDesktopIconView *desktop_i { } + +static NautilusZoomLevel +get_default_zoom_level (void) +{ + static gboolean auto_storage_added = FALSE; + static NautilusZoomLevel default_zoom_level = NAUTILUS_ZOOM_LEVEL_STANDARD; + + if (!auto_storage_added) { + auto_storage_added = TRUE; + eel_preferences_add_auto_enum (NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL, + (int *) &default_zoom_level); + } + + return CLAMP (default_zoom_level, NAUTILUS_ZOOM_LEVEL_SMALLEST, NAUTILUS_ZOOM_LEVEL_LARGEST); +} + +static void +default_zoom_level_changed (gpointer user_data) +{ + NautilusZoomLevel new_level; + FMDesktopIconView *desktop_icon_view; + + desktop_icon_view = FM_DESKTOP_ICON_VIEW (user_data); + new_level = get_default_zoom_level (); + + nautilus_icon_container_set_zoom_level (get_icon_container (desktop_icon_view), + new_level); +} + /* Update home link to point to new home uri */ static void home_uri_changed (gpointer callback_data) @@ -521,6 +554,8 @@ delayed_init (FMDesktopIconView *desktop_icon_view) desktop_icon_view->details->delayed_init_signal = 0; } + + static void fm_desktop_icon_view_init (FMDesktopIconView *desktop_icon_view) { @@ -553,7 +588,7 @@ fm_desktop_icon_view_init (FMDesktopIconView *desktop_icon_view) } nautilus_icon_container_set_is_fixed_size (icon_container, TRUE); - + /* Set up default mount black list */ list = g_list_prepend (NULL, g_strdup ("/proc")); list = g_list_prepend (list, g_strdup ("/boot")); @@ -563,6 +598,7 @@ fm_desktop_icon_view_init (FMDesktopIconView *desktop_icon_view) allocation = >K_WIDGET (icon_container)->allocation; allocation->x = 0; allocation->y = 0; + gtk_widget_queue_resize (GTK_WIDGET (icon_container)); hadj = GTK_LAYOUT (icon_container)->hadjustment; @@ -602,6 +638,11 @@ fm_desktop_icon_view_init (FMDesktopIconView *desktop_icon_view) home_uri_changed, desktop_icon_view); + eel_preferences_add_callback (NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL, + default_zoom_level_changed, + desktop_icon_view); + default_zoom_level_changed (desktop_icon_view); + /* Read out the panel desktop area and update the icon container * accordingly */ panel_desktop_area_changed (desktop_icon_view); |