1 /* GTK - The GIMP Toolkit
2 * gtkfilesystem.h: Filesystem abstraction functions.
3 * Copyright (C) 2003, Red Hat, Inc.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
21 #ifndef __GTK_FILE_SYSTEM_H__
22 #define __GTK_FILE_SYSTEM_H__
25 #include <gtk/gtkwidget.h> /* For icon handling */
29 #define GTK_TYPE_FILE_SYSTEM (_gtk_file_system_get_type ())
30 #define GTK_FILE_SYSTEM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_FILE_SYSTEM, GtkFileSystem))
31 #define GTK_FILE_SYSTEM_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GTK_TYPE_FILE_SYSTEM, GtkFileSystemClass))
32 #define GTK_IS_FILE_SYSTEM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_FILE_SYSTEM))
33 #define GTK_IS_FILE_SYSTEM_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GTK_TYPE_FILE_SYSTEM))
34 #define GTK_FILE_SYSTEM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GTK_TYPE_FILE_SYSTEM, GtkFileSystemClass))
36 #define GTK_TYPE_FOLDER (_gtk_folder_get_type ())
37 #define GTK_FOLDER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_FOLDER, GtkFolder))
38 #define GTK_FOLDER_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GTK_TYPE_FOLDER, GtkFolderClass))
39 #define GTK_IS_FOLDER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_FOLDER))
40 #define GTK_IS_FOLDER_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GTK_TYPE_FOLDER))
41 #define GTK_FOLDER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GTK_TYPE_FOLDER, GtkFolderClass))
43 typedef struct GtkFileSystemClass GtkFileSystemClass;
44 typedef struct GtkFileSystem GtkFileSystem;
45 typedef struct GtkFolderClass GtkFolderClass;
46 typedef struct GtkFolder GtkFolder;
47 typedef struct GtkFileSystemVolume GtkFileSystemVolume; /* opaque struct */
48 typedef struct GtkFileSystemBookmark GtkFileSystemBookmark; /* opaque struct */
50 struct GtkFileSystemClass
52 GObjectClass parent_class;
54 void (*bookmarks_changed) (GtkFileSystem *file_system);
55 void (*volumes_changed) (GtkFileSystem *file_system);
60 GObject parent_object;
65 GObjectClass parent_class;
67 void (*files_added) (GtkFolder *folder,
69 void (*files_removed) (GtkFolder *folder,
71 void (*files_changed) (GtkFolder *folder,
73 void (*finished_loading) (GtkFolder *folder);
74 void (*deleted) (GtkFolder *folder);
79 GObject parent_object;
82 typedef void (* GtkFileSystemGetFolderCallback) (GCancellable *cancellable,
86 typedef void (* GtkFileSystemGetInfoCallback) (GCancellable *cancellable,
90 typedef void (* GtkFileSystemVolumeMountCallback) (GCancellable *cancellable,
91 GtkFileSystemVolume *volume,
95 /* GtkFileSystem methods */
96 GType _gtk_file_system_get_type (void) G_GNUC_CONST;
98 GtkFileSystem * _gtk_file_system_new (void);
100 GSList * _gtk_file_system_list_volumes (GtkFileSystem *file_system);
101 GSList * _gtk_file_system_list_bookmarks (GtkFileSystem *file_system);
103 gboolean _gtk_file_system_parse (GtkFileSystem *file_system,
110 GCancellable * _gtk_file_system_get_folder (GtkFileSystem *file_system,
112 const gchar *attributes,
113 GtkFileSystemGetFolderCallback callback,
115 GCancellable * _gtk_file_system_get_info (GtkFileSystem *file_system,
117 const gchar *attributes,
118 GtkFileSystemGetInfoCallback callback,
120 GCancellable * _gtk_file_system_mount_volume (GtkFileSystem *file_system,
121 GtkFileSystemVolume *volume,
122 GMountOperation *mount_operation,
123 GtkFileSystemVolumeMountCallback callback,
125 GCancellable * _gtk_file_system_mount_enclosing_volume (GtkFileSystem *file_system,
127 GMountOperation *mount_operation,
128 GtkFileSystemVolumeMountCallback callback,
131 gboolean _gtk_file_system_insert_bookmark (GtkFileSystem *file_system,
135 gboolean _gtk_file_system_remove_bookmark (GtkFileSystem *file_system,
139 gchar * _gtk_file_system_get_bookmark_label (GtkFileSystem *file_system,
141 void _gtk_file_system_set_bookmark_label (GtkFileSystem *file_system,
145 GtkFileSystemVolume * _gtk_file_system_get_volume_for_file (GtkFileSystem *file_system,
148 /* GtkFolder functions */
149 GSList * _gtk_folder_list_children (GtkFolder *folder);
150 GFileInfo * _gtk_folder_get_info (GtkFolder *folder,
153 gboolean _gtk_folder_is_finished_loading (GtkFolder *folder);
156 /* GtkFileSystemVolume methods */
157 gchar * _gtk_file_system_volume_get_display_name (GtkFileSystemVolume *volume);
158 gboolean _gtk_file_system_volume_is_mounted (GtkFileSystemVolume *volume);
159 GFile * _gtk_file_system_volume_get_root (GtkFileSystemVolume *volume);
160 GdkPixbuf * _gtk_file_system_volume_render_icon (GtkFileSystemVolume *volume,
165 GtkFileSystemVolume *_gtk_file_system_volume_ref (GtkFileSystemVolume *volume);
166 void _gtk_file_system_volume_unref (GtkFileSystemVolume *volume);
168 /* GtkFileSystemBookmark methods */
169 void _gtk_file_system_bookmark_free (GtkFileSystemBookmark *bookmark);
171 /* GFileInfo helper functions */
172 GdkPixbuf * _gtk_file_info_render_icon (GFileInfo *info,
176 gboolean _gtk_file_info_consider_as_directory (GFileInfo *info);
180 #endif /* __GTK_FILE_SYSTEM_H__ */