[brasero] Moved video project to use a BraseroSessionCfg instead of its own treemodel
- From: Philippe Rouquier <philippr src gnome org>
- To: svn-commits-list gnome org
- Subject: [brasero] Moved video project to use a BraseroSessionCfg instead of its own treemodel
- Date: Sun, 21 Jun 2009 17:07:23 -0400 (EDT)
commit 590d9082d566a753fa64d78cc69cd1dfb5301285
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date: Sun Jun 7 20:51:00 2009 +0200
Moved video project to use a BraseroSessionCfg instead of its own treemodel
libbrasero-burn/brasero-burn-options.c | 3 +-
libbrasero-burn/brasero-burn.c | 4 +-
libbrasero-burn/brasero-error.h | 1 +
libbrasero-burn/brasero-session-cfg.c | 24 +-
libbrasero-burn/brasero-session-span.c | 9 +-
libbrasero-burn/brasero-session.c | 98 ++-
libbrasero-burn/brasero-session.h | 19 +-
libbrasero-burn/brasero-src-image.c | 8 +-
libbrasero-burn/brasero-src-selection.c | 4 +-
libbrasero-burn/brasero-sum-dialog.c | 4 +-
libbrasero-burn/brasero-tags.h | 1 +
libbrasero-burn/brasero-track-stream-cfg.c | 45 +-
libbrasero-burn/brasero-track-stream-cfg.h | 3 +
libbrasero-burn/burn-task-ctx.c | 2 +-
libbrasero-burn/libbrasero-marshal.list | 1 +
src/Makefile.am | 2 -
src/brasero-app.c | 8 +-
src/brasero-audio-disc.c | 2 +-
src/brasero-data-disc.c | 2 +-
src/brasero-project.c | 371 ++++-----
src/brasero-video-disc.c | 541 ++++++-------
src/brasero-video-project.c | 1221 ----------------------------
src/brasero-video-project.h | 187 -----
src/brasero-video-tree-model.c | 323 +++++----
src/brasero-video-tree-model.h | 25 +-
25 files changed, 810 insertions(+), 2098 deletions(-)
---
diff --git a/libbrasero-burn/brasero-burn-options.c b/libbrasero-burn/brasero-burn-options.c
index 2635f52..e8618af 100644
--- a/libbrasero-burn/brasero-burn-options.c
+++ b/libbrasero-burn/brasero-burn-options.c
@@ -786,7 +786,8 @@ brasero_status_dialog_uri_has_image (BraseroTrackDataCfg *track,
track_img = brasero_track_image_cfg_new ();
brasero_track_image_cfg_set_source (track_img, uri);
brasero_burn_session_add_track (BRASERO_BURN_SESSION (priv->session),
- BRASERO_TRACK (track_img));
+ BRASERO_TRACK (track_img),
+ NULL);
return BRASERO_BURN_CANCEL;
}
diff --git a/libbrasero-burn/brasero-burn.c b/libbrasero-burn/brasero-burn.c
index 0fc79f0..8340644 100644
--- a/libbrasero-burn/brasero-burn.c
+++ b/libbrasero-burn/brasero-burn.c
@@ -2187,7 +2187,7 @@ brasero_burn_record_session (BraseroBurn *burn,
brasero_burn_session_push_tracks (priv->session);
brasero_track_disc_set_drive (BRASERO_TRACK_DISC (track), brasero_burn_session_get_burner (priv->session));
- brasero_burn_session_add_track (priv->session, track);
+ brasero_burn_session_add_track (priv->session, track, NULL);
/* It's good practice to unref the track afterwards as we don't need it
* anymore. BraseroBurnSession refs it. */
@@ -2441,7 +2441,7 @@ brasero_burn_same_src_dest_image (BraseroBurn *self,
track = brasero_track_image_new ();
brasero_track_image_set_source (track, image, toc, format);
- brasero_burn_session_add_track (priv->session, BRASERO_TRACK (track));
+ brasero_burn_session_add_track (priv->session, BRASERO_TRACK (track), NULL);
/* It's good practice to unref the track afterwards as we don't need it
* anymore. BraseroBurnSession refs it. */
diff --git a/libbrasero-burn/brasero-error.h b/libbrasero-burn/brasero-error.h
index 36d8017..f067e88 100644
--- a/libbrasero-burn/brasero-error.h
+++ b/libbrasero-burn/brasero-error.h
@@ -52,6 +52,7 @@ typedef enum {
BRASERO_BURN_ERROR_OUTPUT_NONE,
BRASERO_BURN_ERROR_FILE_INVALID,
+ BRASERO_BURN_ERROR_FILE_FOLDER,
BRASERO_BURN_ERROR_FILE_NOT_FOUND,
BRASERO_BURN_ERROR_FILE_NOT_LOCAL,
diff --git a/libbrasero-burn/brasero-session-cfg.c b/libbrasero-burn/brasero-session-cfg.c
index 14e7d53..3e433df 100644
--- a/libbrasero-burn/brasero-session-cfg.c
+++ b/libbrasero-burn/brasero-session-cfg.c
@@ -515,9 +515,9 @@ brasero_session_cfg_check_size (BraseroSessionCfg *self)
BraseroDrive *burner;
GValue *value = NULL;
/* in sectors */
- gint64 session_size;
- gint64 max_sectors;
- gint64 disc_size;
+ goffset session_size;
+ goffset max_sectors;
+ goffset disc_size;
priv = BRASERO_SESSION_CFG_PRIVATE (self);
@@ -656,9 +656,9 @@ brasero_session_cfg_update (BraseroSessionCfg *self,
session_cfg_signals [IS_VALID_SIGNAL],
0);
return;
-
}
- else if (result == BRASERO_BURN_ERR) {
+
+ if (result == BRASERO_BURN_ERR) {
GError *error;
error = brasero_status_get_error (status);
@@ -686,7 +686,7 @@ brasero_session_cfg_update (BraseroSessionCfg *self,
if (brasero_track_type_is_empty (source)) {
brasero_track_type_free (source);
- priv->is_valid = BRASERO_SESSION_NOT_SUPPORTED;
+ priv->is_valid = BRASERO_SESSION_EMPTY;
g_signal_emit (self,
session_cfg_signals [IS_VALID_SIGNAL],
0);
@@ -890,10 +890,11 @@ brasero_session_cfg_track_added (BraseroBurnSession *session,
if (priv->disabled)
return;
- g_signal_connect (track,
- "session-loaded",
- G_CALLBACK (brasero_session_cfg_session_loaded),
- session);
+ if (BRASERO_IS_TRACK_DATA_CFG (track))
+ g_signal_connect (track,
+ "session-loaded",
+ G_CALLBACK (brasero_session_cfg_session_loaded),
+ session);
/* when that happens it's mostly because a medium source changed, or
* a new image was set.
@@ -909,7 +910,8 @@ brasero_session_cfg_track_added (BraseroBurnSession *session,
static void
brasero_session_cfg_track_removed (BraseroBurnSession *session,
- BraseroTrack *track)
+ BraseroTrack *track,
+ guint former_position)
{
BraseroSessionCfgPrivate *priv;
diff --git a/libbrasero-burn/brasero-session-span.c b/libbrasero-burn/brasero-session-span.c
index 2e9ac25..5128bc2 100644
--- a/libbrasero-burn/brasero-session-span.c
+++ b/libbrasero-burn/brasero-session-span.c
@@ -151,8 +151,7 @@ brasero_session_span_possible (BraseroSessionSpan *session)
track = tracks->data;
if (BRASERO_IS_TRACK_DATA_CFG (track))
- return brasero_track_data_cfg_span_possible (BRASERO_TRACK_DATA_CFG (track),
- max_sectors);
+ return brasero_track_data_cfg_span_possible (BRASERO_TRACK_DATA_CFG (track), max_sectors);
/* This is the common case */
brasero_track_get_size (BRASERO_TRACK (track),
@@ -242,7 +241,9 @@ brasero_session_span_next (BraseroSessionSpan *session)
pushed = TRUE;
brasero_burn_session_push_tracks (BRASERO_BURN_SESSION (session));
- brasero_burn_session_add_track (BRASERO_BURN_SESSION (session), BRASERO_TRACK (new_track));
+ brasero_burn_session_add_track (BRASERO_BURN_SESSION (session),
+ BRASERO_TRACK (new_track),
+ NULL);
break;
}
@@ -266,7 +267,7 @@ brasero_session_span_next (BraseroSessionSpan *session)
}
BRASERO_BURN_LOG ("Adding tracks");
- brasero_burn_session_add_track (BRASERO_BURN_SESSION (session), track);
+ brasero_burn_session_add_track (BRASERO_BURN_SESSION (session), track, NULL);
if (priv->last_track)
g_object_unref (priv->last_track);
diff --git a/libbrasero-burn/brasero-session.c b/libbrasero-burn/brasero-session.c
index 99576c4..e98bcbc 100644
--- a/libbrasero-burn/brasero-session.c
+++ b/libbrasero-burn/brasero-session.c
@@ -48,6 +48,7 @@
#include "burn-basics.h"
#include "burn-debug.h"
+#include "libbrasero-marshal.h"
#include "burn-image-format.h"
#include "brasero-medium.h"
@@ -224,14 +225,16 @@ brasero_burn_session_free_tracks (BraseroBurnSession *self)
g_signal_emit (self,
brasero_burn_session_signals [TRACK_REMOVED_SIGNAL],
0,
- track);
+ track,
+ 0);
g_object_unref (track);
}
}
BraseroBurnResult
brasero_burn_session_add_track (BraseroBurnSession *self,
- BraseroTrack *new_track)
+ BraseroTrack *new_track,
+ BraseroTrack *sibling)
{
BraseroBurnSessionPrivate *priv;
@@ -270,7 +273,17 @@ brasero_burn_session_add_track (BraseroBurnSession *self,
brasero_burn_session_free_tracks (self);
brasero_burn_session_start_track_monitoring (self, new_track);
- priv->tracks = g_slist_append (priv->tracks, new_track);
+ if (sibling) {
+ GSList *sibling_node;
+
+ sibling_node = g_slist_find (priv->tracks, sibling);
+ priv->tracks = g_slist_insert_before (priv->tracks,
+ sibling_node,
+ new_track);
+ }
+ else
+ priv->tracks = g_slist_append (priv->tracks, new_track);
+
g_signal_emit (self,
brasero_burn_session_signals [TRACK_ADDED_SIGNAL],
0,
@@ -279,6 +292,75 @@ brasero_burn_session_add_track (BraseroBurnSession *self,
return BRASERO_BURN_OK;
}
+BraseroBurnResult
+brasero_burn_session_move_track (BraseroBurnSession *session,
+ BraseroTrack *track,
+ BraseroTrack *sibling)
+{
+ BraseroBurnSessionPrivate *priv;
+ guint former_position;
+
+ g_return_val_if_fail (BRASERO_IS_BURN_SESSION (session), BRASERO_BURN_ERR);
+
+ priv = BRASERO_BURN_SESSION_PRIVATE (session);
+
+ /* Find the track, remove it */
+ former_position = g_slist_index (priv->tracks, track);
+ priv->tracks = g_slist_remove (priv->tracks, track);
+ g_signal_emit (session,
+ brasero_burn_session_signals [TRACK_REMOVED_SIGNAL],
+ 0,
+ track,
+ former_position);
+
+ /* Re-add it */
+ if (sibling) {
+ GSList *sibling_node;
+
+ sibling_node = g_slist_find (priv->tracks, sibling);
+ priv->tracks = g_slist_insert_before (priv->tracks,
+ sibling_node,
+ track);
+ }
+ else
+ priv->tracks = g_slist_append (priv->tracks, track);
+
+ g_signal_emit (session,
+ brasero_burn_session_signals [TRACK_ADDED_SIGNAL],
+ 0,
+ track);
+
+ return BRASERO_BURN_OK;
+}
+
+BraseroBurnResult
+brasero_burn_session_remove_track (BraseroBurnSession *session,
+ BraseroTrack *track)
+{
+ BraseroBurnSessionPrivate *priv;
+ guint former_position;
+
+ g_return_val_if_fail (BRASERO_IS_BURN_SESSION (session), BRASERO_BURN_ERR);
+
+ priv = BRASERO_BURN_SESSION_PRIVATE (session);
+
+ /* Find the track, remove it */
+ former_position = g_slist_index (priv->tracks, track);
+ priv->tracks = g_slist_remove (priv->tracks, track);
+ g_signal_handlers_disconnect_by_func (track,
+ brasero_burn_session_track_changed,
+ session);
+
+ g_signal_emit (session,
+ brasero_burn_session_signals [TRACK_REMOVED_SIGNAL],
+ 0,
+ track,
+ former_position);
+
+ g_object_unref (track);
+ return BRASERO_BURN_OK;
+}
+
GSList *
brasero_burn_session_get_tracks (BraseroBurnSession *self)
{
@@ -1258,7 +1340,8 @@ brasero_burn_session_push_tracks (BraseroBurnSession *self)
g_signal_emit (self,
brasero_burn_session_signals [TRACK_REMOVED_SIGNAL],
0,
- track);
+ track,
+ 0);
}
}
@@ -1775,10 +1858,11 @@ brasero_burn_session_class_init (BraseroBurnSessionClass *klass)
G_STRUCT_OFFSET (BraseroBurnSessionClass, track_removed),
NULL,
NULL,
- g_cclosure_marshal_VOID__OBJECT,
+ brasero_marshal_VOID__OBJECT_UINT,
G_TYPE_NONE,
- 1,
- BRASERO_TYPE_TRACK);
+ 2,
+ BRASERO_TYPE_TRACK,
+ G_TYPE_UINT);
brasero_burn_session_signals [TRACK_CHANGED_SIGNAL] =
g_signal_new ("track_changed",
BRASERO_TYPE_BURN_SESSION,
diff --git a/libbrasero-burn/brasero-session.h b/libbrasero-burn/brasero-session.h
index d21c239..a31fb3f 100644
--- a/libbrasero-burn/brasero-session.h
+++ b/libbrasero-burn/brasero-session.h
@@ -70,7 +70,8 @@ struct _BraseroBurnSessionClass {
void (*track_added) (BraseroBurnSession *session,
BraseroTrack *track);
void (*track_removed) (BraseroBurnSession *session,
- BraseroTrack *track);
+ BraseroTrack *track,
+ guint former_position);
void (*track_changed) (BraseroBurnSession *session,
BraseroTrack *track);
void (*output_changed) (BraseroBurnSession *session,
@@ -88,11 +89,25 @@ BraseroBurnSession *brasero_burn_session_new ();
BraseroBurnResult
brasero_burn_session_add_track (BraseroBurnSession *session,
- BraseroTrack *track);
+ BraseroTrack *track,
+ BraseroTrack *sibling);
+
+BraseroBurnResult
+brasero_burn_session_move_track (BraseroBurnSession *session,
+ BraseroTrack *track,
+ BraseroTrack *sibling);
+
+BraseroBurnResult
+brasero_burn_session_remove_track (BraseroBurnSession *session,
+ BraseroTrack *track);
GSList *
brasero_burn_session_get_tracks (BraseroBurnSession *session);
+/**
+ * Get some information about the session
+ */
+
BraseroBurnResult
brasero_burn_session_get_status (BraseroBurnSession *session,
BraseroStatus *status);
diff --git a/libbrasero-burn/brasero-src-image.c b/libbrasero-burn/brasero-src-image.c
index 14ee2ad..36f1c89 100644
--- a/libbrasero-burn/brasero-src-image.c
+++ b/libbrasero-burn/brasero-src-image.c
@@ -720,7 +720,9 @@ brasero_src_image_set_property (GObject *object,
}
}
- brasero_burn_session_add_track (priv->session, BRASERO_TRACK (priv->track));
+ brasero_burn_session_add_track (priv->session,
+ BRASERO_TRACK (priv->track),
+ NULL);
g_free (image);
g_free (toc);
}
@@ -732,7 +734,9 @@ brasero_src_image_set_property (GObject *object,
else {
/* Add our own track */
priv->track = brasero_track_image_cfg_new ();
- brasero_burn_session_add_track (priv->session, BRASERO_TRACK (priv->track));
+ brasero_burn_session_add_track (priv->session,
+ BRASERO_TRACK (priv->track),
+ NULL);
}
g_signal_connect (priv->track,
diff --git a/libbrasero-burn/brasero-src-selection.c b/libbrasero-burn/brasero-src-selection.c
index 7920950..a0a73ee 100644
--- a/libbrasero-burn/brasero-src-selection.c
+++ b/libbrasero-burn/brasero-src-selection.c
@@ -177,7 +177,9 @@ brasero_src_selection_set_property (GObject *object,
}
else {
priv->track = brasero_track_disc_new ();
- brasero_burn_session_add_track (priv->session, BRASERO_TRACK (priv->track));
+ brasero_burn_session_add_track (priv->session,
+ BRASERO_TRACK (priv->track),
+ NULL);
}
drive = brasero_track_disc_get_drive (priv->track);
diff --git a/libbrasero-burn/brasero-sum-dialog.c b/libbrasero-burn/brasero-sum-dialog.c
index 23cd3ab..e9bdf6b 100644
--- a/libbrasero-burn/brasero-sum-dialog.c
+++ b/libbrasero-burn/brasero-sum-dialog.c
@@ -474,7 +474,7 @@ brasero_sum_dialog_get_disc_checksum (BraseroSumDialog *self,
track = brasero_track_disc_new ();
brasero_track_disc_set_drive (track, drive);
brasero_track_set_checksum (BRASERO_TRACK (track), BRASERO_CHECKSUM_MD5, checksum);
- brasero_burn_session_add_track (priv->session, BRASERO_TRACK (track));
+ brasero_burn_session_add_track (priv->session, BRASERO_TRACK (track), NULL);
/* It's good practice to unref the track afterwards as we don't need it
* anymore. BraseroBurnSession refs it. */
@@ -565,7 +565,7 @@ brasero_sum_dialog_check_disc_sum (BraseroSumDialog *self,
track = brasero_track_disc_new ();
brasero_track_disc_set_drive (track, drive);
brasero_track_set_checksum (BRASERO_TRACK (track), BRASERO_CHECKSUM_DETECT, NULL);
- brasero_burn_session_add_track (priv->session, BRASERO_TRACK (track));
+ brasero_burn_session_add_track (priv->session, BRASERO_TRACK (track), NULL);
/* no eject at the end (it should be default) */
brasero_burn_session_remove_flag (priv->session, BRASERO_BURN_FLAG_EJECT);
diff --git a/libbrasero-burn/brasero-tags.h b/libbrasero-burn/brasero-tags.h
index e6319ff..874ff74 100644
--- a/libbrasero-burn/brasero-tags.h
+++ b/libbrasero-burn/brasero-tags.h
@@ -55,6 +55,7 @@ G_BEGIN_DECLS
#define BRASERO_TRACK_STREAM_TITLE_TAG "track::stream::info::title"
#define BRASERO_TRACK_STREAM_COMPOSER_TAG "track::stream::info::composer"
#define BRASERO_TRACK_STREAM_ARTIST_TAG "track::stream::info::artist"
+#define BRASERO_TRACK_STREAM_THUMBNAIL_TAG "track::stream::snapshot"
/**
* Int
diff --git a/libbrasero-burn/brasero-track-stream-cfg.c b/libbrasero-burn/brasero-track-stream-cfg.c
index e81b88b..75588e9 100644
--- a/libbrasero-burn/brasero-track-stream-cfg.c
+++ b/libbrasero-burn/brasero-track-stream-cfg.c
@@ -58,13 +58,14 @@ G_DEFINE_TYPE (BraseroTrackStreamCfg, brasero_track_stream_cfg, BRASERO_TYPE_TRA
static void
-brasero_video_project_result_cb (GObject *obj,
- GError *error,
- const gchar *uri,
- GFileInfo *info,
- gpointer user_data)
+brasero_track_stream_cfg_results_cb (GObject *obj,
+ GError *error,
+ const gchar *uri,
+ GFileInfo *info,
+ gpointer user_data)
{
guint64 len;
+ GObject *snapshot;
BraseroTrackStreamCfgPrivate *priv;
priv = BRASERO_TRACK_STREAM_CFG_PRIVATE (obj);
@@ -78,6 +79,16 @@ brasero_video_project_result_cb (GObject *obj,
}
/* FIXME: we don't know whether it's audio or video that is required */
+ if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY) {
+ /* This error is special as it can be recovered from */
+ priv->error = g_error_new (BRASERO_BURN_ERROR,
+ BRASERO_BURN_ERROR_FILE_FOLDER,
+ _("Directories cannot be added to video or audio discs"));
+
+ brasero_track_changed (BRASERO_TRACK (obj));
+ return;
+ }
+
if (g_file_info_get_file_type (info) != G_FILE_TYPE_REGULAR
|| (!g_file_info_get_attribute_boolean (info, BRASERO_IO_HAS_VIDEO)
&& !g_file_info_get_attribute_boolean (info, BRASERO_IO_HAS_AUDIO))) {
@@ -85,7 +96,7 @@ brasero_video_project_result_cb (GObject *obj,
BRASERO_GET_BASENAME_FOR_DISPLAY (uri, name);
priv->error = g_error_new (BRASERO_BURN_ERROR,
- BRASERO_BURN_ERR,
+ BRASERO_BURN_ERROR_GENERAL,
/* Translators: %s is the name of the file */
_("\"%s\" is not suitable for audio or video media"),
name);
@@ -120,7 +131,19 @@ brasero_video_project_result_cb (GObject *obj,
0,
len,
0);
-
+
+ snapshot = g_file_info_get_attribute_object (info, BRASERO_IO_THUMBNAIL);
+ if (snapshot) {
+ GValue *value;
+
+ value = g_new0 (GValue, 1);
+ g_value_init (value, GDK_TYPE_PIXBUF);
+ g_value_set_object (value, g_object_ref (snapshot));
+ brasero_track_tag_add (BRASERO_TRACK (obj),
+ BRASERO_TRACK_STREAM_THUMBNAIL_TAG,
+ value);
+ }
+
/* Get the song info */
if (g_file_info_get_attribute_string (info, BRASERO_IO_TITLE))
brasero_track_tag_add_string (BRASERO_TRACK (obj),
@@ -158,7 +181,7 @@ brasero_track_stream_cfg_get_info (BraseroTrackStreamCfg *track)
/* get info async for the file */
if (!priv->load_uri)
priv->load_uri = brasero_io_register (G_OBJECT (track),
- brasero_video_project_result_cb,
+ brasero_track_stream_cfg_results_cb,
NULL,
NULL);
@@ -249,3 +272,9 @@ brasero_track_stream_cfg_class_init (BraseroTrackStreamCfgClass *klass)
parent_class->set_source = brasero_track_stream_cfg_set_source;
}
+BraseroTrackStreamCfg *
+brasero_track_stream_cfg_new (void)
+{
+ return g_object_new (BRASERO_TYPE_TRACK_STREAM_CFG, NULL);
+}
+
diff --git a/libbrasero-burn/brasero-track-stream-cfg.h b/libbrasero-burn/brasero-track-stream-cfg.h
index 12f8dbb..130bfac 100644
--- a/libbrasero-burn/brasero-track-stream-cfg.h
+++ b/libbrasero-burn/brasero-track-stream-cfg.h
@@ -59,6 +59,9 @@ struct _BraseroTrackStreamCfg
GType brasero_track_stream_cfg_get_type (void) G_GNUC_CONST;
+BraseroTrackStreamCfg *
+brasero_track_stream_cfg_new (void);
+
G_END_DECLS
#endif /* _BRASERO_TRACK_STREAM_CFG_H_ */
diff --git a/libbrasero-burn/burn-task-ctx.c b/libbrasero-burn/burn-task-ctx.c
index e53fc45..5fa349e 100644
--- a/libbrasero-burn/burn-task-ctx.c
+++ b/libbrasero-burn/burn-task-ctx.c
@@ -373,7 +373,7 @@ brasero_task_ctx_finished (BraseroTaskCtx *self)
BraseroTrack *track;
track = iter->data;
- brasero_burn_session_add_track (priv->session, track);
+ brasero_burn_session_add_track (priv->session, track, NULL);
/* It's good practice to unref the track afterwards as
* we don't need it anymore. BraseroBurnSession refs it.
diff --git a/libbrasero-burn/libbrasero-marshal.list b/libbrasero-burn/libbrasero-marshal.list
index 69bfeb8..2354de0 100644
--- a/libbrasero-burn/libbrasero-marshal.list
+++ b/libbrasero-burn/libbrasero-marshal.list
@@ -9,6 +9,7 @@ VOID:INT,STRING
VOID:POINTER,STRING
VOID:POINTER,POINTER
VOID:OBJECT,BOOLEAN
+VOID:OBJECT,UINT
VOID:BOOLEAN,BOOLEAN
VOID:DOUBLE,DOUBLE,LONG
VOID:POINTER,UINT,POINTER
diff --git a/src/Makefile.am b/src/Makefile.am
index 1065613..cc2d0a1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -107,8 +107,6 @@ brasero_SOURCES = \
brasero-rename.c \
brasero-video-disc.c \
brasero-video-disc.h \
- brasero-video-project.h \
- brasero-video-project.c \
brasero-video-tree-model.c \
brasero-video-tree-model.h \
brasero-app.c \
diff --git a/src/brasero-app.c b/src/brasero-app.c
index 218fa42..1c62f30 100644
--- a/src/brasero-app.c
+++ b/src/brasero-app.c
@@ -726,7 +726,9 @@ brasero_app_burn_image (BraseroApp *app,
if (uri)
brasero_track_image_cfg_set_source (track, uri);
- brasero_burn_session_add_track (BRASERO_BURN_SESSION (session), BRASERO_TRACK (track));
+ brasero_burn_session_add_track (BRASERO_BURN_SESSION (session),
+ BRASERO_TRACK (track),
+ NULL);
if (brasero_app_burn_options (app, session))
brasero_app_burn (app, BRASERO_BURN_SESSION (session));
@@ -744,7 +746,9 @@ brasero_app_copy_disc (BraseroApp *app,
session = brasero_session_cfg_new ();
track = brasero_track_disc_new ();
- brasero_burn_session_add_track (BRASERO_BURN_SESSION (session), BRASERO_TRACK (track));
+ brasero_burn_session_add_track (BRASERO_BURN_SESSION (session),
+ BRASERO_TRACK (track),
+ NULL);
/* if a device is specified then get the corresponding medium */
if (device) {
diff --git a/src/brasero-audio-disc.c b/src/brasero-audio-disc.c
index 0d0a660..68577a2 100644
--- a/src/brasero-audio-disc.c
+++ b/src/brasero-audio-disc.c
@@ -2055,7 +2055,7 @@ brasero_audio_disc_set_session_contents (BraseroDisc *disc,
BRASERO_TRACK_STREAM_ISRC_TAG,
isrc);
- brasero_burn_session_add_track (session, BRASERO_TRACK (track));
+ brasero_burn_session_add_track (session, BRASERO_TRACK (track), NULL);
/* It's good practice to unref the track afterwards as we don't
* need it anymore. BraseroBurnSession refs it. */
diff --git a/src/brasero-data-disc.c b/src/brasero-data-disc.c
index 44a625d..d0b4d26 100644
--- a/src/brasero-data-disc.c
+++ b/src/brasero-data-disc.c
@@ -1356,7 +1356,7 @@ brasero_data_disc_set_session_contents (BraseroDisc *self,
priv = BRASERO_DATA_DISC_PRIVATE (self);
- brasero_burn_session_add_track (session, BRASERO_TRACK (priv->project));
+ brasero_burn_session_add_track (session, BRASERO_TRACK (priv->project), NULL);
return BRASERO_DISC_OK;
}
diff --git a/src/brasero-project.c b/src/brasero-project.c
index 8c3875d..37050bf 100644
--- a/src/brasero-project.c
+++ b/src/brasero-project.c
@@ -110,22 +110,9 @@ static void
brasero_project_burn_cb (GtkAction *action, BraseroProject *project);
static void
-brasero_project_size_changed_cb (BraseroDisc *disc,
- gint64 size,
- BraseroProject *project);
-static void
-brasero_project_flags_changed_cb (BraseroDisc *disc,
- BraseroBurnFlag flags,
- BraseroProject *project);
-
-static void
brasero_project_burn_clicked_cb (GtkButton *button, BraseroProject *project);
static void
-brasero_project_contents_changed_cb (BraseroDisc *disc,
- gint nb_files,
- BraseroProject *project);
-static void
brasero_project_selection_changed_cb (BraseroDisc *disc,
BraseroProject *project);
@@ -205,8 +192,6 @@ struct BraseroProjectPrivate {
guint has_focus:1;
guint oversized:1;
guint selected_uris:1;
-
- guint merging:1;
};
static GtkActionEntry entries [] = {
@@ -535,22 +520,102 @@ brasero_project_icon_button_clicked (GtkWidget *button,
g_free (path);
}
+/********************************** size ***************************************/
+
+gchar *
+brasero_project_get_sectors_string (gint64 sectors,
+ gboolean time_format)
+{
+ gint64 size_bytes;
+
+ if (time_format) {
+ size_bytes = sectors * GST_SECOND / 75;
+ return brasero_units_get_time_string (size_bytes, TRUE, FALSE);
+ }
+ else {
+ size_bytes = sectors * 2048;
+ return g_format_size_for_display (size_bytes);
+ }
+}
+
+static void
+brasero_project_update_project_size (BraseroProject *project)
+{
+ goffset sectors = 0;
+ GtkWidget *status;
+ gchar *size_str;
+ gchar *string;
+
+ status = brasero_app_get_statusbar2 (brasero_app_get_default ());
+
+ if (!project->priv->status_ctx)
+ project->priv->status_ctx = gtk_statusbar_get_context_id (GTK_STATUSBAR (status),
+ "size_project");
+
+ gtk_statusbar_pop (GTK_STATUSBAR (status), project->priv->status_ctx);
+
+ brasero_burn_session_get_size (BRASERO_BURN_SESSION (project->priv->session),
+ §ors,
+ NULL);
+
+ string = brasero_project_get_sectors_string (sectors, !BRASERO_IS_DATA_DISC (project->priv->current));
+ size_str = g_strdup_printf (_("Project estimated size: %s"), string);
+
+ g_free (string);
+
+ gtk_statusbar_push (GTK_STATUSBAR (status), project->priv->status_ctx, size_str);
+ g_free (size_str);
+}
+
+static void
+brasero_project_update_controls (BraseroProject *project)
+{
+ GtkAction *action;
+
+ brasero_project_set_remove_button_state (project);
+ brasero_project_set_add_button_state (project);
+
+ action = gtk_action_group_get_action (project->priv->project_group, "DeleteAll");
+ gtk_action_set_sensitive (action, (project->priv->empty == FALSE));
+}
+
static void
-brasero_project_icon_button_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation,
- gpointer NULL_data)
+brasero_project_modified (BraseroProject *project)
{
- allocation->width = MAX (allocation->width, allocation->height);
- allocation->height = MAX (allocation->width, allocation->height);
+ GtkAction *action;
+
+ brasero_project_update_controls (project);
+ brasero_project_update_project_size (project);
+
+ /* the state of the following depends on the existence of an opened project */
+ action = gtk_action_group_get_action (project->priv->project_group, "Save");
+ gtk_action_set_sensitive (action, TRUE);
+ project->priv->modified = TRUE;
}
static void
-brasero_project_icon_button_size_request (GtkWidget *widget,
- GtkRequisition *requisition,
- gpointer NULL_data)
+brasero_project_track_removed (BraseroBurnSession *session,
+ BraseroTrack *track,
+ guint former_position,
+ BraseroProject *project)
{
- requisition->width = MAX (requisition->width, requisition->height);
- requisition->height = MAX (requisition->width, requisition->height);
+ brasero_project_modified (project);
+}
+
+static void
+brasero_project_track_changed (BraseroBurnSession *session,
+ BraseroTrack *track,
+ BraseroProject *project)
+{
+ brasero_project_modified (project);
+}
+
+static void
+brasero_project_track_added (BraseroBurnSession *session,
+ BraseroTrack *track,
+ BraseroProject *project)
+{
+ brasero_project_modified (project);
}
static void
@@ -576,10 +641,33 @@ brasero_project_is_valid (BraseroSessionCfg *session,
BraseroProject *project)
{
BraseroSessionError valid;
+ BraseroStatus *status;
+ GdkWindow *window;
+ GdkCursor *cursor;
+ GtkAction *action;
+
+ /* Update the cursor */
+ status = brasero_status_new ();
+ brasero_burn_session_get_status (BRASERO_BURN_SESSION (session), status);
+
+ window = gtk_widget_get_window (GTK_WIDGET (project));
+ if (window) {
+ if (brasero_status_get_result (status) == BRASERO_BURN_NOT_READY) {
+ cursor = gdk_cursor_new (GDK_WATCH);
+ gdk_window_set_cursor (window, cursor);
+ gdk_cursor_unref (cursor);
+ }
+ else
+ gdk_window_set_cursor (window, NULL);
+ }
+
+ brasero_status_free (status);
valid = brasero_session_cfg_get_error (project->priv->session);
/* Update burn button state */
+ action = gtk_action_group_get_action (project->priv->project_group, "Burn");
+ gtk_action_set_sensitive (action, BRASERO_SESSION_IS_VALID (valid));
gtk_widget_set_sensitive (project->priv->burn, BRASERO_SESSION_IS_VALID (valid));
/* FIXME: update option button state as well */
@@ -589,6 +677,8 @@ brasero_project_is_valid (BraseroSessionCfg *session,
BRASERO_NOTIFY_CONTEXT_SIZE);
if (valid == BRASERO_SESSION_INSUFFICIENT_SPACE) {
+ project->priv->oversized = TRUE;
+
/* Here there is an alternative: we may be able to span the data
* across multiple media. So try that. */
if (brasero_session_span_possible (BRASERO_SESSION_SPAN (project->priv->session)) == BRASERO_BURN_RETRY) {
@@ -620,6 +710,7 @@ brasero_project_is_valid (BraseroSessionCfg *session,
else if (valid == BRASERO_SESSION_OVERBURN_NECESSARY) {
GtkWidget *message;
+ project->priv->oversized = TRUE;
message = brasero_notify_message_add (BRASERO_NOTIFY (project->priv->message),
_("Would you like to burn beyond the disc reported capacity?"),
_("The size of the project is too large for the disc and you must remove files from the project otherwise."
@@ -638,6 +729,9 @@ brasero_project_is_valid (BraseroSessionCfg *session,
G_CALLBACK (brasero_project_message_response_overburn_cb),
project);
}
+ else if (valid == BRASERO_SESSION_EMPTY) {
+ project->priv->empty = TRUE;
+ }
else if (valid == BRASERO_SESSION_NO_OUTPUT) {
brasero_notify_message_add (BRASERO_NOTIFY (project->priv->message),
_("Please insert a recordable CD or DVD."),
@@ -669,6 +763,25 @@ brasero_project_is_valid (BraseroSessionCfg *session,
10000,
BRASERO_NOTIFY_CONTEXT_SIZE);
}
+
+ if (BRASERO_SESSION_IS_VALID (valid)) {
+ project->priv->empty = FALSE;
+ project->priv->oversized = FALSE;
+ }
+}
+
+static void
+brasero_project_flags_changed_cb (BraseroBurnSession *session,
+ BraseroProject *project)
+{
+ BraseroBurnFlag flags;
+
+ flags = brasero_burn_session_get_flags (session);
+
+ /* see if the project name should be updated */
+ if (flags & BRASERO_BURN_FLAG_MERGE)
+ brasero_project_name_set_multisession_medium (BRASERO_PROJECT_NAME (project->priv->name_display),
+ brasero_data_disc_get_loaded_medium (BRASERO_DATA_DISC (project->priv->current)));
}
static void
@@ -695,10 +808,29 @@ brasero_project_init (BraseroProject *obj)
gtk_widget_show (obj->priv->message);
obj->priv->session = brasero_session_cfg_new ();
+
+ /* NOTE: "is-valid" is emitted whenever there is a change in the
+ * contents of the session. So no need to connect to track-added, ... */
g_signal_connect (obj->priv->session,
"is-valid",
G_CALLBACK (brasero_project_is_valid),
obj);
+ g_signal_connect (obj->priv->session,
+ "flags-changed",
+ G_CALLBACK (brasero_project_flags_changed_cb),
+ obj);
+ g_signal_connect (obj->priv->session,
+ "track-added",
+ G_CALLBACK (brasero_project_track_added),
+ obj);
+ g_signal_connect (obj->priv->session,
+ "track-changed",
+ G_CALLBACK (brasero_project_track_changed),
+ obj);
+ g_signal_connect (obj->priv->session,
+ "track-removed",
+ G_CALLBACK (brasero_project_track_removed),
+ obj);
/* bottom */
box = gtk_hbox_new (FALSE, 6);
@@ -782,14 +914,6 @@ brasero_project_init (BraseroProject *obj)
obj->priv->icon_img = image;
button = gtk_button_new ();
- g_signal_connect (button,
- "size-request",
- G_CALLBACK (brasero_project_icon_button_size_request),
- NULL);
- g_signal_connect (button,
- "size-allocate",
- G_CALLBACK (brasero_project_icon_button_size_allocate),
- NULL);
gtk_widget_show (button);
gtk_button_set_image (GTK_BUTTON (button), image);
obj->priv->button_img = button;
@@ -844,14 +968,6 @@ brasero_project_init (BraseroProject *obj)
obj->priv->audio = brasero_audio_disc_new ();
gtk_widget_show (obj->priv->audio);
g_signal_connect (G_OBJECT (obj->priv->audio),
- "contents-changed",
- G_CALLBACK (brasero_project_contents_changed_cb),
- obj);
- g_signal_connect (G_OBJECT (obj->priv->audio),
- "size-changed",
- G_CALLBACK (brasero_project_size_changed_cb),
- obj);
- g_signal_connect (G_OBJECT (obj->priv->audio),
"selection-changed",
G_CALLBACK (brasero_project_selection_changed_cb),
obj);
@@ -860,18 +976,6 @@ brasero_project_init (BraseroProject *obj)
gtk_widget_show (obj->priv->data);
brasero_data_disc_set_right_button_group (BRASERO_DATA_DISC (obj->priv->data), size_group);
g_signal_connect (G_OBJECT (obj->priv->data),
- "contents-changed",
- G_CALLBACK (brasero_project_contents_changed_cb),
- obj);
- g_signal_connect (G_OBJECT (obj->priv->data),
- "size-changed",
- G_CALLBACK (brasero_project_size_changed_cb),
- obj);
- g_signal_connect (G_OBJECT (obj->priv->data),
- "flags-changed",
- G_CALLBACK (brasero_project_flags_changed_cb),
- obj);
- g_signal_connect (G_OBJECT (obj->priv->data),
"selection-changed",
G_CALLBACK (brasero_project_selection_changed_cb),
obj);
@@ -883,14 +987,6 @@ brasero_project_init (BraseroProject *obj)
obj->priv->video = brasero_video_disc_new ();
gtk_widget_show (obj->priv->video);
g_signal_connect (G_OBJECT (obj->priv->video),
- "contents-changed",
- G_CALLBACK (brasero_project_contents_changed_cb),
- obj);
- g_signal_connect (G_OBJECT (obj->priv->video),
- "size-changed",
- G_CALLBACK (brasero_project_size_changed_cb),
- obj);
- g_signal_connect (G_OBJECT (obj->priv->video),
"selection-changed",
G_CALLBACK (brasero_project_selection_changed_cb),
obj);
@@ -943,97 +1039,6 @@ brasero_project_new ()
return GTK_WIDGET (obj);
}
-/********************************** size ***************************************/
-
-gchar *
-brasero_project_get_sectors_string (gint64 sectors,
- gboolean time_format)
-{
- gint64 size_bytes;
-
- if (time_format) {
- size_bytes = sectors * GST_SECOND / 75;
- return brasero_units_get_time_string (size_bytes, TRUE, FALSE);
- }
- else {
- size_bytes = sectors * 2048;
- return g_format_size_for_display (size_bytes);
- }
-}
-
-static void
-brasero_project_update_project_size (BraseroProject *project,
- guint64 sectors)
-{
- GtkWidget *status;
- gchar *string;
- gchar *size;
-
- status = brasero_app_get_statusbar2 (brasero_app_get_default ());
-
- if (!project->priv->status_ctx)
- project->priv->status_ctx = gtk_statusbar_get_context_id (GTK_STATUSBAR (status),
- "size_project");
-
- gtk_statusbar_pop (GTK_STATUSBAR (status), project->priv->status_ctx);
-
- string = brasero_project_get_sectors_string (sectors,
- !BRASERO_IS_DATA_DISC (project->priv->current));
- if (project->priv->merging) {
- gchar *medium_string;
- BraseroMedium *medium;
- gint64 free_space = 0;
-
- medium = brasero_data_disc_get_loaded_medium (BRASERO_DATA_DISC (project->priv->current));
- brasero_medium_get_free_space (medium,
- &free_space,
- NULL);
-
- medium_string = g_format_size_for_display (free_space);
- /* Translators: first %s is the size of the project and the
- * second %s is the remaining free space on the disc that is
- * used for multisession */
- size = g_strdup_printf (_("Project estimated size: %s/%s"),
- string,
- medium_string);
- g_free (medium_string);
- }
- else
- size = g_strdup_printf (_("Project estimated size: %s"), string);
-
- g_free (string);
-
- gtk_statusbar_push (GTK_STATUSBAR (status), project->priv->status_ctx, size);
- g_free (size);
-}
-
-static void
-brasero_project_size_changed_cb (BraseroDisc *disc,
- gint64 sectors,
- BraseroProject *project)
-{
- project->priv->sectors = sectors;
- brasero_project_update_project_size (project, sectors);
-}
-
-static void
-brasero_project_flags_changed_cb (BraseroDisc *disc,
- BraseroBurnFlag flags,
- BraseroProject *project)
-{
- gboolean merging;
-
- merging = (flags & BRASERO_BURN_FLAG_MERGE) != 0;
-
- /* see if the project name should be updated */
- brasero_project_name_set_multisession_medium (BRASERO_PROJECT_NAME (project->priv->name_display),
- brasero_data_disc_get_loaded_medium (BRASERO_DATA_DISC (disc)));
-
- /* we just need to know if MERGE flag is on */
- project->priv->merging = merging;
- brasero_project_update_project_size (project, project->priv->sectors);
-}
-
/***************************** URIContainer ************************************/
static void
brasero_project_selection_changed_cb (BraseroDisc *disc,
@@ -1341,6 +1346,16 @@ brasero_project_create_audio_cover (BraseroProject *project,
/******************************** ******************************************/
static void
+brasero_project_reset (BraseroProject *project)
+{
+ brasero_burn_session_set_flags (BRASERO_BURN_SESSION (project->priv->session),
+ BRASERO_BURN_FLAG_NONE);
+ brasero_burn_session_add_track (BRASERO_BURN_SESSION (project->priv->session),
+ NULL,
+ NULL);
+}
+
+static void
brasero_project_switch (BraseroProject *project, BraseroProjectType type)
{
GtkAction *action;
@@ -1357,8 +1372,7 @@ brasero_project_switch (BraseroProject *project, BraseroProjectType type)
"media-optical",
GTK_ICON_SIZE_LARGE_TOOLBAR);
- if (project->priv->current)
- brasero_disc_reset (project->priv->current);
+ brasero_project_reset (project);
if (project->priv->chooser) {
gtk_widget_destroy (project->priv->chooser);
@@ -1367,7 +1381,6 @@ brasero_project_switch (BraseroProject *project, BraseroProjectType type)
project->priv->empty = 1;
project->priv->burnt = 0;
- project->priv->merging = 0;
project->priv->modified = 0;
if (project->priv->project) {
@@ -1396,8 +1409,6 @@ brasero_project_switch (BraseroProject *project, BraseroProjectType type)
project->priv->message);
gtk_notebook_set_current_page (GTK_NOTEBOOK (project->priv->discs), 0);
- brasero_project_update_project_size (project, 0);
-
brasero_medium_selection_show_media_type (BRASERO_MEDIUM_SELECTION (project->priv->selection),
BRASERO_MEDIA_TYPE_WRITABLE);
brasero_dest_selection_choose_best (BRASERO_DEST_SELECTION (project->priv->selection));
@@ -1411,8 +1422,6 @@ brasero_project_switch (BraseroProject *project, BraseroProjectType type)
project->priv->message);
gtk_notebook_set_current_page (GTK_NOTEBOOK (project->priv->discs), 1);
- brasero_project_update_project_size (project, 0);
-
brasero_medium_selection_show_media_type (BRASERO_MEDIUM_SELECTION (project->priv->selection),
BRASERO_MEDIA_TYPE_WRITABLE|
BRASERO_MEDIA_TYPE_FILE);
@@ -1427,8 +1436,6 @@ brasero_project_switch (BraseroProject *project, BraseroProjectType type)
project->priv->message);
gtk_notebook_set_current_page (GTK_NOTEBOOK (project->priv->discs), 2);
- brasero_project_update_project_size (project, 0);
-
brasero_medium_selection_show_media_type (BRASERO_MEDIUM_SELECTION (project->priv->selection),
BRASERO_MEDIA_TYPE_WRITABLE|
BRASERO_MEDIA_TYPE_FILE);
@@ -1579,9 +1586,7 @@ brasero_project_set_none (BraseroProject *project)
project->priv->chooser = NULL;
}
- if (project->priv->current)
- brasero_disc_reset (project->priv->current);
-
+ brasero_project_reset (project);
project->priv->current = NULL;
/* update buttons/menus */
@@ -1606,42 +1611,6 @@ brasero_project_set_none (BraseroProject *project)
gtk_statusbar_pop (GTK_STATUSBAR (status), project->priv->status_ctx);
}
-/********************* update the appearance of menus and buttons **************/
-static void
-brasero_project_contents_changed_cb (BraseroDisc *disc,
- gint nb_files,
- BraseroProject *project)
-{
- GtkAction *action;
- gboolean sensitive;
-
- project->priv->empty = (nb_files == 0);
-
- if (brasero_disc_get_status (disc, NULL, NULL) != BRASERO_DISC_LOADING)
- project->priv->modified = 1;
-
- brasero_project_set_remove_button_state (project);
- brasero_project_set_add_button_state (project);
-
- action = gtk_action_group_get_action (project->priv->project_group, "DeleteAll");
- gtk_action_set_sensitive (action, (project->priv->empty == FALSE));
-
- /* the following button/action states depend on the project size too */
- sensitive = (project->priv->oversized == 0 &&
- project->priv->empty == 0);
-
- action = gtk_action_group_get_action (project->priv->project_group, "Burn");
- gtk_action_set_sensitive (action, sensitive);
- gtk_widget_set_sensitive (project->priv->burn, sensitive);
-
- /* the state of the following depends on the existence of an opened project */
- action = gtk_action_group_get_action (project->priv->project_group, "Save");
- if (project->priv->modified)
- gtk_action_set_sensitive (action, TRUE);
- else
- gtk_action_set_sensitive (action, FALSE);
-}
-
/**************************** manage the relations with the sources ************/
static void
brasero_project_transfer_uris_from_src (BraseroProject *project)
@@ -2088,8 +2057,6 @@ brasero_project_open_project (BraseroProject *project,
if (!track)
return BRASERO_PROJECT_TYPE_INVALID;
- brasero_project_update_project_size (project, 0);
-
if (track->type == BRASERO_PROJECT_TYPE_AUDIO)
type = BRASERO_PROJECT_TYPE_AUDIO;
else if (track->type == BRASERO_PROJECT_TYPE_DATA)
diff --git a/src/brasero-video-disc.c b/src/brasero-video-disc.c
index 59c0617..9c81489 100644
--- a/src/brasero-video-disc.c
+++ b/src/brasero-video-disc.c
@@ -33,6 +33,7 @@
#include "eggtreemultidnd.h"
#include "brasero-tags.h"
+#include "brasero-track-stream-cfg.h"
#include "brasero-misc.h"
#include "brasero-app.h"
@@ -40,7 +41,6 @@
#include "brasero-io.h"
#include "brasero-utils.h"
#include "brasero-video-disc.h"
-#include "brasero-video-project.h"
#include "brasero-video-tree-model.h"
#include "brasero-multi-song-props.h"
#include "brasero-song-properties.h"
@@ -184,8 +184,8 @@ brasero_video_disc_name_edited_cb (GtkCellRendererText *cellrenderertext,
BraseroVideoDisc *self)
{
BraseroVideoDiscPrivate *priv;
- BraseroVideoProject *project;
- BraseroVideoFile *file;
+ BraseroTrack *track;
+ GtkTreeModel *model;
GtkTreePath *path;
GtkTreeIter row;
@@ -194,47 +194,26 @@ brasero_video_disc_name_edited_cb (GtkCellRendererText *cellrenderertext,
priv->editing = 0;
path = gtk_tree_path_new_from_string (path_string);
- project = BRASERO_VIDEO_PROJECT (gtk_tree_view_get_model (GTK_TREE_VIEW (priv->tree)));
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->tree));
/* see if this is still a valid path. It can happen a user removes it
* while the name of the row is being edited */
- if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (project), &row, path)) {
+ if (!gtk_tree_model_get_iter (model, &row, path)) {
gtk_tree_path_free (path);
return;
}
- file = brasero_video_tree_model_path_to_file (BRASERO_VIDEO_TREE_MODEL (project), path);
+ track = brasero_video_tree_model_path_to_track (BRASERO_VIDEO_TREE_MODEL (model), path);
gtk_tree_path_free (path);
- brasero_video_project_rename (project, file, text);
-}
-
-static void
-brasero_video_disc_vfs_activity_changed (BraseroVideoProject *project,
- gboolean activity,
- BraseroVideoDisc *self)
-{
- GdkCursor *cursor;
- BraseroVideoDiscPrivate *priv;
-
- priv = BRASERO_VIDEO_DISC_PRIVATE (self);
-
- if (!GTK_WIDGET (self)->window)
- return;
+ brasero_track_tag_add_string (track, BRASERO_TRACK_STREAM_TITLE_TAG, text);
- if (activity) {
- cursor = gdk_cursor_new (GDK_WATCH);
- gdk_window_set_cursor (GTK_WIDGET (self)->window, cursor);
- gdk_cursor_unref (cursor);
- }
- else
- gdk_window_set_cursor (GTK_WIDGET (self)->window, NULL);
+ /* Advertize change to update view */
+ brasero_track_changed (track);
}
static gboolean
-brasero_video_disc_directory_dialog (BraseroVideoProject *project,
- const gchar *uri,
- BraseroVideoDisc *self)
+brasero_video_disc_directory_dialog (BraseroVideoDisc *self)
{
gint answer;
GtkWidget *dialog;
@@ -263,10 +242,9 @@ brasero_video_disc_directory_dialog (BraseroVideoProject *project,
}
static void
-brasero_video_disc_unreadable_uri_dialog (BraseroVideoProject *project,
- GError *error,
+brasero_video_disc_unreadable_uri_dialog (BraseroVideoDisc *self,
const gchar *uri,
- BraseroVideoDisc *self)
+ GError *error)
{
gchar *primary;
gchar *name;
@@ -282,9 +260,8 @@ brasero_video_disc_unreadable_uri_dialog (BraseroVideoProject *project,
}
static void
-brasero_video_disc_not_video_dialog (BraseroVideoProject *project,
- const gchar *uri,
- BraseroVideoDisc *self)
+brasero_video_disc_not_video_dialog (BraseroVideoDisc *self,
+ const gchar *uri)
{
gchar *primary;
gchar *name;
@@ -299,42 +276,135 @@ brasero_video_disc_not_video_dialog (BraseroVideoProject *project,
g_free (name);
}
+static void
+brasero_video_disc_session_changed (BraseroSessionCfg *session,
+ BraseroVideoDisc *self)
+{
+ GSList *next;
+ GSList *tracks;
+ gboolean notready;
+ BraseroStatus *status;
+ BraseroVideoDiscPrivate *priv;
+
+ priv = BRASERO_VIDEO_DISC_PRIVATE (self);
+
+ if (!GTK_WIDGET (self)->window)
+ return;
+
+ /* make sure all tracks have video */
+ notready = FALSE;
+ status = brasero_status_new ();
+ tracks = brasero_burn_session_get_tracks (BRASERO_BURN_SESSION (session));
+ for (; tracks; tracks = next) {
+ BraseroStreamFormat format;
+ BraseroTrackStream *track;
+ BraseroBurnResult result;
+
+ track = tracks->data;
+ next = tracks->next;
+
+ result = brasero_track_get_status (BRASERO_TRACK (track), status);
+ if (result == BRASERO_BURN_ERR) {
+ GError *error;
+ gboolean res;
+ gchar *uri;
+
+ uri = brasero_track_stream_get_source (track, TRUE);
+ error = brasero_status_get_error (status);
+ if (!error || error->code != BRASERO_BURN_ERROR_FILE_FOLDER)
+ brasero_video_disc_unreadable_uri_dialog (self, uri, error);
+ else {
+ res = brasero_video_disc_directory_dialog (self);
+ if (res) {
+
+ }
+ }
+
+ brasero_burn_session_remove_track (BRASERO_BURN_SESSION (session),
+ BRASERO_TRACK (track));
+ g_error_free (error);
+ g_free (uri);
+ continue;
+ }
+
+ if (result == BRASERO_BURN_NOT_READY) {
+ notready = TRUE;
+ continue;
+ }
+
+ if (result != BRASERO_BURN_OK)
+ continue;
+
+ format = brasero_track_stream_get_format (track);
+ if (!BRASERO_STREAM_FORMAT_HAS_VIDEO (format)) {
+ gchar *uri;
+
+ uri = brasero_track_stream_get_source (track, TRUE);
+ brasero_video_disc_not_video_dialog (self, uri);
+ g_free (uri);
+
+ brasero_burn_session_remove_track (BRASERO_BURN_SESSION (session),
+ BRASERO_TRACK (track));
+ }
+ }
+ brasero_status_free (status);
+}
+
static BraseroDiscResult
brasero_video_disc_add_uri_real (BraseroVideoDisc *self,
const gchar *uri,
+ BraseroStreamInfo *info,
gint pos,
gint64 start,
gint64 end,
GtkTreePath **path_return)
{
- BraseroVideoFile *file;
- BraseroVideoProject *project;
+ GtkTreeModel *model;
+ BraseroSessionCfg*session;
+ BraseroTrack *sibling = NULL;
+ BraseroTrackStreamCfg *track;
BraseroVideoDiscPrivate *priv;
- BraseroVideoFile *sibling = NULL;
priv = BRASERO_VIDEO_DISC_PRIVATE (self);
if (priv->reject_files)
return BRASERO_DISC_NOT_READY;
- project = BRASERO_VIDEO_PROJECT (gtk_tree_view_get_model (GTK_TREE_VIEW (priv->tree)));
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->tree));
+
+ /* create track */
+ track = brasero_track_stream_cfg_new ();
+ brasero_track_stream_set_source (BRASERO_TRACK_STREAM (track), uri);
+ brasero_track_stream_set_boundaries (BRASERO_TRACK_STREAM (track), start, end, 0);
+
+ if (info) {
+ brasero_track_tag_add_string (BRASERO_TRACK (track),
+ BRASERO_TRACK_STREAM_TITLE_TAG,
+ info->title);
+ brasero_track_tag_add_string (BRASERO_TRACK (track),
+ BRASERO_TRACK_STREAM_ARTIST_TAG,
+ info->artist);
+ brasero_track_tag_add_string (BRASERO_TRACK (track),
+ BRASERO_TRACK_STREAM_COMPOSER_TAG,
+ info->composer);
+
+ brasero_track_tag_add_int (BRASERO_TRACK (track),
+ BRASERO_TRACK_STREAM_ISRC_TAG,
+ info->isrc);
+ }
+ /* insert it in the session */
+ session = brasero_video_tree_model_get_session (BRASERO_VIDEO_TREE_MODEL (model));
if (pos > 0) {
- GtkTreePath *treepath;
+ GSList *tracks;
- treepath = gtk_tree_path_new ();
- gtk_tree_path_append_index (treepath, pos);
- sibling = brasero_video_tree_model_path_to_file (BRASERO_VIDEO_TREE_MODEL (project), treepath);
- gtk_tree_path_free (treepath);
+ tracks = brasero_burn_session_get_tracks (BRASERO_BURN_SESSION (session));
+ sibling = g_slist_nth_data (tracks, pos - 1);
}
+ brasero_burn_session_add_track (BRASERO_BURN_SESSION (session), BRASERO_TRACK (track), sibling);
- file = brasero_video_project_add_uri (project,
- uri,
- NULL,
- sibling,
- start,
- end);
- if (path_return && file)
- *path_return = brasero_video_tree_model_file_to_path (BRASERO_VIDEO_TREE_MODEL (project), file);
+ if (path_return)
+ *path_return = brasero_video_tree_model_track_to_path (BRASERO_VIDEO_TREE_MODEL (model),
+ BRASERO_TRACK (track));
gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), 1);
@@ -352,6 +422,7 @@ brasero_video_disc_add_uri (BraseroDisc *self,
priv = BRASERO_VIDEO_DISC_PRIVATE (self);
result = brasero_video_disc_add_uri_real (BRASERO_VIDEO_DISC (self),
uri,
+ NULL,
-1,
-1,
-1,
@@ -375,6 +446,7 @@ brasero_video_disc_delete_selected (BraseroDisc *self)
{
BraseroVideoDiscPrivate *priv;
GtkTreeSelection *selection;
+ BraseroSessionCfg *session;
GtkTreeModel *model;
GList *selected;
GList *iter;
@@ -385,19 +457,22 @@ brasero_video_disc_delete_selected (BraseroDisc *self)
selected = gtk_tree_selection_get_selected_rows (selection, &model);
selected = g_list_reverse (selected);
+
+ session = brasero_video_tree_model_get_session (BRASERO_VIDEO_TREE_MODEL (model));
+
for (iter = selected; iter; iter = iter->next) {
- BraseroVideoFile *file;
+ BraseroTrack *track;
GtkTreePath *treepath;
treepath = iter->data;
- file = brasero_video_tree_model_path_to_file (BRASERO_VIDEO_TREE_MODEL (model), treepath);
+ track = brasero_video_tree_model_path_to_track (BRASERO_VIDEO_TREE_MODEL (model), treepath);
gtk_tree_path_free (treepath);
- if (!file)
+ if (!track)
continue;
- brasero_video_project_remove_file (BRASERO_VIDEO_PROJECT (model), file);
+ brasero_burn_session_remove_track (BRASERO_BURN_SESSION (session), track);
}
g_list_free (selected);
}
@@ -419,13 +494,13 @@ brasero_video_disc_get_selected_uri (BraseroDisc *self,
return FALSE;
if (uri) {
- BraseroVideoFile *file;
+ BraseroTrack *track;
GtkTreePath *treepath;
treepath = selected->data;
- file = brasero_video_tree_model_path_to_file (BRASERO_VIDEO_TREE_MODEL (model), treepath);
- if (file)
- *uri = g_strdup (file->uri);
+ track = brasero_video_tree_model_path_to_track (BRASERO_VIDEO_TREE_MODEL (model), treepath);
+ if (track)
+ *uri = brasero_track_stream_get_source (BRASERO_TRACK_STREAM (track), TRUE);
else
*uri = NULL;
}
@@ -450,12 +525,14 @@ brasero_video_disc_selection_function (GtkTreeSelection *selection,
gboolean path_currently_selected,
gpointer NULL_data)
{
- BraseroVideoFile *file;
+ BraseroTrack *track;
- file = brasero_video_tree_model_path_to_file (BRASERO_VIDEO_TREE_MODEL (model), treepath);
- if (file)
- file->editable = !path_currently_selected;
+ track = brasero_video_tree_model_path_to_track (BRASERO_VIDEO_TREE_MODEL (model), treepath);
+ /* FIXME: add a tag?? */
+/* if (track)
+ file->editable = !path_currently_selected;
+*/
return TRUE;
}
@@ -471,16 +548,18 @@ brasero_video_disc_rename_songs (GtkTreeModel *model,
const gchar *old_name,
const gchar *new_name)
{
- BraseroVideoFile *file;
+ BraseroTrack *track;
- file = brasero_video_tree_model_path_to_file (BRASERO_VIDEO_TREE_MODEL (model), treepath);
- if (!file)
+ track = brasero_video_tree_model_path_to_track (BRASERO_VIDEO_TREE_MODEL (model), treepath);
+ if (!track)
return FALSE;
- if (file->info->title)
- g_free (file->info->title);
+ brasero_track_tag_add_string (track,
+ BRASERO_TRACK_STREAM_TITLE_TAG,
+ new_name);
- file->info->title = g_strdup (new_name);
+ /* Signal the change to have the view reflect it */
+ brasero_track_changed (track);
return TRUE;
}
@@ -533,32 +612,29 @@ brasero_video_disc_edit_song_properties_list (BraseroVideoDisc *self,
&isrc,
NULL);
- /* start by the end in case we add silences since then the next
- * treepaths will be wrong */
copy = g_list_copy (list);
copy = g_list_reverse (copy);
for (item = copy; item; item = item->next) {
GtkTreePath *treepath;
- BraseroVideoFile *file;
+ BraseroTrack *track;
treepath = item->data;
- file = brasero_video_tree_model_path_to_file (BRASERO_VIDEO_TREE_MODEL (model), treepath);
- if (!file)
+ track = brasero_video_tree_model_path_to_track (BRASERO_VIDEO_TREE_MODEL (model), treepath);
+ if (!track)
continue;
- if (artist) {
- g_free (file->info->artist);
- file->info->artist = g_strdup (artist);
- }
+ brasero_track_tag_add_string (track,
+ BRASERO_TRACK_STREAM_ARTIST_TAG,
+ artist);
- if (composer) {
- g_free (file->info->composer);
- file->info->composer = g_strdup (composer);
- }
+ brasero_track_tag_add_string (track,
+ BRASERO_TRACK_STREAM_COMPOSER_TAG,
+ composer);
- if (isrc > 0)
- file->info->isrc = isrc;
+ brasero_track_tag_add_int (track,
+ BRASERO_TRACK_STREAM_ISRC_TAG,
+ isrc);
}
g_list_free (copy);
@@ -571,7 +647,7 @@ end:
static void
brasero_video_disc_edit_song_properties_file (BraseroVideoDisc *self,
- BraseroVideoFile *file)
+ BraseroTrack *track)
{
gint isrc;
gint64 end;
@@ -580,6 +656,7 @@ brasero_video_disc_edit_song_properties_file (BraseroVideoDisc *self,
gchar *artist;
gchar *composer;
GtkWidget *props;
+ guint64 length = 0;
GtkWidget *toplevel;
GtkTreeModel *model;
GtkResponseType result;
@@ -590,16 +667,18 @@ brasero_video_disc_edit_song_properties_file (BraseroVideoDisc *self,
model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->tree));
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (self));
+ brasero_track_stream_get_length (BRASERO_TRACK_STREAM (track), &length);
+
props = brasero_song_props_new ();
brasero_song_props_set_properties (BRASERO_SONG_PROPS (props),
-1,
- file->info->artist,
- file->info->title,
- file->info->composer,
- file->info->isrc,
- file->end - file->start,
- file->start,
- file->end,
+ brasero_track_tag_lookup_string (track, BRASERO_TRACK_STREAM_ARTIST_TAG),
+ brasero_track_tag_lookup_string (track, BRASERO_TRACK_STREAM_TITLE_TAG),
+ brasero_track_tag_lookup_string (track, BRASERO_TRACK_STREAM_COMPOSER_TAG),
+ brasero_track_tag_lookup_int (track, BRASERO_TRACK_STREAM_ISRC_TAG),
+ length,
+ brasero_track_stream_get_start (BRASERO_TRACK_STREAM (track)),
+ brasero_track_stream_get_end (BRASERO_TRACK_STREAM (track)),
-1);
gtk_window_set_transient_for (GTK_WINDOW (props),
@@ -624,35 +703,37 @@ brasero_video_disc_edit_song_properties_file (BraseroVideoDisc *self,
NULL);
if (title) {
- if (file->info->title)
- g_free (file->info->title);
-
- file->info->title = title;
- file->title_set = TRUE;
+ brasero_track_tag_add_string (track,
+ BRASERO_TRACK_STREAM_TITLE_TAG,
+ title);
+ g_free (title);
}
if (artist) {
- if (file->info->artist)
- g_free (file->info->artist);
-
- file->info->artist = artist;
- file->artist_set = TRUE;
+ brasero_track_tag_add_string (track,
+ BRASERO_TRACK_STREAM_ARTIST_TAG,
+ artist);
+ g_free (artist);
}
if (composer) {
- if (file->info->composer)
- g_free (file->info->composer);
-
- file->info->composer = composer;
- file->composer_set = TRUE;
+ brasero_track_tag_add_string (track,
+ BRASERO_TRACK_STREAM_COMPOSER_TAG,
+ composer);
+ g_free (composer);
}
- if (isrc) {
- file->info->isrc = isrc;
- file->isrc_set = TRUE;
- }
+ if (isrc)
+ brasero_track_tag_add_int (track,
+ BRASERO_TRACK_STREAM_ISRC_TAG,
+ isrc);
- brasero_video_project_resize_file (BRASERO_VIDEO_PROJECT (model), file, start, end);
+ brasero_track_stream_set_boundaries (BRASERO_TRACK_STREAM (track),
+ start,
+ end,
+ 0);
+ /* Signal the change */
+ brasero_track_changed (track);
end:
@@ -677,14 +758,14 @@ brasero_video_disc_edit_information_cb (GtkAction *action,
return;
if (g_list_length (list) == 1) {
- BraseroVideoFile *file;
+ BraseroTrack *track;
GtkTreePath *treepath;
treepath = list->data;
- file = brasero_video_tree_model_path_to_file (BRASERO_VIDEO_TREE_MODEL (model), treepath);
- if (file)
- brasero_video_disc_edit_song_properties_file (self, file);
+ track = brasero_video_tree_model_path_to_track (BRASERO_VIDEO_TREE_MODEL (model), treepath);
+ if (track)
+ brasero_video_disc_edit_song_properties_file (self, track);
}
else
brasero_video_disc_edit_song_properties_list (self, list);
@@ -709,17 +790,19 @@ brasero_video_disc_open_file (BraseroVideoDisc *self)
list = gtk_tree_selection_get_selected_rows (selection, &model);
for (item = list; item; item = item->next) {
- BraseroVideoFile *file;
+ BraseroTrack *track;
+ gchar *uri;
treepath = item->data;
- file = brasero_video_tree_model_path_to_file (BRASERO_VIDEO_TREE_MODEL (model), treepath);
+ track = brasero_video_tree_model_path_to_track (BRASERO_VIDEO_TREE_MODEL (model), treepath);
gtk_tree_path_free (treepath);
- if (!file)
+ if (!track)
continue;
- if (file->uri)
- uris = g_slist_prepend (uris, file->uri);
+ uri = brasero_track_stream_get_source (BRASERO_TRACK_STREAM (track), TRUE);
+ if (uri)
+ uris = g_slist_prepend (uris, uri);
}
g_list_free (list);
@@ -758,6 +841,7 @@ brasero_video_disc_clipboard_text_cb (GtkClipboard *clipboard,
brasero_video_disc_add_uri_real (self,
uri,
+ NULL,
-1,
-1,
-1,
@@ -884,13 +968,13 @@ brasero_video_disc_button_pressed_cb (GtkTreeView *tree,
brasero_disc_selection_changed (BRASERO_DISC (self));
if (event->type == GDK_2BUTTON_PRESS) {
- BraseroVideoFile *file;
+ BraseroTrack *track;
GtkTreeModel *model;
model = gtk_tree_view_get_model (GTK_TREE_VIEW (tree));
- file = brasero_video_tree_model_path_to_file (BRASERO_VIDEO_TREE_MODEL (model), treepath);
- if (file)
- brasero_video_disc_edit_song_properties_file (self, file);
+ track = brasero_video_tree_model_path_to_track (BRASERO_VIDEO_TREE_MODEL (model), treepath);
+ if (track)
+ brasero_video_disc_edit_song_properties_file (self, track);
}
}
@@ -1002,64 +1086,12 @@ brasero_video_disc_key_released_cb (GtkTreeView *tree,
}
static void
-brasero_video_disc_row_deleted_cb (GtkTreeModel *model,
- GtkTreePath *path,
- BraseroVideoDisc *self)
-{
- BraseroVideoProject *project;
- BraseroVideoDiscPrivate *priv;
-
- priv = BRASERO_VIDEO_DISC_PRIVATE (self);
- project = BRASERO_VIDEO_PROJECT (gtk_tree_view_get_model (GTK_TREE_VIEW (priv->tree)));
- brasero_disc_contents_changed (BRASERO_DISC (self),
- brasero_video_project_get_file_num (BRASERO_VIDEO_PROJECT (model)));
-}
-
-static void
-brasero_video_disc_row_inserted_cb (GtkTreeModel *model,
- GtkTreePath *path,
- GtkTreeIter *iter,
- BraseroVideoDisc *self)
-{
- BraseroVideoProject *project;
- BraseroVideoDiscPrivate *priv;
-
- priv = BRASERO_VIDEO_DISC_PRIVATE (self);
- project = BRASERO_VIDEO_PROJECT (gtk_tree_view_get_model (GTK_TREE_VIEW (priv->tree)));
- brasero_disc_contents_changed (BRASERO_DISC (self),
- brasero_video_project_get_file_num (BRASERO_VIDEO_PROJECT (model)));
-}
-
-static void
-brasero_video_disc_row_changed_cb (GtkTreeModel *model,
- GtkTreePath *path,
- GtkTreeIter *iter,
- BraseroVideoDisc *self)
-{
- BraseroVideoProject *project;
- BraseroVideoDiscPrivate *priv;
-
- priv = BRASERO_VIDEO_DISC_PRIVATE (self);
- project = BRASERO_VIDEO_PROJECT (gtk_tree_view_get_model (GTK_TREE_VIEW (priv->tree)));
- brasero_disc_contents_changed (BRASERO_DISC (self),
- brasero_video_project_get_file_num (BRASERO_VIDEO_PROJECT (model)));
-}
-
-static void
-brasero_video_disc_size_changed_cb (BraseroVideoProject *project,
- BraseroVideoDisc *self)
-{
- brasero_disc_size_changed (BRASERO_DISC (self), brasero_video_project_get_size (project));
-}
-
-static void
brasero_video_disc_init (BraseroVideoDisc *object)
{
BraseroVideoDiscPrivate *priv;
GtkTreeSelection *selection;
GtkTreeViewColumn *column;
GtkCellRenderer *renderer;
- GtkTreeModel *model;
GtkWidget *mainbox;
GtkWidget *scroll;
@@ -1075,46 +1107,8 @@ brasero_video_disc_init (BraseroVideoDisc *object)
gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), mainbox, NULL);
gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), 0);
- /* Tree */
- model = GTK_TREE_MODEL (brasero_video_tree_model_new ());
-
- g_signal_connect (G_OBJECT (model),
- "row-deleted",
- G_CALLBACK (brasero_video_disc_row_deleted_cb),
- object);
- g_signal_connect (G_OBJECT (model),
- "row-inserted",
- G_CALLBACK (brasero_video_disc_row_inserted_cb),
- object);
- g_signal_connect (G_OBJECT (model),
- "row-changed",
- G_CALLBACK (brasero_video_disc_row_changed_cb),
- object);
-
- g_signal_connect (G_OBJECT (model),
- "size-changed",
- G_CALLBACK (brasero_video_disc_size_changed_cb),
- object);
- g_signal_connect (G_OBJECT (model),
- "not-video-uri",
- G_CALLBACK (brasero_video_disc_not_video_dialog),
- object);
- g_signal_connect (G_OBJECT (model),
- "directory-uri",
- G_CALLBACK (brasero_video_disc_directory_dialog),
- object);
- g_signal_connect (G_OBJECT (model),
- "unreadable-uri",
- G_CALLBACK (brasero_video_disc_unreadable_uri_dialog),
- object);
- g_signal_connect (G_OBJECT (model),
- "vfs-activity",
- G_CALLBACK (brasero_video_disc_vfs_activity_changed),
- object);
-
- priv->tree = gtk_tree_view_new_with_model (model);
+ priv->tree = gtk_tree_view_new ();
egg_tree_multi_drag_add_drag_support (GTK_TREE_VIEW (priv->tree));
- g_object_unref (G_OBJECT (model));
gtk_widget_show (priv->tree);
g_signal_connect (priv->tree,
@@ -1220,37 +1214,6 @@ brasero_video_disc_init (BraseroVideoDisc *object)
}
static void
-brasero_video_disc_reset_real (BraseroVideoDisc *self)
-{
- BraseroVideoProject *project;
- BraseroVideoDiscPrivate *priv;
-
- priv = BRASERO_VIDEO_DISC_PRIVATE (self);
- project = BRASERO_VIDEO_PROJECT (gtk_tree_view_get_model (GTK_TREE_VIEW (priv->tree)));
- brasero_video_project_reset (project);
- brasero_video_disc_vfs_activity_changed (project, FALSE, self);
-}
-
-static void
-brasero_video_disc_clear (BraseroDisc *disc)
-{
- BraseroVideoDiscPrivate *priv;
-
- priv = BRASERO_VIDEO_DISC_PRIVATE (disc);
-
- brasero_video_disc_reset_real (BRASERO_VIDEO_DISC (disc));
-
- gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), 0);
- brasero_disc_size_changed (disc, 0);
-}
-
-static void
-brasero_video_disc_reset (BraseroDisc *disc)
-{
- brasero_video_disc_reset_real (BRASERO_VIDEO_DISC (disc));
-}
-
-static void
brasero_video_disc_finalize (GObject *object)
{
G_OBJECT_CLASS (brasero_video_disc_parent_class)->finalize (object);
@@ -1296,46 +1259,41 @@ brasero_video_disc_set_property (GObject * object,
}
}
-static BraseroDiscResult
-brasero_video_disc_get_status (BraseroDisc *self,
- gint *remaining,
- gchar **current_task)
+static void
+brasero_video_disc_clear (BraseroDisc *disc)
{
- BraseroVideoProject *project;
BraseroVideoDiscPrivate *priv;
+ BraseroSessionCfg *session;
+ GtkTreeModel *model;
- priv = BRASERO_VIDEO_DISC_PRIVATE (self);
- project = BRASERO_VIDEO_PROJECT (gtk_tree_view_get_model (GTK_TREE_VIEW (priv->tree)));
- return brasero_video_project_get_status (project, remaining, current_task);
+ priv = BRASERO_VIDEO_DISC_PRIVATE (disc);
+
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->tree));
+ session = brasero_video_tree_model_get_session (BRASERO_VIDEO_TREE_MODEL (model));
+ brasero_burn_session_add_track (BRASERO_BURN_SESSION (session), NULL, NULL);
+
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), 0);
}
-BraseroDiscResult
+static BraseroDiscResult
brasero_video_disc_set_session_contents (BraseroDisc *self,
BraseroBurnSession *session)
{
- GSList *tracks, *iter;
- BraseroVideoProject *project;
+ BraseroVideoTreeModel *model;
BraseroVideoDiscPrivate *priv;
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, FALSE);
- if (!tracks)
- return BRASERO_DISC_ERROR_EMPTY_SELECTION;
+ model = brasero_video_tree_model_new ();
+ brasero_video_tree_model_set_session (model, BRASERO_SESSION_CFG (session));
+ gtk_tree_view_set_model (GTK_TREE_VIEW (priv->tree),
+ GTK_TREE_MODEL (model));
+ g_object_unref (model);
- for (iter = tracks; iter; iter = iter->next) {
- BraseroTrack *track;
-
- track = iter->data;
- brasero_burn_session_add_track (session, track);
-
- /* It's good practice to unref the track afterwards as we don't
- * need it anymore. BraseroBurnSession refs it. */
- g_object_unref (track);
-
- }
- g_slist_free (tracks);
+ g_signal_connect (session,
+ "is-valid",
+ G_CALLBACK (brasero_video_disc_session_changed),
+ self);
return BRASERO_DISC_OK;
}
@@ -1346,14 +1304,16 @@ brasero_video_disc_get_track (BraseroDisc *disc,
{
GSList *iter;
GSList *tracks;
- BraseroVideoProject *project;
+ GtkTreeModel *model;
+ BraseroSessionCfg *session;
BraseroVideoDiscPrivate *priv;
disc_track->type = BRASERO_PROJECT_TYPE_VIDEO;
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, TRUE);
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->tree));
+ session = brasero_video_tree_model_get_session (BRASERO_VIDEO_TREE_MODEL (model));
+ tracks = brasero_burn_session_get_tracks (BRASERO_BURN_SESSION (session));
for (iter = tracks; iter; iter = iter->next) {
BraseroDiscSong *song;
@@ -1379,9 +1339,6 @@ brasero_video_disc_get_track (BraseroDisc *disc,
disc_track->contents.tracks = g_slist_append (disc_track->contents.tracks, song);
}
- g_slist_foreach (tracks, (GFunc) g_object_unref, NULL);
- g_slist_free (tracks);
-
return BRASERO_DISC_OK;
}
@@ -1390,7 +1347,6 @@ brasero_video_disc_load_track (BraseroDisc *disc,
BraseroDiscTrack *track)
{
GSList *iter;
- BraseroVideoProject *project;
BraseroVideoDiscPrivate *priv;
g_return_val_if_fail (track->type == BRASERO_PROJECT_TYPE_VIDEO, FALSE);
@@ -1399,20 +1355,19 @@ brasero_video_disc_load_track (BraseroDisc *disc,
return BRASERO_DISC_ERROR_EMPTY_SELECTION;
priv = BRASERO_VIDEO_DISC_PRIVATE (disc);
- project = BRASERO_VIDEO_PROJECT (gtk_tree_view_get_model (GTK_TREE_VIEW (priv->tree)));
priv->loading = g_slist_length (track->contents.tracks);
for (iter = track->contents.tracks; iter; iter = iter->next) {
BraseroDiscSong *song;
song = iter->data;
-
- brasero_video_project_add_uri (BRASERO_VIDEO_PROJECT (project),
- song->uri,
- song->info,
- NULL,
- song->start,
- song->end);
+ brasero_video_disc_add_uri_real (BRASERO_VIDEO_DISC (disc),
+ song->uri,
+ song->info,
+ -1,
+ song->start,
+ song->end,
+ NULL);
}
gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), 1);
@@ -1425,9 +1380,7 @@ brasero_video_disc_iface_disc_init (BraseroDiscIface *iface)
iface->add_uri = brasero_video_disc_add_uri;
iface->delete_selected = brasero_video_disc_delete_selected;
iface->clear = brasero_video_disc_clear;
- iface->reset = brasero_video_disc_reset;
- iface->get_status = brasero_video_disc_get_status;
iface->set_session_contents = brasero_video_disc_set_session_contents;
iface->get_track = brasero_video_disc_get_track;
diff --git a/src/brasero-video-tree-model.c b/src/brasero-video-tree-model.c
index cd06776..46b4cf7 100644
--- a/src/brasero-video-tree-model.c
+++ b/src/brasero-video-tree-model.c
@@ -29,9 +29,11 @@
#include <gtk/gtk.h>
-#include "burn-basics.h"
+#include "brasero-session-cfg.h"
+#include "brasero-tags.h"
+#include "brasero-track-stream-cfg.h"
+
#include "brasero-utils.h"
-#include "brasero-video-project.h"
#include "brasero-video-tree-model.h"
#include "eggtreemultidnd.h"
@@ -39,6 +41,8 @@
typedef struct _BraseroVideoTreeModelPrivate BraseroVideoTreeModelPrivate;
struct _BraseroVideoTreeModelPrivate
{
+ BraseroSessionCfg *session;
+
guint stamp;
GtkIconTheme *theme;
};
@@ -56,7 +60,7 @@ brasero_video_tree_model_iface_init (gpointer g_iface, gpointer data);
G_DEFINE_TYPE_WITH_CODE (BraseroVideoTreeModel,
brasero_video_tree_model,
- BRASERO_TYPE_VIDEO_PROJECT,
+ G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_MODEL,
brasero_video_tree_model_iface_init)
G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_DRAG_DEST,
@@ -118,8 +122,11 @@ brasero_video_tree_model_get_value (GtkTreeModel *model,
{
BraseroVideoTreeModelPrivate *priv;
BraseroVideoTreeModel *self;
- BraseroVideoFile *file;
+ BraseroStatus *status;
+ BraseroTrack *track;
+ const gchar *string;
GdkPixbuf *pixbuf;
+ GValue *value_tag;
gchar *text;
self = BRASERO_VIDEO_TREE_MODEL (model);
@@ -129,20 +136,25 @@ brasero_video_tree_model_get_value (GtkTreeModel *model,
g_return_if_fail (priv->stamp == iter->stamp);
g_return_if_fail (iter->user_data != NULL);
- file = iter->user_data;
+ track = iter->user_data;
switch (column) {
case BRASERO_VIDEO_TREE_MODEL_NAME:
g_value_init (value, G_TYPE_STRING);
- if (file->info && file->info->title)
- g_value_set_string (value, file->info->title);
+ string = brasero_track_tag_lookup_string (track, BRASERO_TRACK_STREAM_TITLE_TAG);
+ if (string)
+ g_value_set_string (value, string);
else {
+ gchar *uri;
gchar *name;
gchar *path;
gchar *unescaped;
- unescaped = g_uri_unescape_string (file->uri, NULL);
+ uri = brasero_track_stream_get_source (BRASERO_TRACK_STREAM (track), TRUE);
+ unescaped = g_uri_unescape_string (uri, NULL);
+ g_free (uri);
+
path = g_filename_from_uri (unescaped, NULL, NULL);
g_free (unescaped);
@@ -156,13 +168,18 @@ brasero_video_tree_model_get_value (GtkTreeModel *model,
return;
case BRASERO_VIDEO_TREE_MODEL_MIME_ICON:
+ status = brasero_status_new ();
+ brasero_track_get_status (track, status);
+
g_value_init (value, GDK_TYPE_PIXBUF);
- if (file->snapshot) {
- pixbuf = file->snapshot;
- g_object_ref (file->snapshot);
- }
- else if (file->is_loading) {
+ value_tag = NULL;
+ brasero_track_tag_lookup (BRASERO_TRACK (track),
+ BRASERO_TRACK_STREAM_THUMBNAIL_TAG,
+ &value_tag);
+ if (value_tag)
+ pixbuf = g_value_dup_object (value_tag);
+ else if (brasero_status_get_result (status) == BRASERO_BURN_NOT_READY) {
pixbuf = gtk_icon_theme_load_icon (priv->theme,
"image-loading",
48,
@@ -178,27 +195,42 @@ brasero_video_tree_model_get_value (GtkTreeModel *model,
}
g_value_set_object (value, pixbuf);
+ brasero_status_free (status);
g_object_unref (pixbuf);
-
return;
case BRASERO_VIDEO_TREE_MODEL_SIZE:
+ status = brasero_status_new ();
+ brasero_track_get_status (track, status);
+
g_value_init (value, G_TYPE_STRING);
- if (!file->is_loading) {
- text = brasero_units_get_time_string (file->end - file->start, TRUE, FALSE);
+ if (brasero_status_get_result (status) == BRASERO_BURN_OK) {
+ guint64 len = 0;
+
+ brasero_track_stream_get_length (BRASERO_TRACK_STREAM (track), &len);
+ text = brasero_units_get_time_string (len, TRUE, FALSE);
g_value_set_string (value, text);
g_free (text);
}
else
g_value_set_string (value, _("(loading ...)"));
+ brasero_status_free (status);
return;
case BRASERO_VIDEO_TREE_MODEL_EDITABLE:
g_value_init (value, G_TYPE_BOOLEAN);
- g_value_set_boolean (value, file->editable);
+ /* This can be used for gap lines */
+ g_value_set_boolean (value, TRUE);
+ //g_value_set_boolean (value, file->editable);
+ return;
+ case BRASERO_VIDEO_TREE_MODEL_SELECTABLE:
+ g_value_init (value, G_TYPE_BOOLEAN);
+ /* This can be used for gap lines */
+ g_value_set_boolean (value, TRUE);
+ //g_value_set_boolean (value, file->editable);
return;
default:
@@ -209,17 +241,19 @@ brasero_video_tree_model_get_value (GtkTreeModel *model,
}
GtkTreePath *
-brasero_video_tree_model_file_to_path (BraseroVideoTreeModel *self,
- BraseroVideoFile *file)
+brasero_video_tree_model_track_to_path (BraseroVideoTreeModel *self,
+ BraseroTrack *track)
{
BraseroVideoTreeModelPrivate *priv;
GtkTreePath *path;
+ GSList *tracks;
guint nth;
priv = BRASERO_VIDEO_TREE_MODEL_PRIVATE (self);
path = gtk_tree_path_new ();
- nth = brasero_video_project_get_item_index (BRASERO_VIDEO_PROJECT (self), file);
+ tracks = brasero_burn_session_get_tracks (BRASERO_BURN_SESSION (priv->session));
+ nth = g_slist_index (tracks, track);
gtk_tree_path_prepend_index (path, nth);
return path;
@@ -230,9 +264,8 @@ brasero_video_tree_model_get_path (GtkTreeModel *model,
GtkTreeIter *iter)
{
BraseroVideoTreeModelPrivate *priv;
- BraseroVideoFile *file;
+ BraseroTrack *track;
GtkTreePath *path;
- guint nth;
priv = BRASERO_VIDEO_TREE_MODEL_PRIVATE (model);
@@ -240,22 +273,20 @@ brasero_video_tree_model_get_path (GtkTreeModel *model,
g_return_val_if_fail (priv->stamp == iter->stamp, NULL);
g_return_val_if_fail (iter->user_data != NULL, NULL);
- file = iter->user_data;
+ track = iter->user_data;
/* NOTE: there is only one single file without a name: root */
- path = gtk_tree_path_new ();
- nth = brasero_video_project_get_item_index (BRASERO_VIDEO_PROJECT (model), file);
- gtk_tree_path_prepend_index (path, nth);
-
+ path = brasero_video_tree_model_track_to_path (BRASERO_VIDEO_TREE_MODEL (model), track);
return path;
}
-BraseroVideoFile *
-brasero_video_tree_model_path_to_file (BraseroVideoTreeModel *self,
- GtkTreePath *path)
+BraseroTrack *
+brasero_video_tree_model_path_to_track (BraseroVideoTreeModel *self,
+ GtkTreePath *path)
{
BraseroVideoTreeModelPrivate *priv;
const gint *indices;
+ GSList *tracks;
guint depth;
priv = BRASERO_VIDEO_TREE_MODEL_PRIVATE (self);
@@ -268,7 +299,8 @@ brasero_video_tree_model_path_to_file (BraseroVideoTreeModel *self,
if (depth > 2)
return NULL;
- return brasero_video_project_get_nth_item (BRASERO_VIDEO_PROJECT (self), indices [0]);
+ tracks = brasero_burn_session_get_tracks (BRASERO_BURN_SESSION (priv->session));
+ return g_slist_nth_data (tracks, indices [0]);
}
static gboolean
@@ -277,23 +309,14 @@ brasero_video_tree_model_get_iter (GtkTreeModel *model,
GtkTreePath *path)
{
BraseroVideoTreeModelPrivate *priv;
- BraseroVideoFile *file;
- const gint *indices;
- guint depth;
+ BraseroTrack *track;
priv = BRASERO_VIDEO_TREE_MODEL_PRIVATE (model);
-
- depth = gtk_tree_path_get_depth (path);
- if (depth > 2)
+ track = brasero_video_tree_model_path_to_track (BRASERO_VIDEO_TREE_MODEL (model), path);
+ if (!track)
return FALSE;
- indices = gtk_tree_path_get_indices (path);
- file = brasero_video_project_get_nth_item (BRASERO_VIDEO_PROJECT (model),
- indices [0]);
- if (!file)
- return FALSE;
-
- iter->user_data = file;
+ iter->user_data = track;
iter->stamp = priv->stamp;
return TRUE;
@@ -304,7 +327,9 @@ brasero_video_tree_model_iter_next (GtkTreeModel *model,
GtkTreeIter *iter)
{
BraseroVideoTreeModelPrivate *priv;
- BraseroVideoFile *file;
+ BraseroTrack *track;
+ GSList *tracks;
+ GSList *node;
priv = BRASERO_VIDEO_TREE_MODEL_PRIVATE (model);
@@ -312,11 +337,16 @@ brasero_video_tree_model_iter_next (GtkTreeModel *model,
g_return_val_if_fail (priv->stamp == iter->stamp, FALSE);
g_return_val_if_fail (iter->user_data != NULL, FALSE);
- file = iter->user_data;
- if (!file || !file->next)
+ tracks = brasero_burn_session_get_tracks (BRASERO_BURN_SESSION (priv->session));
+ track = iter->user_data;
+ if (!track)
return FALSE;
- iter->user_data = file->next;
+ node = g_slist_find (tracks, track);
+ if (!node || !node->next)
+ return FALSE;
+
+ iter->user_data = node->next->data;
return TRUE;
}
@@ -337,6 +367,9 @@ brasero_video_tree_model_get_column_type (GtkTreeModel *model,
case BRASERO_VIDEO_TREE_MODEL_EDITABLE:
return G_TYPE_BOOLEAN;
+ case BRASERO_VIDEO_TREE_MODEL_SELECTABLE:
+ return G_TYPE_BOOLEAN;
+
default:
break;
}
@@ -403,14 +436,14 @@ brasero_video_tree_model_drag_data_received (GtkTreeDragDest *drag_dest,
GtkTreePath *dest_path,
GtkSelectionData *selection_data)
{
- BraseroVideoFile *file;
- BraseroVideoFile *sibling;
- BraseroVideoTreeModel *self;
+ BraseroTrack *track;
+ BraseroTrack *sibling;
+ BraseroVideoTreeModelPrivate *priv;
- self = BRASERO_VIDEO_TREE_MODEL (drag_dest);
+ priv = BRASERO_VIDEO_TREE_MODEL_PRIVATE (drag_dest);
/* The new row(s) must be before dest_path but after our sibling */
- sibling = brasero_video_tree_model_path_to_file (BRASERO_VIDEO_TREE_MODEL (drag_dest), dest_path);
+ sibling = brasero_video_tree_model_path_to_track (BRASERO_VIDEO_TREE_MODEL (drag_dest), dest_path);
/* Received data: see where it comes from:
* - from us, then that's a simple move
@@ -432,10 +465,12 @@ brasero_video_tree_model_drag_data_received (GtkTreeDragDest *drag_dest,
reference = iter->data;
treepath = gtk_tree_row_reference_get_path (reference);
- file = brasero_video_tree_model_path_to_file (BRASERO_VIDEO_TREE_MODEL (drag_dest), treepath);
+ track = brasero_video_tree_model_path_to_track (BRASERO_VIDEO_TREE_MODEL (drag_dest), treepath);
gtk_tree_path_free (treepath);
- brasero_video_project_move (BRASERO_VIDEO_PROJECT (self), file, sibling);
+ brasero_burn_session_move_track (BRASERO_BURN_SESSION (priv->session),
+ track,
+ sibling);
}
}
else if (selection_data->target == gdk_atom_intern ("text/uri-list", TRUE)) {
@@ -451,13 +486,14 @@ brasero_video_tree_model_drag_data_received (GtkTreeDragDest *drag_dest,
return TRUE;
for (i = 0; uris [i]; i ++) {
+ BraseroTrackStreamCfg *track;
+
/* Add the URIs to the project */
- brasero_video_project_add_uri (BRASERO_VIDEO_PROJECT (self),
- uris [i],
- NULL,
- sibling,
- -1,
- -1);
+ track = brasero_track_stream_cfg_new ();
+ brasero_track_stream_set_source (BRASERO_TRACK_STREAM (track), uris [i]);
+ brasero_burn_session_add_track (BRASERO_BURN_SESSION (priv->session),
+ BRASERO_TRACK (track),
+ sibling);
}
g_strfreev (uris);
}
@@ -484,120 +520,133 @@ brasero_video_tree_model_drag_data_delete (GtkTreeDragSource *source,
}
static void
-brasero_video_tree_model_clear (BraseroVideoTreeModel *self,
- guint num_files)
-{
- GtkTreePath *treepath;
- BraseroVideoTreeModelPrivate *priv;
-
- priv = BRASERO_VIDEO_TREE_MODEL_PRIVATE (self);
-
- /* NOTE: no need to move to the next row since previous one was deleted */
- treepath = gtk_tree_path_new_first ();
- while (num_files > 0) {
- num_files --;
- gtk_tree_model_row_deleted (GTK_TREE_MODEL (self), treepath);
- }
- gtk_tree_path_free (treepath);
-}
-
-static void
-brasero_video_tree_model_reset (BraseroVideoProject *project,
- guint num_files)
-{
- brasero_video_tree_model_clear (BRASERO_VIDEO_TREE_MODEL (project), num_files);
-
- /* chain up this function except if we invalidated the file */
- if (BRASERO_VIDEO_PROJECT_CLASS (brasero_video_tree_model_parent_class)->reset)
- BRASERO_VIDEO_PROJECT_CLASS (brasero_video_tree_model_parent_class)->reset (project, num_files);
-}
-
-static gboolean
-brasero_video_tree_model_file_added (BraseroVideoProject *project,
- BraseroVideoFile *file)
+brasero_video_tree_model_track_added (BraseroBurnSession *session,
+ BraseroTrack *track,
+ BraseroVideoTreeModel *model)
{
BraseroVideoTreeModelPrivate *priv;
+ BraseroStatus *status;
GtkTreePath *path;
GtkTreeIter iter;
- priv = BRASERO_VIDEO_TREE_MODEL_PRIVATE (project);
+ priv = BRASERO_VIDEO_TREE_MODEL_PRIVATE (model);
iter.stamp = priv->stamp;
- iter.user_data = file;
+ iter.user_data = track;
- path = brasero_video_tree_model_file_to_path (BRASERO_VIDEO_TREE_MODEL (project), file);
+ path = brasero_video_tree_model_track_to_path (model, track);
/* if the file is reloading (because of a file system change or because
* it was a file that was a tmp folder) then no need to signal an added
* signal but a changed one */
- if (file->is_reloading) {
- gtk_tree_model_row_changed (GTK_TREE_MODEL (project),
- path,
- &iter);
- gtk_tree_path_free (path);
- goto end;
- }
-
- /* Add the row itself */
- gtk_tree_model_row_inserted (GTK_TREE_MODEL (project),
+ status = brasero_status_new ();
+ brasero_track_get_status (track, status);
+ gtk_tree_model_row_inserted (GTK_TREE_MODEL (model),
path,
&iter);
gtk_tree_path_free (path);
-
-end:
- /* chain up this function */
- if (BRASERO_VIDEO_PROJECT_CLASS (brasero_video_tree_model_parent_class)->node_added)
- return BRASERO_VIDEO_PROJECT_CLASS (brasero_video_tree_model_parent_class)->node_added (project,
- file);
-
- return TRUE;
+ brasero_status_free (status);
}
static void
-brasero_video_tree_model_file_removed (BraseroVideoProject *project,
- BraseroVideoFile *file)
+brasero_video_tree_model_track_removed (BraseroBurnSession *session,
+ BraseroTrack *track,
+ guint former_location,
+ BraseroVideoTreeModel *model)
{
BraseroVideoTreeModelPrivate *priv;
- BraseroVideoFile *next;
GtkTreePath *path;
- priv = BRASERO_VIDEO_TREE_MODEL_PRIVATE (project);
+ priv = BRASERO_VIDEO_TREE_MODEL_PRIVATE (model);
/* remove the file. */
- next = file->next;
- path = brasero_video_tree_model_file_to_path (BRASERO_VIDEO_TREE_MODEL (project), next);
- gtk_tree_model_row_deleted (GTK_TREE_MODEL (project), path);
+ path = gtk_tree_path_new_from_indices (former_location, -1);
+ gtk_tree_model_row_deleted (GTK_TREE_MODEL (model), path);
gtk_tree_path_free (path);
-
- /* chain up this function */
- if (BRASERO_VIDEO_PROJECT_CLASS (brasero_video_tree_model_parent_class)->node_removed)
- BRASERO_VIDEO_PROJECT_CLASS (brasero_video_tree_model_parent_class)->node_removed (project,
- file);
}
static void
-brasero_video_tree_model_file_changed (BraseroVideoProject *project,
- BraseroVideoFile *file)
+brasero_video_tree_model_track_changed (BraseroBurnSession *session,
+ BraseroTrack *track,
+ BraseroVideoTreeModel *model)
{
BraseroVideoTreeModelPrivate *priv;
+ GValue *value = NULL;
GtkTreePath *path;
GtkTreeIter iter;
- priv = BRASERO_VIDEO_TREE_MODEL_PRIVATE (project);
+ priv = BRASERO_VIDEO_TREE_MODEL_PRIVATE (model);
+
+ /* scale the thumbnail */
+ brasero_track_tag_lookup (BRASERO_TRACK (track),
+ BRASERO_TRACK_STREAM_THUMBNAIL_TAG,
+ &value);
+ if (value) {
+ GdkPixbuf *scaled;
+ GdkPixbuf *snapshot;
+
+ snapshot = g_value_get_object (value);
+ scaled = gdk_pixbuf_scale_simple (snapshot,
+ 48 * gdk_pixbuf_get_width (snapshot) / gdk_pixbuf_get_height (snapshot),
+ 48,
+ GDK_INTERP_BILINEAR);
+
+ value = g_new0 (GValue, 1);
+ g_value_init (value, GDK_TYPE_PIXBUF);
+ g_value_set_object (value, scaled);
+ brasero_track_tag_add (track,
+ BRASERO_TRACK_STREAM_THUMBNAIL_TAG,
+ value);
+ }
/* Get the iter for the file */
iter.stamp = priv->stamp;
- iter.user_data = file;
+ iter.user_data = track;
- path = brasero_video_tree_model_file_to_path (BRASERO_VIDEO_TREE_MODEL (project), file);
- gtk_tree_model_row_changed (GTK_TREE_MODEL (project),
+ path = brasero_video_tree_model_track_to_path (model, track);
+ gtk_tree_model_row_changed (GTK_TREE_MODEL (model),
path,
&iter);
gtk_tree_path_free (path);
+}
+
+void
+brasero_video_tree_model_set_session (BraseroVideoTreeModel *model,
+ BraseroSessionCfg *session)
+{
+ BraseroVideoTreeModelPrivate *priv;
- /* chain up this function */
- if (BRASERO_VIDEO_PROJECT_CLASS (brasero_video_tree_model_parent_class)->node_changed)
- BRASERO_VIDEO_PROJECT_CLASS (brasero_video_tree_model_parent_class)->node_changed (project, file);
+ priv = BRASERO_VIDEO_TREE_MODEL_PRIVATE (model);
+ if (priv->session) {
+ g_object_unref (priv->session);
+ priv->session = NULL;
+ }
+
+ if (!session)
+ return;
+
+ priv->session = g_object_ref (session);
+ g_signal_connect (session,
+ "track-added",
+ G_CALLBACK (brasero_video_tree_model_track_added),
+ model);
+ g_signal_connect (session,
+ "track-removed",
+ G_CALLBACK (brasero_video_tree_model_track_removed),
+ model);
+ g_signal_connect (session,
+ "track-changed",
+ G_CALLBACK (brasero_video_tree_model_track_changed),
+ model);
+}
+
+BraseroSessionCfg *
+brasero_video_tree_model_get_session (BraseroVideoTreeModel *model)
+{
+ BraseroVideoTreeModelPrivate *priv;
+
+ priv = BRASERO_VIDEO_TREE_MODEL_PRIVATE (model);
+ return priv->session;
}
static void
@@ -703,16 +752,10 @@ static void
brasero_video_tree_model_class_init (BraseroVideoTreeModelClass *klass)
{
GObjectClass* object_class = G_OBJECT_CLASS (klass);
- BraseroVideoProjectClass *video_class = BRASERO_VIDEO_PROJECT_CLASS (klass);
g_type_class_add_private (klass, sizeof (BraseroVideoTreeModelPrivate));
object_class->finalize = brasero_video_tree_model_finalize;
-
- video_class->reset = brasero_video_tree_model_reset;
- video_class->node_added = brasero_video_tree_model_file_added;
- video_class->node_removed = brasero_video_tree_model_file_removed;
- video_class->node_changed = brasero_video_tree_model_file_changed;
}
BraseroVideoTreeModel *
diff --git a/src/brasero-video-tree-model.h b/src/brasero-video-tree-model.h
index 9e45b2f..09999cc 100644
--- a/src/brasero-video-tree-model.h
+++ b/src/brasero-video-tree-model.h
@@ -25,6 +25,9 @@
#include <glib-object.h>
+#include "brasero-track.h"
+#include "brasero-session-cfg.h"
+
G_BEGIN_DECLS
/* This DND target when moving nodes inside ourselves */
@@ -41,6 +44,7 @@ typedef enum {
BRASERO_VIDEO_TREE_MODEL_MIME_ICON,
BRASERO_VIDEO_TREE_MODEL_SIZE,
BRASERO_VIDEO_TREE_MODEL_EDITABLE,
+ BRASERO_VIDEO_TREE_MODEL_SELECTABLE,
BRASERO_VIDEO_TREE_MODEL_COL_NUM
} BraseroVideoProjectColumn;
@@ -56,12 +60,12 @@ typedef struct _BraseroVideoTreeModel BraseroVideoTreeModel;
struct _BraseroVideoTreeModelClass
{
- BraseroVideoProjectClass parent_class;
+ GObjectClass parent_class;
};
struct _BraseroVideoTreeModel
{
- BraseroVideoProject parent_instance;
+ GObject parent_instance;
};
GType brasero_video_tree_model_get_type (void) G_GNUC_CONST;
@@ -69,12 +73,19 @@ GType brasero_video_tree_model_get_type (void) G_GNUC_CONST;
BraseroVideoTreeModel *
brasero_video_tree_model_new (void);
-BraseroVideoFile *
-brasero_video_tree_model_path_to_file (BraseroVideoTreeModel *self,
- GtkTreePath *path);
+void
+brasero_video_tree_model_set_session (BraseroVideoTreeModel *model,
+ BraseroSessionCfg *session);
+BraseroSessionCfg *
+brasero_video_tree_model_get_session (BraseroVideoTreeModel *model);
+
+BraseroTrack *
+brasero_video_tree_model_path_to_track (BraseroVideoTreeModel *self,
+ GtkTreePath *path);
+
GtkTreePath *
-brasero_video_tree_model_file_to_path (BraseroVideoTreeModel *self,
- BraseroVideoFile *file);
+brasero_video_tree_model_track_to_path (BraseroVideoTreeModel *self,
+ BraseroTrack *track);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]