1 /* GIO - GLib Input, Output and Streaming Library
2  *
3  * Copyright (C) 2006-2007 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
16  * Public License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  *
20  * Author: Alexander Larsson <alexl@redhat.com>
21  */
22 
23 #ifndef __G_MOUNT_TRACKER_H__
24 #define __G_MOUNT_TRACKER_H__
25 
26 #include <glib-object.h>
27 #include <gio/gio.h>
28 #include <gmountspec.h>
29 
30 G_BEGIN_DECLS
31 
32 #define G_TYPE_MOUNT_TRACKER         (g_mount_tracker_get_type ())
33 #define G_MOUNT_TRACKER(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_MOUNT_TRACKER, GMountTracker))
34 #define G_MOUNT_TRACKER_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_MOUNT_TRACKER, GMountTrackerClass))
35 #define G_IS_MOUNT_TRACKER(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_MOUNT_TRACKER))
36 #define G_IS_MOUNT_TRACKER_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_MOUNT_TRACKER))
37 #define G_MOUNT_TRACKER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_MOUNT_TRACKER, GMountTrackerClass))
38 
39 typedef struct _GMountTracker        GMountTracker;
40 typedef struct _GMountTrackerClass   GMountTrackerClass;
41 
42 typedef struct {
43   volatile int ref_count;
44   char *display_name;
45   char *stable_name;
46   char *x_content_types;
47   GIcon *icon;
48   GIcon *symbolic_icon;
49   char *dbus_id;
50   char *object_path;
51   gboolean user_visible;
52   char *prefered_filename_encoding; /* NULL -> UTF8 */
53   char *fuse_mountpoint;
54   char *default_location;
55   GMountSpec *mount_spec;
56 } GMountInfo;
57 
58 struct _GMountTrackerClass
59 {
60   GObjectClass parent_class;
61 
62   void (*mounted)   (GMountTracker *tracker,
63 		     GMountInfo *info);
64   void (*unmounted) (GMountTracker *tracker,
65 		     GMountInfo *info);
66 };
67 
68 GType g_mount_tracker_get_type (void) G_GNUC_CONST;
69 
70 gboolean    g_mount_info_equal        (GMountInfo *info1,
71 				       GMountInfo *info2);
72 GMountInfo *g_mount_info_ref          (GMountInfo *info);
73 GMountInfo *g_mount_info_dup          (GMountInfo *info);
74 void        g_mount_info_unref        (GMountInfo *info);
75 const char *g_mount_info_resolve_path (GMountInfo *info,
76 				       const char *path);
77 void        g_mount_info_apply_prefix (GMountInfo *info,
78                                        char      **path);
79 
80 GMountInfo * g_mount_info_from_dbus (GVariant *value);
81 
82 GMountTracker *g_mount_tracker_new                (GDBusConnection *connection,
83                                                    gboolean         user_visible_only);
84 GList *        g_mount_tracker_list_mounts        (GMountTracker *tracker);
85 GMountInfo *   g_mount_tracker_find_by_mount_spec (GMountTracker *tracker,
86 						   GMountSpec    *mount_spec);
87 gboolean       g_mount_tracker_has_mount_spec     (GMountTracker *tracker,
88 						   GMountSpec    *mount_spec);
89 
90 G_END_DECLS
91 
92 #endif /* __G_MOUNT_TRACKER_H__ */
93