r14896 - gnucash/trunk - f_model is not always set in gnc_tree_model_account_types_get_selection

Andreas Köhler andi5 at cvs.gnucash.org
Tue Sep 26 18:08:22 EDT 2006


Author: andi5
Date: 2006-09-26 18:08:22 -0400 (Tue, 26 Sep 2006)
New Revision: 14896
Trac: http://svn.gnucash.org/trac/changeset/14896

Modified:
   gnucash/trunk/
   gnucash/trunk/src/gnome-utils/gnc-tree-model-account-types.c
   gnucash/trunk/src/gnome-utils/gnc-tree-model-account-types.h
Log:
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.




Property changes on: gnucash/trunk
___________________________________________________________________
Name: svk:merge
   - 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/trunk:641
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:13351
   + 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/trunk:642
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:13351

Modified: gnucash/trunk/src/gnome-utils/gnc-tree-model-account-types.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-tree-model-account-types.c	2006-09-26 22:08:09 UTC (rev 14895)
+++ gnucash/trunk/src/gnome-utils/gnc-tree-model-account-types.c	2006-09-26 22:08:22 UTC (rev 14896)
@@ -201,6 +201,14 @@
 }
 
 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)
 {
 	GncTreeModelAccountTypesPrivate *priv;
@@ -236,7 +244,12 @@
     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");

Modified: gnucash/trunk/src/gnome-utils/gnc-tree-model-account-types.h
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-tree-model-account-types.h	2006-09-26 22:08:09 UTC (rev 14895)
+++ gnucash/trunk/src/gnome-utils/gnc-tree-model-account-types.h	2006-09-26 22:08:22 UTC (rev 14896)
@@ -113,10 +113,13 @@
    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



More information about the gnucash-changes mailing list