nautilus/libnautilus-extensions/nautilus-directory-private.h
Darin Adler 08b617282b No parameters is indicated by "(void)" instead of "()".
* components/help/help-method.c: (help_uri_new): No parameters
	is indicated by "(void)" instead of "()".
	(help_uri_to_string): Changed to share more code (I think I might
	have fixed a leak too).
	(init_help_module): No parameters is indicated by "(void)"
	instead of "()". Also fixed a bug where the wrong lock is unlocked.
	(convert_file_to_uri): Use g_strcasecmp instead of strcmp since we
	are checking MIME types.
	(transform_file), (transform_absolute_file), (file_from_path),
	(find_help_file), (transform_relative_file): Merged these so they
	share a lot of common code.

	* components/services/vault/command-line/vault-operations.c:
	(vault_list): Fixed a g_strconcat that was missing a trailing NULL.

	* libnautilus-extensions/nautilus-directory-private.h:
	* libnautilus-extensions/nautilus-file-attributes.h:
	* libnautilus-extensions/nautilus-directory-async.c:
	(cancel_top_left_read), (top_left_read_done),
	(top_left_read_callback), (top_left_read_more_callback),
	(start_getting_top_lefts), Changed top_left code to use
	nautilus_read_file calls.
	(cancel_metafile_read),
	Changed to reflect name changes in nautilus_read_file calls.
	(cancel_get_activation_uri), (nautilus_directory_cancel),
	(set_up_request_by_file_attributes),
	(nautilus_async_destroying_file), (lacks_activation_uri),
	(wants_activation_uri), (request_is_satisfied),
	(activation_uri_found),
	(activation_uri_nautilus_link_read_callback),
	(activation_uri_gmc_link_read_callback),
	(activation_uri_gmc_link_read_more_callback),
	(start_getting_activation_uris),
	(nautilus_directory_async_state_changed): Add code to fetch
	activation URIs for either GMC or Nautilus-style link files.
	(lacks_top_left): Changed to share common
	nautilus_file_should_get_top_left_text function so we don't have
	lots of different code reading the preferences about top-left
	text.
	(is_needy): Enhanced and renamed is_wanted so it takes into
	account files that are and aren't interesting.
	(start_getting_directory_counts), (deep_count_start):
	(start_getting_file_info), Change to use is_needy.

	* libnautilus-extensions/nautilus-directory.h:
	* libnautilus-extensions/nautilus-directory.c:
	Tweaked spacing.

	* libnautilus-extensions/nautilus-file-private.h:
	Added a self_owned flag so we do better with files that don't have
	parent directories and the fields to support activation_uri.

	* libnautilus-extensions/nautilus-file-utilities.h:
	* libnautilus-extensions/nautilus-file-utilities.c:
	(read_file_close_callback), (read_file_close),
	(read_file_succeeded), (read_file_failed),
	(read_file_read_callback), (read_file_read_chunk),
	(read_file_open_callback), (nautilus_read_file_async),
	(nautilus_read_entire_file_async), (nautilus_read_file_cancel):
	Added a variation of the read file call that takes a function to
	decide whether to keep reading or not.

	* libnautilus-extensions/nautilus-file.h:
	* libnautilus-extensions/nautilus-file.c:
	(nautilus_file_new_from_name), (nautilus_file_get),
	(nautilus_file_get_parent_uri_as_string),
	(get_file_for_parent_directory), (nautilus_file_rename),
	(nautilus_file_get_gnome_vfs_uri),
	(nautilus_file_get_uri),
	Add code that handles the "self_owned" flag to make files without
	parents work better.
	(destroy): Fixed some leaks I noticed.
	(nautilus_file_get_top_left_text),
	(nautilus_file_should_get_top_left_text): Added this so that all
	code can share a single call when deciding whether to get text
	based on local vs. non-local.
	(nautilus_file_get_activation_uri): Changed to work with new
	async. code to fetch this.

	* libnautilus-extensions/nautilus-icon-factory.c:
	(nautilus_icon_factory_get_icon_for_file): Call
	nautilus_file_should_get_top_left_text.

	* libnautilus-extensions/nautilus-link.h:
	* libnautilus-extensions/nautilus-link.c:
	(nautilus_link_is_link_file_name): Named so it's clear it looks
	at the file name only.
	(xml_get_root_property), (nautilus_link_get_root_property):
	Added these to share a lot of common code.
	(nautilus_link_get_additional_text): Use the new calls.
	(make_local_path), (icon_read_done_callback),
	(nautilus_link_get_image_uri), (nautilus_link_get_link_uri),
	(nautilus_link_get_display_name): Other cleanup and rewrite.
	(nautilus_link_get_link_uri_given_file_contents): Add API that
	can work with the async. I/O version.

	* libnautilus-extensions/nautilus-stock-dialogs.c:
	(timed_wait_free), (nautilus_timed_wait_start):
	Added some asserts.

	* src/file-manager/fm-directory-view.c: (activate_callback),
	(fm_directory_view_activate_file): Use call_when_ready and
	the new async. stuff.

	* src/file-manager/fm-error-reporting.c:
	(fm_report_error_setting_group): Added a (low-quality) error
	message for the case where you aren't alowed to change the
	group of something.

	* src/file-manager/fm-icon-view.c:
	(icon_position_changed_callback): Added missing NULL in a call
	to g_strconcat.
	(get_icon_text_callback): Fix storage leak.

	* src/file-manager/fm-properties-window.c:
	(activate_owner_callback): Fixed a timed_wait_start/stop mismatch
	that was causing an assert and other badness when you changed the
	owner.

	* src/file-manager/fm-search-list-view.c:
	(get_attribute_from_column): Added a missing case to prevent a
	crash, but had to put in a FIXME since the code isn't really working.

	* src/nautilus-application.c: (nautilus_application_startup):
	Fixed bug where you wouldn't see error messages on startup.  Also
	improved one of the error messages by adding some blank lines.
