[PATCH V2 nm-openconnect 1/3] auth-dialog: Introduce FORMCHOICE helper macro

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

 



libopenconnect >= 3.0 uses a pointer array so we need to change the way
the "choices" field is accessed.
---
 auth-dialog/main.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/auth-dialog/main.c b/auth-dialog/main.c
index 8bc13b8..9253daa 100644
--- a/auth-dialog/main.c
+++ b/auth-dialog/main.c
@@ -71,6 +71,8 @@
 #define __openconnect_set_token_mode openconnect_set_token_mode
 #endif
 
+#define FORMCHOICE(sopt, i)		(&(sopt)->choices[i])
+
 #ifdef OPENCONNECT_OPENSSL
 #include <openssl/ssl.h>
 #include <openssl/bio.h>
@@ -332,10 +334,10 @@ static void combo_changed(GtkComboBox *combo, ui_fragment_data *data)
 	if (entry < 0)
 		return;
 
-	data->entry_text = sopt->choices[entry].name;
+	data->entry_text = FORMCHOICE(sopt, entry)->name;
 
 	g_queue_foreach(data->ui_data->form_entries, (GFunc)do_override_label,
-			&sopt->choices[entry]);
+			FORMCHOICE(sopt, entry));
 }
 
 #ifdef OPENCONNECT_OPENSSL
@@ -423,17 +425,17 @@ static gboolean ui_add_select (ui_fragment_data *data)
 	combo = gtk_combo_box_text_new();
 	gtk_box_pack_end(GTK_BOX(hbox), combo, FALSE, FALSE, 0);
 	for (i = 0; i < sopt->nr_choices; i++) {
-		gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), sopt->choices[i].label);
+		gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), FORMCHOICE(sopt, i)->label);
 		if (data->entry_text &&
-		    !strcmp(data->entry_text, sopt->choices[i].name)) {
+		    !strcmp(data->entry_text, FORMCHOICE(sopt, i)->name)) {
 			gtk_combo_box_set_active(GTK_COMBO_BOX(combo), i);
 			g_free(data->entry_text);
-			data->entry_text = sopt->choices[i].name;
+			data->entry_text = FORMCHOICE(sopt, i)->name;
 		}
 	}
 	if (gtk_combo_box_get_active(GTK_COMBO_BOX(combo)) < 0) {
 		gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0); 
-		data->entry_text = sopt->choices[0].name;
+		data->entry_text = FORMCHOICE(sopt, 0)->name;
 	}
 
 	if (g_queue_peek_tail(ui_data->form_entries) == data)
-- 
1.8.3.2




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux