[brasero] Add video options back to the options dialog when we burn to a disc



commit 87fcab263b7b0cbf27007de83c046a966e92b0af
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date:   Thu Jul 2 16:08:22 2009 +0200

    Add video options back to the options dialog when we burn to a disc

 libbrasero-burn/brasero-video-options.c |   47 +++++++++++++++++++++---------
 libbrasero-burn/brasero-video-options.h |    4 ++
 libbrasero-media/brasero-drive.c        |    1 -
 src/brasero-project.c                   |   28 ++++++++++++++++--
 4 files changed, 62 insertions(+), 18 deletions(-)
---
diff --git a/libbrasero-burn/brasero-video-options.c b/libbrasero-burn/brasero-video-options.c
index e9ba566..08633df 100644
--- a/libbrasero-burn/brasero-video-options.c
+++ b/libbrasero-burn/brasero-video-options.c
@@ -75,6 +75,9 @@ brasero_video_options_audio_AC3 (BraseroVideoOptions *options)
 
 	priv = BRASERO_VIDEO_OPTIONS_PRIVATE (options);
 
+	if (!priv->session)
+		return;
+
 	value = g_new0 (GValue, 1);
 	g_value_init (value, G_TYPE_INT);
 	g_value_set_int (value, BRASERO_AUDIO_FORMAT_AC3);
@@ -91,6 +94,9 @@ brasero_video_options_audio_MP2 (BraseroVideoOptions *options)
 
 	priv = BRASERO_VIDEO_OPTIONS_PRIVATE (options);
 
+	if (!priv->session)
+		return;
+
 	value = g_new0 (GValue, 1);
 	g_value_init (value, G_TYPE_INT);
 	g_value_set_int (value, BRASERO_AUDIO_FORMAT_MP2);
@@ -181,6 +187,9 @@ brasero_video_options_set_tag (BraseroVideoOptions *options,
 
 	priv = BRASERO_VIDEO_OPTIONS_PRIVATE (options);
 
+	if (!priv->session)
+		return;
+
 	value = g_new0 (GValue, 1);
 	g_value_init (value, G_TYPE_INT);
 	g_value_set_int (value, contents);
@@ -289,6 +298,24 @@ brasero_video_options_4_3 (GtkToggleButton *button,
 				       BRASERO_VIDEO_ASPECT_4_3);
 }
 
