Index: gtk/gtkfilechooserdefault.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkfilechooserdefault.c,v
retrieving revision 1.323
diff -u -p -r1.323 gtkfilechooserdefault.c
--- gtk/gtkfilechooserdefault.c	12 Jun 2006 15:11:39 -0000	1.323
+++ gtk/gtkfilechooserdefault.c	16 Jun 2006 09:39:34 -0000
@@ -2310,6 +2310,49 @@ add_bookmark_button_clicked_cb (GtkButto
   bookmarks_add_selected_folder (impl);
 }
 
+/* Copies the location of the currently selected item in the file list
+ * into the clipboard */
+static void
+copy_location_selected_folder (GtkFileChooserDefault *impl)
+{
+  GtkTreeSelection *selection;
+  GtkClipboard *clip;
+  const GtkFilePath *path;
+  char *url;
+  int count;
+
+  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
+
+  count = gtk_tree_selection_count_selected_rows (selection);
+  if (count == 0) {
+    path = impl->current_folder;
+  } else if (count == 1) {
+    GtkTreeIter iter, child_iter;
+
+    //FIXME more error checking
+    gtk_tree_selection_get_selected (selection, NULL, &iter);
+    gtk_tree_model_sort_convert_iter_to_child_iter (impl->sort_model,
+                                                    &child_iter, &iter);
+
+    path = _gtk_file_system_model_get_path (impl->browse_files_model,
+                                            &child_iter);
+  } else {
+    g_assert_not_reached ();
+    path = NULL;
+  }
+
+  url = gtk_file_system_path_to_uri (impl->file_system, path);
+
+  clip = gtk_clipboard_get_for_display (gdk_display_get_default(),
+                                        GDK_SELECTION_CLIPBOARD);
+  gtk_clipboard_set_text (clip, url, -1);
+  clip = gtk_clipboard_get_for_display (gdk_display_get_default(),
+                                        GDK_SELECTION_PRIMARY);
+  gtk_clipboard_set_text (clip, url, -1);
+
+  g_free (url);
+}
+
 /* Returns TRUE plus an iter in the shortcuts_model if a row is selected;
  * returns FALSE if no shortcut is selected.
  */
@@ -2532,6 +2575,12 @@ bookmarks_check_add_sensitivity (GtkFile
     gtk_widget_set_sensitive (impl->browse_files_popup_menu_add_shortcut_item,
 			      (num_selected == 0) ? FALSE : active);
 
+  //FIXME what about multiple files?
+  //FIXME what about the tooltip for that menu item?
+  if (impl->browse_files_popup_menu_copy_location_item)
+    gtk_widget_set_sensitive (impl->browse_files_popup_menu_copy_location_item,
+                              (num_selected <= 1));
+
   if (active)
     {
       if (num_selected == 0)
@@ -3603,6 +3652,15 @@ add_to_shortcuts_cb (GtkMenuItem        
   bookmarks_add_selected_folder (impl);
 }
 
+/* Callback used when the "Copy Location" menu item is activated */
+static void
+copy_location_cb (GtkMenuItem           *item,
+                  GtkFileChooserDefault *impl)
+{
+  copy_location_selected_folder (impl);
+}
+
+
 /* Callback used when the "Show Hidden Files" menu item is toggled */
 static void
 show_hidden_toggled_cb (GtkCheckMenuItem      *item,
@@ -3821,6 +3879,16 @@ file_list_build_popup_menu (GtkFileChoos
   gtk_widget_set_sensitive (item, FALSE);
   g_signal_connect (item, "activate",
 		    G_CALLBACK (add_to_shortcuts_cb), impl);
+  gtk_widget_show (item);
+  gtk_menu_shell_append (GTK_MENU_SHELL (impl->browse_files_popup_menu), item);
+
+  item = gtk_image_menu_item_new_with_mnemonic (_("_Copy Location"));
+  impl->browse_files_popup_menu_copy_location_item = item;
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item),
+                                 gtk_image_new_from_stock (GTK_STOCK_COPY, GTK_ICON_SIZE_MENU));
+  gtk_widget_set_sensitive (item, FALSE);
+  g_signal_connect (item, "activate",
+                    G_CALLBACK (copy_location_cb), impl);
   gtk_widget_show (item);
   gtk_menu_shell_append (GTK_MENU_SHELL (impl->browse_files_popup_menu), item);
 
Index: gtk/gtkfilechooserprivate.h
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkfilechooserprivate.h,v
retrieving revision 1.13
diff -u -p -r1.13 gtkfilechooserprivate.h
--- gtk/gtkfilechooserprivate.h	3 May 2006 22:29:48 -0000	1.13
+++ gtk/gtkfilechooserprivate.h	16 Jun 2006 09:39:34 -0000
@@ -173,6 +173,7 @@ struct _GtkFileChooserDefault
   GtkWidget *browse_files_tree_view;
   GtkWidget *browse_files_popup_menu;
   GtkWidget *browse_files_popup_menu_add_shortcut_item;
+  GtkWidget *browse_files_popup_menu_copy_location_item;
   GtkWidget *browse_files_popup_menu_hidden_files_item;
   GtkWidget *browse_new_folder_button;
   GtkWidget *browse_path_bar;
