Commit Graph

151 Commits

Author SHA1 Message Date
Alberto Ruiz
496f0892fc introspection: This patch fixes nullable return values fixes for the following symbols in gtk
gtk_accel_group_query
  gtk_accel_group_from_accel_closure
  gtk_accel_label_get_accel_widget
  gtk_accessible_get_widget
  gtk_actionable_get_action_name
  gtk_app_chooser_get_app_info
  gtk_app_chooser_button_get_heading
  gtk_app_chooser_dialog_get_heading
  gtk_application_get_window_by_id
  gtk_assistant_get_nth_page
  gtk_binding_set_find
  gtk_builder_get_object
  gtk_builder_lookup_callback_symbol
  gtk_builder_get_application
  gtk_button_get_image
  gtk_cell_area_get_focus_from_sibling
  gtk_cell_renderer_start_editing
  gtk_cell_view_get_model
  gtk_cell_view_get_displayed_row
  gtk_clipboard_get_owner
  gtk_container_get_focus_child
  gtk_container_get_focus_vadjustment
  gtk_container_get_focus_hadjustment
  gtk_dialog_get_widget_for_response
  gtk_drag_get_source_widget
  gtk_drag_dest_get_target_list
  gtk_drag_source_get_target_list
  gtk_entry_completion_get_model
  gtk_entry_completion_compute_prefix
  gtk_expander_get_label_widget
  gtk_file_chooser_get_filename
  gtk_file_chooser_get_current_folder
  gtk_file_chooser_get_uri
  gtk_file_chooser_get_current_folder_uri
  gtk_file_chooser_get_preview_widget
  gtk_file_chooser_get_preview_file
  gtk_file_chooser_get_preview_filename
  gtk_file_chooser_get_preview_uri
  gtk_file_chooser_get_extra_widget
  gtk_file_chooser_get_filter
  gtk_file_chooser_native_get_accept_label
  gtk_file_chooser_native_get_cancel_label
  gtk_file_filter_get_name
  gtk_font_chooser_get_font_family
  gtk_font_chooser_get_font_face
  gtk_font_chooser_get_font
  gtk_font_chooser_get_font_desc
  gtk_font_chooser_get_font_map
  gtk_frame_get_label
  gtk_gesture_get_device
  gtk_gesture_get_window
  gtk_gl_area_get_error
  gtk_header_bar_get_title
  gtk_header_bar_get_subtitle
  gtk_header_bar_get_custom_title
  gtk_icon_info_get_filename
  gtk_icon_view_get_path_at_pos
  gtk_icon_view_get_model
  gtk_image_get_pixbuf
  gtk_image_get_animation
  gtk_label_get_mnemonic_widget
  gtk_label_get_attributes
  gtk_check_version
  gtk_menu_button_get_popup
  gtk_menu_button_get_menu_model
  gtk_menu_button_get_align_widget
  gtk_menu_button_get_popover
  gtk_menu_item_get_submenu
  gtk_menu_item_get_accel_path
  gtk_native_dialog_get_title
  gtk_native_dialog_get_transient_for
  gtk_notebook_get_nth_page
  gtk_notebook_get_tab_label_text
  gtk_notebook_get_menu_label
  gtk_notebook_get_menu_label_text
  gtk_notebook_get_group_name
  gtk_notebook_get_action_widget
  gtk_offscreen_window_get_surface
  gtk_offscreen_window_get_pixbuf
  gtk_paned_get_child1
  gtk_paned_get_child2
  gtk_places_sidebar_get_location
  gtk_places_sidebar_get_nth_bookmark
  gtk_plug_get_socket_window
  gtk_popover_get_default_widget
  gtk_progress_bar_get_text
  gtk_recent_filter_get_name
  gtk_recent_manager_lookup_item
  gtk_settings_get_default
  gtk_socket_get_plug_window
  gtk_stack_sidebar_get_stack
  gtk_stack_switcher_get_stack
  gtk_style_context_get_section
  gtk_style_context_get_parent
  gtk_style_context_get_frame_clock
  gtk_test_find_widget
  gtk_text_buffer_get_mark
  gtk_text_tag_table_lookup
  gtk_text_view_get_tabs
  gtk_text_view_toggle_cursor_visible
  gtk_text_view_get_window
  gtk_toolbar_get_nth_item
  gtk_tool_button_get_label
  gtk_tool_button_get_icon_name
  gtk_tool_button_get_label_widget
  gtk_tool_button_get_icon_widget
  gtk_tool_palette_get_drop_item
  gtk_tool_palette_get_drop_group
  gtk_tree_model_filter_convert_child_path_to_path
  gtk_tree_model_filter_convert_path_to_child_path
  gtk_tree_model_sort_convert_child_path_to_path
  gtk_tree_model_sort_convert_path_to_child_path
  gtk_tree_view_get_column
  gtk_tree_view_get_bin_window
  gtk_tree_view_column_get_widget
  gtk_tree_view_column_get_tree_view
  gtk_widget_get_frame_clock
  gtk_window_group_get_current_device_grab
  GtkTextBufferSerializeFunc
