Commit Graph

28550 Commits

Author SHA1 Message Date
Kristian Rietveld
52de413d43 treemodelfilter: guard for building already existing levels 2011-08-22 21:30:32 +02:00
Kristian Rietveld
dc15124c6f treemodelfilter: Introduce notion of external ref count
We need to distinguish between the ref count objects have on us versus
the ref count we have on our child model.  To keep track of the former,
we introduce the "external ref count" in this commit.  The zero_ref_count
needs to be determined from the external ref count, because objects that
have a ref count on us have say in which levels must be cached and which
can be released.

Before the caching in GtkTreeModelFilter was essentially broken and
levels were never released.  This was caused because the zero_ref_count
was connected to the ref count the filter model had on its child model.
Now that this depends on the external ref count, this is working fine and
as to be expected.
2011-08-22 21:30:32 +02:00
Kristian Rietveld
058a9090c2 treemodelfilter: Move more missions of row-deleted down
The row-deleted signal should be emitted after the internal data
structures have been updated.  In gtk_tree_model_filter_remove_elt_from_level
and gtk_tree_model_filter_virtual_root_deleted the signal was still being
emitted before the updates were carried out.
2011-08-22 21:30:32 +02:00
Kristian Rietveld
cac5d60633 Unit test reference counting in GtkTreeModelSort 2011-08-22 21:30:31 +02:00
Kristian Rietveld
dec7a34047 Avoid unreferencing deleted nodes
Now that we call unref_node in free_level, we have to take care that
free_level may only unref (parent) nodes when these still exist in the
child model.  After row-deleted has been received for a node, its
children may no longer unref this node.
2011-08-22 21:30:31 +02:00
Kristian Rietveld
7677e2d4e3 Bug 611922 - gtk_tree_model_sort_ref_node() is too slow
Referencing a parent node for each referenced node is overdone.  Instead,
we now reference the parent from build_level and unreference in free_level.
Each level keeps a single reference on its immediate parent.  This both
alleviates the performence problems and should perfectly serve the purpose.
2011-08-22 21:30:31 +02:00
Kristian Rietveld
d241323b08 Move asserts to gtktreemodelrefcount.h for other unit tests to use 2011-08-22 21:30:31 +02:00
Kristian Rietveld
bda09159c3 Add generic GtkTreeModel reference counting unit tests 2011-08-22 21:30:31 +02:00
Kristian Rietveld
1cb14a16b7 Add GtkTreeModelRefCount, only to be used in unit tests 2011-08-22 21:30:31 +02:00
Kristian Rietveld
b8752210ba treemodelsort: Remove unnecessary comment
(I am no longer 17 years old and have grown up by now).
2011-08-22 21:30:31 +02:00
Kristian Rietveld
a485334c37 Add some comments to gtk_tree_model_filter_remove_elt_from_level 2011-08-22 21:30:31 +02:00
Kristian Rietveld
e89782742d Fix a couple of memleaks in the filter model tests
(Not all of them yet, need to do the remainder on Linux since valgrind
on Mac OS X is a bit too noisy).
2011-08-22 21:30:31 +02:00
Kristian Rietveld
76cfd8bfac Bug 621076 - GtkTreeModelFilter does not emit all signals in some ...
The bulk of the fix is to walk the chain of ancestors, starting at the
root level, and check if the visibility of any of the ancestors has
changed.  If yes, the necessary signals are emitted so that this change
is propagated properly.  This walk is done after a node has been
inserted, changed or deleted, see function
gtk_tree_model_filter_check_ancestors().

Bug reported, and initial debugging and analysis, by Xavier Claessens.
2011-08-22 21:30:31 +02:00
Kristian Rietveld
c8783d3339 Decrease code duplication in _remove_elt_from_level take two 2011-08-22 21:30:31 +02:00
Kristian Rietveld
df754517dd Decrease amount of code duplication in _remove_elt_from_level 2011-08-22 21:30:31 +02:00
Kristian Rietveld
a9fd6b7f85 Rename gtk_tree_model_filter_remove_node for internal consistency 2011-08-22 21:30:31 +02:00
Kristian Rietveld
7a82045ca8 Change signature of gtk_tree_model_filter_remove_node 2011-08-22 21:30:31 +02:00
Xavier Claessens
22adfc67e5 Add thorough unit test for bug #621076
Minor edits and additions by Kristian Rietveld.
2011-08-22 21:30:30 +02:00
Kristian Rietveld
a172697d47 Corrections to has-child filter tests 2011-08-22 21:30:30 +02:00
Kristian Rietveld
74764f28bc Improve specific_has_child_filter() test to also verify signals 2011-08-22 21:30:30 +02:00
Kristian Rietveld
ebb12d5f06 Improve specific_root_has_child_filter test to also verify signals 2011-08-22 21:30:30 +02:00
Kristian Rietveld
5bd3c52c0f Have a separate category for tests of gtk_tree_model_filter_row_deleted 2011-08-22 21:30:30 +02:00
Kristian Rietveld
3452b0493d Add two unit tests for gtk_tree_model_filter_row_inserted 2011-08-22 21:30:30 +02:00
Kristian Rietveld
4f33f10511 Use g_assert_cmpint instead of g_assert in check_level_length() 2011-08-22 21:30:30 +02:00
Kristian Rietveld
7b3c2751ee Refactor emitting row-inserted for new nodes to a common code path
Suggested by Xavier Claessens / bug 621076.
2011-08-22 21:30:30 +02:00
Kristian Rietveld
bcb00d9a43 Fix comment 2011-08-22 21:30:30 +02:00
Kristian Rietveld
f064d07bda Factor out find_elt_with_offset
Suggested by Xavier Claessens / bug 621076.
2011-08-22 21:30:30 +02:00
Kristian Rietveld
60f3f92e95 Refactor to a common code path for inserts of nodes in levels
Suggested by Xavier Claessens / bug 621076.

