File gtk2-filechooser-network-browsing.patch of Package gtk2

diff -upr gtk+-2.14.4-pre/gtk/gtkfilechooserbutton.c gtk+-2.14.4-post/gtk/gtkfilechooserbutton.c
--- gtk+-2.14.4-pre/gtk/gtkfilechooserbutton.c	2008-10-16 23:06:19.000000000 -0500
+++ gtk+-2.14.4-post/gtk/gtkfilechooserbutton.c	2008-12-04 20:16:04.000000000 -0600
@@ -998,7 +998,7 @@ dnd_select_folder_get_info_cb (GCancella
     {
       gboolean is_folder;
 
-      is_folder = (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY);
+      is_folder = _gtk_file_system_consider_as_directory (info);
 
       data->selected =
 	(((data->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER && is_folder) ||
@@ -1455,7 +1455,7 @@ set_info_get_info_cb (GCancellable *canc
   if (!data->label)
     data->label = g_strdup (g_file_info_get_display_name (info));
 
-  is_folder = (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY);
+  is_folder = _gtk_file_system_consider_as_directory (info);
 
   gtk_list_store_set (GTK_LIST_STORE (data->button->priv->model), &iter,
 		      ICON_COLUMN, pixbuf,
diff -upr gtk+-2.14.4-pre/gtk/gtkfilechooserdefault.c gtk+-2.14.4-post/gtk/gtkfilechooserdefault.c
--- gtk+-2.14.4-pre/gtk/gtkfilechooserdefault.c	2008-10-16 23:06:19.000000000 -0500
+++ gtk+-2.14.4-post/gtk/gtkfilechooserdefault.c	2008-12-04 20:18:19.000000000 -0600
@@ -2771,7 +2771,7 @@ selection_check_foreach_cb (GtkTreeModel
     case OPERATION_MODE_BROWSE:
       gtk_tree_model_sort_convert_iter_to_child_iter (closure->impl->sort_model, &child_iter, iter);
       info = _gtk_file_system_model_get_info (closure->impl->browse_files_model, &child_iter);
-      is_folder = info ? (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY) : FALSE;
+      is_folder = info ? (_gtk_file_system_consider_as_directory (info)) : FALSE;
       break;
 
     case OPERATION_MODE_SEARCH:
@@ -4165,8 +4165,7 @@ file_list_drag_data_received_get_info_cb
 
   if ((data->impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
        data->impl->action == GTK_FILE_CHOOSER_ACTION_SAVE) &&
-      data->uris[1] == 0 && !error &&
-      g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY)
+      data->uris[1] == 0 && !error && _gtk_file_system_consider_as_directory (info))
     change_folder_and_display_error (data->impl, data->file, FALSE);
   else
     {
@@ -6086,7 +6085,7 @@ list_model_filter_func (GtkFileSystemMod
   if (!impl->current_filter)
     return TRUE;
 
-  if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_DIRECTORY)
+  if (_gtk_file_system_consider_as_directory (file_info))
     return TRUE;
 
   return !get_is_file_filtered (impl, file, file_info);
@@ -6123,12 +6122,12 @@ install_list_model_filter (GtkFileChoose
   gboolean dir_a, dir_b;										       \
 													       \
   if (info_a)												       \
-    dir_a = (g_file_info_get_file_type (info_a) == G_FILE_TYPE_DIRECTORY);				       \
+    dir_a = _gtk_file_system_consider_as_directory (info_a);						       \
   else													       \
     return impl->list_sort_ascending ? -1 : 1;								       \
 													       \
   if (info_b)												       \
-    dir_b = (g_file_info_get_file_type (info_b) == G_FILE_TYPE_DIRECTORY);				       \
+    dir_b = _gtk_file_system_consider_as_directory (info_b);						       \
   else													       \
     return impl->list_sort_ascending ? 1 : -1;  							       \
 													       \
@@ -6410,9 +6409,9 @@ show_and_select_files_finished_loading (
 	    have_hidden = g_file_info_get_is_hidden (info);
 
 	  if (!have_filtered)
-	    have_filtered = (g_file_info_get_file_type (info) != G_FILE_TYPE_DIRECTORY) &&
+	    have_filtered = (! _gtk_file_system_consider_as_directory (info)) &&
 			     get_is_file_filtered (data->impl, file, info);
-
+	
 	  g_object_unref (info);
 
 	  if (have_hidden && have_filtered)
@@ -6745,7 +6744,7 @@ update_chooser_entry (GtkFileChooserDefa
 	      impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
 	    {
 	      /* We don't want the name to change when clicking on a folder... */
-	      change_entry = (g_file_info_get_file_type (info) != G_FILE_TYPE_DIRECTORY);
+	      change_entry = (! _gtk_file_system_consider_as_directory (info));
 	    }
           else
 	    change_entry = TRUE; /* ... unless we are in SELECT_FOLDER mode */
@@ -6900,7 +6899,7 @@ update_current_folder_get_info_cb (GCanc
       g_object_unref (data->original_file);
     }
 
-  if (g_file_info_get_file_type (info) != G_FILE_TYPE_DIRECTORY)
+  if (! _gtk_file_system_consider_as_directory (info))
     goto out;
 
   if (!_gtk_path_bar_set_file (GTK_PATH_BAR (impl->browse_path_bar), data->file, data->keep_trail, NULL))
@@ -7183,7 +7182,7 @@ maybe_select (GtkTreeModel *model,
   selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
   
   info = get_list_file_info (impl, iter);
-  is_folder = (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY);
+  is_folder = _gtk_file_system_consider_as_directory (info);
 
   if ((is_folder && impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER) ||
       (!is_folder && impl->action == GTK_FILE_CHOOSER_ACTION_OPEN))
@@ -7581,7 +7580,7 @@ add_shortcut_get_info_cb (GCancellable *
 
   data->impl->loading_shortcuts = g_slist_remove (data->impl->loading_shortcuts, cancellable);
 
-  if (cancelled || error || g_file_info_get_file_type (info) != G_FILE_TYPE_DIRECTORY)
+  if (cancelled || error || (! _gtk_file_system_consider_as_directory (info)))
     goto out;
 
   pos = shortcuts_get_pos_for_shortcut_folder (data->impl, data->impl->num_shortcuts);
@@ -8129,7 +8128,7 @@ save_entry_get_info_cb (GCancellable *ca
   if (!info)
     parent_is_folder = FALSE;
   else
-    parent_is_folder = (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY);
+    parent_is_folder = _gtk_file_system_consider_as_directory (info);
 
   if (parent_is_folder)
     {
@@ -8199,7 +8198,7 @@ file_exists_get_info_cb (GCancellable *c
   if (cancelled)
     goto out;
 
-  file_exists_and_is_not_folder = info && (g_file_info_get_file_type (info) != G_FILE_TYPE_DIRECTORY);
+  file_exists_and_is_not_folder = info && (! _gtk_file_system_consider_as_directory (info));
 
   if (data->impl->action == GTK_FILE_CHOOSER_ACTION_OPEN)
     /* user typed a filename; we are done */
@@ -8613,7 +8612,7 @@ search_hit_get_info_cb (GCancellable *ca
 
   display_name = g_strdup (g_file_info_get_display_name (info));
   mime_type = g_content_type_get_mime_type (g_file_info_get_content_type (info));
-  is_folder = (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY);
+  is_folder = _gtk_file_system_consider_as_directory (info);
   pixbuf = _gtk_file_info_render_icon (info, GTK_WIDGET (request->impl),
 				       request->impl->icon_size);
 
@@ -9684,7 +9683,7 @@ recent_item_get_info_cb (GCancellable *c
       goto out;
     }
 
-  is_folder = (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY);
+  is_folder = _gtk_file_system_consider_as_directory (info);
 
   gtk_list_store_set (request->impl->recent_model, &iter,
                       RECENT_MODEL_COL_IS_FOLDER, is_folder,
@@ -10248,7 +10247,7 @@ shortcuts_activate_get_info_cb (GCancell
   if (cancelled)
     goto out;
 
-  if (!error && g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY)
+  if (!error && _gtk_file_system_consider_as_directory (info))
     change_folder_and_display_error (data->impl, data->file, FALSE);
   else
     gtk_file_chooser_default_select_file (GTK_FILE_CHOOSER (data->impl),
@@ -10470,7 +10469,7 @@ list_select_func  (GtkTreeSelection  *se
 
             gtk_tree_model_sort_convert_iter_to_child_iter (impl->sort_model, &child_iter, &iter);
             info = _gtk_file_system_model_get_info (impl->browse_files_model, &child_iter);
-            if (info && g_file_info_get_file_type (info) != G_FILE_TYPE_DIRECTORY)
+            if (info && (! _gtk_file_system_consider_as_directory (info)))
               return FALSE;
           }
           break;
@@ -10582,11 +10581,28 @@ list_row_activated (GtkTreeView
         info = _gtk_file_system_model_get_info (impl->browse_files_model,
                                                 &child_iter);
 
-        if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY)
+        if (_gtk_file_system_consider_as_directory (info))
           {
-	    GFile *file;
+	    GFile *file, *target_file;
+	    const gchar *target_uri;
 
             file = _gtk_file_system_model_get_file (impl->browse_files_model, &child_iter);
+            if (g_file_info_get_file_type (info) == G_FILE_TYPE_SHORTCUT ||
+                g_file_info_get_file_type (info) == G_FILE_TYPE_MOUNTABLE) 
+              {
+                target_uri = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_TARGET_URI);
+                if (target_uri)
+                  {
+                    target_file = g_file_new_for_uri (target_uri);
+                    if (target_file)
+                      {
+                        g_object_unref (file);
+                        file = target_file;
+                      }
+                  }  
+              }
+            
+            
             change_folder_and_display_error (impl, file, FALSE);
             return;
           }
@@ -10714,7 +10730,7 @@ list_icon_data_func (GtkTreeViewColumn *
         if (info &&
             (impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER ||
              impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER))
-          sensitive = (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY);
+          sensitive = _gtk_file_system_consider_as_directory (info);
       }
       break;
     }
@@ -10818,7 +10834,7 @@ list_name_data_func (GtkTreeViewColumn *
   if (impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER ||
       impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
     {
-      sensitive = (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY);
+      sensitive = _gtk_file_system_consider_as_directory (info);
     }
 
   g_object_set (cell,
@@ -10842,7 +10858,7 @@ list_size_data_func (GtkTreeViewColumn *
   gchar *str;
   gboolean sensitive = TRUE;
 
-  if (!info || g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY)
+  if (!info || _gtk_file_system_consider_as_directory (info))
     {
       g_object_set (cell,
 		    "text", NULL,
@@ -10959,7 +10975,7 @@ list_mtime_data_func (GtkTreeViewColumn
 
       if (impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER ||
 	  impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
-	sensitive = (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY);
+	sensitive = _gtk_file_system_consider_as_directory (info);
     }
 
   if (G_UNLIKELY (time_mtime == 0))
Only in gtk+-2.14.4-post/gtk: gtkfilechooserdefault.c~
diff -upr gtk+-2.14.4-pre/gtk/gtkfilechooserentry.c gtk+-2.14.4-post/gtk/gtkfilechooserentry.c
--- gtk+-2.14.4-pre/gtk/gtkfilechooserentry.c	2008-10-16 23:06:19.000000000 -0500
+++ gtk+-2.14.4-post/gtk/gtkfilechooserentry.c	2008-12-04 20:16:04.000000000 -0600
@@ -439,7 +439,7 @@ maybe_append_separator_to_file (GtkFileC
 
       if (info)
 	{
-	  if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY)
+	  if (_gtk_file_system_consider_as_directory (info))
 	    {
 	      gchar *tmp = display_name;
 	      display_name = g_strconcat (tmp, G_DIR_SEPARATOR_S, NULL);
@@ -1812,7 +1812,7 @@ _gtk_file_chooser_entry_get_is_folder (G
 
       if (file_info)
         {
-	  retval = (g_file_info_get_file_type (file_info) == G_FILE_TYPE_DIRECTORY);
+	  retval = _gtk_file_system_consider_as_directory (file_info);
 	  g_object_unref (file_info);
 	}
     }
diff -upr gtk+-2.14.4-pre/gtk/gtkfilesystem.c gtk+-2.14.4-post/gtk/gtkfilesystem.c
--- gtk+-2.14.4-pre/gtk/gtkfilesystem.c	2008-10-16 23:06:19.000000000 -0500
+++ gtk+-2.14.4-post/gtk/gtkfilesystem.c	2008-12-04 20:16:04.000000000 -0600
@@ -918,6 +918,11 @@ enclosing_volume_mount_cb (GObject
   g_file_mount_enclosing_volume_finish (G_FILE (source_object), result, &error);
   volume = _gtk_file_system_get_volume_for_file (async_data->file_system, G_FILE (source_object));
 
+  /* Silently drop G_IO_ERROR_ALREADY_MOUNTED error for gvfs backends without visible mounts. */
+  /* Better than doing query_info with additional I/O every time. */
+  if (error && g_error_matches (error, G_IO_ERROR, G_IO_ERROR_ALREADY_MOUNTED))
+    g_clear_error (&error);
+
   gdk_threads_enter ();
   ((GtkFileSystemVolumeMountCallback) async_data->callback) (async_data->cancellable, volume,
 							     error, async_data->data);
@@ -1742,3 +1747,14 @@ _gtk_file_info_render_icon (GFileInfo *i
 
   return pixbuf;
 }
+
+gboolean
+_gtk_file_system_consider_as_directory (GFileInfo *info)
+{
+  GFileType type = g_file_info_get_file_type (info);
+  
+  return (type == G_FILE_TYPE_DIRECTORY ||
+          type == G_FILE_TYPE_SHORTCUT ||
+          type == G_FILE_TYPE_MOUNTABLE);
+}
+
diff -upr gtk+-2.14.4-pre/gtk/gtkfilesystem.h gtk+-2.14.4-post/gtk/gtkfilesystem.h
--- gtk+-2.14.4-pre/gtk/gtkfilesystem.h	2008-10-16 23:06:19.000000000 -0500
+++ gtk+-2.14.4-post/gtk/gtkfilesystem.h	2008-12-04 20:16:04.000000000 -0600
@@ -172,6 +172,8 @@ GdkPixbuf *     _gtk_file_info_render_ic
 					    GtkWidget *widget,
 					    gint       icon_size);
 
+gboolean	_gtk_file_system_consider_as_directory (GFileInfo *info);
+
 G_END_DECLS
 
 #endif /* __GTK_FILE_SYSTEM_H__ */
diff -upr gtk+-2.14.4-pre/gtk/gtkfilesystemmodel.c gtk+-2.14.4-post/gtk/gtkfilesystemmodel.c
--- gtk+-2.14.4-pre/gtk/gtkfilesystemmodel.c	2008-10-16 23:06:19.000000000 -0500
+++ gtk+-2.14.4-post/gtk/gtkfilesystemmodel.c	2008-12-04 20:16:04.000000000 -0600
@@ -444,7 +444,7 @@ gtk_file_system_model_iter_has_child (Gt
   else
     {
       GFileInfo *info = file_model_node_get_info (model, node);
-      return (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY);
+      return _gtk_file_system_consider_as_directory (info);
     }
 }
 
@@ -1330,7 +1330,7 @@ file_model_node_is_visible (GtkFileSyste
 	  return FALSE;
 	}
 
-      is_folder = (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY);
+      is_folder = _gtk_file_system_consider_as_directory (info);
 
       if (model->show_folders != model->show_files &&
 	  model->show_folders != is_folder)
@@ -1553,7 +1553,7 @@ file_model_node_get_children (GtkFileSys
     {
       GFileInfo *info = file_model_node_get_info (model, node);
       gboolean has_children = FALSE;
-      gboolean is_folder = (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY);
+      gboolean is_folder = _gtk_file_system_consider_as_directory (info);
 
       file_model_node_idle_clear_cancel (node);