2016-01-08 12:18:23 +00:00
Alexander Larsson
1c46a02bcb TreeModelFilter: Fix uninitialized memory read.
We were copying an iterator that sometimes was not initialized,
which caused debugger warnings in VS2015.
2015-11-05 16:52:51 +01:00
Matthias Clasen
bed26edfd1 tree model filter: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:16 -04:00
Matthias Clasen
8c5eb9a0d6 GtkTreeModelFilter: Documentation improvement
Clarify in the docs that some functions can only be called
once for a given filter model.

https://bugzilla.gnome.org/show_bug.cgi?id=346886
2014-08-30 01:59:05 -04:00
Olivier Brunel
5c019bde15 treemodelfilter: Fix using wrong path on row-deleted
A "typo" led to using a wrong GtkTreePath when converting the path of the
virtual root to check the ancestors, which would lead to either no checks being
performed, or maybe segfaulting when using an invalid path as result.

https://bugzilla.gnome.org/show_bug.cgi?id=722058
Signed-off-by: Olivier Brunel <jjk@jjacky.com>
2014-03-26 20:40:50 -04:00
William Jon McCann
469d333aa2 docs: use Returns: consistently
Instead of Return value:
2014-02-19 18:56:05 -05:00
Matthias Clasen
c779b42476 Docs: use // for comments in examples
Without sgml mode, we can't escape /* as /&ast; anymore,
so just switch to // for comments in examples.
2014-02-14 23:34:22 -05:00
Matthias Clasen
7f6a964c47 Docs: Remove all entities and turn off sgml mode
With all element markup gone, it is time to turn off
sgml mode, and get rid of entities as well.
2014-02-09 17:58:07 -05:00
William Jon McCann
e34bd4137d docs: use apostrophes in *n't 2014-02-07 13:32:47 -05:00
William Jon McCann
7a208fbbf3 docs: use proper apostrophe
https://wiki.gnome.org/Design/OS/Typography
2014-02-07 13:06:10 -05:00
William Jon McCann
2a45418b67 docs: use proper quotes 2014-02-05 15:08:42 -05:00
Matthias Clasen
30cc1512e6 Docs: Use markdown for lists
This greatly reduces the amount of xml in the docs.
2014-02-02 01:07:39 -05:00
William Jon McCann
4c8bd8e7cf docs: Identify examples that are C code
https://bugzilla.gnome.org/show_bug.cgi?id=723119
2014-01-29 12:45:49 -05:00
William Jon McCann
768bc44081 docs: use |[ ]| instead of <programlisting></programlisting>
https://bugzilla.gnome.org/show_bug.cgi?id=723119
2014-01-29 12:45:49 -05:00
William Jon McCann
2d003553e8 docs: don't use <emphasis>
It is a little heavy handed. The text can speak for itself.
2014-01-28 02:02:05 -05:00
Bastien Nocera
587f993444 treemodelfilter: Fix typo in API docs 2014-01-14 15:02:59 +01:00
Emmanuele Bassi
0899ef7cc9 gtk: Use new macros for defining private data
https://bugzilla.gnome.org/show_bug.cgi?id=702996
2013-07-09 09:30:02 +01:00
Jasper St. Pierre
7ee5e7af70 treemodelfilter: Make the constructor binding friendly
This means reffing the root in the set property implementation,
rather than in the constructor. We don't need to unref the root
on set, as it's a CONSTRUCT_ONLY property.

