Updating branch refs/heads/jannis/port-to-udev to 9bd67464b81364ee9da5e86f5bc349c67a6f6b2c (commit) from fc5d5240526507bb57e7db19830842189def4922 (commit)
commit 9bd67464b81364ee9da5e86f5bc349c67a6f6b2c Author: Jannis Pohlmann <jan...@xfce.org> Date: Mon Jul 19 19:33:22 2010 +0200 Make tvm_file_test() case insensitive so that video_ts equals VIDEO_TS. This fixes a few problems with video CD/DVD autoplay. thunar-volman/tvm-block-device.c | 43 +++++++++++++++++++++++++++++-------- 1 files changed, 33 insertions(+), 10 deletions(-) diff --git a/thunar-volman/tvm-block-device.c b/thunar-volman/tvm-block-device.c index 118e383..5d919a0 100644 --- a/thunar-volman/tvm-block-device.c +++ b/thunar-volman/tvm-block-device.c @@ -73,23 +73,46 @@ tvm_file_test (GMount *mount, const gchar *filename, GFileTest test) { - gboolean result = FALSE; - GFile *mount_point; - gchar *mount_path; - gchar *absolute_path; + const gchar *name; + gboolean result = FALSE; + GFile *mount_point; + gchar *directory; + gchar *path; + GDir *dp; g_return_val_if_fail (G_IS_MOUNT (mount), FALSE); g_return_val_if_fail (filename != NULL && *filename != '\0', FALSE); mount_point = g_mount_get_root (mount); - mount_path = g_file_get_path (mount_point); + directory = g_file_get_path (mount_point); g_object_unref (mount_point); - absolute_path = g_build_filename (mount_path, filename, NULL); - g_free (mount_path); + /* try to open the specified directory */ + dp = g_dir_open (directory, 0, NULL); + if (G_LIKELY (dp != NULL)) + { + while (!result) + { + /* read the next entry */ + name = g_dir_read_name (dp); + if (G_UNLIKELY (name == NULL)) + break; + + /* check if we have a potential match */ + if (g_ascii_strcasecmp (name, filename) == 0) + { + /* check if test condition met */ + path = g_build_filename (directory, name, NULL); + result = g_file_test (path, test); + g_free (path); + } + } + + /* cleanup */ + g_dir_close (dp); + } - result = g_file_test (absolute_path, test); - g_free (absolute_path); + g_free (directory); return result; } _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org http://foo-projects.org/mailman/listinfo/xfce4-commits