[Goodies-commits] r4557 - xfburn/trunk/xfburn
David Mohr
squisher at xfce.org
Mon Apr 14 01:21:56 CEST 2008
Author: squisher
Date: 2008-04-13 23:21:56 +0000 (Sun, 13 Apr 2008)
New Revision: 4557
Modified:
xfburn/trunk/xfburn/xfburn-device-box.c
xfburn/trunk/xfburn/xfburn-device-list.c
Log:
Adding label to notify user that no disc is inserted in the drive
Modified: xfburn/trunk/xfburn/xfburn-device-box.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-device-box.c 2008-04-13 23:16:07 UTC (rev 4556)
+++ xfburn/trunk/xfburn/xfburn-device-box.c 2008-04-13 23:21:56 UTC (rev 4557)
@@ -71,6 +71,8 @@
GtkWidget *hbox_speed_selection;
GtkWidget *combo_speed;
+ GtkWidget *status_label;
+
GtkWidget *hbox_mode_selection;
GtkWidget *combo_mode;
} XfburnDeviceBoxPrivate;
@@ -227,6 +229,12 @@
gtk_widget_show (priv->combo_mode);
gtk_box_pack_start (GTK_BOX (priv->hbox_mode_selection), priv->combo_mode, TRUE, TRUE, BORDER);
+ /* status label */
+ priv->status_label = gtk_label_new ("");
+ gtk_widget_show (priv->status_label);
+ gtk_box_pack_start (GTK_BOX (box), priv->status_label, FALSE, FALSE, 0);
+
+
g_signal_connect (G_OBJECT (priv->combo_device), "changed", G_CALLBACK (cb_combo_device_changed), box);
gtk_combo_box_set_active (GTK_COMBO_BOX (priv->combo_device), 0);
}
@@ -293,6 +301,13 @@
gtk_list_store_clear (GTK_LIST_STORE (model));
+ if (el == NULL) {
+ gtk_label_set_markup (GTK_LABEL(priv->status_label), _("<span weight=\"bold\">No media in drive</span>"));
+ return;
+ } else {
+ gtk_label_set_text (GTK_LABEL(priv->status_label), "");
+ }
+
while (el) {
gint speed = GPOINTER_TO_INT (el->data);
GtkTreeIter iter;
Modified: xfburn/trunk/xfburn/xfburn-device-list.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-device-list.c 2008-04-13 23:16:07 UTC (rev 4556)
+++ xfburn/trunk/xfburn/xfburn-device-list.c 2008-04-13 23:21:56 UTC (rev 4557)
@@ -68,7 +68,8 @@
}
/* sort the speed list in ascending order */
-static gint cmp_ints (gconstpointer a, gconstpointer b)
+static gint
+cmp_ints (gconstpointer a, gconstpointer b)
{
return GPOINTER_TO_INT(a) - GPOINTER_TO_INT(b);
}
@@ -81,11 +82,32 @@
int media_no;
int factor;
gint ret;
+ enum burn_disc_status disc_status;
+ //int i;
/* empty previous list */
g_slist_free (device->supported_cdr_speeds);
device->supported_cdr_speeds = NULL;
+ /* check if there is media 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);
+ }
+ */
+
+ if (!(disc_status == BURN_DISC_BLANK || disc_status == BURN_DISC_APPENDABLE)) {
+ DBG ("disc_status = %d", disc_status);
+ g_warning ("no suitable disc found in drive");
+ return;
+ }
+
/* fill new list */
ret = burn_drive_get_speedlist (drive_info->drive, &speed_list);
@@ -123,8 +145,6 @@
device->supported_cdr_speeds = g_slist_sort (device->supported_cdr_speeds, &cmp_ints);
} else if (ret == 0) {
g_warning ("reported speed list is empty");
-
- device->supported_cdr_speeds = g_slist_prepend (device->supported_cdr_speeds, GINT_TO_POINTER (0));
} else {
g_error ("severe error while retrieving speed list");
}
@@ -208,7 +228,11 @@
if (ret <= 0)
g_error ("Unable to get drive %s address (ret=%d). Please report this problem to libburn-hackers at pykix.org", device->name, ret);
- refresh_supported_speeds (device, &(drives[i]));
+ if (burn_drive_grab (drives[i].drive, 1) == 1) {
+ refresh_supported_speeds (device, &(drives[i]));
+ burn_drive_release (drives[i].drive, 0);
+ } else
+ g_warning ("Failed to grab drive %s, did not refresh speed list", device->name);
devices = g_list_append (devices, device);
}
More information about the Goodies-commits
mailing list