[brasero: 5/6] 2009-04-19 Philippe Rouquier <bonfire-app wanadoo fr>



commit a1cda308d4fbe0093f12242accdc0d1a131b9b80
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date:   Sun Apr 19 20:13:02 2009 +0200

    2009-04-19  Philippe Rouquier  <bonfire-app wanadoo fr>
    
    	Change one function return value
    
    	* libbrasero-burn/brasero-burn-options.c
    	(brasero_burn_options_update_valid):
    	* libbrasero-burn/brasero-burn.c (brasero_burn_record):
    	* libbrasero-burn/brasero-cover.c (brasero_session_edit_cover):
    	* libbrasero-burn/brasero-session-cfg.c
    	(brasero_session_cfg_get_gconf_key),
    	(brasero_session_cfg_set_drive_properties):
    	* libbrasero-burn/brasero-session.c
    	(brasero_burn_session_add_track),
    	(brasero_burn_session_get_input_type):
    	* libbrasero-burn/brasero-session.h:
    	* libbrasero-burn/brasero-track-type.c (brasero_track_type_free):
    	* libbrasero-burn/burn-job.c (brasero_job_get_input_type):
---
 ChangeLog                              |   18 ++++++++++++
 libbrasero-burn/brasero-burn-options.c |    3 +-
 libbrasero-burn/brasero-burn.c         |    7 ++++-
 libbrasero-burn/brasero-cover.c        |    9 +++++-
 libbrasero-burn/brasero-session-cfg.c  |   47 +++++++++++++------------------
 libbrasero-burn/brasero-session.c      |   20 ++++++++-----
 libbrasero-burn/brasero-session.h      |    2 +-
 libbrasero-burn/brasero-track-type.c   |    3 ++
 libbrasero-burn/burn-job.c             |    2 +-
 9 files changed, 70 insertions(+), 41 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 766038e..938bb2c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,23 @@
 2009-04-19  Philippe Rouquier  <bonfire-app wanadoo fr>
 
+	Change one function return value
+
+	* libbrasero-burn/brasero-burn-options.c
+	(brasero_burn_options_update_valid):
+	* libbrasero-burn/brasero-burn.c (brasero_burn_record):
+	* libbrasero-burn/brasero-cover.c (brasero_session_edit_cover):
+	* libbrasero-burn/brasero-session-cfg.c
+	(brasero_session_cfg_get_gconf_key),
+	(brasero_session_cfg_set_drive_properties):
+	* libbrasero-burn/brasero-session.c
+	(brasero_burn_session_add_track),
+	(brasero_burn_session_get_input_type):
+	* libbrasero-burn/brasero-session.h:
+	* libbrasero-burn/brasero-track-type.c (brasero_track_type_free):
+	* libbrasero-burn/burn-job.c (brasero_job_get_input_type):
+
+2009-04-19  Philippe Rouquier  <bonfire-app wanadoo fr>
+
 	Move all API that deals with size to goffset
 
 	* libbrasero-burn/brasero-session-cfg.c
