[Xfce4-commits] r24265 - xfburn/branches/libburn_trial/xfburn
Jean-François Wauthy
pollux at xfce.org
Thu Jan 4 18:37:27 CET 2007
Author: pollux
Date: 2007-01-04 17:37:27 +0000 (Thu, 04 Jan 2007)
New Revision: 24265
Modified:
xfburn/branches/libburn_trial/xfburn/xfburn-blank-cd-dialog.c
xfburn/branches/libburn_trial/xfburn/xfburn-burn-image-dialog.c
xfburn/branches/libburn_trial/xfburn/xfburn-device-list.c
xfburn/branches/libburn_trial/xfburn/xfburn-progress-dialog.c
Log:
* basic image burning support
* fix cd blanking GUI
Modified: xfburn/branches/libburn_trial/xfburn/xfburn-blank-cd-dialog.c
===================================================================
--- xfburn/branches/libburn_trial/xfburn/xfburn-blank-cd-dialog.c 2007-01-04 10:42:01 UTC (rev 24264)
+++ xfburn/branches/libburn_trial/xfburn/xfburn-blank-cd-dialog.c 2007-01-04 17:37:27 UTC (rev 24265)
@@ -203,7 +203,7 @@
burn_disc_erase(drive, params->blank_type);
sleep(1);
- xfburn_progress_dialog_set_status_with_text (XFBURN_PROGRESS_DIALOG (dialog_progress), XFBURN_PROGRESS_DIALOG_STATUS_RUNNING, _("Blanking disc"));
+ xfburn_progress_dialog_set_status_with_text (XFBURN_PROGRESS_DIALOG (dialog_progress), XFBURN_PROGRESS_DIALOG_STATUS_RUNNING, _("Blanking disc..."));
while (burn_drive_get_status (drive, &progress) != BURN_DRIVE_IDLE) {
if(progress.sectors>0 && progress.sector>=0) {
Modified: xfburn/branches/libburn_trial/xfburn/xfburn-burn-image-dialog.c
===================================================================
--- xfburn/branches/libburn_trial/xfburn/xfburn-burn-image-dialog.c 2007-01-04 10:42:01 UTC (rev 24264)
+++ xfburn/branches/libburn_trial/xfburn/xfburn-burn-image-dialog.c 2007-01-04 17:37:27 UTC (rev 24265)
@@ -213,10 +213,9 @@
struct burn_write_opts * burn_options;
enum burn_disc_status disc_state;
struct burn_progress progress;
+ gboolean burning_has_started = FALSE;
gint ret;
- DBG ("starting the burning thread");
-
disc = burn_disc_create ();
session = burn_session_create ();
track = burn_track_create ();
@@ -251,7 +250,6 @@
}
burn_session_add_track (session, track, BURN_POS_END);
- DBG ("Source is '%s'\n", params->iso_path);
burn_source_free (data_src);
if (!xfburn_device_grab (params->device, &drive_info)) {
@@ -311,17 +309,29 @@
DBG ("TODO set speed");
burn_drive_set_speed (drive, 0, 0);
burn_write_opts_set_underrun_proof (burn_options, params->burnfree ? 1 : 0);
-
- burn_disc_write (burn_options, disc);
-
+
+ burn_disc_write (burn_options, disc);
burn_write_opts_free (burn_options);
+
+ xfburn_progress_dialog_set_status_with_text (XFBURN_PROGRESS_DIALOG (dialog_progress), XFBURN_PROGRESS_DIALOG_STATUS_RUNNING, _("Burning image..."));
+
while (burn_drive_get_status (drive, NULL) == BURN_DRIVE_SPAWNING)
usleep(1002);
while (burn_drive_get_status (drive, &progress) != BURN_DRIVE_IDLE) {
- DBG ("TODO progress: %d of %d", progress.sector, progress.sectors);
+ if (progress.sectors > 0 && progress.sector >= 0) {
+ gdouble percent = 1.0 + ((gdouble) progress.sector+1.0) / ((gdouble) progress.sectors) * 98.0;
+
+ burning_has_started = TRUE;
+ xfburn_progress_dialog_set_progress_bar_fraction (XFBURN_PROGRESS_DIALOG (dialog_progress), percent / 100.0);
+ } else if (burning_has_started && progress.sectors == 0) {
+ xfburn_progress_dialog_set_status_with_text (XFBURN_PROGRESS_DIALOG (dialog_progress), XFBURN_PROGRESS_DIALOG_STATUS_RUNNING, _("Finalizing disc..."));
+ }
+
usleep (500000);
}
+ xfburn_progress_dialog_set_status_with_text (XFBURN_PROGRESS_DIALOG (dialog_progress), XFBURN_PROGRESS_DIALOG_STATUS_COMPLETED, _("Done"));
+
cleanup:
burn_drive_release (drive, params->eject ? 1 : 0);
/* commented because it unleashes hell
@@ -336,8 +346,6 @@
g_free (params->iso_path);
g_free (params);
-
- DBG ("burning thread terminated");
}
static void
Modified: xfburn/branches/libburn_trial/xfburn/xfburn-device-list.c
===================================================================
--- xfburn/branches/libburn_trial/xfburn/xfburn-device-list.c 2007-01-04 10:42:01 UTC (rev 24264)
+++ xfburn/branches/libburn_trial/xfburn/xfburn-device-list.c 2007-01-04 17:37:27 UTC (rev 24265)
@@ -38,6 +38,7 @@
#define CDR_1X_SPEED 150
/* private */
+static gint supported_cdr_speeds[] = {2, 4, 6, 8, 10, 12, 16, 24, 32, 40, 48, 52, -1};
static GList *devices = NULL;
/*************/
@@ -50,6 +51,21 @@
g_free (device->node_path);
}
+static gint
+get_closest_supported_cdr_speed (gint speed)
+{
+ gint i = 0;
+
+ while (supported_cdr_speeds[i] != -1) {
+ if (speed < (supported_cdr_speeds[i] * CDR_1X_SPEED))
+ return supported_cdr_speeds[i];
+ else
+ i++;
+ }
+
+ return 0;
+}
+
/**************/
/* public API */
/**************/
Modified: xfburn/branches/libburn_trial/xfburn/xfburn-progress-dialog.c
===================================================================
--- xfburn/branches/libburn_trial/xfburn/xfburn-progress-dialog.c 2007-01-04 10:42:01 UTC (rev 24264)
+++ xfburn/branches/libburn_trial/xfburn/xfburn-progress-dialog.c 2007-01-04 17:37:27 UTC (rev 24265)
@@ -65,6 +65,8 @@
static void set_writing_speed (XfburnProgressDialog * dialog, gfloat speed);
static void set_action_text (XfburnProgressDialog * dialog, const gchar * text);
+
+static void cb_button_close_clicked (GtkWidget *button, XfburnProgressDialog * dialog);
static gboolean cb_dialog_delete (XfburnProgressDialog * dialog, GdkEvent * event, XfburnProgressDialogPrivate * priv);
enum
@@ -221,6 +223,7 @@
gtk_widget_grab_default (priv->button_close);
gtk_widget_set_sensitive (priv->button_close, FALSE);
+ g_signal_connect (G_OBJECT (priv->button_close), "clicked", G_CALLBACK (cb_button_close_clicked), obj);
g_signal_connect (G_OBJECT (obj), "delete-event", G_CALLBACK (cb_dialog_delete), priv);
}
@@ -291,6 +294,12 @@
}
/* callbacks */
+static void
+cb_button_close_clicked (GtkWidget *button, XfburnProgressDialog *dialog)
+{
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+}
+
static gboolean
cb_dialog_delete (XfburnProgressDialog * dialog, GdkEvent * event, XfburnProgressDialogPrivate * priv)
{
@@ -459,19 +468,16 @@
{
XfburnProgressDialogPrivate *priv = XFBURN_PROGRESS_DIALOG_GET_PRIVATE (dialog);
+ priv->status = status;
+
if (status != XFBURN_PROGRESS_DIALOG_STATUS_RUNNING) {
gdk_threads_enter ();
gtk_widget_set_sensitive (priv->button_stop, FALSE);
gtk_widget_set_sensitive (priv->button_close, TRUE);
gdk_threads_leave ();
- }
- /*
- switch (status) {
- case XFBURN_PROGRESS_DIALOG_STATUS_
+ xfburn_progress_dialog_set_progress_bar_fraction (dialog, 1.0);
}
- */
- priv->status = status;
}
void
@@ -490,7 +496,7 @@
void
xfburn_progress_dialog_burning_failed (XfburnProgressDialog * dialog, const gchar * msg_error)
{
- xfburn_progress_dialog_set_status (dialog, XFBURN_PROGRESS_DIALOG_STATUS_FAILED);
+ xfburn_progress_dialog_set_status_with_text (dialog, XFBURN_PROGRESS_DIALOG_STATUS_FAILED, _("Failure"));
gdk_threads_enter ();
xfce_err (msg_error);
More information about the Xfce4-commits
mailing list