[gtranslator/leo] Use confirmation dialog to save changes



commit 27232b74013387ba3a52a917bcd4270baedc4bd1
Author: Daniel Mustieles <daniel mustieles gmail com>
Date:   Tue Oct 8 09:37:02 2019 +0200

    Use confirmation dialog to save changes

 src/gtr-actions-file.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)
---
diff --git a/src/gtr-actions-file.c b/src/gtr-actions-file.c
index 809ea171..741926ce 100644
--- a/src/gtr-actions-file.c
+++ b/src/gtr-actions-file.c
@@ -194,9 +194,30 @@ gtr_open_file_dialog (GtkAction * action, GtrWindow * window)
   list = get_modified_documents (window);
   if (list != NULL)
     {
-         gtr_save_current_file_dialog (NULL, window);
+      GtkWidget *dialog;
+      gint res;
+
+      dialog = gtk_message_dialog_new (GTK_WINDOW (window),
+            GTK_DIALOG_DESTROY_WITH_PARENT,
+            GTK_MESSAGE_QUESTION,
+            GTK_BUTTONS_YES_NO,
+            _("Do you want to save the changes?"));
+      gtk_window_set_title (GTK_WINDOW (dialog), _("Warning"));
+      g_list_free (list);
+      res = gtk_dialog_run (GTK_DIALOG (dialog));
+      gtk_widget_destroy (dialog);
+
+      if (res == GTK_RESPONSE_YES)
+      {
+       gtr_save_current_file_dialog (NULL, window);
+      }
     }
 
+  if (dialog != NULL)
+    {
+      gtk_window_present (GTK_WINDOW (dialog));
+      return;
+    }
   dialog = gtr_file_chooser_new (GTK_WINDOW (window),
                                  FILESEL_OPEN,
                                  _("Open file for translation"),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]