[network-manager-openconnect] Fix gtk_message_dialog_new usage



commit f61b3aa4d6e6ad08547cdf0206c795e296842165
Author: Mathieu Trudel-Lapierre <mathieu tl gmail com>
Date:   Wed Aug 10 14:22:57 2011 -0400

    Fix gtk_message_dialog_new usage
    
    Trying to build network-manager-openconnect on Ubuntu oneiric with
    GTK3 (or GTK 2.24...), I've ran into a failure to build:
    
    gtk_message_dialog_new () in auth-dialog/main.c has the build fail
    because in at least GTK 2.24; this function expects a message format
    along with the accompanying parameters rather than a preformatted
    message. See the attached patch which fixes the issue.
    
    [dwmw2: This looks like it was always a potential crash if the
            hostname or reason contained things like '%s'. Newer
            environments or versions of GTK+ actually make it fail to
            build, but it was always wrong.]

 auth-dialog/main.c |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)
---
diff --git a/auth-dialog/main.c b/auth-dialog/main.c
index 0157de3..30e0366 100644
--- a/auth-dialog/main.c
+++ b/auth-dialog/main.c
@@ -618,7 +618,7 @@ static gboolean user_validate_cert(cert_data *data)
 {
 	auth_ui_data *ui_data = _ui_data; /* FIXME global */
 	BIO *bp = BIO_new(BIO_s_mem());
-	char *msg, *title;
+	char *title;
 	BUF_MEM *certinfo;
 	char zero = 0;
 	GtkWidget *dlg, *text, *scroll;
@@ -633,14 +633,12 @@ static gboolean user_validate_cert(cert_data *data)
 	BIO_get_mem_ptr(bp, &certinfo);
 
 	title = get_title(data->ui_data->vpn_name);
-	msg = g_strdup_printf(_("Certificate from VPN server \"%s\" failed verification.\n"
-			      "Reason: %s\nDo you want to accept it?"),
-			      openconnect_get_hostname(data->ui_data->vpninfo),
-			      data->reason);
-
 	dlg = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_QUESTION,
 				     GTK_BUTTONS_OK_CANCEL,
-				     msg);
+	                             _("Certificate from VPN server \"%s\" failed verification.\n"
+			             "Reason: %s\nDo you want to accept it?"),
+			             openconnect_get_hostname(data->ui_data->vpninfo),
+			             data->reason);
 	gtk_window_set_skip_taskbar_hint(GTK_WINDOW(dlg), FALSE);
 	gtk_window_set_skip_pager_hint(GTK_WINDOW(dlg), FALSE);
 	gtk_window_set_title(GTK_WINDOW(dlg), title);
@@ -649,7 +647,6 @@ static gboolean user_validate_cert(cert_data *data)
 	gtk_dialog_set_default_response(GTK_DIALOG(dlg), GTK_RESPONSE_CANCEL);
 
 	g_free(title);
-	g_free(msg);
 
 	scroll = gtk_scrolled_window_new(NULL, NULL);
 	gtk_box_pack_start(GTK_BOX (gtk_dialog_get_content_area(GTK_DIALOG (dlg))), scroll, TRUE, TRUE, 0);



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