mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-13 04:10:13 +00:00
gtk-demo: Ellipsize columns in the characters demo
some of the columns have uneven widths, causing them to bounce around as you scroll. Ellipsize them and give them a fixed with.
This commit is contained in:
parent
2bdc8c7d9e
commit
2273e27808
@ -116,6 +116,18 @@ setup_label (GtkSignalListItemFactory *factory,
|
||||
gtk_list_item_set_child (GTK_LIST_ITEM (listitem), label);
|
||||
}
|
||||
|
||||
static void
|
||||
setup_ellipsizing_label (GtkSignalListItemFactory *factory,
|
||||
GObject *listitem)
|
||||
{
|
||||
GtkWidget *label;
|
||||
label = gtk_label_new ("");
|
||||
gtk_label_set_xalign (GTK_LABEL (label), 0);
|
||||
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
|
||||
gtk_label_set_width_chars (GTK_LABEL (label), 20);
|
||||
gtk_list_item_set_child (GTK_LIST_ITEM (listitem), label);
|
||||
}
|
||||
|
||||
static void
|
||||
bind_codepoint (GtkSignalListItemFactory *factory,
|
||||
GObject *listitem)
|
||||
@ -279,21 +291,21 @@ create_ucd_view (GtkWidget *label)
|
||||
gtk_column_view_append_column (GTK_COLUMN_VIEW (cv), column);
|
||||
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (setup_label), NULL);
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (setup_ellipsizing_label), NULL);
|
||||
g_signal_connect (factory, "bind", G_CALLBACK (bind_name), NULL);
|
||||
column = gtk_column_view_column_new ("Name", factory);
|
||||
gtk_column_view_column_set_resizable (column, TRUE);
|
||||
gtk_column_view_append_column (GTK_COLUMN_VIEW (cv), column);
|
||||
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (setup_label), NULL);
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (setup_ellipsizing_label), NULL);
|
||||
g_signal_connect (factory, "bind", G_CALLBACK (bind_type), NULL);
|
||||
column = gtk_column_view_column_new ("Type", factory);
|
||||
gtk_column_view_column_set_resizable (column, TRUE);
|
||||
gtk_column_view_append_column (GTK_COLUMN_VIEW (cv), column);
|
||||
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (setup_label), NULL);
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (setup_ellipsizing_label), NULL);
|
||||
g_signal_connect (factory, "bind", G_CALLBACK (bind_break_type), NULL);
|
||||
column = gtk_column_view_column_new ("Break Type", factory);
|
||||
gtk_column_view_column_set_resizable (column, TRUE);
|
||||
|
Loading…
Reference in New Issue
Block a user