1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
2 /*
3  * Libbrasero-burn
4  * Copyright (C) Philippe Rouquier 2005-2009 <bonfire-app@wanadoo.fr>
5  *
6  * Libbrasero-burn is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * The Libbrasero-burn authors hereby grant permission for non-GPL compatible
12  * GStreamer plugins to be used and distributed together with GStreamer
13  * and Libbrasero-burn. This permission is above and beyond the permissions granted
14  * by the GPL license by which Libbrasero-burn is covered. If you modify this code
15  * you may extend this exception to your version of the code, but you are not
16  * obligated to do so. If you do not wish to do so, delete this exception
17  * statement from your version.
18  *
19  * Libbrasero-burn is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  * GNU Library General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with this program; if not, write to:
26  * 	The Free Software Foundation, Inc.,
27  * 	51 Franklin Street, Fifth Floor
28  * 	Boston, MA  02110-1301, USA.
29  */
30 
31 #ifdef HAVE_CONFIG_H
32 #  include <config.h>
33 #endif
34 
35 #include <glib.h>
36 #include <glib/gi18n-lib.h>
37 #include <glib-object.h>
38 
39 #include <gtk/gtk.h>
40 
41 #include "brasero-misc.h"
42 #include "brasero-tags.h"
43 #include "brasero-session.h"
44 #include "brasero-session-helper.h"
45 #include "brasero-video-options.h"
46 
47 typedef struct _BraseroVideoOptionsPrivate BraseroVideoOptionsPrivate;
48 struct _BraseroVideoOptionsPrivate
49 {
50 	BraseroBurnSession *session;
51 
52 	GtkWidget *video_options;
53 	GtkWidget *vcd_label;
54 	GtkWidget *vcd_button;
55 	GtkWidget *svcd_button;
56 
57 	GtkWidget *button_native;
58 	GtkWidget *button_ntsc;
59 	GtkWidget *button_pal;
60 	GtkWidget *button_4_3;
61 	GtkWidget *button_16_9;
62 };
63 
64 #define BRASERO_VIDEO_OPTIONS_PRIVATE(o)  (G_TYPE_INSTANCE_GET_PRIVATE ((o), BRASERO_TYPE_VIDEO_OPTIONS, BraseroVideoOptionsPrivate))
65 
66 enum {
67 	PROP_0,
68 	PROP_SESSION
69 };
70 
71 G_DEFINE_TYPE (BraseroVideoOptions, brasero_video_options, GTK_TYPE_ALIGNMENT);
72 
73 static void
brasero_video_options_update_from_tag(BraseroVideoOptions * options,const gchar * tag)74 brasero_video_options_update_from_tag (BraseroVideoOptions *options,
75                                        const gchar *tag)
76 {
77 	BraseroVideoOptionsPrivate *priv;
78 
79 	if (!tag)
80 		return;
81 
82 	priv = BRASERO_VIDEO_OPTIONS_PRIVATE (options);
83 
84 	if (!strcmp (tag, BRASERO_VCD_TYPE)) {
85 		BraseroMedia media;
86 		gint svcd_type;
87 
88 		media = brasero_burn_session_get_dest_media (priv->session);
89 		if (media & BRASERO_MEDIUM_DVD) {
90 			/* Don't change anything in this case
91 			 * as the tag has no influence over
92 			 * this type of image */
93 			return;
94 		}
95 		else if (media & BRASERO_MEDIUM_FILE) {
96 			BraseroImageFormat format;
97 
98 			format = brasero_burn_session_get_output_format (priv->session);
99 
100 			/* Same as above for the following case */
101 			if (format == BRASERO_IMAGE_FORMAT_BIN)
102 				return;
103 		}
104 
105 		svcd_type = brasero_burn_session_tag_lookup_int (priv->session, tag);
106 		if (svcd_type == BRASERO_SVCD) {
107 			if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->svcd_button)))
108 				gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->svcd_button), TRUE);
109 
110 				gtk_widget_set_sensitive (priv->button_4_3, TRUE);
111 				gtk_widget_set_sensitive (priv->button_16_9, TRUE);
112 		}
113 		else {
114 			if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->vcd_button)))
115 				gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->vcd_button), TRUE);
116 
117 			gtk_widget_set_sensitive (priv->button_4_3, FALSE);
118 			gtk_widget_set_sensitive (priv->button_16_9, FALSE);
119 		}
120 	}
121 	else if (!strcmp (tag, BRASERO_VIDEO_OUTPUT_FRAMERATE)) {
122 		GValue *value = NULL;
123 
124 		brasero_burn_session_tag_lookup (priv->session,
125 						 tag,
126 						 &value);
127 		if (value) {
128 			if (g_value_get_int (value) == BRASERO_VIDEO_FRAMERATE_NTSC) {
129 				if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->button_ntsc)))
130 					gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->button_ntsc), TRUE);
131 			}
132 			else {
133 				if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->button_pal)))
134 					gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->button_pal), TRUE);
135 			}
136 		}
137 		else if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->button_native)))
138 			gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->button_native), TRUE);
139 	}
140 	else if (!strcmp (tag, BRASERO_VIDEO_OUTPUT_ASPECT)) {
141 		gint aspect_type = brasero_burn_session_tag_lookup_int (priv->session, tag);
142 
143 		if (aspect_type == BRASERO_VIDEO_ASPECT_16_9) {
144 			if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->button_16_9)))
145 				gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->button_16_9), TRUE);
146 		}
147 		else {
148 			if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->button_4_3)))
149 				gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->button_4_3), TRUE);
150 		}
151 	}
152 }
153 
154 static void
brasero_video_options_update(BraseroVideoOptions * options)155 brasero_video_options_update (BraseroVideoOptions *options)
156 {
157 	BraseroVideoOptionsPrivate *priv;
158 	BraseroMedia media;
159 
160 	priv = BRASERO_VIDEO_OPTIONS_PRIVATE (options);
161 
162 	/* means we haven't initialized yet */
163 	if (!priv->vcd_label)
164 		return;
165 
166 	media = brasero_burn_session_get_dest_media (priv->session);
167 	if (media & BRASERO_MEDIUM_DVD) {
168 		gtk_widget_hide (priv->vcd_label);
169 		gtk_widget_hide (priv->vcd_button);
170 		gtk_widget_hide (priv->svcd_button);
171 
172 		gtk_widget_set_sensitive (priv->button_4_3, TRUE);
173 		gtk_widget_set_sensitive (priv->button_16_9, TRUE);
174 	}
175 	else if (media & BRASERO_MEDIUM_CD) {
176 		gtk_widget_show (priv->vcd_label);
177 		gtk_widget_show (priv->vcd_button);
178 		gtk_widget_show (priv->svcd_button);
179 
180 		brasero_video_options_update_from_tag (options, BRASERO_VCD_TYPE);
181 	}
182 	else if (media & BRASERO_MEDIUM_FILE) {
183 		BraseroImageFormat format;
184 
185 		/* Hide any options about (S)VCD type
186 		 * as this is handled in BraseroImageTypeChooser
187 		 * object */
188 		gtk_widget_hide (priv->vcd_label);
189 		gtk_widget_hide (priv->vcd_button);
190 		gtk_widget_hide (priv->svcd_button);
191 
192 		format = brasero_burn_session_get_output_format (priv->session);
193 		if (format == BRASERO_IMAGE_FORMAT_BIN) {
194 			gtk_widget_set_sensitive (priv->button_4_3, TRUE);
195 			gtk_widget_set_sensitive (priv->button_16_9, TRUE);
196 		}
197 		else if (format == BRASERO_IMAGE_FORMAT_CUE)
198 			brasero_video_options_update_from_tag (options, BRASERO_VCD_TYPE);
199 	}
200 }
201 
202 static void
brasero_video_options_output_changed_cb(BraseroBurnSession * session,BraseroMedium * former_medium,BraseroVideoOptions * options)203 brasero_video_options_output_changed_cb (BraseroBurnSession *session,
204                                          BraseroMedium *former_medium,
205                                          BraseroVideoOptions *options)
206 {
207 	brasero_video_options_update (options);
208 }
209 
210 static void
brasero_video_options_tag_changed_cb(BraseroBurnSession * session,const gchar * tag,BraseroVideoOptions * options)211 brasero_video_options_tag_changed_cb (BraseroBurnSession *session,
212                                       const gchar *tag,
213                                       BraseroVideoOptions *options)
214 {
215 	brasero_video_options_update_from_tag (options, tag);
216 }
217 
218 static void
brasero_video_options_SVCD(GtkToggleButton * button,BraseroVideoOptions * options)219 brasero_video_options_SVCD (GtkToggleButton *button,
220 			    BraseroVideoOptions *options)
221 {
222 	BraseroVideoOptionsPrivate *priv;
223 
224 	if (!gtk_toggle_button_get_active (button))
225 		return;
226 
227 	priv = BRASERO_VIDEO_OPTIONS_PRIVATE (options);
228 	brasero_burn_session_tag_add_int (priv->session,
229 	                                  BRASERO_VCD_TYPE,
230 	                                  BRASERO_SVCD);
231 
232 	/* NOTE: this is only possible when that's
233 	 * not an image */
234 
235 	gtk_widget_set_sensitive (priv->button_4_3, TRUE);
236 	gtk_widget_set_sensitive (priv->button_16_9, TRUE);
237 }
238 
239 static void
brasero_video_options_VCD(GtkToggleButton * button,BraseroVideoOptions * options)240 brasero_video_options_VCD (GtkToggleButton *button,
241 			   BraseroVideoOptions *options)
242 {
243 	BraseroVideoOptionsPrivate *priv;
244 
245 	if (!gtk_toggle_button_get_active (button))
246 		return;
247 
248 	priv = BRASERO_VIDEO_OPTIONS_PRIVATE (options);
249 	brasero_burn_session_tag_add_int (priv->session,
250 	                                  BRASERO_VCD_TYPE,
251 	                                  BRASERO_VCD_V2);
252 
253 	/* NOTE: this is only possible when that's
254 	 * not an image */
255 	gtk_widget_set_sensitive (priv->button_4_3, FALSE);
256 	gtk_widget_set_sensitive (priv->button_16_9, FALSE);
257 
258 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->button_4_3), TRUE);
259 }
260 
261 static void
brasero_video_options_NTSC(GtkToggleButton * button,BraseroVideoOptions * options)262 brasero_video_options_NTSC (GtkToggleButton *button,
263 			    BraseroVideoOptions *options)
264 {
265 	BraseroVideoOptionsPrivate *priv;
266 
267 	if (!gtk_toggle_button_get_active (button))
268 		return;
269 
270 	priv = BRASERO_VIDEO_OPTIONS_PRIVATE (options);
271 	brasero_burn_session_tag_add_int (priv->session,
272 	                                  BRASERO_VIDEO_OUTPUT_FRAMERATE,
273 	                                  BRASERO_VIDEO_FRAMERATE_NTSC);
274 }
275 
276 static void
brasero_video_options_PAL_SECAM(GtkToggleButton * button,BraseroVideoOptions * options)277 brasero_video_options_PAL_SECAM (GtkToggleButton *button,
278 				 BraseroVideoOptions *options)
279 {
280 	BraseroVideoOptionsPrivate *priv;
281 
282 	if (!gtk_toggle_button_get_active (button))
283 		return;
284 
285 	priv = BRASERO_VIDEO_OPTIONS_PRIVATE (options);
286 	brasero_burn_session_tag_add_int (priv->session,
287 	                                  BRASERO_VIDEO_OUTPUT_FRAMERATE,
288 	                                  BRASERO_VIDEO_FRAMERATE_PAL_SECAM);
289 }
290 
291 static void
brasero_video_options_native_framerate(GtkToggleButton * button,BraseroVideoOptions * options)292 brasero_video_options_native_framerate (GtkToggleButton *button,
293 					BraseroVideoOptions *options)
294 {
295 	BraseroVideoOptionsPrivate *priv;
296 
297 	if (!gtk_toggle_button_get_active (button))
298 		return;
299 
300 	priv = BRASERO_VIDEO_OPTIONS_PRIVATE (options);
301 	brasero_burn_session_tag_remove (priv->session, BRASERO_VIDEO_OUTPUT_FRAMERATE);
302 }
303 
304 static void
brasero_video_options_16_9(GtkToggleButton * button,BraseroVideoOptions * options)305 brasero_video_options_16_9 (GtkToggleButton *button,
306 			    BraseroVideoOptions *options)
307 {
308 	BraseroVideoOptionsPrivate *priv;
309 
310 	if (!gtk_toggle_button_get_active (button))
311 		return;
312 
313 	priv = BRASERO_VIDEO_OPTIONS_PRIVATE (options);
314 	brasero_burn_session_tag_add_int (priv->session,
315 	                                  BRASERO_VIDEO_OUTPUT_ASPECT,
316 	                                  BRASERO_VIDEO_ASPECT_16_9);
317 }
318 
319 static void
brasero_video_options_4_3(GtkToggleButton * button,BraseroVideoOptions * options)320 brasero_video_options_4_3 (GtkToggleButton *button,
321 			   BraseroVideoOptions *options)
322 {
323 	BraseroVideoOptionsPrivate *priv;
324 
325 	if (!gtk_toggle_button_get_active (button))
326 		return;
327 
328 	priv = BRASERO_VIDEO_OPTIONS_PRIVATE (options);
329 	brasero_burn_session_tag_add_int (priv->session,
330 	                                  BRASERO_VIDEO_OUTPUT_ASPECT,
331 	                                  BRASERO_VIDEO_ASPECT_4_3);
332 }
333 
334 void
brasero_video_options_set_session(BraseroVideoOptions * options,BraseroBurnSession * session)335 brasero_video_options_set_session (BraseroVideoOptions *options,
336                                    BraseroBurnSession *session)
337 {
338 	BraseroVideoOptionsPrivate *priv;
339 
340 	priv = BRASERO_VIDEO_OPTIONS_PRIVATE (options);
341 	if (priv->session) {
342 		g_signal_handlers_disconnect_by_func (priv->session,
343 		                                      brasero_video_options_output_changed_cb,
344 		                                      options);
345 		g_signal_handlers_disconnect_by_func (priv->session,
346 		                                      brasero_video_options_tag_changed_cb,
347 		                                      options);
348 		g_object_unref (priv->session);
349 		priv->session = NULL;
350 	}
351 
352 	if (session) {
353 		priv->session = g_object_ref (session);
354 		brasero_video_options_update (options);
355 
356 		if (brasero_burn_session_tag_lookup (session, BRASERO_VIDEO_OUTPUT_FRAMERATE, NULL) == BRASERO_BURN_OK)
357 			brasero_video_options_update_from_tag (options, BRASERO_VIDEO_OUTPUT_FRAMERATE);
358 
359 		/* If session has tag update UI otherwise update _from_ UI */
360 		if (brasero_burn_session_tag_lookup (session, BRASERO_VIDEO_OUTPUT_ASPECT, NULL) == BRASERO_BURN_OK)
361 			brasero_video_options_update_from_tag (options, BRASERO_VIDEO_OUTPUT_ASPECT);
362 		else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->button_4_3)))
363 			brasero_burn_session_tag_add_int (priv->session,
364 			                                  BRASERO_VIDEO_OUTPUT_ASPECT,
365 	        			                  BRASERO_VIDEO_ASPECT_4_3);
366 		else
367 			brasero_burn_session_tag_add_int (priv->session,
368 				                          BRASERO_VIDEO_OUTPUT_ASPECT,
369 				                          BRASERO_VIDEO_ASPECT_16_9);
370 
371 		g_signal_connect (priv->session,
372 		                  "output-changed",
373 		                  G_CALLBACK (brasero_video_options_output_changed_cb),
374 		                  options);
375 		g_signal_connect (priv->session,
376 		                  "tag-changed",
377 		                  G_CALLBACK (brasero_video_options_tag_changed_cb),
378 		                  options);
379 	}
380 }
381 
382 static void
brasero_video_options_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec)383 brasero_video_options_set_property (GObject *object,
384 				    guint prop_id,
385 				    const GValue *value,
386 				    GParamSpec *pspec)
387 {
388 	g_return_if_fail (BRASERO_IS_VIDEO_OPTIONS (object));
389 
390 	switch (prop_id)
391 	{
392 	case PROP_SESSION:
393 		brasero_video_options_set_session (BRASERO_VIDEO_OPTIONS (object),
394 		                                   g_value_get_object (value));
395 		break;
396 	default:
397 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
398 		break;
399 	}
400 }
401 
402 static void
brasero_video_options_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec)403 brasero_video_options_get_property (GObject *object,
404 				    guint prop_id,
405 				    GValue *value,
406 				    GParamSpec *pspec)
407 {
408 	BraseroVideoOptionsPrivate *priv;
409 
410 	g_return_if_fail (BRASERO_IS_VIDEO_OPTIONS (object));
411 
412 	priv = BRASERO_VIDEO_OPTIONS_PRIVATE (object);
413 
414 	switch (prop_id)
415 	{
416 	case PROP_SESSION:
417 		g_value_set_object (value, priv->session);
418 		g_object_ref (priv->session);
419 		break;
420 	default:
421 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
422 		break;
423 	}
424 }
425 
426 static void
brasero_video_options_init(BraseroVideoOptions * object)427 brasero_video_options_init (BraseroVideoOptions *object)
428 {
429 	GtkWidget *label;
430 	GtkWidget *table;
431 	GtkWidget *widget;
432 	GtkWidget *button1;
433 	GtkWidget *button2;
434 	GtkWidget *button3;
435 	BraseroVideoOptionsPrivate *priv;
436 
437 	priv = BRASERO_VIDEO_OPTIONS_PRIVATE (object);
438 
439 	gtk_container_set_border_width (GTK_CONTAINER (object), 6);
440 	widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
441 
442 	table = gtk_table_new (3, 4, FALSE);
443 	gtk_table_set_col_spacings (GTK_TABLE (table), 8);
444 	gtk_table_set_row_spacings (GTK_TABLE (table), 6);
445 	gtk_widget_show (table);
446 
447 	label = gtk_label_new (_("Video format:"));
448 	gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
449 	gtk_widget_show (label);
450 	gtk_table_attach (GTK_TABLE (table),
451 			  label,
452 			  0, 1,
453 			  0, 1,
454 			  GTK_FILL,
455 			  GTK_FILL,
456 			  0, 0);
457 
458 	button1 = gtk_radio_button_new_with_mnemonic (NULL, _("_NTSC"));
459 	priv->button_ntsc = button1;
460 	gtk_widget_set_tooltip_text (button1, _("Format used mostly on the North American continent"));
461 	g_signal_connect (button1,
462 			  "toggled",
463 			  G_CALLBACK (brasero_video_options_NTSC),
464 			  object);
465 	gtk_table_attach (GTK_TABLE (table),
466 			  button1,
467 			  3, 4,
468 			  0, 1,
469 			  GTK_FILL,
470 			  GTK_FILL,
471 			  0, 0);
472 
473 	button2 = gtk_radio_button_new_with_mnemonic_from_widget (GTK_RADIO_BUTTON (button1), _("_PAL/SECAM"));
474 	priv->button_pal = button2;
475 	gtk_widget_set_tooltip_text (button2, _("Format used mostly in Europe"));
476 	g_signal_connect (button2,
477 			  "toggled",
478 			  G_CALLBACK (brasero_video_options_PAL_SECAM),
479 			  object);
480 	gtk_table_attach (GTK_TABLE (table),
481 			  button2,
482 			  2, 3,
483 			  0, 1,
484 			  GTK_FILL,
485 			  GTK_FILL,
486 			  0, 0);
487 
488 	button3 = gtk_radio_button_new_with_mnemonic_from_widget (GTK_RADIO_BUTTON (button1),
489 								  _("Native _format"));
490 	priv->button_native = button3;
491 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button3), TRUE);
492 	g_signal_connect (button3,
493 			  "toggled",
494 			  G_CALLBACK (brasero_video_options_native_framerate),
495 			  object);
496 	gtk_table_attach (GTK_TABLE (table),
497 			  button3,
498 			  1, 2,
499 			  0, 1,
500 			  GTK_FILL,
501 			  GTK_FILL,
502 			  0, 0);
503 
504 	label = gtk_label_new (_("Aspect ratio:"));
505 	gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
506 	gtk_widget_show (label);
507 	gtk_table_attach (GTK_TABLE (table),
508 			  label,
509 			  0, 1,
510 			  1, 2,
511 			  GTK_FILL,
512 			  GTK_FILL,
513 			  0, 0);
514 
515 	button1 = gtk_radio_button_new_with_mnemonic (NULL, _("_4:3"));
516 	g_signal_connect (button1,
517 			  "toggled",
518 			  G_CALLBACK (brasero_video_options_4_3),
519 			  object);
520 	gtk_table_attach (GTK_TABLE (table),
521 			  button1,
522 			  1, 2,
523 			  1, 2,
524 			  GTK_FILL,
525 			  GTK_FILL,
526 			  0, 0);
527 	priv->button_4_3 = button1;
528 
529 	button2 = gtk_radio_button_new_with_mnemonic_from_widget (GTK_RADIO_BUTTON (button1),
530 								  _("_16:9"));
531 	g_signal_connect (button2,
532 			  "toggled",
533 			  G_CALLBACK (brasero_video_options_16_9),
534 			  object);
535 	gtk_table_attach (GTK_TABLE (table),
536 			  button2,
537 			  2, 3,
538 			  1, 2,
539 			  GTK_FILL,
540 			  GTK_FILL,
541 			  0, 0);
542 	priv->button_16_9 = button2;
543 
544 	/* Video options for (S)VCD */
545 	label = gtk_label_new (_("VCD type:"));
546 	priv->vcd_label = label;
547 
548 	gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
549 	gtk_widget_show (label);
550 	gtk_table_attach (GTK_TABLE (table),
551 			  label,
552 			  0, 1,
553 			  2, 3,
554 			  GTK_FILL,
555 			  GTK_FILL,
556 			  0, 0);
557 
558 	button1 = gtk_radio_button_new_with_mnemonic_from_widget (NULL, _("Create an SVCD"));
559 	priv->svcd_button = button1;
560 	gtk_table_attach (GTK_TABLE (table),
561 			  button1,
562 			  1, 2,
563 			  2, 3,
564 			  GTK_FILL,
565 			  GTK_FILL,
566 			  0, 0);
567 
568 	g_signal_connect (button1,
569 			  "clicked",
570 			  G_CALLBACK (brasero_video_options_SVCD),
571 			  object);
572 
573 	button2 = gtk_radio_button_new_with_mnemonic_from_widget (GTK_RADIO_BUTTON (button1), _("Create a VCD"));
574 	priv->vcd_button = button2;
575 	gtk_table_attach (GTK_TABLE (table),
576 			  button2,
577 			  2, 3,
578 			  2, 3,
579 			  GTK_FILL,
580 			  GTK_FILL,
581 			  0, 0);
582 
583 	g_signal_connect (button2,
584 			  "clicked",
585 			  G_CALLBACK (brasero_video_options_VCD),
586 			  object);
587 
588 	gtk_box_pack_start (GTK_BOX (widget), table, FALSE, FALSE, 0);
589 
590 	/* NOTE: audio options for DVDs were removed. For SVCD that is MP2 and
591 	 * for Video DVD even if we have a choice AC3 is the most widespread
592 	 * audio format. So use AC3 by default. */
593 
594 	gtk_widget_show_all (widget);
595 	gtk_container_add (GTK_CONTAINER (object), widget);
596 }
597 
598 static void
brasero_video_options_finalize(GObject * object)599 brasero_video_options_finalize (GObject *object)
600 {
601 	BraseroVideoOptionsPrivate *priv;
602 
603 	priv = BRASERO_VIDEO_OPTIONS_PRIVATE (object);
604 	if (priv->session) {
605 		g_signal_handlers_disconnect_by_func (priv->session,
606 		                                      brasero_video_options_output_changed_cb,
607 		                                      object);
608 		g_signal_handlers_disconnect_by_func (priv->session,
609 		                                      brasero_video_options_tag_changed_cb,
610 		                                      object);
611 		g_object_unref (priv->session);
612 		priv->session = NULL;
613 	}
614 
615 	G_OBJECT_CLASS (brasero_video_options_parent_class)->finalize (object);
616 }
617 
618 static void
brasero_video_options_class_init(BraseroVideoOptionsClass * klass)619 brasero_video_options_class_init (BraseroVideoOptionsClass *klass)
620 {
621 	GObjectClass* object_class = G_OBJECT_CLASS (klass);
622 
623 	g_type_class_add_private (klass, sizeof (BraseroVideoOptionsPrivate));
624 
625 	object_class->finalize = brasero_video_options_finalize;
626 	object_class->set_property = brasero_video_options_set_property;
627 	object_class->get_property = brasero_video_options_get_property;
628 
629 	g_object_class_install_property (object_class,
630 					 PROP_SESSION,
631 					 g_param_spec_object ("session",
632 							      "The session",
633 							      "The session to work with",
634 							      BRASERO_TYPE_BURN_SESSION,
635 							      G_PARAM_READWRITE));
636 }
637 
638 GtkWidget *
brasero_video_options_new(BraseroBurnSession * session)639 brasero_video_options_new (BraseroBurnSession *session)
640 {
641 	return g_object_new (BRASERO_TYPE_VIDEO_OPTIONS, "session", session, NULL);
642 }
643