[PATCH] Try to open parent folder when viewed folder is deleted
- From: Christian Neumair <chris gnome-de org>
- To: nautilus-list <nautilus-list gnome org>
- Subject: [PATCH] Try to open parent folder when viewed folder is deleted
- Date: Sun, 02 Jul 2006 10:40:06 +0200
The attached patch ensures that we try to display an existing parent
folder when the viewed file is deleted [1] in Navigation mode.
It also removes two obsolete undefined functions.
I must admit that sync I/O might not be the best idea, maybe we should
make the affected window desensitive and install an async callback for
the file info.
[1] http://bugzilla.gnome.org/show_bug.cgi?id=336724
--
Christian Neumair <chris gnome-de org>
Index: libnautilus-private/nautilus-file-utilities.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-file-utilities.c,v
retrieving revision 1.131
diff -u -p -r1.131 nautilus-file-utilities.c
--- libnautilus-private/nautilus-file-utilities.c 24 May 2006 19:18:36 -0000 1.131
+++ libnautilus-private/nautilus-file-utilities.c 1 Jul 2006 15:44:25 -0000
@@ -513,6 +513,30 @@ nautilus_unique_temporary_file_name (voi
return file_name;
}
+char *
+nautilus_find_existing_uri_in_hierarchy (const char *uri)
+{
+ GnomeVFSURI *vfs_uri, *parent_vfs_uri;
+ char *ret = NULL;
+
+ g_assert (uri != NULL);
+
+ vfs_uri = gnome_vfs_uri_new (uri);
+
+ while (vfs_uri != NULL) {
+ if (gnome_vfs_uri_exists (vfs_uri)) {
+ ret = gnome_vfs_uri_to_string (vfs_uri, GNOME_VFS_URI_HIDE_NONE);
+ break;
+ }
+
+ parent_vfs_uri = gnome_vfs_uri_get_parent (vfs_uri);
+ gnome_vfs_uri_unref (vfs_uri);
+ vfs_uri = parent_vfs_uri;
+ }
+
+ return ret;
+}
+
const char *
nautilus_get_vfs_method_display_name (char *method)
{
Index: libnautilus-private/nautilus-file-utilities.h
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-file-utilities.h,v
retrieving revision 1.60
diff -u -p -r1.60 nautilus-file-utilities.h
--- libnautilus-private/nautilus-file-utilities.h 24 May 2006 19:18:36 -0000 1.60
+++ libnautilus-private/nautilus-file-utilities.h 1 Jul 2006 15:44:26 -0000
@@ -82,8 +82,8 @@ char * nautilus_ensure_unique_file_nam
const char *base_name,
const char *extension);
char * nautilus_unique_temporary_file_name (void);
-char * nautilus_find_file_in_gnome_path (char *file);
-GList * nautilus_find_all_files_in_gnome_path (char *file);
+
+char * nautilus_find_existing_uri_in_hierarchy (const char *uri);
const char *nautilus_get_vfs_method_display_name (char *method);
char * nautilus_get_uri_shortname_for_display (GnomeVFSURI *uri);
Index: src/nautilus-pathbar.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-pathbar.c,v
retrieving revision 1.5
diff -u -p -r1.5 nautilus-pathbar.c
--- src/nautilus-pathbar.c 18 Mar 2006 07:13:50 -0000 1.5
+++ src/nautilus-pathbar.c 1 Jul 2006 15:45:13 -0000
@@ -969,7 +969,7 @@ nautilus_path_bar_check_icon_theme (Naut
}
/* Public functions and their helpers */
-static void
+void
nautilus_path_bar_clear_buttons (NautilusPathBar *path_bar)
{
while (path_bar->button_list != NULL) {
Index: src/nautilus-pathbar.h
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-pathbar.h,v
retrieving revision 1.1
diff -u -p -r1.1 nautilus-pathbar.h
--- src/nautilus-pathbar.h 8 Jul 2005 11:25:51 -0000 1.1
+++ src/nautilus-pathbar.h 1 Jul 2006 15:45:13 -0000
@@ -73,6 +73,7 @@ struct _NautilusPathBarClass
GType nautilus_path_bar_get_type (void) G_GNUC_CONST;
gboolean nautilus_path_bar_set_path (NautilusPathBar *path_bar, const char *file_path);
+void nautilus_path_bar_clear_buttons (NautilusPathBar *path_bar);
void nautilus_path_bar_up (NautilusPathBar *path_bar);
void nautilus_path_bar_down (NautilusPathBar *path_bar);
Index: src/nautilus-window-manage-views.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-window-manage-views.c,v
retrieving revision 1.367
diff -u -p -r1.367 nautilus-window-manage-views.c
--- src/nautilus-window-manage-views.c 21 Jun 2006 16:26:20 -0000 1.367
+++ src/nautilus-window-manage-views.c 1 Jul 2006 15:45:17 -0000
@@ -330,12 +330,30 @@ viewed_file_changed_callback (NautilusFi
* all other nautilus_window_close callers?
*/
end_location_change (window);
-
- /* FIXME bugzilla.gnome.org 45038: Is closing
- * the window really the right thing to do for
- * all cases?
- */
- nautilus_window_close (window);
+
+ if (NAUTILUS_IS_NAVIGATION_WINDOW (window)) {
+ /* auto-show existing parent URI. */
+ char *uri, *go_to_uri;
+ NautilusFile *parent_file;
+
+ parent_file = nautilus_file_get_parent (file);
+ uri = nautilus_file_get_uri (parent_file);
+
+ go_to_uri = nautilus_find_existing_uri_in_hierarchy (uri);
+ if (go_to_uri != NULL) {
+ /* the path bar URI will be set to go_to_uri immediately
+ * in begin_location_change, but we don't want the
+ * inexistant children to show up anymore */
+ nautilus_path_bar_clear_buttons (NAUTILUS_PATH_BAR (NAUTILUS_NAVIGATION_WINDOW (window)->path_bar));
+ nautilus_window_go_to (NAUTILUS_WINDOW (window), go_to_uri);
+ g_free (go_to_uri);
+ }
+
+ g_free (uri);
+ nautilus_file_unref (parent_file);
+ } else {
+ nautilus_window_close (window);
+ }
}
} else {
new_location = nautilus_file_get_uri (file);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]