Commit b19cc767 authored by Christian Neumair's avatar Christian Neumair Committed by Christian Neumair

Added compact view.

2008-03-29  Christian Neumair  <cneumair@gnome.org>

	* libnautilus-private/apps_nautilus_preferences.schemas.in:
	* libnautilus-private/nautilus-global-preferences.c
	(nautilus_global_preferences_get_default_folder_viewer_preference_a
	s_iid):
	* libnautilus-private/nautilus-global-preferences.h:
	* libnautilus-private/nautilus-icon-canvas-item.c
	(create_label_layout),
	(nautilus_icon_canvas_item_get_max_text_width):
	* libnautilus-private/nautilus-icon-container.c
	(lay_down_one_column), (get_max_icon_dimensions),
	(lay_down_icons_vertical), (lay_down_icons_vertical_desktop),
	(lay_down_icons), (size_allocate),
	(nautilus_icon_container_update_icon),
	(nautilus_icon_container_set_layout_mode),
	(nautilus_icon_container_start_renaming_selected_item),
	(nautilus_icon_container_set_forced_icon_size),
	(nautilus_icon_container_set_all_columns_same_width):
	* libnautilus-private/nautilus-icon-container.h:
	* libnautilus-private/nautilus-icon-private.h:
	* libnautilus-private/nautilus-metadata.h:
	* src/file-manager/fm-icon-container.c
	(fm_icon_container_get_icon_images),
	(fm_icon_container_get_icon_text):
	* src/file-manager/fm-icon-view.c
	(get_stored_icon_position_callback),
	(fm_icon_view_supports_manual_layout),
	(fm_icon_view_supports_tighter_layout), (update_layout_menus),
	(fm_icon_view_real_set_directory_sort_reversed),
	(fm_icon_view_get_directory_auto_layout),
	(fm_icon_view_real_get_directory_auto_layout),
	(fm_icon_view_set_directory_auto_layout),
	(fm_icon_view_real_set_directory_auto_layout),
	(fm_icon_view_real_set_directory_tighter_layout),
	(real_supports_manual_layout), (get_default_zoom_level),
	(set_labels_beside_icons), (set_columns_same_width),
	(fm_icon_view_begin_loading), (fm_icon_view_set_zoom_level),
	(fm_icon_view_zoom_to_level),
	(fm_icon_view_restore_default_zoom_level),
	(default_zoom_level_changed_callback),
	(all_columns_same_width_changed_callback),
	(fm_icon_view_set_property), (fm_icon_view_class_init),
	(fm_icon_view_get_id), (fm_icon_view_init), (fm_icon_view_create),
	(fm_compact_view_create), (fm_icon_view_is_compact),
	(fm_icon_view_register):
	* src/file-manager/fm-icon-view.h:
	* src/nautilus-file-management-properties.c
	(nautilus_file_management_properties_dialog_setup):
	* src/nautilus-file-management-properties.glade:
	Added compact view.

