[brasero] Fix project type switching



commit 8fca3b78e78a39b8fea20b6174c535493506316c
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date:   Mon Jun 8 21:00:53 2009 +0200

    Fix project type switching

 src/brasero-data-disc.c        |   37 ++++++++++++++++++++++++++++++++++++-
 src/brasero-project.c          |    7 ++-----
 src/brasero-video-disc.c       |    3 +++
 src/brasero-video-tree-model.c |   19 ++++++++++++++++---
 4 files changed, 57 insertions(+), 9 deletions(-)
---
diff --git a/src/brasero-data-disc.c b/src/brasero-data-disc.c
index d0b4d26..438e055 100644
--- a/src/brasero-data-disc.c
+++ b/src/brasero-data-disc.c
@@ -1348,6 +1348,34 @@ brasero_data_disc_get_track (BraseroDisc *disc,
 	return BRASERO_DISC_OK;
 }
 
+static void
+brasero_data_disc_track_removed (BraseroBurnSession *session,
+				 BraseroTrack *track,
+				 guint former_position,
+				 BraseroDataDisc *disc)
+{
+	BraseroDataDiscPrivate *priv;
+
+	priv = BRASERO_DATA_DISC_PRIVATE (disc);
+
+	g_signal_handlers_disconnect_by_func (session,
+					      brasero_data_disc_track_removed,
+					      disc);
+
+	/* Hide all toggle actions for session importing */
+	if (gtk_action_group_get_visible (priv->import_group))
+		gtk_action_group_set_visible (priv->import_group, FALSE);
+
+	if (gtk_action_group_get_visible (priv->disc_group))
+		gtk_action_group_set_visible (priv->disc_group, FALSE);
+
+	if (priv->load_errors) {
+		g_slist_foreach (priv->load_errors, (GFunc) g_free , NULL);
+		g_slist_free (priv->load_errors);
+		priv->load_errors = NULL;
+	}
+}
+
 static BraseroDiscResult
 brasero_data_disc_set_session_contents (BraseroDisc *self,
 					BraseroBurnSession *session)
@@ -1356,7 +1384,14 @@ brasero_data_disc_set_session_contents (BraseroDisc *self,
 
 	priv = BRASERO_DATA_DISC_PRIVATE (self);
 
-	brasero_burn_session_add_track (session, BRASERO_TRACK (priv->project), NULL);
+	brasero_burn_session_add_track (session,
+					BRASERO_TRACK (priv->project),
+					NULL);
+	g_signal_connect (session,
+			  "track-removed",
+			  G_CALLBACK (brasero_data_disc_track_removed),
+			  self);
+
 	return BRASERO_DISC_OK;
 }
 
diff --git a/src/brasero-project.c b/src/brasero-project.c
index 75aa55a..fc925e8 100644
--- a/src/brasero-project.c
+++ b/src/brasero-project.c
@@ -1354,7 +1354,6 @@ static void
 brasero_project_switch (BraseroProject *project, BraseroProjectType type)
 {
 	GtkAction *action;
-	GConfClient *client;
 	
 	if (project->priv->project_status) {
 		gtk_widget_hide (project->priv->project_status);
@@ -1387,9 +1386,7 @@ brasero_project_switch (BraseroProject *project, BraseroProjectType type)
 		g_free (project->priv->cover);
 		project->priv->cover = NULL;
 	}
-
-	client = gconf_client_get_default ();
-
+g_print ("IN HERE\n");
 	/* remove the buttons from the "toolbar" */
 	if (project->priv->merge_id) {
 		g_print ("REEEK\n");
@@ -1424,7 +1421,7 @@ brasero_project_switch (BraseroProject *project, BraseroProjectType type)
 	}
 	else if (type == BRASERO_PROJECT_TYPE_VIDEO) {
 		gtk_widget_hide (project->priv->button_img);
-
+g_print ("KKK\n");
 		project->priv->current = BRASERO_DISC (project->priv->video);
 		project->priv->merge_id = brasero_disc_add_ui (project->priv->current,
 							       project->priv->manager,
diff --git a/src/brasero-video-disc.c b/src/brasero-video-disc.c
index d348fcb..6a42809 100644
--- a/src/brasero-video-disc.c
+++ b/src/brasero-video-disc.c
@@ -458,6 +458,9 @@ brasero_video_disc_session_changed (BraseroSessionCfg *session,
 		track = tracks->data;
 		next = tracks->next;
 
+		if (!BRASERO_IS_TRACK_STREAM (track))
+			continue;
+
 		result = brasero_track_get_status (BRASERO_TRACK (track), status);
 		if (result == BRASERO_BURN_ERR) {
 			GError *error;
diff --git a/src/brasero-video-tree-model.c b/src/brasero-video-tree-model.c
index 46b4cf7..d881b98 100644
--- a/src/brasero-video-tree-model.c
+++ b/src/brasero-video-tree-model.c
@@ -138,6 +138,9 @@ brasero_video_tree_model_get_value (GtkTreeModel *model,
 
 	track = iter->user_data;
 
+	if (!BRASERO_IS_TRACK_STREAM (track))
+		return;
+
 	switch (column) {
 	case BRASERO_VIDEO_TREE_MODEL_NAME:
 		g_value_init (value, G_TYPE_STRING);
@@ -234,10 +237,8 @@ brasero_video_tree_model_get_value (GtkTreeModel *model,
 		return;
 
 	default:
-		return;
+		break;
 	}
-
-	return;
 }
 
 GtkTreePath *
@@ -249,6 +250,9 @@ brasero_video_tree_model_track_to_path (BraseroVideoTreeModel *self,
 	GSList *tracks;
 	guint nth;
 
+	if (!BRASERO_IS_TRACK_STREAM (track))
+		return NULL;
+
 	priv = BRASERO_VIDEO_TREE_MODEL_PRIVATE (self);
 
 	path = gtk_tree_path_new ();
@@ -529,6 +533,9 @@ brasero_video_tree_model_track_added (BraseroBurnSession *session,
 	GtkTreePath *path;
 	GtkTreeIter iter;
 
+	if (!BRASERO_IS_TRACK_STREAM (track))
+		return;
+
 	priv = BRASERO_VIDEO_TREE_MODEL_PRIVATE (model);
 
 	iter.stamp = priv->stamp;
@@ -557,6 +564,9 @@ brasero_video_tree_model_track_removed (BraseroBurnSession *session,
 	BraseroVideoTreeModelPrivate *priv;
 	GtkTreePath *path;
 
+	if (!BRASERO_IS_TRACK_STREAM (track))
+		return;
+
 	priv = BRASERO_VIDEO_TREE_MODEL_PRIVATE (model);
 
 	/* remove the file. */
@@ -575,6 +585,9 @@ brasero_video_tree_model_track_changed (BraseroBurnSession *session,
 	GtkTreePath *path;
 	GtkTreeIter iter;
 
+	if (!BRASERO_IS_TRACK_STREAM (track))
+		return;
+
 	priv = BRASERO_VIDEO_TREE_MODEL_PRIVATE (model);
 
 	/* scale the thumbnail */



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