Mailing List Archive

NessusClient/nessus/prefs_dialog prefs_dialog.c,1.10.2.1,1.10.2.2
Update of /usr/local/cvs/NessusClient/nessus/prefs_dialog
In directory raccoon.nessus.org:/tmp/cvs-serv75798

Modified Files:
Tag: release-1-0
prefs_dialog.c
Log Message:
Second part of fixing bug 1414:
http://bugs.nessus.org/show_bug.cgi?id=1414
This part takes care to store always all parts of
a radiobutton preference and to have the selected
item first in the ;-separated list.


Index: prefs_dialog.c
===================================================================
RCS file: /usr/local/cvs/NessusClient/nessus/prefs_dialog/prefs_dialog.c,v
retrieving revision 1.10.2.1
retrieving revision 1.10.2.2
diff -u -d -r1.10.2.1 -r1.10.2.2
--- prefs_dialog.c 9 Feb 2006 00:30:37 -0000 1.10.2.1
+++ prefs_dialog.c 17 May 2006 12:41:13 -0000 1.10.2.2
@@ -1444,32 +1444,44 @@
}
else if(!strcmp(type, PREF_RADIO))
{
- GSList *list = arg_get_value(pref->value, "RADIOBUTTONS");
- char *value = NULL;
+ GSList *list = NULL;
+ char * value = NULL;

- if(list)
- while(list && !value)
- {
- GtkWidget *button = list->data;
+ list = arg_get_value(pref->value, "RADIOBUTTONS");

- if(GTK_TOGGLE_BUTTON(button)->active)
- value =
- (char *)gtk_object_get_data(GTK_OBJECT(button),
- "name");
- list = list->next;
- }
- else
- {
- char *t;
+ if (list)
+ {
+ /* First pass: find the active entry */
+ while (list)
+ {
+ GtkWidget *button = list->data;

- if(pref->value)
- value = arg_get_value(pref->value, "value");
- if(value && (t = strchr(value, ';')))
- t[0] = 0;
- }
- if(value)
- arg_set_value(pref->value, "value", strlen(value),
- estrdup(value));
+ if (GTK_TOGGLE_BUTTON(button)->active)
+ {
+ value = estrdup(gtk_object_get_data(GTK_OBJECT(button), "name"));
+ break;
+ }
+ list = list->next;
+ }
+ /* Second pass: find all other entries and append
+ * them separated with ";" */
+ list = arg_get_value(pref->value, "RADIOBUTTONS");
+ while (list)
+ {
+ GtkWidget *button = list->data;
+
+ if (! GTK_TOGGLE_BUTTON(button)->active)
+ {
+ char * v = gtk_object_get_data(GTK_OBJECT(button), "name");
+ value = (char *) erealloc((void *)value, (size_t) (strlen(value) + strlen(";") + strlen(v) + 1));
+ strcat(value, ";");
+ strcat(value, v);
+ }
+ list = list->next;
+ }
+ }
+ if(value)
+ arg_set_value(pref->value, "value", strlen(value), value);
}
}
pref = pref->next;

_______________________________________________
Nessus-cvs mailing list
Nessus-cvs@list.nessus.org
http://mail.nessus.org/mailman/listinfo/nessus-cvs