https://bugzilla.gnome.org/show_bug.cgi?id=680065
2012-12-05 13:43:19 -05:00
Rui Matos
eaddf70a43 GtkTreeModelFilter: Fix _iter_previous() when iter points at 2nd node
GSequence iterators point at the position between two elements so an
iterator pointing at the N tree model node is actually between the N-1
and N sequence elements. This means that asking for the previous
sequence iterator first and then checking if it is the begin iterator
would yeld true for an iterator pointing at the 2nd tree model node
and make us return FALSE mistakenly.

https://bugzilla.gnome.org/show_bug.cgi?id=679910
2012-07-17 10:50:48 +02:00
Benjamin Otte
754bf5e3d8 treemodelfilter: Don't unref deleted rows
When we're fudging with child nodes of a deleted node, we don't want to
have them delete their parent - which is the deleted row.
2012-03-19 02:26:16 +01:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Javier Jardón
0853ce3077 Use G_VALUE_INIT
Instead of an explicit { 0, } when declaring the variable.
2011-10-15 16:45:16 +01:00
Kristian Rietveld
bbc1e883a8 Bug 659022 - gtk_tree_model_filter_clear_cache_helper: assertion failed
This bug is resolved by fixing two things in
gtk_tree_model_filter_row_deleted():

  (1) It is possible for an elt to have elt->visible_siter == NULL, when
  it is deleted.  Only call g_sequence_remove() if this pointer is
  non-NULL.

  (2) For the case len (level->seq) > 1, free the elt->children level
  if non-NULL.  Failing to do this means the level will stick around.
  If this child level was not referenced, it will still have a zero
  ref count on its parent which cannot be removed!

For both bugs unit tests have been added in the preceding commit.
2011-10-03 22:59:40 +02:00
Kristian Rietveld
f646ed6f76 Fix first part of bug 659022
Push creation of path into if clause, the path cannot be created anyway
(and would be meaningless otherwise) if the parent is not visible.
2011-10-03 22:59:40 +02:00
Xavier Claessens
0561c7a68d GtkTreeModelFilter: Fix build warnings
https://bugzilla.gnome.org/show_bug.cgi?id=659441
2011-09-20 09:06:54 +02:00
Kristian Rietveld
e1ede022f8 treemodelfilter: add additional asserts to MODEL_FILTER_DEBUG mode 2011-09-17 06:09:35 +02:00
Kristian Rietveld
7c0526e9b2 treemodelfilter: bring if-condition in sync
Bring the if-condition in sync with the other if-conditions in the
function where the "path" variable is used.
2011-09-11 20:19:56 +02:00
Kristian Rietveld
3db7344f33 treemodelfilter: correct forgotten unref of parent on level destroy
gtk_tree_model_filter_free_level() should always release ref on parent
unless the parent has been removed in the child model.  The unit tests
added in the previous commit test this.
2011-09-11 16:53:27 +02:00
Sébastien Granjoux
35eb92138a treemodelfilter: bgo#658696- Crash when inserting new node 2011-09-11 12:13:54 +02:00
Kristian Rietveld
a43f2ba010 gtktreemodelfilter: fix small bug in prune level
gtk_tree_model_filter_prune_level() should drop all internal reference
counts as well for nodes which are going to be removed from the
sequence.
2011-09-11 12:13:54 +02:00
Kristian Rietveld
9ed76387fa gtktreemodelfilter: fix corner case in rows-reordered handling
If the level to be reordered did not contain an elt with offset == 0
(for example if that node was hidden), the first reference was not
correctly transferred.

A unit test for this has been added in a previous commit.
2011-09-11 12:13:54 +02:00
Kristian Rietveld
022327c408 gtktreemodelfilter: child levels of the root level must remain cached
This is due to the special handling for filter functions that depend
on child level state.  If the parent level of a level is the root level,
the level cannot be removed from the cache.  Any change in this level
can cause its parent in the root level to become visible again.
2011-09-07 22:25:29 +02:00
Kristian Rietveld
ae2b2e7cfc gtktreemodelfilter: rework gtk_tree_model_filter_remove_elt_from_level
The most important change is that the function now properly releases
any external ref count and propagates these changes to the child model.
If a node is removed due to a filtering action, we now properly release
all external reference counts for its hierarchy of child nodes.

