brasero r1356 - in trunk: . src



Author: philippr
Date: Mon Oct  6 17:46:53 2008
New Revision: 1356
URL: http://svn.gnome.org/viewvc/brasero?rev=1356&view=rev

Log:
	Fixed a small problem with copy dialog if disc is inserted during
	run time: the button stayed grayed
	Some cleanup (removed one unused flag)

	* src/brasero-burn-options.c (brasero_burn_options_valid_media_cb),
	(brasero_burn_options_init):
	* src/brasero-dest-selection.c
	(brasero_dest_selection_valid_session):
	* src/brasero-disc-option-dialog.c
	(brasero_disc_option_dialog_valid_media_cb):
	* src/brasero-medium-properties.c
	(brasero_medium_properties_valid_session):
	* src/brasero-session-cfg.c (brasero_session_cfg_get_error),
	(brasero_session_cfg_add_drive_properties_flags),
	(brasero_session_cfg_check_size), (brasero_session_cfg_update),
	(brasero_session_cfg_class_init):
	* src/brasero-session-cfg.h:
	* src/brasero-src-image.c:
	* src/burn-basics.h:
	* src/burn-caps.c (brasero_burn_caps_get_flags):
	* src/burn-debug.c (brasero_debug_burn_flags_to_string):


Modified:
   trunk/ChangeLog
   trunk/src/brasero-burn-options.c
   trunk/src/brasero-dest-selection.c
   trunk/src/brasero-disc-option-dialog.c
   trunk/src/brasero-medium-properties.c
   trunk/src/brasero-session-cfg.c
   trunk/src/brasero-session-cfg.h
   trunk/src/brasero-src-image.c
   trunk/src/burn-basics.h
   trunk/src/burn-caps.c
   trunk/src/burn-debug.c

Modified: trunk/src/brasero-burn-options.c
==============================================================================
--- trunk/src/brasero-burn-options.c	(original)
+++ trunk/src/brasero-burn-options.c	Mon Oct  6 17:46:53 2008
@@ -222,13 +222,16 @@
 }
 
 static void
-brasero_burn_options_valid_media_cb (BraseroBurnSession *session,
-				     BraseroSessionError valid,
+brasero_burn_options_valid_media_cb (BraseroSessionCfg *session,
 				     BraseroBurnOptions *self)
 {
 	BraseroBurnOptionsPrivate *priv;
+	BraseroSessionError valid;
 	gint numcopies;
 
+g_print("VALID %d\n", valid);
+	valid = brasero_session_cfg_get_error (session);
+g_print("VALID2 %d\n", valid);
 	priv = BRASERO_BURN_OPTIONS_PRIVATE (self);
 
 	gtk_widget_set_sensitive (priv->button, valid == BRASERO_SESSION_VALID);
@@ -388,8 +391,7 @@
 	priv->session = brasero_session_cfg_new ();
 	brasero_burn_session_add_flag (BRASERO_BURN_SESSION (priv->session),
 				       BRASERO_BURN_FLAG_NOGRACE|
-				       BRASERO_BURN_FLAG_CHECK_SIZE|
-				       BRASERO_BURN_FLAG_DONT_CLEAN_OUTPUT);
+				       BRASERO_BURN_FLAG_CHECK_SIZE);
 
 	/* Create a cancel button */
 	button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
@@ -435,8 +437,8 @@
 	gtk_widget_show (priv->properties);
 	gtk_box_pack_start (GTK_BOX (selection),
 			    priv->properties,
-			    TRUE,
-			    TRUE,
+			    FALSE,
+			    FALSE,
 			    0);
 
 	/* Medium info */

Modified: trunk/src/brasero-dest-selection.c
==============================================================================
--- trunk/src/brasero-dest-selection.c	(original)
+++ trunk/src/brasero-dest-selection.c	Mon Oct  6 17:46:53 2008
@@ -105,8 +105,7 @@
 }
 
 static void
