Commit 4e04c0a0 authored by Alexander Larsson's avatar Alexander Larsson Committed by Alexander Larsson

Convert file attributes from list of strings to a bitmask. Patch from

2003-04-02  Alexander Larsson  <alexl@redhat.com>

	* components/notes/nautilus-notes.c:
	* components/tree/nautilus-tree-model.c:
	* components/tree/nautilus-tree-view.c:
	* libnautilus-private/nautilus-directory-async.c:
	* libnautilus-private/nautilus-directory-background.c:
	* libnautilus-private/nautilus-directory-private.h:
	* libnautilus-private/nautilus-directory.c:
	* libnautilus-private/nautilus-directory.h:
	* libnautilus-private/nautilus-file-attributes.h:
	* libnautilus-private/nautilus-file-private.h:
	* libnautilus-private/nautilus-file.c: (rename_callback),
	* libnautilus-private/nautilus-file.h:
	* libnautilus-private/nautilus-icon-factory.c:
	* libnautilus-private/nautilus-icon-factory.h:
	* libnautilus-private/nautilus-link.c:
	* libnautilus-private/nautilus-merged-directory.c:
	* libnautilus-private/nautilus-mime-actions.c:
	* libnautilus-private/nautilus-mime-actions.h:
	* libnautilus-private/nautilus-program-choosing.c:
	* libnautilus-private/nautilus-trash-file.c:
	* libnautilus-private/nautilus-trash-monitor.c:
	* libnautilus-private/nautilus-vfs-directory.c:
	* libnautilus-private/nautilus-vfs-file.c:
	* src/file-manager/fm-directory-view.c:
	* src/file-manager/fm-icon-container.c:
	* src/file-manager/fm-properties-window.c:
	* src/nautilus-applicable-views.c:
	* src/nautilus-information-panel.c:
	* src/nautilus-sidebar-title.c:
	* src/nautilus-window-manage-views.c:
	* src/nautilus-window.c:
	* test/test-nautilus-mime-actions-set.c:
	* test/test-nautilus-mime-actions.c:

	Convert file attributes from list of strings to a bitmask.
	Patch from andersca@codefactory.se.
