nautilus-cd-burner r2143 - in trunk: . src
- From: mccann svn gnome org
- To: svn-commits-list gnome org
- Subject: nautilus-cd-burner r2143 - in trunk: . src
- Date: Tue, 29 Jan 2008 02:20:32 +0000 (GMT)
Author: mccann
Date: Tue Jan 29 02:20:32 2008
New Revision: 2143
URL: http://svn.gnome.org/viewvc/nautilus-cd-burner?rev=2143&view=rev
Log:
2008-01-28 William Jon McCann <mccann jhu edu>
* src/burn-extension.c: (volume_is_blank), (drive_is_cd_device),
(nautilus_burn_get_file_items):
Properly check HAL to see if we have a disc to copy.
Modified:
trunk/ChangeLog
trunk/src/burn-extension.c
Modified: trunk/src/burn-extension.c
==============================================================================
--- trunk/src/burn-extension.c (original)
+++ trunk/src/burn-extension.c Tue Jan 29 02:20:32 2008
@@ -314,10 +314,10 @@
}
static gboolean
-_is_blank (GFileInfo *info)
+volume_is_blank (GVolume *volume)
{
LibHalContext *ctx;
- const char *udi;
+ char *udi;
gboolean is_blank;
ctx = get_hal_context ();
@@ -327,13 +327,14 @@
is_blank = FALSE;
- udi = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_MOUNTABLE_HAL_UDI);
+ udi = g_volume_get_identifier (volume, G_VOLUME_IDENTIFIER_KIND_HAL_UDI);
if (udi != NULL) {
is_blank = libhal_device_get_property_bool (ctx,
udi,
"volume.disc.is_blank",
NULL);
}
+ g_free (udi);
return is_blank;
}
@@ -359,10 +360,34 @@
}
static gboolean
-_is_cd_device (GFileInfo *info)
+drive_is_cd_device (GDrive *drive)
{
- /* FIXME: */
- return TRUE;
+ LibHalContext *ctx;
+ char *udi;
+ gboolean is_cd;
+
+ ctx = get_hal_context ();
+ if (ctx == NULL) {
+ return FALSE;
+ }
+
+ is_cd = FALSE;
+
+ udi = g_drive_get_identifier (drive, G_VOLUME_IDENTIFIER_KIND_HAL_UDI);
+ if (udi != NULL) {
+ char *drive_type;
+ drive_type = libhal_device_get_property_string (ctx,
+ udi,
+ "storage.drive_type",
+ NULL);
+ if (drive_type != NULL && strcmp (drive_type, "cdrom")) {
+ is_cd = TRUE;
+ }
+ g_free (drive_type);
+ }
+ g_free (udi);
+
+ return is_cd;
}
static GList *
@@ -475,11 +500,11 @@
if (drive != NULL
&& volume != NULL
- && _is_cd_device (info)
- && !_is_blank (info)) {
- const char *device_path;
+ && drive_is_cd_device (drive)
+ && ! volume_is_blank (volume)) {
+ char *device_path;
- device_path = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_MOUNTABLE_UNIX_DEVICE);
+ device_path = g_volume_get_identifier (volume, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
item = nautilus_menu_item_new ("NautilusBurn::copy_disc",
_("_Copy Disc..."),
@@ -491,6 +516,8 @@
g_signal_connect (item, "activate",
G_CALLBACK (copy_disc_activate_cb), NULL);
items = g_list_append (items, item);
+
+ g_free (device_path);
}
if (drive != NULL) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]