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 41 42 struct GtkFileSystem 43 { 44 GObject parent_object; 45 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 typedef void (* GtkFileSystemGetInfoCallback) (GCancellable *cancellable, 58 GFileInfo *file_info, 59 const GError *error, 60 gpointer data); 61 typedef void (* GtkFileSystemVolumeMountCallback) (GCancellable *cancellable, 62 GtkFileSystemVolume *volume, 63 const GError *error, 64 gpointer data); 65 66 /* GtkFileSystem methods */ 67 GType _gtk_file_system_get_type (void) G_GNUC_CONST; 68 69 GtkFileSystem * _gtk_file_system_new (void); 70 71 GSList * _gtk_file_system_list_volumes (GtkFileSystem *file_system); 72 73 GCancellable * _gtk_file_system_get_info (GtkFileSystem *file_system, 74 GFile *file, 75 const gchar *attributes, 76 GtkFileSystemGetInfoCallback callback, 77 gpointer data); 78 GCancellable * _gtk_file_system_mount_volume (GtkFileSystem *file_system, 79 GtkFileSystemVolume *volume, 80 GMountOperation *mount_operation, 81 GtkFileSystemVolumeMountCallback callback, 82 gpointer data); 83 GCancellable * _gtk_file_system_mount_enclosing_volume (GtkFileSystem *file_system, 84 GFile *file, 85 GMountOperation *mount_operation, 86 GtkFileSystemVolumeMountCallback callback, 87 gpointer data); 88 89 GtkFileSystemVolume * _gtk_file_system_get_volume_for_file (GtkFileSystem *file_system, 90 GFile *file); 91 92 /* GtkFileSystemVolume methods */ 93 gchar * _gtk_file_system_volume_get_display_name (GtkFileSystemVolume *volume); 94 gboolean _gtk_file_system_volume_is_mounted (GtkFileSystemVolume *volume); 95 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 GtkWidget *widget, 99 gint icon_size, 100 GError **error); 101 102 GtkFileSystemVolume *_gtk_file_system_volume_ref (GtkFileSystemVolume *volume); 103 void _gtk_file_system_volume_unref (GtkFileSystemVolume *volume); 104 105 /* GFileInfo helper functions */ 106 cairo_surface_t * _gtk_file_info_render_icon (GFileInfo *info, 107 GtkWidget *widget, 108 gint icon_size); 109 110 gboolean _gtk_file_info_consider_as_directory (GFileInfo *info); 111 112 /* GFile helper functions */ 113 gboolean _gtk_file_has_native_path (GFile *file); 114 115 gboolean _gtk_file_consider_as_remote (GFile *file); 116 117 G_END_DECLS 118 119 #endif /* __GTK_FILE_SYSTEM_H__ */ 120