parent 234e6a28
2003-04-02 Alexander Larsson <alexl@redhat.com>
* components/notes/nautilus-notes.c:
* components/tree/nautilus-tree-model.c:
* components/tree/nautilus-tree-view.c:
* libnautilus-private/nautilus-directory-async.c:
* libnautilus-private/nautilus-directory-background.c:
* libnautilus-private/nautilus-directory-private.h:
* libnautilus-private/nautilus-directory.c:
* libnautilus-private/nautilus-directory.h:
* libnautilus-private/nautilus-file-attributes.h:
* libnautilus-private/nautilus-file-private.h:
* libnautilus-private/nautilus-file.c: (rename_callback),
* libnautilus-private/nautilus-file.h:
* libnautilus-private/nautilus-icon-factory.c:
* libnautilus-private/nautilus-icon-factory.h:
* libnautilus-private/nautilus-link.c:
* libnautilus-private/nautilus-merged-directory.c:
* libnautilus-private/nautilus-mime-actions.c:
* libnautilus-private/nautilus-mime-actions.h:
* libnautilus-private/nautilus-program-choosing.c:
* libnautilus-private/nautilus-trash-file.c:
* libnautilus-private/nautilus-trash-monitor.c:
* libnautilus-private/nautilus-vfs-directory.c:
* libnautilus-private/nautilus-vfs-file.c:
* src/file-manager/fm-directory-view.c:
* src/file-manager/fm-icon-container.c:
* src/file-manager/fm-properties-window.c:
* src/nautilus-applicable-views.c:
* src/nautilus-information-panel.c:
* src/nautilus-sidebar-title.c:
* src/nautilus-window-manage-views.c:
* src/nautilus-window.c:
* test/test-nautilus-mime-actions-set.c:
* test/test-nautilus-mime-actions.c:
Convert file attributes from list of strings to a bitmask.
Patch from andersca@codefactory.se.
=== nautilus 2.2.3 ===
2003-03-31 Alexander Larsson <alexl@redhat.com>
......
......@@ -210,8 +210,8 @@ done_with_file (Notes *notes)
static void
notes_load_metainfo (Notes *notes)
{
GList *attributes;
NautilusFileAttributes attributes;
done_with_file (notes);
notes->file = nautilus_file_get (notes->uri);
......@@ -221,15 +221,13 @@ notes_load_metainfo (Notes *notes)
return;
}
attributes = g_list_prepend (NULL, NAUTILUS_FILE_ATTRIBUTE_METADATA);
attributes = NAUTILUS_FILE_ATTRIBUTE_METADATA;
nautilus_file_monitor_add (notes->file, notes, attributes);
if (nautilus_file_check_if_ready (notes->file, attributes)) {
load_note_text_from_metadata (notes->file, notes);
}
g_list_free (attributes);
g_signal_connect (notes->file, "changed",
G_CALLBACK (load_note_text_from_metadata), notes);
}
......
......@@ -876,22 +876,23 @@ done_loading_callback (NautilusDirectory *directory,
nautilus_file_unref (file);
}
static GList *
static NautilusFileAttributes
get_tree_monitor_attributes (void)
{
GList *attrs;
NautilusFileAttributes attributes;
attrs = nautilus_icon_factory_get_required_file_attributes ();
attrs = g_list_prepend (attrs, NAUTILUS_FILE_ATTRIBUTE_IS_DIRECTORY);
attrs = g_list_prepend (attrs, NAUTILUS_FILE_ATTRIBUTE_DISPLAY_NAME);
return attrs;
attributes = nautilus_icon_factory_get_required_file_attributes ();
attributes |= NAUTILUS_FILE_ATTRIBUTE_IS_DIRECTORY |
NAUTILUS_FILE_ATTRIBUTE_DISPLAY_NAME;
return attributes;
}
static void
start_monitoring_directory (NautilusTreeModel *model, TreeNode *node)
{
NautilusDirectory *directory;
GList *attrs;
NautilusFileAttributes attributes;
if (node->done_loading_id != 0) {
return;
......@@ -914,12 +915,11 @@ start_monitoring_directory (NautilusTreeModel *model, TreeNode *node)
set_done_loading (model, node, nautilus_directory_are_all_files_seen (directory));
attrs = get_tree_monitor_attributes ();
attributes = get_tree_monitor_attributes ();
nautilus_directory_file_monitor_add (directory, model,
model->details->show_hidden_files,
model->details->show_backup_files,
attrs, files_changed_callback, model);
g_list_free (attrs);
attributes, files_changed_callback, model);
}
static int
......@@ -1380,7 +1380,7 @@ nautilus_tree_model_set_root_uri (NautilusTreeModel *model, const char *root_uri
{
NautilusFile *file;
TreeNode *node;
GList *attrs;
NautilusFileAttributes attributes;
g_return_if_fail (model->details->root_node == NULL);
......@@ -1392,9 +1392,8 @@ nautilus_tree_model_set_root_uri (NautilusTreeModel *model, const char *root_uri
g_signal_connect_object (file, "changed",
G_CALLBACK (root_node_file_changed_callback), model, 0);
attrs = get_tree_monitor_attributes ();
nautilus_file_monitor_add (file, model, attrs);
g_list_free (attrs);
attributes = get_tree_monitor_attributes ();
nautilus_file_monitor_add (file, model, attributes);
nautilus_file_unref (file);
......
......@@ -302,7 +302,7 @@ static void
selection_changed_callback (GtkTreeSelection *selection,
NautilusTreeView *view)
{
GList *attrs;
NautilusFileAttributes attributes;
GtkTreeIter iter;
cancel_activation (view);
......@@ -316,10 +316,9 @@ selection_changed_callback (GtkTreeSelection *selection,
return;
}
attrs = g_list_prepend (NULL, NAUTILUS_FILE_ATTRIBUTE_ACTIVATION_URI);
nautilus_file_call_when_ready (view->details->activation_file, attrs,
attributes = NAUTILUS_FILE_ATTRIBUTE_ACTIVATION_URI;
nautilus_file_call_when_ready (view->details->activation_file, attributes,
got_activation_uri_callback, view);
g_list_free (attrs);
}
static int
......
......@@ -104,19 +104,19 @@ static GHashTable *async_jobs;
#endif
/* Forward declarations for functions that need them. */
static void deep_count_load (NautilusDirectory *directory,
const char *uri);
static gboolean request_is_satisfied (NautilusDirectory *directory,
NautilusFile *file,
Request *request);
static void cancel_loading_attributes (NautilusDirectory *directory,
GList *file_attributes);
static void add_all_files_to_work_queue (NautilusDirectory *directory);
static void link_info_done (NautilusDirectory *directory,
NautilusFile *file,
const char *uri,
const char *name,
const char *icon);
static void deep_count_load (NautilusDirectory *directory,
const char *uri);
static gboolean request_is_satisfied (NautilusDirectory *directory,
NautilusFile *file,
Request *request);
static void cancel_loading_attributes (NautilusDirectory *directory,
NautilusFileAttributes file_attributes);
static void add_all_files_to_work_queue (NautilusDirectory *directory);
static void link_info_done (NautilusDirectory *directory,
NautilusFile *file,
const char *uri,
const char *name,
const char *icon);
static gboolean file_needs_high_priority_work_done (NautilusDirectory *directory,
NautilusFile *file);
static gboolean file_needs_low_priority_work_done (NautilusDirectory *directory,
......@@ -505,56 +505,33 @@ remove_monitor (NautilusDirectory *directory,
void
nautilus_directory_set_up_request (Request *request,
GList *file_attributes)
NautilusFileAttributes file_attributes)
{
memset (request, 0, sizeof (*request));
request->directory_count = g_list_find_custom
(file_attributes,
NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_COUNT,
eel_strcmp_compare_func) != NULL;
request->deep_count = g_list_find_custom
(file_attributes,
NAUTILUS_FILE_ATTRIBUTE_DEEP_COUNTS,
eel_strcmp_compare_func) != NULL;
request->mime_list = g_list_find_custom
(file_attributes,
NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_MIME_TYPES,
eel_strcmp_compare_func) != NULL;
request->file_info = g_list_find_custom
(file_attributes,
NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE,
eel_strcmp_compare_func) != NULL;
request->file_info |= g_list_find_custom
(file_attributes,
NAUTILUS_FILE_ATTRIBUTE_IS_DIRECTORY,
eel_strcmp_compare_func) != NULL;
request->file_info |= g_list_find_custom
(file_attributes,
NAUTILUS_FILE_ATTRIBUTE_CAPABILITIES,
eel_strcmp_compare_func) != NULL;
request->file_info |= g_list_find_custom
(file_attributes,
NAUTILUS_FILE_ATTRIBUTE_FILE_TYPE,
eel_strcmp_compare_func) != NULL;
if (g_list_find_custom (file_attributes,
NAUTILUS_FILE_ATTRIBUTE_TOP_LEFT_TEXT,
eel_strcmp_compare_func) != NULL) {
request->directory_count = (file_attributes &
NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_COUNT) != FALSE;
request->deep_count = (file_attributes &
NAUTILUS_FILE_ATTRIBUTE_DEEP_COUNTS) != FALSE;
request->mime_list = (file_attributes &
NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_MIME_TYPES) != FALSE;
request->file_info = (file_attributes &
(NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE |
NAUTILUS_FILE_ATTRIBUTE_IS_DIRECTORY |
NAUTILUS_FILE_ATTRIBUTE_CAPABILITIES |
NAUTILUS_FILE_ATTRIBUTE_FILE_TYPE)) != FALSE;
if (file_attributes & NAUTILUS_FILE_ATTRIBUTE_TOP_LEFT_TEXT) {
request->top_left_text = TRUE;
request->file_info = TRUE;
}
if (g_list_find_custom (file_attributes,
NAUTILUS_FILE_ATTRIBUTE_ACTIVATION_URI,
eel_strcmp_compare_func) != NULL) {
if (file_attributes & NAUTILUS_FILE_ATTRIBUTE_ACTIVATION_URI) {
request->file_info = TRUE;
request->link_info = TRUE;
}
if (g_list_find_custom (file_attributes,
NAUTILUS_FILE_ATTRIBUTE_DISPLAY_NAME,
eel_strcmp_compare_func) != NULL) {
if (file_attributes & NAUTILUS_FILE_ATTRIBUTE_DISPLAY_NAME) {
request->file_info = TRUE;
request->link_info = TRUE;
}
......@@ -570,39 +547,34 @@ nautilus_directory_set_up_request (Request *request,
* directly (would need some funky char trick to prevent
* namespace collisions).
*/
if (g_list_find_custom (file_attributes,
NAUTILUS_FILE_ATTRIBUTE_CUSTOM_ICON,
eel_strcmp_compare_func) != NULL) {
if (file_attributes & NAUTILUS_FILE_ATTRIBUTE_CUSTOM_ICON) {
request->metafile = TRUE;
request->file_info = TRUE;
request->link_info = TRUE;
}
request->metafile |= g_list_find_custom
(file_attributes,
NAUTILUS_FILE_ATTRIBUTE_METADATA,
eel_strcmp_compare_func) != NULL;
request->metafile |= (file_attributes &
NAUTILUS_FILE_ATTRIBUTE_METADATA) != FALSE;
}
static void
mime_db_changed_callback (GnomeVFSMIMEMonitor *ignore, NautilusDirectory *dir)
{
const Monitor *monitor;
GList *ptr, *attrs;
NautilusFileAttributes attrs;
GList *ptr;
GList *file_list;
g_return_if_fail (dir != NULL);
g_return_if_fail (dir->details != NULL);
attrs = NULL;
attrs = g_list_prepend (attrs, NAUTILUS_FILE_ATTRIBUTE_ACTIVATION_URI);
attrs = g_list_prepend (attrs, NAUTILUS_FILE_ATTRIBUTE_CAPABILITIES);
attrs = g_list_prepend (attrs, NAUTILUS_FILE_ATTRIBUTE_CUSTOM_ICON);
attrs = g_list_prepend (attrs, NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE);
attrs = g_list_prepend (attrs, NAUTILUS_FILE_ATTRIBUTE_METADATA);
attrs = g_list_prepend (attrs, NAUTILUS_FILE_ATTRIBUTE_FILE_TYPE);
attrs = g_list_prepend (attrs, NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_MIME_TYPES);
attrs = NAUTILUS_FILE_ATTRIBUTE_ACTIVATION_URI |
NAUTILUS_FILE_ATTRIBUTE_CAPABILITIES |
NAUTILUS_FILE_ATTRIBUTE_CUSTOM_ICON |
NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE |
NAUTILUS_FILE_ATTRIBUTE_METADATA |
NAUTILUS_FILE_ATTRIBUTE_FILE_TYPE |
NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_MIME_TYPES;
file_list = NULL;
for (ptr = dir->details->monitor_list ; ptr != NULL ; ptr = ptr->next) {
......@@ -627,7 +599,6 @@ mime_db_changed_callback (GnomeVFSMIMEMonitor *ignore, NautilusDirectory *dir)
}
g_list_free (file_list);
}
g_list_free (attrs);
}
void
......@@ -636,7 +607,7 @@ nautilus_directory_monitor_add_internal (NautilusDirectory *directory,
gconstpointer client,
gboolean monitor_hidden_files,
gboolean monitor_backup_files,
GList *file_attributes,
NautilusFileAttributes file_attributes,
NautilusDirectoryCallback callback,
gpointer callback_data)
{
......@@ -1287,7 +1258,7 @@ ready_callback_call (NautilusDirectory *directory,
void
nautilus_directory_call_when_ready_internal (NautilusDirectory *directory,
NautilusFile *file,
GList *file_attributes,
NautilusFileAttributes file_attributes,
gboolean wait_for_file_list,
NautilusDirectoryCallback directory_callback,
NautilusFileCallback file_callback,
......@@ -1351,7 +1322,7 @@ nautilus_directory_call_when_ready_internal (NautilusDirectory *directory,
gboolean
nautilus_directory_check_if_ready_internal (NautilusDirectory *directory,
NautilusFile *file,
GList *file_attributes)
NautilusFileAttributes file_attributes)
{
Request request;
......@@ -2043,10 +2014,10 @@ file_list_start_or_stop (NautilusDirectory *directory)
void
nautilus_file_invalidate_count_and_mime_list (NautilusFile *file)
{
GList *attributes = NULL;
attributes = g_list_prepend (attributes, NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_COUNT);
attributes = g_list_prepend (attributes, NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_MIME_TYPES);
NautilusFileAttributes attributes;
attributes = NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_COUNT |
NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_MIME_TYPES;
nautilus_file_invalidate_attributes (file, attributes);
}
......@@ -2072,8 +2043,8 @@ nautilus_directory_invalidate_count_and_mime_list (NautilusDirectory *directory)
}
static void
nautilus_directory_invalidate_file_attributes (NautilusDirectory *directory,
GList *file_attributes)
nautilus_directory_invalidate_file_attributes (NautilusDirectory *directory,
NautilusFileAttributes file_attributes)
{
GList *node;
......@@ -2091,8 +2062,8 @@ nautilus_directory_invalidate_file_attributes (NautilusDirectory *directory,
}
void
nautilus_directory_force_reload_internal (NautilusDirectory *directory,
GList *file_attributes)
nautilus_directory_force_reload_internal (NautilusDirectory *directory,
NautilusFileAttributes file_attributes)
{
/* invalidate attributes that are getting reloaded for all files */
nautilus_directory_invalidate_file_attributes (directory, file_attributes);
......@@ -3205,7 +3176,7 @@ cancel_link_info_for_file (NautilusDirectory *directory,
static void
cancel_loading_attributes (NautilusDirectory *directory,
GList *file_attributes)
NautilusFileAttributes file_attributes)
{
Request request;
......@@ -3238,9 +3209,9 @@ cancel_loading_attributes (NautilusDirectory *directory,
}
void
nautilus_directory_cancel_loading_file_attributes (NautilusDirectory *directory,
NautilusFile *file,
GList *file_attributes)
nautilus_directory_cancel_loading_file_attributes (NautilusDirectory *directory,
NautilusFile *file,
NautilusFileAttributes file_attributes)
{
Request request;
......
......@@ -863,7 +863,6 @@ nautilus_connect_background_to_file_metadata (GtkWidget *widget,
{
EelBackground *background;
gpointer old_file;
GList *attributes;
/* Get at the background object we'll be connecting. */
background = eel_get_widget_background (widget);
......@@ -913,11 +912,9 @@ nautilus_connect_background_to_file_metadata (GtkWidget *widget,
G_CALLBACK (saved_settings_changed_callback), background, 0);
/* arrange to receive file metadata */
attributes = g_list_prepend (NULL, NAUTILUS_FILE_ATTRIBUTE_METADATA);
nautilus_file_monitor_add (file,
background,
attributes);
g_list_free (attributes);
NAUTILUS_FILE_ATTRIBUTE_METADATA);
/* arrange for notification when the theme changes */
eel_preferences_add_callback (NAUTILUS_PREFERENCES_THEME,
......
......@@ -125,14 +125,14 @@ NautilusDirectory *nautilus_directory_get_existing (const cha
void nautilus_directory_async_state_changed (NautilusDirectory *directory);
void nautilus_directory_call_when_ready_internal (NautilusDirectory *directory,
NautilusFile *file,
GList *file_attributes,
NautilusFileAttributes file_attributes,
gboolean wait_for_file_list,
NautilusDirectoryCallback directory_callback,
NautilusFileCallback file_callback,
gpointer callback_data);
gboolean nautilus_directory_check_if_ready_internal (NautilusDirectory *directory,
NautilusFile *file,
GList *file_attributes);
NautilusFileAttributes file_attributes);
void nautilus_directory_cancel_callback_internal (NautilusDirectory *directory,
NautilusFile *file,
NautilusDirectoryCallback directory_callback,
......@@ -143,7 +143,7 @@ void nautilus_directory_monitor_add_internal (NautilusD
gconstpointer client,
gboolean monitor_hidden_files,
gboolean monitor_backup_files,
GList *attributes,
NautilusFileAttributes attributes,
NautilusDirectoryCallback callback,
gpointer callback_data);
void nautilus_directory_monitor_remove_internal (NautilusDirectory *directory,
......@@ -162,10 +162,10 @@ void nautilus_directory_stop_monitoring_file_list (NautilusD
void nautilus_directory_cancel (NautilusDirectory *directory);
void nautilus_async_destroying_file (NautilusFile *file);
void nautilus_directory_force_reload_internal (NautilusDirectory *directory,
GList *file_attributes);
NautilusFileAttributes file_attributes);
void nautilus_directory_cancel_loading_file_attributes (NautilusDirectory *directory,
NautilusFile *file,
GList *file_attributes);
NautilusFileAttributes file_attributes);
/* Calls shared between directory, file, and async. code. */
void nautilus_directory_emit_files_added (NautilusDirectory *directory,
......@@ -182,7 +182,7 @@ NautilusDirectory *nautilus_directory_get_internal (const cha
gboolean create);
char * nautilus_directory_get_name_for_self_as_new_file (NautilusDirectory *directory);
void nautilus_directory_set_up_request (Request *request,
GList *file_attributes);
NautilusFileAttributes file_attributes);
/* Interface to the file list. */
NautilusFile * nautilus_directory_find_file_by_name (NautilusDirectory *directory,
......
......@@ -1246,7 +1246,7 @@ nautilus_directory_notify_files_moved (GList *uri_pairs)
GList *new_files_list, *unref_list;
GHashTable *added_lists, *changed_lists;
char *name;
GList *cancel_attributes;
NautilusFileAttributes cancel_attributes;
/* Make a list of added and changed files in each directory. */
new_files_list = NULL;
......@@ -1347,8 +1347,6 @@ nautilus_directory_notify_files_moved (GList *uri_pairs)
/* Separate handling for brand new file objects. */
nautilus_directory_notify_files_added (new_files_list);
g_list_free (new_files_list);
g_list_free (cancel_attributes);
}
void
......@@ -1520,7 +1518,7 @@ nautilus_directory_get_file_uri (NautilusDirectory *directory,
void
nautilus_directory_call_when_ready (NautilusDirectory *directory,
GList *file_attributes,
NautilusFileAttributes file_attributes,
gboolean wait_for_all_files,
NautilusDirectoryCallback callback,
gpointer callback_data)
......@@ -1552,7 +1550,7 @@ nautilus_directory_file_monitor_add (NautilusDirectory *directory,
gconstpointer client,
gboolean monitor_hidden_files,
gboolean monitor_backup_files,
GList *file_attributes,
NautilusFileAttributes file_attributes,
NautilusDirectoryCallback callback,
gpointer callback_data)
{
......@@ -1739,7 +1737,6 @@ nautilus_self_check_directory (void)
{
NautilusDirectory *directory;
NautilusFile *file;
GList *attributes;
directory = nautilus_directory_get ("file:///etc");
file = nautilus_file_get ("file:///etc/passwd");
......@@ -1748,14 +1745,12 @@ nautilus_self_check_directory (void)
nautilus_directory_file_monitor_add
(directory, &data_dummy,
TRUE, TRUE, NULL, NULL, NULL);
TRUE, TRUE, 0, NULL, NULL);
got_metadata_flag = FALSE;
attributes = g_list_prepend (NULL, NAUTILUS_FILE_ATTRIBUTE_METADATA);
nautilus_directory_call_when_ready (directory, attributes, TRUE,
nautilus_directory_call_when_ready (directory, NAUTILUS_FILE_ATTRIBUTE_METADATA, TRUE,
got_metadata_callback, &data_dummy);
g_list_free (attributes);
while (!got_metadata_flag) {
gtk_main_iteration ();
......@@ -1803,10 +1798,8 @@ nautilus_self_check_directory (void)
directory = nautilus_directory_get ("file:///etc");
got_metadata_flag = FALSE;
attributes = g_list_prepend (NULL, NAUTILUS_FILE_ATTRIBUTE_METADATA);
nautilus_directory_call_when_ready (directory, attributes, TRUE,
nautilus_directory_call_when_ready (directory, NAUTILUS_FILE_ATTRIBUTE_METADATA, TRUE,
got_metadata_callback, &data_dummy);
g_list_free (attributes);
while (!got_metadata_flag) {
gtk_main_iteration ();
......@@ -1816,11 +1809,11 @@ nautilus_self_check_directory (void)
got_files_flag = FALSE;
attributes = g_list_prepend (NULL, NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE);
attributes = g_list_prepend (attributes, NAUTILUS_FILE_ATTRIBUTE_DEEP_COUNTS);
nautilus_directory_call_when_ready (directory, attributes, TRUE,
nautilus_directory_call_when_ready (directory,
NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE |
NAUTILUS_FILE_ATTRIBUTE_DEEP_COUNTS,
TRUE,
got_files_callback, &data_dummy);
g_list_free (attributes);
while (!got_files_flag) {
gtk_main_iteration ();
......
......@@ -27,6 +27,7 @@
#include <gtk/gtkobject.h>
#include <libgnomevfs/gnome-vfs-types.h>
#include <libnautilus-private/nautilus-file-attributes.h>
/* NautilusDirectory is a class that manages the model for a directory,
real or virtual, for Nautilus, mainly the file-manager component. The directory is
......@@ -105,7 +106,7 @@ typedef struct
gboolean (* contains_file) (NautilusDirectory *directory,
NautilusFile *file);
void (* call_when_ready) (NautilusDirectory *directory,
GList *file_attributes,
NautilusFileAttributes file_attributes,
gboolean wait_for_file_list,
NautilusDirectoryCallback callback,
gpointer callback_data);
......@@ -116,7 +117,7 @@ typedef struct
gconstpointer client,
gboolean monitor_hidden_files,
gboolean monitor_backup_files,
GList *monitor_attributes,
NautilusFileAttributes monitor_attributes,
NautilusDirectoryCallback initial_files_callback,
gpointer callback_data);
void (* file_monitor_remove) (NautilusDirectory *directory,
......@@ -163,7 +164,7 @@ NautilusFile * nautilus_directory_get_corresponding_file (NautilusDirector
* The file attribute and metadata keys are for files in the directory.
*/
void nautilus_directory_call_when_ready (NautilusDirectory *directory,
GList *file_attributes,
NautilusFileAttributes file_attributes,
gboolean wait_for_all_files,
NautilusDirectoryCallback callback,
gpointer callback_data);
......@@ -177,7 +178,7 @@ void nautilus_directory_file_monitor_add (NautilusDirector
gconstpointer client,
gboolean monitor_hidden_files,
gboolean monitor_backup_files,
GList *attributes,
NautilusFileAttributes attributes,
NautilusDirectoryCallback initial_files_callback,
gpointer callback_data);
void nautilus_directory_file_monitor_remove (NautilusDirectory *directory,
......
......@@ -29,17 +29,19 @@
* interest in changes to the attributes or when waiting for them.
*/
#define NAUTILUS_FILE_ATTRIBUTE_ACTIVATION_URI "activation URI"
#define NAUTILUS_FILE_ATTRIBUTE_CAPABILITIES "capabilities"
#define NAUTILUS_FILE_ATTRIBUTE_CUSTOM_ICON "custom icon"
#define NAUTILUS_FILE_ATTRIBUTE_DEEP_COUNTS "deep counts"
#define NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_COUNT "directory item count"
#define NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_MIME_TYPES "directory item MIME types"
#define NAUTILUS_FILE_ATTRIBUTE_FILE_TYPE "file type"
#define NAUTILUS_FILE_ATTRIBUTE_IS_DIRECTORY "is directory"
#define NAUTILUS_FILE_ATTRIBUTE_METADATA "metadata"
#define NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE "MIME type"
#define NAUTILUS_FILE_ATTRIBUTE_TOP_LEFT_TEXT "top left text"
#define NAUTILUS_FILE_ATTRIBUTE_DISPLAY_NAME "display name"
typedef enum {
NAUTILUS_FILE_ATTRIBUTE_ACTIVATION_URI = 1 << 0,
NAUTILUS_FILE_ATTRIBUTE_CAPABILITIES = 1 << 1,
NAUTILUS_FILE_ATTRIBUTE_CUSTOM_ICON = 1 << 2,
NAUTILUS_FILE_ATTRIBUTE_DEEP_COUNTS = 1 << 3,
NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_COUNT = 1 << 4,
NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_MIME_TYPES = 1 << 5,
NAUTILUS_FILE_ATTRIBUTE_FILE_TYPE = 1 << 6,
NAUTILUS_FILE_ATTRIBUTE_IS_DIRECTORY = 1 << 7,
NAUTILUS_FILE_ATTRIBUTE_METADATA = 1 << 8,
NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE = 1 << 9,
NAUTILUS_FILE_ATTRIBUTE_TOP_LEFT_TEXT = 1 << 10,
NAUTILUS_FILE_ATTRIBUTE_DISPLAY_NAME = 1 << 11,
} NautilusFileAttributes;
#endif /* NAUTILUS_FILE_ATTRIBUTES_H */
......@@ -167,14 +167,14 @@ gboolean nautilus_file_should_get_top_left_text (NautilusFile
/* Mark specified attributes for this file out of date without canceling current
* I/O or kicking off new I/O.
*/
void nautilus_file_invalidate_attributes_internal (NautilusFile *file,
GList *file_attributes);
GList * nautilus_file_get_all_attributes (void);
gboolean nautilus_file_is_self_owned (NautilusFile *file);
void nautilus_file_invalidate_count_and_mime_list (NautilusFile *file);
gboolean nautilus_file_rename_in_progress (NautilusFile *file);
GnomeVFSFileInfo *nautilus_file_peek_vfs_file_info (NautilusFile *file);
void nautilus_file_invalidate_attributes_internal (NautilusFile *file,
NautilusFileAttributes file_attributes);
NautilusFileAttributes nautilus_file_get_all_attributes (void);
gboolean nautilus_file_is_self_owned (NautilusFile *file);
void nautilus_file_invalidate_count_and_mime_list (NautilusFile *file);
gboolean nautilus_file_rename_in_progress (NautilusFile *file);
GnomeVFSFileInfo * nautilus_file_peek_vfs_file_info (NautilusFile *file);
/* Thumbnailing: */
void nautilus_file_set_is_thumbnailing (NautilusFile *file,
......
......@@ -917,7 +917,6 @@ rename_callback (GnomeVFSAsyncHandle *handle,
char *old_relative_uri;
char *old_uri;
char *new_uri;
GList name_attribute = { 0, };
op = callback_data;
g_assert (handle == op->handle);
......@@ -961,9 +960,8 @@ rename_callback (GnomeVFSAsyncHandle *handle,
* and a rename affects the contents of the desktop file.
*/
if (op->file->details->display_name != NULL) {
name_attribute.data = NAUTILUS_FILE_ATTRIBUTE_DISPLAY_NAME;
nautilus_file_invalidate_attributes (op->file,
&name_attribute);
nautilus_file_invalidate_attributes (op->file,
NAUTILUS_FILE_ATTRIBUTE_DISPLAY_NAME);
}
}
operation_complete (op, result);
......@@ -1065,9 +1063,8 @@ rename_guts (NautilusFile *file,
g_free (uri);
if (success) {
GList attributes = { 0 };
attributes.data = NAUTILUS_FILE_ATTRIBUTE_DISPLAY_NAME;
nautilus_file_invalidate_attributes (file, &attributes);
nautilus_file_invalidate_attributes (file,
NAUTILUS_FILE_ATTRIBUTE_DISPLAY_NAME);
(* callback) (file, GNOME_VFS_OK, callback_data);
return;
} else {
......@@ -2401,7 +2398,7 @@ nautilus_file_get_name (NautilusFile *file)
void
nautilus_file_monitor_add (NautilusFile *file,
gconstpointer client,
GList *attributes)
NautilusFileAttributes attributes)
{
g_return_if_fail (NAUTILUS_IS_FILE (file));
g_return_if_fail (client != NULL);
......@@ -5019,13 +5016,13 @@ nautilus_file_is_not_yet_confirmed (NautilusFile *file)
* obtain the information, which might be slow network calls, e.g.
*
* @file: The file being queried.
* @file_attributes: A GList of the desired information.
* @file_attributes: A bit-mask with the desired information.
*
* Return value: TRUE if all of the specified attributes are currently readable.
*/
gboolean
nautilus_file_check_if_ready (NautilusFile *file,