41 #include "tree-view-utils.h" 44 GtkTreeViewColumn *column,
45 const gchar *sizing_text)
48 int default_width, title_width;
49 const gchar *column_title;
52 column_title = gtk_tree_view_column_get_title (column);
53 layout = gtk_widget_create_pango_layout (GTK_WIDGET(view), column_title);
54 pango_layout_get_pixel_size(layout, &title_width, NULL);
55 g_object_unref(layout);
56 layout = gtk_widget_create_pango_layout (GTK_WIDGET(view), sizing_text);
57 pango_layout_get_pixel_size(layout, &default_width, NULL);
58 g_object_unref(layout);
59 default_width = MAX(default_width, title_width);
63 g_object_set(G_OBJECT(column),
64 "sizing", GTK_TREE_VIEW_COLUMN_FIXED,
65 "fixed-width", default_width,
void tree_view_column_set_default_width(GtkTreeView *view, GtkTreeViewColumn *column, const gchar *sizing_text)
Set default width for a treeview column.