Commit 99a77fa3 authored by TrueTechie's avatar TrueTechie
Browse files

Use different warning when closing an unsaved, read-only document

parent 476e4be0
Pipeline #8754 passed with stages
in 1 minute and 58 seconds
......@@ -389,7 +389,8 @@ mousepad_dialogs_save_changes (GtkWindow *parent,
GtkWidget *area, *hbox, *vbox;
GtkWidget *button;
GtkWidget *image;
GtkWidget *label;
GtkWidget *prompt_label;
GtkWidget *warning_label;
gint response;
/* create the question dialog */
......@@ -403,9 +404,13 @@ mousepad_dialogs_save_changes (GtkWindow *parent,
mousepad_util_image_button ("edit-delete", _("_Don't Save")),
MOUSEPAD_RESPONSE_DONT_SAVE);
/* warning label */
warning_label = gtk_label_new(NULL);
/* we show the save as button instead of save for readonly document */
if (G_UNLIKELY (readonly))
{
gtk_label_set_text(GTK_LABEL(warning_label), "The document file is read-only. If you don't save the document as another file, all the changes will be lost.");
image = gtk_image_new_from_icon_name ("document-save-as", GTK_ICON_SIZE_DIALOG);
button = mousepad_util_image_button ("document-save-as", _("_Save As"));
gtk_widget_set_can_default (button, TRUE);
......@@ -414,6 +419,7 @@ mousepad_dialogs_save_changes (GtkWindow *parent,
}
else
{
gtk_label_set_text(GTK_LABEL(warning_label), "If you don't save the document, all the changes will be lost.");
image = gtk_image_new_from_icon_name ("document-save", GTK_ICON_SIZE_DIALOG);
button = mousepad_util_image_button ("document-save", _("_Save"));
gtk_widget_set_can_default (button, TRUE);
......@@ -436,17 +442,16 @@ mousepad_dialogs_save_changes (GtkWindow *parent,
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 6);
gtk_widget_show (vbox);
/* primary text */
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label),
/* prompt text */
prompt_label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (prompt_label),
_("<big><b>Do you want to save the changes before closing?</b></big>"));
gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 0);
gtk_widget_show (label);
gtk_box_pack_start (GTK_BOX (vbox), prompt_label, TRUE, TRUE, 0);
gtk_widget_show (prompt_label);
/* secondary text */
label = gtk_label_new (_("If you don't save the document, all the changes will be lost."));
gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 0);
gtk_widget_show (label);
/* warning text */
gtk_box_pack_start (GTK_BOX (vbox), warning_label, TRUE, TRUE, 0);
gtk_widget_show (warning_label);
/* run the dialog and wait for a response */
response = gtk_dialog_run (GTK_DIALOG (dialog));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment