brasero r931 - in trunk: . src
- From: philippr svn gnome org
- To: svn-commits-list gnome org
- Subject: brasero r931 - in trunk: . src
- Date: Sun, 29 Jun 2008 15:35:04 +0000 (UTC)
Author: philippr
Date: Sun Jun 29 15:35:03 2008
New Revision: 931
URL: http://svn.gnome.org/viewvc/brasero?rev=931&view=rev
Log:
Fix #540673 â m3u playlist import problem
keep the correct order of entries in a playlist
* src/brasero-io.c (brasero_io_get_file_info_thread_real),
(brasero_io_get_file_info_thread),
(brasero_io_parse_playlist_thread):
* src/brasero-io.h:
Modified:
trunk/ChangeLog
trunk/src/brasero-io.c
trunk/src/brasero-io.h
Modified: trunk/src/brasero-io.c
==============================================================================
--- trunk/src/brasero-io.c (original)
+++ trunk/src/brasero-io.c Sun Jun 29 15:35:03 2008
@@ -698,85 +698,56 @@
* Used to get information about files
*/
-static BraseroAsyncTaskResult
-brasero_io_get_file_info_thread (BraseroAsyncTaskManager *manager,
- GCancellable *cancel,
- gpointer callback_data)
+static GFileInfo *
+brasero_io_get_file_info_thread_real (BraseroAsyncTaskManager *manager,
+ GCancellable *cancel,
+ const gchar *uri,
+ BraseroIOFlags options,
+ GError **error)
{
gchar attributes [256] = {G_FILE_ATTRIBUTE_STANDARD_NAME ","
G_FILE_ATTRIBUTE_STANDARD_SIZE ","
G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK ","
G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET ","
G_FILE_ATTRIBUTE_STANDARD_TYPE};
- BraseroIOJob *job = callback_data;
- gchar *file_uri = NULL;
- GError *error = NULL;
GFileInfo *info;
GFile *file;
- if (job->options & BRASERO_IO_INFO_CHECK_PARENT_SYMLINK) {
- /* If we want to make sure a directory is not added twice we have to make sure
- * that it doesn't have a symlink as parent otherwise "/home/Foo/Bar" with Foo
- * as a symlink pointing to /tmp would be seen as a different file from /tmp/Bar
- * It would be much better if we could use the inode numbers provided by gnome_vfs
- * unfortunately they are guint64 and can't be used in hash tables as keys.
- * Therefore we check parents up to root to see if there are symlinks and if so
- * we get a path without symlinks in it. This is done only for local file */
- file_uri = brasero_io_check_for_parent_symlink (job->uri, cancel);
- }
-
- if (g_cancellable_is_cancelled (cancel)) {
- g_free (file_uri);
+ if (g_cancellable_is_cancelled (cancel))
return BRASERO_ASYNC_TASK_FINISHED;
- }
- if (job->options & BRASERO_IO_INFO_PERM)
+ if (options & BRASERO_IO_INFO_PERM)
strcat (attributes, "," G_FILE_ATTRIBUTE_ACCESS_CAN_READ);
- if (job->options & BRASERO_IO_INFO_MIME)
+ if (options & BRASERO_IO_INFO_MIME)
strcat (attributes, "," G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE);
- if (job->options & BRASERO_IO_INFO_ICON)
+ if (options & BRASERO_IO_INFO_ICON)
strcat (attributes, "," G_FILE_ATTRIBUTE_STANDARD_ICON);
- file = g_file_new_for_uri (file_uri?file_uri:job->uri);
+ file = g_file_new_for_uri (uri);
info = g_file_query_info (file,
attributes,
G_FILE_QUERY_INFO_NONE, /* follow symlinks */
cancel,
- &error);
- if (error) {
- brasero_io_return_result (BRASERO_IO (manager),
- job->base,
- file_uri?file_uri:job->uri,
- NULL,
- error,
- job->callback_data);
- g_free (file_uri);
+ error);
+ if (!info) {
g_object_unref (file);
- return BRASERO_ASYNC_TASK_FINISHED;
+ return NULL;
}
if (g_file_info_get_is_symlink (info)) {
GFile *parent;
parent = g_file_get_parent (file);
- if (!brasero_io_check_symlink_target (parent, info, file_uri?file_uri:job->uri)) {
- error = g_error_new (BRASERO_ERROR,
- BRASERO_ERROR_SYMLINK_LOOP,
- _("recursive symbolic link"));
+ if (!brasero_io_check_symlink_target (parent, info, uri)) {
+ g_set_error (error,
+ BRASERO_ERROR,
+ BRASERO_ERROR_SYMLINK_LOOP,
+ _("recursive symbolic link"));
- /* since we checked for the existence of the file
- * an error means a looping symbolic link */
- brasero_io_return_result (BRASERO_IO (manager),
- job->base,
- file_uri?file_uri:job->uri,
- NULL,
- error,
- job->callback_data);
- g_free (file_uri);
g_object_unref (info);
g_object_unref (file);
g_object_unref (parent);
- return BRASERO_ASYNC_TASK_FINISHED;
+ return NULL;
}
g_object_unref (parent);
}
@@ -785,15 +756,15 @@
/* see if we are supposed to get metadata for this file (provided it's
* an audio file of course). */
if (g_file_info_get_file_type (info) != G_FILE_TYPE_DIRECTORY
- && job->options & BRASERO_IO_INFO_METADATA) {
+ && options & BRASERO_IO_INFO_METADATA) {
BraseroMetadataInfo metadata = { NULL };
gboolean result;
result = brasero_io_get_metadata_info (BRASERO_IO (manager),
cancel,
- file_uri?file_uri:job->uri,
+ uri,
info,
- (job->options & BRASERO_IO_INFO_METADATA_MISSING_CODEC) ? BRASERO_METADATA_FLAG_MISSING : 0,
+ (options & BRASERO_IO_INFO_METADATA_MISSING_CODEC) ? BRASERO_METADATA_FLAG_MISSING : 0,
&metadata);
if (result)
@@ -802,13 +773,47 @@
brasero_metadata_info_clear (&metadata);
}
+ return info;
+}
+
+static BraseroAsyncTaskResult
+brasero_io_get_file_info_thread (BraseroAsyncTaskManager *manager,
+ GCancellable *cancel,
+ gpointer callback_data)
+{
+ BraseroIOJob *job = callback_data;
+ gchar *file_uri = NULL;
+ GError *error = NULL;
+ GFileInfo *info;
+
+ if (job->options & BRASERO_IO_INFO_CHECK_PARENT_SYMLINK) {
+ /* If we want to make sure a directory is not added twice we have to make sure
+ * that it doesn't have a symlink as parent otherwise "/home/Foo/Bar" with Foo
+ * as a symlink pointing to /tmp would be seen as a different file from /tmp/Bar
+ * It would be much better if we could use the inode numbers provided by gnome_vfs
+ * unfortunately they are guint64 and can't be used in hash tables as keys.
+ * Therefore we check parents up to root to see if there are symlinks and if so
+ * we get a path without symlinks in it. This is done only for local file */
+ file_uri = brasero_io_check_for_parent_symlink (job->uri, cancel);
+ }
+
+ if (g_cancellable_is_cancelled (cancel)) {
+ g_free (file_uri);
+ return BRASERO_ASYNC_TASK_FINISHED;
+ }
+
+ info = brasero_io_get_file_info_thread_real (manager,
+ cancel,
+ file_uri?file_uri:job->uri,
+ job->options,
+ &error);
+
brasero_io_return_result (BRASERO_IO (manager),
job->base,
file_uri?file_uri:job->uri,
- info,
NULL,
+ error,
job->callback_data);
- g_free (file_uri);
return BRASERO_ASYNC_TASK_FINISHED;
}
@@ -986,16 +991,32 @@
NULL,
job->callback_data);
- /* Now get information about each file in the list */
+ /* Now get information about each file in the list.
+ * Reverse order of list to get a correct order for entries. */
+ data.uris = g_slist_reverse (data.uris);
for (iter = data.uris; iter; iter = iter->next) {
gchar *child;
+ GFileInfo *child_info;
child = iter->data;
- brasero_io_new_file_info_job (BRASERO_IO (manager),
- child,
- job->base,
- job->options,
- job->callback_data);
+ if (g_cancellable_is_cancelled (cancel))
+ break;
+
+ child_info = brasero_io_get_file_info_thread_real (manager,
+ cancel,
+ child,
+ job->options,
+ NULL);
+
+ if (!child_info)
+ continue;
+
+ brasero_io_return_result (BRASERO_IO (manager),
+ job->base,
+ child,
+ child_info,
+ NULL,
+ job->callback_data);
}
brasero_io_playlist_clear (&data);
Modified: trunk/src/brasero-io.h
==============================================================================
--- trunk/src/brasero-io.h (original)
+++ trunk/src/brasero-io.h Sun Jun 29 15:35:03 2008
@@ -78,6 +78,8 @@
#define BRASERO_IO_PLAYLIST_TITLE "playlist::title"
#define BRASERO_IO_IS_PLAYLIST "playlist::is_playlist"
#define BRASERO_IO_PLAYLIST_ENTRIES_NUM "playlist::entries_num"
+#define BRASERO_IO_PLAYLIST_ENTRIES "playlist::entries"
+#define BRASERO_IO_PLAYLIST_ENTRY_URI "playlist::entry_uri"
#define BRASERO_IO_COUNT_NUM "count::num"
#define BRASERO_IO_COUNT_SIZE "count::size"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]