Commit 1968379a authored by Carlos Soriano's avatar Carlos Soriano Committed by Carlos Soriano Sánchez

nautilus-icon-info: rework zoom levels

Following a design request and preparing to the port to popovers of
nautilus, we want to use only 3 zoom levels for each kind of view, so
the slider makes sense.

Also, following design guidelines, the new zoom levels sizes for icon
view are 64, 96, 128, with default to 96 and 16, 32, 48 for list view,
32 being the default
parent 2712afba
......@@ -95,7 +95,7 @@
#define CONTAINER_PAD_TOP 4
#define CONTAINER_PAD_BOTTOM 4
#define STANDARD_ICON_GRID_WIDTH 155
#define STANDARD_ICON_GRID_WIDTH 80
/* Desktop layout mode defines */
#define DESKTOP_PAD_HORIZONTAL 10
......@@ -350,14 +350,29 @@ icon_set_position (NautilusCanvasIcon *icon,
icon->y = y;
}
static guint
nautilus_canvas_container_get_icon_size_for_zoom_level (NautilusCanvasZoomLevel zoom_level)
{
switch (zoom_level) {
case NAUTILUS_CANVAS_ZOOM_LEVEL_SMALL:
return NAUTILUS_CANVAS_ICON_SIZE_SMALL;
case NAUTILUS_CANVAS_ZOOM_LEVEL_STANDARD:
return NAUTILUS_CANVAS_ICON_SIZE_STANDARD;
case NAUTILUS_CANVAS_ZOOM_LEVEL_LARGE:
return NAUTILUS_CANVAS_ICON_SIZE_LARGE;
}
g_return_val_if_reached (NAUTILUS_CANVAS_ICON_SIZE_STANDARD);
}
static void
icon_get_size (NautilusCanvasContainer *container,
NautilusCanvasIcon *icon,
guint *size)
{
if (size != NULL) {
*size = MAX (nautilus_get_icon_size_for_zoom_level (container->details->zoom_level)
* icon->scale, NAUTILUS_ICON_SIZE_SMALLEST);
*size = MAX (nautilus_canvas_container_get_icon_size_for_zoom_level (container->details->zoom_level)
* icon->scale, NAUTILUS_CANVAS_ICON_SIZE_SMALL);
}
}
......@@ -382,7 +397,7 @@ icon_set_size (NautilusCanvasContainer *container,
}
scale = (double) icon_size /
nautilus_get_icon_size_for_zoom_level
nautilus_canvas_container_get_icon_size_for_zoom_level
(container->details->zoom_level);
nautilus_canvas_container_move_icon (container, icon,
icon->x, icon->y,
......@@ -1092,7 +1107,7 @@ nautilus_canvas_container_update_scroll_region (NautilusCanvasContainer *contain
vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container));
/* Scroll by 1/4 icon each time you click. */
step_increment = nautilus_get_icon_size_for_zoom_level
step_increment = nautilus_canvas_container_get_icon_size_for_zoom_level
(container->details->zoom_level) / 4;
if (gtk_adjustment_get_step_increment (hadj) != step_increment) {
gtk_adjustment_set_step_increment (hadj, step_increment);
......@@ -5151,7 +5166,7 @@ handle_focus_out_event (GtkWidget *widget, GdkEventFocus *event, gpointer user_d
}
static int text_ellipsis_limits[NAUTILUS_ZOOM_LEVEL_N_ENTRIES];
static int text_ellipsis_limits[NAUTILUS_CANVAS_ZOOM_LEVEL_N_ENTRIES];
static int desktop_text_ellipsis_limit;
static gboolean
......@@ -5188,13 +5203,9 @@ get_text_ellipsis_limit_for_zoom (char **strs,
}
static const char * zoom_level_names[] = {
"smallest",
"smaller",
"small",
"standard",
"large",
"larger",
"largest"
};
static void
......@@ -5209,7 +5220,7 @@ text_ellipsis_limit_changed_callback (gpointer callback_data)
/* set default */
get_text_ellipsis_limit_for_zoom (pref, NULL, &one_limit);
for (i = 0; i < NAUTILUS_ZOOM_LEVEL_N_ENTRIES; i++) {
for (i = 0; i < NAUTILUS_CANVAS_ZOOM_LEVEL_N_ENTRIES; i++) {
text_ellipsis_limits[i] = one_limit;
}
......@@ -5244,7 +5255,7 @@ nautilus_canvas_container_init (NautilusCanvasContainer *container)
details->icon_set = g_hash_table_new (g_direct_hash, g_direct_equal);
details->layout_timestamp = UNDEFINED_TIME;
details->zoom_level = NAUTILUS_ZOOM_LEVEL_STANDARD;
details->zoom_level = NAUTILUS_CANVAS_ZOOM_LEVEL_STANDARD;
container->details = details;
......@@ -6314,7 +6325,7 @@ nautilus_canvas_container_request_update (NautilusCanvasContainer *container,
/* zooming */
NautilusZoomLevel
NautilusCanvasZoomLevel
nautilus_canvas_container_get_zoom_level (NautilusCanvasContainer *container)
{
return container->details->zoom_level;
......@@ -6332,10 +6343,10 @@ nautilus_canvas_container_set_zoom_level (NautilusCanvasContainer *container, in
end_renaming_mode (container, TRUE);
pinned_level = new_level;
if (pinned_level < NAUTILUS_ZOOM_LEVEL_SMALLEST) {
pinned_level = NAUTILUS_ZOOM_LEVEL_SMALLEST;
} else if (pinned_level > NAUTILUS_ZOOM_LEVEL_LARGEST) {
pinned_level = NAUTILUS_ZOOM_LEVEL_LARGEST;
if (pinned_level < NAUTILUS_CANVAS_ZOOM_LEVEL_SMALL) {
pinned_level = NAUTILUS_CANVAS_ZOOM_LEVEL_SMALL;
} else if (pinned_level > NAUTILUS_CANVAS_ZOOM_LEVEL_LARGE) {
pinned_level = NAUTILUS_CANVAS_ZOOM_LEVEL_LARGE;
}
if (pinned_level == details->zoom_level) {
......@@ -6344,8 +6355,8 @@ nautilus_canvas_container_set_zoom_level (NautilusCanvasContainer *container, in
details->zoom_level = pinned_level;
pixels_per_unit = (double) nautilus_get_icon_size_for_zoom_level (pinned_level)
/ NAUTILUS_ICON_SIZE_STANDARD;
pixels_per_unit = (double) nautilus_canvas_container_get_icon_size_for_zoom_level (pinned_level)
/ NAUTILUS_CANVAS_ICON_SIZE_STANDARD;
eel_canvas_set_pixels_per_unit (EEL_CANVAS (container), pixels_per_unit);
nautilus_canvas_container_request_update_all_internal (container, TRUE);
......@@ -6890,7 +6901,7 @@ compute_stretch (StretchState *start,
y_stretch = - y_stretch;
}
current->icon_size = MAX ((int) start->icon_size + MIN (x_stretch, y_stretch),
(int) NAUTILUS_ICON_SIZE_SMALLEST);
(int) NAUTILUS_CANVAS_ICON_SIZE_SMALL);
/* Figure out where the corner of the icon should be. */
current->icon_x = start->icon_x;
......@@ -7882,8 +7893,8 @@ nautilus_canvas_container_widget_to_file_operation_position (NautilusCanvasConta
position->y = (int) y;
/* ensure that we end up in the middle of the icon */
position->x -= nautilus_get_icon_size_for_zoom_level (container->details->zoom_level) / 2;
position->y -= nautilus_get_icon_size_for_zoom_level (container->details->zoom_level) / 2;
position->x -= nautilus_canvas_container_get_icon_size_for_zoom_level (container->details->zoom_level) / 2;
position->y -= nautilus_canvas_container_get_icon_size_for_zoom_level (container->details->zoom_level) / 2;
}
static void
......
......@@ -292,7 +292,7 @@ void nautilus_canvas_container_start_renaming_selected_item (Nauti
gboolean select_all);
/* options */
NautilusZoomLevel nautilus_canvas_container_get_zoom_level (NautilusCanvasContainer *view);
NautilusCanvasZoomLevel nautilus_canvas_container_get_zoom_level (NautilusCanvasContainer *view);
void nautilus_canvas_container_set_zoom_level (NautilusCanvasContainer *view,
int new_zoom_level);
void nautilus_canvas_container_set_single_click_mode (NautilusCanvasContainer *container,
......
......@@ -49,7 +49,9 @@
#define LABEL_OFFSET 1
#define LABEL_LINE_SPACING 0
#define MAX_TEXT_WIDTH_STANDARD 135
/* Width of the label with the standard icon size NAUTILUS_CANVAS_ICON_SIZE_SMALL.
* It will adapt to other sizes keeping the same space.*/
#define MAX_TEXT_WIDTH_STANDARD 110
/* special text height handling
* each item has three text height variables:
......
......@@ -3560,7 +3560,7 @@ thumbnail_loader_size_prepared (GdkPixbufLoader *loader,
aspect_ratio = ((double) width) / height;
/* cf. nautilus_file_get_icon() */
max_thumbnail_size = NAUTILUS_ICON_SIZE_LARGEST * cached_thumbnail_size / NAUTILUS_ICON_SIZE_STANDARD;
max_thumbnail_size = NAUTILUS_CANVAS_ICON_SIZE_LARGE * cached_thumbnail_size / NAUTILUS_CANVAS_ICON_SIZE_SMALL;
if (MAX (width, height) > max_thumbnail_size) {
if (width > height) {
width = max_thumbnail_size;
......
......@@ -74,7 +74,7 @@ file_icons_changed (NautilusFile *file,
GdkPixbuf *pixbuf;
pixbuf = nautilus_file_get_icon_pixbuf (fcd->details->destination,
NAUTILUS_ICON_SIZE_LARGE,
NAUTILUS_CANVAS_ICON_SIZE_SMALL,
TRUE,
gtk_widget_get_scale_factor (fcd->details->dest_image),
NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS);
......@@ -83,7 +83,7 @@ file_icons_changed (NautilusFile *file,
g_object_unref (pixbuf);
pixbuf = nautilus_file_get_icon_pixbuf (fcd->details->source,
NAUTILUS_ICON_SIZE_LARGE,
NAUTILUS_CANVAS_ICON_SIZE_SMALL,
TRUE,
gtk_widget_get_scale_factor (fcd->details->src_image),
NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS);
......@@ -219,7 +219,7 @@ file_list_ready_cb (GList *files,
/* Set up file icons */
pixbuf = nautilus_file_get_icon_pixbuf (dest,
NAUTILUS_ICON_SIZE_LARGE,
NAUTILUS_CANVAS_ICON_SIZE_SMALL,
TRUE,
gtk_widget_get_scale_factor (fcd->details->titles_vbox),
NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS);
......@@ -230,7 +230,7 @@ file_list_ready_cb (GList *files,
g_object_unref (pixbuf);
pixbuf = nautilus_file_get_icon_pixbuf (src,
NAUTILUS_ICON_SIZE_LARGE,
NAUTILUS_CANVAS_ICON_SIZE_SMALL,
TRUE,
gtk_widget_get_scale_factor (fcd->details->titles_vbox),
NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS);
......
......@@ -4446,7 +4446,7 @@ nautilus_file_get_thumbnail_icon (NautilusFile *file,
if (flags & NAUTILUS_FILE_ICON_FLAGS_FORCE_THUMBNAIL_SIZE) {
modified_size = size * scale;
} else {
modified_size = size * scale * cached_thumbnail_size / NAUTILUS_ICON_SIZE_STANDARD;
modified_size = size * scale * cached_thumbnail_size / NAUTILUS_CANVAS_ICON_SIZE_SMALL;
DEBUG ("Modifying icon size to %d, as our cached thumbnail size is %d",
modified_size, cached_thumbnail_size);
}
......@@ -4458,14 +4458,14 @@ nautilus_file_get_thumbnail_icon (NautilusFile *file,
s = MAX (w, h);
/* Don't scale up small thumbnails in the standard view */
if (s <= cached_thumbnail_size) {
thumb_scale = (double) size / NAUTILUS_ICON_SIZE_STANDARD;
thumb_scale = (double) size / NAUTILUS_CANVAS_ICON_SIZE_SMALL;
} else {
thumb_scale = (double) modified_size / s;
}
/* Make sure that icons don't get smaller than NAUTILUS_ICON_SIZE_SMALLEST */
if (s * thumb_scale <= NAUTILUS_ICON_SIZE_SMALLEST) {
thumb_scale = (double) NAUTILUS_ICON_SIZE_SMALLEST / s;
if (s * thumb_scale <= NAUTILUS_CANVAS_ICON_SIZE_SMALL) {
thumb_scale = (double) NAUTILUS_CANVAS_ICON_SIZE_SMALL / s;
}
if (file->details->thumbnail_scale == thumb_scale &&
......
......@@ -568,34 +568,6 @@ nautilus_icon_info_get_used_name (NautilusIconInfo *icon)
return icon->icon_name;
}
/* Return nominal icon size for given zoom level.
* @zoom_level: zoom level for which to find matching icon size.
*
* Return value: icon size between NAUTILUS_ICON_SIZE_SMALLEST and
* NAUTILUS_ICON_SIZE_LARGEST, inclusive.
*/
guint
nautilus_get_icon_size_for_zoom_level (NautilusZoomLevel zoom_level)
{
switch (zoom_level) {
case NAUTILUS_ZOOM_LEVEL_SMALLEST:
return NAUTILUS_ICON_SIZE_SMALLEST;
case NAUTILUS_ZOOM_LEVEL_SMALLER:
return NAUTILUS_ICON_SIZE_SMALLER;
case NAUTILUS_ZOOM_LEVEL_SMALL:
return NAUTILUS_ICON_SIZE_SMALL;
case NAUTILUS_ZOOM_LEVEL_STANDARD:
return NAUTILUS_ICON_SIZE_STANDARD;
case NAUTILUS_ZOOM_LEVEL_LARGE:
return NAUTILUS_ICON_SIZE_LARGE;
case NAUTILUS_ZOOM_LEVEL_LARGER:
return NAUTILUS_ICON_SIZE_LARGER;
case NAUTILUS_ZOOM_LEVEL_LARGEST:
return NAUTILUS_ICON_SIZE_LARGEST;
}
g_return_val_if_reached (NAUTILUS_ICON_SIZE_STANDARD);
}
gint
nautilus_get_icon_size_for_stock_size (GtkIconSize size)
{
......@@ -604,7 +576,7 @@ nautilus_get_icon_size_for_stock_size (GtkIconSize size)
if (gtk_icon_size_lookup (size, &w, &h)) {
return MAX (w, h);
}
return NAUTILUS_ICON_SIZE_STANDARD;
return NAUTILUS_CANVAS_ICON_SIZE_SMALL;
}
......
......@@ -11,16 +11,19 @@ G_BEGIN_DECLS
/* Names for Nautilus's different zoom levels, from tiniest items to largest items */
typedef enum {
NAUTILUS_ZOOM_LEVEL_SMALLEST,
NAUTILUS_ZOOM_LEVEL_SMALLER,
NAUTILUS_ZOOM_LEVEL_SMALL,
NAUTILUS_ZOOM_LEVEL_STANDARD,
NAUTILUS_ZOOM_LEVEL_LARGE,
NAUTILUS_ZOOM_LEVEL_LARGER,
NAUTILUS_ZOOM_LEVEL_LARGEST
} NautilusZoomLevel;
NAUTILUS_CANVAS_ZOOM_LEVEL_SMALL,
NAUTILUS_CANVAS_ZOOM_LEVEL_STANDARD,
NAUTILUS_CANVAS_ZOOM_LEVEL_LARGE,
} NautilusCanvasZoomLevel;
#define NAUTILUS_ZOOM_LEVEL_N_ENTRIES (NAUTILUS_ZOOM_LEVEL_LARGEST + 1)
typedef enum {
NAUTILUS_LIST_ZOOM_LEVEL_SMALL,
NAUTILUS_LIST_ZOOM_LEVEL_STANDARD,
NAUTILUS_LIST_ZOOM_LEVEL_LARGE,
} NautilusListZoomLevel;
#define NAUTILUS_LIST_ZOOM_LEVEL_N_ENTRIES (NAUTILUS_LIST_ZOOM_LEVEL_LARGE + 1)
#define NAUTILUS_CANVAS_ZOOM_LEVEL_N_ENTRIES (NAUTILUS_CANVAS_ZOOM_LEVEL_LARGE + 1)
/* Nominal icon sizes for each Nautilus zoom level.
* This scheme assumes that icons are designed to
......@@ -28,13 +31,13 @@ typedef enum {
* be square. Since individual icons can be stretched,
* each icon is not constrained to this nominal size.
*/
#define NAUTILUS_ICON_SIZE_SMALLEST 16
#define NAUTILUS_ICON_SIZE_SMALLER 24
#define NAUTILUS_ICON_SIZE_SMALL 32
#define NAUTILUS_ICON_SIZE_STANDARD 48
#define NAUTILUS_ICON_SIZE_LARGE 72
#define NAUTILUS_ICON_SIZE_LARGER 96
#define NAUTILUS_ICON_SIZE_LARGEST 192
#define NAUTILUS_LIST_ICON_SIZE_SMALL 16
#define NAUTILUS_LIST_ICON_SIZE_STANDARD 32
#define NAUTILUS_LIST_ICON_SIZE_LARGE 48
#define NAUTILUS_CANVAS_ICON_SIZE_SMALL 64
#define NAUTILUS_CANVAS_ICON_SIZE_STANDARD 96
#define NAUTILUS_CANVAS_ICON_SIZE_LARGE 128
/* Maximum size of an icon that the icon factory will ever produce */
#define NAUTILUS_ICON_MAXIMUM_SIZE 320
......@@ -76,7 +79,8 @@ const char * nautilus_icon_info_get_used_name (NautilusI
void nautilus_icon_info_clear_caches (void);
/* Relationship between zoom levels and icons sizes. */
guint nautilus_get_icon_size_for_zoom_level (NautilusZoomLevel zoom_level);
guint nautilus_get_list_icon_size_for_zoom_level (NautilusListZoomLevel zoom_level);
guint nautilus_get_canvas_icon_size_for_zoom_level (NautilusCanvasZoomLevel zoom_level);
gint nautilus_get_icon_size_for_stock_size (GtkIconSize size);
guint nautilus_icon_get_emblem_size_for_icon_size (guint size);
......
......@@ -31,14 +31,16 @@
<value nick="trash-time" value="6"/>
</enum>
<enum id="org.gnome.nautilus.ZoomLevel">
<value nick="smallest" value="0"/>
<value nick="smaller" value="1"/>
<value nick="small" value="2"/>
<value nick="standard" value="3"/>
<value nick="large" value="4"/>
<value nick="larger" value="5"/>
<value nick="largest" value="6"/>
<enum id="org.gnome.nautilus.CanvasZoomLevel">
<value nick="small" value="0"/>
<value nick="standard" value="1"/>
<value nick="large" value="2"/>
</enum>
<enum id="org.gnome.nautilus.ListZoomLevel">
<value nick="small" value="0"/>
<value nick="standard" value="1"/>
<value nick="large" value="2"/>
</enum>
<enum id="org.gnome.nautilus.TabPosition">
......@@ -168,7 +170,7 @@
<schema id="org.gnome.nautilus.icon-view" path="/org/gnome/nautilus/icon-view/" gettext-domain="nautilus">
<key name="captions" type="as">
<default>[ 'none', 'size', 'date_modified' ]</default>
<default>[ 'none', 'none', 'none' ]</default>
<_summary>List of possible captions on icons</_summary>
<_description>A list of captions below an icon in the icon view and
the desktop. The actual number of captions shown depends on
......@@ -176,7 +178,7 @@
"size", "type", "date_modified", "owner",
"group", "permissions", and "mime_type".</_description>
</key>
<key name="default-zoom-level" enum="org.gnome.nautilus.ZoomLevel">
<key name="default-zoom-level" enum="org.gnome.nautilus.CanvasZoomLevel">
<default>'standard'</default>
<_summary>Default icon zoom level</_summary>
<_description>Default zoom level used by the icon view.</_description>
......@@ -184,7 +186,7 @@
<key name="thumbnail-size" type="i">
<default>64</default>
<_summary>Default Thumbnail Icon Size</_summary>
<_description>The default size of an icon for a thumbnail in the icon view.</_description>
<_description>The default size of an icon for a thumbnail in the icon view when using NAUTILUS_ICON_SIZE_SMALL size.</_description>
</key>
<key name="text-ellipsis-limit" type="as">
<default>[ '3' ]</default>
......@@ -206,14 +208,13 @@
for zoom level "smaller". Do not shorten file names for other zoom levels.
Available zoom levels:
smallest (33%), smaller (50%), small (66%), standard (100%), large (150%),
larger (200%), largest (400%)</_description>
small, standard, large</_description>
</key>
</schema>
<schema id="org.gnome.nautilus.list-view" path="/org/gnome/nautilus/list-view/" gettext-domain="nautilus">
<key name="default-zoom-level" enum="org.gnome.nautilus.ZoomLevel">
<default>'small'</default>
<key name="default-zoom-level" enum="org.gnome.nautilus.CanvasZoomLevel">
<default>'standard'</default>
<_summary>Default list zoom level</_summary>
<_description>Default zoom level used by the list view.</_description>
</key>
......
......@@ -743,7 +743,7 @@ nautilus_bookmarks_window_constructed (GObject *object)
gtk_tree_view_append_column (self->priv->tree_view,
GTK_TREE_VIEW_COLUMN (col));
gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (col),
NAUTILUS_ICON_SIZE_SMALLER);
NAUTILUS_LIST_ICON_SIZE_SMALL);
rend = gtk_cell_renderer_text_new ();
g_object_set (rend,
......
......@@ -218,13 +218,9 @@ nautilus_canvas_view_container_get_icon_text_attribute_names (NautilusCanvasCont
int piece_count;
const int pieces_by_level[] = {
0, /* NAUTILUS_ZOOM_LEVEL_SMALLEST */
0, /* NAUTILUS_ZOOM_LEVEL_SMALLER */
0, /* NAUTILUS_ZOOM_LEVEL_SMALL */
1, /* NAUTILUS_ZOOM_LEVEL_STANDARD */
2, /* NAUTILUS_ZOOM_LEVEL_LARGE */
2, /* NAUTILUS_ZOOM_LEVEL_LARGER */
3 /* NAUTILUS_ZOOM_LEVEL_LARGEST */
3, /* NAUTILUS_ZOOM_LEVEL_SMALL */
3, /* NAUTILUS_ZOOM_LEVEL_STANDARD */
3, /* NAUTILUS_ZOOM_LEVEL_LARGE */
};
piece_count = pieces_by_level[nautilus_canvas_container_get_zoom_level (container)];
......@@ -262,14 +258,8 @@ nautilus_canvas_view_container_get_icon_text (NautilusCanvasContainer *container
use_additional = (additional_text != NULL);
/* In the smallest zoom mode, no text is drawn. */
if (nautilus_canvas_container_get_zoom_level (container) == NAUTILUS_ZOOM_LEVEL_SMALLEST &&
!include_invisible) {
*editable_text = NULL;
} else {
/* Strip the suffix for nautilus object xml files. */
*editable_text = nautilus_file_get_display_name (file);
}
/* Strip the suffix for nautilus object xml files. */
*editable_text = nautilus_file_get_display_name (file);
if (!use_additional) {
return;
......
......@@ -154,7 +154,7 @@ static void nautilus_canvas_view_set_directory_sort_by (N
NautilusFile *file,
const char *sort_by);
static void nautilus_canvas_view_set_zoom_level (NautilusCanvasView *view,
NautilusZoomLevel new_level,
NautilusCanvasZoomLevel new_level,
gboolean always_emit);
static void nautilus_canvas_view_update_click_mode (NautilusCanvasView *canvas_view);
static gboolean nautilus_canvas_view_supports_scaling (NautilusCanvasView *canvas_view);
......@@ -775,15 +775,15 @@ get_sort_criterion_by_sort_type (NautilusFileSortType sort_type)
#define DEFAULT_ZOOM_LEVEL(canvas_view) default_zoom_level
static NautilusZoomLevel
static NautilusCanvasZoomLevel
get_default_zoom_level (NautilusCanvasView *canvas_view)
{
NautilusZoomLevel default_zoom_level;
NautilusCanvasZoomLevel default_zoom_level;
default_zoom_level = g_settings_get_enum (nautilus_icon_view_preferences,
NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL);
return CLAMP (DEFAULT_ZOOM_LEVEL(canvas_view), NAUTILUS_ZOOM_LEVEL_SMALLEST, NAUTILUS_ZOOM_LEVEL_LARGEST);
return CLAMP (DEFAULT_ZOOM_LEVEL(canvas_view), NAUTILUS_CANVAS_ZOOM_LEVEL_SMALL, NAUTILUS_CANVAS_ZOOM_LEVEL_LARGE);
}
static void
......@@ -868,24 +868,24 @@ nautilus_canvas_view_end_loading (NautilusView *view,
canvas_view_notify_clipboard_info (monitor, info, canvas_view);
}
static NautilusZoomLevel
static NautilusCanvasZoomLevel
nautilus_canvas_view_get_zoom_level (NautilusView *view)
{
g_return_val_if_fail (NAUTILUS_IS_CANVAS_VIEW (view), NAUTILUS_ZOOM_LEVEL_STANDARD);
g_return_val_if_fail (NAUTILUS_IS_CANVAS_VIEW (view), NAUTILUS_CANVAS_ZOOM_LEVEL_STANDARD);
return nautilus_canvas_container_get_zoom_level (get_canvas_container (NAUTILUS_CANVAS_VIEW (view)));
}
static void
nautilus_canvas_view_set_zoom_level (NautilusCanvasView *view,
NautilusZoomLevel new_level,
gboolean always_emit)
nautilus_canvas_view_set_zoom_level (NautilusCanvasView *view,
NautilusCanvasZoomLevel new_level,
gboolean always_emit)
{
NautilusCanvasContainer *canvas_container;
g_return_if_fail (NAUTILUS_IS_CANVAS_VIEW (view));
g_return_if_fail (new_level >= NAUTILUS_ZOOM_LEVEL_SMALLEST &&
new_level <= NAUTILUS_ZOOM_LEVEL_LARGEST);
g_return_if_fail (new_level >= NAUTILUS_CANVAS_ZOOM_LEVEL_SMALL &&
new_level <= NAUTILUS_CANVAS_ZOOM_LEVEL_LARGE);
canvas_container = get_canvas_container (view);
if (nautilus_canvas_container_get_zoom_level (canvas_container) == new_level) {
......@@ -905,30 +905,34 @@ nautilus_canvas_view_set_zoom_level (NautilusCanvasView *view,
}
static void
nautilus_canvas_view_bump_zoom_level (NautilusView *view, int zoom_increment)
nautilus_canvas_view_zoom_to_level (NautilusView *view,
gint zoom_level)
{
NautilusZoomLevel new_level;
g_return_if_fail (NAUTILUS_IS_CANVAS_VIEW (view));
NautilusCanvasView *canvas_view;
new_level = nautilus_canvas_view_get_zoom_level (view) + zoom_increment;
g_assert (NAUTILUS_IS_CANVAS_VIEW (view));
if (new_level >= NAUTILUS_ZOOM_LEVEL_SMALLEST &&
new_level <= NAUTILUS_ZOOM_LEVEL_LARGEST) {
nautilus_view_zoom_to_level (view, new_level);
}
canvas_view = NAUTILUS_CANVAS_VIEW (view);
nautilus_canvas_view_set_zoom_level (canvas_view, zoom_level, FALSE);
}
static void
nautilus_canvas_view_zoom_to_level (NautilusView *view,
NautilusZoomLevel zoom_level)
nautilus_canvas_view_bump_zoom_level (NautilusView *view, int zoom_increment)
{
NautilusCanvasView *canvas_view;
NautilusCanvasZoomLevel new_level;
g_assert (NAUTILUS_IS_CANVAS_VIEW (view));
g_return_if_fail (NAUTILUS_IS_CANVAS_VIEW (view));
if (!nautilus_view_supports_zooming (view)) {
return;
}
canvas_view = NAUTILUS_CANVAS_VIEW (view);
nautilus_canvas_view_set_zoom_level (canvas_view, zoom_level, FALSE);
new_level = nautilus_canvas_view_get_zoom_level (view) + zoom_increment;
if (new_level >= NAUTILUS_CANVAS_ZOOM_LEVEL_SMALL &&
new_level <= NAUTILUS_CANVAS_ZOOM_LEVEL_LARGE) {
nautilus_canvas_view_zoom_to_level (view, new_level);
}
}
static void
......@@ -939,7 +943,7 @@ nautilus_canvas_view_restore_default_zoom_level (NautilusView *view)
g_return_if_fail (NAUTILUS_IS_CANVAS_VIEW (view));
canvas_view = NAUTILUS_CANVAS_VIEW (view);
nautilus_view_zoom_to_level
nautilus_canvas_view_zoom_to_level
(view, get_default_zoom_level (canvas_view));
}
......@@ -949,7 +953,7 @@ nautilus_canvas_view_can_zoom_in (NautilusView *view)
g_return_val_if_fail (NAUTILUS_IS_CANVAS_VIEW (view), FALSE);
return nautilus_canvas_view_get_zoom_level (view)
< NAUTILUS_ZOOM_LEVEL_LARGEST;
< NAUTILUS_CANVAS_ZOOM_LEVEL_LARGE;
}
static gboolean
......@@ -958,7 +962,7 @@ nautilus_canvas_view_can_zoom_out (NautilusView *view)
g_return_val_if_fail (NAUTILUS_IS_CANVAS_VIEW (view), FALSE);
return nautilus_canvas_view_get_zoom_level (view)
> NAUTILUS_ZOOM_LEVEL_SMALLEST;
> NAUTILUS_CANVAS_ZOOM_LEVEL_SMALL;
}
static gboolean
......@@ -1079,10 +1083,6 @@ layout_changed_callback (NautilusCanvasContainer *container,
static gboolean
nautilus_canvas_view_can_rename_file (NautilusView *view, NautilusFile *file)
{
if (!(nautilus_canvas_view_get_zoom_level (view) > NAUTILUS_ZOOM_LEVEL_SMALLEST)) {
return FALSE;
}
return NAUTILUS_VIEW_CLASS(nautilus_canvas_view_parent_class)->can_rename_file (view, file);
}
......@@ -2070,7 +2070,6 @@ nautilus_canvas_view_class_init (NautilusCanvasViewClass *klass)
nautilus_view_class->invert_selection = nautilus_canvas_view_invert_selection;
nautilus_view_class->compare_files = compare_files;
nautilus_view_class->zoom_to_level = nautilus_canvas_view_zoom_to_level;
nautilus_view_class->get_zoom_level = nautilus_canvas_view_get_zoom_level;
nautilus_view_class->click_policy_changed = nautilus_canvas_view_click_policy_changed;
nautilus_view_class->merge_menus = nautilus_canvas_view_merge_menus;
nautilus_view_class->unmerge_menus = nautilus_canvas_view_unmerge_menus;
......
......@@ -331,21 +331,21 @@ desktop_canvas_container_realize (GtkWidget *widget,
gdk_window_set_background_rgba (bin_window, &transparent);
}
static NautilusZoomLevel
static NautilusCanvasZoomLevel
get_default_zoom_level (void)
{
NautilusZoomLevel default_zoom_level;
NautilusCanvasZoomLevel default_zoom_level;
default_zoom_level = g_settings_get_enum (nautilus_icon_view_preferences,
NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL);
return CLAMP (default_zoom_level, NAUTILUS_ZOOM_LEVEL_SMALLEST, NAUTILUS_ZOOM_LEVEL_LARGEST);
return CLAMP (default_zoom_level, NAUTILUS_CANVAS_ZOOM_LEVEL_SMALL, NAUTILUS_CANVAS_ZOOM_LEVEL_LARGE);
}
static void
default_zoom_level_changed (gpointer user_data)
{
NautilusZoomLevel new_level;
NautilusCanvasZoomLevel new_level;
NautilusDesktopCanvasView *desktop_canvas_view;
desktop_canvas_view = NAUTILUS_DESKTOP_CANVAS_VIEW (user_data);
......
......@@ -53,7 +53,7 @@ nautilus_empty_view_add_file (NautilusView *view, NautilusFile *file, NautilusDi
if (!timer) timer = g_timer_new ();
g_timer_start (timer);
icon = nautilus_file_get_icon_pixbuf (file, nautilus_get_icon_size_for_zoom_level (NAUTILUS_ZOOM_LEVEL_STANDARD), TRUE, 0);
icon = nautilus_file_get_icon_pixbuf (file, nautilus_get_icon_size_for_zoom_level (NAUTILUS_CANVAS_ZOOM_LEVEL_STANDARD), TRUE, 0);
elaps = g_timer_elapsed (timer, NULL);
g_timer_stop (timer);
......@@ -151,15 +151,15 @@ nautilus_empty_view_bump_zoom_level (NautilusView *view, int zoom_increment)
{
}
static NautilusZoomLevel
static NautilusCanvasZoomLevel
nautilus_empty_view_get_zoom_level (NautilusView *view)
{
return NAUTILUS_ZOOM_LEVEL_STANDARD;
return NAUTILUS_CANVAS_ZOOM_LEVEL_STANDARD;
}
static void
nautilus_empty_view_zoom_to_level (NautilusView *view,
NautilusZoomLevel zoom_level)
NautilusCanvasZoomLevel zoom_level)
{
}
......
......@@ -64,13 +64,9 @@ static const char * const default_view_values[] = {
};
static const char * const zoom_values[] = {
"smallest",
"smaller",
"small",
"standard",
"large",
"larger",
"largest",
NULL
};
......
......@@ -363,7 +363,7 @@
<object class="GtkComboBox" id="list_view_zoom_combobox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="model">model5</property>
<property name="model">model4</property>
<child>
<object class="GtkCellRendererText" id="renderer5"/>
<attributes>
......@@ -1339,25 +1339,13 @@
</columns>
<data>
<row>
<col id="0" translatable="yes">33%</col>
<col id="0" translatable="yes">Small</col>
</row>
<row>
<col id="0" translatable="yes">50%</col>
<col id="0" translatable="yes">Standard</col>
</row>
<row>
<col id="0" translatable="yes">66%</col>
</row>
<row>
<col id="0" translatable="yes">100%</col>
</row>
<row>
<col id="0" translatable="yes">150%</col>
</row>
<row>
<col id="0" translatable="yes">200%</col>
</row>
<row>
<col id="0" translatable="yes">400%</col>
<col id="0" translatable="yes">Large</col>
</row>
</data>
</object>
......@@ -1368,54 +1356,13 @@
</columns>
<data>
<row>
<col id="0" translatable="yes">33%</col>
</row>
<row>
<col id="0" translatable="yes">50%</col>
</row>