~ubuntu-branches/ubuntu/karmic/brasero/karmic

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/*
 * brasero
 * Copyright (C) Philippe Rouquier 2008 <bonfire-app@wanadoo.fr>
 * 
 * brasero is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * brasero is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifdef HAVE_CONFIG_H
#  include <config.h>
#endif

#include <string.h>

#include <glib.h>
#include <glib-object.h>
#include <glib/gi18n-lib.h>

#include <gtk/gtk.h>

#include "brasero-medium-properties.h"
#include "brasero-drive-properties.h"
#include "brasero-image-properties.h"
#include "brasero-session-cfg.h"

#include "burn-basics.h"
#include "burn-caps.h"
#include "burn-track.h"
#include "brasero-medium.h"
#include "burn-session.h"

typedef struct _BraseroMediumPropertiesPrivate BraseroMediumPropertiesPrivate;
struct _BraseroMediumPropertiesPrivate
{
	BraseroBurnSession *session;
	BraseroBurnCaps *caps;

	GtkWidget *medium_prop;

	glong valid_sig;

	guint default_format:1;
	guint default_path:1;
	guint default_ext:1;
};

#define BRASERO_MEDIUM_PROPERTIES_PRIVATE(o)  (G_TYPE_INSTANCE_GET_PRIVATE ((o), BRASERO_TYPE_MEDIUM_PROPERTIES, BraseroMediumPropertiesPrivate))

enum {
	PROP_0,
	PROP_SESSION
};

G_DEFINE_TYPE (BraseroMediumProperties, brasero_medium_properties, GTK_TYPE_BUTTON);

static void
brasero_medium_properties_drive_properties (BraseroMediumProperties *self)
{
	BraseroMediumPropertiesPrivate *priv;
	BraseroBurnFlag compulsory = 0;
	BraseroBurnFlag supported = 0;
	BraseroBurnFlag flags = 0;
	BraseroDrive *drive;
	GtkWidget *toplevel;
	const gchar *path;
	gint result;
	gint64 rate;

	priv = BRASERO_MEDIUM_PROPERTIES_PRIVATE (self);

	/* Build dialog */
	priv->medium_prop = brasero_drive_properties_new ();

	toplevel = gtk_widget_get_toplevel (GTK_WIDGET (self));
	gtk_window_set_transient_for (GTK_WINDOW (priv->medium_prop), GTK_WINDOW (toplevel));
	gtk_window_set_destroy_with_parent (GTK_WINDOW (priv->medium_prop), TRUE);
	gtk_window_set_position (GTK_WINDOW (toplevel), GTK_WIN_POS_CENTER_ON_PARENT);

	/* get information */
	drive = brasero_burn_session_get_burner (priv->session);
	rate = brasero_burn_session_get_rate (priv->session);

	brasero_drive_properties_set_drive (BRASERO_DRIVE_PROPERTIES (priv->medium_prop),
					    drive,
					    rate);

	flags = brasero_burn_session_get_flags (priv->session);
	brasero_burn_caps_get_flags (priv->caps,
				     priv->session,
				     &supported,
				     &compulsory);

	brasero_drive_properties_set_flags (BRASERO_DRIVE_PROPERTIES (priv->medium_prop),
					    flags,
					    supported,
					    compulsory);

	path = brasero_burn_session_get_tmpdir (priv->session);
	brasero_drive_properties_set_tmpdir (BRASERO_DRIVE_PROPERTIES (priv->medium_prop),
					     path);

	/* launch the dialog */
	gtk_widget_show_all (priv->medium_prop);
	result = gtk_dialog_run (GTK_DIALOG (priv->medium_prop));
	if (result != GTK_RESPONSE_ACCEPT) {
		gtk_widget_destroy (priv->medium_prop);
		priv->medium_prop = NULL;
		return;
	}

	rate = brasero_drive_properties_get_rate (BRASERO_DRIVE_PROPERTIES (priv->medium_prop));
	brasero_burn_session_set_rate (priv->session, rate);

	brasero_burn_session_remove_flag (priv->session, BRASERO_DRIVE_PROPERTIES_FLAGS);
	flags = brasero_drive_properties_get_flags (BRASERO_DRIVE_PROPERTIES (priv->medium_prop));
	brasero_session_cfg_add_flags (BRASERO_SESSION_CFG (priv->session), flags);

	path = brasero_drive_properties_get_tmpdir (BRASERO_DRIVE_PROPERTIES (priv->medium_prop));
	brasero_burn_session_set_tmpdir (priv->session, path);

	gtk_widget_destroy (priv->medium_prop);
	priv->medium_prop = NULL;
}

