Commit 5d691d77 authored by Darin Adler's avatar Darin Adler
Browse files

Fixed a bunch of bugs that were causing directory display to be

	even slower than it ought to be. The hysteresis wasn't working at
	all because of the confusion about when files were ready for
	display. Also changed hysteresis to 1 second and file chunk to 300
	files instead of 100.

	* libnautilus-private/nautilus-directory-async.c:
	(link_info_gmc_link_read_callback): Fix function so it uses the
	actual URI, not the thing that starts with URL. The old way it
	was always failing to read. There were some other backwards if
	statements in here too.

	* src/file-manager/fm-directory-view.h:
	* src/file-manager/fm-directory-view.c:
	(fm_directory_view_initialize): Create "non-ready files" hash.
	(fm_directory_view_destroy): Destroy it.
	(real_file_still_belongs): Move this here from FMListView.
	(still_should_show_file): New function, used to decide whether to
	keep a file in the window or not.
	(ready_to_load): New function, used to decide whether a file is
	ready enough to show in the window.
	(process_new_files): Move files from the "new files" lists to the
	"old files" lists, filtering out ones that are not ready to load
	and putting those into the "non-ready files" hash. Also sort the
	added files so the ones that show up at the top are the first to
	be added.
	(split_off_first_n): Renamed to eliminate the "g" namespace.
	(process_old_files): The guts of what used to be in
	display_pending_files. Now we use a separate signal for remove
	instead of just reusing the changed signal.
	(display_pending_files): We're not done loading until all the
	"non-ready files" are ready. Also reverse the sense of the return
	value, so it returns TRUE if there is more work to do.
	(display_pending_idle_callback): Don't zero out the idle ID if we
	are going to return TRUE.
	(display_pending_timeout_callback): If there are more files than
	we can handle, do the remainder at idle time, not in another
	timeout.
	(schedule_idle_display_of_pending_files): Lower the priority so we
	are more likely to get canvas updates between idles.
	(done_loading_callback): We're not done until there are no
	"non-ready files" left.
	(fm_directory_view_queue_file_change): Tiny optimization.
	(unref_key_and_remove): Helper function for clearing out the
	"non-ready files" hash.
	(fm_directory_view_stop): Clear out the 4 lists and the hash (it
	used to just be 2 lists).
	(real_sort_files): Default implementation, doesn't sort.
	(fm_directory_view_initialize_class): Various new methods.

	* src/file-manager/fm-icon-view.c: (fm_icon_view_add_file): Do
	less work, since the rules about which files should be shown and
	which files are ready to be seen are now in FMDirectoryView.
	(fm_icon_view_remove_file): New function.
	(fm_icon_view_file_changed): Do way less work, since
	FMDirectoryView does the heavy lifting now.
	(play_file), (preview_audio): Some rudimentary fixes, still seems
	to be broken.
	(compare_files): New function.
	(compare_files_cover): New function.
	(fm_icon_view_sort_files): If automatic layout is on, sort the
	files on their way in so the first ones displayed are the top left
	ones.
	(icon_container_compare_icons_callback): Share code by using the
	new compare_files function.
	(fm_icon_view_initialize_class): Various new methods.

	* src/file-manager/fm-list-view.h:
	* src/file-manager/fm-list-view.c:
	(fm_list_view_initialize_class): Various new methods.
	(fm_list_view_add_file): Do less work, since the rules about which
	files should be shown and which files are ready to be seen are now
	in FMDirectoryView.
	(fm_list_view_file_changed): Do way less work, since
	FMDirectoryView does the heavy lifting now.
	(fm_list_view_remove_file): New function.
	(fm_list_view_sort_files): This replaces the old override of
	display_pending_files.

	* src/file-manager/fm-search-list-view.c:
	(fm_search_list_view_initialize_class): The file_still_belongs
	method moved to FMDirectoryView.
