[Xfce4-commits] <thunar:nick/1.8> Port file renaming to GTask.
Nick Schermer
noreply at xfce.org
Sun Aug 4 21:52:12 CEST 2013
Updating branch refs/heads/nick/1.8
to 345a6bf65732564df384ae89b71c57f0487a6fe9 (commit)
from da5da99a22c83f519a9369b8d90d2c948423b510 (commit)
commit 345a6bf65732564df384ae89b71c57f0487a6fe9
Author: Nick Schermer <nick at xfce.org>
Date: Sun Aug 4 03:24:29 2013 +0200
Port file renaming to GTask.
thunar/thunar-application.c | 64 ++++++++----------------------
thunar/thunar-dialogs.c | 19 ++++-----
thunar/thunar-dialogs.h | 5 ++-
thunar/thunar-io-jobs.c | 73 ----------------------------------
thunar/thunar-io-jobs.h | 2 -
thunar/thunar-properties-dialog.c | 50 +++++++++---------------
thunar/thunar-standard-view.c | 78 +++++++++++++------------------------
thunar/thunar-tasks.c | 61 +++++++++++++++++++++++++++++
thunar/thunar-tasks.h | 4 ++
thunar/thunar-tree-view.c | 54 ++++++++-----------------
10 files changed, 158 insertions(+), 252 deletions(-)
diff --git a/thunar/thunar-application.c b/thunar/thunar-application.c
index 46a519b..f659906 100644
--- a/thunar/thunar-application.c
+++ b/thunar/thunar-application.c
@@ -166,7 +166,6 @@ struct _ThunarApplication
static GQuark thunar_application_screen_quark;
static GQuark thunar_application_startup_id_quark;
-static GQuark thunar_application_file_quark;
@@ -185,8 +184,6 @@ thunar_application_class_init (ThunarApplicationClass *klass)
g_quark_from_static_string ("thunar-application-screen");
thunar_application_startup_id_quark =
g_quark_from_static_string ("thunar-application-startup-id");
- thunar_application_file_quark =
- g_quark_from_static_string ("thunar-application-file");
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = thunar_application_finalize;
@@ -1342,37 +1339,27 @@ thunar_application_is_processing (ThunarApplication *application)
static void
-thunar_application_rename_file_error (ExoJob *job,
- GError *error,
- ThunarApplication *application)
+thunar_application_rename_file_finished (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
- ThunarFile *file;
- GdkScreen *screen;
-
- _thunar_return_if_fail (EXO_IS_JOB (job));
- _thunar_return_if_fail (error != NULL);
- _thunar_return_if_fail (THUNAR_IS_APPLICATION (application));
-
- screen = g_object_get_qdata (G_OBJECT (job), thunar_application_screen_quark);
- file = g_object_get_qdata (G_OBJECT (job), thunar_application_file_quark);
+ GError *error = NULL;
- g_assert (screen != NULL);
- g_assert (file != NULL);
+ _thunar_return_if_fail (G_IS_TASK (result));
+ _thunar_return_if_fail (GDK_IS_SCREEN (source_object));
+ _thunar_return_if_fail (THUNAR_IS_FILE (user_data));
- thunar_dialogs_show_error (screen, error, _("Failed to rename \"%s\""),
- thunar_file_get_display_name (file));
-}
-
-
-
-static void
-thunar_application_rename_file_finished (ExoJob *job,
- gpointer user_data)
-{
- _thunar_return_if_fail (EXO_IS_JOB (job));
+ g_task_propagate_pointer (G_TASK (result), &error);
+ if (error != NULL)
+ {
+ thunar_dialogs_show_error (GDK_SCREEN (source_object), error,
+ _("Failed to rename \"%s\""),
+ thunar_file_get_display_name (user_data));
+ g_error_free (error);
+ }
/* destroy the job object */
- g_object_unref (job);
+ g_object_unref (result);
}
@@ -1394,8 +1381,6 @@ thunar_application_rename_file (ThunarApplication *application,
GdkScreen *screen,
const gchar *startup_id)
{
- ThunarJob *job;
-
_thunar_return_if_fail (THUNAR_IS_APPLICATION (application));
_thunar_return_if_fail (THUNAR_IS_FILE (file));
_thunar_return_if_fail (GDK_IS_SCREEN (screen));
@@ -1404,22 +1389,7 @@ thunar_application_rename_file (ThunarApplication *application,
/* TODO pass the startup ID to the rename dialog */
/* run the rename dialog */
- job = thunar_dialogs_show_rename_file (screen, file);
- if (G_LIKELY (job != NULL))
- {
- /* remember the screen and file */
- g_object_set_qdata (G_OBJECT (job), thunar_application_screen_quark, screen);
- g_object_set_qdata_full (G_OBJECT (job), thunar_application_file_quark,
- g_object_ref (file), g_object_unref);
-
- /* handle rename errors */
- g_signal_connect (job, "error",
- G_CALLBACK (thunar_application_rename_file_error), application);
-
- /* destroy the job when it has finished */
- g_signal_connect (job, "finished",
- G_CALLBACK (thunar_application_rename_file_finished), NULL);
- }
+ thunar_dialogs_show_rename_file (screen, file, thunar_application_rename_file_finished);
}
diff --git a/thunar/thunar-dialogs.c b/thunar/thunar-dialogs.c
index 99b9e54..b143409 100644
--- a/thunar/thunar-dialogs.c
+++ b/thunar/thunar-dialogs.c
@@ -34,8 +34,7 @@
#include <thunar/thunar-dialogs.h>
#include <thunar/thunar-icon-factory.h>
-#include <thunar/thunar-io-jobs.h>
-#include <thunar/thunar-job.h>
+#include <thunar/thunar-tasks.h>
#include <thunar/thunar-pango-extensions.h>
#include <thunar/thunar-preferences.h>
#include <thunar/thunar-private.h>
@@ -55,15 +54,16 @@
* Return value: The #ThunarJob responsible for renaming the file or
* %NULL if there was no renaming required.
**/
-ThunarJob *
-thunar_dialogs_show_rename_file (gpointer parent,
- ThunarFile *file)
+GTask *
+thunar_dialogs_show_rename_file (gpointer parent,
+ ThunarFile *file,
+ GAsyncReadyCallback callback)
{
ThunarIconFactory *icon_factory;
GtkIconTheme *icon_theme;
const gchar *filename;
const gchar *text;
- ThunarJob *job = NULL;
+ GTask *task = NULL;
GtkWidget *dialog;
GtkWidget *entry;
GtkWidget *label;
@@ -80,7 +80,7 @@ thunar_dialogs_show_rename_file (gpointer parent,
gint layout_offset;
gint parent_width = 500;
- _thunar_return_val_if_fail (parent == NULL || GDK_IS_SCREEN (parent) || GTK_IS_WINDOW (parent), FALSE);
+ _thunar_return_val_if_fail (parent == NULL || GDK_IS_SCREEN (parent) || GTK_IS_WIDGET (parent), FALSE);
_thunar_return_val_if_fail (THUNAR_IS_FILE (file), FALSE);
/* parse the parent window and screen */
@@ -184,14 +184,15 @@ thunar_dialogs_show_rename_file (gpointer parent,
if (G_LIKELY (!exo_str_is_equal (filename, text)))
{
/* try to rename the file */
- job = thunar_io_jobs_rename_file (file, text);
+ task = thunar_tasks_new (parent, callback, file);
+ thunar_tasks_rename_file (task, file, text);
}
}
/* cleanup */
gtk_widget_destroy (dialog);
- return job;
+ return task;
}
diff --git a/thunar/thunar-dialogs.h b/thunar/thunar-dialogs.h
index 74c4317..07488c2 100644
--- a/thunar/thunar-dialogs.h
+++ b/thunar/thunar-dialogs.h
@@ -26,8 +26,9 @@
G_BEGIN_DECLS;
-ThunarJob *thunar_dialogs_show_rename_file (gpointer parent,
- ThunarFile *file);
+GTask *thunar_dialogs_show_rename_file (gpointer parent,
+ ThunarFile *file,
+ GAsyncReadyCallback classback);
void thunar_dialogs_show_about (GtkWindow *parent,
const gchar *title,
const gchar *format,
diff --git a/thunar/thunar-io-jobs.c b/thunar/thunar-io-jobs.c
index f72a246..643b1fb 100644
--- a/thunar/thunar-io-jobs.c
+++ b/thunar/thunar-io-jobs.c
@@ -1162,76 +1162,3 @@ thunar_io_jobs_change_mode (GList *files,
THUNAR_TYPE_FILE_MODE, file_mode,
G_TYPE_BOOLEAN, recursive);
}
-
-
-
-static gboolean
-_thunar_io_jobs_rename_notify (ThunarFile *file)
-{
- _thunar_return_val_if_fail (THUNAR_IS_FILE (file), FALSE);
-
- /* tell the associated folder that the file was renamed */
- thunarx_file_info_renamed (THUNARX_FILE_INFO (file));
-
- /* emit the file changed signal */
- thunar_file_changed (file);
-
- return FALSE;
-}
-
-
-
-static gboolean
-_thunar_io_jobs_rename (ThunarJob *job,
- GArray *param_values,
- GError **error)
-{
- const gchar *display_name;
- ThunarFile *file;
- GError *err = NULL;
-
- _thunar_return_val_if_fail (THUNAR_IS_JOB (job), FALSE);
- _thunar_return_val_if_fail (param_values != NULL, FALSE);
- _thunar_return_val_if_fail (param_values->len == 2, FALSE);
- _thunar_return_val_if_fail (G_VALUE_HOLDS (&g_array_index (param_values, GValue, 0), THUNAR_TYPE_FILE), FALSE);
- _thunar_return_val_if_fail (G_VALUE_HOLDS_STRING (&g_array_index (param_values, GValue, 1)), FALSE);
- _thunar_return_val_if_fail (error == NULL || *error == NULL, FALSE);
-
- if (exo_job_set_error_if_cancelled (EXO_JOB (job), error))
- return FALSE;
-
- /* determine the file and display name */
- file = g_value_get_object (&g_array_index (param_values, GValue, 0));
- display_name = g_value_get_string (&g_array_index (param_values, GValue, 1));
-
- /* try to rename the file */
- if (thunar_file_rename (file, display_name, exo_job_get_cancellable (EXO_JOB (job)), TRUE, &err))
- {
- exo_job_send_to_mainloop (EXO_JOB (job),
- (GSourceFunc) _thunar_io_jobs_rename_notify,
- g_object_ref (file), g_object_unref);
- }
-
- /* abort on errors or cancellation */
- if (err != NULL)
- {
- g_propagate_error (error, err);
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-
-ThunarJob *
-thunar_io_jobs_rename_file (ThunarFile *file,
- const gchar *display_name)
-{
- _thunar_return_val_if_fail (THUNAR_IS_FILE (file), NULL);
- _thunar_return_val_if_fail (g_utf8_validate (display_name, -1, NULL), NULL);
-
- return thunar_simple_job_launch (_thunar_io_jobs_rename, 2,
- THUNAR_TYPE_FILE, file,
- G_TYPE_STRING, display_name);
-}
diff --git a/thunar/thunar-io-jobs.h b/thunar/thunar-io-jobs.h
index 851e35d..96adc24 100644
--- a/thunar/thunar-io-jobs.h
+++ b/thunar/thunar-io-jobs.h
@@ -48,8 +48,6 @@ ThunarJob *thunar_io_jobs_change_mode (GList *files,
ThunarFileMode file_mask,
ThunarFileMode file_mode,
gboolean recursive) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
-ThunarJob *thunar_io_jobs_rename_file (ThunarFile *file,
- const gchar *display_name) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
G_END_DECLS
diff --git a/thunar/thunar-properties-dialog.c b/thunar/thunar-properties-dialog.c
index 6e6fa8d..61e31a0 100644
--- a/thunar/thunar-properties-dialog.c
+++ b/thunar/thunar-properties-dialog.c
@@ -46,8 +46,7 @@
#include <thunar/thunar-gtk-extensions.h>
#include <thunar/thunar-icon-factory.h>
#include <thunar/thunar-image.h>
-#include <thunar/thunar-io-jobs.h>
-#include <thunar/thunar-job.h>
+#include <thunar/thunar-tasks.h>
#include <thunar/thunar-marshal.h>
#include <thunar/thunar-pango-extensions.h>
#include <thunar/thunar-permissions-chooser.h>
@@ -659,32 +658,25 @@ thunar_properties_dialog_reload (ThunarPropertiesDialog *dialog)
static void
-thunar_properties_dialog_rename_error (ExoJob *job,
- GError *error,
- ThunarPropertiesDialog *dialog)
+thunar_properties_dialog_rename_finished (GObject *dialog,
+ GAsyncResult *result,
+ gpointer user_data)
{
- _thunar_return_if_fail (EXO_IS_JOB (job));
- _thunar_return_if_fail (error != NULL);
- _thunar_return_if_fail (THUNAR_IS_PROPERTIES_DIALOG (dialog));
- _thunar_return_if_fail (g_list_length (dialog->files) == 1);
-
- /* display an error message */
- thunar_dialogs_show_error (GTK_WIDGET (dialog), error, _("Failed to rename \"%s\""),
- thunar_file_get_display_name (THUNAR_FILE (dialog->files->data)));
-}
+ GError *error = NULL;
-
-
-static void
-thunar_properties_dialog_rename_finished (ExoJob *job,
- ThunarPropertiesDialog *dialog)
-{
- _thunar_return_if_fail (EXO_IS_JOB (job));
+ _thunar_return_if_fail (G_IS_TASK (result));
_thunar_return_if_fail (THUNAR_IS_PROPERTIES_DIALOG (dialog));
- _thunar_return_if_fail (g_list_length (dialog->files) == 1);
+ _thunar_return_if_fail (THUNAR_IS_FILE (user_data));
- g_signal_handlers_disconnect_matched (job, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, dialog);
- g_object_unref (job);
+ g_task_propagate_pointer (G_TASK (result), &error);
+ if (error != NULL)
+ {
+ /* display an error message */
+ thunar_dialogs_show_error (GTK_WIDGET (dialog), error, _("Failed to rename \"%s\""),
+ thunar_file_get_display_name (THUNAR_FILE (user_data)));
+ }
+
+ g_object_unref (result);
}
@@ -694,7 +686,7 @@ thunar_properties_dialog_name_activate (GtkWidget *entry,
ThunarPropertiesDialog *dialog)
{
const gchar *old_name;
- ThunarJob *job;
+ GTask *task;
gchar *new_name;
ThunarFile *file;
@@ -711,12 +703,8 @@ thunar_properties_dialog_name_activate (GtkWidget *entry,
old_name = thunar_file_get_display_name (file);
if (g_utf8_collate (new_name, old_name) != 0)
{
- job = thunar_io_jobs_rename_file (file, new_name);
- if (job != NULL)
- {
- g_signal_connect (job, "error", G_CALLBACK (thunar_properties_dialog_rename_error), dialog);
- g_signal_connect (job, "finished", G_CALLBACK (thunar_properties_dialog_rename_finished), dialog);
- }
+ task = thunar_tasks_new (dialog, thunar_properties_dialog_rename_finished, file);
+ thunar_tasks_rename_file (task, file, new_name);
}
}
diff --git a/thunar/thunar-standard-view.c b/thunar/thunar-standard-view.c
index 6d5dd48..69531b4 100644
--- a/thunar/thunar-standard-view.c
+++ b/thunar/thunar-standard-view.c
@@ -2727,52 +2727,38 @@ thunar_standard_view_action_make_link (GtkAction *action,
static void
-thunar_standard_view_rename_error (ExoJob *job,
- GError *error,
- ThunarStandardView *standard_view)
-{
- GArray *param_values;
- ThunarFile *file;
-
- _thunar_return_if_fail (EXO_IS_JOB (job));
- _thunar_return_if_fail (error != NULL);
- _thunar_return_if_fail (THUNAR_IS_STANDARD_VIEW (standard_view));
-
- param_values = thunar_simple_job_get_param_values (THUNAR_SIMPLE_JOB (job));
- file = g_value_get_object (&g_array_index (param_values, GValue, 0));
-
- /* display an error message */
- thunar_dialogs_show_error (GTK_WIDGET (standard_view), error,
- _("Failed to rename \"%s\""),
- thunar_file_get_display_name (file));
-}
-
-
-
-static void
-thunar_standard_view_rename_finished (ExoJob *job,
- ThunarStandardView *standard_view)
+thunar_standard_view_rename_finished (GObject *view,
+ GAsyncResult *result,
+ gpointer user_data)
{
- GArray *param_values;
- ThunarFile *file;
-
- _thunar_return_if_fail (EXO_IS_JOB (job));
- _thunar_return_if_fail (THUNAR_IS_STANDARD_VIEW (standard_view));
+ GError *error = NULL;
- param_values = thunar_simple_job_get_param_values (THUNAR_SIMPLE_JOB (job));
- file = g_value_get_object (&g_array_index (param_values, GValue, 0));
+ _thunar_return_if_fail (G_IS_TASK (result));
+ _thunar_return_if_fail (THUNAR_IS_STANDARD_VIEW (view));
+ _thunar_return_if_fail (THUNAR_IS_FILE (user_data));
- /* make sure the file is still visible */
- thunar_view_scroll_to_file (THUNAR_VIEW (standard_view), file, TRUE, FALSE, 0.0f, 0.0f);
+ g_task_propagate_pointer (G_TASK (result), &error);
+ if (error != NULL)
+ {
+ /* display an error message */
+ thunar_dialogs_show_error (GTK_WIDGET (view), error,
+ _("Failed to rename \"%s\""),
+ thunar_file_get_display_name (user_data));
+ g_error_free (error);
+ }
+ else
+ {
+ /* make sure the file is still visible */
+ thunar_view_scroll_to_file (THUNAR_VIEW (view), user_data, TRUE, FALSE, 0.0f, 0.0f);
- /* update the selection, so we get updated actions, statusbar,
- * etc. with the new file name and probably new mime type.
- */
- thunar_standard_view_selection_changed (standard_view);
+ /* update the selection, so we get updated actions, statusbar,
+ * etc. with the new file name and probably new mime type.
+ */
+ thunar_standard_view_selection_changed (THUNAR_STANDARD_VIEW (view));
+ }
/* destroy the job */
- g_signal_handlers_disconnect_matched (job, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, standard_view);
- g_object_unref (job);
+ g_object_unref (result);
}
@@ -2782,8 +2768,6 @@ thunar_standard_view_action_rename (GtkAction *action,
ThunarStandardView *standard_view)
{
ThunarFile *file;
- GtkWidget *window;
- ThunarJob *job;
GdkModifierType state;
gboolean force_bulk_renamer;
const gchar *accel_path;
@@ -2813,19 +2797,11 @@ thunar_standard_view_action_rename (GtkAction *action,
if (!force_bulk_renamer
&& standard_view->priv->selected_files->next == NULL)
{
- /* get the window */
- window = gtk_widget_get_toplevel (GTK_WIDGET (standard_view));
-
/* get the file */
file = THUNAR_FILE (standard_view->priv->selected_files->data);
/* run the rename dialog */
- job = thunar_dialogs_show_rename_file (GTK_WINDOW (window), file);
- if (G_LIKELY (job != NULL))
- {
- g_signal_connect (job, "error", G_CALLBACK (thunar_standard_view_rename_error), standard_view);
- g_signal_connect (job, "finished", G_CALLBACK (thunar_standard_view_rename_finished), standard_view);
- }
+ thunar_dialogs_show_rename_file (standard_view, file, thunar_standard_view_rename_finished);
}
else
{
diff --git a/thunar/thunar-tasks.c b/thunar/thunar-tasks.c
index 3eff724..107eff2 100644
--- a/thunar/thunar-tasks.c
+++ b/thunar/thunar-tasks.c
@@ -32,6 +32,15 @@
+typedef struct
+{
+ ThunarFile *file;
+ gchar *display_name;
+}
+ThunarTaskRename;
+
+
+
GTask *
thunar_tasks_new (gpointer source_object,
GAsyncReadyCallback callback,
@@ -92,3 +101,55 @@ thunar_tasks_list_directory (GTask *task,
g_task_set_task_data (task, g_object_ref (directory), g_object_unref);
g_task_run_in_thread (task, thunar_tasks_list_directory_thread);
}
+
+
+
+static void
+thunar_tasks_rename_file_thread (GTask *task,
+ gpointer source_object,
+ gpointer task_data,
+ GCancellable *cancellable)
+{
+ ThunarTaskRename *data = task_data;
+ GError *err = NULL;
+
+ if (g_task_return_error_if_cancelled (task))
+ return;
+
+ if (thunar_file_rename (data->file, data->display_name, cancellable, TRUE, &err))
+ g_task_return_pointer (task, NULL, NULL);
+ else
+ g_task_return_error (task, err);
+}
+
+
+
+static void
+thunar_tasks_rename_file_free (gpointer user_data)
+{
+ ThunarTaskRename *data = user_data;
+
+ g_object_unref (data->file);
+ g_free (data->display_name);
+ g_slice_free (ThunarTaskRename, data);
+}
+
+
+
+void
+thunar_tasks_rename_file (GTask *task,
+ ThunarFile *file,
+ const gchar *display_name)
+{
+ ThunarTaskRename *data;
+
+ _thunar_return_if_fail (THUNAR_IS_FILE (file));
+ _thunar_return_if_fail (G_IS_TASK (task));
+
+ data = g_slice_new0 (ThunarTaskRename);
+ data->file = g_object_ref (file);
+ data->display_name = g_strdup (display_name);
+
+ g_task_set_task_data (task, data, thunar_tasks_rename_file_free);
+ g_task_run_in_thread (task, thunar_tasks_rename_file_thread);
+}
diff --git a/thunar/thunar-tasks.h b/thunar/thunar-tasks.h
index 911121c..10afbc4 100644
--- a/thunar/thunar-tasks.h
+++ b/thunar/thunar-tasks.h
@@ -23,6 +23,7 @@
#define __THUNAR_TASKS_H__
#include <gio/gio.h>
+#include <thunar/thunar-file.h>
G_BEGIN_DECLS
@@ -33,6 +34,9 @@ GTask *thunar_tasks_new (gpointer source_object
void thunar_tasks_list_directory (GTask *task,
GFile *directory);
+void thunar_tasks_rename_file (GTask *task,
+ ThunarFile *file,
+ const gchar *display_name);
G_END_DECLS
#endif /* !__THUNAR_TASKS_H__ */
diff --git a/thunar/thunar-tree-view.c b/thunar/thunar-tree-view.c
index c5b124e..ff92fe1 100644
--- a/thunar/thunar-tree-view.c
+++ b/thunar/thunar-tree-view.c
@@ -1742,37 +1742,27 @@ thunar_tree_view_action_delete (ThunarTreeView *view)
static void
-thunar_tree_view_rename_error (ExoJob *job,
- GError *error,
- ThunarTreeView *view)
+thunar_tree_view_rename_finished (GObject *view,
+ GAsyncResult *result,
+ gpointer user_data)
{
- GArray *param_values;
- ThunarFile *file;
+ GError *error = NULL;
- _thunar_return_if_fail (EXO_IS_JOB (job));
- _thunar_return_if_fail (error != NULL);
+ _thunar_return_if_fail (G_IS_TASK (result));
_thunar_return_if_fail (THUNAR_IS_TREE_VIEW (view));
+ _thunar_return_if_fail (THUNAR_IS_FILE (user_data));
- param_values = thunar_simple_job_get_param_values (THUNAR_SIMPLE_JOB (job));
- file = g_value_get_object (&g_array_index (param_values, GValue, 0));
-
- /* display an error message */
- thunar_dialogs_show_error (GTK_WIDGET (view), error, _("Failed to rename \"%s\""),
- thunar_file_get_display_name (file));
-}
-
-
-
-static void
-thunar_tree_view_rename_finished (ExoJob *job,
- ThunarTreeView *view)
-{
- _thunar_return_if_fail (EXO_IS_JOB (job));
- _thunar_return_if_fail (THUNAR_IS_TREE_VIEW (view));
+ g_task_propagate_pointer (G_TASK (result), &error);
+ if (error != NULL)
+ {
+ /* display an error message */
+ thunar_dialogs_show_error (GTK_WIDGET (view), error, _("Failed to rename \"%s\""),
+ thunar_file_get_display_name (user_data));
+ g_error_free (error);
+ }
- /* destroy the job */
- g_signal_handlers_disconnect_matched (job, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, view);
- g_object_unref (job);
+ /* destroy the task */
+ g_object_unref (result);
}
@@ -1781,8 +1771,6 @@ static void
thunar_tree_view_action_rename (ThunarTreeView *view)
{
ThunarFile *file;
- GtkWidget *window;
- ThunarJob *job;
_thunar_return_if_fail (THUNAR_IS_TREE_VIEW (view));
@@ -1790,16 +1778,8 @@ thunar_tree_view_action_rename (ThunarTreeView *view)
file = thunar_tree_view_get_selected_file (view);
if (G_LIKELY (file != NULL))
{
- /* get the toplevel window */
- window = gtk_widget_get_toplevel (GTK_WIDGET (view));
-
/* run the rename dialog */
- job = thunar_dialogs_show_rename_file (GTK_WINDOW (window), file);
- if (G_LIKELY (job != NULL))
- {
- g_signal_connect (job, "error", G_CALLBACK (thunar_tree_view_rename_error), view);
- g_signal_connect (job, "finished", G_CALLBACK (thunar_tree_view_rename_finished), view);
- }
+ thunar_dialogs_show_rename_file (view, file, thunar_tree_view_rename_finished);
/* release the file */
g_object_unref (file);
More information about the Xfce4-commits
mailing list