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