brasero r648 - in trunk: . src src/plugins/cdrdao src/plugins/checksum src/plugins/libburnia src/plugins/local-track
- From: philippr svn gnome org
- To: svn-commits-list gnome org
- Subject: brasero r648 - in trunk: . src src/plugins/cdrdao src/plugins/checksum src/plugins/libburnia src/plugins/local-track
- Date: Mon, 25 Feb 2008 14:12:44 +0000 (GMT)
Author: philippr
Date: Mon Feb 25 14:12:43 2008
New Revision: 648
URL: http://svn.gnome.org/viewvc/brasero?rev=648&view=rev
Log:
2008-02-25 Philippe Rouquier <philippr svn gnome org>
Fix #510480 â Migrate from GnomeVFS to GIO
Removed GnomeVFS dependency. Now brasero uses Gio and requires glib 2.15.5 at least
Some memleaks fixed.
Fixed crash (division by 0)
* configure.in:
* src/Makefile.am:
* src/brasero-async-task-manager.c:
(brasero_async_task_manager_finalize),
(brasero_async_task_manager_insert_task),
(brasero_async_task_manager_thread),
(brasero_async_task_manager_queue),
(brasero_async_task_manager_foreach_active),
(brasero_async_task_manager_foreach_active_remove),
(brasero_async_task_manager_foreach_unprocessed_remove),
(brasero_async_task_manager_find_urgent_task):
* src/brasero-async-task-manager.h:
* src/brasero-audio-disc.c: (brasero_audio_disc_init),
(brasero_audio_disc_reset_real), (brasero_audio_disc_finalize),
(brasero_audio_disc_validate_utf8_name),
(brasero_audio_disc_set_row_from_metadata),
(brasero_audio_disc_result),
(brasero_audio_disc_vfs_operation_finished),
(brasero_audio_disc_visit_dir_async),
(brasero_audio_disc_add_playlist),
(brasero_audio_disc_unreadable_dialog),
(brasero_audio_disc_new_row_cb), (brasero_audio_disc_add_uri_real),
(brasero_audio_disc_clipboard_text_cb),
(brasero_audio_disc_start_monitoring),
(brasero_audio_disc_inotify_modify),
(brasero_audio_disc_inotify_attributes_changed_cb),
(brasero_audio_disc_inotify_attributes_changed),
(brasero_audio_disc_inotify_monitor_cb):
* src/brasero-data-disc.c: (brasero_data_disc_clipboard_text_cb),
(brasero_data_disc_unreadable_uri_cb):
* src/brasero-data-project.c: (brasero_data_project_uri_to_nodes),
(brasero_data_project_uri_is_graft_needed),
(brasero_data_project_node_loaded),
(brasero_data_project_node_reloaded),
(brasero_data_project_add_node_from_info),
(brasero_data_project_add_excluded_uri),
(brasero_data_project_file_added),
(brasero_data_project_file_update_URI),
(brasero_data_project_file_graft):
* src/brasero-data-project.h:
* src/brasero-data-tree-model.c:
(brasero_data_tree_model_get_value):
* src/brasero-data-vfs.c: (brasero_data_vfs_check_uri_result),
(brasero_data_vfs_directory_load_end),
(brasero_data_vfs_directory_check_symlink_loop),
(brasero_data_vfs_directory_load_result),
(brasero_data_vfs_load_directory),
(brasero_data_vfs_loading_node_end),
(brasero_data_vfs_loading_node_result),
(brasero_data_vfs_load_node), (brasero_data_vfs_loading_node),
(brasero_data_vfs_require_higher_priority),
(brasero_data_vfs_require_directory_contents),
(brasero_data_vfs_require_node_load), (brasero_data_vfs_load_mime),
(brasero_data_vfs_clear), (brasero_data_vfs_init),
(brasero_data_vfs_finalize), (brasero_data_vfs_class_init):
* src/brasero-disc-message.c: (brasero_disc_message_finalize):
* src/brasero-drive-info.c: (brasero_drive_info_update_info):
* src/brasero-drive-properties.c:
(brasero_drive_properties_set_tmpdir):
* src/brasero-file-filtered.c: (brasero_file_filtered_add):
* src/brasero-file-monitor.c:
(brasero_file_monitor_start_monitoring_real):
* src/brasero-file-node.c: (brasero_file_node_validate_utf8_name),
(brasero_file_node_set_from_info),
(brasero_file_node_get_uri_name),
(brasero_file_node_new_from_info):
* src/brasero-file-node.h:
* src/brasero-image-option-dialog.c:
(brasero_image_option_dialog_image_info_cb),
(brasero_image_option_dialog_get_format),
(brasero_image_option_dialog_finalize):
* src/brasero-metadata.c: (brasero_metadata_stop),
(brasero_metadata_cancel), (brasero_metadata_completed),
(brasero_metadata_process_pending_tag_messages),
(brasero_metadata_success), (brasero_metadata_bus_messages),
(brasero_metadata_new_decoded_pad_cb),
(brasero_metadata_set_new_uri), (brasero_metadata_cancelled_cb),
(brasero_metadata_get_info_wait), (brasero_metadata_get_info_sync),
(brasero_metadata_info_copy), (brasero_metadata_set_info),
(brasero_metadata_init), (brasero_metadata_finalize):
* src/brasero-metadata.h:
* src/brasero-mime-filter.c: (brasero_mime_filter_add_mime):
* src/brasero-ncb.c: (NCB_DRIVE_GET_VFS_DRIVE),
(NCB_VOLUME_GET_MOUNT_POINT):
* src/brasero-player-bacon.c:
* src/brasero-player.c: (brasero_player_image),
(brasero_player_metadata_completed),
(brasero_player_retrieve_metadata), (brasero_player_set_uri),
(brasero_player_destroy):
* src/brasero-playlist.c: (brasero_playlist_init),
(brasero_playlist_destroy), (brasero_playlist_parse_end),
(brasero_playlist_parse_result),
(brasero_playlist_add_uri_playlist):
* src/brasero-project-manager.c:
(brasero_project_manager_set_statusbar),
(brasero_project_manager_size_preview),
(brasero_project_manager_size_preview_progress),
(brasero_project_manager_selected_uris_changed),
(brasero_project_manager_load_session),
(brasero_project_manager_save_session),
(brasero_project_manager_finalize):
* src/brasero-project.c: (brasero_project_open_project_xml),
(brasero_project_save_project_xml):
* src/brasero-search-beagle.c:
* src/brasero-sum-dialog.c: (brasero_sum_dialog_download),
(brasero_sum_dialog_get_file_checksum):
* src/brasero-utils.c: (brasero_utils_launch_app):
* src/brasero-utils.h:
* src/brasero-vfs.c: (brasero_vfs_check_for_parent_symlink),
(brasero_utils_get_symlink_target), (brasero_vfs_info_thread),
(brasero_vfs_load_thread), (brasero_vfs_metadata_ctx_new),
(brasero_vfs_metadata_result), (brasero_vfs_count_result_audio),
(brasero_vfs_count_result_data),
(brasero_vfs_playlist_subtask_result):
* src/brasero-vfs.h:
* src/brasero-xfer.c: (brasero_xfer_result_cb),
(brasero_xfer_progress_cb), (brasero_xfer), (brasero_xfer_cancel):
* src/brasero-xfer.h:
* src/burn-basics.c:
* src/burn-basics.h:
* src/burn-caps.c: (brasero_caps_add_processing_plugins_to_task):
* src/burn-job.c: (brasero_job_check_output_volume_space):
* src/burn-mkisofs-base.c: (brasero_mkisofs_base_write_excluded),
(_build_graft_point):
* src/burn-session.c:
* src/burn-track.c: (brasero_track_get_localpath),
(brasero_track_get_uri):
* src/burn-volume.c:
* src/burn.c:
* src/main.c: (brasero_app_parse_options), (main):
* src/plugins/cdrdao/burn-cdrdao.c:
* src/plugins/checksum/burn-md5sum-file.c:
(brasero_md5sum_file_grafts):
* src/plugins/checksum/burn-md5sum.c:
* src/plugins/libburnia/burn-libisofs.c:
(brasero_libisofs_create_volume_thread):
* src/plugins/local-track/burn-local-image.c:
(brasero_local_track_get_download_size),
(brasero_local_track_progress_cb),
(brasero_local_track_file_transfer),
(brasero_local_track_recursive_transfer),
(brasero_local_track_transfer),
(brasero_local_track_read_checksum),
(brasero_local_track_download_checksum),
(brasero_local_track_thread_finished),
(brasero_local_track_thread), (brasero_local_track_start_thread),
(_foreach_non_local_cb), (brasero_local_track_add_if_non_local),
(brasero_local_track_start), (brasero_local_track_stop):
* src/scsi-read-cd.c: (brasero_mmc1_read_block):
Removed:
trunk/src/brasero-vfs.h
Modified:
trunk/ChangeLog
trunk/configure.in
trunk/src/Makefile.am
trunk/src/brasero-async-task-manager.c
trunk/src/brasero-async-task-manager.h
trunk/src/brasero-audio-disc.c
trunk/src/brasero-data-disc.c
trunk/src/brasero-data-project.c
trunk/src/brasero-data-project.h
trunk/src/brasero-data-tree-model.c
trunk/src/brasero-data-vfs.c
trunk/src/brasero-disc-message.c
trunk/src/brasero-drive-info.c
trunk/src/brasero-drive-properties.c
trunk/src/brasero-file-filtered.c
trunk/src/brasero-file-monitor.c
trunk/src/brasero-file-node.c
trunk/src/brasero-file-node.h
trunk/src/brasero-image-option-dialog.c
trunk/src/brasero-metadata.c
trunk/src/brasero-metadata.h
trunk/src/brasero-mime-filter.c
trunk/src/brasero-ncb.c
trunk/src/brasero-player-bacon.c
trunk/src/brasero-player.c
trunk/src/brasero-playlist.c
trunk/src/brasero-project-manager.c
trunk/src/brasero-project.c
trunk/src/brasero-search-beagle.c
trunk/src/brasero-sum-dialog.c
trunk/src/brasero-utils.c
trunk/src/brasero-utils.h
trunk/src/brasero-vfs.c
trunk/src/brasero-xfer.c
trunk/src/brasero-xfer.h
trunk/src/burn-basics.c
trunk/src/burn-basics.h
trunk/src/burn-caps.c
trunk/src/burn-job.c
trunk/src/burn-mkisofs-base.c
trunk/src/burn-session.c
trunk/src/burn-track.c
trunk/src/burn-volume.c
trunk/src/burn.c
trunk/src/main.c
trunk/src/plugins/cdrdao/burn-cdrdao.c
trunk/src/plugins/checksum/burn-md5sum-file.c
trunk/src/plugins/checksum/burn-md5sum.c
trunk/src/plugins/libburnia/burn-libisofs.c
trunk/src/plugins/local-track/burn-local-image.c
trunk/src/scsi-read-cd.c
Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in (original)
+++ trunk/configure.in Mon Feb 25 14:12:43 2008
@@ -63,13 +63,14 @@
AC_SYS_LARGEFILE
dnl ********** GNOME2 ******************************
-GLIB_REQUIRED=2.6.0
+GLIB_REQUIRED=2.15.5
GMODULE_REQUIRED=2.6.0
+GIO_REQUIRED=2.15.5
GDK_REQUIRED=2.6.0
GTK_REQUIRED=2.11.6
LIBGNOME_REQUIRED=2.10.0
LIBGNOMEUI_REQUIRED=2.10.0
-GNOME_VFS_REQUIRED=2.14.2
+GCONF_REQUIRED=2.0.0
GSTREAMER_REQUIRED=0.10.6
GSTREAMER_BASE_REQUIRED=0.10.0
LIBXML2_REQUIRED=2.6.0
@@ -87,25 +88,25 @@
BRASERO_GSTREAMER_LIBS="$BRASERO_GSTREAMER_LIBS $LDFLAGS"
dnl ** used by brasero and one plugin
-PKG_CHECK_MODULES(BRASERO_GNOMEVFS, \
- gnome-vfs-2.0 >= $GNOME_VFS_REQUIRED \
- gnome-vfs-module-2.0)
-
-AC_SUBST(BRASERO_GNOMEVFS_CFLAGS)
-AC_SUBST(BRASERO_GNOMEVFS_LIBS)
+PKG_CHECK_MODULES(BRASERO_GIO, \
+ gio-2.0 >= $GIO_REQUIRED)
-BRASERO_GNOMEVFS_CFLAGS="$BRASERO_GNOMEVFS_CFLAGS $CFLAGS"
-BRASERO_GNOMEVFS_LIBS="$BRASERO_GNOMEVFS_LIBS $LDFLAGS"
+AC_SUBST(BRASERO_GIO_CFLAGS)
+AC_SUBST(BRASERO_GIO_LIBS)
+
+BRASERO_GIO_CFLAGS="$BRASERO_GIO_CFLAGS $CFLAGS"
+BRASERO_GIO_LIBS="$BRASERO_GIO_LIBS $LDFLAGS"
dnl ** used by brasero and all modules
PKG_CHECK_MODULES(BRASERO_BASE, \
libnautilus-burn >= $NAUTILUS_BURN_REQUIRED \
+ gconf-2.0 >= $GCONF_REQUIRED \
glib-2.0 >= $GLIB_REQUIRED)
-
+
AC_SUBST(BRASERO_BASE_CFLAGS)
AC_SUBST(BRASERO_BASE_LIBS)
-BRASERO_BASE_CFLAGS="$BRASERO_BASE_CFLAGS $BRASERO_GNOMEVFS_CFLAGS $CFLAGS"
+BRASERO_BASE_CFLAGS="$BRASERO_BASE_CFLAGS $BRASERO_GIO_CFLAGS $CFLAGS"
BRASERO_BASE_LIBS="$BRASERO_BASE_LIBS $LDFLAGS"
dnl ** used only by brasero app itself ***
@@ -116,11 +117,11 @@
libgnome-2.0 >= $LIBGNOME_REQUIRED \
libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED \
libxml-2.0 >= $LIBXML2_REQUIRED)
-
+
AC_SUBST(BRASERO_CFLAGS)
AC_SUBST(BRASERO_LIBS)
-BRASERO_CFLAGS="$BRASERO_BASE_CFLAGS $BRASERO_GSTREAMER_CFLAGS $BRASERO_GNOMEVFS_CFLAGS $BRASERO_CFLAGS $CFLAGS"
-BRASERO_LIBS="$BRASERO_BASE_LIBS $BRASERO_GSTREAMER_LIBS $BRASERO_GNOMEVFS_LIBS $BRASERO_LIBS $BRASERO_SCSI_LIBS $LDFLAGS"
+BRASERO_CFLAGS="$BRASERO_BASE_CFLAGS $BRASERO_GSTREAMER_CFLAGS $BRASERO_GIO_CFLAGS $BRASERO_CFLAGS $CFLAGS"
+BRASERO_LIBS="$BRASERO_BASE_LIBS $BRASERO_GSTREAMER_LIBS $BRASERO_GIO_LIBS $BRASERO_LIBS $BRASERO_SCSI_LIBS $LDFLAGS"
dnl ****************check for libburn (optional)**************
LIBBURN_REQUIRED=0.4.0
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Mon Feb 25 14:12:43 2008
@@ -106,8 +106,6 @@
brasero-ncb.c \
burn-task.c \
burn-task.h \
- brasero-vfs.c \
- brasero-vfs.h \
brasero-async-task-manager.c \
brasero-async-task-manager.h \
eggtreemultidnd.c \
@@ -231,7 +229,9 @@
brasero-disc-message.c \
baobab-cell-renderer-progress.c \
baobab-cell-renderer-progress.h \
- scsi-device.h
+ scsi-device.h \
+ brasero-io.h \
+ brasero-io.c
if BUILD_INOTIFY
brasero_SOURCES += brasero-file-monitor.c brasero-file-monitor.h
Modified: trunk/src/brasero-async-task-manager.c
==============================================================================
--- trunk/src/brasero-async-task-manager.c (original)
+++ trunk/src/brasero-async-task-manager.c Mon Feb 25 14:12:43 2008
@@ -22,6 +22,14 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <glib.h>
+#include <gio/gio.h>
+#include <glib-object.h>
+
#include "brasero-async-task-manager.h"
static void brasero_async_task_manager_class_init (BraseroAsyncTaskManagerClass *klass);
@@ -36,32 +44,22 @@
GSList *waiting_tasks;
GSList *active_tasks;
- GSList *results;
gint num_threads;
gint unused_threads;
- gint results_id;
-
- GHashTable *types;
- BraseroAsyncTaskTypeID type_num;
-
gint cancelled:1;
};
-struct _BraseroAsyncTaskType {
- BraseroAsyncThread thread;
- BraseroSyncResult result;
-};
-typedef struct _BraseroAsyncTaskType BraseroAsyncTaskType;
-
struct _BraseroAsyncTaskCtx {
- BraseroAsyncTaskType *common;
+ BraseroAsyncPriority priority;
+ const BraseroAsyncTaskType *type;
+ GCancellable *cancel;
gpointer data;
};
typedef struct _BraseroAsyncTaskCtx BraseroAsyncTaskCtx;
-#define MANAGER_MAX_THREAD 1
+#define MANAGER_MAX_THREAD 2
static GObjectClass *parent_class = NULL;
@@ -142,25 +140,8 @@
while (cobj->priv->num_threads)
g_cond_wait (cobj->priv->thread_finished, cobj->priv->lock);
- if (cobj->priv->results_id) {
- g_source_remove (cobj->priv->results_id);
- cobj->priv->results_id = 0;
- }
-
- /* remove all the results in case one got added */
- g_slist_foreach (cobj->priv->results,
- (GFunc) g_free,
- NULL);
- g_slist_free (cobj->priv->results);
- cobj->priv->results = NULL;
-
g_mutex_unlock (cobj->priv->lock);
- if (cobj->priv->types) {
- g_hash_table_destroy (cobj->priv->types);
- cobj->priv->types = NULL;
- }
-
if (cobj->priv->task_finished) {
g_cond_free (cobj->priv->task_finished);
cobj->priv->task_finished = NULL;
@@ -185,79 +166,57 @@
G_OBJECT_CLASS (parent_class)->finalize (object);
}
-BraseroAsyncTaskTypeID
-brasero_async_task_manager_register_type (BraseroAsyncTaskManager *self,
- BraseroAsyncThread thread,
- BraseroSyncResult result)
+static void
+brasero_async_task_manager_insert_task (BraseroAsyncTaskManager *self,
+ BraseroAsyncTaskCtx *ctx)
{
- BraseroAsyncTaskType *type;
-
- g_return_val_if_fail (self != 0, 0);
-
- self->priv->type_num ++;
- if (self->priv->type_num == G_MAXINT) {
- self->priv->type_num = 1;
+ GSList *iter;
+ GSList *node;
+ BraseroAsyncTaskCtx *tmp;
- while (g_hash_table_lookup (self->priv->types, GINT_TO_POINTER (self->priv->type_num))) {
- self->priv->type_num ++;
+ node = g_slist_alloc ();
+ node->data = ctx;
- if (self->priv->type_num == G_MAXINT) {
- g_warning ("ERROR: reached the max number of types\n");
- return 0;
- }
- }
+ if (!self->priv->waiting_tasks) {
+ self->priv->waiting_tasks = node;
+ return;
}
-
- type = g_new0 (BraseroAsyncTaskType, 1);
- type->thread = thread;
- type->result = result;
-
- if (!self->priv->types)
- self->priv->types = g_hash_table_new_full (g_direct_hash,
- g_direct_equal,
- NULL,
- g_free);
-
- g_hash_table_insert (self->priv->types,
- GINT_TO_POINTER (self->priv->type_num),
- type);
- return self->priv->type_num;
-}
-
-static gboolean
-brasero_async_task_manager_result (BraseroAsyncTaskManager *self)
-{
- BraseroAsyncTaskCtx *ctx;
-
- g_mutex_lock (self->priv->lock);
+ tmp = self->priv->waiting_tasks->data;
- if (!self->priv->results) {
- self->priv->results_id = 0;
- g_mutex_unlock (self->priv->lock);
- return FALSE;
+ if (tmp->priority < ctx->priority) {
+ node->next = self->priv->waiting_tasks;
+ self->priv->waiting_tasks = node;
+ return;
}
- ctx = self->priv->results->data;
- self->priv->results = g_slist_remove (self->priv->results, ctx);
-
- g_mutex_unlock (self->priv->lock);
+ for (iter = self->priv->waiting_tasks; iter->next; iter = iter->next) {
+ tmp = iter->next->data;
- ctx->common->result (self, ctx->data);
- g_free (ctx);
+ if (tmp->priority < ctx->priority) {
+ node->next = iter->next;
+ iter->next = node;
+ return;
+ }
+ }
- return TRUE;
+ iter->next = node;
}
static gpointer
brasero_async_task_manager_thread (BraseroAsyncTaskManager *self)
{
gboolean result;
+ GCancellable *cancel;
BraseroAsyncTaskCtx *ctx;
+ cancel = g_cancellable_new ();
+
g_mutex_lock (self->priv->lock);
while (1) {
+ BraseroAsyncTaskResult res;
+
/* say we are unused */
self->priv->unused_threads ++;
@@ -290,21 +249,46 @@
/* get the data from the list */
ctx = self->priv->waiting_tasks->data;
+ ctx->cancel = cancel;
+ ctx->priority &= ~BRASERO_ASYNC_RESCHEDULE;
+
self->priv->waiting_tasks = g_slist_remove (self->priv->waiting_tasks, ctx);
self->priv->active_tasks = g_slist_prepend (self->priv->active_tasks, ctx);
g_mutex_unlock (self->priv->lock);
- ctx->common->thread (self, ctx->data);
+ res = ctx->type->thread (self, cancel, ctx->data);
g_mutex_lock (self->priv->lock);
/* we remove the task from the list and signal it is finished */
self->priv->active_tasks = g_slist_remove (self->priv->active_tasks, ctx);
g_cond_signal (self->priv->task_finished);
- /* insert the task in the results queue */
- self->priv->results = g_slist_append (self->priv->results, ctx);
- if (!self->priv->results_id)
- self->priv->results_id = g_idle_add ((GSourceFunc) brasero_async_task_manager_result, self);
+ if (g_cancellable_is_cancelled (cancel)) {
+ if (ctx->type->destroy)
+ ctx->type->destroy (self, ctx->data);
+
+ g_free (ctx);
+ }
+ else if (res == BRASERO_ASYNC_TASK_RESCHEDULE) {
+ if (self->priv->waiting_tasks) {
+ BraseroAsyncTaskCtx *next;
+
+ next = self->priv->waiting_tasks->data;
+ if (next->priority > ctx->priority)
+ brasero_async_task_manager_insert_task (self, ctx);
+ else
+ self->priv->waiting_tasks = g_slist_prepend (self->priv->waiting_tasks, ctx);
+ }
+ else
+ self->priv->waiting_tasks = g_slist_prepend (self->priv->waiting_tasks, ctx);
+ }
+ else {
+ if (ctx->type->destroy)
+ ctx->type->destroy (self, ctx->data);
+ g_free (ctx);
+ }
+
+ g_cancellable_reset (cancel);
}
end:
@@ -316,6 +300,8 @@
g_cond_signal (self->priv->thread_finished);
g_mutex_unlock (self->priv->lock);
+ g_object_unref (cancel);
+
g_thread_exit (NULL);
return NULL;
@@ -323,25 +309,26 @@
gboolean
brasero_async_task_manager_queue (BraseroAsyncTaskManager *self,
- BraseroAsyncTaskTypeID type,
+ BraseroAsyncPriority priority,
+ const BraseroAsyncTaskType *type,
gpointer data)
{
BraseroAsyncTaskCtx *ctx;
- BraseroAsyncTaskType *task_type;
g_return_val_if_fail (self != NULL, FALSE);
- g_return_val_if_fail (type > 0, FALSE);
-
- task_type = g_hash_table_lookup (self->priv->types, GINT_TO_POINTER (type));
- if (!task_type)
- return FALSE;
ctx = g_new0 (BraseroAsyncTaskCtx, 1);
+ ctx->priority = priority;
+ ctx->type = type;
ctx->data = data;
- ctx->common = task_type;
g_mutex_lock (self->priv->lock);
- self->priv->waiting_tasks = g_slist_append (self->priv->waiting_tasks, ctx);
+ if (priority == BRASERO_ASYNC_IDLE)
+ self->priv->waiting_tasks = g_slist_append (self->priv->waiting_tasks, ctx);
+ else if (priority == BRASERO_ASYNC_NORMAL)
+ brasero_async_task_manager_insert_task (self, ctx);
+ else if (priority == BRASERO_ASYNC_URGENT)
+ self->priv->waiting_tasks = g_slist_prepend (self->priv->waiting_tasks, ctx);
if (self->priv->unused_threads) {
/* wake up one thread in the list */
@@ -356,7 +343,6 @@
self,
FALSE,
&error);
-
if (!thread) {
g_warning ("Can't start thread : %s\n", error->message);
g_error_free (error);
@@ -381,6 +367,29 @@
BraseroAsyncFindTask func,
gpointer user_data)
{
+ GSList *iter;
+ BraseroAsyncTaskCtx *ctx;
+ gboolean result = FALSE;
+
+ g_return_val_if_fail (self != NULL, FALSE);
+ g_return_val_if_fail (func != NULL, FALSE);
+
+ g_mutex_lock (self->priv->lock);
+ for (iter = self->priv->active_tasks; iter; iter = iter->next) {
+ ctx = iter->data;
+ if (func (self, ctx->data, user_data))
+ result = TRUE;
+ }
+ g_mutex_unlock (self->priv->lock);
+
+ return result;
+}
+
+gboolean
+brasero_async_task_manager_foreach_active_remove (BraseroAsyncTaskManager *self,
+ BraseroAsyncFindTask func,
+ gpointer user_data)
+{
GSList *iter, *tasks = NULL;
BraseroAsyncTaskCtx *ctx;
@@ -391,8 +400,10 @@
for (iter = self->priv->active_tasks; iter; iter = iter->next) {
ctx = iter->data;
- if (func (self, ctx->data, user_data))
+ if (func (self, ctx->data, user_data)) {
+ g_cancellable_cancel (ctx->cancel);
tasks = g_slist_prepend (tasks, ctx);
+ }
}
while (tasks) {
@@ -402,37 +413,20 @@
for (iter = tasks; iter; iter = iter->next) {
ctx = iter->data;
- if (g_slist_find (self->priv->active_tasks, ctx) == NULL) {
- tasks = g_slist_remove (tasks, ctx);
- break;
- }
- }
- }
-
- g_mutex_unlock (self->priv->lock);
- return TRUE;
-}
-
-static GSList *
-brasero_async_task_manager_foreach_remove (BraseroAsyncTaskManager *self,
- GSList *list,
- BraseroAsyncFindTask func,
- gpointer user_data)
-{
- BraseroAsyncTaskCtx *ctx;
- GSList *iter, *next;
+ if (g_slist_find (self->priv->active_tasks, ctx))
+ continue;
- for (iter = list; iter; iter = next) {
- ctx = iter->data;
- next = iter->next;
+ tasks = g_slist_remove (tasks, ctx);
- if (func (self, ctx->data, user_data)) {
- list = g_slist_remove (list, ctx);
- g_free (ctx);
+ /* NOTE: no need to call destroy callback here
+ * since it was done in the thread loop. */
+ break;
}
}
- return list;
+ g_mutex_unlock (self->priv->lock);
+
+ return TRUE;
}
gboolean
@@ -440,32 +434,28 @@
BraseroAsyncFindTask func,
gpointer user_data)
{
+ BraseroAsyncTaskCtx *ctx;
+ GSList *iter, *next;
+
g_return_val_if_fail (self != NULL, FALSE);
g_return_val_if_fail (func != NULL, FALSE);
g_mutex_lock (self->priv->lock);
- self->priv->waiting_tasks = brasero_async_task_manager_foreach_remove (self,
- self->priv->waiting_tasks,
- func,
- user_data);
- g_mutex_unlock (self->priv->lock);
- return TRUE;
-}
+ for (iter = self->priv->waiting_tasks; iter; iter = next) {
+ ctx = iter->data;
+ next = iter->next;
-gboolean
-brasero_async_task_manager_foreach_processed_remove (BraseroAsyncTaskManager *self,
- BraseroAsyncFindTask func,
- gpointer user_data)
-{
- g_return_val_if_fail (self != NULL, FALSE);
- g_return_val_if_fail (func != NULL, FALSE);
+ if (func (self, ctx->data, user_data)) {
+ self->priv->waiting_tasks = g_slist_remove (self->priv->waiting_tasks, ctx);
- g_mutex_lock (self->priv->lock);
- self->priv->results = brasero_async_task_manager_foreach_remove (self,
- self->priv->results,
- func,
- user_data);
+ /* call the destroy callback */
+ if (ctx->type->destroy)
+ ctx->type->destroy (self, ctx->data);
+
+ g_free (ctx);
+ }
+ }
g_mutex_unlock (self->priv->lock);
return TRUE;
@@ -487,6 +477,8 @@
ctx = iter->data;
if (func (self, ctx->data, user_data)) {
+ ctx->priority = BRASERO_ASYNC_URGENT;
+
self->priv->waiting_tasks = g_slist_remove (self->priv->waiting_tasks, ctx);
self->priv->waiting_tasks = g_slist_prepend (self->priv->waiting_tasks, ctx);
g_mutex_unlock (self->priv->lock);
Modified: trunk/src/brasero-async-task-manager.h
==============================================================================
--- trunk/src/brasero-async-task-manager.h (original)
+++ trunk/src/brasero-async-task-manager.h Mon Feb 25 14:12:43 2008
@@ -28,6 +28,8 @@
#include <glib.h>
#include <glib-object.h>
+#include <gio/gio.h>
+
G_BEGIN_DECLS
#define BRASERO_TYPE_ASYNC_TASK_MANAGER (brasero_async_task_manager_get_type ())
@@ -48,18 +50,41 @@
GObjectClass parent_class;
} BraseroAsyncTaskManagerClass;
-typedef void (*BraseroAsyncThread) (BraseroAsyncTaskManager *manager, gpointer user_data);
-typedef void (*BraseroSyncResult) (BraseroAsyncTaskManager *manager, gpointer user_data);
-
-typedef gboolean (*BraseroAsyncFindTask) (BraseroAsyncTaskManager *manager, gpointer task, gpointer user_data);
-
GType brasero_async_task_manager_get_type ();
-typedef guint BraseroAsyncTaskTypeID;
+typedef enum {
+ BRASERO_ASYNC_TASK_FINISHED = 0,
+ BRASERO_ASYNC_TASK_RESCHEDULE = 1
+} BraseroAsyncTaskResult;
+
+typedef BraseroAsyncTaskResult (*BraseroAsyncThread) (BraseroAsyncTaskManager *manager,
+ GCancellable *cancel,
+ gpointer user_data);
+typedef void (*BraseroAsyncDestroy) (BraseroAsyncTaskManager *manager,
+ gpointer user_data);
+typedef gboolean (*BraseroAsyncFindTask) (BraseroAsyncTaskManager *manager,
+ gpointer task,
+ gpointer user_data);
+
+struct _BraseroAsyncTaskType {
+ BraseroAsyncThread thread;
+ BraseroAsyncDestroy destroy;
+};
+typedef struct _BraseroAsyncTaskType BraseroAsyncTaskType;
+
+typedef enum {
+ /* used internally when reschedule */
+ BRASERO_ASYNC_RESCHEDULE = 1,
+
+ BRASERO_ASYNC_IDLE = 1 << 1,
+ BRASERO_ASYNC_NORMAL = 1 << 2,
+ BRASERO_ASYNC_URGENT = 1 << 3
+} BraseroAsyncPriority;
gboolean
brasero_async_task_manager_queue (BraseroAsyncTaskManager *manager,
- BraseroAsyncTaskTypeID type,
+ BraseroAsyncPriority priority,
+ const BraseroAsyncTaskType *type,
gpointer data);
gboolean
@@ -67,9 +92,9 @@
BraseroAsyncFindTask func,
gpointer user_data);
gboolean
-brasero_async_task_manager_foreach_processed_remove (BraseroAsyncTaskManager *self,
- BraseroAsyncFindTask func,
- gpointer user_data);
+brasero_async_task_manager_foreach_active_remove (BraseroAsyncTaskManager *manager,
+ BraseroAsyncFindTask func,
+ gpointer user_data);
gboolean
brasero_async_task_manager_foreach_unprocessed_remove (BraseroAsyncTaskManager *self,
BraseroAsyncFindTask func,
@@ -79,9 +104,5 @@
brasero_async_task_manager_find_urgent_task (BraseroAsyncTaskManager *manager,
BraseroAsyncFindTask func,
gpointer user_data);
-BraseroAsyncTaskTypeID
-brasero_async_task_manager_register_type (BraseroAsyncTaskManager *manager,
- BraseroAsyncThread thread,
- BraseroSyncResult result);
#endif /* ASYNC_JOB_MANAGER_H */
Modified: trunk/src/brasero-audio-disc.c
==============================================================================
--- trunk/src/brasero-audio-disc.c (original)
+++ trunk/src/brasero-audio-disc.c Mon Feb 25 14:12:43 2008
@@ -58,12 +58,6 @@
#include <gtk/gtkstock.h>
#include <gtk/gtktoolbar.h>
-#include <libgnomeui/libgnomeui.h>
-
-#include <libgnomevfs/gnome-vfs.h>
-#include <libgnomevfs/gnome-vfs-mime-handlers.h>
-#include <libgnomevfs/gnome-vfs-file-info.h>
-
#include "burn-basics.h"
#include "burn-debug.h"
#include "brasero-disc.h"
@@ -71,7 +65,7 @@
#include "brasero-metadata.h"
#include "brasero-utils.h"
#include "brasero-song-properties.h"
-#include "brasero-vfs.h"
+#include "brasero-io.h"
#include "brasero-split-dialog.h"
#include "eggtreemultidnd.h"
@@ -251,16 +245,12 @@
#endif
struct _BraseroAudioDiscPrivate {
- BraseroVFS *vfs;
- BraseroVFSDataID attr_changed;
- BraseroVFSDataID add_dir;
- BraseroVFSDataID add_uri;
-
-#ifdef BUILD_PLAYLIST
+ BraseroIO *io;
+ BraseroIOJobBase *attr_changed;
+ BraseroIOJobBase *add_dir;
+ BraseroIOJobBase *add_uri;
+ BraseroIOJobBase *add_playlist;
- BraseroVFSDataID add_playlist;
-
-#endif
GtkWidget *notebook;
GtkWidget *tree;
@@ -702,8 +692,8 @@
column);
gtk_tree_view_column_set_resizable (column, FALSE);
-
scroll = gtk_scrolled_window_new (NULL, NULL);
+ gtk_widget_show (scroll);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroll),
GTK_SHADOW_IN);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
@@ -714,6 +704,7 @@
gtk_notebook_append_page (GTK_NOTEBOOK (obj->priv->notebook),
scroll,
NULL);
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (obj->priv->notebook), 0);
/* dnd */
gtk_tree_view_enable_model_drag_dest (GTK_TREE_VIEW (obj->priv->tree),
@@ -779,8 +770,12 @@
static void
brasero_audio_disc_reset_real (BraseroAudioDisc *disc)
{
- if (disc->priv->vfs)
- brasero_vfs_cancel (disc->priv->vfs, G_OBJECT (disc));
+ if (disc->priv->io) {
+ brasero_io_cancel_by_base (disc->priv->io, disc->priv->attr_changed);
+ brasero_io_cancel_by_base (disc->priv->io, disc->priv->add_dir);
+ brasero_io_cancel_by_base (disc->priv->io, disc->priv->add_uri);
+ brasero_io_cancel_by_base (disc->priv->io, disc->priv->add_playlist);
+ }
#ifdef BUILD_INOTIFY
@@ -837,10 +832,22 @@
#endif
- if (cobj->priv->vfs) {
- brasero_vfs_cancel (cobj->priv->vfs, G_OBJECT (cobj));
- g_object_unref (cobj->priv->vfs);
- cobj->priv->vfs = NULL;
+ if (cobj->priv->io) {
+ brasero_io_cancel_by_base (cobj->priv->io, cobj->priv->attr_changed);
+ brasero_io_cancel_by_base (cobj->priv->io, cobj->priv->add_dir);
+ brasero_io_cancel_by_base (cobj->priv->io, cobj->priv->add_uri);
+ brasero_io_cancel_by_base (cobj->priv->io, cobj->priv->add_playlist);
+ g_free (cobj->priv->attr_changed);
+ g_free (cobj->priv->add_dir);
+ g_free (cobj->priv->add_uri);
+ g_free (cobj->priv->add_playlist);
+ cobj->priv->attr_changed = NULL;
+ cobj->priv->add_dir = NULL;
+ cobj->priv->add_uri = NULL;
+ cobj->priv->add_playlist = NULL;
+
+ g_object_unref (cobj->priv->io);
+ cobj->priv->io = NULL;
}
if (cobj->priv->manager) {
@@ -1110,37 +1117,68 @@
gtk_widget_destroy (dialog);
}
+static gchar *
+brasero_audio_disc_validate_utf8_name (const gchar *name)
+{
+ gchar *retval, *ptr;
+ const gchar *invalid;
+
+ if (!name)
+ return NULL;
+
+ if (g_utf8_validate (name, -1, &invalid))
+ return g_markup_escape_text (name, -1);
+
+ retval = g_strdup (name);
+ ptr = retval + (invalid - name);
+ *ptr = '_';
+ ptr++;
+
+ while (!g_utf8_validate (ptr, -1, &invalid)) {
+ ptr = (gchar*) invalid;
+ *ptr = '?';
+ ptr ++;
+ }
+
+ ptr = retval;
+ retval = g_markup_escape_text (retval, -1);
+ g_free (ptr);
+
+ return retval;
+}
+
static gboolean
brasero_audio_disc_set_row_from_metadata (BraseroAudioDisc *disc,
GtkTreeModel *model,
GtkTreeIter *iter,
- const BraseroMetadataInfo *metadata)
+ GFileInfo *info)
{
+ const gchar * const *icon_string = NULL;
gint64 current_length;
GtkTreeIter gap_iter;
- gchar *icon_string;
+ GIcon *icon;
gint64 start;
gint64 end;
- icon_string = gnome_icon_lookup (gtk_icon_theme_get_default (), NULL,
- NULL, NULL, NULL, metadata->type,
- GNOME_ICON_LOOKUP_FLAGS_NONE, NULL);
+ icon = g_content_type_get_icon (g_file_info_get_content_type (info));
+ if (G_IS_THEMED_ICON (icon))
+ icon_string = g_themed_icon_get_names (G_THEMED_ICON (icon));
- /* make sure there is a length and it's not be over the real one */
+ /* make sure there is a length and it's not over the real one */
gtk_tree_model_get (model, iter,
START_COL, &start,
END_COL, &end,
-1);
current_length = BRASERO_AUDIO_TRACK_LENGTH (start, end);
- if (end > metadata->len) {
- end = metadata->len;
+ if (end > g_file_info_get_attribute_uint64 (info, BRASERO_IO_LEN)) {
+ end = g_file_info_get_attribute_uint64 (info, BRASERO_IO_LEN);
gtk_list_store_set (GTK_LIST_STORE (model), iter,
END_COL, (gint64) end,
-1);
}
else if (!end) {
- end = metadata->len;
+ end = g_file_info_get_attribute_uint64 (info, BRASERO_IO_LEN);
gtk_list_store_set (GTK_LIST_STORE (model), iter,
END_COL, (gint64) end,
-1);
@@ -1192,19 +1230,18 @@
}
gtk_list_store_set (GTK_LIST_STORE (model), iter,
- ICON_COL, icon_string,
- LENGTH_COL, metadata->len,
- ARTIST_COL, metadata->artist,
- COMPOSER_COL, metadata->composer,
- ISRC_COL, metadata->isrc,
+ ICON_COL, icon_string?icon_string [0]:NULL,
+ LENGTH_COL, g_file_info_get_attribute_uint64 (info, BRASERO_IO_LEN),
+ ARTIST_COL, g_file_info_get_attribute_string (info, BRASERO_IO_ARTIST),
+ COMPOSER_COL, g_file_info_get_attribute_string (info, BRASERO_IO_COMPOSER),
+ ISRC_COL, g_file_info_get_attribute_int32 (info, BRASERO_IO_ISRC),
SONG_COL, TRUE,
-1);
- g_free (icon_string);
- if (metadata->title) {
+ if (g_file_info_get_attribute_string (info, BRASERO_IO_TITLE)) {
gchar *name;
- name = g_markup_escape_text (metadata->title, -1);
+ name = brasero_audio_disc_validate_utf8_name (g_file_info_get_attribute_string (info, BRASERO_IO_TITLE));
gtk_list_store_set (GTK_LIST_STORE (model), iter,
NAME_COL, name,
-1);
@@ -1257,12 +1294,10 @@
}
static void
-brasero_audio_disc_result (BraseroVFS *vfs,
- GObject *obj,
- GnomeVFSResult result,
+brasero_audio_disc_result (GObject *obj,
+ GError *error,
const gchar *uri,
- GnomeVFSFileInfo *info,
- BraseroMetadataInfo *metadata,
+ GFileInfo *info,
gpointer null_data)
{
gchar *name;
@@ -1272,24 +1307,26 @@
gchar *escaped_name;
BraseroAudioDisc *disc = BRASERO_AUDIO_DISC (obj);
- if (result != GNOME_VFS_OK)
+ if (error)
return;
/* we silently ignore the title and any error */
- if (!metadata)
+ if (g_file_info_get_attribute_string (info, BRASERO_IO_PLAYLIST_TITLE))
return;
- if (!metadata->has_audio)
+ if (!g_file_info_get_attribute_boolean (info, BRASERO_IO_HAS_AUDIO))
return;
model = gtk_tree_view_get_model (GTK_TREE_VIEW (disc->priv->tree));
gtk_list_store_append (GTK_LIST_STORE (model), &iter);
escaped_name = g_path_get_basename (uri);
- name = gnome_vfs_unescape_string_for_display (escaped_name);
+ name = g_uri_unescape_string (escaped_name, NULL);
g_free (escaped_name);
- markup = g_markup_escape_text (name, -1);
+ markup = brasero_audio_disc_validate_utf8_name (name);
+ g_free (name);
+
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
NAME_COL, markup,
URI_COL, uri,
@@ -1299,7 +1336,7 @@
if (!brasero_audio_disc_set_row_from_metadata (disc,
model,
&iter,
- metadata))
+ info))
return;
brasero_audio_disc_add_file (disc, uri);
@@ -1307,8 +1344,8 @@
static void
brasero_audio_disc_vfs_operation_finished (GObject *object,
- gpointer null_data,
- gboolean cancelled)
+ gboolean cancelled,
+ gpointer null_data)
{
BraseroAudioDisc *disc = BRASERO_AUDIO_DISC (object);
@@ -1320,35 +1357,30 @@
/*********************** directories exploration *******************************/
static BraseroDiscResult
-brasero_audio_disc_visit_dir_async (BraseroAudioDisc *disc, const gchar *uri)
+brasero_audio_disc_visit_dir_async (BraseroAudioDisc *disc,
+ const gchar *uri)
{
- GList *uris;
gboolean result;
- uris = g_list_prepend (NULL, (gchar*) uri);
-
- if (!disc->priv->vfs)
- disc->priv->vfs = brasero_vfs_get_default ();
+ if (!disc->priv->io)
+ disc->priv->io = brasero_io_get_default ();
if (!disc->priv->add_dir)
- disc->priv->add_dir = brasero_vfs_register_data_type (disc->priv->vfs,
- G_OBJECT (disc),
- G_CALLBACK (brasero_audio_disc_result),
- brasero_audio_disc_vfs_operation_finished);
+ disc->priv->add_dir = brasero_io_register (G_OBJECT (disc),
+ brasero_audio_disc_result,
+ brasero_audio_disc_vfs_operation_finished,
+ NULL);
brasero_audio_disc_increase_activity_counter (disc);
- result = brasero_vfs_get_metadata (disc->priv->vfs,
- uris,
- GNOME_VFS_FILE_INFO_FOLLOW_LINKS |
- GNOME_VFS_FILE_INFO_GET_ACCESS_RIGHTS |
- GNOME_VFS_FILE_INFO_GET_MIME_TYPE |
- GNOME_VFS_FILE_INFO_FORCE_SLOW_MIME_TYPE,
- BRASERO_METADATA_FLAG_NONE,
- TRUE,
- disc->priv->add_dir,
- NULL);
- g_list_free (uris);
+ brasero_io_load_directory (disc->priv->io,
+ uri,
+ disc->priv->add_dir,
+ BRASERO_IO_INFO_MIME|
+ BRASERO_IO_INFO_PERM|
+ BRASERO_IO_INFO_METADATA|
+ BRASERO_IO_INFO_RECURSIVE,
+ NULL);
return result;
}
@@ -1395,24 +1427,25 @@
brasero_audio_disc_add_playlist (BraseroAudioDisc *disc,
const gchar *uri)
{
- if (!disc->priv->vfs)
- disc->priv->vfs = brasero_vfs_get_default ();
+ if (!disc->priv->io)
+ disc->priv->io = brasero_io_get_default ();
if (!disc->priv->add_playlist)
- disc->priv->add_playlist = brasero_vfs_register_data_type (disc->priv->vfs,
- G_OBJECT (disc),
- G_CALLBACK (brasero_audio_disc_result),
- brasero_audio_disc_vfs_operation_finished);
+ disc->priv->add_playlist = brasero_io_register (G_OBJECT (disc),
+ brasero_audio_disc_result,
+ brasero_audio_disc_vfs_operation_finished,
+ NULL);
brasero_audio_disc_increase_activity_counter (disc);
- return brasero_vfs_parse_playlist (disc->priv->vfs,
- uri,
- GNOME_VFS_FILE_INFO_FOLLOW_LINKS |
- GNOME_VFS_FILE_INFO_GET_ACCESS_RIGHTS |
- GNOME_VFS_FILE_INFO_GET_MIME_TYPE |
- GNOME_VFS_FILE_INFO_FORCE_SLOW_MIME_TYPE,
- disc->priv->add_playlist,
- NULL);
+ brasero_io_parse_playlist (disc->priv->io,
+ uri,
+ disc->priv->add_playlist,
+ BRASERO_IO_INFO_PERM|
+ BRASERO_IO_INFO_MIME|
+ BRASERO_IO_INFO_METADATA,
+ NULL);
+
+ return BRASERO_DISC_OK;
}
#endif
@@ -1420,8 +1453,8 @@
/**************************** New Row ******************************************/
static void
brasero_audio_disc_unreadable_dialog (BraseroAudioDisc *disc,
- const char *uri,
- GnomeVFSResult result)
+ const gchar *uri,
+ GError *error)
{
GtkWidget *dialog, *toplevel;
gchar *name;
@@ -1430,7 +1463,7 @@
if (toplevel == NULL) {
g_warning ("Can't open file %s : %s\n",
uri,
- gnome_vfs_result_to_string (result));
+ error->message);
return;
}
@@ -1448,22 +1481,21 @@
gtk_window_set_title (GTK_WINDOW (dialog), _("Unreadable file"));
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
- gnome_vfs_result_to_string (result));
+ error->message);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
}
static void
-brasero_audio_disc_new_row_cb (BraseroVFS *vfs,
- GObject *obj,
- GnomeVFSResult result,
+brasero_audio_disc_new_row_cb (GObject *obj,
+ GError *error,
const gchar *uri,
- const GnomeVFSFileInfo *info,
- const BraseroMetadataInfo *metadata,
+ GFileInfo *info,
gpointer user_data)
{
GtkTreeIter iter;
+ const gchar *mime;
GtkTreeModel *model;
GtkTreeIter gap_iter;
GtkTreePath *treepath;
@@ -1479,10 +1511,10 @@
gtk_tree_model_get_iter (model, &iter, treepath);
gtk_tree_path_free (treepath);
- if (result != GNOME_VFS_OK) {
+ if (error) {
brasero_audio_disc_unreadable_dialog (disc,
uri,
- result);
+ error);
if (brasero_audio_disc_has_gap (disc, &iter, &gap_iter))
brasero_audio_disc_add_gap (disc, &gap_iter, 0);
@@ -1491,7 +1523,7 @@
return;
}
- if (info->type == GNOME_VFS_FILE_TYPE_DIRECTORY) {
+ if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY) {
if (brasero_audio_disc_has_gap (disc, &iter, &gap_iter))
brasero_audio_disc_add_gap (disc, &gap_iter, 0);
@@ -1503,11 +1535,12 @@
#if BUILD_PLAYLIST
/* see if it a playlist */
- if (info->type == GNOME_VFS_FILE_TYPE_REGULAR
- && (!strcmp (info->mime_type, "audio/x-scpls")
- || !strcmp (info->mime_type, "audio/x-ms-asx")
- || !strcmp (info->mime_type, "audio/x-mp3-playlist")
- || !strcmp (info->mime_type, "audio/x-mpegurl"))) {
+ mime = g_file_info_get_content_type (info);
+ if (g_file_info_get_file_type (info) == G_FILE_TYPE_REGULAR
+ && (!strcmp (mime, "audio/x-scpls")
+ || !strcmp (mime, "audio/x-ms-asx")
+ || !strcmp (mime, "audio/x-mp3-playlist")
+ || !strcmp (mime, "audio/x-mpegurl"))) {
/* This is a supported playlist */
if (brasero_audio_disc_has_gap (disc, &iter, &gap_iter))
brasero_audio_disc_add_gap (disc, &gap_iter, 0);
@@ -1519,10 +1552,9 @@
#endif
- if (info->type != GNOME_VFS_FILE_TYPE_REGULAR
- || !metadata
- || !metadata->has_audio
- || metadata->has_video) {
+ if (g_file_info_get_file_type (info) != G_FILE_TYPE_REGULAR
+ || !g_file_info_get_attribute_boolean (info, BRASERO_IO_HAS_AUDIO)
+ || g_file_info_get_attribute_boolean (info, BRASERO_IO_HAS_VIDEO)) {
if (brasero_audio_disc_has_gap (disc, &iter, &gap_iter))
brasero_audio_disc_add_gap (disc, &gap_iter, 0);
@@ -1531,8 +1563,8 @@
return;
}
- if (GNOME_VFS_FILE_INFO_SYMLINK (info)) {
- uri = g_strconcat ("file://", info->symlink_name, NULL);
+ if (g_file_info_get_is_symlink (info)) {
+ uri = g_strconcat ("file://", g_file_info_get_symlink_target (info), NULL);
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
URI_COL, uri, -1);
}
@@ -1540,7 +1572,7 @@
if (!brasero_audio_disc_set_row_from_metadata (disc,
model,
&iter,
- metadata))
+ info))
return;
brasero_audio_disc_add_file (disc, uri);
@@ -1559,10 +1591,8 @@
GtkTreePath *treepath;
GtkTreeModel *store;
GtkTreeIter iter;
- gboolean success;
gchar *markup;
gchar *name;
- GList *uris;
g_return_val_if_fail (uri != NULL, BRASERO_DISC_ERROR_UNKNOWN);
@@ -1627,32 +1657,24 @@
gtk_tree_path_free (treepath);
/* get info async for the file */
- if (!disc->priv->vfs)
- disc->priv->vfs = brasero_vfs_get_default ();
+ if (!disc->priv->io)
+ disc->priv->io = brasero_io_get_default ();
if (!disc->priv->add_uri)
- disc->priv->add_uri = brasero_vfs_register_data_type (disc->priv->vfs,
- G_OBJECT (disc),
- G_CALLBACK (brasero_audio_disc_new_row_cb),
- brasero_audio_disc_vfs_operation_finished);
+ disc->priv->add_uri = brasero_io_register (G_OBJECT (disc),
+ brasero_audio_disc_new_row_cb,
+ brasero_audio_disc_vfs_operation_finished,
+ NULL);
/* FIXME: if cancelled ref won't be destroyed ?
* no, since the callback is always called even if there is an error */
- uris = g_list_prepend (NULL, (gchar *) uri);
brasero_audio_disc_increase_activity_counter (disc);
- success = brasero_vfs_get_metadata (disc->priv->vfs,
- uris,
- GNOME_VFS_FILE_INFO_GET_ACCESS_RIGHTS |
- GNOME_VFS_FILE_INFO_FOLLOW_LINKS|
- GNOME_VFS_FILE_INFO_GET_MIME_TYPE|
- GNOME_VFS_FILE_INFO_FORCE_SLOW_MIME_TYPE,
- BRASERO_METADATA_FLAG_NONE,
- FALSE,
- disc->priv->add_uri,
- ref);
- g_list_free (uris);
-
- if (!success)
- return BRASERO_DISC_ERROR_THREAD;
+ brasero_io_get_file_info (disc->priv->io,
+ uri,
+ disc->priv->add_uri,
+ BRASERO_IO_INFO_PERM|
+ BRASERO_IO_INFO_MIME|
+ BRASERO_IO_INFO_METADATA,
+ ref);
return BRASERO_DISC_OK;
}
@@ -2963,13 +2985,18 @@
{
gchar **array;
gchar **item;
- gchar *uri;
array = g_strsplit_set (text, "\n\r", 0);
item = array;
while (*item) {
if (**item != '\0') {
- uri = gnome_vfs_make_uri_from_input (*item);
+ GFile *file;
+ gchar *uri;
+
+ file = g_file_new_for_commandline_arg (*item);
+ uri = g_file_get_uri (file);
+ g_object_unref (file);
+
brasero_audio_disc_add_uri_real (disc,
uri,
-1,
@@ -3269,7 +3296,7 @@
IN_MOVE_SELF |
IN_UNMOUNT;
- path = gnome_vfs_get_local_path_from_uri (parent);
+ path = g_filename_from_uri (parent, NULL, NULL);
wd = inotify_add_watch (dev_fd, path, mask);
if (wd == -1) {
g_warning ("ERROR creating watch for local file %s : %s\n",
@@ -3489,11 +3516,20 @@
{
GSList *list, *list_iter;
GtkTreeModel *model;
+ GFileInfo *info;
list = brasero_audio_disc_inotify_find_rows (disc, uri);
if (!list)
return;
+ info = g_file_info_new ();
+ g_file_info_set_attribute_uint64 (info, BRASERO_IO_LEN, metadata->len);
+ g_file_info_set_attribute_string (info, BRASERO_IO_ARTIST, metadata->artist);
+ g_file_info_set_attribute_string (info, BRASERO_IO_TITLE, metadata->title);
+ g_file_info_set_attribute_int32 (info, BRASERO_IO_ISRC, metadata->isrc);
+ g_file_info_set_attribute_string (info, BRASERO_IO_COMPOSER, metadata->composer);
+ g_file_info_set_attribute_boolean (info, BRASERO_IO_HAS_AUDIO, metadata->has_audio);
+
model = gtk_tree_view_get_model (GTK_TREE_VIEW (disc->priv->tree));
for (list_iter = list; list_iter; list_iter = list_iter->next) {
GtkTreePath *treepath;
@@ -3505,9 +3541,11 @@
brasero_audio_disc_set_row_from_metadata (disc,
model,
&iter,
- metadata);
+ info);
}
+ g_object_unref (info);
+
g_slist_foreach (list, (GFunc) gtk_tree_path_free, NULL);
g_slist_free (list);
}
@@ -3630,27 +3668,18 @@
}
static void
-brasero_audio_disc_inotify_attributes_changed_cb (BraseroVFS *vfs,
- GObject *obj,
- GnomeVFSResult result,
+brasero_audio_disc_inotify_attributes_changed_cb (GObject *obj,
+ GError *error,
const gchar *uri,
- const GnomeVFSFileInfo *info,
+ GFileInfo *info,
gpointer null_data)
{
gboolean readable;
BraseroAudioDisc *disc = BRASERO_AUDIO_DISC (obj);
- if (result != GNOME_VFS_OK)
+ if (error)
readable = FALSE;
- else if (!GNOME_VFS_FILE_INFO_LOCAL (info))
- readable = TRUE;
- else if (getuid () == info->uid
- && (info->permissions & GNOME_VFS_PERM_USER_READ))
- readable = TRUE;
- else if (getgid () == info->gid
- && (info->permissions & GNOME_VFS_PERM_GROUP_READ))
- readable = TRUE;
- else if (info->permissions & GNOME_VFS_PERM_OTHER_READ)
+ else if (g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_READ))
readable = TRUE;
else
readable = FALSE;
@@ -3663,31 +3692,22 @@
brasero_audio_disc_inotify_attributes_changed (BraseroAudioDisc *disc,
const gchar *uri)
{
- gboolean result;
- GList *uris;
-
- if (!disc->priv->vfs)
- disc->priv->vfs = brasero_vfs_get_default ();
+ if (!disc->priv->io)
+ disc->priv->io = brasero_io_get_default ();
if (!disc->priv->attr_changed)
- disc->priv->attr_changed = brasero_vfs_register_data_type (disc->priv->vfs,
- G_OBJECT (disc),
- G_CALLBACK (brasero_audio_disc_inotify_attributes_changed_cb),
- brasero_audio_disc_vfs_operation_finished);
+ disc->priv->attr_changed = brasero_io_register (G_OBJECT (disc),
+ brasero_audio_disc_inotify_attributes_changed_cb,
+ brasero_audio_disc_vfs_operation_finished,
+ NULL);
brasero_audio_disc_increase_activity_counter (disc);
-
- uris = g_list_prepend (NULL, (gchar *) uri);
- result = brasero_vfs_get_info (disc->priv->vfs,
- uris,
- FALSE,
- GNOME_VFS_FILE_INFO_GET_ACCESS_RIGHTS |
- GNOME_VFS_FILE_INFO_FOLLOW_LINKS,
- disc->priv->attr_changed,
- NULL);
- g_list_free (uris);
-
- return result;
+ brasero_io_get_file_info (disc->priv->io,
+ uri,
+ disc->priv->attr_changed,
+ BRASERO_IO_INFO_PERM,
+ NULL);
+ return TRUE;
}
static gboolean
@@ -3835,6 +3855,7 @@
continue;
}
+ /* FIXME: we should remove the row if it hasn't audio */
brasero_metadata_set_info (metadata, &info);
brasero_audio_disc_inotify_modify (disc,
monitored,
Modified: trunk/src/brasero-data-disc.c
==============================================================================
--- trunk/src/brasero-data-disc.c (original)
+++ trunk/src/brasero-data-disc.c Mon Feb 25 14:12:43 2008
@@ -501,8 +501,12 @@
while (*item) {
if (**item != '\0') {
gchar *uri;
+ GFile *file;
+
+ file = g_file_new_for_commandline_arg (*item);
+ uri = g_file_get_uri (file);
+ g_object_unref (file);
- uri = gnome_vfs_make_uri_from_input (*item);
brasero_data_project_add_loading_node (priv->project,
uri,
parent);
@@ -814,7 +818,7 @@
static void
brasero_data_disc_unreadable_uri_cb (BraseroDataVFS *vfs,
- GnomeVFSResult result,
+ const GError *error,
const gchar *uri,
BraseroDataDisc *self)
{
@@ -827,11 +831,8 @@
name = brasero_file_node_get_uri_name (uri);
if (priv->loading) {
- gchar *message;
-
- message = g_strdup_printf (_("\"%s\" cannot be found."), name);
- priv->load_errors = g_slist_prepend (priv->load_errors, message);
- g_free (name);
+ priv->load_errors = g_slist_prepend (priv->load_errors,
+ g_strdup (error->message));
return;
}
@@ -849,7 +850,7 @@
gtk_window_set_title (GTK_WINDOW (dialog), _("Unreadable file"));
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
"%s.",
- gnome_vfs_result_to_string (result));
+ error->message);
gtk_widget_show_all (dialog);
gtk_dialog_run (GTK_DIALOG (dialog));
Modified: trunk/src/brasero-data-project.c
==============================================================================
--- trunk/src/brasero-data-project.c (original)
+++ trunk/src/brasero-data-project.c Mon Feb 25 14:12:43 2008
@@ -34,7 +34,7 @@
#include <glib.h>
#include <glib/gi18n-lib.h>
-#include <libgnomevfs/gnome-vfs.h>
+#include <gio/gio.h>
#include "brasero-data-project.h"
#include "brasero-marshal.h"
@@ -537,7 +537,7 @@
g_free (parent);
/* unescape URI */
- path = gnome_vfs_unescape_string_for_display (uri);
+ path = g_uri_unescape_string (uri, NULL);
for (iter = graft->nodes; iter; iter = iter->next) {
BraseroFileNode *node;
@@ -726,7 +726,7 @@
/* get the URI name and parent. NOTE: name is unescaped to fit
* the names of nodes that are meant for display and therefore
* also unescaped. It's not necessary for parent URI. */
- unescaped = gnome_vfs_unescape_string_for_display (uri);
+ unescaped = g_uri_unescape_string (uri, NULL);
name = g_path_get_basename (unescaped);
g_free (unescaped);
@@ -1584,13 +1584,16 @@
brasero_data_project_node_loaded (BraseroDataProject *self,
BraseroFileNode *node,
const gchar *uri,
- GnomeVFSFileInfo *info)
+ GFileInfo *info)
{
+ guint64 size;
+ GFileType type;
gboolean size_changed;
BraseroDataProjectPrivate *priv;
priv = BRASERO_DATA_PROJECT_PRIVATE (self);
+ type = g_file_info_get_file_type (info);
if (node->is_tmp_parent) {
priv->loading --;
g_signal_emit (self,
@@ -1599,7 +1602,7 @@
priv->loading);
/* we must make sure that this is really a directory */
- if (info->type != GNOME_VFS_FILE_TYPE_DIRECTORY) {
+ if (type != G_FILE_TYPE_DIRECTORY) {
BraseroURINode *graft;
/* it isn't a directory so it won't be loaded but turned
@@ -1634,7 +1637,7 @@
}
else if (priv->loading && node->is_grafted) {
priv->loading --;
- if (info->type != GNOME_VFS_FILE_TYPE_DIRECTORY) {
+ if (type != G_FILE_TYPE_DIRECTORY) {
/* no need to load its contents since it's not a folder */
priv->loading --;
}
@@ -1645,10 +1648,11 @@
priv->loading);
}
- if (info->type != GNOME_VFS_FILE_TYPE_DIRECTORY) {
- if (BRASERO_SIZE_TO_SECTORS (info->size, 2048) > BRASERO_FILE_2G_LIMIT
+ size = g_file_info_get_size (info);
+ if (type != G_FILE_TYPE_DIRECTORY) {
+ if (BRASERO_SIZE_TO_SECTORS (size, 2048) > BRASERO_FILE_2G_LIMIT
&& BRASERO_FILE_NODE_SECTORS (node) < BRASERO_FILE_2G_LIMIT) {
- if (brasero_data_project_file_signal (self, G2_FILE_SIGNAL, info->name)) {
+ if (brasero_data_project_file_signal (self, G2_FILE_SIGNAL, g_file_info_get_name (info))) {
brasero_data_project_remove_node (self, node);
return;
}
@@ -1657,12 +1661,12 @@
/* avoid signalling twice for the same directory */
else if (!node->is_file
&& brasero_file_node_get_depth (node) == 6
- && brasero_data_project_file_signal (self, DEEP_DIRECTORY_SIGNAL, info->name)) {
+ && brasero_data_project_file_signal (self, DEEP_DIRECTORY_SIGNAL, g_file_info_get_name (info))) {
brasero_data_project_remove_node (self, node);
return;
}
- size_changed = (BRASERO_SIZE_TO_SECTORS (info->size, 2048) != BRASERO_FILE_NODE_SECTORS (node));
+ size_changed = (BRASERO_SIZE_TO_SECTORS (size, 2048) != BRASERO_FILE_NODE_SECTORS (node));
brasero_file_node_set_from_info (node, info);
/* Check it that needs a graft: this node has not been moved so we don't
@@ -1678,7 +1682,7 @@
g_free (uri);
/* NOTE: info has the uri for the target of the symlink */
- graft = brasero_data_project_uri_ensure_graft (self, info->symlink_name);
+ graft = brasero_data_project_uri_ensure_graft (self, g_file_info_get_symlink_target (info));
brasero_file_node_graft (node, graft);
}
@@ -1713,10 +1717,12 @@
brasero_data_project_node_reloaded (BraseroDataProject *self,
BraseroFileNode *node,
const gchar *uri,
- GnomeVFSFileInfo *info)
+ GFileInfo *info)
{
BraseroDataProjectPrivate *priv;
gboolean size_changed;
+ const gchar *name;
+ guint64 size;
priv = BRASERO_DATA_PROJECT_PRIVATE (self);
@@ -1725,18 +1731,20 @@
/* the only thing that can have changed here is size. Readability was
* checked in data-vfs.c. That's why we're only interested in files
* since directories don't have size. */
- if (info->type == GNOME_VFS_FILE_TYPE_DIRECTORY)
+ if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY)
return;
- if (BRASERO_SIZE_TO_SECTORS (info->size, 2048) > BRASERO_FILE_2G_LIMIT
+ size = g_file_info_get_size (info);
+ name = g_file_info_get_name (info);
+ if (BRASERO_SIZE_TO_SECTORS (size, 2048) > BRASERO_FILE_2G_LIMIT
&& BRASERO_FILE_NODE_SECTORS (node) < BRASERO_FILE_2G_LIMIT) {
- if (brasero_data_project_file_signal (self, G2_FILE_SIGNAL, info->name)) {
+ if (brasero_data_project_file_signal (self, G2_FILE_SIGNAL, name)) {
brasero_data_project_remove_node (self, node);
return;
}
}
- size_changed = (BRASERO_SIZE_TO_SECTORS (info->size, 2048) == BRASERO_FILE_NODE_SECTORS (node));
+ size_changed = (BRASERO_SIZE_TO_SECTORS (size, 2048) == BRASERO_FILE_NODE_SECTORS (node));
if (BRASERO_FILE_NODE_MIME (node) && !size_changed)
return;
@@ -1831,9 +1839,11 @@
BraseroFileNode *
brasero_data_project_add_node_from_info (BraseroDataProject *self,
const gchar *uri,
- GnomeVFSFileInfo *info,
+ GFileInfo *info,
BraseroFileNode *parent)
{
+ GFileType type;
+ const gchar *name;
BraseroFileNode *node;
BraseroURINode *graft;
BraseroDataProjectPrivate *priv;
@@ -1875,7 +1885,8 @@
parent = priv->root;
/* make sure that name doesn't exist */
- node = brasero_file_node_check_name_existence (parent, info->name);
+ name = g_file_info_get_name (info);
+ node = brasero_file_node_check_name_existence (parent, name);
if (node) {
if (brasero_data_project_file_signal (self, NAME_COLLISION_SIGNAL, BRASERO_FILE_NODE_NAME (node)))
return NULL;
@@ -1887,13 +1898,17 @@
graft = g_hash_table_lookup (priv->grafts, uri);
}
- if (info->type != GNOME_VFS_FILE_TYPE_DIRECTORY) {
- if (BRASERO_SIZE_TO_SECTORS (info->size, 2048) > BRASERO_FILE_2G_LIMIT)
- if (brasero_data_project_file_signal (self, G2_FILE_SIGNAL, info->name))
+ type = g_file_info_get_file_type (info);
+ if (type != G_FILE_TYPE_DIRECTORY) {
+ guint64 size;
+
+ size = g_file_info_get_size (info);
+ if (BRASERO_SIZE_TO_SECTORS (size, 2048) > BRASERO_FILE_2G_LIMIT)
+ if (brasero_data_project_file_signal (self, G2_FILE_SIGNAL, name))
return NULL;
}
else if (!brasero_file_node_get_depth (parent) == 5) {
- if (brasero_data_project_file_signal (self, DEEP_DIRECTORY_SIGNAL, info->name))
+ if (brasero_data_project_file_signal (self, DEEP_DIRECTORY_SIGNAL, name))
return NULL;
}
@@ -1907,12 +1922,15 @@
g_free (symlink_uri);
/* then we add the node */
- brasero_data_project_add_node_real (self, node, graft, info->symlink_name);
+ brasero_data_project_add_node_real (self,
+ node,
+ graft,
+ g_file_info_get_symlink_target (info));
}
else
brasero_data_project_add_node_real (self, node, graft, uri);
- if (info->type != GNOME_VFS_FILE_TYPE_DIRECTORY)
+ if (type != G_FILE_TYPE_DIRECTORY)
g_signal_emit (self,
brasero_data_project_signals [SIZE_CHANGED_SIGNAL],
0);
@@ -2542,9 +2560,9 @@
return folders;
/* Create the paths starting from these nodes */
- unescaped_uri = gnome_vfs_unescape_string_for_display (uri);
+ unescaped_uri = g_uri_unescape_string (uri, NULL);
- parent_uri = gnome_vfs_unescape_string_for_display (graft->uri);
+ parent_uri = g_uri_unescape_string (graft->uri, NULL);
parent_uri_len = strlen (parent_uri);
g_free (parent_uri);
@@ -2888,7 +2906,7 @@
/* get the new URI */
parent_uri = brasero_data_project_node_to_uri (BRASERO_DATA_PROJECT (monitor), parent);
- escaped_name = gnome_vfs_escape_path_string (name);
+ escaped_name = g_uri_escape_string (name, NULL, TRUE);
uri = g_strconcat (parent_uri, G_DIR_SEPARATOR_S, escaped_name, NULL);
g_free (escaped_name);
g_free (parent_uri);
@@ -2926,7 +2944,7 @@
uri_node = graft->node;
/* get the new uri */
- escaped_name = gnome_vfs_escape_path_string (name);
+ escaped_name = g_uri_escape_string (name, NULL, TRUE);
uri = g_build_path (G_DIR_SEPARATOR_S, parent_uri, escaped_name, NULL);
g_free (escaped_name);
@@ -3002,7 +3020,7 @@
parent = g_path_get_dirname (uri);
g_free (uri);
- escaped_name = gnome_vfs_escape_path_string (real_name);
+ escaped_name = g_uri_escape_string (real_name, NULL, TRUE);
uri = g_strconcat (parent, G_DIR_SEPARATOR_S, escaped_name, NULL);
g_free (escaped_name);
g_free (parent);
Modified: trunk/src/brasero-data-project.h
==============================================================================
--- trunk/src/brasero-data-project.h (original)
+++ trunk/src/brasero-data-project.h Mon Feb 25 14:12:43 2008
@@ -30,6 +30,8 @@
#define _BRASERO_DATA_PROJECT_H_
#include <glib-object.h>
+#include <gio/gio.h>
+
#include <gtk/gtk.h>
#include "brasero-file-node.h"
@@ -131,7 +133,7 @@
BraseroFileNode *
brasero_data_project_add_node_from_info (BraseroDataProject *project,
const gchar *uri,
- GnomeVFSFileInfo *info,
+ GFileInfo *info,
BraseroFileNode *parent);
BraseroFileNode *
brasero_data_project_add_empty_directory (BraseroDataProject *project,
@@ -153,12 +155,12 @@
brasero_data_project_node_loaded (BraseroDataProject *project,
BraseroFileNode *node,
const gchar *uri,
- GnomeVFSFileInfo *info);
+ GFileInfo *info);
void
brasero_data_project_node_reloaded (BraseroDataProject *project,
BraseroFileNode *node,
const gchar *uri,
- GnomeVFSFileInfo *info);
+ GFileInfo *info);
void
brasero_data_project_directory_node_loaded (BraseroDataProject *self,
BraseroFileNode *parent);
Modified: trunk/src/brasero-data-tree-model.c
==============================================================================
--- trunk/src/brasero-data-tree-model.c (original)
+++ trunk/src/brasero-data-tree-model.c Mon Feb 25 14:12:43 2008
@@ -34,10 +34,6 @@
#include <gtk/gtktreesortable.h>
#include <gtk/gtkicontheme.h>
-#include <libgnomeui/libgnomeui.h>
-
-#include <libgnomevfs/gnome-vfs-mime-handlers.h>
-
#include "burn-basics.h"
#include "brasero-data-tree-model.h"
@@ -483,14 +479,24 @@
g_value_init (value, G_TYPE_STRING);
if (node->is_loading)
g_value_set_string (value, _("(loading ...)"));
- else if (!node->is_file)
- g_value_set_string (value, gnome_vfs_mime_get_description ("x-directory/normal"));
+ else if (!node->is_file) {
+ gchar *description;
+
+ description = g_content_type_get_description ("inode/directory");
+ g_value_set_string (value, description);
+ g_free (description);
+ }
else if (node->is_imported)
g_value_set_string (value, _("Disc file"));
else if (!BRASERO_FILE_NODE_MIME (node))
g_value_set_string (value, _("(loading ...)"));
- else
- g_value_set_string (value, gnome_vfs_mime_get_description (BRASERO_FILE_NODE_MIME (node)));
+ else {
+ gchar *description;
+
+ description = g_content_type_get_description (BRASERO_FILE_NODE_MIME (node));
+ g_value_set_string (value, description);
+ g_free (description);
+ }
return;
@@ -511,15 +517,19 @@
else if (node->is_imported) {
g_value_set_string (value, "media-cdrom");
}
- else {
- gchar *icon_string;
+ else if (BRASERO_FILE_NODE_MIME (node)) {
+ const gchar * const *icon_string = NULL;
+ GIcon *icon;
+
+ /* NOTE: implemented in glib 2.15.6 (not for windows though) */
+ icon = g_content_type_get_icon (BRASERO_FILE_NODE_MIME (node));
+ if (G_IS_THEMED_ICON (icon))
+ icon_string = g_themed_icon_get_names (G_THEMED_ICON (icon));
- icon_string = gnome_icon_lookup (gtk_icon_theme_get_default (), NULL,
- NULL, NULL, NULL, BRASERO_FILE_NODE_MIME (node),
- GNOME_ICON_LOOKUP_FLAGS_NONE, NULL);
- g_value_set_string (value, icon_string);
- g_free (icon_string);
+ g_value_set_string (value, icon_string?icon_string [0]:NULL);
}
+ else
+ g_value_set_string (value, "image-loading");
return;
@@ -579,7 +589,10 @@
node_size = brasero_data_project_get_folder_size (BRASERO_DATA_PROJECT (self), node);
else
node_size = BRASERO_FILE_NODE_SECTORS (node);
- g_value_set_int (value, node_size * 100 / size);
+ if (size)
+ g_value_set_int (value, node_size * 100 / size);
+ else
+ g_value_set_int (value, 0);
}
else
g_value_set_int (value, 0);
Modified: trunk/src/brasero-data-vfs.c
==============================================================================
--- trunk/src/brasero-data-vfs.c (original)
+++ trunk/src/brasero-data-vfs.c Mon Feb 25 14:12:43 2008
@@ -36,7 +36,7 @@
#include "brasero-data-vfs.h"
#include "brasero-data-project.h"
#include "brasero-file-node.h"
-#include "brasero-vfs.h"
+#include "brasero-io.h"
#include "brasero-utils.h"
#include "brasero-marshal.h"
#include "brasero-utils.h"
@@ -57,9 +57,9 @@
* the user despite the filtering rules. */
GHashTable *filtered;
- BraseroVFS *vfs;
- BraseroVFSDataID load_uri;
- BraseroVFSDataID load_contents;
+ BraseroIO *io;
+ BraseroIOJobBase *load_uri;
+ BraseroIOJobBase *load_contents;
guint filter_hidden:1;
guint filter_broken_sym:1;
@@ -174,28 +174,11 @@
return (g_hash_table_size (priv->loading) != 0);
}
-inline static gboolean
-brasero_data_vfs_is_readable (const GnomeVFSFileInfo *info)
-{
- if (!GNOME_VFS_FILE_INFO_LOCAL (info))
- return TRUE;
-
- if (getuid () == info->uid && (info->permissions & GNOME_VFS_PERM_USER_READ))
- return TRUE;
- else if (brasero_utils_is_gid_in_groups (info->gid)
- && (info->permissions & GNOME_VFS_PERM_GROUP_READ))
- return TRUE;
- else if (info->permissions & GNOME_VFS_PERM_OTHER_READ)
- return TRUE;
-
- return FALSE;
-}
-
static gboolean
brasero_data_vfs_check_uri_result (BraseroDataVFS *self,
const gchar *uri,
- GnomeVFSResult result,
- GnomeVFSFileInfo *info)
+ GError *error,
+ GFileInfo *info)
{
BraseroDataVFSPrivate *priv;
@@ -205,15 +188,15 @@
* that is if it is loading. So check the loading GHashTable to know
* that. Otherwise this URI comes from directory exploration. */
- if (result != GNOME_VFS_OK) {
- if (result == GNOME_VFS_ERROR_NOT_FOUND) {
+ if (error) {
+ if (error->domain == G_IO_ERROR && error->code == G_IO_ERROR_NOT_FOUND) {
if (g_hash_table_lookup (priv->loading, uri))
g_signal_emit (self,
brasero_data_vfs_signals [UNKNOWN_SIGNAL],
0,
uri);
}
- else if (result == GNOME_VFS_ERROR_LOOP) {
+ else if (error->domain == BRASERO_ERROR && error->code == BRASERO_ERROR_SYMLINK_LOOP) {
brasero_data_project_exclude_uri (BRASERO_DATA_PROJECT (self),
uri);
@@ -231,28 +214,34 @@
g_signal_emit (self,
brasero_data_vfs_signals [UNREADABLE_SIGNAL],
0,
- result,
+ error,
uri);
}
BRASERO_BURN_LOG ("VFS information retrieval error %s : %s\n",
uri,
- gnome_vfs_result_to_string (result));
+ error->message);
return FALSE;
}
- if ((info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS)
- && !brasero_data_vfs_is_readable (info)) {
- brasero_data_project_exclude_uri (BRASERO_DATA_PROJECT (self),
- uri);
-
- if (g_hash_table_lookup (priv->loading, uri))
+ if (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_ACCESS_CAN_READ)
+ && !g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_READ)) {
+ brasero_data_project_exclude_uri (BRASERO_DATA_PROJECT (self), uri);
+
+ if (g_hash_table_lookup (priv->loading, uri)) {
+ GError *error;
+
+ error = g_error_new (BRASERO_ERROR,
+ BRASERO_ERROR_GENERAL,
+ _("\"%s\" cannot be read"),
+ g_file_info_get_name (info));
g_signal_emit (self,
brasero_data_vfs_signals [UNREADABLE_SIGNAL],
0,
- GNOME_VFS_ERROR_ACCESS_DENIED,
+ error,
uri);
+ }
return FALSE;
}
@@ -284,8 +273,8 @@
*/
static void
brasero_data_vfs_directory_load_end (GObject *object,
- gpointer data,
- gboolean cancelled)
+ gboolean cancelled,
+ gpointer data)
{
BraseroDataVFSPrivate *priv = BRASERO_DATA_VFS_PRIVATE (object);
BraseroDataVFS *self = BRASERO_DATA_VFS (object);
@@ -325,16 +314,103 @@
}
static gboolean
-brasero_data_vfs_directory_load_result (BraseroVFS *vfs,
- GObject *owner,
- GnomeVFSResult result,
+brasero_data_vfs_directory_check_symlink_loop (BraseroDataVFS *self,
+ BraseroFileNode *parent,
+ const gchar *uri,
+ GFileInfo *info)
+{
+ BraseroDataVFSPrivate *priv;
+ const gchar *target_uri;
+ guint target_len;
+ guint uri_len;
+
+ priv = BRASERO_DATA_VFS_PRIVATE (self);
+
+ target_uri = g_file_info_get_symlink_target (info);
+ if (!target_uri)
+ return FALSE;
+
+ /* if target points to a child that's OK */
+ uri_len = strlen (uri);
+ if (!strncmp (target_uri, uri, uri_len)
+ && target_uri [uri_len] == G_DIR_SEPARATOR)
+ return FALSE;
+
+ target_len = strlen (target_uri);
+ while (parent && !parent->is_root) {
+ BraseroFileNode *next;
+ gchar *parent_uri;
+ guint parent_len;
+ gchar *next_uri;
+ guint next_len;
+
+ /* if the file is not grafted carry on */
+ if (!parent->is_grafted) {
+ parent = parent->parent;
+ continue;
+ }
+
+ /* if the file is a symlink, carry on since that's why it was
+ * grafted. It can't have been added by the user since in this
+ * case we replace the symlink by the target. */
+ if (parent->is_symlink) {
+ parent = parent->parent;
+ continue;
+ }
+
+ parent_uri = brasero_data_project_node_to_uri (BRASERO_DATA_PROJECT (self), parent);
+ parent_len = strlen (parent_uri);
+
+ /* see if target is a parent of that file */
+ if (!strncmp (target_uri, parent_uri, target_len)
+ && parent_uri [target_len] == G_DIR_SEPARATOR) {
+ g_free (parent_uri);
+ return TRUE;
+ }
+
+ /* see if the graft is also the parent of the target */
+ if (!strncmp (parent_uri, target_uri, parent_len)
+ && target_uri [parent_len] == G_DIR_SEPARATOR) {
+ g_free (parent_uri);
+ return TRUE;
+ }
+
+ /* The next graft point must be the natural parent of this one */
+ next = parent->parent;
+ if (!next || next->is_root) {
+ g_free (parent_uri);
+ break;
+ }
+
+ next_uri = brasero_data_project_node_to_uri (BRASERO_DATA_PROJECT (self), next);
+ next_len = strlen (next_uri);
+
+ if (!strncmp (next_uri, parent_uri, next_len)
+ && parent_uri [next_len] == G_DIR_SEPARATOR) {
+ /* It's not the natural parent. We're done */
+ g_free (parent_uri);
+ break;
+ }
+
+ /* retry with the next parent graft point */
+ g_free (parent_uri);
+ parent = next;
+ }
+
+ return FALSE;
+}
+
+static void
+brasero_data_vfs_directory_load_result (GObject *owner,
+ GError *error,
const gchar *uri,
- GnomeVFSFileInfo *info,
+ GFileInfo *info,
gpointer data)
{
BraseroDataVFS *self = BRASERO_DATA_VFS (owner);
BraseroDataVFSPrivate *priv;
gchar *parent_uri = data;
+ const gchar *name;
GSList *nodes;
GSList *iter;
@@ -342,14 +418,16 @@
/* check the status of the operation.
* NOTE: no need to remove the nodes. */
- if (!brasero_data_vfs_check_uri_result (self, uri, result, info))
- return TRUE;
+ if (!brasero_data_vfs_check_uri_result (self, uri, error, info))
+ return;
/* Filtering part */
+ name = g_file_info_get_name (info);
+
/* See if it's a broken symlink */
- if (info->type == GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK
- && !info->symlink_name) {
+ if (g_file_info_get_is_symlink (info)
+ && !g_file_info_get_symlink_target (info)) {
BraseroDataVFSFilterStatus status;
/* See if this file is already in filtered */
@@ -375,12 +453,12 @@
uri);
}
- return TRUE;
+ return;
}
}
/* A new hidden file ? */
- else if (info->name [0] == '.') {
+ else if (name [0] == '.') {
BraseroDataVFSFilterStatus status;
/* See if this file is already in restored */
@@ -406,7 +484,7 @@
uri);
}
- return TRUE;
+ return;
}
}
@@ -421,13 +499,23 @@
if (!parent)
continue;
+ if (g_file_info_get_is_symlink (info)) {
+ if (brasero_data_vfs_directory_check_symlink_loop (self, parent, uri, info)) {
+ brasero_data_project_exclude_uri (BRASERO_DATA_PROJECT (self), uri);
+ if (g_hash_table_lookup (priv->loading, uri))
+ g_signal_emit (self,
+ brasero_data_vfs_signals [RECURSIVE_SIGNAL],
+ 0,
+ uri);
+ return;
+ }
+ }
+
brasero_data_project_add_node_from_info (BRASERO_DATA_PROJECT (self),
uri,
info,
parent);
}
-
- return TRUE;
}
static gboolean
@@ -435,12 +523,10 @@
BraseroFileNode *node,
const gchar *uri)
{
- GnomeVFSFileInfoOptions flags;
BraseroDataVFSPrivate *priv;
gchar *registered;
guint reference;
GSList *nodes;
- gboolean res;
priv = BRASERO_DATA_VFS_PRIVATE (self);
@@ -461,25 +547,17 @@
g_slist_prepend (NULL, GINT_TO_POINTER (reference)));
if (!priv->load_contents)
- priv->load_contents = brasero_vfs_register_data_type (priv->vfs,
- G_OBJECT (self),
- G_CALLBACK (brasero_data_vfs_directory_load_result),
- brasero_data_vfs_directory_load_end);
+ priv->load_contents = brasero_io_register (G_OBJECT (self),
+ brasero_data_vfs_directory_load_result,
+ brasero_data_vfs_directory_load_end,
+ NULL);
/* no need to require mime types here as these rows won't be visible */
- flags = GNOME_VFS_FILE_INFO_GET_ACCESS_RIGHTS;
- res = brasero_vfs_load_directory (priv->vfs,
- uri,
- flags,
- priv->load_contents,
- registered);
- if (!res) {
- brasero_data_vfs_remove_from_hash (self, priv->directories, uri);
- brasero_utils_unregister_string (uri);
-
- brasero_data_project_remove_node (BRASERO_DATA_PROJECT (self), node);
- return FALSE;
- }
+ brasero_io_load_directory (priv->io,
+ uri,
+ priv->load_contents,
+ BRASERO_IO_INFO_PERM,
+ registered);
/* Only emit a signal if state changed. Some widgets need to know if
* either directories loading or uri loading state has changed to signal
@@ -498,8 +576,8 @@
*/
static void
brasero_data_vfs_loading_node_end (GObject *object,
- gpointer data,
- gboolean cancelled)
+ gboolean cancelled,
+ gpointer data)
{
BraseroDataVFSPrivate *priv = BRASERO_DATA_VFS_PRIVATE (object);
BraseroDataVFS *self = BRASERO_DATA_VFS (object);
@@ -511,8 +589,10 @@
/* Only emit a signal if state changed. Some widgets need to know if
* either directories loading or uri loading state has changed to signal
- * it even if there were some directories loading. */
- if (!g_hash_table_size (priv->loading))
+ * it even if there were some directories loading.
+ * NOTE: we only cancel when we're stopping. That's why there is no need
+ * to emit any signal in this case (cancellation). */
+ if (!g_hash_table_size (priv->loading) && !cancelled)
g_signal_emit (self,
brasero_data_vfs_signals [ACTIVITY_SIGNAL],
0,
@@ -520,11 +600,10 @@
}
static void
-brasero_data_vfs_loading_node_result (BraseroVFS *vfs,
- GObject *owner,
- GnomeVFSResult result,
+brasero_data_vfs_loading_node_result (GObject *owner,
+ GError *error,
const gchar *uri,
- GnomeVFSFileInfo *info,
+ GFileInfo *info,
gpointer NULL_data)
{
GSList *iter;
@@ -535,7 +614,7 @@
nodes = g_hash_table_lookup (priv->loading, uri);
/* check the status of the operation */
- if (!brasero_data_vfs_check_uri_result (self, uri, result, info)) {
+ if (!brasero_data_vfs_check_uri_result (self, uri, error, info)) {
/* we need to remove the loading node that is waiting */
for (iter = nodes; iter; iter = iter->next) {
BraseroFileNode *node;
@@ -594,14 +673,13 @@
static gboolean
brasero_data_vfs_load_node (BraseroDataVFS *self,
- GnomeVFSFileInfoOptions flags,
+ BraseroIOFlags flags,
guint reference,
const gchar *uri)
{
BraseroDataVFSPrivate *priv;
gchar *registered;
gboolean result;
- GList *uris;
priv = BRASERO_DATA_VFS_PRIVATE (self);
@@ -611,19 +689,16 @@
g_slist_prepend (NULL, GINT_TO_POINTER (reference)));
if (!priv->load_uri)
- priv->load_uri = brasero_vfs_register_data_type (priv->vfs,
- G_OBJECT (self),
- G_CALLBACK (brasero_data_vfs_loading_node_result),
- brasero_data_vfs_loading_node_end);
-
- uris = g_list_prepend (NULL, (gchar *) uri);
- result = brasero_vfs_get_info (priv->vfs,
- uris,
- TRUE,
- flags,
- priv->load_uri,
- registered);
- g_list_free (uris);
+ priv->load_uri = brasero_io_register (G_OBJECT (self),
+ brasero_data_vfs_loading_node_result,
+ brasero_data_vfs_loading_node_end,
+ NULL);
+
+ brasero_io_get_file_info (priv->io,
+ uri,
+ priv->load_uri,
+ flags,
+ registered);
/* Only emit a signal if state changed. Some widgets need to know if
* either directories loading or uri loading state has changed to signal
@@ -653,23 +728,23 @@
if (!node->is_reloading) {
gchar *name;
- GnomeVFSURI *vfs_uri;
+ GFile *vfs_uri;
gchar *unescaped_name;
/* g_path_get_basename is not comfortable with uri related
* to the root directory so check that before */
- vfs_uri = gnome_vfs_uri_new (uri);
- name = gnome_vfs_uri_extract_short_path_name (vfs_uri);
- gnome_vfs_uri_unref (vfs_uri);
+ vfs_uri = g_file_new_for_uri (uri);
+ name = g_file_get_basename (vfs_uri);
+ g_object_unref (vfs_uri);
- unescaped_name = gnome_vfs_unescape_string_for_display (name);
+ unescaped_name = g_uri_unescape_string (name, NULL);
g_free (name);
name = unescaped_name;
if (!name)
return TRUE;
- if (!strcmp (name, GNOME_VFS_URI_PATH_STR)) {
+ if (!strcmp (name, G_DIR_SEPARATOR_S)) {
g_free (name);
/* This is a root directory: we don't add it since a
@@ -699,9 +774,9 @@
/* loading nodes are almost always visible already so get mime type */
return brasero_data_vfs_load_node (self,
- GNOME_VFS_FILE_INFO_GET_ACCESS_RIGHTS|
- GNOME_VFS_FILE_INFO_GET_MIME_TYPE|
- GNOME_VFS_FILE_INFO_FORCE_SLOW_MIME_TYPE,
+ BRASERO_IO_INFO_PERM|
+ BRASERO_IO_INFO_MIME|
+ BRASERO_IO_INFO_CHECK_PARENT_SYMLINK,
reference,
uri);
}
@@ -718,25 +793,23 @@
static gboolean
brasero_data_vfs_require_higher_priority (BraseroDataVFS *self,
BraseroFileNode *node,
- BraseroVFS *vfs,
- guint type)
+ BraseroIO *io,
+ BraseroIOJobBase *type)
{
gchar *registered;
- gboolean result;
gchar *uri;
uri = brasero_data_project_node_to_uri (BRASERO_DATA_PROJECT (self), node);
registered = brasero_utils_register_string (uri);
g_free (uri);
- result = brasero_vfs_find_urgent (vfs,
- type,
- brasero_data_vfs_increase_priority_cb,
- registered);
+ brasero_io_find_urgent (io,
+ type,
+ brasero_data_vfs_increase_priority_cb,
+ registered);
brasero_utils_unregister_string (registered);
-
- return result;
+ return TRUE;
}
gboolean
@@ -748,7 +821,7 @@
priv = BRASERO_DATA_VFS_PRIVATE (self);
return brasero_data_vfs_require_higher_priority (self,
node,
- priv->vfs,
+ priv->io,
priv->load_contents);
}
@@ -761,7 +834,7 @@
priv = BRASERO_DATA_VFS_PRIVATE (self);
return brasero_data_vfs_require_higher_priority (self,
node,
- priv->vfs,
+ priv->io,
priv->load_uri);
}
@@ -770,7 +843,6 @@
BraseroFileNode *node)
{
BraseroDataVFSPrivate *priv;
- gchar *registered;
guint reference;
gboolean result;
GSList *nodes;
@@ -789,6 +861,11 @@
/* make sure the node is not already in the loading table */
nodes = g_hash_table_lookup (priv->loading, uri);
if (nodes) {
+ gchar *registered;
+
+ registered = brasero_utils_register_string (uri);
+ g_free (uri);
+
for (; nodes; nodes = nodes->next) {
guint reference;
BraseroFileNode *ref_node;
@@ -796,8 +873,13 @@
reference = GPOINTER_TO_INT (nodes->data);
ref_node = brasero_data_project_reference_get (BRASERO_DATA_PROJECT (self), reference);
if (ref_node == node) {
- result = TRUE;
- goto end;
+ /* 1sk for a higher priority */
+ brasero_io_find_urgent (priv->io,
+ priv->load_uri,
+ brasero_data_vfs_increase_priority_cb,
+ registered);
+ brasero_utils_unregister_string (registered);
+ return TRUE;
}
}
@@ -805,29 +887,24 @@
reference = brasero_data_project_reference_new (BRASERO_DATA_PROJECT (self), node);
nodes = g_slist_prepend (nodes, GINT_TO_POINTER (reference));
g_hash_table_insert (priv->loading, (gchar *) uri, nodes);
- result = TRUE;
- goto end;
+
+ /* Yet, ask for a higher priority */
+ brasero_io_find_urgent (priv->io,
+ priv->load_uri,
+ brasero_data_vfs_increase_priority_cb,
+ registered);
+ brasero_utils_unregister_string (registered);
+ return TRUE;
}
reference = brasero_data_project_reference_new (BRASERO_DATA_PROJECT (self), node);
result = brasero_data_vfs_load_node (self,
- GNOME_VFS_FILE_INFO_GET_MIME_TYPE|
- GNOME_VFS_FILE_INFO_FORCE_SLOW_MIME_TYPE,
+ BRASERO_IO_INFO_MIME|
+ BRASERO_IO_INFO_URGENT,
reference,
uri);
-
-end:
-
- /* ask for a higher priority */
- registered = brasero_utils_register_string (uri);
g_free (uri);
- brasero_vfs_find_urgent (priv->vfs,
- priv->load_uri,
- brasero_data_vfs_increase_priority_cb,
- registered);
- brasero_utils_unregister_string (registered);
-
return result;
}
@@ -910,8 +987,16 @@
priv = BRASERO_DATA_VFS_PRIVATE (self);
/* Stop all VFS operations */
- if (priv->vfs)
- brasero_vfs_cancel (priv->vfs, self);
+ if (priv->io) {
+ brasero_io_cancel_by_base (priv->io, priv->load_uri);
+ brasero_io_cancel_by_base (priv->io, priv->load_contents);
+
+ g_free (priv->load_uri);
+ priv->load_uri = NULL;
+
+ g_free (priv->load_contents);
+ priv->load_contents = NULL;
+ }
/* Empty the hash tables */
g_hash_table_foreach_remove (priv->loading,
@@ -959,7 +1044,7 @@
priv->filtered = g_hash_table_new (g_str_hash, g_str_equal);
/* get the vfs object */
- priv->vfs = brasero_vfs_get_default ();
+ priv->io = brasero_io_get_default ();
}
static void
@@ -985,9 +1070,9 @@
priv->filtered = NULL;
}
- if (priv->vfs) {
- g_object_unref (priv->vfs);
- priv->vfs = NULL;
+ if (priv->io) {
+ g_object_unref (priv->io);
+ priv->io = NULL;
}
G_OBJECT_CLASS (brasero_data_vfs_parent_class)->finalize (object);
@@ -1043,7 +1128,7 @@
brasero_marshal_VOID__INT_STRING,
G_TYPE_NONE,
2,
- G_TYPE_INT,
+ G_TYPE_POINTER,
G_TYPE_STRING);
brasero_data_vfs_signals [RECURSIVE_SIGNAL] =
Modified: trunk/src/brasero-disc-message.c
==============================================================================
--- trunk/src/brasero-disc-message.c (original)
+++ trunk/src/brasero-disc-message.c Mon Feb 25 14:12:43 2008
@@ -449,6 +449,9 @@
priv->id = 0;
}
+ g_object_unref (priv->group);
+ priv->group = NULL;
+
G_OBJECT_CLASS (brasero_disc_message_parent_class)->finalize (object);
}
Modified: trunk/src/brasero-drive-info.c
==============================================================================
--- trunk/src/brasero-drive-info.c (original)
+++ trunk/src/brasero-drive-info.c Mon Feb 25 14:12:43 2008
@@ -39,8 +39,6 @@
#include <nautilus-burn-drive.h>
-#include <libgnomevfs/gnome-vfs.h>
-
#include "brasero-drive-info.h"
#include "burn-medium.h"
#include "burn-caps.h"
@@ -144,7 +142,7 @@
gint64 data_size;
NCB_MEDIA_GET_CAPACITY (drive, &data_size, NULL);
- data_size_string = gnome_vfs_format_file_size_for_display (data_size);
+ data_size_string = g_format_size_for_display (data_size);
info = g_strdup_printf (_("%s of data"), data_size_string);
g_free (data_size_string);
@@ -170,7 +168,7 @@
gint64 remaining;
NCB_MEDIA_GET_CAPACITY (drive, &remaining, NULL);
- remaining_string = gnome_vfs_format_file_size_for_display (remaining);
+ remaining_string = g_format_size_for_display (remaining);
info = g_strdup_printf (_("%s free"), remaining_string);
g_free (remaining_string);
@@ -185,7 +183,7 @@
gint64 remaining;
NCB_MEDIA_GET_FREE_SPACE (drive, &remaining, NULL);
- remaining_string = gnome_vfs_format_file_size_for_display (remaining);
+ remaining_string = g_format_size_for_display (remaining);
info = g_strdup_printf (_("%s free"), remaining_string);
g_free (remaining_string);
@@ -200,8 +198,8 @@
NCB_MEDIA_GET_CAPACITY (drive, &capacity, NULL);
NCB_MEDIA_GET_FREE_SPACE (drive, &remaining, NULL);
- remaining_string = gnome_vfs_format_file_size_for_display (remaining);
- capacity_string = gnome_vfs_format_file_size_for_display (capacity);
+ remaining_string = g_format_size_for_display (remaining);
+ capacity_string = g_format_size_for_display (capacity);
info = g_strdup_printf (_("%s (%s free)"),
capacity_string,
remaining_string);
@@ -219,7 +217,7 @@
gint64 remaining;
NCB_MEDIA_GET_FREE_SPACE (drive, &remaining, NULL);
- remaining_string = gnome_vfs_format_file_size_for_display (remaining);
+ remaining_string = g_format_size_for_display (remaining);
info = g_strdup_printf (_("%s free"), remaining_string);
g_free (remaining_string);
Modified: trunk/src/brasero-drive-properties.c
==============================================================================
--- trunk/src/brasero-drive-properties.c (original)
+++ trunk/src/brasero-drive-properties.c Mon Feb 25 14:12:43 2008
@@ -30,6 +30,8 @@
#include <glib-object.h>
#include <glib/gi18n-lib.h>
+#include <gio/gio.h>
+
#include <gtk/gtkwindow.h>
#include <gtk/gtkdialog.h>
#include <gtk/gtkcombobox.h>
@@ -43,8 +45,6 @@
#include <nautilus-burn-drive.h>
-#include <libgnomevfs/gnome-vfs.h>
-
#include "burn-basics.h"
#include "burn-medium.h"
#include "burn-debug.h"
@@ -135,12 +135,12 @@
brasero_drive_properties_set_tmpdir (BraseroDriveProperties *self,
const gchar *path)
{
+ GFile *file;
gchar *string;
- gchar *uri_str;
+ GFileInfo *info;
gchar *directory;
- GnomeVFSURI *uri;
- BraseroBurnResult result;
- GnomeVFSFileSize vol_size = 0;
+ GError *error = NULL;
+ guint64 vol_size = 0;
BraseroDrivePropertiesPrivate *priv;
priv = BRASERO_DRIVE_PROPERTIES_PRIVATE (self);
@@ -154,26 +154,34 @@
/* get the volume free space */
directory = g_path_get_dirname (path);
- uri_str = gnome_vfs_get_uri_from_local_path (directory);
+ file = g_file_new_for_path (directory);
g_free (directory);
- uri = gnome_vfs_uri_new (uri_str);
- g_free (uri_str);
-
- if (uri == NULL) {
+ if (file == NULL) {
BRASERO_BURN_LOG ("impossible to retrieve size for %s", path);
gtk_label_set_text (GTK_LABEL (priv->tmpdir_size), _("unknown"));
return;
}
- result = gnome_vfs_get_volume_free_space (uri, &vol_size);
- if (result != GNOME_VFS_OK) {
- BRASERO_BURN_LOG ("impossible to retrieve size for %s", path);
+ info = g_file_query_info (file,
+ G_FILE_ATTRIBUTE_FILESYSTEM_FREE,
+ G_FILE_QUERY_INFO_NONE,
+ NULL,
+ &error);
+ g_object_unref (file);
+
+ if (error) {
+ g_object_unref (info);
+
+ BRASERO_BURN_LOG ("impossible to retrieve size for %s (%s)", path, error->message);
+ g_error_free (error);
+
gtk_label_set_text (GTK_LABEL (priv->tmpdir_size), _("unknown"));
return;
}
- gnome_vfs_uri_unref (uri);
+ vol_size = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_FILESYSTEM_FREE);
+ g_object_unref (info);
string = brasero_utils_get_size_string (vol_size, TRUE, TRUE);
gtk_label_set_text (GTK_LABEL (priv->tmpdir_size), string);
Modified: trunk/src/brasero-file-filtered.c
==============================================================================
--- trunk/src/brasero-file-filtered.c (original)
+++ trunk/src/brasero-file-filtered.c Mon Feb 25 14:12:43 2008
@@ -162,7 +162,7 @@
model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->tree));
gtk_list_store_append (GTK_LIST_STORE (model), &iter);
- unescaped_uri = gnome_vfs_unescape_string_for_display (uri);
+ unescaped_uri = g_uri_unescape_string (uri, NULL);
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
STOCK_ID_COL, stock_id,
UNESCAPED_URI_COL, unescaped_uri,
Modified: trunk/src/brasero-file-monitor.c
==============================================================================
--- trunk/src/brasero-file-monitor.c (original)
+++ trunk/src/brasero-file-monitor.c Mon Feb 25 14:12:43 2008
@@ -32,8 +32,6 @@
#include <glib.h>
#include <glib/gi18n-lib.h>
-#include <libgnomevfs/gnome-vfs.h>
-
#include <sys/inotify.h>
#include "brasero-file-monitor.h"
@@ -571,7 +569,7 @@
priv = BRASERO_FILE_MONITOR_PRIVATE (self);
- path = gnome_vfs_get_local_path_from_uri (uri);
+ path = g_filename_from_uri (uri, NULL, NULL);
dev_fd = g_io_channel_unix_get_fd (priv->notify);
mask = IN_MODIFY |
Modified: trunk/src/brasero-file-node.c
==============================================================================
--- trunk/src/brasero-file-node.c (original)
+++ trunk/src/brasero-file-node.c Mon Feb 25 14:12:43 2008
@@ -28,6 +28,8 @@
#include <string.h>
+#include <gio/gio.h>
+
#include "burn-basics.h"
#include "brasero-file-node.h"
@@ -576,7 +578,7 @@
return NULL;
if (g_utf8_validate (name, -1, &invalid))
- return NULL;
+ return g_markup_escape_text (name, -1);
retval = g_strdup (name);
ptr = retval + (invalid - name);
@@ -589,6 +591,10 @@
ptr ++;
}
+ ptr = retval;
+ retval = g_markup_escape_text (retval, -1);
+ g_free (ptr);
+
return retval;
}
@@ -708,7 +714,7 @@
void
brasero_file_node_set_from_info (BraseroFileNode *node,
- GnomeVFSFileInfo *info)
+ GFileInfo *info)
{
/* NOTE: the name will never be replaced here since that means
* we could replace a previously set name (that triggered the
@@ -719,26 +725,29 @@
* - the mime type
* - the size (and possibly the one of his parent)
* - the type */
- node->is_file = (info->type != GNOME_VFS_FILE_TYPE_DIRECTORY);
+ node->is_file = (g_file_info_get_file_type (info) != G_FILE_TYPE_DIRECTORY);
node->is_fake = FALSE;
node->is_loading = FALSE;
node->is_imported = FALSE;
node->is_reloading = FALSE;
- node->is_symlink = (GNOME_VFS_FILE_INFO_SYMLINK (info));
+ node->is_symlink = (g_file_info_get_is_symlink (info));
if (node->is_file) {
guint sectors;
gint sectors_diff;
/* register mime type string */
- if (info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE) {
+ if (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE)) {
+ const gchar *mime;
+
if (BRASERO_FILE_NODE_MIME (node))
brasero_utils_unregister_string (BRASERO_FILE_NODE_MIME (node));
- node->union2.mime = brasero_utils_register_string (info->mime_type);
+ mime = g_file_info_get_content_type (info);
+ node->union2.mime = brasero_utils_register_string (mime);
}
- sectors = BRASERO_SIZE_TO_SECTORS (info->size, 2048);
+ sectors = BRASERO_SIZE_TO_SECTORS (g_file_info_get_size (info), 2048);
if (sectors > BRASERO_FILE_2G_LIMIT && BRASERO_FILE_NODE_SECTORS (node) <= BRASERO_FILE_2G_LIMIT) {
BraseroFileTreeStats *stats;
@@ -773,16 +782,16 @@
brasero_file_node_get_uri_name (const gchar *uri)
{
gchar *unescaped_name;
- GnomeVFSURI *vfs_uri;
+ GFile *vfs_uri;
gchar *name;
/* g_path_get_basename is not comfortable with uri related
* to the root directory so check that before */
- vfs_uri = gnome_vfs_uri_new (uri);
- name = gnome_vfs_uri_extract_short_path_name (vfs_uri);
- gnome_vfs_uri_unref (vfs_uri);
+ vfs_uri = g_file_new_for_uri (uri);
+ name = g_file_get_basename (vfs_uri);
+ g_object_unref (vfs_uri);
- unescaped_name = gnome_vfs_unescape_string_for_display (name);
+ unescaped_name = g_uri_unescape_string (name, NULL);
g_free (name);
/* NOTE: a graft should be added for non utf8 name since we
@@ -814,14 +823,14 @@
}
BraseroFileNode *
-brasero_file_node_new_from_info (GnomeVFSFileInfo *info,
+brasero_file_node_new_from_info (GFileInfo *info,
BraseroFileNode *parent,
GCompareFunc sort_func)
{
BraseroFileNode *node;
node = g_new0 (BraseroFileNode, 1);
- node->union1.name = g_strdup (info->name);
+ node->union1.name = g_strdup (g_file_info_get_name (info));
brasero_file_node_set_from_info (node, info);
Modified: trunk/src/brasero-file-node.h
==============================================================================
--- trunk/src/brasero-file-node.h (original)
+++ trunk/src/brasero-file-node.h Mon Feb 25 14:12:43 2008
@@ -27,7 +27,7 @@
#include <glib.h>
-#include <libgnomevfs/gnome-vfs.h>
+#include <gio/gio.h>
#include "burn-volume.h"
@@ -221,7 +221,7 @@
BraseroFileNode *parent,
GCompareFunc sort_func);
BraseroFileNode *
-brasero_file_node_new_from_info (GnomeVFSFileInfo *info,
+brasero_file_node_new_from_info (GFileInfo *info,
BraseroFileNode *parent,
GCompareFunc sort_func);
BraseroFileNode *
@@ -242,7 +242,7 @@
const gchar *name);
void
brasero_file_node_set_from_info (BraseroFileNode *node,
- GnomeVFSFileInfo *info);
+ GFileInfo *info);
void
brasero_file_node_graft (BraseroFileNode *file_node,
Modified: trunk/src/brasero-image-option-dialog.c
==============================================================================
--- trunk/src/brasero-image-option-dialog.c (original)
+++ trunk/src/brasero-image-option-dialog.c Mon Feb 25 14:12:43 2008
@@ -44,7 +44,7 @@
#include "brasero-image-type-chooser.h"
#include "brasero-dest-selection.h"
#include "brasero-ncb.h"
-#include "brasero-vfs.h"
+#include "brasero-io.h"
G_DEFINE_TYPE (BraseroImageOptionDialog, brasero_image_option_dialog, GTK_TYPE_DIALOG);
@@ -57,8 +57,8 @@
gulong caps_sig;
gulong session_sig;
- BraseroVFS *vfs;
- BraseroVFSDataID info_type;
+ BraseroIO *io;
+ BraseroIOJobBase *info_type;
GtkWidget *selection;
GtkWidget *format;
@@ -94,11 +94,10 @@
}
static void
-brasero_image_option_dialog_image_info_cb (BraseroVFS *vfs,
- GObject *object,
- GnomeVFSResult result,
+brasero_image_option_dialog_image_info_cb (GObject *object,
+ GError *error,
const gchar *uri,
- GnomeVFSFileInfo *info,
+ GFileInfo *info,
gpointer null_data)
{
BraseroImageOptionDialog *dialog = BRASERO_IMAGE_OPTION_DIALOG (object);
@@ -106,7 +105,7 @@
priv = BRASERO_IMAGE_OPTION_DIALOG_PRIVATE (dialog);
- if (result != GNOME_VFS_OK) {
+ if (error) {
brasero_image_option_dialog_set_track (dialog,
BRASERO_IMAGE_FORMAT_NONE,
NULL,
@@ -115,12 +114,12 @@
}
/* Add it to recent file manager */
- if (!strcmp (info->mime_type, "application/x-toc"))
+ if (!strcmp (g_file_info_get_content_type (info), "application/x-toc"))
brasero_image_option_dialog_set_track (dialog,
BRASERO_IMAGE_FORMAT_CLONE,
NULL,
uri);
- else if (!strcmp (info->mime_type, "application/octet-stream")) {
+ else if (!strcmp (g_file_info_get_content_type (info), "application/octet-stream")) {
/* that could be an image, so here is the deal:
* if we can find the type through the extension, fine.
* if not default to CLONE */
@@ -140,17 +139,17 @@
uri,
NULL);
}
- else if (!strcmp (info->mime_type, "application/x-cd-image"))
+ else if (!strcmp (g_file_info_get_content_type (info), "application/x-cd-image"))
brasero_image_option_dialog_set_track (dialog,
BRASERO_IMAGE_FORMAT_BIN,
uri,
NULL);
- else if (!strcmp (info->mime_type, "application/x-cdrdao-toc"))
+ else if (!strcmp (g_file_info_get_content_type (info), "application/x-cdrdao-toc"))
brasero_image_option_dialog_set_track (dialog,
BRASERO_IMAGE_FORMAT_CDRDAO,
NULL,
uri);
- else if (!strcmp (info->mime_type, "application/x-cue"))
+ else if (!strcmp (g_file_info_get_content_type (info), "application/x-cue"))
brasero_image_option_dialog_set_track (dialog,
BRASERO_IMAGE_FORMAT_CUE,
NULL,
@@ -166,7 +165,6 @@
brasero_image_option_dialog_get_format (BraseroImageOptionDialog *dialog,
gchar *uri)
{
- GList *uris;
BraseroImageOptionDialogPrivate *priv;
priv = BRASERO_IMAGE_OPTION_DIALOG_PRIVATE (dialog);
@@ -179,24 +177,20 @@
return;
}
- if (!priv->vfs)
- priv->vfs = brasero_vfs_get_default ();
+ if (!priv->io)
+ priv->io = brasero_io_get_default ();
if (!priv->info_type)
- priv->info_type = brasero_vfs_register_data_type (priv->vfs,
- G_OBJECT (dialog),
- G_CALLBACK (brasero_image_option_dialog_image_info_cb),
- NULL);
-
- uris = g_list_prepend (NULL, uri);
- brasero_vfs_get_info (priv->vfs,
- uris,
- FALSE,
- GNOME_VFS_FILE_INFO_GET_MIME_TYPE|
- GNOME_VFS_FILE_INFO_FORCE_SLOW_MIME_TYPE,
- priv->info_type,
- NULL);
- g_list_free (uris);
+ priv->info_type = brasero_io_register (G_OBJECT (dialog),
+ brasero_image_option_dialog_image_info_cb,
+ NULL,
+ NULL);
+
+ brasero_io_get_file_info (priv->io,
+ uri,
+ priv->info_type,
+ BRASERO_IO_INFO_MIME,
+ NULL);
}
static void
@@ -631,10 +625,14 @@
priv = BRASERO_IMAGE_OPTION_DIALOG_PRIVATE (object);
- if (priv->vfs) {
- brasero_vfs_cancel (priv->vfs, object);
- g_object_unref (priv->vfs);
- priv->vfs = NULL;
+ if (priv->io) {
+ brasero_io_cancel_by_base (priv->io, priv->info_type);
+
+ g_free (priv->info_type);
+ priv->info_type = NULL;
+
+ g_object_unref (priv->io);
+ priv->io = NULL;
}
if (priv->track) {
Modified: trunk/src/brasero-metadata.c
==============================================================================
--- trunk/src/brasero-metadata.c (original)
+++ trunk/src/brasero-metadata.c Mon Feb 25 14:12:43 2008
@@ -65,6 +65,9 @@
BraseroMetadataFlag flags;
BraseroMetadataInfo *info;
+ GMutex *mutex;
+ GCond *cond;
+
guint started:1;
guint moved_forward:1;
guint prev_level_mes:1;
@@ -136,16 +139,19 @@
g_free (info);
}
-void
-brasero_metadata_cancel (BraseroMetadata *self)
+static void
+brasero_metadata_stop (BraseroMetadata *self)
{
BraseroMetadataPrivate *priv;
priv = BRASERO_METADATA_PRIVATE (self);
- if (priv->error) {
- g_error_free (priv->error);
- priv->error = NULL;
+ if (priv->pipeline)
+ gst_element_set_state (priv->pipeline, GST_STATE_NULL);
+
+ if (priv->progress_id) {
+ g_source_remove (priv->progress_id);
+ priv->progress_id = 0;
}
if (priv->watch) {
@@ -153,11 +159,32 @@
priv->watch = 0;
}
+ /* stop the pipeline */
+ priv->started = 0;
+
+ /* that's for sync_wait */
+ g_mutex_lock (priv->mutex);
+ g_cond_signal (priv->cond);
+ g_mutex_unlock (priv->mutex);
+
+ /* stop loop */
if (priv->loop && g_main_loop_is_running (priv->loop))
g_main_loop_quit (priv->loop);
+}
- if (priv->pipeline)
- gst_element_set_state (GST_ELEMENT (priv->pipeline), GST_STATE_NULL);
+void
+brasero_metadata_cancel (BraseroMetadata *self)
+{
+ BraseroMetadataPrivate *priv;
+
+ priv = BRASERO_METADATA_PRIVATE (self);
+
+ brasero_metadata_stop (self);
+
+ if (priv->error) {
+ g_error_free (priv->error);
+ priv->error = NULL;
+ }
}
static gint
@@ -276,62 +303,11 @@
static gboolean
brasero_metadata_completed (BraseroMetadata *self)
{
- GstFormat format = GST_FORMAT_TIME;
BraseroMetadataPrivate *priv;
- gint64 duration = -1;
priv = BRASERO_METADATA_PRIVATE (self);
- /* find the type of the file */
- brasero_metadata_get_mime_type (self);
-
- /* get the size */
- if (!BRASERO_METADATA_IS_FAST (priv->flags)
- && brasero_metadata_is_mp3 (self))
- gst_element_query_position (GST_ELEMENT (priv->sink),
- &format,
- &duration);
-
- if (duration == -1)
- gst_element_query_duration (GST_ELEMENT (priv->pipeline),
- &format,
- &duration);
-
- if (duration == -1) {
- if (!priv->error) {
- priv->error = g_error_new (BRASERO_ERROR,
- BRASERO_ERROR_GENERAL,
- _("this format is not supported by gstreamer"));
- }
-
- goto signal;
- }
-
- BRASERO_BURN_LOG ("found duration %lli", duration);
-
- priv->info->len = duration;
-
- /* check if that's a seekable one */
- brasero_metadata_is_seekable (self);
-
- if (priv->silence) {
- priv->silence->end = duration;
- priv->info->silences = g_slist_append (priv->info->silences, priv->silence);
- priv->silence = NULL;
- }
-
-signal:
-
- if (priv->progress_id) {
- g_source_remove (priv->progress_id);
- priv->progress_id = 0;
- }
-
- /* stop the pipeline */
- priv->started = 0;
- gst_element_set_state (priv->pipeline, GST_STATE_NULL);
-
- if (!priv->loop || !g_main_loop_is_running (priv->loop)) {
+ if ((!priv->loop || !g_main_loop_is_running (priv->loop)) && !priv->cond) {
/* we send a message only if we haven't got a loop (= async mode) */
g_object_ref (self);
g_signal_emit (G_OBJECT (self),
@@ -340,9 +316,8 @@
priv->error);
g_object_unref (self);
}
- else
- g_main_loop_quit (priv->loop);
+ brasero_metadata_stop (self);
return TRUE;
}
@@ -392,6 +367,82 @@
}
}
+static void
+brasero_metadata_process_pending_tag_messages (BraseroMetadata *self)
+{
+ GstBus *bus;
+ GstMessage *msg;
+ BraseroMetadataPrivate *priv;
+
+ priv = BRASERO_METADATA_PRIVATE (self);
+
+ bus = gst_pipeline_get_bus (GST_PIPELINE (priv->pipeline));
+ while ((msg = gst_bus_pop_filtered (bus, GST_MESSAGE_TAG))) {
+ GstTagList *tags = NULL;
+
+ gst_message_parse_tag (msg, &tags);
+ gst_tag_list_foreach (tags, (GstTagForeachFunc) foreach_tag, self);
+ gst_tag_list_free (tags);
+
+ gst_message_unref (msg);
+ }
+
+ g_object_unref (bus);
+}
+
+static gboolean
+brasero_metadata_success (BraseroMetadata *self)
+{
+ GstFormat format = GST_FORMAT_TIME;
+ BraseroMetadataPrivate *priv;
+ gint64 duration = -1;
+
+ priv = BRASERO_METADATA_PRIVATE (self);
+
+ /* find the type of the file */
+ brasero_metadata_get_mime_type (self);
+
+ /* get the size */
+ if (!BRASERO_METADATA_IS_FAST (priv->flags)
+ && brasero_metadata_is_mp3 (self))
+ gst_element_query_position (GST_ELEMENT (priv->sink),
+ &format,
+ &duration);
+
+ if (duration == -1)
+ gst_element_query_duration (GST_ELEMENT (priv->pipeline),
+ &format,
+ &duration);
+
+ if (duration == -1) {
+ if (!priv->error) {
+ priv->error = g_error_new (BRASERO_ERROR,
+ BRASERO_ERROR_GENERAL,
+ _("this format is not supported by gstreamer"));
+ }
+
+ return brasero_metadata_completed (self);
+ }
+
+ BRASERO_BURN_LOG ("found duration %lli", duration);
+
+ priv->info->len = duration;
+
+ /* check if that's a seekable one */
+ brasero_metadata_is_seekable (self);
+
+ if (priv->silence) {
+ priv->silence->end = duration;
+ priv->info->silences = g_slist_append (priv->info->silences, priv->silence);
+ priv->silence = NULL;
+ }
+
+ /* empty the bus of any pending message */
+ brasero_metadata_process_pending_tag_messages (self);
+
+ return brasero_metadata_completed (self);
+}
+
static gboolean
brasero_metadata_bus_messages (GstBus *bus,
GstMessage *msg,
@@ -458,6 +509,7 @@
priv->prev_level_mes = 1;
}
break;
+
case GST_MESSAGE_ERROR:
gst_message_parse_error (msg, &error, &debug_string);
BRASERO_BURN_LOG (debug_string);
@@ -468,7 +520,7 @@
break;
case GST_MESSAGE_EOS:
- brasero_metadata_completed (self);
+ brasero_metadata_success (self);
break;
case GST_MESSAGE_TAG:
@@ -520,7 +572,7 @@
break;
}
- brasero_metadata_completed (self);
+ brasero_metadata_success (self);
break;
default:
@@ -538,11 +590,13 @@
{
GstPad *sink;
GstCaps *caps;
+ GstPadLinkReturn res;
GstStructure *structure;
BraseroMetadataPrivate *priv;
priv = BRASERO_METADATA_PRIVATE (self);
+ res = GST_PAD_LINK_REFUSED;
BRASERO_BURN_LOG ("new pad");
sink = gst_element_get_pad (priv->first, "sink");
if (GST_PAD_IS_LINKED (sink))
@@ -559,7 +613,7 @@
priv->info->has_video = (g_strrstr (name, "video") != NULL);
if (priv->info->has_audio || priv->info->has_video)
- gst_pad_link (pad, sink);
+ res = gst_pad_link (pad, sink);
}
gst_object_unref (sink);
@@ -714,8 +768,80 @@
self);
gst_object_unref (bus);
- /* launch the pipeline */
- gst_element_set_state (priv->pipeline, GST_STATE_PAUSED);
+ return TRUE;
+}
+
+static void
+brasero_metadata_cancelled_cb (GCancellable *cancel,
+ BraseroMetadata *self)
+{
+ brasero_metadata_cancel (self);
+}
+
+gboolean
+brasero_metadata_get_info_wait (BraseroMetadata *self,
+ GCancellable *cancel,
+ const gchar *uri,
+ BraseroMetadataFlag flags,
+ GError **error)
+{
+ BraseroMetadataPrivate *priv;
+ gulong cancel_signal = 0;
+
+ priv = BRASERO_METADATA_PRIVATE (self);
+
+ priv->flags = flags;
+ if (!brasero_metadata_set_new_uri (self, uri)) {
+ g_propagate_error (error, priv->error);
+ priv->error = NULL;
+
+ brasero_metadata_info_free (priv->info);
+ priv->info = NULL;
+
+ return FALSE;
+ }
+
+ g_mutex_lock (priv->mutex);
+
+ cancel_signal = g_signal_connect (cancel,
+ "cancelled",
+ G_CALLBACK (brasero_metadata_cancelled_cb),
+ self);
+
+ /* Now wait ... but check a last time otherwise we wouldn't get the
+ * any notice of cancellation if it had been cancelled before we
+ * connected to the signal */
+ if (g_cancellable_is_cancelled (cancel)) {
+ g_signal_handler_disconnect (cancel, cancel_signal);
+ g_mutex_unlock (priv->mutex);
+
+ brasero_metadata_stop (self);
+ brasero_metadata_info_free (priv->info);
+ priv->info = NULL;
+
+ return FALSE;
+ }
+
+ priv->started = 1;
+ gst_element_set_state (GST_ELEMENT (priv->pipeline), GST_STATE_PLAYING);
+ g_cond_wait (priv->cond, priv->mutex);
+ g_mutex_unlock (priv->mutex);
+
+ g_signal_handler_disconnect (cancel, cancel_signal);
+
+ if (priv->error) {
+ if (error) {
+ g_propagate_error (error, priv->error);
+ priv->error = NULL;
+ }
+ else {
+ BRASERO_BURN_LOG ("ERROR getting metadata : %s\n", priv->error->message);
+ g_error_free (priv->error);
+ priv->error = NULL;
+ }
+
+ return FALSE;
+ }
return TRUE;
}
@@ -757,15 +883,11 @@
priv->error = NULL;
}
else {
- g_warning ("ERROR getting metadata : %s\n",
- priv->error->message);
+ BRASERO_BURN_LOG ("ERROR getting metadata : %s\n", priv->error->message);
g_error_free (priv->error);
priv->error = NULL;
}
- brasero_metadata_info_free (priv->info);
- priv->info = NULL;
-
return FALSE;
}
@@ -804,48 +926,43 @@
return TRUE;
}
-gboolean
-brasero_metadata_set_info (BraseroMetadata *self,
- BraseroMetadataInfo *info)
+void
+brasero_metadata_info_copy (BraseroMetadataInfo *dest,
+ BraseroMetadataInfo *src)
{
- BraseroMetadataPrivate *priv;
GSList *iter;
- priv = BRASERO_METADATA_PRIVATE (self);
-
- if (!priv->info)
- return FALSE;
-
- memset (info, 0, sizeof (BraseroMetadataInfo));
+ if (!dest || !src)
+ return;
- info->isrc = priv->info->isrc;
- info->len = priv->info->len;
- info->is_seekable = priv->info->is_seekable;
- info->has_audio = priv->info->has_audio;
- info->has_video = priv->info->has_video;
+ dest->isrc = src->isrc;
+ dest->len = src->len;
+ dest->is_seekable = src->is_seekable;
+ dest->has_audio = src->has_audio;
+ dest->has_video = src->has_video;
- if (priv->info->uri)
- info->uri = g_strdup (priv->info->uri);
+ if (src->uri)
+ dest->uri = g_strdup (src->uri);
- if (priv->info->type)
- info->type = g_strdup (priv->info->type);
+ if (src->type)
+ dest->type = g_strdup (src->type);
- if (priv->info->title)
- info->title = g_strdup (priv->info->title);
+ if (src->title)
+ dest->title = g_strdup (src->title);
- if (priv->info->artist)
- info->artist = g_strdup (priv->info->artist);
+ if (src->artist)
+ dest->artist = g_strdup (src->artist);
- if (priv->info->album)
- info->album = g_strdup (priv->info->album);
+ if (src->album)
+ dest->album = g_strdup (src->album);
- if (priv->info->genre)
- info->genre = g_strdup (priv->info->genre);
+ if (src->genre)
+ dest->genre = g_strdup (src->genre);
- if (priv->info->musicbrainz_id)
- info->musicbrainz_id = g_strdup (priv->info->musicbrainz_id);
+ if (src->musicbrainz_id)
+ dest->musicbrainz_id = g_strdup (src->musicbrainz_id);
- for (iter = priv->info->silences; iter; iter = iter->next) {
+ for (iter = src->silences; iter; iter = iter->next) {
BraseroMetadataSilence *silence, *copy;
silence = iter->data;
@@ -854,15 +971,37 @@
copy->start = silence->start;
copy->end = silence->end;
- info->silences = g_slist_append (info->silences, copy);
+ dest->silences = g_slist_append (dest->silences, copy);
}
+}
+
+gboolean
+brasero_metadata_set_info (BraseroMetadata *self,
+ BraseroMetadataInfo *info)
+{
+ BraseroMetadataPrivate *priv;
+
+ priv = BRASERO_METADATA_PRIVATE (self);
+
+ if (!priv->info)
+ return FALSE;
+
+ memset (info, 0, sizeof (BraseroMetadataInfo));
+ brasero_metadata_info_copy (info, priv->info);
return TRUE;
}
static void
brasero_metadata_init (BraseroMetadata *obj)
-{ }
+{
+ BraseroMetadataPrivate *priv;
+
+ priv = BRASERO_METADATA_PRIVATE (obj);
+
+ priv->cond = g_cond_new ();
+ priv->mutex = g_mutex_new ();
+}
static void
brasero_metadata_destroy_pipeline (BraseroMetadata *self)
@@ -961,6 +1100,16 @@
priv->info = NULL;
}
+ if (priv->mutex) {
+ g_mutex_free (priv->mutex);
+ priv->mutex = NULL;
+ }
+
+ if (priv->cond) {
+ g_cond_free (priv->cond);
+ priv->cond = NULL;
+ }
+
G_OBJECT_CLASS (parent_class)->finalize (object);
}
Modified: trunk/src/brasero-metadata.h
==============================================================================
--- trunk/src/brasero-metadata.h (original)
+++ trunk/src/brasero-metadata.h Mon Feb 25 14:12:43 2008
@@ -27,6 +27,7 @@
#include <glib.h>
#include <glib-object.h>
+#include <gio/gio.h>
#include <gst/gst.h>
@@ -70,6 +71,9 @@
} BraseroMetadataInfo;
void
+brasero_metadata_info_copy (BraseroMetadataInfo *dest,
+ BraseroMetadataInfo *src);
+void
brasero_metadata_info_clear (BraseroMetadataInfo *info);
void
brasero_metadata_info_free (BraseroMetadataInfo *info);
@@ -95,6 +99,13 @@
brasero_metadata_cancel (BraseroMetadata *metadata);
gboolean
+brasero_metadata_get_info_wait (BraseroMetadata *self,
+ GCancellable *cancel,
+ const gchar *uri,
+ BraseroMetadataFlag flags,
+ GError **error);
+
+gboolean
brasero_metadata_get_info_sync (BraseroMetadata *meta,
const gchar *uri,
BraseroMetadataFlag flags,
Modified: trunk/src/brasero-mime-filter.c
==============================================================================
--- trunk/src/brasero-mime-filter.c (original)
+++ trunk/src/brasero-mime-filter.c Mon Feb 25 14:12:43 2008
@@ -30,6 +30,8 @@
#include <glib/gi18n-lib.h>
#include <glib-object.h>
+#include <gio/gio.h>
+
#include <gtk/gtkhbox.h>
#include <gtk/gtkfilefilter.h>
#include <gtk/gtkcombobox.h>
@@ -39,10 +41,6 @@
#include <gtk/gtkmarshal.h>
#include <gtk/gtklabel.h>
-#include <libgnomeui/libgnomeui.h>
-
-#include <libgnomevfs/gnome-vfs-mime-handlers.h>
-
#include "brasero-mime-filter.h"
#include "brasero-utils.h"
@@ -233,17 +231,19 @@
item = g_hash_table_lookup (filter->priv->table, mime);
if (item == NULL) {
+ GIcon *icon;
gchar *display;
GtkTreeIter row;
- gchar *icon_string;
GtkTreeModel *model;
const gchar *description;
+ const gchar * const *icon_string = NULL;
- description = gnome_vfs_mime_get_description (mime);
+ description = g_content_type_get_description (mime);
display = g_strdup_printf (_("%s only"), description);
- icon_string = gnome_icon_lookup (gtk_icon_theme_get_default (), NULL,
- NULL, NULL, NULL, mime,
- GNOME_ICON_LOOKUP_FLAGS_NONE, NULL);
+
+ icon = g_content_type_get_icon (mime);
+ if (G_IS_THEMED_ICON (icon))
+ icon_string = g_themed_icon_get_names (G_THEMED_ICON (icon));
/* create the GtkFileFilter */
item = gtk_file_filter_new ();
@@ -263,11 +263,10 @@
g_object_ref (item);
gtk_list_store_set (GTK_LIST_STORE (model), &row,
BRASERO_MIME_FILTER_DISPLAY_COL, display,
- BRASERO_MIME_FILTER_ICON_COL, icon_string,
+ BRASERO_MIME_FILTER_ICON_COL, icon_string?icon_string [0]:NULL,
BRASERO_MIME_FILTER_FILTER_COL, item,
-1);
g_object_ref_sink (GTK_OBJECT (item));
- g_free (icon_string);
g_free (display);
/* we check that the first entry at least is visible */
Modified: trunk/src/brasero-ncb.c
==============================================================================
--- trunk/src/brasero-ncb.c (original)
+++ trunk/src/brasero-ncb.c Mon Feb 25 14:12:43 2008
@@ -38,10 +38,7 @@
#include <glib.h>
#include <glib/gi18n-lib.h>
-#include <libgnomevfs/gnome-vfs-volume-monitor.h>
-#include <libgnomevfs/gnome-vfs-volume.h>
-#include <libgnomevfs/gnome-vfs-drive.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
+#include <gio/gio.h>
#include <nautilus-burn-drive-monitor.h>
@@ -352,42 +349,51 @@
return launch_command (drive, TRUE, error);
}
-static GnomeVFSDrive *
+static GDrive *
NCB_DRIVE_GET_VFS_DRIVE (NautilusBurnDrive *drive)
{
- GnomeVFSVolumeMonitor *monitor;
+ GVolumeMonitor *monitor;
GList *drives;
GList *iter;
- monitor = gnome_vfs_get_volume_monitor ();
- drives = gnome_vfs_volume_monitor_get_connected_drives (monitor);
+ monitor = g_volume_monitor_get ();
+ drives = g_volume_monitor_get_connected_drives (monitor);
for (iter = drives; iter; iter = iter->next) {
- GnomeVFSDeviceType device_type;
- GnomeVFSDrive *vfs_drive;
- gchar *device_path;
+ GDrive *vfs_drive;
+ GList *vol_iter;
+ GList *volumes;
vfs_drive = iter->data;
-
- device_type = gnome_vfs_drive_get_device_type (vfs_drive);
- if (device_type != GNOME_VFS_DEVICE_TYPE_AUDIO_CD
- && device_type != GNOME_VFS_DEVICE_TYPE_VIDEO_DVD
- && device_type != GNOME_VFS_DEVICE_TYPE_CDROM)
+ if (!g_drive_has_media (vfs_drive))
continue;
- device_path = gnome_vfs_drive_get_device_path (vfs_drive);
- if (!strcmp (device_path, NCB_DRIVE_GET_DEVICE (drive))) {
- gnome_vfs_drive_ref (vfs_drive);
-
- g_list_foreach (drives, (GFunc) gnome_vfs_drive_unref, NULL);
- g_list_free (drives);
+ /* FIXME: try to see if we can get the identifier for drive */
+ volumes = g_drive_get_volumes (vfs_drive);
+ for (vol_iter = volumes; vol_iter; vol_iter = vol_iter->next) {
+ GVolume *volume;
+ gchar *device_path;
+
+ volume = vol_iter->data;
+ device_path = g_volume_get_identifier (volume, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
+ if (!strcmp (device_path, NCB_DRIVE_GET_DEVICE (drive))) {
+
+ g_object_ref (vfs_drive);
+
+ g_list_foreach (volumes, (GFunc) g_object_unref, NULL);
+ g_list_free (volumes);
+
+ g_list_foreach (drives, (GFunc) g_object_unref, NULL);
+ g_list_free (drives);
+
+ g_free (device_path);
+ return vfs_drive;
+ }
g_free (device_path);
- return vfs_drive;
}
-
- g_free (device_path);
+ g_list_foreach (volumes, (GFunc) g_object_unref, NULL);
+ g_list_free (volumes);
}
-
- g_list_foreach (drives, (GFunc) gnome_vfs_drive_unref, NULL);
+ g_list_foreach (drives, (GFunc) g_object_unref, NULL);
g_list_free (drives);
return NULL;
@@ -397,24 +403,38 @@
NCB_VOLUME_GET_MOUNT_POINT (NautilusBurnDrive *drive,
GError **error)
{
- GnomeVFSDrive *vfsdrive = NULL;
gchar *mount_point = NULL;
gchar *local_path = NULL;
+ GDrive *vfsdrive = NULL;
GList *iter, *volumes;
/* get the uri for the mount point */
vfsdrive = NCB_DRIVE_GET_VFS_DRIVE (drive);
- volumes = gnome_vfs_drive_get_mounted_volumes (vfsdrive);
- gnome_vfs_drive_unref (vfsdrive);
+ volumes = g_drive_get_volumes (vfsdrive);
+ g_object_unref (vfsdrive);
for (iter = volumes; iter; iter = iter->next) {
- GnomeVFSVolume *volume;
+ GVolume *volume;
+ GMount *mount;
+ GFile *root;
volume = iter->data;
- mount_point = gnome_vfs_volume_get_activation_uri (volume);
+
+ mount = g_volume_get_mount (volume);
+ if (!mount)
+ continue;
+
+ root = g_mount_get_root (mount);
+ g_object_unref (mount);
+
+ mount_point = g_file_get_uri (root);
+ g_object_unref (root);
+
if (mount_point)
break;
}
+ g_list_foreach (volumes, (GFunc) g_object_unref, NULL);
+ g_list_free (volumes);
if (!mount_point || strncmp (mount_point, "file://", 7)) {
/* mount point won't be usable */
@@ -431,7 +451,7 @@
else {
gchar *tmp;
- local_path = gnome_vfs_get_local_path_from_uri (mount_point);
+ local_path = g_filename_from_uri (mount_point, NULL, NULL);
tmp = local_path;
local_path = g_strdup (local_path);
g_free (tmp);
@@ -439,8 +459,6 @@
g_free (mount_point);
}
- gnome_vfs_drive_volume_list_free (volumes);
-
return local_path;
}
Modified: trunk/src/brasero-player-bacon.c
==============================================================================
--- trunk/src/brasero-player-bacon.c (original)
+++ trunk/src/brasero-player-bacon.c Mon Feb 25 14:12:43 2008
@@ -37,8 +37,6 @@
#include <gconf/gconf-client.h>
-#include <libgnomevfs/gnome-vfs.h>
-
#include <gst/gst.h>
#include <gst/interfaces/xoverlay.h>
Modified: trunk/src/brasero-player.c
==============================================================================
--- trunk/src/brasero-player.c (original)
+++ trunk/src/brasero-player.c Mon Feb 25 14:12:43 2008
@@ -50,7 +50,7 @@
#include "brasero-player-bacon.h"
#include "brasero-utils.h"
#include "brasero-metadata.h"
-#include "brasero-vfs.h"
+#include "brasero-io.h"
#include "burn-debug.h"
G_DEFINE_TYPE (BraseroPlayer, brasero_player, GTK_TYPE_ALIGNMENT);
@@ -86,8 +86,8 @@
BraseroPlayerBaconState state;
- BraseroVFS *vfs;
- BraseroVFSDataID meta_task;
+ BraseroIO *io;
+ BraseroIOJobBase *meta_task;
gchar *uri;
gint64 start;
@@ -745,7 +745,7 @@
/* image */
/* FIXME: this does not allow to preview remote files */
- path = gnome_vfs_get_local_path_from_uri (player->priv->uri);
+ path = g_filename_from_uri (player->priv->uri, NULL, NULL);
player->priv->pixbuf = gdk_pixbuf_new_from_file (path, &error);
if (!player->priv->pixbuf) {
@@ -841,12 +841,10 @@
}
static void
-brasero_player_metadata_completed (BraseroVFS *vfs,
- GObject *obj,
- GnomeVFSResult result,
+brasero_player_metadata_completed (GObject *obj,
+ GError *error,
const gchar *uri,
- GnomeVFSFileInfo *info,
- BraseroMetadataInfo *metadata,
+ GFileInfo *info,
gpointer null_data)
{
BraseroPlayer *player = BRASERO_PLAYER (obj);
@@ -860,7 +858,7 @@
if (player->priv->controls)
brasero_player_destroy_controls (player);
- if (result != GNOME_VFS_OK) {
+ if (error) {
brasero_player_no_multimedia_stream (player);
g_signal_emit (player,
brasero_player_signals [ERROR_SIGNAL],
@@ -869,12 +867,12 @@
}
/* based on the mime type, we try to determine the type of file */
- if (metadata && metadata->has_video) {
+ if (g_file_info_get_attribute_boolean (info, BRASERO_IO_HAS_VIDEO)) {
/* video */
brasero_player_create_controls_stream (player, TRUE);
gtk_range_set_value (GTK_RANGE (player->priv->progress), 0.0);
- if (metadata->is_seekable)
+ if (g_file_info_get_attribute_boolean (info, BRASERO_IO_IS_SEEKABLE))
gtk_widget_set_sensitive (player->priv->progress, TRUE);
else
gtk_widget_set_sensitive (player->priv->progress, FALSE);
@@ -883,18 +881,18 @@
gtk_widget_hide (player->priv->image_display);
gtk_widget_show (player->priv->notebook);
}
- else if (metadata && metadata->has_audio) {
+ else if (g_file_info_get_attribute_boolean (info, BRASERO_IO_HAS_AUDIO)) {
/* audio */
brasero_player_create_controls_stream (player, FALSE);
gtk_widget_hide (player->priv->notebook);
gtk_range_set_value (GTK_RANGE (player->priv->progress), 0.0);
- if (metadata->is_seekable)
+ if (g_file_info_get_attribute_boolean (info, BRASERO_IO_IS_SEEKABLE))
gtk_widget_set_sensitive (player->priv->progress, TRUE);
else
gtk_widget_set_sensitive (player->priv->progress, FALSE);
}
- else if (info && info->mime_type && !strncmp ("image/", info->mime_type, 6)) {
+ else if (!strncmp ("image/", g_file_info_get_content_type (info), 6)) {
brasero_player_image (player);
return;
}
@@ -907,14 +905,14 @@
}
if (player->priv->end <= 0)
- player->priv->end = metadata->len;
+ player->priv->end = g_file_info_get_attribute_uint64 (info, BRASERO_IO_LEN);
- player->priv->length = metadata->len;
+ player->priv->length = g_file_info_get_attribute_uint64 (info, BRASERO_IO_LEN);
/* only reached for audio/video */
brasero_player_update_info_real (player,
- metadata->artist,
- metadata->title);
+ g_file_info_get_attribute_string (info, BRASERO_IO_ARTIST),
+ g_file_info_get_attribute_string (info, BRASERO_IO_TITLE));
player->priv->state = BACON_STATE_READY;
g_signal_emit (player,
@@ -925,26 +923,21 @@
static void
brasero_player_retrieve_metadata (BraseroPlayer *player)
{
- GList *uris;
-
- if (!player->priv->vfs)
- player->priv->vfs = brasero_vfs_get_default ();
+ if (!player->priv->io)
+ player->priv->io = brasero_io_get_default ();
if (!player->priv->meta_task)
- player->priv->meta_task = brasero_vfs_register_data_type (player->priv->vfs,
- G_OBJECT (player),
- G_CALLBACK (brasero_player_metadata_completed),
- NULL);
-
- uris = g_list_prepend (NULL, player->priv->uri);
- brasero_vfs_get_metadata (player->priv->vfs,
- uris,
- GNOME_VFS_FILE_INFO_FOLLOW_LINKS,
- BRASERO_METADATA_FLAG_NONE,
- FALSE,
+ player->priv->meta_task = brasero_io_register (G_OBJECT (player),
+ brasero_player_metadata_completed,
+ NULL,
+ NULL);
+
+ brasero_io_get_file_info (player->priv->io,
+ player->priv->uri,
player->priv->meta_task,
+ BRASERO_IO_INFO_METADATA|
+ BRASERO_IO_INFO_MIME,
NULL);
- g_list_free (uris);
}
const gchar *
@@ -983,7 +976,6 @@
brasero_player_set_uri (BraseroPlayer *player,
const gchar *uri)
{
- gchar *song_uri;
gchar *name;
/* avoid reloading everything if it's the same uri */
@@ -1015,8 +1007,9 @@
player->priv->start = 0;
player->priv->end = 0;
- if (player->priv->vfs)
- brasero_vfs_cancel (player->priv->vfs, player);
+ if (player->priv->io)
+ brasero_io_cancel_by_base (player->priv->io,
+ player->priv->meta_task);
/* That stops the pipeline from playing */
brasero_player_bacon_set_uri (BRASERO_PLAYER_BACON (player->priv->bacon), NULL);
@@ -1029,12 +1022,15 @@
if (player->priv->controls) {
if (player->priv->header) {
+ gchar *song_uri;
+
BRASERO_GET_BASENAME_FOR_DISPLAY (uri, name);
song_uri = g_markup_printf_escaped (_("<span weight=\"bold\">Loading information</span>\nabout <span size=\"smaller\"><i>%s</i></span>"),
name);
g_free (name);
gtk_label_set_markup (GTK_LABEL (player->priv->header), song_uri);
+ g_free (song_uri);
}
/* grey out the rest of the control while it's loading */
@@ -1213,13 +1209,15 @@
}
if (player->priv->meta_task){
- brasero_vfs_cancel (player->priv->vfs, player);
+ brasero_io_cancel_by_base (player->priv->io,
+ player->priv->meta_task);
+ g_free (player->priv->meta_task);
player->priv->meta_task = 0;
}
- if (player->priv->vfs) {
- g_object_unref (player->priv->vfs);
- player->priv->vfs = NULL;
+ if (player->priv->io) {
+ g_object_unref (player->priv->io);
+ player->priv->io = NULL;
}
if (GTK_OBJECT_CLASS (parent_class)->destroy)
Modified: trunk/src/brasero-playlist.c
==============================================================================
--- trunk/src/brasero-playlist.c (original)
+++ trunk/src/brasero-playlist.c Mon Feb 25 14:12:43 2008
@@ -35,6 +35,8 @@
#include <glib/gi18n-lib.h>
#include <glib-object.h>
+#include <gio/gio.h>
+
#include <gtk/gtkwidget.h>
#include <gtk/gtkvbox.h>
#include <gtk/gtkhbox.h>
@@ -52,8 +54,6 @@
#include <gtk/gtkscrolledwindow.h>
#include <gtk/gtkmessagedialog.h>
-#include <libgnomevfs/gnome-vfs.h>
-
#ifdef BUILD_SEARCH
#include <beagle/beagle.h>
#endif
@@ -63,7 +63,7 @@
#include "brasero-playlist.h"
#include "brasero-utils.h"
#include "brasero-metadata.h"
-#include "brasero-vfs.h"
+#include "brasero-io.h"
#include "eggtreemultidnd.h"
#include "brasero-uri-container.h"
@@ -89,8 +89,8 @@
GtkWidget *button_remove;
guint activity_counter;
- BraseroVFS *vfs;
- BraseroVFSDataID parse_type;
+ BraseroIO *io;
+ BraseroIOJobBase *parse_type;
gint searched:1;
};
@@ -262,7 +262,7 @@
obj->priv = g_new0 (BraseroPlaylistPrivate, 1);
gtk_box_set_spacing (GTK_BOX (obj), BRASERO_PLAYLIST_SPACING);
- obj->priv->vfs = brasero_vfs_get_default ();
+ obj->priv->io = brasero_io_get_default ();
hbox = gtk_hbox_new (FALSE, 8);
gtk_widget_show (hbox);
@@ -446,10 +446,15 @@
/* NOTE: we must do it here since cancel could call brasero_playlist_end
* itself calling decrease_activity_counter. In finalize the latter will
* raise problems since the GdkWindow has been destroyed */
- if (playlist->priv->vfs) {
- brasero_vfs_cancel (playlist->priv->vfs, playlist);
- g_object_unref (playlist->priv->vfs);
- playlist->priv->vfs = NULL;
+ if (playlist->priv->io) {
+ brasero_io_cancel_by_base (playlist->priv->io,
+ playlist->priv->parse_type);
+
+ g_free (playlist->priv->parse_type);
+ playlist->priv->parse_type = NULL;
+
+ g_object_unref (playlist->priv->io);
+ playlist->priv->io = NULL;
}
if (GTK_OBJECT_CLASS (parent_class)->destroy)
@@ -809,8 +814,8 @@
static void
brasero_playlist_parse_end (GObject *object,
- gpointer callback_data,
- gboolean cancelled)
+ gboolean cancelled,
+ gpointer callback_data)
{
BraseroPlaylistParseData *data = callback_data;
BraseroPlaylist *playlist = BRASERO_PLAYLIST (object);
@@ -822,20 +827,20 @@
}
static void
-brasero_playlist_parse_result (BraseroVFS *vfs,
- GObject *object,
- GnomeVFSResult result,
+brasero_playlist_parse_result (GObject *object,
+ GError *error,
const gchar *uri,
- GnomeVFSFileInfo *info,
- BraseroMetadataInfo *metadata,
+ GFileInfo *info,
gpointer callback_data)
{
gint num;
+ gboolean has_audio;
gint64 total_length;
GtkTreeModel *model;
GtkTreePath *treepath;
GtkTreeIter parent, row;
gchar *len_string, *num_string;
+ const gchar *playlist_title = NULL;
BraseroPlaylistParseData *data = callback_data;
BraseroPlaylist *playlist = BRASERO_PLAYLIST (object);
@@ -844,13 +849,14 @@
gtk_tree_model_get_iter (model, &parent, treepath);
gtk_tree_path_free (treepath);
- if (!data->title) {
+ playlist_title = g_file_info_get_attribute_string (info, BRASERO_IO_PLAYLIST_TITLE);
+ if (playlist_title) {
/* The first entry returned is always the playlist as a whole:
* if it was successfully parsed uri is the title if any. If not
* it's simply the URI */
/* this is for the playlist as a whole */
- if (result != GNOME_VFS_OK) {
+ if (error) {
if (!data->quiet)
brasero_playlist_dialog_error (playlist, uri);
@@ -866,26 +872,37 @@
}
/* See if the song can be added */
- if (result == GNOME_VFS_OK && metadata && metadata->has_audio) {
+ has_audio = g_file_info_get_attribute_boolean (info, BRASERO_IO_HAS_AUDIO);
+ if (!error && has_audio) {
gchar *name;
+ guint64 len;
+ const gchar *title;
+ const gchar *genre;
gtk_tree_store_append (GTK_TREE_STORE (model), &row, &parent);
- if (metadata->len > 0)
- len_string = brasero_utils_get_time_string (metadata->len, TRUE, FALSE);
+ len = g_file_info_get_attribute_uint64 (info, BRASERO_IO_LEN);
+ title = g_file_info_get_attribute_string (info, BRASERO_IO_TITLE);
+ genre = g_file_info_get_attribute_string (info, BRASERO_IO_GENRE);
+
+ if (len > 0)
+ len_string = brasero_utils_get_time_string (len, TRUE, FALSE);
else
len_string = NULL;
BRASERO_GET_BASENAME_FOR_DISPLAY (uri, name);
gtk_tree_store_set (GTK_TREE_STORE (model), &row,
- BRASERO_PLAYLIST_DISPLAY_COL, metadata->title ? metadata->title : name,
+ BRASERO_PLAYLIST_DISPLAY_COL, title ? title : name,
BRASERO_PLAYLIST_LEN_COL, len_string,
- BRASERO_PLAYLIST_GENRE_COL, metadata->genre,
- BRASERO_PLAYLIST_URI_COL, metadata->uri,
- BRASERO_PLAYLIST_DSIZE_COL, metadata->len,
+ BRASERO_PLAYLIST_GENRE_COL, genre,
+ BRASERO_PLAYLIST_URI_COL, uri,
+ BRASERO_PLAYLIST_DSIZE_COL, len,
-1);
g_free (name);
g_free (len_string);
+
+ if (len)
+ total_length += len;
}
/* update the playlist information */
@@ -900,9 +917,6 @@
BRASERO_PLAYLIST_DSIZE_COL, &total_length,
-1);
- if (metadata)
- total_length += metadata->len;
-
if (total_length > 0)
len_string = brasero_utils_get_time_string (total_length, TRUE, FALSE);
else
@@ -949,45 +963,24 @@
const gchar *uri,
gboolean quiet)
{
- gboolean success;
BraseroPlaylistParseData *data;
data = g_new0 (BraseroPlaylistParseData, 1);
data->reference = brasero_playlist_insert (playlist, uri);
if (!playlist->priv->parse_type)
- playlist->priv->parse_type = brasero_vfs_register_data_type (playlist->priv->vfs,
- G_OBJECT (playlist),
- G_CALLBACK (brasero_playlist_parse_result),
- brasero_playlist_parse_end);
-
- success = brasero_vfs_parse_playlist (playlist->priv->vfs,
- uri,
- GNOME_VFS_FILE_INFO_GET_ACCESS_RIGHTS |
- GNOME_VFS_FILE_INFO_GET_MIME_TYPE |
- GNOME_VFS_FILE_INFO_FORCE_SLOW_MIME_TYPE,
- playlist->priv->parse_type,
- data);
-
- if (!success) {
- GtkTreePath *treepath;
- GtkTreeModel *model;
- GtkTreeIter iter;
-
- /* failure: remove entry and warn user */
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (playlist->priv->tree));
- treepath = gtk_tree_row_reference_get_path (data->reference);
- gtk_tree_model_get_iter (model, &iter, treepath);
- gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
- gtk_tree_path_free (treepath);
-
- if (!quiet)
- brasero_playlist_dialog_error (playlist, uri);
- }
- else {
- data->quiet = quiet;
- brasero_playlist_increase_activity_counter (playlist);
- }
+ playlist->priv->parse_type = brasero_io_register (G_OBJECT (playlist),
+ brasero_playlist_parse_result,
+ brasero_playlist_parse_end,
+ NULL);
+
+ brasero_io_parse_playlist (playlist->priv->io,
+ uri,
+ playlist->priv->parse_type,
+ BRASERO_IO_INFO_PERM|
+ BRASERO_IO_INFO_MIME,
+ data);
+ brasero_playlist_increase_activity_counter (playlist);
}
static void
Modified: trunk/src/brasero-project-manager.c
==============================================================================
--- trunk/src/brasero-project-manager.c (original)
+++ trunk/src/brasero-project-manager.c Mon Feb 25 14:12:43 2008
@@ -43,10 +43,6 @@
#include <gtk/gtkuimanager.h>
#include <gtk/gtkscrolledwindow.h>
-#include <libgnomevfs/gnome-vfs.h>
-#include <libgnomevfs/gnome-vfs-file-info.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
-
#include "brasero-utils.h"
#include "brasero-project.h"
#include "brasero-layout.h"
@@ -57,7 +53,7 @@
#include "brasero-burn-dialog.h"
#include "brasero-project-type-chooser.h"
#include "brasero-disc-copy-dialog.h"
-#include "brasero-vfs.h"
+#include "brasero-io.h"
#include "burn-caps.h"
#ifdef BUILD_SEARCH
@@ -150,9 +146,9 @@
};
struct BraseroProjectManagerPrivate {
- BraseroVFS *vfs;
+ BraseroIO *io;
BraseroProjectType type;
- BraseroVFSDataID size_preview;
+ BraseroIOJobBase *size_preview;
GtkWidget *project;
GtkWidget *layout;
@@ -199,27 +195,25 @@
}
static void
-brasero_project_manager_size_preview (BraseroVFS *vfs,
- GObject *object,
- gint files_num,
- gint invalid_num,
- gint64 files_size,
- gpointer user_data)
+brasero_project_manager_set_statusbar (BraseroProjectManager *manager,
+ guint64 files_size,
+ gint invalid_num,
+ gint files_num)
{
- BraseroProjectManager *manager = BRASERO_PROJECT_MANAGER (object);
- gint valid_num = files_num - invalid_num;
- gchar *status_string = NULL;
+ gchar *status_string = NULL;
+ gint valid_num;
gtk_statusbar_pop (GTK_STATUSBAR (manager->priv->status),
manager->priv->status_ctx);
+ valid_num = files_num - invalid_num;
if (!invalid_num && valid_num) {
gchar *size_string;
if (manager->priv->type == BRASERO_PROJECT_TYPE_AUDIO)
size_string = brasero_utils_get_time_string (files_size, TRUE, FALSE);
else if (manager->priv->type == BRASERO_PROJECT_TYPE_DATA)
- size_string = gnome_vfs_format_file_size_for_display (files_size);
+ size_string = g_format_size_for_display (files_size);
else
return;
@@ -238,7 +232,7 @@
size_string);
}
else if (manager->priv->type == BRASERO_PROJECT_TYPE_DATA) {
- size_string = gnome_vfs_format_file_size_for_display (files_size);
+ size_string = g_format_size_for_display (files_size);
status_string = g_strdup_printf (ngettext ("%d file can be added (%s)", "%d selected files can be added (%s)", valid_num),
valid_num,
size_string);
@@ -269,17 +263,57 @@
g_free (status_string);
}
+static void
+brasero_project_manager_size_preview (GObject *object,
+ GError *error,
+ const gchar *uri,
+ GFileInfo *info,
+ gpointer user_data)
+{
+ BraseroProjectManager *manager = BRASERO_PROJECT_MANAGER (object);
+ guint64 files_size;
+ gint invalid_num;
+ gint files_num;
+
+ invalid_num = g_file_info_get_attribute_uint32 (info, BRASERO_IO_COUNT_INVALID);
+ files_size = g_file_info_get_attribute_uint64 (info, BRASERO_IO_COUNT_SIZE);
+ files_num = g_file_info_get_attribute_uint32 (info, BRASERO_IO_COUNT_NUM);
+ brasero_project_manager_set_statusbar (manager,
+ files_size,
+ invalid_num,
+ files_num);
+}
+
+static void
+brasero_project_manager_size_preview_progress (GObject *object,
+ BraseroIOJobProgress *progress,
+ gpointer user_data)
+{
+ BraseroProjectManager *manager = BRASERO_PROJECT_MANAGER (object);
+ guint64 files_size;
+ gint files_num;
+
+ files_size = brasero_io_job_progress_get_total (progress);
+ files_num = brasero_io_job_progress_get_file_processed (progress);
+ brasero_project_manager_set_statusbar (manager,
+ files_size,
+ 0,
+ files_num);
+}
+
void
brasero_project_manager_selected_uris_changed (BraseroURIContainer *container,
BraseroProjectManager *manager)
{
+ BraseroIOFlags flags;
gchar **uris, **iter;
- GList *list = NULL;
+ GSList *list = NULL;
/* if we are in the middle of an unfinished size seek then
* cancel it and re-initialize */
- if (manager->priv->vfs)
- brasero_vfs_cancel (manager->priv->vfs, manager);
+ if (manager->priv->io)
+ brasero_io_cancel_by_base (manager->priv->io,
+ manager->priv->size_preview);
uris = brasero_uri_container_get_selected_uris (container);
if (!uris) {
@@ -291,24 +325,29 @@
return;
}
- for (iter = uris; iter && *iter; iter ++)
- list = g_list_prepend (list, *iter);
-
- if (!manager->priv->vfs)
- manager->priv->vfs = brasero_vfs_get_default ();
+ if (!manager->priv->io)
+ manager->priv->io = brasero_io_get_default ();
if (!manager->priv->size_preview)
- manager->priv->size_preview = brasero_vfs_register_data_type (manager->priv->vfs,
- G_OBJECT (manager),
- G_CALLBACK (brasero_project_manager_size_preview),
- NULL);
- brasero_vfs_get_count (manager->priv->vfs,
- list,
- (manager->priv->type == BRASERO_PROJECT_TYPE_AUDIO),
- manager->priv->size_preview,
- NULL);
+ manager->priv->size_preview = brasero_io_register (G_OBJECT (manager),
+ brasero_project_manager_size_preview,
+ NULL,
+ brasero_project_manager_size_preview_progress);
+
+ for (iter = uris; iter && *iter; iter ++)
+ list = g_slist_prepend (list, *iter);
+
+ flags = BRASERO_IO_INFO_RECURSIVE|BRASERO_IO_INFO_IDLE;
+ if (manager->priv->type == BRASERO_PROJECT_TYPE_AUDIO)
+ flags |= BRASERO_IO_INFO_METADATA;
+
+ brasero_io_get_file_count (manager->priv->io,
+ list,
+ manager->priv->size_preview,
+ flags,
+ NULL);
- g_list_free (list);
+ g_slist_free (list);
g_strfreev (uris);
}
void
@@ -669,9 +708,8 @@
gchar *uri;
BraseroProjectType type;
- uri = gnome_vfs_make_uri_from_input (path);
- type = brasero_project_load_session (BRASERO_PROJECT (manager->priv->project),
- uri);
+ uri = g_filename_to_uri (path, NULL, NULL);
+ type = brasero_project_load_session (BRASERO_PROJECT (manager->priv->project), uri);
g_free (uri);
brasero_project_manager_switch (manager, type, NULL, NULL, FALSE);
@@ -693,7 +731,7 @@
/* if we want to save the current open project, this need a
* modification in BraseroProject to bypass ask_status in case
* DataDisc has not finished exploration */
- uri = gnome_vfs_make_uri_from_input (path);
+ uri = g_filename_to_uri (path, NULL, NULL);
result = brasero_project_save_session (BRASERO_PROJECT (manager->priv->project),
uri,
cancellable);
@@ -845,10 +883,14 @@
cobj = BRASERO_PROJECT_MANAGER (object);
- if (cobj->priv->vfs) {
- brasero_vfs_cancel (cobj->priv->vfs, object);
- g_object_unref (cobj->priv->vfs);
- cobj->priv->vfs = NULL;
+ if (cobj->priv->io) {
+ brasero_io_cancel_by_base (cobj->priv->io, cobj->priv->size_preview);
+
+ g_free (cobj->priv->size_preview);
+ cobj->priv->size_preview = NULL;
+
+ g_object_unref (cobj->priv->io);
+ cobj->priv->io = NULL;
}
g_free (cobj->priv);
Modified: trunk/src/brasero-project.c
==============================================================================
--- trunk/src/brasero-project.c (original)
+++ trunk/src/brasero-project.c Mon Feb 25 14:12:43 2008
@@ -49,9 +49,6 @@
#include <libxml/xmlstring.h>
#include <libxml/uri.h>
-#include <libgnomevfs/gnome-vfs.h>
-#include <libgnomevfs/gnome-vfs-file-info.h>
-
#include <gconf/gconf-client.h>
#include "burn-debug.h"
@@ -1894,7 +1891,7 @@
gboolean retval;
gchar *path;
- path = gnome_vfs_get_local_path_from_uri (uri);
+ path = g_filename_from_uri (uri, NULL, NULL);
if (!path)
return FALSE;
@@ -2268,7 +2265,7 @@
gint success;
gchar *path;
- path = gnome_vfs_get_local_path_from_uri (uri);
+ path = g_filename_from_uri (uri, NULL, NULL);
if (!path)
return FALSE;
Modified: trunk/src/brasero-search-beagle.c
==============================================================================
--- trunk/src/brasero-search-beagle.c (original)
+++ trunk/src/brasero-search-beagle.c Mon Feb 25 14:12:43 2008
@@ -36,6 +36,8 @@
#include <glib/gutils.h>
#include <glib-object.h>
+#include <gio/gio.h>
+
#include <gtk/gtkvbox.h>
#include <gtk/gtkfilefilter.h>
#include <gtk/gtkselection.h>
@@ -57,10 +59,6 @@
#include <gtk/gtkdialog.h>
#include <gtk/gtkmessagedialog.h>
-#include <libgnomeui/libgnomeui.h>
-
-#include <libgnomevfs/gnome-vfs-mime-handlers.h>
-
#include <beagle/beagle.h>
#include "brasero-utils.h"
Modified: trunk/src/brasero-sum-dialog.c
==============================================================================
--- trunk/src/brasero-sum-dialog.c (original)
+++ trunk/src/brasero-sum-dialog.c Mon Feb 25 14:12:43 2008
@@ -49,7 +49,6 @@
#include <gtk/gtkdialog.h>
#include <gtk/gtkmessagedialog.h>
-#include <libgnomevfs/gnome-vfs.h>
#include <nautilus-burn-drive.h>
#include "brasero-sum-dialog.h"
@@ -291,14 +290,12 @@
static BraseroBurnResult
brasero_sum_dialog_download (BraseroSumDialog *self,
- GnomeVFSURI *vfsuri,
+ const gchar *src,
gchar **retval,
GError **error)
{
BraseroBurnResult result;
- GnomeVFSURI *tmpuri;
gchar *tmppath;
- gchar *uri;
gint id;
int fd;
@@ -316,21 +313,6 @@
}
close (fd);
- uri = gnome_vfs_get_uri_from_local_path (tmppath);
- if (!uri) {
- g_remove (tmppath);
- g_free (tmppath);
-
- g_set_error (error,
- BRASERO_BURN_ERROR,
- BRASERO_BURN_ERROR_GENERAL,
- _("URI is not valid"));
- return BRASERO_BURN_ERR;
- }
-
- tmpuri = gnome_vfs_uri_new (uri);
- g_free (uri);
-
brasero_tool_dialog_set_action (BRASERO_TOOL_DIALOG (self),
BRASERO_BURN_ACTION_FILE_COPY,
_("Downloading md5 file"));
@@ -341,12 +323,10 @@
self->priv->xfer_ctx = brasero_xfer_new ();
result = brasero_xfer (self->priv->xfer_ctx,
- vfsuri,
- tmpuri,
+ src,
+ tmppath,
error);
- gnome_vfs_uri_unref (tmpuri);
-
g_source_remove (id);
brasero_xfer_free (self->priv->xfer_ctx);
self->priv->xfer_ctx = NULL;
@@ -368,17 +348,18 @@
GError **error)
{
BraseroBurnResult result;
- GnomeVFSURI *vfsuri;
gchar buffer [33];
+ GFile *file_src;
gchar *tmppath;
+ gchar *scheme;
gchar *uri;
gchar *src;
FILE *file;
int read;
/* see if this file needs downloading */
- uri = gnome_vfs_make_uri_from_input (file_path);
- if (!uri) {
+ file_src = g_file_new_for_commandline_arg (file_path);
+ if (!file_src) {
g_set_error (error,
BRASERO_BURN_ERROR,
BRASERO_BURN_ERROR_GENERAL,
@@ -387,27 +368,28 @@
}
tmppath = NULL;
- vfsuri = gnome_vfs_uri_new (uri);
- if (!gnome_vfs_uri_is_local (vfsuri)) {
- g_free (uri);
+ scheme = g_file_get_uri_scheme (file_src);
+ if (strcmp (scheme, "file")) {
+ uri = g_file_get_uri (file_src);
+ g_object_unref (file_src);
result = brasero_sum_dialog_download (self,
- vfsuri,
+ uri,
&tmppath,
error);
- gnome_vfs_uri_unref (vfsuri);
-
- if (result != BRASERO_BURN_CANCEL)
+ if (result != BRASERO_BURN_CANCEL) {
+ g_object_unref (file_src);
+ g_free (scheme);
return result;
+ }
src = tmppath;
}
else {
- src = gnome_vfs_get_local_path_from_uri (uri);
- g_free (uri);
-
- gnome_vfs_uri_unref (vfsuri);
+ src = g_file_get_path (file_src);
+ g_object_unref (file);
}
+ g_free (scheme);
/* now get the md5 sum from the file */
file = fopen (src, "r");
Modified: trunk/src/brasero-utils.c
==============================================================================
--- trunk/src/brasero-utils.c (original)
+++ trunk/src/brasero-utils.c Mon Feb 25 14:12:43 2008
@@ -38,10 +38,6 @@
#include <libgnomeui/libgnomeui.h>
-#include <libgnomevfs/gnome-vfs.h>
-#include <libgnomevfs/gnome-vfs-file-info.h>
-#include <libgnomevfs/gnome-vfs-mime-handlers.h>
-
#include <nautilus-burn-drive.h>
#include <gst/gst.h>
@@ -498,106 +494,6 @@
return button;
}
-static gboolean
-brasero_utils_empty_dir (const gchar *uri, GnomeVFSFileInfo * info)
-{
- GnomeVFSDirectoryHandle *handle;
- gchar *file_uri, *name;
-
- /* NOTE : we don't follow uris as certain files are linked by content-data */
- if (gnome_vfs_directory_open
- (&handle, uri, GNOME_VFS_FILE_INFO_DEFAULT) != GNOME_VFS_OK) {
- g_warning ("Can't open directory %s\n", uri);
- return FALSE;
- }
- gnome_vfs_file_info_clear (info);
- while (gnome_vfs_directory_read_next (handle, info) ==
- GNOME_VFS_OK) {
- if (!strcmp (info->name, "..")
- || *info->name == '.')
- continue;
-
- name = gnome_vfs_escape_string (info->name);
- file_uri = g_strconcat (uri, "/", name, NULL);
- g_free (name);
-
- if (info->type == GNOME_VFS_FILE_TYPE_DIRECTORY) {
- brasero_utils_empty_dir (file_uri, info);
- g_free (file_uri);
- } else if (gnome_vfs_unlink (file_uri) != GNOME_VFS_OK)
- g_warning ("Cannot remove file %s\n", file_uri);
-
- gnome_vfs_file_info_clear (info);
- }
- gnome_vfs_directory_close (handle);
- if (gnome_vfs_remove_directory (uri) != GNOME_VFS_OK) {
- g_warning ("Cannot remove directory %s\n", uri);
- return FALSE;
- }
-
- return TRUE;
-}
-
-gboolean
-brasero_utils_remove (const gchar *uri)
-{
- GnomeVFSFileInfo *info;
- gboolean result = TRUE;
-
- if (!uri)
- return TRUE;
-
- info = gnome_vfs_file_info_new ();
- /* NOTE : we don't follow uris as certain files are simply linked by content-data */
- gnome_vfs_get_file_info (uri, info, GNOME_VFS_FILE_INFO_DEFAULT);
-
- if (info->type == GNOME_VFS_FILE_TYPE_DIRECTORY)
- result = brasero_utils_empty_dir (uri, info);
- else if (gnome_vfs_unlink (uri) != GNOME_VFS_OK) {
- g_warning ("Cannot remove file %s\n", uri);
- result = FALSE;
- }
-
- gnome_vfs_file_info_clear (info);
- gnome_vfs_file_info_unref (info);
-
- return result;
-}
-
-gchar *
-brasero_utils_escape_string (const gchar *text)
-{
- gchar *ptr, *result;
- gint len = 1;
-
- ptr = (gchar *) text;
- while (*ptr != '\0') {
- if (*ptr == '\\' || *ptr == '=')
- len++;
-
- len++;
- ptr++;
- }
-
- result = g_new (gchar, len);
-
- ptr = result;
- while (*text != '\0') {
- if (*text == '\\' || *text == '=') {
- *ptr = '\\';
- ptr++;
- }
-
- *ptr = *text;
- ptr++;
- text++;
- }
-
- *ptr = '\0';
-
- return result;
-}
-
/* Copied from glib-2.8.3 (glib.c) but slightly
* modified to use only the first 64 bytes */
gboolean
@@ -631,24 +527,16 @@
brasero_utils_launch_app (GtkWidget *widget,
GSList *list)
{
- gchar *uri;
- gchar *mime;
- GList *uris;
GSList *item;
- GnomeVFSResult result;
- GnomeVFSMimeApplication *application;
for (item = list; item; item = item->next) {
- uri = item->data;
-
- mime = gnome_vfs_get_mime_type (uri);
- if (!mime)
- continue;
+ GError *error;
+ gchar *uri;
- application = gnome_vfs_mime_get_default_application (mime);
- g_free (mime);
+ error = NULL;
+ uri = item->data;
- if (!application) {
+ if (!g_app_info_launch_default_for_uri (uri, NULL, &error)) {
GtkWidget *dialog;
GtkWidget *toplevel;
@@ -663,40 +551,14 @@
gtk_window_set_title (GTK_WINDOW (dialog), _("File error"));
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
- _("there is no application defined for this file."));
+ error->message);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
- continue;
- }
-
- uris = g_list_prepend (NULL, uri);
- result = gnome_vfs_mime_application_launch (application, uris);
- g_list_free (uris);
-
- if (result != GNOME_VFS_OK) {
- GtkWidget *dialog;
- GtkWidget *toplevel;
-
- toplevel = gtk_widget_get_toplevel (GTK_WIDGET (widget));
- dialog = gtk_message_dialog_new (GTK_WINDOW (toplevel),
- GTK_DIALOG_DESTROY_WITH_PARENT |
- GTK_DIALOG_MODAL,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_CLOSE,
- _("File can't be opened:"));
- gtk_window_set_title (GTK_WINDOW (dialog), _("File error"));
-
- gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
- _("application %s can't be started."),
- application->name);
-
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
+ g_error_free (error);
+ continue;
}
-
- gnome_vfs_mime_application_free (application);
}
}
Modified: trunk/src/brasero-utils.h
==============================================================================
--- trunk/src/brasero-utils.h (original)
+++ trunk/src/brasero-utils.h Mon Feb 25 14:12:43 2008
@@ -29,8 +29,6 @@
#include <glib.h>
#include <gtk/gtk.h>
-#include <libgnomevfs/gnome-vfs.h>
-
#include "burn-basics.h"
#ifndef _UTILS_H
@@ -46,7 +44,8 @@
typedef enum {
BRASERO_ERROR_NONE,
- BRASERO_ERROR_GENERAL
+ BRASERO_ERROR_GENERAL,
+ BRASERO_ERROR_SYMLINK_LOOP
} BraseroErrors;
void brasero_utils_init (void);
@@ -95,11 +94,6 @@
GtkIconSize size);
gboolean
-brasero_utils_remove (const gchar *uri);
-
-gchar *brasero_utils_escape_string (const gchar *text);
-
-gboolean
brasero_utils_str_equal_64 (gconstpointer v1,
gconstpointer v2);
Modified: trunk/src/brasero-vfs.c
==============================================================================
--- trunk/src/brasero-vfs.c (original)
+++ trunk/src/brasero-vfs.c Mon Feb 25 14:12:43 2008
@@ -31,7 +31,7 @@
#include <glib.h>
#include <glib-object.h>
-#include <libgnomevfs/gnome-vfs.h>
+#include <gio/gio.h>
#ifdef BUILD_PLAYLIST
#include <totem-pl-parser.h>
@@ -135,14 +135,14 @@
#endif
struct _BraseroInfoResult {
- GnomeVFSFileInfo *info;
- GnomeVFSResult result;
+ GFileInfo *info;
+ GError *error;
gchar *uri;
};
typedef struct _BraseroInfoResult BraseroInfoResult;
struct _BraseroMetadataResult {
- GnomeVFSFileInfo *info;
+ GFileInfo *info;
BraseroVFSMetadataTask *item;
};
typedef struct _BraseroMetadataResult BraseroMetadataResult;
@@ -313,34 +313,38 @@
static gchar *
brasero_vfs_check_for_parent_symlink (const gchar *escaped_uri)
{
- GnomeVFSFileInfo *info;
- GnomeVFSURI *parent;
+ GFileInfo *info;
+ GFile *parent;
gchar *uri;
- parent = gnome_vfs_uri_new (escaped_uri);
- info = gnome_vfs_file_info_new ();
- uri = gnome_vfs_uri_to_string (parent, GNOME_VFS_URI_HIDE_NONE);
-
- while (gnome_vfs_uri_has_parent (parent)) {
- GnomeVFSURI *tmp;
- GnomeVFSResult result;
-
- result = gnome_vfs_get_file_info_uri (parent,
- info,
- GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
+ parent = g_file_new_for_uri (escaped_uri);
+ uri = g_file_get_uri (parent);
+
+ while (g_file_get_parent (parent)) {
+ GFile *tmp;
+ GError *error;
+
+ error = NULL;
+ info = g_file_query_info (parent,
+ ,
+ G_FILE_QUERY_INFO_NONE,
+ NULL,
+ NULL);
- if (result != GNOME_VFS_OK)
+ if (error != GNOME_VFS_OK) {
+ g_error_free (error);
/* we shouldn't reached this point but who knows */
break;
+ }
/* NOTE: no need to check for broken symlinks since
* we wouldn't have reached this point otherwise */
- if (GNOME_VFS_FILE_INFO_SYMLINK (info)) {
+ if (g_file_info_get_is_symlink (info)) {
gchar *parent_uri;
gchar *new_root;
gchar *newuri;
- parent_uri = gnome_vfs_uri_to_string (parent, GNOME_VFS_URI_HIDE_NONE);
+ parent_uri = g_file_get_uri (parent);
new_root = gnome_vfs_make_uri_from_input (info->symlink_name);
newuri = g_strconcat (new_root,
@@ -361,7 +365,7 @@
parent = gnome_vfs_uri_get_parent (parent);
gnome_vfs_uri_unref (tmp);
- gnome_vfs_file_info_clear (info);
+ g_object_unref (info);
}
gnome_vfs_file_info_unref (info);
gnome_vfs_uri_unref (parent);
@@ -371,7 +375,7 @@
static gboolean
brasero_utils_get_symlink_target (const gchar *escaped_uri,
- GnomeVFSFileInfo *info,
+ GFileInfo *info,
GnomeVFSFileInfoOptions flags)
{
gint size;
@@ -517,8 +521,8 @@
data = BRASERO_CTX_TASK_DATA (ctx);
for (iter = data->uris; iter; iter = next) {
BraseroInfoResult *result;
- GnomeVFSFileInfo *info;
- GnomeVFSURI *vfsuri;
+ GFileInfo *info;
+ GFile *file;
gchar *uri;
if (ctx->cancelled)
@@ -548,19 +552,22 @@
result->uri = uri;
info = gnome_vfs_file_info_new ();
- vfsuri = gnome_vfs_uri_new (uri);
- result->result = gnome_vfs_get_file_info_uri (vfsuri,
- info,
- data->flags);
- gnome_vfs_uri_unref (vfsuri);
-
- if (result->result != GNOME_VFS_OK) {
- result->info = info;
+ file = g_file_new_for_uri (uri);
+ result->result = g_file_query_info (file,
+ data->flags,
+ G_FILE_QUERY_INFO_NONE,
+ NULL,
+ &error);
+ g_object_unref (file);
+
+ if (error) {
+ result->info = NULL;
+ result->error = error;
continue;
}
if (info->type == GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK) {
- gnome_vfs_file_info_clear (info);
+ g_object_unref (info);
if (!brasero_utils_get_symlink_target (uri,
info,
data->flags)) {
@@ -679,7 +686,7 @@
{
BraseroVFSTaskCtx *ctx = callback_data;
GnomeVFSDirectoryHandle *handle;
- GnomeVFSFileInfo *info;
+ GFileInfo *info;
BraseroLoadData *data;
GnomeVFSResult res;
@@ -996,7 +1003,7 @@
brasero_vfs_metadata_ctx_new (BraseroVFS *self,
BraseroVFSTaskCtx *ctx,
const gchar *uri,
- GnomeVFSFileInfo *info)
+ GFileInfo *info)
{
BraseroVFSMetadataTask *item = NULL;
BraseroMetadataResult *result;
@@ -1104,7 +1111,7 @@
GObject *owner,
GnomeVFSResult result,
const gchar *uri,
- GnomeVFSFileInfo *info,
+ GFileInfo *info,
gpointer user_data)
{
BraseroVFSTaskCtx *ctx = user_data;
@@ -1266,7 +1273,7 @@
GObject *owner,
GnomeVFSResult result,
const gchar *uri,
- GnomeVFSFileInfo *info,
+ GFileInfo *info,
BraseroMetadataInfo *metadata,
gpointer user_data)
{
@@ -1317,7 +1324,7 @@
GObject *owner,
GnomeVFSResult result,
const gchar *uri,
- GnomeVFSFileInfo *info,
+ GFileInfo *info,
gpointer user_data)
{
BraseroVFSTaskCtx *ctx = user_data;
@@ -1445,7 +1452,7 @@
GObject *object,
GnomeVFSResult result,
const gchar *uri,
- GnomeVFSFileInfo *info,
+ GFileInfo *info,
BraseroMetadataInfo *metadata,
gpointer user_data)
{
Modified: trunk/src/brasero-xfer.c
==============================================================================
--- trunk/src/brasero-xfer.c (original)
+++ trunk/src/brasero-xfer.c Mon Feb 25 14:12:43 2008
@@ -30,119 +30,94 @@
#include <glib.h>
#include <glib/gi18n-lib.h>
-
-#include <libgnomevfs/gnome-vfs.h>
+#include <gio/gio.h>
#include "brasero-xfer.h"
+#include "brasero-io.h"
#include "burn-basics.h"
#include "brasero-utils.h"
struct _BraseroXferCtx {
+ BraseroIOJobBase *base;
+
gint64 current_copy_size;
gint64 current_bytes_copied;
- GnomeVFSAsyncHandle *handle;
GMainLoop *loop;
GError *error;
+
+ gboolean cancel;
};
/* This one is for error reporting */
-static int
-brasero_xfer_async_cb (GnomeVFSAsyncHandle *handle,
- GnomeVFSXferProgressInfo *info,
- gpointer user_data)
+static void
+brasero_xfer_result_cb (GObject *object,
+ GError *error,
+ const gchar *uri,
+ GFileInfo *info,
+ gpointer callback_data)
{
- BraseroXferCtx *ctx = user_data;
-
- /* we've been cancelled */
- if (!ctx->handle)
- return FALSE;
+ BraseroXferCtx *ctx = callback_data;
- if (info->phase == GNOME_VFS_XFER_PHASE_COMPLETED) {
+ if (error) {
+ ctx->error = g_error_copy (error);
if (g_main_loop_is_running (ctx->loop))
g_main_loop_quit (ctx->loop);
-
- return FALSE;
+ return;
}
- else if (info->status != GNOME_VFS_XFER_PROGRESS_STATUS_OK) {
- ctx->error = g_error_new (BRASERO_BURN_ERROR,
- BRASERO_BURN_ERROR_GENERAL,
- gnome_vfs_result_to_string (info->vfs_status));
- return GNOME_VFS_XFER_ERROR_ACTION_ABORT;
+
+ /* we've been cancelled */
+ if (ctx->cancel) {
+ if (g_main_loop_is_running (ctx->loop))
+ g_main_loop_quit (ctx->loop);
+ return;
}
- return TRUE;
+ if (g_main_loop_is_running (ctx->loop))
+ g_main_loop_quit (ctx->loop);
}
/* This one is for progress reporting */
-static gint
-brasero_xfer_cb (GnomeVFSXferProgressInfo *info,
- gpointer user_data)
+static void
+brasero_xfer_progress_cb (GObject *object,
+ BraseroIOJobProgress *progress,
+ gpointer user_data)
{
BraseroXferCtx *ctx = user_data;
- if (!ctx->handle)
- return FALSE;
-
- if (info->file_size)
- ctx->current_copy_size = info->bytes_total;
-
- if (info->bytes_copied)
- ctx->current_bytes_copied = info->total_bytes_copied;
+ if (ctx->cancel)
+ return;
- return TRUE;
+ ctx->current_copy_size = brasero_io_job_progress_get_total (progress);
+ ctx->current_bytes_copied = brasero_io_job_progress_get_read (progress);;
}
BraseroBurnResult
brasero_xfer (BraseroXferCtx *ctx,
- GnomeVFSURI *vfsuri,
- GnomeVFSURI *tmpuri,
+ const gchar *src_uri,
+ const gchar *dest_path,
GError **error)
{
- GList *dest_list, *src_list;
- GnomeVFSResult res;
+ BraseroIO *io;
- /* download */
- dest_list = g_list_append (NULL, tmpuri);
- src_list = g_list_append (NULL, vfsuri);
+ ctx->base = brasero_io_register (NULL,
+ brasero_xfer_result_cb,
+ NULL,
+ brasero_xfer_progress_cb);
+ /* download */
bzero (ctx, sizeof (BraseroXferCtx));
- res = gnome_vfs_async_xfer (&ctx->handle,
- src_list,
- dest_list,
- GNOME_VFS_XFER_DEFAULT |
- GNOME_VFS_XFER_USE_UNIQUE_NAMES |
- GNOME_VFS_XFER_RECURSIVE,
- GNOME_VFS_XFER_ERROR_MODE_ABORT,
- GNOME_VFS_XFER_OVERWRITE_MODE_ABORT,
- GNOME_VFS_PRIORITY_DEFAULT,
- brasero_xfer_async_cb,
- ctx,
- brasero_xfer_cb,
- ctx);
-
- g_list_free (src_list);
- g_list_free (dest_list);
-
- if (res != GNOME_VFS_OK) {
- g_set_error (error,
- BRASERO_BURN_ERROR,
- BRASERO_BURN_ERROR_GENERAL,
- gnome_vfs_result_to_string (res));
- return BRASERO_BURN_ERR;
- }
+ brasero_io_xfer (io, src_uri, dest_path, ctx->base, BRASERO_IO_INFO_NONE, ctx);
ctx->loop = g_main_loop_new (NULL, FALSE);
g_main_loop_run (ctx->loop);
g_main_loop_unref (ctx->loop);
ctx->loop = NULL;
- if (!ctx->handle)
+ if (!ctx->cancel)
return BRASERO_BURN_CANCEL;
- ctx->handle = NULL;
-
if (ctx->error) {
g_propagate_error (error, ctx->error);
return BRASERO_BURN_ERR;
@@ -154,13 +129,13 @@
BraseroBurnResult
brasero_xfer_cancel (BraseroXferCtx *ctx)
{
- if (ctx->handle) {
- gnome_vfs_async_cancel (ctx->handle);
- ctx->handle = NULL;
- }
+ BraseroIO *io;
- if (ctx->loop && g_main_loop_is_running (ctx->loop))
- g_main_loop_quit (ctx->loop);
+ ctx->cancel = 1;
+
+ io = brasero_io_get_default ();
+ brasero_io_cancel_by_data (io, ctx);
+ g_object_unref (io);
return BRASERO_BURN_OK;
}
Modified: trunk/src/brasero-xfer.h
==============================================================================
--- trunk/src/brasero-xfer.h (original)
+++ trunk/src/brasero-xfer.h Mon Feb 25 14:12:43 2008
@@ -23,8 +23,7 @@
*/
#include <glib.h>
-
-#include <libgnomevfs/gnome-vfs.h>
+#include <gio/gio.h>
#include "burn-basics.h"
@@ -43,8 +42,8 @@
BraseroBurnResult
brasero_xfer (BraseroXferCtx *ctx,
- GnomeVFSURI *uri,
- GnomeVFSURI *dest,
+ const gchar *src,
+ const gchar *dest,
GError **error);
BraseroBurnResult
Modified: trunk/src/burn-basics.c
==============================================================================
--- trunk/src/burn-basics.c (original)
+++ trunk/src/burn-basics.c Mon Feb 25 14:12:43 2008
@@ -32,8 +32,6 @@
#include <glib/gi18n-lib.h>
#include <glib/gstdio.h>
-#include <libgnomevfs/gnome-vfs.h>
-
#include "burn-basics.h"
#include "burn-debug.h"
#include "burn-caps.h"
Modified: trunk/src/burn-basics.h
==============================================================================
--- trunk/src/burn-basics.h (original)
+++ trunk/src/burn-basics.h Mon Feb 25 14:12:43 2008
@@ -27,15 +27,13 @@
#include <glib.h>
-#include <libgnomevfs/gnome-vfs.h>
-
G_BEGIN_DECLS
#define BRASERO_GET_BASENAME_FOR_DISPLAY(uri, name) \
{ \
gchar *escaped_basename; \
escaped_basename = g_path_get_basename (uri); \
- name = gnome_vfs_unescape_string_for_display (escaped_basename); \
+ name = g_uri_unescape_string (escaped_basename, NULL); \
g_free (escaped_basename); \
}
Modified: trunk/src/burn-caps.c
==============================================================================
--- trunk/src/burn-caps.c (original)
+++ trunk/src/burn-caps.c Mon Feb 25 14:12:43 2008
@@ -1143,7 +1143,7 @@
g_signal_connect (job,
"error",
G_CALLBACK (brasero_burn_caps_job_error_cb),
- link);
+ caps);
if (!task
|| !(caps->flags & BRASERO_PLUGIN_IO_ACCEPT_PIPE)
Modified: trunk/src/burn-job.c
==============================================================================
--- trunk/src/burn-job.c (original)
+++ trunk/src/burn-job.c Mon Feb 25 14:12:43 2008
@@ -29,11 +29,14 @@
#include <string.h>
#include <errno.h>
#include <fcntl.h>
+#include <unistd.h>
#include <glib.h>
#include <glib-object.h>
#include <glib/gi18n-lib.h>
+#include <gio/gio.h>
+
#include "burn-basics.h"
#include "burn-debug.h"
#include "burn-session.h"
@@ -407,13 +410,12 @@
brasero_job_check_output_volume_space (BraseroJob *self,
GError **error)
{
- gchar *uri_str;
+ GFile *file;
+ GFileInfo *info;
gchar *directory;
- GnomeVFSURI *uri;
+ guint64 vol_size = 0;
gint64 output_size = 0;
BraseroJobPrivate *priv;
- GnomeVFSFileSize vol_size = 0;
- BraseroBurnResult result = BRASERO_BURN_ERR;
/* now that the job has a known output we must check that the volume the
* job is writing to has enough space for all output */
@@ -425,21 +427,24 @@
return BRASERO_BURN_ERR;
directory = g_path_get_dirname (priv->output->image);
-
- uri_str = gnome_vfs_get_uri_from_local_path (directory);
+ file = g_file_new_for_path (directory);
g_free (directory);
- uri = gnome_vfs_uri_new (uri_str);
- g_free (uri_str);
-
- if (uri == NULL)
+ if (file == NULL)
goto error;
- result = gnome_vfs_get_volume_free_space (uri, &vol_size);
- if (result != GNOME_VFS_OK)
+ info = g_file_query_info (file,
+ G_FILE_ATTRIBUTE_FILESYSTEM_FREE,
+ G_FILE_QUERY_INFO_NONE,
+ NULL,
+ error);
+ if (!info)
goto error;
- gnome_vfs_uri_unref (uri);
+ g_object_unref (file);
+
+ vol_size = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_FILESYSTEM_FREE);
+ g_object_unref (info);
/* get the size of the output this job is supposed to create */
brasero_job_get_session_output_size (BRASERO_JOB (self), NULL, &output_size);
@@ -460,12 +465,12 @@
error:
- g_set_error (error,
- BRASERO_BURN_ERROR,
- BRASERO_BURN_ERROR_GENERAL,
- _("the size of the volume can't be checked (%s)"),
- gnome_vfs_result_to_string (result));
- gnome_vfs_uri_unref (uri);
+ if (error && *error == NULL)
+ g_set_error (error,
+ BRASERO_BURN_ERROR,
+ BRASERO_BURN_ERROR_GENERAL,
+ _("the size of the volume can't be checked (Unknown error)"));
+ g_object_unref (file);
return BRASERO_BURN_ERR;
}
Modified: trunk/src/burn-mkisofs-base.c
==============================================================================
--- trunk/src/burn-mkisofs-base.c (original)
+++ trunk/src/burn-mkisofs-base.c Mon Feb 25 14:12:43 2008
@@ -32,14 +32,13 @@
#include <stdlib.h>
#include <errno.h>
#include <string.h>
+#include <unistd.h>
#include <glib.h>
#include <glib-object.h>
#include <glib/gi18n-lib.h>
#include <glib/gstdio.h>
-#include <libgnomevfs/gnome-vfs.h>
-
#include "burn-basics.h"
#include "burn-debug.h"
#include "burn-track.h"
@@ -128,7 +127,7 @@
return BRASERO_BURN_ERR;
}
- localpath = gnome_vfs_get_local_path_from_uri (uri);
+ localpath = g_filename_from_uri (uri, NULL, NULL);
/* we need to escape some characters like []\? since in this file we
* can use glob like expressions. */
@@ -224,7 +223,7 @@
/* make up the graft point */
if (*uri != '/')
- path = gnome_vfs_get_local_path_from_uri (uri);
+ path = g_filename_from_uri (uri, NULL, NULL);
else
path = g_strdup (uri);
Modified: trunk/src/burn-session.c
==============================================================================
--- trunk/src/burn-session.c (original)
+++ trunk/src/burn-session.c Mon Feb 25 14:12:43 2008
@@ -30,6 +30,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include <unistd.h>
#include <glib.h>
#include <glib-object.h>
Modified: trunk/src/burn-track.c
==============================================================================
--- trunk/src/burn-track.c (original)
+++ trunk/src/burn-track.c Mon Feb 25 14:12:43 2008
@@ -33,6 +33,8 @@
#include <glib/gstdio.h>
#include <glib/gi18n-lib.h>
+#include <gio/gio.h>
+
#include "burn-track.h"
#include "burn-debug.h"
#include "burn-medium.h"
@@ -619,6 +621,7 @@
{
gchar *localpath;
gchar *realuri;
+ GFile *file;
if (!uri)
return NULL;
@@ -629,8 +632,11 @@
if (strncmp (uri, "file://", 7))
return NULL;
- realuri = gnome_vfs_make_uri_from_input (uri);
- localpath = gnome_vfs_get_local_path_from_uri (realuri);
+ file = g_file_new_for_commandline_arg (uri);
+ realuri = g_file_get_uri (file);
+ g_object_unref (file);
+
+ localpath = g_filename_from_uri (realuri, NULL, NULL);
g_free (realuri);
return localpath;
@@ -639,13 +645,20 @@
static gchar *
brasero_track_get_uri (const gchar *uri)
{
+ gchar *uri_return;
+ GFile *file;
+
if (!uri)
return NULL;
if (uri [0] != '/')
return g_strdup (uri);
-
- return gnome_vfs_make_uri_from_input (uri);
+
+ file = g_file_new_for_commandline_arg (uri);
+ uri_return = g_file_get_uri (file);
+ g_object_unref (file);
+
+ return uri_return;
}
gchar *
Modified: trunk/src/burn-volume.c
==============================================================================
--- trunk/src/burn-volume.c (original)
+++ trunk/src/burn-volume.c Mon Feb 25 14:12:43 2008
@@ -29,6 +29,7 @@
#include <errno.h>
#include <string.h>
#include <stdio.h>
+#include <unistd.h>
#include <glib.h>
#include <glib/gi18n-lib.h>
Modified: trunk/src/burn.c
==============================================================================
--- trunk/src/burn.c (original)
+++ trunk/src/burn.c Mon Feb 25 14:12:43 2008
@@ -35,8 +35,6 @@
#include <glib/gi18n-lib.h>
#include <glib/gstdio.h>
-#include <libgnomevfs/gnome-vfs.h>
-
#include <nautilus-burn-drive.h>
#include "brasero-marshal.h"
Modified: trunk/src/main.c
==============================================================================
--- trunk/src/main.c (original)
+++ trunk/src/main.c Mon Feb 25 14:12:43 2008
@@ -31,16 +31,15 @@
#include <glib.h>
#include <glib/gi18n-lib.h>
+
+#include <gio/gio.h>
+
#include <gtk/gtk.h>
#include <gst/gst.h>
#include <libgnomeui/libgnomeui.h>
-#include <libgnomevfs/gnome-vfs.h>
-#include <libgnomevfs/gnome-vfs-mime-handlers.h>
-
-#include <nautilus-burn-recorder.h>
#include <nautilus-burn-init.h>
#include <gconf/gconf-client.h>
@@ -120,8 +119,11 @@
#define BRASERO_PROJECT_OPEN_URI(app, function, path) \
{ \
+ GFile *file; \
gchar *uri; \
- uri = gnome_vfs_make_uri_from_input (path); \
+ file = g_file_new_for_commandline_arg (path); \
+ uri = g_file_get_uri (file); \
+ g_object_unref (file); \
function (BRASERO_PROJECT_MANAGER (app->contents), uri); \
}
@@ -132,7 +134,10 @@
/* convert all names into a GSList * */ \
for (iter = uris; iter && *iter; iter ++) { \
gchar *uri; \
- uri = gnome_vfs_make_uri_from_input (*iter); \
+ GFile *file; \
+ file = g_file_new_for_commandline_arg (*iter); \
+ uri = g_file_get_uri (file); \
+ g_object_unref (file); \
list = g_slist_prepend (list, uri); \
} \
function (BRASERO_PROJECT_MANAGER (app->contents), list); \
@@ -650,9 +655,14 @@
/* in this case we can also add the files */
for (iter = files; iter && *iter; iter ++) {
+ GFile *file;
gchar *uri;
- uri = gnome_vfs_make_uri_from_input (*iter);
- list = g_slist_prepend (list, uri);
+
+ file = g_file_new_for_commandline_arg (*iter);
+ uri = g_file_get_uri (file);
+ g_object_unref (file);
+
+ list = g_slist_prepend (list, file);
}
brasero_project_manager_data (BRASERO_PROJECT_MANAGER (app->contents), list);
@@ -660,15 +670,23 @@
}
else if (files) {
const gchar *mime;
- gchar *uri;
+ GFileInfo *info;
+ GFile *file;
if (g_strv_length (files) > 1)
BRASERO_PROJECT_OPEN_LIST (app, brasero_project_manager_data, files);
/* we need to determine what type of file it is */
- uri = gnome_vfs_make_uri_from_input (files [0]);
- mime = gnome_vfs_get_mime_type (uri);
- g_free (uri);
+ file = g_file_new_for_commandline_arg (files [0]);
+ info = g_file_query_info (file,
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+ G_FILE_QUERY_INFO_NONE,
+ NULL,
+ NULL);
+ g_object_unref (file);
+
+ mime = g_file_info_get_content_type (info);
+ g_object_unref (info);
if (mime) {
if (!strcmp (mime, "application/x-brasero")) {
@@ -728,7 +746,6 @@
notify_init (PACKAGE);
#endif
- gnome_vfs_init ();
gst_init (&argc, &argv);
brasero_burn_set_debug (debug);
Modified: trunk/src/plugins/cdrdao/burn-cdrdao.c
==============================================================================
--- trunk/src/plugins/cdrdao/burn-cdrdao.c (original)
+++ trunk/src/plugins/cdrdao/burn-cdrdao.c Mon Feb 25 14:12:43 2008
@@ -37,8 +37,6 @@
#include <glib/gstdio.h>
#include <gmodule.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
-
#include <nautilus-burn-drive.h>
#include "burn-cdrdao-common.h"
Modified: trunk/src/plugins/checksum/burn-md5sum-file.c
==============================================================================
--- trunk/src/plugins/checksum/burn-md5sum-file.c (original)
+++ trunk/src/plugins/checksum/burn-md5sum-file.c Mon Feb 25 14:12:43 2008
@@ -39,8 +39,6 @@
#include <gmodule.h>
-#include <libgnomevfs/gnome-vfs.h>
-
#include "burn-plugin.h"
#include "burn-job.h"
#include "burn-md5.h"
@@ -259,7 +257,7 @@
/* get the path */
uri = iter->data;
- path = gnome_vfs_get_local_path_from_uri (uri);
+ path = g_filename_from_uri (uri, NULL, NULL);
if (path)
g_hash_table_insert (excludedH, path, path);
@@ -299,7 +297,7 @@
/* get the current and futures paths */
uri = graft->uri;
- path = gnome_vfs_get_local_path_from_uri (uri);
+ path = g_filename_from_uri (uri, NULL, NULL);
graft_path = graft->path;
if (g_file_test (path, G_FILE_TEST_IS_DIR))
Modified: trunk/src/plugins/checksum/burn-md5sum.c
==============================================================================
--- trunk/src/plugins/checksum/burn-md5sum.c (original)
+++ trunk/src/plugins/checksum/burn-md5sum.c Mon Feb 25 14:12:43 2008
@@ -31,6 +31,7 @@
#include <errno.h>
#include <ctype.h>
#include <sys/param.h>
+#include <unistd.h>
#include <glib.h>
#include <glib-object.h>
@@ -39,8 +40,6 @@
#include <gmodule.h>
-#include <libgnomevfs/gnome-vfs.h>
-
#include "burn-plugin.h"
#include "burn-job.h"
#include "burn-md5.h"
Modified: trunk/src/plugins/libburnia/burn-libisofs.c
==============================================================================
--- trunk/src/plugins/libburnia/burn-libisofs.c (original)
+++ trunk/src/plugins/libburnia/burn-libisofs.c Mon Feb 25 14:12:43 2008
@@ -30,6 +30,7 @@
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
+#include <unistd.h>
#include <glib.h>
#include <glib-object.h>
@@ -40,8 +41,6 @@
#include <libisofs/libisofs.h>
#include <libburn/libburn.h>
-#include <libgnomevfs/gnome-vfs.h>
-
#include "burn-basics.h"
#include "burn-libburnia.h"
#include "burn-libisofs.h"
@@ -399,7 +398,7 @@
gchar *uri;
uri = excluded->data;
- excluded_array [size++] = gnome_vfs_get_local_path_from_uri (uri);
+ excluded_array [size++] = g_filename_from_uri (uri, NULL, NULL);
}
for (iter = grafts; iter; iter = iter->next) {
@@ -440,7 +439,7 @@
if (graft->uri) {
gchar *local_path;
- local_path = gnome_vfs_get_local_path_from_uri (graft->uri);
+ local_path = g_filename_from_uri (graft->uri, NULL, NULL);
if (!local_path){
priv->error = g_error_new (BRASERO_BURN_ERROR,
BRASERO_BURN_ERROR_GENERAL,
Modified: trunk/src/plugins/local-track/burn-local-image.c
==============================================================================
--- trunk/src/plugins/local-track/burn-local-image.c (original)
+++ trunk/src/plugins/local-track/burn-local-image.c Mon Feb 25 14:12:43 2008
@@ -35,9 +35,9 @@
#include <glib/gi18n-lib.h>
#include <glib/gstdio.h>
-#include <gmodule.h>
+#include <gio/gio.h>
-#include <libgnomevfs/gnome-vfs.h>
+#include <gmodule.h>
#include "burn-basics.h"
#include "burn-job.h"
@@ -47,11 +47,23 @@
BRASERO_PLUGIN_BOILERPLATE (BraseroLocalTrack, brasero_local_track, BRASERO_TYPE_JOB, BraseroJob);
struct _BraseroLocalTrackPrivate {
+ GCancellable *cancel;
+ guint64 data_size;
+ guint64 read_bytes;
+
+ gchar checksum [33];
gchar *checksum_src;
gchar *checksum_dest;
GHashTable *nonlocals;
- GnomeVFSAsyncHandle *xfer_handle;
+
+ guint thread_id;
+ GThread *thread;
+
+ GSList *src_list;
+ GSList *dest_list;
+
+ GError *error;
};
typedef struct _BraseroLocalTrackPrivate BraseroLocalTrackPrivate;
@@ -59,11 +71,248 @@
static GObjectClass *parent_class = NULL;
-static gint
-brasero_local_track_xfer_async_cb (GnomeVFSAsyncHandle *handle,
- GnomeVFSXferProgressInfo *info,
- BraseroLocalTrack *self);
+/**
+ * This part is for file transfer.
+ * First we gather some information about the size of data to download then we
+ * actually download it.
+ */
+
+static BraseroBurnResult
+brasero_local_track_get_download_size (BraseroLocalTrack *self,
+ GFile *src,
+ GError **error)
+{
+ BraseroLocalTrackPrivate *priv;
+ GFileEnumerator *enumerator;
+ GFileInfo *info;
+
+ priv = BRASERO_LOCAL_TRACK_PRIVATE (self);
+
+ enumerator = g_file_enumerate_children (src,
+ G_FILE_ATTRIBUTE_STANDARD_TYPE,
+ G_FILE_QUERY_INFO_NONE, /* follow symlinks */
+ priv->cancel,
+ error);
+ if (!enumerator)
+ return BRASERO_BURN_ERR;
+
+ while ((info = g_file_enumerator_next_file (enumerator, priv->cancel, error))) {
+ if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY) {
+ GFile *child;
+
+ child = g_file_get_child (src, g_file_info_get_name (info));
+ brasero_local_track_get_download_size (self, child, error);
+ g_object_unref (child);
+ }
+ else
+ priv->data_size += g_file_info_get_size (info);
+
+ g_object_unref (info);
+ }
+
+ g_file_enumerator_close (enumerator, priv->cancel, NULL);
+ g_object_unref (enumerator);
+
+ return BRASERO_BURN_OK;
+}
+
+static void
+brasero_local_track_progress_cb (goffset current_num_bytes,
+ goffset total_num_bytes,
+ gpointer callback_data)
+{
+ BraseroLocalTrack *self = BRASERO_LOCAL_TRACK (callback_data);
+ BraseroLocalTrackPrivate *priv;
+
+ priv = BRASERO_LOCAL_TRACK_PRIVATE (self);
+
+ brasero_job_start_progress (BRASERO_JOB (self), FALSE);
+ brasero_job_set_progress (BRASERO_JOB (self),
+ (gdouble) (priv->read_bytes + current_num_bytes) /
+ (gdouble) priv->data_size);
+}
+
+static BraseroBurnResult
+brasero_local_track_file_transfer (BraseroLocalTrack *self,
+ GFile *src,
+ GFile *dest,
+ GError **error)
+{
+ gboolean result;
+ gchar *name, *string;
+ BraseroLocalTrackPrivate *priv;
+
+ priv = BRASERO_LOCAL_TRACK_PRIVATE (self);
+
+ name = g_file_get_basename (src);
+ string = g_strdup_printf (_("Copying `%s` locally"), name);
+ g_free (name);
+
+ /* get the source name from the info */
+ brasero_job_set_current_action (BRASERO_JOB (self),
+ BRASERO_BURN_ACTION_FILE_COPY,
+ string,
+ TRUE);
+ g_free (string);
+
+ result = g_file_copy (src,
+ dest,
+ G_FILE_COPY_ALL_METADATA,
+ priv->cancel,
+ brasero_local_track_progress_cb,
+ self,
+ error);
+
+ return result? BRASERO_BURN_OK:BRASERO_BURN_ERR;
+}
+
+static BraseroBurnResult
+brasero_local_track_recursive_transfer (BraseroLocalTrack *self,
+ GFile *src,
+ GFile *dest,
+ GError **error)
+{
+ GFileInfo *info;
+ GFileEnumerator *enumerator;
+ BraseroLocalTrackPrivate *priv;
+
+ priv = BRASERO_LOCAL_TRACK_PRIVATE (self);
+
+ enumerator = g_file_enumerate_children (src,
+ G_FILE_ATTRIBUTE_STANDARD_TYPE,
+ G_FILE_QUERY_INFO_NONE, /* follow symlinks */
+ priv->cancel,
+ error);
+ if (!enumerator)
+ return BRASERO_BURN_ERR;
+
+ while ((info = g_file_enumerator_next_file (enumerator, priv->cancel, error))) {
+ BraseroBurnResult result;
+ GFile *dest_child;
+ GFile *src_child;
+
+ if (error) {
+ g_file_enumerator_close (enumerator, priv->cancel, NULL);
+ g_object_unref (enumerator);
+ g_object_unref (info);
+ return BRASERO_BURN_ERR;
+ }
+
+ src_child = g_file_get_child (src, g_file_info_get_name (info));
+ dest_child = g_file_get_child (dest, g_file_info_get_name (info));
+
+ if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY) {
+ gchar *path;
+
+ path = g_file_get_path (dest_child);
+
+ /* create a directory with the same name and explore it */
+ if (g_mkdir (path, 700)) {
+ g_set_error (error,
+ BRASERO_BURN_ERROR,
+ BRASERO_BURN_ERROR_GENERAL,
+ _("a directory couldn't be created (%s)"),
+ strerror (errno));
+ result = BRASERO_BURN_ERR;
+ }
+ else {
+ result = brasero_local_track_recursive_transfer (self,
+ src_child,
+ dest_child,
+ error);
+ }
+
+ g_free (path);
+ }
+ else {
+ result = brasero_local_track_file_transfer (self,
+ src_child,
+ dest_child,
+ error);
+ priv->read_bytes += g_file_info_get_size (info);
+ }
+
+ g_object_unref (info);
+ g_object_unref (src_child);
+ g_object_unref (dest_child);
+
+ if (result != BRASERO_BURN_OK) {
+ g_file_enumerator_close (enumerator, priv->cancel, NULL);
+ g_object_unref (enumerator);
+ return BRASERO_BURN_ERR;
+
+ }
+ }
+
+ g_file_enumerator_close (enumerator, priv->cancel, NULL);
+ g_object_unref (enumerator);
+
+ return BRASERO_BURN_OK;
+}
+
+static BraseroBurnResult
+brasero_local_track_transfer (BraseroLocalTrack *self,
+ GFile *src,
+ GFile *dest,
+ GError **error)
+{
+ GFileInfo *info;
+ BraseroBurnResult result;
+ BraseroLocalTrackPrivate *priv;
+
+ priv = BRASERO_LOCAL_TRACK_PRIVATE (self);
+
+ /* Retrieve some information about the file we have to copy */
+ info = g_file_query_info (src,
+ G_FILE_ATTRIBUTE_STANDARD_TYPE,
+ G_FILE_QUERY_INFO_NONE, /* follow symlinks */
+ priv->cancel,
+ error);
+ if (!info || error)
+ return BRASERO_BURN_ERR;
+
+ /* Retrieve the size of all the data. */
+ if (g_file_info_get_file_type (info) != G_FILE_TYPE_DIRECTORY)
+ priv->data_size = g_file_info_get_size (info);
+ else
+ brasero_local_track_get_download_size (self, src, error);
+
+ priv->read_bytes = 0;
+
+ /* start the downloading */
+ if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY) {
+ gchar *dest_path;
+
+ dest_path = g_file_get_path (dest);
+ if (g_mkdir_with_parents (dest_path, 700)) {
+ g_free (dest_path);
+ g_object_unref (info);
+
+ g_set_error (error,
+ BRASERO_BURN_ERROR,
+ BRASERO_BURN_ERROR_GENERAL,
+ _("a directory couldn't be created (%s)"),
+ strerror (errno));
+ return BRASERO_BURN_ERR;
+ }
+
+ g_free (dest_path);
+ result = brasero_local_track_recursive_transfer (self, src, dest, error);
+ }
+ else {
+ result = brasero_local_track_file_transfer (self, src, dest, error);
+ priv->read_bytes += g_file_info_get_size (info);
+ }
+
+ g_object_unref (info);
+
+ return result;
+}
+
+/**
+ * That's for URI translation ...
+ */
static gchar *
brasero_local_track_translate_uri (BraseroLocalTrack *self,
@@ -126,32 +375,26 @@
gint bytes;
FILE *file;
gchar *path;
- gchar checksum [33];
- BraseroTrack *track;
BraseroLocalTrackPrivate *priv;
priv = BRASERO_LOCAL_TRACK_PRIVATE (self);
+ memset (priv->checksum, 0, sizeof (priv->checksum));
+
/* get the file_checksum from the md5 file */
- path = gnome_vfs_get_local_path_from_uri (priv->checksum_dest);
+ path = g_filename_from_uri (priv->checksum_dest, NULL, NULL);
file = fopen (path, "r");
g_free (path);
if (!file)
return BRASERO_BURN_ERR;
- bytes = fread (checksum, 1, sizeof (checksum) - 1, file);
+ bytes = fread (priv->checksum, 1, sizeof (priv->checksum) - 1, file);
fclose (file);
- if (bytes != sizeof (checksum) - 1)
+ if (bytes != sizeof (priv->checksum) - 1)
return BRASERO_BURN_ERR;
- checksum [sizeof (checksum)] = '\0';
-
- brasero_job_get_current_track (BRASERO_JOB (self), &track);
- brasero_track_set_checksum (track,
- BRASERO_CHECKSUM_MD5,
- checksum);
return BRASERO_BURN_OK;
}
@@ -160,17 +403,10 @@
{
BraseroLocalTrackPrivate *priv;
BraseroBurnResult result;
- GnomeVFSResult res;
- GnomeVFSURI *dest;
- GList *dest_list;
- GnomeVFSURI *src;
- GList *src_list;
+ GFile *src, *dest;
priv = BRASERO_LOCAL_TRACK_PRIVATE (self);
- src = gnome_vfs_uri_new (priv->checksum_src);
- src_list = g_list_prepend (NULL, src);
-
/* generate a unique name for dest */
result = brasero_job_get_tmp_file (BRASERO_JOB (self),
NULL,
@@ -179,45 +415,23 @@
if (result != BRASERO_BURN_OK)
goto error;
- if (!g_str_has_prefix (priv->checksum_dest, "file://")) {
- gchar *tmp;
-
- tmp = priv->checksum_dest;
- priv->checksum_dest = g_strconcat ("file://", tmp, NULL);
- g_free (tmp);
- }
-
- dest = gnome_vfs_uri_new (priv->checksum_dest);
- dest_list = g_list_prepend (NULL, dest);
-
- res = gnome_vfs_async_xfer (&priv->xfer_handle,
- src_list,
- dest_list,
- GNOME_VFS_XFER_DEFAULT|
- GNOME_VFS_XFER_USE_UNIQUE_NAMES|
- GNOME_VFS_XFER_RECURSIVE,
- GNOME_VFS_XFER_ERROR_MODE_ABORT,
- GNOME_VFS_XFER_OVERWRITE_MODE_ABORT,
- GNOME_VFS_PRIORITY_DEFAULT,
- (GnomeVFSAsyncXferProgressCallback) brasero_local_track_xfer_async_cb,
- self,
- NULL, NULL);
-
- g_list_foreach (src_list, (GFunc) gnome_vfs_uri_unref, NULL);
- g_list_foreach (dest_list, (GFunc) gnome_vfs_uri_unref, NULL);
- g_list_free (src_list);
- g_list_free (dest_list);
-
- if (res != GNOME_VFS_OK) {
- result = BRASERO_BURN_ERR;
- goto error;
- }
-
brasero_job_set_current_action (BRASERO_JOB (self),
BRASERO_BURN_ACTION_FILE_COPY,
_("Copying files md5sum file"),
TRUE);
- return BRASERO_BURN_OK;
+
+ src = g_file_new_for_uri (priv->checksum_src);
+ dest = g_file_new_for_uri (priv->checksum_dest);
+
+ result = brasero_local_track_transfer (self,
+ src,
+ dest,
+ NULL);
+
+ g_object_unref (dest);
+ g_object_unref (src);
+
+ return result;
error:
/* we give up */
@@ -228,8 +442,8 @@
return result;
}
-static BraseroBurnResult
-brasero_local_track_finished (BraseroLocalTrack *self)
+static gboolean
+brasero_local_track_thread_finished (BraseroLocalTrack *self)
{
BraseroTrack *track;
BraseroTrackType input;
@@ -237,23 +451,30 @@
priv = BRASERO_LOCAL_TRACK_PRIVATE (self);
- /* successfully downloaded files */
+ priv->thread_id = 0;
- if (priv->checksum_src
- && !priv->checksum_dest
- && brasero_local_track_download_checksum (self) == BRASERO_BURN_OK)
- return BRASERO_BURN_OK;
+ if (priv->cancel) {
+ g_object_unref (priv->cancel);
+ priv->cancel = NULL;
+ if (g_cancellable_is_cancelled (priv->cancel))
+ return FALSE;
+ }
- if (priv->checksum_dest)
- brasero_local_track_read_checksum (self);
+ if (priv->error) {
+ GError *error;
+
+ error = priv->error;
+ priv->error = NULL;
+ brasero_job_error (BRASERO_JOB (self), error);
+ return FALSE;
+ }
/* now we update all the track with the local uris in retval */
brasero_job_get_current_track (BRASERO_JOB (self), &track);
track = brasero_track_copy (track);
brasero_track_get_type (track, &input);
- /* FIXME: we'd better make a copy of the tracks instead of modifying
- * them */
+ /* make a copy of the tracks instead of modifying them */
switch (input.type) {
case BRASERO_TRACK_TYPE_DATA: {
GSList *grafts;
@@ -300,99 +521,109 @@
BRASERO_JOB_NOT_SUPPORTED (self);
}
+ if (priv->checksum)
+ brasero_track_set_checksum (track,
+ BRASERO_CHECKSUM_MD5,
+ priv->checksum);
+
brasero_job_add_track (BRASERO_JOB (self), track);
/* It's good practice to unref the track afterwards as we don't need it
* anymore. BraseroTaskCtx refs it. */
brasero_track_unref (track);
-
brasero_job_finished_track (BRASERO_JOB (self));
- return BRASERO_BURN_OK;
+ return FALSE;
}
-/* This one is for error reporting */
-static gint
-brasero_local_track_xfer_async_cb (GnomeVFSAsyncHandle *handle,
- GnomeVFSXferProgressInfo *info,
- BraseroLocalTrack *self)
+static gpointer
+brasero_local_track_thread (gpointer data)
{
+ BraseroLocalTrack *self = BRASERO_LOCAL_TRACK (data);
BraseroLocalTrackPrivate *priv;
+ GSList *src, *dest;
priv = BRASERO_LOCAL_TRACK_PRIVATE (self);
+ brasero_job_set_current_action (BRASERO_JOB (self),
+ BRASERO_BURN_ACTION_FILE_COPY,
+ _("Copying files locally"),
+ TRUE);
- if (!priv->xfer_handle)
- return FALSE;
-
- if (info->source_name) {
- gchar *name, *string;
+ for (src = priv->src_list, dest = priv->dest_list;
+ src && dest;
+ src = src->next, dest = dest->next) {
+ GFile *src_file;
+ GFile *dest_file;
+ BraseroBurnResult result;
+
+ src_file = src->data;
+ dest_file = dest->data;
+
+ result = brasero_local_track_transfer (self,
+ src_file,
+ dest_file,
+ &priv->error);
+ if (g_cancellable_is_cancelled (priv->cancel))
+ goto end;
- BRASERO_GET_BASENAME_FOR_DISPLAY (info->source_name, name);
- string = g_strdup_printf (_("Copying `%s` locally"), name);
- g_free (name);
-
- /* get the source name from the info */
- brasero_job_set_current_action (BRASERO_JOB (self),
- BRASERO_BURN_ACTION_FILE_COPY,
- string,
- TRUE);
- g_free (string);
+ if (result != BRASERO_BURN_OK)
+ goto end;
}
- /* that where we'll treat the errors and decide to retry or not */
- brasero_job_start_progress (BRASERO_JOB (self), FALSE);
- brasero_job_set_progress (BRASERO_JOB (self),
- (gdouble) info->total_bytes_copied /
- (gdouble) info->bytes_total);
-
- if (info->phase == GNOME_VFS_XFER_PHASE_COMPLETED) {
- brasero_local_track_finished (self);
- return FALSE;
- }
- else if (info->status != GNOME_VFS_XFER_PROGRESS_STATUS_OK) {
- /* here there is an exception which is if the failure comes
- * from the .md5 file that may or may not exist */
- if (priv->checksum_dest) {
- g_free (priv->checksum_src);
- priv->checksum_src = NULL;
+ /* successfully downloaded files, get a checksum if we can. */
+ if (priv->checksum_src
+ && !priv->checksum_dest
+ && brasero_local_track_download_checksum (self) == BRASERO_BURN_OK)
+ brasero_local_track_read_checksum (self);
- g_free (priv->checksum_dest);
- priv->checksum_dest = NULL;
+end:
- brasero_local_track_finished (self);
- return FALSE;
- }
+ if (!g_cancellable_is_cancelled (priv->cancel))
+ priv->thread_id = g_idle_add ((GSourceFunc) brasero_local_track_thread_finished, self);
- brasero_job_error (BRASERO_JOB (self),
- g_error_new (BRASERO_BURN_ERROR,
- BRASERO_BURN_ERROR_GENERAL,
- gnome_vfs_result_to_string (info->vfs_status)));
- return GNOME_VFS_XFER_ERROR_ACTION_ABORT;
- }
+ priv->thread = NULL;
+ g_thread_exit (NULL);
- return TRUE;
+ return NULL;
}
-struct _BraseroDownloadableListData {
- GHashTable *nonlocals;
- GList *dest_list;
- GList *src_list;
- GError **error;
-};
-typedef struct _BraseroDownloadableListData BraseroDownloadableListData;
+static BraseroBurnResult
+brasero_local_track_start_thread (BraseroLocalTrack *self,
+ GError **error)
+{
+ BraseroLocalTrackPrivate *priv;
+
+ priv = BRASERO_LOCAL_TRACK_PRIVATE (self);
+
+ if (priv->thread)
+ return BRASERO_BURN_RUNNING;
+
+ priv->thread = g_thread_create (brasero_local_track_thread,
+ self,
+ TRUE,
+ error);
+ if (!priv->thread)
+ return BRASERO_BURN_ERR;
+
+ priv->cancel = g_cancellable_new ();
+ return BRASERO_BURN_OK;
+}
static gboolean
_foreach_non_local_cb (const gchar *uri,
const gchar *localuri,
- BraseroDownloadableListData *data)
+ gpointer *data)
{
- GnomeVFSURI *vfsuri, *tmpuri;
+ BraseroLocalTrackPrivate *priv;
+ GFile *file, *tmpfile;
gchar *parent;
gchar *tmp;
+ priv = BRASERO_LOCAL_TRACK_PRIVATE (data);
+
/* check that is hasn't any parent in the hash */
parent = g_path_get_dirname (uri);
while (parent [1] != '\0') {
- localuri = g_hash_table_lookup (data->nonlocals, parent);
+ localuri = g_hash_table_lookup (priv->nonlocals, parent);
if (localuri) {
g_free (parent);
return TRUE;
@@ -404,11 +635,11 @@
}
g_free (parent);
- vfsuri = gnome_vfs_uri_new (uri);
- data->src_list = g_list_append (data->src_list, vfsuri);
+ file = g_file_new_for_uri (uri);
+ priv->src_list = g_slist_append (priv->src_list, file);
- tmpuri = gnome_vfs_uri_new (localuri);
- data->dest_list = g_list_append (data->dest_list, tmpuri);
+ tmpfile = g_file_new_for_uri (localuri);
+ priv->dest_list = g_slist_append (priv->dest_list, tmpfile);
return FALSE;
}
@@ -435,31 +666,24 @@
g_free);
if (g_str_has_prefix (uri, "burn://")) {
- GnomeVFSHandle *handle = NULL;
- GnomeVFSResult res;
+ GFile *file;
+ GFileInfo *info;
/* this is a special case for burn:// uris */
- res = gnome_vfs_open (&handle, uri, GNOME_VFS_OPEN_READ);
- if (res != GNOME_VFS_OK || !handle) {
- g_set_error (error,
- BRASERO_BURN_ERROR,
- BRASERO_BURN_ERROR_GENERAL,
- gnome_vfs_result_to_string (res));
- return BRASERO_BURN_ERR;;
- }
+ file = g_file_new_for_uri (uri);
+ info = g_file_query_info (file, "burn::backing-file", 0, NULL, error);
+ g_object_unref (file);
+
+ if (!info)
+ return BRASERO_BURN_ERR;
- res = gnome_vfs_file_control (handle,
- "mapping:get_mapping",
- &localuri);
- gnome_vfs_close (handle);
-
- if (res != GNOME_VFS_OK
- || !localuri
- || !g_str_has_prefix (localuri, "file://")) {
+ localuri = g_strdup (g_file_info_get_attribute_byte_string (info, "burn::backing-file"));
+ g_object_unref (info);
+ if (!localuri) {
g_set_error (error,
BRASERO_BURN_ERROR,
BRASERO_BURN_ERROR_GENERAL,
- gnome_vfs_result_to_string (res));
+ _("impossible to retrieve local file path"));
return BRASERO_BURN_ERR;
}
@@ -494,13 +718,11 @@
brasero_local_track_start (BraseroJob *job,
GError **error)
{
- BraseroDownloadableListData callback_data;
BraseroLocalTrackPrivate *priv;
BraseroJobAction action;
BraseroLocalTrack *self;
BraseroTrackType input;
BraseroTrack *track;
- GnomeVFSResult res;
GSList *grafts;
gchar *uri;
@@ -567,53 +789,18 @@
/* first we create a list of all the non local files that need to be
* downloaded. To be elligible a file must not have one of his parent
* in the hash. */
- callback_data.nonlocals = priv->nonlocals;
- callback_data.dest_list = NULL;
- callback_data.src_list = NULL;
-
g_hash_table_foreach_remove (priv->nonlocals,
(GHRFunc) _foreach_non_local_cb,
- &callback_data);
+ job);
/* if there are files in list then download them otherwise stop */
- if (!callback_data.src_list) {
+ if (!priv->src_list) {
/* that means there were only burn:// uris in nonlocals */
BRASERO_JOB_LOG (self, "no foreign URIs");
return BRASERO_BURN_NOT_RUNNING;
}
- res = gnome_vfs_async_xfer (&priv->xfer_handle,
- callback_data.src_list,
- callback_data.dest_list,
- GNOME_VFS_XFER_DEFAULT|
- GNOME_VFS_XFER_USE_UNIQUE_NAMES|
- GNOME_VFS_XFER_RECURSIVE,
- GNOME_VFS_XFER_ERROR_MODE_ABORT,
- GNOME_VFS_XFER_OVERWRITE_MODE_ABORT,
- GNOME_VFS_PRIORITY_DEFAULT,
- (GnomeVFSAsyncXferProgressCallback) brasero_local_track_xfer_async_cb,
- self,
- NULL, NULL);
-
- g_list_foreach (callback_data.src_list, (GFunc) gnome_vfs_uri_unref, NULL);
- g_list_foreach (callback_data.dest_list, (GFunc) gnome_vfs_uri_unref, NULL);
- g_list_free (callback_data.src_list);
- g_list_free (callback_data.dest_list);
-
- if (res != GNOME_VFS_OK) {
- if (error)
- g_set_error (error,
- BRASERO_BURN_ERROR,
- BRASERO_BURN_ERROR_GENERAL,
- gnome_vfs_result_to_string (res));
- return BRASERO_BURN_ERR;
- }
-
- brasero_job_set_current_action (BRASERO_JOB (self),
- BRASERO_BURN_ACTION_FILE_COPY,
- _("Copying files locally"),
- TRUE);
- return BRASERO_BURN_OK;
+ return brasero_local_track_start_thread (self, error);
}
static BraseroBurnResult
@@ -622,9 +809,38 @@
{
BraseroLocalTrackPrivate *priv = BRASERO_LOCAL_TRACK_PRIVATE (job);
- if (priv->xfer_handle) {
- gnome_vfs_async_cancel (priv->xfer_handle);
- priv->xfer_handle = NULL;
+ if (priv->cancel) {
+ /* signal that we've been cancelled */
+ g_cancellable_cancel (priv->cancel);
+ }
+
+ if (priv->thread)
+ g_thread_join (priv->thread);
+
+ if (priv->cancel) {
+ /* unref it after the thread has stopped */
+ g_object_unref (priv->cancel);
+ priv->cancel = NULL;
+ }
+
+ if (priv->thread_id) {
+ g_source_remove (priv->thread_id);
+ priv->thread_id = 0;
+ }
+
+ if (priv->error) {
+ g_error_free (priv->error);
+ priv->error = NULL;
+ }
+
+ if (priv->src_list) {
+ g_slist_foreach (priv->src_list, (GFunc) g_object_unref, NULL);
+ g_slist_free (priv->src_list);
+ }
+
+ if (priv->dest_list) {
+ g_slist_foreach (priv->dest_list, (GFunc) g_object_unref, NULL);
+ g_slist_free (priv->dest_list);
}
if (priv->nonlocals) {
Modified: trunk/src/scsi-read-cd.c
==============================================================================
--- trunk/src/scsi-read-cd.c (original)
+++ trunk/src/scsi-read-cd.c Mon Feb 25 14:12:43 2008
@@ -141,6 +141,6 @@
buffer,
buffer_len,
error);
-
+ brasero_scsi_command_free (cdb);
return res;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]