From ed78c6d2d8e5ff3b8ae7edd633cce3a266e58d5d Mon Sep 17 00:00:00 2001 From: infirit Date: Fri, 21 Nov 2014 15:31:24 +0100 Subject: FrCommand: set the filename before each call to fr_command_* functions this change will allow the command to use a different filename from the one pointed to by the local_copy attribute. Based on FR commit: 5e48592fb49d1f5ce713fcd77d44acd664de4b6a From: Paolo Bacchilega --- src/fr-command.c | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) (limited to 'src/fr-command.c') diff --git a/src/fr-command.c b/src/fr-command.c index 31e758a..1f00d84 100644 --- a/src/fr-command.c +++ b/src/fr-command.c @@ -48,7 +48,7 @@ enum { /* Properties */ enum { PROP_0, - PROP_FILENAME, + PROP_FILE, PROP_MIME_TYPE, PROP_PROCESS, PROP_PASSWORD, @@ -289,8 +289,8 @@ fr_command_set_property (GObject *object, case PROP_PROCESS: fr_command_set_process (comm, g_value_get_object (value)); break; - case PROP_FILENAME: - fr_command_set_filename (comm, g_value_get_string (value)); + case PROP_FILE: + fr_command_set_file (comm, g_value_get_object (value)); break; case PROP_MIME_TYPE: fr_command_set_mime_type (comm, g_value_get_string (value)); @@ -328,8 +328,8 @@ fr_command_get_property (GObject *object, case PROP_PROCESS: g_value_set_object (value, comm->process); break; - case PROP_FILENAME: - g_value_set_string (value, comm->filename); + case PROP_FILE: + g_value_take_object (value, g_file_new_for_path (comm->filename)); break; case PROP_MIME_TYPE: g_value_set_static_string (value, comm->mime_type); @@ -444,11 +444,11 @@ fr_command_class_init (FrCommandClass *class) FR_TYPE_PROCESS, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, - PROP_FILENAME, - g_param_spec_string ("filename", - "Filename", - "The archive filename", - NULL, + PROP_FILE, + g_param_spec_object ("file", + "File", + "The archive local file", + G_TYPE_FILE, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_MIME_TYPE, @@ -542,7 +542,7 @@ fr_command_finalize (GObject *object) } -void +static void fr_command_set_filename (FrCommand *comm, const char *filename) { @@ -583,11 +583,24 @@ fr_command_set_filename (FrCommand *comm, void -fr_command_set_multi_volume (FrCommand *comm, - const char *filename) +fr_command_set_file (FrCommand *comm, + GFile *file) { - comm->multi_volume = TRUE; + char *filename; + + filename = g_file_get_path (file); fr_command_set_filename (comm, filename); + + g_free (filename); +} + + +void +fr_command_set_multi_volume (FrCommand *comm, + GFile *file) +{ + comm->multi_volume = TRUE; + fr_command_set_file (comm, file); } -- cgit v1.2.1