static gchar *
brasero_medium_properties_get_output_path (BraseroMediumProperties *self)
{
	gchar *path = NULL;
	BraseroImageFormat format;
	BraseroMediumPropertiesPrivate *priv;

	priv = BRASERO_MEDIUM_PROPERTIES_PRIVATE (self);

	format = brasero_burn_session_get_output_format (priv->session);
	switch (format) {
	case BRASERO_IMAGE_FORMAT_BIN:
		brasero_burn_session_get_output (priv->session,
						 &path,
						 NULL,
						 NULL);
		break;

	case BRASERO_IMAGE_FORMAT_CLONE:
		brasero_burn_session_get_output (priv->session,
						 NULL,
						 &path,
						 NULL);
		break;

	case BRASERO_IMAGE_FORMAT_CDRDAO:
		brasero_burn_session_get_output (priv->session,
						 NULL,
						 &path,
						 NULL);
		break;

	case BRASERO_IMAGE_FORMAT_CUE:
		brasero_burn_session_get_output (priv->session,
						 NULL,
						 &path,
						 NULL);
		break;

	default:
		break;
	}

	return path;
}

static void
brasero_medium_properties_set_output_path (BraseroMediumProperties *self,
					   BraseroImageFormat format,
					   const gchar *path)
{
	BraseroMediumPropertiesPrivate *priv;

	priv = BRASERO_MEDIUM_PROPERTIES_PRIVATE (self);

	switch (format) {
	case BRASERO_IMAGE_FORMAT_BIN:
		brasero_burn_session_set_image_output_full (priv->session,
							    format,
							    path,
							    NULL);
		break;

	case BRASERO_IMAGE_FORMAT_CDRDAO:
	case BRASERO_IMAGE_FORMAT_CLONE:
	case BRASERO_IMAGE_FORMAT_CUE:
		brasero_burn_session_set_image_output_full (priv->session,
							    format,
							    NULL,
							    path);
		break;

	default:
		break;
	}
}

static guint
brasero_medium_properties_get_possible_output_formats (BraseroMediumProperties *self,
						       BraseroImageFormat *formats)
{
	guint num = 0;
	BraseroTrackType output;
	BraseroImageFormat format;
	BraseroMediumPropertiesPrivate *priv;

	priv = BRASERO_MEDIUM_PROPERTIES_PRIVATE (self);

	/* see how many output format are available */
	format = BRASERO_IMAGE_FORMAT_CDRDAO;
	(*formats) = BRASERO_IMAGE_FORMAT_NONE;
	output.type = BRASERO_TRACK_TYPE_IMAGE;

	for (; format > BRASERO_IMAGE_FORMAT_NONE; format >>= 1) {
		BraseroBurnResult result;

		output.subtype.img_format = format;
		result = brasero_burn_caps_is_output_supported (priv->caps,
								priv->session,
								&output);
		if (result == BRASERO_BURN_OK) {
			(*formats) |= format;
			num ++;
		}
	}

	return num;
}

static void
brasero_medium_properties_image_format_changed_cb (BraseroImageProperties *dialog,
						   BraseroMediumProperties *self)
{
	BraseroMediumPropertiesPrivate *priv;
	BraseroImageFormat format;
	gchar *image_path;

	priv = BRASERO_MEDIUM_PROPERTIES_PRIVATE (self);

	/* make sure the extension is still valid */
	image_path = brasero_image_properties_get_path (dialog);
	if (!image_path)
		return;

	format = brasero_image_properties_get_format (dialog);

	if (format == BRASERO_IMAGE_FORMAT_ANY || format == BRASERO_IMAGE_FORMAT_NONE)
		format = brasero_burn_caps_get_default_output_format (priv->caps, priv->session);

	if (priv->default_path && !brasero_image_properties_is_path_edited (dialog)) {
		/* not changed: get a new default path */
		g_free (image_path);
		image_path = brasero_image_format_get_default_path (format);
	}
	else if (image_path) {
		gchar *tmp;

		tmp = image_path;
		image_path = brasero_image_format_fix_path_extension (format, FALSE, image_path);
		g_free (tmp);
	}
	else {
		priv->default_path = TRUE;
		image_path = brasero_image_format_get_default_path (format);
	}

	brasero_image_properties_set_path (dialog, image_path);
}

