[epiphany] ephy-window: make construct_confirm_close_dialog reusable



commit 5fed4b274d16041d629155c6b246a46917d09fe7
Author: Diego Escalante Urrelo <descalante igalia com>
Date:   Thu Jan 27 13:48:14 2011 -0500

    ephy-window: make construct_confirm_close_dialog reusable
    
    Bug #618443

 src/ephy-window.c |   28 ++++++++++++++++------------
 1 files changed, 16 insertions(+), 12 deletions(-)
---
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 5753912..98eb1c4 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -515,24 +515,24 @@ impl_set_active_child (EphyEmbedContainer *container,
 }
 
 static GtkWidget *
-construct_confirm_close_dialog (EphyWindow *window)
+construct_confirm_close_dialog (EphyWindow *window,
+				const char *title,
+				const char *info,
+				const char *action)
 {
 	GtkWidget *dialog;
 
-	dialog = gtk_message_dialog_new
-		(GTK_WINDOW (window),
-		 GTK_DIALOG_MODAL,
-		 GTK_MESSAGE_WARNING,
-		 GTK_BUTTONS_CANCEL,
-		 _("There are unsubmitted changes to form elements"));
+	dialog = gtk_message_dialog_new (GTK_WINDOW (window),
+					 GTK_DIALOG_MODAL,
+					 GTK_MESSAGE_WARNING,
+					 GTK_BUTTONS_CANCEL,
+					 title);
 
 	gtk_message_dialog_format_secondary_text
-		(GTK_MESSAGE_DIALOG (dialog),
-		 _("If you close the document anyway, "
-		   "you will lose that information."));
+		(GTK_MESSAGE_DIALOG (dialog), info);
 	
 	gtk_dialog_add_button (GTK_DIALOG (dialog),
-			       _("Close _Document"), GTK_RESPONSE_ACCEPT);
+			       action, GTK_RESPONSE_ACCEPT);
 
 	gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL);
 
@@ -554,7 +554,11 @@ confirm_close_with_modified_forms (EphyWindow *window)
 		GtkWidget *dialog;
 		int response;
 
-		dialog = construct_confirm_close_dialog (window);
+		dialog = construct_confirm_close_dialog (window,
+				_("There are unsubmitted changes to form elements"),
+				_("If you close the document anyway, "
+				  "you will lose that information."),
+				_("Close _Document"));
 		response = gtk_dialog_run (GTK_DIALOG (dialog));
 
 		gtk_widget_destroy (dialog);



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