[gtranslator: 1/2] Add a save-changes dialog for open button
- From: Daniel Garcia Moreno <danigm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtranslator: 1/2] Add a save-changes dialog for open button
- Date: Tue, 8 Oct 2019 06:34:33 +0000 (UTC)
commit 32da8132a4e6832945435fb4dbb62deb6950f9b9
Author: Priyanka Saggu <priyankasggu11929 gmail com>
Date: Sun Oct 6 03:42:38 2019 +0530
Add a save-changes dialog for open button
src/gtr-actions-file.c | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
---
diff --git a/src/gtr-actions-file.c b/src/gtr-actions-file.c
index d58efc18..12b12440 100644
--- a/src/gtr-actions-file.c
+++ b/src/gtr-actions-file.c
@@ -46,7 +46,7 @@
#define GTR_IS_CLOSING_ALL "gtr-is-closing-all"
static void load_file_list (GtrWindow * window, const GSList * uris);
-
+static GList * get_modified_documents (GtrWindow * window);
/*
* The main file opening function. Checks that the file isn't already open,
@@ -189,6 +189,30 @@ void
gtr_open_file_dialog (GtkAction * action, GtrWindow * window)
{
GtkWidget *dialog = NULL;
+ GList *list;
+
+ list = get_modified_documents (window);
+ if (list != NULL)
+ {
+ 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_file_as_dialog ((GtkAction*) action, window);
+ return;
+ }
+ }
if (dialog != NULL)
{
@@ -783,3 +807,4 @@ _gtr_actions_file_save_all (GtkAction * action, GtrWindow * window)
g_list_free (list);
}
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]