[gtk+/gtk-2.90] Show an error dialog when we can't read the folder's contents



commit 4567c8971373d8971927023a66c2166b7b45de55
Author: Federico Mena Quintero <federico novell com>
Date:   Wed Sep 2 13:43:03 2009 -0500

    Show an error dialog when we can't read the folder's contents
    
    Signed-off-by: Federico Mena Quintero <federico novell com>

 gtk/gtkfilechooserdefault.c |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c
index ea3d1f0..51af003 100644
--- a/gtk/gtkfilechooserdefault.c
+++ b/gtk/gtkfilechooserdefault.c
@@ -6382,6 +6382,29 @@ pending_select_files_process (GtkFileChooserDefault *impl)
   g_assert (impl->pending_select_files == NULL);
 }
 
+static void
+show_error_on_reading_current_folder (GtkFileChooserDefault *impl, GError *error)
+{
+  GFileInfo *info;
+  char *msg;
+
+  info = g_file_query_info (impl->current_folder,
+			    G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
+			    G_FILE_QUERY_INFO_NONE,
+			    NULL,
+			    NULL);
+  if (info)
+    {
+      msg = g_strdup (_("Could not read the contents of %s"), g_file_info_get_display_name (info));
+      g_object_unref (info);
+    }
+  else
+    msg = g_strdup (_("Could not read the contents of the folder"));
+
+  error_message (impl, msg, error->message);
+  g_free (msg);
+}
+
 /* Callback used when the file system model finishes loading */
 static void
 browse_files_model_finished_loading_cb (GtkFileSystemModel    *model,
@@ -6390,6 +6413,9 @@ browse_files_model_finished_loading_cb (GtkFileSystemModel    *model,
 {
   profile_start ("start", NULL);
 
+  if (error)
+    show_error_on_reading_current_folder (impl, error);
+
   if (impl->load_state == LOAD_PRELOAD)
     {
       load_remove_timer (impl);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]