static gboolean
brasero_medium_properties_image_check_extension (BraseroMediumProperties *self,
						 BraseroImageFormat format,
						 const gchar *path)
{
	gchar *dot;
	const gchar *suffixes [] = {".iso",
				    ".toc",
				    ".cue",
				    ".toc",
				    NULL };

	dot = g_utf8_strrchr (path, -1, '.');
	if (dot) {
		if (format & BRASERO_IMAGE_FORMAT_BIN
		&& !strcmp (suffixes [0], dot))
			return TRUE;
		else if (format & BRASERO_IMAGE_FORMAT_CLONE
		     && !strcmp (suffixes [1], dot))
			return TRUE;
		else if (format & BRASERO_IMAGE_FORMAT_CUE
		     && !strcmp (suffixes [2], dot))
			return TRUE;
		else if (format & BRASERO_IMAGE_FORMAT_CDRDAO
		     && !strcmp (suffixes [3], dot))
			return TRUE;
	}

	return FALSE;
}

static gboolean
brasero_medium_properties_image_extension_ask (BraseroMediumProperties *self)
{
	GtkWidget *dialog;
	GtkWidget *toplevel;
	GtkResponseType answer;

	toplevel = gtk_widget_get_toplevel (GTK_WIDGET (self));
	dialog = gtk_message_dialog_new (GTK_WINDOW (toplevel),
					 GTK_DIALOG_DESTROY_WITH_PARENT |
					 GTK_DIALOG_MODAL,
					 GTK_MESSAGE_WARNING,
					 GTK_BUTTONS_NONE,
					 _("Do you really want to keep the current extension for the disc image name?"));

		
	gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
						  _("If you choose to keep it, programs may not be able to recognize the file type properly."));

	gtk_dialog_add_button (GTK_DIALOG (dialog),
			       _("_Keep Current Extension"),
			       GTK_RESPONSE_CANCEL);
	gtk_dialog_add_button (GTK_DIALOG (dialog),
			       _("Change _Extension"),
			       GTK_RESPONSE_YES);

	answer = gtk_dialog_run (GTK_DIALOG (dialog));
	gtk_widget_destroy (dialog);

	if (answer == GTK_RESPONSE_YES)
		return TRUE;

	return FALSE;
}

static void
brasero_medium_properties_image_properties (BraseroMediumProperties *self)
{
	BraseroMediumPropertiesPrivate *priv;
	BraseroImageFormat formats;
	BraseroImageFormat format;
	gulong format_changed;
	gchar *original_path;
	GtkWindow *toplevel;
	gchar *image_path;
	gint answer;
	guint num;

	priv = BRASERO_MEDIUM_PROPERTIES_PRIVATE (self);

	priv->medium_prop = brasero_image_properties_new ();

	toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self)));
	gtk_window_set_transient_for (GTK_WINDOW (priv->medium_prop), GTK_WINDOW (toplevel));
	gtk_window_set_destroy_with_parent (GTK_WINDOW (priv->medium_prop), TRUE);
	gtk_window_set_position (GTK_WINDOW (toplevel), GTK_WIN_POS_CENTER_ON_PARENT);

	/* set all information namely path and format */
	original_path = brasero_medium_properties_get_output_path (self);
	brasero_image_properties_set_path (BRASERO_IMAGE_PROPERTIES (priv->medium_prop), original_path);
	g_free (original_path);

	if (!priv->default_format)
		format = brasero_burn_session_get_output_format (priv->session);
	else
		format = BRASERO_IMAGE_FORMAT_ANY;

	num = brasero_medium_properties_get_possible_output_formats (self, &formats);
	brasero_image_properties_set_formats (BRASERO_IMAGE_PROPERTIES (priv->medium_prop),
					      num > 0 ? formats:BRASERO_IMAGE_FORMAT_NONE,
					      format);

	format_changed = g_signal_connect (priv->medium_prop,
					   "format-changed",
					   G_CALLBACK (brasero_medium_properties_image_format_changed_cb),
					   self);

	/* and here we go ... run the thing */
	gtk_widget_show (priv->medium_prop);
	answer = gtk_dialog_run (GTK_DIALOG (priv->medium_prop));

	g_signal_handler_disconnect (priv->medium_prop, format_changed);

	if (answer != GTK_RESPONSE_OK) {
		gtk_widget_destroy (priv->medium_prop);
		priv->medium_prop = NULL;
		return;
	}

	/* get and check format */
	format = brasero_image_properties_get_format (BRASERO_IMAGE_PROPERTIES (priv->medium_prop));

	/* see if we are to choose the format ourselves */
	if (format == BRASERO_IMAGE_FORMAT_ANY || format == BRASERO_IMAGE_FORMAT_NONE) {
		format = brasero_burn_caps_get_default_output_format (priv->caps, priv->session);
		priv->default_format = TRUE;
	}
	else
		priv->default_format = FALSE;

	/* see if the user has changed the path */
	if (brasero_image_properties_is_path_edited (BRASERO_IMAGE_PROPERTIES (priv->medium_prop)))
		priv->default_path = FALSE;

	if (!priv->default_path) {
		/* check the extension */
		image_path = brasero_image_properties_get_path (BRASERO_IMAGE_PROPERTIES (priv->medium_prop));

		/* there is one special case: CLONE image tocs _must_ have a
		 * correct suffix ".toc" so don't ask, fix it */
		if (!brasero_medium_properties_image_check_extension (self, format, image_path)) {
			if (format == BRASERO_IMAGE_FORMAT_CLONE
			||  brasero_medium_properties_image_extension_ask (self)) {
				gchar *tmp;

				priv->default_ext = TRUE;
				tmp = image_path;
				image_path = brasero_image_format_fix_path_extension (format, TRUE, image_path);
				g_free (tmp);
			}
			else
				priv->default_ext = FALSE;
		}
	}
	else
		image_path = brasero_image_format_get_default_path (format);

	gtk_widget_destroy (priv->medium_prop);
	priv->medium_prop = NULL;

	brasero_medium_properties_set_output_path (self,
						format,
						image_path);
	g_free (image_path);
}

