Commit 0605af88 authored by Darin Adler's avatar Darin Adler

reviewed by: John Sullivan <sullivan@eazel.com>

	Fixed bug 6163 (Need NautilusViewFrame ::
	report_location_changed). This is re-adding a feature we also had
	long ago, where a view reports a location change, but does not
	want the location change to come back to it in the form of a
	load_location call.

	* src/nautilus-applicable-views.h:
	* src/nautilus-applicable-views.c:
	(get_view_result_from_gnome_vfs_result), (got_file_info_callback),
	(got_minimum_file_info_callback),
	(nautilus_determine_initial_view),
	(nautilus_determine_initial_view_cancel): Changed this entire file
	to have a much easier-to-understand API.

	* src/nautilus-view-frame-private.h:
	* src/nautilus-view-frame-corba.c: (free_location_plus_callback):
	Change existing structure so it can be used for the location-change
	case, which includes a title too.
	(open_force_new_window): Use new structure.
	(report_location_change): Implement new call.
	(impl_Nautilus_ViewFrame_open_location_force_new_window): Use new
	structure.
	(impl_Nautilus_ViewFrame_report_location_change): Implement new
	call.

	* libnautilus/nautilus-view-component.idl: Add the new call.
	* libnautilus/nautilus-view.h:
	* libnautilus/nautilus-view.c:
	(nautilus_view_report_location_change): Add the new call.

	* src/nautilus-view-frame.h:
	* src/nautilus-view-frame.c:
	(nautilus_view_frame_initialize_class): Add new signal.
	(nautilus_view_frame_report_location_change): Implement new call.

	* src/nautilus-window-private.h:
	* src/nautilus-window-manage-views.h:
	* src/nautilus-window-manage-views.c: (update_for_new_location):
	Got rid of obsolete assert. Also, no longer clear the selection.
	The selection is set properly earlier, and clearing it at this
	point serves no purpose.
	(location_has_really_changed): Call free_location_change to share
	more code. Also no reason to free "pending_ni" any more, because
	we don't keep it around in the success case.
	(load_new_location_in_one_view): New name.
	(load_new_location_in_sidebar_panels): New name. Also take a
	parameter of a view to skip.
	(load_new_location_in_all_views): New function.
	(set_to_pending_location_and_selection): New name, and removed
	code to handle the case where there is no pending location, since
	that doesn't happen. Also take a parameter of a view to skip. Also
	broke out the guts into load_new_location_in_all_views.
	(free_location_change): Free things by their new names. There's
	also less to free now.
	(cancel_location_change): Key off pending_location instead of
	pending_ni. Also save code by using new function that skips a
	view.
	(determined_initial_view_callback): Changed name, and use new
	interface. No longer need "end_reached" trick, because the new
	interface handles that.
	(begin_location_change): Made a static after moving all the
	functions that use it in here. Also moved some of the reload
	code out into nautilus_window_reload.
	(report_location_change_callback): New function. Does all the
	steps neede for a location change in place.
	(nautilus_window_back_or_forward), (nautilus_window_reload): Moved
	these two functions in here from nautilus-window.c so we could
	make begin_location_change more private.

	* src/nautilus-window.h:
	* src/nautilus-window.c: (nautilus_window_go_to): Changed the name.
	(nautilus_window_get_location): New function for callers that used
	to get the location field directly.
	(go_to_callback): Changed name.

	* src/nautilus-desktop-window.c: (nautilus_desktop_window_new):
	* src/nautilus-location-bar.c: (drag_data_received_callback):
	* src/nautilus-shell.c: (open_window), (save_window_states),
	(restore_window_states):
	* src/nautilus-window-menus.c: (services_button_callback),
	(help_menu_nautilus_manual_callback),
	(help_menu_nautilus_license_callback),
	(help_menu_nautilus_feedback_callback),
	(activate_bookmark_in_menu_item):
	* src/nautilus-window-service-ui.c: (goto_services_summary),
	(goto_online_storage), (goto_software_catalog),
	(goto_services_support):
	* src/nautilus-window.c: (location_change_at_idle_callback),
	(nautilus_window_constructed), (view_as_menu_vfs_method_callback),
	(nautilus_window_go_web_search), (nautilus_window_go_home):
	Use nautilus_go_to under its new name.

	* src/nautilus-shell.c: (restore_window_states): Use
	nautilus_istr_has_prefix instead of g_strncasecmp. Also did other
	code cleanup.

	* libnautilus-extensions/nautilus-gtk-extensions.h: Added a new
	marshal function that I needed.

	* libnautilus-extensions/nautilus-thumbnails.c: Added a FIXME.

	* libnautilus-extensions/nautilus-view-identifier.h:
	* libnautilus-extensions/nautilus-view-identifier.c:
	(nautilus_view_identifier_copy),
	(nautilus_view_identifier_compare): Use const.

	* src/nautilus-application.c: (nautilus_application_startup): Only
	check for root if we are actually running nautilus, not if we are
	just killing off an existing copy.
	(confirm_ok_to_run_as_root): Changed name of the function and
	improved the wording of the message and button. Also added an
	environment variable you can set to get rid of this. (Probably
	should have been a preference instead, but I am officially being
	lazy about this.)

	Fixed bug that was revealed by the change in the loading sequence
	I made. John didn't review this part:

	* libnautilus-extensions/nautilus-directory-private.h:
	* libnautilus-extensions/nautilus-directory-async.c:
	(load_directory_state_destroy), (load_directory_done):
	Separate out code to free the partly-done state so it can
	be used in the cancel case.
	(dequeue_pending_idle_callback): Ref the directory object
	so that we won't get messed up if the callback destroys it.
	(directory_load_cancel): Separated out the old part of
	file_list_cancel so that we can cancel the idle part too
	when we want to.
	(file_list_cancel): Use the new calls to cancel the idle
	part of directory loading.
	(directory_load_done): Use directory_load_cancel instead of
	file_list_cancel.
	(nautilus_directory_stop_monitoring_file_list): Use
	directory_load_cancel instead of file_list_cancel.
	(nautilus_directory_async_state_changed): Added state variables to
	protect cases where we re-enter this function.
