diff options
author | Darin Adler <darin@src.gnome.org> | 2001-04-20 21:24:55 +0000 |
---|---|---|
committer | Darin Adler <darin@src.gnome.org> | 2001-04-20 21:24:55 +0000 |
commit | 6752bb0fff395f31b17e9115d1bef624d3cb93e1 (patch) | |
tree | 2956701539c6f20143d837f9671ff46adfcb3118 | |
parent | 9ccec0aff0ee2d1a6d5127177031a6243eef68ba (diff) | |
download | nautilus-6752bb0fff395f31b17e9115d1bef624d3cb93e1.tar.gz |
Fixed bug where the monitor would be "left behind" when a file was
moved from one directory to another.
* libnautilus-extensions/nautilus-directory-private.h:
* libnautilus-extensions/nautilus-directory-async.c:
(nautilus_directory_remove_file_monitors),
(nautilus_directory_add_file_monitors): New calls to remove a
file's monitors from one directory and add it to another.
* libnautilus-extensions/nautilus-file.c:
(nautilus_file_set_directory): Call the new calls.
* configure.in: Paths from change yesterday were wrong. Had to fix
them to make RPM builds work again.
* libnautilus-extensions/nautilus-link.c:
(nautilus_link_local_create_from_gnome_entry): Fix, based on patch
from fcrozat@mandrakesoft.com, to handle the URL versions
of gnome-entry properly.
-rw-r--r-- | ChangeLog | 23 | ||||
-rw-r--r-- | configure.in | 8 | ||||
-rw-r--r-- | libnautilus-extensions/nautilus-directory-async.c | 52 | ||||
-rw-r--r-- | libnautilus-extensions/nautilus-directory-private.h | 9 | ||||
-rw-r--r-- | libnautilus-extensions/nautilus-file.c | 3 | ||||
-rw-r--r-- | libnautilus-extensions/nautilus-link.c | 2 | ||||
-rw-r--r-- | libnautilus-private/nautilus-directory-async.c | 52 | ||||
-rw-r--r-- | libnautilus-private/nautilus-directory-private.h | 9 | ||||
-rw-r--r-- | libnautilus-private/nautilus-file.c | 3 | ||||
-rw-r--r-- | libnautilus-private/nautilus-link.c | 2 |
10 files changed, 156 insertions, 7 deletions
@@ -1,3 +1,24 @@ +2001-04-20 Darin Adler <darin@eazel.com> + + Fixed bug where the monitor would be "left behind" when a file was + moved from one directory to another. + + * libnautilus-extensions/nautilus-directory-private.h: + * libnautilus-extensions/nautilus-directory-async.c: + (nautilus_directory_remove_file_monitors), + (nautilus_directory_add_file_monitors): New calls to remove a + file's monitors from one directory and add it to another. + * libnautilus-extensions/nautilus-file.c: + (nautilus_file_set_directory): Call the new calls. + + * configure.in: Paths from change yesterday were wrong. Had to fix + them to make RPM builds work again. + + * libnautilus-extensions/nautilus-link.c: + (nautilus_link_local_create_from_gnome_entry): Fix, based on patch + from fcrozat@mandrakesoft.com, to handle the URL versions + of gnome-entry properly. + 2001-04-20 Ramiro Estrugo <ramiro@eazel.com> * src/nautilus-application.c: (nautilus_application_startup): @@ -8144,7 +8165,7 @@ Tue Mar 06 12:24:24 2001 George Lebl <jirka@5z.com> supported type for the trash folder creation and detection code. -2001-03-02 Frederic Crozat <fcrozat@mandrakesoft.com> +2001-03-02 Frederic Crozat <fcrozat@mandrakesoft.com> reviewed by: Gene Z. Ragan <gzr@eazel.com> diff --git a/configure.in b/configure.in index 0b4419f0f..6e6267228 100644 --- a/configure.in +++ b/configure.in @@ -676,10 +676,10 @@ dnl ==================================== if test -d eazel-logos then HAVE_EAZEL_LOGOS=yes - EAZEL_LOGOS_PNG='%{_datadir}/share/pixmaps/nautilus/eazel-logos/*.png' - EAZEL_LOGOS_XML='%{_datadir}/share/pixmaps/nautilus/eazel-logos/*.xml' - EAZEL_LOGOS_LICENSE='%{_datadir}/share/pixmaps/nautilus/eazel-logos/LICENSE' - EAZEL_LOGOS_THROB='%{_datadir}/share/pixmaps/nautilus/eazel-logos/throbber/*.png' + EAZEL_LOGOS_PNG='%{_datadir}/pixmaps/nautilus/eazel-logos/*.png' + EAZEL_LOGOS_XML='%{_datadir}/pixmaps/nautilus/eazel-logos/*.xml' + EAZEL_LOGOS_LICENSE='%{_datadir}/pixmaps/nautilus/eazel-logos/LICENSE' + EAZEL_LOGOS_THROB='%{_datadir}/pixmaps/nautilus/eazel-logos/throbber/*.png' fi AM_CONDITIONAL(HAVE_EAZEL_LOGOS, test "x$HAVE_EAZEL_LOGOS" = "xyes") diff --git a/libnautilus-extensions/nautilus-directory-async.c b/libnautilus-extensions/nautilus-directory-async.c index f7c624f33..9593427e5 100644 --- a/libnautilus-extensions/nautilus-directory-async.c +++ b/libnautilus-extensions/nautilus-directory-async.c @@ -1085,6 +1085,58 @@ nautilus_directory_monitor_remove_internal (NautilusDirectory *directory, nautilus_directory_async_state_changed (directory); } +FileMonitors * +nautilus_directory_remove_file_monitors (NautilusDirectory *directory, + NautilusFile *file) +{ + GList *result, **list, *node, *next; + Monitor *monitor; + + g_assert (NAUTILUS_IS_DIRECTORY (directory)); + g_assert (NAUTILUS_IS_FILE (file)); + g_assert (file->details->directory == directory); + + result = NULL; + + list = &directory->details->monitor_list; + for (node = directory->details->monitor_list; node != NULL; node = next) { + next = node->next; + monitor = node->data; + + if (monitor->file == file) { + *list = g_list_remove_link (*list, node); + result = g_list_concat (node, result); + } + } + + update_metadata_monitors (directory); + nautilus_directory_async_state_changed (directory); + + return (FileMonitors *) result; +} + +void +nautilus_directory_add_file_monitors (NautilusDirectory *directory, + NautilusFile *file, + FileMonitors *monitors) +{ + GList **list; + + g_assert (NAUTILUS_IS_DIRECTORY (directory)); + g_assert (NAUTILUS_IS_FILE (file)); + g_assert (file->details->directory == directory); + + if (monitors == NULL) { + return; + } + + list = &directory->details->monitor_list; + *list = g_list_concat (*list, (GList *) monitors); + + update_metadata_monitors (directory); + nautilus_directory_async_state_changed (directory); +} + static int ready_callback_key_compare (gconstpointer a, gconstpointer b) { diff --git a/libnautilus-extensions/nautilus-directory-private.h b/libnautilus-extensions/nautilus-directory-private.h index 9b9bd455e..65ef808f5 100644 --- a/libnautilus-extensions/nautilus-directory-private.h +++ b/libnautilus-extensions/nautilus-directory-private.h @@ -36,6 +36,7 @@ typedef struct ActivationURIReadState ActivationURIReadState; typedef struct TopLeftTextReadState TopLeftTextReadState; +typedef struct FileMonitors FileMonitors; struct NautilusDirectoryDetails { @@ -181,10 +182,18 @@ NautilusFile * nautilus_directory_find_file_by_relative_uri (NautilusD const char *relative_uri); NautilusFile * nautilus_directory_find_file_by_internal_uri (NautilusDirectory *directory, const char *relative_uri); + void nautilus_directory_add_file (NautilusDirectory *directory, NautilusFile *file); void nautilus_directory_remove_file (NautilusDirectory *directory, NautilusFile *file); +FileMonitors * nautilus_directory_remove_file_monitors (NautilusDirectory *directory, + NautilusFile *file); +void nautilus_directory_add_file_monitors (NautilusDirectory *directory, + NautilusFile *file, + FileMonitors *monitors); +void nautilus_directory_add_file (NautilusDirectory *directory, + NautilusFile *file); GList * nautilus_directory_begin_file_name_change (NautilusDirectory *directory, NautilusFile *file); void nautilus_directory_end_file_name_change (NautilusDirectory *directory, diff --git a/libnautilus-extensions/nautilus-file.c b/libnautilus-extensions/nautilus-file.c index b48f44871..8cb3c4f8a 100644 --- a/libnautilus-extensions/nautilus-file.c +++ b/libnautilus-extensions/nautilus-file.c @@ -1219,6 +1219,7 @@ nautilus_file_set_directory (NautilusFile *file, NautilusDirectory *new_directory) { NautilusDirectory *old_directory; + FileMonitors *monitors; g_return_if_fail (NAUTILUS_IS_FILE (file)); g_return_if_fail (NAUTILUS_IS_DIRECTORY (file->details->directory)); @@ -1239,6 +1240,7 @@ nautilus_file_set_directory (NautilusFile *file, remove_from_link_hash_table (file); + monitors = nautilus_directory_remove_file_monitors (old_directory, file); nautilus_directory_remove_file (old_directory, file); nautilus_directory_ref (new_directory); @@ -1246,6 +1248,7 @@ nautilus_file_set_directory (NautilusFile *file, nautilus_directory_unref (old_directory); nautilus_directory_add_file (new_directory, file); + nautilus_directory_add_file_monitors (new_directory, file, monitors); add_to_link_hash_table (file); diff --git a/libnautilus-extensions/nautilus-link.c b/libnautilus-extensions/nautilus-link.c index 8fd7fcaba..f53cde8a5 100644 --- a/libnautilus-extensions/nautilus-link.c +++ b/libnautilus-extensions/nautilus-link.c @@ -536,7 +536,7 @@ nautilus_link_local_create_from_gnome_entry (GnomeDesktopEntry *entry, const cha launch_string = g_strdup_printf ("command:%s", arguments); } } else if (strcmp (entry->type, "URL") == 0) { - launch_string = g_strdup_printf ("command:%s", arguments); + launch_string = g_strdup (arguments); } else { /* Unknown .desktop file type */ launch_string = NULL; diff --git a/libnautilus-private/nautilus-directory-async.c b/libnautilus-private/nautilus-directory-async.c index f7c624f33..9593427e5 100644 --- a/libnautilus-private/nautilus-directory-async.c +++ b/libnautilus-private/nautilus-directory-async.c @@ -1085,6 +1085,58 @@ nautilus_directory_monitor_remove_internal (NautilusDirectory *directory, nautilus_directory_async_state_changed (directory); } +FileMonitors * +nautilus_directory_remove_file_monitors (NautilusDirectory *directory, + NautilusFile *file) +{ + GList *result, **list, *node, *next; + Monitor *monitor; + + g_assert (NAUTILUS_IS_DIRECTORY (directory)); + g_assert (NAUTILUS_IS_FILE (file)); + g_assert (file->details->directory == directory); + + result = NULL; + + list = &directory->details->monitor_list; + for (node = directory->details->monitor_list; node != NULL; node = next) { + next = node->next; + monitor = node->data; + + if (monitor->file == file) { + *list = g_list_remove_link (*list, node); + result = g_list_concat (node, result); + } + } + + update_metadata_monitors (directory); + nautilus_directory_async_state_changed (directory); + + return (FileMonitors *) result; +} + +void +nautilus_directory_add_file_monitors (NautilusDirectory *directory, + NautilusFile *file, + FileMonitors *monitors) +{ + GList **list; + + g_assert (NAUTILUS_IS_DIRECTORY (directory)); + g_assert (NAUTILUS_IS_FILE (file)); + g_assert (file->details->directory == directory); + + if (monitors == NULL) { + return; + } + + list = &directory->details->monitor_list; + *list = g_list_concat (*list, (GList *) monitors); + + update_metadata_monitors (directory); + nautilus_directory_async_state_changed (directory); +} + static int ready_callback_key_compare (gconstpointer a, gconstpointer b) { diff --git a/libnautilus-private/nautilus-directory-private.h b/libnautilus-private/nautilus-directory-private.h index 9b9bd455e..65ef808f5 100644 --- a/libnautilus-private/nautilus-directory-private.h +++ b/libnautilus-private/nautilus-directory-private.h @@ -36,6 +36,7 @@ typedef struct ActivationURIReadState ActivationURIReadState; typedef struct TopLeftTextReadState TopLeftTextReadState; +typedef struct FileMonitors FileMonitors; struct NautilusDirectoryDetails { @@ -181,10 +182,18 @@ NautilusFile * nautilus_directory_find_file_by_relative_uri (NautilusD const char *relative_uri); NautilusFile * nautilus_directory_find_file_by_internal_uri (NautilusDirectory *directory, const char *relative_uri); + void nautilus_directory_add_file (NautilusDirectory *directory, NautilusFile *file); void nautilus_directory_remove_file (NautilusDirectory *directory, NautilusFile *file); +FileMonitors * nautilus_directory_remove_file_monitors (NautilusDirectory *directory, + NautilusFile *file); +void nautilus_directory_add_file_monitors (NautilusDirectory *directory, + NautilusFile *file, + FileMonitors *monitors); +void nautilus_directory_add_file (NautilusDirectory *directory, + NautilusFile *file); GList * nautilus_directory_begin_file_name_change (NautilusDirectory *directory, NautilusFile *file); void nautilus_directory_end_file_name_change (NautilusDirectory *directory, diff --git a/libnautilus-private/nautilus-file.c b/libnautilus-private/nautilus-file.c index b48f44871..8cb3c4f8a 100644 --- a/libnautilus-private/nautilus-file.c +++ b/libnautilus-private/nautilus-file.c @@ -1219,6 +1219,7 @@ nautilus_file_set_directory (NautilusFile *file, NautilusDirectory *new_directory) { NautilusDirectory *old_directory; + FileMonitors *monitors; g_return_if_fail (NAUTILUS_IS_FILE (file)); g_return_if_fail (NAUTILUS_IS_DIRECTORY (file->details->directory)); @@ -1239,6 +1240,7 @@ nautilus_file_set_directory (NautilusFile *file, remove_from_link_hash_table (file); + monitors = nautilus_directory_remove_file_monitors (old_directory, file); nautilus_directory_remove_file (old_directory, file); nautilus_directory_ref (new_directory); @@ -1246,6 +1248,7 @@ nautilus_file_set_directory (NautilusFile *file, nautilus_directory_unref (old_directory); nautilus_directory_add_file (new_directory, file); + nautilus_directory_add_file_monitors (new_directory, file, monitors); add_to_link_hash_table (file); diff --git a/libnautilus-private/nautilus-link.c b/libnautilus-private/nautilus-link.c index 8fd7fcaba..f53cde8a5 100644 --- a/libnautilus-private/nautilus-link.c +++ b/libnautilus-private/nautilus-link.c @@ -536,7 +536,7 @@ nautilus_link_local_create_from_gnome_entry (GnomeDesktopEntry *entry, const cha launch_string = g_strdup_printf ("command:%s", arguments); } } else if (strcmp (entry->type, "URL") == 0) { - launch_string = g_strdup_printf ("command:%s", arguments); + launch_string = g_strdup (arguments); } else { /* Unknown .desktop file type */ launch_string = NULL; |