summaryrefslogtreecommitdiff
path: root/libnautilus-private/nautilus-volume-monitor.h
blob: a81cfb86d35e625a46cf458f84d535b373fd51a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */

/* nautilus-volume-monitor.h - interface for desktop mounting functions.

   Copyright (C) 2000 Eazel, Inc.

   The Gnome Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public License as
   published by the Free Software Foundation; either version 2 of the
   License, or (at your option) any later version.

   The Gnome 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
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public
   License along with the Gnome Library; see the file COPYING.LIB.  If not,
   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, USA.

   Authors: Gene Z. Ragan <gzr@eazel.com>
*/

#ifndef NAUTILUS_VOLUME_MONITOR_H
#define NAUTILUS_VOLUME_MONITOR_H

#include <gtk/gtkobject.h>

typedef struct NautilusVolumeMonitor NautilusVolumeMonitor;
typedef struct NautilusVolumeMonitorClass NautilusVolumeMonitorClass;
typedef struct NautilusVolumeMonitorDetails NautilusVolumeMonitorDetails;

#define NAUTILUS_TYPE_VOLUME_MONITOR		(nautilus_volume_monitor_get_type())
#define NAUTILUS_VOLUME_MONITOR(obj)		(GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_VOLUME_MONITOR, NautilusVolumeMonitor))
#define NAUTILUS_VOLUME_MONITOR_CLASS(klass)	(GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_VOLUME_MONITOR, NautilusVolumeMonitorClass))
#define IS_NAUTILUS_VOLUME_MONITOR(obj)		(GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_VOLUME_MONITOR))

struct NautilusVolumeMonitor {
	GtkObject parent;
	NautilusVolumeMonitorDetails *details;
};

typedef struct NautilusVolume NautilusVolume;

struct NautilusVolumeMonitorClass {
	GtkObjectClass parent_class;

	/* Signals */
	void (* volume_mounted)	  (NautilusVolumeMonitor 	 *monitor,
				   const NautilusVolume      	 *volume);
	void (* volume_unmounted) (NautilusVolumeMonitor 	 *monitor,
				   const NautilusVolume      	 *volume);
};

typedef enum { 
	NAUTILUS_VOLUME_ACTIVE, 
	NAUTILUS_VOLUME_INACTIVE, 
	NAUTILUS_VOLUME_EMPTY, 
	NAUTILUS_VOLUME_NUMBER_OF_STATES
} NautilusVolumeState;

typedef enum {
	NAUTILUS_VOLUME_AFFS,
	NAUTILUS_VOLUME_CDROM, 	
	NAUTILUS_VOLUME_EXT2,
	NAUTILUS_VOLUME_FAT,
	NAUTILUS_VOLUME_FLOPPY,
	NAUTILUS_VOLUME_HPFS,
	NAUTILUS_VOLUME_MINIX,
	NAUTILUS_VOLUME_MSDOS,
	NAUTILUS_VOLUME_NFS,
	NAUTILUS_VOLUME_PROC,
	NAUTILUS_VOLUME_SMB,
	NAUTILUS_VOLUME_UDF,
	NAUTILUS_VOLUME_UFS,
	NAUTILUS_VOLUME_UNSDOS,
	NAUTILUS_VOLUME_VFAT,
	NAUTILUS_VOLUME_XENIX,
	NAUTILUS_VOLUME_XIAFS,
	NAUTILUS_VOLUME_UNKNOWN
} NautilusVolumeType;

struct NautilusVolume {
	NautilusVolumeType type;
	NautilusVolumeState state;
	
	char *fsname;
	char *mount_path;
	char *volume_name;
	
	gboolean is_mounted;
	gboolean did_mount;
	
	gboolean is_read_only;
};

typedef gboolean (* NautilusEachVolumeFunction) (const NautilusVolume *, gpointer);

GtkType                	nautilus_volume_monitor_get_type                   	(void);
NautilusVolumeMonitor  	*nautilus_volume_monitor_get                        	(void);
char 			*nautilus_volume_monitor_get_volume_name 		(const NautilusVolume 		*volume);

gboolean               	nautilus_volume_monitor_volume_is_mounted          	(const NautilusVolume 		*volume);
gboolean               	nautilus_volume_monitor_mount_unmount_removable    	(NautilusVolumeMonitor 		*monitor,
									   	 const char            		*mount_point);
gboolean		nautilus_volume_monitor_volume_is_removable		(NautilusVolume 		*volume);
gboolean               	nautilus_volume_monitor_is_volume_link             	(const char            		*path);
void                   	nautilus_volume_monitor_each_volume                	(NautilusVolumeMonitor 		*monitor,
									   	 NautilusEachVolumeFunction  	function,
									   	 gpointer               	context);
void                   	nautilus_volume_monitor_each_mounted_volume        	(NautilusVolumeMonitor 		*monitor,
									  	 NautilusEachVolumeFunction   	function,
									   	 gpointer               	context);
GList			*nautilus_volume_monitor_get_removable_volumes 		(NautilusVolumeMonitor 		*monitor);

#endif /* NAUTILUS_VOLUME_MONITOR_H */