packet_list_get_widest_column_string() can return NULL, so check for this.

Use get_default_col_size() to get pixel size for string.

svn path=/trunk/; revision=31062
This commit is contained in:
Stig Bjørlykke 2009-11-24 00:16:26 +00:00
parent 3c4f5186fa
commit f7425e276d
1 changed files with 3 additions and 6 deletions

View File

@ -316,20 +316,17 @@ new_packet_list_recreate_visible_rows(void)
void new_packet_list_resize_column(gint col)
{
PangoLayout *layout;
GtkTreeViewColumn *column;
gint col_width;
const gchar *long_str;
long_str = packet_list_get_widest_column_string(packetlist, col);
if(strcmp("",long_str)==0)
/* If we get an empty string levae the width unchanged */
if(!long_str || strcmp("",long_str)==0)
/* If we get an empty string leave the width unchanged */
return;
column = gtk_tree_view_get_column (GTK_TREE_VIEW(packetlist->view), col);
layout = gtk_widget_create_pango_layout(packetlist->view, long_str );
pango_layout_get_pixel_size(layout, &col_width, NULL);
col_width = get_default_col_size (packetlist->view, long_str);
gtk_tree_view_column_set_fixed_width(column, col_width);
g_object_unref(G_OBJECT(layout));
}
static void