gtk-demo: Cosmetic fixes for the words demo

Set a window size, and don't put newlines in titles, left align and
ellipsize the label.
This commit is contained in:
Matthias Clasen 2020-06-30 07:51:59 -04:00 committed by Benjamin Otte
parent ac524bb13a
commit 7c4ad1a5c4

View File

@ -16,6 +16,8 @@ const char *factory_text =
" <template class='GtkListItem'>\n"
" <property name='child'>\n"
" <object class='GtkLabel'>\n"
" <property name='ellipsize'>end</property>\n"
" <property name='xalign'>0</property>\n"
" <binding name='label'>\n"
" <lookup name='string' type='GtkStringObject'>\n"
" <lookup name='item'>GtkListItem</lookup>\n"
@ -40,7 +42,7 @@ update_title_cb (GtkFilterListModel *model)
(total - pending) * 100 / total);
}
else
title = g_strdup_printf ("%u Words\n", g_list_model_get_n_items (G_LIST_MODEL (model)));
title = g_strdup_printf ("%u Words", g_list_model_get_n_items (G_LIST_MODEL (model)));
gtk_window_set_title (GTK_WINDOW (window), title);
g_free (title);
}
@ -182,7 +184,8 @@ do_listview_words (GtkWidget *do_widget)
gtk_filter_list_model_set_incremental (filter_model, TRUE);
window = gtk_window_new ();
gtk_window_set_title (GTK_WINDOW (window), "Words");
gtk_window_set_default_size (GTK_WINDOW (window), 400, 600);
header = gtk_header_bar_new ();
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), TRUE);
open_button = gtk_file_chooser_button_new ("_Open", GTK_FILE_CHOOSER_ACTION_OPEN);