parent cf9df316
2001-02-02 Darin Adler <darin@eazel.com>
reviewed by: John Sullivan <sullivan@eazel.com>
Fixed bug 6163 (Need NautilusViewFrame ::
report_location_changed). This is re-adding a feature we also had
long ago, where a view reports a location change, but does not
want the location change to come back to it in the form of a
load_location call.
* src/nautilus-applicable-views.h:
* src/nautilus-applicable-views.c:
(get_view_result_from_gnome_vfs_result), (got_file_info_callback),
(got_minimum_file_info_callback),
(nautilus_determine_initial_view),
(nautilus_determine_initial_view_cancel): Changed this entire file
to have a much easier-to-understand API.
* src/nautilus-view-frame-private.h:
* src/nautilus-view-frame-corba.c: (free_location_plus_callback):
Change existing structure so it can be used for the location-change
case, which includes a title too.
(open_force_new_window): Use new structure.
(report_location_change): Implement new call.
(impl_Nautilus_ViewFrame_open_location_force_new_window): Use new
structure.
(impl_Nautilus_ViewFrame_report_location_change): Implement new
call.
* libnautilus/nautilus-view-component.idl: Add the new call.
* libnautilus/nautilus-view.h:
* libnautilus/nautilus-view.c:
(nautilus_view_report_location_change): Add the new call.
* src/nautilus-view-frame.h:
* src/nautilus-view-frame.c:
(nautilus_view_frame_initialize_class): Add new signal.
(nautilus_view_frame_report_location_change): Implement new call.
* src/nautilus-window-private.h:
* src/nautilus-window-manage-views.h:
* src/nautilus-window-manage-views.c: (update_for_new_location):
Got rid of obsolete assert. Also, no longer clear the selection.
The selection is set properly earlier, and clearing it at this
point serves no purpose.
(location_has_really_changed): Call free_location_change to share
more code. Also no reason to free "pending_ni" any more, because
we don't keep it around in the success case.
(load_new_location_in_one_view): New name.
(load_new_location_in_sidebar_panels): New name. Also take a
parameter of a view to skip.
(load_new_location_in_all_views): New function.
(set_to_pending_location_and_selection): New name, and removed
code to handle the case where there is no pending location, since
that doesn't happen. Also take a parameter of a view to skip. Also
broke out the guts into load_new_location_in_all_views.
(free_location_change): Free things by their new names. There's
also less to free now.
(cancel_location_change): Key off pending_location instead of
pending_ni. Also save code by using new function that skips a
view.
(determined_initial_view_callback): Changed name, and use new
interface. No longer need "end_reached" trick, because the new
interface handles that.
(begin_location_change): Made a static after moving all the
functions that use it in here. Also moved some of the reload
code out into nautilus_window_reload.
(report_location_change_callback): New function. Does all the
steps neede for a location change in place.
(nautilus_window_back_or_forward), (nautilus_window_reload): Moved
these two functions in here from nautilus-window.c so we could
make begin_location_change more private.
* src/nautilus-window.h:
* src/nautilus-window.c: (nautilus_window_go_to): Changed the name.
(nautilus_window_get_location): New function for callers that used
to get the location field directly.
(go_to_callback): Changed name.
* src/nautilus-desktop-window.c: (nautilus_desktop_window_new):
* src/nautilus-location-bar.c: (drag_data_received_callback):
* src/nautilus-shell.c: (open_window), (save_window_states),
(restore_window_states):
* src/nautilus-window-menus.c: (services_button_callback),
(help_menu_nautilus_manual_callback),
(help_menu_nautilus_license_callback),
(help_menu_nautilus_feedback_callback),
(activate_bookmark_in_menu_item):
* src/nautilus-window-service-ui.c: (goto_services_summary),
(goto_online_storage), (goto_software_catalog),
(goto_services_support):
* src/nautilus-window.c: (location_change_at_idle_callback),
(nautilus_window_constructed), (view_as_menu_vfs_method_callback),
(nautilus_window_go_web_search), (nautilus_window_go_home):
Use nautilus_go_to under its new name.
* src/nautilus-shell.c: (restore_window_states): Use
nautilus_istr_has_prefix instead of g_strncasecmp. Also did other
code cleanup.
* libnautilus-extensions/nautilus-gtk-extensions.h: Added a new
marshal function that I needed.
* libnautilus-extensions/nautilus-thumbnails.c: Added a FIXME.
* libnautilus-extensions/nautilus-view-identifier.h:
* libnautilus-extensions/nautilus-view-identifier.c:
(nautilus_view_identifier_copy),
(nautilus_view_identifier_compare): Use const.
* src/nautilus-application.c: (nautilus_application_startup): Only
check for root if we are actually running nautilus, not if we are
just killing off an existing copy.
(confirm_ok_to_run_as_root): Changed name of the function and
improved the wording of the message and button. Also added an
environment variable you can set to get rid of this. (Probably
should have been a preference instead, but I am officially being
lazy about this.)
Fixed bug that was revealed by the change in the loading sequence
I made. John didn't review this part:
* libnautilus-extensions/nautilus-directory-private.h:
* libnautilus-extensions/nautilus-directory-async.c:
(load_directory_state_destroy), (load_directory_done):
Separate out code to free the partly-done state so it can
be used in the cancel case.
(dequeue_pending_idle_callback): Ref the directory object
so that we won't get messed up if the callback destroys it.
(directory_load_cancel): Separated out the old part of
file_list_cancel so that we can cancel the idle part too
when we want to.
(file_list_cancel): Use the new calls to cancel the idle
part of directory loading.
(directory_load_done): Use directory_load_cancel instead of
file_list_cancel.
(nautilus_directory_stop_monitoring_file_list): Use
directory_load_cancel instead of file_list_cancel.
(nautilus_directory_async_state_changed): Added state variables to
protect cases where we re-enter this function.
2001-02-02 Ramiro Estrugo <ramiro@eazel.com>
reviewed by: Michael Engber <engber@eazel.com>
......@@ -349,14 +490,14 @@
reviewed by: Pavel Cisler <pavel@eazel.com>
Fixed bug 6941, 'Clean Up By Name' feature on the desktop keep switching
file locations after being 'cleaned up'
Fixed bug 6941, 'Clean Up By Name' feature on the desktop keep
switching file locations after being 'cleaned up'
* src/file-manager/fm-desktop-icon-view.c:
(desktop_icons_compare_callback):
In the case of identical links tpyes, compare by name.
More work on gmc transtion tool
More work on gmc transition tool
* src/nautilus-first-time-druid.c:
(druid_finished):
......
......@@ -1166,7 +1166,7 @@ get_filter_options_for_directory_count (void)
}
static void
load_directory_done (NautilusDirectory *directory)
load_directory_state_destroy (NautilusDirectory *directory)
{
NautilusFile *file;
......@@ -1189,7 +1189,12 @@ load_directory_done (NautilusDirectory *directory)
gnome_vfs_directory_filter_destroy (directory->details->load_file_count_filter);
directory->details->load_file_count_filter = NULL;
}
static void
load_directory_done (NautilusDirectory *directory)
{
load_directory_state_destroy (directory);
nautilus_directory_async_state_changed (directory);
}
......@@ -1205,6 +1210,8 @@ dequeue_pending_idle_callback (gpointer callback_data)
directory = NAUTILUS_DIRECTORY (callback_data);
nautilus_directory_ref (directory);
directory->details->dequeue_pending_idle_id = 0;
/* Handle the files in the order we saw them. */
......@@ -1215,6 +1222,7 @@ dequeue_pending_idle_callback (gpointer callback_data)
if (!nautilus_directory_is_file_list_monitored (directory)) {
gnome_vfs_file_info_list_free (pending_file_info);
load_directory_done (directory);
nautilus_directory_unref (directory);
return FALSE;
}
......@@ -1315,6 +1323,8 @@ dequeue_pending_idle_callback (gpointer callback_data)
/* Get the state machine running again. */
nautilus_directory_async_state_changed (directory);
nautilus_directory_unref (directory);
return FALSE;
}
......@@ -1343,7 +1353,7 @@ directory_load_one (NautilusDirectory *directory,
}
static void
file_list_cancel (NautilusDirectory *directory)
directory_load_cancel (NautilusDirectory *directory)
{
if (directory->details->directory_load_in_progress != NULL) {
gnome_vfs_async_cancel (directory->details->directory_load_in_progress);
......@@ -1352,13 +1362,31 @@ file_list_cancel (NautilusDirectory *directory)
}
}
static void
file_list_cancel (NautilusDirectory *directory)
{
directory_load_cancel (directory);
if (directory->details->dequeue_pending_idle_id != 0) {
gtk_idle_remove (directory->details->dequeue_pending_idle_id);
directory->details->dequeue_pending_idle_id = 0;
}
if (directory->details->pending_file_info != NULL) {
gnome_vfs_file_info_list_free (directory->details->pending_file_info);
directory->details->pending_file_info = NULL;
}
load_directory_state_destroy (directory);
}
static void
directory_load_done (NautilusDirectory *directory,
GnomeVFSResult result)
{
GList *node;
file_list_cancel (directory);
directory_load_cancel (directory);
directory->details->directory_loaded = TRUE;
directory->details->directory_loaded_sent_notification = FALSE;
......@@ -1408,10 +1436,9 @@ directory_load_callback (GnomeVFSAsyncHandle *handle,
directory_load_one (directory, element->data);
}
if (nautilus_directory_file_list_length_reached (directory) ||
result != GNOME_VFS_OK) {
directory_load_done (directory,
result);
if (nautilus_directory_file_list_length_reached (directory)
|| result != GNOME_VFS_OK) {
directory_load_done (directory, result);
}
}
......@@ -2133,7 +2160,7 @@ nautilus_directory_stop_monitoring_file_list (NautilusDirectory *directory)
}
directory->details->file_list_monitored = FALSE;
file_list_cancel (directory);
directory_load_cancel (directory);
nautilus_file_list_unref (directory->details->file_list);
directory->details->directory_loaded = FALSE;
}
......@@ -3147,11 +3174,22 @@ nautilus_directory_async_state_changed (NautilusDirectory *directory)
* I/O state again so that we can release or cancel I/O that
* is not longer needed once the callbacks are satisfied.
*/
if (directory->details->in_async_service_loop) {
directory->details->state_changed = TRUE;
return;
}
directory->details->in_async_service_loop = TRUE;
nautilus_directory_ref (directory);
do {
directory->details->state_changed = FALSE;
start_or_stop_io (directory);
} while (call_ready_callbacks (directory));
if (call_ready_callbacks (directory)) {
directory->details->state_changed = TRUE;
}
} while (directory->details->state_changed);
nautilus_directory_unref (directory);
directory->details->in_async_service_loop = FALSE;
/* Check if any directories should wake up. */
async_job_wake_up ();
......
......@@ -68,6 +68,9 @@ struct NautilusDirectoryDetails
GList *call_when_ready_list;
GList *monitor_list;
gboolean in_async_service_loop;
gboolean state_changed;
gboolean file_list_monitored;
gboolean directory_loaded;
gboolean directory_loaded_sent_notification;
......
......@@ -173,6 +173,7 @@ GList *nautilus_get_window_list_ordered_front_to_back (void);
#define nautilus_gtk_marshal_NONE__BOXED_BOXED gtk_marshal_NONE__POINTER_POINTER
#define nautilus_gtk_marshal_NONE__POINTER_STRING_STRING nautilus_gtk_marshal_NONE__POINTER_POINTER_POINTER
#define nautilus_gtk_marshal_NONE__STRING_POINTER gtk_marshal_NONE__POINTER_POINTER
#define nautilus_gtk_marshal_NONE__STRING_POINTER_STRING gtk_marshal_NONE__POINTER_POINTER_POINTER
#define nautilus_gtk_marshal_BOOL__POINTER_POINTER nautilus_gtk_marshal_INT__POINTER_POINTER
#define nautilus_gtk_marshal_INT__POINTER_STRING nautilus_gtk_marshal_INT__POINTER_POINTER
#define nautilus_gtk_marshal_POINTER__POINTER_STRING_POINTER nautilus_gtk_marshal_POINTER__POINTER_POINTER_POINTER
......
......@@ -225,6 +225,10 @@ compare_thumbnail_info (gconstpointer a, gconstpointer b)
/* utility to create a placeholder thumbnail uri (which indicates that a
* previous thumbnailing attempt has failed)
*/
/* FIXME: A .x extension might exist on a real file, and we might
* recognize it by magic number even if it doesn't have the right
* extension.
*/
static char *
make_invalid_thumbnail_uri (const char *thumbnail_uri)
{
......
......@@ -46,7 +46,7 @@ nautilus_view_identifier_new (const char *iid, const char *name)
}
NautilusViewIdentifier *
nautilus_view_identifier_copy (NautilusViewIdentifier *identifier)
nautilus_view_identifier_copy (const NautilusViewIdentifier *identifier)
{
if (identifier == NULL) {
return NULL;
......@@ -197,7 +197,8 @@ nautilus_view_identifier_list_free (GList *list)
}
int
nautilus_view_identifier_compare (NautilusViewIdentifier *a, NautilusViewIdentifier *b)
nautilus_view_identifier_compare (const NautilusViewIdentifier *a,
const NautilusViewIdentifier *b)
{
int result;
......@@ -206,4 +207,4 @@ nautilus_view_identifier_compare (NautilusViewIdentifier *a, NautilusViewIdentif
return result;
}
return strcmp (a->name, b->name);
}
}
......@@ -32,18 +32,18 @@ typedef struct {
char *name; /* human-readable name */
} NautilusViewIdentifier;
NautilusViewIdentifier *nautilus_view_identifier_new (const char *iid,
const char *name);
NautilusViewIdentifier *nautilus_view_identifier_new_from_oaf_server_info (OAF_ServerInfo *server,
char *name_attribute);
NautilusViewIdentifier *nautilus_view_identifier_new_from_content_view (OAF_ServerInfo *server);
NautilusViewIdentifier *nautilus_view_identifier_new_from_sidebar_panel (OAF_ServerInfo *server);
NautilusViewIdentifier *nautilus_view_identifier_copy (NautilusViewIdentifier *identifier);
void nautilus_view_identifier_free (NautilusViewIdentifier *identifier);
int nautilus_view_identifier_compare (NautilusViewIdentifier *a,
NautilusViewIdentifier *b);
NautilusViewIdentifier *nautilus_view_identifier_new (const char *iid,
const char *name);
NautilusViewIdentifier *nautilus_view_identifier_new_from_oaf_server_info (OAF_ServerInfo *server,
char *name_attribute);
NautilusViewIdentifier *nautilus_view_identifier_new_from_content_view (OAF_ServerInfo *server);
NautilusViewIdentifier *nautilus_view_identifier_new_from_sidebar_panel (OAF_ServerInfo *server);
NautilusViewIdentifier *nautilus_view_identifier_copy (const NautilusViewIdentifier *identifier);
void nautilus_view_identifier_free (NautilusViewIdentifier *identifier);
int nautilus_view_identifier_compare (const NautilusViewIdentifier *a,
const NautilusViewIdentifier *b);
/* lists of NautilusViewIdentifier */
GList * nautilus_view_identifier_list_copy (GList *list);
void nautilus_view_identifier_list_free (GList *list);
GList * nautilus_view_identifier_list_copy (GList *list);
void nautilus_view_identifier_list_free (GList *list);
#endif /* NAUTILUS_VIEW_IDENTIFIER */
......@@ -1166,7 +1166,7 @@ get_filter_options_for_directory_count (void)
}
static void
load_directory_done (NautilusDirectory *directory)
load_directory_state_destroy (NautilusDirectory *directory)
{
NautilusFile *file;
......@@ -1189,7 +1189,12 @@ load_directory_done (NautilusDirectory *directory)
gnome_vfs_directory_filter_destroy (directory->details->load_file_count_filter);
directory->details->load_file_count_filter = NULL;
}
static void
load_directory_done (NautilusDirectory *directory)
{
load_directory_state_destroy (directory);
nautilus_directory_async_state_changed (directory);
}
......@@ -1205,6 +1210,8 @@ dequeue_pending_idle_callback (gpointer callback_data)
directory = NAUTILUS_DIRECTORY (callback_data);
nautilus_directory_ref (directory);
directory->details->dequeue_pending_idle_id = 0;
/* Handle the files in the order we saw them. */
......@@ -1215,6 +1222,7 @@ dequeue_pending_idle_callback (gpointer callback_data)
if (!nautilus_directory_is_file_list_monitored (directory)) {
gnome_vfs_file_info_list_free (pending_file_info);
load_directory_done (directory);
nautilus_directory_unref (directory);
return FALSE;
}
......@@ -1315,6 +1323,8 @@ dequeue_pending_idle_callback (gpointer callback_data)
/* Get the state machine running again. */
nautilus_directory_async_state_changed (directory);
nautilus_directory_unref (directory);
return FALSE;
}
......@@ -1343,7 +1353,7 @@ directory_load_one (NautilusDirectory *directory,
}
static void
file_list_cancel (NautilusDirectory *directory)
directory_load_cancel (NautilusDirectory *directory)
{
if (directory->details->directory_load_in_progress != NULL) {
gnome_vfs_async_cancel (directory->details->directory_load_in_progress);
......@@ -1352,13 +1362,31 @@ file_list_cancel (NautilusDirectory *directory)
}
}
static void
file_list_cancel (NautilusDirectory *directory)
{
directory_load_cancel (directory);
if (directory->details->dequeue_pending_idle_id != 0) {
gtk_idle_remove (directory->details->dequeue_pending_idle_id);
directory->details->dequeue_pending_idle_id = 0;
}
if (directory->details->pending_file_info != NULL) {
gnome_vfs_file_info_list_free (directory->details->pending_file_info);
directory->details->pending_file_info = NULL;
}
load_directory_state_destroy (directory);
}
static void
directory_load_done (NautilusDirectory *directory,
GnomeVFSResult result)
{
GList *node;
file_list_cancel (directory);
directory_load_cancel (directory);
directory->details->directory_loaded = TRUE;
directory->details->directory_loaded_sent_notification = FALSE;
......@@ -1408,10 +1436,9 @@ directory_load_callback (GnomeVFSAsyncHandle *handle,
directory_load_one (directory, element->data);
}
if (nautilus_directory_file_list_length_reached (directory) ||
result != GNOME_VFS_OK) {
directory_load_done (directory,
result);
if (nautilus_directory_file_list_length_reached (directory)
|| result != GNOME_VFS_OK) {
directory_load_done (directory, result);
}
}
......@@ -2133,7 +2160,7 @@ nautilus_directory_stop_monitoring_file_list (NautilusDirectory *directory)
}
directory->details->file_list_monitored = FALSE;
file_list_cancel (directory);
directory_load_cancel (directory);
nautilus_file_list_unref (directory->details->file_list);
directory->details->directory_loaded = FALSE;
}
......@@ -3147,11 +3174,22 @@ nautilus_directory_async_state_changed (NautilusDirectory *directory)
* I/O state again so that we can release or cancel I/O that
* is not longer needed once the callbacks are satisfied.
*/
if (directory->details->in_async_service_loop) {
directory->details->state_changed = TRUE;
return;
}
directory->details->in_async_service_loop = TRUE;
nautilus_directory_ref (directory);
do {
directory->details->state_changed = FALSE;
start_or_stop_io (directory);
} while (call_ready_callbacks (directory));
if (call_ready_callbacks (directory)) {
directory->details->state_changed = TRUE;
}
} while (directory->details->state_changed);
nautilus_directory_unref (directory);
directory->details->in_async_service_loop = FALSE;
/* Check if any directories should wake up. */
async_job_wake_up ();
......
......@@ -68,6 +68,9 @@ struct NautilusDirectoryDetails
GList *call_when_ready_list;
GList *monitor_list;
gboolean in_async_service_loop;
gboolean state_changed;
gboolean file_list_monitored;
gboolean directory_loaded;
gboolean directory_loaded_sent_notification;
......
......@@ -173,6 +173,7 @@ GList *nautilus_get_window_list_ordered_front_to_back (void);
#define nautilus_gtk_marshal_NONE__BOXED_BOXED gtk_marshal_NONE__POINTER_POINTER
#define nautilus_gtk_marshal_NONE__POINTER_STRING_STRING nautilus_gtk_marshal_NONE__POINTER_POINTER_POINTER
#define nautilus_gtk_marshal_NONE__STRING_POINTER gtk_marshal_NONE__POINTER_POINTER
#define nautilus_gtk_marshal_NONE__STRING_POINTER_STRING gtk_marshal_NONE__POINTER_POINTER_POINTER
#define nautilus_gtk_marshal_BOOL__POINTER_POINTER nautilus_gtk_marshal_INT__POINTER_POINTER
#define nautilus_gtk_marshal_INT__POINTER_STRING nautilus_gtk_marshal_INT__POINTER_POINTER
#define nautilus_gtk_marshal_POINTER__POINTER_STRING_POINTER nautilus_gtk_marshal_POINTER__POINTER_POINTER_POINTER
......
......@@ -225,6 +225,10 @@ compare_thumbnail_info (gconstpointer a, gconstpointer b)
/* utility to create a placeholder thumbnail uri (which indicates that a
* previous thumbnailing attempt has failed)
*/
/* FIXME: A .x extension might exist on a real file, and we might
* recognize it by magic number even if it doesn't have the right
* extension.
*/
static char *
make_invalid_thumbnail_uri (const char *thumbnail_uri)
{
......
......@@ -46,7 +46,7 @@ nautilus_view_identifier_new (const char *iid, const char *name)
}
NautilusViewIdentifier *
nautilus_view_identifier_copy (NautilusViewIdentifier *identifier)
nautilus_view_identifier_copy (const NautilusViewIdentifier *identifier)
{
if (identifier == NULL) {
return NULL;
......@@ -197,7 +197,8 @@ nautilus_view_identifier_list_free (GList *list)
}
int
nautilus_view_identifier_compare (NautilusViewIdentifier *a, NautilusViewIdentifier *b)
nautilus_view_identifier_compare (const NautilusViewIdentifier *a,
const NautilusViewIdentifier *b)
{
int result;
......@@ -206,4 +207,4 @@ nautilus_view_identifier_compare (NautilusViewIdentifier *a, NautilusViewIdentif
return result;
}
return strcmp (a->name, b->name);
}
}
......@@ -32,18 +32,18 @@ typedef struct {
char *name; /* human-readable name */
} NautilusViewIdentifier;
NautilusViewIdentifier *nautilus_view_identifier_new (const char *iid,
const char *name);
NautilusViewIdentifier *nautilus_view_identifier_new_from_oaf_server_info (OAF_ServerInfo *server,
char *name_attribute);
NautilusViewIdentifier *nautilus_view_identifier_new_from_content_view (OAF_ServerInfo *server);
NautilusViewIdentifier *nautilus_view_identifier_new_from_sidebar_panel (OAF_ServerInfo *server);
NautilusViewIdentifier *nautilus_view_identifier_copy (NautilusViewIdentifier *identifier);
void nautilus_view_identifier_free (NautilusViewIdentifier *identifier);
int nautilus_view_identifier_compare (NautilusViewIdentifier *a,
NautilusViewIdentifier *b);
NautilusViewIdentifier *nautilus_view_identifier_new (const char *iid,
const char *name);
NautilusViewIdentifier *nautilus_view_identifier_new_from_oaf_server_info (OAF_ServerInfo *server,
char *name_attribute);
NautilusViewIdentifier *nautilus_view_identifier_new_from_content_view (OAF_ServerInfo *server);
NautilusViewIdentifier *nautilus_view_identifier_new_from_sidebar_panel (OAF_ServerInfo *server);
NautilusViewIdentifier *nautilus_view_identifier_copy (const NautilusViewIdentifier *identifier);
void nautilus_view_identifier_free (NautilusViewIdentifier *identifier);
int nautilus_view_identifier_compare (const NautilusViewIdentifier *a,
const NautilusViewIdentifier *b);
/* lists of NautilusViewIdentifier */
GList * nautilus_view_identifier_list_copy (GList *list);
void nautilus_view_identifier_list_free (GList *list);
GList * nautilus_view_identifier_list_copy (GList *list);
void nautilus_view_identifier_list_free (GList *list);
#endif /* NAUTILUS_VIEW_IDENTIFIER */
......@@ -95,6 +95,20 @@ module Nautilus {
oneway void open_location_force_new_window (in URI location,
in URIList selection);
/* Called by a view component when the location
* changes, but the view component is handling it
* directly. This differs from
* "open_location_in_this_window" in that it
* understands that the same component is reused, and
* also it treats the load as "already underway" and
* does not send a "load_location",
* "selection_changed", or "title_changed" to the view
* that initiates this.
*/
oneway void report_location_change (in URI location,
in URIList selection,
in string title);
/* Called by a view component to announce a change in the
* selection. This selection change will be reported back
* to the original view along with the others.
......
......@@ -528,6 +528,26 @@ nautilus_view_open_location_force_new_window (NautilusView *view,
view_frame_call_end (view_frame, &ev);
}
void
nautilus_view_report_location_change (NautilusView *view,
const char *location,
GList *selection,
const char *title)
{
CORBA_Environment ev;
Nautilus_ViewFrame view_frame;
Nautilus_URIList *uri_list;
view_frame = view_frame_call_begin (view, &ev);
if (view_frame != CORBA_OBJECT_NIL) {
uri_list = nautilus_uri_list_from_g_list (selection);
Nautilus_ViewFrame_report_location_change
(view_frame, (CORBA_char *) location, uri_list, (CORBA_char *) title, &ev);
CORBA_free (uri_list);
}
view_frame_call_end (view_frame, &ev);
}
void
nautilus_view_report_selection_change (NautilusView *view,
GList *selection)
......
......@@ -74,6 +74,10 @@ void nautilus_view_open_location_prefer_existing_window (NautilusV
void nautilus_view_open_location_force_new_window (NautilusView *view,
const char *location_uri,
GList *selection); /* list of URI char *s */
void nautilus_view_report_location_change (NautilusView *view,
const char *location_uri,
GList *selection, /* list of URI char *s */
const char *title);
void nautilus_view_report_selection_change (NautilusView *view,
GList *selection); /* list of URI char *s */
void nautilus_view_report_status (NautilusView *view,
......
......@@ -4,7 +4,7 @@
* Nautilus
*
* Copyright (C) 1999, 2000 Red Hat, Inc.
* Copyright (C) 2000 Eazel, Inc.
* Copyright (C) 2000, 2001 Eazel, Inc.
*
* Nautilus is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
......@@ -22,6 +22,7 @@
*
* Authors: Elliot Lee <sopwith@redhat.com>
* Maciej Stachowiak <mjs@eazel.com>
* Darin Adler <darin@eazel.com>
*
*/
......@@ -34,59 +35,46 @@
#include <config.h>
#include "nautilus-applicable-views.h"
#include <ctype.h>
#include <dirent.h>
#include <libgnomevfs/gnome-vfs-async-ops.h>
#include <libgnomevfs/gnome-vfs-file-info.h>
#include <libgnomevfs/gnome-vfs-result.h>
#include <libnautilus-extensions/nautilus-directory.h>
#include <libnautilus-extensions/nautilus-file-attributes.h>
#include <libnautilus-extensions/nautilus-file.h>
#include <libnautilus-extensions/nautilus-glib-extensions.h>
#include <libnautilus-extensions/nautilus-global-preferences.h>
#include <libnautilus-extensions/nautilus-metadata.h>
#include <libnautilus-extensions/nautilus-mime-actions.h>
#include <libnautilus-extensions/nautilus-string.h>
#include <libnautilus-extensions/nautilus-view-identifier.h>
#include <limits.h>
#include <string.h>
#include <sys/types.h>
struct NautilusNavigationInfo {
NautilusNavigationCallback callback;
struct NautilusDetermineViewHandle {
NautilusDetermineViewHandle **early_completion_hook;
NautilusDetermineViewCallback callback;
gpointer callback_data;
char *location;
NautilusFile *file;
NautilusDirectory *directory;
NautilusViewIdentifier *initial_content_id;
GnomeVFSAsyncHandle *handle;
};
static NautilusNavigationResult
get_nautilus_navigation_result_from_gnome_vfs_result (GnomeVFSResult gnome_vfs_result)
static NautilusDetermineViewResult
get_view_result_from_gnome_vfs_result (GnomeVFSResult gnome_vfs_result)