Mailing List Archive

NessusClient/nessus/prefs_dialog prefs_report.c,1.7,1.8
Update of /usr/local/cvs/NessusClient/nessus/prefs_dialog
In directory raccoon.nessus.org:/tmp/cvs-serv41704

Modified Files:
prefs_report.c
Log Message:
Migrating from GtkOptionMenu to GtkComboBox
as recommended for GTK+ >= 2.4.0.


Index: prefs_report.c
===================================================================
RCS file: /usr/local/cvs/NessusClient/nessus/prefs_dialog/prefs_report.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- prefs_report.c 4 May 2006 15:33:17 -0000 1.7
+++ prefs_report.c 18 Oct 2006 22:44:27 -0000 1.8
@@ -248,7 +248,7 @@
{
GtkTreeView * tree_view;
GtkTreeModel * tree_store;
- GtkWidget * order_optionmenu;
+ GtkWidget * order_combobox;
int order_index;
int be = (int)arg_get_value(ctrls, "BE");
const char *restriction_keys[3];
@@ -262,8 +262,8 @@
tree_view = GTK_TREE_VIEW(arg_get_value(ctrls, "REPORT_TREE_VIEW"));
tree_store = GTK_TREE_MODEL(gtk_tree_store_new(NUM_COLS, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_INT));
- order_optionmenu = arg_get_value(ctrls, "ORDER_OPTION_MENU");
- order_index = gtk_option_menu_get_history(GTK_OPTION_MENU(order_optionmenu));
+ order_combobox = arg_get_value(ctrls, "ORDER_COMBO_BOX");
+ order_index = gtk_combo_box_get_active(GTK_COMBO_BOX(order_combobox));

fill_tree_model(tree_store, be, tree_orders[order_index], 2, 0, NULL,
restriction_keys, restriction_values);
@@ -410,11 +410,11 @@
}


-/* Signal handler for the "changed" signal of the tree order option menu
+/* Signal handler for the "changed" signal of the tree order combobox.
* Simply calls prefs_report_update to update the tree.
*/
static void
-order_optionmenu_changed(GtkOptionMenu *optionmenu, gpointer user_data)
+order_combobox_changed(GtkComboBox *combobox, gpointer user_data)
{
prefs_report_update(user_data);
}
@@ -432,9 +432,7 @@
GtkWidget *hpaned;
GtkWidget *report;
GtkWidget *tree_box;
- GtkWidget *order_optionmenu;
- GtkWidget *order_menu;
- GtkWidget *menuitem;
+ GtkWidget *order_combobox;
GtkTreeSelection *selection;
GtkTreeViewColumn *column;
GtkCellRenderer *renderer;
@@ -456,25 +454,21 @@
gtk_widget_show(tree_box);
gtk_container_add(GTK_CONTAINER(hpaned), tree_box);

- /* The tree order option menu
+ /* The tree order combobox
* NOTE: the order of the menu items should match the order of the
* elements of tree_orders
*/
- order_optionmenu = gtk_option_menu_new();
- arg_add_value(ctrls, "ORDER_OPTION_MENU", ARG_PTR, -1, order_optionmenu);
- gtk_widget_show(order_optionmenu);
- gtk_box_pack_start(GTK_BOX(tree_box), order_optionmenu, FALSE, FALSE, 0);
- order_menu = gtk_menu_new();
- gtk_option_menu_set_menu(GTK_OPTION_MENU(order_optionmenu), order_menu);
- menuitem = gtk_menu_item_new_with_label(_("Host/Port/Severity"));
- gtk_widget_show(menuitem);
- gtk_menu_append(GTK_MENU(order_menu), menuitem);
- menuitem = gtk_menu_item_new_with_label(_("Port/Host/Severity"));
- gtk_widget_show(menuitem);
- gtk_menu_append(GTK_MENU(order_menu), menuitem);
- g_signal_connect(G_OBJECT(order_optionmenu), "changed",
- G_CALLBACK(order_optionmenu_changed), ctrls);
- gtk_option_menu_set_history(GTK_OPTION_MENU(order_optionmenu), 0);
+ order_combobox = gtk_combo_box_new_text ();
+ arg_add_value(ctrls, "ORDER_COMBO_BOX", ARG_PTR, -1, order_combobox);
+ gtk_widget_show(order_combobox);
+ gtk_box_pack_start(GTK_BOX(tree_box), order_combobox, FALSE, FALSE, 0);
+ gtk_combo_box_append_text(GTK_COMBO_BOX(order_combobox),
+ _("Host/Port/Severity"));
+ gtk_combo_box_append_text(GTK_COMBO_BOX(order_combobox),
+ _("Port/Host/Severity"));
+ g_signal_connect(G_OBJECT(order_combobox), "changed",
+ G_CALLBACK(order_combobox_changed), ctrls);
+ gtk_combo_box_set_active(GTK_COMBO_BOX(order_combobox), 0);

/* scrolled window for the tree */
tree_window = gtk_scrolled_window_new(NULL, NULL);

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