static void
brasero_medium_properties_clicked (GtkButton *button)
{
	BraseroMediumPropertiesPrivate *priv;
	BraseroDrive *drive;

	priv = BRASERO_MEDIUM_PROPERTIES_PRIVATE (button);

	drive = brasero_burn_session_get_burner (priv->session);
	if (!drive)
		return;

	if (brasero_drive_is_fake (drive))
		brasero_medium_properties_image_properties (BRASERO_MEDIUM_PROPERTIES (button));
	else
		brasero_medium_properties_drive_properties (BRASERO_MEDIUM_PROPERTIES (button));
}

static void
brasero_medium_properties_update_image_output (BraseroMediumProperties *self,
					       gboolean is_valid)
{
	BraseroMediumPropertiesPrivate *priv;
	BraseroImageFormat valid_format;
	BraseroImageFormat format;
	gchar *path = NULL;

	priv = BRASERO_MEDIUM_PROPERTIES_PRIVATE (self);

	/* Get session current state */
	format = brasero_burn_session_get_output_format (priv->session);
	valid_format = format;

	/* Check current set format if it's invalid */
	if (format != BRASERO_IMAGE_FORMAT_NONE) {
		/* The user set a format. There is nothing to do about it except
		 * checking if the format is still available. If not, then set
		 * default and remove the current one */
		if (!is_valid) {
			priv->default_format = TRUE;
			valid_format = brasero_burn_caps_get_default_output_format (priv->caps, priv->session);
		}
		else if (priv->default_format) {
			/* since input, or caps changed, check if there isn't a
			 * better format available. */
			valid_format = brasero_burn_caps_get_default_output_format (priv->caps, priv->session);
		}
	}
	else {
		/* This is always invalid; find one */
		priv->default_format = TRUE;
		valid_format = brasero_burn_caps_get_default_output_format (priv->caps, priv->session);
	}

	/* see if we have a workable format */
	if (valid_format == BRASERO_IMAGE_FORMAT_NONE) {
		if (priv->medium_prop) {
			gtk_widget_destroy (priv->medium_prop);
			priv->medium_prop = NULL;
		}

		return;
	}

	path = brasero_medium_properties_get_output_path (self);

	/* Now check, fix the output path, _provided__the__format__changed_ */
	if (valid_format == format) {
		g_free (path);
		return;
	}

	if (!path) {
		priv->default_path = TRUE;
		priv->default_ext = TRUE;
		path = brasero_image_format_get_default_path (valid_format);
	}
	else if (priv->default_ext
	     &&  brasero_medium_properties_image_check_extension (self, format, path)) {
		gchar *tmp;

		priv->default_ext = TRUE;

		tmp = path;
		path = brasero_image_format_fix_path_extension (format, TRUE, path);
		g_free (tmp);
	}

	/* we always need to do this */
	brasero_medium_properties_set_output_path (self,
						valid_format,
						path);

	g_free (path);

	if (priv->medium_prop) {
		BraseroImageFormat formats;
		guint num;

		/* update image settings dialog if needed */
		num = brasero_medium_properties_get_possible_output_formats (self, &formats);
		brasero_image_properties_set_formats (BRASERO_IMAGE_PROPERTIES (priv->medium_prop),
						      num > 1 ? formats:BRASERO_IMAGE_FORMAT_NONE,
						      BRASERO_IMAGE_FORMAT_ANY);
	}
}

