summaryrefslogtreecommitdiff
path: root/tests/testfilechooser.c
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@ximian.com>2003-09-09 15:18:29 +0000
committerFederico Mena Quintero <federico@src.gnome.org>2003-09-09 15:18:29 +0000
commit613b441b5b3a2920463396e28c9ae95b34868ec1 (patch)
treef8fe413ace9283c9e3e2fc02b460417577d244f6 /tests/testfilechooser.c
parent0d7de37eb07c6b1c531dddb54063ac95d4db5874 (diff)
downloadgtk+-613b441b5b3a2920463396e28c9ae95b34868ec1.tar.gz
Free the display_key.
2003-09-08 Federico Mena Quintero <federico@ximian.com> * gtkfilesystem.c (gtk_file_info_free): Free the display_key. * gtkfilechooserimpldefault.c (list_mtime_data_func): New function. (create_file_list): Add a modification time column; remove the size column. (mtime_sort_func): New callback. (tree_selection_changed): Add a sorting function for the mtime column. Have the model fetch the modification time as well. (tree_selection_changed): Do allow the file list model to show directories. * testfilechooser.c (my_new_from_file_at_size): Do not try to read non-regular files.
Diffstat (limited to 'tests/testfilechooser.c')
-rw-r--r--tests/testfilechooser.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/testfilechooser.c b/tests/testfilechooser.c
index be4922aead..5ff9af1d2c 100644
--- a/tests/testfilechooser.c
+++ b/tests/testfilechooser.c
@@ -136,6 +136,7 @@ my_new_from_file_at_size (const char *filename,
int width;
int height;
} info;
+ struct stat st;
guchar buffer [4096];
int length;
@@ -144,6 +145,18 @@ my_new_from_file_at_size (const char *filename,
g_return_val_if_fail (filename != NULL, NULL);
g_return_val_if_fail (width > 0 && height > 0, NULL);
+ if (stat (filename, &st) != 0) {
+ g_set_error (error,
+ G_FILE_ERROR,
+ g_file_error_from_errno (errno),
+ _("Could not get information for file '%s': %s"),
+ filename, g_strerror (errno));
+ return NULL;
+ }
+
+ if (!S_ISREG (st.st_mode))
+ return NULL;
+
f = fopen (filename, "rb");
if (!f) {
g_set_error (error,