Index: src/nautilus-pathbar.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-pathbar.c,v
retrieving revision 1.7
diff -p -u -r1.7 nautilus-pathbar.c
--- src/nautilus-pathbar.c	8 Dec 2006 09:49:39 -0000	1.7
+++ src/nautilus-pathbar.c	15 Dec 2006 06:44:08 -0000
@@ -41,15 +41,15 @@
 #include "nautilus-pathbar.h"
 
 enum {
-        PATH_CLICKED,
-        LAST_SIGNAL
+	PATH_CLICKED,
+	LAST_SIGNAL
 };
 
 typedef enum {
-        NORMAL_BUTTON,
-        ROOT_BUTTON,
-        HOME_BUTTON,
-        DESKTOP_BUTTON,
+	NORMAL_BUTTON,
+	ROOT_BUTTON,
+	HOME_BUTTON,
+	DESKTOP_BUTTON,
 	VOLUME_BUTTON
 } ButtonType;
 
@@ -64,32 +64,35 @@ static gboolean desktop_is_home;
 
 #define NAUTILUS_PATH_BAR_ICON_SIZE 16
 
-#define DEFAULT_ICON 		"gnome-fs-directory"
+#define DEFAULT_ICON 			"gnome-fs-directory"
 #define DEFAULT_DESKTOP_ICON 	"gnome-fs-desktop"
-#define DEFAULT_HOME_ICON 	"gnome-fs-home"
+#define DEFAULT_HOME_ICON		"gnome-fs-home"
 #define DEFAULT_FILESYSTEM_ICON	"gnome-dev-harddisk"
 
 typedef struct _ButtonData ButtonData;
