Skip to content

Commit

Permalink
Show warning when exporting to a plain format
Browse files Browse the repository at this point in the history
  • Loading branch information
paolostivanin committed Mar 1, 2024
1 parent 1383208 commit 1a8e6ff
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
13 changes: 9 additions & 4 deletions src/exports.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
#include "message-dialogs.h"
#include "common/exports.h"


static void show_ret_msg_dialog (GtkWidget *mainwin,
const gchar *fpath,
const gchar *ret_msg);
static void show_ret_msg_dialog (GtkWidget *mainwin,
const gchar *fpath,
const gchar *ret_msg);


void
Expand All @@ -35,6 +34,12 @@ export_data_cb (GSimpleAction *simple,
return;
}
encrypted = TRUE;
} else {
const gchar *msg = "Please note that exporting to a plain format is a huge security risk.\n"
"If you wish to safely abort the operation, please click the 'Cancel' button below.";
if (get_confirmation_from_dialog (app_data->main_window, msg) == FALSE) {
return;
}
}

GtkFileChooserNative *fl_diag = gtk_file_chooser_native_new ("Export file",
Expand Down
14 changes: 7 additions & 7 deletions src/message-dialogs.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@ get_confirmation_from_dialog (GtkWidget *parent,
static GtkWidget *dialog = NULL;
gboolean confirm;

dialog = gtk_dialog_new_with_buttons ("Confirm", GTK_WINDOW (parent), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
dialog = gtk_dialog_new_with_buttons ("Confirm", GTK_WINDOW(parent), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
"OK", GTK_RESPONSE_OK, "Cancel", GTK_RESPONSE_CANCEL,
NULL);

gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
gtk_container_set_border_width (GTK_CONTAINER(dialog), 5);

GtkWidget *content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
GtkWidget *content_area = gtk_dialog_get_content_area (GTK_DIALOG(dialog));
GtkWidget *label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label), message);
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER);
gtk_container_add (GTK_CONTAINER (content_area), label);
gtk_label_set_markup (GTK_LABEL(label), message);
gtk_label_set_justify (GTK_LABEL(label), GTK_JUSTIFY_CENTER);
gtk_container_add (GTK_CONTAINER(content_area), label);
gtk_widget_show_all (dialog);

gint result = gtk_dialog_run (GTK_DIALOG (dialog));
gint result = gtk_dialog_run (GTK_DIALOG(dialog));
switch (result) {
case GTK_RESPONSE_OK:
confirm = TRUE;
Expand Down

0 comments on commit 1a8e6ff

Please sign in to comment.