summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarin Adler <darin@src.gnome.org>2000-12-14 23:17:36 +0000
committerDarin Adler <darin@src.gnome.org>2000-12-14 23:17:36 +0000
commitced5102634eb3d547531b7d800b8ba694c2336f0 (patch)
tree8bc61a2e06a55631572260d171e5a0fd9e1aff51
parent7d699bbccc04b34e180ffd6d832f3de0ed5f8b95 (diff)
downloadnautilus-ced5102634eb3d547531b7d800b8ba694c2336f0.tar.gz
reviewed by: John Sullivan <sullivan@eazel.com>
Fix bug 2807 (support metadata removal for cases where we move/delete files) by implementing metadata removal. Fix bug 2199 (Saved icon positions ruin desktop layout features) by testing and fixing other bugs now that metadata removal is implemented. Fix bug 5164 (exception trying to drag file) by fixing a few placeholders in XML files that were still transparent and should not be. Fix bug where we don't reveal the New Folder icon (reintroduced by my changes yesterday) by computing the icon position in a way that works even before the canvas item is updated. * libnautilus-extensions/nautilus-directory-metafile.c: (get_file_node): Small change (not used for now) that might help unify the "before metafile is read" case with the code after the metafile is read. (nautilus_directory_rename_file_metadata): Remove the old file metadata before renaming the new data. Also change code to avoid looking up things in the hash table twice. (nautilus_directory_copy_file_metadata): Updated and added FIXME comments. (nautilus_directory_remove_file_metadata): Add code to remove metadata, similar to the existing rename code. * libnautilus-extensions/nautilus-directory.c: (nautilus_directory_schedule_metadata_copy), (nautilus_directory_schedule_metadata_move), (nautilus_directory_schedule_metadata_remove): Fix code that was using file names instead of relative URIs (essentially escaped file names). This code was missed when we made the switchover. Without this, changes to files with spaces in their names didn't update metadata properly. * libnautilus-extensions/nautilus-file-operations.c: (build_error_string): Added blank line between the intro sentence and the rest of the error message. (handle_xfer_overwrite): Added blank line between the intro sentence and the rest of the error message. (sync_xfer_callback): Fix metadata code to remove the metadata when creating a new file, just as it copies metadata when copying a file. This change helps the New Folder case, but requires a fix in gnome-vfs to set the top level boolean for the New Folder case. (handle_new_folder_vfs_error): Added blank line between the intro sentence and the rest of the error message. (nautilus_self_check_file_operations): Changed the self-check to use the standard way of testing functions that return text instead of rolling its own. * libnautilus-extensions/nautilus-gnome-extensions.h: * libnautilus-extensions/nautilus-gnome-extensions.c: (nautilus_gnome_canvas_item_get_canvas_bounds): Added a function that's like nautilus_gnome_canvas_item_get_current_canvas_bounds but is accurate even before the icon is updated. * libnautilus-extensions/nautilus-icon-container.c: (reveal_icon): Use nautilus_gnome_canvas_item_get_canvas_bounds instead of nautilus_gnome_canvas_item_get_current_canvas_bounds. Fixes the bug I reintroduced where New Folder icons would not be revealed. * libnautilus-extensions/nautilus-xml-extensions.h: * libnautilus-extensions/nautilus-xml-extensions.c: (nautilus_xml_remove_node): Add a remove-node function. This is needed because gnome-xml doesn't have xmlRemoveNode implemented. This implementation is not quite complete, but probably good enough for our purposes. A complete implementation might have to have some handling for removing the root node and perhaps some stuff to remove unused namespaces. Maybe this can be rolled into gnome-xml. * src/file-manager/nautilus-directory-view-ui.xml: * src/nautilus-shell-ui.xml: Added some more delimit="none" entries to make it so that the actual placeholder definitions are not "transparent". * libnautilus-extensions/nautilus-glib-extensions.c (nautilus_self_check_glib_extensions): Marked some strings that are part of a test translatable since the result might be different in some locales. Translating the strings to the right result makes "make check" work properly in that locale.
-rw-r--r--ChangeLog87
-rw-r--r--libnautilus-extensions/nautilus-directory-metafile.c89
-rw-r--r--libnautilus-extensions/nautilus-directory.c35
-rw-r--r--libnautilus-extensions/nautilus-file-operations.c213
-rw-r--r--libnautilus-extensions/nautilus-glib-extensions.c15
-rw-r--r--libnautilus-extensions/nautilus-gnome-extensions.c12
-rw-r--r--libnautilus-extensions/nautilus-gnome-extensions.h113
-rw-r--r--libnautilus-extensions/nautilus-icon-container.c10
-rw-r--r--libnautilus-extensions/nautilus-xml-extensions.c30
-rw-r--r--libnautilus-extensions/nautilus-xml-extensions.h1
-rw-r--r--libnautilus-private/nautilus-directory-metafile.c89
-rw-r--r--libnautilus-private/nautilus-directory.c35
-rw-r--r--libnautilus-private/nautilus-file-operations.c213
-rw-r--r--libnautilus-private/nautilus-glib-extensions.c15
-rw-r--r--libnautilus-private/nautilus-gnome-extensions.c12
-rw-r--r--libnautilus-private/nautilus-gnome-extensions.h113
-rw-r--r--libnautilus-private/nautilus-icon-container.c10
-rw-r--r--libnautilus-private/nautilus-xml-extensions.c30
-rw-r--r--libnautilus-private/nautilus-xml-extensions.h1
-rw-r--r--src/file-manager/nautilus-directory-view-ui.xml4
-rw-r--r--src/nautilus-shell-ui.xml2
21 files changed, 684 insertions, 445 deletions
diff --git a/ChangeLog b/ChangeLog
index 545d31a0f..c20b7c5b2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,90 @@
+2000-12-14 Darin Adler <darin@eazel.com>
+
+ reviewed by: John Sullivan <sullivan@eazel.com>
+
+ Fix bug 2807 (support metadata removal for cases where we
+ move/delete files) by implementing metadata removal.
+
+ Fix bug 2199 (Saved icon positions ruin desktop layout features)
+ by testing and fixing other bugs now that metadata removal is
+ implemented.
+
+ Fix bug 5164 (exception trying to drag file) by fixing a few
+ placeholders in XML files that were still transparent and should
+ not be.
+
+ Fix bug where we don't reveal the New Folder icon (reintroduced by
+ my changes yesterday) by computing the icon position in a way that
+ works even before the canvas item is updated.
+
+ * libnautilus-extensions/nautilus-directory-metafile.c:
+ (get_file_node): Small change (not used for now) that might
+ help unify the "before metafile is read" case with the code
+ after the metafile is read.
+ (nautilus_directory_rename_file_metadata): Remove the old
+ file metadata before renaming the new data. Also change code
+ to avoid looking up things in the hash table twice.
+ (nautilus_directory_copy_file_metadata): Updated and added
+ FIXME comments.
+ (nautilus_directory_remove_file_metadata): Add code to
+ remove metadata, similar to the existing rename code.
+
+ * libnautilus-extensions/nautilus-directory.c:
+ (nautilus_directory_schedule_metadata_copy),
+ (nautilus_directory_schedule_metadata_move),
+ (nautilus_directory_schedule_metadata_remove): Fix code that was
+ using file names instead of relative URIs (essentially escaped
+ file names). This code was missed when we made the
+ switchover. Without this, changes to files with spaces in their
+ names didn't update metadata properly.
+
+ * libnautilus-extensions/nautilus-file-operations.c:
+ (build_error_string): Added blank line between the intro sentence
+ and the rest of the error message.
+ (handle_xfer_overwrite): Added blank line between the intro
+ sentence and the rest of the error message.
+ (sync_xfer_callback): Fix metadata code to remove the metadata
+ when creating a new file, just as it copies metadata when copying
+ a file. This change helps the New Folder case, but requires a fix
+ in gnome-vfs to set the top level boolean for the New Folder case.
+ (handle_new_folder_vfs_error): Added blank line between the intro
+ sentence and the rest of the error message.
+ (nautilus_self_check_file_operations): Changed the self-check to
+ use the standard way of testing functions that return text instead
+ of rolling its own.
+
+ * libnautilus-extensions/nautilus-gnome-extensions.h:
+ * libnautilus-extensions/nautilus-gnome-extensions.c:
+ (nautilus_gnome_canvas_item_get_canvas_bounds): Added a function
+ that's like nautilus_gnome_canvas_item_get_current_canvas_bounds
+ but is accurate even before the icon is updated.
+
+ * libnautilus-extensions/nautilus-icon-container.c: (reveal_icon):
+ Use nautilus_gnome_canvas_item_get_canvas_bounds instead of
+ nautilus_gnome_canvas_item_get_current_canvas_bounds. Fixes the
+ bug I reintroduced where New Folder icons would not be revealed.
+
+ * libnautilus-extensions/nautilus-xml-extensions.h:
+ * libnautilus-extensions/nautilus-xml-extensions.c:
+ (nautilus_xml_remove_node): Add a remove-node function. This is
+ needed because gnome-xml doesn't have xmlRemoveNode
+ implemented. This implementation is not quite complete, but
+ probably good enough for our purposes. A complete implementation
+ might have to have some handling for removing the root node and
+ perhaps some stuff to remove unused namespaces. Maybe this can be
+ rolled into gnome-xml.
+
+ * src/file-manager/nautilus-directory-view-ui.xml:
+ * src/nautilus-shell-ui.xml:
+ Added some more delimit="none" entries to make it so that the
+ actual placeholder definitions are not "transparent".
+
+ * libnautilus-extensions/nautilus-glib-extensions.c
+ (nautilus_self_check_glib_extensions): Marked some strings that
+ are part of a test translatable since the result might be
+ different in some locales. Translating the strings to the right
+ result makes "make check" work properly in that locale.
+
2000-12-14 Andy Hertzfeld <andy@eazel.com>
* src/nautilus-first-time-druid.c:
diff --git a/libnautilus-extensions/nautilus-directory-metafile.c b/libnautilus-extensions/nautilus-directory-metafile.c
index d3305bc27..865b94eb9 100644
--- a/libnautilus-extensions/nautilus-directory-metafile.c
+++ b/libnautilus-extensions/nautilus-directory-metafile.c
@@ -98,26 +98,30 @@ get_file_node (NautilusDirectory *directory,
const char *file_name,
gboolean create)
{
- xmlNode *root, *child;
+ xmlNode *root, *node;
g_assert (NAUTILUS_IS_DIRECTORY (directory));
if (directory->details->metafile_node_hash != NULL) {
- child = g_hash_table_lookup (directory->details->metafile_node_hash,
+ node = g_hash_table_lookup (directory->details->metafile_node_hash,
file_name);
- if (child != NULL) {
- return child;
+ if (node != NULL) {
+ return node;
}
}
if (create) {
- root = create_metafile_root (directory);
- child = xmlNewChild (root, NULL, "FILE", NULL);
- xmlSetProp (child, "NAME", file_name);
+ if (directory->details->metafile_read) {
+ root = create_metafile_root (directory);
+ node = xmlNewChild (root, NULL, "FILE", NULL);
+ } else {
+ node = xmlNewNode (NULL, "FILE");
+ }
+ xmlSetProp (node, "NAME", file_name);
g_hash_table_insert (directory->details->metafile_node_hash,
xmlMemStrdup (file_name),
- child);
- return child;
+ node);
+ return node;
}
return NULL;
@@ -550,8 +554,6 @@ nautilus_directory_get_file_metadata (NautilusDirectory *directory,
}
}
-
-
GList *
nautilus_directory_get_file_metadata_list (NautilusDirectory *directory,
const char *file_name,
@@ -575,7 +577,6 @@ nautilus_directory_get_file_metadata_list (NautilusDirectory *directory,
}
}
-
gboolean
nautilus_directory_set_file_metadata (NautilusDirectory *directory,
const char *file_name,
@@ -633,27 +634,27 @@ nautilus_directory_rename_file_metadata (NautilusDirectory *directory,
const char *old_file_name,
const char *new_file_name)
{
- xmlNode *file_node;
- GHashTable *directory_table;
gboolean found;
gpointer key, value;
+ xmlNode *file_node;
+ GHashTable *directory_table;
char *old_file_uri, *new_file_uri;
+ nautilus_directory_remove_file_metadata (directory, new_file_name);
+
if (directory->details->metafile_read) {
/* Move data in XML document if present. */
- file_node = get_file_node (directory, old_file_name, FALSE);
- if (file_node != NULL) {
- xmlSetProp (file_node, "NAME", new_file_name);
- found = g_hash_table_lookup_extended (directory->details->metafile_node_hash,
- old_file_name, &key, &value);
- g_assert (found);
+ found = g_hash_table_lookup_extended (directory->details->metafile_node_hash,
+ old_file_name, &key, &value);
+ if (found) {
g_assert (strcmp (key, old_file_name) == 0);
- g_assert (value == file_node);
+ file_node = value;
g_hash_table_remove (directory->details->metafile_node_hash,
old_file_name);
xmlFree (key);
g_hash_table_insert (directory->details->metafile_node_hash,
xmlMemStrdup (new_file_name), value);
+ xmlSetProp (file_node, "NAME", new_file_name);
nautilus_directory_request_write_metafile (directory);
}
} else {
@@ -741,8 +742,6 @@ nautilus_directory_metafile_apply_pending_changes (NautilusDirectory *directory)
directory->details->metadata_changes = NULL;
}
-
-
gboolean
nautilus_directory_get_boolean_file_metadata (NautilusDirectory *directory,
const char *file_name,
@@ -833,8 +832,6 @@ nautilus_directory_set_integer_file_metadata (NautilusDirectory *directory,
g_free (default_as_string);
}
-
-
static void
copy_file_metadata_for_key (NautilusDirectory *source_directory,
const char *source_file_name,
@@ -859,10 +856,13 @@ nautilus_directory_copy_file_metadata (NautilusDirectory *source_directory,
NautilusDirectory *destination_directory,
const char *destination_file_name)
{
- /* FIXME bugzilla.eazel.com 2808: This hard-coded set of keys is not right. */
/* FIXME bugzilla.eazel.com 3343: This does nothing to ensure
* the source directory metadata is read in.
*/
+
+ /* FIXME bugzilla.eazel.com 2808: Change this to copy all the
+ * metadata, not just a hard-coded set of keys.
+ */
copy_file_metadata_for_key
(source_directory, source_file_name,
destination_directory, destination_file_name,
@@ -883,19 +883,50 @@ nautilus_directory_copy_file_metadata (NautilusDirectory *source_directory,
(source_directory, source_file_name,
destination_directory, destination_file_name,
NAUTILUS_METADATA_KEY_CUSTOM_ICON);
+
+ /* FIXME: Do we want to copy the thumbnail here like in the
+ * rename and remove cases?
+ */
}
void
nautilus_directory_remove_file_metadata (NautilusDirectory *directory,
const char *file_name)
{
+ gboolean found;
+ gpointer key, value;
+ xmlNode *file_node;
+ GHashTable *directory_table;
char *file_uri;
- file_uri = nautilus_directory_get_file_uri (directory, file_name);
-
- /* FIXME bugzilla.eazel.com 2807: This is not implemented. */
+ if (directory->details->metafile_read) {
+ /* Remove data in XML document if present. */
+ found = g_hash_table_lookup_extended (directory->details->metafile_node_hash,
+ file_name, &key, &value);
+ if (found) {
+ g_assert (strcmp (key, file_name) == 0);
+ file_node = value;
+ g_hash_table_remove (directory->details->metafile_node_hash,
+ file_name);
+ xmlFree (key);
+ nautilus_xml_remove_node (file_node);
+ xmlFreeNode (file_node);
+ nautilus_directory_request_write_metafile (directory);
+ }
+ } else {
+ /* Remove data from hash table. */
+ directory_table = directory->details->metadata_changes;
+ found = g_hash_table_lookup_extended
+ (directory_table, file_name, &key, &value);
+ if (found) {
+ g_hash_table_remove (directory_table, file_name);
+ g_free (key);
+ metadata_value_destroy (value);
+ }
+ }
/* delete the thumbnails for the file, if any */
+ file_uri = nautilus_directory_get_file_uri (directory, file_name);
nautilus_remove_thumbnail_for_file (file_uri);
g_free (file_uri);
}
diff --git a/libnautilus-extensions/nautilus-directory.c b/libnautilus-extensions/nautilus-directory.c
index 7f3b9c26f..f60311069 100644
--- a/libnautilus-extensions/nautilus-directory.c
+++ b/libnautilus-extensions/nautilus-directory.c
@@ -1129,7 +1129,7 @@ nautilus_directory_schedule_metadata_copy (GList *uri_pairs)
GList *p;
URIPair *pair;
NautilusDirectory *source_directory, *destination_directory;
- char *source_file_name, *destination_file_name;
+ const char *source_relative_uri, *destination_relative_uri;
for (p = uri_pairs; p != NULL; p = p->next) {
pair = (URIPair *) p->data;
@@ -1137,16 +1137,13 @@ nautilus_directory_schedule_metadata_copy (GList *uri_pairs)
source_directory = get_parent_directory (pair->from_uri);
destination_directory = get_parent_directory (pair->to_uri);
- source_file_name = nautilus_uri_get_basename (pair->from_uri);
- destination_file_name = nautilus_uri_get_basename (pair->to_uri);
+ source_relative_uri = g_basename (pair->from_uri);
+ destination_relative_uri = g_basename (pair->to_uri);
nautilus_directory_copy_file_metadata (source_directory,
- source_file_name,
+ source_relative_uri,
destination_directory,
- destination_file_name);
-
- g_free (destination_file_name);
- g_free (source_file_name);
+ destination_relative_uri);
nautilus_directory_unref (source_directory);
nautilus_directory_unref (destination_directory);
@@ -1159,7 +1156,7 @@ nautilus_directory_schedule_metadata_move (GList *uri_pairs)
GList *p;
URIPair *pair;
NautilusDirectory *source_directory, *destination_directory;
- char *source_file_name, *destination_file_name;
+ const char *source_relative_uri, *destination_relative_uri;
for (p = uri_pairs; p != NULL; p = p->next) {
pair = (URIPair *) p->data;
@@ -1167,18 +1164,15 @@ nautilus_directory_schedule_metadata_move (GList *uri_pairs)
source_directory = get_parent_directory (pair->from_uri);
destination_directory = get_parent_directory (pair->to_uri);
- source_file_name = nautilus_uri_get_basename (pair->from_uri);
- destination_file_name = nautilus_uri_get_basename (pair->to_uri);
+ source_relative_uri = g_basename (pair->from_uri);
+ destination_relative_uri = g_basename (pair->to_uri);
nautilus_directory_copy_file_metadata (source_directory,
- source_file_name,
+ source_relative_uri,
destination_directory,
- destination_file_name);
+ destination_relative_uri);
nautilus_directory_remove_file_metadata (source_directory,
- source_file_name);
-
- g_free (destination_file_name);
- g_free (source_file_name);
+ source_relative_uri);
nautilus_directory_unref (source_directory);
nautilus_directory_unref (destination_directory);
@@ -1191,18 +1185,17 @@ nautilus_directory_schedule_metadata_remove (GList *uris)
GList *p;
const char *uri;
NautilusDirectory *directory;
- char *file_name;
+ const char *relative_uri;
for (p = uris; p != NULL; p = p->next) {
uri = (const char *) p->data;
directory = get_parent_directory (uri);
- file_name = nautilus_uri_get_basename (uri);
+ relative_uri = g_basename (uri);
nautilus_directory_remove_file_metadata (directory,
- file_name);
+ relative_uri);
- g_free (file_name);
nautilus_directory_unref (directory);
}
}
diff --git a/libnautilus-extensions/nautilus-file-operations.c b/libnautilus-extensions/nautilus-file-operations.c
index f22b97b4e..b1d506df3 100644
--- a/libnautilus-extensions/nautilus-file-operations.c
+++ b/libnautilus-extensions/nautilus-file-operations.c
@@ -488,8 +488,8 @@ typedef enum {
static char *
build_error_string (const char *source_name, const char *target_name,
- XferKind operation_kind, NautilusFileOperationsErrorKind error_kind,
- NautilusFileOperationsErrorLocation error_location, GnomeVFSResult error)
+ XferKind operation_kind, NautilusFileOperationsErrorKind error_kind,
+ NautilusFileOperationsErrorLocation error_location, GnomeVFSResult error)
{
/* Avoid clever message composing here, just use brute force and
* duplicate the different flavors of error messages for all the
@@ -510,7 +510,7 @@ build_error_string (const char *source_name, const char *target_name,
case XFER_MOVE:
case XFER_MOVE_TO_TRASH:
if (error_kind == ERROR_READ_ONLY) {
- error_string = _("Error while moving.\n"
+ error_string = _("Error while moving.\n\n"
"\"%s\" cannot be moved because it is on "
"a read-only disk.");
}
@@ -521,13 +521,13 @@ build_error_string (const char *source_name, const char *target_name,
switch (error_kind) {
case ERROR_NOT_ENOUGH_PERMISSIONS:
case ERROR_NOT_WRITABLE:
- error_string = _("Error while deleting.\n"
+ error_string = _("Error while deleting.\n\n"
"\"%s\" cannot be deleted because you do not have "
"permissions to modify its parent folder.");
break;
case ERROR_READ_ONLY:
- error_string = _("Error while deleting.\n"
+ error_string = _("Error while deleting.\n\n"
"\"%s\" cannot be deleted because it is on "
"a read-only disk.");
break;
@@ -558,14 +558,14 @@ build_error_string (const char *source_name, const char *target_name,
switch (operation_kind) {
case XFER_MOVE:
if (error_kind == ERROR_NOT_ENOUGH_PERMISSIONS) {
- error_string = _("Error while moving.\n"
+ error_string = _("Error while moving.\n\n"
"\"%s\" cannot be moved because you do not have "
"permissions to change it or its parent folder.");
}
break;
case XFER_MOVE_TO_TRASH:
if (error_kind == ERROR_NOT_ENOUGH_PERMISSIONS) {
- error_string = _("Error while moving.\n"
+ error_string = _("Error while moving.\n\n"
"\"%s\" cannot be moved to the trash because you do not have "
"permissions to change it or its parent folder.");
}
@@ -589,7 +589,7 @@ build_error_string (const char *source_name, const char *target_name,
case XFER_COPY:
case XFER_DUPLICATE:
if (error_kind == ERROR_NOT_READABLE) {
- error_string = _("Error while copying.\n"
+ error_string = _("Error while copying.\n\n"
"\"%s\" cannot be copied because you do not have "
"permissions to read it.");
}
@@ -611,16 +611,16 @@ build_error_string (const char *source_name, const char *target_name,
switch (operation_kind) {
case XFER_COPY:
case XFER_DUPLICATE:
- error_string = _("Error while copying to \"%s\".\n"
+ error_string = _("Error while copying to \"%s\".\n\n"
"There is not enough space on the destination.");
break;
case XFER_MOVE_TO_TRASH:
case XFER_MOVE:
- error_string = _("Error while moving to \"%s\".\n"
+ error_string = _("Error while moving to \"%s\".\n\n"
"There is not enough space on the destination.");
break;
case XFER_LINK:
- error_string = _("Error while creating link in \"%s\".\n"
+ error_string = _("Error while creating link in \"%s\".\n\n"
"There is not enough space on the destination.");
break;
default:
@@ -632,33 +632,33 @@ build_error_string (const char *source_name, const char *target_name,
case XFER_COPY:
case XFER_DUPLICATE:
if (error_kind == ERROR_NOT_ENOUGH_PERMISSIONS) {
- error_string = _("Error while copying to \"%s\".\n"
+ error_string = _("Error while copying to \"%s\".\n\n"
"You do not have permissions to write to "
"this folder.");
} else if (error_kind == ERROR_NOT_WRITABLE) {
- error_string = _("Error while copying to \"%s\".\n"
+ error_string = _("Error while copying to \"%s\".\n\n"
"The destination disk is read-only.");
}
break;
case XFER_MOVE:
case XFER_MOVE_TO_TRASH:
if (error_kind == ERROR_NOT_ENOUGH_PERMISSIONS) {
- error_string = _("Error while moving items to \"%s\".\n"
+ error_string = _("Error while moving items to \"%s\".\n\n"
"You do not have permissions to write to "
"this folder.");
} else if (error_kind == ERROR_NOT_WRITABLE) {
- error_string = _("Error while moving items to \"%s\".\n"
+ error_string = _("Error while moving items to \"%s\".\n\n"
"The destination disk is read-only.");
}
break;
case XFER_LINK:
if (error_kind == ERROR_NOT_ENOUGH_PERMISSIONS) {
- error_string = _("Error while creating links in \"%s\".\n"
+ error_string = _("Error while creating links in \"%s\".\n\n"
"You do not have permissions to write to "
"this folder.");
} else if (error_kind == ERROR_NOT_WRITABLE) {
- error_string = _("Error while creating links in \"%s\".\n"
+ error_string = _("Error while creating links in \"%s\".\n\n"
"The destination disk is read-only.");
}
break;
@@ -687,21 +687,21 @@ build_error_string (const char *source_name, const char *target_name,
switch (operation_kind) {
case XFER_COPY:
case XFER_DUPLICATE:
- error_string = _("Error \"%s\" while copying \"%s\".\n"
+ error_string = _("Error \"%s\" while copying \"%s\".\n\n"
"Would you like to continue?");
break;
case XFER_MOVE:
- error_string = _("Error \"%s\" while moving \"%s\".\n"
+ error_string = _("Error \"%s\" while moving \"%s\".\n\n"
"Would you like to continue?");
break;
case XFER_LINK:
- error_string = _("Error \"%s\" while creating a link to \"%s\".\n"
+ error_string = _("Error \"%s\" while creating a link to \"%s\".\n\n"
"Would you like to continue?");
break;
case XFER_DELETE:
case XFER_EMPTY_TRASH:
case XFER_MOVE_TO_TRASH:
- error_string = _("Error \"%s\" while deleting \"%s\".\n"
+ error_string = _("Error \"%s\" while deleting \"%s\".\n\n"
"Would you like to continue?");
break;
default:
@@ -716,21 +716,21 @@ build_error_string (const char *source_name, const char *target_name,
switch (operation_kind) {
case XFER_COPY:
case XFER_DUPLICATE:
- error_string = _("Error \"%s\" while copying.\n"
+ error_string = _("Error \"%s\" while copying.\n\n"
"Would you like to continue?");
break;
case XFER_MOVE:
- error_string = _("Error \"%s\" while moving.\n"
+ error_string = _("Error \"%s\" while moving.\n\n"
"Would you like to continue?");
break;
case XFER_LINK:
- error_string = _("Error \"%s\" while linking.\n"
+ error_string = _("Error \"%s\" while linking.\n\n"
"Would you like to continue?");
break;
case XFER_DELETE:
case XFER_EMPTY_TRASH:
case XFER_MOVE_TO_TRASH:
- error_string = _("Error \"%s\" while deleting.\n"
+ error_string = _("Error \"%s\" while deleting.\n\n"
"Would you like to continue?");
break;
default:
@@ -938,7 +938,7 @@ handle_xfer_overwrite (const GnomeVFSXferProgressInfo *progress_info,
char *unescaped_name;
unescaped_name = nautilus_format_name_for_display (progress_info->target_name);
- text = g_strdup_printf (_("File \"%s\" already exists.\n"
+ text = g_strdup_printf (_("File \"%s\" already exists.\n\n"
"Would you like to replace it?"),
unescaped_name);
g_free (unescaped_name);
@@ -1409,13 +1409,17 @@ sync_xfer_callback (GnomeVFSXferProgressInfo *progress_info, gpointer data)
/* this is one of the selected copied or moved items -- we need
* to make sure it's metadata gets copied over
*/
- g_assert (progress_info->source_name != NULL);
- nautilus_file_changes_queue_schedule_metadata_copy
- (progress_info->source_name, progress_info->target_name);
-
- apply_one_position (position_iterator, progress_info->source_name,
- progress_info->target_name);
-
+ if (progress_info->source_name == NULL) {
+ /* remove any old metadata */
+ nautilus_file_changes_queue_schedule_metadata_remove
+ (progress_info->target_name);
+ } else {
+ nautilus_file_changes_queue_schedule_metadata_copy
+ (progress_info->source_name, progress_info->target_name);
+
+ apply_one_position (position_iterator, progress_info->source_name,
+ progress_info->target_name);
+ }
if (debuting_uris != NULL) {
g_hash_table_insert (debuting_uris, g_strdup (progress_info->target_name), NULL);
}
@@ -1426,20 +1430,21 @@ sync_xfer_callback (GnomeVFSXferProgressInfo *progress_info, gpointer data)
case GNOME_VFS_XFER_PHASE_MOVING:
if (progress_info->top_level_item) {
g_assert (progress_info->source_name != NULL);
+
nautilus_file_changes_queue_schedule_metadata_move
(progress_info->source_name, progress_info->target_name);
-
+
apply_one_position (position_iterator, progress_info->source_name,
- progress_info->target_name);
-
+ progress_info->target_name);
+
if (debuting_uris != NULL) {
g_hash_table_insert (debuting_uris, g_strdup (progress_info->target_name), NULL);
}
}
nautilus_file_changes_queue_file_moved (progress_info->source_name,
- progress_info->target_name);
+ progress_info->target_name);
break;
-
+
case GNOME_VFS_XFER_PHASE_DELETESOURCE:
if (progress_info->top_level_item) {
g_assert (progress_info->source_name != NULL);
@@ -1448,7 +1453,7 @@ sync_xfer_callback (GnomeVFSXferProgressInfo *progress_info, gpointer data)
}
nautilus_file_changes_queue_file_removed (progress_info->source_name);
break;
-
+
case GNOME_VFS_XFER_PHASE_COMPLETED:
/* done, clean up */
icon_position_iterator_free (position_iterator);
@@ -1775,8 +1780,8 @@ nautilus_file_operations_copy_move (const GList *item_uris,
gnome_vfs_async_xfer (&xfer_info->handle, source_uri_list, target_uri_list,
move_options, GNOME_VFS_XFER_ERROR_MODE_QUERY,
GNOME_VFS_XFER_OVERWRITE_MODE_QUERY,
- &update_xfer_callback, xfer_info,
- &sync_xfer_callback, sync_xfer_info);
+ update_xfer_callback, xfer_info,
+ sync_xfer_callback, sync_xfer_info);
}
gnome_vfs_uri_list_free (source_uri_list);
@@ -1803,26 +1808,28 @@ handle_new_folder_vfs_error (const GnomeVFSXferProgressInfo *progress_info, NewF
error_string_to_free = NULL;
if (progress_info->vfs_status == GNOME_VFS_ERROR_ACCESS_DENIED) {
- error_string = _("Error creating new folder.\n"
- "You do not have permissions to write to the destination.");
+ error_string = _("Error creating new folder.\n\n"
+ "You do not have permissions to write to the destination.");
} else if (progress_info->vfs_status == GNOME_VFS_ERROR_NO_SPACE) {
- error_string = _("Error creating new folder.\n"
- "There is no space on the destination.");
+ error_string = _("Error creating new folder.\n\n"
+ "There is no space on the destination.");
} else {
error_string = g_strdup_printf (_("Error \"%s\" creating new folder."),
- gnome_vfs_result_to_string(progress_info->vfs_status));
+ gnome_vfs_result_to_string(progress_info->vfs_status));
}
-
- nautilus_error_dialog (error_string, _("Error creating new folder"), GTK_WINDOW (state->parent_view));
-
+
+ nautilus_error_dialog (error_string, _("Error creating new folder"),
+ GTK_WINDOW (state->parent_view));
+
g_free (error_string_to_free);
-
+
return GNOME_VFS_XFER_ERROR_ACTION_ABORT;
}
static int
new_folder_xfer_callback (GnomeVFSAsyncHandle *handle,
- GnomeVFSXferProgressInfo *progress_info, gpointer data)
+ GnomeVFSXferProgressInfo *progress_info,
+ gpointer data)
{
NewFolderXferState *state;
char *temp_string;
@@ -1832,7 +1839,7 @@ new_folder_xfer_callback (GnomeVFSAsyncHandle *handle,
switch (progress_info->status) {
case GNOME_VFS_XFER_PROGRESS_STATUS_OK:
nautilus_file_changes_consume_changes (TRUE);
- (state->done_callback) (progress_info->target_name, state->data);
+ (* state->done_callback) (progress_info->target_name, state->data);
g_free (state);
return 0;
@@ -1846,13 +1853,15 @@ new_folder_xfer_callback (GnomeVFSAsyncHandle *handle,
progress_info->duplicate_name[8] = '\0';
g_free (temp_string);
temp_string = progress_info->duplicate_name;
- progress_info->duplicate_name = g_strdup_printf ("%s.%d",
- progress_info->duplicate_name,
- progress_info->duplicate_count);
+ progress_info->duplicate_name = g_strdup_printf
+ ("%s.%d",
+ progress_info->duplicate_name,
+ progress_info->duplicate_count);
} else {
- progress_info->duplicate_name = g_strdup_printf ("%s%%20%d",
- progress_info->duplicate_name,
- progress_info->duplicate_count);
+ progress_info->duplicate_name = g_strdup_printf
+ ("%s%%20%d",
+ progress_info->duplicate_name,
+ progress_info->duplicate_count);
}
g_free (temp_string);
return GNOME_VFS_XFER_ERROR_ACTION_SKIP;
@@ -1871,7 +1880,7 @@ new_folder_xfer_callback (GnomeVFSAsyncHandle *handle,
void
nautilus_file_operations_new_folder (GtkWidget *parent_view,
const char *parent_dir,
- void (*done_callback)(const char *, gpointer),
+ void (*done_callback) (const char *, gpointer),
gpointer data)
{
NewFolderXferState *state;
@@ -1893,8 +1902,8 @@ nautilus_file_operations_new_folder (GtkWidget *parent_view,
GNOME_VFS_XFER_NEW_UNIQUE_DIRECTORY,
GNOME_VFS_XFER_ERROR_MODE_QUERY,
GNOME_VFS_XFER_OVERWRITE_MODE_QUERY,
- &new_folder_xfer_callback, state,
- &sync_xfer_callback, NULL);
+ new_folder_xfer_callback, state,
+ sync_xfer_callback, NULL);
gnome_vfs_uri_list_free (target_uri_list);
gnome_vfs_uri_unref (parent_uri);
@@ -2005,8 +2014,8 @@ nautilus_file_operations_move_to_trash (const GList *item_uris,
GNOME_VFS_XFER_REMOVESOURCE | GNOME_VFS_XFER_USE_UNIQUE_NAMES,
GNOME_VFS_XFER_ERROR_MODE_QUERY,
GNOME_VFS_XFER_OVERWRITE_MODE_REPLACE,
- &update_xfer_callback, xfer_info,
- &sync_xfer_callback, NULL);
+ update_xfer_callback, xfer_info,
+ sync_xfer_callback, NULL);
}
@@ -2052,8 +2061,8 @@ nautilus_file_operations_delete (const GList *item_uris,
GNOME_VFS_XFER_DELETE_ITEMS | GNOME_VFS_XFER_RECURSIVE,
GNOME_VFS_XFER_ERROR_MODE_QUERY,
GNOME_VFS_XFER_OVERWRITE_MODE_REPLACE,
- &update_xfer_callback, xfer_info,
- &sync_xfer_callback, NULL);
+ update_xfer_callback, xfer_info,
+ sync_xfer_callback, NULL);
gnome_vfs_uri_list_free (uri_list);
}
@@ -2088,8 +2097,8 @@ do_empty_trash (GtkWidget *parent_view)
GNOME_VFS_XFER_EMPTY_DIRECTORIES,
GNOME_VFS_XFER_ERROR_MODE_QUERY,
GNOME_VFS_XFER_OVERWRITE_MODE_REPLACE,
- &update_xfer_callback, xfer_info,
- &sync_xfer_callback, NULL);
+ update_xfer_callback, xfer_info,
+ sync_xfer_callback, NULL);
}
gnome_vfs_uri_list_free (trash_dir_list);
@@ -2145,53 +2154,37 @@ nautilus_file_operations_empty_trash (GtkWidget *parent_view)
#if !defined (NAUTILUS_OMIT_SELF_CHECK)
-static gboolean
-test_next_duplicate_name (const char *name, const char *expected_next_name)
-{
- gboolean result;
- char *next_name;
-
- next_name = get_duplicate_name (name, 1);
- result = strcmp (expected_next_name, next_name) == 0;
- if (!result) {
- printf("expected %s, got %s\n", expected_next_name, next_name);
- }
- g_free (next_name);
-
- return result;
-}
-
void
nautilus_self_check_file_operations (void)
{
/* test the next duplicate name generator */
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_(" (copy)"), _(" (another copy)")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo"), _("foo (copy)")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_(".bashrc"), _(".bashrc (copy)")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_(".foo.txt"), _(".foo (copy).txt")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo foo"), _("foo foo (copy)")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo.txt"), _("foo (copy).txt")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo foo.txt"), _("foo foo (copy).txt")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo foo.txt txt"), _("foo foo (copy).txt txt")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo...txt"), _("foo.. (copy).txt")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo..."), _("foo... (copy)")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo. (copy)"), _("foo. (another copy)")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo (copy)"), _("foo (another copy)")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo (copy).txt"), _("foo (another copy).txt")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo (another copy)"), _("foo (3rd copy)")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo (another copy).txt"), _("foo (3rd copy).txt")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo foo (another copy).txt"), _("foo foo (3rd copy).txt")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo (21st copy)"), _("foo (22nd copy)")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo (21st copy).txt"), _("foo (22nd copy).txt")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo (22nd copy)"), _("foo (23rd copy)")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo (22nd copy).txt"), _("foo (23rd copy).txt")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo (23rd copy)"), _("foo (24th copy)")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo (23rd copy).txt"), _("foo (24th copy).txt")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo (24th copy)"), _("foo (25th copy)")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo (24th copy).txt"), _("foo (25th copy).txt")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo foo (24th copy)"), _("foo foo (25th copy)")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo foo (24th copy).txt"), _("foo foo (25th copy).txt")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo foo (100000000000000th copy).txt"), _("foo foo (copy).txt")), TRUE);
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_(" (copy)"), 1), _(" (another copy)"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo"), 1), _("foo (copy)"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_(".bashrc"), 1), _(".bashrc (copy)"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_(".foo.txt"), 1), _(".foo (copy).txt"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo foo"), 1), _("foo foo (copy)"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo.txt"), 1), _("foo (copy).txt"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo foo.txt"), 1), _("foo foo (copy).txt"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo foo.txt txt"), 1), _("foo foo (copy).txt txt"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo...txt"), 1), _("foo.. (copy).txt"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo..."), 1), _("foo... (copy)"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo. (copy)"), 1), _("foo. (another copy)"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo (copy)"), 1), _("foo (another copy)"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo (copy).txt"), 1), _("foo (another copy).txt"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo (another copy)"), 1), _("foo (3rd copy)"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo (another copy).txt"), 1), _("foo (3rd copy).txt"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo foo (another copy).txt"), 1), _("foo foo (3rd copy).txt"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo (21st copy)"), 1), _("foo (22nd copy)"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo (21st copy).txt"), 1), _("foo (22nd copy).txt"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo (22nd copy)"), 1), _("foo (23rd copy)"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo (22nd copy).txt"), 1), _("foo (23rd copy).txt"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo (23rd copy)"), 1), _("foo (24th copy)"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo (23rd copy).txt"), 1), _("foo (24th copy).txt"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo (24th copy)"), 1), _("foo (25th copy)"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo (24th copy).txt"), 1), _("foo (25th copy).txt"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo foo (24th copy)"), 1), _("foo foo (25th copy)"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo foo (24th copy).txt"), 1), _("foo foo (25th copy).txt"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo foo (100000000000000th copy).txt"), 1), _("foo foo (copy).txt"));
}
#endif
diff --git a/libnautilus-extensions/nautilus-glib-extensions.c b/libnautilus-extensions/nautilus-glib-extensions.c
index df028fdd6..0c422665f 100644
--- a/libnautilus-extensions/nautilus-glib-extensions.c
+++ b/libnautilus-extensions/nautilus-glib-extensions.c
@@ -30,8 +30,10 @@
#include "nautilus-lib-self-check-functions.h"
#include "nautilus-string.h"
#include <ctype.h>
-#include <sys/time.h>
+#include <libgnome/gnome-defs.h>
+#include <libgnome/gnome-i18n.h>
#include <stdlib.h>
+#include <sys/time.h>
/* Legal conversion specifiers, as specified in the C standard. */
#define C_STANDARD_STRFTIME_CHARACTERS "aAbBcdHIjmMpSUwWxXyYZ"
@@ -1166,9 +1168,14 @@ nautilus_self_check_glib_extensions (void)
NAUTILUS_CHECK_STRING_RESULT (test_strftime (huge_string, 2000, 1, 1, 0, 0, 0), huge_string);
NAUTILUS_CHECK_STRING_RESULT (test_strftime ("%%", 2000, 1, 1, 1, 0, 0), "%");
NAUTILUS_CHECK_STRING_RESULT (test_strftime ("%%%%", 2000, 1, 1, 1, 0, 0), "%%");
- NAUTILUS_CHECK_STRING_RESULT (test_strftime ("%m/%d/%y, %I:%M %p", 2000, 1, 1, 1, 0, 0), "01/01/00, 01:00 AM");
- NAUTILUS_CHECK_STRING_RESULT (test_strftime ("%-m/%-d/%y, %-I:%M %p", 2000, 1, 1, 1, 0, 0), "1/1/00, 1:00 AM");
- NAUTILUS_CHECK_STRING_RESULT (test_strftime ("%_m/%_d/%y, %_I:%M %p", 2000, 1, 1, 1, 0, 0), " 1/ 1/00, 1:00 AM");
+ /* localizers: These strings are part of the strftime
+ * self-check code and must be changed to match what strtfime
+ * yields -- usually just omitting the AM part is all that's
+ * needed.
+ */
+ NAUTILUS_CHECK_STRING_RESULT (test_strftime ("%m/%d/%y, %I:%M %p", 2000, 1, 1, 1, 0, 0), _("01/01/00, 01:00 AM"));
+ NAUTILUS_CHECK_STRING_RESULT (test_strftime ("%-m/%-d/%y, %-I:%M %p", 2000, 1, 1, 1, 0, 0), _("1/1/00, 1:00 AM"));
+ NAUTILUS_CHECK_STRING_RESULT (test_strftime ("%_m/%_d/%y, %_I:%M %p", 2000, 1, 1, 1, 0, 0), _(" 1/ 1/00, 1:00 AM"));
g_free (huge_string);
diff --git a/libnautilus-extensions/nautilus-gnome-extensions.c b/libnautilus-extensions/nautilus-gnome-extensions.c
index bc29e1913..3d2759357 100644
--- a/libnautilus-extensions/nautilus-gnome-extensions.c
+++ b/libnautilus-extensions/nautilus-gnome-extensions.c
@@ -195,6 +195,18 @@ nautilus_gnome_canvas_item_get_world_bounds (GnomeCanvasItem *item,
}
}
+void
+nautilus_gnome_canvas_item_get_canvas_bounds (GnomeCanvasItem *item,
+ ArtIRect *canvas_bounds)
+{
+ ArtDRect world_bounds;
+
+ nautilus_gnome_canvas_item_get_world_bounds
+ (item, &world_bounds);
+ nautilus_gnome_canvas_world_to_canvas_rectangle
+ (item->canvas, &world_bounds, canvas_bounds);
+}
+
static void
nautilus_gnome_canvas_draw_pixbuf_helper (art_u8 *dst, int dst_rowstride,
const art_u8 *src, int src_rowstride,
diff --git a/libnautilus-extensions/nautilus-gnome-extensions.h b/libnautilus-extensions/nautilus-gnome-extensions.h
index f0c3d8024..d64b251f4 100644
--- a/libnautilus-extensions/nautilus-gnome-extensions.h
+++ b/libnautilus-extensions/nautilus-gnome-extensions.h
@@ -40,90 +40,95 @@ typedef struct {
} NautilusArtIPoint;
/* Causes an update as needed. The GnomeCanvas code says it should, but it doesn't. */
-void nautilus_gnome_canvas_set_scroll_region (GnomeCanvas *canvas,
- double x1,
- double y1,
- double x2,
- double y2);
+void nautilus_gnome_canvas_set_scroll_region (GnomeCanvas *canvas,
+ double x1,
+ double y1,
+ double x2,
+ double y2);
/* Make the scroll region bigger so the code in GnomeCanvas won't center it. */
-void nautilus_gnome_canvas_set_scroll_region_left_justify (GnomeCanvas *canvas,
- double x1,
- double y1,
- double x2,
- double y2);
+void nautilus_gnome_canvas_set_scroll_region_left_justify (GnomeCanvas *canvas,
+ double x1,
+ double y1,
+ double x2,
+ double y2);
/* Set a new scroll region without eliminating any of the currently-visible area. */
void nautilus_gnome_canvas_set_scroll_region_include_visible_area (GnomeCanvas *canvas,
- double x1,
- double y1,
- double x2,
- double y2);
+ double x1,
+ double y1,
+ double x2,
+ double y2);
/* For cases where you need to get more than one item updated. */
-void nautilus_gnome_canvas_request_update_all (GnomeCanvas *canvas);
-void nautilus_gnome_canvas_item_request_update_deep (GnomeCanvasItem *item);
+void nautilus_gnome_canvas_request_update_all (GnomeCanvas *canvas);
+void nautilus_gnome_canvas_item_request_update_deep (GnomeCanvasItem *item);
/* This is more handy than gnome_canvas_item_get_bounds because it
* always returns the bounds * in world coordinates and it returns
* them in a single rectangle.
*/
-void nautilus_gnome_canvas_item_get_world_bounds (GnomeCanvasItem *item,
- ArtDRect *world_bounds);
+void nautilus_gnome_canvas_item_get_world_bounds (GnomeCanvasItem *item,
+ ArtDRect *world_bounds);
/* This returns the current canvas bounds as computed by update.
* It's not as "up to date" as get_bounds, which is accurate even
* before an update happens.
*/
-void nautilus_gnome_canvas_item_get_current_canvas_bounds (GnomeCanvasItem *item,
- ArtIRect *canvas_bounds);
+void nautilus_gnome_canvas_item_get_current_canvas_bounds (GnomeCanvasItem *item,
+ ArtIRect *canvas_bounds);
+
+/* This returns the canvas bounds in a slower way that's always up to
+ * date, even before an update.
+ */
+void nautilus_gnome_canvas_item_get_canvas_bounds (GnomeCanvasItem *item,
+ ArtIRect *canvas_bounds);
/* Convenience functions for doing things with whole rectangles. */
-void nautilus_gnome_canvas_world_to_canvas_rectangle (GnomeCanvas *canvas,
- const ArtDRect *world_rectangle,
- ArtIRect *canvas_rectangle);
-void nautilus_gnome_canvas_world_to_window_rectangle (GnomeCanvas *canvas,
- const ArtDRect *world_rectangle,
- ArtIRect *window_rectangle);
-void nautilus_gnome_canvas_request_redraw_rectangle (GnomeCanvas *canvas,
- const ArtIRect *canvas_rectangle);
+void nautilus_gnome_canvas_world_to_canvas_rectangle (GnomeCanvas *canvas,
+ const ArtDRect *world_rectangle,
+ ArtIRect *canvas_rectangle);
+void nautilus_gnome_canvas_world_to_window_rectangle (GnomeCanvas *canvas,
+ const ArtDRect *world_rectangle,
+ ArtIRect *window_rectangle);
+void nautilus_gnome_canvas_request_redraw_rectangle (GnomeCanvas *canvas,
+ const ArtIRect *canvas_rectangle);
/* Requests the entire object be redrawn.
* Normally, you use request_update when calling from outside the canvas item
* code. This is for within canvas item code.
*/
-void nautilus_gnome_canvas_item_request_redraw (GnomeCanvasItem *item);
-
-void nautilus_gnome_canvas_draw_pixbuf (GnomeCanvasBuf *buf,
- const GdkPixbuf *pixbuf,
- int x,
- int y);
-
-void nautilus_gnome_canvas_fill_rgb (GnomeCanvasBuf *buf,
- art_u8 r,
- art_u8 g,
- art_u8 b);
+void nautilus_gnome_canvas_item_request_redraw (GnomeCanvasItem *item);
+void nautilus_gnome_canvas_draw_pixbuf (GnomeCanvasBuf *buf,
+ const GdkPixbuf *pixbuf,
+ int x,
+ int y);
+void nautilus_gnome_canvas_fill_rgb (GnomeCanvasBuf *buf,
+ art_u8 r,
+ art_u8 g,
+ art_u8 b);
/* More functions for ArtIRect and ArtDRect. */
-gboolean nautilus_art_irect_equal (const ArtIRect *rect_a,
- const ArtIRect *rect_b);
-gboolean nautilus_art_drect_equal (const ArtDRect *rect_a,
- const ArtDRect *rect_b);
-gboolean nautilus_art_irect_hits_irect (const ArtIRect *rect_a,
- const ArtIRect *rect_b);
-gboolean nautilus_art_irect_contains_irect (const ArtIRect *outer_rect,
- const ArtIRect *inner_rect);
+gboolean nautilus_art_irect_equal (const ArtIRect *rect_a,
+ const ArtIRect *rect_b);
+gboolean nautilus_art_drect_equal (const ArtDRect *rect_a,
+ const ArtDRect *rect_b);
+gboolean nautilus_art_irect_hits_irect (const ArtIRect *rect_a,
+ const ArtIRect *rect_b);
+gboolean nautilus_art_irect_contains_irect (const ArtIRect *outer_rect,
+ const ArtIRect *inner_rect);
/* More functions for GnomeDialog */
-GtkButton *nautilus_gnome_dialog_get_button_by_index (GnomeDialog *dialog,
- int index);
+GtkButton *nautilus_gnome_dialog_get_button_by_index (GnomeDialog *dialog,
+ int index);
/* Open up a new terminal, optionally passing in a command to execute */
-void nautilus_gnome_open_terminal (const char *command);
+void nautilus_gnome_open_terminal (const char *command);
-/* Set an icon on GnomeStock widget. If the setting fails register this
- * as a new file. Returns FALSE if even that failed */
-gboolean nautilus_gnome_stock_set_icon_or_register (GnomeStock *stock,
- const char *icon);
+/* Set an icon on GnomeStock widget. If the setting fails register this
+ * as a new file. Returns FALSE if even that failed.
+ */
+gboolean nautilus_gnome_stock_set_icon_or_register (GnomeStock *stock,
+ const char *icon);
#endif /* NAUTILUS_GNOME_EXTENSIONS_H */
diff --git a/libnautilus-extensions/nautilus-icon-container.c b/libnautilus-extensions/nautilus-icon-container.c
index d8de971dd..37b7a480c 100644
--- a/libnautilus-extensions/nautilus-icon-container.c
+++ b/libnautilus-extensions/nautilus-icon-container.c
@@ -388,10 +388,13 @@ nautilus_icon_container_scroll (NautilusIconContainer *container,
}
static void
-pending_icon_to_reveal_destroy_callback (NautilusIconCanvasItem *item, NautilusIconContainer *container)
+pending_icon_to_reveal_destroy_callback (NautilusIconCanvasItem *item,
+ NautilusIconContainer *container)
{
+ g_assert (NAUTILUS_IS_ICON_CONTAINER (container));
g_assert (container->details->pending_icon_to_reveal != NULL);
g_assert (container->details->pending_icon_to_reveal->item == item);
+
container->details->pending_icon_to_reveal = NULL;
}
@@ -419,7 +422,8 @@ set_pending_icon_to_reveal (NautilusIconContainer *container, NautilusIcon *icon
}
if (icon != NULL) {
- gtk_signal_connect (GTK_OBJECT (icon->item), "destroy", &pending_icon_to_reveal_destroy_callback, container);
+ gtk_signal_connect (GTK_OBJECT (icon->item), "destroy",
+ pending_icon_to_reveal_destroy_callback, container);
}
container->details->pending_icon_to_reveal = icon;
@@ -447,7 +451,7 @@ reveal_icon (NautilusIconContainer *container,
hadj = gtk_layout_get_hadjustment (GTK_LAYOUT (container));
vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (container));
- nautilus_gnome_canvas_item_get_current_canvas_bounds
+ nautilus_gnome_canvas_item_get_canvas_bounds
(GNOME_CANVAS_ITEM (icon->item), &bounds);
if (bounds.y0 < vadj->value) {
diff --git a/libnautilus-extensions/nautilus-xml-extensions.c b/libnautilus-extensions/nautilus-xml-extensions.c
index b41ad96f6..652b99b23 100644
--- a/libnautilus-extensions/nautilus-xml-extensions.c
+++ b/libnautilus-extensions/nautilus-xml-extensions.c
@@ -184,3 +184,33 @@ nautilus_xml_get_property_translated (xmlNodePtr parent,
xmlFree (untranslated_property);
return xmlStrdup (translated_property);
}
+
+void
+nautilus_xml_remove_node (xmlNodePtr node)
+{
+ g_return_if_fail (node != NULL);
+ g_return_if_fail (node->doc != NULL);
+ g_return_if_fail (node->parent != NULL);
+ g_return_if_fail (node->doc->xmlRootNode != node);
+
+ if (node->prev == NULL) {
+ g_assert (node->parent->xmlChildrenNode == node);
+ node->parent->xmlChildrenNode = node->next;
+ } else {
+ g_assert (node->parent->xmlChildrenNode != node);
+ node->prev->next = node->next;
+ }
+
+ if (node->next == NULL) {
+ g_assert (node->parent->last == node);
+ node->parent->last = node->prev;
+ } else {
+ g_assert (node->parent->last != node);
+ node->next->prev = node->prev;
+ }
+
+ node->doc = NULL;
+ node->parent = NULL;
+ node->next = NULL;
+ node->prev = NULL;
+}
diff --git a/libnautilus-extensions/nautilus-xml-extensions.h b/libnautilus-extensions/nautilus-xml-extensions.h
index fae0d05da..c0d528aa6 100644
--- a/libnautilus-extensions/nautilus-xml-extensions.h
+++ b/libnautilus-extensions/nautilus-xml-extensions.h
@@ -45,5 +45,6 @@ GList *nautilus_xml_get_property_for_children (xmlNodePtr parent,
const char *property_name);
xmlChar *nautilus_xml_get_property_translated (xmlNodePtr parent,
const char *property_name);
+void nautilus_xml_remove_node (xmlNodePtr node);
#endif /* NAUTILUS_XML_EXTENSIONS_H */
diff --git a/libnautilus-private/nautilus-directory-metafile.c b/libnautilus-private/nautilus-directory-metafile.c
index d3305bc27..865b94eb9 100644
--- a/libnautilus-private/nautilus-directory-metafile.c
+++ b/libnautilus-private/nautilus-directory-metafile.c
@@ -98,26 +98,30 @@ get_file_node (NautilusDirectory *directory,
const char *file_name,
gboolean create)
{
- xmlNode *root, *child;
+ xmlNode *root, *node;
g_assert (NAUTILUS_IS_DIRECTORY (directory));
if (directory->details->metafile_node_hash != NULL) {
- child = g_hash_table_lookup (directory->details->metafile_node_hash,
+ node = g_hash_table_lookup (directory->details->metafile_node_hash,
file_name);
- if (child != NULL) {
- return child;
+ if (node != NULL) {
+ return node;
}
}
if (create) {
- root = create_metafile_root (directory);
- child = xmlNewChild (root, NULL, "FILE", NULL);
- xmlSetProp (child, "NAME", file_name);
+ if (directory->details->metafile_read) {
+ root = create_metafile_root (directory);
+ node = xmlNewChild (root, NULL, "FILE", NULL);
+ } else {
+ node = xmlNewNode (NULL, "FILE");
+ }
+ xmlSetProp (node, "NAME", file_name);
g_hash_table_insert (directory->details->metafile_node_hash,
xmlMemStrdup (file_name),
- child);
- return child;
+ node);
+ return node;
}
return NULL;
@@ -550,8 +554,6 @@ nautilus_directory_get_file_metadata (NautilusDirectory *directory,
}
}
-
-
GList *
nautilus_directory_get_file_metadata_list (NautilusDirectory *directory,
const char *file_name,
@@ -575,7 +577,6 @@ nautilus_directory_get_file_metadata_list (NautilusDirectory *directory,
}
}
-
gboolean
nautilus_directory_set_file_metadata (NautilusDirectory *directory,
const char *file_name,
@@ -633,27 +634,27 @@ nautilus_directory_rename_file_metadata (NautilusDirectory *directory,
const char *old_file_name,
const char *new_file_name)
{
- xmlNode *file_node;
- GHashTable *directory_table;
gboolean found;
gpointer key, value;
+ xmlNode *file_node;
+ GHashTable *directory_table;
char *old_file_uri, *new_file_uri;
+ nautilus_directory_remove_file_metadata (directory, new_file_name);
+
if (directory->details->metafile_read) {
/* Move data in XML document if present. */
- file_node = get_file_node (directory, old_file_name, FALSE);
- if (file_node != NULL) {
- xmlSetProp (file_node, "NAME", new_file_name);
- found = g_hash_table_lookup_extended (directory->details->metafile_node_hash,
- old_file_name, &key, &value);
- g_assert (found);
+ found = g_hash_table_lookup_extended (directory->details->metafile_node_hash,
+ old_file_name, &key, &value);
+ if (found) {
g_assert (strcmp (key, old_file_name) == 0);
- g_assert (value == file_node);
+ file_node = value;
g_hash_table_remove (directory->details->metafile_node_hash,
old_file_name);
xmlFree (key);
g_hash_table_insert (directory->details->metafile_node_hash,
xmlMemStrdup (new_file_name), value);
+ xmlSetProp (file_node, "NAME", new_file_name);
nautilus_directory_request_write_metafile (directory);
}
} else {
@@ -741,8 +742,6 @@ nautilus_directory_metafile_apply_pending_changes (NautilusDirectory *directory)
directory->details->metadata_changes = NULL;
}
-
-
gboolean
nautilus_directory_get_boolean_file_metadata (NautilusDirectory *directory,
const char *file_name,
@@ -833,8 +832,6 @@ nautilus_directory_set_integer_file_metadata (NautilusDirectory *directory,
g_free (default_as_string);
}
-
-
static void
copy_file_metadata_for_key (NautilusDirectory *source_directory,
const char *source_file_name,
@@ -859,10 +856,13 @@ nautilus_directory_copy_file_metadata (NautilusDirectory *source_directory,
NautilusDirectory *destination_directory,
const char *destination_file_name)
{
- /* FIXME bugzilla.eazel.com 2808: This hard-coded set of keys is not right. */
/* FIXME bugzilla.eazel.com 3343: This does nothing to ensure
* the source directory metadata is read in.
*/
+
+ /* FIXME bugzilla.eazel.com 2808: Change this to copy all the
+ * metadata, not just a hard-coded set of keys.
+ */
copy_file_metadata_for_key
(source_directory, source_file_name,
destination_directory, destination_file_name,
@@ -883,19 +883,50 @@ nautilus_directory_copy_file_metadata (NautilusDirectory *source_directory,
(source_directory, source_file_name,
destination_directory, destination_file_name,
NAUTILUS_METADATA_KEY_CUSTOM_ICON);
+
+ /* FIXME: Do we want to copy the thumbnail here like in the
+ * rename and remove cases?
+ */
}
void
nautilus_directory_remove_file_metadata (NautilusDirectory *directory,
const char *file_name)
{
+ gboolean found;
+ gpointer key, value;
+ xmlNode *file_node;
+ GHashTable *directory_table;
char *file_uri;
- file_uri = nautilus_directory_get_file_uri (directory, file_name);
-
- /* FIXME bugzilla.eazel.com 2807: This is not implemented. */
+ if (directory->details->metafile_read) {
+ /* Remove data in XML document if present. */
+ found = g_hash_table_lookup_extended (directory->details->metafile_node_hash,
+ file_name, &key, &value);
+ if (found) {
+ g_assert (strcmp (key, file_name) == 0);
+ file_node = value;
+ g_hash_table_remove (directory->details->metafile_node_hash,
+ file_name);
+ xmlFree (key);
+ nautilus_xml_remove_node (file_node);
+ xmlFreeNode (file_node);
+ nautilus_directory_request_write_metafile (directory);
+ }
+ } else {
+ /* Remove data from hash table. */
+ directory_table = directory->details->metadata_changes;
+ found = g_hash_table_lookup_extended
+ (directory_table, file_name, &key, &value);
+ if (found) {
+ g_hash_table_remove (directory_table, file_name);
+ g_free (key);
+ metadata_value_destroy (value);
+ }
+ }
/* delete the thumbnails for the file, if any */
+ file_uri = nautilus_directory_get_file_uri (directory, file_name);
nautilus_remove_thumbnail_for_file (file_uri);
g_free (file_uri);
}
diff --git a/libnautilus-private/nautilus-directory.c b/libnautilus-private/nautilus-directory.c
index 7f3b9c26f..f60311069 100644
--- a/libnautilus-private/nautilus-directory.c
+++ b/libnautilus-private/nautilus-directory.c
@@ -1129,7 +1129,7 @@ nautilus_directory_schedule_metadata_copy (GList *uri_pairs)
GList *p;
URIPair *pair;
NautilusDirectory *source_directory, *destination_directory;
- char *source_file_name, *destination_file_name;
+ const char *source_relative_uri, *destination_relative_uri;
for (p = uri_pairs; p != NULL; p = p->next) {
pair = (URIPair *) p->data;
@@ -1137,16 +1137,13 @@ nautilus_directory_schedule_metadata_copy (GList *uri_pairs)
source_directory = get_parent_directory (pair->from_uri);
destination_directory = get_parent_directory (pair->to_uri);
- source_file_name = nautilus_uri_get_basename (pair->from_uri);
- destination_file_name = nautilus_uri_get_basename (pair->to_uri);
+ source_relative_uri = g_basename (pair->from_uri);
+ destination_relative_uri = g_basename (pair->to_uri);
nautilus_directory_copy_file_metadata (source_directory,
- source_file_name,
+ source_relative_uri,
destination_directory,
- destination_file_name);
-
- g_free (destination_file_name);
- g_free (source_file_name);
+ destination_relative_uri);
nautilus_directory_unref (source_directory);
nautilus_directory_unref (destination_directory);
@@ -1159,7 +1156,7 @@ nautilus_directory_schedule_metadata_move (GList *uri_pairs)
GList *p;
URIPair *pair;
NautilusDirectory *source_directory, *destination_directory;
- char *source_file_name, *destination_file_name;
+ const char *source_relative_uri, *destination_relative_uri;
for (p = uri_pairs; p != NULL; p = p->next) {
pair = (URIPair *) p->data;
@@ -1167,18 +1164,15 @@ nautilus_directory_schedule_metadata_move (GList *uri_pairs)
source_directory = get_parent_directory (pair->from_uri);
destination_directory = get_parent_directory (pair->to_uri);
- source_file_name = nautilus_uri_get_basename (pair->from_uri);
- destination_file_name = nautilus_uri_get_basename (pair->to_uri);
+ source_relative_uri = g_basename (pair->from_uri);
+ destination_relative_uri = g_basename (pair->to_uri);
nautilus_directory_copy_file_metadata (source_directory,
- source_file_name,
+ source_relative_uri,
destination_directory,
- destination_file_name);
+ destination_relative_uri);
nautilus_directory_remove_file_metadata (source_directory,
- source_file_name);
-
- g_free (destination_file_name);
- g_free (source_file_name);
+ source_relative_uri);
nautilus_directory_unref (source_directory);
nautilus_directory_unref (destination_directory);
@@ -1191,18 +1185,17 @@ nautilus_directory_schedule_metadata_remove (GList *uris)
GList *p;
const char *uri;
NautilusDirectory *directory;
- char *file_name;
+ const char *relative_uri;
for (p = uris; p != NULL; p = p->next) {
uri = (const char *) p->data;
directory = get_parent_directory (uri);
- file_name = nautilus_uri_get_basename (uri);
+ relative_uri = g_basename (uri);
nautilus_directory_remove_file_metadata (directory,
- file_name);
+ relative_uri);
- g_free (file_name);
nautilus_directory_unref (directory);
}
}
diff --git a/libnautilus-private/nautilus-file-operations.c b/libnautilus-private/nautilus-file-operations.c
index f22b97b4e..b1d506df3 100644
--- a/libnautilus-private/nautilus-file-operations.c
+++ b/libnautilus-private/nautilus-file-operations.c
@@ -488,8 +488,8 @@ typedef enum {
static char *
build_error_string (const char *source_name, const char *target_name,
- XferKind operation_kind, NautilusFileOperationsErrorKind error_kind,
- NautilusFileOperationsErrorLocation error_location, GnomeVFSResult error)
+ XferKind operation_kind, NautilusFileOperationsErrorKind error_kind,
+ NautilusFileOperationsErrorLocation error_location, GnomeVFSResult error)
{
/* Avoid clever message composing here, just use brute force and
* duplicate the different flavors of error messages for all the
@@ -510,7 +510,7 @@ build_error_string (const char *source_name, const char *target_name,
case XFER_MOVE:
case XFER_MOVE_TO_TRASH:
if (error_kind == ERROR_READ_ONLY) {
- error_string = _("Error while moving.\n"
+ error_string = _("Error while moving.\n\n"
"\"%s\" cannot be moved because it is on "
"a read-only disk.");
}
@@ -521,13 +521,13 @@ build_error_string (const char *source_name, const char *target_name,
switch (error_kind) {
case ERROR_NOT_ENOUGH_PERMISSIONS:
case ERROR_NOT_WRITABLE:
- error_string = _("Error while deleting.\n"
+ error_string = _("Error while deleting.\n\n"
"\"%s\" cannot be deleted because you do not have "
"permissions to modify its parent folder.");
break;
case ERROR_READ_ONLY:
- error_string = _("Error while deleting.\n"
+ error_string = _("Error while deleting.\n\n"
"\"%s\" cannot be deleted because it is on "
"a read-only disk.");
break;
@@ -558,14 +558,14 @@ build_error_string (const char *source_name, const char *target_name,
switch (operation_kind) {
case XFER_MOVE:
if (error_kind == ERROR_NOT_ENOUGH_PERMISSIONS) {
- error_string = _("Error while moving.\n"
+ error_string = _("Error while moving.\n\n"
"\"%s\" cannot be moved because you do not have "
"permissions to change it or its parent folder.");
}
break;
case XFER_MOVE_TO_TRASH:
if (error_kind == ERROR_NOT_ENOUGH_PERMISSIONS) {
- error_string = _("Error while moving.\n"
+ error_string = _("Error while moving.\n\n"
"\"%s\" cannot be moved to the trash because you do not have "
"permissions to change it or its parent folder.");
}
@@ -589,7 +589,7 @@ build_error_string (const char *source_name, const char *target_name,
case XFER_COPY:
case XFER_DUPLICATE:
if (error_kind == ERROR_NOT_READABLE) {
- error_string = _("Error while copying.\n"
+ error_string = _("Error while copying.\n\n"
"\"%s\" cannot be copied because you do not have "
"permissions to read it.");
}
@@ -611,16 +611,16 @@ build_error_string (const char *source_name, const char *target_name,
switch (operation_kind) {
case XFER_COPY:
case XFER_DUPLICATE:
- error_string = _("Error while copying to \"%s\".\n"
+ error_string = _("Error while copying to \"%s\".\n\n"
"There is not enough space on the destination.");
break;
case XFER_MOVE_TO_TRASH:
case XFER_MOVE:
- error_string = _("Error while moving to \"%s\".\n"
+ error_string = _("Error while moving to \"%s\".\n\n"
"There is not enough space on the destination.");
break;
case XFER_LINK:
- error_string = _("Error while creating link in \"%s\".\n"
+ error_string = _("Error while creating link in \"%s\".\n\n"
"There is not enough space on the destination.");
break;
default:
@@ -632,33 +632,33 @@ build_error_string (const char *source_name, const char *target_name,
case XFER_COPY:
case XFER_DUPLICATE:
if (error_kind == ERROR_NOT_ENOUGH_PERMISSIONS) {
- error_string = _("Error while copying to \"%s\".\n"
+ error_string = _("Error while copying to \"%s\".\n\n"
"You do not have permissions to write to "
"this folder.");
} else if (error_kind == ERROR_NOT_WRITABLE) {
- error_string = _("Error while copying to \"%s\".\n"
+ error_string = _("Error while copying to \"%s\".\n\n"
"The destination disk is read-only.");
}
break;
case XFER_MOVE:
case XFER_MOVE_TO_TRASH:
if (error_kind == ERROR_NOT_ENOUGH_PERMISSIONS) {
- error_string = _("Error while moving items to \"%s\".\n"
+ error_string = _("Error while moving items to \"%s\".\n\n"
"You do not have permissions to write to "
"this folder.");
} else if (error_kind == ERROR_NOT_WRITABLE) {
- error_string = _("Error while moving items to \"%s\".\n"
+ error_string = _("Error while moving items to \"%s\".\n\n"
"The destination disk is read-only.");
}
break;
case XFER_LINK:
if (error_kind == ERROR_NOT_ENOUGH_PERMISSIONS) {
- error_string = _("Error while creating links in \"%s\".\n"
+ error_string = _("Error while creating links in \"%s\".\n\n"
"You do not have permissions to write to "
"this folder.");
} else if (error_kind == ERROR_NOT_WRITABLE) {
- error_string = _("Error while creating links in \"%s\".\n"
+ error_string = _("Error while creating links in \"%s\".\n\n"
"The destination disk is read-only.");
}
break;
@@ -687,21 +687,21 @@ build_error_string (const char *source_name, const char *target_name,
switch (operation_kind) {
case XFER_COPY:
case XFER_DUPLICATE:
- error_string = _("Error \"%s\" while copying \"%s\".\n"
+ error_string = _("Error \"%s\" while copying \"%s\".\n\n"
"Would you like to continue?");
break;
case XFER_MOVE:
- error_string = _("Error \"%s\" while moving \"%s\".\n"
+ error_string = _("Error \"%s\" while moving \"%s\".\n\n"
"Would you like to continue?");
break;
case XFER_LINK:
- error_string = _("Error \"%s\" while creating a link to \"%s\".\n"
+ error_string = _("Error \"%s\" while creating a link to \"%s\".\n\n"
"Would you like to continue?");
break;
case XFER_DELETE:
case XFER_EMPTY_TRASH:
case XFER_MOVE_TO_TRASH:
- error_string = _("Error \"%s\" while deleting \"%s\".\n"
+ error_string = _("Error \"%s\" while deleting \"%s\".\n\n"
"Would you like to continue?");
break;
default:
@@ -716,21 +716,21 @@ build_error_string (const char *source_name, const char *target_name,
switch (operation_kind) {
case XFER_COPY:
case XFER_DUPLICATE:
- error_string = _("Error \"%s\" while copying.\n"
+ error_string = _("Error \"%s\" while copying.\n\n"
"Would you like to continue?");
break;
case XFER_MOVE:
- error_string = _("Error \"%s\" while moving.\n"
+ error_string = _("Error \"%s\" while moving.\n\n"
"Would you like to continue?");
break;
case XFER_LINK:
- error_string = _("Error \"%s\" while linking.\n"
+ error_string = _("Error \"%s\" while linking.\n\n"
"Would you like to continue?");
break;
case XFER_DELETE:
case XFER_EMPTY_TRASH:
case XFER_MOVE_TO_TRASH:
- error_string = _("Error \"%s\" while deleting.\n"
+ error_string = _("Error \"%s\" while deleting.\n\n"
"Would you like to continue?");
break;
default:
@@ -938,7 +938,7 @@ handle_xfer_overwrite (const GnomeVFSXferProgressInfo *progress_info,
char *unescaped_name;
unescaped_name = nautilus_format_name_for_display (progress_info->target_name);
- text = g_strdup_printf (_("File \"%s\" already exists.\n"
+ text = g_strdup_printf (_("File \"%s\" already exists.\n\n"
"Would you like to replace it?"),
unescaped_name);
g_free (unescaped_name);
@@ -1409,13 +1409,17 @@ sync_xfer_callback (GnomeVFSXferProgressInfo *progress_info, gpointer data)
/* this is one of the selected copied or moved items -- we need
* to make sure it's metadata gets copied over
*/
- g_assert (progress_info->source_name != NULL);
- nautilus_file_changes_queue_schedule_metadata_copy
- (progress_info->source_name, progress_info->target_name);
-
- apply_one_position (position_iterator, progress_info->source_name,
- progress_info->target_name);
-
+ if (progress_info->source_name == NULL) {
+ /* remove any old metadata */
+ nautilus_file_changes_queue_schedule_metadata_remove
+ (progress_info->target_name);
+ } else {
+ nautilus_file_changes_queue_schedule_metadata_copy
+ (progress_info->source_name, progress_info->target_name);
+
+ apply_one_position (position_iterator, progress_info->source_name,
+ progress_info->target_name);
+ }
if (debuting_uris != NULL) {
g_hash_table_insert (debuting_uris, g_strdup (progress_info->target_name), NULL);
}
@@ -1426,20 +1430,21 @@ sync_xfer_callback (GnomeVFSXferProgressInfo *progress_info, gpointer data)
case GNOME_VFS_XFER_PHASE_MOVING:
if (progress_info->top_level_item) {
g_assert (progress_info->source_name != NULL);
+
nautilus_file_changes_queue_schedule_metadata_move
(progress_info->source_name, progress_info->target_name);
-
+
apply_one_position (position_iterator, progress_info->source_name,
- progress_info->target_name);
-
+ progress_info->target_name);
+
if (debuting_uris != NULL) {
g_hash_table_insert (debuting_uris, g_strdup (progress_info->target_name), NULL);
}
}
nautilus_file_changes_queue_file_moved (progress_info->source_name,
- progress_info->target_name);
+ progress_info->target_name);
break;
-
+
case GNOME_VFS_XFER_PHASE_DELETESOURCE:
if (progress_info->top_level_item) {
g_assert (progress_info->source_name != NULL);
@@ -1448,7 +1453,7 @@ sync_xfer_callback (GnomeVFSXferProgressInfo *progress_info, gpointer data)
}
nautilus_file_changes_queue_file_removed (progress_info->source_name);
break;
-
+
case GNOME_VFS_XFER_PHASE_COMPLETED:
/* done, clean up */
icon_position_iterator_free (position_iterator);
@@ -1775,8 +1780,8 @@ nautilus_file_operations_copy_move (const GList *item_uris,
gnome_vfs_async_xfer (&xfer_info->handle, source_uri_list, target_uri_list,
move_options, GNOME_VFS_XFER_ERROR_MODE_QUERY,
GNOME_VFS_XFER_OVERWRITE_MODE_QUERY,
- &update_xfer_callback, xfer_info,
- &sync_xfer_callback, sync_xfer_info);
+ update_xfer_callback, xfer_info,
+ sync_xfer_callback, sync_xfer_info);
}
gnome_vfs_uri_list_free (source_uri_list);
@@ -1803,26 +1808,28 @@ handle_new_folder_vfs_error (const GnomeVFSXferProgressInfo *progress_info, NewF
error_string_to_free = NULL;
if (progress_info->vfs_status == GNOME_VFS_ERROR_ACCESS_DENIED) {
- error_string = _("Error creating new folder.\n"
- "You do not have permissions to write to the destination.");
+ error_string = _("Error creating new folder.\n\n"
+ "You do not have permissions to write to the destination.");
} else if (progress_info->vfs_status == GNOME_VFS_ERROR_NO_SPACE) {
- error_string = _("Error creating new folder.\n"
- "There is no space on the destination.");
+ error_string = _("Error creating new folder.\n\n"
+ "There is no space on the destination.");
} else {
error_string = g_strdup_printf (_("Error \"%s\" creating new folder."),
- gnome_vfs_result_to_string(progress_info->vfs_status));
+ gnome_vfs_result_to_string(progress_info->vfs_status));
}
-
- nautilus_error_dialog (error_string, _("Error creating new folder"), GTK_WINDOW (state->parent_view));
-
+
+ nautilus_error_dialog (error_string, _("Error creating new folder"),
+ GTK_WINDOW (state->parent_view));
+
g_free (error_string_to_free);
-
+
return GNOME_VFS_XFER_ERROR_ACTION_ABORT;
}
static int
new_folder_xfer_callback (GnomeVFSAsyncHandle *handle,
- GnomeVFSXferProgressInfo *progress_info, gpointer data)
+ GnomeVFSXferProgressInfo *progress_info,
+ gpointer data)
{
NewFolderXferState *state;
char *temp_string;
@@ -1832,7 +1839,7 @@ new_folder_xfer_callback (GnomeVFSAsyncHandle *handle,
switch (progress_info->status) {
case GNOME_VFS_XFER_PROGRESS_STATUS_OK:
nautilus_file_changes_consume_changes (TRUE);
- (state->done_callback) (progress_info->target_name, state->data);
+ (* state->done_callback) (progress_info->target_name, state->data);
g_free (state);
return 0;
@@ -1846,13 +1853,15 @@ new_folder_xfer_callback (GnomeVFSAsyncHandle *handle,
progress_info->duplicate_name[8] = '\0';
g_free (temp_string);
temp_string = progress_info->duplicate_name;
- progress_info->duplicate_name = g_strdup_printf ("%s.%d",
- progress_info->duplicate_name,
- progress_info->duplicate_count);
+ progress_info->duplicate_name = g_strdup_printf
+ ("%s.%d",
+ progress_info->duplicate_name,
+ progress_info->duplicate_count);
} else {
- progress_info->duplicate_name = g_strdup_printf ("%s%%20%d",
- progress_info->duplicate_name,
- progress_info->duplicate_count);
+ progress_info->duplicate_name = g_strdup_printf
+ ("%s%%20%d",
+ progress_info->duplicate_name,
+ progress_info->duplicate_count);
}
g_free (temp_string);
return GNOME_VFS_XFER_ERROR_ACTION_SKIP;
@@ -1871,7 +1880,7 @@ new_folder_xfer_callback (GnomeVFSAsyncHandle *handle,
void
nautilus_file_operations_new_folder (GtkWidget *parent_view,
const char *parent_dir,
- void (*done_callback)(const char *, gpointer),
+ void (*done_callback) (const char *, gpointer),
gpointer data)
{
NewFolderXferState *state;
@@ -1893,8 +1902,8 @@ nautilus_file_operations_new_folder (GtkWidget *parent_view,
GNOME_VFS_XFER_NEW_UNIQUE_DIRECTORY,
GNOME_VFS_XFER_ERROR_MODE_QUERY,
GNOME_VFS_XFER_OVERWRITE_MODE_QUERY,
- &new_folder_xfer_callback, state,
- &sync_xfer_callback, NULL);
+ new_folder_xfer_callback, state,
+ sync_xfer_callback, NULL);
gnome_vfs_uri_list_free (target_uri_list);
gnome_vfs_uri_unref (parent_uri);
@@ -2005,8 +2014,8 @@ nautilus_file_operations_move_to_trash (const GList *item_uris,
GNOME_VFS_XFER_REMOVESOURCE | GNOME_VFS_XFER_USE_UNIQUE_NAMES,
GNOME_VFS_XFER_ERROR_MODE_QUERY,
GNOME_VFS_XFER_OVERWRITE_MODE_REPLACE,
- &update_xfer_callback, xfer_info,
- &sync_xfer_callback, NULL);
+ update_xfer_callback, xfer_info,
+ sync_xfer_callback, NULL);
}
@@ -2052,8 +2061,8 @@ nautilus_file_operations_delete (const GList *item_uris,
GNOME_VFS_XFER_DELETE_ITEMS | GNOME_VFS_XFER_RECURSIVE,
GNOME_VFS_XFER_ERROR_MODE_QUERY,
GNOME_VFS_XFER_OVERWRITE_MODE_REPLACE,
- &update_xfer_callback, xfer_info,
- &sync_xfer_callback, NULL);
+ update_xfer_callback, xfer_info,
+ sync_xfer_callback, NULL);
gnome_vfs_uri_list_free (uri_list);
}
@@ -2088,8 +2097,8 @@ do_empty_trash (GtkWidget *parent_view)
GNOME_VFS_XFER_EMPTY_DIRECTORIES,
GNOME_VFS_XFER_ERROR_MODE_QUERY,
GNOME_VFS_XFER_OVERWRITE_MODE_REPLACE,
- &update_xfer_callback, xfer_info,
- &sync_xfer_callback, NULL);
+ update_xfer_callback, xfer_info,
+ sync_xfer_callback, NULL);
}
gnome_vfs_uri_list_free (trash_dir_list);
@@ -2145,53 +2154,37 @@ nautilus_file_operations_empty_trash (GtkWidget *parent_view)
#if !defined (NAUTILUS_OMIT_SELF_CHECK)
-static gboolean
-test_next_duplicate_name (const char *name, const char *expected_next_name)
-{
- gboolean result;
- char *next_name;
-
- next_name = get_duplicate_name (name, 1);
- result = strcmp (expected_next_name, next_name) == 0;
- if (!result) {
- printf("expected %s, got %s\n", expected_next_name, next_name);
- }
- g_free (next_name);
-
- return result;
-}
-
void
nautilus_self_check_file_operations (void)
{
/* test the next duplicate name generator */
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_(" (copy)"), _(" (another copy)")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo"), _("foo (copy)")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_(".bashrc"), _(".bashrc (copy)")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_(".foo.txt"), _(".foo (copy).txt")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo foo"), _("foo foo (copy)")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo.txt"), _("foo (copy).txt")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo foo.txt"), _("foo foo (copy).txt")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo foo.txt txt"), _("foo foo (copy).txt txt")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo...txt"), _("foo.. (copy).txt")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo..."), _("foo... (copy)")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo. (copy)"), _("foo. (another copy)")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo (copy)"), _("foo (another copy)")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo (copy).txt"), _("foo (another copy).txt")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo (another copy)"), _("foo (3rd copy)")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo (another copy).txt"), _("foo (3rd copy).txt")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo foo (another copy).txt"), _("foo foo (3rd copy).txt")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo (21st copy)"), _("foo (22nd copy)")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo (21st copy).txt"), _("foo (22nd copy).txt")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo (22nd copy)"), _("foo (23rd copy)")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo (22nd copy).txt"), _("foo (23rd copy).txt")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo (23rd copy)"), _("foo (24th copy)")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo (23rd copy).txt"), _("foo (24th copy).txt")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo (24th copy)"), _("foo (25th copy)")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo (24th copy).txt"), _("foo (25th copy).txt")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo foo (24th copy)"), _("foo foo (25th copy)")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo foo (24th copy).txt"), _("foo foo (25th copy).txt")), TRUE);
- NAUTILUS_CHECK_BOOLEAN_RESULT (test_next_duplicate_name (_("foo foo (100000000000000th copy).txt"), _("foo foo (copy).txt")), TRUE);
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_(" (copy)"), 1), _(" (another copy)"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo"), 1), _("foo (copy)"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_(".bashrc"), 1), _(".bashrc (copy)"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_(".foo.txt"), 1), _(".foo (copy).txt"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo foo"), 1), _("foo foo (copy)"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo.txt"), 1), _("foo (copy).txt"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo foo.txt"), 1), _("foo foo (copy).txt"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo foo.txt txt"), 1), _("foo foo (copy).txt txt"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo...txt"), 1), _("foo.. (copy).txt"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo..."), 1), _("foo... (copy)"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo. (copy)"), 1), _("foo. (another copy)"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo (copy)"), 1), _("foo (another copy)"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo (copy).txt"), 1), _("foo (another copy).txt"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo (another copy)"), 1), _("foo (3rd copy)"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo (another copy).txt"), 1), _("foo (3rd copy).txt"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo foo (another copy).txt"), 1), _("foo foo (3rd copy).txt"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo (21st copy)"), 1), _("foo (22nd copy)"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo (21st copy).txt"), 1), _("foo (22nd copy).txt"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo (22nd copy)"), 1), _("foo (23rd copy)"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo (22nd copy).txt"), 1), _("foo (23rd copy).txt"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo (23rd copy)"), 1), _("foo (24th copy)"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo (23rd copy).txt"), 1), _("foo (24th copy).txt"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo (24th copy)"), 1), _("foo (25th copy)"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo (24th copy).txt"), 1), _("foo (25th copy).txt"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo foo (24th copy)"), 1), _("foo foo (25th copy)"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo foo (24th copy).txt"), 1), _("foo foo (25th copy).txt"));
+ NAUTILUS_CHECK_STRING_RESULT (get_duplicate_name (_("foo foo (100000000000000th copy).txt"), 1), _("foo foo (copy).txt"));
}
#endif
diff --git a/libnautilus-private/nautilus-glib-extensions.c b/libnautilus-private/nautilus-glib-extensions.c
index df028fdd6..0c422665f 100644
--- a/libnautilus-private/nautilus-glib-extensions.c
+++ b/libnautilus-private/nautilus-glib-extensions.c
@@ -30,8 +30,10 @@
#include "nautilus-lib-self-check-functions.h"
#include "nautilus-string.h"
#include <ctype.h>
-#include <sys/time.h>
+#include <libgnome/gnome-defs.h>
+#include <libgnome/gnome-i18n.h>
#include <stdlib.h>
+#include <sys/time.h>
/* Legal conversion specifiers, as specified in the C standard. */
#define C_STANDARD_STRFTIME_CHARACTERS "aAbBcdHIjmMpSUwWxXyYZ"
@@ -1166,9 +1168,14 @@ nautilus_self_check_glib_extensions (void)
NAUTILUS_CHECK_STRING_RESULT (test_strftime (huge_string, 2000, 1, 1, 0, 0, 0), huge_string);
NAUTILUS_CHECK_STRING_RESULT (test_strftime ("%%", 2000, 1, 1, 1, 0, 0), "%");
NAUTILUS_CHECK_STRING_RESULT (test_strftime ("%%%%", 2000, 1, 1, 1, 0, 0), "%%");
- NAUTILUS_CHECK_STRING_RESULT (test_strftime ("%m/%d/%y, %I:%M %p", 2000, 1, 1, 1, 0, 0), "01/01/00, 01:00 AM");
- NAUTILUS_CHECK_STRING_RESULT (test_strftime ("%-m/%-d/%y, %-I:%M %p", 2000, 1, 1, 1, 0, 0), "1/1/00, 1:00 AM");
- NAUTILUS_CHECK_STRING_RESULT (test_strftime ("%_m/%_d/%y, %_I:%M %p", 2000, 1, 1, 1, 0, 0), " 1/ 1/00, 1:00 AM");
+ /* localizers: These strings are part of the strftime
+ * self-check code and must be changed to match what strtfime
+ * yields -- usually just omitting the AM part is all that's
+ * needed.
+ */
+ NAUTILUS_CHECK_STRING_RESULT (test_strftime ("%m/%d/%y, %I:%M %p", 2000, 1, 1, 1, 0, 0), _("01/01/00, 01:00 AM"));
+ NAUTILUS_CHECK_STRING_RESULT (test_strftime ("%-m/%-d/%y, %-I:%M %p", 2000, 1, 1, 1, 0, 0), _("1/1/00, 1:00 AM"));
+ NAUTILUS_CHECK_STRING_RESULT (test_strftime ("%_m/%_d/%y, %_I:%M %p", 2000, 1, 1, 1, 0, 0), _(" 1/ 1/00, 1:00 AM"));
g_free (huge_string);
diff --git a/libnautilus-private/nautilus-gnome-extensions.c b/libnautilus-private/nautilus-gnome-extensions.c
index bc29e1913..3d2759357 100644
--- a/libnautilus-private/nautilus-gnome-extensions.c
+++ b/libnautilus-private/nautilus-gnome-extensions.c
@@ -195,6 +195,18 @@ nautilus_gnome_canvas_item_get_world_bounds (GnomeCanvasItem *item,
}
}
+void
+nautilus_gnome_canvas_item_get_canvas_bounds (GnomeCanvasItem *item,
+ ArtIRect *canvas_bounds)
+{
+ ArtDRect world_bounds;
+
+ nautilus_gnome_canvas_item_get_world_bounds
+ (item, &world_bounds);
+ nautilus_gnome_canvas_world_to_canvas_rectangle
+ (item->canvas, &world_bounds, canvas_bounds);
+}
+
static void
nautilus_gnome_canvas_draw_pixbuf_helper (art_u8 *dst, int dst_rowstride,
const art_u8 *src, int src_rowstride,
diff --git a/libnautilus-private/nautilus-gnome-extensions.h b/libnautilus-private/nautilus-gnome-extensions.h
index f0c3d8024..d64b251f4 100644
--- a/libnautilus-private/nautilus-gnome-extensions.h
+++ b/libnautilus-private/nautilus-gnome-extensions.h
@@ -40,90 +40,95 @@ typedef struct {
} NautilusArtIPoint;
/* Causes an update as needed. The GnomeCanvas code says it should, but it doesn't. */
-void nautilus_gnome_canvas_set_scroll_region (GnomeCanvas *canvas,
- double x1,
- double y1,
- double x2,
- double y2);
+void nautilus_gnome_canvas_set_scroll_region (GnomeCanvas *canvas,
+ double x1,
+ double y1,
+ double x2,
+ double y2);
/* Make the scroll region bigger so the code in GnomeCanvas won't center it. */
-void nautilus_gnome_canvas_set_scroll_region_left_justify (GnomeCanvas *canvas,
- double x1,
- double y1,
- double x2,
- double y2);
+void nautilus_gnome_canvas_set_scroll_region_left_justify (GnomeCanvas *canvas,
+ double x1,
+ double y1,
+ double x2,
+ double y2);
/* Set a new scroll region without eliminating any of the currently-visible area. */
void nautilus_gnome_canvas_set_scroll_region_include_visible_area (GnomeCanvas *canvas,
- double x1,
- double y1,
- double x2,
- double y2);
+ double x1,
+ double y1,
+ double x2,
+ double y2);
/* For cases where you need to get more than one item updated. */
-void nautilus_gnome_canvas_request_update_all (GnomeCanvas *canvas);
-void nautilus_gnome_canvas_item_request_update_deep (GnomeCanvasItem *item);
+void nautilus_gnome_canvas_request_update_all (GnomeCanvas *canvas);
+void nautilus_gnome_canvas_item_request_update_deep (GnomeCanvasItem *item);
/* This is more handy than gnome_canvas_item_get_bounds because it
* always returns the bounds * in world coordinates and it returns
* them in a single rectangle.
*/
-void nautilus_gnome_canvas_item_get_world_bounds (GnomeCanvasItem *item,
- ArtDRect *world_bounds);
+void nautilus_gnome_canvas_item_get_world_bounds (GnomeCanvasItem *item,
+ ArtDRect *world_bounds);
/* This returns the current canvas bounds as computed by update.
* It's not as "up to date" as get_bounds, which is accurate even
* before an update happens.
*/
-void nautilus_gnome_canvas_item_get_current_canvas_bounds (GnomeCanvasItem *item,
- ArtIRect *canvas_bounds);
+void nautilus_gnome_canvas_item_get_current_canvas_bounds (GnomeCanvasItem *item,
+ ArtIRect *canvas_bounds);
+
+/* This returns the canvas bounds in a slower way that's always up to
+ * date, even before an update.
+ */
+void nautilus_gnome_canvas_item_get_canvas_bounds (GnomeCanvasItem *item,
+ ArtIRect *canvas_bounds);
/* Convenience functions for doing things with whole rectangles. */
-void nautilus_gnome_canvas_world_to_canvas_rectangle (GnomeCanvas *canvas,
- const ArtDRect *world_rectangle,
- ArtIRect *canvas_rectangle);
-void nautilus_gnome_canvas_world_to_window_rectangle (GnomeCanvas *canvas,
- const ArtDRect *world_rectangle,
- ArtIRect *window_rectangle);
-void nautilus_gnome_canvas_request_redraw_rectangle (GnomeCanvas *canvas,
- const ArtIRect *canvas_rectangle);
+void nautilus_gnome_canvas_world_to_canvas_rectangle (GnomeCanvas *canvas,
+ const ArtDRect *world_rectangle,
+ ArtIRect *canvas_rectangle);
+void nautilus_gnome_canvas_world_to_window_rectangle (GnomeCanvas *canvas,
+ const ArtDRect *world_rectangle,
+ ArtIRect *window_rectangle);
+void nautilus_gnome_canvas_request_redraw_rectangle (GnomeCanvas *canvas,
+ const ArtIRect *canvas_rectangle);
/* Requests the entire object be redrawn.
* Normally, you use request_update when calling from outside the canvas item
* code. This is for within canvas item code.
*/
-void nautilus_gnome_canvas_item_request_redraw (GnomeCanvasItem *item);
-
-void nautilus_gnome_canvas_draw_pixbuf (GnomeCanvasBuf *buf,
- const GdkPixbuf *pixbuf,
- int x,
- int y);
-
-void nautilus_gnome_canvas_fill_rgb (GnomeCanvasBuf *buf,
- art_u8 r,
- art_u8 g,
- art_u8 b);
+void nautilus_gnome_canvas_item_request_redraw (GnomeCanvasItem *item);
+void nautilus_gnome_canvas_draw_pixbuf (GnomeCanvasBuf *buf,
+ const GdkPixbuf *pixbuf,
+ int x,
+ int y);
+void nautilus_gnome_canvas_fill_rgb (GnomeCanvasBuf *buf,
+ art_u8 r,
+ art_u8 g,
+ art_u8 b);
/* More functions for ArtIRect and ArtDRect. */
-gboolean nautilus_art_irect_equal (const ArtIRect *rect_a,
- const ArtIRect *rect_b);
-gboolean nautilus_art_drect_equal (const ArtDRect *rect_a,
- const ArtDRect *rect_b);
-gboolean nautilus_art_irect_hits_irect (const ArtIRect *rect_a,
- const ArtIRect *rect_b);
-gboolean nautilus_art_irect_contains_irect (const ArtIRect *outer_rect,
- const ArtIRect *inner_rect);
+gboolean nautilus_art_irect_equal (const ArtIRect *rect_a,
+ const ArtIRect *rect_b);
+gboolean nautilus_art_drect_equal (const ArtDRect *rect_a,
+ const ArtDRect *rect_b);
+gboolean nautilus_art_irect_hits_irect (const ArtIRect *rect_a,
+ const ArtIRect *rect_b);
+gboolean nautilus_art_irect_contains_irect (const ArtIRect *outer_rect,
+ const ArtIRect *inner_rect);
/* More functions for GnomeDialog */
-GtkButton *nautilus_gnome_dialog_get_button_by_index (GnomeDialog *dialog,
- int index);
+GtkButton *nautilus_gnome_dialog_get_button_by_index (GnomeDialog *dialog,
+ int index);
/* Open up a new terminal, optionally passing in a command to execute */
-void nautilus_gnome_open_terminal (const char *command);
+void nautilus_gnome_open_terminal (const char *command);
-/* Set an icon on GnomeStock widget. If the setting fails register this
- * as a new file. Returns FALSE if even that failed */
-gboolean nautilus_gnome_stock_set_icon_or_register (GnomeStock *stock,
- const char *icon);
+/* Set an icon on GnomeStock widget. If the setting fails register this
+ * as a new file. Returns FALSE if even that failed.
+ */
+gboolean nautilus_gnome_stock_set_icon_or_register (GnomeStock *stock,
+ const char *icon);
#endif /* NAUTILUS_GNOME_EXTENSIONS_H */
diff --git a/libnautilus-private/nautilus-icon-container.c b/libnautilus-private/nautilus-icon-container.c
index d8de971dd..37b7a480c 100644
--- a/libnautilus-private/nautilus-icon-container.c
+++ b/libnautilus-private/nautilus-icon-container.c
@@ -388,10 +388,13 @@ nautilus_icon_container_scroll (NautilusIconContainer *container,
}
static void
-pending_icon_to_reveal_destroy_callback (NautilusIconCanvasItem *item, NautilusIconContainer *container)
+pending_icon_to_reveal_destroy_callback (NautilusIconCanvasItem *item,
+ NautilusIconContainer *container)
{
+ g_assert (NAUTILUS_IS_ICON_CONTAINER (container));
g_assert (container->details->pending_icon_to_reveal != NULL);
g_assert (container->details->pending_icon_to_reveal->item == item);
+
container->details->pending_icon_to_reveal = NULL;
}
@@ -419,7 +422,8 @@ set_pending_icon_to_reveal (NautilusIconContainer *container, NautilusIcon *icon
}
if (icon != NULL) {
- gtk_signal_connect (GTK_OBJECT (icon->item), "destroy", &pending_icon_to_reveal_destroy_callback, container);
+ gtk_signal_connect (GTK_OBJECT (icon->item), "destroy",
+ pending_icon_to_reveal_destroy_callback, container);
}
container->details->pending_icon_to_reveal = icon;
@@ -447,7 +451,7 @@ reveal_icon (NautilusIconContainer *container,
hadj = gtk_layout_get_hadjustment (GTK_LAYOUT (container));
vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (container));
- nautilus_gnome_canvas_item_get_current_canvas_bounds
+ nautilus_gnome_canvas_item_get_canvas_bounds
(GNOME_CANVAS_ITEM (icon->item), &bounds);
if (bounds.y0 < vadj->value) {
diff --git a/libnautilus-private/nautilus-xml-extensions.c b/libnautilus-private/nautilus-xml-extensions.c
index b41ad96f6..652b99b23 100644
--- a/libnautilus-private/nautilus-xml-extensions.c
+++ b/libnautilus-private/nautilus-xml-extensions.c
@@ -184,3 +184,33 @@ nautilus_xml_get_property_translated (xmlNodePtr parent,
xmlFree (untranslated_property);
return xmlStrdup (translated_property);
}
+
+void
+nautilus_xml_remove_node (xmlNodePtr node)
+{
+ g_return_if_fail (node != NULL);
+ g_return_if_fail (node->doc != NULL);
+ g_return_if_fail (node->parent != NULL);
+ g_return_if_fail (node->doc->xmlRootNode != node);
+
+ if (node->prev == NULL) {
+ g_assert (node->parent->xmlChildrenNode == node);
+ node->parent->xmlChildrenNode = node->next;
+ } else {
+ g_assert (node->parent->xmlChildrenNode != node);
+ node->prev->next = node->next;
+ }
+
+ if (node->next == NULL) {
+ g_assert (node->parent->last == node);
+ node->parent->last = node->prev;
+ } else {
+ g_assert (node->parent->last != node);
+ node->next->prev = node->prev;
+ }
+
+ node->doc = NULL;
+ node->parent = NULL;
+ node->next = NULL;
+ node->prev = NULL;
+}
diff --git a/libnautilus-private/nautilus-xml-extensions.h b/libnautilus-private/nautilus-xml-extensions.h
index fae0d05da..c0d528aa6 100644
--- a/libnautilus-private/nautilus-xml-extensions.h
+++ b/libnautilus-private/nautilus-xml-extensions.h
@@ -45,5 +45,6 @@ GList *nautilus_xml_get_property_for_children (xmlNodePtr parent,
const char *property_name);
xmlChar *nautilus_xml_get_property_translated (xmlNodePtr parent,
const char *property_name);
+void nautilus_xml_remove_node (xmlNodePtr node);
#endif /* NAUTILUS_XML_EXTENSIONS_H */
diff --git a/src/file-manager/nautilus-directory-view-ui.xml b/src/file-manager/nautilus-directory-view-ui.xml
index 319a1d434..922b28bfa 100644
--- a/src/file-manager/nautilus-directory-view-ui.xml
+++ b/src/file-manager/nautilus-directory-view-ui.xml
@@ -138,10 +138,10 @@
<menuitem name="Open" verb="Open"/>
<menuitem name="OpenNew" verb="OpenNew"/>
<submenu name="Open With" _label="Open With">
- <placeholder name="Applications Placeholder"/>
+ <placeholder name="Applications Placeholder" delimit="none"/>
<menuitem name="OtherApplication" verb="OtherApplication"/>
<separator/>
- <placeholder name="Viewers Placeholder"/>
+ <placeholder name="Viewers Placeholder" delimit="none"/>
<menuitem name="OtherViewer" verb="OtherViewer"/>
</submenu>
</placeholder>
diff --git a/src/nautilus-shell-ui.xml b/src/nautilus-shell-ui.xml
index 3ad0d82db..64a4b03c1 100644
--- a/src/nautilus-shell-ui.xml
+++ b/src/nautilus-shell-ui.xml
@@ -345,7 +345,7 @@
<popups>
<popup name="background">
<placeholder name="Before Zoom Items" delimit="none">
- <placeholder name="New Items">
+ <placeholder name="New Items" delimit="none">
<menuitem name="New Window" verb="New Window"/>
</placeholder>
</placeholder>