Lines 49-64
Link Here
|
49 |
|
49 |
|
50 |
typedef struct { |
50 |
typedef struct { |
51 |
GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon; |
51 |
GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon; |
52 |
HalStoragePolicy *hal_storage_policy; |
52 |
LibHalStoragePolicy *hal_storage_policy; |
53 |
} GnomeVFSHalUserData; |
53 |
} GnomeVFSHalUserData; |
54 |
|
54 |
|
55 |
static void |
|
|
56 |
_hal_mainloop_integration (LibHalContext *ctx, |
57 |
DBusConnection * dbus_connection) |
58 |
{ |
59 |
dbus_connection_setup_with_g_main (dbus_connection, NULL); |
60 |
} |
61 |
|
62 |
static void |
55 |
static void |
63 |
_hal_device_added (LibHalContext *hal_ctx, |
56 |
_hal_device_added (LibHalContext *hal_ctx, |
64 |
const char *udi) |
57 |
const char *udi) |
Lines 66-81
_hal_device_added (LibHalContext *hal_ct
Link Here
|
66 |
GnomeVFSHalUserData *hal_userdata; |
59 |
GnomeVFSHalUserData *hal_userdata; |
67 |
GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon; |
60 |
GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon; |
68 |
|
61 |
|
69 |
hal_userdata = (GnomeVFSHalUserData *) hal_ctx_get_user_data (hal_ctx); |
62 |
hal_userdata = (GnomeVFSHalUserData *) libhal_ctx_get_user_data (hal_ctx); |
70 |
volume_monitor_daemon = hal_userdata->volume_monitor_daemon; |
63 |
volume_monitor_daemon = hal_userdata->volume_monitor_daemon; |
71 |
|
64 |
|
72 |
/* Handle optical discs without data since these are not handled |
65 |
/* Handle optical discs without data since these are not handled |
73 |
* by GNOME VFS |
66 |
* by GNOME VFS |
74 |
*/ |
67 |
*/ |
75 |
if (hal_device_get_property_bool (hal_ctx, udi, "volume.is_disc")) { |
68 |
if (libhal_device_get_property_bool (hal_ctx, udi, "volume.is_disc", NULL)) { |
76 |
const char *storage_udi; |
69 |
const char *storage_udi; |
77 |
|
70 |
|
78 |
storage_udi = hal_device_get_property_string (hal_ctx, udi, "block.storage_device"); |
71 |
storage_udi = libhal_device_get_property_string (hal_ctx, udi, "block.storage_device", NULL); |
79 |
if (storage_udi != NULL) { |
72 |
if (storage_udi != NULL) { |
80 |
GnomeVFSDrive *drive; |
73 |
GnomeVFSDrive *drive; |
81 |
|
74 |
|
Lines 97-103
_hal_device_removed (LibHalContext *hal_
Link Here
|
97 |
GnomeVFSHalUserData *hal_userdata; |
90 |
GnomeVFSHalUserData *hal_userdata; |
98 |
GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon; |
91 |
GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon; |
99 |
|
92 |
|
100 |
hal_userdata = (GnomeVFSHalUserData *) hal_ctx_get_user_data (hal_ctx); |
93 |
hal_userdata = (GnomeVFSHalUserData *) libhal_ctx_get_user_data (hal_ctx); |
101 |
volume_monitor_daemon = hal_userdata->volume_monitor_daemon; |
94 |
volume_monitor_daemon = hal_userdata->volume_monitor_daemon; |
102 |
|
95 |
|
103 |
drive = _gnome_vfs_volume_monitor_find_drive_by_hal_udi ( |
96 |
drive = _gnome_vfs_volume_monitor_find_drive_by_hal_udi ( |
Lines 122-274
_hal_device_removed (LibHalContext *hal_
Link Here
|
122 |
} |
115 |
} |
123 |
} |
116 |
} |
124 |
|
117 |
|
125 |
static void |
|
|
126 |
_hal_device_new_capability (LibHalContext *hal_ctx, |
127 |
const char *udi, |
128 |
const char *capability) |
129 |
{ |
130 |
GnomeVFSHalUserData *hal_userdata; |
131 |
GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon; |
132 |
|
133 |
hal_userdata = (GnomeVFSHalUserData *) hal_ctx_get_user_data (hal_ctx); |
134 |
volume_monitor_daemon = hal_userdata->volume_monitor_daemon; |
135 |
|
136 |
/* do nothing */ |
137 |
} |
138 |
|
139 |
static void |
140 |
_hal_device_lost_capability (LibHalContext *hal_ctx, |
141 |
const char *udi, |
142 |
const char *capability) |
143 |
{ |
144 |
GnomeVFSHalUserData *hal_userdata; |
145 |
GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon; |
146 |
|
147 |
hal_userdata = (GnomeVFSHalUserData *) hal_ctx_get_user_data (hal_ctx); |
148 |
volume_monitor_daemon = hal_userdata->volume_monitor_daemon; |
149 |
|
118 |
|
150 |
/* do nothing */ |
|
|
151 |
} |
152 |
|
119 |
|
153 |
static void |
120 |
static LibHalStoragePolicyIconPair icon_mapping[] = { |
154 |
_hal_device_property_modified (LibHalContext *hal_ctx, |
121 |
{LIBHAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK, "gnome-dev-removable"}, |
155 |
const char *udi, |
122 |
{LIBHAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK_IDE, "gnome-dev-removable"}, |
156 |
const char *key, |
123 |
{LIBHAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK_SCSI, "gnome-dev-removable"}, |
157 |
dbus_bool_t is_removed, |
124 |
{LIBHAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK_USB, "gnome-dev-removable-usb"}, |
158 |
dbus_bool_t is_added) |
125 |
{LIBHAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK_IEEE1394, "gnome-dev-removable-1394"}, |
159 |
{ |
126 |
{LIBHAL_STORAGE_ICON_DRIVE_DISK, "gnome-dev-removable"}, |
160 |
GnomeVFSHalUserData *hal_userdata; |
127 |
{LIBHAL_STORAGE_ICON_DRIVE_DISK_IDE, "gnome-dev-removable"}, |
161 |
GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon; |
128 |
{LIBHAL_STORAGE_ICON_DRIVE_DISK_SCSI, "gnome-dev-removable"}, |
162 |
|
129 |
{LIBHAL_STORAGE_ICON_DRIVE_DISK_USB, "gnome-dev-removable-usb"}, |
163 |
hal_userdata = (GnomeVFSHalUserData *) hal_ctx_get_user_data (hal_ctx); |
130 |
{LIBHAL_STORAGE_ICON_DRIVE_DISK_IEEE1394, "gnome-dev-removable-1394"}, |
164 |
volume_monitor_daemon = hal_userdata->volume_monitor_daemon; |
131 |
{LIBHAL_STORAGE_ICON_DRIVE_CDROM, "gnome-dev-removable"}, |
165 |
|
132 |
{LIBHAL_STORAGE_ICON_DRIVE_CDROM_IDE, "gnome-dev-removable"}, |
166 |
/* do nothing */ |
133 |
{LIBHAL_STORAGE_ICON_DRIVE_CDROM_SCSI, "gnome-dev-removable"}, |
167 |
} |
134 |
{LIBHAL_STORAGE_ICON_DRIVE_CDROM_USB, "gnome-dev-removable-usb"}, |
168 |
|
135 |
{LIBHAL_STORAGE_ICON_DRIVE_CDROM_IEEE1394, "gnome-dev-removable-1394"}, |
169 |
static void |
136 |
{LIBHAL_STORAGE_ICON_DRIVE_FLOPPY, "gnome-dev-removable"}, |
170 |
_hal_device_condition (LibHalContext *hal_ctx, |
137 |
{LIBHAL_STORAGE_ICON_DRIVE_FLOPPY_IDE, "gnome-dev-removable"}, |
171 |
const char *udi, |
138 |
{LIBHAL_STORAGE_ICON_DRIVE_FLOPPY_SCSI, "gnome-dev-removable"}, |
172 |
const char *condition_name, |
139 |
{LIBHAL_STORAGE_ICON_DRIVE_FLOPPY_USB, "gnome-dev-removable-usb"}, |
173 |
DBusMessage *message) |
140 |
{LIBHAL_STORAGE_ICON_DRIVE_FLOPPY_IEEE1394, "gnome-dev-removable-1394"}, |
174 |
{ |
141 |
{LIBHAL_STORAGE_ICON_DRIVE_TAPE, "gnome-dev-removable"}, |
175 |
GnomeVFSHalUserData *hal_userdata; |
142 |
{LIBHAL_STORAGE_ICON_DRIVE_COMPACT_FLASH, "gnome-dev-removable"}, |
176 |
GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon; |
143 |
{LIBHAL_STORAGE_ICON_DRIVE_MEMORY_STICK, "gnome-dev-removable"}, |
177 |
|
144 |
{LIBHAL_STORAGE_ICON_DRIVE_SMART_MEDIA, "gnome-dev-removable"}, |
178 |
hal_userdata = (GnomeVFSHalUserData *) hal_ctx_get_user_data (hal_ctx); |
145 |
{LIBHAL_STORAGE_ICON_DRIVE_SD_MMC, "gnome-dev-removable"}, |
179 |
volume_monitor_daemon = hal_userdata->volume_monitor_daemon; |
146 |
{LIBHAL_STORAGE_ICON_DRIVE_CAMERA, "gnome-dev-removable"}, |
180 |
|
147 |
{LIBHAL_STORAGE_ICON_DRIVE_PORTABLE_AUDIO_PLAYER, "gnome-dev-removable"}, |
181 |
/* do nothing */ |
148 |
{LIBHAL_STORAGE_ICON_DRIVE_ZIP, "gnome-dev-removable"}, |
182 |
} |
149 |
{LIBHAL_STORAGE_ICON_DRIVE_JAZ, "gnome-dev-removable"}, |
183 |
|
150 |
{LIBHAL_STORAGE_ICON_DRIVE_FLASH_KEY, "gnome-dev-removable"}, |
184 |
static LibHalFunctions |
151 |
|
185 |
hal_functions = { _hal_mainloop_integration, |
152 |
{LIBHAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK, "gnome-dev-harddisk"}, |
186 |
_hal_device_added, |
153 |
{LIBHAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK_IDE, "gnome-dev-harddisk"}, |
187 |
_hal_device_removed, |
154 |
{LIBHAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK_SCSI, "gnome-dev-harddisk"}, |
188 |
_hal_device_new_capability, |
155 |
{LIBHAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK_USB, "gnome-dev-harddisk-usb"}, |
189 |
_hal_device_lost_capability, |
156 |
{LIBHAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK_IEEE1394, "gnome-dev-harddisk-1394"}, |
190 |
_hal_device_property_modified, |
157 |
{LIBHAL_STORAGE_ICON_VOLUME_DISK, "gnome-dev-harddisk"}, |
191 |
_hal_device_condition }; |
158 |
{LIBHAL_STORAGE_ICON_VOLUME_DISK_IDE, "gnome-dev-harddisk"}, |
192 |
|
159 |
{LIBHAL_STORAGE_ICON_VOLUME_DISK_SCSI, "gnome-dev-harddisk"}, |
193 |
static HalStoragePolicyIconPair icon_mapping[] = { |
160 |
{LIBHAL_STORAGE_ICON_VOLUME_DISK_USB, "gnome-dev-harddisk-usb"}, |
194 |
{HAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK, "gnome-dev-removable"}, |
161 |
{LIBHAL_STORAGE_ICON_VOLUME_DISK_IEEE1394, "gnome-dev-harddisk-1394"}, |
195 |
{HAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK_IDE, "gnome-dev-removable"}, |
162 |
{LIBHAL_STORAGE_ICON_VOLUME_CDROM, "gnome-dev-cdrom"}, |
196 |
{HAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK_SCSI, "gnome-dev-removable"}, |
163 |
{LIBHAL_STORAGE_ICON_VOLUME_CDROM_IDE, "gnome-dev-cdrom"}, |
197 |
{HAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK_USB, "gnome-dev-removable-usb"}, |
164 |
{LIBHAL_STORAGE_ICON_VOLUME_CDROM_SCSI, "gnome-dev-cdrom"}, |
198 |
{HAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK_IEEE1394, "gnome-dev-removable-1394"}, |
165 |
{LIBHAL_STORAGE_ICON_VOLUME_CDROM_USB, "gnome-dev-cdrom"}, |
199 |
{HAL_STORAGE_ICON_DRIVE_DISK, "gnome-dev-removable"}, |
166 |
{LIBHAL_STORAGE_ICON_VOLUME_CDROM_IEEE1394, "gnome-dev-cdrom"}, |
200 |
{HAL_STORAGE_ICON_DRIVE_DISK_IDE, "gnome-dev-removable"}, |
167 |
{LIBHAL_STORAGE_ICON_VOLUME_FLOPPY, "gnome-dev-floppy"}, |
201 |
{HAL_STORAGE_ICON_DRIVE_DISK_SCSI, "gnome-dev-removable"}, |
168 |
{LIBHAL_STORAGE_ICON_VOLUME_FLOPPY_IDE, "gnome-dev-floppy"}, |
202 |
{HAL_STORAGE_ICON_DRIVE_DISK_USB, "gnome-dev-removable-usb"}, |
169 |
{LIBHAL_STORAGE_ICON_VOLUME_FLOPPY_SCSI, "gnome-dev-floppy"}, |
203 |
{HAL_STORAGE_ICON_DRIVE_DISK_IEEE1394, "gnome-dev-removable-1394"}, |
170 |
{LIBHAL_STORAGE_ICON_VOLUME_FLOPPY_USB, "gnome-dev-floppy"}, |
204 |
{HAL_STORAGE_ICON_DRIVE_CDROM, "gnome-dev-removable"}, |
171 |
{LIBHAL_STORAGE_ICON_VOLUME_FLOPPY_IEEE1394, "gnome-dev-floppy"}, |
205 |
{HAL_STORAGE_ICON_DRIVE_CDROM_IDE, "gnome-dev-removable"}, |
172 |
{LIBHAL_STORAGE_ICON_VOLUME_TAPE, "gnome-dev-harddisk"}, |
206 |
{HAL_STORAGE_ICON_DRIVE_CDROM_SCSI, "gnome-dev-removable"}, |
173 |
{LIBHAL_STORAGE_ICON_VOLUME_COMPACT_FLASH, "gnome-dev-media-cf"}, |
207 |
{HAL_STORAGE_ICON_DRIVE_CDROM_USB, "gnome-dev-removable-usb"}, |
174 |
{LIBHAL_STORAGE_ICON_VOLUME_MEMORY_STICK, "gnome-dev-media-ms"}, |
208 |
{HAL_STORAGE_ICON_DRIVE_CDROM_IEEE1394, "gnome-dev-removable-1394"}, |
175 |
{LIBHAL_STORAGE_ICON_VOLUME_SMART_MEDIA, "gnome-dev-media-sm"}, |
209 |
{HAL_STORAGE_ICON_DRIVE_FLOPPY, "gnome-dev-removable"}, |
176 |
{LIBHAL_STORAGE_ICON_VOLUME_SD_MMC, "gnome-dev-media-sdmmc"}, |
210 |
{HAL_STORAGE_ICON_DRIVE_FLOPPY_IDE, "gnome-dev-removable"}, |
177 |
{LIBHAL_STORAGE_ICON_VOLUME_CAMERA, "camera"}, |
211 |
{HAL_STORAGE_ICON_DRIVE_FLOPPY_SCSI, "gnome-dev-removable"}, |
178 |
{LIBHAL_STORAGE_ICON_VOLUME_PORTABLE_AUDIO_PLAYER, "gnome-dev-ipod"}, |
212 |
{HAL_STORAGE_ICON_DRIVE_FLOPPY_USB, "gnome-dev-removable-usb"}, |
179 |
{LIBHAL_STORAGE_ICON_VOLUME_ZIP, "gnome-dev-zipdisk"}, |
213 |
{HAL_STORAGE_ICON_DRIVE_FLOPPY_IEEE1394, "gnome-dev-removable-1394"}, |
180 |
{LIBHAL_STORAGE_ICON_VOLUME_JAZ, "gnome-dev-jazdisk"}, |
214 |
{HAL_STORAGE_ICON_DRIVE_TAPE, "gnome-dev-removable"}, |
181 |
{LIBHAL_STORAGE_ICON_VOLUME_FLASH_KEY, "gnome-dev-harddisk"}, |
215 |
{HAL_STORAGE_ICON_DRIVE_COMPACT_FLASH, "gnome-dev-removable"}, |
|
|
216 |
{HAL_STORAGE_ICON_DRIVE_MEMORY_STICK, "gnome-dev-removable"}, |
217 |
{HAL_STORAGE_ICON_DRIVE_SMART_MEDIA, "gnome-dev-removable"}, |
218 |
{HAL_STORAGE_ICON_DRIVE_SD_MMC, "gnome-dev-removable"}, |
219 |
{HAL_STORAGE_ICON_DRIVE_CAMERA, "gnome-dev-removable"}, |
220 |
{HAL_STORAGE_ICON_DRIVE_PORTABLE_AUDIO_PLAYER, "gnome-dev-removable"}, |
221 |
|
222 |
{HAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK, "gnome-dev-harddisk"}, |
223 |
{HAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK_IDE, "gnome-dev-harddisk"}, |
224 |
{HAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK_SCSI, "gnome-dev-harddisk"}, |
225 |
{HAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK_USB, "gnome-dev-harddisk-usb"}, |
226 |
{HAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK_IEEE1394, "gnome-dev-harddisk-1394"}, |
227 |
{HAL_STORAGE_ICON_VOLUME_DISK, "gnome-dev-harddisk"}, |
228 |
{HAL_STORAGE_ICON_VOLUME_DISK_IDE, "gnome-dev-harddisk"}, |
229 |
{HAL_STORAGE_ICON_VOLUME_DISK_SCSI, "gnome-dev-harddisk"}, |
230 |
{HAL_STORAGE_ICON_VOLUME_DISK_USB, "gnome-dev-harddisk-usb"}, |
231 |
{HAL_STORAGE_ICON_VOLUME_DISK_IEEE1394, "gnome-dev-harddisk-1394"}, |
232 |
{HAL_STORAGE_ICON_VOLUME_CDROM, "gnome-dev-cdrom"}, |
233 |
{HAL_STORAGE_ICON_VOLUME_CDROM_IDE, "gnome-dev-cdrom"}, |
234 |
{HAL_STORAGE_ICON_VOLUME_CDROM_SCSI, "gnome-dev-cdrom"}, |
235 |
{HAL_STORAGE_ICON_VOLUME_CDROM_USB, "gnome-dev-cdrom"}, |
236 |
{HAL_STORAGE_ICON_VOLUME_CDROM_IEEE1394, "gnome-dev-cdrom"}, |
237 |
{HAL_STORAGE_ICON_VOLUME_FLOPPY, "gnome-dev-floppy"}, |
238 |
{HAL_STORAGE_ICON_VOLUME_FLOPPY_IDE, "gnome-dev-floppy"}, |
239 |
{HAL_STORAGE_ICON_VOLUME_FLOPPY_SCSI, "gnome-dev-floppy"}, |
240 |
{HAL_STORAGE_ICON_VOLUME_FLOPPY_USB, "gnome-dev-floppy"}, |
241 |
{HAL_STORAGE_ICON_VOLUME_FLOPPY_IEEE1394, "gnome-dev-floppy"}, |
242 |
{HAL_STORAGE_ICON_VOLUME_TAPE, "gnome-dev-harddisk"}, |
243 |
{HAL_STORAGE_ICON_VOLUME_COMPACT_FLASH, "gnome-dev-media-cf"}, |
244 |
{HAL_STORAGE_ICON_VOLUME_MEMORY_STICK, "gnome-dev-media-ms"}, |
245 |
{HAL_STORAGE_ICON_VOLUME_SMART_MEDIA, "gnome-dev-media-sm"}, |
246 |
{HAL_STORAGE_ICON_VOLUME_SD_MMC, "gnome-dev-media-sdmmc"}, |
247 |
{HAL_STORAGE_ICON_VOLUME_CAMERA, "camera"}, |
248 |
{HAL_STORAGE_ICON_VOLUME_PORTABLE_AUDIO_PLAYER, "gnome-dev-ipod"}, |
249 |
|
250 |
{HAL_STORAGE_ICON_DISC_CDROM, "gnome-dev-cdrom"}, |
251 |
{HAL_STORAGE_ICON_DISC_CDR, "gnome-dev-cdrom"}, |
252 |
{HAL_STORAGE_ICON_DISC_CDRW, "gnome-dev-cdrom"}, |
253 |
{HAL_STORAGE_ICON_DISC_DVDROM, "gnome-dev-dvd"}, |
254 |
{HAL_STORAGE_ICON_DISC_DVDRAM, "gnome-dev-dvd"}, |
255 |
{HAL_STORAGE_ICON_DISC_DVDR, "gnome-dev-dvd"}, |
256 |
{HAL_STORAGE_ICON_DISC_DVDRW, "gnome-dev-dvd"}, |
257 |
{HAL_STORAGE_ICON_DISC_DVDPLUSR, "gnome-dev-dvd"}, |
258 |
{HAL_STORAGE_ICON_DISC_DVDPLUSRW, "gnome-dev-dvd"}, |
259 |
|
182 |
|
260 |
/* |
183 |
/* |
261 |
{HAL_STORAGE_ICON_DISC_CDROM, "gnome-dev-disc-cdrom"}, |
184 |
{LIBHAL_STORAGE_ICON_DISC_CDROM, "gnome-dev-cdrom"}, |
262 |
{HAL_STORAGE_ICON_DISC_CDR, "gnome-dev-disc-cdr"}, |
185 |
{LIBHAL_STORAGE_ICON_DISC_CDR, "gnome-dev-cdrom"}, |
263 |
{HAL_STORAGE_ICON_DISC_CDRW, "gnome-dev-disc-cdrw"}, |
186 |
{LIBHAL_STORAGE_ICON_DISC_CDRW, "gnome-dev-cdrom"}, |
264 |
{HAL_STORAGE_ICON_DISC_DVDROM, "gnome-dev-disc-dvdrom"}, |
187 |
{LIBHAL_STORAGE_ICON_DISC_DVDROM, "gnome-dev-dvd"}, |
265 |
{HAL_STORAGE_ICON_DISC_DVDRAM, "gnome-dev-disc-dvdram"}, |
188 |
{LIBHAL_STORAGE_ICON_DISC_DVDRAM, "gnome-dev-dvd"}, |
266 |
{HAL_STORAGE_ICON_DISC_DVDR, "gnome-dev-disc-dvdr"}, |
189 |
{LIBHAL_STORAGE_ICON_DISC_DVDR, "gnome-dev-dvd"}, |
267 |
{HAL_STORAGE_ICON_DISC_DVDRW, "gnome-dev-disc-dvdrw"}, |
190 |
{LIBHAL_STORAGE_ICON_DISC_DVDRW, "gnome-dev-dvd"}, |
268 |
{HAL_STORAGE_ICON_DISC_DVDPLUSR, "gnome-dev-disc-dvdr-plus"}, |
191 |
{LIBHAL_STORAGE_ICON_DISC_DVDPLUSR, "gnome-dev-dvd"}, |
269 |
{HAL_STORAGE_ICON_DISC_DVDPLUSRW, "gnome-dev-disc-dvdrw-plus"}, |
192 |
{LIBHAL_STORAGE_ICON_DISC_DVDPLUSRW, "gnome-dev-dvd"}, |
270 |
*/ |
193 |
*/ |
271 |
|
194 |
|
|
|
195 |
{LIBHAL_STORAGE_ICON_DISC_CDROM, "gnome-dev-cdrom"}, |
196 |
{LIBHAL_STORAGE_ICON_DISC_CDR, "gnome-dev-disc-cdr"}, |
197 |
{LIBHAL_STORAGE_ICON_DISC_CDRW, "gnome-dev-disc-cdrw"}, |
198 |
{LIBHAL_STORAGE_ICON_DISC_DVDROM, "gnome-dev-disc-dvdrom"}, |
199 |
{LIBHAL_STORAGE_ICON_DISC_DVDRAM, "gnome-dev-disc-dvdram"}, |
200 |
{LIBHAL_STORAGE_ICON_DISC_DVDR, "gnome-dev-disc-dvdr"}, |
201 |
{LIBHAL_STORAGE_ICON_DISC_DVDRW, "gnome-dev-disc-dvdrw"}, |
202 |
{LIBHAL_STORAGE_ICON_DISC_DVDPLUSR, "gnome-dev-disc-dvdr-plus"}, |
203 |
{LIBHAL_STORAGE_ICON_DISC_DVDPLUSRW, "gnome-dev-disc-dvdrw"}, /* missing -plus icon here! */ |
204 |
|
272 |
{0x00, NULL} |
205 |
{0x00, NULL} |
273 |
}; |
206 |
}; |
274 |
|
207 |
|
Lines 276-301
static HalStoragePolicyIconPair icon_map
Link Here
|
276 |
gboolean |
209 |
gboolean |
277 |
_gnome_vfs_hal_mounts_init (GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon) |
210 |
_gnome_vfs_hal_mounts_init (GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon) |
278 |
{ |
211 |
{ |
|
|
212 |
DBusError error; |
213 |
DBusConnection *dbus_connection; |
279 |
GnomeVFSHalUserData *hal_userdata; |
214 |
GnomeVFSHalUserData *hal_userdata; |
280 |
HalStoragePolicy *hal_storage_policy; |
215 |
LibHalStoragePolicy *hal_storage_policy; |
281 |
|
216 |
|
282 |
/* Initialise the connection to the hal daemon */ |
217 |
/* Initialise the connection to the hal daemon */ |
283 |
if ((volume_monitor_daemon->hal_ctx = |
218 |
if ((volume_monitor_daemon->hal_ctx = |
284 |
hal_initialize (&hal_functions, FALSE)) == NULL) { |
219 |
libhal_ctx_new ()) == NULL) { |
285 |
g_warning ("hal_initialize failed\n"); |
220 |
g_warning ("libhal_ctx_new failed\n"); |
|
|
221 |
return FALSE; |
222 |
} |
223 |
|
224 |
dbus_error_init (&error); |
225 |
dbus_connection = dbus_bus_get (DBUS_BUS_SYSTEM, &error); |
226 |
if (dbus_error_is_set (&error)) { |
227 |
g_warning ("Error connecting to D-BUS system bus: %s\n", |
228 |
error.message); |
229 |
dbus_error_free (&error); |
230 |
return FALSE; |
231 |
} |
232 |
dbus_connection_setup_with_g_main (dbus_connection, NULL); |
233 |
|
234 |
libhal_ctx_set_dbus_connection (volume_monitor_daemon->hal_ctx, |
235 |
dbus_connection); |
236 |
|
237 |
libhal_ctx_set_device_added (volume_monitor_daemon->hal_ctx, |
238 |
_hal_device_added); |
239 |
libhal_ctx_set_device_removed (volume_monitor_daemon->hal_ctx, |
240 |
_hal_device_removed); |
241 |
|
242 |
if (!libhal_ctx_init (volume_monitor_daemon->hal_ctx, &error)) { |
243 |
g_warning ("libhal_ctx_init failed: %s\n", error.message); |
244 |
dbus_error_free (&error); |
286 |
return FALSE; |
245 |
return FALSE; |
287 |
} |
246 |
} |
288 |
|
247 |
|
289 |
|
248 |
|
290 |
/* Setup GNOME specific policy - right now this is only icons */ |
249 |
/* Setup GNOME specific policy - right now this is only icons */ |
291 |
hal_storage_policy = hal_storage_policy_new (); |
250 |
hal_storage_policy = libhal_storage_policy_new (); |
292 |
hal_storage_policy_set_icon_mapping (hal_storage_policy, icon_mapping); |
251 |
libhal_storage_policy_set_icon_mapping (hal_storage_policy, icon_mapping); |
293 |
|
252 |
|
294 |
/* Tie some data with the libhal context */ |
253 |
/* Tie some data with the libhal context */ |
295 |
hal_userdata = g_new0 (GnomeVFSHalUserData, 1); |
254 |
hal_userdata = g_new0 (GnomeVFSHalUserData, 1); |
296 |
hal_userdata->volume_monitor_daemon = volume_monitor_daemon; |
255 |
hal_userdata->volume_monitor_daemon = volume_monitor_daemon; |
297 |
hal_userdata->hal_storage_policy = hal_storage_policy; |
256 |
hal_userdata->hal_storage_policy = hal_storage_policy; |
298 |
hal_ctx_set_user_data (volume_monitor_daemon->hal_ctx, |
257 |
libhal_ctx_set_user_data (volume_monitor_daemon->hal_ctx, |
299 |
hal_userdata); |
258 |
hal_userdata); |
300 |
return TRUE; |
259 |
return TRUE; |
301 |
} |
260 |
} |
Lines 304-316
void
Link Here
|
304 |
_gnome_vfs_hal_mounts_shutdown (GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon) |
263 |
_gnome_vfs_hal_mounts_shutdown (GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon) |
305 |
{ |
264 |
{ |
306 |
GnomeVFSHalUserData *hal_userdata; |
265 |
GnomeVFSHalUserData *hal_userdata; |
|
|
266 |
DBusError error; |
267 |
|
268 |
hal_userdata = (GnomeVFSHalUserData *) libhal_ctx_get_user_data (volume_monitor_daemon->hal_ctx); |
269 |
libhal_storage_policy_free (hal_userdata->hal_storage_policy); |
307 |
|
270 |
|
308 |
hal_userdata = (GnomeVFSHalUserData *) hal_ctx_get_user_data (volume_monitor_daemon->hal_ctx); |
271 |
dbus_error_init (&error); |
309 |
hal_storage_policy_free (hal_userdata->hal_storage_policy); |
272 |
if (!libhal_ctx_shutdown (volume_monitor_daemon->hal_ctx, &error)) { |
|
|
273 |
g_warning ("hal_shutdown failed: %s\n", error.message); |
274 |
dbus_error_free (&error); |
275 |
return; |
276 |
} |
310 |
|
277 |
|
311 |
if (hal_shutdown (volume_monitor_daemon->hal_ctx) != 0) { |
278 |
if (!libhal_ctx_free (volume_monitor_daemon->hal_ctx)) { |
312 |
g_warning ("hal_shutdown failed\n"); |
279 |
g_warning ("hal_shutdown failed - unable to free hal context\n"); |
313 |
} |
280 |
} |
|
|
281 |
|
314 |
} |
282 |
} |
315 |
|
283 |
|
316 |
/**************************************************************************/ |
284 |
/**************************************************************************/ |
Lines 330-339
_gnome_vfs_hal_mounts_modify_drive (Gnom
Link Here
|
330 |
char *drive_icon; |
298 |
char *drive_icon; |
331 |
char *unique_drive_name; |
299 |
char *unique_drive_name; |
332 |
LibHalContext *hal_ctx; |
300 |
LibHalContext *hal_ctx; |
333 |
HalDrive *hal_drive; |
301 |
LibHalDrive *hal_drive; |
334 |
HalVolume *hal_volume; |
302 |
LibHalVolume *hal_volume; |
335 |
GnomeVFSHalUserData *hal_userdata; |
303 |
GnomeVFSHalUserData *hal_userdata; |
336 |
HalStoragePolicy *hal_storage_policy; |
304 |
LibHalStoragePolicy *hal_storage_policy; |
337 |
char *target_mount_point; |
305 |
char *target_mount_point; |
338 |
|
306 |
|
339 |
hal_drive = NULL; |
307 |
hal_drive = NULL; |
Lines 342-348
_gnome_vfs_hal_mounts_modify_drive (Gnom
Link Here
|
342 |
if ((hal_ctx = volume_monitor_daemon->hal_ctx) == NULL) |
310 |
if ((hal_ctx = volume_monitor_daemon->hal_ctx) == NULL) |
343 |
goto out; |
311 |
goto out; |
344 |
|
312 |
|
345 |
hal_userdata = (GnomeVFSHalUserData *) hal_ctx_get_user_data (hal_ctx); |
313 |
hal_userdata = (GnomeVFSHalUserData *) libhal_ctx_get_user_data (hal_ctx); |
346 |
hal_storage_policy = hal_userdata->hal_storage_policy; |
314 |
hal_storage_policy = hal_userdata->hal_storage_policy; |
347 |
|
315 |
|
348 |
if (drive == NULL || drive->priv == NULL || drive->priv->device_path == NULL) |
316 |
if (drive == NULL || drive->priv == NULL || drive->priv->device_path == NULL) |
Lines 352-372
_gnome_vfs_hal_mounts_modify_drive (Gnom
Link Here
|
352 |
* /dev/sda1 etc, however we get the Drive object for the parent if |
320 |
* /dev/sda1 etc, however we get the Drive object for the parent if |
353 |
* that is the case. This is a feature of libhal-storage. |
321 |
* that is the case. This is a feature of libhal-storage. |
354 |
*/ |
322 |
*/ |
355 |
if ((hal_drive = hal_drive_from_device_file (hal_ctx, drive->priv->device_path)) == NULL) { |
323 |
if ((hal_drive = libhal_drive_from_device_file (hal_ctx, drive->priv->device_path)) == NULL) { |
356 |
g_warning ("%s: no hal drive for device=%s", __FUNCTION__, drive->priv->device_path); |
324 |
g_warning ("%s: no hal drive for device=%s", __FUNCTION__, drive->priv->device_path); |
357 |
goto out; |
325 |
goto out; |
358 |
} |
326 |
} |
359 |
|
327 |
|
360 |
/* There may not be a volume object associated, so hal_volume may be NULL */ |
328 |
/* There may not be a volume object associated, so hal_volume may be NULL */ |
361 |
hal_volume = hal_volume_from_device_file (hal_ctx, drive->priv->device_path); |
329 |
hal_volume = libhal_volume_from_device_file (hal_ctx, drive->priv->device_path); |
362 |
|
330 |
|
363 |
/* For optical discs, we manually add/remove GnomeVFSVolume optical discs without |
331 |
/* For optical discs, we manually add/remove GnomeVFSVolume optical discs without |
364 |
* data (e.g. blank and pure audio) since these don't appear in the mounted filesystems |
332 |
* data (e.g. blank and pure audio) since these don't appear in the mounted filesystems |
365 |
* file /etc/mtab |
333 |
* file /etc/mtab |
366 |
*/ |
334 |
*/ |
367 |
if (hal_volume != NULL && |
335 |
if (hal_volume != NULL && |
368 |
hal_drive_get_type (hal_drive) == HAL_DRIVE_TYPE_CDROM && |
336 |
libhal_drive_get_type (hal_drive) == LIBHAL_DRIVE_TYPE_CDROM && |
369 |
hal_volume_is_disc (hal_volume) && !hal_volume_disc_has_data (hal_volume)) { |
337 |
libhal_volume_is_disc (hal_volume) && !libhal_volume_disc_has_data (hal_volume)) { |
370 |
GnomeVFSVolume *volume; |
338 |
GnomeVFSVolume *volume; |
371 |
char *volume_name; |
339 |
char *volume_name; |
372 |
char *volume_icon; |
340 |
char *volume_icon; |
Lines 377-411
_gnome_vfs_hal_mounts_modify_drive (Gnom
Link Here
|
377 |
gnome_vfs_volume_unref (volume); |
345 |
gnome_vfs_volume_unref (volume); |
378 |
} else { |
346 |
} else { |
379 |
|
347 |
|
380 |
volume_name = hal_volume_policy_compute_display_name ( |
348 |
volume_name = libhal_volume_policy_compute_display_name ( |
381 |
hal_drive, hal_volume, hal_storage_policy); |
349 |
hal_drive, hal_volume, hal_storage_policy); |
382 |
|
350 |
|
383 |
/* set icon name; try dedicated icon name first... */ |
351 |
/* set icon name; try dedicated icon name first... */ |
384 |
if (hal_drive_get_dedicated_icon_volume (hal_drive) != NULL) |
352 |
if (libhal_drive_get_dedicated_icon_volume (hal_drive) != NULL) |
385 |
volume_icon = strdup (hal_drive_get_dedicated_icon_volume (hal_drive)); |
353 |
volume_icon = strdup (libhal_drive_get_dedicated_icon_volume (hal_drive)); |
386 |
else |
354 |
else |
387 |
volume_icon = hal_volume_policy_compute_icon_name ( |
355 |
volume_icon = libhal_volume_policy_compute_icon_name ( |
388 |
hal_drive, hal_volume, hal_storage_policy); |
356 |
hal_drive, hal_volume, hal_storage_policy); |
389 |
|
357 |
|
390 |
volume = g_object_new (GNOME_VFS_TYPE_VOLUME, NULL); |
358 |
volume = g_object_new (GNOME_VFS_TYPE_VOLUME, NULL); |
391 |
volume->priv->hal_udi = g_strdup (hal_volume_get_udi (hal_volume)); |
359 |
volume->priv->hal_udi = g_strdup (libhal_volume_get_udi (hal_volume)); |
392 |
volume->priv->volume_type = GNOME_VFS_VOLUME_TYPE_MOUNTPOINT; |
360 |
volume->priv->volume_type = GNOME_VFS_VOLUME_TYPE_MOUNTPOINT; |
393 |
|
361 |
|
394 |
if (hal_volume_disc_is_blank (hal_volume)) { |
362 |
if (libhal_volume_disc_is_blank (hal_volume)) { |
395 |
/* Blank discs should open the burn:/// location */ |
363 |
/* Blank discs should open the burn:/// location */ |
396 |
volume->priv->device_path = g_strdup (hal_volume_get_device_file (hal_volume)); |
364 |
volume->priv->device_path = g_strdup (libhal_volume_get_device_file (hal_volume)); |
397 |
volume->priv->activation_uri = g_strdup ("burn:///"); |
365 |
volume->priv->activation_uri = g_strdup ("burn:///"); |
398 |
volume->priv->unix_device = makedev (hal_volume_get_device_major (hal_volume), |
366 |
volume->priv->unix_device = makedev (libhal_volume_get_device_major (hal_volume), |
399 |
hal_volume_get_device_minor (hal_volume)); |
367 |
libhal_volume_get_device_minor (hal_volume)); |
400 |
volume->priv->filesystem_type = g_strdup (hal_volume_get_fstype (hal_volume)); |
368 |
volume->priv->filesystem_type = g_strdup (libhal_volume_get_fstype (hal_volume)); |
401 |
} else if (hal_volume_disc_has_audio (hal_volume)) { |
369 |
} else if (libhal_volume_disc_has_audio (hal_volume)) { |
402 |
/* Audio discs with data should open the cdda:///dev/cdrom location */ |
370 |
/* Audio discs with data should open the cdda:///dev/cdrom location */ |
403 |
volume->priv->device_path = g_strdup (hal_volume_get_device_file (hal_volume)); |
371 |
volume->priv->device_path = g_strdup (libhal_volume_get_device_file (hal_volume)); |
404 |
volume->priv->activation_uri = g_strdup_printf ( |
372 |
volume->priv->activation_uri = g_strdup_printf ( |
405 |
"cdda://%s", hal_volume_get_device_file (hal_volume)); |
373 |
"cdda://%s", libhal_volume_get_device_file (hal_volume)); |
406 |
volume->priv->unix_device = makedev (hal_volume_get_device_major (hal_volume), |
374 |
volume->priv->unix_device = makedev (libhal_volume_get_device_major (hal_volume), |
407 |
hal_volume_get_device_minor (hal_volume)); |
375 |
libhal_volume_get_device_minor (hal_volume)); |
408 |
volume->priv->filesystem_type = g_strdup (hal_volume_get_fstype (hal_volume)); |
376 |
volume->priv->filesystem_type = g_strdup (libhal_volume_get_fstype (hal_volume)); |
409 |
} |
377 |
} |
410 |
|
378 |
|
411 |
volume->priv->is_read_only = TRUE; |
379 |
volume->priv->is_read_only = TRUE; |
Lines 419-424
_gnome_vfs_hal_mounts_modify_drive (Gnom
Link Here
|
419 |
volume->priv->is_user_visible = TRUE; |
387 |
volume->priv->is_user_visible = TRUE; |
420 |
|
388 |
|
421 |
volume->priv->drive = drive; |
389 |
volume->priv->drive = drive; |
|
|
390 |
|
422 |
_gnome_vfs_drive_add_mounted_volume (drive, volume); |
391 |
_gnome_vfs_drive_add_mounted_volume (drive, volume); |
423 |
|
392 |
|
424 |
_gnome_vfs_volume_monitor_mounted (GNOME_VFS_VOLUME_MONITOR (volume_monitor_daemon), volume); |
393 |
_gnome_vfs_volume_monitor_mounted (GNOME_VFS_VOLUME_MONITOR (volume_monitor_daemon), volume); |
Lines 427-433
_gnome_vfs_hal_mounts_modify_drive (Gnom
Link Here
|
427 |
free (volume_name); |
396 |
free (volume_name); |
428 |
free (volume_icon); |
397 |
free (volume_icon); |
429 |
} |
398 |
} |
430 |
} else if (hal_volume == NULL && hal_drive_get_type (hal_drive) == HAL_DRIVE_TYPE_CDROM) { |
399 |
} else if (hal_volume == NULL && libhal_drive_get_type (hal_drive) == LIBHAL_DRIVE_TYPE_CDROM) { |
431 |
GnomeVFSVolume *volume; |
400 |
GnomeVFSVolume *volume; |
432 |
|
401 |
|
433 |
/* Remove GnomeVFSVolume with same device file */ |
402 |
/* Remove GnomeVFSVolume with same device file */ |
Lines 444-453
_gnome_vfs_hal_mounts_modify_drive (Gnom
Link Here
|
444 |
goto out; |
413 |
goto out; |
445 |
|
414 |
|
446 |
/* set whether we need to eject */ |
415 |
/* set whether we need to eject */ |
447 |
drive->priv->must_eject_at_unmount = hal_drive_requires_eject (hal_drive); |
416 |
drive->priv->must_eject_at_unmount = libhal_drive_requires_eject (hal_drive); |
448 |
|
417 |
|
449 |
/* set display name */ |
418 |
/* set display name */ |
450 |
drive_name = hal_drive_policy_compute_display_name (hal_drive, hal_volume, hal_storage_policy); |
419 |
drive_name = libhal_drive_policy_compute_display_name (hal_drive, hal_volume, hal_storage_policy); |
451 |
unique_drive_name = _gnome_vfs_volume_monitor_uniquify_drive_name ( |
420 |
unique_drive_name = _gnome_vfs_volume_monitor_uniquify_drive_name ( |
452 |
GNOME_VFS_VOLUME_MONITOR (volume_monitor_daemon), drive_name); |
421 |
GNOME_VFS_VOLUME_MONITOR (volume_monitor_daemon), drive_name); |
453 |
if (drive->priv->display_name != NULL) |
422 |
if (drive->priv->display_name != NULL) |
Lines 456-465
_gnome_vfs_hal_mounts_modify_drive (Gnom
Link Here
|
456 |
free (drive_name); |
425 |
free (drive_name); |
457 |
|
426 |
|
458 |
/* set icon name; try dedicated icon name first... */ |
427 |
/* set icon name; try dedicated icon name first... */ |
459 |
if (hal_drive_get_dedicated_icon_drive (hal_drive) != NULL) |
428 |
if (libhal_drive_get_dedicated_icon_drive (hal_drive) != NULL) |
460 |
drive_icon = strdup (hal_drive_get_dedicated_icon_drive (hal_drive)); |
429 |
drive_icon = strdup (libhal_drive_get_dedicated_icon_drive (hal_drive)); |
461 |
else |
430 |
else |
462 |
drive_icon = hal_drive_policy_compute_icon_name (hal_drive, hal_volume, hal_storage_policy); |
431 |
drive_icon = libhal_drive_policy_compute_icon_name (hal_drive, hal_volume, hal_storage_policy); |
463 |
if (drive->priv->icon != NULL) |
432 |
if (drive->priv->icon != NULL) |
464 |
g_free (drive->priv->icon); |
433 |
g_free (drive->priv->icon); |
465 |
drive->priv->icon = g_strdup (drive_icon); |
434 |
drive->priv->icon = g_strdup (drive_icon); |
Lines 469-475
_gnome_vfs_hal_mounts_modify_drive (Gnom
Link Here
|
469 |
target_mount_point = NULL; |
438 |
target_mount_point = NULL; |
470 |
if (hal_volume != NULL) { |
439 |
if (hal_volume != NULL) { |
471 |
const char *str; |
440 |
const char *str; |
472 |
str = hal_volume_get_mount_point (hal_volume); |
441 |
str = libhal_volume_get_mount_point (hal_volume); |
473 |
if (str != NULL) |
442 |
if (str != NULL) |
474 |
target_mount_point = g_strdup (str); |
443 |
target_mount_point = g_strdup (str); |
475 |
} |
444 |
} |
Lines 479-496
_gnome_vfs_hal_mounts_modify_drive (Gnom
Link Here
|
479 |
target_mount_point = gnome_vfs_get_local_path_from_uri (drive->priv->activation_uri); |
448 |
target_mount_point = gnome_vfs_get_local_path_from_uri (drive->priv->activation_uri); |
480 |
|
449 |
|
481 |
/* if we don't use removable media and the volume shouldn't be visible, then hide the drive */ |
450 |
/* if we don't use removable media and the volume shouldn't be visible, then hide the drive */ |
482 |
if(!hal_drive_uses_removable_media (hal_drive) && |
451 |
if(!libhal_drive_uses_removable_media (hal_drive) && |
483 |
!hal_volume_policy_should_be_visible (hal_drive, hal_volume, hal_storage_policy, target_mount_point)) |
452 |
!libhal_volume_policy_should_be_visible (hal_drive, hal_volume, hal_storage_policy, target_mount_point)) |
484 |
drive->priv->is_user_visible = FALSE; |
453 |
drive->priv->is_user_visible = FALSE; |
485 |
|
454 |
|
486 |
g_free (target_mount_point); |
455 |
g_free (target_mount_point); |
487 |
|
456 |
|
488 |
/* set hal udi */ |
457 |
/* set hal udi */ |
489 |
drive->priv->hal_udi = g_strdup (hal_drive_get_udi (hal_drive)); |
458 |
drive->priv->hal_udi = g_strdup (libhal_drive_get_udi (hal_drive)); |
490 |
|
459 |
|
491 |
out: |
460 |
out: |
492 |
hal_volume_free (hal_volume); |
461 |
libhal_volume_free (hal_volume); |
493 |
hal_drive_free (hal_drive); |
462 |
libhal_drive_free (hal_drive); |
494 |
} |
463 |
} |
495 |
|
464 |
|
496 |
void |
465 |
void |
Lines 501-510
_gnome_vfs_hal_mounts_modify_volume (Gno
Link Here
|
501 |
char *volume_icon; |
470 |
char *volume_icon; |
502 |
char *unique_volume_name; |
471 |
char *unique_volume_name; |
503 |
LibHalContext *hal_ctx; |
472 |
LibHalContext *hal_ctx; |
504 |
HalDrive *hal_drive; |
473 |
LibHalDrive *hal_drive; |
505 |
HalVolume *hal_volume; |
474 |
LibHalVolume *hal_volume; |
506 |
GnomeVFSHalUserData *hal_userdata; |
475 |
GnomeVFSHalUserData *hal_userdata; |
507 |
HalStoragePolicy *hal_storage_policy; |
476 |
LibHalStoragePolicy *hal_storage_policy; |
508 |
char *target_mount_point; |
477 |
char *target_mount_point; |
509 |
|
478 |
|
510 |
hal_volume = NULL; |
479 |
hal_volume = NULL; |
Lines 515-521
_gnome_vfs_hal_mounts_modify_volume (Gno
Link Here
|
515 |
if (volume == NULL || volume->priv == NULL || volume->priv->device_path == NULL) |
484 |
if (volume == NULL || volume->priv == NULL || volume->priv->device_path == NULL) |
516 |
goto out; |
485 |
goto out; |
517 |
|
486 |
|
518 |
hal_userdata = (GnomeVFSHalUserData *) hal_ctx_get_user_data (hal_ctx); |
487 |
hal_userdata = (GnomeVFSHalUserData *) libhal_ctx_get_user_data (hal_ctx); |
519 |
hal_storage_policy = hal_userdata->hal_storage_policy; |
488 |
hal_storage_policy = hal_userdata->hal_storage_policy; |
520 |
|
489 |
|
521 |
/* Now, modify the drive with the hal stuff, unless we've already done so */ |
490 |
/* Now, modify the drive with the hal stuff, unless we've already done so */ |
Lines 526-542
_gnome_vfs_hal_mounts_modify_volume (Gno
Link Here
|
526 |
* /dev/sda1 etc, however we get the Drive object for the parent if |
495 |
* /dev/sda1 etc, however we get the Drive object for the parent if |
527 |
* that is the case. This is a feature of libhal-storage. |
496 |
* that is the case. This is a feature of libhal-storage. |
528 |
*/ |
497 |
*/ |
529 |
if ((hal_drive = hal_drive_from_device_file (hal_ctx, volume->priv->device_path)) == NULL) { |
498 |
if ((hal_drive = libhal_drive_from_device_file (hal_ctx, volume->priv->device_path)) == NULL) { |
530 |
g_warning ("%s: no hal drive for device=%s", __FUNCTION__, volume->priv->device_path); |
499 |
g_warning ("%s: no hal drive for device=%s", __FUNCTION__, volume->priv->device_path); |
531 |
goto out; |
500 |
goto out; |
532 |
} |
501 |
} |
533 |
if ((hal_volume = hal_volume_from_device_file (hal_ctx, volume->priv->device_path)) == NULL) { |
502 |
if ((hal_volume = libhal_volume_from_device_file (hal_ctx, volume->priv->device_path)) == NULL) { |
534 |
g_warning ("%s: no hal volume for device=%s", __FUNCTION__, volume->priv->device_path); |
503 |
g_warning ("%s: no hal volume for device=%s", __FUNCTION__, volume->priv->device_path); |
535 |
goto out; |
504 |
goto out; |
536 |
} |
505 |
} |
537 |
|
506 |
|
538 |
/* set display name */ |
507 |
/* set display name */ |
539 |
volume_name = hal_volume_policy_compute_display_name (hal_drive, hal_volume, hal_storage_policy); |
508 |
volume_name = libhal_volume_policy_compute_display_name (hal_drive, hal_volume, hal_storage_policy); |
540 |
unique_volume_name = _gnome_vfs_volume_monitor_uniquify_volume_name ( |
509 |
unique_volume_name = _gnome_vfs_volume_monitor_uniquify_volume_name ( |
541 |
GNOME_VFS_VOLUME_MONITOR (volume_monitor_daemon), volume_name); |
510 |
GNOME_VFS_VOLUME_MONITOR (volume_monitor_daemon), volume_name); |
542 |
if (volume->priv->display_name != NULL) |
511 |
if (volume->priv->display_name != NULL) |
Lines 545-554
_gnome_vfs_hal_mounts_modify_volume (Gno
Link Here
|
545 |
free (volume_name); |
514 |
free (volume_name); |
546 |
|
515 |
|
547 |
/* set icon name; try dedicated icon name first... */ |
516 |
/* set icon name; try dedicated icon name first... */ |
548 |
if (hal_drive_get_dedicated_icon_volume (hal_drive) != NULL) |
517 |
if (libhal_drive_get_dedicated_icon_volume (hal_drive) != NULL) |
549 |
volume_icon = strdup (hal_drive_get_dedicated_icon_volume (hal_drive)); |
518 |
volume_icon = strdup (libhal_drive_get_dedicated_icon_volume (hal_drive)); |
550 |
else |
519 |
else |
551 |
volume_icon = hal_volume_policy_compute_icon_name (hal_drive, hal_volume, hal_storage_policy); |
520 |
volume_icon = libhal_volume_policy_compute_icon_name (hal_drive, hal_volume, hal_storage_policy); |
552 |
if (volume->priv->icon != NULL) |
521 |
if (volume->priv->icon != NULL) |
553 |
g_free (volume->priv->icon); |
522 |
g_free (volume->priv->icon); |
554 |
volume->priv->icon = g_strdup (volume_icon); |
523 |
volume->priv->icon = g_strdup (volume_icon); |
Lines 558-564
_gnome_vfs_hal_mounts_modify_volume (Gno
Link Here
|
558 |
target_mount_point = NULL; |
527 |
target_mount_point = NULL; |
559 |
{ |
528 |
{ |
560 |
const char *str; |
529 |
const char *str; |
561 |
str = hal_volume_get_mount_point (hal_volume); |
530 |
str = libhal_volume_get_mount_point (hal_volume); |
562 |
if (str != NULL) |
531 |
if (str != NULL) |
563 |
target_mount_point = g_strdup (str); |
532 |
target_mount_point = g_strdup (str); |
564 |
} |
533 |
} |
Lines 569-584
_gnome_vfs_hal_mounts_modify_volume (Gno
Link Here
|
569 |
|
538 |
|
570 |
/* set whether it's visible on the desktop */ |
539 |
/* set whether it's visible on the desktop */ |
571 |
volume->priv->is_user_visible = |
540 |
volume->priv->is_user_visible = |
572 |
hal_volume_policy_should_be_visible (hal_drive, hal_volume, hal_storage_policy, target_mount_point) && |
541 |
libhal_volume_policy_should_be_visible (hal_drive, hal_volume, hal_storage_policy, target_mount_point) && |
573 |
(hal_drive_is_hotpluggable (hal_drive) || hal_drive_uses_removable_media (hal_drive)); |
542 |
(libhal_drive_is_hotpluggable (hal_drive) || libhal_drive_uses_removable_media (hal_drive)); |
574 |
|
543 |
|
575 |
g_free (target_mount_point); |
544 |
g_free (target_mount_point); |
576 |
|
545 |
|
577 |
/* set hal udi */ |
546 |
/* set hal udi */ |
578 |
volume->priv->hal_udi = g_strdup (hal_volume_get_udi (hal_volume)); |
547 |
volume->priv->hal_udi = g_strdup (libhal_volume_get_udi (hal_volume)); |
579 |
out: |
548 |
out: |
580 |
hal_drive_free (hal_drive); |
549 |
libhal_drive_free (hal_drive); |
581 |
hal_volume_free (hal_volume); |
550 |
libhal_volume_free (hal_volume); |
582 |
} |
551 |
} |
583 |
|
552 |
|
584 |
#endif /* USE_HAL */ |
553 |
#endif /* USE_HAL */ |