Apart from that, the function has been restructured to remove code
duplication.

Finally, there is still some doubt whether there are more calls to
gtk_tree_model_filter_free_level() which need unref_external set to TRUE.
2011-09-07 22:25:29 +02:00
Kristian Rietveld
767b2e2604 gtktreemodelfilter: add a debug define and more assertions
Should be helpful when debugging this thing.  Perhaps this needs to
be properly integrated in G_DEBUG/GTK_DEBUG, but currently I do not see
the need to.
2011-09-07 22:25:29 +02:00
Kristian Rietveld
f317dd3831 gtktreemodelfilter: make rule used for level caching consistent
There was still a discrepancy between the comments and the code about when
exactly a level was to be removed.  The rule is now set on that for a level
to be removed its zero_ref_count as well as the zero_ref_count of its
parent has to be zero.
2011-09-07 22:25:29 +02:00
Kristian Rietveld
584ff7c29a treemodelfilter: eliminate unread variable assigments
Courtesy of scan-build/clang.
2011-08-22 21:30:35 +02:00
Kristian Rietveld
089edcf765 Fix bad typo in gtk_tree_model_filter_build_level() ... 2011-08-22 21:30:34 +02:00
Kristian Rietveld
6cd134d39e gtktreemodelfilter: only maintain cache at 1 level depth instead of 2 2011-08-22 21:30:34 +02:00
Kristian Rietveld
aa9151a6ee Extend public and internal documentation about GtkTreeModelFilter 2011-08-22 21:30:34 +02:00
Xavier Claessens
bee3d5f143 Replace GArray with GSequence in GtkTreeModelFilter
Significantly improves performance when e.g. removing (filtering) a lot
of rows from the filter model.  Fixes bug 616871.

This commit includes changes by Kristian Rietveld to make the patch apply
on top of the treemodel-fix branch and pass all newly written unit tests.
2011-08-22 21:30:33 +02:00
Xavier Claessens
eb594da2f2 Revert usage of parent_elt_index back to parent_elt pointers
This was introduced in commit a59c39f370.
The revert is part of bug 616871.  Adaption to recent GtkTreeModelFilter
changes by Kristian Rietveld.
2011-08-22 21:30:33 +02:00
Kristian Rietveld
510d84f682 Do not emit rows-reordered for levels with no visible rows 2011-08-22 21:30:33 +02:00
Kristian Rietveld
3b7aed050d Correct ref transfer in GtkTreeModelFilter rows-reordered handling 2011-08-22 21:30:33 +02:00
Kristian Rietveld
88dd6372b0 treemodelfilter: rework reference counting
- Before we kept a reference on all nodes in non-root levels.  This has
   been changed, now we keep a reference on the first node of each level.
   If, due to changes in the model, another node becomes the first node in
   the level, the reference is transferred to this new first node.
 - All non-root levels keep a reference on their parent.
 - By making use of the external ref count, the filter model now emits less
   unnecessary signals.
 - GtkTreeModelFilter does support filter functions which decide visibility
   of a given node based on the number of or visibility of children.
   To accomplish this, a child level of a node is cached when its
   parent has an external ref count > 0, because changes to the node might
   affect this parent.
 - An optimization for not building the root level in case the inserted
   node is not visible in gtk_tree_model_filter_row_inserted() has been
   removed.  In this case, we still need to build the root level and
   possibly a child level to monitor for signals which might make
   this row visible.
2011-08-22 21:30:32 +02:00
Kristian Rietveld
2984e22ef0 treemodelfilter: handle another case in check_ancestors
In gtk_tree_model_filter_check_ancestors(), also handle the case when
a node is already in the cache, but invisible, in the root level.
With the upcoming changes to GtkTreeModelFilter's ref counting this
case can occur.
2011-08-22 21:30:32 +02:00
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
a485334c37 Add some comments to gtk_tree_model_filter_remove_elt_from_level 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