diff --git a/libbrasero-burn/brasero-burn-options.c b/libbrasero-burn/brasero-burn-options.c
index 0e31775..69205ea 100644
--- a/libbrasero-burn/brasero-burn-options.c
+++ b/libbrasero-burn/brasero-burn-options.c
@@ -340,10 +340,9 @@ brasero_burn_options_update_valid (BraseroBurnOptions *self)
 	}
 	else if (valid == BRASERO_SESSION_EMPTY) {
 		BraseroTrackType *type;
-		BraseroBurnResult result;
 		
 		type = brasero_track_type_new ();
-		result = brasero_burn_session_get_input_type (BRASERO_BURN_SESSION (priv->session), type);
+		brasero_burn_session_get_input_type (BRASERO_BURN_SESSION (priv->session), type);
 
 		if (brasero_track_type_get_has_data (type))
 			brasero_notify_message_add (BRASERO_NOTIFY (priv->message_output),
diff --git a/libbrasero-burn/brasero-burn.c b/libbrasero-burn/brasero-burn.c
index ac8d16d..04605c2 100644
--- a/libbrasero-burn/brasero-burn.c
+++ b/libbrasero-burn/brasero-burn.c
@@ -2534,6 +2534,7 @@ brasero_burn_record (BraseroBurn *burn,
 		     BraseroBurnSession *session,
 		     GError **error)
 {
+	BraseroTrackType *type = NULL;
 	BraseroBurnResult result;
 	BraseroBurnPrivate *priv;
 
@@ -2592,7 +2593,9 @@ brasero_burn_record (BraseroBurn *burn,
 			goto end;
 	}
 
-	if (brasero_burn_session_get_input_type (session, NULL) == BRASERO_TRACK_TYPE_DISC) {
+	type = brasero_track_type_new ();
+	brasero_burn_session_get_input_type (session, type);
+	if (brasero_track_type_get_has_medium (type)) {
 		result = brasero_burn_lock_src_media (burn, error);
 		if (result != BRASERO_BURN_OK)
 			goto end;
@@ -2603,6 +2606,8 @@ brasero_burn_record (BraseroBurn *burn,
 
 end:
 
+	brasero_track_type_free (type);
+
 	if (result == BRASERO_BURN_OK)
 		result = brasero_burn_unlock_medias (burn, error);
 	else
diff --git a/libbrasero-burn/brasero-cover.c b/libbrasero-burn/brasero-cover.c
index 97b31be..5ecb307 100644
--- a/libbrasero-burn/brasero-cover.c
+++ b/libbrasero-burn/brasero-cover.c
@@ -218,6 +218,7 @@ brasero_session_edit_cover (BraseroBurnSession *session,
 			    GtkWidget *toplevel)
 {
 	BraseroJacketEdit *contents;
+	BraseroTrackType *type;
 	GValue *cover_value;
 	const gchar *title;
 	GtkWidget *edit;
@@ -226,8 +227,14 @@ brasero_session_edit_cover (BraseroBurnSession *session,
 	edit = brasero_jacket_edit_dialog_new (GTK_WIDGET (toplevel), &contents);
 
 	/* Don't go any further if it's not video */
-	if (brasero_burn_session_get_input_type (session, NULL) != BRASERO_TRACK_TYPE_STREAM)
+	type = brasero_track_type_new ();
+	brasero_burn_session_get_input_type (session, type);
+	if (!brasero_track_type_get_has_stream (type)) {
+		brasero_track_type_free (type);
 		return edit;
+	}
+
+	brasero_track_type_free (type);
 
 	title = brasero_burn_session_get_label (session);
 	tracks = brasero_burn_session_get_tracks (session);
diff --git a/libbrasero-burn/brasero-session-cfg.c b/libbrasero-burn/brasero-session-cfg.c
index 04bc94f..ced61c9 100644
--- a/libbrasero-burn/brasero-session-cfg.c
+++ b/libbrasero-burn/brasero-session-cfg.c
@@ -93,6 +93,7 @@ static gchar *
 brasero_session_cfg_get_gconf_key (BraseroSessionCfg *self,
 				   const gchar *property)
 {
+	BraseroTrackType *type;
 	BraseroMedium *medium;
 	BraseroDrive *drive;
 	gchar *display_name;
@@ -126,49 +127,40 @@ brasero_session_cfg_get_gconf_key (BraseroSessionCfg *self,
 		return NULL;
 	}
 
-	switch (brasero_burn_session_get_input_type (BRASERO_BURN_SESSION (self), NULL)) {
-	case BRASERO_TRACK_TYPE_NONE:
-		key = g_strdup_printf ("%s/%s/none_%s/%s",
-				       BRASERO_DRIVE_PROPERTIES_KEY,
-				       display_name,
-				       disc_type,
-				       property);
-		break;
-	case BRASERO_TRACK_TYPE_DISC:
+	type = brasero_track_type_new ();
+	brasero_burn_session_get_input_type (BRASERO_BURN_SESSION (self), type);
+	if (brasero_track_type_get_has_medium (type))
 		key = g_strdup_printf ("%s/%s/disc_%s/%s",
 				       BRASERO_DRIVE_PROPERTIES_KEY,
 				       display_name,
 				       disc_type,
 				       property);
-		break;
-
-	case BRASERO_TRACK_TYPE_DATA:
+	else if (brasero_track_type_get_has_data (type))
 		key = g_strdup_printf ("%s/%s/data_%s/%s",
 				       BRASERO_DRIVE_PROPERTIES_KEY,
 				       display_name,
 				       disc_type,
 				       property);
-		break;
-
-	case BRASERO_TRACK_TYPE_IMAGE:
+	else if (brasero_track_type_get_has_image (type))
 		key = g_strdup_printf ("%s/%s/image_%s/%s",
 				       BRASERO_DRIVE_PROPERTIES_KEY,
 				       display_name,
 				       disc_type,
 				       property);
-		break;
-
-	case BRASERO_TRACK_TYPE_STREAM:
+	else if (brasero_track_type_get_has_stream (type))
 		key = g_strdup_printf ("%s/%s/audio_%s/%s",
 				       BRASERO_DRIVE_PROPERTIES_KEY,
 				       display_name,
 				       disc_type,
 				       property);
-		break;
-	default:
-		break;
-	}
+	else
+		key = g_strdup_printf ("%s/%s/none_%s/%s",
+				       BRASERO_DRIVE_PROPERTIES_KEY,
+				       display_name,
+				       disc_type,
+				       property);
 
+	brasero_track_type_free (type);
 	g_free (display_name);
 	g_free (disc_type);
 	return key;
@@ -365,7 +357,7 @@ static void
 brasero_session_cfg_set_drive_properties (BraseroSessionCfg *self)
 {
 	BraseroSessionCfgPrivate *priv;
-	BraseroTrackDataType source;
+	BraseroTrackType *source;
 	BraseroBurnFlag flags;
 	BraseroMedium *medium;
 	BraseroDrive *drive;
@@ -378,7 +370,8 @@ brasero_session_cfg_set_drive_properties (BraseroSessionCfg *self)
 	priv = BRASERO_SESSION_CFG_PRIVATE (self);
 
 	/* The next two must work as they were checked earlier */
-	source = brasero_burn_session_get_input_type (BRASERO_BURN_SESSION (self), NULL);
+	source = brasero_track_type_new ();
+	brasero_burn_session_get_input_type (BRASERO_BURN_SESSION (self), source);
 	drive = brasero_burn_session_get_burner (BRASERO_BURN_SESSION (self));
 
 	medium = brasero_drive_get_medium (drive);
@@ -441,9 +434,9 @@ brasero_session_cfg_set_drive_properties (BraseroSessionCfg *self)
 		flags = BRASERO_BURN_FLAG_EJECT|
 			BRASERO_BURN_FLAG_BURNPROOF;
 
-		if (source == BRASERO_TRACK_TYPE_DATA
-		||  source == BRASERO_TRACK_TYPE_DISC
-		||  source == BRASERO_TRACK_TYPE_IMAGE)
+		if (brasero_track_type_get_has_data (source)
+		||  brasero_track_type_get_has_medium (source)
+		||  brasero_track_type_get_has_image (source))
 			flags |= BRASERO_BURN_FLAG_NO_TMP_FILES;
 	}
 	else {
diff --git a/libbrasero-burn/brasero-session.c b/libbrasero-burn/brasero-session.c
index 89d9359..8771aa7 100644
--- a/libbrasero-burn/brasero-session.c
+++ b/libbrasero-burn/brasero-session.c
@@ -223,6 +223,7 @@ brasero_burn_session_add_track (BraseroBurnSession *self,
 				BraseroTrack *new_track)
 {
 	BraseroBurnSessionPrivate *priv;
+	BraseroTrackType *type;
 
 	g_return_val_if_fail (BRASERO_IS_BURN_SESSION (self), BRASERO_BURN_ERR);
 
@@ -252,10 +253,11 @@ brasero_burn_session_add_track (BraseroBurnSession *self,
 	}
 
 	/* if there is already a track, then we replace it on condition that it
-	 * has the same type and it's not AUDIO (only one allowed to have many)
-	 */
+	 * has the same type and it's not AUDIO (only one allowed to have many) */
+	type = brasero_track_type_new ();
+	brasero_burn_session_get_input_type (self, type);
 	if (!BRASERO_IS_TRACK_STREAM (new_track)
-	||  brasero_burn_session_get_input_type (self, NULL) != BRASERO_TRACK_TYPE_STREAM) {
+	||  brasero_track_type_get_has_stream (type)) {
 		brasero_burn_session_stop_tracks_monitoring (self);
 
 		g_slist_foreach (priv->tracks, (GFunc) g_object_unref, NULL);
@@ -273,6 +275,7 @@ brasero_burn_session_add_track (BraseroBurnSession *self,
 		priv->tracks = g_slist_append (priv->tracks, new_track);
 	}
 
+	brasero_track_type_free (type);
 	return BRASERO_BURN_OK;
 }
 
@@ -389,25 +392,26 @@ brasero_burn_session_get_size (BraseroBurnSession *session,
 	return BRASERO_BURN_OK;
 }
 
-/* FIXME: change this return type */
-BraseroTrackDataType
+BraseroBurnResult
 brasero_burn_session_get_input_type (BraseroBurnSession *self,
 				     BraseroTrackType *type)
 {
 	BraseroTrack *track;
 	BraseroBurnSessionPrivate *priv;
 
-	g_return_val_if_fail (BRASERO_IS_BURN_SESSION (self), BRASERO_TRACK_TYPE_NONE);
+	g_return_val_if_fail (BRASERO_IS_BURN_SESSION (self), BRASERO_BURN_ERR);
 
 	priv = BRASERO_BURN_SESSION_PRIVATE (self);
 
 	if (!priv->tracks)
-		return BRASERO_TRACK_TYPE_NONE;
+		return BRASERO_BURN_OK;
 
 	/* there can be many tracks (in case of audio) but they must be
 	 * all of the same kind for the moment */
 	track = priv->tracks->data;
-	return brasero_track_get_track_type (track, type);
+	brasero_track_get_track_type (track, type);
+
+	return BRASERO_BURN_OK;
 }
 
 /**
diff --git a/libbrasero-burn/brasero-session.h b/libbrasero-burn/brasero-session.h
index eeac827..d91d050 100644
--- a/libbrasero-burn/brasero-session.h
+++ b/libbrasero-burn/brasero-session.h
@@ -95,7 +95,7 @@ brasero_burn_session_get_size (BraseroBurnSession *session,
 			       goffset *blocks,
 			       goffset *bytes);
 
-BraseroTrackDataType
+BraseroBurnResult
 brasero_burn_session_get_input_type (BraseroBurnSession *session,
 				     BraseroTrackType *type);
 
diff --git a/libbrasero-burn/brasero-track-type.c b/libbrasero-burn/brasero-track-type.c
index 0669697..35b0423 100644
--- a/libbrasero-burn/brasero-track-type.c
+++ b/libbrasero-burn/brasero-track-type.c
@@ -48,6 +48,9 @@ brasero_track_type_new (void)
 void
 brasero_track_type_free (BraseroTrackType *type)
 {
+	if (!type)
+		return;
+
 	g_free (type);
 }
 
diff --git a/libbrasero-burn/burn-job.c b/libbrasero-burn/burn-job.c
index b1c4020..ef62454 100644
--- a/libbrasero-burn/burn-job.c
+++ b/libbrasero-burn/burn-job.c
@@ -1404,7 +1404,7 @@ brasero_job_get_flags (BraseroJob *self, BraseroBurnFlag *flags)
 BraseroBurnResult
 brasero_job_get_input_type (BraseroJob *self, BraseroTrackType *type)
 {
-	BraseroBurnResult result;
+	BraseroBurnResult result = BRASERO_BURN_OK;
 	BraseroJobPrivate *priv;
 
 	BRASERO_JOB_DEBUG (self);



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