The previous function enumerated the whole directory and used a lot of
outdated API to decide how to show files.
The new code queries the filesystem model to decide about this.
The now unused old functions were removed.
Replace the list model code with the file system model and use all the
file system model API niceties we get from that.
Also adds the function _gtk_file_system_model_add_and_query_file() which
g_file_query_info()'s the file before adding it, so it gets added with
the right information.
The new model is mostly API-compatible with the old model (minimal
changes were required), but is a lot faster and has a lot of very
desirable features.
- the model does no longer support a tree, just a list of files in a
given directory
- the storage has been moved to a GArray as opposed to a tree
- no more dependency on GtkFileSystem
- columns are managed by the creator of the model, so any number of
nodes can be added as needed. This also makes the API more similar
to GtkListStore.
- Values are filled on demand using a function given when creating the
model.
- The function can decide to let the model cache returned values or
decide to be called again the next time the value is queried.
- implements GtkTreeSortable
- _gtk_file_system_model_get_value() was added to significantly speed
up value access, which is necessary when sorting large models.
2008-06-30 Cody Russell <bratsche@gnome.org>
* Practically everything changed.
Change all references of GIMP Toolkit (and variations of it)
to GTK+ Toolkit, showing no mercy at all to our beloved
ancestry. (#540529)
svn path=/trunk/; revision=20709
2008-06-23 Michael Natterer <mitch@imendio.com>
* gtk/gtkaction.h
* gtk/gtkbuildable.h
* gtk/gtkbuilderprivate.h
* gtk/gtkcelllayout.h
* gtk/gtkentrycompletion.h
* gtk/gtkfilechoosersettings.h
* gtk/gtkfilesystem.h
* gtk/gtkfilesystemmodel.h
* gtk/gtkicontheme.h
* gtk/gtklinkbutton.h
* gtk/gtkpagesetup.h
* gtk/gtkpapersize.h
* gtk/gtkprintcontext.h
* gtk/gtkprintoperation.h
* gtk/gtkprintoperationpreview.h
* gtk/gtkprintsettings.h
* gtk/gtkrecentchooserprivate.h
* gtk/gtkrecentmanager.h
* gtk/gtksearchengine.h
* gtk/gtktexttag.h
* gtk/gtktreeselection.h
* gtk/gtktreeviewcolumn.h
* gtk/gtkuimanager.h: remove redundant inclusion of <glib.h> and
<glib-object.h>. There is no point in relying on them being pulled
in by other headers in some places and placing them explicitly in
other places, so choose the "as little includes as possible"
approach and get rid of them.
svn path=/trunk/; revision=20675
2008-06-10 Carlos Garnacho <carlos@imendio.com>
Bug 520874 - Should use gio directly.
* gtk/gtkfilesystem.[ch]: Turn into a private object, which mostly
provides helper functions for asynchronous calls, folder abstraction
and uniform handling of volumes/drives/mounts.
* gtk/gtkfilesystemwin32.[ch]:
* gtk/gtkfilesystemunix.[ch]: Removed, these are no longer required.
* gtk/gtkfilechooser.c:
* gtk/gtkfilechooserbutton.c:
* gtk/gtkfilechooserdefault.c:
* gtk/gtkfilechooserentry.[ch]:
* gtk/gtkfilechooserprivate.h:
* gtk/gtkfilechooserutils.c:
* gtk/gtkfilesystemmodel.[ch]:
* gtk/gtkpathbar.[ch]: Use GIO internally. Adapt to GtkFileSystem API.
Do not load filesystem implementation modules.
* gtk/Makefile.am:
* gtk/gtk.symbols: the gtkfilesystem.h private header isn't installed
anymore, nor the unix/win32 implementations.
* README.in: Add blurb about these changes.
svn path=/trunk/; revision=20342
2004-07-08 Federico Mena Quintero <federico@ximian.com>
Fix#139290:
* gtk/gtkfilesystemmodel.c (_gtk_file_system_model_new): Add a
GError argument. Do check for errors when getting the
GtkFileFolder: get the folder and read the children before
actually creating the model. Removed obsolete code that handled
roots-changed on the file system.
(file_model_node_get_info): Assert that we don't reach the old
case to display file system roots.
(roots_changed_callback): Removed.
* gtk/gtkfilechooserdefault.c (set_list_model): Add a GError
argument, and a boolean return value. Return an error if we
cannot create the file system model. On error, set a NULL model
on the tree.
(gtk_file_chooser_default_set_current_folder): Use the error value
from set_list_model().
(gtk_file_chooser_default_set_property): Set the show_hidden
property only if the browse_files_model exists.
(gtk_file_chooser_default_unselect_path): Only operate if the
browse_files_model exists.
(check_preview_change): Check whether we have the sort_model.
(change_folder_and_display_error): Copy the path we get passed
before using it. There's a comment in there that explains why we
need to copy it; basically, if the passed path belongs to the
model, the model may go away in the middle of this function and
we'll be left with a dangling pointer.
(install_list_model_filter): Assert that the model is not NULL.
(set_current_filter): Check whether the model exists.
* gtk/gtktreeselection.c (gtk_tree_selection_get_selected): Don't
g_return_if_fail if the model is NULL.
(gtk_tree_selection_get_selected_rows): Likewise.
(gtk_tree_selection_count_selected_rows): Likewise.
(gtk_tree_selection_selected_foreach): Likewise.
(gtk_tree_selection_path_is_selected): Likewise; rather just
return FALSE.
(gtk_tree_selection_select_all): Likewise.
(gtk_tree_selection_unselect_all): Likewise.
(gtk_tree_selection_select_range): Do g_return_if_fail() if the
model is NULL.
(gtk_tree_selection_unselect_range): Likewise.
* gtk/gtkfilesystemunix.c (fill_in_names): Return immediately if
g_dir_open() fails: there is no need to set the error ourselves,
as g_dir_open() already does it.
2004-01-16 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilesystemmodel.c (struct _GtkFileSystemModel): Added a
has_editable field.
(_gtk_file_system_model_add_editable): New function.
(_gtk_file_system_model_remove_editable): New function.
(gtk_file_system_model_get_value): Return appropriate values for
the temporary editable row.
(_gtk_file_system_model_get_info): Handle the editable row.
(_gtk_file_system_model_get_path): Likewise.
* gtk/gtkfilechooserdefault.c (shortcuts_append_bookmarks):
Removed an unused variable.
(toolbar_button_new): Optionally show the button.
(up_button_clicked_cb): Renamed from up_button_cb(), fixed prototype.
(toolbar_create): Add a "New Folder" button for Save mode.
(error_building_filename_dialog): New helper function.
(gtk_file_chooser_default_get_paths): Use error_building_filename_dialog().
(create_file_list): Connect to the "edited" signal of the text
cell renderer. Store the name column and text renderer in the
impl structure.
(renderer_edited_cb): New callback.
(gtk_file_chooser_default_set_property): Show/hide the "New
folder" button when the save action changes.
(COMPARE_DIRECTORIES): Allow the info values to be NULL.
(COMPARE_DIRECTORIES): Duh, use the list_model, not the
tree_model.
(get_list_file_info): Likewise!
(list_icon_data_func): Handle the path being NULL.
(new_folder_button_clicked): New callback.
(list_name_data_func): If we are on the editable row, set the text
to "Type name of new folder".
(list_selection_changed): Handle the editable row.
(list_mtime_data_func): Likewise.
* gtk/gtkfilesystemunix.c (gtk_file_system_unix_make_path): Return
NULL, not FALSE.
(gtk_file_system_unix_create_folder): Test the result of mkdir() correctly.
Wed Jul 23 11:23:43 2003 Owen Taylor <otaylor@redhat.com>
* gtkfilefilter.[ch]: File filter objects.
* gtkfilechooser.[ch] gtkfilechooserutils.[ch]: Add
file filtering to API.
* gtkfilechooserimpldefault.c: Implement file filters.
* testfilechooser.c: Try out the filter functionality.
* gtkfilesystemmodel.c: Add
_gtk_file_system_model_set_filter() to set a callback
function for filtering.
* gtkfilechooserutils.c: Propagate property notification
to the receiver.
* fnmatch.c: Copy this from GTK+ temporarily to get
UTF-8 pattern matching functionality.
Wed Jul 16 16:50:31 2003 Owen Taylor <otaylor@redhat.com>
* configure.ac Makefile.am: auto-ize.
* xdgmime/: Add freedesktop.org MIME spec implementatin
by Jonathan Blandford.
* gtkfilesystem.[ch]: Add gtk_file_info_render_icon()
gtk_file_info_set/get_icon_type to do icon handling
based on MIME type. Add a simple icon caching system.
* gtkfilesystemgnomevfs.c: Implement ensure_types()
so that extending the set of types for a loaded
directory works. Set the MIME type to get the default
icon handling.
* gtkfilesystemunix.c: Look up the MIME type using
xdgmime.
* gtkfilechooserimpldefault.c: Display icons in the list.
Fri Apr 4 17:30:27 2003 Owen Taylor <otaylor@redhat.com>
* gtkfilechooserprivate.h gtkfilechooser.h: Move
interface definition into a private header so it
can refer to GtkFileSystem.
* *.[ch]: Switch over from using gchar *uri internally
to using GtkFilePath * internally, and add
conversion routines to GtkFileSystem.
* TODO README: Updates.