diff --git a/src/gnome-utils/gnc-tree-model-account-types.c b/src/gnome-utils/gnc-tree-model-account-types.c index f393c96d72..02377c7ac4 100644 --- a/src/gnome-utils/gnc-tree-model-account-types.c +++ b/src/gnome-utils/gnc-tree-model-account-types.c @@ -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"); diff --git a/src/gnome-utils/gnc-tree-model-account-types.h b/src/gnome-utils/gnc-tree-model-account-types.h index 350735d701..0994a21804 100644 --- a/src/gnome-utils/gnc-tree-model-account-types.h +++ b/src/gnome-utils/gnc-tree-model-account-types.h @@ -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