+void
+brasero_video_options_set_session (BraseroVideoOptions *options,
+                                   BraseroBurnSession *session)
+{
+	BraseroVideoOptionsPrivate *priv;
+
+	priv = BRASERO_VIDEO_OPTIONS_PRIVATE (options);
+	if (priv->session) {
+		g_object_unref (priv->session);
+		priv->session = NULL;
+	}
+
+	if (session) {
+		priv->session = g_object_ref (session);
+		brasero_video_options_update (options);
+	}
+}
+
 static void
 brasero_video_options_set_property (GObject *object,
 				    guint prop_id,
@@ -303,10 +330,9 @@ brasero_video_options_set_property (GObject *object,
 
 	switch (prop_id)
 	{
-	case PROP_SESSION: /* Readable and only writable at creation time */
-		priv->session = BRASERO_BURN_SESSION (g_value_get_object (value));
-		g_object_ref (priv->session);
-		brasero_video_options_update (BRASERO_VIDEO_OPTIONS(object));
+	case PROP_SESSION:
+		brasero_video_options_set_session (BRASERO_VIDEO_OPTIONS (object),
+		                                   g_value_get_object (value));
 		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -341,18 +367,17 @@ brasero_video_options_get_property (GObject *object,
 static void
 brasero_video_options_init (BraseroVideoOptions *object)
 {
-	gchar *string;
 	GtkWidget *label;
 	GtkWidget *table;
 	GtkWidget *widget;
 	GtkWidget *button1;
 	GtkWidget *button2;
 	GtkWidget *button3;
-	GtkWidget *options;
 	BraseroVideoOptionsPrivate *priv;
 
 	priv = BRASERO_VIDEO_OPTIONS_PRIVATE (object);
 
+	gtk_container_set_border_width (GTK_CONTAINER (object), 6);
 	widget = gtk_vbox_new (FALSE, 0);
 
 	table = gtk_table_new (3, 4, FALSE);
@@ -501,13 +526,7 @@ brasero_video_options_init (BraseroVideoOptions *object)
 			  G_CALLBACK (brasero_video_options_VCD),
 			  object);
 
-	string = g_strdup_printf ("<b>%s</b>", _("Video Options"));
-	options = brasero_utils_pack_properties (string,
-						 table,
-						 NULL);
-	g_free (string);
-
-	gtk_box_pack_start (GTK_BOX (widget), options, FALSE, FALSE, 0);
+	gtk_box_pack_start (GTK_BOX (widget), table, FALSE, FALSE, 0);
 
 	/* NOTE: audio options for DVDs were removed. For SVCD that is MP2 and
 	 * for Video DVD even if we have a choice AC3 is the most widespread
@@ -556,7 +575,7 @@ brasero_video_options_class_init (BraseroVideoOptionsClass *klass)
 							      "The session",
 							      "The session to work with",
 							      BRASERO_TYPE_BURN_SESSION,
-							      G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY));
+							      G_PARAM_READWRITE));
 }
 
 GtkWidget *
diff --git a/libbrasero-burn/brasero-video-options.h b/libbrasero-burn/brasero-video-options.h
index a5f3ca7..f962018 100644
--- a/libbrasero-burn/brasero-video-options.h
+++ b/libbrasero-burn/brasero-video-options.h
@@ -53,6 +53,10 @@ GType brasero_video_options_get_type (void) G_GNUC_CONST;
 GtkWidget *
 brasero_video_options_new (BraseroBurnSession *session);
 
+void
+brasero_video_options_set_session (BraseroVideoOptions *options,
+                                   BraseroBurnSession *session);
+
 G_END_DECLS
 
 #endif /* _BRASERO_VIDEO_OPTIONS_H_ */
diff --git a/libbrasero-media/brasero-drive.c b/libbrasero-media/brasero-drive.c
index 47ba34c..c9095b2 100644
--- a/libbrasero-media/brasero-drive.c
+++ b/libbrasero-media/brasero-drive.c
@@ -849,7 +849,6 @@ brasero_drive_get_gdrive_real (BraseroDrive *drive)
 
 		tmp = iter->data;
 		device_path = g_drive_get_identifier (tmp, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
-		g_print ("TETS %s\n", device_path);
 		if (!device_path)
 			continue;
 
diff --git a/src/brasero-project.c b/src/brasero-project.c
index cbac010..23e1757 100644
--- a/src/brasero-project.c
+++ b/src/brasero-project.c
@@ -1338,20 +1338,20 @@ brasero_project_setup_session (BraseroProject *project,
 static gboolean
 brasero_project_drive_properties (BraseroProject *project)
 {
+	BraseroTrackType *track_type;
 	GtkWidget *medium_prop;
 	GtkResponseType answer;
 	BraseroDrive *drive;
 	GtkWidget *toplevel;
 	gchar *display_name;
+	GtkWidget *options;
 	GtkWidget *button;
 	GtkWidget *dialog;
 	GtkWidget *box;
 	gchar *header;
+	gchar *string;
 
 	/* Build dialog */
-	medium_prop = brasero_drive_properties_new (project->priv->session);
-	gtk_widget_show (medium_prop);
-
 	toplevel = gtk_widget_get_toplevel (GTK_WIDGET (project));
 
 	drive = brasero_burn_session_get_burner (BRASERO_BURN_SESSION (project->priv->session));
@@ -1378,6 +1378,28 @@ brasero_project_drive_properties (BraseroProject *project)
 				      GTK_RESPONSE_OK);
 
 	box = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+
+	track_type = brasero_track_type_new ();
+
+	brasero_burn_session_get_input_type (BRASERO_BURN_SESSION (project->priv->session), track_type);
+	if (brasero_track_type_get_has_stream (track_type)
+	&& BRASERO_STREAM_FORMAT_HAS_VIDEO (brasero_track_type_get_stream_format (track_type))) {
+		/* Special case for video project */
+		options = brasero_video_options_new (BRASERO_BURN_SESSION (project->priv->session));
+		gtk_widget_show (options);
+
+		string = g_strdup_printf ("<b>%s</b>", _("Video Options"));
+		options = brasero_utils_pack_properties (string,
+							 options,
+							 NULL);
+		g_free (string);
+		gtk_box_pack_start (GTK_BOX (box), options, FALSE, TRUE, 0);
+	}
+
+	brasero_track_type_free (track_type);
+
+	medium_prop = brasero_drive_properties_new (project->priv->session);
+	gtk_widget_show (medium_prop);
 	gtk_box_pack_start (GTK_BOX (box), medium_prop, TRUE, TRUE, 0);
 
 	/* launch the dialog */



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