From 90e07ecbf5068fb8f14462d52430eab93b2b56b2 Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: May 02 2008 11:50:12 +0000 Subject: - Mask file moving to nautilus-cd-burner window as copy operation (#443944) - Don't allow recursive move/copy into itself (gnomebz #530720) --- diff --git a/nautilus-cd-burner-move-workaround.patch b/nautilus-cd-burner-move-workaround.patch new file mode 100644 index 0000000..0eb295b --- /dev/null +++ b/nautilus-cd-burner-move-workaround.patch @@ -0,0 +1,51 @@ +Index: libnautilus-private/nautilus-file-operations.c +=================================================================== +--- libnautilus-private/nautilus-file-operations.c (revision 14109) ++++ libnautilus-private/nautilus-file-operations.c (working copy) +@@ -4651,15 +4651,45 @@ + gpointer done_callback_data) + { + GList *locations; ++ GList *p; + GFile *dest, *src_dir; + GtkWindow *parent_window; +- ++ gboolean target_is_mapping; ++ gboolean have_nonmapping_source; ++ gboolean have_nonlocal_source; ++ char *file_scheme; ++ + dest = NULL; ++ target_is_mapping = FALSE; ++ have_nonlocal_source = FALSE; ++ have_nonmapping_source = FALSE; ++ + if (target_dir) { + dest = g_file_new_for_uri (target_dir); ++ if (strncmp (target_dir, "burn", 4) == 0) { ++ target_is_mapping = TRUE; ++ } + } + locations = location_list_from_uri_list (item_uris); ++ ++ for (p = location_list_from_uri_list (item_uris); p != NULL; p = p->next) { ++ file_scheme = g_file_get_uri_scheme ((GFile *)p->data); + ++ if (strcmp (file_scheme, "file") != 0) { ++ have_nonlocal_source = TRUE; ++ } ++ ++ if (strcmp (file_scheme, "burn") != 0) { ++ have_nonmapping_source = TRUE; ++ } ++ ++ g_free (file_scheme); ++ } ++ ++ if (target_is_mapping && have_nonmapping_source && !have_nonlocal_source && (copy_action == GDK_ACTION_COPY || copy_action == GDK_ACTION_MOVE)) { ++ copy_action = GDK_ACTION_COPY; ++ } ++ + parent_window = NULL; + if (parent_view) { + parent_window = (GtkWindow *)gtk_widget_get_ancestor (parent_view, GTK_TYPE_WINDOW); diff --git a/nautilus-copymove_inside_itself.patch b/nautilus-copymove_inside_itself.patch new file mode 100644 index 0000000..128475e --- /dev/null +++ b/nautilus-copymove_inside_itself.patch @@ -0,0 +1,113 @@ +Index: libnautilus-private/nautilus-file-operations.c +=================================================================== +--- libnautilus-private/nautilus-file-operations.c (revision 14108) ++++ libnautilus-private/nautilus-file-operations.c (working copy) +@@ -3224,6 +3224,24 @@ + } + } + ++static gboolean ++g_file_struct_contains (GFile *child, GFile *root) ++{ ++ GFile *f; ++ ++ f = g_file_dup (child); ++ while (f) { ++ if (g_file_equal (f, root)) { ++ g_object_unref (f); ++ return TRUE; ++ } ++ f = g_file_get_parent (f); ++ } ++ ++ if (f) g_object_unref (f); ++ return FALSE; ++} ++ + /* Debuting files is non-NULL only for toplevel items */ + static void + copy_move_file (CopyMoveJob *copy_job, +@@ -3264,6 +3282,41 @@ + dest = get_target_file (src, dest_dir, same_fs); + } + ++ ++ /* Don't allow recursive move/copy into itself. ++ * (We would get a file system error if we proceeded but it is nicer to ++ * detect and report it at this level) */ ++ if (g_file_struct_contains (dest_dir, src)) { ++ if (job->skip_all_error) { ++ g_error_free (error); ++ goto out; ++ } ++ ++ /* the run_warning() frees all strings passed in automatically */ ++ primary = copy_job->is_move ? g_strdup (_("You cannot move a folder into itself.")) ++ : g_strdup (_("You cannot copy a folder into itself.")); ++ secondary = g_strdup (_("The destination folder is inside the source folder.")); ++ ++ response = run_warning (job, ++ primary, ++ secondary, ++ NULL, ++ GTK_STOCK_CANCEL, SKIP_ALL, SKIP, ++ NULL); ++ ++ if (response == 0 || response == GTK_RESPONSE_DELETE_EVENT) { ++ abort_job (job); ++ } else if (response == 1) { /* skip all */ ++ job->skip_all_error = TRUE; ++ } else if (response == 2) { /* skip */ ++ /* do nothing */ ++ } else { ++ g_assert_not_reached (); ++ } ++ ++ goto out; ++ } ++ + retry: + + error = NULL; +@@ -3791,6 +3844,41 @@ + + dest = get_target_file (src, dest_dir, same_fs); + ++ ++ /* Don't allow recursive move/copy into itself. ++ * (We would get a file system error if we proceeded but it is nicer to ++ * detect and report it at this level) */ ++ if (g_file_struct_contains (dest_dir, src)) { ++ if (job->skip_all_error) { ++ g_error_free (error); ++ goto out; ++ } ++ ++ /* the run_warning() frees all strings passed in automatically */ ++ primary = move_job->is_move ? g_strdup (_("You cannot move a folder into itself.")) ++ : g_strdup (_("You cannot copy a folder into itself.")); ++ secondary = g_strdup (_("The destination folder is inside the source folder.")); ++ ++ response = run_warning (job, ++ primary, ++ secondary, ++ NULL, ++ GTK_STOCK_CANCEL, SKIP_ALL, SKIP, ++ NULL); ++ ++ if (response == 0 || response == GTK_RESPONSE_DELETE_EVENT) { ++ abort_job (job); ++ } else if (response == 1) { /* skip all */ ++ job->skip_all_error = TRUE; ++ } else if (response == 2) { /* skip */ ++ /* do nothing */ ++ } else { ++ g_assert_not_reached (); ++ } ++ ++ goto out; ++ } ++ + retry: + + flags = G_FILE_COPY_NOFOLLOW_SYMLINKS | G_FILE_COPY_NO_FALLBACK_FOR_MOVE; diff --git a/nautilus.spec b/nautilus.spec index 9a670e0..66d0faf 100644 --- a/nautilus.spec +++ b/nautilus.spec @@ -19,7 +19,7 @@ Name: nautilus Summary: Nautilus is a file manager for GNOME Version: 2.23.1 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv2+ Group: User Interface/Desktops Source: http://download.gnome.org/sources/%{name}/2.23/%{name}-%{version}.tar.bz2 @@ -93,6 +93,13 @@ Patch10: nautilus-gvfs-desktop-key.patch # http://bugzilla.gnome.org/show_bug.cgi?id=528675 Patch11: nautilus-fix-open-folder.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=443944 +Patch12: nautilus-cd-burner-move-workaround.patch + +# https://bugzilla.gnome.org/show_bug.cgi?id=530720 +Patch13: nautilus-copymove_inside_itself.patch + + %description Nautilus integrates access to files, applications, media, Internet-based resources and the Web. Nautilus delivers a dynamic and @@ -131,6 +138,8 @@ for writing nautilus extensions. %patch9 -p0 -b .fix-autorun %patch10 -p0 -b .gvfs-desktop-key %patch11 -p1 -b .fix-open-folder +%patch12 -p0 -b .cd-burner +%patch13 -p0 -b .recurse %build @@ -243,6 +252,10 @@ fi %changelog +* Fri May 2 2008 Tomas Bzatek - 2.23.1-3 +- Mask file moving to nautilus-cd-burner window as copy operation (#443944) +- Don't allow recursive move/copy into itself (gnomebz #530720) + * Thu Apr 24 2008 Tomas Bzatek - 2.23.1-2 - Add SELinux patch (gnomebz #529694)