Commit 3729e63c authored by Alexander Schwinn's avatar Alexander Schwinn
Browse files

Make icon-view margin depend on zoom level (Issue #839)

Like that rubber band selection starting on the left can be done
properly on high zoom levels
parent 776749fc
......@@ -460,6 +460,29 @@ thunar_zoom_level_to_icon_size (ThunarZoomLevel zoom_level)
thunar_zoom_level_to_view_margin (ThunarZoomLevel zoom_level)
switch (zoom_level)
case THUNAR_ZOOM_LEVEL_25_PERCENT: return 3;
case THUNAR_ZOOM_LEVEL_38_PERCENT: return 3;
case THUNAR_ZOOM_LEVEL_50_PERCENT: return 3;
case THUNAR_ZOOM_LEVEL_75_PERCENT: return 3;
case THUNAR_ZOOM_LEVEL_100_PERCENT: return 3;
case THUNAR_ZOOM_LEVEL_150_PERCENT: return 5;
case THUNAR_ZOOM_LEVEL_200_PERCENT: return 10;
case THUNAR_ZOOM_LEVEL_250_PERCENT: return 12;
case THUNAR_ZOOM_LEVEL_300_PERCENT: return 15;
case THUNAR_ZOOM_LEVEL_400_PERCENT: return 18;
case THUNAR_ZOOM_LEVEL_800_PERCENT: return 20;
case THUNAR_ZOOM_LEVEL_1600_PERCENT: return 40;
default: return 3;
static ThunarThumbnailSize
thunar_icon_size_to_thumbnail_size (ThunarIconSize icon_size)
......@@ -282,6 +282,7 @@ typedef enum
GType thunar_zoom_level_get_type (void) G_GNUC_CONST;
ThunarThumbnailSize thunar_zoom_level_to_thumbnail_size (ThunarZoomLevel zoom_level) G_GNUC_CONST;
gint thunar_zoom_level_to_view_margin (ThunarZoomLevel zoom_level) G_GNUC_CONST;
const gchar* thunar_zoom_level_string_from_value (ThunarZoomLevel zoom_level);
gboolean thunar_zoom_level_value_from_string (const gchar *value_string,
gint *value);
......@@ -178,12 +178,17 @@ thunar_icon_view_get_accessible (GtkWidget *widget)
static void
thunar_icon_view_zoom_level_changed (ThunarStandardView *standard_view)
gint wrap_width;
gint wrap_width;
ExoIconView *exo_icon_view;
ThunarZoomLevel zoom_level;
_thunar_return_if_fail (THUNAR_IS_STANDARD_VIEW (standard_view));
exo_icon_view = EXO_ICON_VIEW (gtk_bin_get_child (GTK_BIN (standard_view)));
zoom_level = thunar_view_get_zoom_level (THUNAR_VIEW (standard_view));
/* determine the "wrap-width" depending on the "zoom-level" */
switch (thunar_view_get_zoom_level (THUNAR_VIEW (standard_view)))
switch (zoom_level)
wrap_width = 48;
......@@ -208,6 +213,11 @@ thunar_icon_view_zoom_level_changed (ThunarStandardView *standard_view)
/* set the new "wrap-width" for the text renderer */
g_object_set (G_OBJECT (standard_view->name_renderer), "wrap-width", wrap_width, NULL);
/* Like that rubber band selection can be done properly on high zoom levels */
/* Without margin adjustment it would be almost impossible to start the selection on the left */
exo_icon_view_set_margin (exo_icon_view, thunar_zoom_level_to_view_margin (zoom_level));
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment