brasero r1558 - in trunk/src: . plugins/libburnia
- From: philippr svn gnome org
- To: svn-commits-list gnome org
- Subject: brasero r1558 - in trunk/src: . plugins/libburnia
- Date: Sat, 22 Nov 2008 12:23:40 +0000 (UTC)
Author: philippr
Date: Sat Nov 22 12:23:40 2008
New Revision: 1558
URL: http://svn.gnome.org/viewvc/brasero?rev=1558&view=rev
Log:
Changes to support an upcoming rhythmbox plugin (provided it\'s accepted)
Added a new command line option to open and burn a project
If an audio project has audio end don\'t scan it anymore just use it
Added a new command line option to set a cover for jacket-view
Show a button to create a cover if the disc we\'ve just copied is audio
Unrelated changes:
Use libburn signal handler while burning the docs say it\'s safer; so be it
Fix a minor bug where when creating a new project in the middle of another
no GtkFileChooser would pop up
* src/brasero-audio-disc.c (brasero_audio_disc_get_status),
(brasero_audio_disc_add_track), (brasero_audio_disc_load_track):
* src/brasero-burn-dialog.c (brasero_burn_dialog_success_run),
(brasero_burn_dialog_notify_success):
* src/brasero-jacket-edit.c (brasero_jacket_edit_set_audio_tracks):
* src/brasero-jacket-edit.h:
* src/brasero-project-manager.c
(brasero_project_manager_copy_disc),
(brasero_project_manager_switch), (brasero_project_manager_copy),
(brasero_project_manager_burn_project):
* src/brasero-project-manager.h:
* src/brasero-project.c (brasero_project_finalize),
(brasero_project_set_cover_specifics), (brasero_project_burn),
(brasero_project_switch), (brasero_project_set_none),
(brasero_project_open_project_xml), (brasero_project_open_project),
(brasero_project_load_session), (brasero_project_save_project_xml):
* src/burn-basics.h:
* src/main.c (brasero_app_parse_options):
* src/plugins/libburnia/burn-libburn.c
(brasero_libburn_start_record), (brasero_libburn_start_erase),
(brasero_libburn_stop):
Modified:
trunk/src/brasero-app.c
trunk/src/brasero-app.h
trunk/src/brasero-audio-disc.c
trunk/src/brasero-burn-dialog.c
trunk/src/brasero-jacket-edit.c
trunk/src/brasero-jacket-edit.h
trunk/src/brasero-layout.c
trunk/src/brasero-project-manager.c
trunk/src/brasero-project-manager.h
trunk/src/brasero-project.c
trunk/src/brasero-sum-dialog.c
trunk/src/brasero-video-disc.c
trunk/src/brasero-video-project.c
trunk/src/brasero-video-project.h
trunk/src/burn-basics.h
trunk/src/main.c
trunk/src/plugins/libburnia/burn-libburn.c
Modified: trunk/src/brasero-app.c
==============================================================================
--- trunk/src/brasero-app.c (original)
+++ trunk/src/brasero-app.c Sat Nov 22 12:23:40 2008
@@ -341,22 +341,21 @@
BraseroAppPrivate *priv;
priv = BRASERO_APP_PRIVATE (app);
- priv->is_running = TRUE;
+ priv->is_running = TRUE;
gtk_widget_realize (GTK_WIDGET (app));
- brasero_session_load (app, load_default_project);
- gtk_widget_show (GTK_WIDGET (app));
- gtk_main ();
+ brasero_session_load (app, load_default_project);
}
void
brasero_app_blank (BraseroApp *app,
- const gchar *device,
- gboolean wait_and_close)
+ const gchar *device)
{
GtkWidget *dialog;
GtkWidget *toplevel;
+ BraseroAppPrivate *priv;
+ priv = BRASERO_APP_PRIVATE (app);
dialog = brasero_blank_dialog_new ();
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (app));
@@ -375,10 +374,12 @@
g_object_unref (drive);
}
- if (wait_and_close) {
+ if (!priv->is_running) {
gtk_widget_show (dialog);
gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
+
+ /* brasero-tool-dialog auto destroys itself */
+ // gtk_widget_destroy (dialog);
}
else {
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (toplevel));
@@ -392,7 +393,7 @@
static void
on_erase_cb (GtkAction *action, BraseroApp *app)
{
- brasero_app_blank (app, NULL, FALSE);
+ brasero_app_blank (app, NULL);
}
static void
@@ -413,11 +414,13 @@
void
brasero_app_check (BraseroApp *app,
- const gchar *device,
- gboolean wait_and_close)
+ const gchar *device)
{
GtkWidget *dialog;
GtkWidget *toplevel;
+ BraseroAppPrivate *priv;
+
+ priv = BRASERO_APP_PRIVATE (app);
dialog = brasero_sum_dialog_new ();
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (app));
@@ -437,10 +440,12 @@
g_object_unref (drive);
}
- if (wait_and_close) {
+ if (!priv->is_running) {
gtk_widget_show (dialog);
gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
+
+ /* brasero-tool-dialog auto destroys itself */
+ // gtk_widget_destroy (dialog);
}
else {
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (toplevel));
@@ -454,7 +459,7 @@
static void
on_integrity_check_cb (GtkAction *action, BraseroApp *app)
{
- brasero_app_check (app, NULL, FALSE);
+ brasero_app_check (app, NULL);
}
static void
Modified: trunk/src/brasero-app.h
==============================================================================
--- trunk/src/brasero-app.h (original)
+++ trunk/src/brasero-app.h Sat Nov 22 12:23:40 2008
@@ -72,13 +72,11 @@
void
brasero_app_blank (BraseroApp *app,
- const gchar *device,
- gboolean wait_and_close);
+ const gchar *device);
void
brasero_app_check (BraseroApp *app,
- const gchar *device,
- gboolean wait_and_close);
+ const gchar *device);
void
brasero_app_get_geometry (BraseroApp *app,
Modified: trunk/src/brasero-audio-disc.c
==============================================================================
--- trunk/src/brasero-audio-disc.c (original)
+++ trunk/src/brasero-audio-disc.c Sat Nov 22 12:23:40 2008
@@ -288,6 +288,7 @@
BACKGROUND_COL,
SONG_COL,
EDITABLE_COL,
+ LENGTH_SET_COL, /* if start/end were set through scanning or not */
TITLE_SET_COL,
ARTIST_SET_COL,
COMPOSER_SET_COL,
@@ -620,6 +621,7 @@
G_TYPE_BOOLEAN,
G_TYPE_BOOLEAN,
G_TYPE_BOOLEAN,
+ G_TYPE_BOOLEAN,
G_TYPE_BOOLEAN);
g_signal_connect (G_OBJECT (model),
@@ -912,9 +914,6 @@
{
GtkTreeModel *model;
- if (BRASERO_AUDIO_DISC (disc)->priv->loading)
- return BRASERO_DISC_LOADING;
-
if (BRASERO_AUDIO_DISC (disc)->priv->activity_counter) {
if (remaining)
*remaining = BRASERO_AUDIO_DISC (disc)->priv->activity_counter;
@@ -925,6 +924,9 @@
return BRASERO_DISC_NOT_READY;
}
+ if (BRASERO_AUDIO_DISC (disc)->priv->loading)
+ return BRASERO_DISC_LOADING;
+
model = gtk_tree_view_get_model (GTK_TREE_VIEW (BRASERO_AUDIO_DISC (disc)->priv->tree));
if (!gtk_tree_model_iter_n_children (model, NULL))
return BRASERO_DISC_ERROR_EMPTY_SELECTION;
@@ -1991,11 +1993,13 @@
gboolean title_set;
gboolean artist_set;
gboolean composer_set;
+ gboolean length_set;
gtk_tree_model_get (model, &iter,
URI_COL, &uri,
START_COL, &start,
END_COL, &end,
+ LENGTH_SET_COL, &length_set,
TITLE_SET_COL, &title_set,
ARTIST_SET_COL, &artist_set,
COMPOSER_SET_COL, &composer_set,
@@ -2021,8 +2025,11 @@
song = g_new0 (BraseroDiscSong, 1);
song->uri = uri;
- song->start = start > 0 ? start:0;
- song->end = end > 0 ? end:0;
+
+ if (length_set) {
+ song->start = start > 0 ? start:0;
+ song->end = end > 0 ? end:0;
+ }
info = g_new0 (BraseroSongInfo, 1);
if (title_set)
@@ -2164,18 +2171,70 @@
}
/********************************* load track **********************************/
+static void
+brasero_audio_disc_add_track (BraseroAudioDisc *disc,
+ BraseroDiscSong *song)
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (disc->priv->tree));
+ gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+ URI_COL, song->uri,
+ START_COL, (guint64) song->start,
+ END_COL, (guint64) song->end,
+ SONG_COL, TRUE,
+ -1);
+
+ disc->priv->sectors += BRASERO_DURATION_TO_SECTORS (BRASERO_AUDIO_TRACK_LENGTH (song->start, song->end));
+
+ if (song->info) {
+ if (song->info->title)
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+ NAME_COL, song->info->title,
+ TITLE_SET_COL, TRUE,
+ -1);
+ if (song->info->artist)
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+ ARTIST_COL, song->info->artist,
+ ARTIST_SET_COL, TRUE,
+ -1);
+ if (song->info->composer)
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+ COMPOSER_COL, song->info->composer,
+ COMPOSER_SET_COL, TRUE,
+ -1);
+ if (song->info->isrc)
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+ ISRC_COL, song->info->isrc,
+ ISRC_SET_COL, TRUE,
+ -1);
+ }
+
+ if (song->gap) {
+ gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+ LENGTH_COL, (guint64) song->gap,
+ -1);
+ disc->priv->sectors += BRASERO_DURATION_TO_SECTORS (song->gap);
+ }
+}
+
static BraseroDiscResult
brasero_audio_disc_load_track (BraseroDisc *disc,
BraseroDiscTrack *track)
{
GSList *iter;
+ GtkWidget *toplevel;
g_return_val_if_fail (track->type == BRASERO_DISC_TRACK_AUDIO, FALSE);
if (track->contents.tracks == NULL)
return BRASERO_DISC_ERROR_EMPTY_SELECTION;
- BRASERO_AUDIO_DISC (disc)->priv->loading = g_slist_length (track->contents.tracks);
+ toplevel = gtk_widget_get_toplevel (GTK_WIDGET (disc));
for (iter = track->contents.tracks; iter; iter = iter->next) {
BraseroDiscSong *song;
BraseroSongInfo *info;
@@ -2183,14 +2242,21 @@
song = iter->data;
info = song->info;
- brasero_audio_disc_add_uri_real (BRASERO_AUDIO_DISC (disc),
- song->uri,
- -1,
- song->gap,
- song->start,
- song->end,
- info,
- NULL);
+ if (song->end > 0 && !brasero_app_is_running (BRASERO_APP (toplevel))) {
+ /* Set the minimum information */
+ brasero_audio_disc_add_track (BRASERO_AUDIO_DISC (disc), song);
+ }
+ else {
+ BRASERO_AUDIO_DISC (disc)->priv->loading ++;
+ brasero_audio_disc_add_uri_real (BRASERO_AUDIO_DISC (disc),
+ song->uri,
+ -1,
+ song->gap,
+ song->start,
+ song->end,
+ info,
+ NULL);
+ }
}
@@ -2802,6 +2868,7 @@
string = brasero_utils_get_time_string (BRASERO_AUDIO_TRACK_LENGTH (slice->start, slice->end), TRUE, FALSE);
gtk_list_store_set (GTK_LIST_STORE (model), parent,
+ LENGTH_SET_COL, TRUE,
START_COL, slice->start,
END_COL, slice->end,
SIZE_COL, string,
@@ -2828,6 +2895,7 @@
ISRC_COL, isrc,
ISRC_SET_COL, isrc_set,
SONG_COL, TRUE,
+ LENGTH_SET_COL, TRUE,
START_COL, slice->start,
END_COL, slice->end,
SIZE_COL, string,
@@ -3261,6 +3329,7 @@
gtk_tree_model_get_iter (model, &iter, treepath);
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+ LENGTH_SET_COL, TRUE,
START_COL, start,
END_COL, end,
SIZE_COL, length_str,
Modified: trunk/src/brasero-burn-dialog.c
==============================================================================
--- trunk/src/brasero-burn-dialog.c (original)
+++ trunk/src/brasero-burn-dialog.c Sat Nov 22 12:23:40 2008
@@ -1604,15 +1604,25 @@
answer = gtk_dialog_run (GTK_DIALOG (dialog));
if (answer == GTK_RESPONSE_CLOSE) {
GtkWidget *contents;
- GtkWidget *window;
+ GValue *cover_value;
const gchar *title;
+ GtkWidget *window;
GSList *tracks;
contents = brasero_jacket_edit_dialog_new (GTK_WIDGET (dialog), &window);
title = brasero_burn_session_get_label (dialog->priv->session);
tracks = brasero_burn_session_get_tracks (dialog->priv->session);
- brasero_jacket_edit_set_audio_tracks (BRASERO_JACKET_EDIT (contents), title, tracks);
+
+ cover_value = NULL;
+ brasero_burn_session_tag_lookup (dialog->priv->session,
+ BRASERO_COVER_URI,
+ &cover_value);
+
+ brasero_jacket_edit_set_audio_tracks (BRASERO_JACKET_EDIT (contents),
+ title,
+ cover_value? g_value_get_string (cover_value):NULL,
+ tracks);
gtk_dialog_run (GTK_DIALOG (window));
@@ -1705,7 +1715,9 @@
media,
dialog->priv->total_size);
- if (brasero_burn_session_get_input_type (dialog->priv->session, NULL) == BRASERO_TRACK_TYPE_AUDIO) {
+ if (dialog->priv->input.type == BRASERO_TRACK_TYPE_AUDIO
+ || (dialog->priv->input.type == BRASERO_TRACK_TYPE_DISC
+ && (dialog->priv->input.subtype.media & BRASERO_MEDIUM_HAS_AUDIO))) {
/* since we succeed offer the possibility to create cover if that's an audio disc */
gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Create Cover"), GTK_RESPONSE_CLOSE);
}
Modified: trunk/src/brasero-jacket-edit.c
==============================================================================
--- trunk/src/brasero-jacket-edit.c (original)
+++ trunk/src/brasero-jacket-edit.c Sat Nov 22 12:23:40 2008
@@ -716,6 +716,7 @@
void
brasero_jacket_edit_set_audio_tracks (BraseroJacketEdit *self,
const gchar *label,
+ const gchar *cover,
GSList *tracks)
{
BraseroJacketEditPrivate *priv;
@@ -725,22 +726,37 @@
priv = BRASERO_JACKET_EDIT_PRIVATE (self);
- buffer = brasero_jacket_view_get_body_buffer (BRASERO_JACKET_VIEW (priv->front));
-
- /* create the tags */
- gtk_text_buffer_create_tag (buffer,
- "Title",
- "justification", GTK_JUSTIFY_CENTER,
- "weight", PANGO_WEIGHT_BOLD,
- "scale", PANGO_SCALE_X_LARGE,
- "stretch", PANGO_STRETCH_ULTRA_EXPANDED,
- NULL);
-
- gtk_text_buffer_get_start_iter (buffer, &start);
-
- if (label) {
- BRASERO_JACKET_EDIT_INSERT_TAGGED_TEXT (buffer, "\n\n\n\n", "Title", &start);
- BRASERO_JACKET_EDIT_INSERT_TAGGED_TEXT (buffer, label, "Title", &start);
+ /* Set background for front cover */
+ if (cover) {
+ gchar *path;
+
+ path = g_filename_from_uri (cover, NULL, NULL);
+ if (!path)
+ path = g_strdup (cover);
+
+ brasero_jacket_view_set_image_style (BRASERO_JACKET_VIEW (priv->front), BRASERO_JACKET_IMAGE_STRETCH);
+ brasero_jacket_view_set_image (BRASERO_JACKET_VIEW (priv->front), path);
+ g_free (path);
+ }
+ else {
+ /* Otherwise we create a very rough one */
+ buffer = brasero_jacket_view_get_body_buffer (BRASERO_JACKET_VIEW (priv->front));
+
+ /* create the tags */
+ gtk_text_buffer_create_tag (buffer,
+ "Title",
+ "justification", GTK_JUSTIFY_CENTER,
+ "weight", PANGO_WEIGHT_BOLD,
+ "scale", PANGO_SCALE_X_LARGE,
+ "stretch", PANGO_STRETCH_ULTRA_EXPANDED,
+ NULL);
+
+ gtk_text_buffer_get_start_iter (buffer, &start);
+
+ if (label) {
+ BRASERO_JACKET_EDIT_INSERT_TAGGED_TEXT (buffer, "\n\n\n\n", "Title", &start);
+ BRASERO_JACKET_EDIT_INSERT_TAGGED_TEXT (buffer, label, "Title", &start);
+ }
}
buffer = brasero_jacket_view_get_body_buffer (BRASERO_JACKET_VIEW (priv->back));
Modified: trunk/src/brasero-jacket-edit.h
==============================================================================
--- trunk/src/brasero-jacket-edit.h (original)
+++ trunk/src/brasero-jacket-edit.h Sat Nov 22 12:23:40 2008
@@ -61,6 +61,7 @@
void
brasero_jacket_edit_set_audio_tracks (BraseroJacketEdit *self,
const gchar *label,
+ const gchar *cover,
GSList *tracks);
G_END_DECLS
Modified: trunk/src/brasero-layout.c
==============================================================================
--- trunk/src/brasero-layout.c (original)
+++ trunk/src/brasero-layout.c Sat Nov 22 12:23:40 2008
@@ -547,7 +547,6 @@
return;
}
} while (gtk_tree_model_iter_next (model, &iter));
-
}
static void
@@ -762,6 +761,8 @@
BraseroLayoutObject *source;
BraseroLayoutItem *item;
GtkTreeModel *model;
+ gboolean is_visible;
+ GtkAction *action;
GtkTreeIter iter;
model = gtk_combo_box_get_model (combo);
@@ -772,6 +773,12 @@
ITEM_COL, &item,
-1);
+ /* Make sure there is a displayed sidepane before setting the source for
+ * project. It can happen that when we're changing of project type this
+ * is called. */
+ action = gtk_action_group_get_action (layout->priv->action_group, BRASERO_LAYOUT_NONE_ID);
+ is_visible = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
+
if (layout->priv->active_item)
gtk_widget_hide (layout->priv->active_item->widget);
@@ -786,6 +793,9 @@
BRASERO_BURN_LOG ("Item is not an URI container");
brasero_project_set_source (BRASERO_PROJECT (layout->priv->project), NULL);
}
+ else if (!is_visible) {
+ brasero_project_set_source (BRASERO_PROJECT (layout->priv->project), NULL);
+ }
else {
brasero_uri_container_uri_selected (BRASERO_URI_CONTAINER (source));
brasero_project_set_source (BRASERO_PROJECT (layout->priv->project),
Modified: trunk/src/brasero-project-manager.c
==============================================================================
--- trunk/src/brasero-project-manager.c (original)
+++ trunk/src/brasero-project-manager.c Sat Nov 22 12:23:40 2008
@@ -592,7 +592,8 @@
static void
brasero_project_manager_copy_disc (BraseroProjectManager *manager,
- const gchar *device)
+ const gchar *device,
+ const gchar *cover)
{
BraseroBurnSession *session;
GtkResponseType result;
@@ -638,6 +639,18 @@
session = brasero_burn_options_get_session (BRASERO_BURN_OPTIONS (dialog));
gtk_widget_destroy (dialog);
+ /* Set a cover if any. */
+ if (cover) {
+ GValue *value;
+
+ value = g_new0 (GValue, 1);
+ g_value_init (value, G_TYPE_STRING);
+ g_value_set_string (value, cover);
+ brasero_burn_session_tag_add (session,
+ BRASERO_COVER_URI,
+ value);
+ }
+
brasero_project_manager_burn (manager, session);
g_object_unref (session);
@@ -759,7 +772,7 @@
if (toplevel)
gtk_window_set_title (GTK_WINDOW (toplevel), _("Brasero - Disc Copy"));
- brasero_project_manager_copy_disc (manager, uri);
+ brasero_project_manager_copy_disc (manager, uri, NULL);
}
}
@@ -868,13 +881,17 @@
void
brasero_project_manager_copy (BraseroProjectManager *manager,
- const gchar *device)
+ const gchar *device,
+ const gchar *cover)
{
- brasero_project_manager_switch (manager,
- BRASERO_PROJECT_TYPE_COPY,
- NULL,
- device,
- TRUE);
+ if (manager->priv->oneshot)
+ brasero_project_manager_copy_disc (manager, device, cover);
+ else
+ brasero_project_manager_switch (manager,
+ BRASERO_PROJECT_TYPE_COPY,
+ NULL,
+ device,
+ TRUE);
}
void
@@ -916,6 +933,22 @@
return type;
}
+void
+brasero_project_manager_burn_project (BraseroProjectManager *manager,
+ const gchar *uri)
+{
+ BraseroProjectType type;
+
+ brasero_project_manager_set_oneshot (manager, TRUE);
+ type = brasero_project_open_project (BRASERO_PROJECT (manager->priv->project), uri);
+
+ if (type == BRASERO_PROJECT_TYPE_INVALID)
+ return;
+
+ manager->priv->type = type;
+ brasero_project_burn (BRASERO_PROJECT (manager->priv->project));
+}
+
#ifdef BUILD_PLAYLIST
BraseroProjectType
Modified: trunk/src/brasero-project-manager.h
==============================================================================
--- trunk/src/brasero-project-manager.h (original)
+++ trunk/src/brasero-project-manager.h Sat Nov 22 12:23:40 2008
@@ -73,10 +73,14 @@
GSList *uris);
void
brasero_project_manager_copy (BraseroProjectManager *manager,
- const gchar *device);
+ const gchar *device,
+ const gchar *cover);
void
brasero_project_manager_iso (BraseroProjectManager *manager,
const gchar *uri);
+void
+brasero_project_manager_burn_project (BraseroProjectManager *manager,
+ const gchar *uri);
BraseroProjectType
brasero_project_manager_open_playlist (BraseroProjectManager *manager,
Modified: trunk/src/brasero-project.c
==============================================================================
--- trunk/src/brasero-project.c (original)
+++ trunk/src/brasero-project.c Sat Nov 22 12:23:40 2008
@@ -167,6 +167,8 @@
gchar *project;
+ gchar *cover;
+
gint64 sectors;
BraseroDisc *current;
@@ -553,8 +555,11 @@
if (cobj->priv->project)
g_free (cobj->priv->project);
- g_free(cobj->priv);
- G_OBJECT_CLASS(parent_class)->finalize(object);
+ if (cobj->priv->cover)
+ g_free (cobj->priv->cover);
+
+ g_free (cobj->priv);
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
GtkWidget *
@@ -861,6 +866,7 @@
brasero_disc_set_session_contents (BRASERO_DISC (self->priv->current), session);
brasero_jacket_edit_set_audio_tracks (BRASERO_JACKET_EDIT (cover),
brasero_burn_session_get_label (session),
+ self->priv->cover,
brasero_burn_session_get_tracks (session));
g_object_unref (session);
}
@@ -935,9 +941,20 @@
session = brasero_disc_option_dialog_get_session (BRASERO_DISC_OPTION_DIALOG (dialog));
gtk_widget_destroy (dialog);
- /* set the label for the session */
+ /* set the label/cover for the session */
brasero_burn_session_set_label (session, gtk_entry_get_text (GTK_ENTRY (project->priv->name_display)));
+ if (project->priv->cover) {
+ GValue *value;
+
+ value = g_new0 (GValue, 1);
+ g_value_init (value, G_TYPE_STRING);
+ g_value_set_string (value, project->priv->cover);
+ brasero_burn_session_tag_add (session,
+ BRASERO_COVER_URI,
+ value);
+ }
+
/* now setup the burn dialog */
dialog = brasero_burn_dialog_new ();
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (toplevel));
@@ -984,6 +1001,11 @@
project->priv->project = NULL;
}
+ if (project->priv->cover) {
+ g_free (project->priv->cover);
+ project->priv->cover = NULL;
+ }
+
client = gconf_client_get_default ();
/* remove the buttons from the "toolbar" */
@@ -1143,6 +1165,11 @@
project->priv->project = NULL;
}
+ if (project->priv->cover) {
+ g_free (project->priv->cover);
+ project->priv->cover = NULL;
+ }
+
if (project->priv->chooser) {
gtk_widget_destroy (project->priv->chooser);
project->priv->chooser = NULL;
@@ -1997,6 +2024,7 @@
brasero_project_open_project_xml (BraseroProject *proj,
const gchar *uri,
gchar **label,
+ gchar **cover,
BraseroDiscTrack **track,
gboolean warn_user)
{
@@ -2047,6 +2075,18 @@
if (!(*label))
goto error;
}
+ else if (!xmlStrcmp (item->name, (const xmlChar *) "cover")) {
+ xmlChar *escaped;
+
+ escaped = xmlNodeListGetString (project,
+ item->xmlChildrenNode,
+ 1);
+ if (!escaped)
+ goto error;
+
+ *cover = g_uri_unescape_string ((char *) escaped, NULL);
+ g_free (escaped);
+ }
else if (!xmlStrcmp (item->name, (const xmlChar *) "track")) {
if (track_node)
goto error;
@@ -2083,11 +2123,12 @@
BraseroDiscTrack *track = NULL;
BraseroProjectType type;
gchar *label = NULL;
+ gchar *cover = NULL;
if (!uri || *uri =='\0')
return BRASERO_PROJECT_TYPE_INVALID;
- if (!brasero_project_open_project_xml (project, uri, &label, &track, TRUE))
+ if (!brasero_project_open_project_xml (project, uri, &label, &cover, &track, TRUE))
return BRASERO_PROJECT_TYPE_INVALID;
brasero_project_update_project_size (project, 0);
@@ -2117,6 +2158,13 @@
project);
}
+ if (cover) {
+ if (project->priv->cover)
+ g_free (project->priv->cover);
+
+ project->priv->cover = cover;
+ }
+
brasero_disc_load_track (project->priv->current, track);
brasero_track_free (track);
@@ -2248,8 +2296,9 @@
BraseroDiscTrack *track = NULL;
BraseroProjectType type;
gchar *label;
+ gchar *cover;
- if (!brasero_project_open_project_xml (project, uri, &label, &track, FALSE))
+ if (!brasero_project_open_project_xml (project, uri, &label, &cover, &track, FALSE))
return BRASERO_PROJECT_TYPE_INVALID;
if (track->type == BRASERO_DISC_TRACK_AUDIO)
@@ -2379,25 +2428,27 @@
return FALSE;
}
- /* start of the song */
- start = g_strdup_printf ("%"G_GINT64_FORMAT, song->start);
- success = xmlTextWriterWriteElement (project,
- (xmlChar *) "start",
- (xmlChar *) start);
+ if (song->end > 0) {
+ /* start of the song */
+ start = g_strdup_printf ("%"G_GINT64_FORMAT, song->start);
+ success = xmlTextWriterWriteElement (project,
+ (xmlChar *) "start",
+ (xmlChar *) start);
- g_free (start);
- if (success == -1)
- return FALSE;
+ g_free (start);
+ if (success == -1)
+ return FALSE;
- /* end of the song */
- end = g_strdup_printf ("%"G_GINT64_FORMAT, song->end);
- success = xmlTextWriterWriteElement (project,
- (xmlChar *) "end",
- (xmlChar *) end);
+ /* end of the song */
+ end = g_strdup_printf ("%"G_GINT64_FORMAT, song->end);
+ success = xmlTextWriterWriteElement (project,
+ (xmlChar *) "end",
+ (xmlChar *) end);
- g_free (end);
- if (success == -1)
- return FALSE;
+ g_free (end);
+ if (success == -1)
+ return FALSE;
+ }
if (!info)
continue;
@@ -2520,8 +2571,8 @@
gint success;
gchar *path;
- path = g_filename_from_uri (uri, NULL, NULL);
- if (!path)
+ path = g_filename_from_uri (uri, NULL, NULL);
+ if (!path)
return FALSE;
project = xmlNewTextWriterFilename (path, 0);
@@ -2561,6 +2612,19 @@
if (success < 0)
goto error;
+ if (proj->priv->cover) {
+ gchar *escaped;
+
+ escaped = g_uri_escape_string (proj->priv->cover, NULL, FALSE);
+ success = xmlTextWriterWriteElement (project,
+ (xmlChar *) "cover",
+ (xmlChar *) escaped);
+ g_free (escaped);
+
+ if (success < 0)
+ goto error;
+ }
+
success = xmlTextWriterStartElement (project, (xmlChar *) "track");
if (success < 0)
goto error;
Modified: trunk/src/brasero-sum-dialog.c
==============================================================================
--- trunk/src/brasero-sum-dialog.c (original)
+++ trunk/src/brasero-sum-dialog.c Sat Nov 22 12:23:40 2008
@@ -35,6 +35,7 @@
#include <stdio.h>
#include <glib.h>
+#include <glib/gstdio.h>
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
Modified: trunk/src/brasero-video-disc.c
==============================================================================
--- trunk/src/brasero-video-disc.c (original)
+++ trunk/src/brasero-video-disc.c Sat Nov 22 12:23:40 2008
@@ -1372,7 +1372,7 @@
priv = BRASERO_VIDEO_DISC_PRIVATE (self);
project = BRASERO_VIDEO_PROJECT (gtk_tree_view_get_model (GTK_TREE_VIEW (priv->tree)));
- tracks = brasero_video_project_get_contents (project);
+ tracks = brasero_video_project_get_contents (project, FALSE);
if (!tracks)
return BRASERO_DISC_ERROR_EMPTY_SELECTION;
@@ -1405,7 +1405,7 @@
priv = BRASERO_VIDEO_DISC_PRIVATE (disc);
project = BRASERO_VIDEO_PROJECT (gtk_tree_view_get_model (GTK_TREE_VIEW (priv->tree)));
- tracks = brasero_video_project_get_contents (project);
+ tracks = brasero_video_project_get_contents (project, TRUE);
for (iter = tracks; iter; iter = iter->next) {
BraseroDiscSong *song;
@@ -1414,7 +1414,7 @@
track = iter->data;
song = g_new0 (BraseroDiscSong, 1);
- song->uri = brasero_track_get_audio_source (track, TRUE);;
+ song->uri = brasero_track_get_audio_source (track, TRUE);
song->start = brasero_track_get_audio_start (track);
song->end = brasero_track_get_audio_end (track);
song->info = brasero_song_info_copy (brasero_track_get_audio_info (track));
Modified: trunk/src/brasero-video-project.c
==============================================================================
--- trunk/src/brasero-video-project.c (original)
+++ trunk/src/brasero-video-project.c Sat Nov 22 12:23:40 2008
@@ -506,18 +506,20 @@
GdkPixbuf *scaled;
scaled = gdk_pixbuf_scale_simple (snapshot,
- 96 * gdk_pixbuf_get_width (snapshot) / gdk_pixbuf_get_height (snapshot),
- 96,
+ 48 * gdk_pixbuf_get_width (snapshot) / gdk_pixbuf_get_height (snapshot),
+ 48,
GDK_INTERP_BILINEAR);
file->snapshot = scaled;
}
/* size */
- len = g_file_info_get_attribute_uint64 (info, BRASERO_IO_LEN);
- if (file->end > len)
- file->end = len;
- else if (file->end <= 0)
- file->end = len;
+ if (!file->len_set) {
+ len = g_file_info_get_attribute_uint64 (info, BRASERO_IO_LEN);
+ if (file->end > len)
+ file->end = len;
+ else if (file->end <= 0)
+ file->end = len;
+ }
/* Get the song info */
if (!file->info)
@@ -775,8 +777,10 @@
if (start > -1)
file->start = start;
- if (end > -1)
+ if (end > -1) {
file->end = end;
+ file->len_set = TRUE;
+ }
if (sibling) {
file->next = sibling;
@@ -966,7 +970,8 @@
}
GSList *
-brasero_video_project_get_contents (BraseroVideoProject *self)
+brasero_video_project_get_contents (BraseroVideoProject *self,
+ gboolean values_set)
{
GSList *tracks = NULL;
BraseroVideoFile *file;
@@ -980,8 +985,26 @@
BraseroSongInfo *info = NULL;
BraseroTrack *track;
- if (file->info)
+ if (file->info) {
info = brasero_song_info_copy (file->info);
+
+ if (values_set) {
+ if (!file->title_set) {
+ g_free (info->title);
+ info->title = NULL;
+ }
+ if (!file->artist_set) {
+ g_free (info->artist);
+ info->artist = NULL;
+ }
+ if (!file->composer_set) {
+ g_free (info->composer);
+ info->composer = NULL;
+ }
+ if (!file->isrc_set)
+ info->isrc = 0;
+ }
+ }
else
info = NULL;
@@ -991,7 +1014,17 @@
BRASERO_AUDIO_FORMAT_UNDEFINED|
BRASERO_VIDEO_FORMAT_UNDEFINED);
- brasero_track_set_audio_boundaries (track, file->start, file->end, -1);
+ if (!values_set || file->len_set)
+ brasero_track_set_audio_boundaries (track,
+ file->start,
+ file->end,
+ -1);
+ else
+ brasero_track_set_audio_boundaries (track,
+ file->start,
+ 0,
+ -1);
+
brasero_track_set_audio_info (track, info);
tracks = g_slist_prepend (tracks, track);
}
Modified: trunk/src/brasero-video-project.h
==============================================================================
--- trunk/src/brasero-video-project.h (original)
+++ trunk/src/brasero-video-project.h Sat Nov 22 12:23:40 2008
@@ -67,6 +67,7 @@
guint is_reloading:1;
guint is_monitored:1;
+ guint len_set:1;
guint isrc_set:1;
guint title_set:1;
guint artist_set:1;
@@ -169,7 +170,8 @@
gchar **current_task);
GSList *
-brasero_video_project_get_contents (BraseroVideoProject *project);
+brasero_video_project_get_contents (BraseroVideoProject *project,
+ gboolean values_set);
BraseroVideoFile *
brasero_video_project_get_nth_item (BraseroVideoProject *project,
Modified: trunk/src/burn-basics.h
==============================================================================
--- trunk/src/burn-basics.h (original)
+++ trunk/src/burn-basics.h Sat Nov 22 12:23:40 2008
@@ -196,6 +196,11 @@
*/
/**
+ * Gives the uri (gchar *) of the cover
+ */
+#define BRASERO_COVER_URI "session::art::cover"
+
+/**
* Define the audio streams for a DVD
*/
#define BRASERO_DVD_AUDIO_STREAMS "session::DVD::audio::format"
Modified: trunk/src/main.c
==============================================================================
--- trunk/src/main.c (original)
+++ trunk/src/main.c Sat Nov 22 12:23:40 2008
@@ -31,6 +31,7 @@
#include <locale.h>
#include <glib.h>
+#include <glib/gstdio.h>
#include <glib/gi18n-lib.h>
#include <gio/gio.h>
@@ -55,13 +56,15 @@
#include "burn-debug.h"
#include "burn.h"
+gchar *burn_project_uri;
gchar *project_uri;
+gchar *cover_project;
gchar *playlist_uri;
gchar *iso_uri;
gchar **files;
-gchar **audio_project;
-gchar **data_project;
-gchar **video_project;
+gint audio_project;
+gint data_project;
+gint video_project;
gint copy_project;
gint empty_project;
gint disc_blank;
@@ -92,7 +95,11 @@
{ "copy", 'c', 0, G_OPTION_ARG_NONE, ©_project,
N_("Copy a disc"),
- NULL },
+ N_("PATH TO DEVICE") },
+
+ { "cover", 'j', G_OPTION_FLAG_FILENAME, G_OPTION_ARG_STRING, &cover_project,
+ N_("Cover to use"),
+ N_("PATH TO COVER") },
{ "video", 'o', 0, G_OPTION_ARG_NONE, &video_project,
N_("Open a video project adding the URIs given on the command line"),
@@ -118,6 +125,10 @@
N_("Burn the contents of burn:// URI"),
NULL },
+ { "burn-and-remove-project", 'r', G_OPTION_FLAG_FILENAME, G_OPTION_ARG_STRING, &burn_project_uri,
+ N_("Burn the specified project and REMOVE it.\nThis option is mainly useful for integration use with other applications."),
+ N_("PATH") },
+
{ "debug", 'g', 0, G_OPTION_ARG_NONE, &debug,
N_("Display debug statements on stdout"),
NULL },
@@ -163,7 +174,6 @@
{
gint nb = 0;
GtkWidget *manager;
- gboolean load_default_project = FALSE;
manager = brasero_app_get_project_manager (app);
@@ -174,13 +184,15 @@
}
/* we first check that only one of the options was given
- * (except for --debug) */
+ * (except for --debug and cover argument) */
if (copy_project)
nb ++;
if (iso_uri)
nb ++;
if (project_uri)
nb ++;
+ if (burn_project_uri)
+ nb ++;
if (playlist_uri)
nb ++;
if (audio_project)
@@ -205,17 +217,16 @@
else if (copy_project) {
gchar *device = NULL;
- /* make sure there is only one file in the remaining list for
- * specifying the source device. It could be extended to let
- * the user specify the destination device as well */
+ /* Make sure there is only one file in the remaining list for
+ * specifying the source device. It could be extended to let
+ * the user specify the destination device as well */
if (files
&& files [0] != NULL
&& files [1] == NULL)
- device = files [0];
-
- /* this can't combine with any other options */
+ device = files [0];
+
brasero_project_manager_set_oneshot (BRASERO_PROJECT_MANAGER (manager), TRUE);
- brasero_project_manager_copy (BRASERO_PROJECT_MANAGER (manager), device);
+ brasero_project_manager_copy (BRASERO_PROJECT_MANAGER (manager), device, cover_project);
return;
}
else if (iso_uri) {
@@ -225,25 +236,66 @@
}
else if (project_uri) {
brasero_project_manager_set_oneshot (BRASERO_PROJECT_MANAGER (manager), TRUE);
+ brasero_app_run (app, FALSE);
BRASERO_PROJECT_OPEN_URI (manager, brasero_project_manager_open_project, project_uri);
}
+ else if (burn_project_uri) {
+ brasero_project_manager_set_oneshot (BRASERO_PROJECT_MANAGER (manager), TRUE);
+ BRASERO_PROJECT_OPEN_URI (manager, brasero_project_manager_burn_project, burn_project_uri);
+ if (g_remove (burn_project_uri) != 0) {
+ gchar *path;
+
+ path = g_filename_from_uri (burn_project_uri, NULL, NULL);
+ g_remove (path);
+ g_free (path);
+ }
+ return;
+ }
+ else if (open_ncb) {
+ GSList *list = NULL;
+ gchar **iter;
+
+ list = g_slist_prepend (NULL, "burn:///");
+
+ /* in this case we can also add the files from the command line */
+ for (iter = files; iter && *iter; iter ++) {
+ GFile *file;
+ gchar *uri;
+
+ file = g_file_new_for_commandline_arg (*iter);
+ uri = g_file_get_uri (file);
+ g_object_unref (file);
+
+ list = g_slist_prepend (list, file);
+ }
+
+ /* reverse to keep the order of files */
+ list = g_slist_reverse (list);
+ brasero_project_manager_set_oneshot (BRASERO_PROJECT_MANAGER (manager), TRUE);
+ brasero_project_manager_data (BRASERO_PROJECT_MANAGER (manager), list);
+ g_slist_free (list);
+ return;
+ }
#ifdef BUILD_PLAYLIST
else if (playlist_uri) {
- brasero_project_manager_set_oneshot (BRASERO_PROJECT_MANAGER (manager), TRUE);
+ brasero_app_run (app, FALSE);
BRASERO_PROJECT_OPEN_URI (manager, brasero_project_manager_open_playlist, playlist_uri);
}
#endif
else if (audio_project) {
+ brasero_app_run (app, FALSE);
BRASERO_PROJECT_OPEN_LIST (manager, brasero_project_manager_audio, files);
}
else if (data_project) {
+ brasero_app_run (app, FALSE);
BRASERO_PROJECT_OPEN_LIST (manager, brasero_project_manager_data, files);
}
else if (video_project) {
+ brasero_app_run (app, FALSE);
BRASERO_PROJECT_OPEN_LIST (manager, brasero_project_manager_video, files);
}
else if (disc_blank) {
@@ -257,7 +309,7 @@
&& files [1] == NULL)
device = files [0];
- brasero_app_blank (app, device, TRUE);
+ brasero_app_blank (app, device);
return;
}
else if (disc_check) {
@@ -271,35 +323,12 @@
&& files [1] == NULL)
device = files [0];
- brasero_app_check (app, device, TRUE);
- return;
- }
- else if (open_ncb) {
- GSList *list = NULL;
- gchar **iter;
-
- list = g_slist_prepend (NULL, "burn:///");
-
- /* in this case we can also add the files from the command line */
- for (iter = files; iter && *iter; iter ++) {
- GFile *file;
- gchar *uri;
-
- file = g_file_new_for_commandline_arg (*iter);
- uri = g_file_get_uri (file);
- g_object_unref (file);
-
- list = g_slist_prepend (list, file);
- }
-
- /* reverse to keep the order of files */
- list = g_slist_reverse (list);
- brasero_project_manager_set_oneshot (BRASERO_PROJECT_MANAGER (manager), TRUE);
- brasero_project_manager_data (BRASERO_PROJECT_MANAGER (manager), list);
- g_slist_free (list);
+ brasero_app_check (app, device);
return;
}
else if (files) {
+ brasero_app_run (app, FALSE);
+
if (g_strv_length (files) == 1) {
BraseroProjectType type;
@@ -317,10 +346,11 @@
}
else {
brasero_project_manager_empty (BRASERO_PROJECT_MANAGER (manager));
- load_default_project = TRUE;
+ brasero_app_run (app, TRUE);
}
- brasero_app_run (app, load_default_project);
+ gtk_widget_show (GTK_WIDGET (app));
+ gtk_main ();
}
int
Modified: trunk/src/plugins/libburnia/burn-libburn.c
==============================================================================
--- trunk/src/plugins/libburnia/burn-libburn.c (original)
+++ trunk/src/plugins/libburnia/burn-libburn.c Sat Nov 22 12:23:40 2008
@@ -61,6 +61,8 @@
/* This buffer is used to capture Primary Volume Descriptor for
* for overwrite media so as to "grow" the latter. */
unsigned char *pvd;
+
+ guint sig_handler:1;
};
typedef struct _BraseroLibburnPrivate BraseroLibburnPrivate;
@@ -554,6 +556,11 @@
300L - blocks,
614400L - blocks * 2048);
+ if (!priv->sig_handler) {
+ burn_set_signal_handling ("brasero", NULL, 0);
+ priv->sig_handler = 1;
+ }
+
burn_disc_write (opts, priv->ctx->disc);
burn_write_opts_free (opts);
@@ -590,6 +597,11 @@
if (profile == BRASERO_SCSI_PROF_DVD_RW_RESTRICTED) {
if (!(flags & BRASERO_BURN_FLAG_FAST_BLANK)) {
/* leave libburn choose the best format */
+ if (!priv->sig_handler) {
+ burn_set_signal_handling ("brasero", NULL, 0);
+ priv->sig_handler = 1;
+ }
+
burn_disc_format (priv->ctx->drive,
(off_t) 0,
(1 << 4));
@@ -602,8 +614,12 @@
* Bit 4 is enforce (re)-format if needed
* 0x26 is DVD+RW format is to be set from bit 8
* in the latter case bit 7 needs to be set as
- * well.
- */
+ * well. */
+ if (!priv->sig_handler) {
+ burn_set_signal_handling ("brasero", NULL, 0);
+ priv->sig_handler = 1;
+ }
+
burn_disc_format (priv->ctx->drive,
(off_t) 0,
(1 << 2)|(1 << 4));
@@ -612,6 +628,11 @@
}
else if (burn_disc_erasable (priv->ctx->drive)) {
/* This is mainly for CDRW and sequential DVD-RW */
+ if (!priv->sig_handler) {
+ burn_set_signal_handling ("brasero", NULL, 0);
+ priv->sig_handler = 1;
+ }
+
burn_disc_erase (priv->ctx->drive, (flags & BRASERO_BURN_FLAG_FAST_BLANK) != 0);
return BRASERO_BURN_OK;
}
@@ -672,6 +693,11 @@
return BRASERO_BURN_ERR;
}
+ if (!priv->sig_handler) {
+ burn_set_signal_handling ("brasero", NULL, 0);
+ priv->sig_handler = 1;
+ }
+
burn_disc_write (opts, priv->ctx->disc);
burn_write_opts_free (opts);
@@ -735,6 +761,11 @@
self = BRASERO_LIBBURN (job);
priv = BRASERO_LIBBURN_PRIVATE (self);
+ if (priv->sig_handler) {
+ priv->sig_handler = 0;
+ burn_set_signal_handling (NULL, NULL, 1);
+ }
+
if (priv->ctx) {
brasero_libburn_common_ctx_free (priv->ctx);
priv->ctx = NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]