Use ws_gtk_grid...() in place of gtk_table...();

Also: Fix a minor difference in window handling between Gtk2 & Gtk3:
  Use gtk_box_pack_start() instead of gtk_container_add(0 in one case.


svn path=/trunk/; revision=46915
This commit is contained in:
Bill Meier 2013-01-03 16:26:20 +00:00
parent add135b901
commit 936626b160
1 changed files with 14 additions and 14 deletions

View File

@ -56,8 +56,8 @@ typedef struct _wsp_stats_t {
guint32 num_pdus;
GtkWidget *win;
GHashTable *hash;
GtkWidget *table_pdu_types;
GtkWidget *table_status_code;
GtkWidget *grid_pdu_types;
GtkWidget *grid_status_code;
guint index; /* Number of status codes to display */
} wspstat_t;
@ -76,7 +76,7 @@ wsp_reset_hash(gchar *key _U_ , wsp_status_code_t *data, gpointer ptr _U_)
}
/* Update the entry corresponding to the number of packets of a special status code
* or create it if it don't exist.
* or create it if it doesn't exist.
*/
static void
wsp_draw_statuscode(gchar *key _U_, wsp_status_code_t *data, gchar *unused _U_)
@ -94,13 +94,13 @@ wsp_draw_statuscode(gchar *key _U_, wsp_status_code_t *data, gchar *unused _U_)
/* Maybe we should display the hexadecimal value ? */
/* g_snprintf(string_buff, sizeof(string_buff), "%s (0X%x)", data->name, *key); */
tmp = gtk_label_new(data->name /* string_buff */ );
gtk_table_attach_defaults(GTK_TABLE(data->sp->table_status_code), tmp, x, x+1, y, y+1);
ws_gtk_grid_attach(GTK_GRID(data->sp->grid_status_code), tmp, x, y, 1, 1);
gtk_label_set_justify(GTK_LABEL(tmp), GTK_JUSTIFY_LEFT);
gtk_widget_show(tmp);
g_snprintf(string_buff, sizeof(string_buff), "%9d", data->packets);
data->widget = gtk_label_new(string_buff);
gtk_table_attach_defaults(GTK_TABLE(data->sp->table_status_code), data->widget, x+1, x+2, y, y+1);
ws_gtk_grid_attach(GTK_GRID(data->sp->grid_status_code), data->widget, x+1, y, 1, 1);
gtk_label_set_justify(GTK_LABEL(data->widget), GTK_JUSTIFY_LEFT);
gtk_widget_show(data->widget);
@ -231,7 +231,7 @@ add_table_entry(wspstat_t *sp, const char *str, int x, int y, int idx)
GtkWidget *tmp;
tmp = gtk_label_new(str);
gtk_table_attach_defaults(GTK_TABLE(sp->table_pdu_types), tmp, x, x+1, y, y+1);
ws_gtk_grid_attach(GTK_GRID(sp->grid_pdu_types), tmp, x, y, 1, 1);
gtk_label_set_justify(GTK_LABEL(tmp), GTK_JUSTIFY_LEFT);
gtk_widget_show(tmp);
if (idx != 0) {
@ -346,21 +346,21 @@ gtk_wspstat_init(const char *opt_arg, void *userdata _U_)
/* PDU Types frame */
pdutypes_fr = gtk_frame_new("Summary of PDU Types (wsp.pdu_type)");
gtk_container_add(GTK_CONTAINER(main_vb), pdutypes_fr);
gtk_box_pack_start(GTK_BOX(main_vb), pdutypes_fr, TRUE, TRUE, 0);
sp->table_pdu_types = gtk_table_new((sp->num_pdus+1) / 2 + 1, 4, FALSE);
gtk_container_add(GTK_CONTAINER(pdutypes_fr), sp->table_pdu_types);
gtk_container_set_border_width(GTK_CONTAINER(sp->table_pdu_types), 10);
sp->grid_pdu_types = ws_gtk_grid_new();
gtk_container_add(GTK_CONTAINER(pdutypes_fr), sp->grid_pdu_types);
gtk_container_set_border_width(GTK_CONTAINER(sp->grid_pdu_types), 10);
wsp_init_table(sp);
/* Status Codes frame */
statuscode_fr = gtk_frame_new("Summary of Status Code (wsp.reply.status)");
gtk_container_add(GTK_CONTAINER(main_vb), statuscode_fr);
gtk_box_pack_start(GTK_BOX(main_vb), statuscode_fr, TRUE, TRUE, 0);
sp->table_status_code = gtk_table_new(0, 4, FALSE);
gtk_container_add(GTK_CONTAINER(statuscode_fr), sp->table_status_code);
gtk_container_set_border_width(GTK_CONTAINER(sp->table_status_code), 10);
sp->grid_status_code = ws_gtk_grid_new();
gtk_container_add(GTK_CONTAINER(statuscode_fr), sp->grid_status_code);
gtk_container_set_border_width(GTK_CONTAINER(sp->grid_status_code), 10);
sp->index = 0; /* No answers to display yet */
error_string = register_tap_listener(