diff options
author | Pavel Cisler <pavel@eazel.com> | 2000-08-02 14:16:08 +0000 |
---|---|---|
committer | Pavel Cisler <pce@src.gnome.org> | 2000-08-02 14:16:08 +0000 |
commit | 21c6cffaaa57ff5d361af64e4cdefe256d6345e6 (patch) | |
tree | 2563d694e7321d85b2577dae4fe23b626263344a /libnautilus-private | |
parent | 8797b6dce9c41af8c569188a3e30e2f0ee9e6d74 (diff) | |
download | nautilus-21c6cffaaa57ff5d361af64e4cdefe256d6345e6.tar.gz |
Bugzilla bug 1400
2000-08-02 Pavel Cisler <pavel@eazel.com>
Bugzilla bug 1400
* libnautilus-extensions/nautilus-directory.c:
* libnautilus-extensions/nautilus-directory.h:
(any_non_metafile_item),
(nautilus_directory_is_not_empty):
Added a call I needed to check a directory empty state.
* src/file-manager/Makefile.am:
* src/file-manager/nautilus-trash-monitor.h:
* src/file-manager/nautilus-trash-monitor.c:
(nautilus_trash_monitor_initialize_class),
(nautilus_trash_files_changed_callback),
(nautilus_trash_metadata_ready_callback),
(nautilus_trash_monitor_initialize), (nautilus_trash_monitor_get),
(nautilus_trash_monitor_shutdown):
New trash state monitoring class, used to update the Trash icon, etc.
* src/file-manager/fm-directory-view.c:
(bonobo_menu_empty_trash_callback), (fm_directory_view_initialize),
(fm_directory_view_trash_or_delete_selection),
(trash_state_changed_callback):
Hook up to the Trash monitor change signal.
Tweak the callback Gene prepared for me earlier that updates the
Trash icon to use the new signal.
* src/file-manager/fm-directory-view.c:
(finish_loading_uri):
Tiny tweak - use a cover call instead of emitting a signal directly.
Diffstat (limited to 'libnautilus-private')
-rw-r--r-- | libnautilus-private/nautilus-directory.c | 36 | ||||
-rw-r--r-- | libnautilus-private/nautilus-directory.h | 5 |
2 files changed, 40 insertions, 1 deletions
diff --git a/libnautilus-private/nautilus-directory.c b/libnautilus-private/nautilus-directory.c index 4afc89c53..5b57d2d54 100644 --- a/libnautilus-private/nautilus-directory.c +++ b/libnautilus-private/nautilus-directory.c @@ -493,7 +493,7 @@ nautilus_directory_is_search_directory (NautilusDirectory *directory) nautilus_strcasecmp (info->mime_type, "x-special/virtual-directory") == 0; gnome_vfs_file_info_unref (info); - + return is_search_directory; #endif } @@ -1028,6 +1028,40 @@ nautilus_directory_file_monitor_remove (NautilusDirectory *directory, nautilus_directory_monitor_remove_internal (directory, NULL, client); } +static int +any_non_metafile_item (gconstpointer item, gconstpointer data) +{ + /* A metafile is exactly what we are not looking for, anything else is a match. */ + return nautilus_file_matches_uri (NAUTILUS_FILE (item), (const char *)data) ? 1 : 0; +} + +gboolean +nautilus_directory_is_not_empty (NautilusDirectory *directory) +{ + char *metafile_uri_string; + gboolean result; + + g_return_val_if_fail (NAUTILUS_IS_DIRECTORY (directory), FALSE); + + /* directory must be monitored for this call to be correct */ + g_assert (nautilus_directory_is_file_list_monitored (directory)); + + if (directory->details->metafile_uri == NULL) { + /* we don't have a metafile - we're not empty if we have at least one file */ + return directory->details->files != NULL; + } + + metafile_uri_string = gnome_vfs_uri_to_string (directory->details->metafile_uri, + GNOME_VFS_URI_HIDE_NONE); + + /* Return TRUE if the directory contains anything besides a metafile. */ + result = g_list_find_custom (directory->details->files, + metafile_uri_string, any_non_metafile_item) != NULL; + + g_free (metafile_uri_string); + return result; +} + #if !defined (NAUTILUS_OMIT_SELF_CHECK) #include "nautilus-debug.h" diff --git a/libnautilus-private/nautilus-directory.h b/libnautilus-private/nautilus-directory.h index dcb059160..7abf9e41e 100644 --- a/libnautilus-private/nautilus-directory.h +++ b/libnautilus-private/nautilus-directory.h @@ -163,6 +163,11 @@ gboolean nautilus_directory_is_local (NautilusDirectory gboolean nautilus_directory_is_search_directory (NautilusDirectory *directory); +/* Return false if directory contains anything besides a nautilus metafile. + * Only valid if directory is monitored. + * Used by the Trash monitor + */ +gboolean nautilus_directory_is_not_empty (NautilusDirectory *directory); typedef struct NautilusDirectoryDetails NautilusDirectoryDetails; |