Commit e9c820b5 authored by John Sullivan's avatar John Sullivan

More groundwork for displaying more textual info under icons at higher zoom

levels.
parent b038ec54
2000-02-04 John Sullivan <sullivan@eazel.com>
Some renaming and reorganization heading towards supporting
icons with more info in label at higher zoom levels.
* libnautilus/nautilus-icons-controller.c:
* libnautilus/nautilus-icons-controller.h:
(nautilus_icons_controller_get_icon_name): Renamed to
nautilus_icons_controller_get_icon_text since it won't always
just be the name.
* src/file-manager/fm-icons-controller.c:
(fm_icons_controller_get_icon_name): Renamed to
fm_icons_controller_get_icon_text to match.
* libnautilus/gnome-icon-container.c:
(icon_new): Updated for name change.
* libnautilus/nautilus-directory.c:
* libnautilus/nautilus-directory.h:
(nautilus_file_get_string_attribute): New function, consolidates
nautilus_file_get_date_as_string, nautilus_file_get_size_as_string,
and nautilus_file_get_type_as_string (and more to come). These old
functions are now private.
* src/file-manager/fm-directory-view-list.c:
Changed column-identifying strings stored in metadata to be attribute
names recognized by nautilus_file_get_string_attribute. Added
LIST_VIEW_DEFAULT_SORTING_ATTRIBUTE.
(get_column_from_metadata_value): Renamed to get_column_from_attribute
(get_metadata_value_from_column): Renamed to get_attribute_from_column
(get_sort_column_from_attribute): New function, handles unknown attributes
by using LIST_VIEW_DEFAULT_SORTING_ATTRIBUTE.
(add_to_flist): Rewrote to use column attributes and nautilus_file_
get_string_attribute.
(fm_directory_view_list_begin_loading): Now calls get_sort_column_
from_attribute to handle the case where saved sorting attribute is unknown.
2000-02-04 Ettore Perazzoli <ettore@helixcode.com>
* components/html/Makefile.am: Use `GTKHTML_LIBS' and
......
......@@ -105,7 +105,7 @@ icon_new (GnomeIconContainer *container,
NautilusControllerIcon *data)
{
GnomeIconContainerDetails *details;
char *name;
char *label;
GnomeIconContainerIcon *new;
GdkPixbuf *image;
GnomeCanvas* canvas;
......@@ -120,16 +120,16 @@ icon_new (GnomeIconContainer *container,
new->data = data;
image = nautilus_icons_controller_get_icon_image (details->controller, data);
name = nautilus_icons_controller_get_icon_name (details->controller, data);
label = nautilus_icons_controller_get_icon_text (details->controller, data);
new->item = gnome_canvas_item_new
(GNOME_CANVAS_GROUP (canvas->root),
nautilus_icons_view_icon_item_get_type (),
"pixbuf", image,
"label", name,
"label", label,
NULL);
g_free (name);
g_free (label);
return new;
}
......
......@@ -90,6 +90,9 @@ static int nautilus_file_compare_for_sort_internal (NautilusFile *file_1,
NautilusFileSortType sort_type,
gboolean reversed);
static char * nautilus_file_get_date_as_string (NautilusFile *file);
static char * nautilus_file_get_size_as_string (NautilusFile *file);
static char * nautilus_file_get_type_as_string (NautilusFile *file);
static void nautilus_directory_load_cb (GnomeVFSAsyncHandle *handle,
GnomeVFSResult result,
GnomeVFSDirectoryList *list,
......@@ -1328,7 +1331,7 @@ nautilus_file_get_uri (NautilusFile *file)
* Returns: Newly allocated string ready to display to the user.
*
**/
gchar *
static char *
nautilus_file_get_date_as_string (NautilusFile *file)
{
/* Note: This uses modified time. There's also accessed time and
......@@ -1417,7 +1420,7 @@ nautilus_file_get_size (NautilusFile *file)
* Returns: Newly allocated string ready to display to the user.
*
**/
gchar *
static char *
nautilus_file_get_size_as_string (NautilusFile *file)
{
g_return_val_if_fail (file != NULL, NULL);
......@@ -1428,6 +1431,38 @@ nautilus_file_get_size_as_string (NautilusFile *file)
return gnome_vfs_file_size_to_string (file->info->size);
}
/**
* nautilus_file_get_string_attribute:
*
* Get a user-displayable string from a named attribute. Use g_free to
* free this string.
*
* @file: NautilusFile representing the file in question.
* @attribute_name: The name of the desired attribute. The currently supported
* set includes "name", "type", "size", and "date modified".
*
* Returns: Newly allocated string ready to display to the user, or NULL
* if @attribute_name is not supported.
*
**/
char *
nautilus_file_get_string_attribute (NautilusFile *file, const char *attribute_name)
{
if (strcmp (attribute_name, "name") == 0)
return nautilus_file_get_name (file);
if (strcmp (attribute_name, "type") == 0)
return nautilus_file_get_type_as_string (file);
if (strcmp (attribute_name, "size") == 0)
return nautilus_file_get_size_as_string (file);
if (strcmp (attribute_name, "date_modified") == 0)
return nautilus_file_get_date_as_string (file);
return NULL;
}
/**
* nautilus_file_get_type_as_string:
*
......@@ -1438,7 +1473,7 @@ nautilus_file_get_size_as_string (NautilusFile *file)
* Returns: Newly allocated string ready to display to the user.
*
**/
gchar *
static char *
nautilus_file_get_type_as_string (NautilusFile *file)
{
g_return_val_if_fail (file != NULL, NULL);
......
......@@ -155,9 +155,8 @@ void nautilus_file_set_metadata (NautilusFile
const char *metadata);
/* Attributes for file objects as user-displayable strings. */
char * nautilus_file_get_date_as_string (NautilusFile *file);
char * nautilus_file_get_size_as_string (NautilusFile *file);
char * nautilus_file_get_type_as_string (NautilusFile *file);
char * nautilus_file_get_string_attribute (NautilusFile *file,
const char *attribute_name);
/* Comparing two file objects for sorting */
int nautilus_file_compare_for_sort (NautilusFile *file_1,
......
......@@ -34,14 +34,14 @@ static void nautilus_icons_controller_initialize (NautilusIconsController *contr
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusIconsController, nautilus_icons_controller, GTK_TYPE_OBJECT)
NAUTILUS_IMPLEMENT_MUST_OVERRIDE_SIGNAL(nautilus_icons_controller, get_icon_image)
NAUTILUS_IMPLEMENT_MUST_OVERRIDE_SIGNAL(nautilus_icons_controller, get_icon_name)
NAUTILUS_IMPLEMENT_MUST_OVERRIDE_SIGNAL(nautilus_icons_controller, get_icon_text)
NAUTILUS_IMPLEMENT_MUST_OVERRIDE_SIGNAL(nautilus_icons_controller, get_icon_uri)
static void
nautilus_icons_controller_initialize_class (NautilusIconsControllerClass *klass)
{
NAUTILUS_ASSIGN_MUST_OVERRIDE_SIGNAL(klass, nautilus_icons_controller, get_icon_image);
NAUTILUS_ASSIGN_MUST_OVERRIDE_SIGNAL(klass, nautilus_icons_controller, get_icon_name);
NAUTILUS_ASSIGN_MUST_OVERRIDE_SIGNAL(klass, nautilus_icons_controller, get_icon_text);
NAUTILUS_ASSIGN_MUST_OVERRIDE_SIGNAL(klass, nautilus_icons_controller, get_icon_uri);
}
......@@ -59,10 +59,10 @@ nautilus_icons_controller_get_icon_image (NautilusIconsController *controller,
}
char *
nautilus_icons_controller_get_icon_name (NautilusIconsController *controller,
nautilus_icons_controller_get_icon_text (NautilusIconsController *controller,
NautilusControllerIcon *icon)
{
return (* NAUTILUS_ICONS_CONTROLLER_CLASS (controller->object.klass)->get_icon_name)
return (* NAUTILUS_ICONS_CONTROLLER_CLASS (controller->object.klass)->get_icon_text)
(controller, icon);
}
......
......@@ -59,7 +59,7 @@ GtkType nautilus_icons_controller_get_type (void);
/* Icon operations. */
GdkPixbuf *nautilus_icons_controller_get_icon_image (NautilusIconsController *controller,
NautilusControllerIcon *icon);
char * nautilus_icons_controller_get_icon_name (NautilusIconsController *controller,
char * nautilus_icons_controller_get_icon_text (NautilusIconsController *controller,
NautilusControllerIcon *icon);
char * nautilus_icons_controller_get_icon_uri (NautilusIconsController *controller,
NautilusControllerIcon *icon);
......@@ -75,7 +75,7 @@ struct _NautilusIconsControllerClass
GdkPixbuf * (*get_icon_image) (NautilusIconsController *controller,
NautilusControllerIcon *icon);
char * (* get_icon_name) (NautilusIconsController *controller,
char * (* get_icon_text) (NautilusIconsController *controller,
NautilusControllerIcon *icon);
char * (* get_icon_uri) (NautilusIconsController *controller,
NautilusControllerIcon *icon);
......
......@@ -105,7 +105,7 @@ icon_new (GnomeIconContainer *container,
NautilusControllerIcon *data)
{
GnomeIconContainerDetails *details;
char *name;
char *label;
GnomeIconContainerIcon *new;
GdkPixbuf *image;
GnomeCanvas* canvas;
......@@ -120,16 +120,16 @@ icon_new (GnomeIconContainer *container,
new->data = data;
image = nautilus_icons_controller_get_icon_image (details->controller, data);
name = nautilus_icons_controller_get_icon_name (details->controller, data);
label = nautilus_icons_controller_get_icon_text (details->controller, data);
new->item = gnome_canvas_item_new
(GNOME_CANVAS_GROUP (canvas->root),
nautilus_icons_view_icon_item_get_type (),
"pixbuf", image,
"label", name,
"label", label,
NULL);
g_free (name);
g_free (label);
return new;
}
......
......@@ -90,6 +90,9 @@ static int nautilus_file_compare_for_sort_internal (NautilusFile *file_1,
NautilusFileSortType sort_type,
gboolean reversed);
static char * nautilus_file_get_date_as_string (NautilusFile *file);
static char * nautilus_file_get_size_as_string (NautilusFile *file);
static char * nautilus_file_get_type_as_string (NautilusFile *file);
static void nautilus_directory_load_cb (GnomeVFSAsyncHandle *handle,
GnomeVFSResult result,
GnomeVFSDirectoryList *list,
......@@ -1328,7 +1331,7 @@ nautilus_file_get_uri (NautilusFile *file)
* Returns: Newly allocated string ready to display to the user.
*
**/
gchar *
static char *
nautilus_file_get_date_as_string (NautilusFile *file)
{
/* Note: This uses modified time. There's also accessed time and
......@@ -1417,7 +1420,7 @@ nautilus_file_get_size (NautilusFile *file)
* Returns: Newly allocated string ready to display to the user.
*
**/
gchar *
static char *
nautilus_file_get_size_as_string (NautilusFile *file)
{
g_return_val_if_fail (file != NULL, NULL);
......@@ -1428,6 +1431,38 @@ nautilus_file_get_size_as_string (NautilusFile *file)
return gnome_vfs_file_size_to_string (file->info->size);
}
/**
* nautilus_file_get_string_attribute:
*
* Get a user-displayable string from a named attribute. Use g_free to
* free this string.
*
* @file: NautilusFile representing the file in question.
* @attribute_name: The name of the desired attribute. The currently supported
* set includes "name", "type", "size", and "date modified".
*
* Returns: Newly allocated string ready to display to the user, or NULL
* if @attribute_name is not supported.
*
**/
char *
nautilus_file_get_string_attribute (NautilusFile *file, const char *attribute_name)
{
if (strcmp (attribute_name, "name") == 0)
return nautilus_file_get_name (file);
if (strcmp (attribute_name, "type") == 0)
return nautilus_file_get_type_as_string (file);
if (strcmp (attribute_name, "size") == 0)
return nautilus_file_get_size_as_string (file);
if (strcmp (attribute_name, "date_modified") == 0)
return nautilus_file_get_date_as_string (file);
return NULL;
}
/**
* nautilus_file_get_type_as_string:
*
......@@ -1438,7 +1473,7 @@ nautilus_file_get_size_as_string (NautilusFile *file)
* Returns: Newly allocated string ready to display to the user.
*
**/
gchar *
static char *
nautilus_file_get_type_as_string (NautilusFile *file)
{
g_return_val_if_fail (file != NULL, NULL);
......
......@@ -155,9 +155,8 @@ void nautilus_file_set_metadata (NautilusFile
const char *metadata);
/* Attributes for file objects as user-displayable strings. */
char * nautilus_file_get_date_as_string (NautilusFile *file);
char * nautilus_file_get_size_as_string (NautilusFile *file);
char * nautilus_file_get_type_as_string (NautilusFile *file);
char * nautilus_file_get_string_attribute (NautilusFile *file,
const char *attribute_name);
/* Comparing two file objects for sorting */
int nautilus_file_compare_for_sort (NautilusFile *file_1,
......
......@@ -34,14 +34,14 @@ static void nautilus_icons_controller_initialize (NautilusIconsController *contr
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusIconsController, nautilus_icons_controller, GTK_TYPE_OBJECT)
NAUTILUS_IMPLEMENT_MUST_OVERRIDE_SIGNAL(nautilus_icons_controller, get_icon_image)
NAUTILUS_IMPLEMENT_MUST_OVERRIDE_SIGNAL(nautilus_icons_controller, get_icon_name)
NAUTILUS_IMPLEMENT_MUST_OVERRIDE_SIGNAL(nautilus_icons_controller, get_icon_text)
NAUTILUS_IMPLEMENT_MUST_OVERRIDE_SIGNAL(nautilus_icons_controller, get_icon_uri)
static void
nautilus_icons_controller_initialize_class (NautilusIconsControllerClass *klass)
{
NAUTILUS_ASSIGN_MUST_OVERRIDE_SIGNAL(klass, nautilus_icons_controller, get_icon_image);
NAUTILUS_ASSIGN_MUST_OVERRIDE_SIGNAL(klass, nautilus_icons_controller, get_icon_name);
NAUTILUS_ASSIGN_MUST_OVERRIDE_SIGNAL(klass, nautilus_icons_controller, get_icon_text);
NAUTILUS_ASSIGN_MUST_OVERRIDE_SIGNAL(klass, nautilus_icons_controller, get_icon_uri);
}
......@@ -59,10 +59,10 @@ nautilus_icons_controller_get_icon_image (NautilusIconsController *controller,
}
char *
nautilus_icons_controller_get_icon_name (NautilusIconsController *controller,
nautilus_icons_controller_get_icon_text (NautilusIconsController *controller,
NautilusControllerIcon *icon)
{
return (* NAUTILUS_ICONS_CONTROLLER_CLASS (controller->object.klass)->get_icon_name)
return (* NAUTILUS_ICONS_CONTROLLER_CLASS (controller->object.klass)->get_icon_text)
(controller, icon);
}
......
......@@ -59,7 +59,7 @@ GtkType nautilus_icons_controller_get_type (void);
/* Icon operations. */
GdkPixbuf *nautilus_icons_controller_get_icon_image (NautilusIconsController *controller,
NautilusControllerIcon *icon);
char * nautilus_icons_controller_get_icon_name (NautilusIconsController *controller,
char * nautilus_icons_controller_get_icon_text (NautilusIconsController *controller,
NautilusControllerIcon *icon);
char * nautilus_icons_controller_get_icon_uri (NautilusIconsController *controller,
NautilusControllerIcon *icon);
......@@ -75,7 +75,7 @@ struct _NautilusIconsControllerClass
GdkPixbuf * (*get_icon_image) (NautilusIconsController *controller,
NautilusControllerIcon *icon);
char * (* get_icon_name) (NautilusIconsController *controller,
char * (* get_icon_text) (NautilusIconsController *controller,
NautilusControllerIcon *icon);
char * (* get_icon_uri) (NautilusIconsController *controller,
NautilusControllerIcon *icon);
......
......@@ -105,7 +105,7 @@ icon_new (GnomeIconContainer *container,
NautilusControllerIcon *data)
{
GnomeIconContainerDetails *details;
char *name;
char *label;
GnomeIconContainerIcon *new;
GdkPixbuf *image;
GnomeCanvas* canvas;
......@@ -120,16 +120,16 @@ icon_new (GnomeIconContainer *container,
new->data = data;
image = nautilus_icons_controller_get_icon_image (details->controller, data);
name = nautilus_icons_controller_get_icon_name (details->controller, data);
label = nautilus_icons_controller_get_icon_text (details->controller, data);
new->item = gnome_canvas_item_new
(GNOME_CANVAS_GROUP (canvas->root),
nautilus_icons_view_icon_item_get_type (),
"pixbuf", image,
"label", name,
"label", label,
NULL);
g_free (name);
g_free (label);
return new;
}
......
......@@ -90,6 +90,9 @@ static int nautilus_file_compare_for_sort_internal (NautilusFile *file_1,
NautilusFileSortType sort_type,
gboolean reversed);
static char * nautilus_file_get_date_as_string (NautilusFile *file);
static char * nautilus_file_get_size_as_string (NautilusFile *file);
static char * nautilus_file_get_type_as_string (NautilusFile *file);
static void nautilus_directory_load_cb (GnomeVFSAsyncHandle *handle,
GnomeVFSResult result,
GnomeVFSDirectoryList *list,
......@@ -1328,7 +1331,7 @@ nautilus_file_get_uri (NautilusFile *file)
* Returns: Newly allocated string ready to display to the user.
*
**/
gchar *
static char *
nautilus_file_get_date_as_string (NautilusFile *file)
{
/* Note: This uses modified time. There's also accessed time and
......@@ -1417,7 +1420,7 @@ nautilus_file_get_size (NautilusFile *file)
* Returns: Newly allocated string ready to display to the user.
*
**/
gchar *
static char *
nautilus_file_get_size_as_string (NautilusFile *file)
{
g_return_val_if_fail (file != NULL, NULL);
......@@ -1428,6 +1431,38 @@ nautilus_file_get_size_as_string (NautilusFile *file)
return gnome_vfs_file_size_to_string (file->info->size);
}
/**
* nautilus_file_get_string_attribute:
*
* Get a user-displayable string from a named attribute. Use g_free to
* free this string.
*
* @file: NautilusFile representing the file in question.
* @attribute_name: The name of the desired attribute. The currently supported
* set includes "name", "type", "size", and "date modified".
*
* Returns: Newly allocated string ready to display to the user, or NULL
* if @attribute_name is not supported.
*
**/
char *
nautilus_file_get_string_attribute (NautilusFile *file, const char *attribute_name)
{
if (strcmp (attribute_name, "name") == 0)
return nautilus_file_get_name (file);
if (strcmp (attribute_name, "type") == 0)
return nautilus_file_get_type_as_string (file);
if (strcmp (attribute_name, "size") == 0)
return nautilus_file_get_size_as_string (file);
if (strcmp (attribute_name, "date_modified") == 0)
return nautilus_file_get_date_as_string (file);
return NULL;
}
/**
* nautilus_file_get_type_as_string:
*
......@@ -1438,7 +1473,7 @@ nautilus_file_get_size_as_string (NautilusFile *file)
* Returns: Newly allocated string ready to display to the user.
*
**/
gchar *
static char *
nautilus_file_get_type_as_string (NautilusFile *file)
{
g_return_val_if_fail (file != NULL, NULL);
......
......@@ -155,9 +155,8 @@ void nautilus_file_set_metadata (NautilusFile
const char *metadata);
/* Attributes for file objects as user-displayable strings. */
char * nautilus_file_get_date_as_string (NautilusFile *file);
char * nautilus_file_get_size_as_string (NautilusFile *file);
char * nautilus_file_get_type_as_string (NautilusFile *file);
char * nautilus_file_get_string_attribute (NautilusFile *file,
const char *attribute_name);
/* Comparing two file objects for sorting */
int nautilus_file_compare_for_sort (NautilusFile *file_1,
......
......@@ -34,14 +34,14 @@ static void nautilus_icons_controller_initialize (NautilusIconsController *contr
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusIconsController, nautilus_icons_controller, GTK_TYPE_OBJECT)
NAUTILUS_IMPLEMENT_MUST_OVERRIDE_SIGNAL(nautilus_icons_controller, get_icon_image)
NAUTILUS_IMPLEMENT_MUST_OVERRIDE_SIGNAL(nautilus_icons_controller, get_icon_name)
NAUTILUS_IMPLEMENT_MUST_OVERRIDE_SIGNAL(nautilus_icons_controller, get_icon_text)
NAUTILUS_IMPLEMENT_MUST_OVERRIDE_SIGNAL(nautilus_icons_controller, get_icon_uri)
static void
nautilus_icons_controller_initialize_class (NautilusIconsControllerClass *klass)
{
NAUTILUS_ASSIGN_MUST_OVERRIDE_SIGNAL(klass, nautilus_icons_controller, get_icon_image);
NAUTILUS_ASSIGN_MUST_OVERRIDE_SIGNAL(klass, nautilus_icons_controller, get_icon_name);
NAUTILUS_ASSIGN_MUST_OVERRIDE_SIGNAL(klass, nautilus_icons_controller, get_icon_text);
NAUTILUS_ASSIGN_MUST_OVERRIDE_SIGNAL(klass, nautilus_icons_controller, get_icon_uri);
}
......@@ -59,10 +59,10 @@ nautilus_icons_controller_get_icon_image (NautilusIconsController *controller,
}
char *
nautilus_icons_controller_get_icon_name (NautilusIconsController *controller,
nautilus_icons_controller_get_icon_text (NautilusIconsController *controller,
NautilusControllerIcon *icon)
{
return (* NAUTILUS_ICONS_CONTROLLER_CLASS (controller->object.klass)->get_icon_name)
return (* NAUTILUS_ICONS_CONTROLLER_CLASS (controller->object.klass)->get_icon_text)
(controller, icon);
}
......
......@@ -59,7 +59,7 @@ GtkType nautilus_icons_controller_get_type (void);
/* Icon operations. */
GdkPixbuf *nautilus_icons_controller_get_icon_image (NautilusIconsController *controller,
NautilusControllerIcon *icon);
char * nautilus_icons_controller_get_icon_name (NautilusIconsController *controller,
char * nautilus_icons_controller_get_icon_text (NautilusIconsController *controller,
NautilusControllerIcon *icon);
char * nautilus_icons_controller_get_icon_uri (NautilusIconsController *controller,
NautilusControllerIcon *icon);
......@@ -75,7 +75,7 @@ struct _NautilusIconsControllerClass
GdkPixbuf * (*get_icon_image) (NautilusIconsController *controller,
NautilusControllerIcon *icon);
char * (* get_icon_name) (NautilusIconsController *controller,
char * (* get_icon_text) (NautilusIconsController *controller,
NautilusControllerIcon *icon);
char * (* get_icon_uri) (NautilusIconsController *controller,
NautilusControllerIcon *icon);
......
......@@ -62,13 +62,15 @@ struct _FMDirectoryViewListDetails
#define UP_INDICATOR_VALUE 1
#define DOWN_INDICATOR_VALUE 2
/* special values for metadata */
/* file attributes associated with columns */
#define LIST_VIEW_COLUMN_ICON_METADATA_VALUE "icon_column"
#define LIST_VIEW_COLUMN_NAME_METADATA_VALUE "name_column"
#define LIST_VIEW_COLUMN_SIZE_METADATA_VALUE "size_column"
#define LIST_VIEW_COLUMN_MIME_TYPE_METADATA_VALUE "type_column"
#define LIST_VIEW_COLUMN_DATE_MODIFIED_METADATA_VALUE "date_modified_column"
#define LIST_VIEW_ICON_ATTRIBUTE "icon"
#define LIST_VIEW_NAME_ATTRIBUTE "name"
#define LIST_VIEW_SIZE_ATTRIBUTE "size"
#define LIST_VIEW_MIME_TYPE_ATTRIBUTE "type"
#define LIST_VIEW_DATE_MODIFIED_ATTRIBUTE "date_modified"
#define LIST_VIEW_DEFAULT_SORTING_ATTRIBUTE LIST_VIEW_NAME_ATTRIBUTE
/* forward declarations */
......@@ -119,9 +121,10 @@ static void fm_directory_view_list_set_zoom_level (FMDirectoryViewList *list_v
static void fm_directory_view_list_sort_items (FMDirectoryViewList *list_view,
int column,
gboolean reversed);
int get_column_from_metadata_value (const char *value);
const char *get_attribute_from_column (int column);
int get_column_from_attribute (const char *value);
int get_sort_column_from_attribute (const char *value);
static GtkFList *get_flist (FMDirectoryViewList *list_view);
const char *get_metadata_value_from_column (int column);
static GtkWidget *get_sort_indicator (GtkFList *flist,
gint column,
gboolean reverse);
......@@ -449,29 +452,26 @@ static void
add_to_flist (FMDirectoryViewList *list_view, NautilusFile *file)
{
GtkCList *clist;
gchar *text[LIST_VIEW_COLUMN_COUNT];
gchar *name;
gchar *size_string;
gchar *modified_string;
gchar *type_string;
gchar **text;
int new_row;
int column;
g_return_if_fail (FM_IS_DIRECTORY_VIEW (list_view));
g_return_if_fail (file != NULL);
text[LIST_VIEW_COLUMN_ICON] = NULL;
name = nautilus_file_get_name (file);
text[LIST_VIEW_COLUMN_NAME] = name;
size_string = nautilus_file_get_size_as_string (file);
text[LIST_VIEW_COLUMN_SIZE] = size_string;
/* One extra slot so it's NULL-terminated */
text = g_new0 (gchar *, LIST_VIEW_COLUMN_COUNT+1);
modified_string = nautilus_file_get_date_as_string (file);
text[LIST_VIEW_COLUMN_DATE_MODIFIED] = modified_string;
type_string = nautilus_file_get_type_as_string (file);
text[LIST_VIEW_COLUMN_MIME_TYPE] = type_string;
for (column = 0; column < LIST_VIEW_COLUMN_COUNT; ++column)
{
/* No text in icon column */
if (column != LIST_VIEW_COLUMN_ICON)
{
text[column] =
nautilus_file_get_string_attribute (file,
get_attribute_from_column (column));
}
}
clist = GTK_CLIST (get_flist(list_view));
......@@ -486,10 +486,7 @@ add_to_flist (FMDirectoryViewList *list_view, NautilusFile *file)
install_icon (list_view, new_row);
g_free (name);
g_free (size_string);
g_free (modified_string);
g_free (type_string);
g_strfreev (text);
}
static GtkFList *
......@@ -595,11 +592,11 @@ fm_directory_view_list_begin_loading (FMDirectoryView *view)
fm_directory_view_list_sort_items (
list_view,
get_column_from_metadata_value (
get_sort_column_from_attribute (
nautilus_directory_get_metadata (
directory,
LIST_VIEW_SORT_COLUMN_METADATA_KEY,
LIST_VIEW_COLUMN_NAME_METADATA_VALUE)),
LIST_VIEW_DEFAULT_SORTING_ATTRIBUTE)),
nautilus_directory_get_boolean_metadata (