summaryrefslogtreecommitdiff
path: root/gtk/gtkfilesystemmodel.c
Commit message (Collapse)AuthorAgeFilesLines
* all: Add names to timeoutsBastien Nocera2013-10-231-0/+1
| | | | | | | Add names to every timeout we setup, so it's easier to track their usage, and debug possible misbehaviour. https://bugzilla.gnome.org/show_bug.cgi?id=710651
* bgo#687196 - Fix model corruption during file removalbgo687196-filesystemmodel-crashFederico Mena Quintero2012-11-021-3/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | The main problem is that we were emitting the row-deleted signal for the model in the middle of the process that actually deletes the row from the model (remove the row from the array, update the model->file_lookup hash table, etc.). In the model's caller, one of the row-deleted callbacks was requesting an iter, which caused the model to revalidate itself - but it did this while it was in an inconsistent state. This led to an assertion failure later when the model resorted itself. The fix in remove_file() is like this: * The filteredness/visibility of the deleted node is not updated. The node will simply be gone; we don't need to update those values at all. * We invalidate just the node that is being deleted. * The model->file_lookup hash table is not completely nuked; instead, we carefully adjust its indices. * The row-deleted signal is only emitted at the very end, when deletion is complete and the model is consistent. Many thanks to William Hua for doing the detective work on this bug! Signed-off-by: Federico Mena Quintero <federico@gnome.org>
* Make freeze_updates() and thaw_updates() static functionsFederico Mena Quintero2012-11-011-18/+19
| | | | | | They were in the semi-public API of GtkFileSystemModel, but never actually used outside of it. Signed-off-by: Federico Mena Quintero <federico@gnome.org>
* Comments on how the filtering and sorting processes workFederico Mena Quintero2012-11-011-1/+21
| | | | Signed-off-by: Federico Mena Quintero <federico@gnome.org>
* Remove argument to _gtk_file_system_model_update_file() that should not be ↵Federico Mena Quintero2012-10-311-7/+11
| | | | | | part of the internal API Signed-off-by: Federico Mena Quintero <federico@gnome.org>
* Rename gtk_tree_path_new_from_node() to tree_path_new_from_node()Federico Mena Quintero2012-10-311-7/+7
| | | | | | | | | This is a function internal to the file system model; let's not pollute the gtk_tree_path namespace. Also, make the 'i' variable into 'r' as it refers to a row index, not a file-array index (for consistency with the docs and the rest of the code). Signed-off-by: Federico Mena Quintero <federico@gnome.org>
* Emit row-changed notificationMatthias Clasen2012-07-151-1/+6
| | | | | Emit row-changed when the filteredness of a visible row changes in GtkFileSystemModel.
* Make computing and setting the visibility/filters atomic operationsFederico Mena Quintero2012-07-151-27/+26
| | | | | | | | This way we remove paired function calls (compute/set pairs), and also make it possible to avoid computing a filter twice, as setting the visibility depends on filteredness. Signed-off-by: Federico Mena Quintero <federico@gnome.org>
* Make it clear that 'filtered' means 'filtered_out'Federico Mena Quintero2012-07-151-22/+23
| | | | | | | | | It bothers me that we call gtk_file_filter_filter(), then negate the result, and the return *that* from node_should_be_filtered(). So, rename 'filtered' throughout GtkFileSystemModel to 'filtered_out' to mean things that didn't pass the filter. Signed-off-by: Federico Mena Quintero <federico@gnome.org>
* Remove superfluous check in node_set_filtered()Federico Mena Quintero2012-07-151-4/+0
| | | | | | | | This was a copy-paste leftover from node_set_visible(). Filters are not concerned with model freezes, so node_set_filtered() does not need to handle freezes, either. Signed-off-by: Federico Mena Quintero <federico@gnome.org>
* Desensitize filtered folders when in folder selection modeWilliam Jon McCann2012-07-151-24/+85
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=679333
* Change FSF AddressJavier Jardón2012-02-271-3/+1
|
* filesystemmodel: Add a toggle for whether directories are filteredBenjamin Otte2011-12-161-10/+41
|
* filesystemmodel: Add a missing checkBenjamin Otte2011-10-031-0/+3
| | | | | Paths with depth > 1 should return FALSE instead of pretending the depth is 1.
* Ensure we always grab the gdk lock in async callbacksAlexander Larsson2011-03-281-0/+4
| | | | | | Async callbacks are delivered in idles, so we need to make sure we get the gdk lock before calling any gdk/gtk stuff. This was missing in a few places.
* bgo#614006 - GtkFileSystemModel - Make sure to generate node IDs are valid ↵Sergey Orlov2010-08-241-1/+4
| | | | | | | | | for new files When a file was inserted during the period that the editable row was active, the node IDs would not get updated correctly. Signed-off-by: Federico Mena Quintero <federico@novell.com>
* gtk/: fully remove gtkalias hacksJavier Jardón2010-07-101-1/+0
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=623845
* Revert "Add length to gtk_tree_path_get_indices"Colin Walters2010-06-281-1/+1
| | | | | | This reverts commit eebb16eb1af11c5327dd06b23df82f7528566739. Was an accidental commit.
* Add length to gtk_tree_path_get_indicesColin Walters2010-06-281-1/+1
| | | | | | The old version wasn't introspectable as it didn't have a length return parameter. Also, delete gtk_tree_path_get_indices_with_depth, since it's no longer needed.
* Can't select file on file browser after changing sort orderBenjamin Otte2010-06-281-1/+1
| | | | | | | The row values are 1-indexed not 0-indexed, this has to be taken into account when producing the new_order array. https://bugzilla.gnome.org/show_bug.cgi?id=621414
* filechooser: Fix a crash when removing filesBenjamin Otte2010-05-021-0/+1
| | | | | | | | | | | The file removal code was not properly clearing the file=>array index cache, so later lookups into that cache would return invalid array indexes. The easiest way to reproduce it is to create a directory with two files and deleting both of them. Reported-by: Javier Jardón <jjardon@gnome.org>
* Fix error case in filesystem modelBenjamin Otte2010-03-291-3/+5
| | | | | | | | | | We should not unref the model here, it might not even exist anymore. Instead check if it exists and only use it if it does. The unref was leftover from a previous fix in ba9f53397ff0b86ad56166c7fc91b4d499f7aefc. Spotted by Matthias Clasen in https://bugzilla.gnome.org/show_bug.cgi?id=614099
* [annotations] Add allow-noneJohan Dahlin2010-02-191-2/+2
| | | | | | | | This commit was created using a script that searched for all docstrings containing a parameter and the string 'or %NULL'. Gdk backends and demos excluded as they are not part of a public API https://bugzilla.gnome.org/show_bug.cgi?id=610474
* Don't keep the filesystem model alive while querying filesBenjamin Otte2009-11-021-14/+14
| | | | | | | | This allows disposing of the filesystemmodel while the file enumeration is still happening. As the filechooser does not disconnect its signals because it assumes it is the only owner of the model, this also prevents a SEGV when emitting the "load-finished" signal in that case.
* Fix thinkos in which fields get usedFederico Mena Quintero2009-10-151-3/+3
| | | | Signed-off-by: Federico Mena Quintero <federico@novell.com>
* Oops, it's gsize, not GSizeFederico Mena Quintero2009-10-151-1/+1
| | | | Signed-off-by: Federico Mena Quintero <federico@novell.com>
* In set_filter(), handle the case where the new filter is the same as the old ↵Federico Mena Quintero2009-10-151-2/+7
| | | | | | filter Signed-off-by: Federico Mena Quintero <federico@novell.com>
* s/get_is_visible/iter_is_visible for clarityFederico Mena Quintero2009-10-151-4/+4
| | | | Signed-off-by: Federico Mena Quintero <federico@novell.com>
* Remove obsolete commentFederico Mena Quintero2009-10-151-2/+0
| | | | Signed-off-by: Federico Mena Quintero <federico@novell.com>
* Make the code match the docs in _gtk_file_system_model_clear_cache()Federico Mena Quintero2009-10-151-2/+2
| | | | Signed-off-by: Federico Mena Quintero <federico@novell.com>
* Free some missing fields in ::finalize()Federico Mena Quintero2009-10-151-0/+8
| | | | Signed-off-by: Federico Mena Quintero <federico@novell.com>
* Clarify variable names in gtk_file_system_model_sort()Federico Mena Quintero2009-10-151-11/+12
| | | | | | To comply with the i -> indexes; r -> rows convention. Signed-off-by: Federico Mena Quintero <federico@novell.com>
* Nothing to do for ref/unref_nodeFederico Mena Quintero2009-10-151-2/+2
| | | | Signed-off-by: Federico Mena Quintero <federico@novell.com>
* Clarify a couple of spots with commentsFederico Mena Quintero2009-10-151-2/+2
| | | | Signed-off-by: Federico Mena Quintero <federico@novell.com>
* Clarify array indexes vs. row numbersFederico Mena Quintero2009-10-151-60/+90
| | | | | | | | | There was some confusion between "index" as used for the model->files[] array, and node->index as used for our 1-based row numbers. Now we use "index" only for indices in the model->files[] array, and node->row for row numbers. Functions and variables are renamed to clarify whether they refer to indexes or rows. Signed-off-by: Federico Mena Quintero <federico@novell.com>
* Big comment on how GtkFileSystemModel worksFederico Mena Quintero2009-10-151-1/+65
| | | | | | Let's have some documentation on the idea behind this beast... Signed-off-by: Federico Mena Quintero <federico@novell.com>
* Remove obsolete code to use a cached mime-typeFederico Mena Quintero2009-10-151-16/+10
| | | | | | | The non-standard "filechooser::mime-type" was a remnant of the recent-files code using a hand-built GFileInfo; now we just query the file info ourselves. Signed-off-by: Federico Mena Quintero <federico@novell.com>
* Fix thinko in node_should_be_visible()Federico Mena Quintero2009-10-151-1/+1
| | | | Signed-off-by: Federico Mena Quintero <federico@novell.com>
* Factory out functions to emit row_inserted, row_changed, row_deletedFederico Mena Quintero2009-10-151-27/+43
| | | | | | This is to avoid temporary variables for the path/iter and to avoid duplicated code. Signed-off-by: Federico Mena Quintero <federico@novell.com>
* When updating a file, handle the case where the old file info is the same as ↵Federico Mena Quintero2009-10-151-2/+6
| | | | | | | | the new one This prevents us from inadvertently losing the last ref to the info. Signed-off-by: Federico Mena Quintero <federico@novell.com>
* When removing a file, also remove it from the file_lookup hash tableFederico Mena Quintero2009-10-151-0/+5
| | | | Signed-off-by: Federico Mena Quintero <federico@novell.com>
* Comment on how the file_lookup hash table gets rebuilt on demandFederico Mena Quintero2009-10-151-2/+15
| | | | Signed-off-by: Federico Mena Quintero <federico@novell.com>
* Clarify the arguments to g_file_query_info_async()Federico Mena Quintero2009-10-151-2/+2
| | | | Signed-off-by: Federico Mena Quintero <federico@novell.com>
* Clarify the code flow in gtk_file_system_model_got_files()Federico Mena Quintero2009-10-151-12/+11
| | | | Signed-off-by: Federico Mena Quintero <federico@novell.com>
* Remove the dir_thaw_source while disposing the modelFederico Mena Quintero2009-10-151-0/+6
| | | | | | Otherwise that timeout may trigger after the model has died. Signed-off-by: Federico Mena Quintero <federico@novell.com>
* Make _gtk_file_system_model_remove_file() staticFederico Mena Quintero2009-10-151-5/+8
| | | | | | It was only used internally by the model. Signed-off-by: Federico Mena Quintero <federico@novell.com>
* Make _gtk_file_system_model_add_file() staticFederico Mena Quintero2009-10-151-10/+14
| | | | | | It was only used internally by the model, anyway. Signed-off-by: Federico Mena Quintero <federico@novell.com>
* Clarify the comments that some fields in GtkFileSystemModel can be NULLFederico Mena Quintero2009-10-151-2/+2
| | | | Signed-off-by: Federico Mena Quintero <federico@novell.com>
* Clarify the arguments to g_file_monitor_directory()Federico Mena Quintero2009-10-151-2/+2
| | | | Signed-off-by: Federico Mena Quintero <federico@novell.com>
* Clarify an argument to g_file_enumerate_children_async()Federico Mena Quintero2009-10-151-1/+1
| | | | Signed-off-by: Federico Mena Quintero <federico@novell.com>