]> Pileus Git - ~andy/gtk/blob - gtk/gtkfilesystem.h
ff0cdddffe59720f4b40003cfdf8238d0f21a4ee
[~andy/gtk] / gtk / gtkfilesystem.h
1 /* GTK - The GIMP Toolkit
2  * gtkfilesystem.h: Filesystem abstraction functions.
3  * Copyright (C) 2003, Red Hat, Inc.
4  *
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.
9  *
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.
14  *
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.
19  */
20
21 #ifndef __GTK_FILE_SYSTEM_H__
22 #define __GTK_FILE_SYSTEM_H__
23
24 #include <gio/gio.h>
25 #include <gtk/gtkwidget.h>      /* For icon handling */
26
27 G_BEGIN_DECLS
28
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))
35
36 typedef struct GtkFileSystem          GtkFileSystem;
37 typedef struct GtkFileSystemPrivate      GtkFileSystemPrivate;
38 typedef struct GtkFileSystemClass     GtkFileSystemClass;
39
40
41 typedef struct GtkFileSystemVolume GtkFileSystemVolume; /* opaque struct */
42 typedef struct GtkFileSystemBookmark GtkFileSystemBookmark; /* opaque struct */
43
44
45 struct GtkFileSystem
46 {
47   GObject parent_object;
48
49   GtkFileSystemPrivate *priv;
50 };
51
52 struct GtkFileSystemClass
53 {
54   GObjectClass parent_class;
55
56   void (*bookmarks_changed) (GtkFileSystem *file_system);
57   void (*volumes_changed)   (GtkFileSystem *file_system);
58 };
59
60
61 typedef void (* GtkFileSystemGetInfoCallback)      (GCancellable        *cancellable,
62                                                     GFileInfo           *file_info,
63                                                     const GError        *error,
64                                                     gpointer             data);
65 typedef void (* GtkFileSystemVolumeMountCallback)  (GCancellable        *cancellable,
66                                                     GtkFileSystemVolume *volume,
67                                                     const GError        *error,
68                                                     gpointer             data);
69
70 /* GtkFileSystem methods */
71 GType           _gtk_file_system_get_type     (void) G_GNUC_CONST;
72
73 GtkFileSystem * _gtk_file_system_new          (void);
74
75 GSList *        _gtk_file_system_list_volumes   (GtkFileSystem *file_system);
76 GSList *        _gtk_file_system_list_bookmarks (GtkFileSystem *file_system);
77
78 GCancellable *  _gtk_file_system_get_info               (GtkFileSystem                     *file_system,
79                                                          GFile                             *file,
80                                                          const gchar                       *attributes,
81                                                          GtkFileSystemGetInfoCallback       callback,
82                                                          gpointer                           data);
83 GCancellable *  _gtk_file_system_mount_volume           (GtkFileSystem                     *file_system,
84                                                          GtkFileSystemVolume               *volume,
85                                                          GMountOperation                   *mount_operation,
86                                                          GtkFileSystemVolumeMountCallback   callback,
87                                                          gpointer                           data);
88 GCancellable *  _gtk_file_system_mount_enclosing_volume (GtkFileSystem                     *file_system,
89                                                          GFile                             *file,
90                                                          GMountOperation                   *mount_operation,
91                                                          GtkFileSystemVolumeMountCallback   callback,
92                                                          gpointer                           data);
93
94 gboolean        _gtk_file_system_insert_bookmark    (GtkFileSystem      *file_system,
95                                                      GFile              *file,
96                                                      gint                position,
97                                                      GError            **error);
98 gboolean        _gtk_file_system_remove_bookmark    (GtkFileSystem      *file_system,
99                                                      GFile              *file,
100                                                      GError            **error);
101
102 gchar *         _gtk_file_system_get_bookmark_label (GtkFileSystem *file_system,
103                                                      GFile         *file);
104 void            _gtk_file_system_set_bookmark_label (GtkFileSystem *file_system,
105                                                      GFile         *file,
106                                                      const gchar   *label);
107
108 GtkFileSystemVolume * _gtk_file_system_get_volume_for_file (GtkFileSystem       *file_system,
109                                                             GFile               *file);
110
111 /* GtkFileSystemVolume methods */
112 gchar *               _gtk_file_system_volume_get_display_name (GtkFileSystemVolume *volume);
113 gboolean              _gtk_file_system_volume_is_mounted       (GtkFileSystemVolume *volume);
114 GFile *               _gtk_file_system_volume_get_root         (GtkFileSystemVolume *volume);
115 GdkPixbuf *           _gtk_file_system_volume_render_icon      (GtkFileSystemVolume  *volume,
116                                                                 GtkWidget            *widget,
117                                                                 gint                  icon_size,
118                                                                 GError              **error);
119
120 GtkFileSystemVolume  *_gtk_file_system_volume_ref              (GtkFileSystemVolume *volume);
121 void                  _gtk_file_system_volume_unref            (GtkFileSystemVolume *volume);
122
123 /* GtkFileSystemBookmark methods */
124 void                   _gtk_file_system_bookmark_free          (GtkFileSystemBookmark *bookmark);
125
126 /* GFileInfo helper functions */
127 GdkPixbuf *     _gtk_file_info_render_icon (GFileInfo *info,
128                                             GtkWidget *widget,
129                                             gint       icon_size);
130
131 gboolean        _gtk_file_info_consider_as_directory (GFileInfo *info);
132
133 G_END_DECLS
134
135 #endif /* __GTK_FILE_SYSTEM_H__ */