-
-struct _ButtonData
-{
-        GtkWidget *button;
-        ButtonType type;
-        char *dir_name;
-        char *path;
+struct _ButtonData {
+	GtkWidget *button;
+	ButtonType type;
+	char *dir_name;
+	char *path;
 
 	/* custom icon */ 
 	char *custom_icon_name;
 
-	/* flag to indicate its the base folder in the URI */
+	/* flag to indicate it is the base folder in the URI */
 	gboolean is_base_dir;
 
-        GtkWidget *image;
-        GtkWidget *label;
-        guint ignore_changes : 1;
-        guint file_is_hidden : 1;
+	GtkWidget *image;
+	GtkWidget *label;
+	guint ignore_changes : 1;
+	guint file_is_hidden : 1;
+	
+	/* File notification variables */
+	NautilusFile *path_file;
+	guint file_changed_handler_id;
 };
 
+
 /* This macro is used to check if a button can be used as a fake root.
  * All buttons in front of a fake root are automatically hidden when in a
  * directory below a fake root and replaced with the "<" arrow button.
@@ -165,7 +168,7 @@ update_button_types (NautilusPathBar *pa
 	GList *list;
 	char *path = NULL;
 
-	for (list = path_bar->button_list; list; list = list->next) {
+	for (list = path_bar->button_list; list != NULL; list = list->next) {
 		ButtonData *button_data;
 		button_data = BUTTON_DATA (list->data);
 		if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button_data->button))) {
@@ -203,110 +206,113 @@ desktop_location_changed_callback (gpoin
 static void
 nautilus_path_bar_init (NautilusPathBar *path_bar)
 {
-        GTK_WIDGET_SET_FLAGS (path_bar, GTK_NO_WINDOW);
-        gtk_widget_set_redraw_on_allocate (GTK_WIDGET (path_bar), FALSE);
+	GTK_WIDGET_SET_FLAGS (path_bar, GTK_NO_WINDOW);
+	gtk_widget_set_redraw_on_allocate (GTK_WIDGET (path_bar), FALSE);
 
-        path_bar->spacing = 3;
-        path_bar->up_slider_button = get_slider_button (path_bar, GTK_ARROW_LEFT);
-        path_bar->down_slider_button = get_slider_button (path_bar, GTK_ARROW_RIGHT);
-        path_bar->icon_size = NAUTILUS_PATH_BAR_ICON_SIZE;
+	path_bar->spacing = 3;
+	path_bar->up_slider_button = get_slider_button (path_bar, GTK_ARROW_LEFT);
+	path_bar->down_slider_button = get_slider_button (path_bar, GTK_ARROW_RIGHT);
+	path_bar->icon_size = NAUTILUS_PATH_BAR_ICON_SIZE;
 
-        path_bar->desktop_path = nautilus_get_desktop_directory_uri ();
+	path_bar->desktop_path = nautilus_get_desktop_directory_uri ();
 	path_bar->home_path = nautilus_get_home_directory_uri ();
 	path_bar->root_path = g_strdup ("file:///");
 	desktop_is_home = (strcmp (path_bar->home_path, path_bar->desktop_path) == 0);
 
 	eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_DESKTOP_IS_HOME_DIR,
-						  desktop_location_changed_callback,
-						  path_bar,
-						  G_OBJECT (path_bar));
-
-        g_signal_connect (path_bar->up_slider_button, "clicked", G_CALLBACK (nautilus_path_bar_scroll_up), path_bar);
-        g_signal_connect (path_bar->down_slider_button, "clicked", G_CALLBACK (nautilus_path_bar_scroll_down), path_bar);
-
-        g_signal_connect (path_bar->up_slider_button, "button_press_event", G_CALLBACK (nautilus_path_bar_slider_button_press), path_bar);
-        g_signal_connect (path_bar->up_slider_button, "button_release_event", G_CALLBACK (nautilus_path_bar_slider_button_release), path_bar);
-        g_signal_connect (path_bar->down_slider_button, "button_press_event", G_CALLBACK (nautilus_path_bar_slider_button_press), path_bar);
-        g_signal_connect (path_bar->down_slider_button, "button_release_event", G_CALLBACK (nautilus_path_bar_slider_button_release), path_bar);
+			  								  desktop_location_changed_callback,
+			  								  path_bar,
+			  								  G_OBJECT (path_bar));
+
+	g_signal_connect (path_bar->up_slider_button, "clicked", G_CALLBACK (nautilus_path_bar_scroll_up), path_bar);
+	g_signal_connect (path_bar->down_slider_button, "clicked", G_CALLBACK (nautilus_path_bar_scroll_down), path_bar);
+
+	g_signal_connect (path_bar->up_slider_button, "button_press_event", G_CALLBACK (nautilus_path_bar_slider_button_press), path_bar);
+	g_signal_connect (path_bar->up_slider_button, "button_release_event", G_CALLBACK (nautilus_path_bar_slider_button_release), path_bar);
+	g_signal_connect (path_bar->down_slider_button, "button_press_event", G_CALLBACK (nautilus_path_bar_slider_button_press), path_bar);
+	g_signal_connect (path_bar->down_slider_button, "button_release_event", G_CALLBACK (nautilus_path_bar_slider_button_release), path_bar);
 }
 
 static void
 nautilus_path_bar_class_init (NautilusPathBarClass *path_bar_class)
 {
-        GObjectClass *gobject_class;
-        GtkObjectClass *object_class;
-        GtkWidgetClass *widget_class;
-        GtkContainerClass *container_class;
-
-        gobject_class = (GObjectClass *) path_bar_class;
-        object_class = (GtkObjectClass *) path_bar_class;
-        widget_class = (GtkWidgetClass *) path_bar_class;
-        container_class = (GtkContainerClass *) path_bar_class;
+	GObjectClass *gobject_class;
+	GtkObjectClass *object_class;
+	GtkWidgetClass *widget_class;
+	GtkContainerClass *container_class;
+
+	gobject_class = (GObjectClass *) path_bar_class;
+	object_class = (GtkObjectClass *) path_bar_class;
+	widget_class = (GtkWidgetClass *) path_bar_class;
+	container_class = (GtkContainerClass *) path_bar_class;
 
-        gobject_class->finalize = nautilus_path_bar_finalize;
-        gobject_class->dispose = nautilus_path_bar_dispose;
+	gobject_class->finalize = nautilus_path_bar_finalize;
+	gobject_class->dispose = nautilus_path_bar_dispose;
 
-        widget_class->size_request = nautilus_path_bar_size_request;
+	widget_class->size_request = nautilus_path_bar_size_request;
 	widget_class->unmap = nautilus_path_bar_unmap;
-        widget_class->size_allocate = nautilus_path_bar_size_allocate;
-        widget_class->style_set = nautilus_path_bar_style_set;
-        widget_class->screen_changed = nautilus_path_bar_screen_changed;
-        widget_class->grab_notify = nautilus_path_bar_grab_notify;
-        widget_class->state_changed = nautilus_path_bar_state_changed;
-
-        container_class->add = nautilus_path_bar_add;
-        container_class->forall = nautilus_path_bar_forall;
-        container_class->remove = nautilus_path_bar_remove;
-
-        path_bar_signals [PATH_CLICKED] =
-                g_signal_new ("path-clicked",
-		  G_OBJECT_CLASS_TYPE (object_class),
-		  G_SIGNAL_RUN_FIRST,
-		  G_STRUCT_OFFSET (NautilusPathBarClass, path_clicked),
-		  NULL, NULL,
-		  g_cclosure_marshal_VOID__STRING,
-		  G_TYPE_NONE, 1,
-		  G_TYPE_STRING);
+	widget_class->size_allocate = nautilus_path_bar_size_allocate;
+	widget_class->style_set = nautilus_path_bar_style_set;
+	widget_class->screen_changed = nautilus_path_bar_screen_changed;
+	widget_class->grab_notify = nautilus_path_bar_grab_notify;
+	widget_class->state_changed = nautilus_path_bar_state_changed;
+
+	container_class->add = nautilus_path_bar_add;
+	container_class->forall = nautilus_path_bar_forall;
+	container_class->remove = nautilus_path_bar_remove;
+
+	path_bar_signals [PATH_CLICKED] = g_signal_new ("path-clicked",
+													G_OBJECT_CLASS_TYPE (object_class),
+													G_SIGNAL_RUN_FIRST,
+													G_STRUCT_OFFSET (NautilusPathBarClass, path_clicked),
+													NULL, NULL,
+													g_cclosure_marshal_VOID__STRING,
+													G_TYPE_NONE, 1,
+													G_TYPE_STRING);
 }
 
-
 static void
 nautilus_path_bar_finalize (GObject *object)
 {
-        NautilusPathBar *path_bar;
-
-        path_bar = NAUTILUS_PATH_BAR (object);
+	NautilusPathBar *path_bar;
+		
+	path_bar = NAUTILUS_PATH_BAR (object);
 
 	nautilus_path_bar_stop_scrolling (path_bar);
 
-        g_list_free (path_bar->button_list);
-	if (path_bar->root_path) {
+ 	g_list_free (path_bar->button_list);
+
+	if (path_bar->root_path != NULL) {
 		g_free (path_bar->root_path);
 		path_bar->root_path = NULL;
 	}
-	if (path_bar->home_path) {
+	
+	if (path_bar->home_path != NULL) {
 		g_free (path_bar->home_path);
 		path_bar->home_path = NULL;
 	}
-	if (path_bar->desktop_path) {
+	
+	if (path_bar->desktop_path != NULL) {
 		g_free (path_bar->desktop_path);
 		path_bar->desktop_path = NULL;
 	}
 
-	if (path_bar->root_icon) {
+	if (path_bar->root_icon != NULL) {
 		g_object_unref (path_bar->root_icon);
 		path_bar->root_icon = NULL;
 	}
-	if (path_bar->home_icon) {
+	
+	if (path_bar->home_icon != NULL) {
                 g_object_unref (path_bar->home_icon);
 		path_bar->home_icon = NULL;
 	}
-	if (path_bar->desktop_icon) {
+	
+	if (path_bar->desktop_icon != NULL) {
 		g_object_unref (path_bar->desktop_icon);
 		path_bar->desktop_icon = NULL;
 	}
-
-        G_OBJECT_CLASS (nautilus_path_bar_parent_class)->finalize (object);
+	
+	G_OBJECT_CLASS (nautilus_path_bar_parent_class)->finalize (object);
 }
 
 /* Removes the settings signal handler.  It's safe to call multiple times */
@@ -351,7 +357,7 @@ nautilus_path_bar_size_request (GtkWidge
         requisition->width = 0;
         requisition->height = 0;
 
-	for (list = path_bar->button_list; list; list = list->next) {
+	for (list = path_bar->button_list; list != NULL; list = list->next) {
 		button_data = BUTTON_DATA (list->data);
                 gtk_widget_size_request (button_data->button, &child_requisition);
                 requisition->width = MAX (child_requisition.width, requisition->width);
@@ -379,7 +385,7 @@ nautilus_path_bar_size_request (GtkWidge
 static void
 nautilus_path_bar_update_slider_buttons (NautilusPathBar *path_bar)
 {
-	if (path_bar->button_list) {
+	if (path_bar->button_list != NULL) {
                 	
       		GtkWidget *button;
 
@@ -448,7 +454,7 @@ nautilus_path_bar_size_allocate (GtkWidg
 
 	width += BUTTON_DATA (path_bar->button_list->data)->button->requisition.width;
 
-        for (list = path_bar->button_list->next; list; list = list->next) {
+        for (list = path_bar->button_list->next; list != NULL; list = list->next) {
         	child = BUTTON_DATA (list->data)->button;
                 width += child->requisition.width + path_bar->spacing;
 
@@ -533,7 +539,7 @@ nautilus_path_bar_size_allocate (GtkWidg
 		}
         }
 
-        for (list = first_button; list; list = list->prev) {
+        for (list = first_button; list != NULL; list = list->prev) {
                 child = BUTTON_DATA (list->data)->button;
 
                 child_allocation.width = child->requisition.width;
@@ -571,7 +577,7 @@ nautilus_path_bar_size_allocate (GtkWidg
         	gtk_widget_set_child_visible (BUTTON_DATA (list->data)->button, FALSE);
                 list = list->prev;
         }
-        for (list = first_button->next; list; list = list->next) {
+        for (list = first_button->next; list != NULL; list = list->next) {
  	        gtk_widget_set_child_visible (BUTTON_DATA (list->data)->button, FALSE);
         }
 
@@ -644,35 +650,45 @@ nautilus_path_bar_remove_1 (GtkContainer
 
 static void
 nautilus_path_bar_remove (GtkContainer *container,
-		          GtkWidget    *widget)
+		          		  GtkWidget *widget)
 {
-        NautilusPathBar *path_bar;
-        GList *children;
-
-        path_bar = NAUTILUS_PATH_BAR (container);
-
-        if (widget == path_bar->up_slider_button) {
-                nautilus_path_bar_remove_1 (container, widget);
-                path_bar->up_slider_button = NULL;
-                return;
-        }
+	NautilusPathBar *path_bar;
+	GList *children;
+	ButtonData *button_data;
 
-        if (widget == path_bar->down_slider_button) {
-                nautilus_path_bar_remove_1 (container, widget);
-                path_bar->down_slider_button = NULL;
-                return;
-        }
+	path_bar = NAUTILUS_PATH_BAR (container);
 
-        children = path_bar->button_list;
-        while (children) {              
-                if (widget == BUTTON_DATA (children->data)->button) {
+	if (widget == path_bar->up_slider_button) {
+		nautilus_path_bar_remove_1 (container, widget);
+		path_bar->up_slider_button = NULL;
+		return;
+	}
+
+	if (widget == path_bar->down_slider_button) {
+		nautilus_path_bar_remove_1 (container, widget);
+		path_bar->down_slider_button = NULL;
+		return;
+	}
+
+	children = path_bar->button_list;
+	while (children) {
+		button_data = BUTTON_DATA (children->data);         
+		if (widget == button_data->button) {
+			/* Clean up file changed signal handlers */
+			if (button_data->path_file != NULL) {
+				g_signal_handler_disconnect (G_OBJECT (button_data->path_file), button_data->file_changed_handler_id);
+				nautilus_file_monitor_remove (button_data->path_file, path_bar);
+				nautilus_file_unref (button_data->path_file);
+			}
+						
 			nautilus_path_bar_remove_1 (container, widget);
-	  		path_bar->button_list = g_list_remove_link (path_bar->button_list, children);
-	  		g_list_free (children);
-	  		return;
+			path_bar->button_list = g_list_remove_link (path_bar->button_list, children);
+			g_list_free (children);
+			return;
 		}
-                children = children->next;
-        }
+		
+		children = children->next;
+	}
 }
 
 static void
@@ -730,7 +746,7 @@ nautilus_path_bar_scroll_down (GtkWidget
   
         /* We find the button at the 'down' end that we have to make */
         /* visible */
-        for (list = path_bar->button_list; list; list = list->next) {
+        for (list = path_bar->button_list; list != NULL; list = list->next) {
         	if (list->next && gtk_widget_get_child_visible (BUTTON_DATA (list->next->data)->button)) {
 			down_button = list;
 	  		break;
@@ -738,7 +754,7 @@ nautilus_path_bar_scroll_down (GtkWidget
         }
   
         /* Find the last visible button on the 'up' end */
-        for (list = g_list_last (path_bar->button_list); list; list = list->prev) {
+        for (list = g_list_last (path_bar->button_list); list != NULL; list = list->prev) {
                 if (gtk_widget_get_child_visible (BUTTON_DATA (list->data)->button)) {
 	  		up_button = list;
 	  		break;
@@ -776,7 +792,7 @@ nautilus_path_bar_scroll_up (GtkWidget *
 
         gtk_widget_queue_resize (GTK_WIDGET (path_bar));
 
-        for (list = g_list_last (path_bar->button_list); list; list = list->prev) {
+        for (list = g_list_last (path_bar->button_list); list != NULL; list = list->prev) {
                 if (list->prev && gtk_widget_get_child_visible (BUTTON_DATA (list->prev->data)->button)) {
 			if (list->prev == path_bar->fake_root) {
 	    			path_bar->fake_root = NULL;
@@ -918,7 +934,7 @@ reload_icons (NautilusPathBar *path_bar)
         }
 
 
-        for (list = path_bar->button_list; list; list = list->next) {
+        for (list = path_bar->button_list; list != NULL; list = list->next) {
                 ButtonData *button_data;
                 gboolean current_dir;
 
@@ -968,14 +984,19 @@ nautilus_path_bar_check_icon_theme (Naut
         change_icon_theme (path_bar);
 }
 
+
 /* Public functions and their helpers */
 void
 nautilus_path_bar_clear_buttons (NautilusPathBar *path_bar)
 {
-        while (path_bar->button_list != NULL) {
-                gtk_container_remove (GTK_CONTAINER (path_bar), BUTTON_DATA (path_bar->button_list->data)->button);
-        }
-        path_bar->first_scrolled_button = NULL;
+	ButtonData *button_data;
+	
+	while (path_bar->button_list != NULL) {		
+		button_data = BUTTON_DATA (path_bar->button_list->data);
+		gtk_container_remove (GTK_CONTAINER (path_bar), button_data->button);
+	}
+		 												  
+	path_bar->first_scrolled_button = NULL;
 	path_bar->fake_root = NULL;
 }
 
@@ -1138,23 +1159,23 @@ label_size_request_cb (GtkWidget       *
 		       GtkRequisition  *requisition,
 		       ButtonData      *button_data)
 {
-        const gchar *dir_name = get_dir_name (button_data);
-        PangoLayout *layout;
-        gint bold_width, bold_height;
-        gchar *markup;
-	
+	const gchar *dir_name = get_dir_name (button_data);
+	PangoLayout *layout;
+	gint bold_width, bold_height;
+	gchar *markup;
+
 	layout = gtk_widget_create_pango_layout (button_data->label, dir_name);
-        pango_layout_get_pixel_size (layout, &requisition->width, &requisition->height);
-  
-        markup = g_markup_printf_escaped ("<b>%s</b>", dir_name);
-        pango_layout_set_markup (layout, markup, -1);
-        g_free (markup);
-
-        pango_layout_get_pixel_size (layout, &bold_width, &bold_height);
-        requisition->width = MAX (requisition->width, bold_width);
-        requisition->height = MAX (requisition->height, bold_height);
-  
-        g_object_unref (layout);
+	pango_layout_get_pixel_size (layout, &requisition->width, &requisition->height);
+
+	markup = g_markup_printf_escaped ("<b>%s</b>", dir_name);
+	pango_layout_set_markup (layout, markup, -1);
+	g_free (markup);
+
+	pango_layout_get_pixel_size (layout, &bold_width, &bold_height);
+	requisition->width = MAX (requisition->width, bold_width);
+	requisition->height = MAX (requisition->height, bold_height);
+
+	g_object_unref (layout);
 }
 
 static void
@@ -1311,6 +1332,48 @@ button_drag_data_get_cb (GtkWidget      
         g_free (uri_list);
 }
 
+static void
+file_changed_callback (NautilusFile *file, gpointer callback_data)
+{
+	NautilusPathBar *path_bar;
+	ButtonData *button_data;
+	char *new_path;
+	GList* list;
+	
+	button_data = NULL;
+	new_path = NULL;
+	
+	/* If the item is in the trash or was deleted, we need to prune
+	 * all children of the item and set the path bar to the 
+	 * path of the exisiting items.
+	 */
+	if (nautilus_file_is_gone (file) || nautilus_file_is_in_trash (file)) {
+		path_bar = NAUTILUS_PATH_BAR (callback_data);
+		
+		/* Locate the path button that corresponds to this file. */	 
+		for (list = path_bar->button_list; list != NULL; list = list->next) {
+			/* Get the button data from the list */
+			button_data = list->data;
+			
+			if (button_data->path_file == file) {
+				/* We found a match. Get the path of the 
+				 * preceeding item and us it to prune
+				 * and update the path bar.
+				 */
+				 button_data = list->next->data;
+				 g_assert (button_data != NULL);
+				 new_path = nautilus_file_get_uri (button_data->path_file);
+				 break;
+			}
+		}
+		
+		/* Clear out the old path and set to the new one */
+		g_assert (new_path != NULL);
+		nautilus_path_bar_clear_buttons (path_bar);
+		nautilus_path_bar_set_path (path_bar, new_path);
+	}
+}
+
 static ButtonData *
 make_directory_button (NautilusPathBar  *path_bar,
 		       const char       *dir_name,
@@ -1319,111 +1382,130 @@ make_directory_button (NautilusPathBar  
 		       gboolean          base_dir,	
 		       gboolean          file_is_hidden)
 {
-        const GtkTargetEntry targets[] = {
-                { "text/uri-list", 0, 0 }
-        };
-
-        GtkWidget *child;
-        GtkWidget *label_alignment;
-        ButtonData *button_data;
+	const GtkTargetEntry targets[] = {
+		{ "text/uri-list", 0, 0 }
+	};
+
+	GtkWidget *child;
+	GtkWidget *label_alignment;
+	ButtonData *button_data;
 
 	child = NULL;
 	label_alignment = NULL;
 
-        file_is_hidden = !! file_is_hidden;
-        /* Is it a special button? */
-        button_data = g_new0 (ButtonData, 1);
-
-        button_data->type = find_button_type (path_bar, path, button_data);
-        button_data->button = gtk_toggle_button_new ();
+	file_is_hidden = !! file_is_hidden;
 	
-        switch (button_data->type) {
-                case ROOT_BUTTON:
-                        button_data->image = gtk_image_new ();
-                        child = button_data->image;
-                        button_data->label = NULL;
-                        break;
-                case HOME_BUTTON:
-                case DESKTOP_BUTTON:
+	/* Is it a special button? */
+	button_data = g_new0 (ButtonData, 1);
+
+	button_data->type = find_button_type (path_bar, path, button_data);
+	button_data->button = gtk_toggle_button_new ();
+
+	switch (button_data->type) {
+		case ROOT_BUTTON:
+		button_data->image = gtk_image_new ();
+		child = button_data->image;
+		button_data->label = NULL;
+		break;
+		
+		case HOME_BUTTON:
+		case DESKTOP_BUTTON:
 		case VOLUME_BUTTON:
-                        button_data->image = gtk_image_new ();
-                        button_data->label = gtk_label_new (NULL);
-                        label_alignment = gtk_alignment_new (0.5, 0.5, 1.0, 1.0);
-                        gtk_container_add (GTK_CONTAINER (label_alignment), button_data->label);
-                        child = gtk_hbox_new (FALSE, 2);
-                        gtk_box_pack_start (GTK_BOX (child), button_data->image, FALSE, FALSE, 0);
-                        gtk_box_pack_start (GTK_BOX (child), label_alignment, FALSE, FALSE, 0);
-                        break;
+		button_data->image = gtk_image_new ();
+		button_data->label = gtk_label_new (NULL);
+		label_alignment = gtk_alignment_new (0.5, 0.5, 1.0, 1.0);
+		gtk_container_add (GTK_CONTAINER (label_alignment), button_data->label);
+		child = gtk_hbox_new (FALSE, 2);
+		gtk_box_pack_start (GTK_BOX (child), button_data->image, FALSE, FALSE, 0);
+		gtk_box_pack_start (GTK_BOX (child), label_alignment, FALSE, FALSE, 0);
+		break;
+		
 		case NORMAL_BUTTON:
-    		default:
-			if (base_dir) {
-	                        button_data->image = gtk_image_new ();
-        	                button_data->label = gtk_label_new (NULL);
-        	                label_alignment = gtk_alignment_new (0.5, 0.5, 1.0, 1.0);
-        	                gtk_container_add (GTK_CONTAINER (label_alignment), button_data->label);
-        	                child = gtk_hbox_new (FALSE, 2);
-        	                gtk_box_pack_start (GTK_BOX (child), button_data->image, FALSE, FALSE, 0);
-        	                gtk_box_pack_start (GTK_BOX (child), label_alignment, FALSE, FALSE, 0);
-				button_data->is_base_dir = TRUE;
-				button_data->custom_icon_name = get_icon_name_for_file_path (path);
-			} else {
-				button_data->is_base_dir = FALSE;
-	      			button_data->label = gtk_label_new (NULL);
-      				label_alignment = gtk_alignment_new (0.5, 0.5, 1.0, 1.0);
-      				gtk_container_add (GTK_CONTAINER (label_alignment), button_data->label);
-      				child = label_alignment;
-      				button_data->image = NULL;
-			}
-        }
+		default:
+		if (base_dir) {
+			button_data->image = gtk_image_new ();
+			button_data->label = gtk_label_new (NULL);
+			label_alignment = gtk_alignment_new (0.5, 0.5, 1.0, 1.0);
+			gtk_container_add (GTK_CONTAINER (label_alignment), button_data->label);
+			child = gtk_hbox_new (FALSE, 2);
+			gtk_box_pack_start (GTK_BOX (child), button_data->image, FALSE, FALSE, 0);
+			gtk_box_pack_start (GTK_BOX (child), label_alignment, FALSE, FALSE, 0);
+			button_data->is_base_dir = TRUE;
+			button_data->custom_icon_name = get_icon_name_for_file_path (path);
+		} else {
+			button_data->is_base_dir = FALSE;
+			button_data->label = gtk_label_new (NULL);
+			label_alignment = gtk_alignment_new (0.5, 0.5, 1.0, 1.0);
+			gtk_container_add (GTK_CONTAINER (label_alignment), button_data->label);
+			child = label_alignment;
+			button_data->image = NULL;
+		}
+	}
 
-  	/* label_alignment is created because we can't override size-request
-   	* on label itself and still have the contents of the label centered
-   	* properly in the label's requisition
-   	*/
-
-        if (label_alignment) {
-                g_signal_connect (label_alignment, "size-request",
-			      	  G_CALLBACK (label_size_request_cb), button_data);
+	/* label_alignment is created because we can't override size-request
+	* on label itself and still have the contents of the label centered
+	* properly in the label's requisition
+	*/
+
+	if (label_alignment) {
+		g_signal_connect (label_alignment, "size-request",
+		G_CALLBACK (label_size_request_cb), button_data);
 	}
-	
+
 	/* do not set these for volumes */
 	if (button_data->type != VOLUME_BUTTON) {
 		button_data->dir_name = g_strdup (dir_name);
-        	button_data->path = g_strdup (path);
+		button_data->path = g_strdup (path);
 	}
 
-        button_data->file_is_hidden = file_is_hidden;
-			  
-        gtk_container_add (GTK_CONTAINER (button_data->button), child);
-        gtk_widget_show_all (button_data->button);
-
-        nautilus_path_bar_update_button_appearance (path_bar, button_data, current_dir);
-
-        g_signal_connect (button_data->button, "clicked", G_CALLBACK (button_clicked_cb), button_data);
-        g_object_weak_ref (G_OBJECT (button_data->button), (GWeakNotify) button_data_free, button_data);
+	button_data->file_is_hidden = file_is_hidden;
 
-        gtk_drag_source_set (button_data->button,
-		       	     GDK_BUTTON1_MASK,
-		       	     targets,
-		             G_N_ELEMENTS (targets),
-		             GDK_ACTION_COPY);
-        g_signal_connect (button_data->button, "drag-data-get",G_CALLBACK (button_drag_data_get_cb), button_data);
+	gtk_container_add (GTK_CONTAINER (button_data->button), child);
+	gtk_widget_show_all (button_data->button);
 
-        return button_data;
+	nautilus_path_bar_update_button_appearance (path_bar, button_data, current_dir);
+
+	g_signal_connect (button_data->button, "clicked", G_CALLBACK (button_clicked_cb), button_data);
+	g_object_weak_ref (G_OBJECT (button_data->button), (GWeakNotify) button_data_free, button_data);
+
+	gtk_drag_source_set (button_data->button,
+						 GDK_BUTTON1_MASK,
+						 targets,
+						 G_N_ELEMENTS (targets),
+						 GDK_ACTION_COPY);
+	g_signal_connect (button_data->button, "drag-data-get",G_CALLBACK (button_drag_data_get_cb), button_data);
+
+
+	/* Get the file for the path */
+	button_data->path_file = nautilus_file_get (path);
+	g_assert (button_data->path_file != NULL);
+
+					     		
+	/* Watch the new path so that we can be notified when the file is moved or deleted. */
+	nautilus_file_monitor_add (button_data->path_file,
+				   			   path_bar,
+				   			   NAUTILUS_FILE_ATTRIBUTE_CAPABILITIES);
+				   			   
+	button_data->file_changed_handler_id = g_signal_connect (button_data->path_file,
+														  	 "changed",
+		 												  	 G_CALLBACK (file_changed_callback), 
+		 												  	 path_bar);
+		 												
+	return button_data;
 }
 
 static gboolean
 nautilus_path_bar_check_parent_path (NautilusPathBar *path_bar,
 				     const char  *file_path)
 {
-        GList *list;
-        GList *current_path;
+	GList *list;
+	GList *current_path;
 	gboolean need_new_fake_root;
 
-	current_path = NULL;
+	current_path = NULL;	
 	need_new_fake_root = FALSE;
 
-        for (list = path_bar->button_list; list; list = list->next) {
+        for (list = path_bar->button_list; list != NULL; list = list->next) {
                 ButtonData *button_data;
 
                 button_data = list->data;
@@ -1440,7 +1522,7 @@ nautilus_path_bar_check_parent_path (Nau
 
 		if (need_new_fake_root) {
 			path_bar->fake_root = NULL;
-	  		for (list = current_path; list; list = list->next) {
+	  		for (list = current_path; list != NULL; list = list->next) {
 	      			ButtonData *button_data;
 
 	      			button_data = list->data;
@@ -1451,7 +1533,7 @@ nautilus_path_bar_check_parent_path (Nau
 	    		}
 		}
 
-                for (list = path_bar->button_list; list; list = list->next) {
+                for (list = path_bar->button_list; list != NULL; list = list->next) {
 
 	  		nautilus_path_bar_update_button_appearance (path_bar,
 					  			    BUTTON_DATA (list->data),
@@ -1492,7 +1574,6 @@ get_parent_directory (const char *file_p
 
 }
 
-
 static char *
 get_display_name_for_folder (const char *file_path)
 {
@@ -1512,65 +1593,65 @@ get_display_name_for_folder (const char 
 	return name;
 }
 
-
 static gboolean
 nautilus_path_bar_update_path (NautilusPathBar *path_bar, const char *file_path)
 {
-        char *path, *parent_path, *name;
-        gboolean first_directory, last_directory;
-        gboolean result;
-        GList *new_buttons, *l, *fake_root;
-        ButtonData *button_data;
+	char *path, *parent_path, *name;
+	gboolean first_directory, last_directory;
+	gboolean result;
+	GList *new_buttons, *l, *fake_root;
+	ButtonData *button_data;
 
-        g_return_val_if_fail (NAUTILUS_IS_PATH_BAR (path_bar), FALSE);
-        g_return_val_if_fail (file_path != NULL, FALSE);
+	g_return_val_if_fail (NAUTILUS_IS_PATH_BAR (path_bar), FALSE);
+	g_return_val_if_fail (file_path != NULL, FALSE);
 
-        name = NULL;
+	name = NULL;
 	fake_root = NULL;
-        result = TRUE;
+	result = TRUE;
 	parent_path = NULL;
 	first_directory = TRUE;
 	last_directory = FALSE;
 	new_buttons = NULL;
 
-        path = g_strdup (file_path);
+	path = g_strdup (file_path);
 
-        gtk_widget_push_composite_child ();
+	gtk_widget_push_composite_child ();
 
-        while (path != NULL) {
-
-                parent_path = get_parent_directory (path);
-                name = get_display_name_for_folder (path);	
+	while (path != NULL) {
+		parent_path = get_parent_directory (path);
+		name = get_display_name_for_folder (path);	
 		last_directory = !parent_path;
-                button_data = make_directory_button (path_bar, name, path, first_directory, last_directory, FALSE);
-                g_free (path);
+		button_data = make_directory_button (path_bar, name, path, first_directory, last_directory, FALSE);
+		g_free (path);
 		g_free (name);
 
-                new_buttons = g_list_prepend (new_buttons, button_data);
+		new_buttons = g_list_prepend (new_buttons, button_data);
 
 		if (BUTTON_IS_FAKE_ROOT (button_data)) {
 			fake_root = new_buttons;
 		}
-		
-                path = parent_path;
-                first_directory = FALSE;
-        }
 
-        nautilus_path_bar_clear_buttons (path_bar);
-       	path_bar->button_list = g_list_reverse (new_buttons);
+		path = parent_path;
+		first_directory = FALSE;
+	}
+
+	nautilus_path_bar_clear_buttons (path_bar);
+	path_bar->button_list = g_list_reverse (new_buttons);
 	path_bar->fake_root = fake_root;
 
-       	for (l = path_bar->button_list; l; l = l->next) {
+	for (l = path_bar->button_list; l != NULL; l = l->next) {
 		GtkWidget *button;
 		button = BUTTON_DATA (l->data)->button;
 		gtk_container_add (GTK_CONTAINER (path_bar), button);
 	}	
 
-        gtk_widget_pop_composite_child ();
+	gtk_widget_pop_composite_child ();
 
-        return result;
+	return result;
 }
 
+
+
 gboolean
 nautilus_path_bar_set_path (NautilusPathBar *path_bar, const char *file_path)
 {
@@ -1582,12 +1663,10 @@ nautilus_path_bar_set_path (NautilusPath
         if (nautilus_path_bar_check_parent_path (path_bar, file_path)) {
                 return TRUE;
 	}
-
+		 													
 	return nautilus_path_bar_update_path (path_bar, file_path);
 }
 
-
-
 /**
  * _nautilus_path_bar_up:
  * @path_bar: a #NautilusPathBar
@@ -1600,7 +1679,7 @@ nautilus_path_bar_up (NautilusPathBar *p
 {
         GList *l;
 
-        for (l = path_bar->button_list; l; l = l->next) {
+        for (l = path_bar->button_list; l != NULL; l = l->next) {
                 GtkWidget *button = BUTTON_DATA (l->data)->button;
                 if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button))) {
 			if (l->next) {
@@ -1624,7 +1703,7 @@ nautilus_path_bar_down (NautilusPathBar 
 {
         GList *l;
 
-        for (l = path_bar->button_list; l; l = l->next) {
+        for (l = path_bar->button_list; l != NULL; l = l->next) {
                 GtkWidget *button = BUTTON_DATA (l->data)->button;
                 if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button))) {
 	  		if (l->prev) {
