[Goodies-commits] r5190 - xfburn/trunk/xfburn
David Mohr
squisher at xfce.org
Sun Aug 3 22:01:29 CEST 2008
Author: squisher
Date: 2008-08-03 20:01:29 +0000 (Sun, 03 Aug 2008)
New Revision: 5190
Modified:
xfburn/trunk/xfburn/xfburn-device-box.c
xfburn/trunk/xfburn/xfburn-device-list.c
xfburn/trunk/xfburn/xfburn-main.c
xfburn/trunk/xfburn/xfburn-perform-burn.c
Log:
Little bit of code cleanup
Modified: xfburn/trunk/xfburn/xfburn-device-box.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-device-box.c 2008-08-03 02:59:13 UTC (rev 5189)
+++ xfburn/trunk/xfburn/xfburn-device-box.c 2008-08-03 20:01:29 UTC (rev 5190)
@@ -627,7 +627,9 @@
if (!priv->valid_disc) {
priv->status_text = _("Drive can't burn on the inserted disc!");
} else {
- priv->valid_disc = (disc_status == BURN_DISC_BLANK) || (disc_status == BURN_DISC_APPENDABLE);
+ priv->valid_disc = (disc_status == BURN_DISC_BLANK);
+ /* Not sure if we support appending yet, so let's disable it for the time being
+ * || (disc_status == BURN_DISC_APPENDABLE); */
if (!priv->valid_disc) {
switch (disc_status) {
@@ -656,8 +658,8 @@
if (!priv->valid_disc && disc_status == BURN_DISC_FULL && is_erasable) {
g_idle_add ((GSourceFunc) ask_for_blanking, priv);
}
- } else {
- /* for blanking */
+ }
+ else { /* priv->blank_mode == TRUE */
priv->valid_disc = is_erasable && (disc_status != BURN_DISC_BLANK);
if (!priv->valid_disc) {
Modified: xfburn/trunk/xfburn/xfburn-device-list.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-device-list.c 2008-08-03 02:59:13 UTC (rev 5189)
+++ xfburn/trunk/xfburn/xfburn-device-list.c 2008-08-03 20:01:29 UTC (rev 5190)
@@ -81,35 +81,15 @@
return GPOINTER_TO_INT(a) - GPOINTER_TO_INT(b);
}
-/* FIXME: rename function, as it is doing more than refresh speed */
static void
-refresh_supported_speeds (XfburnDevice * device, struct burn_drive_info *drive_info)
+refresh_disc (XfburnDevice * device, struct burn_drive_info *drive_info)
{
- struct burn_speed_descriptor *speed_list = NULL;
gint ret;
- /*
- int status, num_formats;
- off_t size;
- unsigned bl_sas;
- int i;
- */
- /* empty previous list */
- g_slist_free (device->supported_cdr_speeds);
- device->supported_cdr_speeds = NULL;
-
/* check if there is a disc in the drive */
while ((disc_status = burn_disc_get_status (drive_info->drive)) == BURN_DISC_UNREADY)
usleep(100001);
- /* libburn docs say we might need to check more than once,
- * but that's probably covered by the loop above */
- /*
- for (i=0; i<2; i++) {
- usleep(100001);
- disc_status = burn_disc_get_status (drive_info->drive);
- }
- */
DBG ("disc_status = %d", disc_status);
if ((ret = burn_disc_get_profile(drive_info->drive, &profile_no, profile_name)) != 1) {
@@ -117,30 +97,14 @@
}
is_erasable = burn_disc_erasable (drive_info->drive);
DBG ("profile_no = 0x%x (%s), %s erasable", profile_no, profile_name, (is_erasable ? "" : "NOT"));
+}
- if (ret == 1 && profile_no == 0 && is_erasable && disc_status == 6) {
- DBG ("work around bug in my drive or libburn: disc is a full DVD-RW sequential");
- profile_no = XFBURN_PROFILE_DVD_MINUS_RW_SEQUENTIAL;
- disc_status = BURN_DISC_FULL;
- strcpy (profile_name, "(?) DVD-RW sequiential");
- }
+static void
+refresh_speed_list (XfburnDevice * device, struct burn_drive_info *drive_info)
+{
+ struct burn_speed_descriptor *speed_list = NULL;
+ gint ret;
- /*
- ret = burn_disc_get_formats (drive_info->drive, &status, &size, &bl_sas, &num_formats);
- DBG ("_get_formats (%d) = %d, %llu, %d, %d", ret, status, size, bl_sas, num_formats);
- for (i=0; i<num_formats; i++) {
- int type;
- ret = burn_disc_get_format_descr (drive_info->drive, i, &type, &size, &bl_sas);
- DBG ("_get_format_descr (%d) = 0x%x, %llu, %u", ret, type, size, bl_sas);
- }
- */
-
-
- if (!(disc_status == BURN_DISC_BLANK || disc_status == BURN_DISC_APPENDABLE)) {
- DBG ("no writable / appendable disc found in drive, speed list not updated");
- return;
- }
-
/* fill new list */
ret = burn_drive_get_speedlist (drive_info->drive, &speed_list);
/* speed_list = NULL; DEBUG */
@@ -165,6 +129,7 @@
g_warning ("reported speed list is empty for device:");
g_warning (DEVICE_INFO_PRINTF);
} else {
+ /* ret < 0 */
g_error ("severe error while retrieving speed list");
}
}
@@ -215,9 +180,13 @@
/* reset other internal structures */
profile_no = 0;
- *profile_name = 0;
+ *profile_name = '\0';
is_erasable = 0;
+ /* empty previous speed list */
+ g_slist_free (device->supported_cdr_speeds);
+ device->supported_cdr_speeds = NULL;
+
if (!burn_initialize ()) {
g_critical ("Unable to initialize libburn");
return FALSE;
@@ -229,7 +198,8 @@
disc_status = BURN_DISC_UNGRABBED;
} else {
ret = TRUE;
- refresh_supported_speeds (device, drive_info);
+ refresh_disc (device, drive_info);
+ refresh_speed_list (device, drive_info);
burn_drive_release (drive_info->drive, 0);
}
Modified: xfburn/trunk/xfburn/xfburn-main.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-main.c 2008-08-03 02:59:13 UTC (rev 5189)
+++ xfburn/trunk/xfburn/xfburn-main.c 2008-08-03 20:01:29 UTC (rev 5190)
@@ -178,7 +178,7 @@
n_drives = xfburn_device_list_init ();
#if 0
#ifdef HAVE_THUNAR_VFS
- if (n_drives < 3) {
+ if (n_drives < 1) {
//XfburnHalManager *halman = xfburn_hal_manager_get_instance();
ThunarVfsVolumeManager *volman;
GList *volume_list;
Modified: xfburn/trunk/xfburn/xfburn-perform-burn.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-perform-burn.c 2008-08-03 02:59:13 UTC (rev 5189)
+++ xfburn/trunk/xfburn/xfburn-perform-burn.c 2008-08-03 20:01:29 UTC (rev 5190)
@@ -95,8 +95,10 @@
xfburn_progress_dialog_burning_failed (XFBURN_PROGRESS_DIALOG (dialog_progress), _("Closed media with data detected. Need blank or appendable media"));
else if (disc_state == BURN_DISC_EMPTY)
xfburn_progress_dialog_burning_failed (XFBURN_PROGRESS_DIALOG (dialog_progress), _("No media detected in drive"));
- else
+ else {
+ g_warning ("Cannot recognize state of drive and media: disc_state = %d", disc_state);
xfburn_progress_dialog_burning_failed (XFBURN_PROGRESS_DIALOG (dialog_progress), _("Cannot recognize state of drive and media"));
+ }
return;
}
More information about the Goodies-commits
mailing list