[nautilus/wip/csoriano/waiting-ui-review: 4/9] general: add another zoom level
- From: Carlos Soriano Sánchez <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/csoriano/waiting-ui-review: 4/9] general: add another zoom level
- Date: Thu, 11 Feb 2016 12:29:50 +0000 (UTC)
commit 4a99c692c30e8bde27d7ba614405583df44c1357
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 | 2 ++
libnautilus-private/nautilus-canvas-container.c | 8 +++++---
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, 41 insertions(+), 19 deletions(-)
---
diff --git a/data/org.gnome.nautilus.gschema.xml b/data/org.gnome.nautilus.gschema.xml
index 463200c..24961bb 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">
diff --git a/libnautilus-private/nautilus-canvas-container.c b/libnautilus-private/nautilus-canvas-container.c
index e3d0bd7..d346981 100644
--- a/libnautilus-private/nautilus-canvas-container.c
+++ b/libnautilus-private/nautilus-canvas-container.c
@@ -98,7 +98,7 @@
* 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 STANDARD_ICON_GRID_WIDTH 142
/* Desktop layout mode defines */
#define DESKTOP_PAD_HORIZONTAL 10
@@ -355,6 +355,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);
}
@@ -6255,8 +6257,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 318eb53..137cc40 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 (139 - 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..557588f 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 94
+#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 1d498e0..8410368 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 3fde3f9..833b0e7 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 d8d57e4..b0b9fce 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]