~mfisch/brasero/update-to-3.8.0

« back to all changes in this revision

Viewing changes to libbrasero-burn/brasero-dest-selection.c

  • Committer: Bazaar Package Importer
  • Author(s): Robert Ancell
  • Date: 2009-07-14 14:13:00 UTC
  • mfrom: (1.1.25 upstream)
  • Revision ID: james.westby@ubuntu.com-20090714141300-e08q13sp48b2xzwd
Tags: 2.27.4-0ubuntu1
* New upstream release: (LP: #399112)
  - Hal support removed, now relies on GIO only for drives/media probing
  - New layout for size reporting in data/audio/video project
  - Lot's of bug fixes
  - Fixed some memleaks
  - Bump libbrasero-media version to reflect changes (important to packagers)
  - Fix #582261 – brasero shows 0% done, while continues burning disc
  - Fix #582513 – Bogus VIDEO_TS directory error if AUDIO_TS directory present
  - Fix #573805 – "Increase compatibility with Windows systems"?
  - Fix #585190 – remove 0 from 03 % status
  - Fix #586744 – Use AS_HELP_STRING for configure switches
  - Fix #584793 – Poor language in warning dialog when attempting to burn an audio CD onto a CDRW
  - Fix #580617 – Brasero floods .xsession-errors log with "Unknown (or already deleted) monitored directory" warnings
  - Fix #563501 – Brasero burning window shouldn't try to show drive speed while is converting audio files
  - Fix #485719 – Burn dialog CD icon
  - Fix #585481 – Deep hierarchy warning
  - Fix #554070 – The need of a "replace all" and "replace non" button
  - Fix #582461 – Brasero hangs at normalizing tracks
  - Fix #587284 – nautilus hangs every time
  - Fix #574093 – Caret visible in instructions for project creation
  - Fix #581742 – port from HAL to DeviceKit-disks
  - Fix #573801 – Bad error message when burning empty burn:///
  - Fix #573486 – Various i18n and string issues for good
  - Fix #587399 – License clarification
  - Fix #587554 – Unclear meaning of text
  - Fix #582979 – brasero should not include Categories in mime handler .desktop files
  - Fix #586040 – duplicated command listed in open-with dialog
  - Fixes for #573486 – Various i18n and string issues
* debian/control.in:
  - Add in missing comma in brasero suggests

Show diffs side-by-side

added added

removed removed

Lines of Context:
62
62
        BraseroBurnSession *session;
63
63
 
64
64
        BraseroDrive *locked_drive;
65
 
 
66
 
        gulong valid_sig;
67
65
};
68
66
 
69
67
#define BRASERO_DEST_SELECTION_PRIVATE(o)  (G_TYPE_INSTANCE_GET_PRIVATE ((o), BRASERO_TYPE_DEST_SELECTION, BraseroDestSelectionPrivate))
75
73
 
76
74
G_DEFINE_TYPE (BraseroDestSelection, brasero_dest_selection, BRASERO_TYPE_MEDIUM_SELECTION);
77
75
 
78
 
void
 
76
static void
79
77
brasero_dest_selection_lock (BraseroDestSelection *self,
80
78
                             gboolean locked)