(Additional obseration: this should speed up the filter model's
handling of row-inserted as a binary search is now used instead
of a linear scan).
2011-08-22 21:30:30 +02:00
Xavier Claessens
dc12c373dc Improve error messages of signal monitor 2011-08-22 21:30:30 +02:00
Kristian Rietveld
e0f12ce020 Factor out another part of gtk_tree_model_filter_row_deleted 2011-08-22 21:30:30 +02:00
Kristian Rietveld
1686e515d6 Three more TreeModelFilter remove ancestor tests 2011-08-22 21:30:30 +02:00
Kristian Rietveld
df0fcfb940 In sort model also emit row-deleted after updating the data structures 2011-08-22 21:30:30 +02:00
Kristian Rietveld
e9c960929b Correct GtkTreeModelFilter to never unref an already deleted child node 2011-08-22 21:30:30 +02:00
Kristian Rietveld
b27a6568b7 Improve filter model remove node unit tests 2011-08-22 21:30:29 +02:00
Kristian Rietveld
f0da89fa20 Print failed assertions for failed child iterator conversions 2011-08-22 21:30:29 +02:00
Kristian Rietveld
2f5fbcd10a Make _get_iter invalidate iterators when FALSE is returned 2011-08-22 21:30:29 +02:00
Kristian Rietveld
431987a2fa Add more unit tests for gtk_tree_model_filter_row_deleted() 2011-08-22 21:30:29 +02:00
Kristian Rietveld
56f83ad197 Further reduce variable shadowing by factoring code out into functions 2011-08-22 21:30:29 +02:00
Kristian Rietveld
cb8c608e49 Add unit test for bug 77977 for reference 2011-08-22 21:30:29 +02:00
Kristian Rietveld
ed603fa790 Add bug base and bug numbers to tree model unit tests 2011-08-22 21:30:29 +02:00
Kristian Rietveld
f1d791355a Move TreeModelSort specific tests to a new sortmodel.c file 2011-08-22 21:30:29 +02:00
Kristian Rietveld
b227aa06eb Make naming of tree model unit tests consistent
All test paths now start with the name of the class which is being
tested.
2011-08-22 21:30:29 +02:00
Kristian Rietveld
2cb9f03a66 Put all GtkTreeModel unit tests in a single binary
This to reduce linking time and have all tests in a single binary.
2011-08-22 21:30:29 +02:00
Cosimo Cecchi
a14cecb0ad widget-factory: add the primary-toolbar hint to the toolbar 2011-08-22 11:40:41 -04:00
Chun-wei Fan
0f458f1e35 Update config.h.win32.in
-Only define HAVE_STRINGS_H when MSVC is not used
-Define HVE_STDINT_H for Visual C++ 2010 and later, as Visual C++ 2010
 does ship with a "proper" stdint.h by default
-Add check macros HAVE_RINT and HAVE_ROUND--they are only defined when
 MSVC is not used
-Remove obsolete check macros
2011-08-20 11:18:23 +08:00
Chun-wei Fan
323d24db8c Update configure.ac to check for rint()/round()
Added check in configure.ac to check for the rint() and
round() functions as they are normally only available in C99
compilers.
2011-08-20 11:17:45 +08:00
Chun-wei Fan
ad73ed298d Include C89 fallback code
gtk/gtkborderimage.c, gtk/gtklabel.c and gtk/gtkstyleproperty.c call
round() and/or rint(), which was only available in C99 compilers.

This adds the inclusion of the fallback implementation (gtk/fallback-c89.c)
to define these functions if they are not initially made available by the
compiler.

Also remove the rint() implementation in gtk/gtklabel.c as it is now in
the fallback implmentation.
2011-08-20 11:17:44 +08:00
Chun-wei Fan
db3fecc5b9 Add fallback implemetation for rint()/round()
Add an implementation for rint() and round() for compilers that do not
define one or both of them.  Note that this file should be included
after config.h was included.
2011-08-20 11:17:43 +08:00
Arash Mousavi
054a625497 Updated Persian translation 2011-08-20 00:59:30 +04:30
David Zeuthen
c68eeaa966 Bug 656851 – Allow use of GVariant in GtkListStore
Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-08-18 17:49:40 -04:00