mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
f_model is not always set in gnc_tree_model_account_types_get_selection
because of a bug in gtk+ (#357791). Also add gnc_tree_model_account_types_get_mask. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@14896 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
e18efa1191
commit
9718dda4df
@ -200,6 +200,14 @@ gnc_tree_model_account_types_set_mask (GtkTreeModel *f_model,
|
|||||||
gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (f_model));
|
gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (f_model));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
guint32
|
||||||
|
gnc_tree_model_account_types_get_mask (GtkTreeModel *f_model)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (f_model, 0);
|
||||||
|
|
||||||
|
return GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (f_model), TYPE_MASK));
|
||||||
|
}
|
||||||
|
|
||||||
guint32
|
guint32
|
||||||
gnc_tree_model_account_types_get_selected (GncTreeModelAccountTypes * model)
|
gnc_tree_model_account_types_get_selected (GncTreeModelAccountTypes * model)
|
||||||
{
|
{
|
||||||
@ -236,7 +244,12 @@ gnc_tree_model_account_types_get_selection (GtkTreeSelection *sel)
|
|||||||
view = gtk_tree_selection_get_tree_view(sel);
|
view = gtk_tree_selection_get_tree_view(sel);
|
||||||
g_return_val_if_fail (view, 0);
|
g_return_val_if_fail (view, 0);
|
||||||
|
|
||||||
|
/* circumvent a bug in gtk+ not always filling f_model */
|
||||||
|
f_model = NULL;
|
||||||
list = gtk_tree_selection_get_selected_rows(sel, &f_model);
|
list = gtk_tree_selection_get_selected_rows(sel, &f_model);
|
||||||
|
if (!f_model)
|
||||||
|
f_model = gtk_tree_view_get_model(view);
|
||||||
|
|
||||||
model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
|
model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
|
||||||
if (model != account_types_tree_model)
|
if (model != account_types_tree_model)
|
||||||
PERR("TreeSelection's TreeModel is not the account-types Model");
|
PERR("TreeSelection's TreeModel is not the account-types Model");
|
||||||
|
@ -113,10 +113,13 @@ GtkTreeModel * gnc_tree_model_account_types_valid (void);
|
|||||||
Caller is responsible for ref/unref. */
|
Caller is responsible for ref/unref. */
|
||||||
GtkTreeModel * gnc_tree_model_account_types_filter_using_mask (guint32 types);
|
GtkTreeModel * gnc_tree_model_account_types_filter_using_mask (guint32 types);
|
||||||
|
|
||||||
/* Update the set of the visibible account types in 'model' to 'types'. */
|
/* Update the set of the visibible account types in 'f_model' to 'types'. */
|
||||||
void gnc_tree_model_account_types_set_mask (GtkTreeModel *f_model,
|
void gnc_tree_model_account_types_set_mask (GtkTreeModel *f_model,
|
||||||
guint32 types);
|
guint32 types);
|
||||||
|
|
||||||
|
/* Return the current set of the visibible account types. */
|
||||||
|
guint32 gnc_tree_model_account_types_get_mask (GtkTreeModel *f_model);
|
||||||
|
|
||||||
/* Return the bitmask of the account type enums reflecting the state
|
/* Return the bitmask of the account type enums reflecting the state
|
||||||
of the tree selection. If your view allows the selection of
|
of the tree selection. If your view allows the selection of
|
||||||
multiple account types, use must use this function to get the
|
multiple account types, use must use this function to get the
|
||||||
|
Loading…
Reference in New Issue
Block a user