2000-07-26 03:07:30 +00:00

165 lines
7 KiB
C

/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
nautilus-directory-private.h: Nautilus directory model.
Copyright (C) 1999, 2000 Eazel, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public
License along with this program; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Author: Darin Adler <darin@eazel.com>
*/
#include "nautilus-directory.h"
#include <libgnomevfs/gnome-vfs-types.h>
#include <libgnomevfs/gnome-vfs-uri.h>
#include <libgnomevfs/gnome-vfs-file-info.h>
#include <tree.h>
#include "nautilus-file.h"
#include "nautilus-file-utilities.h"
typedef struct ActivationURIReadState ActivationURIReadState;
typedef struct MetafileWriteState MetafileWriteState;
typedef struct TopLeftTextReadState TopLeftTextReadState;
struct NautilusDirectoryDetails
{
/* The location. */
char *uri_text;
GnomeVFSURI *uri;
GnomeVFSURI *metafile_uri;
GnomeVFSURI *alternate_metafile_uri;
/* The file objects. */
GList *files;
/* The metadata. */
gboolean metafile_read;
xmlDoc *metafile;
GHashTable *metadata_changes;
/* State for reading and writing metadata. */
gboolean use_alternate_metafile;
NautilusReadFileHandle *metafile_read_handle;
guint write_metafile_idle_id;
MetafileWriteState *metafile_write_state;
/* These lists are going to be pretty short. If we think they
* are going to get big, we can use hash tables instead.
*/
GList *call_when_ready_list;
GList *monitor_list;
gboolean file_list_monitored;
gboolean directory_loaded;
gboolean directory_loaded_sent_notification;
GnomeVFSAsyncHandle *directory_load_in_progress;
GnomeVFSDirectoryListPosition directory_load_list_last_handled;
GList *pending_file_info; /* list of GnomeVFSFileInfo's that are pending */
guint dequeue_pending_idle_id;
GList *get_file_infos_in_progress; /* list of GnomeVFSAsyncHandle * */
GnomeVFSAsyncHandle *count_in_progress;
NautilusFile *count_file;
NautilusFile *deep_count_file;
GnomeVFSAsyncHandle *deep_count_in_progress;
char *deep_count_uri;
GnomeVFSDirectoryListPosition deep_count_last_handled;
GList *deep_count_subdirectories;
GnomeVFSAsyncHandle *get_info_in_progress;
NautilusFile *get_info_file;
TopLeftTextReadState *top_left_read_state;
ActivationURIReadState *activation_uri_read_state;
GList *file_operations_in_progress; /* list of FileOperation * */
};
typedef struct {
char *from_uri;
char *to_uri;
} URIPair;
/* Almost-public change notification calls */
void nautilus_directory_notify_files_added (GList *uris);
void nautilus_directory_notify_files_moved (GList *uri_pairs);
void nautilus_directory_notify_files_removed (GList *uris);
/* async. interface */
void nautilus_directory_async_state_changed (NautilusDirectory *directory);
void nautilus_directory_call_when_ready_internal (NautilusDirectory *directory,
NautilusFile *file,
GList *file_attributes,
gboolean monitor_metadata,
NautilusDirectoryCallback directory_callback,
NautilusFileCallback file_callback,
gpointer callback_data);
gboolean nautilus_directory_check_if_ready_internal (NautilusDirectory *directory,
NautilusFile *file,
GList *file_attributes);
void nautilus_directory_cancel_callback_internal (NautilusDirectory *directory,
NautilusFile *file,
NautilusDirectoryCallback directory_callback,
NautilusFileCallback file_callback,
gpointer callback_data);
void nautilus_directory_monitor_add_internal (NautilusDirectory *directory,
NautilusFile *file,
gconstpointer client,
GList *attributes,
gboolean monitor_metadata,
NautilusDirectoryCallback callback,
gpointer callback_data);
void nautilus_directory_monitor_remove_internal (NautilusDirectory *directory,
NautilusFile *file,
gconstpointer client);
void nautilus_directory_get_info_for_new_files (NautilusDirectory *directory,
GList *vfs_uris);
gboolean nautilus_directory_is_file_list_monitored (NautilusDirectory *directory);
void nautilus_directory_remove_file_monitor_link (NautilusDirectory *directory,
GList *link);
void nautilus_directory_request_read_metafile (NautilusDirectory *directory);
void nautilus_directory_request_write_metafile (NautilusDirectory *directory);
void nautilus_directory_schedule_dequeue_pending (NautilusDirectory *directory);
void nautilus_directory_stop_monitoring_file_list (NautilusDirectory *directory);
void nautilus_directory_cancel (NautilusDirectory *directory);
void nautilus_metafile_write_start (NautilusDirectory *directory);
void nautilus_async_destroying_file (NautilusFile *file);
void nautilus_directory_force_reload (NautilusDirectory *directory);
/* Calls shared between directory, file, and async. code. */
NautilusFile *nautilus_directory_find_file (NautilusDirectory *directory,
const char *file_name);
void nautilus_directory_emit_metadata_changed (NautilusDirectory *directory);
void nautilus_directory_emit_files_added (NautilusDirectory *directory,
GList *added_files);
void nautilus_directory_emit_files_changed (NautilusDirectory *directory,
GList *changed_files);
void nautilus_directory_emit_done_loading (NautilusDirectory *directory);
/* debugging functions */
int nautilus_directory_number_outstanding (void);
/* Shared functions not directly related to NautilusDirectory/File. */
int nautilus_compare_file_with_name (gconstpointer a,
gconstpointer b);