[nautilus/wip/gaction_: 17/38] nautilus-icon-info: rework zoom levels
- From: Carlos Soriano Sánchez <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/gaction_: 17/38] nautilus-icon-info: rework zoom levels
- Date: Wed, 21 Jan 2015 13:20:12 +0000 (UTC)
commit 9012a59bc122c1f7e93614859715deabd39d0ab5
Author: Carlos Soriano <carlos sorian89 gmail com>
Date: Fri Jan 16 15:01:11 2015 +0100
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
libnautilus-private/nautilus-canvas-container.c | 55 ++++++++++-------
libnautilus-private/nautilus-canvas-container.h | 2 +-
libnautilus-private/nautilus-canvas-item.c | 4 +-
libnautilus-private/nautilus-directory-async.c | 2 +-
.../nautilus-file-conflict-dialog.c | 8 +-
libnautilus-private/nautilus-file.c | 8 +-
libnautilus-private/nautilus-icon-info.c | 30 +---------
libnautilus-private/nautilus-icon-info.h | 38 ++++++-----
.../org.gnome.nautilus.gschema.xml.in | 31 +++++-----
src/nautilus-bookmarks-window.c | 2 +-
src/nautilus-canvas-view-container.c | 20 ++-----
src/nautilus-canvas-view.c | 67 ++++++++++----------
src/nautilus-desktop-canvas-view.c | 8 +-
src/nautilus-empty-view.c | 8 +-
src/nautilus-file-management-properties.c | 4 -
src/nautilus-file-management-properties.ui | 67 ++-----------------
src/nautilus-list-model.c | 60 +++++++----------
src/nautilus-list-model.h | 9 +--
src/nautilus-list-view.c | 48 +++++---------
src/nautilus-properties-window.c | 8 +-
src/nautilus-view.c | 14 +----
src/nautilus-view.h | 13 ++---
src/nautilus-window.c | 10 +--
23 files changed, 196 insertions(+), 320 deletions(-)
---
diff --git a/libnautilus-private/nautilus-canvas-container.c b/libnautilus-private/nautilus-canvas-container.c
index 03e8890..be8b4d2 100644
--- a/libnautilus-private/nautilus-canvas-container.c
+++ b/libnautilus-private/nautilus-canvas-container.c
@@ -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
diff --git a/libnautilus-private/nautilus-canvas-container.h b/libnautilus-private/nautilus-canvas-container.h
index ff16a4e..3d2871f 100644
--- a/libnautilus-private/nautilus-canvas-container.h
+++ b/libnautilus-private/nautilus-canvas-container.h
@@ -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,
diff --git a/libnautilus-private/nautilus-canvas-item.c b/libnautilus-private/nautilus-canvas-item.c
index 88fce2d..88d4bae 100644
--- a/libnautilus-private/nautilus-canvas-item.c
+++ b/libnautilus-private/nautilus-canvas-item.c
@@ -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:
diff --git a/libnautilus-private/nautilus-directory-async.c b/libnautilus-private/nautilus-directory-async.c
index afc41b2..e4d9f0a 100644
--- a/libnautilus-private/nautilus-directory-async.c
+++ b/libnautilus-private/nautilus-directory-async.c
@@ -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;
diff --git a/libnautilus-private/nautilus-file-conflict-dialog.c
b/libnautilus-private/nautilus-file-conflict-dialog.c
index 7fcb2d6..4ff762c 100644
--- a/libnautilus-private/nautilus-file-conflict-dialog.c
+++ b/libnautilus-private/nautilus-file-conflict-dialog.c
@@ -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);
diff --git a/libnautilus-private/nautilus-file.c b/libnautilus-private/nautilus-file.c
index 5957dc6..d0b7c75 100644
--- a/libnautilus-private/nautilus-file.c
+++ b/libnautilus-private/nautilus-file.c
@@ -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 &&
diff --git a/libnautilus-private/nautilus-icon-info.c b/libnautilus-private/nautilus-icon-info.c
index c272803..0cafe63 100644
--- a/libnautilus-private/nautilus-icon-info.c
+++ b/libnautilus-private/nautilus-icon-info.c
@@ -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;
}
diff --git a/libnautilus-private/nautilus-icon-info.h b/libnautilus-private/nautilus-icon-info.h
index e8446ec..4b8cf2c 100644
--- a/libnautilus-private/nautilus-icon-info.h
+++ b/libnautilus-private/nautilus-icon-info.h
@@ -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);
diff --git a/libnautilus-private/org.gnome.nautilus.gschema.xml.in
b/libnautilus-private/org.gnome.nautilus.gschema.xml.in
index ba344a2..b57a9c6 100644
--- a/libnautilus-private/org.gnome.nautilus.gschema.xml.in
+++ b/libnautilus-private/org.gnome.nautilus.gschema.xml.in
@@ -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>
diff --git a/src/nautilus-bookmarks-window.c b/src/nautilus-bookmarks-window.c
index ad4393b..122aba4 100644
--- a/src/nautilus-bookmarks-window.c
+++ b/src/nautilus-bookmarks-window.c
@@ -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,
diff --git a/src/nautilus-canvas-view-container.c b/src/nautilus-canvas-view-container.c
index 09e3ce6..dc1ce19 100644
--- a/src/nautilus-canvas-view-container.c
+++ b/src/nautilus-canvas-view-container.c
@@ -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;
diff --git a/src/nautilus-canvas-view.c b/src/nautilus-canvas-view.c
index ae1d364..184a635 100644
--- a/src/nautilus-canvas-view.c
+++ b/src/nautilus-canvas-view.c
@@ -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;
diff --git a/src/nautilus-desktop-canvas-view.c b/src/nautilus-desktop-canvas-view.c
index c6971f5..946748a 100644
--- a/src/nautilus-desktop-canvas-view.c
+++ b/src/nautilus-desktop-canvas-view.c
@@ -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);
diff --git a/src/nautilus-empty-view.c b/src/nautilus-empty-view.c
index 7a13446..f72a615 100644
--- a/src/nautilus-empty-view.c
+++ b/src/nautilus-empty-view.c
@@ -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)
{
}
diff --git a/src/nautilus-file-management-properties.c b/src/nautilus-file-management-properties.c
index 998590c..a30aaae 100644
--- a/src/nautilus-file-management-properties.c
+++ b/src/nautilus-file-management-properties.c
@@ -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
};
diff --git a/src/nautilus-file-management-properties.ui b/src/nautilus-file-management-properties.ui
index 4c601bc..31fb39e 100644
--- a/src/nautilus-file-management-properties.ui
+++ b/src/nautilus-file-management-properties.ui
@@ -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>
- <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>
- </row>
- </data>
- </object>
- <object class="GtkListStore" id="model5">
- <columns>
- <!-- column-name gchararray -->
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
- <col id="0" translatable="yes">33%</col>
- </row>
- <row>
- <col id="0" translatable="yes">50%</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>
+ <col id="0" translatable="yes">Small</col>
</row>
<row>
- <col id="0" translatable="yes">200%</col>
+ <col id="0" translatable="yes">Standard</col>
</row>
<row>
- <col id="0" translatable="yes">400%</col>
+ <col id="0" translatable="yes">Large</col>
</row>
</data>
</object>
diff --git a/src/nautilus-list-model.c b/src/nautilus-list-model.c
index 7da5150..4f4abc3 100644
--- a/src/nautilus-list-model.c
+++ b/src/nautilus-list-model.c
@@ -144,13 +144,9 @@ nautilus_list_model_get_column_type (GtkTreeModel *tree_model, int index)
return NAUTILUS_TYPE_FILE;
case NAUTILUS_LIST_MODEL_SUBDIRECTORY_COLUMN:
return NAUTILUS_TYPE_DIRECTORY;
- case NAUTILUS_LIST_MODEL_SMALLEST_ICON_COLUMN:
- case NAUTILUS_LIST_MODEL_SMALLER_ICON_COLUMN:
case NAUTILUS_LIST_MODEL_SMALL_ICON_COLUMN:
case NAUTILUS_LIST_MODEL_STANDARD_ICON_COLUMN:
case NAUTILUS_LIST_MODEL_LARGE_ICON_COLUMN:
- case NAUTILUS_LIST_MODEL_LARGER_ICON_COLUMN:
- case NAUTILUS_LIST_MODEL_LARGEST_ICON_COLUMN:
return CAIRO_GOBJECT_TYPE_SURFACE;
case NAUTILUS_LIST_MODEL_FILE_NAME_IS_EDITABLE_COLUMN:
return G_TYPE_BOOLEAN;
@@ -251,6 +247,20 @@ nautilus_list_model_get_icon_scale (NautilusListModel *model)
return retval;
}
+guint
+nautilus_list_model_get_icon_size_for_zoom_level (NautilusListZoomLevel zoom_level)
+{
+ switch (zoom_level) {
+ case NAUTILUS_LIST_ZOOM_LEVEL_SMALL:
+ return NAUTILUS_LIST_ICON_SIZE_SMALL;
+ case NAUTILUS_LIST_ZOOM_LEVEL_STANDARD:
+ return NAUTILUS_LIST_ICON_SIZE_STANDARD;
+ case NAUTILUS_LIST_ZOOM_LEVEL_LARGE:
+ return NAUTILUS_LIST_ICON_SIZE_LARGE;
+ }
+ g_return_val_if_reached (NAUTILUS_LIST_ICON_SIZE_STANDARD);
+}
+
static void
nautilus_list_model_get_value (GtkTreeModel *tree_model, GtkTreeIter *iter, int column, GValue *value)
{
@@ -260,7 +270,7 @@ nautilus_list_model_get_value (GtkTreeModel *tree_model, GtkTreeIter *iter, int
char *str;
GdkPixbuf *icon, *rendered_icon;
int icon_size, icon_scale;
- NautilusZoomLevel zoom_level;
+ NautilusListZoomLevel zoom_level;
NautilusFileIconFlags flags;
cairo_surface_t *surface;
@@ -283,18 +293,14 @@ nautilus_list_model_get_value (GtkTreeModel *tree_model, GtkTreeIter *iter, int
g_value_set_object (value, file_entry->subdirectory);
break;
- case NAUTILUS_LIST_MODEL_SMALLEST_ICON_COLUMN:
- case NAUTILUS_LIST_MODEL_SMALLER_ICON_COLUMN:
case NAUTILUS_LIST_MODEL_SMALL_ICON_COLUMN:
case NAUTILUS_LIST_MODEL_STANDARD_ICON_COLUMN:
case NAUTILUS_LIST_MODEL_LARGE_ICON_COLUMN:
- case NAUTILUS_LIST_MODEL_LARGER_ICON_COLUMN:
- case NAUTILUS_LIST_MODEL_LARGEST_ICON_COLUMN:
g_value_init (value, CAIRO_GOBJECT_TYPE_SURFACE);
if (file != NULL) {
zoom_level = nautilus_list_model_get_zoom_level_from_column_id (column);
- icon_size = nautilus_get_icon_size_for_zoom_level (zoom_level);
+ icon_size = nautilus_list_model_get_icon_size_for_zoom_level (zoom_level);
icon_scale = nautilus_list_model_get_icon_scale (model);
flags = NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS |
@@ -1246,47 +1252,31 @@ nautilus_list_model_get_attribute_from_sort_column_id (NautilusListModel *model,
return attribute;
}
-NautilusZoomLevel
+NautilusListZoomLevel
nautilus_list_model_get_zoom_level_from_column_id (int column)
{
switch (column) {
- case NAUTILUS_LIST_MODEL_SMALLEST_ICON_COLUMN:
- return NAUTILUS_ZOOM_LEVEL_SMALLEST;
- case NAUTILUS_LIST_MODEL_SMALLER_ICON_COLUMN:
- return NAUTILUS_ZOOM_LEVEL_SMALLER;
case NAUTILUS_LIST_MODEL_SMALL_ICON_COLUMN:
- return NAUTILUS_ZOOM_LEVEL_SMALL;
+ return NAUTILUS_LIST_ZOOM_LEVEL_SMALL;
case NAUTILUS_LIST_MODEL_STANDARD_ICON_COLUMN:
- return NAUTILUS_ZOOM_LEVEL_STANDARD;
+ return NAUTILUS_LIST_ZOOM_LEVEL_STANDARD;
case NAUTILUS_LIST_MODEL_LARGE_ICON_COLUMN:
- return NAUTILUS_ZOOM_LEVEL_LARGE;
- case NAUTILUS_LIST_MODEL_LARGER_ICON_COLUMN:
- return NAUTILUS_ZOOM_LEVEL_LARGER;
- case NAUTILUS_LIST_MODEL_LARGEST_ICON_COLUMN:
- return NAUTILUS_ZOOM_LEVEL_LARGEST;
+ return NAUTILUS_LIST_ZOOM_LEVEL_LARGE;
}
- g_return_val_if_reached (NAUTILUS_ZOOM_LEVEL_STANDARD);
+ g_return_val_if_reached (NAUTILUS_LIST_ZOOM_LEVEL_STANDARD);
}
int
-nautilus_list_model_get_column_id_from_zoom_level (NautilusZoomLevel zoom_level)
+nautilus_list_model_get_column_id_from_zoom_level (NautilusListZoomLevel zoom_level)
{
switch (zoom_level) {
- case NAUTILUS_ZOOM_LEVEL_SMALLEST:
- return NAUTILUS_LIST_MODEL_SMALLEST_ICON_COLUMN;
- case NAUTILUS_ZOOM_LEVEL_SMALLER:
- return NAUTILUS_LIST_MODEL_SMALLER_ICON_COLUMN;
- case NAUTILUS_ZOOM_LEVEL_SMALL:
+ case NAUTILUS_LIST_ZOOM_LEVEL_SMALL:
return NAUTILUS_LIST_MODEL_SMALL_ICON_COLUMN;
- case NAUTILUS_ZOOM_LEVEL_STANDARD:
+ case NAUTILUS_LIST_ZOOM_LEVEL_STANDARD:
return NAUTILUS_LIST_MODEL_STANDARD_ICON_COLUMN;
- case NAUTILUS_ZOOM_LEVEL_LARGE:
+ case NAUTILUS_LIST_ZOOM_LEVEL_LARGE:
return NAUTILUS_LIST_MODEL_LARGE_ICON_COLUMN;
- case NAUTILUS_ZOOM_LEVEL_LARGER:
- return NAUTILUS_LIST_MODEL_LARGER_ICON_COLUMN;
- case NAUTILUS_ZOOM_LEVEL_LARGEST:
- return NAUTILUS_LIST_MODEL_LARGEST_ICON_COLUMN;
}
g_return_val_if_reached (NAUTILUS_LIST_MODEL_STANDARD_ICON_COLUMN);
diff --git a/src/nautilus-list-model.h b/src/nautilus-list-model.h
index 7169a7a..266c9bb 100644
--- a/src/nautilus-list-model.h
+++ b/src/nautilus-list-model.h
@@ -45,13 +45,9 @@
enum {
NAUTILUS_LIST_MODEL_FILE_COLUMN,
NAUTILUS_LIST_MODEL_SUBDIRECTORY_COLUMN,
- NAUTILUS_LIST_MODEL_SMALLEST_ICON_COLUMN,
- NAUTILUS_LIST_MODEL_SMALLER_ICON_COLUMN,
NAUTILUS_LIST_MODEL_SMALL_ICON_COLUMN,
NAUTILUS_LIST_MODEL_STANDARD_ICON_COLUMN,
NAUTILUS_LIST_MODEL_LARGE_ICON_COLUMN,
- NAUTILUS_LIST_MODEL_LARGER_ICON_COLUMN,
- NAUTILUS_LIST_MODEL_LARGEST_ICON_COLUMN,
NAUTILUS_LIST_MODEL_FILE_NAME_IS_EDITABLE_COLUMN,
NAUTILUS_LIST_MODEL_NUM_COLUMNS
};
@@ -102,8 +98,9 @@ GQuark nautilus_list_model_get_attribute_from_sort_column_id (NautilusListMode
void nautilus_list_model_sort_files (NautilusListModel *model,
GList **files);
-NautilusZoomLevel nautilus_list_model_get_zoom_level_from_column_id (int column);
-int nautilus_list_model_get_column_id_from_zoom_level (NautilusZoomLevel zoom_level);
+NautilusListZoomLevel nautilus_list_model_get_zoom_level_from_column_id (int column);
+int nautilus_list_model_get_column_id_from_zoom_level (NautilusListZoomLevel zoom_level);
+guint nautilus_list_model_get_icon_size_for_zoom_level (NautilusListZoomLevel zoom_level);
NautilusFile * nautilus_list_model_file_for_path (NautilusListModel *model, GtkTreePath *path);
gboolean nautilus_list_model_load_subdirectory (NautilusListModel *model, GtkTreePath *path,
NautilusDirectory **directory);
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
index ba09d02..9182588 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -71,7 +71,7 @@ struct NautilusListViewDetails {
GList *cells;
GtkCellEditable *editable_widget;
- NautilusZoomLevel zoom_level;
+ NautilusListZoomLevel zoom_level;
NautilusTreeViewDragDest *drag_dest;
@@ -129,8 +129,8 @@ static GtkTargetList * source_target_list = NULL;
static GList *nautilus_list_view_get_selection (NautilusView *view);
static GList *nautilus_list_view_get_selection_for_file_transfer (NautilusView *view);
-static void nautilus_list_view_set_zoom_level (NautilusListView *view,
- NautilusZoomLevel new_level,
+static void nautilus_list_view_set_zoom_level (NautilusListView *view,
+ NautilusListZoomLevel new_level,
gboolean always_set_level);
static void nautilus_list_view_scroll_to_file (NautilusListView *view,
NautilusFile *file);
@@ -1887,7 +1887,7 @@ set_up_pixbuf_size (NautilusListView *view)
int icon_size;
/* Make all rows the same size. */
- icon_size = nautilus_get_icon_size_for_zoom_level (view->details->zoom_level);
+ icon_size = nautilus_list_model_get_icon_size_for_zoom_level (view->details->zoom_level);
gtk_cell_renderer_set_fixed_size (GTK_CELL_RENDERER (view->details->pixbuf_cell),
-1, icon_size);
@@ -2310,16 +2310,16 @@ set_sort_order_from_metadata_and_preferences (NautilusListView *list_view)
sort_reversed ? GTK_SORT_DESCENDING : GTK_SORT_ASCENDING);
}
-static NautilusZoomLevel
+static NautilusListZoomLevel
get_default_zoom_level (void) {
- NautilusZoomLevel default_zoom_level;
+ NautilusListZoomLevel default_zoom_level;
default_zoom_level = g_settings_get_enum (nautilus_list_view_preferences,
NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_ZOOM_LEVEL);
- if (default_zoom_level < NAUTILUS_ZOOM_LEVEL_SMALLEST
- || NAUTILUS_ZOOM_LEVEL_LARGEST < default_zoom_level) {
- default_zoom_level = NAUTILUS_ZOOM_LEVEL_SMALL;
+ if (default_zoom_level < NAUTILUS_LIST_ZOOM_LEVEL_SMALL
+ || default_zoom_level > NAUTILUS_LIST_ZOOM_LEVEL_LARGE) {
+ default_zoom_level = NAUTILUS_LIST_ZOOM_LEVEL_STANDARD;
}
return default_zoom_level;
@@ -3130,14 +3130,14 @@ nautilus_list_view_reset_to_defaults (NautilusView *view)
static void
nautilus_list_view_set_zoom_level (NautilusListView *view,
- NautilusZoomLevel new_level,
+ NautilusListZoomLevel new_level,
gboolean always_emit)
{
int column;
g_return_if_fail (NAUTILUS_IS_LIST_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_LIST_ZOOM_LEVEL_SMALL &&
+ new_level <= NAUTILUS_LIST_ZOOM_LEVEL_LARGE);
if (view->details->zoom_level == new_level) {
if (always_emit) {
@@ -3172,27 +3172,14 @@ nautilus_list_view_bump_zoom_level (NautilusView *view, int zoom_increment)
list_view = NAUTILUS_LIST_VIEW (view);
new_level = list_view->details->zoom_level + zoom_increment;
- if (new_level >= NAUTILUS_ZOOM_LEVEL_SMALLEST &&
- new_level <= NAUTILUS_ZOOM_LEVEL_LARGEST) {
+ if (new_level >= NAUTILUS_LIST_ZOOM_LEVEL_SMALL &&
+ new_level <= NAUTILUS_LIST_ZOOM_LEVEL_LARGE) {
nautilus_list_view_set_zoom_level (list_view, new_level, FALSE);
}
}
-
-static NautilusZoomLevel
-nautilus_list_view_get_zoom_level (NautilusView *view)
-{
- NautilusListView *list_view;
-
- g_return_val_if_fail (NAUTILUS_IS_LIST_VIEW (view), NAUTILUS_ZOOM_LEVEL_STANDARD);
-
- list_view = NAUTILUS_LIST_VIEW (view);
-
- return list_view->details->zoom_level;
-}
-
static void
nautilus_list_view_zoom_to_level (NautilusView *view,
- NautilusZoomLevel zoom_level)
+ gint zoom_level)
{
NautilusListView *list_view;
@@ -3220,7 +3207,7 @@ nautilus_list_view_can_zoom_in (NautilusView *view)
{
g_return_val_if_fail (NAUTILUS_IS_LIST_VIEW (view), FALSE);
- return NAUTILUS_LIST_VIEW (view)->details->zoom_level < NAUTILUS_ZOOM_LEVEL_LARGEST;
+ return NAUTILUS_LIST_VIEW (view)->details->zoom_level < NAUTILUS_LIST_ZOOM_LEVEL_LARGE;
}
static gboolean
@@ -3228,7 +3215,7 @@ nautilus_list_view_can_zoom_out (NautilusView *view)
{
g_return_val_if_fail (NAUTILUS_IS_LIST_VIEW (view), FALSE);
- return NAUTILUS_LIST_VIEW (view)->details->zoom_level > NAUTILUS_ZOOM_LEVEL_SMALLEST;
+ return NAUTILUS_LIST_VIEW (view)->details->zoom_level > NAUTILUS_LIST_ZOOM_LEVEL_SMALL;
}
static void
@@ -3621,7 +3608,6 @@ nautilus_list_view_class_init (NautilusListViewClass *class)
nautilus_view_class->compare_files = nautilus_list_view_compare_files;
nautilus_view_class->sort_directories_first_changed =
nautilus_list_view_sort_directories_first_changed;
nautilus_view_class->start_renaming_file = nautilus_list_view_start_renaming_file;
- nautilus_view_class->get_zoom_level = nautilus_list_view_get_zoom_level;
nautilus_view_class->zoom_to_level = nautilus_list_view_zoom_to_level;
nautilus_view_class->end_file_changes = nautilus_list_view_end_file_changes;
nautilus_view_class->using_manual_layout = nautilus_list_view_using_manual_layout;
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index 1412bcf..4ad4d8b 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -366,11 +366,11 @@ get_image_for_properties_window (NautilusPropertiesWindow *window,
file = NAUTILUS_FILE (l->data);
if (!icon) {
- icon = nautilus_file_get_icon (file, NAUTILUS_ICON_SIZE_STANDARD, icon_scale,
+ icon = nautilus_file_get_icon (file, NAUTILUS_CANVAS_ICON_SIZE_SMALL, icon_scale,
NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS |
NAUTILUS_FILE_ICON_FLAGS_IGNORE_VISITING);
} else {
- new_icon = nautilus_file_get_icon (file, NAUTILUS_ICON_SIZE_STANDARD, icon_scale,
+ new_icon = nautilus_file_get_icon (file, NAUTILUS_CANVAS_ICON_SIZE_SMALL, icon_scale,
NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS |
NAUTILUS_FILE_ICON_FLAGS_IGNORE_VISITING);
if (!new_icon || new_icon != icon) {
@@ -385,7 +385,7 @@ get_image_for_properties_window (NautilusPropertiesWindow *window,
if (!icon) {
icon = nautilus_icon_info_lookup_from_name ("text-x-generic",
- NAUTILUS_ICON_SIZE_STANDARD,
+ NAUTILUS_CANVAS_ICON_SIZE_STANDARD,
icon_scale);
}
@@ -394,7 +394,7 @@ get_image_for_properties_window (NautilusPropertiesWindow *window,
}
if (icon_pixbuf != NULL) {
- *icon_pixbuf = nautilus_icon_info_get_pixbuf_at_size (icon, NAUTILUS_ICON_SIZE_STANDARD);
+ *icon_pixbuf = nautilus_icon_info_get_pixbuf_at_size (icon, NAUTILUS_CANVAS_ICON_SIZE_SMALL);
}
g_object_unref (icon);
diff --git a/src/nautilus-view.c b/src/nautilus-view.c
index b869535..9bc22b0 100644
--- a/src/nautilus-view.c
+++ b/src/nautilus-view.c
@@ -584,7 +584,7 @@ nautilus_view_bump_zoom_level (NautilusView *view,
**/
void
nautilus_view_zoom_to_level (NautilusView *view,
- NautilusZoomLevel zoom_level)
+ gint zoom_level)
{
g_return_if_fail (NAUTILUS_IS_VIEW (view));
@@ -595,18 +595,6 @@ nautilus_view_zoom_to_level (NautilusView *view,
NAUTILUS_VIEW_CLASS (G_OBJECT_GET_CLASS (view))->zoom_to_level (view, zoom_level);
}
-NautilusZoomLevel
-nautilus_view_get_zoom_level (NautilusView *view)
-{
- g_return_val_if_fail (NAUTILUS_IS_VIEW (view), NAUTILUS_ZOOM_LEVEL_STANDARD);
-
- if (!nautilus_view_supports_zooming (view)) {
- return NAUTILUS_ZOOM_LEVEL_STANDARD;
- }
-
- return NAUTILUS_VIEW_CLASS (G_OBJECT_GET_CLASS (view))->get_zoom_level (view);
-}
-
/**
* nautilus_view_can_zoom_in:
*
diff --git a/src/nautilus-view.h b/src/nautilus-view.h
index 98f3d57..d10b493 100644
--- a/src/nautilus-view.h
+++ b/src/nautilus-view.h
@@ -189,12 +189,10 @@ struct NautilusViewClass {
void (* bump_zoom_level) (NautilusView *view,
int zoom_increment);
- /* zoom_to_level is a function pointer that subclasses must override
- * to set the zoom level of an object to the specified level. */
- void (* zoom_to_level) (NautilusView *view,
- NautilusZoomLevel level);
-
- NautilusZoomLevel (* get_zoom_level) (NautilusView *view);
+ /* zoom_to_level is a function pointer that subclasses must override
+ * to set the zoom level of an object to the specified level. */
+ void (* zoom_to_level) (NautilusView *view,
+ gint level);
/* restore_default_zoom_level is a function pointer that subclasses must override
* to restore the zoom level of an object to a default setting. */
@@ -398,11 +396,10 @@ gboolean nautilus_view_supports_zooming (NautilusView *v
void nautilus_view_bump_zoom_level (NautilusView *view,
int zoom_increment);
void nautilus_view_zoom_to_level (NautilusView *view,
- NautilusZoomLevel level);
+ gint level);
void nautilus_view_restore_default_zoom_level (NautilusView *view);
gboolean nautilus_view_can_zoom_in (NautilusView *view);
gboolean nautilus_view_can_zoom_out (NautilusView *view);
-NautilusZoomLevel nautilus_view_get_zoom_level (NautilusView *view);
void nautilus_view_pop_up_location_context_menu (NautilusView *view,
GdkEventButton *event,
const char *location);
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index acfb9a2..0ffeff7 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -1884,19 +1884,15 @@ nautilus_window_sync_zoom_widgets (NautilusWindow *window)
GtkAction *action;
gboolean supports_zooming;
gboolean can_zoom, can_zoom_in, can_zoom_out;
- NautilusZoomLevel zoom_level;
slot = nautilus_window_get_active_slot (window);
view = nautilus_window_slot_get_view (slot);
if (view != NULL) {
supports_zooming = nautilus_view_supports_zooming (view);
- zoom_level = nautilus_view_get_zoom_level (view);
- can_zoom = supports_zooming &&
- zoom_level >= NAUTILUS_ZOOM_LEVEL_SMALLEST &&
- zoom_level <= NAUTILUS_ZOOM_LEVEL_LARGEST;
- can_zoom_in = can_zoom && nautilus_view_can_zoom_in (view);
- can_zoom_out = can_zoom && nautilus_view_can_zoom_out (view);
+ can_zoom_in = supports_zooming && nautilus_view_can_zoom_in (view);
+ can_zoom_out = supports_zooming && nautilus_view_can_zoom_out (view);
+ can_zoom = can_zoom_out || can_zoom_in;
} else {
supports_zooming = FALSE;
can_zoom = FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]