-brasero_dest_selection_valid_session (BraseroBurnSession *session,
-				      BraseroSessionError is_valid,
+brasero_dest_selection_valid_session (BraseroSessionCfg *session,
 				      BraseroDestSelection *self)
 {
 	BraseroDestSelectionPrivate *priv;

Modified: trunk/src/brasero-disc-option-dialog.c
==============================================================================
--- trunk/src/brasero-disc-option-dialog.c	(original)
+++ trunk/src/brasero-disc-option-dialog.c	Mon Oct  6 17:46:53 2008
@@ -1034,8 +1034,7 @@
 }
 
 static void
-brasero_disc_option_dialog_valid_media_cb (BraseroDestSelection *selection,
-					   BraseroSessionError valid,
+brasero_disc_option_dialog_valid_media_cb (BraseroSessionCfg *session,
 					   BraseroDiscOptionDialog *self)
 {
 	BraseroDiscOptionDialogPrivate *priv;
@@ -1043,7 +1042,7 @@
 	priv = BRASERO_DISC_OPTION_DIALOG_PRIVATE (self);
 
 	if (priv->video_options)
-		gtk_widget_set_sensitive (priv->video_options, valid == BRASERO_SESSION_VALID);
+		gtk_widget_set_sensitive (priv->video_options, brasero_session_cfg_get_error (session) == BRASERO_SESSION_VALID);
 
 	/* update the multi button:
 	 * NOTE: order is important here multi then video */

Modified: trunk/src/brasero-medium-properties.c
==============================================================================
--- trunk/src/brasero-medium-properties.c	(original)
+++ trunk/src/brasero-medium-properties.c	Mon Oct  6 17:46:53 2008
@@ -558,8 +558,7 @@
 }
 
 static void
-brasero_medium_properties_valid_session (BraseroBurnSession *session,
-					 BraseroSessionError is_valid,
+brasero_medium_properties_valid_session (BraseroSessionCfg *session,
 					 BraseroMediumProperties *self)
 {
 	BraseroMediumPropertiesPrivate *priv;
@@ -568,7 +567,7 @@
 
 	/* make sure the current displayed path is valid */
 	if (brasero_burn_session_is_dest_file (priv->session))
-		brasero_medium_properties_update_image_output (self, is_valid == BRASERO_SESSION_VALID);
+		brasero_medium_properties_update_image_output (self, brasero_session_cfg_get_error (session) == BRASERO_SESSION_VALID);
 }
 
 static void

Modified: trunk/src/brasero-session-cfg.c
==============================================================================
--- trunk/src/brasero-session-cfg.c	(original)
+++ trunk/src/brasero-session-cfg.c	Mon Oct  6 17:46:53 2008
@@ -51,6 +51,8 @@
 
 	glong caps_sig;
 
+	BraseroSessionError is_valid;
+
 	guint configuring:1;
 	guint disabled:1;
 };
@@ -70,6 +72,15 @@
 
 #define BRASERO_DEST_SAVED_FLAGS	(BRASERO_DRIVE_PROPERTIES_FLAGS|BRASERO_BURN_FLAG_MULTI)
 
+BraseroSessionError
+brasero_session_cfg_get_error (BraseroSessionCfg *self)
+{
+	BraseroSessionCfgPrivate *priv;
+
+	priv = BRASERO_SESSION_CFG_PRIVATE (self);
+	return priv->is_valid;
+}
+
 void
 brasero_session_cfg_disable (BraseroSessionCfg *self)
 {
@@ -150,7 +161,13 @@
 		return;
 	}
 
-	for (flag = 1; flag < BRASERO_BURN_FLAG_LAST; flag <<= 1) {
+	/* These are always supported and better be set. */
+	brasero_burn_session_set_flags (BRASERO_BURN_SESSION (self),
+					BRASERO_BURN_FLAG_DONT_OVERWRITE|
+					BRASERO_BURN_FLAG_CHECK_SIZE|
+					BRASERO_BURN_FLAG_NOGRACE);
+
+	for (flag = BRASERO_BURN_FLAG_EJECT; flag < BRASERO_BURN_FLAG_LAST; flag <<= 1) {
 		/* see if this flag was originally set */
 		if (!(flags & flag))
 			continue;
@@ -334,6 +351,7 @@
 static BraseroSessionError
 brasero_session_cfg_check_size (BraseroSessionCfg *self)
 {
+	BraseroSessionCfgPrivate *priv;
 	BraseroBurnFlag flags;
 	BraseroMedium *medium;
 	BraseroDrive *burner;
@@ -344,17 +362,25 @@
 	gint64 disc_size;
 	GSList *iter;
 
+	priv = BRASERO_SESSION_CFG_PRIVATE (self);
+
 	burner = brasero_burn_session_get_burner (BRASERO_BURN_SESSION (self));
-	if (!burner)
+	if (!burner) {
+		priv->is_valid = BRASERO_SESSION_NO_OUTPUT;
 		return BRASERO_SESSION_NO_OUTPUT;
+	}
 
 	/* FIXME: here we could check the hard drive space */
-	if (brasero_drive_is_fake (burner))
+	if (brasero_drive_is_fake (burner)) {
+		priv->is_valid = BRASERO_SESSION_VALID;
 		return BRASERO_SESSION_VALID;
+	}
 
 	medium = brasero_drive_get_medium (burner);
-	if (!medium)
+	if (!medium) {
+		priv->is_valid = BRASERO_SESSION_NO_OUTPUT;
 		return BRASERO_SESSION_NO_OUTPUT;
+	}
 
 	flags = brasero_burn_session_get_flags (BRASERO_BURN_SESSION (self));
 	if (flags & (BRASERO_BURN_FLAG_MERGE|BRASERO_BURN_FLAG_APPEND))
@@ -406,8 +432,10 @@
 			  session_size,
 			  disc_size);
 
-	if (session_size < disc_size)
+	if (session_size < disc_size) {
+		priv->is_valid = BRASERO_SESSION_VALID;
 		return BRASERO_SESSION_VALID;
+	}
 
 	/* FIXME: This is not good since with a DVD 3% of 4.3G may be too much
 	 * with 3% we are slightly over the limit of the most overburnable discs
@@ -419,20 +447,26 @@
 	 * us to determine how much data can be written to a particular disc
 	 * provided he has chosen a real disc. */
 	max_sectors = disc_size * 103 / 100;
-	if (max_sectors < session_size)
+	if (max_sectors < session_size) {
+		priv->is_valid = BRASERO_SESSION_INSUFFICIENT_SPACE;
 		return BRASERO_SESSION_INSUFFICIENT_SPACE;
+	}
 
 	if (!(flags & BRASERO_BURN_FLAG_OVERBURN)) {
 		BraseroSessionCfgPrivate *priv;
 
 		priv = BRASERO_SESSION_CFG_PRIVATE (self);
 
-		if (!(priv->supported & BRASERO_BURN_FLAG_OVERBURN))
+		if (!(priv->supported & BRASERO_BURN_FLAG_OVERBURN)) {
+			priv->is_valid = BRASERO_SESSION_INSUFFICIENT_SPACE;
 			return BRASERO_SESSION_INSUFFICIENT_SPACE;
+		}
 
+		priv->is_valid = BRASERO_SESSION_OVERBURN_NECESSARY;
 		return BRASERO_SESSION_OVERBURN_NECESSARY;
 	}
 
+	priv->is_valid = BRASERO_SESSION_VALID;
 	return BRASERO_SESSION_VALID;
 }
 
@@ -455,6 +489,7 @@
 	brasero_burn_session_get_input_type (BRASERO_BURN_SESSION (self), &source);
 	if (source.type == BRASERO_TRACK_TYPE_NONE) {
 		priv->configuring = FALSE;
+		priv->is_valid = BRASERO_SESSION_NOT_SUPPORTED;
 		g_signal_emit (self,
 			       session_cfg_signals [IS_VALID_SIGNAL],
 			       0,
@@ -465,6 +500,7 @@
 	if (source.type == BRASERO_TRACK_TYPE_DISC
 	&&  source.subtype.media == BRASERO_MEDIUM_NONE) {
 		priv->configuring = FALSE;
+		priv->is_valid = BRASERO_SESSION_NO_INPUT_MEDIUM;
 		g_signal_emit (self,
 			       session_cfg_signals [IS_VALID_SIGNAL],
 			       0,
@@ -475,6 +511,7 @@
 	if (source.type == BRASERO_TRACK_TYPE_IMAGE
 	&&  source.subtype.img_format == BRASERO_IMAGE_FORMAT_NONE) {
 		priv->configuring = FALSE;
+		priv->is_valid = BRASERO_SESSION_NO_INPUT_IMAGE;
 		g_signal_emit (self,
 			       session_cfg_signals [IS_VALID_SIGNAL],
 			       0,
@@ -508,25 +545,30 @@
 		/* This is a special case */
 		if (source.type == BRASERO_TRACK_TYPE_DISC
 		&& (source.subtype.media & BRASERO_MEDIUM_PROTECTED)
-		&&  brasero_burn_caps_has_capability (priv->caps, &source) != BRASERO_BURN_OK)
+		&&  brasero_burn_caps_has_capability (priv->caps, &source) != BRASERO_BURN_OK) {
+			priv->is_valid = BRASERO_SESSION_DISC_PROTECTED;
 			g_signal_emit (self,
 				       session_cfg_signals [IS_VALID_SIGNAL],
 				       0,
 				       BRASERO_SESSION_DISC_PROTECTED);
-		else
+		}
+		else {
+			priv->is_valid = BRASERO_SESSION_NOT_SUPPORTED;
 			g_signal_emit (self,
 				       session_cfg_signals [IS_VALID_SIGNAL],
 				       0,
 				       BRASERO_SESSION_NOT_SUPPORTED);
+		}
 		return;
 	}
 
-	if (brasero_burn_session_same_src_dest_drive (BRASERO_BURN_SESSION (self)))
+	if (brasero_burn_session_same_src_dest_drive (BRASERO_BURN_SESSION (self))) {
+		priv->is_valid = BRASERO_SESSION_VALID;
 		g_signal_emit (self,
 			       session_cfg_signals [IS_VALID_SIGNAL],
 			       0,
 			       BRASERO_SESSION_VALID);
-
+	}
 	else
 		g_signal_emit (self,
 			       session_cfg_signals [IS_VALID_SIGNAL],
@@ -748,13 +790,13 @@
 	session_cfg_signals[IS_VALID_SIGNAL] =
 		g_signal_new ("is_valid",
 		              G_OBJECT_CLASS_TYPE (klass),
-		              G_SIGNAL_RUN_LAST | G_SIGNAL_RUN_CLEANUP | G_SIGNAL_ACTION,
+		              G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE | G_SIGNAL_RUN_CLEANUP | G_SIGNAL_ACTION,
 		              0,
 		              NULL, NULL,
-		              g_cclosure_marshal_VOID__INT,
+		              g_cclosure_marshal_VOID__VOID,
 		              G_TYPE_NONE,
-			      1,
-		              G_TYPE_INT);
+			      0,
+		              G_TYPE_NONE);
 }
 
 BraseroSessionCfg *

Modified: trunk/src/brasero-session-cfg.h
==============================================================================
--- trunk/src/brasero-session-cfg.h	(original)
+++ trunk/src/brasero-session-cfg.h	Mon Oct  6 17:46:53 2008
@@ -54,16 +54,6 @@
 						BRASERO_BURN_FLAG_BURNPROOF|	\
 						BRASERO_BURN_FLAG_NO_TMP_FILES)
 
-BraseroSessionCfg *
-brasero_session_cfg_new (void);
-
-void
-brasero_session_cfg_add_flags (BraseroSessionCfg *cfg,
-			       BraseroBurnFlag flags);
-
-void
-brasero_session_cfg_disable (BraseroSessionCfg *self);
-
 /**
  * This is for the signal sent to tell whether or not session is valid
  */
@@ -80,6 +70,20 @@
 	BRASERO_SESSION_DISC_PROTECTED
 } BraseroSessionError;
 
+BraseroSessionCfg *
+brasero_session_cfg_new (void);
+
+BraseroSessionError
+brasero_session_cfg_get_error (BraseroSessionCfg *cfg);
+
+void
+brasero_session_cfg_add_flags (BraseroSessionCfg *cfg,
+			       BraseroBurnFlag flags);
+
+void
+brasero_session_cfg_disable (BraseroSessionCfg *self);
+
+
 /**
  * This tag (for sessions) is used to set an estimated size, used to determine
  * in the burn option dialog is the selected medium is big enough.

Modified: trunk/src/brasero-src-image.c
==============================================================================
--- trunk/src/brasero-src-image.c	(original)
+++ trunk/src/brasero-src-image.c	Mon Oct  6 17:46:53 2008
@@ -21,6 +21,8 @@
 #  include <config.h>
 #endif
 
+#include <string.h>
+
 #include <glib.h>
 #include <glib/gi18n-lib.h>
 #include <glib-object.h>

Modified: trunk/src/burn-basics.h
==============================================================================
--- trunk/src/burn-basics.h	(original)
+++ trunk/src/burn-basics.h	Mon Oct  6 17:46:53 2008
@@ -132,29 +132,28 @@
 	/* These flags should always be supported */
 	BRASERO_BURN_FLAG_EJECT			= 1,
 	BRASERO_BURN_FLAG_NOGRACE		= 1 << 1,
-	BRASERO_BURN_FLAG_DONT_CLEAN_OUTPUT	= 1 << 2,
-	BRASERO_BURN_FLAG_DONT_OVERWRITE	= 1 << 3,
-	BRASERO_BURN_FLAG_CHECK_SIZE		= 1 << 4,
+	BRASERO_BURN_FLAG_DONT_OVERWRITE	= 1 << 2,
+	BRASERO_BURN_FLAG_CHECK_SIZE		= 1 << 3,
 
 	/* These are of great importance for the result */
-	BRASERO_BURN_FLAG_MERGE			= 1 << 5,
-	BRASERO_BURN_FLAG_MULTI			= 1 << 6,
-	BRASERO_BURN_FLAG_APPEND		= 1 << 7,
-
-	BRASERO_BURN_FLAG_BURNPROOF		= 1 << 8,
-	BRASERO_BURN_FLAG_NO_TMP_FILES		= 1 << 9,
-	BRASERO_BURN_FLAG_DUMMY			= 1 << 10,
+	BRASERO_BURN_FLAG_MERGE			= 1 << 4,
+	BRASERO_BURN_FLAG_MULTI			= 1 << 5,
+	BRASERO_BURN_FLAG_APPEND		= 1 << 6,
+
+	BRASERO_BURN_FLAG_BURNPROOF		= 1 << 7,
+	BRASERO_BURN_FLAG_NO_TMP_FILES		= 1 << 8,
+	BRASERO_BURN_FLAG_DUMMY			= 1 << 9,
 
 	/* FIXME! this flag is more or less linked to OVERBURN one can't we do 
 	 * a single one */
-	BRASERO_BURN_FLAG_OVERBURN		= 1 << 11,
+	BRASERO_BURN_FLAG_OVERBURN		= 1 << 10,
 
-	BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE	= 1 << 12,
-	BRASERO_BURN_FLAG_FAST_BLANK		= 1 << 13,
+	BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE	= 1 << 11,
+	BRASERO_BURN_FLAG_FAST_BLANK		= 1 << 12,
 
 	/* NOTE: these two are contradictory? */
-	BRASERO_BURN_FLAG_DAO			= 1 << 14,
-	BRASERO_BURN_FLAG_RAW			= 1 << 15,
+	BRASERO_BURN_FLAG_DAO			= 1 << 13,
+	BRASERO_BURN_FLAG_RAW			= 1 << 14,
 
 	BRASERO_BURN_FLAG_LAST
 } BraseroBurnFlag;

Modified: trunk/src/burn-caps.c
==============================================================================
--- trunk/src/burn-caps.c	(original)
+++ trunk/src/burn-caps.c	Mon Oct  6 17:46:53 2008
@@ -2780,7 +2780,6 @@
 	/* FIXME: what's the meaning of NOGRACE when outputting ? */
 	BraseroBurnFlag compulsory_flags = BRASERO_BURN_FLAG_NONE;
 	BraseroBurnFlag supported_flags = BRASERO_BURN_FLAG_DONT_OVERWRITE|
-					  BRASERO_BURN_FLAG_DONT_CLEAN_OUTPUT|
 					  BRASERO_BURN_FLAG_CHECK_SIZE|
 					  BRASERO_BURN_FLAG_NOGRACE;
 
@@ -2798,10 +2797,6 @@
 		if (input.type == BRASERO_TRACK_TYPE_DISC)
 			supported_flags |= BRASERO_BURN_FLAG_EJECT;
 
-		/* FIXME: do the flag have the same meaning now with session
-		 * making a clear distinction between tmp files and output */
-		compulsory_flags |= BRASERO_BURN_FLAG_DONT_CLEAN_OUTPUT;
-
 		*supported = supported_flags;
 		*compulsory = compulsory_flags;
 

Modified: trunk/src/burn-debug.c
==============================================================================
--- trunk/src/burn-debug.c	(original)
+++ trunk/src/burn-debug.c	Mon Oct  6 17:46:53 2008
@@ -114,8 +114,6 @@
 		strcat (buffer, "burnproof, ");
 	if (flags & BRASERO_BURN_FLAG_NO_TMP_FILES)
 		strcat (buffer, "no tmp file, ");
-	if (flags & BRASERO_BURN_FLAG_DONT_CLEAN_OUTPUT)
-		strcat (buffer, "clean output, ");
 	if (flags & BRASERO_BURN_FLAG_DONT_OVERWRITE)
 		strcat (buffer, "no overwrite, ");
 	if (flags & BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]