Add function to GncQueryView to expand column

Add function gnc_query_set_expand_column to GncQueryView so that the
expand column can be specified that takes up any available free space.

Use this function in the Due Bills/Invoice Reminder to to set the
expanding column to the company name.
This commit is contained in:
Robert Fewell 2025-01-24 12:27:44 +00:00
parent 8795233afb
commit 55465e88ed
5 changed files with 34 additions and 0 deletions

View File

@ -352,6 +352,7 @@ gnc_dialog_query_view_create (GtkWindow *parent, GList *param_list, Query *q,
const char *title, const char *label,
gboolean abs, gboolean inv_sort,
gint sort_column, GtkSortType order,
gint expand_column,
GNCDisplayViewButton *buttons,
const gchar *pref_group, gpointer user_data)
{
@ -380,6 +381,9 @@ gnc_dialog_query_view_create (GtkWindow *parent, GList *param_list, Query *q,
/* Set the sort order */
gnc_query_sort_order (GNC_QUERY_VIEW (dqv->qview), sort_column, order);
/* Set the column that expands, columns start from 0 */
gnc_query_set_expand_column (GNC_QUERY_VIEW (dqv->qview), expand_column);
/* Unselect all rows */
gnc_query_view_unselect_all (GNC_QUERY_VIEW (dqv->qview));

View File

@ -57,6 +57,7 @@ gnc_dialog_query_view_create (GtkWindow *parent, GList *param_list, Query *q,
const char *title, const char *label,
gboolean abs, gboolean inv_sort,
gint sort_column, GtkSortType order,
gint expand_column,
GNCDisplayViewButton *buttons,
const gchar *pref_group, gpointer user_data);

View File

@ -775,6 +775,32 @@ gnc_query_view_set_query_sort (GNCQueryView *qview, gboolean new_column)
gnc_query_view_refresh (qview);
}
/********************************************************************\
* gnc_query_set_expand_column *
* sets the column that expands to take up free space starting *
* from 0 *
* *
* Args: qview - view to change the sort order for *
* column - the tree view column to set to expand *
* Returns: nothing *
\********************************************************************/
void
gnc_query_set_expand_column (GNCQueryView *qview, gint column)
{
g_return_if_fail (qview != NULL);
g_return_if_fail (GNC_IS_QUERY_VIEW(qview));
GtkTreeView *view = GTK_TREE_VIEW(qview);
gint num_columns = gtk_tree_view_get_n_columns (view);
if (column >= 0 && column < num_columns)
{
GtkTreeViewColumn *tree_column = gtk_tree_view_get_column (view, column);
gtk_tree_view_column_set_expand (tree_column, TRUE);
}
}
/********************************************************************\
* gnc_query_view_fill *
* Add all items to the list store *

View File

@ -119,6 +119,8 @@ gboolean gnc_query_view_item_in_view (GNCQueryView *qview, gpointer item);
void gnc_query_sort_order (GNCQueryView *qview, gint column, GtkSortType order);
void gnc_query_set_expand_column (GNCQueryView *qview, gint column);
void gnc_query_scroll_to_selection (GNCQueryView *qview);
void gnc_query_force_scroll_to_selection (GNCQueryView *qview);

View File

@ -3923,6 +3923,7 @@ gnc_invoice_show_docs_due (GtkWindow *parent, QofBook *book, double days_in_adva
message,
TRUE, FALSE,
1, GTK_SORT_ASCENDING,
1, // columns start from 0
duetype == DUE_FOR_VENDOR ?
vendorbuttons :
customerbuttons,