...
 
Commits (29)
version 3.8.4
-------------
Bugs fixed:
* cannot add files to a subfolder with zip and 7zip archives (#703420)
* 7zip: fixed file deletion from jar, war, ear archives (#701739)
* progress and message dialogs: fixed unnecessary word breaking (#702919)
* error creating 7zip archives for directories without write
permission (#651494)
* libarchive: restore directory modification time when extracting
(#697756)
* do not allow to create a second 'New Archive' dialog (#701992)
version 3.8.3
-------------
Bugs fixed:
* Do not allow to save as the original name. (#700892)
* New archive: correctly save the archive in the selected destination.
(Lionel Landwerlin) (#701297)
* libarchive: sanitize filenames before extracting.
New or updated application translations:
* Chinese (simplified) (tuhaihe)
* Finnish (Jiri Grönroos)
* Japanese (Akira Tanaka)
New or updated manual translations:
* Brazilian Portuguese (Rafael Ferreira)
* Deutsch (Christian Kirbach)
version 3.8.2
-------------
New or updated application translations:
* Low German (Nils-Christoph Fiedler)
New or updated manual translations:
* Hungarian (Gabor Kelemen)
version 3.8.1
-------------
......
......@@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script.
AC_PREREQ([2.68])
AC_INIT([file-roller],[3.8.1],[http://bugzilla.gnome.org/enter_bug.cgi?product=file-roller],[file-roller])
AC_INIT([file-roller],[3.8.4],[http://bugzilla.gnome.org/enter_bug.cgi?product=file-roller],[file-roller])
AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz tar-ustar])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
......@@ -313,6 +313,11 @@ AC_SUBST(DISABLE_DEPRECATED)
dnl ******************************
AC_CHECK_PROG(desktop_validate, desktop-file-validate, true)
AM_CONDITIONAL([DESKTOP_VALIDATE], [test "$desktop_validate" = "true"])
dnl ******************************
AC_CONFIG_FILES([Makefile
file-roller.spec
data/Makefile
......
......@@ -62,6 +62,9 @@ CLEANFILES = \
$(NULL)
dist-hook:
if DESKTOP_VALIDATE
desktop-file-validate $(desktop_DATA)
endif
cd $(distdir); rm -f $(CLEANFILES)
-include $(top_srcdir)/git.mk
This diff is collapsed.
......@@ -530,7 +530,7 @@ msgstr "Meglévő archívum megnyitása."
#: C/archive-open.page:24(page/title) C/keyboard-shortcuts.page:35(td/p)
msgid "Open an archive"
msgstr "Nyissa meg az archívumot"
msgstr "Archívum megnyitása"
#: C/archive-open.page:26(page/p)
msgid "You can open an existing archive with <app>Archive Manager</app> by:"
......
This diff is collapsed.
......@@ -138,7 +138,6 @@ src/typedefs.h
src/ui.h
[type: gettext/glade]src/ui/menus-toolbars.ui
[type: gettext/glade]src/ui/message-dialog.ui
[type: gettext/glade]src/ui/new-archive-dialog-options.ui
[type: gettext/glade]src/ui/new-archive-dialog.ui
[type: gettext/glade]src/ui/password.ui
[type: gettext/glade]src/ui/progress-dialog.ui
......
......@@ -14,8 +14,8 @@ msgstr ""
"Project-Id-Version: file-roller\n"
"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?product=file-"
"roller&keywords=I18N+L10N&component=general\n"
"POT-Creation-Date: 2013-03-11 22:11+0000\n"
"PO-Revision-Date: 2013-03-26 20:18+0200\n"
"POT-Creation-Date: 2013-04-28 06:51+0000\n"
"PO-Revision-Date: 2013-06-03 12:18+0300\n"
"Last-Translator: Jiri Grönroos <jiri.gronroos+l10n@iki.fi>\n"
"Language-Team: Finnish <gnome-fi-laatu@lists.sourceforge.net>\n"
"Language: fi\n"
......@@ -422,7 +422,7 @@ msgstr "Tämän tyyppistä tiedostia ei voitu avata"
#: ../src/dlg-package-installer.c:321
msgid "_Search Command"
msgstr "_Hakukomento"
msgstr "_Etsi komento"
#: ../src/dlg-password.c:91
#, c-format
......@@ -432,7 +432,7 @@ msgstr "Anna salasana arkistolle ”%s”."
#: ../src/dlg-prop.c:96
#, c-format
msgid "%s Properties"
msgstr "%s-ominaisuudet"
msgstr "%s - ominaisuudet"
#: ../src/dlg-update.c:163
#, c-format
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -88,7 +88,8 @@ dlg_batch_add_files (FrWindow *window,
NULL,
((file_list->next == NULL) ? FR_NEW_ARCHIVE_ACTION_NEW_SINGLE_FILE : FR_NEW_ARCHIVE_ACTION_NEW_MANY_FILES),
parent,
filename);
filename,
NULL);
g_signal_connect (dialog,
"response",
G_CALLBACK (dialog_response_cb),
......
......@@ -12,7 +12,6 @@
<file compressed="true">ui/menus-toolbars.ui</file>
<file compressed="true">ui/message-dialog.ui</file>
<file compressed="true">ui/new-archive-dialog.ui</file>
<file compressed="true">ui/new-archive-dialog-options.ui</file>
<file compressed="true">ui/password.ui</file>
<file compressed="true">ui/progress-dialog.ui</file>
<file compressed="true">ui/properties.ui</file>
......
......@@ -33,6 +33,7 @@
#include "file-utils.h"
#include "fr-error.h"
#include "fr-archive-libarchive.h"
#include "gio-utils.h"
#include "glib-utils.h"
#include "typedefs.h"
......@@ -417,28 +418,18 @@ extract_data_get_extraction_requested (ExtractData *extract_data,
}
static void
_g_file_set_attributes_from_entry (GFile *file,
struct archive_entry *entry,
ExtractData *extract_data,
GCancellable *cancellable)
static GFileInfo *
_g_file_info_create_from_entry (struct archive_entry *entry,
ExtractData *extract_data)
{
GFileInfo *info;
GError *error = NULL;
info = g_file_info_new ();
/* times */
if (archive_entry_ctime_is_set (entry)) {
g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_CREATED, archive_entry_ctime (entry));
g_file_info_set_attribute_uint32 (info, G_FILE_ATTRIBUTE_TIME_CREATED_USEC, archive_entry_ctime_nsec (entry));
}
if (archive_entry_mtime_is_set (entry)) {
if (archive_entry_mtime_is_set (entry))
g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_MODIFIED, archive_entry_mtime (entry));
g_file_info_set_attribute_uint32 (info, G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC, archive_entry_mtime_nsec (entry));
}
/* username */
......@@ -478,12 +469,67 @@ _g_file_set_attributes_from_entry (GFile *file,
g_file_info_set_attribute_uint32 (info, G_FILE_ATTRIBUTE_UNIX_MODE, archive_entry_mode (entry));
if (! g_file_set_attributes_from_info (file, info, 0, cancellable, &error)) {
g_warning ("%s", error->message);
g_error_free (error);
}
return info;
}
static gboolean
_g_file_set_attributes_from_info (GFile *file,
GFileInfo *info,
GCancellable *cancellable,
GError **error)
{
return g_file_set_attributes_from_info (file, info, G_FILE_QUERY_INFO_NONE, cancellable, error);
}
static gboolean
_g_file_set_attributes_from_entry (GFile *file,
struct archive_entry *entry,
ExtractData *extract_data,
GCancellable *cancellable,
GError **error)
{
GFileInfo *info;
gboolean result;
info = _g_file_info_create_from_entry (entry, extract_data);
result = _g_file_set_attributes_from_info (file, info, cancellable, error);
g_object_unref (info);
return result;
}
static gboolean
restore_modification_time (GHashTable *created_folders,
GCancellable *cancellable,
GError **error)
{
GHashTableIter iter;
gpointer key, value;
gboolean result = TRUE;
g_hash_table_iter_init (&iter, created_folders);
while (result && g_hash_table_iter_next (&iter, &key, &value)) {
GFile *file = key;
GFileInfo *original_info = value;
GFileInfo *info;
if (g_file_info_get_attribute_status (original_info, G_FILE_ATTRIBUTE_TIME_MODIFIED) != G_FILE_ATTRIBUTE_STATUS_SET)
continue;
info = g_file_info_new ();
g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_MODIFIED, g_file_info_get_attribute_uint64 (original_info, G_FILE_ATTRIBUTE_TIME_MODIFIED));
if (g_file_info_get_attribute_status (original_info, G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC) == G_FILE_ATTRIBUTE_STATUS_SET)
g_file_info_set_attribute_uint32 (info, G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC, g_file_info_get_attribute_uint32 (original_info, G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC));
result = _g_file_set_attributes_from_info (file, info, cancellable, error);
g_object_unref (info);
}
return result;
}
......@@ -495,6 +541,8 @@ extract_archive_thread (GSimpleAsyncResult *result,
ExtractData *extract_data;
LoadData *load_data;
GHashTable *checked_folders;
GHashTable *created_folders;
GHashTable *folders_created_during_extraction;
struct archive *a;
struct archive_entry *entry;
int r;
......@@ -503,6 +551,8 @@ extract_archive_thread (GSimpleAsyncResult *result,
load_data = LOAD_DATA (extract_data);
checked_folders = g_hash_table_new_full (g_file_hash, (GEqualFunc) g_file_equal, g_object_unref, NULL);
created_folders = g_hash_table_new_full (g_file_hash, (GEqualFunc) g_file_equal, g_object_unref, g_object_unref);
folders_created_during_extraction = g_hash_table_new_full (g_file_hash, (GEqualFunc) g_file_equal, g_object_unref, NULL);
fr_archive_progress_set_total_files (load_data->archive, extract_data->n_files_to_extract);
a = archive_read_new ();
......@@ -512,6 +562,7 @@ extract_archive_thread (GSimpleAsyncResult *result,
while ((r = archive_read_next_header (a, &entry)) == ARCHIVE_OK) {
const char *pathname;
char *fullpath;
const char *relative_path;
GFile *file;
GFile *parent;
GOutputStream *ostream;
......@@ -531,11 +582,19 @@ extract_archive_thread (GSimpleAsyncResult *result,
}
fullpath = (*pathname == '/') ? g_strdup (pathname) : g_strconcat ("/", pathname, NULL);
file = g_file_get_child (extract_data->destination, _g_path_get_relative_basename (fullpath, extract_data->base_dir, extract_data->junk_paths));
relative_path = _g_path_get_relative_basename_safe (fullpath, extract_data->base_dir, extract_data->junk_paths);
if (relative_path == NULL) {
archive_read_data_skip (a);
continue;
}
file = g_file_get_child (extract_data->destination, relative_path);
/* honor the skip_older and overwrite options */
if (extract_data->skip_older || ! extract_data->overwrite) {
if ((g_hash_table_lookup (folders_created_during_extraction, file) == NULL)
&& (extract_data->skip_older || ! extract_data->overwrite))
{
GFileInfo *info;
info = g_file_query_info (file,
......@@ -593,7 +652,18 @@ extract_archive_thread (GSimpleAsyncResult *result,
&& (g_hash_table_lookup (checked_folders, parent) == NULL)
&& ! g_file_query_exists (parent, cancellable))
{
if (g_file_make_directory_with_parents (parent, cancellable, &load_data->error)) {
if (! _g_file_make_directory_with_parents (parent,
folders_created_during_extraction,
cancellable,
&local_error))
{
if (! g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_EXISTS))
load_data->error = local_error;
else
g_clear_error (&local_error);
}
if (load_data->error == NULL) {
GFile *grandparent;
grandparent = g_object_ref (parent);
......@@ -615,14 +685,22 @@ extract_archive_thread (GSimpleAsyncResult *result,
linkname = archive_entry_hardlink (entry);
if (linkname != NULL) {
char *link_fullpath;
GFile *link_file;
char *oldname;
char *newname;
int r;
char *link_fullpath;
const char *relative_path;
GFile *link_file;
char *oldname;
char *newname;
int r;
link_fullpath = (*linkname == '/') ? g_strdup (linkname) : g_strconcat ("/", linkname, NULL);
link_file = g_file_get_child (extract_data->destination, _g_path_get_relative_basename (link_fullpath, extract_data->base_dir, extract_data->junk_paths));
relative_path = _g_path_get_relative_basename_safe (link_fullpath, extract_data->base_dir, extract_data->junk_paths);
if (relative_path == NULL) {
g_free (link_fullpath);
archive_read_data_skip (a);
continue;
}
link_file = g_file_get_child (extract_data->destination, relative_path);
oldname = g_file_get_path (link_file);
newname = g_file_get_path (file);
......@@ -669,8 +747,15 @@ extract_archive_thread (GSimpleAsyncResult *result,
load_data->error = g_error_copy (local_error);
g_error_free (local_error);
}
else
_g_file_set_attributes_from_entry (file, entry, extract_data, cancellable);
if (load_data->error == NULL) {
GFileInfo *info;
info = _g_file_info_create_from_entry (entry, extract_data);
_g_file_set_attributes_from_info (file, info, cancellable, &load_data->error);
g_hash_table_insert (created_folders, g_object_ref (file), g_object_ref (info));
g_object_unref (info);
}
archive_read_data_skip (a);
break;
......@@ -689,7 +774,7 @@ extract_archive_thread (GSimpleAsyncResult *result,
if (r != ARCHIVE_EOF)
load_data->error = g_error_new_literal (FR_ERROR, FR_ERROR_COMMAND_ERROR, archive_error_string (a));
else
_g_file_set_attributes_from_entry (file, entry, extract_data, cancellable);
_g_file_set_attributes_from_entry (file, entry, extract_data, cancellable, &load_data->error);
break;
case AE_IFLNK:
......@@ -719,6 +804,9 @@ extract_archive_thread (GSimpleAsyncResult *result,
}
}
if (load_data->error == NULL)
restore_modification_time (created_folders, cancellable, &load_data->error);
if ((load_data->error == NULL) && (r != ARCHIVE_EOF))
load_data->error = g_error_new_literal (FR_ERROR, FR_ERROR_COMMAND_ERROR, archive_error_string (a));
if (load_data->error == NULL)
......@@ -726,6 +814,8 @@ extract_archive_thread (GSimpleAsyncResult *result,
if (load_data->error != NULL)
g_simple_async_result_set_from_error (result, load_data->error);
g_hash_table_unref (folders_created_during_extraction);
g_hash_table_unref (created_folders);
g_hash_table_unref (checked_folders);
archive_read_free (a);
extract_data_free (extract_data);
......
......@@ -450,6 +450,7 @@ fr_archive_init (FrArchive *self)
self->propAddCanReplace = FALSE;
self->propAddCanStoreFolders = FALSE;
self->propAddCanStoreLinks = FALSE;
self->propAddCanFollowDirectoryLinksWithoutDereferencing = TRUE;
self->propExtractCanAvoidOverwrite = FALSE;
self->propExtractCanSkipOlder = FALSE;
self->propExtractCanJunkPaths = FALSE;
......
......@@ -121,6 +121,31 @@ struct _FrArchive {
*/
guint propAddCanStoreLinks : 1;
/* propAddCanFollowDirectoryLinksWithoutDereferencing:
*
* is used to overcome an issue with 7zip when adding a file in a
* subfolder. For example if we want to add to an archive
*
* /home/user/index.html
*
* in the folder 'doc'
*
* we create a symbolic link doc -> /home/user
*
* and use the following command to add the file
*
* 7z a -bd -y -mx=7 -- /home/user/archive.7z doc/index.html
*
* this gives an error because 7zip doesn't see the doc/index.html file
* for some reason, in this case we have to add the -l option to always
* deference the links.
*
* This means that when adding files to a subfolder in an 7zip archive
* we cannot store symbolic links as such, suboptimal but more
* acceptable than an error.
*/
guint propAddCanFollowDirectoryLinksWithoutDereferencing : 1;
/* propExtractCanAvoidOverwrite:
*
* TRUE if the command can avoid to overwrite the files on disk.
......
......@@ -321,10 +321,8 @@ fr_command_7z_add (FrCommand *command,
else
fr_process_add_arg (command->process, "a");
if (base_dir != NULL) {
if (base_dir != NULL)
fr_process_set_working_dir (command->process, base_dir);
fr_process_add_arg_concat (command->process, "-w", base_dir, NULL);
}
if (_g_mime_type_matches (archive->mime_type, "application/zip")
|| _g_mime_type_matches (archive->mime_type, "application/x-cbz"))
......@@ -392,7 +390,8 @@ fr_command_7z_delete (FrCommand *command,
const char *from_file,
GList *file_list)
{
GList *scan;
FrArchive *archive = FR_ARCHIVE (command);
GList *scan;
fr_command_7z_begin_command (command);
fr_process_add_arg (command->process, "d");
......@@ -401,6 +400,12 @@ fr_command_7z_delete (FrCommand *command,
if (_g_mime_type_matches (FR_ARCHIVE (command)->mime_type, "application/x-ms-dos-executable"))
fr_process_add_arg (command->process, "-sfx");
if (_g_mime_type_matches (archive->mime_type, "application/zip")
|| _g_mime_type_matches (archive->mime_type, "application/x-cbz"))
{
fr_process_add_arg (command->process, "-tzip");
}
if (from_file != NULL)
fr_process_add_arg_concat (command->process, "-i@", from_file, NULL);
......@@ -674,6 +679,7 @@ fr_command_7z_init (FrCommand7z *self)
base->propAddCanReplace = TRUE;
base->propAddCanStoreFolders = TRUE;
base->propAddCanStoreLinks = TRUE;
base->propAddCanFollowDirectoryLinksWithoutDereferencing = FALSE;
base->propExtractCanAvoidOverwrite = FALSE;
base->propExtractCanSkipOlder = FALSE;
base->propExtractCanJunkPaths = TRUE;
......
......@@ -19,6 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
......
......@@ -19,6 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
......
......@@ -19,6 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
......
......@@ -19,6 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
......
......@@ -19,6 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
......
......@@ -19,6 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <glib.h>
#include <unistd.h>
#include <string.h>
......
......@@ -19,6 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
......
......@@ -19,6 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......
......@@ -20,17 +20,14 @@
*/
#include <config.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <glib.h>
#include <glib/gi18n.h>
#include "file-data.h"
#include "file-utils.h"
#include "glib-utils.h"
......
......@@ -19,6 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#define _XOPEN_SOURCE /* See feature_test_macros(7) */
#include <time.h>
#include <stdio.h>
......
......@@ -19,6 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
......
......@@ -19,6 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
......
......@@ -721,7 +721,7 @@ create_tmp_base_dir (GFile *base_dir,
temp_dir = _g_file_get_temp_work_dir (NULL);
destination_parent = _g_path_remove_level (destination);
parent_dir = _g_file_append_path (temp_dir, destination_parent, NULL);
parent_dir = _g_file_append_path (temp_dir, destination_parent, NULL);
debug (DEBUG_INFO, "mkdir %s\n", g_file_get_path (parent_dir));
_g_file_make_directory_tree (parent_dir, 0700, NULL);
......@@ -951,6 +951,11 @@ _fr_command_add (FrCommand *self,
new_file_list = _g_string_list_dup (file_list);
}
/* see fr-archive.h for an explanation of the following code */
if (base_dir_created && ! archive->propAddCanFollowDirectoryLinksWithoutDereferencing)
follow_links = TRUE;
/* if the command cannot update, get the list of files that are
* newer than the ones in the archive. */
......
......@@ -20,6 +20,7 @@
*/
#include <config.h>
#include "fr-error.h"
......
......@@ -46,6 +46,7 @@ struct _FrNewArchiveDialogPrivate {
gboolean can_encrypt;
gboolean can_encrypt_header;
gboolean can_create_volumes;
GFile *original_file;
};
......@@ -59,6 +60,7 @@ fr_new_archive_dialog_finalize (GObject *object)
self = FR_NEW_ARCHIVE_DIALOG (object);
_g_object_unref (self->priv->original_file);
g_object_unref (self->priv->settings);
g_object_unref (self->priv->builder);
g_hash_table_unref (self->priv->supported_ext);
......@@ -102,7 +104,6 @@ fr_new_archive_dialog_class_init (FrNewArchiveDialogClass *klass)
object_class = G_OBJECT_CLASS (klass);
object_class->finalize = fr_new_archive_dialog_finalize;
object_class->finalize = fr_new_archive_dialog_finalize;
widget_class = GTK_WIDGET_CLASS (klass);
widget_class->unmap = fr_new_archive_dialog_unmap;
......@@ -116,6 +117,7 @@ fr_new_archive_dialog_init (FrNewArchiveDialog *self)
self->priv->settings = g_settings_new (FILE_ROLLER_SCHEMA_NEW);
self->priv->builder = NULL;
self->priv->supported_ext = g_hash_table_new (g_str_hash, g_str_equal);
self->priv->original_file = NULL;
}
......@@ -200,7 +202,8 @@ _fr_new_archive_dialog_construct (FrNewArchiveDialog *self,
GtkWindow *parent,
FrNewArchiveAction action,
GFile *folder,
const char *default_name)
const char *default_name,
GFile *original_file)
{
char *active_extension;
int active_extension_idx;
......@@ -214,6 +217,9 @@ _fr_new_archive_dialog_construct (FrNewArchiveDialog *self,
if (self->priv->builder == NULL)
return;
_g_object_unref (self->priv->original_file);
self->priv->original_file = _g_object_ref (original_file);
gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (self))), GET_WIDGET ("content"));
gtk_dialog_add_button (GTK_DIALOG (self), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
......@@ -298,12 +304,13 @@ fr_new_archive_dialog_new (const char *title,
GtkWindow *parent,
FrNewArchiveAction action,
GFile *folder,
const char *default_name)
const char *default_name,
GFile *original_file)
{
FrNewArchiveDialog *self;
self = g_object_new (FR_TYPE_NEW_ARCHIVE_DIALOG, "title", title, NULL);
_fr_new_archive_dialog_construct (self, parent, action, folder, default_name);
_fr_new_archive_dialog_construct (self, parent, action, folder, default_name, original_file);
return (GtkWidget *) self;
}
......@@ -344,7 +351,7 @@ fr_new_archive_dialog_get_file (FrNewArchiveDialog *self,
/* file */
n_format = get_selected_format (self);
parent = gtk_file_chooser_get_current_folder_file (GTK_FILE_CHOOSER (GET_WIDGET ("parent_filechooserbutton")));
parent = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (GET_WIDGET ("parent_filechooserbutton")));
if (parent == NULL) {
GtkWidget *d;
......@@ -427,6 +434,24 @@ fr_new_archive_dialog_get_file (FrNewArchiveDialog *self,
return NULL;
}
/* check whehter the file is equal to the original file */
if ((self->priv->original_file != NULL) && (g_file_equal (file, self->priv->original_file))) {
dialog = _gtk_error_dialog_new (GTK_WINDOW (self),
GTK_DIALOG_MODAL,
NULL,
_("Could not create the archive"),
"%s",
_("New name is the same as old one, please type other name."));
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (GTK_WIDGET (dialog));
g_object_unref (parent_info);
g_object_unref (file);
return NULL;
}
/* overwrite confirmation */
if (g_file_query_exists (file, NULL)) {
......
......@@ -55,7 +55,8 @@ GtkWidget * fr_new_archive_dialog_new (const char *
GtkWindow *parent,
FrNewArchiveAction action,
GFile *folder,
const char *default_name);
const char *default_name,
GFile *original_file);
GFile * fr_new_archive_dialog_get_file (FrNewArchiveDialog *dialog,
const char **mime_type);
const char * fr_new_archive_dialog_get_password (FrNewArchiveDialog *dialog);
......
......@@ -19,6 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
......
This diff is collapsed.
......@@ -106,6 +106,11 @@ struct _FrWindowClass
GType fr_window_get_type (void);
GtkWidget * fr_window_new (void);
void fr_window_close (FrWindow *window);
void fr_window_set_dialog (FrWindow *window,
const char *dialog_name,
GtkWidget *dialog);
gboolean fr_window_present_dialog_if_created (FrWindow *window,
const char *dialog_name);
/* archive operations */
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.