svn path=/trunk/; revision=14003
parent fc91bb49
2008-03-29 Christian Neumair <cneumair@gnome.org>
* libnautilus-private/apps_nautilus_preferences.schemas.in:
* libnautilus-private/nautilus-global-preferences.c
(nautilus_global_preferences_get_default_folder_viewer_preference_a
s_iid):
* libnautilus-private/nautilus-global-preferences.h:
* libnautilus-private/nautilus-icon-canvas-item.c
(create_label_layout),
(nautilus_icon_canvas_item_get_max_text_width):
* libnautilus-private/nautilus-icon-container.c
(lay_down_one_column), (get_max_icon_dimensions),
(lay_down_icons_vertical), (lay_down_icons_vertical_desktop),
(lay_down_icons), (size_allocate),
(nautilus_icon_container_update_icon),
(nautilus_icon_container_set_layout_mode),
(nautilus_icon_container_start_renaming_selected_item),
(nautilus_icon_container_set_forced_icon_size),
(nautilus_icon_container_set_all_columns_same_width):
* libnautilus-private/nautilus-icon-container.h:
* libnautilus-private/nautilus-icon-private.h:
* libnautilus-private/nautilus-metadata.h:
* src/file-manager/fm-icon-container.c
(fm_icon_container_get_icon_images),
(fm_icon_container_get_icon_text):
* src/file-manager/fm-icon-view.c
(get_stored_icon_position_callback),
(fm_icon_view_supports_manual_layout),
(fm_icon_view_supports_tighter_layout), (update_layout_menus),
(fm_icon_view_real_set_directory_sort_reversed),
(fm_icon_view_get_directory_auto_layout),
(fm_icon_view_real_get_directory_auto_layout),
(fm_icon_view_set_directory_auto_layout),
(fm_icon_view_real_set_directory_auto_layout),
(fm_icon_view_real_set_directory_tighter_layout),
(real_supports_manual_layout), (get_default_zoom_level),
(set_labels_beside_icons), (set_columns_same_width),
(fm_icon_view_begin_loading), (fm_icon_view_set_zoom_level),
(fm_icon_view_zoom_to_level),
(fm_icon_view_restore_default_zoom_level),
(default_zoom_level_changed_callback),
(all_columns_same_width_changed_callback),
(fm_icon_view_set_property), (fm_icon_view_class_init),
(fm_icon_view_get_id), (fm_icon_view_init), (fm_icon_view_create),
(fm_compact_view_create), (fm_icon_view_is_compact),
(fm_icon_view_register):
* src/file-manager/fm-icon-view.h:
* src/nautilus-file-management-properties.c
(nautilus_file_management_properties_dialog_setup):
* src/nautilus-file-management-properties.glade:
Added compact view.
2008-03-29 Cosimo Cecchi <cosimoc@gnome.org>
* src/nautilus-window-manage-views.c:
......
......@@ -532,8 +532,8 @@ most cases, this should be left alone. -->Sans 10</default>
<short>Default folder viewer</short>
<long>
When a folder is visited this viewer is used unless you have selected
another view for that particular folder. Possible values are "list_view"
and "icon_view".
another view for that particular folder. Possible values are "list_view",
"icon_view" and "compact_view".
</long>
</locale>
</schema>
......@@ -663,6 +663,36 @@ most cases, this should be left alone. -->Sans 10</default>
</long>
</locale>
</schema>
<!-- Icon View -->
<schema>
<key>/schemas/apps/nautilus/compact_view/default_zoom_level</key>
<applyto>/apps/nautilus/compact_view/default_zoom_level</applyto>
<owner>nautilus</owner>
<type>string</type>
<default>standard</default>
<locale name="C">
<short>Default compact view zoom level</short>
<long>
Default zoom level used by the compact view.
</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/nautilus/compact_view/all_columns_have_same_width</key>
<applyto>/apps/nautilus/compact_view/all_columns_have_same_width</applyto>
<owner>nautilus</owner>
<type>string</type>
<default>standard</default>
<locale name="C">
<short>All columns have same width</short>
<long>
If this preference is set, all columns in the compact view have the same
width. Otherwise, the width of each column is determined seperately.
</long>
</locale>
</schema>
<!-- List View -->
......
......@@ -137,6 +137,7 @@ static EelEnumerationEntry search_bar_type_enum_entries[] = {
static EelEnumerationEntry default_folder_viewer_enum_entries[] = {
{ "icon_view", N_("Icon View"), NAUTILUS_DEFAULT_FOLDER_VIEWER_ICON_VIEW },
{ "compact_view", N_("Compact View"), NAUTILUS_DEFAULT_FOLDER_VIEWER_COMPACT_VIEW },
{ "list_view", N_("List View"), NAUTILUS_DEFAULT_FOLDER_VIEWER_LIST_VIEW }
};
......@@ -415,6 +416,14 @@ static const PreferenceDefault preference_defaults[] = {
PREFERENCE_INTEGER,
GINT_TO_POINTER (96)
},
/* Compact Icon View Default Preferences */
{ NAUTILUS_PREFERENCES_COMPACT_VIEW_DEFAULT_ZOOM_LEVEL,
PREFERENCE_STRING,
"standard",
NULL, NULL,
"default_zoom_level"
},
/* List View Default Preferences */
{ NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_SORT_ORDER,
......@@ -706,6 +715,8 @@ nautilus_global_preferences_get_default_folder_viewer_preference_as_iid (void)
if (preference_value == NAUTILUS_DEFAULT_FOLDER_VIEWER_LIST_VIEW) {
viewer_iid = NAUTILUS_LIST_VIEW_IID;
} else if (preference_value == NAUTILUS_DEFAULT_FOLDER_VIEWER_COMPACT_VIEW) {
viewer_iid = NAUTILUS_COMPACT_VIEW_IID;
} else {
viewer_iid = NAUTILUS_ICON_VIEW_IID;
}
......
......@@ -109,13 +109,15 @@ typedef enum
enum
{
NAUTILUS_DEFAULT_FOLDER_VIEWER_ICON_VIEW,
NAUTILUS_DEFAULT_FOLDER_VIEWER_COMPACT_VIEW,
NAUTILUS_DEFAULT_FOLDER_VIEWER_LIST_VIEW,
NAUTILUS_DEFAULT_FOLDER_VIEWER_OTHER
};
/* These IIDs are used by the preferences code and in nautilus-application.c */
#define NAUTILUS_ICON_VIEW_IID "OAFIID:Nautilus_File_Manager_Icon_View"
#define NAUTILUS_LIST_VIEW_IID "OAFIID:Nautilus_File_Manager_List_View"
#define NAUTILUS_ICON_VIEW_IID "OAFIID:Nautilus_File_Manager_Icon_View"
#define NAUTILUS_COMPACT_VIEW_IID "OAFIID:Nautilus_File_Manager_Compact_View"
#define NAUTILUS_LIST_VIEW_IID "OAFIID:Nautilus_File_Manager_List_View"
/* Icon View */
......@@ -143,6 +145,10 @@ enum
/* The default size for thumbnail icons */
#define NAUTILUS_PREFERENCES_ICON_VIEW_THUMBNAIL_SIZE "icon_view/thumbnail_size"
/* Compact View */
#define NAUTILUS_PREFERENCES_COMPACT_VIEW_DEFAULT_ZOOM_LEVEL "compact_view/default_zoom_level"
#define NAUTILUS_PREFERENCES_COMPACT_VIEW_ALL_COLUMNS_SAME_WIDTH "compact_view/all_columns_same_width"
/* List View */
#define NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_SORT_IN_REVERSE_ORDER "list_view/default_sort_in_reverse_order"
#define NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_SORT_ORDER "list_view/default_sort_order"
......
......@@ -62,6 +62,7 @@
#define MAX_TEXT_WIDTH_STANDARD 135
#define MAX_TEXT_WIDTH_TIGHTER 80
#define MAX_TEXT_WIDTH_BESIDE 90
#define MAX_TEXT_WIDTH_BESIDE_TOP_TO_BOTTOM 300
/* Private part of the NautilusIconCanvasItem structure. */
struct NautilusIconCanvasItemDetails {
......@@ -1816,6 +1817,11 @@ nautilus_icon_canvas_item_draw (EelCanvasItem *item, GdkDrawable *drawable,
(g_ascii_isdigit (*(p+1)) && \
g_ascii_isdigit (*(p+2))))
#define IS_COMPACT_VIEW(container) \
container->details->layout_mode == NAUTILUS_ICON_LAYOUT_T_B_L_R && \
container->details->label_position == NAUTILUS_ICON_LABEL_POSITION_BESIDE
static PangoLayout *
create_label_layout (NautilusIconCanvasItem *item,
const char *text)
......@@ -1872,6 +1878,9 @@ create_label_layout (NautilusIconCanvasItem *item,
pango_layout_set_spacing (layout, LABEL_LINE_SPACING);
pango_layout_set_wrap (layout, PANGO_WRAP_WORD_CHAR);
if (IS_COMPACT_VIEW (container)) {
pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_END);
}
/* Create a font description */
if (container->details->font) {
......@@ -2424,14 +2433,19 @@ double
nautilus_icon_canvas_item_get_max_text_width (NautilusIconCanvasItem *item)
{
EelCanvasItem *canvas_item;
canvas_item = EEL_CANVAS_ITEM (item);
if (nautilus_icon_container_is_tighter_layout (NAUTILUS_ICON_CONTAINER (canvas_item->canvas))) {
return MAX_TEXT_WIDTH_TIGHTER * canvas_item->canvas->pixels_per_unit;
} else {
if (NAUTILUS_ICON_CONTAINER (canvas_item->canvas)->details->label_position == NAUTILUS_ICON_LABEL_POSITION_BESIDE) {
return MAX_TEXT_WIDTH_BESIDE * canvas_item->canvas->pixels_per_unit;
if (NAUTILUS_ICON_CONTAINER (canvas_item->canvas)->details->layout_mode == NAUTILUS_ICON_LAYOUT_T_B_L_R ||
NAUTILUS_ICON_CONTAINER (canvas_item->canvas)->details->layout_mode == NAUTILUS_ICON_LAYOUT_T_B_R_L) {
return MAX_TEXT_WIDTH_BESIDE_TOP_TO_BOTTOM * canvas_item->canvas->pixels_per_unit;
} else {
return MAX_TEXT_WIDTH_BESIDE * canvas_item->canvas->pixels_per_unit;
}
} else {
return MAX_TEXT_WIDTH_STANDARD * canvas_item->canvas->pixels_per_unit;
}
......
......@@ -1000,6 +1000,40 @@ lay_down_one_line (NautilusIconContainer *container,
}
}
static void
lay_down_one_column (NautilusIconContainer *container,
GList *line_start,
GList *line_end,
double x,
double y_start,
double y_iter,
GArray *positions)
{
GList *p;
NautilusIcon *icon;
double y;
IconPositions *position;
int i;
/* FIXME: Should layout differently when in RTL base mode */
/* Lay out the icons along the baseline. */
y = y_start;
i = 0;
for (p = line_start; p != line_end; p = p->next) {
icon = p->data;
position = &g_array_index (positions, IconPositions, i++);
icon_set_position
(icon,
x + position->x_offset,
y + position->y_offset);
y += y_iter;
}
}
static void
lay_down_icons_horizontal (NautilusIconContainer *container,
GList *icons,
......@@ -1161,6 +1195,160 @@ lay_down_icons_horizontal (NautilusIconContainer *container,
g_array_free (positions, TRUE);
}
static void
get_max_icon_dimensions (GList *icon_start,
GList *icon_end,
double *max_icon_width,
double *max_icon_height,
double *max_text_width,
double *max_text_height)
{
NautilusIcon *icon;
EelDRect icon_bounds;
EelDRect text_bounds;
GList *p;
*max_icon_width = *max_text_width = 0.0;
*max_icon_height = *max_text_height = 0.0;
/* Would it be worth caching these bounds for the next loop? */
for (p = icon_start; p != icon_end; p = p->next) {
icon = p->data;
icon_bounds = nautilus_icon_canvas_item_get_icon_rectangle (icon->item);
*max_icon_width = MAX (*max_icon_width, ceil (icon_bounds.x1 - icon_bounds.x0));
*max_icon_height = MAX (*max_icon_height, ceil (icon_bounds.y1 - icon_bounds.y0));
text_bounds = nautilus_icon_canvas_item_get_text_rectangle (icon->item);
*max_text_width = MAX (*max_text_width, ceil (text_bounds.x1 - text_bounds.x0));
*max_text_height = MAX (*max_text_height, ceil (text_bounds.y1 - text_bounds.y0));
}
}
/* column-wise layout. At the moment, this only works with label-beside-icon (used by "Compact View"). */
static void
lay_down_icons_vertical (NautilusIconContainer *container,
GList *icons,
double start_y)
{
GList *p, *line_start;
NautilusIcon *icon;
double canvas_width, x, canvas_height;
GArray *positions;
IconPositions *position;
EelDRect icon_bounds;
EelDRect text_bounds;
EelCanvasItem *item;
double line_height;
double max_height;
double max_height_with_borders;
double max_width;
double max_width_in_column;
double max_text_width, max_icon_width;
double max_text_height, max_icon_height;
int height;
int i;
g_assert (NAUTILUS_IS_ICON_CONTAINER (container));
g_assert (container->details->label_position == NAUTILUS_ICON_LABEL_POSITION_BESIDE);
if (icons == NULL) {
return;
}
positions = g_array_new (FALSE, FALSE, sizeof (IconPositions));
/* Lay out icons a column at a time. */
canvas_width = CANVAS_WIDTH(container);
canvas_height = CANVAS_HEIGHT(container);
max_icon_width = max_text_width = 0.0;
max_icon_height = max_text_height = 0.0;
get_max_icon_dimensions (icons, NULL,
&max_icon_width, &max_icon_height,
&max_text_width, &max_text_height);
max_width = max_icon_width + max_text_width;
max_height = MAX (max_icon_height, max_text_height);
max_height_with_borders = ICON_PAD_TOP + max_height + ICON_PAD_BOTTOM;
line_height = ICON_PAD_TOP;
line_start = icons;
x = 0;
i = 0;
max_width_in_column = 0.0;
for (p = icons; p != NULL; p = p->next) {
icon = p->data;
item = EEL_CANVAS_ITEM (icon->item);
/* If this icon doesn't fit, it's time to lay out the column that's queued up. */
if (line_start != p && line_height + max_height_with_borders + ICON_PAD_BOTTOM > canvas_height ) {
x += ICON_PAD_LEFT;
/* correctly set (per-column) width */
if (!container->details->all_columns_same_width) {
for (i = 0; i < (int) positions->len; i++) {
position = &g_array_index (positions, IconPositions, i);
position->width = max_width_in_column;
}
}
lay_down_one_column (container, line_start, p, x, CONTAINER_PAD_TOP, max_height_with_borders, positions);
/* Advance to next column. */
if (container->details->all_columns_same_width) {
x += max_width + ICON_PAD_RIGHT;
} else {
x += max_width_in_column + ICON_PAD_RIGHT;
}
line_height = ICON_PAD_TOP;
line_start = p;
i = 0;
max_width_in_column = 0;
}
icon_bounds = nautilus_icon_canvas_item_get_icon_rectangle (icon->item);
text_bounds = nautilus_icon_canvas_item_get_text_rectangle (icon->item);
max_width_in_column = MAX (max_width_in_column,
ceil (icon_bounds.x1 - icon_bounds.x0) +
ceil (text_bounds.x1 - text_bounds.x0));
g_array_set_size (positions, i + 1);
position = &g_array_index (positions, IconPositions, i++);
if (container->details->all_columns_same_width) {
position->width = max_width;
}
position->height = max_height;
position->y_offset = ICON_PAD_TOP;
position->x_offset = ICON_PAD_LEFT;
position->x_offset += max_icon_width - ceil (icon_bounds.x1 - icon_bounds.x0);
height = MAX (ceil (icon_bounds.y1 - icon_bounds.y0), ceil(text_bounds.y1 - text_bounds.y0));
position->y_offset += (max_height - height) / 2;
/* Add this icon. */
line_height += max_height_with_borders;
}
/* Lay down that last column of icons. */
if (line_start != NULL) {
x += ICON_PAD_LEFT;
lay_down_one_column (container, line_start, NULL, x, CONTAINER_PAD_TOP, max_height_with_borders, positions);
}
g_array_free (positions, TRUE);
}
static void
snap_position (NautilusIconContainer *container,
NautilusIcon *icon,
......@@ -1488,7 +1676,7 @@ nautilus_icon_container_set_rtl_positions (NautilusIconContainer *container)
}
static void
lay_down_icons_vertical (NautilusIconContainer *container, GList *icons)
lay_down_icons_vertical_desktop (NautilusIconContainer *container, GList *icons)
{
GList *p, *placed_icons, *unplaced_icons;
int total, new_length, placed;
......@@ -1669,7 +1857,11 @@ lay_down_icons (NautilusIconContainer *container, GList *icons, double start_y)
case NAUTILUS_ICON_LAYOUT_T_B_L_R:
case NAUTILUS_ICON_LAYOUT_T_B_R_L:
lay_down_icons_vertical (container, icons);
if (nautilus_icon_container_get_is_desktop (container)) {
lay_down_icons_vertical_desktop (container, icons);
} else {
lay_down_icons_vertical (container, icons, start_y);
}
break;
default:
......@@ -3157,6 +3349,10 @@ size_allocate (GtkWidget *widget,
need_layout_redone = TRUE;
}
if (allocation->height != widget->allocation.height) {
need_layout_redone = TRUE;
}
GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
container->details->has_been_allocated = TRUE;
......@@ -5768,9 +5964,14 @@ nautilus_icon_container_update_icon (NautilusIconContainer *container,
/* compute the maximum size based on the scale factor */
min_image_size = MINIMUM_IMAGE_SIZE * EEL_CANVAS (container)->pixels_per_unit;
max_image_size = MAX (MAXIMUM_IMAGE_SIZE * EEL_CANVAS (container)->pixels_per_unit, NAUTILUS_ICON_MAXIMUM_SIZE);
/* Get the appropriate images for the file. */
icon_get_size (container, icon, &icon_size);
if (container->details->forced_icon_size > 0) {
icon_size = container->details->forced_icon_size;
} else {
icon_get_size (container, icon, &icon_size);
}
icon_size = MAX (icon_size, min_image_size);
icon_size = MIN (icon_size, max_image_size);
......@@ -5787,7 +5988,10 @@ nautilus_icon_container_update_icon (NautilusIconContainer *container,
&has_open_window);
pixbuf = nautilus_icon_info_get_pixbuf (icon_info);
if (container->details->forced_icon_size > 0)
pixbuf = nautilus_icon_info_get_pixbuf_at_size (icon_info, icon_size);
else
pixbuf = nautilus_icon_info_get_pixbuf (icon_info);
nautilus_icon_info_get_attach_points (icon_info, &attach_points, &n_attach_points);
has_embedded_text_rect = nautilus_icon_info_get_embedded_rect (icon_info,
&embedded_text_rect);
......@@ -6803,6 +7007,7 @@ nautilus_icon_container_set_layout_mode (NautilusIconContainer *container,
g_return_if_fail (NAUTILUS_IS_ICON_CONTAINER (container));
container->details->layout_mode = mode;
invalidate_label_sizes (container);
redo_layout (container);
......@@ -7022,7 +7227,11 @@ nautilus_icon_container_start_renaming_selected_item (NautilusIconContainer *con
eel_editable_label_set_line_wrap (EEL_EDITABLE_LABEL (details->rename_widget), TRUE);
eel_editable_label_set_line_wrap_mode (EEL_EDITABLE_LABEL (details->rename_widget), PANGO_WRAP_WORD_CHAR);
eel_editable_label_set_draw_outline (EEL_EDITABLE_LABEL (details->rename_widget), TRUE);
eel_editable_label_set_justify (EEL_EDITABLE_LABEL (details->rename_widget), GTK_JUSTIFY_CENTER);
if (details->label_position != NAUTILUS_ICON_LABEL_POSITION_BESIDE) {
eel_editable_label_set_justify (EEL_EDITABLE_LABEL (details->rename_widget), GTK_JUSTIFY_CENTER);
}
gtk_misc_set_padding (GTK_MISC (details->rename_widget), 1, 1);
gtk_layout_put (GTK_LAYOUT (container),
details->rename_widget, 0, 0);
......@@ -7591,6 +7800,34 @@ nautilus_icon_container_set_allow_moves (NautilusIconContainer *container,
container->details->drag_allow_moves = allow_moves;
}
void
nautilus_icon_container_set_forced_icon_size (NautilusIconContainer *container,
int forced_icon_size)
{
g_return_if_fail (NAUTILUS_IS_ICON_CONTAINER (container));
if (forced_icon_size != container->details->forced_icon_size) {
container->details->forced_icon_size = forced_icon_size;
invalidate_label_sizes (container);
nautilus_icon_container_request_update_all (container);
}
}
void
nautilus_icon_container_set_all_columns_same_width (NautilusIconContainer *container,
gboolean all_columns_same_width)
{
g_return_if_fail (NAUTILUS_IS_ICON_CONTAINER (container));
if (all_columns_same_width != container->details->all_columns_same_width) {
container->details->all_columns_same_width = all_columns_same_width;
invalidate_label_sizes (container);
nautilus_icon_container_request_update_all (container);
}
}
/* NautilusIconContainerAccessible */
static NautilusIconContainerAccessiblePrivate *
......
......@@ -302,6 +302,10 @@ char* nautilus_icon_container_get_icon_description (Nautilu
gboolean nautilus_icon_container_get_allow_moves (NautilusIconContainer *container);
void nautilus_icon_container_set_allow_moves (NautilusIconContainer *container,
gboolean allow_moves);
void nautilus_icon_container_set_forced_icon_size (NautilusIconContainer *container,
int forced_icon_size);
void nautilus_icon_container_set_all_columns_same_width (NautilusIconContainer *container,
gboolean all_columns_same_width);
gboolean nautilus_icon_container_is_layout_rtl (NautilusIconContainer *container);
......
......@@ -224,6 +224,10 @@ struct NautilusIconContainerDetails {
gboolean single_click_mode;
gboolean auto_layout;
gboolean tighter_layout;
/* Whether for the vertical layout, all columns are supposed to
* have the same width. */
gboolean all_columns_same_width;
/* Layout mode */
NautilusIconLayoutMode layout_mode;
......@@ -231,6 +235,9 @@ struct NautilusIconContainerDetails {
/* Label position */
NautilusIconLabelPosition label_position;
/* Forced icon size, iff greater than 0 */
int forced_icon_size;
/* Should the container keep icons aligned to a grid */
gboolean keep_aligned;
......
......@@ -52,6 +52,8 @@
#define NAUTILUS_METADATA_KEY_LIST_VIEW_COLUMN_ORDER "list_view_column_order"
#define NAUTILUS_METADATA_SUBKEY_COLUMNS "columns"
#define NAUTILUS_METADATA_KEY_COMPACT_VIEW_ZOOM_LEVEL "compact_view_zoom_level"
#define NAUTILUS_METADATA_KEY_WINDOW_GEOMETRY "window_geometry"
#define NAUTILUS_METADATA_KEY_WINDOW_SCROLL_POSITION "window_scroll_position"
#define NAUTILUS_METADATA_KEY_WINDOW_SHOW_HIDDEN_FILES "window_show_hidden_files"
......
......@@ -82,19 +82,28 @@ fm_icon_container_get_icon_images (NautilusIconContainer *container,
if (emblem_pixbufs != NULL) {
emblem_size = nautilus_icon_get_emblem_size_for_icon_size (size);
emblems_to_ignore = fm_directory_view_get_emblem_names_to_exclude
(FM_DIRECTORY_VIEW (icon_view));
*emblem_pixbufs = nautilus_file_get_emblem_pixbufs (file,
emblem_size,
FALSE,
emblems_to_ignore);
g_strfreev (emblems_to_ignore);
/* don't return images larger than the actual icon size */
emblem_size = MIN (emblem_size, size);
if (emblem_size > 0) {
emblems_to_ignore = fm_directory_view_get_emblem_names_to_exclude
(FM_DIRECTORY_VIEW (icon_view));
*emblem_pixbufs = nautilus_file_get_emblem_pixbufs (file,
emblem_size,
FALSE,
emblems_to_ignore);
g_strfreev (emblems_to_ignore);
}
}
*has_window_open = nautilus_file_has_open_window (file);
flags = NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS;
flags = 0;
if (!fm_icon_view_is_compact (icon_view) ||
nautilus_icon_container_get_zoom_level (container) > NAUTILUS_ZOOM_LEVEL_STANDARD) {
flags |= NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS;
}
if (use_embedding) {
flags |= NAUTILUS_FILE_ICON_FLAGS_EMBEDDING_TEXT;
}
......@@ -321,6 +330,11 @@ fm_icon_container_get_icon_text (NautilusIconContainer *container,
*editable_text = nautilus_file_get_display_name (file);
}
if (fm_icon_view_is_compact (icon_view)) {
*additional_text = NULL;
return;
}
if (NAUTILUS_IS_DESKTOP_ICON_FILE (file)) {
/* Don't show the normal extra information for desktop icons, it doesn't
* make sense. */
......
......@@ -74,6 +74,12 @@
#define POPUP_PATH_ICON_APPEARANCE "/selection/Icon Appearance Items"
enum
{
PROP_0,
PROP_COMPACT
};
typedef struct {
const NautilusFileSortType sort_type;
const char *metadata_text;
......@@ -108,6 +114,8 @@ struct FMIconViewDetails
gboolean filter_by_screen;
int num_screens;
gboolean compact;
};
......@@ -166,6 +174,7 @@ static void fm_icon_view_update_click_mode (FMIconVie
static void fm_icon_view_set_directory_tighter_layout (FMIconView *icon_view,
NautilusFile *file,
gboolean tighter_layout);
static gboolean fm_icon_view_supports_manual_layout (FMIconView *icon_view);
static const SortCriterion *get_sort_criterion_by_sort_type (NautilusFileSortType sort_type);
static void set_sort_criterion_by_sort_type (FMIconView *icon_view,
NautilusFileSortType sort_type);
......@@ -177,6 +186,7 @@ static void preview_audio (FMIconVie
gboolean start_flag);
static void update_layout_menus (FMIconView *view);
static void fm_icon_view_iface_init (NautilusViewIface *iface);
G_DEFINE_TYPE_WITH_CODE (FMIconView, fm_icon_view, FM_TYPE_DIRECTORY_VIEW,
......@@ -249,6 +259,10 @@ get_stored_icon_position_callback (NautilusIconContainer *container,
g_assert (position != NULL);
g_assert (FM_IS_ICON_VIEW (icon_view));
if (!fm_icon_view_supports_manual_layout (icon_view)) {
return FALSE;
}
/* Doing parsing in the "C" locale instead of the one set
* by the user ensures that data in the metafile is not in
* a locale-specific format. It's only necessary for floating
......@@ -605,6 +619,16 @@ fm_icon_view_supports_auto_layout (FMIconView *view)
supports_auto_layout, (view));
}
static gboolean
fm_icon_view_supports_manual_layout (FMIconView *view)
{
g_return_val_if_fail (FM_IS_ICON_VIEW (view), FALSE);
return EEL_CALL_METHOD_WITH_RETURN_VALUE
(FM_ICON_VIEW_CLASS, view,
supports_manual_layout, (view));
}
static gboolean
fm_icon_view_supports_keep_aligned (FMIconView *view)
{
......@@ -625,6 +649,12 @@ fm_icon_view_supports_labels_beside_icons (FMIconView *view)
supports_labels_beside_icons, (view));
}
static gboolean
fm_icon_view_supports_tighter_layout (FMIconView *view)
{
return !fm_icon_view_is_compact (view);
}
static void
update_layout_menus (FMIconView *view)
{
......@@ -649,6 +679,9 @@ update_layout_menus (FMIconView *view)
FM_ACTION_TIGHTER_LAYOUT);
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
fm_icon_view_using_tighter_layout (view));
gtk_action_set_sensitive (action, fm_icon_view_supports_tighter_layout (view));
gtk_action_set_visible (action, fm_icon_view_supports_tighter_layout (view));
action = gtk_action_group_get_action (view->details->icon_action_group,
FM_ACTION_REVERSED_ORDER);
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
......@@ -656,6 +689,11 @@ update_layout_menus (FMIconView *view)
gtk_action_set_sensitive (action, is_auto_layout);
}
action = gtk_action_group_get_action (view->details->icon_action_group,
FM_ACTION_MANUAL_LAYOUT);
gtk_action_set_visible (action,
fm_icon_view_supports_manual_layout (view));
/* Clean Up is only relevant for manual layout */
action = gtk_action_group_get_action (view->details->icon_action_group,
FM_ACTION_CLEAN_UP);
......@@ -772,7 +810,7 @@ static gboolean
fm_icon_view_real_get_directory_sort_reversed (FMIconView *icon_view,
NautilusFile *file)
{