81
79
{
83
81
 
84
82
        priv = BRASERO_DEST_SELECTION_PRIVATE (self);
85
83
 
 
84
        if (locked == (priv->locked_drive != NULL))
 
85
                return;
 
86
 
86
87
        gtk_widget_set_sensitive (GTK_WIDGET (self), (locked != TRUE));
87
 
 
88
88
        gtk_widget_queue_draw (GTK_WIDGET (self));
 
89
 
89
90
        if (priv->locked_drive) {
90
91
                brasero_drive_unlock (priv->locked_drive);
91
92
                g_object_unref (priv->locked_drive);
 
93
                priv->locked_drive = NULL;
92
94
        }
93
95
 
94
96
        if (locked) {
113
115
brasero_dest_selection_valid_session (BraseroSessionCfg *session,
114
116
                                      BraseroDestSelection *self)
115
117
{
 
118
        brasero_medium_selection_update_media_string (BRASERO_MEDIUM_SELECTION (self));
 
119
}
 
120
 
 
121
static void
 
122
brasero_dest_selection_output_changed (BraseroSessionCfg *session,
 
123
                                       BraseroMedium *former,
 
124
                                       BraseroDestSelection *self)
 
125
{
116
126
        BraseroDestSelectionPrivate *priv;
117
127
        BraseroMedium *medium;
118
128
        BraseroDrive *burner;
123
133
        burner = brasero_burn_session_get_burner (priv->session);
124
134
        medium = brasero_medium_selection_get_active (BRASERO_MEDIUM_SELECTION (self));
125
135
        if (burner != brasero_medium_get_drive (medium))
126
 
                brasero_medium_selection_set_active (BRASERO_MEDIUM_SELECTION (self), medium);
 
136
                brasero_medium_selection_set_active (BRASERO_MEDIUM_SELECTION (self),
 
137
                                                     brasero_drive_get_medium (burner));
127
138
 
128
139
        if (medium)
129
140
                g_object_unref (medium);
130
 
 
131
 
        brasero_medium_selection_update_media_string (BRASERO_MEDIUM_SELECTION (self));
 
141
}
 
142
 
 
143
static void
 
144
brasero_dest_selection_flags_changed (BraseroBurnSession *session,
 
145
                                      BraseroDestSelection *self)
 
146
{
 
147
        BraseroDestSelectionPrivate *priv;
 
148
 
 
149
        priv = BRASERO_DEST_SELECTION_PRIVATE (self);
 
150
 
 
151
        brasero_dest_selection_lock (self, (brasero_burn_session_get_flags (BRASERO_BURN_SESSION (priv->session)) & BRASERO_BURN_FLAG_MERGE) != 0);
132
152
}
133
153
 
134
154
static void
179
199
}
180
200
 
181
201
static void
182
 
brasero_dest_selection_finalize (GObject *object)
 
202
brasero_dest_selection_clean (BraseroDestSelection *self)
183
203
{
184
204
        BraseroDestSelectionPrivate *priv;
185
205
 
186
 
        priv = BRASERO_DEST_SELECTION_PRIVATE (object);
187
 
 
188
 
        if (priv->valid_sig) {
189
 
                g_signal_handler_disconnect (priv->session,
190
 
                                             priv->valid_sig);
191
 
                priv->valid_sig = 0;
192
 
        }
 
206
        priv = BRASERO_DEST_SELECTION_PRIVATE (self);
193
207
 
194
208
        if (priv->session) {
 
209
                g_signal_handlers_disconnect_by_func (priv->session,
 
210
                                                      brasero_dest_selection_valid_session,
 
211
                                                      self);
 
212
                g_signal_handlers_disconnect_by_func (priv->session,
 
213
                                                      brasero_dest_selection_output_changed,
 
214
                                                      self);
 
215
                g_signal_handlers_disconnect_by_func (priv->session,
 
216
                                                      brasero_dest_selection_flags_changed,
 
217
                                                      self);
 
218
 
195
219
                g_object_unref (priv->session);
196
220
                priv->session = NULL;
197
221
        }
200
224
                brasero_drive_unlock (priv->locked_drive);
201
225
                g_object_unref (priv->locked_drive);
202
226
        }
 
227
}
203
228
 
 
229
static void
 
230
brasero_dest_selection_finalize (GObject *object)
 
231
{
 
232
        brasero_dest_selection_clean (BRASERO_DEST_SELECTION (object));
204
233
        G_OBJECT_CLASS (brasero_dest_selection_parent_class)->finalize (object);
205
234
}
206
235
 
232
261
                                       gpointer callback_data)
233
262
{
234
263
        BraseroBurnSession *session;
235
 
        goffset session_blocks;
236
 
        goffset burner_blocks;
 
264
        goffset session_blocks = 0;
 
265
        goffset burner_blocks = 0;
237
266
        goffset medium_blocks;
238
267
        BraseroDrive *burner;
239
268
 
322
351
        }
323
352
}
324
353
 
 
354
void
 
355
brasero_dest_selection_set_session (BraseroDestSelection *selection,
 
356
                                    BraseroBurnSession *session)
 
357
{
 
358
        BraseroDestSelectionPrivate *priv;
 
359
 
 
360
        priv = BRASERO_DEST_SELECTION_PRIVATE (selection);
 
361
 
 
362
        if (priv->session)
 
363
                brasero_dest_selection_clean (selection);
 
364
 
 
365
        if (!session)
 
366
                return;
 
367
 
 
368
        priv->session = g_object_ref (session);
 
369
        if (brasero_burn_session_get_flags (session) & BRASERO_BURN_FLAG_MERGE) {
 
370
                BraseroDrive *drive;
 
371
 
 
372
                drive = brasero_burn_session_get_burner (session);
 
373
                brasero_medium_selection_set_active (BRASERO_MEDIUM_SELECTION (selection),
 
374
                                                     brasero_drive_get_medium (drive));
 
375
        }
 
376
        else {
 
377
                BraseroMedium *medium;
 
378
 
 
379
                medium = brasero_medium_selection_get_active (BRASERO_MEDIUM_SELECTION (selection));
 
380
                if (medium) {
 
381
                        brasero_burn_session_set_burner (session, brasero_medium_get_drive (medium));
 
382
                        g_object_unref (medium);
 
383
                }
 
384
        }
 
385
 
 
386
        g_signal_connect (session,
 
387
                          "is-valid",
 
388
                          G_CALLBACK (brasero_dest_selection_valid_session),
 
389
                          selection);
 
390
        g_signal_connect (session,
 
391
                          "output-changed",
 
392
                          G_CALLBACK (brasero_dest_selection_output_changed),
 
393
                          selection);
 
394
        g_signal_connect (session,
 
395
                          "flags-changed",
 
396
                          G_CALLBACK (brasero_dest_selection_flags_changed),
 
397
                          selection);
 
398
 
 
399
        brasero_medium_selection_update_media_string (BRASERO_MEDIUM_SELECTION (selection));
 
400
}
 
