gtkfilesystem.h 4.84 KB
Newer Older
Cody Russell's avatar
Cody Russell committed
1
/* GTK - The GIMP Toolkit
2
 * gtkfilesystem.h: Filesystem abstraction functions.
Owen Taylor's avatar
Owen Taylor committed
3 4 5 6 7 8 9 10 11 12 13 14 15
 * Copyright (C) 2003, Red Hat, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
Javier Jardón's avatar
Javier Jardón committed
16
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
Owen Taylor's avatar
Owen Taylor committed
17 18 19 20 21
 */

#ifndef __GTK_FILE_SYSTEM_H__
#define __GTK_FILE_SYSTEM_H__

22
#include <gio/gio.h>
Owen Taylor's avatar
Owen Taylor committed
23
#include <gtk/gtkwidget.h>	/* For icon handling */
Owen Taylor's avatar
Owen Taylor committed
24 25 26

G_BEGIN_DECLS

27
#define GTK_TYPE_FILE_SYSTEM         (_gtk_file_system_get_type ())
28 29 30 31 32
#define GTK_FILE_SYSTEM(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_FILE_SYSTEM, GtkFileSystem))
#define GTK_FILE_SYSTEM_CLASS(c)     (G_TYPE_CHECK_CLASS_CAST    ((c), GTK_TYPE_FILE_SYSTEM, GtkFileSystemClass))
#define GTK_IS_FILE_SYSTEM(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_FILE_SYSTEM))
#define GTK_IS_FILE_SYSTEM_CLASS(c)  (G_TYPE_CHECK_CLASS_TYPE    ((c), GTK_TYPE_FILE_SYSTEM))
#define GTK_FILE_SYSTEM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS  ((o), GTK_TYPE_FILE_SYSTEM, GtkFileSystemClass))
Owen Taylor's avatar
Owen Taylor committed
33

34
typedef struct GtkFileSystem          GtkFileSystem;
35
typedef struct GtkFileSystemPrivate      GtkFileSystemPrivate;
36 37 38
typedef struct GtkFileSystemClass     GtkFileSystemClass;


39
typedef struct GtkFileSystemVolume GtkFileSystemVolume; /* opaque struct */
40

41 42 43 44 45

struct GtkFileSystem
{
  GObject parent_object;

46
  GtkFileSystemPrivate *priv;
47 48
};

49
struct GtkFileSystemClass
50
{
51
  GObjectClass parent_class;
52

53
  void (*volumes_changed)   (GtkFileSystem *file_system);
54 55
};

56

57 58 59 60 61 62 63 64 65 66
typedef void (* GtkFileSystemGetInfoCallback)      (GCancellable        *cancellable,
						    GFileInfo           *file_info,
						    const GError        *error,
						    gpointer             data);
typedef void (* GtkFileSystemVolumeMountCallback)  (GCancellable        *cancellable,
						    GtkFileSystemVolume *volume,
						    const GError        *error,
						    gpointer             data);

/* GtkFileSystem methods */
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
GType           _gtk_file_system_get_type     (void) G_GNUC_CONST;

GtkFileSystem * _gtk_file_system_new          (void);

GSList *        _gtk_file_system_list_volumes   (GtkFileSystem *file_system);

GCancellable *  _gtk_file_system_get_info               (GtkFileSystem                     *file_system,
							 GFile                             *file,
							 const gchar                       *attributes,
							 GtkFileSystemGetInfoCallback       callback,
							 gpointer                           data);
GCancellable *  _gtk_file_system_mount_volume           (GtkFileSystem                     *file_system,
							 GtkFileSystemVolume               *volume,
							 GMountOperation                   *mount_operation,
							 GtkFileSystemVolumeMountCallback   callback,
							 gpointer                           data);
GCancellable *  _gtk_file_system_mount_enclosing_volume (GtkFileSystem                     *file_system,
							 GFile                             *file,
							 GMountOperation                   *mount_operation,
							 GtkFileSystemVolumeMountCallback   callback,
							 gpointer                           data);

GtkFileSystemVolume * _gtk_file_system_get_volume_for_file (GtkFileSystem       *file_system,
							    GFile               *file);
91 92

/* GtkFileSystemVolume methods */
93 94 95
gchar *               _gtk_file_system_volume_get_display_name (GtkFileSystemVolume *volume);
gboolean              _gtk_file_system_volume_is_mounted       (GtkFileSystemVolume *volume);
GFile *               _gtk_file_system_volume_get_root         (GtkFileSystemVolume *volume);
96
GIcon *               _gtk_file_system_volume_get_symbolic_icon (GtkFileSystemVolume *volume);
97
cairo_surface_t *     _gtk_file_system_volume_render_icon      (GtkFileSystemVolume  *volume,
98 99 100
							        GtkWidget            *widget,
							        gint                  icon_size,
							        GError              **error);
101

102 103
GtkFileSystemVolume  *_gtk_file_system_volume_ref              (GtkFileSystemVolume *volume);
void                  _gtk_file_system_volume_unref            (GtkFileSystemVolume *volume);
104 105

/* GFileInfo helper functions */
106 107 108
cairo_surface_t *     _gtk_file_info_render_icon (GFileInfo *info,
						  GtkWidget *widget,
						  gint       icon_size);
109

110 111
gboolean	_gtk_file_info_consider_as_directory (GFileInfo *info);

112
/* GFile helper functions */
113
gboolean	_gtk_file_has_native_path (GFile *file);
114

115 116
gboolean        _gtk_file_consider_as_remote (GFile *file);

Owen Taylor's avatar
Owen Taylor committed
117 118 119
G_END_DECLS

#endif /* __GTK_FILE_SYSTEM_H__ */