Hi,
I just commited my patch for CR #7 with the changes proposed by Jan.
I've attached a patch for the last part of CR #8; the credentials preferences
page now uses the same layout class as the plugin preferences and should
provide a more consistent user interface.
Let me know what you think.
Regards,
Michael
Index: openvas-client/nessus/prefs_dialog/prefs_dialog_plugins_prefs.c
===================================================================
--- openvas-client/nessus/prefs_dialog/prefs_dialog_plugins_prefs.c
(Revision 892)
+++ openvas-client/nessus/prefs_dialog/prefs_dialog_plugins_prefs.c
(Arbeitskopie)
@@ -53,39 +53,27 @@
create_plugin_prefs_containers(ctrls)
struct arglist *ctrls;
{
- GtkWidget *listnotebook;
- GtkWidget *cred_s_window, *cred_vbox;
+ GtkWidget *listnotebook, *cred_listnotebook;
listnotebook = listnotebook_new(FALSE, TRUE);
read_only_set_recurse(listnotebook);
gtk_container_set_border_width(GTK_CONTAINER(listnotebook), 10);
- cred_s_window = gtk_scrolled_window_new(NULL, NULL);
- read_only_set_recurse(cred_s_window);
- gtk_container_border_width(GTK_CONTAINER(cred_s_window), 10);
- gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(cred_s_window),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-
- cred_vbox = gtk_vbox_new(FALSE, FALSE);
- read_only_set_recurse(cred_vbox);
- gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(cred_s_window),
- cred_vbox);
- gtk_widget_show(cred_vbox);
-
+ cred_listnotebook = listnotebook_new(FALSE, TRUE);
+ read_only_set_recurse(cred_listnotebook);
+ gtk_container_set_border_width(GTK_CONTAINER(cred_listnotebook), 10);
+
/* On the first call we have to add the values, on subsequent calls we
* just set them */
if (arg_get_value(ctrls, "PLUGIN_PREFS") != NULL)
{
arg_set_value(ctrls, "PLUGIN_PREFS", -1, listnotebook);
- arg_set_value(ctrls, "SCROLLED_WINDOW_CREDENTIALS", -1, cred_s_window);
- arg_set_value(ctrls, "VBOX_CREDENTIALS", -1, cred_vbox);
+ arg_set_value(ctrls, "PLUGIN_CREDENTIALS", -1, cred_listnotebook);
}
else
{
arg_add_value(ctrls, "PLUGIN_PREFS", ARG_PTR, -1, listnotebook);
- arg_add_value(ctrls, "VBOX_CREDENTIALS", ARG_PTR, -1, cred_vbox);
- arg_add_value(ctrls, "SCROLLED_WINDOW_CREDENTIALS", ARG_PTR, -1,
- cred_s_window);
+ arg_add_value(ctrls, "PLUGIN_CREDENTIALS", ARG_PTR, -1, cred_listnotebook);
}
}
@@ -95,7 +83,7 @@
{
struct arglist *ctrls = emalloc(sizeof(struct arglist));
GtkWidget *frame, * cred_frame;
- GtkWidget *plugin_prefs, * cred_s_window;
+ GtkWidget *plugin_prefs, *plugin_credentials;
frame = gtk_frame_new(_("Advanced Plugins preferences"));
gtk_container_border_width(GTK_CONTAINER(frame), 10);
@@ -115,10 +103,9 @@
plugin_prefs = arg_get_value(ctrls, "PLUGIN_PREFS");
gtk_container_add(GTK_CONTAINER(frame), plugin_prefs);
gtk_widget_show(plugin_prefs);
- cred_s_window = arg_get_value(ctrls, "SCROLLED_WINDOW_CREDENTIALS");
- read_only_set_recurse(cred_s_window);
- gtk_container_add(GTK_CONTAINER(cred_frame), cred_s_window);
- gtk_widget_show(cred_s_window);
+ plugin_credentials = arg_get_value(ctrls, "PLUGIN_CREDENTIALS");
+ gtk_container_add(GTK_CONTAINER(cred_frame), plugin_credentials);
+ gtk_widget_show(plugin_credentials);
return (ctrls);
}
@@ -150,17 +137,20 @@
if((prefs = plugs->plugin_prefs) != NULL )
{
if (strcmp(plugs->family, "Credentials"))
+ {
notebook_vbox = pprefs_add_notebook_page(ctrls, plugs->name, 0);
+ }
+ else
+ {
+ notebook_vbox = pprefs_add_notebook_page(ctrls, plugs->name, 1);
+ }
while(prefs && prefs->next)
{
char *type, *value;
GtkWidget *vbox;
- if (strcmp(plugs->family, "Credentials"))
- vbox = notebook_vbox;
- else
- vbox = arg_get_value(ctrls, "VBOX_CREDENTIALS");
+ vbox = notebook_vbox;
type = arg_get_value(prefs->value, "type");
value = arg_get_value(prefs->value, "value");
@@ -182,8 +172,6 @@
}
plugs = plugs->next;
}
-
- listnotebook_select_page(arg_get_value(ctrls, "PLUGIN_PREFS"), 0);
}
/*
@@ -228,45 +216,38 @@
struct arglist *ctrls;
{
GtkWidget *frame, *cred_frame;
- GtkWidget *plugin_prefs, *cred_s_window;
- GtkWidget *cred_vbox;
+ GtkWidget *plugin_prefs, *plugin_credentials;
frame = arg_get_value(ctrls, "FRAME");
plugin_prefs = arg_get_value(ctrls, "PLUGIN_PREFS");
cred_frame = arg_get_value(ctrls, "FRAME_CREDENTIALS");
- cred_s_window = arg_get_value(ctrls, "SCROLLED_WINDOW_CREDENTIALS");
- cred_vbox = arg_get_value(ctrls, "VBOX_CREDENTIALS");
+ plugin_credentials = arg_get_value(ctrls, "PLUGIN_CREDENTIALS");
gtk_widget_hide(plugin_prefs);
- gtk_widget_hide(cred_s_window);
+ gtk_widget_hide(plugin_credentials);
gtk_container_remove(GTK_CONTAINER(frame), plugin_prefs);
- gtk_container_remove(GTK_CONTAINER(cred_frame), cred_s_window);
+ gtk_container_remove(GTK_CONTAINER(cred_frame), plugin_credentials);
plugin_prefs = context->plugin_prefs_widget;
- cred_s_window = context->plugin_prefs_cred_swindow;
- cred_vbox = context->plugin_prefs_cred_vbox;
- if(plugin_prefs != NULL && cred_s_window != NULL && cred_vbox != NULL)
+ plugin_credentials = context->plugin_prefs_cred_widget;
+ if(plugin_prefs != NULL && plugin_credentials != NULL)
{
arg_set_value(ctrls, "PLUGIN_PREFS", -1, plugin_prefs);
- arg_set_value(ctrls, "SCROLLED_WINDOW_CREDENTIALS", -1, cred_s_window);
- arg_set_value(ctrls, "VBOX_CREDENTIALS", -1, cred_vbox);
+ arg_set_value(ctrls, "PLUGIN_CREDENTIALS", -1, plugin_credentials);
}
else
{
create_plugin_prefs_containers(ctrls);
plugin_prefs = arg_get_value(ctrls, "PLUGIN_PREFS");
- cred_s_window = arg_get_value(ctrls, "SCROLLED_WINDOW_CREDENTIALS");
- cred_vbox = arg_get_value(ctrls, "VBOX_CREDENTIALS");
+ plugin_credentials = arg_get_value(ctrls, "PLUGIN_CREDENTIALS");
if((context->plugins && context->plugins->next)
|| (context->scanners && context->scanners->next))
{
g_object_ref(plugin_prefs);
- g_object_ref(cred_s_window);
- g_object_ref(cred_vbox);
+ g_object_ref(plugin_credentials);
context->plugin_prefs_widget = plugin_prefs;
- context->plugin_prefs_cred_swindow = cred_s_window;
- context->plugin_prefs_cred_vbox = cred_vbox;
+ context->plugin_prefs_cred_widget = plugin_credentials;
prefs_plugins_reset(ctrls, context->scanners);
prefs_plugins_reset(ctrls, context->plugins);
@@ -289,12 +270,12 @@
gtk_widget_set_sensitive(plugin_prefs, TRUE);
gtk_widget_show(plugin_prefs);
- gtk_container_add(GTK_CONTAINER(cred_frame), cred_s_window);
+ gtk_container_add(GTK_CONTAINER(cred_frame), plugin_credentials);
/* cred_frame's children may also have an unset GTK_PARENT_SENSITIVE
* flag so work around it in the same manner as above for plugin_prefs */
gtk_widget_set_sensitive(cred_frame, FALSE);
gtk_widget_set_sensitive(cred_frame, TRUE);
- gtk_widget_show(cred_s_window);
+ gtk_widget_show(plugin_credentials);
}
@@ -321,7 +302,22 @@
listnotebook_add_page(listnotebook, s_window, name, NULL);
}
+ else
+ {
+ GtkWidget *cred_listnotebook = arg_get_value(ctrls, "PLUGIN_CREDENTIALS");
+ GtkWidget *s_window = gtk_scrolled_window_new(NULL, NULL);
+ read_only_set_recurse(s_window);
+ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(s_window),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_widget_show(s_window);
+ vbox = gtk_vbox_new(FALSE, FALSE);
+ gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(s_window), vbox);
+ gtk_widget_show(vbox);
+
+ listnotebook_add_page(cred_listnotebook, s_window, name, NULL);
+ }
+
return vbox;
}
Index: openvas-client/nessus/context.c
===================================================================
--- openvas-client/nessus/context.c (Revision 892)
+++ openvas-client/nessus/context.c (Arbeitskopie)
@@ -56,8 +56,7 @@
(*context)->treerowref = NULL;
(*context)->move_menuitem = NULL;
(*context)->plugin_prefs_widget = NULL;
- (*context)->plugin_prefs_cred_swindow = NULL;
- (*context)->plugin_prefs_cred_vbox = NULL;
+ (*context)->plugin_prefs_cred_widget = NULL;
(*context)->pbar = NULL;
(*context)->plugin_tree_store = NULL;
(*context)->plugin_tree_model = NULL;
@@ -113,14 +112,10 @@
g_object_unref(context->plugin_prefs_widget);
context->plugin_prefs_widget = NULL;
}
- if (context->plugin_prefs_cred_swindow != NULL) {
- g_object_unref(context->plugin_prefs_cred_swindow);
- context->plugin_prefs_cred_swindow = NULL;
+ if (context->plugin_prefs_cred_widget != NULL) {
+ g_object_unref(context->plugin_prefs_cred_widget);
+ context->plugin_prefs_cred_widget = NULL;
}
- if (context->plugin_prefs_cred_vbox != NULL) {
- g_object_unref(context->plugin_prefs_cred_vbox);
- context->plugin_prefs_cred_vbox = NULL;
- }
#endif
}
Index: openvas-client/nessus/context.h
===================================================================
--- openvas-client/nessus/context.h (Revision 892)
+++ openvas-client/nessus/context.h (Arbeitskopie)
@@ -65,8 +65,7 @@
GtkTreeRowReference *treerowref;
GtkWidget *move_menuitem;
GtkWidget *plugin_prefs_widget;
- GtkWidget *plugin_prefs_cred_swindow;
- GtkWidget *plugin_prefs_cred_vbox;
+ GtkWidget *plugin_prefs_cred_widget;
GtkWidget *pbar;
GtkTreeStore *plugin_tree_store;
GtkTreeModel *plugin_tree_model;
Index: openvas-client/ChangeLog
===================================================================
--- openvas-client/ChangeLog (Revision 892)
+++ openvas-client/ChangeLog (Arbeitskopie)
@@ -1,5 +1,23 @@
2008-06-05 Michael Wiegand <[EMAIL PROTECTED]>
+ Implementing Credentials page changes according to
+ change request #8, http://www.openvas.org/openvas-cr-8.html.
+
+ * nessus/prefs_dialog/prefs_dialog_plugins_prefs.c
+ (create_plugin_prefs_containers, prefs_dialog_plugins_prefs,
+ prefs_dialog_plugins_prefs_read_only, prefs_dialog_plugins_prefs_fill,
+ prefs_plugins_prefs_redraw, pprefs_add_notebook_page): Changed
+ implementation of the credentials page to make use of the listnotebook
+ class.
+
+ * nessus/context.c (context_init, context_force_plugin_prefs_redraw):
+ Added listnotebook object handling for credentials page to context.
+
+ * nessus/context.c: Added listnotebook object for credentials page to
+ context.
+
+2008-06-05 Michael Wiegand <[EMAIL PROTECTED]>
+
Extending report widget with optional plugin info according
to change request #7, http://www.openvas.org/openvas-cr-7.html.
_______________________________________________
Openvas-devel mailing list
[email protected]
http://lists.wald.intevation.org/mailman/listinfo/openvas-devel