static void
brasero_medium_properties_valid_session (BraseroSessionCfg *session,
					 BraseroMediumProperties *self)
{
	BraseroMediumPropertiesPrivate *priv;

	priv = BRASERO_MEDIUM_PROPERTIES_PRIVATE (self);

	/* make sure the current displayed path is valid */
	if (brasero_burn_session_is_dest_file (priv->session))
		brasero_medium_properties_update_image_output (self, BRASERO_SESSION_IS_VALID (brasero_session_cfg_get_error (session)));
}

static void
brasero_medium_properties_init (BraseroMediumProperties *object)
{
	BraseroMediumPropertiesPrivate *priv;

	priv = BRASERO_MEDIUM_PROPERTIES_PRIVATE (object);

	priv->caps = brasero_burn_caps_get_default ();

	gtk_widget_set_tooltip_text (GTK_WIDGET (object), _("Configure recording options"));

	priv->default_ext = TRUE;
	priv->default_path = TRUE;
	priv->default_format = TRUE;
}

static void
brasero_medium_properties_finalize (GObject *object)
{
	BraseroMediumPropertiesPrivate *priv;

	priv = BRASERO_MEDIUM_PROPERTIES_PRIVATE (object);

	if (priv->caps) {
		g_object_unref (priv->caps);
		priv->caps = NULL;
	}

	if (priv->valid_sig) {
		g_signal_handler_disconnect (priv->session,
					     priv->valid_sig);
		priv->valid_sig = 0;
	}

	if (priv->session) {
		g_object_unref (priv->session);
		priv->session = NULL;
	}

	G_OBJECT_CLASS (brasero_medium_properties_parent_class)->finalize (object);
}

static void
brasero_medium_properties_set_property (GObject *object,
					guint property_id,
					const GValue *value,
					GParamSpec *pspec)
{
	BraseroMediumPropertiesPrivate *priv;
	BraseroBurnSession *session;

	priv = BRASERO_MEDIUM_PROPERTIES_PRIVATE (object);

	switch (property_id) {
	case PROP_SESSION:
		if (priv->session)
			g_object_unref (priv->session);

		session = g_value_get_object (value);

		/* NOTE: no need to unref a potential previous session since
		 * it's only set at construct time */
		priv->session = session;
		g_object_ref (session);

		priv->valid_sig = g_signal_connect (session,
						    "is-valid",
						    G_CALLBACK (brasero_medium_properties_valid_session),
						    object);
		break;

	default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
	}
}

static void
brasero_medium_properties_get_property (GObject *object,
				     guint property_id,
				     GValue *value,
				     GParamSpec *pspec)
{
	BraseroMediumPropertiesPrivate *priv;

	priv = BRASERO_MEDIUM_PROPERTIES_PRIVATE (object);

	switch (property_id) {
	case PROP_SESSION:
		g_value_set_object (value, priv->session);
		break;

	default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
	}
}

static void
brasero_medium_properties_class_init (BraseroMediumPropertiesClass *klass)
{
	GObjectClass* object_class = G_OBJECT_CLASS (klass);
	GtkButtonClass* button_class = GTK_BUTTON_CLASS (klass);

	g_type_class_add_private (klass, sizeof (BraseroMediumPropertiesPrivate));

	object_class->finalize = brasero_medium_properties_finalize;
	object_class->set_property = brasero_medium_properties_set_property;
	object_class->get_property = brasero_medium_properties_get_property;

	button_class->clicked = brasero_medium_properties_clicked;
	g_object_class_install_property (object_class,
					 PROP_SESSION,
					 g_param_spec_object ("session",
							      "The session to work with",
							      "The session to work with",
							      BRASERO_TYPE_BURN_SESSION,
							      G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY));

}

GtkWidget *
brasero_medium_properties_new (BraseroBurnSession *session)
{
	return g_object_new (BRASERO_TYPE_MEDIUM_PROPERTIES,
			     "session", session,
			     "use-stock", TRUE,
			     "label", GTK_STOCK_PROPERTIES,
			     "focus-on-click", FALSE,
			     NULL);
}