401
 
325
402
static void
326
403
brasero_dest_selection_set_property (GObject *object,
327
404
                                     guint property_id,
338
415
                /* NOTE: no need to unref a potential previous session since
339
416
                 * it's only set at construct time */
340
417
                session = g_value_get_object (value);
341
 
                priv->session = session;
342
 
                g_object_ref (session);
343
 
 
344
 
                if (brasero_burn_session_get_flags (session) & BRASERO_BURN_FLAG_MERGE) {
345
 
                        BraseroDrive *drive;
346
 
 
347
 
                        drive = brasero_burn_session_get_burner (session);
348
 
                        brasero_medium_selection_set_active (BRASERO_MEDIUM_SELECTION (object),
349
 
                                                             brasero_drive_get_medium (drive));
350
 
                }
351
 
                else {
352
 
                        BraseroMedium *medium;
353
 
 
354
 
                        medium = brasero_medium_selection_get_active (BRASERO_MEDIUM_SELECTION (object));
355
 
                        if (medium) {
356
 
                                brasero_burn_session_set_burner (session, brasero_medium_get_drive (medium));
357
 
                                g_object_unref (medium);
358
 
                        }
359
 
                }
360
 
 
361
 
                priv->valid_sig = g_signal_connect (session,
362
 
                                                    "is-valid",
363
 
                                                    G_CALLBACK (brasero_dest_selection_valid_session),
364
 
                                                    object);
365
 
 
366
 
                brasero_medium_selection_update_media_string (BRASERO_MEDIUM_SELECTION (object));
 
418
                brasero_dest_selection_set_session (BRASERO_DEST_SELECTION (object), session);
367
419
                break;
368
420
 
369
421
        default:
406
458
        case BRASERO_IMAGE_FORMAT_BIN:
407
459
                brasero_burn_session_get_output (priv->session,
408
460
                                                 &path,
409
 
                                                 NULL,
410
461
                                                 NULL);
411
462
                break;
412
463
 
413
464
        case BRASERO_IMAGE_FORMAT_CLONE:
414
 
                brasero_burn_session_get_output (priv->session,
415
 
                                                 NULL,
416
 
                                                 &path,
417
 
                                                 NULL);
418
 
                break;
419
 
 
420
465
        case BRASERO_IMAGE_FORMAT_CDRDAO:
421
 
                brasero_burn_session_get_output (priv->session,
422
 
                                                 NULL,
423
 
                                                 &path,
424
 
                                                 NULL);
425
 
                break;
426
 
 
427
466
        case BRASERO_IMAGE_FORMAT_CUE:
428
467
                brasero_burn_session_get_output (priv->session,
429
468
                                                 NULL,
430
 
                                                 &path,
431
 
                                                 NULL);
 
469
                                                 &path);
432
470
                break;
433
471
 
434
472
        default:
522
560
                                               &blocks);
523
561
        }
524
562
        else {
525
 
                brasero_medium_get_free_space (medium, NULL, &blocks);
 
563
                brasero_medium_get_free_space (medium, &size_bytes, &blocks);
526
564
 
527
565
                /* if data would not fit, try to see if once blanked it would
528
566
                 * work. This also covers the case where the media is closed as
600
638
                                                              "The session",
601
639
                                                              "The session to work with",
602
640
                                                              BRASERO_TYPE_BURN_SESSION,
603
 
                                                              G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY));
 
641
                                                              G_PARAM_READWRITE));
604
642
}
605
643
 
606
644
GtkWidget *
607
645
brasero_dest_selection_new (BraseroBurnSession *session)
608
646
{
609
 
        g_return_val_if_fail (BRASERO_IS_BURN_SESSION (session), NULL);
610
 
 
611
647
        return g_object_new (BRASERO_TYPE_DEST_SELECTION,
612
648
                             "session", session,
613
649
                             NULL);