parent a59af0bc
2001-10-18 Darin Adler <darin@bentspoon.com>
Fixed a bunch of bugs that were causing directory display to be
even slower than it ought to be. The hysteresis wasn't working at
all because of the confusion about when files were ready for
display. Also changed hysteresis to 1 second and file chunk to 300
files instead of 100.
* libnautilus-private/nautilus-directory-async.c:
(link_info_gmc_link_read_callback): Fix function so it uses the
actual URI, not the thing that starts with URL. The old way it
was always failing to read. There were some other backwards if
statements in here too.
* src/file-manager/fm-directory-view.h:
* src/file-manager/fm-directory-view.c:
(fm_directory_view_initialize): Create "non-ready files" hash.
(fm_directory_view_destroy): Destroy it.
(real_file_still_belongs): Move this here from FMListView.
(still_should_show_file): New function, used to decide whether to
keep a file in the window or not.
(ready_to_load): New function, used to decide whether a file is
ready enough to show in the window.
(process_new_files): Move files from the "new files" lists to the
"old files" lists, filtering out ones that are not ready to load
and putting those into the "non-ready files" hash. Also sort the
added files so the ones that show up at the top are the first to
be added.
(split_off_first_n): Renamed to eliminate the "g" namespace.
(process_old_files): The guts of what used to be in
display_pending_files. Now we use a separate signal for remove
instead of just reusing the changed signal.
(display_pending_files): We're not done loading until all the
"non-ready files" are ready. Also reverse the sense of the return
value, so it returns TRUE if there is more work to do.
(display_pending_idle_callback): Don't zero out the idle ID if we
are going to return TRUE.
(display_pending_timeout_callback): If there are more files than
we can handle, do the remainder at idle time, not in another
timeout.
(schedule_idle_display_of_pending_files): Lower the priority so we
are more likely to get canvas updates between idles.
(done_loading_callback): We're not done until there are no
"non-ready files" left.
(fm_directory_view_queue_file_change): Tiny optimization.
(unref_key_and_remove): Helper function for clearing out the
"non-ready files" hash.
(fm_directory_view_stop): Clear out the 4 lists and the hash (it
used to just be 2 lists).
(real_sort_files): Default implementation, doesn't sort.
(fm_directory_view_initialize_class): Various new methods.
* src/file-manager/fm-icon-view.c: (fm_icon_view_add_file): Do
less work, since the rules about which files should be shown and
which files are ready to be seen are now in FMDirectoryView.
(fm_icon_view_remove_file): New function.
(fm_icon_view_file_changed): Do way less work, since
FMDirectoryView does the heavy lifting now.
(play_file), (preview_audio): Some rudimentary fixes, still seems
to be broken.
(compare_files): New function.
(compare_files_cover): New function.
(fm_icon_view_sort_files): If automatic layout is on, sort the
files on their way in so the first ones displayed are the top left
ones.
(icon_container_compare_icons_callback): Share code by using the
new compare_files function.
(fm_icon_view_initialize_class): Various new methods.
* src/file-manager/fm-list-view.h:
* src/file-manager/fm-list-view.c:
(fm_list_view_initialize_class): Various new methods.
(fm_list_view_add_file): Do less work, since the rules about which
files should be shown and which files are ready to be seen are now
in FMDirectoryView.
(fm_list_view_file_changed): Do way less work, since
FMDirectoryView does the heavy lifting now.
(fm_list_view_remove_file): New function.
(fm_list_view_sort_files): This replaces the old override of
display_pending_files.
* src/file-manager/fm-search-list-view.c:
(fm_search_list_view_initialize_class): The file_still_belongs
method moved to FMDirectoryView.
2001-10-15 Darin Adler <darin@bentspoon.com>
Switch to require Mozilla 0.9.5 -- sadly this means we are
......@@ -211,7 +296,7 @@
(destroy, compare_by_name, nautilus_file_get_string_attribute,
nautilus_file_get_all_attributes, nautilus_self_check_file):
Adjust for custom_name->display_name change, use
nautilus_file_get_display_name instead of natilus_file_get_name
nautilus_file_get_display_name instead of nautilus_file_get_name
where appropriate.
* libnautilus-private/nautilus-directory-async.c:
......
......@@ -800,11 +800,11 @@ dequeue_pending_idle_callback (gpointer callback_data)
file_info = node->data;
/* Update the file count. */
/* FIXME bugzilla.gnome.org 45063: This could count a file twice if we get it
* from both load_directory and from
* new_files_callback. Not too hard to fix by moving
* this into the actual callback instead of waiting
* for the idle function.
/* FIXME bugzilla.gnome.org 45063: This could count a
* file twice if we get it from both load_directory
* and from new_files_callback. Not too hard to fix by
* moving this into the actual callback instead of
* waiting for the idle function.
*/
if (gnome_vfs_directory_filter_apply (directory->details->load_file_count_filter,
file_info)) {
......@@ -2798,29 +2798,33 @@ link_info_gmc_link_read_callback (GnomeVFSResult result,
} else {
/* Make sure we don't run off the end of the buffer. */
end_of_line = memchr (file_contents, '\n', bytes_read);
if (end_of_line != NULL) {
uri = g_strndup (file_contents, end_of_line - file_contents);
} else {
uri = g_strndup (file_contents, bytes_read);
if (end_of_line == NULL) {
end_of_line = file_contents + bytes_read;
}
uri = file_contents + strlen("URL: ");
uri = g_strndup (uri, end_of_line - uri);
path = gnome_vfs_get_local_path_from_uri (uri);
if (path != NULL) {
/* FIXME: this gnome_metata_get call is synchronous, but better to
* have it here where the results will at least be cached than in
* nautilus_file_get_display_name.
*/
res = gnome_metadata_get (path, "icon-name", &size, &name);
/* FIXME: this gnome_metata_get call is synchronous, but better to
* have it here where the results will at least be cached than in
* nautilus_file_get_display_name.
*/
res = gnome_metadata_get (path, "icon-name", &size, &name);
} else {
res = -1;
}
if (res == 0) {
if (res != 0) {
name = NULL;
}
if (path != NULL) {
/* FIXME: this gnome_metata_get call is synchronous, but better to
* have it here where the results will at least be cached than in
* nautilus_file_get_display_name.
*/
res = gnome_metadata_get (path, "icon-filename", &size, &icon_path);
} else {
res = -1;
......@@ -2833,10 +2837,11 @@ link_info_gmc_link_read_callback (GnomeVFSResult result,
icon = NULL;
}
g_free (path);
}
g_free (file_contents);
link_info_read_done (directory, uri ? uri + 5 : NULL, name, icon);
link_info_read_done (directory, uri, name, icon);
g_free (uri);
g_free (name);
g_free (icon);
......@@ -2923,8 +2928,8 @@ link_info_start (NautilusDirectory *directory,
}
/* Figure out if it is a link. */
gmc_style_link = nautilus_file_is_mime_type (file, "application/x-gmc-link") &&
nautilus_file_is_in_desktop (file);
gmc_style_link = nautilus_file_is_mime_type (file, "application/x-gmc-link")
&& nautilus_file_is_in_desktop (file);
nautilus_style_link = nautilus_file_is_nautilus_link (file);
is_directory = nautilus_file_is_directory (file);
......
This diff is collapsed.
......@@ -68,18 +68,20 @@ struct FMDirectoryViewClass {
*/
void (* clear) (FMDirectoryView *view);
/* The 'begin_adding_files' signal is emitted before a set of files
/* The 'begin_file_changes' signal is emitted before a set of files
* are added to the view. It can be replaced by a subclass to do any
* necessary preparation for a set of new files. The default
* implementation does nothing.
*/
void (* begin_adding_files) (FMDirectoryView *view);
void (* begin_file_changes) (FMDirectoryView *view);
/* The 'add_file' signal is emitted to add one file to the view.
* It must be replaced by each subclass.
*/
void (* add_file) (FMDirectoryView *view,
NautilusFile *file);
void (* remove_file) (FMDirectoryView *view,
NautilusFile *file);
/* The 'file_changed' signal is emitted to signal a change in a file,
* including the file being removed.
......@@ -88,12 +90,12 @@ struct FMDirectoryViewClass {
void (* file_changed) (FMDirectoryView *view,
NautilusFile *file);
/* The 'done_adding_files' signal is emitted after a set of files
/* The 'end_file_changes' signal is emitted after a set of files
* are added to the view. It can be replaced by a subclass to do any
* necessary cleanup (typically, cleanup for code in begin_adding_files).
* necessary cleanup (typically, cleanup for code in begin_file_changes).
* The default implementation does nothing.
*/
void (* done_adding_files) (FMDirectoryView *view);
void (* end_file_changes) (FMDirectoryView *view);
/* The 'begin_loading' signal is emitted before any of the contents
* of a directory are added to the view. It can be replaced by a
......@@ -195,14 +197,12 @@ struct FMDirectoryViewClass {
*/
void (* update_menus) (FMDirectoryView *view);
/* display_pending_files is a function pointer that subclasses can override
to have files delivered in different sized "chunks" when they arrive from
the directory model. The default directory view method will deliver
all available files at once. The list of pending files added and changed
may be modified by the subclass, to remove files that are no longer pending. */
gboolean (* display_pending_files) (FMDirectoryView *view,
GList **pending_files_added,
GList **pending_files_changed);
/* sort_files is a function pointer that subclasses can override
* to provide a sorting order to determine which files should be
* presented when only a partial list is provided.
*/
void (* sort_files) (FMDirectoryView *view,
GList **files);
/* get_emblem_names_to_exclude is a function pointer that subclasses
* may override to specify a set of emblem names that should not
......@@ -240,12 +240,12 @@ struct FMDirectoryViewClass {
* default implementation checks the permissions of the
* directory.
*/
gboolean (* is_read_only) (FMDirectoryView *view);
gboolean (* is_read_only) (FMDirectoryView *view);
/* is_empty is a function pointer that subclasses must
* override to report whether the view contains any items.
*/
gboolean (* is_empty) (FMDirectoryView *view);
gboolean (* is_empty) (FMDirectoryView *view);
/* supports_creating_files is a function pointer that subclasses may
* override to control whether or not new items can be created.
......@@ -261,9 +261,12 @@ struct FMDirectoryViewClass {
*/
gboolean (* accepts_dragged_files) (FMDirectoryView *view);
void (* start_renaming_item) (FMDirectoryView *view,
void (* start_renaming_item) (FMDirectoryView *view,
const char *uri);
gboolean (* file_still_belongs) (FMDirectoryView *view,
NautilusFile *file);
/* Preference change callbacks, overriden by icon and list views.
* Icon and list views respond by synchronizing to the new preference
* values and forcing an update if appropriate.
......
......@@ -122,7 +122,6 @@ typedef enum {
static void create_icon_container (FMIconView *icon_view);
static void fm_icon_view_initialize (FMIconView *icon_view);
static void fm_icon_view_initialize_class (FMIconViewClass *klass);
static gboolean fm_icon_view_is_empty (FMDirectoryView *view);
static void fm_icon_view_set_directory_sort_by (FMIconView *icon_view,
NautilusFile *file,
const char *sort_by);
......@@ -163,7 +162,7 @@ static void font_changed_callback (
static void smooth_font_changed_callback (gpointer callback_data);
static void icon_view_handle_uri_list (NautilusIconContainer *container,
const char *item_uris,
GdkDragAction action,
GdkDragAction action,
int x,
int y,
FMIconView *view);
......@@ -172,8 +171,8 @@ static void icon_view_handle_uri_list (
static int preview_sound_auto_value;
EEL_DEFINE_CLASS_BOILERPLATE (FMIconView,
fm_icon_view,
FM_TYPE_DIRECTORY_VIEW)
fm_icon_view,
FM_TYPE_DIRECTORY_VIEW)
/* Note that the first item in this list is the default sort,
* and that the items show up in the menu in the order they
......@@ -232,7 +231,7 @@ struct FMIconViewDetails
BonoboUIComponent *ui;
NautilusAudioPlayerData *audio_player_data;
int timeout;
int audio_preview_timeout;
NautilusFile *audio_preview_file;
};
......@@ -499,52 +498,36 @@ static void
fm_icon_view_add_file (FMDirectoryView *view, NautilusFile *file)
{
FMIconView *icon_view;
g_assert (NAUTILUS_IS_FILE (file));
NautilusIconContainer *icon_container;
icon_view = FM_ICON_VIEW (view);
if (!fm_directory_view_should_show_file (view, file)) {
return;
}
icon_container = get_icon_container (icon_view);
/* Reset scroll region for the first icon added when loading a directory. */
if (icon_view->details->loading
&& fm_icon_view_is_empty (FM_DIRECTORY_VIEW (icon_view))) {
nautilus_icon_container_reset_scroll_region (get_icon_container (icon_view));
if (icon_view->details->loading && nautilus_icon_container_is_empty (icon_container)) {
nautilus_icon_container_reset_scroll_region (icon_container);
}
if (nautilus_icon_factory_is_basic_icon_ready_for_file (file) &&
nautilus_icon_container_add (get_icon_container (icon_view),
if (nautilus_icon_container_add (icon_container,
NAUTILUS_ICON_CONTAINER_ICON_DATA (file))) {
nautilus_file_ref (file);
}
}
static void
fm_icon_view_remove_file (FMDirectoryView *view, NautilusFile *file)
{
if (nautilus_icon_container_remove (get_icon_container (FM_ICON_VIEW (view)),
NAUTILUS_ICON_CONTAINER_ICON_DATA (file))) {
nautilus_file_unref (file);
}
}
static void
fm_icon_view_file_changed (FMDirectoryView *view, NautilusFile *file)
{
gboolean removed;
/* This handles both changes to an existing file and the existing file going away. */
if (!fm_directory_view_should_show_file (view, file)
|| !nautilus_directory_contains_file (fm_directory_view_get_model (view), file)) {
removed = nautilus_icon_container_remove
(get_icon_container (FM_ICON_VIEW (view)),
NAUTILUS_ICON_CONTAINER_ICON_DATA (file));
if (removed) {
nautilus_file_unref (file);
}
} else if (nautilus_icon_factory_is_basic_icon_ready_for_file (file) &&
nautilus_icon_container_add (get_icon_container (FM_ICON_VIEW (view)),
NAUTILUS_ICON_CONTAINER_ICON_DATA (file))) {
nautilus_file_ref (file);
} else {
nautilus_icon_container_request_update
(get_icon_container (FM_ICON_VIEW (view)),
NAUTILUS_ICON_CONTAINER_ICON_DATA (file));
}
nautilus_icon_container_request_update
(get_icon_container (FM_ICON_VIEW (view)),
NAUTILUS_ICON_CONTAINER_ICON_DATA (file));
}
static void
......@@ -1540,7 +1523,7 @@ band_select_ended_callback (NautilusIconContainer *container,
/* here's the timer task that actually plays the file using mpg123. */
/* FIXME bugzilla.gnome.org 41258: we should get the application from our mime-type stuff */
static int
static gboolean
play_file (gpointer callback_data)
{
#if USE_OLD_AUDIO_PREVIEW
......@@ -1580,16 +1563,14 @@ play_file (gpointer callback_data)
g_free (file_path);
g_free (file_uri);
g_free (mime_type);
/* FIXME: Need to zero out the timeout. */
#else
char *file_path, *file_uri, *mime_type;
gboolean is_mp3;
FMIconView *icon_view;
icon_view = FM_ICON_VIEW (callback_data);
if (icon_view == NULL) {
icon_view->details->timeout = -1;
return 0;
}
file_uri = nautilus_file_get_uri (icon_view->details->audio_preview_file);
file_path = gnome_vfs_get_local_path_from_uri (file_uri);
......@@ -1605,10 +1586,10 @@ play_file (gpointer callback_data)
g_free (file_path);
g_free (mime_type);
icon_view->details->timeout = -1;
icon_view->details->audio_preview_timeout = 0;
icon_view->details->audio_preview_file = NULL;
#endif
return 0;
return FALSE;
}
/* FIXME bugzilla.gnome.org 42530: Hardcoding this here sucks. We should be using components
......@@ -1632,17 +1613,18 @@ preview_audio (FMIconView *icon_view, NautilusFile *file, gboolean start_flag)
icon_view->details->audio_player_data = NULL;
}
#endif
if (icon_view->details->timeout >= 0) {
gtk_timeout_remove (icon_view->details->timeout);
icon_view->details->timeout = -1;
if (icon_view->details->audio_preview_timeout != 0) {
gtk_timeout_remove (icon_view->details->audio_preview_timeout);
icon_view->details->audio_preview_timeout = 0;
}
if (start_flag) {
icon_view->details->audio_preview_file = file;
#if USE_OLD_AUDIO_PREVIEW
icon_view->details->timeout = gtk_timeout_add (1000, play_file, file);
icon_view->details->audio_preview_timeout = gtk_timeout_add (1000, play_file, file);
#else
icon_view->details->timeout = gtk_timeout_add (1000, play_file, icon_view);
/* FIXME: Need to kill the existing timeout if there is one? */
icon_view->details->audio_preview_timeout = gtk_timeout_add (1000, play_file, icon_view);
#endif
}
}
......@@ -1733,22 +1715,44 @@ renaming_icon_callback (NautilusIconContainer *container,
}
static int
icon_container_compare_icons_callback (NautilusIconContainer *container,
NautilusFile *file_a,
NautilusFile *file_b,
FMIconView *icon_view)
compare_files (FMIconView *icon_view,
NautilusFile *a,
NautilusFile *b)
{
g_assert (FM_IS_ICON_VIEW (icon_view));
g_assert (container == get_icon_container (icon_view));
g_assert (NAUTILUS_IS_FILE (file_a));
g_assert (NAUTILUS_IS_FILE (file_b));
return nautilus_file_compare_for_sort
(file_a, file_b, icon_view->details->sort->sort_type,
(a, b, icon_view->details->sort->sort_type,
fm_directory_view_should_sort_directories_first (FM_DIRECTORY_VIEW (icon_view)),
icon_view->details->sort_reversed);
}
static int
compare_files_cover (gconstpointer a, gconstpointer b, gpointer callback_data)
{
return compare_files (callback_data, NAUTILUS_FILE (a), NAUTILUS_FILE (b));
}
static void
fm_icon_view_sort_files (FMDirectoryView *view, GList **files)
{
FMIconView *icon_view;
icon_view = FM_ICON_VIEW (view);
if (!fm_icon_view_using_auto_layout (icon_view)) {
return;
}
*files = eel_g_list_sort_custom (*files, compare_files_cover, icon_view);
}
static int
icon_container_compare_icons_callback (NautilusIconContainer *container,
NautilusFile *a,
NautilusFile *b,
FMIconView *icon_view)
{
return compare_files (icon_view, a, b);
}
/* This is used by type-to-select code. It deliberately ignores the
* folders-first and reversed-sort settings.
*/
......@@ -2247,116 +2251,6 @@ fm_icon_view_sort_directories_first_changed (FMDirectoryView *directory_view)
/* GtkObject methods. */
static void
fm_icon_view_initialize_class (FMIconViewClass *klass)
{
GtkObjectClass *object_class;
FMDirectoryViewClass *fm_directory_view_class;
object_class = GTK_OBJECT_CLASS (klass);
fm_directory_view_class = FM_DIRECTORY_VIEW_CLASS (klass);
object_class->destroy = fm_icon_view_destroy;
fm_directory_view_class->add_file = fm_icon_view_add_file;
fm_directory_view_class->begin_loading = fm_icon_view_begin_loading;
fm_directory_view_class->end_loading = fm_icon_view_end_loading;
fm_directory_view_class->bump_zoom_level = fm_icon_view_bump_zoom_level;
fm_directory_view_class->zoom_to_level = fm_icon_view_zoom_to_level;
fm_directory_view_class->restore_default_zoom_level = fm_icon_view_restore_default_zoom_level;
fm_directory_view_class->can_zoom_in = fm_icon_view_can_zoom_in;
fm_directory_view_class->can_zoom_out = fm_icon_view_can_zoom_out;
fm_directory_view_class->get_background_widget = fm_icon_view_get_background_widget;
fm_directory_view_class->clear = fm_icon_view_clear;
fm_directory_view_class->file_changed = fm_icon_view_file_changed;
fm_directory_view_class->is_empty = fm_icon_view_is_empty;
fm_directory_view_class->get_selection = fm_icon_view_get_selection;
fm_directory_view_class->reset_to_defaults = fm_icon_view_reset_to_defaults;
fm_directory_view_class->select_all = fm_icon_view_select_all;
fm_directory_view_class->set_selection = fm_icon_view_set_selection;
fm_directory_view_class->reveal_selection = fm_icon_view_reveal_selection;
fm_directory_view_class->get_selected_icon_locations = fm_icon_view_get_selected_icon_locations;
fm_directory_view_class->merge_menus = fm_icon_view_merge_menus;
fm_directory_view_class->update_menus = fm_icon_view_update_menus;
fm_directory_view_class->start_renaming_item = fm_icon_view_start_renaming_item;
fm_directory_view_class->text_attribute_names_changed = fm_icon_view_text_attribute_names_changed;
fm_directory_view_class->embedded_text_policy_changed = fm_icon_view_embedded_text_policy_changed;
fm_directory_view_class->image_display_policy_changed = fm_icon_view_image_display_policy_changed;
fm_directory_view_class->click_policy_changed = fm_icon_view_click_policy_changed;
fm_directory_view_class->smooth_graphics_mode_changed = fm_icon_view_smooth_graphics_mode_changed;
fm_directory_view_class->sort_directories_first_changed = fm_icon_view_sort_directories_first_changed;
klass->clean_up = fm_icon_view_real_clean_up;
klass->get_directory_sort_by = fm_icon_view_real_get_directory_sort_by;
klass->set_directory_sort_by = fm_icon_view_real_set_directory_sort_by;
klass->get_directory_sort_reversed = fm_icon_view_real_get_directory_sort_reversed;
klass->set_directory_sort_reversed = fm_icon_view_real_set_directory_sort_reversed;
klass->get_directory_auto_layout = fm_icon_view_real_get_directory_auto_layout;
klass->set_directory_auto_layout = fm_icon_view_real_set_directory_auto_layout;
klass->get_directory_tighter_layout = fm_icon_view_real_get_directory_tighter_layout;
klass->set_directory_tighter_layout = fm_icon_view_real_set_directory_tighter_layout;
klass->supports_auto_layout = real_supports_auto_layout;
eel_preferences_add_auto_integer (NAUTILUS_PREFERENCES_PREVIEW_SOUND,
&preview_sound_auto_value);
}
static void
fm_icon_view_initialize (FMIconView *icon_view)
{
NautilusIconContainer *icon_container;
g_return_if_fail (GTK_BIN (icon_view)->child == NULL);
icon_view->details = g_new0 (FMIconViewDetails, 1);
icon_view->details->sort = &sort_criteria[0];
icon_view->details->audio_player_data = NULL;
icon_view->details->timeout = -1;
icon_view->details->audio_preview_file = NULL;
create_icon_container (icon_view);
icon_container = get_icon_container (icon_view);
eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_ICON_VIEW_FONT,
font_changed_callback,
icon_view,
GTK_OBJECT (icon_view));
eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_ICON_VIEW_SMOOTH_FONT,
smooth_font_changed_callback,
icon_view,
GTK_OBJECT (icon_view));
eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL_FONT_SIZE,
default_zoom_level_font_size_changed_callback,
icon_view,
GTK_OBJECT (icon_view));
eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER,
default_sort_order_changed_callback,
icon_view,
GTK_OBJECT (icon_view));
eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_SORT_IN_REVERSE_ORDER,
default_sort_in_reverse_order_changed_callback,
icon_view,
GTK_OBJECT (icon_view));
eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_USE_TIGHTER_LAYOUT,
default_use_tighter_layout_changed_callback,
icon_view,
GTK_OBJECT (icon_view));
eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_USE_MANUAL_LAYOUT,
default_use_manual_layout_changed_callback,
icon_view,
GTK_OBJECT (icon_view));
eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL,
default_zoom_level_changed_callback,
icon_view,
GTK_OBJECT (icon_view));
gtk_signal_connect (GTK_OBJECT (icon_container),
"handle_uri_list",
GTK_SIGNAL_FUNC (icon_view_handle_uri_list),
icon_view);
}
static gboolean
icon_view_can_accept_item (NautilusIconContainer *container,