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
zzzoldfeatures/remove-group2
Andreas Köhler 20 years ago
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));
}
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
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);
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);
if (!f_model)
f_model = gtk_tree_view_get_model(view);
model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
if (model != account_types_tree_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. */
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,
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
of the tree selection. If your view allows the selection of
multiple account types, use must use this function to get the

Loading…
Cancel
Save