[nautilus] general: add another zoom level
- From: Carlos Soriano Sánchez <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] general: add another zoom level
- Date: Wed, 24 Feb 2016 10:22:01 +0000 (UTC)
commit fd21c947cce5f9140aee4ae4abb9ac6914bdc0d2
Author: Carlos Soriano <csoriano gnome org>
Date: Wed Feb 10 09:56:17 2016 +0100
general: add another zoom level
In icon view, add a smaller zoom level to be able for dense views,
and increase the default padding to allow the labels enough space.
Now levels are 48px, 64px, 96px and 128px for icon view, instead of
only 64px, 96px and 128px, but with the increased padding the 64px and
48px are useful.
List view also gains a bigger level, and they become 16px, 32px, 48px,
64px.
Also, adjust the label max width to be larger, but inside the icon
itself. This fixes the label not taking advantage of all the width the
icon provides, and also a few cases where icons were misaligned.
data/org.gnome.nautilus.gschema.xml | 4 ++-
libnautilus-private/nautilus-canvas-container.c | 28 +++++++++++++++++++---
libnautilus-private/nautilus-canvas-item.c | 2 +-
libnautilus-private/nautilus-directory-async.c | 2 +-
libnautilus-private/nautilus-icon-info.h | 14 +++++++----
src/nautilus-canvas-view-container.c | 1 +
src/nautilus-canvas-view.c | 8 +++---
src/nautilus-list-model.c | 8 ++++++
src/nautilus-list-model.h | 1 +
src/nautilus-list-view.c | 11 +++++---
src/resources/ui/nautilus-toolbar-view-menu.ui | 3 +-
11 files changed, 61 insertions(+), 21 deletions(-)
---
diff --git a/data/org.gnome.nautilus.gschema.xml b/data/org.gnome.nautilus.gschema.xml
index 9c4ec10..65bac39 100644
--- a/data/org.gnome.nautilus.gschema.xml
+++ b/data/org.gnome.nautilus.gschema.xml
@@ -36,12 +36,14 @@
<value value="0" nick="small"/>
<value value="1" nick="standard"/>
<value value="2" nick="large"/>
+ <value value="3" nick="larger"/>
</enum>
<enum id="org.gnome.nautilus.ListZoomLevel">
<value value="0" nick="small"/>
<value value="1" nick="standard"/>
<value value="2" nick="large"/>
+ <value value="3" nick="larger"/>
</enum>
<enum id="org.gnome.nautilus.TabPosition">
@@ -211,7 +213,7 @@
<description>A list of captions below an icon in the icon view and the desktop. The actual number of
captions shown depends on the zoom level. Some possible values are: "size", "type", "date_modified", "owner",
"group", "permissions", and "mime_type".</description>
</key>
<key name="default-zoom-level" enum="org.gnome.nautilus.CanvasZoomLevel">
- <default>'standard'</default>
+ <default>'large'</default>
<summary>Default icon zoom level</summary>
<description>Default zoom level used by the icon view.</description>
</key>
diff --git a/libnautilus-private/nautilus-canvas-container.c b/libnautilus-private/nautilus-canvas-container.c
index 2947730..b164522 100644
--- a/libnautilus-private/nautilus-canvas-container.c
+++ b/libnautilus-private/nautilus-canvas-container.c
@@ -98,7 +98,10 @@
* where a 76px canvas item would only take one.
* Canvas items are then centered in the extra available space.
*/
-#define STANDARD_ICON_GRID_WIDTH 80
+#define SMALL_ICON_GRID_WIDTH 58
+#define STANDARD_ICON_GRID_WIDTH 56
+#define LARGE_ICON_GRID_WIDTH 56
+#define LARGER_ICON_GRID_WIDTH 64
/* Desktop layout mode defines */
#define DESKTOP_PAD_HORIZONTAL 10
@@ -344,6 +347,21 @@ icon_set_position (NautilusCanvasIcon *icon,
icon->y = y;
}
+static guint
+nautilus_canvas_container_get_grid_size_for_zoom_level (NautilusCanvasZoomLevel zoom_level)
+{
+ switch (zoom_level) {
+ case NAUTILUS_CANVAS_ZOOM_LEVEL_SMALL:
+ return SMALL_ICON_GRID_WIDTH;
+ case NAUTILUS_CANVAS_ZOOM_LEVEL_STANDARD:
+ return STANDARD_ICON_GRID_WIDTH;
+ case NAUTILUS_CANVAS_ZOOM_LEVEL_LARGE:
+ return LARGE_ICON_GRID_WIDTH;
+ case NAUTILUS_CANVAS_ZOOM_LEVEL_LARGER:
+ return LARGER_ICON_GRID_WIDTH;
+ }
+ g_return_val_if_reached (STANDARD_ICON_GRID_WIDTH);
+}
guint
nautilus_canvas_container_get_icon_size_for_zoom_level (NautilusCanvasZoomLevel zoom_level)
@@ -355,6 +373,8 @@ nautilus_canvas_container_get_icon_size_for_zoom_level (NautilusCanvasZoomLevel
return NAUTILUS_CANVAS_ICON_SIZE_STANDARD;
case NAUTILUS_CANVAS_ZOOM_LEVEL_LARGE:
return NAUTILUS_CANVAS_ICON_SIZE_LARGE;
+ case NAUTILUS_CANVAS_ZOOM_LEVEL_LARGER:
+ return NAUTILUS_CANVAS_ICON_SIZE_LARGER;
}
g_return_val_if_reached (NAUTILUS_CANVAS_ICON_SIZE_STANDARD);
}
@@ -1252,7 +1272,7 @@ lay_down_icons_horizontal (NautilusCanvasContainer *container,
/* Lay out icons a line at a time. */
canvas_width = CANVAS_WIDTH(container, allocation);
- grid_width = STANDARD_ICON_GRID_WIDTH;
+ grid_width = nautilus_canvas_container_get_grid_size_for_zoom_level (container->details->zoom_level);
icon_size = nautilus_canvas_container_get_icon_size_for_zoom_level (container->details->zoom_level);
line_width = 0;
@@ -6244,8 +6264,8 @@ nautilus_canvas_container_set_zoom_level (NautilusCanvasContainer *container, in
pinned_level = new_level;
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;
+ } else if (pinned_level > NAUTILUS_CANVAS_ZOOM_LEVEL_LARGER) {
+ pinned_level = NAUTILUS_CANVAS_ZOOM_LEVEL_LARGER;
}
if (pinned_level == details->zoom_level) {
diff --git a/libnautilus-private/nautilus-canvas-item.c b/libnautilus-private/nautilus-canvas-item.c
index 44991e8..4d2f0fb 100644
--- a/libnautilus-private/nautilus-canvas-item.c
+++ b/libnautilus-private/nautilus-canvas-item.c
@@ -55,7 +55,7 @@
/* Width of the label with the standard icon size NAUTILUS_CANVAS_ICON_SIZE_STANDARD.
* It will adapt to other sizes keeping the same space.*/
-#define MAX_TEXT_WIDTH_STANDARD (134 - 2 * TEXT_BACK_PADDING_X)
+#define MAX_TEXT_WIDTH_STANDARD (107 - 2 * TEXT_BACK_PADDING_X)
/* 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 fd70c7b..358dfb4 100644
--- a/libnautilus-private/nautilus-directory-async.c
+++ b/libnautilus-private/nautilus-directory-async.c
@@ -3561,7 +3561,7 @@ thumbnail_loader_size_prepared (GdkPixbufLoader *loader,
aspect_ratio = ((double) width) / height;
/* cf. nautilus_file_get_icon() */
- max_thumbnail_size = NAUTILUS_CANVAS_ICON_SIZE_LARGE * cached_thumbnail_size /
NAUTILUS_CANVAS_ICON_SIZE_SMALL;
+ max_thumbnail_size = NAUTILUS_CANVAS_ICON_SIZE_LARGER * 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-icon-info.h b/libnautilus-private/nautilus-icon-info.h
index 437d352..03998d4 100644
--- a/libnautilus-private/nautilus-icon-info.h
+++ b/libnautilus-private/nautilus-icon-info.h
@@ -14,16 +14,18 @@ typedef enum {
NAUTILUS_CANVAS_ZOOM_LEVEL_SMALL,
NAUTILUS_CANVAS_ZOOM_LEVEL_STANDARD,
NAUTILUS_CANVAS_ZOOM_LEVEL_LARGE,
+ NAUTILUS_CANVAS_ZOOM_LEVEL_LARGER,
} NautilusCanvasZoomLevel;
typedef enum {
NAUTILUS_LIST_ZOOM_LEVEL_SMALL,
NAUTILUS_LIST_ZOOM_LEVEL_STANDARD,
NAUTILUS_LIST_ZOOM_LEVEL_LARGE,
+ NAUTILUS_LIST_ZOOM_LEVEL_LARGER,
} 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)
+#define NAUTILUS_LIST_ZOOM_LEVEL_N_ENTRIES (NAUTILUS_LIST_ZOOM_LEVEL_LARGER + 1)
+#define NAUTILUS_CANVAS_ZOOM_LEVEL_N_ENTRIES (NAUTILUS_CANVAS_ZOOM_LEVEL_LARGER + 1)
/* Nominal icon sizes for each Nautilus zoom level.
* This scheme assumes that icons are designed to
@@ -34,10 +36,12 @@ typedef enum {
#define NAUTILUS_LIST_ICON_SIZE_SMALL 16
#define NAUTILUS_LIST_ICON_SIZE_STANDARD 32
#define NAUTILUS_LIST_ICON_SIZE_LARGE 48
+#define NAUTILUS_LIST_ICON_SIZE_LARGER 64
-#define NAUTILUS_CANVAS_ICON_SIZE_SMALL 64
-#define NAUTILUS_CANVAS_ICON_SIZE_STANDARD 96
-#define NAUTILUS_CANVAS_ICON_SIZE_LARGE 128
+#define NAUTILUS_CANVAS_ICON_SIZE_SMALL 48
+#define NAUTILUS_CANVAS_ICON_SIZE_STANDARD 64
+#define NAUTILUS_CANVAS_ICON_SIZE_LARGE 96
+#define NAUTILUS_CANVAS_ICON_SIZE_LARGER 128
/* Maximum size of an icon that the icon factory will ever produce */
#define NAUTILUS_ICON_MAXIMUM_SIZE 320
diff --git a/src/nautilus-canvas-view-container.c b/src/nautilus-canvas-view-container.c
index e9779bb..55b4980 100644
--- a/src/nautilus-canvas-view-container.c
+++ b/src/nautilus-canvas-view-container.c
@@ -203,6 +203,7 @@ nautilus_canvas_view_container_get_icon_text_attribute_names (NautilusCanvasCont
1, /* NAUTILUS_ZOOM_LEVEL_SMALL */
2, /* NAUTILUS_ZOOM_LEVEL_STANDARD */
3, /* NAUTILUS_ZOOM_LEVEL_LARGE */
+ 3, /* NAUTILUS_ZOOM_LEVEL_LARGER */
};
piece_count = pieces_by_level[nautilus_canvas_container_get_zoom_level (container)];
diff --git a/src/nautilus-canvas-view.c b/src/nautilus-canvas-view.c
index a5de12a..da33aa8 100644
--- a/src/nautilus-canvas-view.c
+++ b/src/nautilus-canvas-view.c
@@ -690,7 +690,7 @@ get_default_zoom_level (NautilusCanvasView *canvas_view)
default_zoom_level = g_settings_get_enum (nautilus_icon_view_preferences,
NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL);
- return CLAMP (default_zoom_level, NAUTILUS_CANVAS_ZOOM_LEVEL_SMALL, NAUTILUS_CANVAS_ZOOM_LEVEL_LARGE);
+ return CLAMP (default_zoom_level, NAUTILUS_CANVAS_ZOOM_LEVEL_SMALL,
NAUTILUS_CANVAS_ZOOM_LEVEL_LARGER);
}
static void
@@ -794,7 +794,7 @@ nautilus_canvas_view_zoom_to_level (NautilusFilesView *view,
g_return_if_fail (NAUTILUS_IS_CANVAS_VIEW (view));
g_return_if_fail (new_level >= NAUTILUS_CANVAS_ZOOM_LEVEL_SMALL &&
- new_level <= NAUTILUS_CANVAS_ZOOM_LEVEL_LARGE);
+ new_level <= NAUTILUS_CANVAS_ZOOM_LEVEL_LARGER);
canvas_view = NAUTILUS_CANVAS_VIEW (view);
canvas_container = get_canvas_container (canvas_view);
@@ -821,7 +821,7 @@ nautilus_canvas_view_bump_zoom_level (NautilusFilesView *view, int zoom_incremen
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) {
+ new_level <= NAUTILUS_CANVAS_ZOOM_LEVEL_LARGER) {
nautilus_canvas_view_zoom_to_level (view, new_level);
}
}
@@ -844,7 +844,7 @@ nautilus_canvas_view_can_zoom_in (NautilusFilesView *view)
g_return_val_if_fail (NAUTILUS_IS_CANVAS_VIEW (view), FALSE);
return nautilus_canvas_view_get_zoom_level (view)
- < NAUTILUS_CANVAS_ZOOM_LEVEL_LARGE;
+ < NAUTILUS_CANVAS_ZOOM_LEVEL_LARGER;
}
static gboolean
diff --git a/src/nautilus-list-model.c b/src/nautilus-list-model.c
index c7eb2c1..14656d8 100644
--- a/src/nautilus-list-model.c
+++ b/src/nautilus-list-model.c
@@ -147,6 +147,7 @@ nautilus_list_model_get_column_type (GtkTreeModel *tree_model, int index)
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:
return CAIRO_GOBJECT_TYPE_SURFACE;
case NAUTILUS_LIST_MODEL_FILE_NAME_IS_EDITABLE_COLUMN:
return G_TYPE_BOOLEAN;
@@ -257,6 +258,8 @@ nautilus_list_model_get_icon_size_for_zoom_level (NautilusListZoomLevel zoom_lev
return NAUTILUS_LIST_ICON_SIZE_STANDARD;
case NAUTILUS_LIST_ZOOM_LEVEL_LARGE:
return NAUTILUS_LIST_ICON_SIZE_LARGE;
+ case NAUTILUS_LIST_ZOOM_LEVEL_LARGER:
+ return NAUTILUS_LIST_ICON_SIZE_LARGER;
}
g_return_val_if_reached (NAUTILUS_LIST_ICON_SIZE_STANDARD);
}
@@ -296,6 +299,7 @@ nautilus_list_model_get_value (GtkTreeModel *tree_model, GtkTreeIter *iter, int
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:
g_value_init (value, CAIRO_GOBJECT_TYPE_SURFACE);
if (file != NULL) {
@@ -1256,6 +1260,8 @@ nautilus_list_model_get_zoom_level_from_column_id (int column)
return NAUTILUS_LIST_ZOOM_LEVEL_STANDARD;
case NAUTILUS_LIST_MODEL_LARGE_ICON_COLUMN:
return NAUTILUS_LIST_ZOOM_LEVEL_LARGE;
+ case NAUTILUS_LIST_MODEL_LARGER_ICON_COLUMN:
+ return NAUTILUS_LIST_ZOOM_LEVEL_LARGER;
}
g_return_val_if_reached (NAUTILUS_LIST_ZOOM_LEVEL_STANDARD);
@@ -1271,6 +1277,8 @@ nautilus_list_model_get_column_id_from_zoom_level (NautilusListZoomLevel zoom_le
return NAUTILUS_LIST_MODEL_STANDARD_ICON_COLUMN;
case NAUTILUS_LIST_ZOOM_LEVEL_LARGE:
return NAUTILUS_LIST_MODEL_LARGE_ICON_COLUMN;
+ case NAUTILUS_LIST_ZOOM_LEVEL_LARGER:
+ return NAUTILUS_LIST_MODEL_LARGER_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 1e2a9b3..0a1b4d6 100644
--- a/src/nautilus-list-model.h
+++ b/src/nautilus-list-model.h
@@ -48,6 +48,7 @@ enum {
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_FILE_NAME_IS_EDITABLE_COLUMN,
NAUTILUS_LIST_MODEL_NUM_COLUMNS
};
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
index 9de03be..b6af6ed 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -1535,6 +1535,7 @@ trash_orig_path_cell_data_func (GtkTreeViewColumn *column,
#define SMALL_ZOOM_ICON_PADDING 0
#define STANDARD_ZOOM_ICON_PADDING 6
#define LARGE_ZOOM_ICON_PADDING 6
+#define LARGER_ZOOM_ICON_PADDING 6
static gint
nautilus_list_view_get_icon_padding_for_zoom_level (NautilusListZoomLevel zoom_level)
@@ -1546,6 +1547,8 @@ nautilus_list_view_get_icon_padding_for_zoom_level (NautilusListZoomLevel zoom_l
return STANDARD_ZOOM_ICON_PADDING;
case NAUTILUS_LIST_ZOOM_LEVEL_LARGE:
return LARGE_ZOOM_ICON_PADDING;
+ case NAUTILUS_LIST_ZOOM_LEVEL_LARGER:
+ return LARGER_ZOOM_ICON_PADDING;
default:
g_assert_not_reached ();
}
@@ -2028,7 +2031,7 @@ get_default_zoom_level (void) {
NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_ZOOM_LEVEL);
if (default_zoom_level < NAUTILUS_LIST_ZOOM_LEVEL_SMALL
- || default_zoom_level > NAUTILUS_LIST_ZOOM_LEVEL_LARGE) {
+ || default_zoom_level > NAUTILUS_LIST_ZOOM_LEVEL_LARGER) {
default_zoom_level = NAUTILUS_LIST_ZOOM_LEVEL_STANDARD;
}
@@ -2723,7 +2726,7 @@ nautilus_list_view_set_zoom_level (NautilusListView *view,
g_return_if_fail (NAUTILUS_IS_LIST_VIEW (view));
g_return_if_fail (new_level >= NAUTILUS_LIST_ZOOM_LEVEL_SMALL &&
- new_level <= NAUTILUS_LIST_ZOOM_LEVEL_LARGE);
+ new_level <= NAUTILUS_LIST_ZOOM_LEVEL_LARGER);
if (view->details->zoom_level == new_level) {
return;
@@ -2752,7 +2755,7 @@ nautilus_list_view_bump_zoom_level (NautilusFilesView *view, int zoom_increment)
new_level = list_view->details->zoom_level + zoom_increment;
if (new_level >= NAUTILUS_LIST_ZOOM_LEVEL_SMALL &&
- new_level <= NAUTILUS_LIST_ZOOM_LEVEL_LARGE) {
+ new_level <= NAUTILUS_LIST_ZOOM_LEVEL_LARGER) {
nautilus_list_view_zoom_to_level (view, new_level);
}
}
@@ -2770,7 +2773,7 @@ nautilus_list_view_can_zoom_in (NautilusFilesView *view)
{
g_return_val_if_fail (NAUTILUS_IS_LIST_VIEW (view), FALSE);
- return NAUTILUS_LIST_VIEW (view)->details->zoom_level < NAUTILUS_LIST_ZOOM_LEVEL_LARGE;
+ return NAUTILUS_LIST_VIEW (view)->details->zoom_level < NAUTILUS_LIST_ZOOM_LEVEL_LARGER;
}
static gboolean
diff --git a/src/resources/ui/nautilus-toolbar-view-menu.ui b/src/resources/ui/nautilus-toolbar-view-menu.ui
index fe863be..dfc2197 100644
--- a/src/resources/ui/nautilus-toolbar-view-menu.ui
+++ b/src/resources/ui/nautilus-toolbar-view-menu.ui
@@ -63,6 +63,7 @@
<mark value="0" position="bottom"/>
<mark value="1" position="bottom"/>
<mark value="2" position="bottom"/>
+ <mark value="3" position="bottom"/>
</marks>
</object>
<packing>
@@ -218,7 +219,7 @@
</object>
<object class="GtkAdjustment" id="zoom_adjustment">
<property name="lower">0</property>
- <property name="upper">2</property>
+ <property name="upper">3</property>
<property name="step_increment">1</property>
<property name="page_increment">1</property>
<property name="value">1</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]