Give the zoom label a minimum width

This also hides a GTK+ bug.
This commit is contained in:
Přemysl Eric Janouch 2021-12-19 07:31:10 +01:00
parent ae57c45c2a
commit 92c6ca6c35
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 5 additions and 1 deletions

View File

@ -757,10 +757,14 @@ make_view_toolbar(void)
TOOLBAR(XX)
#undef XX
// TODO(p): The scale should be at least as wide as "999%".
gtk_widget_set_margin_start(g.toolbar[TOOLBAR_SCALE], 5);
gtk_widget_set_margin_end(g.toolbar[TOOLBAR_SCALE], 5);
// So that the width doesn't jump around in the usual zoom range.
// Ideally, we'd measure the widest digit and use width(NNN%).
gtk_label_set_width_chars(GTK_LABEL(g.toolbar[TOOLBAR_SCALE]), 5);
gtk_widget_set_halign(g.toolbar[TOOLBAR_SCALE], GTK_ALIGN_CENTER);
// GtkStatusBar solves a problem we do not have here.
GtkWidget *view_toolbar = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
GtkBox *box = GTK_BOX(view_toolbar);