static void
desktop_directory_file_call_when_ready (NautilusFile *file,
					NautilusFileAttributes attributes,
					NautilusFileCallback callback,
					gpointer callback_data)

{
	NautilusDesktopDirectoryFile *desktop_file;
	DesktopCallback search_key, *desktop_callback;

	desktop_file = NAUTILUS_DESKTOP_DIRECTORY_FILE (file);

	/* Check to be sure we aren't overwriting. */
	search_key.callback = callback;
	search_key.callback_data = callback_data;
	if (g_hash_table_lookup (desktop_file->details->callbacks, &search_key) != NULL) {
		g_warning ("tried to add a new callback while an old one was pending");
		return;
	}

	/* Create a desktop_callback record. */
	desktop_callback = g_new0 (DesktopCallback, 1);
	nautilus_file_ref (file);
	desktop_callback->desktop_file = desktop_file;
	desktop_callback->callback = callback;
	desktop_callback->callback_data = callback_data;
	desktop_callback->initializing = TRUE;

	partition_attributes (attributes,
			      &desktop_callback->delegated_attributes,
			      &desktop_callback->non_delegated_attributes);

	desktop_callback->non_ready_files = g_list_prepend
		(desktop_callback->non_ready_files, file);
	desktop_callback->non_ready_files = g_list_prepend
		(desktop_callback->non_ready_files, desktop_file->details->real_dir_file);
	
	/* Put it in the hash table. */
	g_hash_table_insert (desktop_file->details->callbacks,
			     desktop_callback, desktop_callback);

	/* Now connect to each file's call_when_ready. */
	nautilus_directory_call_when_ready_internal
		(file->details->directory, file,
		 desktop_callback->non_delegated_attributes,
		 FALSE, NULL, ready_callback, desktop_callback);
	nautilus_file_call_when_ready
			(desktop_file->details->real_dir_file,
			 desktop_callback->delegated_attributes,
			 ready_callback, desktop_callback);

	desktop_callback->initializing = FALSE;

	/* Check if any files became read while we were connecting up
	 * the call_when_ready callbacks (also handles the pathological
	 * case where there are no files at all).
	 */
	desktop_callback_check_done (desktop_callback);

}
Ejemplo n.º 2
0
static void
desktop_call_when_ready (NautilusDirectory *directory,
			 NautilusFileAttributes file_attributes,
			 gboolean wait_for_file_list,
			 NautilusDirectoryCallback callback,
			 gpointer callback_data)
{
	NautilusDesktopDirectory *desktop;
	MergedCallback search_key, *merged_callback;

	desktop = NAUTILUS_DESKTOP_DIRECTORY (directory);

	/* Check to be sure we aren't overwriting. */
	search_key.callback = callback;
	search_key.callback_data = callback_data;
	if (g_hash_table_lookup (desktop->details->callbacks, &search_key) != NULL) {
		g_warning ("tried to add a new callback while an old one was pending");
		return;
	}

	/* Create a merged_callback record. */
	merged_callback = g_new0 (MergedCallback, 1);
	merged_callback->desktop_dir = desktop;
	merged_callback->callback = callback;
	merged_callback->callback_data = callback_data;
	merged_callback->wait_for_attributes = file_attributes;
	merged_callback->wait_for_file_list = wait_for_file_list;
	merged_callback->non_ready_directories = g_list_prepend
			(merged_callback->non_ready_directories, directory);
	merged_callback->non_ready_directories = g_list_prepend
			(merged_callback->non_ready_directories, desktop->details->real_directory);


	merged_callback->merged_file_list = g_list_concat (NULL,
							   nautilus_file_list_copy (directory->details->file_list));

	/* Put it in the hash table. */
	g_hash_table_insert (desktop->details->callbacks,
			     merged_callback, merged_callback);

	/* Now tell all the directories about it. */
	nautilus_directory_call_when_ready
		(desktop->details->real_directory,
		 merged_callback->wait_for_attributes,
		 merged_callback->wait_for_file_list,
		 directory_ready_callback, merged_callback);
	nautilus_directory_call_when_ready_internal
		(directory,
		 NULL,
		 merged_callback->wait_for_attributes,
		 merged_callback->wait_for_file_list,
		 directory_ready_callback,
		 NULL,
		 merged_callback);
	
}
Ejemplo n.º 3
0
static void
vfs_file_call_when_ready (NautilusFile           *file,
                          NautilusFileAttributes  file_attributes,
                          NautilusFileCallback    callback,
                          gpointer                callback_data)
{
    nautilus_directory_call_when_ready_internal
        (file->details->directory, file,
        file_attributes, FALSE, NULL, callback, callback_data);
}
static void
vfs_call_when_ready (NautilusDirectory *directory,
		     NautilusFileAttributes file_attributes,
		     gboolean wait_for_file_list,
		     NautilusDirectoryCallback callback,
		     gpointer callback_data)
{
	g_assert (NAUTILUS_IS_VFS_DIRECTORY (directory));

	nautilus_directory_call_when_ready_internal
		(directory,
		 NULL,
		 file_attributes,
		 wait_for_file_list,
		 callback,
		 NULL,
		 callback_data);
}