[Xfce4-commits] r29928 - in thunar/branches/migration-to-gio: . thunar
Jannis Pohlmann
jannis at xfce.org
Wed May 6 00:12:08 CEST 2009
Author: jannis
Date: 2009-05-05 22:12:08 +0000 (Tue, 05 May 2009)
New Revision: 29928
Modified:
thunar/branches/migration-to-gio/ChangeLog
thunar/branches/migration-to-gio/configure.in.in
thunar/branches/migration-to-gio/thunar/thunar-application.c
thunar/branches/migration-to-gio/thunar/thunar-deep-count-job.c
thunar/branches/migration-to-gio/thunar/thunar-deep-count-job.h
thunar/branches/migration-to-gio/thunar/thunar-folder.c
thunar/branches/migration-to-gio/thunar/thunar-io-jobs-util.c
thunar/branches/migration-to-gio/thunar/thunar-io-jobs.c
thunar/branches/migration-to-gio/thunar/thunar-io-scan-directory.c
thunar/branches/migration-to-gio/thunar/thunar-io-scan-directory.h
thunar/branches/migration-to-gio/thunar/thunar-job.c
thunar/branches/migration-to-gio/thunar/thunar-job.h
thunar/branches/migration-to-gio/thunar/thunar-permissions-chooser.c
thunar/branches/migration-to-gio/thunar/thunar-progress-dialog.c
thunar/branches/migration-to-gio/thunar/thunar-progress-dialog.h
thunar/branches/migration-to-gio/thunar/thunar-simple-job.c
thunar/branches/migration-to-gio/thunar/thunar-simple-job.h
thunar/branches/migration-to-gio/thunar/thunar-size-label.c
thunar/branches/migration-to-gio/thunar/thunar-transfer-job.c
Log:
* configure.in.in: Depend on exo-0.3.101svn-r29926 for ExoJob.
* thunar/thunar-application.c, thunar/thunar-deep-count-job.{c,h},
thunar/thunar-folder.c, thunar/thunar-io-jobs-util.c,
thunar/thunar-io-jobs.c, thunar/thunar-io-scan-directory.{c,h},
thunar/thunar-job.{c,h}, thunar/thunar-permissions-chooser.c,
thunar/thunar-progress-dialog.{c,h}, thunar/thunar-simple-job.{c,h},
thunar/thunar-size-label.c, thunar/thunar-transfer-job.c: Implement
ThunarJob based on ExoJob. Update a lot of classes to use the
equivalent ExoJob functions instead the ones from ThunarJob which
have been removed.
Modified: thunar/branches/migration-to-gio/ChangeLog
===================================================================
--- thunar/branches/migration-to-gio/ChangeLog 2009-05-05 21:39:22 UTC (rev 29927)
+++ thunar/branches/migration-to-gio/ChangeLog 2009-05-05 22:12:08 UTC (rev 29928)
@@ -1,3 +1,16 @@
+2009-05-05 Jannis Pohlmann <jannis at xfce.org>
+
+ * configure.in.in: Depend on exo-0.3.101svn-r29926 for ExoJob.
+ * thunar/thunar-application.c, thunar/thunar-deep-count-job.{c,h},
+ thunar/thunar-folder.c, thunar/thunar-io-jobs-util.c,
+ thunar/thunar-io-jobs.c, thunar/thunar-io-scan-directory.{c,h},
+ thunar/thunar-job.{c,h}, thunar/thunar-permissions-chooser.c,
+ thunar/thunar-progress-dialog.{c,h}, thunar/thunar-simple-job.{c,h},
+ thunar/thunar-size-label.c, thunar/thunar-transfer-job.c: Implement
+ ThunarJob based on ExoJob. Update a lot of classes to use the
+ equivalent ExoJob functions instead the ones from ThunarJob which
+ have been removed.
+
2009-05-01 Jannis Pohlmann <jannis at xfce.org>
* thunar/thunar-file.{c,h}, thnuar/thunar-standard-view.c,
Modified: thunar/branches/migration-to-gio/configure.in.in
===================================================================
--- thunar/branches/migration-to-gio/configure.in.in 2009-05-05 21:39:22 UTC (rev 29927)
+++ thunar/branches/migration-to-gio/configure.in.in 2009-05-05 22:12:08 UTC (rev 29928)
@@ -159,7 +159,7 @@
dnl ***********************************
dnl *** Check for required packages ***
dnl ***********************************
-XDT_CHECK_PACKAGE([EXO], [exo-0.3], [0.3.101svn-r29789])
+XDT_CHECK_PACKAGE([EXO], [exo-0.3], [0.3.101svn-r29926])
XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.16.0])
XDT_CHECK_PACKAGE([GIO], [gio-2.0], [2.16.0])
XDT_CHECK_PACKAGE([GTHREAD], [gthread-2.0], [2.16.0])
Modified: thunar/branches/migration-to-gio/thunar/thunar-application.c
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-application.c 2009-05-05 21:39:22 UTC (rev 29927)
+++ thunar/branches/migration-to-gio/thunar/thunar-application.c 2009-05-05 22:12:08 UTC (rev 29928)
@@ -50,8 +50,8 @@
/* Prototype for the Thunar job launchers */
-typedef ThunarJob *(*Launcher) (GList *source_path_list,
- GList *target_path_list);
+typedef ThunarJob *(*Launcher) (GList *source_path_list,
+ GList *target_path_list);
@@ -403,10 +403,10 @@
GList *target_file_list,
GClosure *new_files_closure)
{
- ThunarJob *job;
GtkWindow *window;
GtkWidget *dialog;
GdkScreen *screen;
+ ThunarJob *job;
_thunar_return_if_fail (parent == NULL || GDK_IS_SCREEN (parent) || GTK_IS_WIDGET (parent));
@@ -1277,7 +1277,7 @@
-static ThunarJob*
+static ThunarJob *
unlink_stub (GList *source_path_list,
GList *target_path_list)
{
@@ -1416,7 +1416,7 @@
-static ThunarJob*
+static ThunarJob *
creat_stub (GList *source_path_list,
GList *target_path_list)
{
@@ -1455,7 +1455,7 @@
-static ThunarJob*
+static ThunarJob *
mkdir_stub (GList *source_path_list,
GList *target_path_list)
{
Modified: thunar/branches/migration-to-gio/thunar/thunar-deep-count-job.c
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-deep-count-job.c 2009-05-05 21:39:22 UTC (rev 29927)
+++ thunar/branches/migration-to-gio/thunar/thunar-deep-count-job.c 2009-05-05 22:12:08 UTC (rev 29928)
@@ -45,7 +45,7 @@
static void thunar_deep_count_job_class_init (ThunarDeepCountJobClass *klass);
static void thunar_deep_count_job_init (ThunarDeepCountJob *job);
static void thunar_deep_count_job_finalize (GObject *object);
-static gboolean thunar_deep_count_job_execute (ThunarJob *job,
+static gboolean thunar_deep_count_job_execute (ExoJob *job,
GError **error);
@@ -110,8 +110,8 @@
static void
thunar_deep_count_job_class_init (ThunarDeepCountJobClass *klass)
{
- ThunarJobClass *job_class;
- GObjectClass *gobject_class;
+ ExoJobClass *job_class;
+ GObjectClass *gobject_class;
/* Determine the parent type class */
thunar_deep_count_job_parent_class = g_type_class_peek_parent (klass);
@@ -119,7 +119,7 @@
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = thunar_deep_count_job_finalize;
- job_class = THUNAR_JOB_CLASS (klass);
+ job_class = EXO_JOB_CLASS (klass);
job_class->execute = thunar_deep_count_job_execute;
/**
@@ -180,21 +180,21 @@
{
_thunar_return_if_fail (THUNAR_IS_DEEP_COUNT_JOB (job));
- thunar_job_emit (THUNAR_JOB (job),
- deep_count_signals[STATUS_UPDATE],
- 0,
- job->total_size,
- job->file_count,
- job->directory_count,
- job->unreadable_directory_count);
+ exo_job_emit (EXO_JOB (job),
+ deep_count_signals[STATUS_UPDATE],
+ 0,
+ job->total_size,
+ job->file_count,
+ job->directory_count,
+ job->unreadable_directory_count);
}
static gboolean
-thunar_deep_count_job_process (ThunarJob *job,
- GFile *file,
- GError **error)
+thunar_deep_count_job_process (ExoJob *job,
+ GFile *file,
+ GError **error)
{
ThunarDeepCountJob *count_job = THUNAR_DEEP_COUNT_JOB (job);
GFileEnumerator *enumerator;
@@ -208,7 +208,7 @@
_thunar_return_val_if_fail (error == NULL || *error == NULL, FALSE);
/* abort if job was already cancelled */
- if (thunar_job_is_cancelled (job))
+ if (exo_job_is_cancelled (job))
return FALSE;
/* query size and type of the current file */
@@ -216,11 +216,11 @@
G_FILE_ATTRIBUTE_STANDARD_TYPE ","
G_FILE_ATTRIBUTE_STANDARD_SIZE,
count_job->query_flags,
- thunar_job_get_cancellable (job),
+ exo_job_get_cancellable (job),
error);
/* abort on invalid info or cancellation */
- if (info == NULL || thunar_job_is_cancelled (job))
+ if (info == NULL || exo_job_is_cancelled (job))
return FALSE;
/* add size of the file to the total size */
@@ -235,10 +235,10 @@
G_FILE_ATTRIBUTE_STANDARD_SIZE ","
G_FILE_ATTRIBUTE_STANDARD_NAME,
count_job->query_flags,
- thunar_job_get_cancellable (job),
+ exo_job_get_cancellable (job),
error);
- if (!thunar_job_is_cancelled (job))
+ if (!exo_job_is_cancelled (job))
{
if (enumerator == NULL)
{
@@ -262,22 +262,22 @@
/* directory was readable */
count_job->directory_count += 1;
- while (!thunar_job_is_cancelled (job))
+ while (!exo_job_is_cancelled (job))
{
/* query next child info */
child_info = g_file_enumerator_next_file (enumerator,
- thunar_job_get_cancellable (job),
+ exo_job_get_cancellable (job),
error);
/* abort on invalid child info (iteration ends) or cancellation */
- if (child_info == NULL || thunar_job_is_cancelled (job))
+ if (child_info == NULL || exo_job_is_cancelled (job))
break;
/* generate a GFile for the child */
child = g_file_resolve_relative_path (file, g_file_info_get_name (child_info));
/* recurse unless the job was cancelled before */
- if (!thunar_job_is_cancelled (job))
+ if (!exo_job_is_cancelled (job))
thunar_deep_count_job_process (job, child, error);
/* free resources */
@@ -308,14 +308,14 @@
/* we've succeeded if there was no error when loading information
* about the job file itself and the job was not cancelled */
- return !thunar_job_is_cancelled (job) && success;
+ return !exo_job_is_cancelled (job) && success;
}
static gboolean
-thunar_deep_count_job_execute (ThunarJob *job,
- GError **error)
+thunar_deep_count_job_execute (ExoJob *job,
+ GError **error)
{
gboolean success;
GError *err = NULL;
@@ -324,7 +324,7 @@
_thunar_return_val_if_fail (error == NULL || *error == NULL, FALSE);
/* don't start the job if it was already cancelled */
- if (thunar_job_set_error_if_cancelled (job, error))
+ if (exo_job_set_error_if_cancelled (job, error))
return FALSE;
/* count files, directories and compute size of the job file */
@@ -334,11 +334,11 @@
if (!success)
{
- g_assert (err != NULL || thunar_job_is_cancelled (job));
+ g_assert (err != NULL || exo_job_is_cancelled (job));
/* set error if the job was cancelled. otherwise just propagate
* the results of the processing function */
- if (thunar_job_set_error_if_cancelled (job, error))
+ if (exo_job_set_error_if_cancelled (job, error))
{
if (err != NULL)
g_error_free (err);
@@ -357,7 +357,7 @@
-ThunarJob *
+ThunarDeepCountJob *
thunar_deep_count_job_new (GFile *file,
GFileQueryInfoFlags flags)
{
@@ -369,5 +369,5 @@
job->file = g_object_ref (file);
job->query_flags = flags;
- return THUNAR_JOB (job);
+ return job;
}
Modified: thunar/branches/migration-to-gio/thunar/thunar-deep-count-job.h
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-deep-count-job.h 2009-05-05 21:39:22 UTC (rev 29927)
+++ thunar/branches/migration-to-gio/thunar/thunar-deep-count-job.h 2009-05-05 22:12:08 UTC (rev 29928)
@@ -38,10 +38,10 @@
#define THUNAR_IS_DEEP_COUNT_JOB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), THUNAR_TYPE_DEEP_COUNT_JOB)
#define THUNAR_DEEP_COUNT_JOB_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), THUNAR_TYPE_DEEP_COUNT_JOB, ThunarDeepCountJobClass))
-GType thunar_deep_count_job_get_type (void) G_GNUC_CONST;
+GType thunar_deep_count_job_get_type (void) G_GNUC_CONST;
-ThunarJob *thunar_deep_count_job_new (GFile *file,
- GFileQueryInfoFlags flags) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
+ThunarDeepCountJob *thunar_deep_count_job_new (GFile *file,
+ GFileQueryInfoFlags flags) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
G_END_DECLS;
Modified: thunar/branches/migration-to-gio/thunar/thunar-folder.c
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-folder.c 2009-05-05 21:39:22 UTC (rev 29927)
+++ thunar/branches/migration-to-gio/thunar/thunar-folder.c 2009-05-05 22:12:08 UTC (rev 29928)
@@ -61,13 +61,13 @@
guint prop_uid,
const GValue *value,
GParamSpec *pspec);
-static void thunar_folder_error (ThunarJob *job,
+static void thunar_folder_error (ExoJob *job,
GError *error,
ThunarFolder *folder);
static gboolean thunar_folder_files_ready (ThunarJob *job,
GList *files,
ThunarFolder *folder);
-static void thunar_folder_finished (ThunarJob *job,
+static void thunar_folder_finished (ExoJob *job,
ThunarFolder *folder);
static void thunar_folder_file_changed (ThunarFileMonitor *file_monitor,
ThunarFile *file,
@@ -100,7 +100,7 @@
{
GtkObject __parent__;
- ThunarJob *job;
+ ThunarJob *job;
ThunarFile *corresponding_file;
GList *new_files;
@@ -275,7 +275,7 @@
if (G_UNLIKELY (folder->job != NULL))
{
g_signal_handlers_disconnect_matched (folder->job, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, folder);
- thunar_job_cancel (folder->job);
+ exo_job_cancel (EXO_JOB (folder->job));
g_object_unref (folder->job);
}
@@ -351,13 +351,13 @@
static void
-thunar_folder_error (ThunarJob *job,
+thunar_folder_error (ExoJob *job,
GError *error,
ThunarFolder *folder)
{
_thunar_return_if_fail (THUNAR_IS_FOLDER (folder));
_thunar_return_if_fail (THUNAR_IS_JOB (job));
- _thunar_return_if_fail (folder->job == job);
+ _thunar_return_if_fail (folder->job == THUNAR_JOB (job));
/* tell the consumer about the problem */
g_signal_emit (G_OBJECT (folder), folder_signals[ERROR], 0, error);
@@ -373,7 +373,7 @@
_thunar_return_val_if_fail (THUNAR_IS_FOLDER (folder), FALSE);
_thunar_return_val_if_fail (THUNAR_IS_JOB (job), FALSE);
_thunar_return_val_if_fail (folder->monitor == NULL, FALSE);
- _thunar_return_val_if_fail (folder->job == job, FALSE);
+ _thunar_return_val_if_fail (folder->job == THUNAR_JOB (job), FALSE);
/* merge the list with the existing list of new files */
folder->new_files = g_list_concat (folder->new_files, files);
@@ -385,7 +385,7 @@
static void
-thunar_folder_finished (ThunarJob *job,
+thunar_folder_finished (ExoJob *job,
ThunarFolder *folder)
{
ThunarFile *file;
@@ -396,7 +396,7 @@
_thunar_return_if_fail (THUNAR_IS_JOB (job));
_thunar_return_if_fail (THUNAR_IS_FILE (folder->corresponding_file));
_thunar_return_if_fail (folder->monitor == NULL);
- _thunar_return_if_fail (folder->job == job);
+ _thunar_return_if_fail (folder->job == THUNAR_JOB (job));
/* check if we need to merge new files with existing files */
if (G_UNLIKELY (folder->files != NULL))
@@ -729,7 +729,7 @@
{
/* disconnect from the job */
g_signal_handlers_disconnect_matched (folder->job, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, folder);
- thunar_job_cancel (THUNAR_JOB (folder->job));
+ exo_job_cancel (EXO_JOB (folder->job));
g_object_unref (folder->job);
}
Modified: thunar/branches/migration-to-gio/thunar/thunar-io-jobs-util.c
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-io-jobs-util.c 2009-05-05 21:39:22 UTC (rev 29927)
+++ thunar/branches/migration-to-gio/thunar/thunar-io-jobs-util.c 2009-05-05 22:12:08 UTC (rev 29928)
@@ -45,7 +45,7 @@
/**
* thunar_io_jobs_util_next_duplicate_file:
- * @job : a #ThunarTransferJob.
+ * @job : a #ThunarJob.
* @file : the source #GFile.
* @type : the operation type (copy or link).
* @n : the @n<!---->th copy/link to create the #GFile for.
@@ -90,13 +90,13 @@
_thunar_return_val_if_fail (!g_file_is_root (file), NULL);
/* abort on cancellation */
- if (thunar_job_set_error_if_cancelled (job, error))
+ if (exo_job_set_error_if_cancelled (EXO_JOB (job), error))
return NULL;
/* query the source file info / display name */
info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
- thunar_job_get_cancellable (job), &err);
+ exo_job_get_cancellable (EXO_JOB (job)), &err);
/* abort on error */
if (info == NULL)
Modified: thunar/branches/migration-to-gio/thunar/thunar-io-jobs.c
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-io-jobs.c 2009-05-05 21:39:22 UTC (rev 29927)
+++ thunar/branches/migration-to-gio/thunar/thunar-io-jobs.c 2009-05-05 22:12:08 UTC (rev 29928)
@@ -46,7 +46,7 @@
/* recursively collect the files */
for (lp = base_file_list;
- err == NULL && lp != NULL && !thunar_job_is_cancelled (job);
+ err == NULL && lp != NULL && !exo_job_is_cancelled (EXO_JOB (job));
lp = lp->next)
{
/* try to scan the directory */
@@ -60,9 +60,9 @@
}
/* check if we failed */
- if (G_UNLIKELY (err != NULL || thunar_job_is_cancelled (job)))
+ if (G_UNLIKELY (err != NULL || exo_job_is_cancelled (EXO_JOB (job))))
{
- if (thunar_job_set_error_if_cancelled (job, error))
+ if (exo_job_set_error_if_cancelled (EXO_JOB (job), error))
g_error_free (err);
else
g_propagate_error (error, err);
@@ -101,27 +101,27 @@
file_list = g_value_get_boxed (g_value_array_get_nth (param_values, 0));
/* we know the total amount of files to be processed */
- thunar_job_set_total_files (job, file_list);
+ thunar_job_set_total_files (THUNAR_JOB (job), file_list);
/* iterate over all files in the list */
for (lp = file_list;
- err == NULL && lp != NULL && !thunar_job_is_cancelled (job);
+ err == NULL && lp != NULL && !exo_job_is_cancelled (EXO_JOB (job));
lp = lp->next)
{
g_assert (G_IS_FILE (lp->data));
/* update progress information */
- thunar_job_processing_file (job, lp);
+ thunar_job_processing_file (THUNAR_JOB (job), lp);
again:
/* try to create the file */
stream = g_file_create (lp->data,
G_FILE_CREATE_NONE,
- thunar_job_get_cancellable (job),
+ exo_job_get_cancellable (EXO_JOB (job)),
&err);
/* abort if the job was cancelled */
- if (thunar_job_is_cancelled (job))
+ if (exo_job_is_cancelled (EXO_JOB (job)))
break;
/* check if creating failed */
@@ -135,11 +135,11 @@
info = g_file_query_info (lp->data,
G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
G_FILE_QUERY_INFO_NONE,
- thunar_job_get_cancellable (job),
+ exo_job_get_cancellable (EXO_JOB (job)),
NULL);
/* abort if the job was cancelled */
- if (thunar_job_is_cancelled (job))
+ if (exo_job_is_cancelled (EXO_JOB (job)))
break;
/* determine the display name, using the basename as a fallback */
@@ -156,14 +156,15 @@
}
/* ask the user whether he wants to overwrite the existing file */
- response = thunar_job_ask_overwrite (job, _("The file \"%s\" already exists"),
+ response = thunar_job_ask_overwrite (THUNAR_JOB (job),
+ _("The file \"%s\" already exists"),
display_name);
/* check if we should overwrite */
if (G_UNLIKELY (response == THUNAR_JOB_RESPONSE_YES))
{
/* try to remove the file. fail if not possible */
- if (g_file_delete (lp->data, thunar_job_get_cancellable (job), &err))
+ if (g_file_delete (lp->data, exo_job_get_cancellable (EXO_JOB (job)), &err))
goto again;
}
@@ -178,7 +179,8 @@
g_free (basename);
/* ask the user whether to skip/retry this path (cancels the job if not) */
- response = thunar_job_ask_skip (job, _("Failed to create empty file \"%s\": %s"),
+ response = thunar_job_ask_skip (THUNAR_JOB (job),
+ _("Failed to create empty file \"%s\": %s"),
display_name, err->message);
g_free (display_name);
@@ -201,11 +203,11 @@
}
/* check if the job was cancelled */
- if (G_UNLIKELY (thunar_job_is_cancelled (job)))
+ if (G_UNLIKELY (exo_job_is_cancelled (EXO_JOB (job))))
return FALSE;
/* emit the "new-files" signal with the given file list */
- thunar_job_new_files (job, file_list);
+ thunar_job_new_files (THUNAR_JOB (job), file_list);
return TRUE;
}
@@ -242,20 +244,20 @@
file_list = g_value_get_boxed (g_value_array_get_nth (param_values, 0));
/* we know the total list of files to process */
- thunar_job_set_total_files (job, file_list);
+ thunar_job_set_total_files (THUNAR_JOB (job), file_list);
for (lp = file_list;
- err == NULL && lp != NULL && !thunar_job_is_cancelled (job);
+ err == NULL && lp != NULL && !exo_job_is_cancelled (EXO_JOB (job));
lp = lp->next)
{
g_assert (G_IS_FILE (lp->data));
/* update progress information */
- thunar_job_processing_file (job, lp);
+ thunar_job_processing_file (THUNAR_JOB (job), lp);
again:
/* try to create the directory */
- if (!g_file_make_directory (lp->data, thunar_job_get_cancellable (job), &err))
+ if (!g_file_make_directory (lp->data, exo_job_get_cancellable (EXO_JOB (job)), &err))
{
if (err->code == G_IO_ERROR_EXISTS)
{
@@ -263,18 +265,18 @@
err = NULL;
/* abort if the job was cancelled */
- if (thunar_job_is_cancelled (job))
+ if (exo_job_is_cancelled (EXO_JOB (job)))
break;
/* the file already exists, query its display name */
info = g_file_query_info (lp->data,
G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
G_FILE_QUERY_INFO_NONE,
- thunar_job_get_cancellable (job),
+ exo_job_get_cancellable (EXO_JOB (job)),
NULL);
/* abort if the job was cancelled */
- if (thunar_job_is_cancelled (job))
+ if (exo_job_is_cancelled (EXO_JOB (job)))
break;
/* determine the display name, using the basename as a fallback */
@@ -291,14 +293,15 @@
}
/* ask the user whether he wants to overwrite the existing file */
- response = thunar_job_ask_overwrite (job, _("The file \"%s\" already exists"),
+ response = thunar_job_ask_overwrite (THUNAR_JOB (job),
+ _("The file \"%s\" already exists"),
display_name);
/* check if we should overwrite it */
if (G_UNLIKELY (response == THUNAR_JOB_RESPONSE_YES))
{
/* try to remove the file, fail if not possible */
- if (g_file_delete (lp->data, thunar_job_get_cancellable (job), &err))
+ if (g_file_delete (lp->data, exo_job_get_cancellable (EXO_JOB (job)), &err))
goto again;
}
@@ -313,7 +316,8 @@
g_free (basename);
/* ask the user whether to skip/retry this path (cancels the job if not) */
- response = thunar_job_ask_skip (job, _("Failed to create directory \"%s\": %s"),
+ response = thunar_job_ask_skip (THUNAR_JOB (job),
+ _("Failed to create directory \"%s\": %s"),
display_name, err->message);
g_free (display_name);
@@ -335,11 +339,11 @@
}
/* check if the job was cancelled */
- if (G_UNLIKELY (thunar_job_is_cancelled (job)))
+ if (G_UNLIKELY (exo_job_is_cancelled (EXO_JOB (job))))
return FALSE;
/* emit the "new-files" signal with the given file list */
- thunar_job_new_files (job, file_list);
+ thunar_job_new_files (THUNAR_JOB (job), file_list);
return TRUE;
}
@@ -377,15 +381,15 @@
file_list = g_value_get_boxed (g_value_array_get_nth (param_values, 0));
/* tell the user that we're preparing to unlink the files */
- thunar_job_info_message (job, _("Preparing..."));
+ exo_job_info_message (EXO_JOB (job), _("Preparing..."));
/* recursively collect files for removal, not following any symlinks */
file_list = _tij_collect_nofollow (job, file_list, &err);
/* free the file list and fail if there was an error or the job was cancelled */
- if (err != NULL || thunar_job_is_cancelled (job))
+ if (err != NULL || exo_job_is_cancelled (EXO_JOB (job)))
{
- if (thunar_job_set_error_if_cancelled (job, error))
+ if (exo_job_set_error_if_cancelled (EXO_JOB (job), error))
g_error_free (err);
else
g_propagate_error (error, err);
@@ -395,10 +399,10 @@
}
/* we know the total list of files to process */
- thunar_job_set_total_files (job, file_list);
+ thunar_job_set_total_files (THUNAR_JOB (job), file_list);
/* remove all the files */
- for (lp = file_list; lp != NULL && !thunar_job_is_cancelled (job); lp = lp->next)
+ for (lp = file_list; lp != NULL && !exo_job_is_cancelled (EXO_JOB (job)); lp = lp->next)
{
g_assert (G_IS_FILE (lp->data));
@@ -408,17 +412,17 @@
again:
/* try to delete the file */
- if (G_UNLIKELY (!g_file_delete (lp->data, thunar_job_get_cancellable (job), &err)))
+ if (G_UNLIKELY (!g_file_delete (lp->data, exo_job_get_cancellable (EXO_JOB (job)), &err)))
{
/* query the file info for the display name */
info = g_file_query_info (lp->data,
G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
G_FILE_QUERY_INFO_NONE,
- thunar_job_get_cancellable (job),
+ exo_job_get_cancellable (EXO_JOB (job)),
NULL);
/* abort if the job was cancelled */
- if (thunar_job_is_cancelled (job))
+ if (exo_job_is_cancelled (EXO_JOB (job)))
{
g_clear_error (&err);
break;
@@ -438,7 +442,8 @@
}
/* ask the user whether he wants to skip this file */
- response = thunar_job_ask_skip (job, _("Could not delete file \"%s\": %s"),
+ response = thunar_job_ask_skip (THUNAR_JOB (job),
+ _("Could not delete file \"%s\": %s"),
display_name, err->message);
g_free (display_name);
@@ -454,7 +459,7 @@
/* release the file list */
g_file_list_free (file_list);
- if (thunar_job_set_error_if_cancelled (job, error))
+ if (exo_job_set_error_if_cancelled (EXO_JOB (job), error))
return FALSE;
else
return TRUE;
@@ -475,13 +480,16 @@
thunar_io_jobs_move_files (GList *source_file_list,
GList *target_file_list)
{
+ ThunarJob *job;
+
_thunar_return_val_if_fail (source_file_list != NULL, NULL);
_thunar_return_val_if_fail (target_file_list != NULL, NULL);
_thunar_return_val_if_fail (g_list_length (source_file_list) == g_list_length (target_file_list), NULL);
+
+ job = thunar_transfer_job_new (source_file_list, target_file_list,
+ THUNAR_TRANSFER_JOB_MOVE);
- return thunar_job_launch (thunar_transfer_job_new (source_file_list,
- target_file_list,
- THUNAR_TRANSFER_JOB_MOVE));
+ return THUNAR_JOB (exo_job_launch (EXO_JOB (job)));
}
@@ -490,13 +498,16 @@
thunar_io_jobs_copy_files (GList *source_file_list,
GList *target_file_list)
{
+ ThunarJob *job;
+
_thunar_return_val_if_fail (source_file_list != NULL, NULL);
_thunar_return_val_if_fail (target_file_list != NULL, NULL);
_thunar_return_val_if_fail (g_list_length (source_file_list) == g_list_length (target_file_list), NULL);
- return thunar_job_launch (thunar_transfer_job_new (source_file_list,
- target_file_list,
- THUNAR_TRANSFER_JOB_COPY));
+ job = thunar_transfer_job_new (source_file_list, target_file_list,
+ THUNAR_TRANSFER_JOB_COPY);
+
+ return THUNAR_JOB (exo_job_launch (EXO_JOB (job)));
}
@@ -526,7 +537,7 @@
target_file_list = g_value_get_boxed (g_value_array_get_nth (param_values, 1));
/* we know the total list of paths to process */
- thunar_job_set_total_files (job, source_file_list);
+ thunar_job_set_total_files (THUNAR_JOB (job), source_file_list);
/* process all files */
for (sp = source_file_list, tp = target_file_list;
@@ -537,7 +548,7 @@
_thunar_assert (G_IS_FILE (tp->data));
/* update progress information */
- thunar_job_processing_file (job, sp);
+ thunar_job_processing_file (THUNAR_JOB (job), sp);
again:
source_path = g_file_get_path (sp->data);
@@ -546,7 +557,7 @@
{
/* try to create the symlink */
g_file_make_symbolic_link (tp->data, source_path,
- thunar_job_get_cancellable (job),
+ exo_job_get_cancellable (EXO_JOB (job)),
&err);
g_free (source_path);
@@ -559,7 +570,8 @@
if (err->domain == G_IO_ERROR && err->code == G_IO_ERROR_EXISTS)
{
/* ask the user whether he wants to overwrite the existing file */
- response = thunar_job_ask_overwrite (job, "%s", err->message);
+ response = thunar_job_ask_overwrite (THUNAR_JOB (job), "%s",
+ err->message);
/* release the error */
g_clear_error (&err);
@@ -568,7 +580,7 @@
if (G_LIKELY (response == THUNAR_JOB_RESPONSE_YES))
{
/* try to remove the target file (fail if not possible) */
- if (g_file_delete (tp->data, thunar_job_get_cancellable (job), &err))
+ if (g_file_delete (tp->data, exo_job_get_cancellable (EXO_JOB (job)), &err))
goto again;
}
}
@@ -594,7 +606,7 @@
}
else
{
- thunar_job_new_files (job, new_files_list);
+ thunar_job_new_files (THUNAR_JOB (job), new_files_list);
g_file_list_free (new_files_list);
return TRUE;
}
@@ -633,13 +645,13 @@
file_list = g_value_get_boxed (g_value_array_get_nth (param_values, 0));
- if (thunar_job_set_error_if_cancelled (job, error))
+ if (exo_job_set_error_if_cancelled (EXO_JOB (job), error))
return FALSE;
for (lp = file_list; err == NULL && lp != NULL; lp = lp->next)
{
_thunar_assert (G_IS_FILE (lp->data));
- g_file_trash (lp->data, thunar_job_get_cancellable (job), &err);
+ g_file_trash (lp->data, exo_job_get_cancellable (EXO_JOB (job)), &err);
}
if (err != NULL)
@@ -670,13 +682,16 @@
thunar_io_jobs_restore_files (GList *source_file_list,
GList *target_file_list)
{
+ ThunarJob *job;
+
_thunar_return_val_if_fail (source_file_list != NULL, NULL);
_thunar_return_val_if_fail (target_file_list != NULL, NULL);
_thunar_return_val_if_fail (g_list_length (source_file_list) == g_list_length (target_file_list), NULL);
- return thunar_job_launch (thunar_transfer_job_new (source_file_list,
- target_file_list,
- THUNAR_TRANSFER_JOB_MOVE));
+ job = thunar_transfer_job_new (source_file_list, target_file_list,
+ THUNAR_TRANSFER_JOB_MOVE);
+
+ return THUNAR_JOB (exo_job_launch (EXO_JOB (job)));
}
@@ -721,19 +736,19 @@
}
/* we know the total list of files to process */
- thunar_job_set_total_files (job, file_list);
+ thunar_job_set_total_files (THUNAR_JOB (job), file_list);
/* change the ownership of all files */
for (lp = file_list; lp != NULL && err == NULL; lp = lp->next)
{
/* update progress information */
- thunar_job_processing_file (job, lp);
+ thunar_job_processing_file (THUNAR_JOB (job), lp);
/* try to query information about the file */
info = g_file_query_info (lp->data,
G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
- thunar_job_get_cancellable (job),
+ exo_job_get_cancellable (EXO_JOB (job)),
&err);
if (G_UNLIKELY (err != NULL))
@@ -746,7 +761,7 @@
g_file_set_attribute_uint32 (lp->data,
G_FILE_ATTRIBUTE_UNIX_UID, uid,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
- thunar_job_get_cancellable (job),
+ exo_job_get_cancellable (EXO_JOB (job)),
&err);
}
else if (gid >= 0)
@@ -755,19 +770,19 @@
g_file_set_attribute_uint32 (lp->data,
G_FILE_ATTRIBUTE_UNIX_GID, gid,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
- thunar_job_get_cancellable (job),
+ exo_job_get_cancellable (EXO_JOB (job)),
&err);
}
/* check if there was a recoverable error */
- if (G_UNLIKELY (err != NULL && !thunar_job_is_cancelled (job)))
+ if (G_UNLIKELY (err != NULL && !exo_job_is_cancelled (EXO_JOB (job))))
{
/* generate a useful error message */
message = G_LIKELY (uid >= 0) ? _("Failed to change the owner of \"%s\": %s")
: _("Failed to change the group of \"%s\": %s");
/* ask the user whether to skip/retry this file */
- response = thunar_job_ask_skip (job, message,
+ response = thunar_job_ask_skip (THUNAR_JOB (job), message,
g_file_info_get_display_name (info),
err->message);
@@ -868,13 +883,13 @@
}
/* we know the total list of files to process */
- thunar_job_set_total_files (job, file_list);
+ thunar_job_set_total_files (THUNAR_JOB (job), file_list);
/* change the ownership of all files */
for (lp = file_list; lp != NULL && err == NULL; lp = lp->next)
{
/* update progress information */
- thunar_job_processing_file (job, lp);
+ thunar_job_processing_file (THUNAR_JOB (job), lp);
/* try to query information about the file */
info = g_file_query_info (lp->data,
@@ -882,7 +897,7 @@
G_FILE_ATTRIBUTE_STANDARD_TYPE ","
G_FILE_ATTRIBUTE_UNIX_MODE,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
- thunar_job_get_cancellable (job),
+ exo_job_get_cancellable (EXO_JOB (job)),
&err);
if (G_UNLIKELY (err != NULL))
@@ -912,14 +927,14 @@
g_file_set_attribute_uint32 (lp->data,
G_FILE_ATTRIBUTE_UNIX_MODE, new_mode,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
- thunar_job_get_cancellable (job),
+ exo_job_get_cancellable (EXO_JOB (job)),
&err);
/* check if there was a recoverable error */
- if (G_UNLIKELY (err != NULL && !thunar_job_is_cancelled (job)))
+ if (G_UNLIKELY (err != NULL && !exo_job_is_cancelled (EXO_JOB (job))))
{
/* ask the user whether to skip/retry this file */
- response = thunar_job_ask_skip (job,
+ response = thunar_job_ask_skip (job,
_("Failed to change the permissions of \"%s\": %s"),
g_file_info_get_display_name (info),
err->message);
@@ -999,7 +1014,7 @@
_thunar_return_val_if_fail (param_values->n_values == 1, FALSE);
_thunar_return_val_if_fail (error == NULL || *error == NULL, FALSE);
- if (thunar_job_set_error_if_cancelled (job, error))
+ if (exo_job_set_error_if_cancelled (EXO_JOB (job), error))
return FALSE;
/* determine the directory to list */
@@ -1015,7 +1030,7 @@
/* turn the GFile list into a ThunarFile list */
for (lp = g_list_last (path_list);
- err == NULL && !thunar_job_is_cancelled (job) && lp != NULL;
+ err == NULL && !exo_job_is_cancelled (EXO_JOB (job)) && lp != NULL;
lp = lp->prev)
{
file = thunar_file_get (lp->data, &err);
@@ -1032,7 +1047,7 @@
g_propagate_error (error, err);
return FALSE;
}
- else if (G_UNLIKELY (thunar_job_set_error_if_cancelled (job, &err)))
+ else if (G_UNLIKELY (exo_job_set_error_if_cancelled (EXO_JOB (job), &err)))
{
g_propagate_error (error, err);
return FALSE;
@@ -1042,7 +1057,7 @@
if (G_LIKELY (file_list != NULL))
{
/* emit the "files-ready" signal */
- if (!thunar_job_files_ready (job, file_list))
+ if (!thunar_job_files_ready (THUNAR_JOB (job), file_list))
{
/* none of the handlers took over the file list, so it's up to us
* to destroy it */
@@ -1054,7 +1069,7 @@
_thunar_assert (err == NULL);
/* propagate cancellation error */
- if (thunar_job_set_error_if_cancelled (job, &err))
+ if (exo_job_set_error_if_cancelled (EXO_JOB (job), &err))
{
g_propagate_error (error, err);
return FALSE;
Modified: thunar/branches/migration-to-gio/thunar/thunar-io-scan-directory.c
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-io-scan-directory.c 2009-05-05 21:39:22 UTC (rev 29927)
+++ thunar/branches/migration-to-gio/thunar/thunar-io-scan-directory.c 2009-05-05 22:12:08 UTC (rev 29928)
@@ -24,6 +24,8 @@
#include <gio/gio.h>
+#include <exo/exo.h>
+
#include <thunar/thunar-job.h>
#include <thunar/thunar-private.h>
@@ -49,14 +51,14 @@
_thunar_return_val_if_fail (error == NULL || *error == NULL, NULL);
/* abort if the job was cancelled */
- if (thunar_job_set_error_if_cancelled (job, error))
+ if (exo_job_set_error_if_cancelled (EXO_JOB (job), error))
return NULL;
/* query the file type */
- type = g_file_query_file_type (file, flags, thunar_job_get_cancellable (job));
+ type = g_file_query_file_type (file, flags, exo_job_get_cancellable (EXO_JOB (job)));
/* abort if the job was cancelled */
- if (thunar_job_set_error_if_cancelled (job, error))
+ if (exo_job_set_error_if_cancelled (EXO_JOB (job), error))
return NULL;
/* ignore non-directory nodes */
@@ -67,7 +69,7 @@
enumerator = g_file_enumerate_children (file,
G_FILE_ATTRIBUTE_STANDARD_TYPE ","
G_FILE_ATTRIBUTE_STANDARD_NAME,
- flags, thunar_job_get_cancellable (job),
+ flags, exo_job_get_cancellable (EXO_JOB (job)),
&err);
/* abort if there was an error or the job was cancelled */
@@ -78,10 +80,12 @@
}
/* query info of the first child */
- info = g_file_enumerator_next_file (enumerator, thunar_job_get_cancellable (job), &err);
+ info = g_file_enumerator_next_file (enumerator,
+ exo_job_get_cancellable (EXO_JOB (job)),
+ &err);
/* iterate over children one by one as long as there's no error */
- while (info != NULL && err == NULL && !thunar_job_is_cancelled (job))
+ while (info != NULL && err == NULL && !exo_job_is_cancelled (EXO_JOB (job)))
{
/* create GFile for the child and prepend it to the file list */
child_file = g_file_get_child (file, g_file_info_get_name (info));
@@ -100,7 +104,9 @@
g_object_unref (child_file);
g_object_unref (info);
- info = g_file_enumerator_next_file (enumerator, thunar_job_get_cancellable (job), &err);
+ info = g_file_enumerator_next_file (enumerator,
+ exo_job_get_cancellable (EXO_JOB (job)),
+ &err);
}
/* release the enumerator */
@@ -112,7 +118,7 @@
g_file_list_free (files);
return NULL;
}
- else if (thunar_job_set_error_if_cancelled (job, &err))
+ else if (exo_job_set_error_if_cancelled (EXO_JOB (job), &err))
{
g_propagate_error (error, err);
g_file_list_free (files);
Modified: thunar/branches/migration-to-gio/thunar/thunar-io-scan-directory.h
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-io-scan-directory.h 2009-05-05 21:39:22 UTC (rev 29927)
+++ thunar/branches/migration-to-gio/thunar/thunar-io-scan-directory.h 2009-05-05 22:12:08 UTC (rev 29928)
@@ -21,6 +21,8 @@
#ifndef __THUNAR_IO_SCAN_DIRECTORY_H__
#define __THUNAR_IO_SCAN_DIRECTORY_H__
+#include <exo/exo.h>
+
#include <thunar/thunar-job.h>
#include <thunar/thunar-private.h>
Modified: thunar/branches/migration-to-gio/thunar/thunar-job.c
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-job.c 2009-05-05 21:39:22 UTC (rev 29927)
+++ thunar/branches/migration-to-gio/thunar/thunar-job.c 2009-05-05 22:12:08 UTC (rev 29928)
@@ -2,20 +2,20 @@
/*-
* Copyright (c) 2009 Jannis Pohlmann <jannis at xfce.org>
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful,
+ * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
@@ -29,6 +29,8 @@
#include <string.h>
#endif
+#include <exo/exo.h>
+
#include <thunar/thunar-enum-types.h>
#include <thunar/thunar-job.h>
#include <thunar/thunar-marshal.h>
@@ -45,21 +47,13 @@
{
ASK,
ASK_REPLACE,
- ERROR,
- FINISHED,
- INFO_MESSAGE,
FILES_READY,
NEW_FILES,
- PERCENT,
LAST_SIGNAL,
};
-typedef struct _ThunarJobSyncSignalData ThunarJobSyncSignalData;
-
-
-
static void thunar_job_class_init (ThunarJobClass *klass);
static void thunar_job_init (ThunarJob *job);
static void thunar_job_finalize (GObject *object);
@@ -69,17 +63,6 @@
static ThunarJobResponse thunar_job_real_ask_replace (ThunarJob *job,
ThunarFile *source_file,
ThunarFile *target_file);
-static void _thunar_job_error (ThunarJob *job,
- GError *error);
-static void _thunar_job_finished (ThunarJob *job);
-static gboolean _thunar_job_finish (ThunarJob *job,
- GSimpleAsyncResult *result,
- GError **error);
-static void _thunar_job_async_ready (GObject *object,
- GAsyncResult *result);
-static gboolean _thunar_job_scheduler_job_func (GIOSchedulerJob *scheduler_job,
- GCancellable *cancellable,
- gpointer user_data);
@@ -88,27 +71,16 @@
ThunarJobResponse earlier_ask_create_response;
ThunarJobResponse earlier_ask_overwrite_response;
ThunarJobResponse earlier_ask_skip_response;
- GIOSchedulerJob *scheduler_job;
- GCancellable *cancellable;
GList *total_files;
- guint running : 1;
};
-struct _ThunarJobSyncSignalData
-{
- gpointer instance;
- GQuark signal_detail;
- guint signal_id;
- va_list var_args;
-};
+static ExoJobClass *thunar_job_parent_class;
+static guint job_signals[LAST_SIGNAL];
-static GObjectClass *thunar_job_parent_class;
-static guint job_signals[LAST_SIGNAL];
-
GType
thunar_job_get_type (void)
{
@@ -116,7 +88,7 @@
if (G_UNLIKELY (type == G_TYPE_INVALID))
{
- type = g_type_register_static_simple (G_TYPE_OBJECT,
+ type = g_type_register_static_simple (EXO_TYPE_JOB,
"ThunarJob",
sizeof (ThunarJobClass),
(GClassInitFunc) thunar_job_class_init,
@@ -156,7 +128,6 @@
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = thunar_job_finalize;
- klass->execute = NULL;
klass->ask = thunar_job_real_ask;
klass->ask_replace = thunar_job_real_ask_replace;
@@ -204,20 +175,6 @@
2, THUNAR_TYPE_FILE, THUNAR_TYPE_FILE);
/**
- * ThunarJob::error:
- * @job : a #ThunarJob.
- * @error : a #GError describing the cause.
- *
- * Emitted whenever an error occurs while executing the @job.
- **/
- job_signals[ERROR] =
- g_signal_new (I_("error"),
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_NO_HOOKS, 0, NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
-
- /**
* ThunarJob::files-ready:
* @job : a #ThunarJob.
* @file_list : a list of #ThunarFile<!---->s.
@@ -253,42 +210,6 @@
G_TYPE_BOOLEAN, 1, G_TYPE_POINTER);
/**
- * ThunarJob::finished:
- * @job : a #ThunarJob.
- *
- * This signal will be automatically emitted once the
- * @job finishes its execution, no matter whether @job
- * completed successfully or was cancelled by the
- * user.
- **/
- job_signals[FINISHED] =
- g_signal_new (I_("finished"),
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_NO_HOOKS, 0, NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- /**
- * ThunarJob::info-message:
- * @job : a #ThunarJob.
- * @message : information to be displayed about @job.
- *
- * This signal is emitted to display information about the
- * @job. Examples of messages are "Preparing..." or
- * "Cleaning up...".
- *
- * The @message is garantied to contain valid UTF-8, so
- * it can be displayed by #GtkWidget<!---->s out of the
- * box.
- **/
- job_signals[INFO_MESSAGE] =
- g_signal_new (I_("info-message"),
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_NO_HOOKS, 0, NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 1, G_TYPE_STRING);
-
- /**
* ThunarJob::new-files:
* @job : a #ThunarJob.
* @file_list : a list of #GFile<!---->s that were created by @job.
@@ -304,24 +225,6 @@
G_SIGNAL_NO_HOOKS, 0, NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1, G_TYPE_POINTER);
-
- /**
- * ThunarJob::percent:
- * @job : a #ThunarJob.
- * @percent : the percentage of completeness.
- *
- * This signal is emitted to present the state
- * of the overall progress.
- *
- * The @percent value is garantied to be in the
- * range 0.0 to 100.0.
- **/
- job_signals[PERCENT] =
- g_signal_new (I_("percent"),
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_NO_HOOKS, 0, NULL, NULL,
- g_cclosure_marshal_VOID__DOUBLE,
- G_TYPE_NONE, 1, G_TYPE_DOUBLE);
}
@@ -330,12 +233,9 @@
thunar_job_init (ThunarJob *job)
{
job->priv = THUNAR_JOB_GET_PRIVATE (job);
- job->priv->cancellable = g_cancellable_new ();
job->priv->earlier_ask_create_response = 0;
job->priv->earlier_ask_overwrite_response = 0;
job->priv->earlier_ask_skip_response = 0;
- job->priv->running = FALSE;
- job->priv->scheduler_job = NULL;
}
@@ -343,11 +243,6 @@
static void
thunar_job_finalize (GObject *object)
{
- ThunarJob *job = THUNAR_JOB (object);
-
- thunar_job_cancel (job);
- g_object_unref (job->priv->cancellable);
-
(*G_OBJECT_CLASS (thunar_job_parent_class)->finalize) (object);
}
@@ -399,235 +294,6 @@
-static gboolean
-_thunar_job_finish (ThunarJob *job,
- GSimpleAsyncResult *result,
- GError **error)
-{
- _thunar_return_val_if_fail (THUNAR_IS_JOB (job), FALSE);
- _thunar_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (result), FALSE);
- _thunar_return_val_if_fail (error == NULL || *error == NULL, FALSE);
-
- return !g_simple_async_result_propagate_error (result, error);
-}
-
-
-
-static void
-_thunar_job_async_ready (GObject *object,
- GAsyncResult *result)
-{
- ThunarJob *job = THUNAR_JOB (object);
- GError *error = NULL;
-
- _thunar_return_if_fail (THUNAR_IS_JOB (job));
- _thunar_return_if_fail (G_IS_SIMPLE_ASYNC_RESULT (result));
-
- if (!_thunar_job_finish (job, G_SIMPLE_ASYNC_RESULT (result), &error))
- {
- g_assert (error != NULL);
-
- /* don't treat cancellation as an error for now */
- if (error->code != G_IO_ERROR_CANCELLED)
- _thunar_job_error (job, error);
-
- g_error_free (error);
- }
-
- _thunar_job_finished (job);
-}
-
-
-
-static gboolean
-_thunar_job_scheduler_job_func (GIOSchedulerJob *scheduler_job,
- GCancellable *cancellable,
- gpointer user_data)
-{
- GSimpleAsyncResult *result = user_data;
- ThunarJob *job;
- GError *error = NULL;
- gboolean success;
-
- job = g_simple_async_result_get_op_res_gpointer (result);
- job->priv->scheduler_job = scheduler_job;
-
- success = (*THUNAR_JOB_GET_CLASS (job)->execute) (job, &error);
-
- /* TODO why was this necessary again? */
- g_io_scheduler_job_send_to_mainloop (scheduler_job, (GSourceFunc) gtk_false,
- NULL, NULL);
-
- if (!success)
- {
- g_simple_async_result_set_from_error (result, error);
- g_error_free (error);
- }
-
- g_simple_async_result_complete_in_idle (result);
-
- return FALSE;
-}
-
-
-
-/**
- * thunar_job_launch:
- * @job : a #ThunarJob.
- *
- * This functions schedules @job to be run as soon
- * as possible, in a separate thread.
- *
- * Return value: a pointer to @job.
- **/
-ThunarJob*
-thunar_job_launch (ThunarJob *job)
-{
- GSimpleAsyncResult *result;
-
- _thunar_return_val_if_fail (THUNAR_IS_JOB (job), NULL);
- _thunar_return_val_if_fail (!job->priv->running, NULL);
- _thunar_return_val_if_fail (THUNAR_JOB_GET_CLASS (job)->execute != NULL, NULL);
-
- /* mark the job as running */
- job->priv->running = TRUE;
-
- result = g_simple_async_result_new (G_OBJECT (job),
- (GAsyncReadyCallback) _thunar_job_async_ready,
- NULL,
- thunar_job_launch);
-
- g_simple_async_result_set_op_res_gpointer (result,
- g_object_ref (job),
- (GDestroyNotify) g_object_unref);
-
- g_io_scheduler_push_job (_thunar_job_scheduler_job_func,
- result,
- (GDestroyNotify) g_object_unref,
- G_PRIORITY_HIGH,
- job->priv->cancellable);
-
- return job;
-}
-
-
-
-/**
- * thunar_job_cancel:
- * @job : a #ThunarJob.
- *
- * Attempts to cancel the operation currently
- * performed by @job. Even after the cancellation
- * of @job, it may still emit signals, so you
- * must take care of disconnecting all handlers
- * appropriately if you cannot handle signals
- * after cancellation.
- **/
-void
-thunar_job_cancel (ThunarJob *job)
-{
- _thunar_return_if_fail (THUNAR_IS_JOB (job));
- g_cancellable_cancel (job->priv->cancellable);
-}
-
-
-
-/**
- * thunar_job_is_cancelled:
- * @job : a #ThunarJob.
- *
- * Checks whether @job was previously cancelled
- * by a call to thunar_job_cancel().
- *
- * Return value: %TRUE if @job is cancelled.
- **/
-gboolean
-thunar_job_is_cancelled (const ThunarJob *job)
-{
- _thunar_return_val_if_fail (THUNAR_IS_JOB (job), FALSE);
- return g_cancellable_is_cancelled (job->priv->cancellable);
-}
-
-
-
-GCancellable *
-thunar_job_get_cancellable (const ThunarJob *job)
-{
- _thunar_return_val_if_fail (THUNAR_IS_JOB (job), NULL);
- return job->priv->cancellable;
-}
-
-
-
-gboolean
-thunar_job_set_error_if_cancelled (ThunarJob *job,
- GError **error)
-{
- _thunar_return_val_if_fail (THUNAR_IS_JOB (job), FALSE);
- return g_cancellable_set_error_if_cancelled (job->priv->cancellable, error);
-}
-
-
-
-static gboolean
-_thunar_job_emit_valist_in_mainloop (gpointer user_data)
-{
- ThunarJobSyncSignalData *data = user_data;
-
- g_signal_emit_valist (data->instance,
- data->signal_id,
- data->signal_detail,
- data->var_args);
-
- return FALSE;
-}
-
-
-
-void
-thunar_job_emit_valist (ThunarJob *job,
- guint signal_id,
- GQuark signal_detail,
- va_list var_args)
-{
- ThunarJobSyncSignalData data;
-
- _thunar_return_if_fail (THUNAR_IS_JOB (job));
- _thunar_return_if_fail (job->priv->scheduler_job != NULL);
-
- data.instance = job;
- data.signal_id = signal_id;
- data.signal_detail = signal_detail;
-
- /* copy the variable argument list */
- G_VA_COPY (data.var_args, var_args);
-
- /* emit the signal in the main loop */
- g_io_scheduler_job_send_to_mainloop (job->priv->scheduler_job,
- _thunar_job_emit_valist_in_mainloop,
- &data,
- NULL);
-}
-
-
-
-void
-thunar_job_emit (ThunarJob *job,
- guint signal_id,
- GQuark signal_detail,
- ...)
-{
- va_list var_args;
-
- _thunar_return_if_fail (THUNAR_IS_JOB (job));
-
- va_start (var_args, signal_detail);
- thunar_job_emit_valist (job, signal_id, signal_detail, var_args);
- va_end (var_args);
-}
-
-
-
static ThunarJobResponse
_thunar_job_ask_valist (ThunarJob *job,
const gchar *format,
@@ -650,12 +316,12 @@
g_free (text);
/* send the question and wait for the answer */
- thunar_job_emit (job, job_signals[ASK], 0, message, choices, &response);
+ exo_job_emit (EXO_JOB (job), job_signals[ASK], 0, message, choices, &response);
g_free (message);
/* cancel the job as per users request */
if (G_UNLIKELY (response == THUNAR_JOB_RESPONSE_CANCEL))
- thunar_job_cancel (job);
+ exo_job_cancel (EXO_JOB (job));
return response;
}
@@ -674,7 +340,7 @@
_thunar_return_val_if_fail (format != NULL, THUNAR_JOB_RESPONSE_CANCEL);
/* check if the user already cancelled the job */
- if (G_UNLIKELY (thunar_job_is_cancelled (job)))
+ if (G_UNLIKELY (exo_job_is_cancelled (EXO_JOB (job))))
return THUNAR_JOB_RESPONSE_CANCEL;
/* check if the user said "Overwrite All" earlier */
@@ -729,7 +395,7 @@
_thunar_return_val_if_fail (THUNAR_IS_JOB (job), THUNAR_JOB_RESPONSE_CANCEL);
- if (G_UNLIKELY (thunar_job_is_cancelled (job)))
+ if (G_UNLIKELY (exo_job_is_cancelled (EXO_JOB (job))))
return THUNAR_JOB_RESPONSE_CANCEL;
/* check if the user said "Create All" earlier */
@@ -755,7 +421,7 @@
else if (response == THUNAR_JOB_RESPONSE_NO_ALL)
response = THUNAR_JOB_RESPONSE_NO;
else if (response == THUNAR_JOB_RESPONSE_CANCEL)
- thunar_job_cancel (job);
+ exo_job_cancel (EXO_JOB (job));
return response;
}
@@ -776,7 +442,7 @@
_thunar_return_val_if_fail (G_IS_FILE (source_path), THUNAR_JOB_RESPONSE_CANCEL);
_thunar_return_val_if_fail (G_IS_FILE (target_path), THUNAR_JOB_RESPONSE_CANCEL);
- if (G_UNLIKELY (thunar_job_set_error_if_cancelled (job, error)))
+ if (G_UNLIKELY (exo_job_set_error_if_cancelled (EXO_JOB (job), error)))
return THUNAR_JOB_RESPONSE_CANCEL;
/* check if the user said "Overwrite All" earlier */
@@ -800,7 +466,8 @@
return THUNAR_JOB_RESPONSE_NO;
}
- thunar_job_emit (job, job_signals[ASK_REPLACE], 0, source_file, target_file, &response);
+ exo_job_emit (EXO_JOB (job), job_signals[ASK_REPLACE], 0,
+ source_file, target_file, &response);
g_object_unref (source_file);
g_object_unref (target_file);
@@ -814,7 +481,7 @@
else if (response == THUNAR_JOB_RESPONSE_NO_ALL)
response = THUNAR_JOB_RESPONSE_NO;
else if (response == THUNAR_JOB_RESPONSE_CANCEL)
- thunar_job_cancel (job);
+ exo_job_cancel (EXO_JOB (job));
return response;
}
@@ -833,7 +500,7 @@
_thunar_return_val_if_fail (format != NULL, THUNAR_JOB_RESPONSE_CANCEL);
/* check if the user already cancelled the job */
- if (G_UNLIKELY (thunar_job_is_cancelled (job)))
+ if (G_UNLIKELY (exo_job_is_cancelled (EXO_JOB (job))))
return THUNAR_JOB_RESPONSE_CANCEL;
/* check if the user said "Skip All" earlier */
@@ -881,25 +548,14 @@
gboolean handled = FALSE;
_thunar_return_val_if_fail (THUNAR_IS_JOB (job), FALSE);
- thunar_job_emit (job, job_signals[FILES_READY], 0, file_list, &handled);
+
+ exo_job_emit (EXO_JOB (job), job_signals[FILES_READY], 0, file_list, &handled);
return handled;
}
void
-thunar_job_info_message (ThunarJob *job,
- const gchar *message)
-{
- _thunar_return_if_fail (THUNAR_IS_JOB (job));
- _thunar_return_if_fail (message != NULL);
-
- thunar_job_emit (job, job_signals[INFO_MESSAGE], 0, message);
-}
-
-
-
-void
thunar_job_new_files (ThunarJob *job,
const GList *file_list)
{
@@ -909,46 +565,13 @@
if (G_LIKELY (file_list != NULL))
{
/* emit the "new-files" signal */
- thunar_job_emit (job, job_signals[NEW_FILES], 0, file_list);
+ exo_job_emit (EXO_JOB (job), job_signals[NEW_FILES], 0, file_list);
}
}
void
-thunar_job_percent (ThunarJob *job,
- gdouble percent)
-{
- _thunar_return_if_fail (THUNAR_IS_JOB (job));
-
- percent = MAX (0.0, MIN (100.0, percent));
- thunar_job_emit (job, job_signals[PERCENT], 0, percent);
-}
-
-
-
-static void
-_thunar_job_error (ThunarJob *job,
- GError *error)
-{
- _thunar_return_if_fail (THUNAR_IS_JOB (job));
- _thunar_return_if_fail (error != NULL);
-
- g_signal_emit (job, job_signals[ERROR], 0, error);
-}
-
-
-
-static void
-_thunar_job_finished (ThunarJob *job)
-{
- _thunar_return_if_fail (THUNAR_IS_JOB (job));
- g_signal_emit (job, job_signals[FINISHED], 0);
-}
-
-
-
-void
thunar_job_set_total_files (ThunarJob *job,
GList *total_files)
{
@@ -978,7 +601,7 @@
display_name = g_filename_display_name (basename);
g_free (basename);
- thunar_job_info_message (job, display_name);
+ exo_job_info_message (EXO_JOB (job), display_name);
g_free (display_name);
/* verify that we have total files set */
@@ -995,7 +618,7 @@
/* determine the total_number of files */
n_total = g_list_length (job->priv->total_files);
- thunar_job_percent (job, (n_processed * 100.0) / n_total);
+ exo_job_percent (EXO_JOB (job), (n_processed * 100.0) / n_total);
}
}
}
Modified: thunar/branches/migration-to-gio/thunar/thunar-job.h
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-job.h 2009-05-05 21:39:22 UTC (rev 29927)
+++ thunar/branches/migration-to-gio/thunar/thunar-job.h 2009-05-05 22:12:08 UTC (rev 29928)
@@ -1,22 +1,22 @@
-/* $Id$ */
+/* vi:set et ai sw=2 sts=2 ts=2: */
/*-
* Copyright (c) 2005-2007 Benedikt Meurer <benny at xfce.org>
* Copyright (c) 2009 Jannis Pohlmann <jannis at xfce.org>
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful,
+ * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#ifndef __THUNAR_JOB_H__
@@ -24,6 +24,8 @@
#include <gio/gio.h>
+#include <exo/exo.h>
+
#include <thunar/thunar-enum-types.h>
#include <thunar/thunar-file.h>
@@ -43,14 +45,10 @@
struct _ThunarJobClass
{
/*< private >*/
- GObjectClass __parent__;
+ ExoJobClass __parent__;
/*< public >*/
- /* virtual methods */
- gboolean (*execute) (ThunarJob *job,
- GError **error);
-
/* signals */
ThunarJobResponse (*ask) (ThunarJob *job,
const gchar *message,
@@ -63,28 +61,16 @@
struct _ThunarJob
{
/*< private >*/
- GObject __parent__;
+ ExoJob __parent__;
ThunarJobPrivate *priv;
};
GType thunar_job_get_type (void) G_GNUC_CONST;
-ThunarJob *thunar_job_launch (ThunarJob *job);
-void thunar_job_cancel (ThunarJob *job);
-gboolean thunar_job_is_cancelled (const ThunarJob *job);
-
-GCancellable *thunar_job_get_cancellable (const ThunarJob *job);
-gboolean thunar_job_set_error_if_cancelled (ThunarJob *job,
- GError **error);
-
void thunar_job_set_total_files (ThunarJob *job,
GList *total_files);
void thunar_job_processing_file (ThunarJob *job,
GList *current_file);
-void thunar_job_emit (ThunarJob *job,
- guint signal_id,
- GQuark signal_detail,
- ...);
ThunarJobResponse thunar_job_ask_create (ThunarJob *job,
const gchar *format,
...);
@@ -100,12 +86,8 @@
...);
gboolean thunar_job_files_ready (ThunarJob *job,
GList *file_list);
-void thunar_job_info_message (ThunarJob *job,
- const gchar *message);
void thunar_job_new_files (ThunarJob *job,
const GList *file_list);
-void thunar_job_percent (ThunarJob *job,
- gdouble percent);
G_END_DECLS
Modified: thunar/branches/migration-to-gio/thunar/thunar-permissions-chooser.c
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-permissions-chooser.c 2009-05-05 21:39:22 UTC (rev 29927)
+++ thunar/branches/migration-to-gio/thunar/thunar-permissions-chooser.c 2009-05-05 22:12:08 UTC (rev 29928)
@@ -32,6 +32,8 @@
#include <unistd.h>
#endif
+#include <exo/exo.h>
+
#include <thunar/thunar-dialogs.h>
#include <thunar/thunar-enum-types.h>
#include <thunar/thunar-gobject-extensions.h>
@@ -459,7 +461,7 @@
if (G_UNLIKELY (chooser->job != NULL))
{
/* cancel the job (if not already done) */
- thunar_job_cancel (chooser->job);
+ exo_job_cancel (EXO_JOB (chooser->job));
/* disconnect from the job */
g_signal_handlers_disconnect_matched (chooser->job, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, chooser);
@@ -675,9 +677,9 @@
ThunarFileMode file_mask,
ThunarFileMode file_mode)
{
- ThunarJob *job;
- gboolean recursive = FALSE;
- gint response;
+ ThunarJob*job;
+ gboolean recursive = FALSE;
+ gint response;
_thunar_return_if_fail (THUNAR_IS_PERMISSIONS_CHOOSER (chooser));
_thunar_return_if_fail (THUNAR_IS_FILE (chooser->file));
@@ -707,7 +709,7 @@
dir_mask, dir_mode, file_mask, file_mode,
recursive);
thunar_permissions_chooser_job_start (chooser, job, recursive);
- g_object_unref (G_OBJECT (job));
+ g_object_unref (job);
}
@@ -989,9 +991,9 @@
GtkWidget *button)
{
ThunarFileMode mode;
- ThunarJob *job;
GtkWidget *dialog;
GtkWidget *window;
+ ThunarJob *job;
gint response;
_thunar_return_if_fail (THUNAR_IS_PERMISSIONS_CHOOSER (chooser));
@@ -1083,7 +1085,7 @@
return;
/* cancel the job (if not already done) */
- thunar_job_cancel (chooser->job);
+ exo_job_cancel (EXO_JOB (chooser->job));
/* disconnect from the job */
g_signal_handlers_disconnect_matched (chooser->job, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, chooser);
Modified: thunar/branches/migration-to-gio/thunar/thunar-progress-dialog.c
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-progress-dialog.c 2009-05-05 21:39:22 UTC (rev 29927)
+++ thunar/branches/migration-to-gio/thunar/thunar-progress-dialog.c 2009-05-05 22:12:08 UTC (rev 29928)
@@ -55,22 +55,22 @@
static ThunarJobResponse thunar_progress_dialog_ask (ThunarProgressDialog *dialog,
const gchar *message,
ThunarJobResponse choices,
- ThunarJob *job);
+ ExoJob *job);
static ThunarJobResponse thunar_progress_dialog_ask_replace (ThunarProgressDialog *dialog,
ThunarFile *src_file,
ThunarFile *dst_file,
- ThunarJob *job);
+ ExoJob *job);
static void thunar_progress_dialog_error (ThunarProgressDialog *dialog,
GError *error,
- ThunarJob *job);
+ ExoJob *job);
static void thunar_progress_dialog_finished (ThunarProgressDialog *dialog,
- ThunarJob *job);
+ ExoJob *job);
static void thunar_progress_dialog_info_message (ThunarProgressDialog *dialog,
const gchar *message,
- ThunarJob *job);
+ ExoJob *job);
static void thunar_progress_dialog_percent (ThunarProgressDialog *dialog,
gdouble percent,
- ThunarJob *job);
+ ExoJob *job);
@@ -83,7 +83,7 @@
{
GtkDialog __parent__;
- ThunarJob *job;
+ ExoJob *job;
GTimeVal start_time;
GTimeVal last_update_time;
@@ -273,7 +273,7 @@
thunar_progress_dialog_ask (ThunarProgressDialog *dialog,
const gchar *message,
ThunarJobResponse choices,
- ThunarJob *job)
+ ExoJob *job)
{
_thunar_return_val_if_fail (THUNAR_IS_PROGRESS_DIALOG (dialog), THUNAR_JOB_RESPONSE_CANCEL);
_thunar_return_val_if_fail (g_utf8_validate (message, -1, NULL), THUNAR_JOB_RESPONSE_CANCEL);
@@ -293,7 +293,7 @@
thunar_progress_dialog_ask_replace (ThunarProgressDialog *dialog,
ThunarFile *src_file,
ThunarFile *dst_file,
- ThunarJob *job)
+ ExoJob *job)
{
_thunar_return_val_if_fail (THUNAR_IS_PROGRESS_DIALOG (dialog), THUNAR_JOB_RESPONSE_CANCEL);
_thunar_return_val_if_fail (THUNAR_IS_JOB (job), THUNAR_JOB_RESPONSE_CANCEL);
@@ -313,7 +313,7 @@
static void
thunar_progress_dialog_error (ThunarProgressDialog *dialog,
GError *error,
- ThunarJob *job)
+ ExoJob *job)
{
_thunar_return_if_fail (THUNAR_IS_PROGRESS_DIALOG (dialog));
_thunar_return_if_fail (error != NULL && error->message != NULL);
@@ -331,7 +331,7 @@
static void
thunar_progress_dialog_finished (ThunarProgressDialog *dialog,
- ThunarJob *job)
+ ExoJob *job)
{
_thunar_return_if_fail (THUNAR_IS_PROGRESS_DIALOG (dialog));
_thunar_return_if_fail (THUNAR_IS_JOB (job));
@@ -345,7 +345,7 @@
static void
thunar_progress_dialog_info_message (ThunarProgressDialog *dialog,
const gchar *message,
- ThunarJob *job)
+ ExoJob *job)
{
_thunar_return_if_fail (THUNAR_IS_PROGRESS_DIALOG (dialog));
_thunar_return_if_fail (g_utf8_validate (message, -1, NULL));
@@ -370,7 +370,7 @@
static void
thunar_progress_dialog_percent (ThunarProgressDialog *dialog,
gdouble percent,
- ThunarJob *job)
+ ExoJob *job)
{
GTimeVal current_time;
gulong remaining_time;
@@ -442,7 +442,7 @@
case GTK_RESPONSE_CLOSE:
case GTK_RESPONSE_NO:
if (G_LIKELY (THUNAR_PROGRESS_DIALOG (dialog)->job != NULL))
- thunar_job_cancel (THUNAR_PROGRESS_DIALOG (dialog)->job);
+ exo_job_cancel (THUNAR_PROGRESS_DIALOG (dialog)->job);
break;
}
@@ -469,7 +469,7 @@
/**
* thunar_progress_dialog_new_with_job:
- * @job : a #ThunarJob or %NULL.
+ * @job : a #ExoJob or %NULL.
*
* Allocates a new #ThunarProgressDialog and associates it with
* the @job.
@@ -477,7 +477,7 @@
* Return value: the newly allocated #ThunarProgressDialog.
**/
GtkWidget*
-thunar_progress_dialog_new_with_job (ThunarJob *job)
+thunar_progress_dialog_new_with_job (ExoJob *job)
{
_thunar_return_val_if_fail (job == NULL || THUNAR_IS_JOB (job), NULL);
return g_object_new (THUNAR_TYPE_PROGRESS_DIALOG, "job", job, NULL);
@@ -489,12 +489,12 @@
* thunar_progress_dialog_get_job:
* @dialog : a #ThunarProgressDialog.
*
- * Returns the #ThunarJob associated with @dialog
+ * Returns the #ExoJob associated with @dialog
* or %NULL if no job is currently associated with @dialog.
*
* Return value: the job associated with @dialog or %NULL.
**/
-ThunarJob *
+ExoJob *
thunar_progress_dialog_get_job (ThunarProgressDialog *dialog)
{
_thunar_return_val_if_fail (THUNAR_IS_PROGRESS_DIALOG (dialog), NULL);
@@ -506,13 +506,13 @@
/**
* thunar_progress_dialog_set_job:
* @dialog : a #ThunarProgressDialog.
- * @job : a #ThunarJob or %NULL.
+ * @job : a #ExoJob or %NULL.
*
* Associates @job with @dialog.
**/
void
thunar_progress_dialog_set_job (ThunarProgressDialog *dialog,
- ThunarJob *job)
+ ExoJob *job)
{
_thunar_return_if_fail (THUNAR_IS_PROGRESS_DIALOG (dialog));
_thunar_return_if_fail (job == NULL || THUNAR_IS_JOB (job));
Modified: thunar/branches/migration-to-gio/thunar/thunar-progress-dialog.h
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-progress-dialog.h 2009-05-05 21:39:22 UTC (rev 29927)
+++ thunar/branches/migration-to-gio/thunar/thunar-progress-dialog.h 2009-05-05 22:12:08 UTC (rev 29928)
@@ -38,11 +38,11 @@
GType thunar_progress_dialog_get_type (void) G_GNUC_CONST;
GtkWidget *thunar_progress_dialog_new (void) G_GNUC_MALLOC;
-GtkWidget *thunar_progress_dialog_new_with_job (ThunarJob *job) G_GNUC_MALLOC;
+GtkWidget *thunar_progress_dialog_new_with_job (ExoJob *job) G_GNUC_MALLOC;
-ThunarJob *thunar_progress_dialog_get_job (ThunarProgressDialog *dialog);
+ExoJob *thunar_progress_dialog_get_job (ThunarProgressDialog *dialog);
void thunar_progress_dialog_set_job (ThunarProgressDialog *dialog,
- ThunarJob *job);
+ ExoJob *job);
G_END_DECLS;
Modified: thunar/branches/migration-to-gio/thunar/thunar-simple-job.c
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-simple-job.c 2009-05-05 21:39:22 UTC (rev 29927)
+++ thunar/branches/migration-to-gio/thunar/thunar-simple-job.c 2009-05-05 22:12:08 UTC (rev 29928)
@@ -3,20 +3,20 @@
* Copyright (c) 2006 Benedikt Meurer <benny at xfce.org>
* Copyright (c) 2009 Jannis Pohlmann <jannis at xfce.org>
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful,
+ * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
@@ -43,7 +43,7 @@
static void thunar_simple_job_class_init (ThunarSimpleJobClass *klass);
static void thunar_simple_job_finalize (GObject *object);
-static gboolean thunar_simple_job_execute (ThunarJob *job,
+static gboolean thunar_simple_job_execute (ExoJob *job,
GError **error);
@@ -90,8 +90,8 @@
static void
thunar_simple_job_class_init (ThunarSimpleJobClass *klass)
{
- ThunarJobClass *thunarjob_class;
- GObjectClass *gobject_class;
+ GObjectClass *gobject_class;
+ ExoJobClass *exojob_class;
/* determine the parent type class */
thunar_simple_job_parent_class = g_type_class_peek_parent (klass);
@@ -99,8 +99,8 @@
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = thunar_simple_job_finalize;
- thunarjob_class = THUNAR_JOB_CLASS (klass);
- thunarjob_class->execute = thunar_simple_job_execute;
+ exojob_class = EXO_JOB_CLASS (klass);
+ exojob_class->execute = thunar_simple_job_execute;
}
@@ -119,8 +119,8 @@
static gboolean
-thunar_simple_job_execute (ThunarJob *job,
- GError **error)
+thunar_simple_job_execute (ExoJob *job,
+ GError **error)
{
ThunarSimpleJob *simple_job = THUNAR_SIMPLE_JOB (job);
gboolean success = TRUE;
@@ -130,15 +130,15 @@
_thunar_return_val_if_fail (simple_job->func != NULL, FALSE);
/* try to execute the job using the supplied function */
- success = (*simple_job->func) (job, simple_job->param_values, &err);
+ success = (*simple_job->func) (THUNAR_JOB (job), simple_job->param_values, &err);
if (!success)
{
- g_assert (err != NULL || thunar_job_is_cancelled (job));
+ g_assert (err != NULL || exo_job_is_cancelled (job));
/* set error if the job was cancelled. otherwise just propagate
* the results of the processing function */
- if (thunar_job_set_error_if_cancelled (job, error))
+ if (exo_job_set_error_if_cancelled (job, error))
{
g_clear_error (&err);
}
@@ -180,7 +180,7 @@
*
* Return value: the launched #ThunarJob.
**/
-ThunarJob*
+ThunarJob *
thunar_simple_job_launch (ThunarSimpleJobFunc func,
guint n_param_values,
...)
@@ -219,5 +219,5 @@
va_end (var_args);
/* launch the job */
- return thunar_job_launch (THUNAR_JOB (simple_job));
+ return THUNAR_JOB (exo_job_launch (EXO_JOB (simple_job)));
}
Modified: thunar/branches/migration-to-gio/thunar/thunar-simple-job.h
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-simple-job.h 2009-05-05 21:39:22 UTC (rev 29927)
+++ thunar/branches/migration-to-gio/thunar/thunar-simple-job.h 2009-05-05 22:12:08 UTC (rev 29928)
@@ -1,22 +1,21 @@
-/* $Id$ */
+/* vi:set et ai sw=2 sts=2 ts=2: */
/*-
- * Copyright (c) 2006 Benedikt Meurer <benny at xfce.org>
* Copyright (c) 2009 Jannis Pohlmann <jannis at xfce.org>
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful,
+ * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#ifndef __THUNAR_SIMPLE_JOB_H__
Modified: thunar/branches/migration-to-gio/thunar/thunar-size-label.c
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-size-label.c 2009-05-05 21:39:22 UTC (rev 29927)
+++ thunar/branches/migration-to-gio/thunar/thunar-size-label.c 2009-05-05 22:12:08 UTC (rev 29928)
@@ -62,12 +62,12 @@
ThunarSizeLabel *size_label);
static void thunar_size_label_file_changed (ThunarFile *file,
ThunarSizeLabel *size_label);
-static void thunar_size_label_error (ThunarJob *job,
+static void thunar_size_label_error (ExoJob *job,
const GError *error,
ThunarSizeLabel *size_label);
-static void thunar_size_label_finished (ThunarJob *job,
+static void thunar_size_label_finished (ExoJob *job,
ThunarSizeLabel *size_label);
-static void thunar_size_label_status_update (ThunarJob *job,
+static void thunar_size_label_status_update (ThunarDeepCountJob *job,
guint64 total_size,
guint file_count,
guint directory_count,
@@ -85,17 +85,17 @@
struct _ThunarSizeLabel
{
- GtkHBox __parent__;
+ GtkHBox __parent__;
- ThunarJob *job;
+ ThunarDeepCountJob *job;
- ThunarFile *file;
+ ThunarFile *file;
- GtkWidget *label;
- GtkWidget *throbber;
+ GtkWidget *label;
+ GtkWidget *throbber;
/* the throbber animation is started after a timeout */
- gint animate_timer_id;
+ gint animate_timer_id;
};
@@ -209,8 +209,8 @@
if (G_UNLIKELY (size_label->job != NULL))
{
g_signal_handlers_disconnect_matched (G_OBJECT (size_label->job), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, size_label);
- thunar_job_cancel (THUNAR_JOB (size_label->job));
- g_object_unref (G_OBJECT (size_label->job));
+ exo_job_cancel (EXO_JOB (size_label->job));
+ g_object_unref (size_label->job);
}
/* reset the file property */
@@ -287,8 +287,8 @@
/* cancel the pending job (if any) */
if (G_UNLIKELY (size_label->job != NULL))
{
- g_signal_handlers_disconnect_matched (G_OBJECT (size_label->job), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, size_label);
- thunar_job_cancel (size_label->job);
+ g_signal_handlers_disconnect_matched (size_label->job, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, size_label);
+ exo_job_cancel (EXO_JOB (size_label->job));
g_object_unref (size_label->job);
size_label->job = NULL;
}
@@ -375,9 +375,9 @@
/* cancel the pending job (if any) */
if (G_UNLIKELY (size_label->job != NULL))
{
- g_signal_handlers_disconnect_matched (G_OBJECT (size_label->job), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, size_label);
- thunar_job_cancel (THUNAR_JOB (size_label->job));
- g_object_unref (G_OBJECT (size_label->job));
+ g_signal_handlers_disconnect_matched (size_label->job, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, size_label);
+ exo_job_cancel (EXO_JOB (size_label->job));
+ g_object_unref (size_label->job);
size_label->job = NULL;
}
@@ -398,7 +398,7 @@
gtk_label_set_text (GTK_LABEL (size_label->label), _("Calculating..."));
/* launch the job */
- thunar_job_launch (size_label->job);
+ exo_job_launch (EXO_JOB (size_label->job));
}
else
{
@@ -432,13 +432,13 @@
static void
-thunar_size_label_error (ThunarJob *job,
+thunar_size_label_error (ExoJob *job,
const GError *error,
ThunarSizeLabel *size_label)
{
_thunar_return_if_fail (THUNAR_IS_JOB (job));
_thunar_return_if_fail (THUNAR_IS_SIZE_LABEL (size_label));
- _thunar_return_if_fail (size_label->job == job);
+ _thunar_return_if_fail (size_label->job == THUNAR_DEEP_COUNT_JOB (job));
/* setup the error text as label */
gtk_label_set_text (GTK_LABEL (size_label->label), error->message);
@@ -447,12 +447,12 @@
static void
-thunar_size_label_finished (ThunarJob *job,
+thunar_size_label_finished (ExoJob *job,
ThunarSizeLabel *size_label)
{
_thunar_return_if_fail (THUNAR_IS_JOB (job));
_thunar_return_if_fail (THUNAR_IS_SIZE_LABEL (size_label));
- _thunar_return_if_fail (size_label->job == job);
+ _thunar_return_if_fail (size_label->job == THUNAR_DEEP_COUNT_JOB (job));
/* be sure to cancel the animate timer */
if (G_UNLIKELY (size_label->animate_timer_id >= 0))
@@ -463,26 +463,26 @@
gtk_widget_hide (size_label->throbber);
/* disconnect from the job */
- g_signal_handlers_disconnect_matched (G_OBJECT (size_label->job), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, size_label);
- g_object_unref (G_OBJECT (size_label->job));
+ g_signal_handlers_disconnect_matched (size_label->job, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, size_label);
+ g_object_unref (size_label->job);
size_label->job = NULL;
}
static void
-thunar_size_label_status_update (ThunarJob *job,
- guint64 total_size,
- guint file_count,
- guint directory_count,
- guint unreadable_directory_count,
- ThunarSizeLabel *size_label)
+thunar_size_label_status_update (ThunarDeepCountJob *job,
+ guint64 total_size,
+ guint file_count,
+ guint directory_count,
+ guint unreadable_directory_count,
+ ThunarSizeLabel *size_label)
{
gchar *size_string;
gchar *text;
guint n;
- _thunar_return_if_fail (THUNAR_IS_JOB (job));
+ _thunar_return_if_fail (THUNAR_IS_DEEP_COUNT_JOB (job));
_thunar_return_if_fail (THUNAR_IS_SIZE_LABEL (size_label));
_thunar_return_if_fail (size_label->job == job);
Modified: thunar/branches/migration-to-gio/thunar/thunar-transfer-job.c
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-transfer-job.c 2009-05-05 21:39:22 UTC (rev 29927)
+++ thunar/branches/migration-to-gio/thunar/thunar-transfer-job.c 2009-05-05 22:12:08 UTC (rev 29928)
@@ -40,7 +40,7 @@
static void thunar_transfer_job_class_init (ThunarTransferJobClass *klass);
static void thunar_transfer_job_init (ThunarTransferJob *job);
static void thunar_transfer_job_finalize (GObject *object);
-static gboolean thunar_transfer_job_execute (ThunarJob *job,
+static gboolean thunar_transfer_job_execute (ExoJob *job,
GError **error);
static void thunar_transfer_node_free (ThunarTransferNode *node);
@@ -101,8 +101,8 @@
static void
thunar_transfer_job_class_init (ThunarTransferJobClass *klass)
{
- ThunarJobClass *thunarjob_class;
- GObjectClass *gobject_class;
+ GObjectClass *gobject_class;
+ ExoJobClass *exojob_class;
/* Determine the parent type class */
thunar_transfer_job_parent_class = g_type_class_peek_parent (klass);
@@ -110,8 +110,8 @@
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = thunar_transfer_job_finalize;
- thunarjob_class = THUNAR_JOB_CLASS (klass);
- thunarjob_class->execute = thunar_transfer_job_execute;
+ exojob_class = EXO_JOB_CLASS (klass);
+ exojob_class->execute = thunar_transfer_job_execute;
}
@@ -162,7 +162,7 @@
job->file_progress = current_num_bytes;
/* notify callers about the progress we made */
- thunar_job_percent (THUNAR_JOB (job), (job->total_progress * 100.0) / job->total_size);
+ exo_job_percent (EXO_JOB (job), (job->total_progress * 100.0) / job->total_size);
}
}
@@ -183,14 +183,14 @@
_thunar_return_val_if_fail (node != NULL && G_IS_FILE (node->source_file), FALSE);
_thunar_return_val_if_fail (error == NULL || *error == NULL, FALSE);
- if (thunar_job_set_error_if_cancelled (THUNAR_JOB (job), error))
+ if (exo_job_set_error_if_cancelled (EXO_JOB (job), error))
return FALSE;
info = g_file_query_info (node->source_file,
G_FILE_ATTRIBUTE_STANDARD_SIZE ","
G_FILE_ATTRIBUTE_STANDARD_TYPE,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
- thunar_job_get_cancellable (THUNAR_JOB (job)),
+ exo_job_get_cancellable (EXO_JOB (job)),
&err);
if (G_UNLIKELY (info == NULL))
@@ -260,26 +260,26 @@
/* reset the file progress */
job->file_progress = 0;
- if (thunar_job_set_error_if_cancelled (THUNAR_JOB (job), error))
+ if (exo_job_set_error_if_cancelled (EXO_JOB (job), error))
return FALSE;
source_type = g_file_query_file_type (source_file, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
- thunar_job_get_cancellable (THUNAR_JOB (job)));
+ exo_job_get_cancellable (EXO_JOB (job)));
- if (thunar_job_set_error_if_cancelled (THUNAR_JOB (job), error))
+ if (exo_job_set_error_if_cancelled (EXO_JOB (job), error))
return FALSE;
target_type = g_file_query_file_type (target_file, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
- thunar_job_get_cancellable (THUNAR_JOB (job)));
+ exo_job_get_cancellable (EXO_JOB (job)));
- if (thunar_job_set_error_if_cancelled (THUNAR_JOB (job), error))
+ if (exo_job_set_error_if_cancelled (EXO_JOB (job), error))
return FALSE;
/* check if the target is a symlink and we are in overwrite mode */
if (target_type == G_FILE_TYPE_SYMBOLIC_LINK && (copy_flags & G_FILE_COPY_OVERWRITE) != 0)
{
/* try to delete the symlink */
- if (!g_file_delete (target_file, thunar_job_get_cancellable (THUNAR_JOB (job)), &err))
+ if (!g_file_delete (target_file, exo_job_get_cancellable (EXO_JOB (job)), &err))
{
g_propagate_error (error, err);
return FALSE;
@@ -288,8 +288,8 @@
/* try to copy the file */
g_file_copy (source_file, target_file, copy_flags,
- thunar_job_get_cancellable (THUNAR_JOB (job)),
- thunar_transfer_job_progress, THUNAR_JOB (job), &err);
+ exo_job_get_cancellable (EXO_JOB (job)),
+ thunar_transfer_job_progress, job, &err);
/* check if there were errors */
if (G_UNLIKELY (err != NULL && err->domain == G_IO_ERROR))
@@ -322,16 +322,16 @@
/* check if the target file exists */
target_exists = g_file_query_exists (target_file,
- thunar_job_get_cancellable (THUNAR_JOB (job)));
+ exo_job_get_cancellable (EXO_JOB (job)));
/* abort on cancellation, continue otherwise */
- if (!thunar_job_set_error_if_cancelled (THUNAR_JOB (job), &err))
+ if (!exo_job_set_error_if_cancelled (EXO_JOB (job), &err))
{
if (target_exists)
{
/* the target still exists and thus is not a directory. try to remove it */
g_file_delete (target_file,
- thunar_job_get_cancellable (THUNAR_JOB ((job))),
+ exo_job_get_cancellable (EXO_JOB (job)),
&err);
}
@@ -340,7 +340,7 @@
{
/* now try to create the directory */
g_file_make_directory (target_file,
- thunar_job_get_cancellable (THUNAR_JOB (job)),
+ exo_job_get_cancellable (EXO_JOB (job)),
&err);
}
}
@@ -399,7 +399,7 @@
_thunar_return_val_if_fail (error == NULL || *error == NULL, NULL);
/* abort on cancellation */
- if (thunar_job_set_error_if_cancelled (THUNAR_JOB (job), error))
+ if (exo_job_set_error_if_cancelled (EXO_JOB (job), error))
return NULL;
/* various attempts to copy the file */
@@ -418,9 +418,10 @@
{
for (n = 1; err == NULL; ++n)
{
- GFile *duplicate_file = thunar_io_jobs_util_next_duplicate_file (THUNAR_JOB (job),
+ GFile *duplicate_file = thunar_io_jobs_util_next_duplicate_file (THUNAR_JOB (job),
source_file,
- TRUE, n, &err);
+ TRUE, n,
+ &err);
if (err == NULL)
{
@@ -522,7 +523,7 @@
info = g_file_query_info (node->source_file,
G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
- thunar_job_get_cancellable (THUNAR_JOB (job)),
+ exo_job_get_cancellable (EXO_JOB (job)),
&err);
/* abort on error or cancellation */
@@ -533,11 +534,12 @@
}
/* update progress information */
- thunar_job_info_message (THUNAR_JOB (job), g_file_info_get_display_name (info));
+ exo_job_info_message (EXO_JOB (job), g_file_info_get_display_name (info));
retry_copy:
/* copy the item specified by this node (not recursively) */
- real_target_file = thunar_transfer_job_copy_file (job, node->source_file, target_file, &err);
+ real_target_file = thunar_transfer_job_copy_file (job, node->source_file,
+ target_file, &err);
if (G_LIKELY (real_target_file != NULL))
{
/* node->source_file == real_target_file means to skip the file */
@@ -570,7 +572,7 @@
retry_remove:
/* try to remove the source directory if we are on copy+remove fallback for move */
if (job->type == THUNAR_TRANSFER_JOB_MOVE &&
- !g_file_delete (node->source_file, thunar_job_get_cancellable (THUNAR_JOB (job)), &err))
+ !g_file_delete (node->source_file, exo_job_get_cancellable (EXO_JOB (job)), &err))
{
/* ask the user to retry */
response = thunar_job_ask_skip (THUNAR_JOB (job), "%s", err->message);
@@ -618,8 +620,8 @@
static gboolean
-thunar_transfer_job_execute (ThunarJob *job,
- GError **error)
+thunar_transfer_job_execute (ExoJob *job,
+ GError **error)
{
ThunarTransferNode *node;
ThunarJobResponse response;
@@ -634,16 +636,15 @@
GList *tp;
GFile *target_parent;
gchar *basename;
- gchar *message;
gchar *parent_display_name;
_thunar_return_val_if_fail (THUNAR_IS_TRANSFER_JOB (job), FALSE);
_thunar_return_val_if_fail (error == NULL || *error == NULL, FALSE);
- if (thunar_job_set_error_if_cancelled (job, error))
+ if (exo_job_set_error_if_cancelled (job, error))
return FALSE;
- thunar_job_info_message (job, _("Collecting files..."));
+ exo_job_info_message (job, _("Collecting files..."));
for (sp = transfer_job->source_node_list, tp = transfer_job->target_file_list;
sp != NULL && tp != NULL && err == NULL;
@@ -659,29 +660,28 @@
info = g_file_query_info (node->source_file,
G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
- thunar_job_get_cancellable (job),
+ exo_job_get_cancellable (job),
&err);
if (G_UNLIKELY (info == NULL))
break;
/* check if we are moving a file out of the trash */
- if (transfer_job->type == THUNAR_TRANSFER_JOB_MOVE && g_file_is_trashed (node->source_file))
+ if (transfer_job->type == THUNAR_TRANSFER_JOB_MOVE
+ && g_file_is_trashed (node->source_file))
{
/* update progress information */
- message = g_strdup_printf (_("Trying to restore \"%s\""),
- g_file_info_get_display_name (info));
- thunar_job_info_message (job, message);
- g_free (message);
+ exo_job_info_message (job, _("Trying to restore \"%s\""),
+ g_file_info_get_display_name (info));
/* determine the parent file */
target_parent = g_file_get_parent (tp->data);
/* check if the parent exists */
- parent_exists = g_file_query_exists (target_parent, thunar_job_get_cancellable (job));
+ parent_exists = g_file_query_exists (target_parent, exo_job_get_cancellable (job));
/* abort on cancellation */
- if (thunar_job_set_error_if_cancelled (job, &err))
+ if (exo_job_set_error_if_cancelled (job, &err))
{
g_object_unref (target_parent);
break;
@@ -695,7 +695,7 @@
g_free (basename);
/* ask the user whether he wants to create the parent folder because its gone */
- response = thunar_job_ask_create (job,
+ response = thunar_job_ask_create (THUNAR_JOB (job),
_("The folder \"%s\" does not exist anymore but is "
"required to restore the file \"%s\" from the "
"trash"),
@@ -712,10 +712,10 @@
/* try to create the parent directory */
if (!g_file_make_directory_with_parents (target_parent,
- thunar_job_get_cancellable (job),
+ exo_job_get_cancellable (job),
&err))
{
- if (!thunar_job_is_cancelled (job))
+ if (!exo_job_is_cancelled (job))
{
g_clear_error (&err);
@@ -737,15 +737,14 @@
if (transfer_job->type == THUNAR_TRANSFER_JOB_MOVE)
{
- message = g_strdup_printf (_("Trying to move \"%s\""),
- g_file_info_get_display_name (info));
- thunar_job_info_message (job, message);
- g_free (message);
+ /* update progress information */
+ exo_job_info_message (job, _("Trying to move \"%s\""),
+ g_file_info_get_display_name (info));
if (g_file_move (node->source_file, tp->data,
G_FILE_COPY_NOFOLLOW_SYMLINKS
| G_FILE_COPY_NO_FALLBACK_FOR_MOVE,
- thunar_job_get_cancellable (job),
+ exo_job_get_cancellable (job),
NULL, NULL, &err))
{
/* add the target file to the new files list */
@@ -759,15 +758,14 @@
transfer_job->source_node_list = g_list_delete_link (transfer_job->source_node_list, sp);
transfer_job->target_file_list = g_list_delete_link (transfer_job->target_file_list, tp);
}
- else if (!thunar_job_is_cancelled (job))
+ else if (!exo_job_is_cancelled (job))
{
g_clear_error (&err);
- message = g_strdup_printf (_("Could not move \"%s\" directly. "
- "Collecting files for copying..."),
- g_file_info_get_display_name (info));
- thunar_job_info_message (job, message);
- g_free (message);
+ /* update progress information */
+ exo_job_info_message (job, _("Could not move \"%s\" directly. "
+ "Collecting files for copying..."),
+ g_file_info_get_display_name (info));
if (!thunar_transfer_job_collect_node (transfer_job, node, &err))
{
@@ -779,7 +777,7 @@
}
else if (transfer_job->type == THUNAR_TRANSFER_JOB_COPY)
{
- if (!thunar_transfer_job_collect_node (transfer_job, node, &err))
+ if (!thunar_transfer_job_collect_node (THUNAR_TRANSFER_JOB (job), node, &err))
break;
}
@@ -807,7 +805,7 @@
}
else
{
- thunar_job_new_files (job, new_files_list);
+ thunar_job_new_files (THUNAR_JOB (job), new_files_list);
g_file_list_free (new_files_list);
return TRUE;
}
More information about the Xfce4-commits
mailing list