diff options
author | zhuyaliang <[email protected]> | 2023-03-15 10:57:07 +0800 |
---|---|---|
committer | Luke from DC <[email protected]> | 2023-03-22 03:36:00 +0000 |
commit | 16ef96fa57c1e1f550b9de13f4d87ad4c5ce9452 (patch) | |
tree | 5b9a4c9d513705d59da8df23e37a268dc9f363e1 /src/actions.c | |
parent | c7bb2fa397156a1ce000fe375acfe82a39d51cb0 (diff) | |
download | engrampa-16ef96fa57c1e1f550b9de13f4d87ad4c5ce9452.tar.bz2 engrampa-16ef96fa57c1e1f550b9de13f4d87ad4c5ce9452.tar.xz |
Fix archive file save as function
Diffstat (limited to 'src/actions.c')
-rw-r--r-- | src/actions.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/actions.c b/src/actions.c index 98028e4..6b0b25c 100644 --- a/src/actions.c +++ b/src/actions.c @@ -198,6 +198,22 @@ get_archive_filename_from_selector (DlgNewData *data) } g_object_unref (info); g_object_unref (dir); + if ((data->original_file != NULL) && (g_file_equal (file, data->original_file))) { + GtkWidget *dialog; + dialog = _gtk_error_dialog_new (GTK_WINDOW (data->dialog), + 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 (info); + g_object_unref (file); + + return NULL; + } /* if the user did not specify a valid extension use the filetype combobox current type * or tar.gz if automatic is selected. */ @@ -450,11 +466,11 @@ activate_action_save_as (GtkAction *action, { FrWindow *window = callback_data; DlgNewData *data; + GFile *file = NULL; char *archive_name = NULL; if (fr_window_get_archive_uri (window)) { const char *uri; - GFile *file; GFileInfo *info; GError *err = NULL; @@ -472,10 +488,10 @@ activate_action_save_as (GtkAction *action, archive_name = g_strdup (g_file_info_get_display_name (info)); g_object_unref (info); - g_object_unref (file); } data = dlg_save_as (window, archive_name); + data->original_file = file; g_signal_connect (G_OBJECT (data->dialog), "response", G_CALLBACK (save_file_response_cb), |