1 //      g-udisks-device.h
2 //
3 //      Copyright 2010 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
4 //
5 //      This program is free software; you can redistribute it and/or modify
6 //      it under the terms of the GNU General Public License as published by
7 //      the Free Software Foundation; either version 2 of the License, or
8 //      (at your option) any later version.
9 //
10 //      This program 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
13 //      GNU General Public License for more details.
14 //
15 //      You should have received a copy of the GNU General Public License
16 //      along with this program; if not, write to the Free Software
17 //      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 //      MA 02110-1301, USA.
19 
20 
21 #ifndef __G_UDISKS_DEVICE_H__
22 #define __G_UDISKS_DEVICE_H__
23 
24 #include <glib-object.h>
25 #include <dbus/dbus-glib.h>
26 
27 G_BEGIN_DECLS
28 
29 
30 #define G_TYPE_UDISKS_DEVICE                (g_udisks_device_get_type())
31 #define G_UDISKS_DEVICE(obj)                (G_TYPE_CHECK_INSTANCE_CAST((obj),\
32             G_TYPE_UDISKS_DEVICE, GUDisksDevice))
33 #define G_UDISKS_DEVICE_CLASS(klass)        (G_TYPE_CHECK_CLASS_CAST((klass),\
34             G_TYPE_UDISKS_DEVICE, GUDisksDeviceClass))
35 #define G_IS_UDISKS_DEVICE(obj)            (G_TYPE_CHECK_INSTANCE_TYPE((obj),\
36             G_TYPE_UDISKS_DEVICE))
37 #define G_IS_UDISKS_DEVICE_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE((klass),\
38             G_TYPE_UDISKS_DEVICE))
39 #define G_UDISKS_DEVICE_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS((obj),\
40             G_TYPE_UDISKS_DEVICE, GUDisksDeviceClass))
41 
42 typedef struct _GUDisksDevice            GUDisksDevice;
43 typedef struct _GUDisksDeviceClass        GUDisksDeviceClass;
44 typedef struct _GUDisksDevicePrivate        GUDisksDevicePrivate;
45 
46 struct _GUDisksDevice
47 {
48     GObject parent;
49     char* obj_path; /* dbus object path */
50 
51     char* dev_file;
52     char* dev_file_presentation;
53     gboolean is_sys_internal : 1;
54     gboolean is_removable : 1;
55     gboolean is_read_only : 1;
56     gboolean is_drive : 1;
57     gboolean is_optic_disc : 1;
58     gboolean is_mounted : 1;
59     gboolean is_media_available : 1;
60     gboolean is_media_change_notification_polling : 1;
61     gboolean is_luks : 1;
62     gboolean is_luks_clear_text : 1;
63     gboolean is_linux_md_component : 1;
64     gboolean is_linux_md : 1;
65     gboolean is_linux_lvm2lv : 1;
66     gboolean is_linux_lvm2pv : 1;
67     gboolean is_linux_dmmp_component : 1;
68     gboolean is_linux_dmmp : 1;
69     gboolean is_ejectable : 1;
70     gboolean is_disc_blank : 1;
71     gboolean is_hidden : 1;
72     gboolean auto_mount : 1;
73 
74     guint mounted_by_uid;
75     char** mount_paths;
76     guint64 dev_size;
77     guint64 partition_size;
78 
79     guint num_audio_tracks;
80     guint luks_unlocked_by_uid;
81 
82     char* name;
83     char* icon_name;
84 
85     char* usage;
86     char* type;
87     char* uuid;
88     char* label;
89     char* vender;
90     char* model;
91     char* conn_iface;
92     char* media;
93     char* partition_slave;
94 };
95 
96 struct _GUDisksDeviceClass
97 {
98     GObjectClass parent_class;
99 };
100 
101 
102 GType g_udisks_device_get_type (void);
103 GUDisksDevice* g_udisks_device_new (const char* obj_path, GHashTable* props);
104 
105 void g_udisks_device_update(GUDisksDevice* dev, GHashTable* props);
106 
107 DBusGProxy* g_udisks_device_get_proxy(GUDisksDevice* dev, DBusGConnection* con);
108 
109 const char* g_udisks_device_get_icon_name(GUDisksDevice* dev);
110 
111 /* this is only valid if the device contains a optic disc */
112 const char* g_udisks_device_get_disc_name(GUDisksDevice* dev);
113 
114 gboolean g_udisks_device_is_volume(GUDisksDevice* dev);
115 
116 G_END_DECLS
117 
118 #endif /* __G_UDISKS_DEVICE_H__ */
119