summaryrefslogtreecommitdiff
path: root/libnautilus-private/nautilus-trash-file.c
diff options
context:
space:
mode:
authorDarin Adler <darin@src.gnome.org>2001-01-15 23:45:04 +0000
committerDarin Adler <darin@src.gnome.org>2001-01-15 23:45:04 +0000
commitdaee7ca55208f6e01db5f5be0839d146e7fb5c18 (patch)
tree40ef6d6f97f367e99a784951bb0f31e2d6056f03 /libnautilus-private/nautilus-trash-file.c
parent9ed2f40a2b8ca7d4af5f5bd4bcf79372181aa07d (diff)
downloadnautilus-daee7ca55208f6e01db5f5be0839d146e7fb5c18.tar.gz
Fix bug 5557 (Intermittent crash in
Nautilus_View_history_changed): * src/nautilus-view-frame.c: (send_history): Added a check for NULL so we don't try to send a NULL history list through the history machinery. Fix bug 5360 ("menthos's Home" string is hard to translate): * src/file-manager/fm-desktop-icon-view.c: (update_home_link_and_delete_copies): Added comment to help translators understand what to do with "%s's Home". Fix bug 5641 ("xfree" does not work with newer versions of RPM 4 headers): * components/services/install/lib/eazel-package-system-rpm3.c: (eazel_package_system_rpm3_packagedata_fill_from_header): Just use "free" instead of "xfree". Fix bug 5631 (Tear-offs of right-click menus don't work): * src/nautilus-shell-ui.xml: * src/file-manager/nautilus-directory-view-ui.xml: * src/file-manager/nautilus-icon-view-ui.xml: Mark popups and submenus of the popups with tearoff="0" so they don't have tear-off menu items. More work on bug 2147 (NautilusFile for trash needs non-empty values for more properties). * libnautilus-extensions/nautilus-file.h: * libnautilus-extensions/nautilus-file.c: (nautilus_file_new_from_relative_uri), (nautilus_file_new_from_info), (nautilus_file_monitor_add), (nautilus_file_monitor_remove), (nautilus_file_get_directory_item_count), (nautilus_file_get_deep_counts), (nautilus_file_check_if_ready), (nautilus_file_call_when_ready), (nautilus_file_cancel_call_when_ready): Put more of the machinery in place to make enough of NautilusFile virtual so that we can implement the trash case. * libnautilus-extensions/nautilus-merged-directory.h: * libnautilus-extensions/nautilus-merged-directory.c: (merged_add_real_directory), (nautilus_merged_directory_add_real_directory), (merged_remove_real_directory), (nautilus_merged_directory_remove_real_directory), (remove_all_real_directories), (nautilus_merged_directory_initialize_class): Make adding and removing directories use signals so we can share this list with the NautilusTrashFile. * libnautilus-extensions/nautilus-trash-file.c: (add_directory_callback), (remove_directory_callback), (nautilus_trash_file_initialize), (trash_destroy): Use a NautilusTrashDirectory object for the list of directories. * libnautilus-extensions/nautilus-vfs-file.c: (vfs_file_monitor_add), (vfs_file_monitor_remove), (vfs_file_call_when_ready), (vfs_file_cancel_call_when_ready), (vfs_file_check_if_ready), (vfs_file_get_item_count), (vfs_file_get_deep_counts), (nautilus_vfs_file_initialize_class): Move the guts of these functions into the "VFS" subclass. Other stuff: * libnautilus-extensions/nautilus-trash-directory.c: (find_directory_start), (find_directory_end), (find_directory_callback), (add_volume), (remove_trash_volume): Fix bug in the recently-added timed-wait, to handle the case where the call is cancelled as well as the case where it succeeds or fails. * src/file-manager/fm-directory-view.c: (zoomable_set_zoom_level_callback): Formatting tweak. * src/nautilus-main.c: (main): Fix the FIXME.
Diffstat (limited to 'libnautilus-private/nautilus-trash-file.c')
-rw-r--r--libnautilus-private/nautilus-trash-file.c64
1 files changed, 61 insertions, 3 deletions
diff --git a/libnautilus-private/nautilus-trash-file.c b/libnautilus-private/nautilus-trash-file.c
index 319b64591..7c5e9481f 100644
--- a/libnautilus-private/nautilus-trash-file.c
+++ b/libnautilus-private/nautilus-trash-file.c
@@ -26,9 +26,15 @@
#include <config.h>
#include "nautilus-trash-file.h"
+#include "nautilus-file-utilities.h"
#include "nautilus-gtk-macros.h"
+#include "nautilus-trash-directory.h"
+#include <gtk/gtksignal.h>
struct NautilusTrashFileDetails {
+ NautilusTrashDirectory *as_directory;
+ guint add_directory_connection_id;
+ guint remove_directory_connection_id;
};
static void nautilus_trash_file_initialize (gpointer object,
@@ -40,18 +46,70 @@ NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusTrashFile,
NAUTILUS_TYPE_FILE)
static void
+add_directory_callback (NautilusTrashDirectory *trash_directory,
+ NautilusDirectory *real_directory,
+ NautilusTrashFile *trash_file)
+{
+ g_assert (NAUTILUS_IS_TRASH_DIRECTORY (trash_directory));
+ g_assert (NAUTILUS_IS_DIRECTORY (real_directory));
+ g_assert (!NAUTILUS_IS_MERGED_DIRECTORY (real_directory));
+ g_assert (NAUTILUS_IS_TRASH_FILE (trash_file));
+ g_assert (trash_file->details->as_directory == trash_directory);
+}
+
+static void
+remove_directory_callback (NautilusTrashDirectory *trash_directory,
+ NautilusDirectory *real_directory,
+ NautilusTrashFile *trash_file)
+{
+ g_assert (NAUTILUS_IS_TRASH_DIRECTORY (trash_directory));
+ g_assert (NAUTILUS_IS_DIRECTORY (real_directory));
+ g_assert (!NAUTILUS_IS_MERGED_DIRECTORY (real_directory));
+ g_assert (NAUTILUS_IS_TRASH_FILE (trash_file));
+ g_assert (trash_file->details->as_directory == trash_directory);
+}
+
+static void
nautilus_trash_file_initialize (gpointer object, gpointer klass)
{
- NautilusTrashFile *file;
+ NautilusTrashFile *trash_file;
+ NautilusTrashDirectory *trash_directory;
+
+ trash_file = NAUTILUS_TRASH_FILE (object);
+
+ trash_directory = NAUTILUS_TRASH_DIRECTORY (nautilus_directory_get (NAUTILUS_TRASH_URI));
- file = NAUTILUS_TRASH_FILE (object);
+ trash_file->details = g_new0 (NautilusTrashFileDetails, 1);
+ trash_file->details->as_directory = trash_directory;
- file->details = g_new0 (NautilusTrashFileDetails, 1);
+ trash_file->details->add_directory_connection_id = gtk_signal_connect
+ (GTK_OBJECT (trash_directory),
+ "add_real_directory",
+ add_directory_callback,
+ trash_file);
+ trash_file->details->remove_directory_connection_id = gtk_signal_connect
+ (GTK_OBJECT (trash_directory),
+ "remove_real_directory",
+ remove_directory_callback,
+ trash_file);
}
static void
trash_destroy (GtkObject *object)
{
+ NautilusTrashFile *trash_file;
+ NautilusTrashDirectory *trash_directory;
+
+ trash_file = NAUTILUS_TRASH_FILE (object);
+ trash_directory = trash_file->details->as_directory;
+
+ gtk_signal_disconnect (GTK_OBJECT (trash_directory),
+ trash_file->details->add_directory_connection_id);
+ gtk_signal_disconnect (GTK_OBJECT (trash_directory),
+ trash_file->details->remove_directory_connection_id);
+ nautilus_directory_unref (NAUTILUS_DIRECTORY (trash_directory));
+ g_free (trash_file->details);
+
NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object));
}