diff --git a/dialog.c b/dialog.c index 84869195..cbe95124 100644 --- a/dialog.c +++ b/dialog.c @@ -364,6 +364,7 @@ union control *ctrl_listbox(struct controlset *s,char *label,char shortcut, c->listbox.percentwidth = 100; c->listbox.ncols = 0; c->listbox.percentages = NULL; + c->listbox.hscroll = TRUE; return c; } diff --git a/dialog.h b/dialog.h index 9ea8599e..6f454f56 100644 --- a/dialog.h +++ b/dialog.h @@ -345,6 +345,12 @@ union control { */ int ncols; /* number of columns */ int *percentages; /* % width of each column */ + /* + * Flag which can be set to FALSE to suppress the horizontal + * scroll bar if a list box entry goes off the right-hand + * side. + */ + int hscroll; } listbox; struct { STANDARD_PREFIX; diff --git a/unix/gtkdlg.c b/unix/gtkdlg.c index 86fa310e..3776df8c 100644 --- a/unix/gtkdlg.c +++ b/unix/gtkdlg.c @@ -2276,15 +2276,22 @@ GtkWidget *layout_ctrls(struct dlgparam *dp, struct Shortcuts *scs, cols = cols ? cols : 1; for (i = 0; i < cols; i++) { GtkTreeViewColumn *column; + GtkCellRenderer *cellrend; /* * It appears that GTK 2 doesn't leave us any * particularly sensible way to honour the * "percentages" specification in the ctrl * structure. */ + cellrend = gtk_cell_renderer_text_new(); + if (!ctrl->listbox.hscroll) { + gtk_object_set(GTK_OBJECT(cellrend), + "ellipsize", PANGO_ELLIPSIZE_END, + "ellipsize-set", TRUE, + NULL); + } column = gtk_tree_view_column_new_with_attributes - ("heading", gtk_cell_renderer_text_new(), - "text", i+1, (char *)NULL); + ("heading", cellrend, "text", i+1, (char *)NULL); gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_GROW_ONLY); gtk_tree_view_append_column(GTK_TREE_VIEW(w), column);