[Xfce4-commits] <ristretto:master> Do not open non-image files when opening folder-contents from the recently-used menu.

Stephan Arts stephan at xfce.org
Wed Aug 12 12:22:07 CEST 2009


Updating branch refs/heads/master
         to 9b75414e8bb4500c58635dd45ecb8f2f45266902 (commit)
       from a07d682816dffb989b62eac47f2fbd6f02770201 (commit)

commit 9b75414e8bb4500c58635dd45ecb8f2f45266902
Author: Stephan Arts <stephan at xfce.org>
Date:   Sun Jun 21 10:56:27 2009 +0200

    Do not open non-image files when opening folder-contents from the recently-used menu.

 src/main_window.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/main_window.c b/src/main_window.c
index 58d6d18..8cadffd 100644
--- a/src/main_window.c
+++ b/src/main_window.c
@@ -1208,6 +1208,7 @@ cb_rstto_main_window_open_recent(GtkRecentChooser *chooser, RsttoMainWindow *win
     GtkWidget *err_dialog;
     gchar *uri = gtk_recent_chooser_get_current_uri (chooser);
     const gchar *filename;
+    const gchar *content_type = NULL;
     GError *error = NULL;
     GFile *file = g_file_new_for_uri (uri);
     GFile *child_file;
@@ -1219,13 +1220,17 @@ cb_rstto_main_window_open_recent(GtkRecentChooser *chooser, RsttoMainWindow *win
     {
         if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_DIRECTORY)
         {
-            file_enumarator = g_file_enumerate_children (file, "standard::name", 0, NULL, NULL);
+            file_enumarator = g_file_enumerate_children (file, "standard::*", 0, NULL, NULL);
             for(child_file_info = g_file_enumerator_next_file (file_enumarator, NULL, NULL); child_file_info != NULL; child_file_info = g_file_enumerator_next_file (file_enumarator, NULL, NULL))
             {
                 filename = g_file_info_get_name (child_file_info);
+                content_type  = g_file_info_get_content_type (child_file_info);
                 child_file = g_file_get_child (file, filename);
 
-                rstto_image_list_add_file (window->priv->props.image_list, child_file, NULL);
+                if (strncmp (content_type, "image/", 6) == 0)
+                {
+                    rstto_image_list_add_file (window->priv->props.image_list, child_file, NULL);
+                }
 
                 g_object_unref (child_file);
                 g_object_unref (child_file_info);



More information about the Xfce4-commits mailing list